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/equipmentUnseal/EquipmentUnsealForm.vue |  519 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 519 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/modules/equipmentUnseal/EquipmentUnsealForm.vue b/src/views/eam/modules/equipmentUnseal/EquipmentUnsealForm.vue
new file mode 100644
index 0000000..f8631a9
--- /dev/null
+++ b/src/views/eam/modules/equipmentUnseal/EquipmentUnsealForm.vue
@@ -0,0 +1,519 @@
+<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="unseal"
+              ></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="equipmentUnsealDetailTable.loading"
+          :columns="equipmentUnsealDetailTable.columns"
+          :dataSource="equipmentUnsealDetailTable.dataSource"
+          :maxHeight="300"
+          :disabled="formDisabled"
+          :rowNumber="true"
+          :rowSelection="true"
+          :toolbar="true"
+          :toolbarConfig="toolbarConfig"
+          :alwaysEdit='true'
+          :bordered='true'
+        >
+
+          <template slot="toolbarPrefix">
+            <a-button
+              type="primary"
+              @click="selectEquipmentList"
+              :disabled="formDisabled"
+            >閫夋嫨璁惧
+            </a-button>
+          </template>
+          <!-- 璁惧鍥剧墖鎻掓Ы -->
+          <!-- <template v-slot:equipmentPhoto='props'>
+            <Tooltip
+              placement="top"
+              title="棰勮鍥剧墖"
+            >
+              <span
+                v-if="!text"
+                style="font-size: 12px;font-style: italic;"
+              >鏃犲浘鐗�</span>
+              <img
+                v-else
+                :src="getImgView(text)"
+                :preview="props.rowId"
+                height="25px"
+                alt=""
+                style="max-width:80px;font-size: 12px;font-style: italic;"
+              />
+            </Tooltip>
+          </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 { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
+import { randomUUID, randomNumber } from '@/utils/util'
+
+import { validateDuplicateValue } from '@/utils/util'
+import pick from 'lodash.pick'
+import { getAction, postAction, requestPut } from '@api/manage'
+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: 'EquipmentUnsealForm',
+  mixins: [JVxeTableModelMixin],
+  components: {
+    EquipmentSelectModal,
+    JFormContainer
+  },
+  data() {
+    return {
+      changeMethod: 'unseal',
+      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 }
+      },
+      model: {},
+      // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁
+      addDefaultRowNum: 0,
+      validatorRules: {
+        num: [
+          { required: true, message: '璇疯緭鍏ュ崟鎹彿!' },
+          { validator: (rule, value, callback) => validateDuplicateValue('mom_eam_equipment_change', 'num', value, this.model.id, callback) }
+        ],
+        remark: [
+          { required: false, message: '璇疯緭鍏ュ娉�!' }
+        ]
+      },
+      refKeys: ['equipmentUnsealDetail'],
+      tableKeys: ['equipmentUnsealDetail'],
+      activeKey: 'equipmentUnsealDetail',
+      // 璁惧鍚皝鏄庣粏
+      equipmentUnsealDetailTable: {
+        loading: false,
+        dataSource: [],
+        columns: [
+          {
+            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",
+          },
+          // fixed: 'left'
+          {
+            title: '璁惧鍚嶇О',
+            key: 'equipmentName',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: "center",
+            defaultValue: ''
+          },
+          // fixed: 'left',
+          {
+            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.normal,
+            disabled: true,
+            width: '200px',
+            align: "center",
+          },
+          {
+            title: '灏佸瓨鏃ユ湡',
+            key: 'sealDate',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: "center",
+          },
+          {
+            title: '鍚皝鏃ユ湡',
+            key: 'unsealDate',
+            type: JVXETypes.datetime,
+            width: '150px',
+            align: "center",
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: '',
+            validateRules: [{
+              required: true, // 蹇呭~
+              message: '${title}涓嶈兘涓虹┖' // 鎻愮ず鐨勬枃鏈�
+            }]
+          },
+          {
+            title: '鍚皝鍘熷洜',
+            key: 'unsealReason',
+            type: JVXETypes.textarea,
+            width: '200px',
+            align: "center",
+            placeholder: '璇疯緭鍏�${title}',
+            defaultValue: '',
+            validateRules: [{
+              required: true, // 蹇呭~
+              message: '${title}涓嶈兘涓虹┖' // 鎻愮ず鐨勬枃鏈�
+            }]
+          },
+          {
+            title: '鐗圭璁惧',
+            key: 'specificEquipment',
+            type: JVXETypes.hidden,
+            disabled: true,
+            width: '150px',
+            align: "center",
+            defaultValue: ''
+          },
+          {
+            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: 'equipmentStatus',
+          //   type: JVXETypes.select,
+          //   options: [],
+          //   dictCode: 'equipment_status',
+          //   disabled: true,
+          //   width: '200px',
+          //   // placeholder: '璇疯緭鍏�${title}',
+          //   defaultValue: ''
+          // },
+          {
+            title: '鎶�鏈姸鎬�',
+            key: 'technologyStatus_dictText',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: "center",
+            defaultValue: ''
+          },
+          {
+            title: '璁惧浣嶇疆',
+            key: 'location',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: "center",
+          },
+          {
+            title: '閲嶈搴�',
+            key: 'equipmentImportanceId_dictText',
+            type: JVXETypes.normal,
+            disabled: true,
+            width: '150px',
+            align: "center",
+            // placeholder: '璇疯緭鍏�${title}',
+            defaultValue: ''
+          },
+          {
+            title: '閲嶈搴�',
+            key: 'equipmentImportanceId',
+            type: JVXETypes.hidden
+          },
+          // {
+          //   title: '璁惧鍥剧墖',
+          //   key: 'equipmentPhoto',
+          //   type: JVXETypes.slot,
+          //   disabled: true,
+          //   width: '120px',
+          //   slotName: 'equipmentPhoto'
+          // },
+          // {
+          //   title: '鎿嶄綔',
+          //   key: 'action',
+          //   type: JVXETypes.slot,
+          //   disabled: true,
+          //   width: '100px',
+          //   slotName: 'action',
+          // },
+        ]
+      },
+      url: {
+        add: '/eam/equipmentUnseal/add',
+        edit: '/eam/equipmentUnseal/edit',
+        queryById: '/eam/equipmentUnseal/queryById',
+        equipmentUnsealDetail: {
+          list: '/eam/equipmentUnseal/listEquipmentUnsealDetailByMainId'
+        }
+      }
+    }
+  },
+  props: {
+    //琛ㄥ崟绂佺敤
+    disabled: {
+      type: Boolean,
+      default: false,
+      required: false
+    }
+  },
+  computed: {
+    formDisabled() {
+      return this.disabled
+    }
+  },
+  mounted() {
+    this.$bus.$on('selectionRows', (data) => {
+      // 澧炲姞閫変腑鐨勮澶囧埌鍒楄〃涓�
+      this.addSelectedEquipments(data)
+
+    })
+  },
+  created() {
+  },
+  methods: {
+    //閫夋嫨璁惧
+    selectEquipmentList() {
+      let ids = []
+      let tableData = this.$refs.equipmentUnsealDetail.getTableData()
+      let deleteData = this.$refs.equipmentUnsealDetail.getDeleteData()
+      for (let i = 0; i < tableData.length; i++) {
+        ids.push(tableData[i].equipmentId)
+      }
+      this.$refs.EquipmentSelectModal.showModals(ids)
+      this.$refs.EquipmentSelectModal.title = '閫夋嫨璁惧'
+      this.$refs.EquipmentSelectModal.disableSubmit = false
+    },
+    addSelectedEquipments(data) {
+      let tableData = this.$refs.equipmentUnsealDetail.getTableData()
+      let tableStr = JSON.stringify(tableData)
+      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,
+            sealReason: data[i].sealReason,
+            sealDate: data[i].sealDate
+          }
+        }
+        addRows.push(sealDetail)
+      }
+      this.$refs.equipmentUnsealDetail.pushRows(addRows)
+    },
+    handleDL(props) {
+      // 璋冪敤鍒犻櫎鏂规硶
+      props.target.removeRows(props.row)
+    },
+    addBefore() {
+      this.equipmentUnsealDetailTable.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.equipmentUnsealDetail.list, params, this.equipmentUnsealDetailTable)
+      }
+    },
+    //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟
+    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, // 灞曞紑
+        equipmentUnsealDetailList: allValues.tablesValue[0].tableData
+      }
+    },
+    validateError(msg) {
+      this.$message.error(msg)
+    }
+
+  }
+}
+</script>
+
+<style scoped>
+/** tab panel 涓湁涓嬫媺妗�/鏃ユ湡 杩欑被甯︿笅鎷夋晥鏋滅殑锛岄渶瑕佸姞姝ゆ牱寮� */
+/deep/ .jeecg-tabs-top {
+  overflow: visible;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3