lyh
21 小时以前 1392d8f3def2c21e7a6fc15cf3f68fc1056ec0b6
src/views/eam/base/modules/EamTechnicalStatusEvaluationStandardModal.vue
@@ -1,97 +1,70 @@
<template>
  <j-modal :title="title" :width="1200" :visible="visible" :confirmLoading="confirmLoading" switchFullscreen centered
           @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
           @ok="handleOk" @cancel="handleCancel" cancelText="关闭"
           :okButtonProps="{ class:{'jee-hidden': disableSubmit} }">
    <a-spin :spinning="spinning">
      <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
        <a-row>
          <a-col :span="8">
            <a-form-model-item label="规范编码">
              <a-input placeholder="规范编码自动生成" v-model="model.standardCode" disabled/>
            </a-form-model-item>
          </a-col>
      <j-form-container :disabled="disableSubmit">
        <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"
                      slot="detail">
          <a-row>
            <a-col :span="8">
              <a-form-model-item label="规范编码">
                <a-input placeholder="规范编码自动生成" v-model="model.standardCode" disabled/>
              </a-form-model-item>
            </a-col>
          <a-col :span="8">
            <a-form-model-item prop="standardName" label="规范名称">
              <a-input placeholder="请输入规范名称" v-model="model.standardName"/>
            </a-form-model-item>
          </a-col>
            <a-col :span="8">
              <a-form-model-item prop="standardName" label="规范名称">
                <a-input placeholder="请输入规范名称" v-model="model.standardName"/>
              </a-form-model-item>
            </a-col>
          <a-col :span="8">
            <a-form-model-item prop="equipmentId" label="统一编码">
              <lx-search-equipment-select placeholder="请输入统一编码或名称搜索" v-model="model.equipmentId" :disabled="!editable"/>
            </a-form-model-item>
          </a-col>
        </a-row>
            <a-col :span="8">
              <a-form-model-item prop="equipmentId" label="统一编码">
                <lx-search-equipment-select placeholder="请输入统一编码或名称搜索" v-model="model.equipmentId"
                                            :disabled="!editable"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        <a-row>
          <a-col :span="8">
            <a-form-model-item label="鉴定周期(年)">
              <a-input-number v-model="model.evaluationPeriod" :min="1" placeholder="请输入鉴定周期(年)" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
        </a-row>
          <a-row>
            <a-col :span="8" v-for="item in checkList" :key="item.key">
              <a-form-model-item :label="item.label">
                <j-dict-select-tag @change="handleCheckListChange($event,item.key)" dict-code="yn" type="radio"
                                   v-model="model[item.key]"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        <a-row>
          <!--<a-col :span="8">-->
          <!--<a-form-model-item label="安全装置检查">-->
          <!--<j-dict-select-tag @change="handleCheckListChange($event,1)" dict-code="yn " type="radio"-->
          <!--:disabled="model.hasPrecisionCheck=='0'&&model.hasOtherCheck=='0'"-->
          <!--v-model="model.hasSafetyEquipmentCheck"/>-->
          <!--</a-form-model-item>-->
          <!--</a-col>-->
          <!--<a-col :span="8">-->
          <!--<a-form-model-item label="设备精度检查">-->
          <!--<j-dict-select-tag @change="handleCheckListChange($event,2)" dict-code="yn " type="radio"-->
          <!--:disabled="model.hasSafetyEquipmentCheck=='0'&&model.hasOtherCheck=='0'"-->
          <!--v-model="model.hasPrecisionCheck"/>-->
          <!--</a-form-model-item>-->
          <!--</a-col>-->
          <!--<a-col :span="8">-->
          <!--<a-form-model-item label="其他检查">-->
          <!--<j-dict-select-tag @change="handleCheckListChange($event,3)" dict-code="yn " type="radio"-->
          <!--:disabled="model.hasPrecisionCheck=='0'&&model.hasSafetyEquipmentCheck=='0'"-->
          <!--v-model="model.hasOtherCheck"/>-->
          <!--</a-form-model-item>-->
          <!--</a-col>-->
          <a-col :span="8" v-for="item in checkList">
            <a-form-model-item :label="item.label">
              <j-dict-select-tag @change="handleCheckListChange($event,item.key)" dict-code="yn" type="radio"
                                 :disabled="checkList.filter(i=>i.key!=item.key).every(i=>i.value=='0')"
                                 v-model="model[item.key]"/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="24">
            <a-form-model-item :labelCol="{span:2}" :wrapperCol="{span:21}" label="备注">
              <a-textarea placeholder="请输入备注" v-model="model.remark"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
          <a-row>
            <a-col :span="24">
              <a-form-model-item :labelCol="{span:2}" :wrapperCol="{span:21}" label="备注">
                <a-textarea placeholder="请输入备注" v-model="model.remark"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </j-form-container>
      <a-tabs :activeKey="activeTabKey" @change="handleTabChange">
        <a-tab-pane tab="安全装置检查" :key="1" v-if="+model.hasSafetyEquipmentCheck">
          <j-vxe-table ref="editableDetailTable1" rowNumber rowSelection bordered alwaysEdit toolbar
                       :toolbarConfig="detail.toolbarConfig" keep-source
                       :toolbarConfig="detail.toolbarConfig" keep-source :disabled="disableSubmit"
                       :height="300" :dataSource="detail.safetyEquipmentCheckList" :columns="detail.columns">
          </j-vxe-table>
        </a-tab-pane>
        <a-tab-pane tab="设备精度检查" :key="2" v-if="+model.hasPrecisionCheck" forceRender>
          <j-vxe-table ref="editableDetailTable2" rowNumber rowSelection bordered alwaysEdit toolbar
                       :toolbarConfig="detail.toolbarConfig" keep-source
                       :height="300" :dataSource="detail.precisionCheckList" :columns="detail.precisionCheckColumns">
                       :toolbarConfig="detail.toolbarConfig" keep-source :disabled="disableSubmit"
                       :height="300" :dataSource="detail.precisionCheckList"
                       :columns="detail.precisionCheckColumns">
          </j-vxe-table>
        </a-tab-pane>
        <a-tab-pane tab="其他检查" :key="3" v-if="+model.hasOtherCheck" forceRender>
          <j-vxe-table ref="editableDetailTable3" rowNumber rowSelection bordered alwaysEdit toolbar
                       :toolbarConfig="detail.toolbarConfig" keep-source
                       :toolbarConfig="detail.toolbarConfig" keep-source :disabled="disableSubmit"
                       :height="300" :dataSource="detail.otherCheckList" :columns="detail.columns">
          </j-vxe-table>
        </a-tab-pane>
@@ -127,6 +100,7 @@
        },
        spinning: false,
        confirmLoading: false,
        disableSubmit: false,
        editable: true,
        validatorRules: {
          standardName: [{ required: true, message: '请输入规范名称', trigger: 'change' }],
@@ -155,6 +129,7 @@
            order: 3
          }
        ],
        hasCheckedCheckList: [],
        activeTabKey: 1,
        upgradeFlag: false,
        detail: {
@@ -213,7 +188,7 @@
              width: 150,
              validateRules: [
                { required: true, message: '请输入${title}' },
                { unique: true, message: '${title}不能重复' }
                { unique: false, message: '${title}不能重复' }
              ]
            },
            {
@@ -230,7 +205,7 @@
              placeholder: '请输入${title}',
              type: JVXETypes.textarea,
              align: 'center',
              validateRules: [{ required: true, message: '请输入${title}' }]
              validateRules: [{ required: false, message: '请输入${title}' }]
            },
            {
              title: '允差值',
@@ -273,7 +248,6 @@
       */
      edit(record, upgradeFlag = false) {
        this.upgradeFlag = upgradeFlag
        console.log('upgradeFlag', this.upgradeFlag)
        this.detail.safetyEquipmentCheckList = this.detail.precisionCheckList = this.detail.otherCheckList = []
        this.model = Object.assign({}, record)
        this.hasCheckedCheckList = []
@@ -302,6 +276,10 @@
        }
      },
      /**
       * 获取检查明细
       * @param standardId 规范编号
       */
      loadDetail(standardId) {
        this.spinning = true
        getAction(this.url.detail, { standardId })
@@ -330,6 +308,15 @@
      },
      async handleOk() {
        console.log('tis', this.hasCheckedCheckList)
        if (this.hasCheckedCheckList.findIndex(item => item.value === '1') < 0) {
          this.$notification.warning({
            message: '消息',
            description: '至少选择一项检查'
          })
          return
        }
        // 先校验当前tab下的表格
        let errMap = await this.$refs['editableDetailTable' + this.activeTabKey].validateTable()
        if (errMap) return false
@@ -342,7 +329,7 @@
          if (tableData.length == 0) {
            this.$notification.warning({
              message: '消息',
              description: hasCheckedCheckList[index].label + '必填项不能为空'
              description: hasCheckedCheckList[index].label + '不能为空'
            })
            return
          }