From b008401dfa948e874ce1e340e669322d6c68c097 Mon Sep 17 00:00:00 2001
From: cuijian <cuijian@xalxzn.com>
Date: 星期四, 31 八月 2023 18:42:57 +0800
Subject: [PATCH] 专业点检标准、专业点检方案增加自动生成编码,项目性维修上传附件功能

---
 src/views/eam/SpecialtyInspectionPlanList.vue                                          |    2 
 src/views/eam/modules/specialtyInspectionStandard/SpecialtylnspectionStandardModal.vue |   28 ++++++--
 src/views/eam/modules/projectMaintenanceOrder/ProjectMaintenanceOrderForm.vue          |   33 +++++++++-
 src/views/eam/SerialNumberList.vue                                                     |   12 ++--
 src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue         |   21 ++++--
 src/views/eam/SpecialtyInspectionStandardList.vue                                      |   12 ++++
 src/views/spare/modules/sparePart/SparePartModel.vue                                   |   25 +++++---
 src/views/eam/ProjectMaintenanceOrderList.vue                                          |   45 ++++++++------
 8 files changed, 122 insertions(+), 56 deletions(-)

diff --git a/src/views/eam/ProjectMaintenanceOrderList.vue b/src/views/eam/ProjectMaintenanceOrderList.vue
index 24aefee..e805135 100644
--- a/src/views/eam/ProjectMaintenanceOrderList.vue
+++ b/src/views/eam/ProjectMaintenanceOrderList.vue
@@ -132,22 +132,21 @@
         @change='handleTableChange'
       >
         <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'checkbox'}" -->
-        <template
-          slot='imgSlot'
-          slot-scope='text,record'
-        >
-          <span
-            v-if='!text'
-            style='font-size: 12px;font-style: italic;'
-          >鏃犲浘鐗�</span>
-          <img
+        <template slot="imgSlot" slot-scope="text,record">
+          <span v-if="!record.path" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>
+          <img v-else :src="getImgView(record.path)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
+        </template>
+        <template slot="fileSlot" slot-scope="text">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>
+          <a-button
             v-else
-            :src='getImgView(text)'
-            :preview='record.id'
-            height='25px'
-            alt=''
-            style='max-width:80px;font-size: 12px;font-style: italic;'
-          />
+            :ghost="true"
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)">
+            涓嬭浇
+          </a-button>
         </template>
 
         <span
@@ -324,11 +323,17 @@
           // }
         },
         {
-          title: '闄勪欢',
-          align: "center",
-          dataIndex: 'annex',
-          scopedSlots: { customRender: 'imgSlot' }
-        },
+            title:'闄勪欢',
+            align:"center",
+            dataIndex: 'annex',
+            scopedSlots: {customRender: 'fileSlot'}
+          },
+          // {
+          //   title:'鍥剧墖棰勮',
+          //   align:"center",
+          //   dataIndex: 'annex',
+          //   scopedSlots: {customRender: 'imgSlot'}
+          // },
         // {
         //   title:'鍙樺姩鏂瑰紡',
         //   align:"center",
diff --git a/src/views/eam/SerialNumberList.vue b/src/views/eam/SerialNumberList.vue
index 2b16125..cc9c7dd 100644
--- a/src/views/eam/SerialNumberList.vue
+++ b/src/views/eam/SerialNumberList.vue
@@ -198,12 +198,12 @@
           dataIndex: 'beginSymbol',
           sorter: true,
         },
-        {
-          title: '浼佷笟浠g爜',
-          align: 'center',
-          dataIndex: 'enterpriseCode',
-          sorter: true,
-        },
+        // {
+        //   title: '浼佷笟浠g爜',
+        //   align: 'center',
+        //   dataIndex: 'enterpriseCode',
+        //   sorter: true,
+        // },
         {
           title: '绫诲瀷',
           align: 'center',
diff --git a/src/views/eam/SpecialtyInspectionPlanList.vue b/src/views/eam/SpecialtyInspectionPlanList.vue
index 42507f4..c470fc3 100644
--- a/src/views/eam/SpecialtyInspectionPlanList.vue
+++ b/src/views/eam/SpecialtyInspectionPlanList.vue
@@ -13,7 +13,7 @@
             :md="6"
             :sm="8"
           >
-            <a-form-item label='鐐规璁″垝缂栫爜'>
+            <a-form-item label='鐐规鏂规缂栫爜'>
               <a-input
                 placeholder='璇疯緭鍏ヨ澶囩紪鐮�'
                 v-model='queryParam.num'
diff --git a/src/views/eam/SpecialtyInspectionStandardList.vue b/src/views/eam/SpecialtyInspectionStandardList.vue
index 536795b..a99b9fa 100644
--- a/src/views/eam/SpecialtyInspectionStandardList.vue
+++ b/src/views/eam/SpecialtyInspectionStandardList.vue
@@ -154,6 +154,10 @@
           >鍗囩増</a>
           <a-divider type="vertical" />
           <a
+            v-if="record.versionStatus == '2'"
+            @click="handleCopy(record)"
+          >澶嶅埗</a>
+          <a
             v-if="record.versionStatus == '1'"
             @click="handleTakeEffect(record)"
           >鐢熸晥</a>
@@ -357,6 +361,14 @@
       this.$refs.modalForm.isRevise = true;
     },
 
+    //澶嶅埗
+    handleCopy: function (record) {
+      this.$refs.modalForm.edit(record);
+      this.$refs.modalForm.title = "涓撲笟鐐规鏍囧噯澶嶅埗";
+      this.$refs.modalForm.disableSubmit = false;
+      this.$refs.modalForm.isCopy = true;
+    },
+
     //鐢熸晥
     handleTakeEffect(record) {
       const that = this;
diff --git a/src/views/eam/modules/projectMaintenanceOrder/ProjectMaintenanceOrderForm.vue b/src/views/eam/modules/projectMaintenanceOrder/ProjectMaintenanceOrderForm.vue
index 89b0747..73205d1 100644
--- a/src/views/eam/modules/projectMaintenanceOrder/ProjectMaintenanceOrderForm.vue
+++ b/src/views/eam/modules/projectMaintenanceOrder/ProjectMaintenanceOrderForm.vue
@@ -97,10 +97,7 @@
               :wrapperCol='wrapperCol'
               prop='annex'
             >
-              <j-image-upload
-                :isMultiple="false"
-                v-model="model.annex"
-              ></j-image-upload>
+            <j-upload :returnUrl= "false" :isMultiple="false"  v-model="model.file" ></j-upload>
             </a-form-model-item>
           </a-col>
           <a-col :span='12'>
@@ -215,10 +212,10 @@
 
 import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
 import { JVXETypes } from '@comp/jeecg/JVxeTable'
-import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
 
 import JFormContainer from '@/components/jeecg/JFormContainer'
 import { getAction } from '@api/manage'
+import { VALIDATE_FAILED, getRefPromise, validateFormAndTables,validateFormModelAndTables} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
 
 export default {
   name: 'ProjectMaintenanceOrderForm',
@@ -543,6 +540,32 @@
   },
   methods: {
 
+    handleOk() {
+      this.model['annex'] = this.model.file[0].filePath;
+      /** 瑙﹀彂琛ㄥ崟楠岃瘉 */
+      this.getAllTable().then(tables => {
+        /** 涓�娆℃�ч獙璇佷富琛ㄥ拰鎵�鏈夌殑娆¤〃 */
+        return validateFormModelAndTables(this.$refs.form,this.model, tables)
+      }).then(allValues => {
+        /** 涓�娆℃�ч獙璇佷竴瀵逛竴鐨勬墍鏈夊瓙琛� */
+        return this.validateSubForm(allValues)
+      }).then(allValues => {
+        if (typeof this.classifyIntoFormData !== 'function') {
+          throw this.throwNotFunction('classifyIntoFormData')
+        }
+        let formData = this.classifyIntoFormData(allValues)
+        // 鍙戣捣璇锋眰
+        return this.request(formData)
+      }).catch(e => {
+        if (e.error === VALIDATE_FAILED) {
+          // 濡傛灉鏈夋湭閫氳繃琛ㄥ崟楠岃瘉鐨勫瓙琛紝灏辫嚜鍔ㄨ烦杞埌瀹冩墍鍦ㄧ殑tab
+          this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
+        } else {
+          console.error(e)
+        }
+      })
+    },
+
     getSuppler() {
       getAction(this.url.supplierVoList).then((res) => {
         if (res.success) {
diff --git a/src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue b/src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue
index 06f9007..f22b2d8 100644
--- a/src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue
+++ b/src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue
@@ -340,11 +340,11 @@
       form: this.$form.createForm(this),
       headers: {},
       validatorRules: {
-        num: {
-          rules: [
-            { required: true, message: '璇疯緭鍏ョ偣妫�璁″垝缂栫爜!' },
-          ]
-        },
+        // num: {
+        //   rules: [
+        //     { required: true, message: '璇疯緭鍏ョ偣妫�璁″垝缂栫爜!' },
+        //   ]
+        // },
         inspectionCycleId: {
           rules: [
             { required: true, message: '璇烽�夋嫨鐐规鍛ㄦ湡!' },
@@ -384,6 +384,7 @@
         listByBusIdAndBusType: "/system/sysUploadRela/listByBusIdAndBusType",
         getInspectionCycle: "/eam/inspectionStandardDetail/getInspectionCycle",
         // getSysDeparts: "/eam/specialtyInspectionPlan/getSysDeparts",
+        getNum: '/eam/sysIdentity/getNumNew',
       },
       dataSource: [],
       //鐢ㄤ簬灞曠ず鏂囦欢
@@ -522,7 +523,7 @@
     handleOk() {
       const that = this;
       // 瑙﹀彂琛ㄥ崟楠岃瘉
-      that.form.validateFields((err, values) => {
+      that.form.validateFields(async (err, values) => {
         if (JSON.stringify(that.fileObject.file) == '{}' && that.uploadId == '' && that.fileList.length == 0) {
           that.$message.warning("璇蜂笂浼犳枃浠�");
           return false
@@ -543,7 +544,13 @@
             method = 'put';
           }
           let formData = Object.assign(that.model, values);
-
+          if(!formData.num){
+                await getAction(this.url.getNum, { type: 'SpecialtyInspectionPlan', length: '4' }).then((res) => {
+                if (res.success) {
+                  formData.num = res.message;
+                }
+              });
+            }
           formData.type = "inspection_path_photo";
           formData.uploadId = that.uploadId;
           formData.fileType = "7";//鏂囦欢绫诲瀷  7锛氬浘鐗�
diff --git a/src/views/eam/modules/specialtyInspectionStandard/SpecialtylnspectionStandardModal.vue b/src/views/eam/modules/specialtyInspectionStandard/SpecialtylnspectionStandardModal.vue
index 6fd79a4..2573712 100644
--- a/src/views/eam/modules/specialtyInspectionStandard/SpecialtylnspectionStandardModal.vue
+++ b/src/views/eam/modules/specialtyInspectionStandard/SpecialtylnspectionStandardModal.vue
@@ -22,7 +22,7 @@
               <a-input
                 allow-clear
                 :disabled="codeDisable"
-                :placeholder="disableSubmit?'':'璇疯緭鍏ョ偣妫�鏍囧噯缂栫爜'"
+                :placeholder="disableSubmit?'':'璇疯緭鍏ョ偣妫�鏍囧噯缂栫爜锛屼笉杈撳叆灏嗙敱绯荤粺鑷姩鐢熸垚缂栫爜'"
                 v-decorator="['num', validatorRules.num ]"
               />
             </a-form-item>
@@ -291,6 +291,7 @@
       model: {},
       inspectionCycles: {},
       isRevise: false,
+      isCopy:false,
       labelCol: {
         xs: { span: 24 },
         sm: { span: 6 },
@@ -302,11 +303,11 @@
       confirmLoading: false,
       form: this.$form.createForm(this),
       validatorRules: {
-        num: {
-          rules: [
-            { required: true, message: '璇疯緭鍏ョ偣妫�鏍囧噯缂栫爜!' },
-          ]
-        },
+        // num: {
+        //   rules: [
+        //     { required: true, message: '璇疯緭鍏ョ偣妫�鏍囧噯缂栫爜!' },
+        //   ]
+        // },
         equipmentName: {
           rules: [
             { required: true, message: '璇烽�夋嫨璁惧!' },
@@ -330,6 +331,8 @@
         getInspectionCycle: "/eam/inspectionStandardDetail/getInspectionCycle",
         revise: '/eam/specialtyStandard/revise',
         getReviseVersion: "/eam/specialtyStandard/getReviseVersion",
+        getNum: '/eam/sysIdentity/getNumNew',
+        getCopy: "/eam/specialtyStandard/getCopy",
       },
 
       dataSource: [],
@@ -426,20 +429,29 @@
 
     handleOk() {
       const that = this;
-      this.form.validateFields((err, values) => {
+      this.form.validateFields(async (err, values) => {
         if (!err) {
           that.confirmLoading = true;
           let formData = Object.assign(this.model, values);
           formData.specialtyInspectionStandardDetaillist = that.dataSource;
           let obj;
           if (!this.model.id) {
+            if(!formData.num){
+                await getAction(this.url.getNum, { type: 'SpecialtyInspectionStandard', length: '4' }).then((res) => {
+                if (res.success) {
+                  formData.num = res.message;
+                }
+              });
+            }
             formData.versionStatus = '1'
             obj = postAction(this.url.add, formData);
           } else {
             if (this.isRevise) {
               formData.versionStatus = '1'
               obj = postAction(this.url.revise, formData);
-            } else {
+            } else if(this.isCopy){
+              obj = postAction(this.url.getCopy, formData);
+            }else {
               obj = requestPut(this.url.edit, formData, { id: this.model.id });
             }
           }
diff --git a/src/views/spare/modules/sparePart/SparePartModel.vue b/src/views/spare/modules/sparePart/SparePartModel.vue
index b5f7752..223f820 100644
--- a/src/views/spare/modules/sparePart/SparePartModel.vue
+++ b/src/views/spare/modules/sparePart/SparePartModel.vue
@@ -311,7 +311,7 @@
       validatorRules: {
         num: {
           rules: [
-            { required: true, message: '璇疯緭鍏ヨ澶囧垎绫荤紪鍙�!' },
+            // { required: true, message: '璇疯緭鍏ヨ澶囧垎绫荤紪鍙�!' },
             { min: 2, max: 30, message: '闀垮害鍦� 2 鍒� 30 涓瓧绗�', trigger: 'blur' },
             // { validator: this.validateNum },
           ]
@@ -378,13 +378,13 @@
         this.codeDisable = true;
       } else {
         this.codeDisable = false;
-        this.$nextTick(() => {
-          getAction(this.url.getNum, { type: 'SparePart', length: '4' }).then((res) => {
-            if (res.success) {
-              this.form.setFieldsValue({ num: res.message });
-            }
-          })
-        });
+        // this.$nextTick(() => {
+        //   getAction(this.url.getNum, { type: 'SparePart', length: '4' }).then((res) => {
+        //     if (res.success) {
+        //       this.form.setFieldsValue({ num: res.message });
+        //     }
+        //   })
+        // });
       }
     },
 
@@ -396,12 +396,19 @@
     handleOk() {
       const that = this;
       // 瑙﹀彂琛ㄥ崟楠岃瘉
-      this.form.validateFields((err, values) => {
+      this.form.validateFields(async (err, values) => {
         if (!err) {
           that.confirmLoading = true;
           let formData = Object.assign(this.model, values);
           let obj;
           if (!this.model.id) {
+            if(!formData.num){
+                await getAction(this.url.getNum, { type: 'SparePart', length: '4' }).then((res) => {
+                if (res.success) {
+                  formData.num = res.message;
+                }
+              });
+            }
             formData.sparePartCategoryId = this.sparePartCategoryId
             obj = postAction(this.url.add, formData);
           } else {

--
Gitblit v1.9.3