Просмотр исходного кода

通用检测项目设置表单名称逻辑修改

cfort 3 лет назад
Родитель
Сommit
436897ecf4

+ 8 - 7
src/views/platform/bpmn/bpmTask/list.vue

@@ -367,7 +367,7 @@
                 // 打开表单前获取flowName和processName,避免流程节点状态bug
                 let selected = this.listData.find(item => item.id === id)
                 this.flowName = selected.name
-                this.processName = this.getProjectName(selected.procDefKey)
+                this.processName = this.getProjectName(selected.procDefKey, selected.subject)
 
                 request({
                     url: BUSINESS_BASE_URL() + '/getFormData/flag',
@@ -401,14 +401,15 @@
             },
             handleLinkClick(data, columns) {
                 this.flowName = data.name
-                this.processName = this.getProjectName(data.procDefKey)
+                this.processName = this.getProjectName(data.procDefKey, data.subject)
                 this.handleApprove(data[this.pkKey])
             },
-            // 获取检测流程对应的检测项目名称
-            getProjectName(v) {
-                const { testingList } = this.$store.getters
-                let res = testingList.find(item => item.processKey === v)
-                return res ? res.name : ''
+            // 判断是否为检测项目流程,是则截取流程标题为表单名称
+            getProjectName(key, subject) {
+                // 从store中获取保存的检测流程信息数组
+                const { testingList = [] } = this.$store.getters
+                let res = testingList.includes(key)
+                return res ? subject.includes('#') ? subject.split('#')[0] : '' : ''
             }
         }
     }

+ 7 - 6
src/views/system/dashboard/components/new-home.vue

@@ -482,7 +482,7 @@
                 this.defId = data.procDefId || ''
                 this.proInstId = data.id || ''
                 this.FlowName = data.name
-                this.processName = this.getProjectName(data.procDefKey)
+                this.processName = this.getProjectName(data.procDefKey, data.subject)
                 this.dialogFormVisible = true
             },
             // 开关右侧栏抽屉
@@ -512,11 +512,12 @@
                 }
                 return result.split('/')
             },
-            // 获取检测流程对应的检测项目名称
-            getProjectName(v) {
-                const { testingList } = this.$store.getters
-                let res = testingList.find(item => item.processKey === v)
-                return res ? res.name : ''
+            // 判断是否为检测项目流程,是则截取流程标题为表单名称
+            getProjectName(key, subject) {
+                // 从store中获取保存的检测流程信息数组
+                const { testingList = [] } = this.$store.getters
+                let res = testingList.includes(key)
+                return res ? subject.includes('#') ? subject.split('#')[0] : '' : ''
             },
             /**
              * 主管提醒

+ 6 - 4
src/views/system/dashboard/page.vue

@@ -504,17 +504,19 @@
                     })
                 }
             },
-            // 获取检测流程数据,存储到store中
+            // 获取所有检测流程的peocessKey,存储到store中
             getTestingData() {
                 let testingList = this.$store.getters.testingList
                 if (testingList.length) {
                     return
                 } else {
                     // let sql = 'select xiang_mu_ming_ as name, liu_cheng_bian_ha as processKey from t_jcxmlcpzb'
-                    let sql = 'select jian_ce_xiang_mu_ as name, defkey_ as processKey from t_mjjcnlfw where length(defkey_) > 0 order by xiang_mu_bian_hao + 0 asc'
+                    let sql = 'select distinct defkey_ as processKey from t_mjjcnlfw where length(defkey_) > 0'
                     curdPost('sql', sql).then(res => {
-                        const { data } = res.variables
-                        this.$store.dispatch('ibps/param/setTestingList', data)
+                        const { data = [] } = res.variables || {}
+                        const testingData = []
+                        data.forEach(item => testingData.push(item.processKey))
+                        this.$store.dispatch('ibps/param/setTestingList', testingData)
                     }).catch(error => {
                         this.$message.error('获取检测流程数据失败!')
                         console.log(error)