From 102c7d7dc9f5af873f19c86a0d17d5d6addcbc32 Mon Sep 17 00:00:00 2001
From: zhuzhuanzhuan
Date: 星期二, 19 九月 2023 17:39:28 +0800
Subject: [PATCH] 项目优化

---
 src/views/mdc/base/modules/EquipmentList/UserModal.vue |  102 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 72 insertions(+), 30 deletions(-)

diff --git a/src/views/mdc/base/modules/EquipmentList/UserModal.vue b/src/views/mdc/base/modules/EquipmentList/UserModal.vue
index e078ac0..4d41e23 100644
--- a/src/views/mdc/base/modules/EquipmentList/UserModal.vue
+++ b/src/views/mdc/base/modules/EquipmentList/UserModal.vue
@@ -1,12 +1,11 @@
 <template>
-  <a-drawer
+  <a-modal
     :title="title"
     :maskClosable="true"
     :width="drawerWidth"
-    placement="right"
-    :closable="true"
-    @close="handleCancel"
+    @cancel="visible=false"
     :visible="visible"
+    :footer="null"
     style="height: 100%;overflow: auto;padding-bottom: 53px;">
 
     <template slot="title">
@@ -26,7 +25,7 @@
             <a-form-model-item label="璁惧缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentId">
               <a-input-search :readOnly="true"
                               v-model="model.equipmentId"
-                              :disabled="disSeach"   @search="deviceSearch" enter-button placeholder='璇烽�夋嫨璁惧缂栫爜'/>
+                              :disabled="disSeach"   @search="deviceSearch" enter-button placeholder='璇烽�夋嫨璁惧缂栫爜' />
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
@@ -39,23 +38,35 @@
 
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-model-item label="閮ㄩ棬鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
+            <a-form-model-item  v-if="isDepartType == 0" label="閮ㄩ棬鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
               <j-select-equipment-depart :disabled="disableSubmit" v-model="model.selectedDeparts" :multi="false" @back="backDepartInfo" :backDepart="true" :treeOpera="true"></j-select-equipment-depart>
+            </a-form-model-item>
+
+            <a-form-model-item v-if="isDepartType == -1" label="璁惧绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol">
+              <a-select :disabled="disableSubmit" :readOnly="disableSubmit" placeholder="璇烽�夋嫨璁惧绫诲瀷"
+                        :triggerChange="true"
+                        v-model="model.equipmentType">
+                <a-select-option v-for='item in selectList' :key='item.id' :value='item.equipmentTypeName'>
+                  {{item.equipmentTypeName}}
+                </a-select-option>
+              </a-select>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
             <a-form-model-item label="杞﹂棿鍒嗛厤" :labelCol="labelCol" :wrapperCol="wrapperCol"  v-show="!productionDisabled" ref="selectedProduction"  prop="selectedProduction">
               <!--<j-select-equipment-production  v-decorator="['selectedProduction',{rules:[{required:true,message:'璇烽�夋嫨杞﹂棿!'}]}]" :multi="false" @back="backProductionInfo" :backProduction="true" :treeProductOpera="true"></j-select-equipment-production>-->
-
-
-
               <j-select-equipment-production :disabled="disableSubmit"  v-model="model.selectedProduction" :multi="false" @back="backProductionInfo" :backProduction="true" :treeProductOpera="true"></j-select-equipment-production>
             </a-form-model-item>
+
           </a-col>
         </a-row>
         <a-row :gutter="24">
           <a-col :span="12">
-            <a-form-model-item label="璁惧绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol">
+            <a-form-model-item v-if="isDepartType == -1" label="绯荤粺鐗堟湰鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol">
+              <a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="璇疯緭鍏ョ郴缁熺増鏈彿"
+                       v-model="model.systemVersion"/>
+            </a-form-model-item>
+            <a-form-model-item v-if="isDepartType == 0" label="璁惧绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol">
             <a-select :disabled="disableSubmit" :readOnly="disableSubmit" placeholder="璇烽�夋嫨璁惧绫诲瀷"
               :triggerChange="true"
                       v-model="model.equipmentType">
@@ -113,7 +124,7 @@
             </a-form-model-item>
           </a-col>
           <a-col :span='12'>
-            <a-form-model-item label="绯荤粺鐗堟湰鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol">
+            <a-form-model-item v-if="isDepartType == 0" label="绯荤粺鐗堟湰鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol">
               <a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="璇疯緭鍏ョ郴缁熺増鏈彿"
                        v-model="model.systemVersion"/>
             </a-form-model-item>
@@ -133,13 +144,13 @@
 
 
     <div class="drawer-bootom-button" v-show="!disableSubmit">
-      <a-popconfirm title="纭畾鏀惧純缂栬緫锛�" @confirm="handleCancel" okText="纭畾" cancelText="鍙栨秷">
+      <a-popconfirm title="纭畾鏀惧純鎿嶄綔锛�" @confirm="handleCancel" okText="纭畾" cancelText="鍙栨秷">
         <a-button style="margin-right: .8rem">鍙栨秷</a-button>
       </a-popconfirm>
       <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">鎻愪氦</a-button>
     </div>
     <device-list-model ref="deviceListModel" @sendSelectionRows="getDeviceRows"></device-list-model>
-  </a-drawer>
+  </a-modal>
 
 </template>
 
@@ -157,6 +168,7 @@
   import DeviceListModel from './DeviceListModal'
   import JSelectEquipmentDepart from '../../../../../components/jeecgbiz/JSelectEquipmentDepart'
   import AFormModelItem from 'ant-design-vue/es/form-model/FormItem'
+  import {mapActions} from 'vuex'
   export default {
     name: "UserModal",
     components: {
@@ -187,7 +199,7 @@
           equipmentId:
             [
               {
-              required: true, message: '璇烽�夋嫨璁惧缂栧彿!',
+              required: true, message: '璇烽�夋嫨璁惧缂栧彿!'
               },
               // {
               // validator: this.validatequipmentId
@@ -240,13 +252,15 @@
         rolesOptions:[],
         nextDepartOptions:[],
         nextProductionOptions:[],
-        selectList:[]
+        selectList:[],
+        isDepartType:''
       }
     },
     created () {
       const token = Vue.ls.get(ACCESS_TOKEN);
       this.headers = {"X-Access-Token":token}
       this.queryGroup()
+      this.queryTreeData()
       // this.initRoleList()
       // this.initTenantList()
     },
@@ -256,6 +270,21 @@
       }
     },
     methods: {
+      ...mapActions(['QueryDepartTree']),
+      queryTreeData() {
+        this.QueryDepartTree().then(res => {
+          if (res.success) {
+            this.isDepartType = res.result[0].value
+          } else {
+            // this.$message.warn(res.message)
+            this.$notification.warning({
+              message:'娑堟伅',
+              description:res.message
+            });
+          }
+        }).finally(() =>{
+        })
+      },
       queryGroup() {
         getAction(this.url.queryEquipmentType).then(res => {
           if (res.success) {
@@ -264,7 +293,11 @@
             //   return { label: item.id, value: item.equipmentTypeName + '' }
             // })
           } else {
-            this.$message.warning(res.message)
+            // this.$message.warning(res.message)
+            this.$notification.warning({
+              message:'娑堟伅',
+              description:res.message
+            });
           }
         }).finally(() => {
           this.loading = false
@@ -274,10 +307,10 @@
         console.log(val)
         if(val.equipmentid ){
           this.model.equipmentId = val.equipmentid
-          this.model.equipmentName = val.equipmentname,
-            this.model.equipmentModel = val.equipmentmodel,
-            this.model.equipmentIp = val.equipmentip,
-            this.model.dataPort =  val.dataport,
+          this.model.equipmentName = val.equipmentname
+            this.model.equipmentModel = val.equipmentmodel
+            this.model.equipmentIp = val.equipmentip
+            this.model.dataPort =  val.dataport
             this.model.driveType = val.drivetype
             this.model.controlSystem = val.controlsystem
             this.model.saveTableName = val.savetablename
@@ -312,6 +345,7 @@
         that.visible = true;
         //鏍规嵁灞忓箷瀹藉害鑷�傚簲鎶藉眽瀹藉害
         this.resetScreenSize();
+
         // that.userId = record.id;
         // console.log(record)
         that.model = Object.assign({}, record);
@@ -414,8 +448,6 @@
         })
       },
 
-
-
       refresh () {
         this.userId=""
         this.nextDepartOptions=[];
@@ -453,10 +485,18 @@
             }
             obj.then((res)=>{
               if(res.success){
-                that.$message.success(res.message);
+                // that.$message.success(res.message);
+                that.$notification.success({
+                  message:'娑堟伅',
+                  description:res.message
+                });
                 that.$emit('ok');
               }else{
-                that.$message.warning(res.message);
+                // that.$message.warning(res.message);
+                that.$notification.warning({
+                  message:'娑堟伅',
+                  description:res.message
+                });
               }
             }).finally(() => {
               that.confirmLoading = false;
@@ -506,11 +546,6 @@
       //     }
       //   })
       // },
-      handleCancel () {
-        this.close()
-      },
-
-
 
       // validatequipmentId(rule, value, callback){
       //   if(!value){
@@ -544,8 +579,15 @@
         }else{
           this.departIdShow=true;
         }
+      },
+      /**
+       * 缂栬緫鎴栨煡鐪嬭鎯呮暟鎹椂娓呴櫎鎶藉眽琛ㄥ崟楠岃瘉
+       */
+      removeValidate(){
+        this.$refs.form.clearValidate()
       }
-    }
+    },
+
   }
 </script>
 

--
Gitblit v1.9.3