From 0eaf97f0ae448f4376e89a8544efb54a930eb643 Mon Sep 17 00:00:00 2001
From: zenglf <18502938215@163.com>
Date: 星期三, 18 十月 2023 18:07:51 +0800
Subject: [PATCH] 操作证管理功能 前端界面增加操作证明细

---
 src/views/eam/modules/operationCertificate/OperationCertificateForm.vue |  430 +++++++++++++++++++++++++++--------------------------
 1 files changed, 222 insertions(+), 208 deletions(-)

diff --git a/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue b/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue
index 2821bf7..f3cb46e 100644
--- a/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue
+++ b/src/views/eam/modules/operationCertificate/OperationCertificateForm.vue
@@ -1,73 +1,76 @@
 <template>
-  <a-spin :spinning="confirmLoading">
-    <j-form-container :disabled="formDisabled">
+  <a-spin :spinning='confirmLoading'>
+    <j-form-container :disabled='formDisabled'>
       <!-- 涓昏〃鍗曞尯鍩� -->
-      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+      <a-form-model ref='form' :model='model' :rules='validatorRules' slot='detail'>
         <a-row>
-          <a-col :span="12" >
-            <a-form-model-item label="鎿嶄綔璇佺紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
-              <a-input v-model="model.num" placeholder="璇疯緭鍏ユ搷浣滆瘉缂栧彿" ></a-input>
+          <a-col :span='12'>
+            <a-form-model-item label='鎿嶄綔璇佺紪鍙�' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='num'>
+              <a-input v-model='model.num' placeholder='璇疯緭鍏ユ搷浣滆瘉缂栧彿'></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="12" >
-            <a-form-model-item label="濮撳悕" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId">
-              <j-select-user-by-dep v-model="model.userId" :multi="false" />
+          <a-col :span='12'>
+            <a-form-model-item label='濮撳悕' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='userId'>
+              <j-select-user-by-dep v-model='model.userId' :multi='false' />
             </a-form-model-item>
           </a-col>
-          <a-col :span="12" >
-            <a-form-model-item label="鍙戣瘉鏃ユ湡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="issueDate">
-              <j-date placeholder="璇烽�夋嫨鍙戣瘉鏃ユ湡" v-model="model.issueDate" style="width: 100%" />
+          <a-col :span='12'>
+            <a-form-model-item label='鍙戣瘉鏃ユ湡' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='issueDate'>
+              <j-date placeholder='璇烽�夋嫨鍙戣瘉鏃ユ湡' v-model='model.issueDate' style='width: 100%' />
             </a-form-model-item>
           </a-col>
-          <a-col :span="12" >
-            <a-form-model-item label="寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startTime">
-              <j-date placeholder="璇烽�夋嫨寮�濮嬫椂闂�" v-model="model.startTime" style="width: 100%" />
+          <a-col :span='12'>
+            <a-form-model-item label='寮�濮嬫椂闂�' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='startTime'>
+              <j-date placeholder='璇烽�夋嫨寮�濮嬫椂闂�' v-model='model.startTime' style='width: 100%' />
             </a-form-model-item>
           </a-col>
-          <a-col :span="12" >
-            <a-form-model-item label="缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="endTime">
-              <j-date placeholder="璇烽�夋嫨缁撴潫鏃堕棿" v-model="model.endTime" style="width: 100%" />
+          <a-col :span='12'>
+            <a-form-model-item label='缁撴潫鏃堕棿' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='endTime'>
+              <j-date placeholder='璇烽�夋嫨缁撴潫鏃堕棿' v-model='model.endTime' style='width: 100%' />
             </a-form-model-item>
           </a-col>
-          <a-col :span="12" >
-            <a-form-model-item label="褰撳墠鍛ㄦ湡鍒嗘暟" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="currentCycleScore">
-              <a-input-number v-model="model.currentCycleScore" placeholder="璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�" style="width: 100%" />
+          <a-col :span='12'>
+            <a-form-model-item label='褰撳墠鍛ㄦ湡鍒嗘暟' :labelCol='labelCol' :wrapperCol='wrapperCol'
+                               prop='currentCycleScore'>
+              <a-input-number v-model='model.currentCycleScore' placeholder='璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�' style='width: 100%' />
             </a-form-model-item>
           </a-col>
-          <a-col :span="12" >
-            <a-form-model-item label="璁惧缁熶竴缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentIds">
-              <j-multi-select-tag type="list_multi" v-model="model.equipmentIds" dictCode="mom_eam_equipment,num,id" placeholder="璇烽�夋嫨璁惧缁熶竴缂栫爜" />
+          <a-col :span='12'>
+            <a-form-model-item label='璁惧缁熶竴缂栫爜' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='equipmentIds'>
+              <j-multi-select-tag type='list_multi' v-model='model.equipmentIds' dictCode='mom_eam_equipment,num,id'
+                                  placeholder='璇烽�夋嫨璁惧缁熶竴缂栫爜' />
             </a-form-model-item>
           </a-col>
-          <a-col :span="12" >
-            <a-form-model-item label="鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
-              <j-dict-select-tag type="list" v-model="model.status" dictCode="certificate_status" placeholder="璇烽�夋嫨鐘舵��" disabled/>
+          <a-col :span='12'>
+            <a-form-model-item label='鐘舵��' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='status'>
+              <j-dict-select-tag type='list' v-model='model.status' dictCode='certificate_status'
+                                 placeholder='璇烽�夋嫨鐘舵��' disabled />
             </a-form-model-item>
           </a-col>
-          <a-col :span="24" >
-            <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
-              <a-textarea v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" ></a-textarea>
+          <a-col :span='24'>
+            <a-form-model-item label='澶囨敞' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='remark'>
+              <a-textarea v-model='model.remark' placeholder='璇疯緭鍏ュ娉�'></a-textarea>
             </a-form-model-item>
           </a-col>
 
         </a-row>
       </a-form-model>
     </j-form-container>
-      <!-- 瀛愯〃鍗曞尯鍩� -->
-    <a-tabs v-model="activeKey" @change="handleChangeTabs">
-      <a-tab-pane tab="鎿嶄綔璇佺鐞嗘槑缁�" :key="refKeys[0]" :forceRender="true">
+    <!-- 瀛愯〃鍗曞尯鍩� -->
+    <a-tabs v-model='activeKey' @change='handleChangeTabs'>
+      <a-tab-pane tab='鎿嶄綔璇佺鐞嗘槑缁�' :key='refKeys[0]' :forceRender='true'>
         <j-vxe-table
           keep-source
-          :ref="refKeys[0]"
-          :loading="operationCertificateDetailTable.loading"
-          :columns="operationCertificateDetailTable.columns"
-          :dataSource="operationCertificateDetailTable.dataSource"
-          :maxHeight="300"
-          :disabled="formDisabled"
-          :rowNumber="true"
-          :rowSelection="true"
-          :toolbar="true"
-          />
+          :ref='refKeys[0]'
+          :loading='operationCertificateDetailTable.loading'
+          :columns='operationCertificateDetailTable.columns'
+          :dataSource='operationCertificateDetailTable.dataSource'
+          :maxHeight='300'
+          :disabled='formDisabled'
+          :rowNumber='true'
+          :rowSelection='true'
+          :toolbar='true'
+        />
       </a-tab-pane>
     </a-tabs>
   </a-spin>
@@ -75,177 +78,188 @@
 
 <script>
 
-  import { getAction } from '@/api/manage'
-  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
-  import { JVXETypes } from '@/components/jeecg/JVxeTable'
-  import { getRefPromise,VALIDATE_FAILED} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
-  import { validateDuplicateValue } from '@/utils/util'
-  import JFormContainer from '@/components/jeecg/JFormContainer'
+import { getAction } from '@/api/manage'
+import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
+import { JVXETypes } from '@/components/jeecg/JVxeTable'
+import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
+import { validateDuplicateValue } from '@/utils/util'
+import JFormContainer from '@/components/jeecg/JFormContainer'
 
-  export default {
-    name: 'OperationCertificateForm',
-    mixins: [JVxeTableModelMixin],
-    components: {
-      JFormContainer,
-    },
-    data() {
-      return {
-        labelCol: {
-          xs: { span: 24 },
-          sm: { span: 5 },
-        },
-        wrapperCol: {
-          xs: { span: 24 },
-          sm: { span: 16 },
-        },
-        model:{
-         },
-        // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁
-        addDefaultRowNum: 1,
-        validatorRules: {
-           num: [
-              { required: true, message: '璇疯緭鍏ユ搷浣滆瘉缂栧彿!'},
-           ],
-           currentCycleScore: [
-              { required: true, message: '璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�!'},
-              { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!'},
-           ],
-        },
-        refKeys: ['operationCertificateDetail', ],
-        tableKeys:['operationCertificateDetail', ],
-        activeKey: 'operationCertificateDetail',
-        // 鎿嶄綔璇佺鐞嗘槑缁�
-        operationCertificateDetailTable: {
-          loading: false,
-          dataSource: [],
-          columns: [
-            {
-              title: '璇佷功ID',
-              key: 'operationCertificateId',
-               type: JVXETypes.hidden,
-              width:"200px",
-              placeholder: '璇疯緭鍏�${title}',
-              defaultValue:'',
-            },
-            {
-              title: '鏃ユ湡',
-              key: 'happenDate',
-              type: JVXETypes.date,
-              width:"120px",
-              placeholder: '璇疯緭鍏�${title}',
-              defaultValue:'',
-            },
-            {
-              title: '绫诲瀷',
-              key: 'type',
-               type: JVXETypes.select,
-              dictCode: 'certificate_change_type',
-              width:"100px",
-              placeholder: '璇疯緭鍏�${title}',
-              defaultValue:'',
-            },
-            {
-              title: '璁惧缁熶竴缂栫爜',
-              key: 'equipmentId',
-              type: JVXETypes.selectSearch,
-              dictCode: 'mom_eam_equipment,num,id ',
-              width: '200px',
-              placeholder: '璇疯緭鍏�${title}',
-              defaultValue: '',
-              validateRules: [{ required: true, message: '${title}涓嶈兘涓虹┖' }]
-            },
-            {
-              title: '鎵e垎椤�',
-              key: 'deductionItem',
-              type: JVXETypes.selectSearch,
-              dictCode: 'mom_eam_base_deduction_item,content,id ',
-              width:"500px",
-              placeholder: '璇疯緭鍏�${title}',
-              defaultValue:'',
-            },
-            {
-              title: '鎵e垎鍛ㄦ湡',
-              key: 'period',
-               type: JVXETypes.normal,
-              width:"200px",
-              placeholder: '璇疯緭鍏�${title}',
-              defaultValue:'',
-            },
-          ]
-        },
-        url: {
-          add: "/eam/operationCertificate/add",
-          edit: "/eam/operationCertificate/edit",
-          queryById: "/eam/operationCertificate/queryById",
-          operationCertificateDetail: {
-            list: '/eam/operationCertificate/queryOperationCertificateDetailByMainId'
+export default {
+  name: 'OperationCertificateForm',
+  mixins: [JVxeTableModelMixin],
+  components: {
+    JFormContainer
+  },
+  data() {
+    return {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      },
+      model: {},
+      // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁
+      addDefaultRowNum: 1,
+
+      validatorRules: {
+        num: [
+          { required: true, message: '璇疯緭鍏ユ搷浣滆瘉缂栧彿!' }
+        ],
+        currentCycleScore: [
+          { required: true, message: '璇疯緭鍏ュ綋鍓嶅懆鏈熷垎鏁�!' },
+          { pattern: /^-?\d+\.?\d*$/, message: '璇疯緭鍏ユ暟瀛�!' }
+        ]
+      },
+      refKeys: ['operationCertificateDetail'],
+      tableKeys: ['operationCertificateDetail'],
+      activeKey: 'operationCertificateDetail',
+      // 鎿嶄綔璇佺鐞嗘槑缁�
+      operationCertificateDetailTable: {
+        loading: false,
+        dataSource: [],
+        columns: [
+          {
+            title: '璇佷功ID',
+            key: 'operationCertificateId',
+            type: JVXETypes.hidden,
+            width: '200px',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
           },
+          {
+            title: '鏃ユ湡',
+            key: 'happenDate',
+            type: JVXETypes.date,
+            width: '120px',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
+          },
+          {
+            title: '绫诲瀷',
+            key: 'type',
+            type: JVXETypes.select,
+            dictCode: 'certificate_change_type',
+            width: '100px',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
+          },
+          {
+            title: '璁惧缁熶竴缂栫爜',
+            key: 'equipmentId',
+            type: JVXETypes.selectSearch,
+            dictCode: 'mom_eam_equipment,num,id ',
+            width: '200px',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: '',
+            validateRules: [{ required: true, message: '${title}涓嶈兘涓虹┖' }]
+          },
+          {
+            title: '鎵e垎椤�',
+            key: 'deductionItem',
+            type: JVXETypes.selectSearch,
+            dictCode: 'mom_eam_base_deduction_item,content,id ',
+            width: '500px',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
+          },
+          // {
+          //   title: '鎵e垎鍛ㄦ湡',
+          //   key: 'period',
+          //   type: JVXETypes.normal,
+          //   width: '200px',
+          //   placeholder: '璇疯緭鍏�${title}',
+          //   defaultValue: ''
+          // }
+        ]
+      },
+      url: {
+        add: '/eam/operationCertificate/add',
+        edit: '/eam/operationCertificate/edit',
+        queryById: '/eam/operationCertificate/queryById',
+        operationCertificateDetail: {
+          list: '/eam/operationCertificate/queryOperationCertificateDetailByMainId'
         }
       }
-    },
-    props: {
-      //琛ㄥ崟绂佺敤
-      disabled: {
-        type: Boolean,
-        default: false,
-        required: false
-      }
-    },
-    computed: {
-      formDisabled(){
-        return this.disabled
-      },
-    },
-    created () {
-    },
-    methods: {
-      addBefore(){
-        this.operationCertificateDetailTable.dataSource=[]
-      },
-      getAllTable() {
-        let values = this.tableKeys.map(key => getRefPromise(this, key))
-        return Promise.all(values)
-      },
-      /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */
-      editAfter() {
-        this.$nextTick(() => {
-        })
-        // 鍔犺浇瀛愯〃鏁版嵁
-        if (this.model.id) {
-          let params = { id: this.model.id }
-          this.requestSubTableData(this.url.operationCertificateDetail.list, params, this.operationCertificateDetailTable)
-        }
-      },
-      //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟
-        validateSubForm(allValues){
-            return new Promise((resolve,reject)=>{
-              Promise.all([
-              ]).then(() => {
-                resolve(allValues)
-              }).catch(e => {
-                if (e.error === VALIDATE_FAILED) {
-                  // 濡傛灉鏈夋湭閫氳繃琛ㄥ崟楠岃瘉鐨勫瓙琛紝灏辫嚜鍔ㄨ烦杞埌瀹冩墍鍦ㄧ殑tab
-                  this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
-                } else {
-                  console.error(e)
-                }
-              })
-            })
-        },
-      /** 鏁寸悊鎴恌ormData */
-      classifyIntoFormData(allValues) {
-        let main = Object.assign(this.model, allValues.formValue)
-        return {
-          ...main, // 灞曞紑
-          operationCertificateDetailList: allValues.tablesValue[0].tableData,
-        }
-      },
-      validateError(msg){
-        this.$message.error(msg)
-      },
-
     }
+  },
+  props: {
+    //琛ㄥ崟绂佺敤
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false
+    },
+    //瀛愯〃鍔犺浇
+    loadSubTableData: {
+      type: Boolean,
+      default: true,
+      required: false
+    }
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled
+    },
+    loadSubTableDataMode() {
+      return this.loadSubTableData
+    }
+  },
+  created() {
+  },
+  methods: {
+    addBefore() {
+      this.operationCertificateDetailTable.dataSource = []
+    },
+    getAllTable() {
+      let values = this.tableKeys.map(key => getRefPromise(this, key))
+      return Promise.all(values)
+    },
+    /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */
+    editAfter() {
+      this.$nextTick(() => {
+      })
+      console.log( "this.loadSubTableDataMode:"+this.loadSubTableDataMode)
+      // 鍔犺浇瀛愯〃鏁版嵁
+      if (this.model.id && this.loadSubTableDataMode) {
+        let params = { id: this.model.id }
+        // 鍔犺浇瀛愯〃鏁版嵁
+        this.requestSubTableData(this.url.operationCertificateDetail.list, params, this.operationCertificateDetailTable)
+      }
+
+    },
+    //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟
+    validateSubForm(allValues) {
+      return new Promise((resolve, reject) => {
+        Promise.all([]).then(() => {
+          resolve(allValues)
+        }).catch(e => {
+          if (e.error === VALIDATE_FAILED) {
+            // 濡傛灉鏈夋湭閫氳繃琛ㄥ崟楠岃瘉鐨勫瓙琛紝灏辫嚜鍔ㄨ烦杞埌瀹冩墍鍦ㄧ殑tab
+            this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
+          } else {
+            console.error(e)
+          }
+        })
+      })
+    },
+    /** 鏁寸悊鎴恌ormData */
+    classifyIntoFormData(allValues) {
+      let main = Object.assign(this.model, allValues.formValue)
+      return {
+        ...main, // 灞曞紑
+        operationCertificateDetailList: allValues.tablesValue[0].tableData
+      }
+    },
+    validateError(msg) {
+      this.$message.error(msg)
+    }
+
   }
+}
 </script>
 
 <style scoped>

--
Gitblit v1.9.3