From 5cbba170e270e6f1c99a91e27dbb7951a27d596a Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期五, 24 十一月 2023 16:41:32 +0800
Subject: [PATCH] 故障报修验收

---
 src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue |  225 +++++++++++++++++++++++++++++++------------------------
 1 files changed, 126 insertions(+), 99 deletions(-)

diff --git a/src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue b/src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue
index 7350f8d..117a24a 100644
--- a/src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue
+++ b/src/views/eam/modules/dailyMaintenanceStandard/DailyMaintenanceStandardModal.vue
@@ -29,17 +29,34 @@
           </a-col>
           <a-col :span="12">
             <a-form-item
-              label="瀵硅薄閮ㄩ棬"
+              label="浣跨敤閮ㄩ棬"
               :labelCol="labelCol"
               :wrapperCol="wrapperCol"
             >
-              <a-input-search
+              <!-- <a-input-search
                 :disabled="disableSubmit"
-                placeholder="璇烽�夋嫨瀵硅薄閮ㄩ棬"
+                placeholder="璇烽�夋嫨浣跨敤閮ㄩ棬"
                 enter-button
                 @search="onDepartList()"
                 :read-only="true"
                 v-decorator="['useDepartName', validatorRules.useDepartName]"
+              /> 
+              <a-tree-select
+                style="width: 100%"
+                :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+                :tree-data="treeData"
+                placeholder="璇烽�夋嫨閮ㄩ棬"
+                tree-default-expand-all
+                v-decorator="['departId', validatorRules.useId ]"
+              />-->
+
+              <j-dict-select-tag
+                allow-clear
+                :disabled="disableSubmit"
+                :placeholder="disableSubmit?'':'璇烽�夋嫨浣跨敤閮ㄩ棬'"
+                :triggerChange="true"
+                dictCode="sys_depart,depart_name,id,del_flag!='1'"
+                v-decorator="['departId', {}]"
               />
             </a-form-item>
           </a-col>
@@ -88,7 +105,7 @@
                 allow-clear
                 :disabled="true"
                 :placeholder="disableSubmit?'':'璇疯緭鍏ヨ矗浠荤彮缁�'"
-                v-decorator="['teamName', validatorRules.teamName ]"
+                v-decorator="['teamName', {} ]"
               />
             </a-form-item>
           </a-col>
@@ -106,25 +123,25 @@
               <a-input
                 allow-clear
                 :disabled="true"
-                :placeholder="disableSubmit?'':'璇疯緭鍏ヨ澶囩紪鐮�/鍚嶇О/鍨嬪彿'"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ョ粺涓�缂栫爜/鍚嶇О/鍨嬪彿'"
                 v-decorator="['equipmentId', validatorRules.equipmentId ]"
               />
             </a-form-item>
           </a-col>
-          <a-col :span="12">
+          <!-- <a-col :span="12">
             <a-form-item
-              label="瀵硅薄閮ㄩ棬Id"
+              label="浣跨敤閮ㄩ棬Id"
               :labelCol="labelCol"
               :wrapperCol="wrapperCol"
             >
               <a-input
                 allow-clear
                 :disabled="true"
-                :placeholder="disableSubmit?'':'璇疯緭鍏ュ璞¢儴闂╥d'"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ヤ娇鐢ㄩ儴闂╥d'"
                 v-decorator="['departId', validatorRules.useId ]"
               />
             </a-form-item>
-          </a-col>
+          </a-col> -->
           <a-col :span="12">
             <a-form-item
               label="鐝粍Id"
@@ -210,14 +227,14 @@
         <!-- <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item
-              label="瀵硅薄閮ㄩ棬"
+              label="浣跨敤閮ㄩ棬"
               :labelCol="labelCol"
               :wrapperCol="wrapperCol"
             >
               <j-dict-select-tag
                 allow-clear
                 :disabled="disableSubmit"
-                :placeholder="disableSubmit?'':'璇峰璞¢儴闂�'"
+                :placeholder="disableSubmit?'':'璇蜂娇鐢ㄩ儴闂�'"
                 :triggerChange="true"
                 dictCode="sys_depart,depart_name,id,version = '7' and del_flag!='1'"
                 v-decorator="['departId', validatorRules.departId]"
@@ -255,6 +272,7 @@
       rowKey='id'
       :columns="columns"
       :dataSource="dataSource"
+      :pagination="false"
     >
       <template
         v-for="col in columns"
@@ -284,8 +302,9 @@
             v-if="col.dataIndex == 'location'"
             :maxLength="500"
             auto-size
-            placeholder="璇疯緭鍏ヤ綅缃�"
+            placeholder="璇疯緭鍏ヤ繚鍏讳綅缃�"
             @change="(e)=>handleChange(e, record.key, col, index)"
+            :disabled="true"
           />
           <j-image-upload
             :value="text"
@@ -296,6 +315,16 @@
             @change="(e)=>handleChange(e, record.key, col, index)"
           >
           </j-image-upload>
+          <j-dict-select-tag
+            v-if="col.dataIndex == 'maintenanceRole'"
+            :value="text"
+            allow-clear
+            :triggerChange="true"
+            dictCode="maintenance_role"
+            placeholder="璇烽�夋嫨淇濆吇瑙掕壊"
+            style="width: 100%"
+            @change="(e)=>handleChange(e, record.key, col, index)"
+          />
         </div>
       </template>
 
@@ -310,43 +339,6 @@
           <a>鍒犻櫎</a>
         </a-popconfirm>
       </span>
-
-      <!-- <span
-        slot="photo"
-        slot-scope="text,record"
-      >
-        <Tooltip
-          placement="top"
-          title="棰勮鍥剧墖"
-        >
-          <img
-            v-if=" record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif')"
-            width="30"
-            height="14"
-            border="1"
-            draggable="false"
-            preview="1"
-            :preview-text="''"
-            :src="record.upload.src"
-          />
-        </Tooltip>
-        <a
-          v-if="record.upload.path && record.upload.format.toLowerCase()=='pdf'"
-          href="javascript:;"
-          @click="view(record.upload)"
-        >
-          棰勮
-        </a>
-
-        <a-divider
-          v-if="record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif'||record.upload.format.toLowerCase()=='pdf')"
-          type="vertical"
-        />
-        <a
-          href="javascript:;"
-          @click="handleUpload(record)"
-        >涓婁紶</a>
-      </span> -->
     </a-table>
     <template slot="footer">
       <a-button
@@ -442,52 +434,59 @@
           align: 'center',
           dataIndex: 'standard'
         },
+        // {
+        //   title: '鏂规硶',
+        //   align: 'center',
+        //   dataIndex: 'maintenanceMethodName'
+        // },
+        // {
+        //   title: '宸ュ叿',
+        //   align: 'center',
+        //   dataIndex: 'maintenanceTool'
+        // },
+        // {
+        //   title: '缁翠繚涓撲笟',
+        //   align: 'center',
+        //   dataIndex: 'maintenanceSpecialtyName'
+        // },
+        // {
+        //   title: '瀹夊叏瑕佹眰',
+        //   align: 'center',
+        //   dataIndex: 'maintenanceRequire',
+        //   scopedSlots: { customRender: 'maintenanceRequire' },
+        //   width: 150,
+        // },
+        // {
+        //   title: '宸ユ椂瀹氶',
+        //   align: 'center',
+        //   dataIndex: 'workingHourQuota'
+        // },
+        // {
+        //   title: '绀烘剰鍥�',
+        //   align: 'center',
+        //   dataIndex: 'photo',
+        //   scopedSlots: { customRender: 'photo' },
+        //   width: 150,
+        // },
         {
-          title: '鏂规硶',
-          align: 'center',
-          dataIndex: 'maintenanceMethodName'
-        },
-        {
-          title: '宸ュ叿',
-          align: 'center',
-          dataIndex: 'maintenanceTool'
-        },
-        {
-          title: '缁翠繚涓撲笟',
-          align: 'center',
-          dataIndex: 'maintenanceSpecialtyName'
-        },
-        {
-          title: '瀹夊叏瑕佹眰',
-          align: 'center',
-          dataIndex: 'maintenanceRequire',
-          scopedSlots: { customRender: 'maintenanceRequire' },
-          width: 150,
-        },
-        {
-          title: '宸ユ椂瀹氶',
-          align: 'center',
-          dataIndex: 'workingHourQuota'
-        },
-        {
-          title: '绀烘剰鍥�',
-          align: 'center',
-          dataIndex: 'photo',
-          scopedSlots: { customRender: 'photo' },
-          width: 150,
-        },
-        {
-          title: '閮ㄤ綅',
+          title: '淇濆吇閮ㄤ綅',
           align: 'center',
           dataIndex: 'location',
-          scopedSlots: { customRender: 'location' },
-          width: 150,
+          // scopedSlots: { customRender: 'location' },
+          // width: 150,
         },
         {
           title: '鍛ㄦ湡',
           align: 'center',
           dataIndex: 'maintenanceCycleId',
           scopedSlots: { customRender: 'maintenanceCycleId' },
+          width: 150,
+        },
+        {
+          title: '淇濆吇瑙掕壊',
+          align: 'center',
+          dataIndex: 'maintenanceRole',
+          scopedSlots: { customRender: 'maintenanceRole' },
           width: 150,
         },
         {
@@ -508,6 +507,7 @@
       model: {},
       upload: {},
       maintenanceCycles: {},
+      treeData: [],
       labelCol: {
         xs: { span: 24 },
         sm: { span: 6 },
@@ -531,7 +531,7 @@
         },
         useDepartName: {
           rules: [
-            { required: true, message: '璇烽�夋嫨瀵硅薄閮ㄩ棬!' },
+            { required: true, message: '璇烽�夋嫨浣跨敤閮ㄩ棬!' },
           ]
         },
         equipmentName: {
@@ -559,11 +559,13 @@
         list: "/eam/maintenanceStandardDetail/getMaintenanceStandardDetailListByIds",
         add: "/eam/maintenanceStandard/add",
         edit: "/eam/maintenanceStandard/edit",
-        addDetail: "/eam/maintenanceStandardDetail/add",
-        getMaintenanceCycle: "/eam/maintenanceStandardDetail/getMaintenanceCycle",
+        // addDetail: "/eam/maintenanceStandardDetail/add",
+        getMaintenanceCycle: "/eam/maintenanceStandardDetail/getPeriodicMaintenanceCycle",
         realDelete: "/eam/maintenanceStandardDetail/realDelete",
         revise: '/eam/maintenanceStandard/revise',
         getReviseVersion: "/eam/maintenanceStandard/getReviseVersion",
+        loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
+        getNum: '/eam/sysIdentity/getNumNew'
       },
 
       dataSource: [],
@@ -583,6 +585,7 @@
           standard: data[i].standard,
           maintenanceMethodName: data[i].maintenanceMethod_dictText,
           maintenanceTool: data[i].maintenanceTool,
+          location: data[i].location,
           maintenanceSpecialtyName: data[i].maintenanceSpecialtyId_dictText,
           maintenanceRequire: data[i].maintenanceRequire,
           workingHourQuota: data[i].workingHourQuota,
@@ -631,27 +634,27 @@
 
     add() {
       this.edit({ maintenanceStandardDetaillist: [] })
+      this.getSeq()
     },
 
     edit(record) {
       let that = this;
-      this.getMaintenanceCycle()
+      // this.initOptions();
+      // this.getMaintenanceCycle()
       this.dataSource = [];
       this.form.resetFields();
       this.model = Object.assign({}, record);
       this.visible = true;
       if (record.maintenanceStandardDetaillist != undefined) {
         const temp = [...record.maintenanceStandardDetaillist];
-        // for (let i = 0; i < temp.length; i++) {
-        //   let r = temp[i].upload;
-        //   r.src = this.getSrc(temp[i].upload);
-        // }
         that.dataSource = temp;
       }
       that.$nextTick(() => {
         that.form.setFieldsValue(pick(that.model, 'num', 'departId', 'teamId', 'equipmentId', 'equipmentName', 'useDepartName', 'useId', 'teamName', 'assignMode', 'version', 'remark'));
       });
       if (record.id) {
+        this.maintenanceCycles = []
+        this.getMaintenanceCycle(this.model.equipmentId)
         this.codeDisable = true;
         that.$nextTick(() => {
           if (that.isRevise) {
@@ -670,10 +673,28 @@
       }
     },
 
+    initOptions() {
+      getAction(this.url.loadOptions).then(res => {
+        if (res.success) {
+          this.treeData = res.result
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+
+    getSeq() {
+      getAction(this.url.getNum, { type: 'DailyMaintenanceStandard', length: 4 }).then(res => {
+        if (res.success) {
+          this.form.setFieldsValue({ "num": res.result })
+        }
+      })
+    },
+
     onEquipmentList() {
       let data = this.form.getFieldsValue(['departId']);
       if (data.departId == null || data.departId == "") {
-        this.$message.warning("璇峰厛閫夋嫨瀵硅薄閮ㄩ棬锛�");
+        this.$message.warning("璇峰厛閫夋嫨浣跨敤閮ㄩ棬锛�");
         return
       }
       this.$refs.EquipmentList.list(data.departId);
@@ -682,12 +703,14 @@
     sendEquipmentRecord(data) {
       this.dataSource = [];
       let record = data.record;
+      this.getMaintenanceCycle(record.id)
       this.form.setFieldsValue({ equipmentId: record.id, equipmentName: record.num + "/" + record.name + "/" + record.model, teamId: record.teamId, teamName: record.teamId_dictText });
+
     },
 
     onDepartList() {
       this.$refs.DepartList.list();
-      this.$refs.DepartList.title = "閫夋嫨瀵硅薄閮ㄩ棬";
+      this.$refs.DepartList.title = "閫夋嫨浣跨敤閮ㄩ棬";
     },
     sendDepartRecord(data) {
       this.dataSource = [];
@@ -706,7 +729,6 @@
     },
 
     handleOk() {
-      console.log("123")
       const that = this;
       this.form.validateFields((err, values) => {
         if (!err) {
@@ -722,10 +744,12 @@
           let obj;
           if (!this.model.id) {
             formData.versionStatus = '1'
+            formData.approvalStatus = '1'
             obj = postAction(this.url.add, formData);
           } else {
             if (this.isRevise) {
               formData.versionStatus = '1'
+              formData.approvalStatus = '1'
               obj = postAction(this.url.revise, formData);
             } else {
               obj = requestPut(this.url.edit, formData, { id: this.model.id });
@@ -764,8 +788,8 @@
       })
     },
 
-    getMaintenanceCycle() {
-      getAction(this.url.getMaintenanceCycle).then((res) => {
+    getMaintenanceCycle(equipmentId) {
+      getAction(this.url.getMaintenanceCycle, { equipmentId: equipmentId }).then((res) => {
         if (res.success) {
           this.maintenanceCycles = res.result
         }
@@ -793,6 +817,9 @@
         if (column.dataIndex == 'location') {
           target[column.dataIndex] = value.target.value;
         }
+        if (column.dataIndex == 'maintenanceRole') {
+          target[column.dataIndex] = value;
+        }
         //鏄剧ず甯﹁繃鏉ョ殑鏁版嵁
         that.dataSource = temp;
       }

--
Gitblit v1.9.3