zhaowei
2025-04-27 c408c703aec036468cd5399098c2f4829e2dab03
1、我的待办新增批量处理功能
2、设备台账调整铭牌二维码大小
已添加3个文件
已修改4个文件
626 ■■■■■ 文件已修改
src/views/eam/equipment/modules/NameplateModal.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/repair/EamReportRepairList.vue 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/repair/modules/EamReportRepairList/AssignRepairReportModal.vue 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowable/workflow/FlowTodo.vue 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowable/workflow/InspectionOrder/InspectionOrderBatchHandle.vue 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowable/workflow/weekMaintenance/WeekMaintenanceApprovalModal.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowable/workflow/weekMaintenance/WeekMaintenanceBatchApprovalModal.vue 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/equipment/modules/NameplateModal.vue
@@ -19,48 +19,48 @@
        <tbody>
        <tr>
          <td rowspan="3" align="center">
            <div style="height: 80%;width: 50%">
              <QrcodeVue :value="httpUrl+item.id" :size="50"/>
            <div style="height: 80%">
              <QrcodeVue :value="httpUrl+item.id" :size="100"/>
            </div>
          </td>
          <td>设备编号</td>
          <td>{{ item.equipmentCode }}</td>
          <td class="long-col">{{ item.equipmentCode }}</td>
        </tr>
        <tr>
          <td>设备名称</td>
          <td>{{ item.equipmentName }}</td>
          <td style="width: 25%">设备名称</td>
          <td class="long-col">{{ item.equipmentName }}</td>
        </tr>
        <tr>
          <td>设备型号</td>
          <td>{{ item.equipmentModel }}</td>
          <td class="long-col">{{ item.equipmentModel }}</td>
        </tr>
        <tr>
          <td>设备管理</td>
          <td>使用车间</td>
          <td>{{ item.orgId_dictText }}</td>
          <td class="long-col">{{ item.orgId_dictText }}</td>
        </tr>
        <tr>
          <td rowspan="3" align="center">
            <div style="height: 80%;width: 50%">
              <QrcodeVue :value="item.equipmentCode" :size="50"/>
            <div style="height: 80%">
              <QrcodeVue :value="item.equipmentCode" :size="100"/>
            </div>
          </td>
          <td>出厂编号</td>
          <td>{{ item.factoryNumber }}</td>
          <td class="long-col">{{ item.factoryNumber }}</td>
        </tr>
        <tr>
          <td>设备管理员</td>
          <td>{{ item.equipmentManager_dictText }}</td>
          <td class="long-col">{{ item.equipmentManager_dictText }}</td>
        </tr>
        <tr>
          <td>安装位置</td>
          <td>{{ item.installationPosition }}</td>
          <td class="long-col">{{ item.installationPosition }}</td>
        </tr>
        <tr>
@@ -133,19 +133,23 @@
    text-align: center;
    &:not(:last-child) {
      margin-bottom: 10px;
      margin-bottom: 100px;
    }
    th {
      font-size: 24px;
      letter-spacing: 3px;
      padding: 12px;
      padding: 6px;
    }
    td {
      font-size: 14px;
      width: 33%;
      /*width: 33%;*/
      padding: 6px;
      &.long-col {
        width: 300px;
      }
    }
  }
</style>
src/views/eam/repair/EamReportRepairList.vue
@@ -61,8 +61,8 @@
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <!--<a-button type="primary" icon="download" @click="handleExportXls('故障报修')">导出</a-button>-->
      <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"-->
                <!--@change="handleImportExcel">-->
        <!--<a-button type="primary" icon="import">导入</a-button>-->
      <!--@change="handleImportExcel">-->
      <!--<a-button type="primary" icon="import">导入</a-button>-->
      <!--</a-upload>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
@@ -107,6 +107,10 @@
          <a-divider type="vertical"/>
          <a @click="handleAssign(record)">指派</a>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定作废吗?" @confirm="() => handleDelete(record.id)">
            <a>作废</a>
          </a-popconfirm>
@@ -121,6 +125,8 @@
                           @ok="modalFormOk"/>
    <!-- å›¾ç‰‡é¢„览弹窗 -->
    <images-preview-modal ref="imagesPreviewModalRef" :imageListUrl="currentImageListUrl"/>
    <!--指派报修弹窗-->
    <assign-repair-report-modal ref="assignRepairReportModalRef" @ok="modalFormOk"/>
  </a-card>
</template>
@@ -132,12 +138,14 @@
  import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
  import ImagesPreviewModal from '@views/eam/repair/modules/ImagesPreviewModal.vue'
  import { getAction } from '@/api/manage'
  import AssignRepairReportModal from './modules/EamReportRepairList/AssignRepairReportModal'
  export default {
    name: 'EamReportRepairList',
    mixins: [JeecgListMixin],
    components: {
      AssignRepairReportModal,
      ImagesPreviewModal,
      LxSearchEquipmentSelect,
      EamReportRepairModal
@@ -252,7 +260,7 @@
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
          width: 150
          width: 200
        }
        this.columns = [...this.columns, operationColumn]
        this.getFaultReasonListByApi()
@@ -307,6 +315,15 @@
        this.$refs.imagesPreviewModalRef.visible = true
      },
      /**
       * æŒ‡æ´¾æŠ¥ä¿®å•
       * @param record è¡¨æ ¼è¡Œä¿¡æ¯
       */
      handleAssign(record) {
        this.$refs.assignRepairReportModalRef.visible = true
        this.$refs.assignRepairReportModalRef.model = Object.assign({}, { id: record.id })
      },
      getCheckboxProps(record) {
        return {
          props: {
src/views/eam/repair/modules/EamReportRepairList/AssignRepairReportModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
<template>
  <j-modal :visible="visible" title="指派报修" :width="500" @ok="handleSubmit" @cancel="handleCancel"
           :confirmLoading="confirmLoading">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:4}" :wrapperCol="{span:18}">
        <a-form-model-item label="维修工" prop="repairer">
          <j-search-select-tag v-model="model.repairer" placeholder="请选择维修工"
                               dict="sys_user,realname, username, del_flag=0 and post='PCR0002' and status=1"/>
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
  import { postAction } from '@/api/manage'
  export default {
    name: 'AssignRepairReportModal',
    data() {
      return {
        visible: false,
        confirmLoading: false,
        model: {},
        validateRules: {
          repairer: [
            { required: true, message: '请选择维修工' }
          ]
        },
        url: {
          assign: '/eam/eamRepairOrder/assign'
        }
      }
    },
    methods: {
      handleSubmit() {
        const that = this
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true
            postAction(that.url.assign, that.model)
              .then(res => {
                if (res.success) {
                  that.$message.success(res.message)
                  that.handleCancel()
                  that.$emit('ok')
                } else {
                  that.$message.warning(res.message)
                }
              })
              .finally(() => {
                that.confirmLoading = false
              })
          } else {
            return false
          }
        })
      },
      handleCancel() {
        this.visible = false
      }
    }
  }
</script>
<style scoped>
  .container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-content: center;
  }
</style>
src/views/flowable/workflow/FlowTodo.vue
@@ -15,11 +15,11 @@
                                 dictCode="flow_type"></j-dict-select-tag>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="6" :md="8" :sm="24">
            <a-form-item label="流程名称">
              <a-input placeholder="请输入流程名称" v-model="queryParam.flowName"></a-input>
            </a-form-item>
          </a-col>
          <!--<a-col :xl="4" :lg="6" :md="8" :sm="24">-->
          <!--<a-form-item label="流程名称">-->
          <!--<a-input placeholder="请输入流程名称" v-model="queryParam.flowName"></a-input>-->
          <!--</a-form-item>-->
          <!--</a-col>-->
          <a-col :xl="4" :lg="6" :md="8" :sm="24">
            <a-form-item label="当前节点">
              <a-input placeholder="请输入当前节点精确查询" v-model="queryParam.name"></a-input>
@@ -33,10 +33,12 @@
          <template v-if="toggleSearchStatus">
            <a-col :xl="8" :lg="8" :md="12" :sm="24">
              <a-form-item label="任务时间范围">
                <j-date :show-time="false" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust"
                <j-date :show-time="false" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间"
                        class="query-group-cust"
                        v-model="queryParam.startTime"></j-date>
                <span class="query-group-split-cust"></span>
                <j-date :show-time="false" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust"
                <j-date :show-time="false" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间"
                        class="query-group-cust"
                        v-model="queryParam.endTime"></j-date>
              </a-form-item>
            </a-col>
@@ -100,12 +102,20 @@
      </a-table>
    </div>
    <!--单个流程处理-->
    <InspectionOrderHandle ref="modalFormInspectionOrder" :selectShenpiData="selectInspectionOrderData"
                           @searchReset="searchReset"></InspectionOrderHandle>
    <week-maintenance-approval-modal ref="weekMaintenanceApprovalModal" :selectShenpiData="selectWeekMaintenanceData"
                                     @searchReset="searchReset"></week-maintenance-approval-modal>
    <repair-order-approval-modal ref="repairOrderApprovalModal" @searchReset="searchReset"
                                 :selectShenpiData="selectRepairOrderData"></repair-order-approval-modal>
    <!--批量处理-->
    <inspection-order-batch-handle ref="inspectionOrderBatchHandleRef" @searchReset="searchReset"
                                   :taskList="selectionRows"/>
    <week-maintenance-batch-approval-modal ref="weenMaintenanceBatchApprovalModalRef" @searchReset="searchReset"
                                           :taskList="selectionRows"/>
  </a-card>
</template>
@@ -120,11 +130,15 @@
  import InspectionOrderHandle from '@views/flowable/workflow/InspectionOrder/InspectionOrderHandle.vue'
  import { getAction } from '@api/manage'
  import InspectionOrderBatchHandle from './InspectionOrder/InspectionOrderBatchHandle'
  import WeekMaintenanceBatchApprovalModal from './weekMaintenance/WeekMaintenanceBatchApprovalModal'
  export default {
    name: 'NcDeviceCharactersList',
    mixins: [JeecgListMixin, mixinDevice],
    components: {
      WeekMaintenanceBatchApprovalModal,
      InspectionOrderBatchHandle,
      JDictSelectTag,
      WeekMaintenanceApprovalModal,
      RepairOrderApprovalModal,
@@ -148,7 +162,7 @@
          {
            title: '流程分类',
            align: 'center',
            dataIndex: 'category_dictText',
            dataIndex: 'category_dictText'
          },
          {
            title: '流程名称',
@@ -221,6 +235,40 @@
      }
    },
    methods: {
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1
        }
        var params = this.getQueryParams()//查询条件
        if (!params) {
          return false
        }
        this.loading = true
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records || res.result
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
            if (this.selectedRowKeys.length > 0) this.selectedRowKeys = this.selectionRows = []
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          } else {
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      },
      handelDetail(item, index) {
        console.log('点击了详情')
        console.log('item----->', item)
@@ -241,6 +289,37 @@
            alert('没找到该流程')
        }
      },
      batchHandle() {
        const categorySet = new Set(this.selectionRows.map(item => item.category))
        const nameSet = new Set(this.selectionRows.map(item => item.name))
        if (categorySet.size !== 1 || nameSet.size !== 1) {
          this.$notification.info({
            message: '消息',
            description: '请选择同一流程分类下的同一当前节点'
          })
          return
        }
        if (categorySet.has('eam_repair')) {
          this.$notification.info({
            message: '消息',
            description: '设备维修流程无法批量处理'
          })
          return
        }
        if (categorySet.has('sbdjApproval')) {
          this.$refs.inspectionOrderBatchHandleRef.visible = true
          this.$refs.inspectionOrderBatchHandleRef.title = this.selectionRows[0].name
          this.$refs.inspectionOrderBatchHandleRef.getAllApproveData(this.selectionRows[0])
          this.$refs.inspectionOrderBatchHandleRef.getBasicInformation(this.selectionRows[0])
        } else if (categorySet.has('WEEK_MAINTENANCE')) {
          this.$refs.weenMaintenanceBatchApprovalModalRef.handleDetail(this.selectionRows[0])
          this.$refs.weenMaintenanceBatchApprovalModalRef.title = this.selectionRows[0].name
        }
      },
      splitAprocessType(title) {
        let parts = title.split(':') // æ³¨æ„å†’号是全角字符,使用对应的字进行分割
        let result = parts[0]
@@ -256,35 +335,6 @@
        this.$refs.modalFormInspectionOrder.getBasicInformation(record)
      },
      batchHandle() {
        if (this.selectedRowKeys.length <= 0) {
          this.$notification.warning({
            message: '消息',
            description: '请选择一条记录'
          })
          return
        } else {
          let ids = ''
          for (var a = 0; a < this.selectedRowKeys.length; a++) {
            ids += this.selectedRowKeys[a] + ','
          }
          getAction(this.url.isSameNode + '?taskIds=' + ids).then((res) => {
            if (res.success) {
              let taskDefKey = res.result
              this.selectBachData.taskIds = ids
              this.selectBachData.taskDefKey = taskDefKey
              this.$refs.modalFormDispatchFileBatch.title = '批量处理'
              this.$refs.modalFormDispatchFileBatch.edit(this.selectBachData)
              this.$refs.modalFormDispatchFileBatch.disableSubmit = false
            } else {
              this.$notification.warning({
                message: '消息',
                description: res.message
              })
            }
          })
        }
      },
      handleWeekMaintenance(item) {
        if (item && item.dataId) {
src/views/flowable/workflow/InspectionOrder/InspectionOrderBatchHandle.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,161 @@
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :okButtonProps="{ class:{'jee-hidden': tableRowRecord.inspectionStatus!=='WAIT_CONFIRM'} }"
    @ok="submitForm"
    @cancel="handleCancel"
    :mask-closable="false"
    :confirmLoading="confirmLoading"
    switchFullscreen
    centered
  >
    <a-spin :spinning="spinning">
      <a-tabs>
        <a-tab-pane key='1' tab='流程图'>
          <img :src="imageSrc" alt="流程图获取中..."/>
        </a-tab-pane>
      </a-tabs>
      <a-form-model ref='form' :model='tableRowRecord' :labelCol="labelCol" :wrapperCol="wrapperCol"
                    :rules="validatorRules" v-if="tableRowRecord.inspectionStatus==='WAIT_CONFIRM'">
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> ç­ç»„长确认信息
        </a-divider>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item prop="confirmDealType" label="处理类型">
              <j-dict-select-tag type='radio' v-model='tableRowRecord.confirmDealType' dictCode='approved_rejected'/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item prop="confirmComment" label="处理意见">
              <a-textarea placeholder="请输入处理意见" v-model="tableRowRecord.confirmComment"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
  import { getAction, downFile, httpAction } from '@api/manage'
  export default {
    name: 'InspectionOrderBatchHandle',
    props: {
      taskList: {
        type: Array
      }
    },
    data() {
      return {
        confirmLoading: false,
        spinning: false,
        tableRowRecord: {},
        hitaskDataSource: [],
        validatorRules: {
          confirmDealType: [
            { required: true, message: '请选择处理类型' }
          ],
          confirmComment: [
            { required: true, message: '请输入处理意见' }
          ]
        },
        imageSrc: null,
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 30 },
          sm: { span: 16 }
        },
        visible: false,
        // è¡¨å¤´
        url: {
          diagramView: '/assign/flow/diagramView',
          batchApprove: '/eam/eamInspectionOrder/batchApproval',
          queryById: '/eam/eamInspectionOrder/queryById'
        },
        title: ''
      }
    },
    methods: {
      /**
       * èŽ·å–æµç¨‹å›¾
       * @param record å¾…办记录信息
       */
      getAllApproveData(record) {
        if (record.procInstId) {
          const { processDefinitionId, processInstanceId, processDefinitionKey, procInstId } = record
          const param = { procInstId }
          const imageParam = { processDefinitionId, processInstanceId, TaskDefinitionKey: processDefinitionKey }
          const that = this
          downFile(this.url.diagramView, imageParam, 'get')
            .then((res => {
              const urlObject = window.URL.createObjectURL(new Blob([res]))
              that.imageSrc = urlObject
            }))
            .catch(err => {
              that.$notification.error({
                message: '消息',
                description: res.message
              })
            })
        }
      },
      /**
       * èŽ·å–å¾…åŠžè®°å½•çš„åŸºæœ¬ä¿¡æ¯
       * @param record å¾…办记录信息
       */
      async getBasicInformation(record) {
        this.spinning = true
        const param = { id: record.dataId }
        let res = await getAction(this.url.queryById, param)
        this.tableRowRecord = Object.assign({}, res.result)
        this.spinning = false
      },
      async submitForm() {
        this.$refs.form.validate(valid => {
          if (valid) {
            this.confirmLoading = this.spinning = true
            const flowTaskVo = {}
            flowTaskVo.confirmDealType = this.tableRowRecord.confirmDealType
            flowTaskVo.confirmComment = this.tableRowRecord.confirmComment
            flowTaskVo.taskList = this.taskList
            const that = this
            console.log('表单提交数据', flowTaskVo)
            httpAction(this.url.batchApprove, flowTaskVo, 'post')
              .then((res) => {
                if (res.success) {
                  that.$message.success(res.message)
                  //刷新表格
                  that.$emit('searchReset')
                  that.handleCancel()
                } else {
                  that.$message.warning(res.message)
                }
              })
              .finally(() => {
                that.confirmLoading = that.spinning = false
              })
          } else {
            return false
          }
        })
      },
      handleCancel() {
        this.visible = false
      }
    }
  }
</script>
src/views/flowable/workflow/weekMaintenance/WeekMaintenanceApprovalModal.vue
@@ -127,7 +127,7 @@
                </a-card>
              </a-tab-pane>
              <a-tab-pane key='3' tab='流程图'>
                <img :src="imageSrc" alt="Fetched Image"/>-->
                <img :src="imageSrc" alt="Fetched Image"/>
              </a-tab-pane>
            </template>
            <a-button v-if="!disableSubmit &&!confirmDisable&& selectedRowKeys.length > 0" slot="tabBarExtraContent"
src/views/flowable/workflow/weekMaintenance/WeekMaintenanceBatchApprovalModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,208 @@
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ class:{'jee-hidden': !isDisplaySubmitButton} }"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    centered
    cancelText="关闭">
    <a-spin :spinning="spinning">
      <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
        <a-row :gutter="24">
          <a-tabs>
            <a-tab-pane key='1' tab='流程图'>
              <img :src="imageSrc" alt="流程图获取中..."/>
            </a-tab-pane>
          </a-tabs>
        </a-row>
        <div v-if="model.maintenanceStatus==='WAIT_CONFIRM'">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> ç­ç»„长确认信息
          </a-divider>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-model-item prop="confirmDealType" label="确认类型">
                <j-dict-select-tag type='radio' v-model='model.confirmDealType' dictCode='approved_rejected'
                                   placeholder="请选择处理类型"/>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item prop="confirmComment" label="确认意见">
                <a-textarea placeholder="请输入意见" v-model="model.confirmComment"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </div>
        <div v-if="model.maintenanceStatus==='WAIT_INITIAL_ACCEPTANCE'">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> åˆéªŒæ”¶ä¿¡æ¯
          </a-divider>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-model-item prop="initialAcceptanceComment"
                                 label="初验收意见">
                <a-textarea placeholder="请输入意见" v-model="model.initialAcceptanceComment"/>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item prop="initialAcceptanceFilesResult"
                                 label="初验收附件">
                <lx-upload :returnUrl="false" :isMultiple="true" v-model="model.initialAcceptanceFilesResult"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </div>
        <div v-if="model.maintenanceStatus==='WAIT_FINAL_ACCEPTANCE'">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> ç»ˆéªŒæ”¶ä¿¡æ¯
          </a-divider>
          <a-row :gutter="24">
            <a-col :span="12">
              <a-form-model-item prop="finalAcceptanceComment"
                                 label="终验收意见">
                <a-textarea placeholder="请输入意见" v-model="model.finalAcceptanceComment"/>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item prop="finalAcceptanceFilesResult"
                                 label="终验收附件">
                <lx-upload :returnUrl="false" :isMultiple="true" v-model="model.finalAcceptanceFilesResult"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </div>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
  import { downFile, getAction, httpAction } from '@/api/manage'
  export default {
    name: 'WeekMaintenanceBatchApprovalModal',
    props: {
      taskList: {
        type: Array
      }
    },
    data() {
      return {
        title: '',
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        },
        confirmLoading: false,
        spinning: false,
        imageSrc: null,
        validatorRules: {
          confirmDealType: [
            { required: true, message: '请选择通过或驳回!' }
          ],
          confirmComment: [
            { required: true, message: '请输入确认意见!' }
          ],
          initialAcceptanceComment: [
            { required: true, message: '请输入初验收意见!' }
          ],
          finalAcceptanceComment: [
            { required: true, message: '请输入终验收意见!' }
          ]
        },
        url: {
          queryById: '/eam/weekMaintenanceOrder/queryById',
          batchApprove: '/eam/weekMaintenanceOrder/batchApproval',
          diagramView: '/assign/flow/diagramView'
        }
      }
    },
    computed: {
      isDisplaySubmitButton: function() {
        return ['WAIT_CONFIRM', 'WAIT_INITIAL_ACCEPTANCE', 'WAIT_FINAL_ACCEPTANCE'].includes(this.model.maintenanceStatus)
      }
    },
    methods: {
      async handleDetail(item) {
        this.visible = true
        this.spinning = true
        this.imageSrc = null
        if (item.procInstId) {
          const { processDefinitionId, processInstanceId, processDefinitionKey } = item
          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({
                message: '消息',
                description: res.message
              })
            })
        }
        let res = await getAction(this.url.queryById, { id: item.dataId })
        this.model = Object.assign({}, res.result)
        this.spinning = false
      },
      async handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = that.spinning = true
            const { confirmComment, confirmDealType, initialAcceptanceComment, initialAcceptanceFilesResult, finalAcceptanceComment, finalAcceptanceFilesResult } = that.model
            const params = {}
            params.taskList = that.taskList
            params.confirmComment = confirmComment
            params.confirmDealType = confirmDealType
            params.initialAcceptanceComment = initialAcceptanceComment
            params.initialAcceptanceFilesResult = initialAcceptanceFilesResult
            params.finalAcceptanceComment = finalAcceptanceComment
            params.finalAcceptanceFilesResult = finalAcceptanceFilesResult
            console.log('params', params)
            httpAction(this.url.batchApprove, params, 'post').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
            })
          } else {
            return false
          }
        })
      },
      handleCancel() {
        this.close()
      },
      close() {
        this.$emit('close')
        this.visible = false
        if (this.$refs.form) this.$refs.form.clearValidate()
      }
    }
  }
</script>