From c02a3ebf5b4338710c4f9ae231d72cf591dfb97f Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期一, 02 十二月 2024 11:28:04 +0800
Subject: [PATCH] 1.修改  批量派发 没绑定工艺路线的单子,显示在最前面

---
 src/views/basicSettings/organizationList.vue |   63 +++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/src/views/basicSettings/organizationList.vue b/src/views/basicSettings/organizationList.vue
index 04678a1..116dc2c 100644
--- a/src/views/basicSettings/organizationList.vue
+++ b/src/views/basicSettings/organizationList.vue
@@ -168,7 +168,7 @@
                   />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
-                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row.id)" />
+                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
                 </el-tooltip>
                 <!--                <el-button type="primary" size="mini" />-->
                 <!--                <el-button type="danger" size="mini">鍒犻櫎</el-button>-->
@@ -184,7 +184,7 @@
         :page.sync="form.page"
         :limit.sync="form.rows"
         align="right"
-        layout="total ,prev, pager, next,sizes"
+        layout="total ,prev, pager, next, sizes,jumper "
         popper-class="select_bottom"
         @pagination="getOrganizationSearch"
       />
@@ -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"
@@ -221,7 +220,7 @@
         <el-form-item label="缁勭粐鍚嶇О" prop="OrgName">
           <el-input v-model="dialogForm.OrgName" style="width: 200px" />
         </el-form-item>
-        <el-form-item v-if="dialogForm.OrgType!=='閮ㄩ棬'" prop="SupUnit" label="涓婄骇鍗曚綅">
+        <el-form-item v-if="dialogForm.OrgType!=='閮ㄩ棬'&&$store.state.settings.orgType===''" prop="SupUnit" label="涓婄骇鍗曚綅">
           <el-select
             v-model="dialogForm.SupUnit"
             style="width: 200px"
@@ -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>
@@ -266,7 +265,7 @@
 // const SER_HZ = /^[\u4e00-\u9fa5]+$/
 // const SER_HZ = /^[a-zA-Z0-9_;,.<>() ]{0,}$/
 export default {
-  name: 'ZZJG',
+  name: 'OrganizationList',
   components: {
     Pagination, TableColumnSettings
   },
@@ -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,16 @@
       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('褰撳墠鐢ㄦ埛鏃犳柊澧炴潈闄愶紒')
+      }
+
+      await this.getPrentOrganization()
+
       this.operation = operation
       this.dialogVisible = true
 
@@ -519,7 +533,11 @@
       // this.numvalue = res.numvalue
     },
     // 淇敼鎸夐挳
-    edit(operation, row) {
+    async  edit(operation, row) {
+      if (this.$store.state.settings.orgType === 'W') {
+        return this.$message.info('褰撳墠鐢ㄦ埛鏃犱慨鏀规潈闄愶紒')
+      }
+      await this.getPrentOrganization()
       this.operation = operation
       this.dialogVisible = true
       // if (row.description === 'F') {
@@ -536,20 +554,23 @@
       //   this.dialogForm.OrgType = '鐢熶骇绾�'
       // }
       this.$nextTick(() => {
-        this.changeRadio(this.dialogForm.OrgType)
         this.dialogForm.OrgCode = row.org_code
         this.dialogForm.OrgName = row.org_name
         this.dialogForm.SupUnit = row.parent_id
       })
     },
     // 鍒犻櫎鎸夐挳
-    async del(id) {
+    async del(row) {
+      if (this.$store.state.settings.orgType === 'W') {
+        return this.$message.info('褰撳墠鐢ㄦ埛鏃犲垹闄ゆ潈闄愶紒')
+      }
+
       this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        DeleteOrganization({ orgid: id }).then(res => {
+        DeleteOrganization({ orgid: row.id, orgcode: row.org_code }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
             if (this.form.page > 1 && this.tableData.length === 1) {
@@ -580,14 +601,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