From 3784cc5b9f62d0397c3036126c014fe4070e8a7d Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 13 六月 2023 20:39:05 +0800
Subject: [PATCH] 1.组织架构和用户清单引入分车间概念

---
 src/views/basicSettings/organizationList.vue |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/views/basicSettings/organizationList.vue b/src/views/basicSettings/organizationList.vue
index 04678a1..d0bae78 100644
--- a/src/views/basicSettings/organizationList.vue
+++ b/src/views/basicSettings/organizationList.vue
@@ -201,11 +201,10 @@
       @close="handleClose"
     >
       <el-form ref="dialogForm" :rules="dialogFormRules" :model="dialogForm" label-width="80px">
-        <el-form-item label="缁勭粐绫诲瀷" prop="OrgType">
+        <el-form-item v-if="$store.state.settings.orgType===''" label="缁勭粐绫诲瀷" prop="OrgType">
           <el-radio-group
             v-model="dialogForm.OrgType"
             :disabled="operation==='edit'"
-            @change="changeRadio"
           >
             <el-radio
               v-for="item in OrgTypeArr"
@@ -232,7 +231,7 @@
             <el-option
               v-for="item in SupUnitArr"
               :key="item.id"
-              :label="item.org_name"
+              :label="item.org_name+' / '+item.org_code"
               :value="item.id"
             />
           </el-select>
@@ -442,7 +441,7 @@
   //   }
   // },
   created() {
-    this.getOrganizationSearch()
+    this.handleRequest()
   },
   mounted() {
     window.addEventListener('resize', this.getHeight)
@@ -472,10 +471,24 @@
       this.tableTimeStampKey = new Date().getTime()
       this.$refs.tableDataRef.doLayout()
     },
+
+    handleRequest() {
+      this.getOrganizationSearch().then(res => {
+        if (res.code === '200') {
+          this.getPrentOrganization()
+        }
+      })
+    },
     async getOrganizationSearch() {
       const res = await OrganizationSearch(this.form)
       this.tableData = res.data
       this.total = res.count
+
+      return { code: res.code }
+    },
+    async getPrentOrganization() {
+      const { data: res } = await PrentOrganization({ orgcode: 'W' })
+      this.SupUnitArr = res
     },
     // 鎺掑簭鏀瑰彉鏃�
     sortChange({ column, prop, order }) {
@@ -502,15 +515,14 @@
       this.form.UserName = ''
       this.getOrganizationSearch()
     },
-    // 鍗曢�夋鏀瑰彉鏃�
-    async changeRadio(val) {
-      if (this.dialogForm.OrgType !== '閮ㄩ棬') {
-        const { data: res } = await PrentOrganization({ orgcode: this.OrgTypeArr.find(item => item.label === this.dialogForm.OrgType).value })
-        this.SupUnitArr = res
-      }
-    },
+
     // 鏂板鎸夐挳
     async add(operation) {
+      console.log(this.$store.state.settings.orgType, 987)
+      if (this.$store.state.settings.orgType === 'W') {
+        return this.$message.info('褰撳墠鐢ㄦ埛鏃犳柊澧炴潈闄愶紒')
+      }
+
       this.operation = operation
       this.dialogVisible = true
 
@@ -520,6 +532,10 @@
     },
     // 淇敼鎸夐挳
     edit(operation, row) {
+      if (this.$store.state.settings.orgType === 'W') {
+        return this.$message.info('褰撳墠鐢ㄦ埛鏃犱慨鏀规潈闄愶紒')
+      }
+
       this.operation = operation
       this.dialogVisible = true
       // if (row.description === 'F') {
@@ -544,6 +560,10 @@
     },
     // 鍒犻櫎鎸夐挳
     async del(id) {
+      if (this.$store.state.settings.orgType === 'W') {
+        return this.$message.info('褰撳墠鐢ㄦ埛鏃犲垹闄ゆ潈闄愶紒')
+      }
+
       this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
@@ -580,14 +600,14 @@
         if (valid) {
           this.$store.state.app.buttonIsDisabled = true
           const data = {
-            OrganType: this.dialogForm.OrgType === '閮ㄩ棬' ? 'D' : 'W',
+            OrganType: this.$store.state.settings.orgType !== '' ? 'W' : (this.dialogForm.OrgType === '閮ㄩ棬' ? 'D' : 'W'),
             OrganCode: this.dialogForm.OrgCode,
             OrganName: this.dialogForm.OrgName,
             RightCode: '',
             numvalue: '',
             // RightCode: this.operation === 'add' ? getCookie('ruleCode') : '',
             // numvalue: this.operation === 'add' ? this.numvalue : '',
-            SupUnit: this.dialogForm.OrgType === '閮ㄩ棬' ? '0' : this.dialogForm.SupUnit,
+            SupUnit: this.$store.state.settings.orgType !== '' ? this.SupUnitArr.find(i => i.org_code === getCookie('stu_torgcode')).id : (this.dialogForm.OrgType === '閮ㄩ棬' ? '0' : this.dialogForm.SupUnit),
             OperType: this.operation === 'add' ? 'Add' : 'Update',
             Operator: getCookie('admin')
           }

--
Gitblit v1.9.3