From 92ff846fb659c62037a32b1d8c15eae9df9d9b54 Mon Sep 17 00:00:00 2001
From: zenglf <18502938215@163.com>
Date: 星期一, 18 九月 2023 13:24:30 +0800
Subject: [PATCH] Merge branch 'develop' of http://117.34.109.166:18448/r/vue_mdc_430

---
 src/views/eam/modules/equipmentSeal/EquipmentSealForm.vue |  508 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 508 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/modules/equipmentSeal/EquipmentSealForm.vue b/src/views/eam/modules/equipmentSeal/EquipmentSealForm.vue
new file mode 100644
index 0000000..7504805
--- /dev/null
+++ b/src/views/eam/modules/equipmentSeal/EquipmentSealForm.vue
@@ -0,0 +1,508 @@
+<template>
+  <a-spin :spinning="confirmLoading">
+    <j-form-container :disabled="formDisabled">
+      <!-- 涓昏〃鍗曞尯鍩� -->
+      <a-form-model
+        ref="form"
+        :model="model"
+        :rules="validatorRules"
+        slot="detail"
+      >
+        <a-row>
+          <a-col :span="24">
+            <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"
+            :hidden=true
+          >
+            <a-form-model-item
+              label="鍙樺姩鏂瑰紡"
+              :labelCol="labelCol"
+              :wrapperCol="wrapperCol"
+              prop="changeMethod"
+            >
+              <a-input
+                v-model="model.changeMethod"
+                placeholder="璇疯緭鍏ュ彉鍔ㄦ柟寮�"
+                defaultValue="seal"
+              ></a-input>
+            </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"
+                rows="4"
+                placeholder="璇疯緭鍏ュ娉�"
+              />
+            </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"
+      >
+        <j-vxe-table
+          keep-source
+          :ref="refKeys[0]"
+          :loading="equipmentSealDetailTable.loading"
+          :columns="equipmentSealDetailTable.columns"
+          :dataSource="equipmentSealDetailTable.dataSource"
+          :maxHeight="300"
+          :disabled="formDisabled"
+          :alwaysEdit="true"
+          :bordered="true"
+          :rowNumber="true"
+          :rowSelection="true"
+          :toolbar="true"
+          :toolbarConfig="toolbarConfig"
+          :linkage-config="linkageConfig"
+          :addDefaultRowNum="0"
+        >
+          <template slot="toolbarPrefix">
+            <a-button
+              type="primary"
+              @click="selectEquipmentList"
+              :disabled="formDisabled"
+            >閫夋嫨璁惧
+            </a-button>
+          </template>
+
+          <template v-slot:action="props">
+            <a-popconfirm
+              title="纭畾鍒犻櫎鍚楋紵"
+              @confirm="handleDL(props)"
+            >
+              <a>鍒犻櫎</a>
+            </a-popconfirm>
+          </template>
+        </j-vxe-table>
+      </a-tab-pane>
+    </a-tabs>
+    <equipment-select-modal ref="EquipmentSelectModal"></equipment-select-modal>
+  </a-spin>
+</template>
+
+<script>
+
+
+import { validateDuplicateValue } from '@/utils/util'
+// import EquipmentSelection from '@/components/tools/EquipmentSelection.vue'
+import EquipmentSelectModal from './EquipmentSelectModal.vue'
+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'
+
+export default {
+  name: 'EquipmentSealForm',
+  mixins: [JVxeTableModelMixin],
+  components: {
+    EquipmentSelectModal,
+    JFormContainer
+  },
+  data() {
+    return {
+      changeMethod: 'seal',
+      toolbarConfig: {
+        // prefix 鍓嶇紑锛泂uffix 鍚庣紑
+        slot: ['prefix', 'suffix'],
+        // add 鏂板鎸夐挳锛況emove 鍒犻櫎鎸夐挳锛沜learSelection 娓呯┖閫夋嫨鎸夐挳
+        btn: ['remove', 'clearSelection']
+      },
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 5 }
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 16 }
+      },
+      addDefaultRowNum: 0,
+      model: {},
+      validatorRules: {
+
+        num: [
+          { required: true, message: '璇疯緭鍏ュ崟鎹彿!' },
+          { validator: (rule, value, callback) => validateDuplicateValue('mom_eam_equipment_change', 'num', value, this.model.id, callback) }
+        ],
+
+        remark: [
+          { required: false, message: '璇疯緭鍏ュ娉�!' }
+        ]
+      },
+      linkageConfig: [
+        { handleVerify: this.handleVerify, key: 'maintenanceAfterUnseal' }
+      ],
+      refKeys: ['equipmentSealDetail'],
+      tableKeys: ['equipmentSealDetail'],
+      activeKey: 'equipmentSealDetail',
+      // 璁惧灏佸瓨鏄庣粏
+      equipmentSealDetailTable: {
+        loading: false,
+        dataSource: [],
+        columns: [
+          // {
+          //   title: '鎿嶄綔',
+          //   key: 'action',
+          //   width: '60px',
+          //   type: FormTypes.slot, // 瀹氫箟璇ュ垪涓� 鑷畾涔夋彃鍊煎垪
+          //   slotName: 'action' // slot 鐨勫悕绉帮紝瀵瑰簲 v-slot 鍐掑彿鍚庨潰鍜岀瓑鍙峰墠闈㈢殑鍐呭
+          // },
+          {
+            title: '璁惧灏佸瓨鏄庣粏id',
+            key: 'id',
+            type: JVXETypes.hidden,
+            width: '100px'
+          },
+          // fixed: 'left'
+          {
+            title: '璁惧鍙樺姩鍗昳d',
+            key: 'equipmentChangeId',
+            type: JVXETypes.hidden,
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
+          },
+          {
+            title: '璁惧ID',
+            key: 'equipmentId',
+            type: JVXETypes.hidden,
+            defaultValue: ''
+          },
+          {
+            title: '璁惧缂栫爜',
+            key: 'equipmentNum',
+            type: JVXETypes.normal,
+            width: '150px',
+            align: 'center'
+            // placeholder: '璇疯緭鍏�${title}',
+          },
+          // fixed: 'left'
+          {
+            title: '璁惧鍚嶇О',
+            key: 'equipmentName',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: 'center',
+            defaultValue: ''
+          },
+          {
+            title: '璁惧鍨嬪彿',
+            key: 'model',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: 'center',
+            defaultValue: ''
+          },
+          {
+            title: '璁惧瑙勬牸',
+            key: 'specification',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: 'center',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
+          },
+          {
+            title: '璁惧璧勪骇缂栫爜',
+            key: 'assetNumber',
+            type: JVXETypes.normal,
+            width: '150px',
+            align: 'center',
+            defaultValue: ''
+          },
+          {
+            title: '灏佸瓨鍘熷洜',
+            key: 'sealReason',
+            type: JVXETypes.input,
+            width: '200px',
+            align: 'center',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: '',
+            validateRules: [{
+              required: true, // 蹇呭~
+              message: '璇疯緭鍏�${title}' // 鏄剧ず鐨勬枃鏈�
+            }]
+          },
+          {
+            title: '灏佸瓨鏃ユ湡',
+            key: 'sealDate',
+            type: JVXETypes.datetime,
+            width: '150px',
+            align: 'center',
+            placeholder: '璇烽�夋嫨${title}',
+            defaultValue: '',
+            validateRules: [{
+              required: true, // 蹇呭~
+              message: '璇疯緭鍏�${title}' // 鏄剧ず鐨勬枃鏈�
+            }]
+
+          },
+          {
+            title: '棰勮鍚皝鏃ユ湡',
+            key: 'planUnsealDate',
+            type: JVXETypes.date,
+            width: '150px',
+            align: 'center',
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
+          },
+          {
+            title: '鐗圭璁惧',
+            key: 'specificEquipment',
+            type: JVXETypes.hidden,
+            disabled: true,
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: '',
+            width: '150px'
+          },
+          {
+            title: '鐗圭璁惧',
+            key: 'specificEquipment_dictText',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: 'center',
+            defaultValue: ''
+          },
+
+          {
+            title: '璁惧鐘舵��',
+            key: 'equipmentStatus_dictText',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: 'center',
+            defaultValue: ''
+          },
+          {
+            title: '鎶�鏈姸鎬�',
+            key: 'technologyStatus_dictText',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: 'center',
+            defaultValue: ''
+          },
+          {
+            title: '璁惧浣嶇疆',
+            key: 'location',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '200px',
+            align: 'center'
+          },
+          {
+            title: '閲嶈搴�',
+            key: 'equipmentImportanceId_dictText',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: 'center',
+            defaultValue: ''
+          },
+          {
+            title: '閲嶈搴�',
+            key: 'equipmentImportanceId',
+            type: JVXETypes.hidden
+          }
+          // {
+          //   title: '璁惧鍥剧墖',
+          //   key: 'equipmentPhoto',
+          //   type: JVXETypes.slot,
+          //   disabled: true,
+          //   width: '150px',
+          //   slotName: 'equipmentPhoto'
+          // },
+          // {
+          //   title: '鎿嶄綔',
+          //   key: 'action',
+          //   type: JVXETypes.slot,
+          //   disabled: true,
+          //   width: '150px',
+          //   align: "center",
+          //   slotName: 'action',
+          // },
+
+        ]
+      },
+      url: {
+        add: '/eam/equipmentSeal/add',
+        edit: '/eam/equipmentSeal/edit',
+        queryById: '/eam/equipmentSeal/queryById',
+        equipmentSealDetail: {
+          list: '/eam/equipmentSeal/listEquipmentSealDetailByMainId'
+        }
+      }
+    }
+  },
+  props: {
+    //琛ㄥ崟绂佺敤
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false
+    }
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled
+    }
+  },
+  created() {
+  },
+  mounted() {
+    this.$bus.$on('selectionRows', (data) => {
+      // 澧炲姞閫変腑鐨勮澶囧埌鍒楄〃涓�
+      this.addSelectedEquipments(data)
+
+    })
+  },
+  methods: {
+    handleChange(value, data) {
+      this.$nextTick(() => {
+        this.$set(data, 'maintenanceAfterUnseal', data.maintenanceAfterUnseal)
+      })
+    },
+    handleVerify(parent) {
+      if (parent == 'Y') {
+        // 蹇呭~銆�
+      }
+    },
+    selectionRows(data) {
+      // 澧炲姞閫変腑鐨勮澶囧埌鍒楄〃涓�
+      this.addSelectedEquipments(data)
+    },
+    handleDL(props) {
+      // 璋冪敤鍒犻櫎鏂规硶
+      props.target.removeRows(props.row)
+    },
+
+    //閫夋嫨璁惧
+    selectEquipmentList() {
+      let ids = []
+      let tableData = this.$refs.equipmentSealDetail.getTableData()
+      let deleteData = this.$refs.equipmentSealDetail.getDeleteData()
+      for (let i = 0; i < tableData.length; i++) {
+        ids.push(tableData[i].equipmentId)
+      }
+      // this.$refs.EquipmentSelection.showModals(ids, tableData)
+      // this.$refs.EquipmentSelection.title = '閫夋嫨璁惧'
+      // this.$refs.EquipmentSelection.disableSubmit = false
+      this.$refs.EquipmentSelectModal.showModals(ids)
+      this.$refs.EquipmentSelectModal.title = '閫夋嫨璁惧'
+      this.$refs.EquipmentSelectModal.disableSubmit = false
+    },
+    addSelectedEquipments(data) {
+      let tableData = this.$refs.equipmentSealDetail.getTableData()
+      let tableStr = tableData.toString()
+      let addRows = []
+      for (let i = 0; i < data.length; i++) {
+        var sealDetail = {}
+        if (tableStr.indexOf(data[i].id) == -1) {
+          sealDetail = {
+            equipmentId: data[i].id,
+            equipmentNum: data[i].num,
+            equipmentName: data[i].name,
+            assetNumber: data[i].assetNumber,
+            specificEquipment_dictText: data[i].specificEquipment_dictText,
+            specificEquipment: data[i].specificEquipment,
+            model: data[i].model,
+            specification: data[i].specification,
+            equipmentStatus_dictText: data[i].equipmentStatus_dictText,
+            equipmentStatus: data[i].equipmentStatus,
+            technologyStatus_dictText: data[i].technologyStatus_dictText,
+            technologyStatus: data[i].technologyStatus,
+            equipmentPhoto: data[i].equipmentPhoto,
+            location: data[i].location,
+            equipmentImportanceId_dictText: data[i].equipmentImportanceId_dictText,
+            equipmentImportanceId: data[i].equipmentImportanceId
+          }
+        }
+        addRows.push(sealDetail)
+      }
+      // this.$refs.equipmentSealDetail.clearAllData()
+      this.$refs.equipmentSealDetail.pushRows(addRows)
+    },
+    addBefore() {
+      this.equipmentSealDetailTable.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 = { equipmentChangeId: this.model.id }
+        this.requestSubTableData(this.url.equipmentSealDetail.list, params, this.equipmentSealDetailTable)
+      }
+    },
+    //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟
+    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, // 灞曞紑
+        equipmentSealDetailList: allValues.tablesValue[0].tableData
+      }
+    },
+    validateError(msg) {
+      this.$message.error(msg)
+    }
+
+  }
+
+}
+</script>
+
+<style scoped>
+
+/deep/ .jeecg-tabs-top {
+  overflow: visible;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3