zhangherong
2025-04-15 8b55f331c79350dbbdc85b6d366b151dfe6652f8
src/views/flowable/workflow/weekMaintenance/WeekMaintenanceApprovalModal.vue
@@ -23,7 +23,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>
                                            @autocompleteForm="autocompleteForm"
                                            disabled></maintenance-equipment-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
@@ -35,7 +36,8 @@
        <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
              <a-date-picker placeholder="请选择计划保养日期" v-model="model.maintenanceDate" format="YYYY-MM-DD"
                             disabled
                             style="width: 100%" />
            </a-form-model-item>
          </a-col>
@@ -56,31 +58,70 @@
            <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" prop="remark" label="保养图片">
            <lx-upload :returnUrl="false"
                       :isMultiple="true"
                       file-type="image"
                       v-model="model.fileList" />
          </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">
          <j-vxe-table
            ref="editableDetailTable"
            :rowNumber="true"
            :rowSelection="true"
            :bordered="true"
            :alwaysEdit="true"
            :toolbar="true"
            :toolbarConfig="detail.toolbarConfig"
            keep-source
            :height="300"
            :loading="detail.loading"
            :dataSource="detail.dataSource"
            :columns="detail.columns"
            style="margin-top: 8px;" />
          <a-tabs>
            <a-tab-pane key="1" tab="保养项明细">
              <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="请选择保养结果"
                                     @change="handleInspectionResultSelectChange($event,props.row)"
                                     style="width: 100%" />
                </template>
                <template v-slot:exceptionDescription="props">
                  <a-textarea style="height: 32px" v-model="props.row.exceptionDescription"
                              :disabled="!props.row.maintenanceResult||props.row.maintenanceResult==='1'" />
                </template>
                <template v-slot:reportFlag="props">
                  <j-dict-select-tag v-model="props.row.reportFlag"
                                     :disabled="!props.row.maintenanceResult||props.row.maintenanceResult==='1'"
                                     dictCode="yn"
                                     style="width: 100%" />
                </template>
              </j-vxe-table>
            </a-tab-pane>
            <a-button v-if="selectedRowKeys.length>0" slot="tabBarExtraContent" type="primary"
                      @click="handleSelectAllInspectionResult">批量保养正常
            </a-button>
          </a-tabs>
        </a-row>
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 班组长确认信息
        </a-divider>
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 初验收信息
        </a-divider>
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 终验收信息
        </a-divider>
        <div v-if="['WAIT_CONFIRM', 'WAIT_INITIAL_ACCEPTANCE', 'WAIT_FINAL_ACCEPTANCE', 'COMPLETE'].includes(model.maintenanceStatus)">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 班组长确认信息
          </a-divider>
        </div>
        <div v-if="['WAIT_INITIAL_ACCEPTANCE', 'WAIT_FINAL_ACCEPTANCE', 'COMPLETE'].includes(model.maintenanceStatus)">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 初验收信息
          </a-divider>
        </div>
        <div v-if="['WAIT_FINAL_ACCEPTANCE', 'COMPLETE'].includes(model.maintenanceStatus)">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 终验收信息
          </a-divider>
        </div>
      </a-form-model>
    </a-spin>
  </j-modal>
@@ -104,10 +145,10 @@
      visible: false,
      //状态控制
      //保养中 不可编辑
      underMaintenanceDisable : false,
      confirmDisable : false,
      initialAcceptanceDisable : false,
      finalAcceptanceDisable : false,
      underMaintenanceDisable: false,
      confirmDisable: false,
      initialAcceptanceDisable: false,
      finalAcceptanceDisable: false,
      editable: false,
      model: {},
      maintenanceCategory: 'WEEK_MAINTENANCE',
@@ -129,13 +170,12 @@
        sm: { span: 21 }
      },
      confirmLoading: false,
      validatorRules: {
      },
      validatorRules: {},
      url: {
        queryById: '/eam/weekMaintenanceOrder/queryById',
        detail: '/eam/weekMaintenanceOrderDetail/queryList',
        approval : '/eam/weekMaintenanceOrder/approval',
        userSelect: '/eam/user_select/list',
        approval: '/eam/weekMaintenanceOrder/approval',
        userSelect: '/eam/user_select/list'
      },
      detail: {
        loading: false,
@@ -155,31 +195,63 @@
            title: '序号',
            key: 'itemCode',
            type: JVXETypes.normal,
            width: '10%',
            align: 'center',
            width: '5%',
            align: 'center'
          },
          {
            title: '保养项',
            key: 'itemName',
            type: JVXETypes.normal,
            width: '20%',
            align: 'center',
            width: '10%',
            align: 'center'
          },
          {
            title: '子保养项',
            key: 'subItemName',
            type: JVXETypes.normal,
            width: '25%',
            width: '10%',
            align: 'center'
          },
          {
            title: '保养要求',
            key: 'itemDemand',
            type: JVXETypes.normal,
            width: '30%',
            width: '20%',
            align: 'center'
          },
          {
            title: '保养结果',
            key: 'maintenanceResult',
            type: JVXETypes.selectSearch,
            dictCode: 'eam_inspection_result',
            width: '10%',
            align: 'center',
            slotName: 'maintenanceResult',
            validateRules: [
              { required: true, message: '保养结果不能为空!' }
            ]
          },
          {
            title: '异常描述',
            key: 'exceptionDescription',
            type: JVXETypes.textarea,
            width: '20%',
            align: 'center',
            slotName: 'exceptionDescription',
          },
          {
            title: '是否报修',
            key: 'reportFlag',
            type: JVXETypes.selectSearch,
            dictCode: 'yn',
            width: '10%',
            align: 'center',
            slotName: 'reportFlag',
          }
        ],
        isDisplayBmp: false,
        showBmpButtonLoading: false,
        selectedRowKeys: [],
        toolbarConfig: {
          // prefix 前缀;suffix 后缀
          slot: ['prefix', 'suffix'],
@@ -192,14 +264,17 @@
  created() {
  },
  methods: {
    async handleDetail(dataId) {
      this.loading = true;
      this.visible = true;
    async handleDetail(item) {
      this.loading = true
      this.visible = true
      this.detail.dataSource = []
      let res = await getAction(this.url.queryById, {id: dataId});
      this.model = Object.assign({}, res.result);
      await this.loadDetail(dataId);
      this.loading = false;
      let param = {
        id: item.dataId
      }
      let res = await getAction(this.url.queryById, param)
      this.model = Object.assign({}, res.result, item)
      await this.loadDetail(item.dataId)
      this.loading = false
    },
    close() {
      this.$emit('close')
@@ -251,8 +326,7 @@
      if (!this.model.id) {
        this.loadStandardDetail(selectObj.id)
      }
      debugger
      this.loadMaintenanceOperatorList(this.model.equipmentId);
      this.loadMaintenanceOperatorList(this.model.equipmentId)
    },
    //标准选择变化
    loadDetail(orderId) {
@@ -279,8 +353,32 @@
          }))
        }
      })
    }
    },
    handleInspectionResultSelectChange(value, record) {
      if (record.exceptionDescription) delete record.exceptionDescription
      if (record.reportFlag) delete record.reportFlag
    },
    // 批量选择所有点检结果
    handleSelectAllInspectionResult() {
      this.selectedRowKeys.forEach(key => {
        const dataItem = this.detail.dataSource.find(item => item.id === key)
        if (dataItem && dataItem.maintenanceResult !== '1') {
          console.log('dataItem', dataItem)
          delete dataItem.exceptionDescription
          delete dataItem.reportFlag
          dataItem.maintenanceResult = '1'
        }
      })
      this.$refs.editableDetailTable.clearCheckboxRow()
      this.selectedRowKeys = []
    },
    /**
     * 表格多选框发生改变时触发
     * @param {selectedRowIds} 表格中已选择的ID列表
     */
    handleTableSelectRowChange({ selectedRowIds }) {
      this.selectedRowKeys = selectedRowIds
    },
  }
}
</script>