3
2
yuedefeng преди 6 години
родител
ревизия
9e425d9b83

+ 2 - 2
src/dashoo.cn/backend/api/business/role/roleService.go

@@ -23,9 +23,9 @@ func GetRoleService(xormEngine *xorm.Engine) *RoleService {
 func (s *RoleService) GetRoleList(pageIndex, itemsPerPage int64, order, userid string, entitiesPtr *[]userRole.Base_Role, where ...string) (total int64) {
 	var resultsSlice []map[string][]byte
 	var search string = "1=1"
-	rids := s.GetRoleids(userid)
+	/*rids := s.GetRoleids(userid)
 
-	search = search + " and Id in (" + strings.Join(rids, ",") + ")"
+	search = search + " and Id in (" + strings.Join(rids, ",") + ")"*/
 
 	if len(where) > 0 {
 		search = search + " and " + where[0]

+ 296 - 9
src/dashoo.cn/backend/api/business/workflow/ActivitiService.go

@@ -20,11 +20,11 @@ import (
 )
 
 type ActivitiService struct {
-	BaseUrl		string
-	AposeUrl	string
-	OriginUrl	string
-	Username 	string
-	Password 	string
+	BaseUrl   string
+	AposeUrl  string
+	OriginUrl string
+	Username  string
+	Password  string
 	ServiceBase
 }
 
@@ -32,12 +32,12 @@ func GetActivitiService(xormEngine *xorm.Engine) *ActivitiService {
 	s := new(ActivitiService)
 	s.DBE = xormEngine
 	//s.BaseUrl = "http://123.56.168.26:8080/activiti-rest/service"
-	//s.BaseUrl = "http://192.168.0.167:8081/api/acti"
-	s.BaseUrl = "http://47.92.212.59:8080/acti-api/api/acti"
+	//s.BaseUrl = "http://192.168.0.120:8081/api/acti"
+	s.BaseUrl = utils.Cfg.MustValue("workflow", "BaseUrl")
 	//s.BaseUrl = "http://localhost:8081/api/acti"
-	s.AposeUrl = "http://47.92.212.59:8080/acti-api/api/apose"
+	s.AposeUrl = utils.Cfg.MustValue("workflow", "AposeUrl")
 	//s.OriginUrl = "http://localhost:8081/api"
-	s.OriginUrl = "http://47.92.212.59:8080/acti-api/api"
+	s.OriginUrl = utils.Cfg.MustValue("workflow", "OriginUrl")
 	//s.AposeUrl = "http://localhost:8081/api/apose"
 	//s.AposeUrl = "http://192.168.0.171:8081/api/apose"
 	s.Username = "leader"
@@ -117,6 +117,31 @@ func (this *ActivitiService) StartProcess(processKey string, formEntityId string
 	return string(p)
 }
 
+func (this *ActivitiService) StartProcess2(processKey, formEntityId, userNames, result, supplierType, supplierName string) string {
+	/*vars := make(map[string]string)
+	vars["processDefinitionKey"] = processKey
+	vars["formEntityId"] = formEntityId*/
+	/*params := "processDefinitionKey="+processKey+"&formEntityId"+formEntityId*/
+	var ActiProcess ActiProcessVM
+	ActiProcess.ProcessKey = processKey
+	ActiProcess.BusinessKey = formEntityId
+	ActiProcess.UserNames = userNames
+	ActiProcess.Result = result
+	ActiProcess.WfType = supplierType
+	ActiProcess.SupplierName = supplierName
+
+	json, err := json.Marshal(ActiProcess)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(json)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/start-process-bytype", params, "")
+	p, _ := ioutil.ReadAll(retVal.Body)
+	return string(p)
+}
+
 func (this *ActivitiService) TaskComplete(processKey string, formEntityId string, userNames string, userId string, result string, remarks string) string {
 
 	var ActiComplete ActiCompleteVM
@@ -138,6 +163,46 @@ func (this *ActivitiService) TaskComplete(processKey string, formEntityId string
 	return string(p)
 }
 
+func (this *ActivitiService) TaskComplete2(ActiComplete ActiCompleteVM) string {
+
+	jsonParams, err := json.Marshal(ActiComplete)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParams)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/task-complete", params, "")
+	p, _ := ioutil.ReadAll(retVal.Body)
+	return string(p)
+}
+
+/*func (this *ActivitiService) MultiTaskComplete(processKey string, formEntityId string, userNames string, multiOrgAudits []MultiOrgAuditVM, userId string, result string, remarks string, callbackUrl string) string {
+
+var ActiComplete MultiActiCompleteVM
+ActiComplete.ProcessKey = processKey
+ActiComplete.BusinessKey = formEntityId
+ActiComplete.UserNames = userNames
+ActiComplete.MultiOrgAudits = multiOrgAudits
+ActiComplete.UserId = userId
+ActiComplete.Result = result
+ActiComplete.Remarks = remarks
+ActiComplete.CallbackUrl = callbackUrl*/
+
+func (this *ActivitiService) MultiTaskComplete(ActiComplete MultiActiCompleteVM) string {
+
+	jsonParams, err := json.Marshal(ActiComplete)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParams)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/multi-task-complete", params, "")
+	p, _ := ioutil.ReadAll(retVal.Body)
+	return string(p)
+}
+
 func (this *ActivitiService) GetMyTasks(processKey string, userId string) string {
 	var ActiMyTasks ActiMyTasksVM
 	ActiMyTasks.ProcessKey = processKey
@@ -155,6 +220,91 @@ func (this *ActivitiService) GetMyTasks(processKey string, userId string) string
 	return string(p)
 }
 
+func (this *ActivitiService) GetMyTasksWithTime(processKey string, userId string) []ActiMyTasksRetWithTimeVM {
+	var ActiMyTasks ActiMyTasksVM
+	ActiMyTasks.ProcessKey = processKey
+	ActiMyTasks.UserId = userId
+	jsonParam, err := json.Marshal(ActiMyTasks)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/my-tasks-with-time", params, "")
+
+	p, _ := ioutil.ReadAll(retVal.Body)
+	myTasksRetWithTimes := make([]ActiMyTasksRetWithTimeVM, 0)
+	json.Unmarshal(p, &myTasksRetWithTimes)
+	return myTasksRetWithTimes
+}
+
+
+func (this *ActivitiService) GetMyFinishedTasksWithTime(processKey string, userId string) []ActiMyTasksRetWithTimeVM {
+	var ActiMyTasks ActiMyTasksVM
+	ActiMyTasks.ProcessKey = processKey
+	ActiMyTasks.UserId = userId
+	jsonParam, err := json.Marshal(ActiMyTasks)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/my-finished-tasks-with-time", params, "")
+
+	p, _ := ioutil.ReadAll(retVal.Body)
+	myTasksRetWithTimes := make([]ActiMyTasksRetWithTimeVM, 0)
+	json.Unmarshal(p, &myTasksRetWithTimes)
+	return myTasksRetWithTimes
+}
+
+func (this *ActivitiService) GetMyAllTypePagingTasksWithTime(userId string, PageIndex, PageSize int64, wfName, wfType, supplierName string) ActiMyPagingResultVM {
+	var myPagingTasks ActiMyPagingTasksVM
+	myPagingTasks.UserId = userId
+	myPagingTasks.PageIndex = PageIndex
+	myPagingTasks.PageSize = PageSize
+	myPagingTasks.WfName = wfName
+	myPagingTasks.WfType = wfType
+	myPagingTasks.SupplierName = supplierName
+	jsonParam, err := json.Marshal(myPagingTasks)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/my-all-type-paging-tasks-with-time", params, "")
+
+	p, _ := ioutil.ReadAll(retVal.Body)
+	var myTasksRetWithTimes ActiMyPagingResultVM
+	json.Unmarshal(p, &myTasksRetWithTimes)
+	return myTasksRetWithTimes
+}
+
+func (this *ActivitiService) GetMyAllTypePagingFinishedTasksWithTime(userId string, PageIndex, PageSize int64, wfName, wfType, supplierName string) ActiMyPagingResultVM {
+	var myPagingTasks ActiMyPagingTasksVM
+	myPagingTasks.UserId = userId
+	myPagingTasks.PageIndex = PageIndex
+	myPagingTasks.PageSize = PageSize
+	myPagingTasks.WfName = wfName
+	myPagingTasks.WfType = wfType
+	myPagingTasks.SupplierName = supplierName
+	jsonParam, err := json.Marshal(myPagingTasks)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/my-all-type-paging-finished-tasks-with-time", params, "")
+
+	p, _ := ioutil.ReadAll(retVal.Body)
+	var myTasksRetWithTimes ActiMyPagingResultVM
+	json.Unmarshal(p, &myTasksRetWithTimes)
+	return myTasksRetWithTimes
+}
+
 func (this *ActivitiService) GetHistoricTasks(processKey string, businessKey string, processInstanceId string) []ActiHistoricTask {
 	var ActiProcess ActiProcessVM
 	ActiProcess.ProcessKey = processKey
@@ -175,6 +325,26 @@ func (this *ActivitiService) GetHistoricTasks(processKey string, businessKey str
 	return historicTasks
 }
 
+func (this *ActivitiService) GetHistoricMultiTasks(processKey string, businessKey string, processInstanceId string) []ActiHistoricTask {
+	var ActiProcess ActiProcessVM
+	ActiProcess.ProcessKey = processKey
+	ActiProcess.BusinessKey = businessKey
+	ActiProcess.ProcessInstanceId = processInstanceId
+	jsonParam, err := json.Marshal(ActiProcess)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/historic-multi-tasks", params, "")
+	jsonblob, _ := ioutil.ReadAll(retVal.Body)
+	//	var historicTasks []ActiHistoricTask
+	historicTasks := make([]ActiHistoricTask, 0)
+	json.Unmarshal(jsonblob, &historicTasks)
+	return historicTasks
+}
+
 func (this *ActivitiService) GetActivitiProccessImage(processInstanceId string) []byte {
 	var ActiProcess ActiProcessVM
 	ActiProcess.ProcessInstanceId = processInstanceId
@@ -206,6 +376,24 @@ func (this *ActivitiService) GetHistoryMyTasks(processKey string, userId string)
 	return string(p)
 }
 
+func (this *ActivitiService) GetAllMyTasks(processKey string, userId string) string {
+	var ActiMyTasks ActiMyTasksVM
+	ActiMyTasks.ProcessKey = processKey
+	ActiMyTasks.UserId = userId
+	json, err := json.Marshal(ActiMyTasks)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(json)
+	fmt.Println(params)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post("/my-tasks-finished", params, "")
+	p, _ := ioutil.ReadAll(retVal.Body)
+	retVal2 := this.Post("/my-tasks", params, "")
+	p2, _ := ioutil.ReadAll(retVal2.Body)
+	return string(p) + "," + string(p2)
+}
+
 func (this *ActivitiService) ExcelToPdf(addressUrl string) string {
 	var aposeVM AposeVM
 	aposeVM.AddressUrl = addressUrl
@@ -300,6 +488,53 @@ func (this *ActivitiService) WordToPdf(addressUrl string) string {
 	return retDocUrl
 }
 
+func (this *ActivitiService) WordToPdfWithWatermark(wartermark, addressUrl string) string {
+	var aposeVM AposeVM
+	aposeVM.AddressUrl = addressUrl
+	aposeVM.Watermark = wartermark
+	fmt.Println("==addressUrl===", addressUrl)
+	jsonParam, err := json.Marshal(aposeVM)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.Post2("/word-to-pdf-watermark", params, "")
+	if retVal.StatusCode != 200 {
+		return ""
+	}
+	//pdfByte, err := ioutil.ReadAll(retVal.Body)
+	//ioutil.WriteFile("E:\aa.pdf", pdfByte, 777)
+	//模板下载到服务器
+	_dir := utils.Cfg.MustValue("file", "tmplateDir") + "pdf"
+	utils.CreatePath(_dir)
+	_dir += "/tmp_" + strconv.Itoa(int(time.Now().Unix())) + ".pdf"
+	raw := retVal.Body
+	defer raw.Close()
+
+	file, err := os.Create(_dir)
+	defer file.Close()
+	writer := bufio.NewWriter(file)
+	defer writer.Flush()
+	body, err := ioutil.ReadAll(raw)
+	writer.Write(body)
+
+	if err != nil {
+		return ""
+	}
+	var sw *Seaweed
+	var filer []string
+	if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
+		filer = []string{_filer}
+	}
+	sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
+	//_, fID, err := sw.Upload(retVal.Body, "tmp.pdf", int64(len(pdfByte)), "", "")
+	_, _, fID, err := sw.UploadFile(_dir, "", "")
+	retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	os.Remove(_dir)
+	fmt.Println("==retDocUrl==", retDocUrl)
+	return retDocUrl
+}
 
 func (this *ActivitiService) FillWordTemplate(datas map[string]interface{}, templateUrl string, fileName string) string {
 	var wordTempVM WordTemplateVM
@@ -349,3 +584,55 @@ func (this *ActivitiService) FillWordTemplate(datas map[string]interface{}, temp
 	fmt.Println("==retDocUrl==", retDocUrl)
 	return retDocUrl
 }
+
+// 带水印
+func (this *ActivitiService) FillWordWatermarkTemplate(datas map[string]interface{}, templateUrl string, fileName,watermark string) string {
+	var wordTempVM WordTemplateWatermarkVM
+	wordTempVM.Datas = datas
+	wordTempVM.TemplateUrl = templateUrl
+	wordTempVM.FileName = fileName
+	wordTempVM.Watermark = watermark
+
+	fmt.Println("==templateWatermarkUrl===", templateUrl)
+	jsonParam, err := json.Marshal(wordTempVM)
+	if err != nil {
+		fmt.Println(err, "生成json字符串错误")
+	}
+	params := string(jsonParam)
+	//token = Authorization(this.Username, this.Password)
+	retVal := this.PostOrigin("/word/fill-word-watermark", params, "")
+	if retVal.StatusCode != 200 {
+		return ""
+	}
+	//pdfByte, err := ioutil.ReadAll(retVal.Body)
+	//ioutil.WriteFile("E:\aa.pdf", pdfByte, 777)
+	//模板下载到服务器
+	_dir := utils.Cfg.MustValue("file", "tmplateDir") + "word"
+	utils.CreatePath(_dir)
+	_dir += "/tmp_" + strconv.Itoa(int(time.Now().Unix())) + ".docx"
+	raw := retVal.Body
+	defer raw.Close()
+
+	file, err := os.Create(_dir)
+	defer file.Close()
+	writer := bufio.NewWriter(file)
+	defer writer.Flush()
+	body, err := ioutil.ReadAll(raw)
+	writer.Write(body)
+
+	if err != nil {
+		return ""
+	}
+	var sw *Seaweed
+	var filer []string
+	if _filer := os.Getenv("GOSWFS_FILER_URL"); _filer != "" {
+		filer = []string{_filer}
+	}
+	sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
+	//_, fID, err := sw.Upload(retVal.Body, "tmp.pdf", int64(len(pdfByte)), "", "")
+	_, _, fID, err := sw.UploadFile(_dir, "", "")
+	retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	os.Remove(_dir)
+	fmt.Println("==retDocWatermarkUrl==", retDocUrl)
+	return retDocUrl
+}

+ 51 - 0
src/dashoo.cn/backend/api/business/workflow/workflow.go

@@ -7,6 +7,9 @@ type ActiProcessVM struct {
 	BusinessKey       string `json:"businessKey"`
 	ProcessInstanceId string `json:"processInstanceId"`
 	UserNames         string `json:"userNames"`
+	Result         	  string `json:"result"`
+	WfType     		  string `json:"type"`
+	SupplierName      string `json:"supplierName"`
 }
 
 type ActiCompleteVM struct {
@@ -16,6 +19,7 @@ type ActiCompleteVM struct {
 	UserId      string `json:"userId"`
 	Result      string `json:"result"`
 	Remarks     string `json:"remarks"`
+	CallbackUrl string `json:"callbackUrl"`
 }
 
 type ActiMyTasksVM struct {
@@ -23,6 +27,28 @@ type ActiMyTasksVM struct {
 	UserId     string `json:"userId"`
 }
 
+type ActiMyTasksRetWithTimeVM struct {
+	ProcessDefinitionId string `json:"processDefinitionId"`
+	TaskName 			string `json:"taskName"`
+	BusinessKey 		string `json:"businessKey"`
+	WorkflowId  		string `json:"workflowId"`
+	CreateTime  		int64  `json:"createTime"`
+}
+
+type ActiMyPagingTasksVM struct {
+	UserId     		string `json:"userId"`
+	PageIndex  		int64  `json:"pageIndex"`
+	PageSize   		int64  `json:"pageSize"`
+	WfName     		string `json:"wfName"`
+	WfType     		string `json:"type"`
+	SupplierName    string `json:"supplierName"`
+}
+
+type ActiMyPagingResultVM struct {
+	Total   int64  `json:"total"`
+	TaskList []ActiMyTasksRetWithTimeVM  `json:"taskDTOList"`
+}
+
 type ActiHistoricTask struct {
 	BusinessKey       string `json:"businessKey"`
 	TaskName          string `json:"taskName"`
@@ -38,6 +64,7 @@ type ActiHistoricTask struct {
 
 type AposeVM struct {
 	AddressUrl string `json:"addressUrl"`
+	Watermark  string `json:"watermark"`
 }
 
 type WordTemplateVM struct {
@@ -46,6 +73,30 @@ type WordTemplateVM struct {
 	FileName    string                 `json:"fileName"`
 }
 
+type WordTemplateWatermarkVM struct {
+	Datas       map[string]interface{} `json:"datas"`
+	TemplateUrl string                 `json:"templateUrl"`
+	FileName    string                 `json:"fileName"`
+	Watermark   string                 `json:"watermark"`
+}
+
+type MultiActiCompleteVM struct {
+	ProcessKey     string            `json:"processKey"`
+	BusinessKey    string            `json:"businessKey"`
+	UserNames      string            `json:"userNames"`
+	UserId         string            `json:"userId"`
+	Result         string            `json:"result"`
+	Remarks        string            `json:"remarks"`
+	MultiOrgAudits []MultiOrgAuditVM `json:"multiOrgAudits"`
+	CallbackUrl    string            `json:"callbackUrl"`
+}
+
+type MultiOrgAuditVM struct {
+	OrgId   string `json:"orgId"`
+	OrgName string `json:"orgName"`
+	UserIds string `json:"userIds"`
+}
+
 const (
 	////特检站数据录入
 	//TJZ_DATA_KEY string = "tjz_data_apply"

+ 6 - 0
src/dashoo.cn/backend/api/conf/app.conf

@@ -61,6 +61,12 @@ upFileHost = weed1.labsop.cn:9333
 downFileHost = weed1.labsop.cn:9390
 excelPassword = lims123456
 
+[workflow]
+callbackHost=http://36dcae10.ngrok.io
+OriginUrl=http://47.92.212.59:8080/acti-api/api
+AposeUrl=http://47.92.212.59:8080/acti-api/api/apose
+BaseUrl=http://47.92.212.59:8080/acti-api/api/acti
+
 [casbin]
 type=mysql
 

+ 3 - 1
src/dashoo.cn/backend/api/conf/auth_model.conf

@@ -13,9 +13,11 @@ g2 = _, _, _
 g3 = _, _, _
 #区域
 g4 = _, _, _
+#角色管理角色
+g5 = _, _, _
 
 [policy_effect]
 e = some(where (p.eft == allow))
 
 [matchers]
-m = g(r.sub, p.sub, r.dom) && g2(r.sub, r.dom, p.sub) && g3(r.sub, r.dom, p.sub) && g4(r.sub, r.dom, p.sub) && r.dom == p.dom && r.obj == p.obj && r.act == p.act
+m = g(r.sub, p.sub, r.dom) && g2(r.sub, r.dom, p.sub) && g3(r.sub, r.dom, p.sub) && g4(r.sub, r.dom, p.sub) && g5(r.sub, r.dom, p.sub) && r.dom == p.dom && r.obj == p.obj && r.act == p.act

+ 6 - 3
src/dashoo.cn/backend/api/controllers/casbin/role.go

@@ -63,7 +63,10 @@ func (this *RoleController) RoleList() {
 			roleofrole += permisvc.GetManRoleForRole(rids[i]) + ","
 		}
 		roleofrole = strings.Trim(roleofrole, ",")
-		where = where + " and Id in (" + roleofrole + ")"
+		if len(roleofrole) <= 0 {
+			roleofrole = "0"
+		}
+		where = where + " and ( Id in (" + roleofrole + ") OR CreateUserId = '" + this.User.Id + "')"
 	}
 	total := svc.GetRoleList(page.CurrentPage, page.Size, "SortCode asc", utils.ToStr(this.User.Id), &roles, where)
 	var datainfo DataInfo
@@ -540,11 +543,11 @@ func (this *RoleController) GetUsersForRole() {
 		where = where + " and Realname like '%" + keyword + "%'"
 	}
 	//判断超级管理员和有查看所有数据权限的用户
-	svcPerm := permission.GetPermissionService(utils.DBE)
+	/*svcPerm := permission.GetPermissionService(utils.DBE)
 	isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
 	if !svcPerm.IsAdmin(this.User.Id) && !isauth {
 		where += " and Unit = '" + this.User.Uint + "'"
-	}
+	}*/
 	total, users := svc.GetUserListForRole(page.CurrentPage, page.Size, roleid, "Id", where)
 
 	var datainfo DataInfo

+ 3 - 0
src/dashoo.cn/backend/api/controllers/lims/limsdataentry.go

@@ -165,6 +165,9 @@ func (this *LimsDataEntryController) GetToDoList() {
 	rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
 	rsvc.GetAuditStepRoleEntity(OilAuditSettingName, this.User.DepartmentId, workflow.DATAAUDIT, &RoleSet)
 	processInstanceId = svcActiviti.GetMyTasks(RoleSet.WorkFlowCord, this.User.Id)
+	if len(processInstanceId) <= 0 {
+		processInstanceId = "0"
+	}
 	//switch this.User.DepartmentId {
 	//case "100000150":
 	//	processInstanceId = svcActiviti.GetMyTasks(workflow.TJZ_DATA_KEY, this.User.Id)

+ 61 - 1
src/dashoo.cn/backend/api/controllers/workflow/workflow.go

@@ -6,6 +6,7 @@ import (
 	"dashoo.cn/business2/permission"
 	"dashoo.cn/business2/userRole"
 	"dashoo.cn/utils"
+	"sort"
 )
 
 // 动作接口说明
@@ -26,7 +27,30 @@ func (this *WorkflowController) GetHistoricTask() {
 	var historicTasks []workflow.ActiHistoricTask
 	svcActiviti := workflow.GetActivitiService(utils.DBE)
 	historicTasks = svcActiviti.GetHistoricTasks(processKey, businessKey, processInstanceId)
+	sort.Slice(historicTasks, func(i, j int) bool {
+		return historicTasks[i].StartTime < historicTasks[j].StartTime
+	})
+	var datainfo DataInfo
+	datainfo.Items = historicTasks
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title get
+// @Description get workflow by token
+// @Success 200 {object} historicTasks
+// @router /historymultitask [get]
+func (this *WorkflowController) GetHistoricMultiTask() {
+	businessKey := this.GetString("business")
+	processKey := this.GetString("process")
+	processInstanceId := this.GetString("instance")
 
+	var historicTasks []workflow.ActiHistoricTask
+	svcActiviti := workflow.GetActivitiService(utils.DBE)
+	historicTasks = svcActiviti.GetHistoricMultiTasks(processKey, businessKey, processInstanceId)
+	sort.Slice(historicTasks, func(i, j int) bool {
+		return historicTasks[i].StartTime < historicTasks[j].StartTime
+	})
 	var datainfo DataInfo
 	datainfo.Items = historicTasks
 	this.Data["json"] = &datainfo
@@ -42,7 +66,9 @@ func (this *WorkflowController) UserList() {
 	svc := permission.GetPermissionService(utils.DBE)
 	var users []userRole.Base_User
 
-	where := "IsVisible=1 and AccCode='" + this.User.AccCode + "' "
+
+
+	where := "IsVisible=1"
 	if keyword != "" {
 		where = where + " and Realname like '%" + keyword + "%'"
 	}
@@ -55,3 +81,37 @@ func (this *WorkflowController) UserList() {
 	this.ServeJSON()
 }
 
+// @Title 获取所有用户Post
+// @Description get user by token
+// @Success 200 {object} models.User
+// @router /userlist_post [post]
+func (this *WorkflowController) UserListByPost() {
+	userIds :=  this.GetString("userids")//this.Ctx.Input.Param(":userIds")
+	svc := permission.GetPermissionService(utils.DBE)
+	var users []userRole.Base_User
+
+
+
+	where := "IsVisible=1"
+	if userIds != "" {
+		where = where + " and Id in (" + userIds + ")"
+	}
+	total := svc.GetPagingEntitiesWithOrder(1, 1000, "Id", false, &users, where)
+
+	var datainfo DataInfo
+	datainfo.Items = users
+	datainfo.CurrentItemCount = total
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title get
+// @Description get SampleType by token
+// @Success 200 {object} samplesubpackage.SampleSubpackage
+// @router /historyimg/:id [get]
+func (this *WorkflowController) GetHistoricImg() {
+	processInstanceId := this.Ctx.Input.Param(":id")
+	svcActiviti := workflow.GetActivitiService(utils.DBE)
+	entity := svcActiviti.GetActivitiProccessImage(processInstanceId)
+	this.Ctx.Output.Body(entity)
+}

+ 4 - 4
src/dashoo.cn/frontend_web/nuxt.config.ignore.js

@@ -162,16 +162,16 @@ module.exports = {
 	  baseURL: '//localhost:10091/api/'
   },
   ignore: [
-    'pages/lims/report*/**/*.*',
+    // 'pages/lims/report*/**/*.*',
     'pages/lims/createreport/**/*.*',
-    'pages/lims/dataentry/**/*.*',
+    // 'pages/lims/dataentry/**/*.*',
     'pages/lims/deliver/**/*.*',
     'pages/lims/drillingdaily/**/*.*',
     'pages/lims/oiltestingdaily/**/*.*',
     'pages/lims/preparation/**/*.*',
     'pages/lims/tasksbalance/**/*.*',
-    'pages/system/**/*.*',
-    'pages/setting/**/*.*',
+    // 'pages/system/**/*.*',
+    // 'pages/setting/**/*.*',
     'pages/prototype/**/*.*',
     'pages/material/**/*.*',
     'pages/report/**/*.*',

+ 32 - 15
src/dashoo.cn/frontend_web/src/components/lims/historytaskdialog.vue

@@ -28,7 +28,7 @@
         </el-table-column>
       </el-table>
       <div slot="footer" class="dialog-footer" style="margin-top:-160px;">
-        <img :src="baseurl + 'limsdataentry/historyimg/' + entryinfo.instance " v-if="entryinfo.instance" style="width:850px">
+        <img :src="baseurl + 'limsdataentry/historyimg/' + entryinfo.instance + '?t='+(new Date()).getTime() " v-if="entryinfo.instance" style="width:850px">
       </div>
     </el-dialog>
   </div>
@@ -48,7 +48,7 @@
       entryinfo: {}
     },
     created() {
-      this.getuserlist()
+      this.getHistoryTask()
     },
     computed: {
       ...mapGetters({
@@ -56,13 +56,13 @@
       })
     },
     watch: {
-      visible(val) {
+      visible (val) {
         this.selfVisible = val
         if (this.visible) {
           this.getHistoryTask()
         }
       },
-      selfVisible(val) {
+      selfVisible (val) {
         this.$emit('update:visible', val)
       },
     },
@@ -78,25 +78,39 @@
       }
     },
     methods: {
-      getHistoryTask() {
+      getHistoryTask () {
+        this.tmp_historyTask = []
         let _this = this
         const params = {
           process: _this.entryinfo.process,
           business: _this.entryinfo.business,
-          instance: _this.entryinfo.instance,
+          instance: _this.entryinfo.instance
         }
-        this.$axios.get('limsdataentry/historytask', {
-            params
-          })
+        this.$axios.get('workflow/historytask', {
+          params
+        })
           .then(res => {
-            _this.historyTask = res.data.items
+            this.tmp_historyTask = res.data.items
+            let useridstr = ''
+            for (let i = 0; i < this.tmp_historyTask.length; i++) {
+              if (this.tmp_historyTask[i].assignee !== '') {
+                useridstr = useridstr + this.tmp_historyTask[i].assignee + ','
+              }
+              if (this.tmp_historyTask[i].users !== '') {
+                useridstr = useridstr + this.tmp_historyTask[i].users + ','
+              }
+            }
+            if (useridstr) {
+              useridstr = useridstr.substring(0, useridstr.length - 1)
+            }
+            this.getuserlist(useridstr)
           })
           .catch(err => {
             // handle error
             console.error(err)
           })
       },
-      assigneeToAssignee(val) {
+      assigneeToAssignee (val) {
         for (let i = 0; i < this.userlist.length; i++) {
           if (val == this.userlist[i].Id) {
             return this.userlist[i].Realname
@@ -119,12 +133,15 @@
         }
         return userNames;
       },
-      getuserlist() {
-        let _this = this
-        _this.$axios.get('limsindex/userlist', {})
+      getuserlist (val) {
+        // let params = {
+        //   userids: val
+        // }
+        this.$axios.post('workflow/userlist_post?userids=' + val)
           .then(res => {
             // response
-            _this.userlist = res.data.items
+            this.userlist = res.data.items
+            this.historyTask = this.tmp_historyTask
           })
           .catch(err => {
             // handle error

+ 51 - 30
src/dashoo.cn/frontend_web/src/components/workflow/wfhistory.vue

@@ -1,8 +1,14 @@
 <template>
-  <div>
-    <el-table :data="historyTask" border>
+  <div style="overflow: auto">
+    <el-table :data="historyTask" border size="mini">
       <el-table-column prop="taskName" sortable min-width="130" label="当前状态" align="center" show-overflow-tooltip></el-table-column>
-      <el-table-column prop="remarks" sortable min-width="130" label="审批意见" align="center" show-overflow-tooltip></el-table-column>
+      <el-table-column prop="remarks" sortable min-width="130" label="审批意见" align="center" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <span style="font-weight: bold" v-if="scope.row.assignee">
+            {{scope.row.remarks}}
+          </span>
+        </template>
+      </el-table-column>
       <el-table-column prop="assignee" sortable min-width="100" label="审核人" align="center" show-overflow-tooltip>
         <template slot-scope="scope">
           <span style="font-weight: bold" v-if="scope.row.assignee">
@@ -26,8 +32,8 @@
         </template>
       </el-table-column>
     </el-table>
-    <div style="margin-top:10px;">
-      <img :src="baseurl + 'limsdataentry/historyimg/' + entryinfo.instance +'?t='+(new Date()).getTime() " v-if="entryinfo.instance">
+    <div style="margin-top:5px; text-align: center;">
+      <img :src="baseurl + 'workflow/historyimg/' + entryinfo.instance +'?t='+(new Date()).getTime() " v-if="entryinfo.instance">
     </div>
   </div>
 </template>
@@ -47,7 +53,7 @@
       entryinfo: {}
     },
     created () {
-      this.getuserlist()
+      this.getHistoryTask()
     },
     computed: {
       ...mapGetters({
@@ -57,7 +63,7 @@
     watch: {
       entryinfo: {
         handler: function (newVal, oldVal) {
-          this.getuserlist()
+          this.getHistoryTask()
         },
         deep: true
       }
@@ -71,67 +77,83 @@
         instance: '',
         selfVisible: this.visible, // 避免vue双向绑定警告
         historyTask: [],
-        userlist: [],
+        tmp_historyTask: [],
+        userlist: []
       }
     },
     methods: {
-      getHistoryTask() {
+      getHistoryTask () {
+        this.tmp_historyTask = []
         let _this = this
         const params = {
           process: _this.entryinfo.process,
           business: _this.entryinfo.business,
-          instance: _this.entryinfo.instance,
+          instance: _this.entryinfo.instance
         }
         this.$axios.get('workflow/historytask', {
           params
         })
           .then(res => {
-            _this.historyTask = res.data.items
+            this.tmp_historyTask = res.data.items
+            let useridstr = ''
+            for (let i = 0; i < this.tmp_historyTask.length; i++) {
+              if (this.tmp_historyTask[i].assignee !== '') {
+                useridstr = useridstr + this.tmp_historyTask[i].assignee + ','
+              }
+              if (this.tmp_historyTask[i].users !== '') {
+                useridstr = useridstr + this.tmp_historyTask[i].users + ','
+              }
+            }
+            if (useridstr) {
+              useridstr = useridstr.substring(0, useridstr.length - 1)
+            }
+            this.getuserlist(useridstr)
           })
           .catch(err => {
             // handle error
             console.error(err)
           })
       },
-      assigneeToAssignee(val) {
+      assigneeToAssignee (val) {
         for (let i = 0; i < this.userlist.length; i++) {
           if (val == this.userlist[i].Id) {
             return this.userlist[i].Realname
           }
         }
       },
-      assigneeToUsers(users) {
-        let userNames = ""
+      assigneeToUsers (users) {
+        let userNames = ''
         let userArr = users.split(',')
-        for(let idx=0; idx<userArr.length; idx++) {
+        for (let idx = 0; idx < userArr.length; idx++) {
           let val = userArr[idx]
           for (let i = 0; i < this.userlist.length; i++) {
             if (parseInt(val) == parseInt(this.userlist[i].Id)) {
-              userNames += this.userlist[i].Realname + ", "
+              userNames += this.userlist[i].Realname + ', '
             }
           }
         }
-        if(userNames.length > 0) {
-          userNames = userNames.substring(0, userNames.length-2)
+        if (userNames.length > 0) {
+          userNames = userNames.substring(0, userNames.length - 2)
         }
-        return userNames;
+        return userNames
       },
-      getuserlist() {
-        let _this = this
-        _this.$axios.get('workflow/userlist', {})
+      getuserlist (val) {
+        // let params = {
+        //   userids: val
+        // }
+        this.$axios.post('workflow/userlist_post?userids=' + val)
           .then(res => {
             // response
-            _this.userlist = res.data.items
-
-            this.getHistoryTask()
+            this.userlist = res.data.items
+            this.historyTask = this.tmp_historyTask
           })
           .catch(err => {
             // handle error
             console.error(err)
           })
       },
-      timestampToTime(val) {
-        var date = new Date(val) //时间戳为10位需*1000,时间戳为13位的话不需乘1000
+      timestampToTime (val) {
+        var date = new Date(val) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
         var Y = date.getFullYear() + '-'
         var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
         var D = date.getDate() + ' '
@@ -140,7 +162,7 @@
         var s = date.getSeconds()
         return Y + M + D + h + m + s
       },
-      jstimehandle(val) {
+      jstimehandle (val) {
         if (val === '') {
           return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
@@ -155,10 +177,9 @@
           val = val.replace('T', ' ')
           return val.substring(0, 19)
         }
-      },
+      }
     }
   }
-
 </script>
 
 <style>

+ 7 - 7
src/dashoo.cn/frontend_web/src/pages/system/userrole.vue

@@ -41,7 +41,7 @@
                 class="icon icon-user"></i></el-button>
             <el-button size="small" type="text" v-if="adminpermission == 1" style="margin-left:6px" title="菜单权限"
               @click="setpower(scope.row)"><i class="icon icon-file-text"></i></el-button>
-            <el-button size="small" type="text" v-if="adminpermission == 1" style="margin-left:6px" title="操作权限"
+            <el-button size="small" type="text" style="margin-left:6px" title="操作权限"
               @click="getItemPower(scope.row)"><i class="icon icon-lock"></i></el-button>
             <el-button size="small" type="text" style="margin-left:6px" title="角色" @click="setRoleManage(scope.row.Id)"
               v-if="appclient == 'gfgl'&&adminpermission == 1"><i class="icon icon-cog"></i></el-button>
@@ -375,9 +375,9 @@
       // initial data
       this.initData()
       //this.getallequipmentlist()
-      this.getallrolelist()
+      //this.getallrolelist()
       this.getadminpermission()
-      this.getroleData()
+      // this.getroleData()
     },
     methods: {
       initData() {
@@ -404,7 +404,7 @@
             _this.exportloading = false
           })
       },
-      getroleData() {
+      /* getroleData() {
         let _this = this
         // request
         this.$axios.get('role/list', {})
@@ -416,7 +416,7 @@
             // handle error
             console.error(err)
           })
-      },
+      }, */
       getadminpermission() {
         this.$axios.get('role/getAdminPermi', {})
           .then(res => {
@@ -428,7 +428,7 @@
             console.error(err)
           })
       },
-      getallrolelist() {
+      /*getallrolelist() {
         this.$axios.get('role/alllist', {})
           .then(res => {
             // response
@@ -444,7 +444,7 @@
             console.error(err)
             this.exportloading = false
           })
-      },
+      },*/
       getpartuserlist() {
         let _this = this
         this.$axios.get('users/parlist', {})