Procházet zdrojové kódy

体系记录运行盒子部门改成下拉并默认当前组(金山)

shenqilong před 6 měsíci
rodič
revize
788b7d27c0
1 změnil soubory, kde provedl 42 přidání a 14 odebrání
  1. 42 14
      src/views/platform/bpmn/bpmInstHis/list.vue

+ 42 - 14
src/views/platform/bpmn/bpmInstHis/list.vue

@@ -245,11 +245,27 @@ export default {
   },
   data() {
     const { first = '' } = this.$store.getters.level || {}
-    const { userList = [], deptList = [] } = this.$store.getters || {}
+    const {
+      userList = [],
+      deptList = [],
+      setting,
+      mainPosition
+    } = this.$store.getters || {}
+    const deptOption = deptList
+      .filter((i) => i.depth >= 3)
+      .map((item) => ({ label: item.positionName, value: item.positionId }))
+    const mainPositionId = mainPosition?.id || ''
+    const isHighLevel = deptList
+      .filter((i) => i.depth === 3)
+      .some((i) => mainPositionId.includes(i.positionId))
+
     return {
       first,
       userList,
       deptList,
+      deptOption,
+      mainPositionId,
+      isHighLevel,
       width: 360,
       selection: false,
       dialogFormVisible: false,
@@ -303,6 +319,13 @@ export default {
               label: '部门',
               itemWidth: 150,
               placeholder: '请输入',
+              fieldType: setting?.dept?.default ? 'select' : 'input',
+              options: deptOption,
+              value: setting?.dept?.default
+                ? isHighLevel
+                  ? ''
+                  : mainPositionId
+                : '',
               labelWidth: 50
             },
             {
@@ -400,8 +423,11 @@ export default {
       }
     }
   },
-  async created() {
-    this.loadData()
+  async mounted() {
+    setTimeout(() => {
+      this.loadData()
+    }, 100)
+
     this.getConfig()
     const {
       reocrdsBoxShowStartDate: showCompileTime = false,
@@ -779,19 +805,21 @@ export default {
               result.push({ key: 'Q^create_by_^SL', value: i })
             })
           } else if (key === 'dept') {
-            // 转换部门ID
-            const t = this.deptList.filter((i) =>
-              i.positionName.includes(data[key])
-            )
-            if (!t.length) {
+            if (this.deptSelect) {
               result.push({ key: 'Q^subject_^SL', value: data[key] })
+            } else {
+              // 转换部门ID
+              const t = this.deptList.filter((i) =>
+                i.positionName.includes(data[key])
+              )
+              if (!t.length) {
+                result.push({ key: 'Q^subject_^SL', value: data[key] })
+              }
+              const res = t.map((i) => i.positionId)
+              res.forEach((i) => {
+                result.push({ key: 'Q^subject_^SL', value: i })
+              })
             }
-            const res = t.map((i) => i.positionId)
-            res.forEach((i) => {
-              result.push({ key: 'Q^subject_^SL', value: i })
-            })
-          } else {
-            result.push({ key: 'Q^subject_^SL', value: data[key] })
           }
         } else {
           result.push({ key, value: data[key] })