From b5e4adfc3a55490ad1cd49f50dfcc9dfb7b57d33 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期四, 31 八月 2023 13:45:34 +0800
Subject: [PATCH] 文档名称来源 修改

---
 src/views/eam/modules/equipmentNew/EquipmentDocumentModal.vue |  328 +++++++++++++++++++++++++++++------------------------
 1 files changed, 179 insertions(+), 149 deletions(-)

diff --git a/src/views/eam/modules/equipmentNew/EquipmentDocumentModal.vue b/src/views/eam/modules/equipmentNew/EquipmentDocumentModal.vue
index 45a09a2..c9c1fed 100644
--- a/src/views/eam/modules/equipmentNew/EquipmentDocumentModal.vue
+++ b/src/views/eam/modules/equipmentNew/EquipmentDocumentModal.vue
@@ -7,12 +7,22 @@
     switchFullscreen
     @ok="handleOk"
     @cancel="handleCancel"
-    cancelText="鍏抽棴">
+    cancelText="鍏抽棴"
+  >
     <a-spin :spinning="confirmLoading">
-      <a-form-model ref="form" :model="model" :rules="validatorRules">
+      <a-form-model
+        ref="form"
+        :model="model"
+        :rules="validatorRules"
+      >
         <a-row>
           <a-col :span="24">
-            <a-form-model-item label="鏂囨。缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
+            <a-form-model-item
+              label="鏂囨。缂栧彿"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="num"
+            >
               <a-input
                 placeholder="璇疯緭鍏ユ枃妗g紪鍙�"
                 v-model="model.num"
@@ -20,18 +30,28 @@
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
-            <a-form-model-item label="鏂囨。绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fileType">
+            <a-form-model-item
+              label="鏂囨。绫诲瀷"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="fileType"
+            >
               <j-dict-select-tag
                 allow-clear
                 placeholder="璇烽�夋嫨鏂囨。绫诲瀷"
                 :triggerChange="true"
-                dictCode="common_upload_type"
+                dictCode="mom_eam_document_type,name,id, del_flag!='1'"
                 v-model="model.fileType"
               />
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
-            <a-form-model-item label="鏂囨。涓婁紶" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fileType">
+            <a-form-model-item
+              label="鏂囨。涓婁紶"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+            >
+              <!-- prop="fileType" -->
               <a-upload-dragger
                 name="file"
                 :customRequest="customRequest"
@@ -52,7 +72,12 @@
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
-            <a-form-model-item label="鏂囦欢鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
+            <a-form-model-item
+              label="鏂囦欢鍚嶇О"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="name"
+            >
               <a-input
                 placeholder="璇疯緭鍏ユ枃浠跺悕绉�"
                 v-model="model.name"
@@ -60,7 +85,12 @@
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
-            <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
+            <a-form-model-item
+              label="澶囨敞"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="remark"
+            >
               <a-textarea
                 placeholder="璇疯緭鍏ュ娉�"
                 allow-clear
@@ -76,82 +106,82 @@
 
 <script>
 
-  import { httpAction } from '@/api/manage'
-  import { validateDuplicateValue } from '@/utils/util'
+import { httpAction } from '@/api/manage'
+import { validateDuplicateValue } from '@/utils/util'
 import { getAction, postFileAction } from '../../../../api/manage'
 import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
 import Vue from 'vue'
 
-  export default {
-    name: "EquipmentDocumentModal",
-    components: {
-    },
-    props:{
-      mainId:{
-        type:String,
-        required:false,
-        default:''
-      }
-    },
-    data () {
-      return {
-        title:"鎿嶄綔",
-        width:800,
-        visible: false,
-        model:{
-        },
-        labelCol: {
-          xs: { span: 24 },
-          sm: { span: 5 },
-        },
-        wrapperCol: {
-          xs: { span: 24 },
-          sm: { span: 16 },
-        },
-        headers: {},
-
-        confirmLoading: false,
-        validatorRules: {
-          num:[
-           { required: true, message: '璇疯緭鍏ユ枃妗g紪鍙凤紒' },
-          ],
-          fileType:[
-           { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷锛�' },
-          ]
-        },
-        url: {
-          add: "/eam/equipmentDocument/add",
-          edit: "/eam/equipmentDocument/edit",
-          listByBusIdAndBusType: "/system/sysUploadRela/listByBusIdAndBusType",
-        },
-        fileList: [],
-        fileObject: {},
-        isFileChange: false,
-        uploadId: '',
-      }
-    },
-    created () {
-    //澶囦唤model鍘熷鍊�
-      this.modelDefault = JSON.parse(JSON.stringify(this.model));
-       // this.initFileTypes();
-        const token = Vue.ls.get(ACCESS_TOKEN);
-        const tenantid = Vue.ls.get(TENANT_ID)
-        this.headers = {
-          'Content-Type': 'multipart/form-data',
-          "X-Access-Token": token,
-          'X-Access-Tenant': tenantid
-        };
-    },
-    methods: {
-      add () {
-        this.edit(this.modelDefault);
+export default {
+  name: "EquipmentDocumentModal",
+  components: {
+  },
+  props: {
+    mainId: {
+      type: String,
+      required: false,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      title: "鎿嶄綔",
+      width: 800,
+      visible: false,
+      model: {
       },
-      customRequest(val) {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 },
+      },
+      headers: {},
+
+      confirmLoading: false,
+      validatorRules: {
+        num: [
+          { required: true, message: '璇疯緭鍏ユ枃妗g紪鍙凤紒' },
+        ],
+        fileType: [
+          { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷锛�' },
+        ]
+      },
+      url: {
+        add: "/eam/equipmentDocument/add",
+        edit: "/eam/equipmentDocument/edit",
+        listByBusIdAndBusType: "/system/sysUploadRela/listByBusIdAndBusType",
+      },
+      fileList: [],
+      fileObject: {},
+      isFileChange: false,
+      uploadId: '',
+    }
+  },
+  created() {
+    //澶囦唤model鍘熷鍊�
+    this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    // this.initFileTypes();
+    const token = Vue.ls.get(ACCESS_TOKEN);
+    const tenantid = Vue.ls.get(TENANT_ID)
+    this.headers = {
+      'Content-Type': 'multipart/form-data',
+      "X-Access-Token": token,
+      'X-Access-Tenant': tenantid
+    };
+  },
+  methods: {
+    add() {
+      this.edit(this.modelDefault);
+    },
+    customRequest(val) {
       if (this.fileList.length == 0) {
         this.fileObject = val;
       }
-      },
-      handleChange(info) {
+    },
+    handleChange(info) {
       //榛樿缁欓檮浠剁姸鎬侊紝浠呮帶鍒舵牱寮�
       let file = info.file;
       //鏂囦欢鏇存敼锛屾爣璁版洿鏂�
@@ -162,7 +192,7 @@
       if (file.status == "removed") {
         this.fileList = [];
         this.fileObject.file = {};
-        this.model.name=''
+        this.model.name = ''
         return false;
       }
       //鍗曟枃浠舵帶鍒�
@@ -177,12 +207,12 @@
       this.model = Object.assign({}, this.model);
 
     },
-      edit (record) {
-        this.fileList = [];
-        this.uploadId = ''
-        this.model = Object.assign({}, record);
-        var that = this;
-        getAction(that.url.listByBusIdAndBusType, { busId: record.id, busType: 'equipment_file' }).then((res) => {
+    edit(record) {
+      this.fileList = [];
+      this.uploadId = ''
+      this.model = Object.assign({}, record);
+      var that = this;
+      getAction(that.url.listByBusIdAndBusType, { busId: record.id, busType: 'equipment_file' }).then((res) => {
         if (res.success) {
           for (let i = 0; i < res.result.length; i++) {
             that.fileList.push({
@@ -191,74 +221,74 @@
               status: "done",
             })
             that.$nextTick(() => {
-              that.model.name = res.result[i].upload.name 
-            }); 
+              that.model.name = res.result[i].upload.name
+            });
           }
         }
       })
-        this.visible = true;
-      },
-      close () {
-        this.$emit('close');
-        this.visible = false;
-        this.$refs.form.clearValidate();
-      },
-      handleOk () {
-        const that = this;
-        // 瑙﹀彂琛ㄥ崟楠岃瘉
-        this.$refs.form.validate(valid => {
-          if (JSON.stringify(that.fileObject.file) == '{}' && that.uploadId == '' && that.fileList.length == 0) {
-                that.$message.warning("璇蜂笂浼犳枃浠�");
-                return false
-          } 
-          if (valid) {
-              that.confirmLoading = true;
-              let formData = Object.assign({}, that.model);
-              let httpurl = ''
-              let method = ''
-              if (!that.model.id) {
-                httpurl += that.url.add;
-                method = 'post';
-                formData.equipmentId = that.mainId;
-              } else {
-                httpurl += that.url.edit;
-                method = 'put';
-              }
-
-              formData.type = "equipment_file";
-              formData.uploadId = that.uploadId;
-              // formData.fileType = "7";//鏂囦欢绫诲瀷  7锛氬浘鐗�
-              var saveDate = new FormData();
-
-              formData.isFileChange = that.isFileChange;
-
-              saveDate.append("file", that.fileObject.file);
-              saveDate.append('data', JSON.stringify(formData));
-
-              postFileAction(httpurl, saveDate, this.headers).then((res) => {
-                if (res.success) {
-                  that.$message.success(res.message);
-                  that.$emit('ok');
-                } else {
-                  that.$message.warning(res.message);
-                }
-              }).finally(() => {
-                that.confirmLoading = false;
-                that.close();
-              })
-              
-
-          }else{
-             return false
-          }
-        })
-      },
-      handleCancel () {
-        this.close()
-      },
-
-
+      this.visible = true;
     },
-    
-  }
+    close() {
+      this.$emit('close');
+      this.visible = false;
+      this.$refs.form.clearValidate();
+    },
+    handleOk() {
+      const that = this;
+      // 瑙﹀彂琛ㄥ崟楠岃瘉
+      this.$refs.form.validate(valid => {
+        if (JSON.stringify(that.fileObject.file) == '{}' && that.uploadId == '' && that.fileList.length == 0) {
+          that.$message.warning("璇蜂笂浼犳枃浠�");
+          return false
+        }
+        if (valid) {
+          that.confirmLoading = true;
+          let formData = Object.assign({}, that.model);
+          let httpurl = ''
+          let method = ''
+          if (!that.model.id) {
+            httpurl += that.url.add;
+            method = 'post';
+            formData.equipmentId = that.mainId;
+          } else {
+            httpurl += that.url.edit;
+            method = 'put';
+          }
+
+          formData.type = "equipment_file";
+          formData.uploadId = that.uploadId;
+          // formData.fileType = "7";//鏂囦欢绫诲瀷  7锛氬浘鐗�
+          var saveDate = new FormData();
+
+          formData.isFileChange = that.isFileChange;
+
+          saveDate.append("file", that.fileObject.file);
+          saveDate.append('data', JSON.stringify(formData));
+
+          postFileAction(httpurl, saveDate, this.headers).then((res) => {
+            if (res.success) {
+              that.$message.success(res.message);
+              that.$emit('ok');
+            } else {
+              that.$message.warning(res.message);
+            }
+          }).finally(() => {
+            that.confirmLoading = false;
+            that.close();
+          })
+
+
+        } else {
+          return false
+        }
+      })
+    },
+    handleCancel() {
+      this.close()
+    },
+
+
+  },
+
+}
 </script>

--
Gitblit v1.9.3