zhaowei
6 天以前 257ef0490f66229f983429f01872fac33eef13d0
三保工单审批流程
已修改3个文件
1620 ■■■■ 文件已修改
src/views/eam/maintenance/EamThirdMaintenanceOrderList.vue 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/maintenance/modules/EamThirdMaintenanceOrderModal.vue 561 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowable/workflow/thirdMaintenance/ThirdMaintenanceApprovalModal.vue 999 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/maintenance/EamThirdMaintenanceOrderList.vue
@@ -47,38 +47,24 @@
             @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <template v-if="record.maintenanceStatus === 'WAIT_MAINTENANCE'">
            <a @click="handleEdit(record)">编辑</a>
            <a-divider type="vertical"/>
            <a-popconfirm title="确定领取吗?" @confirm="() => handlerCollect(record.id)">
              <a>领取</a>
            </a-popconfirm>
            <a-divider type="vertical"/>
            <a-dropdown>
              <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
              <a-menu slot="overlay">
                <a-menu-item>
                  <a-popconfirm title="确定作废吗?" @confirm="() => handlerAbolish(record.id)">
                    <a>作废</a>
                  </a-popconfirm>
                </a-menu-item>
                <a-menu-item>
                  <a @click="handleDetail(record)">详情</a>
                </a-menu-item>
              </a-menu>
            </a-dropdown>
            <a @click="handlerAbolish(record.id)">作废</a>
            <a-divider type="vertical"/>
          </template>
          <template v-else>
            <a @click="handleDetail(record)">详情</a>
          <a @click="handleDetail(record)">详情</a>
          <template v-if="record.maintenanceStatus === 'COMPLETE'">
          <a-divider type="vertical"/>
          <a @click="handlePrint(record)">打印</a>
          </template>
          <a-divider v-if="record.maintenanceStatus === 'COMPLETE'" type="vertical"/>
          <a v-if="record.maintenanceStatus === 'COMPLETE'" @click="handlePrint(record)">打印</a>
        </span>
    </a-table>
    <!-- table区域-end -->
@@ -163,16 +149,6 @@
            title: '计划保养日期',
            align: 'center',
            dataIndex: 'maintenanceDate'
          },
          {
            title: '锁定工单日期',
            align: 'center',
            dataIndex: 'freezeOrderDate'
          },
          {
            title: '工单过期日期',
            align: 'center',
            dataIndex: 'orderExpirationDate'
          },
          {
            title: '实际开始时间',
@@ -269,13 +245,21 @@
            align: 'center',
            dataIndex: 'inspectorSignatureTime'
          },
          {
            title: '移交单HF编码',
            align: 'center',
            dataIndex: 'hfCodeA'
          },
          {
            title: '验收单HF编码',
            align: 'center',
            dataIndex: 'hfCodeB'
          }
        ],
        url: {
          list: '/eam/thirdMaintenanceOrder/list',
          abolish: '/eam/thirdMaintenanceOrder/abolish',
          abolishBatch: '/eam/thirdMaintenanceOrder/abolishBatch',
          collect: '/eam/thirdMaintenanceOrder/collect',
          collectBatch: '/eam/thirdMaintenanceOrder/collectBatch'
          collect: '/eam/thirdMaintenanceOrder/collect'
        }
      }
    },
@@ -288,7 +272,6 @@
        dataIndex: 'action',
        align: 'center',
        fixed: 'right',
        width: 200,
        scopedSlots: { customRender: 'action' }
      }
      this.columns = [...this.columns, operationColumn]
@@ -352,9 +335,10 @@
       */
      handleDetail(record) {
        this.selectThirdMaintenanceData = Object.assign({}, record)
        this.$refs.thirdMaintenanceApprovalModal.recordDetail(record)
        this.$refs.thirdMaintenanceApprovalModal.title = '详情'
        this.$refs.thirdMaintenanceApprovalModal.visible = true
        this.$refs.thirdMaintenanceApprovalModal.disableSubmit = true
        this.$refs.thirdMaintenanceApprovalModal.recordDetail(record)
      },
      onMaintenanceDateChange(dateString) {
src/views/eam/maintenance/modules/EamThirdMaintenanceOrderModal.vue
@@ -1,437 +1,220 @@
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    :mask-closable="false"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
  <j-modal :title="title" :width="1200" :visible="visible" :confirmLoading="confirmLoading" switchFullscreen centered
           :mask-closable="false" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="spinning">
      <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
        <a-row :gutter="24">
        <a-row>
          <a-col :span="8">
            <a-form-model-item prop="orderNum" label="工单号">
              <a-input placeholder="工单号系统自动生成" v-model="model.orderNum" disabled />
              <a-input placeholder="工单号系统自动生成" v-model="model.orderNum" disabled/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="equipmentId" label="设备编码">
              <maintenance-equipment-select placeholder="请输入设备编号或名称搜索" v-model="model.equipmentId"
                                            :maintenanceCategory="maintenanceCategory"
                                            @autocompleteForm="autocompleteForm"
                                            :disabled="editable"></maintenance-equipment-select>
            <a-form-model-item prop="equipmentId" label="统一编码">
              <maintenance-equipment-select placeholder="请输入统一编码或名称搜索" v-model="model.equipmentId"
                                            maintenanceCategory="THIRD_MAINTENANCE" @autocompleteForm="autocompleteForm"
                                            :disabled="editable"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="standardName" label="标准名称">
              <a-input placeholder="选择设备后自动带出" v-model="model.standardName" disabled />
            <a-form-model-item prop="standardName" label="规范名称">
              <a-input placeholder="选择设备后自动带出" v-model="model.standardName" disabled/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
        <a-row>
          <a-col :span="8">
            <a-form-model-item prop="maintenanceDate" label="保养日期">
              <a-date-picker placeholder="请选择计划保养日期" v-model="model.maintenanceDate" format="YYYY-MM-DD"
                             style="width: 100%" />
                             style="width: 100%"/>
            </a-form-model-item>
          </a-col>
<!--          <a-col :span="8">-->
<!--            <a-form-model-item prop="operator" label="保养人">-->
<!--              <j-search-select-tag v-model="model.operator" placeholder="请选择保养人" :disabled="!model.equipmentId"-->
<!--                                   :dictOptions="maintenanceOperatorOptions" />-->
<!--            </a-form-model-item>-->
<!--          </a-col>-->
          <a-col :span="8">
            <a-form-model-item prop="maintenancePeriod" label="保养周期">
              <a-input placeholder="选择设备后自动带出" v-model="model.maintenancePeriod" disabled />
              <a-input placeholder="选择设备后自动带出" v-model="model.maintenancePeriod" disabled/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="remark" label="备注">
            <a-textarea placeholder="请输入备注" v-model="model.remark" />
        <a-row>
          <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" label="备注">
            <a-textarea placeholder="请输入备注" v-model="model.remark"/>
          </a-form-model-item>
        </a-row>
        <a-row :gutter="24">
          <a-tabs v-model="activeTabKey">
            <a-tab-pane key="1" tab="保养项" :forceRender="true">
              <j-vxe-table
                ref="editableDetailTable"
                :rowNumber="true"
                :rowSelection="true"
                :bordered="true"
                :alwaysEdit="true"
                :toolbar="true"
                :toolbarConfig="detail.toolbarConfig"
                keep-source
                :height="300"
                :dataSource="detail.dataSource"
                :columns="detail.columns"
                style="margin-top: 8px;" />
            </a-tab-pane>
          </a-tabs>
        </a-row>
        <a-tabs default-active-key="1">
          <a-tab-pane key="1" tab="保养项明细">
            <j-vxe-table ref="editableDetailTable" bordered keep-source
                         :height="300" :dataSource="detail.dataSource" :columns="detail.columns"/>
          </a-tab-pane>
        </a-tabs>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
import { getAction, httpAction } from '@/api/manage'
import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect.vue'
import { JVXETypes } from '@comp/jeecg/JVxeTable'
  import { getAction, httpAction } from '@/api/manage'
  import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect.vue'
  import { JVXETypes } from '@comp/jeecg/JVxeTable'
export default {
  name: 'EamThirdMaintenanceOrderModal',
  components: { MaintenanceEquipmentSelect },
  data() {
    return {
      title: '操作',
      visible: false,
      editable: false,
      maintenanceCategory: 'THIRD_MAINTENANCE',
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      labelColLong: {
        xs: { span: 24 },
        sm: { span: 2 }
      },
      wrapperColLong: {
        xs: { span: 24 },
        sm: { span: 21 }
      },
      confirmLoading: false,
      spinning: false,
      activeTabKey: '1',
      maintenanceOperatorOptions: [],
      validatorRules: {
        equipmentId: [
          { required: true, message: '请选择设备!' }
        ],
        maintenanceDate: [
          { required: true, message: '请选择计划保养日期!' }
        ]
      },
      url: {
        add: '/eam/thirdMaintenanceOrder/add',
        edit: '/eam/thirdMaintenanceOrder/edit',
        standardDetail: '/eam/eamMaintenanceStandardDetail/queryList',
        detail: '/eam/thirdMaintenanceOrderDetail/queryList',
        userSelect: '/eam/user_select/list',
      },
      detail: {
        loading: false,
        dataSource: [],
        columns: [
          {
            title: 'ID',
            key: 'id',
            type: JVXETypes.hidden
          },
          {
            title: 'orderId',
            key: 'orderId',
            type: JVXETypes.hidden
          },
          {
            title: '序号',
            key: 'itemCode',
            type: JVXETypes.inputNumber,
            width: '10%',
            align: 'center',
            validateRules: [
              { required: true, unique: true, message: '序号不能重复' }
            ]
          },
          {
            title: '部位',
            key: 'itemPart',
            type: JVXETypes.textarea,
            width: '25%',
            align: 'center'
          },
          {
            title: '保养项',
            key: 'itemName',
            type: JVXETypes.textarea,
            width: '20%',
            align: 'center',
            validateRules: [
              { required: true, message: '保养项不能为空!' }
            ]
          },
          {
            title: '保养要求',
            key: 'itemDemand',
            type: JVXETypes.textarea,
            width: '30%',
            align: 'center',
            validateRules: [
              { required: true, message: '保养要求不能为空!' }
            ]
          }
        ],
        toolbarConfig: {
          // prefix 前缀;suffix 后缀
          slot: ['prefix', 'suffix'],
          // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
          btn: ['add', 'remove', 'clearSelection']
        }
      },
      // precisionDetail: {
      //   loading: false,
      //   dataSource: [],
      //   columns: [
      //     {
      //       title: 'ID',
      //       key: 'id',
      //       type: JVXETypes.hidden
      //     },
      //     {
      //       title: 'orderId',
      //       key: 'orderId',
      //       type: JVXETypes.hidden
      //     },
      //     {
      //       title: 'equipmentId',
      //       key: 'equipmentId',
      //       type: JVXETypes.hidden
      //     },
      //     {
      //       title: 'parameterId',
      //       key: 'parameterId',
      //       type: JVXETypes.hidden
      //     },
      //     {
      //       title: '检测项目',
      //       key: 'parameterId_dictText',
      //       type: JVXETypes.normal,
      //       width: '25%',
      //       align: 'center'
      //     },
      //     {
      //       title: '参数编码',
      //       key: 'parameterCode_dictText',
      //       type: JVXETypes.normal,
      //       width: '20%',
      //       align: 'center',
      //     },
      //     {
      //       title: '允差值',
      //       key: 'parameterValue',
      //       type: JVXETypes.normal,
      //       width: '30%',
      //       align: 'center',
      //     }
      //   ],
      //   toolbarConfig: {
      //     // prefix 前缀;suffix 后缀
      //     slot: ['prefix', 'suffix'],
      //     // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
      //     btn: ['add', 'remove', 'clearSelection']
      //   }
      // }
    }
  },
  created() {
  },
  methods: {
    add() {
      this.initParams();
      //初始化默认值
      this.model = {}
      this.visible = true
      this.editable = false
      this.detail.dataSource = []
    },
    edit(record) {
      this.initParams();
      this.model = Object.assign({}, record)
      this.visible = true
      this.editable = true
      this.detail.dataSource = []
      this.loadDetail(record.id)
      // this.loadPrecisionDetail(record.id)
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.$refs.form.clearValidate()
    },
    async handleOk() {
      const that = this
      let errMap = await that.$refs.editableDetailTable.validateTable()
      if (errMap) {
        this.$message.warning('数据校验失败!')
        return
      }
      // 触发表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          let tableData = that.$refs.editableDetailTable.getTableData()
          let removeData = that.$refs.editableDetailTable.getDeleteData()
          that.model.tableDetailList = [...tableData]
          that.model.removeDetailList = [...removeData]
          that.confirmLoading = true
          let httpurl = ''
          let method = ''
          if (!this.model.id) {
            httpurl += this.url.add
            method = 'post'
          } else {
            httpurl += this.url.edit
            method = 'put'
          }
          httpAction(httpurl, this.model, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$emit('ok')
              that.close()
            } else {
              that.$message.warning(res.message)
  export default {
    name: 'EamThirdMaintenanceOrderModal',
    components: { MaintenanceEquipmentSelect },
    data() {
      return {
        title: '操作',
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 15 }
        },
        labelColLong: {
          xs: { span: 24 },
          sm: { span: 2 }
        },
        wrapperColLong: {
          xs: { span: 24 },
          sm: { span: 21 }
        },
        confirmLoading: false,
        spinning: false,
        validatorRules: {
          equipmentId: [
            { required: true, message: '请输入统一编码或名称搜索' }
          ],
          maintenanceDate: [
            { required: true, message: '请选择计划保养日期!' }
          ]
        },
        url: {
          add: '/eam/thirdMaintenanceOrder/add',
          standardDetail: '/eam/eamMaintenanceStandardDetail/queryList'
        },
        detail: {
          dataSource: [],
          columns: [
            {
              title: 'ID',
              key: 'id',
              type: JVXETypes.hidden
            },
            {
              title: 'orderId',
              key: 'orderId',
              type: JVXETypes.hidden
            },
            {
              title: '序号',
              key: 'itemCode',
              type: JVXETypes.normal,
              width: 60,
              align: 'center'
            },
            {
              title: '保养部位',
              key: 'itemPart',
              type: JVXETypes.normal,
              align: 'center'
            },
            {
              title: '保养内容',
              key: 'itemName',
              type: JVXETypes.normal,
              align: 'center'
            },
            {
              title: '验收标准',
              key: 'itemDemand',
              type: JVXETypes.normal,
              align: 'center'
            }
          }).finally(() => {
            that.confirmLoading = false
          })
        } else {
          return false
          ]
        }
      })
    },
    handleCancel() {
      this.close()
    },
    autocompleteForm(selectObj) {
      //标准名称,保养周期不刷新解决办法
      //办法一  validatorRules equipmentId 还是有问题
      // const newObj = {
      //   standardName: selectObj.standardName,
      //   maintenancePeriod: selectObj.maintenancePeriod,
      //   standardId : selectObj.id,
      //   equipmentId: selectObj.equipmentId,
      // };
      // this.model = Object.assign({}, newObj, this.model)
      //办法二
      this.$set(this.model, 'standardName', selectObj.standardName)
      this.$set(this.model, 'maintenancePeriod', selectObj.maintenancePeriod)
      this.$set(this.model, 'standardId', selectObj.id)
      this.$set(this.model, 'equipmentId', selectObj.equipmentId)
      // console.log('model', this.model)
      if (!this.model.equipmentId) delete this.model.operator
      if (!this.model.id) {
        this.loadStandardDetail(selectObj.id)
        this.loadPrecisionParameterList(selectObj.equipmentId)
      }
      this.loadMaintenanceOperatorList(this.model.equipmentId)
    },
    //加载详情数据
    loadStandardDetail(standardId) {
      this.detail.dataSource = []
      if (standardId) {
    methods: {
      add() {
        //初始化默认值
        this.model = {}
        this.detail.dataSource = []
        this.visible = true
      },
      async handleOk() {
        const that = this
        let errMap = await that.$refs.editableDetailTable.validateTable()
        if (errMap) return
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.model.tableDetailList = that.$refs.editableDetailTable.getTableData()
            that.confirmLoading = that.spinning = true
            httpAction(that.url.add, that.model, 'post')
              .then((res) => {
                if (res.success) {
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                  that.$emit('ok')
                  that.close()
                } else {
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .finally(() => {
                that.confirmLoading = that.spinning = false
              })
          } else {
            return false
          }
        })
      },
      autocompleteForm(selectObj) {
        this.$set(this.model, 'standardName', selectObj.standardName)
        this.$set(this.model, 'maintenancePeriod', selectObj.maintenancePeriod)
        this.$set(this.model, 'standardId', selectObj.id)
        this.$set(this.model, 'equipmentId', selectObj.equipmentId)
        this.loadStandardDetail(selectObj.id)
      },
      //加载详情数据
      loadStandardDetail(standardId) {
        this.detail.dataSource = []
        this.spinning = true
        getAction(this.url.standardDetail, { standardId: standardId })
        getAction(this.url.standardDetail, { standardId })
          .then(res => {
            if (res.success) {
              this.detail.dataSource = res.result.map(item => ({
                itemCode: item.itemCode,
                itemName: item.itemName,
                itemPart: item.itemPart,
                itemDemand: item.itemDemand
              }))
              this.detail.dataSource = res.result
            }
          })
          .finally(() => {
            this.spinning = false
          })
      },
      handleCancel() {
        this.close()
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.$refs.form.clearValidate()
      }
    },
    //标准选择变化
    loadDetail(orderId) {
      if (orderId) {
        getAction(this.url.detail, { orderId: orderId }).then(res => {
          if (res.success) {
            this.detail.dataSource = [...res.result]
          }
        })
      }
    },
    loadMaintenanceOperatorList(equipmentId) {
      this.maintenanceOperatorOptions = []
      let params = { positionCode: 'PCR0001' }
      if (equipmentId) {
        params.equipmentId = equipmentId
      } else {
        return
      }
      const that = this
      getAction(this.url.userSelect, params)
        .then(res => {
          if (res.success) {
            that.maintenanceOperatorOptions = res.result.map(item => ({
              key: item.id,
              value: item.username,
              text: item.realname
            }))
            if (!that.maintenanceOperatorOptions.find(item => item.value === that.model.operator)) delete that.model.operator
          } else {
            if (that.model.operator) delete that.model.operator
          }
        })
        .catch(err => {
          if (that.model.operator) delete that.model.operator
        })
    },
    // loadPrecisionParameterList(equipmentId) {
    //   this.precisionDetail.dataSource = []
    //   if (equipmentId) {
    //     this.spinning = true
    //     getAction(this.url.precisionDetail, { equipmentId: equipmentId })
    //       .then(res => {
    //         if (res.success) {
    //           this.precisionDetail.dataSource = res.result.map(item => ({
    //             equipmentId: item.equipmentId,
    //             parameterId: item.parameterId,
    //             parameterId_dictText: item.parameterId_dictText,
    //             parameterCode_dictText: item.parameterCode_dictText,
    //             parameterValue: item.parameterValue,
    //           }))
    //         }
    //       })
    //       .finally(() => {
    //         this.spinning = false
    //       })
    //   }
    // },
    // loadPrecisionDetail(orderId) {
    //   if (orderId) {
    //     getAction(this.url.precisionCheckDetail, { orderId: orderId }).then(res => {
    //       if (res.success) {
    //         this.precisionDetail.dataSource = [...res.result]
    //       }
    //     })
    //   }
    // },
    initParams() {
      this.detail.dataSource = []
      // this.precisionDetail.dataSource = []
      this.activeTabKey = '1'
    },
    }
  }
}
</script>
<style lang="less" scoped>
</style>
</script>
src/views/flowable/workflow/thirdMaintenance/ThirdMaintenanceApprovalModal.vue
@@ -1,184 +1,223 @@
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    centered
    cancelText="关闭">
  <j-modal :title="title" :visible="visible" :confirmLoading="confirmLoading"
           :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" fullscreen @ok="handleOk" @cancel="handleCancel"
           cancelText="关闭">
    <a-spin :spinning="spinning">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 保养基础信息
        </a-divider>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderNum" label="工单号">
              <a-input placeholder="工单号系统自动生成" v-model="model.orderNum" disabled/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentId" label="设备编码">
              <maintenance-equipment-select placeholder="请输入设备编号或名称搜索" v-model="model.equipmentId"
                                            :maintenanceCategory="maintenanceCategory"
                                            @autocompleteForm="autocompleteForm"
                                            disabled></maintenance-equipment-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="standardName" label="标准名称">
              <a-input placeholder="选择设备后自动带出" v-model="model.standardName" disabled/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenanceDate" label="保养日期">
              <a-date-picker placeholder="请选择计划保养日期" v-model="model.maintenanceDate" format="YYYY-MM-DD"
                             disabled
                             style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operator" label="保养人">
              <j-search-select-tag v-model="model.operator" placeholder="请选择保养人" disabled
                                   :dictOptions="maintenanceOperatorOptions"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancePeriod" label="保养周期">
              <a-input placeholder="选择设备后自动带出" v-model="model.maintenancePeriod" disabled/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="remark" label="备注">
            <a-textarea placeholder="请输入备注" v-model="model.remark" disabled/>
          </a-form-model-item>
        </a-row>
        <a-row :gutter="24">
          <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" label="保养图片">
            <lx-upload :returnUrl="false"
                       :isMultiple="true"
                       file-type="image"
                       :disabled="confirmDisable"
                       :number="3"
                       v-model="model.imageFilesResult"/>
          </a-form-model-item>
        </a-row>
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 保养项信息
        </a-divider>
        <a-row :gutter="24">
          <a-tabs v-model="activeTabKey">
            <a-tab-pane key="1" tab="保养项明细" v-if="!isPrecisionCheck">
              <j-vxe-table
                ref="editableDetailTable"
                :rowNumber="false"
                :rowSelection="true"
                :bordered="true"
                :alwaysEdit="true"
                :toolbar="false"
                keep-source
                :height="300"
                :loading="detail.loading"
                :dataSource="detail.dataSource"
                :columns="detail.columns"
                @selectRowChange="handleTableSelectRowChange"
              >
                <template v-slot:maintenanceResult="props">
                  <j-dict-select-tag v-model="props.row.maintenanceResult" dictCode="eam_inspection_result"
                                     placeholder="请选择保养结果"
                                     :disabled="disableSubmit || confirmDisable"
                                     @change="handleInspectionResultSelectChange($event,props.row)"
                                     style="width: 100%"/>
                </template>
      <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
        <a-row :gutter="24" id="outer-row">
          <a-col :span="8" class="scroll-col">
            <a-tabs>
              <a-tab-pane tab="基础信息">
                <a-row>
                  <a-col :span="12">
                    <a-form-model-item label="工单号">
                      <a-input v-model="model.orderNum" readOnly/>
                    </a-form-model-item>
                  </a-col>
                  <a-col :span="12">
                    <a-form-model-item label="统一编码">
                      <maintenance-equipment-select v-model="model.equipmentId" maintenanceCategory="THIRD_MAINTENANCE"
                                                    @autocompleteForm="autocompleteForm" disabled/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
                <template v-slot:exceptionDescription="props">
                  <a-textarea style="height: 32px" v-model="props.row.exceptionDescription"
                              :disabled="disableSubmit || confirmDisable || !props.row.maintenanceResult || props.row.maintenanceResult === '1'"/>
                </template>
                <a-row>
                  <a-col :span="12">
                    <a-form-model-item label="规范名称">
                      <a-input v-model="model.standardName" readOnly/>
                    </a-form-model-item>
                  </a-col>
                  <a-col :span="12">
                    <a-form-model-item label="保养日期">
                      <a-input v-model="model.maintenanceDate" readOnly/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
                <template v-slot:reportFlag="props">
                  <j-dict-select-tag v-model="props.row.reportFlag"
                                     :disabled="disableSubmit || confirmDisable || !props.row.maintenanceResult || props.row.maintenanceResult === '1'"
                                     dictCode="yn"
                                     style="width: 100%"/>
                </template>
              </j-vxe-table>
            </a-tab-pane>
<!--            <a-tab-pane key='4' tab='精度检验' v-if="!isMaintenance">-->
<!--              <j-vxe-table-->
<!--                ref="editablePrecisionDetailTable"-->
<!--                :rowNumber="true"-->
<!--                :rowSelection="true"-->
<!--                :bordered="true"-->
<!--                :alwaysEdit="true"-->
<!--                :toolbar="false"-->
<!--                :toolbarConfig="precisionDetail.toolbarConfig"-->
<!--                keep-source-->
<!--                :height="300"-->
<!--                :dataSource="precisionDetail.dataSource"-->
<!--                :columns="precisionDetail.columns"-->
<!--                style="margin-top: 8px;" >-->
<!--                <template v-slot:actualValue="props">-->
<!--                  <a-input-number v-model="props.row.actualValue" :disabled="disableSubmit || confirmDisable" style="width: 100%" />-->
<!--                </template>-->
<!--              </j-vxe-table>-->
<!--            </a-tab-pane>-->
            <template v-if="selectShenpiData.procInstId">
              <a-tab-pane key='2' tab='流程节点'>
                <a-card :bordered="false">
                  <a-timeline>
                    <a-timeline-item v-for="(item,index) in taskData" :key="index">
                      <div>
                        <h3 style="font-weight: bold;">{{item.taskName}}</h3>
                        <div>处理人:{{item.assignee_dictText}}</div>
                        <div v-if="index !==0">处理时长:{{item.duration}}</div>
                        <div v-if="item.name !== '提交申请'">处理类型:{{item.sequenceFlowName}}</div>
                        <div v-if="item.description">处理意见:{{item.description}}</div>
                      </div>
                    </a-timeline-item>
                  </a-timeline>
                </a-card>
                <a-row>
                  <a-col :span="12">
                    <a-form-model-item label="维修人">
                      <a-input v-model="model.repairman_dictText" readOnly/>
                    </a-form-model-item>
                  </a-col>
                  <a-col :span="12">
                    <a-form-model-item label="保养周期">
                      <a-input v-model="model.maintenancePeriod" readOnly/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="24">
                    <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" label="备注">
                      <a-textarea v-model="model.remark" readOnly/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
              </a-tab-pane>
              <a-tab-pane key='3' tab='流程图'>
                <img :src="imageSrc" alt="Fetched Image"/>
            </a-tabs>
          </a-col>
          <a-col :span="model.maintenanceStatus&&model.maintenanceStatus!='WAIT_MAINTENANCE'?10:16" class="scroll-col">
            <a-tabs v-model="activeTabKey" @change="$refs.editableDetailTable.clearValidate()">
              <a-tab-pane key="1" tab="保养项明细">
                <j-vxe-table ref="editableDetailTable" rowSelection bordered alwaysEdit keep-source :height="300"
                             :dataSource="detail.dataSource" :columns="detail.columns"
                             @selectRowChange="handleTableSelectRowChange">
                  <!--保养结果-->
                  <template v-slot:maintenanceResult="props">
                    <j-dict-select-tag v-model="props.row.maintenanceResult" dictCode="third_maintenance_result"
                                       placeholder="请选择保养结果"
                                       :disabled="disableSubmit || (model.maintenanceStatus&&model.maintenanceStatus!='UNDER_MAINTENANCE')"
                                       @change="handleResultSelectChange($event,props.row,'exceptionDescription')"
                                       style="width: 100%"/>
                  </template>
                  <!--保养异常描述-->
                  <template v-slot:exceptionDescription="props">
                    <a-textarea :rows="1" :autoSize="false" v-model="props.row.exceptionDescription"
                                :placeholder="props.row.maintenanceResult&&props.row.maintenanceResult!='NORMAL'?'请输入异常描述':''"
                                @blur="$refs.editableDetailTable.validateTable"
                                :disabled="disableSubmit ||
                                (model.maintenanceStatus&&model.maintenanceStatus!='UNDER_MAINTENANCE') ||
                                !props.row.maintenanceResult ||
                                props.row.maintenanceResult === 'NORMAL'"/>
                  </template>
                  <!--第一次验收结果-->
                  <template v-slot:firstInspectResult="props">
                    <j-dict-select-tag v-model="props.row.firstInspectResult"
                                       placeholder="请选择验收结果"
                                       @change="handleResultSelectChange($event,props.row,'firstInspectException')"
                                       :disabled="disableSubmit ||(model.maintenanceStatus&&model.maintenanceStatus!='UNDER_FIRST_ACCEPTANCE')"
                                       dictCode="check_status" style="width: 100%"/>
                  </template>
                  <!--第一次验收异常描述-->
                  <template v-slot:firstInspectException="props">
                    <a-textarea :rows="1" v-model="props.row.firstInspectException"
                                :placeholder="props.row.firstInspectResult&&props.row.firstInspectResult!='1'?'请输入异常描述':''"
                                @blur="$refs.editableDetailTable.validateTable"
                                :disabled="disableSubmit ||
                                (model.maintenanceStatus&&model.maintenanceStatus!='UNDER_FIRST_ACCEPTANCE')||
                                !props.row.firstInspectResult ||
                                props.row.firstInspectResult === '1'"
                                dictCode="check_status" style="width: 100%;resize:none"/>
                  </template>
                  <!--第二次验收结果-->
                  <template v-slot:secondInspectResult="props">
                    <j-dict-select-tag v-model="props.row.secondInspectResult"
                                       placeholder="请选择验收结果"
                                       @change="handleResultSelectChange($event,props.row,'secondInspectException')"
                                       disabled dictCode="check_status" style="width: 100%"/>
                  </template>
                  <!--第二次验收异常描述-->
                  <template v-slot:secondInspectException="props">
                    <a-textarea :rows="1" v-model="props.row.secondInspectException"
                                :placeholder="props.row.secondInspectResult&&props.row.secondInspectResult!='1'?'请输入异常描述':''"
                                @blur="$refs.editableDetailTable.validateTable"
                                :disabled="disableSubmit ||
                                (model.maintenanceStatus&&model.maintenanceStatus!='UNDER_SECOND_ACCEPTANCE')||
                                !props.row.secondInspectResult ||
                                props.row.secondInspectResult === '1'"
                                dictCode="check_status" style="width: 100%;resize:none"/>
                  </template>
                </j-vxe-table>
              </a-tab-pane>
            </template>
            <a-button v-if="!disableSubmit &&!confirmDisable&& selectedRowKeys.length > 0" slot="tabBarExtraContent"
                      type="primary" @click="handleSelectAllInspectionResult">保养正常
            </a-button>
          </a-tabs>
              <template v-if="selectShenpiData.procInstId">
                <a-tab-pane key='2' tab='流程图'>
                  <img :src="imageSrc" alt="Fetched Image"/>
                </a-tab-pane>
              </template>
              <template slot="tabBarExtraContent">
                <a-space>
                  <a-button
                    v-if="activeTabKey=='1'"
                    :disabled="disableSubmit || (model.maintenanceStatus&&model.maintenanceStatus!='UNDER_MAINTENANCE')||selectedRowKeys.length == 0"
                    type="primary" @click="handleSelectAllMaintenanceResult">批量保养正常
                  </a-button>
                  <a-button
                    v-if="activeTabKey=='1'"
                    :disabled="disableSubmit || (model.maintenanceStatus&&model.maintenanceStatus!='UNDER_FIRST_ACCEPTANCE')||selectedRowKeys.length == 0"
                    type="primary" @click="handleSelectAllFirstAcceptanceResult">批量验收通过
                  </a-button>
                </a-space>
              </template>
            </a-tabs>
          </a-col>
          <a-col v-if="model.maintenanceStatus&&model.maintenanceStatus!='WAIT_MAINTENANCE'" :span="6"
                 class="scroll-col">
            <a-tabs v-if="displayEvaluationFlag">
              <a-tab-pane tab="保养前技术状态鉴定">
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol"
                                   prop="fullyFunctional" label="设备功能是否齐全">
                  <j-dict-select-tag type='radio' v-model='model.fullyFunctional' dictCode='yn'
                                     @change="handleCheckRadioChange"
                                     :disabled="disableSubmit||(model.maintenanceStatus&&model.maintenanceStatus!='WAIT_CHECK')"/>
                </a-form-model-item>
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol"
                                   prop="runningNormally" label="设备能否正常运转">
                  <j-dict-select-tag type='radio' v-model='model.runningNormally' dictCode='yn'
                                     @change="handleCheckRadioChange"
                                     :disabled="disableSubmit||(model.maintenanceStatus&&model.maintenanceStatus!='WAIT_CHECK')"/>
                </a-form-model-item>
                <a-form-model-item v-if="model.fullyFunctional=='0'||model.runningNormally=='0'"
                                   :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol" label="问题描述">
                  <a-textarea v-model='model.problemDescription' placeholder="请描述问题"
                              :disabled="disableSubmit||(model.maintenanceStatus&&model.maintenanceStatus!='WAIT_CHECK')"/>
                </a-form-model-item>
              </a-tab-pane>
            </a-tabs>
            <a-tabs v-if="displayOperatorFlag">
              <a-tab-pane tab="操作人确认">
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol" label="确认类型">
                  <j-dict-select-tag v-model="model.operatorSignatureResult" type="radio" disabled dict-code="yn"/>
                </a-form-model-item>
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol" label="协助操作人">
                  <a-input v-model="model.assistantOperator"
                           :disabled="disableSubmit||(model.maintenanceStatus&&model.maintenanceStatus!='OPERATOR_SIGNATURE')"
                           placeholder="请输入协助操作人"/>
                </a-form-model-item>
              </a-tab-pane>
            </a-tabs>
            <a-tabs v-if="displayRepairerFlag">
              <a-tab-pane tab="维修人确认">
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol" label="确认类型">
                  <j-dict-select-tag v-model="model.repairmanSignatureResult" type="radio" disabled dict-code="yn"/>
                </a-form-model-item>
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol" label="协助维修人">
                  <a-input v-model="model.assistantRepairman"
                           :disabled="disableSubmit||(model.maintenanceStatus&&model.maintenanceStatus!='REPAIRMAN_SIGNATURE')"
                           placeholder="请输入协助维修人"/>
                </a-form-model-item>
              </a-tab-pane>
            </a-tabs>
            <a-tabs v-if="displayRepairLeaderFlag">
              <a-tab-pane tab="维修室主任确认">
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol" label="确认类型">
                  <j-dict-select-tag v-model="model.repairManagerSignatureResult" type="radio" disabled dict-code="yn"/>
                </a-form-model-item>
              </a-tab-pane>
            </a-tabs>
            <a-tabs v-if="displayInspectorFlag">
              <a-tab-pane tab="检查人确认">
                <a-form-model-item :labelCol="rightColLabelCol" :wrapperCol="rightColWrapperCol" label="确认类型">
                  <j-dict-select-tag v-model="model.inspectorSignatureResult" type="radio" disabled dict-code="yn"/>
                </a-form-model-item>
              </a-tab-pane>
            </a-tabs>
          </a-col>
        </a-row>
        <div v-if="confirmDisable">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 机动办确认信息
          </a-divider>
          <a-row :gutter="24">
            <a-col :span="24">
              <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="confirmComment" label="确认意见">
                <a-textarea placeholder="请输入意见" v-model="model.confirmComment"
                            :disabled="disableSubmit || leaderConfirmDisable"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </div>
        <div v-if="leaderConfirmDisable">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 领导确认信息
          </a-divider>
          <a-row :gutter="24">
            <a-col :span="24">
              <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="leaderConfirmComment"
                                 label="领导意见">
                <a-textarea placeholder="请输入意见" v-model="model.leaderConfirmComment"
                            :disabled="disableSubmit || completionDisable"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </div>
      </a-form-model>
    </a-spin>
  </j-modal>
@@ -189,11 +228,13 @@
  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
  import { JVXETypes } from '@comp/jeecg/JVxeTable'
  import MaintenanceEquipmentSelect from '@views/eam/equipment/modules/MaintenanceEquipmentSelect'
  import ATextarea from 'ant-design-vue/es/input/TextArea'
  export default {
    name: 'ThirdMaintenanceApprovalModal',
    mixins: [JVxeTableModelMixin],
    components: {
      ATextarea,
      MaintenanceEquipmentSelect
    },
    props: {
@@ -205,15 +246,7 @@
      return {
        title: '操作',
        visible: false,
        //状态控制
        //保养中 不可编辑
        // confirmDisable: false,
        // initialAcceptanceDisable: false,
        // finalAcceptanceDisable: false,
        editable: false,
        model: {},
        maintenanceCategory: 'SECOND_MAINTENANCE',
        maintenanceOperatorOptions: [],
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
@@ -224,42 +257,40 @@
        },
        labelColLong: {
          xs: { span: 24 },
          sm: { span: 2 }
          sm: { span: 3 }
        },
        wrapperColLong: {
          xs: { span: 24 },
          sm: { span: 21 }
          sm: { span: 20 }
        },
        rightColLabelCol: {
          xs: { span: 24 },
          sm: { span: 9 }
        },
        rightColWrapperCol: {
          xs: { span: 24 },
          sm: { span: 15 }
        },
        confirmLoading: false,
        spinning: false,
        imageSrc: null,
        activeTabKey: '1',
        validatorRules: {
          confirmComment: [
            { required: true, message: '请输入确认意见!' }
          ],
          leaderConfirmComment: [
            { required: true, message: '请输入初验收意见!' }
          ],
          fullyFunctional: [{ required: true, message: '请选择设备功能是否齐全' }],
          runningNormally: [{ required: true, message: '请选择设备能否正常运转' }]
        },
        url: {
          queryById: '/eam/thirdMaintenanceOrder/queryById',
          detail: '/eam/thirdMaintenanceOrderDetail/queryList',
          approval: '/eam/thirdMaintenanceOrder/approval',
          userSelect: '/eam/user_select/list',
          queryHisTaskList: '/assign/flow/queryHisTaskList',
          diagramView: '/assign/flow/diagramView',
          // precisionCheckDetail: '/eam/precisionCheckDetail/queryList',
          diagramView: '/assign/flow/diagramView'
        },
        disableSubmit: false,
        taskData: [],
        isDisplayBmp: false,
        showBmpButtonLoading: false,
        selectedRowKeys: [],
        detail: {
          loading: false,
          dataSource: [],
          columns: [
          columns: [],
          defaultColumns: [
            {
              title: 'ID',
              key: 'id',
@@ -274,322 +305,338 @@
              title: '序号',
              key: 'itemCode',
              type: JVXETypes.normal,
              width: '5%',
              width: 60,
              align: 'center'
            },
            {
              title: '保养项',
              title: '保养部位',
              key: 'itemPart',
              type: JVXETypes.normal,
              width: 120,
              align: 'center'
            },
            {
              title: '保养内容',
              key: 'itemName',
              type: JVXETypes.normal,
              width: '10%',
              width: 120,
              align: 'center'
            },
            {
              title: '保养要求',
              title: '验收标准',
              key: 'itemDemand',
              type: JVXETypes.normal,
              width: '20%',
              width: 120,
              align: 'center'
            },
            {
              title: '保养结果',
              key: 'maintenanceResult',
              type: JVXETypes.slot,
              width: '10%',
              align: 'center',
              width: 200,
              slotName: 'maintenanceResult',
              validateRules: [
                { required: true, message: '保养结果不能为空!' }
                { required: true, message: '请选择${title}' }
              ]
            },
            {
              title: '异常描述',
              title: '保养异常描述',
              key: 'exceptionDescription',
              type: JVXETypes.slot,
              width: '20%',
              align: 'center',
              width: 200,
              slotName: 'exceptionDescription',
              validateRules: [
                { handler: this.customValidator }
              ]
            },
            {
              title: '是否报修',
              key: 'reportFlag',
              type: JVXETypes.slot,
              width: '10%',
              align: 'center',
              slotName: 'reportFlag',
              validateRules: [
                { handler: this.customValidator }
                { handler: this.maintenanceExceptionDescriptionValidator }
              ]
            }
          ],
          toolbarConfig: {
            // prefix 前缀;suffix 后缀
            slot: ['prefix', 'suffix'],
            // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
            btn: ['clearSelection']
          }
        },
        // precisionDetail: {
        //   loading: false,
        //   dataSource: [],
        //   columns: [
        //     {
        //       title: 'ID',
        //       key: 'id',
        //       type: JVXETypes.hidden
        //     },
        //     {
        //       title: 'orderId',
        //       key: 'orderId',
        //       type: JVXETypes.hidden
        //     },
        //     {
        //       title: 'equipmentId',
        //       key: 'equipmentId',
        //       type: JVXETypes.hidden
        //     },
        //     {
        //       title: 'parameterId',
        //       key: 'parameterId',
        //       type: JVXETypes.hidden
        //     },
        //     {
        //       title: '检测项目',
        //       key: 'parameterId_dictText',
        //       type: JVXETypes.normal,
        //       width: '25%',
        //       align: 'center'
        //     },
        //     {
        //       title: '参数编码',
        //       key: 'parameterCode_dictText',
        //       type: JVXETypes.normal,
        //       width: '20%',
        //       align: 'center',
        //     },
        //     {
        //       title: '允差值',
        //       key: 'parameterValue',
        //       type: JVXETypes.normal,
        //       width: '15%',
        //       align: 'center',
        //     },
        //     {
        //       title: '实测值',
        //       key: 'actualValue',
        //       type: JVXETypes.slot,
        //       width: '15%',
        //       align: 'center',
        //       slotName: 'actualValue',
        //       validateRules: [
        //         { required: true, message: '请输入实测值!' }
        //       ]
        //     }
        //   ],
        //   toolbarConfig: {
        //     // prefix 前缀;suffix 后缀
        //     slot: ['prefix', 'suffix'],
        //     // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
        //     btn: ['add', 'remove', 'clearSelection']
        //   }
        // }
          ]
        }
      }
    },
    created() {
    },
    computed: {
      confirmDisable: function() {
        return ['WAIT_CONFIRM', 'WAIT_LEADER_CONFIRM', 'COMPLETE'].includes(this.model.maintenanceStatus)
      displayEvaluationFlag() {
        return this.model.maintenanceStatus && ['WAIT_CHECK', 'UNDER_MAINTENANCE', 'UNDER_FIRST_ACCEPTANCE', 'UNDER_SECOND_ACCEPTANCE', 'OPERATOR_SIGNATURE', 'REPAIRMAN_SIGNATURE', 'REPAIR_MANAGER_SIGNATURE', 'INSPECTOR_SIGNATURE', 'COMPLETE'].includes(this.model.maintenanceStatus)
      },
      leaderConfirmDisable: function() {
        return ['WAIT_LEADER_CONFIRM', 'COMPLETE'].includes(this.model.maintenanceStatus)
      displayFirstAcceptanceFlag() {
        return this.model.maintenanceStatus && ['UNDER_FIRST_ACCEPTANCE', 'UNDER_SECOND_ACCEPTANCE', 'OPERATOR_SIGNATURE', 'REPAIRMAN_SIGNATURE', 'REPAIR_MANAGER_SIGNATURE', 'INSPECTOR_SIGNATURE', 'COMPLETE'].includes(this.model.maintenanceStatus)
      },
      completionDisable: function() {
        return ['COMPLETE', 'ABOLISH'].includes(this.model.maintenanceStatus)
      displaySecondAcceptanceFlag() {
        return this.model.maintenanceStatus && ['UNDER_SECOND_ACCEPTANCE', 'OPERATOR_SIGNATURE', 'REPAIRMAN_SIGNATURE', 'REPAIR_MANAGER_SIGNATURE', 'INSPECTOR_SIGNATURE', 'COMPLETE'].includes(this.model.maintenanceStatus)
      },
      isMaintenance: function() {
        return this.selectShenpiData && this.selectShenpiData.taskDefKey === 'maintenance_execution';
      displayOperatorFlag() {
        return this.model.maintenanceStatus && ['OPERATOR_SIGNATURE', 'REPAIRMAN_SIGNATURE', 'REPAIR_MANAGER_SIGNATURE', 'INSPECTOR_SIGNATURE', 'COMPLETE'].includes(this.model.maintenanceStatus)
      },
      isPrecisionCheck: function() {
        return this.selectShenpiData && this.selectShenpiData.taskDefKey === 'precision_check';
      displayRepairerFlag() {
        return this.model.maintenanceStatus && ['REPAIRMAN_SIGNATURE', 'REPAIR_MANAGER_SIGNATURE', 'INSPECTOR_SIGNATURE', 'COMPLETE'].includes(this.model.maintenanceStatus)
      },
      displayRepairLeaderFlag() {
        return this.model.maintenanceStatus && ['REPAIR_MANAGER_SIGNATURE', 'INSPECTOR_SIGNATURE', 'COMPLETE'].includes(this.model.maintenanceStatus)
      },
      displayInspectorFlag() {
        return this.model.maintenanceStatus && ['INSPECTOR_SIGNATURE', 'COMPLETE'].includes(this.model.maintenanceStatus)
      }
    },
    methods: {
      async handleDetail(item) {
        this.initParams()
        //重新计算defaultKey
        if(item && item.taskDefKey === 'precision_check') {
          this.activeTabKey = '4';
        }
      /**
       * 主页面点击执行审批时触发
       * @param record 主页面列表行记录
       */
      async handleDetail(record) {
        this.model = {}
        if (item.procInstId) {
          const { processDefinitionId, processInstanceId, processDefinitionKey, procInstId } = item
        this.detail.dataSource = []
        this.getBasicInformationByApi(record)
        this.getFlowChartImageByApi(record)
      },
          let taskDataList = await getAction(this.url.queryHisTaskList, { procInstId })
          this.taskData = [...taskDataList.result]
      /**
       * 主页面点击详情时触发
       * @param record 主页面列表行记录
       */
      recordDetail(record) {
        this.spinning = true
        this.detail.dataSource = []
        this.model = Object.assign({
          operatorSignatureResult: '1',
          repairmanSignatureResult: '1',
          repairManagerSignatureResult: '1',
          inspectorSignatureResult: '1'
        }, record)
        this.handleDynamicColumns()
        this.loadDetail(record.id)
      },
          downFile(this.url.diagramView, {
            processDefinitionId,
            processInstanceId,
            TaskDefinitionKey: processDefinitionKey
          }, 'get')
            .then((res => {
              const urlObject = window.URL.createObjectURL(new Blob([res]))
              this.imageSrc = urlObject
            }))
            .catch(err => {
              this.$notification.error({
      /**
       * 获取基础信息
       * @param record 主页面列表行记录
       */
      getBasicInformationByApi(record) {
        this.spinning = true
        const that = this
        getAction(this.url.queryById, { id: record.dataId })
          .then(res => {
            if (res.success) {
              that.model = Object.assign({
                operatorSignatureResult: '1',
                repairmanSignatureResult: '1',
                repairManagerSignatureResult: '1',
                inspectorSignatureResult: '1'
              }, res.result)
              that.model.dataId = record.dataId
              that.model.taskId = record.id
              that.model.userId = record.assignee
              that.model.instanceId = record.procInstId
              that.handleDynamicColumns()
            }
            else {
              that.$notification.warning({
                message: '消息',
                description: res.message
              })
            })
        }
        let res = await getAction(this.url.queryById, { id: item.dataId })
        this.model = Object.assign({}, res.result)
        if (this.model.imageFiles) {
          let obj = JSON.parse(this.model.imageFiles)
          this.model.imageFilesResult = [...obj]
        }
        this.model.dataId = item.dataId
        this.model.taskId = item.id
        this.model.userId = item.assignee
        this.model.instanceId = item.procInstId
        this.model.values = item.variables
        await this.loadDetail(item.dataId)
        // await this.loadPrecisionDetail(item.dataId);
            }
          })
          .finally(() => {
            this.loadDetail(record.dataId)
          })
      },
      recordDetail(record) {
        console.log('record', record)
        this.initParams()
        this.model = Object.assign({}, record)
        if (this.model.imageFiles) {
          let obj = JSON.parse(this.model.imageFiles)
          this.model.imageFilesResult = [...obj]
        }
        this.loadDetail(record.id)
        this.loadPrecisionDetail(record.id);
      /**
       * 获取保养明细
       * @param orderId 工单号
       */
      loadDetail(orderId) {
        getAction(this.url.detail, { orderId })
          .then(res => {
            if (res.success) {
              if (this.model.maintenanceStatus && this.model.maintenanceStatus == 'UNDER_SECOND_ACCEPTANCE') {
                this.detail.dataSource = res.result.map(item => {
                  return {
                    ...item,
                    secondInspectResult: '1'
                  }
                })
                return
              }
              this.detail.dataSource = res.result
            }
          })
          .finally(() => {
            this.spinning = false
          })
      },
      initParams() {
        this.detail.dataSource = []
        this.visible = true
        this.activeTabKey = '1';
        if(this.selectShenpiData &&  this.selectShenpiData.taskDefKey === 'precision_check') {
          this.activeTabKey = '4';
        }
        this.spinning = true
      /**
       * 获取流程图
       * @param record 主页面列表行记录
       */
      getFlowChartImageByApi(record) {
        const { processDefinitionId, processInstanceId, processDefinitionKey } = record
        downFile(this.url.diagramView, {
          processDefinitionId,
          processInstanceId,
          TaskDefinitionKey: processDefinitionKey
        }, 'get')
          .then((res => {
            this.imageSrc = window.URL.createObjectURL(new Blob([res]))
          }))
          .catch(err => {
            this.$notification.error({
              message: '消息',
              description: err.message
            })
          })
      },
      async handleOk() {
        const that = this
        if(that.$refs.editableDetailTable) {
        if (this.model.maintenanceStatus == 'UNDER_MAINTENANCE' || this.model.maintenanceStatus == 'UNDER_FIRST_ACCEPTANCE' || this.model.maintenanceStatus == 'UNDER_SECOND_ACCEPTANCE') {
          let errMap = await that.$refs.editableDetailTable.validateTable()
          if (errMap) {
            this.$message.warning('数据校验失败!')
            return
          if (this.activeTabKey != '1') {
            this.activeTabKey = '1'
            if (errMap) {
              that.$refs.editableDetailTable.clearValidate()
              that.$notification.warning({
                message: '消息',
                description: '保养或验收不能为空'
              })
              return
            }
          }
          if (errMap) return
        }
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = that.spinning = true
            let tableData = [];
            let precisionTableData = [];
            if(that.$refs.editableDetailTable) {
              tableData = that.$refs.editableDetailTable.getTableData()
            }
            if(that.$refs.editablePrecisionDetailTable) {
              precisionTableData = that.$refs.editablePrecisionDetailTable.getTableData()
            }
            that.model.tableDetailList = [...tableData]
            that.model.precisionDetailList = [...precisionTableData]
            let httpurl = this.url.approval
            let method = 'put'
            that.model.tableDetailList = that.$refs.editableDetailTable.getTableData()
            httpAction(httpurl, this.model, method).then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('searchReset')
                that.close()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.confirmLoading = that.spinning = false
            })
            httpAction(that.url.approval, that.model, 'put')
              .then((res) => {
                if (res.success) {
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                  that.$emit('modalFormOk')
                  that.close()
                } else {
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .finally(() => {
                that.confirmLoading = that.spinning = false
              })
          } else {
            return false
          }
        })
      },
      handleDynamicColumns() {
        let columns = []
        if (this.displayFirstAcceptanceFlag) {
          columns = [
            {
              title: '第一次验收结果',
              key: 'firstInspectResult',
              type: JVXETypes.slot,
              align: 'center',
              width: 200,
              slotName: 'firstInspectResult',
              validateRules: [{ required: true, message: '请选择${title}' }]
            },
            {
              title: '第一次验收异常描述',
              key: 'firstInspectException',
              type: JVXETypes.slot,
              align: 'center',
              width: 200,
              slotName: 'firstInspectException',
              validateRules: [
                { handler: this.firstAcceptanceExceptionDescriptionValidator }
              ]
            }
          ]
        }
        if (this.displaySecondAcceptanceFlag) {
          columns = [
            ...columns,
            {
              title: '第二次验收结果',
              key: 'secondInspectResult',
              type: JVXETypes.slot,
              align: 'center',
              width: 200,
              slotName: 'secondInspectResult',
              validateRules: [{ required: true, message: '请选择${title}' }]
            },
            {
              title: '第二次验收异常描述',
              key: 'secondInspectException',
              type: JVXETypes.slot,
              align: 'center',
              width: 200,
              slotName: 'secondInspectException',
              validateRules: [
                { handler: this.secondAcceptanceExceptionDescriptionValidator }
              ]
            }
          ]
        }
        this.detail.columns = [...this.detail.defaultColumns, ...columns]
      },
      autocompleteForm(selectObj) {
        this.$set(this.model, 'standardName', selectObj.standardName)
        this.$set(this.model, 'maintenancePeriod', selectObj.maintenancePeriod)
        this.$set(this.model, 'standardId', selectObj.id)
        this.$set(this.model, 'equipmentId', selectObj.equipmentId)
        // console.log('model', this.model)
        if (!this.model.id) {
          this.loadStandardDetail(selectObj.id)
        }
        this.loadMaintenanceOperatorList(this.model.equipmentId)
      },
      //标准选择变化
      loadDetail(orderId) {
        if (orderId) {
          getAction(this.url.detail, { orderId: orderId })
            .then(res => {
              if (res.success) {
                this.detail.dataSource = [...res.result]
              }
            })
            .finally(() => {
              this.spinning = false
            })
        }
      /**
       * 保养、验收结果发生改变时触发
       * @param value 改变后的值
       * @param record 表格行记录
       * @param key 对象属性名称
       */
      handleResultSelectChange(value, record, key) {
        if (record[key]) delete record[key]
        this.$refs.editableDetailTable.validateTable()
      },
      // loadPrecisionDetail(orderId) {
      //   if (orderId) {
      //     getAction(this.url.precisionCheckDetail, { orderId: orderId }).then(res => {
      //       if (res.success) {
      //         this.precisionDetail.dataSource = [...res.result]
      //       }
      //     })
      //   }
      // },
      loadMaintenanceOperatorList(equipmentId) {
        this.maintenanceOperatorOptions = []
        let params = { positionCode: 'PCR0001' }
        if (equipmentId) {
          params.equipmentId = equipmentId
        }
        getAction(this.url.userSelect, params).then(res => {
          if (res.success) {
            this.maintenanceOperatorOptions = res.result.map(item => ({
              key: item.id,
              value: item.username,
              text: item.realname
            }))
          }
        })
      },
      handleInspectionResultSelectChange(value, record) {
        if (record.exceptionDescription) delete record.exceptionDescription
        if (record.reportFlag) delete record.reportFlag
      },
      // 批量选择所有点检结果
      handleSelectAllInspectionResult() {
      // 批量选择保养结果正常
      handleSelectAllMaintenanceResult() {
        this.selectedRowKeys.forEach(key => {
          const dataItem = this.detail.dataSource.find(item => item.id === key)
          if (dataItem && dataItem.maintenanceResult !== '1') {
            console.log('dataItem', dataItem)
          if (dataItem && dataItem.maintenanceResult !== 'NORMAL') {
            delete dataItem.exceptionDescription
            delete dataItem.reportFlag
            dataItem.maintenanceResult = '1'
            dataItem.maintenanceResult = 'NORMAL'
          }
        })
        this.$refs.editableDetailTable.clearCheckboxRow()
        this.selectedRowKeys = []
      },
      // 批量选择第一次验收结果通过
      handleSelectAllFirstAcceptanceResult() {
        this.selectedRowKeys.forEach(key => {
          const dataItem = this.detail.dataSource.find(item => item.id === key)
          if (dataItem && dataItem.firstInspectResult !== '1') {
            delete dataItem.firstInspectException
            dataItem.firstInspectResult = '1'
          }
        })
        this.$refs.editableDetailTable.clearCheckboxRow()
        this.$refs.editableDetailTable.clearValidate()
        this.selectedRowKeys = []
      },
@@ -601,10 +648,57 @@
        this.selectedRowKeys = selectedRowIds
      },
      customValidator({ cellValue, row }, callback) {
      // 保养前技术状态单选发生改变时触发
      handleCheckRadioChange() {
        if (this.model.fullyFunctional == '1' && this.model.runningNormally == '1') this.model.problemDescription = ''
      },
      /**
       * 保养异常描述单元格校验
       * @param cellValue 单元格值
       * @param row 表格行记录
       * @param callback 结果回调函数
       */
      maintenanceExceptionDescriptionValidator({ cellValue, row }, callback) {
        if (row.maintenanceResult === '2') {
          if (!cellValue) {
            callback(false, '${title}不能为空!') // false = 未通过,可以跟自定义提示
            callback(false, '请输入${title}') // false = 未通过,可以跟自定义提示
          } else {
            callback(true) // true = 通过验证
          }
        } else {
          callback(true)
        }
      },
      /**
       * 第一次验收异常描述单元格校验
       * @param cellValue 单元格值
       * @param row 表格行记录
       * @param callback 结果回调函数
       */
      firstAcceptanceExceptionDescriptionValidator({ cellValue, row }, callback) {
        if (row.firstInspectResult === '2') {
          if (!cellValue) {
            callback(false, '请输入${title}') // false = 未通过,可以跟自定义提示
          } else {
            callback(true) // true = 通过验证
          }
        } else {
          callback(true)
        }
      },
      /**
       * 第二次验收异常描述单元格校验
       * @param cellValue 单元格值
       * @param row 表格行记录
       * @param callback 结果回调函数
       */
      secondAcceptanceExceptionDescriptionValidator({ cellValue, row }, callback) {
        if (row.secondInspectResult === '2') {
          if (!cellValue) {
            callback(false, '请输入${title}') // false = 未通过,可以跟自定义提示
          } else {
            callback(true) // true = 通过验证
          }
@@ -626,6 +720,29 @@
  }
</script>
<style lang="less" scoped>
<style scoped lang="less">
  /deep/ .ant-select-dropdown-menu {
    text-align: left;
  }
</style>
  /deep/ .ant-spin-nested-loading {
    height: 100%;
    .ant-spin-container {
      height: 100%;
      .ant-form {
        height: 100%;
        #outer-row {
          height: 100%;
          .scroll-col {
            height: 100%;
            overflow: auto;
          }
        }
      }
    }
  }
</style>