src/views/flowable/workflow/repairOrder/RepairOrderApprovalModal.vue
@@ -9,7 +9,7 @@
    centered
  >
    <a-spin :spinning="spinning">
      <a-form-model :model='tableRowRecord' :rules='validatorRules' :labelCol='labelCol'
      <a-form-model ref="form" :model='tableRowRecord' :rules='validatorRules' :labelCol='labelCol'
                    :wrapperCol='wrapperCol'>
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;">报修基础信息</a-divider>
@@ -25,18 +25,13 @@
            </a-form-model-item>
          </a-col>
          <a-col :span='threeColSpan'>
            <a-form-model-item label='单据状态'>
              <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairStatus_dictText'/>
            <a-form-model-item label='维修负责人'>
              <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairer'/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span='threeColSpan'>
            <a-form-model-item label='维修负责人'>
              <a-input :readOnly='inputReadOnly' v-model='tableRowRecord.repairer'/>
            </a-form-model-item>
          </a-col>
          <a-col :span="threeColSpan">
            <a-form-model-item label="故障开始时间">
              <a-input :readOnly='inputReadOnly' v-model="tableRowRecord.faultStartTime"/>
@@ -54,7 +49,8 @@
        <a-row>
          <a-col :span='threeColSpan*3'>
            <a-form-model-item label='报修图片' :labelCol='labelColLong' :wrapperCol='wrapperColLong'>
              <j-image-upload v-model="tableRowRecord.imageFiles" disabled :is-multiple="true" :number="3"/>
              <lx-upload :returnUrl="false" :isMultiple="true" file-type="image" disabled :number="3"
                         v-model="tableRowRecord.reportImageFiles"/>
            </a-form-model-item>
          </a-col>
        </a-row>
@@ -63,37 +59,40 @@
        <a-tabs v-model="activeTabKey">
          <a-tab-pane key="1" tab="领用备件">
            <a-form-model ref="form" :model="approveData" :rules="validatorRules" :labelCol='labelCol'
                          :wrapperCol='wrapperCol'>
              <a-row>
            <a-row>
              <a-col :span="twoColSpan*2">
                <a-form-model-item label="是否需要领用备件" prop="isUseSpare">
                  <a-radio-group v-model="tableRowRecord.isUseSpare">
                    <a-radio :value="1">是</a-radio>
                    <a-radio :value="0">否</a-radio>
                  </a-radio-group>
                </a-form-model-item>
              </a-col>
              <template v-if="tableRowRecord.isUseSpare===0">
                <a-col :span="twoColSpan*2">
                  <a-form-model-item label="是否需要领用备件" prop="status">
                    <a-radio-group v-model="approveData.status">
                      <a-radio :value="1">是</a-radio>
                      <a-radio :value="0">否</a-radio>
                    </a-radio-group>
                  <a-form-model-item label="故障原因" prop="faultReason">
                    <a-input :readOnly="disableSubmit||tableRowRecord.repairStatus!=='UNDER_REPAIR'"
                             v-model="tableRowRecord.faultReason" rows="4"
                             placeholder="请输入故障原因"/>
                  </a-form-model-item>
                </a-col>
                <template v-if="approveData.status===0">
                  <a-col :span="twoColSpan*2">
                    <a-form-model-item label="故障原因" prop="faultReason">
                      <a-input v-model="approveData.faultReason" rows="4" placeholder="请输入故障原因"/>
                    </a-form-model-item>
                  </a-col>
                  <a-col :span="twoColSpan*2">
                    <a-form-model-item label="维修结果描述" prop="repairResultDescription">
                      <a-textarea v-model="approveData.repairResultDescription" placeholder="请输入维修结果描述"/>
                    </a-form-model-item>
                  </a-col>
                  <a-col :span="twoColSpan*2">
                    <a-form-model-item label="维修图片">
                      <j-image-upload v-model="approveData.imageFiles" :is-multiple="true" :number="3"/>
                    </a-form-model-item>
                  </a-col>
                </template>
              </a-row>
            </a-form-model>
                <a-col :span="twoColSpan*2">
                  <a-form-model-item label="维修结果描述" prop="repairDescription">
                    <a-textarea :readOnly="disableSubmit||tableRowRecord.repairStatus!=='UNDER_REPAIR'"
                                v-model="tableRowRecord.repairDescription"
                                placeholder="请输入维修结果描述"/>
                  </a-form-model-item>
                </a-col>
                <a-col :span="twoColSpan*2">
                  <a-form-model-item label="维修图片">
                    <lx-upload :returnUrl="false" :isMultiple="true" file-type="image" :number="3"
                               :disabled="disableSubmit||tableRowRecord.repairStatus!=='UNDER_REPAIR'"
                               v-model="tableRowRecord.imageFiles"/>
                  </a-form-model-item>
                </a-col>
              </template>
            </a-row>
          </a-tab-pane>
          <a-tab-pane key='2' tab='流程节点'>
@@ -113,33 +112,55 @@
          </a-tab-pane>
          <a-tab-pane key='3' tab='流程图'>
            <img :src="imageSrc" alt="Fetched Image"/>-->
            <img :src="imageSrc" alt="Fetched Image"/>
          </a-tab-pane>
        </a-tabs>
        <template>
        <template v-if="isDisplayConfirmSpare">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;">管理员领用备件
          </a-divider>
          <a-row>
            <a-col :span="twoColSpan">
              <a-form-model-item prop="confirmDealType" label="处理类型">
                <j-dict-select-tag type='radio' v-model='tableRowRecord.confirmDealType' dictCode='approved_rejected'
                                   :disabled="disableSubmit||tableRowRecord.inspectionStatus!=='WAIT_CONFIRM'"
                                   placeholder="请选择处理类型"/>
              </a-form-model-item>
            </a-col>
            <a-col :span="twoColSpan">
              <a-form-model-item prop="confirmComment" label="处理意见">
                <a-textarea placeholder="请输入处理意见"
                            :disabled="disableSubmit||tableRowRecord.inspectionStatus!=='WAIT_CONFIRM'"
                            v-model="tableRowRecord.confirmComment"/>
            <a-col :span="twoColSpan*2">
              <a-form-model-item prop="sparePartDescription" label="备件描述">
                <a-textarea :readOnly="disableSubmit||tableRowRecord.repairStatus!=='WAIT_SPARES'"
                            v-model="tableRowRecord.sparePartDescription"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </template>
        <template v-if="tableRowRecord.sparePartDescription">
          <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;">维修结果上报</a-divider>
          <a-row>
            <a-col :span="twoColSpan*2">
              <a-form-model-item label="故障原因" prop="faultReason">
                <a-input :readOnly="disableSubmit||isDisableSubmitRepairResult" v-model="tableRowRecord.faultReason"
                         rows="4" placeholder="请输入故障原因"/>
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col :span="twoColSpan*2">
              <a-form-model-item label="维修结果描述" prop="repairDescription">
                <a-textarea :readOnly="disableSubmit||isDisableSubmitRepairResult"
                            v-model="tableRowRecord.repairDescription"
                            placeholder="请输入维修结果描述"/>
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col :span="twoColSpan*2">
              <a-form-model-item label="维修图片">
                <lx-upload :disabled="disableSubmit||isDisableSubmitRepairResult" :returnUrl="false" :isMultiple="true"
                           file-type="image" :number="3"
                           v-model="tableRowRecord.imageFiles"/>
              </a-form-model-item>
            </a-col>
          </a-row>
        </template>
      </a-form-model>
    </a-spin>
  </a-modal>
@@ -162,7 +183,6 @@
    data() {
      return {
        title: '',
        form: this.$form.createForm(this),
        threeColSpan: 8,
        twoColSpan: 12,
        inputReadOnly: true,
@@ -189,13 +209,16 @@
          sm: { span: 20 }
        },
        validatorRules: {
          status: [
          isUseSpare: [
            { required: true, message: '请选择是否需要领用备件' }
          ],
          sparePartDescription: [
            { required: true, message: '请输入备件描述' }
          ],
          faultReason: [
            { required: true, message: '请输入故障原因' }
          ],
          repairResultDescription: [
          repairDescription: [
            { required: true, message: '请输入维修结果描述' }
          ]
        },
@@ -206,8 +229,16 @@
          queryBomDataById: '/eam/eamRepairOrder/queryById',
          diagramView: '/assign/flow/diagramView',
          queryHisTaskList: '/assign/flow/queryHisTaskList',
          approve: '/activit/assign/file/approve'
          approve: '/eam/eamRepairOrder/perform'
        }
      }
    },
    computed: {
      isDisplayConfirmSpare() {
        return ['WAIT_SPARES', 'WAIT_CONFIRM', 'COMPLETE'].includes(this.tableRowRecord.repairStatus)
      },
      isDisableSubmitRepairResult() {
        return ['WAIT_CONFIRM', 'COMPLETE'].includes(this.tableRowRecord.repairStatus)
      }
    },
    methods: {
@@ -249,12 +280,15 @@
        const that = this
        const param = { id: record.dataId }
        this.tableRowRecord = {}
        this.approveData = { status: 0 }
        this.activeTabKey = '1'
        getAction(this.url.queryBomDataById, param)
          .then((res => {
            if (res.success) {
              that.tableRowRecord = res.result
              that.tableRowRecord = Object.assign({}, res.result, {
                isUseSpare: res.result.isUseSpare === null ? 0 : res.result.isUseSpare,
                imageFiles: JSON.parse(res.result.imageFiles),
                reportImageFiles: JSON.parse(res.result.reportImageFiles)
              })
              console.log('this.tableRowRecord----->', that.tableRowRecord)
            }
          }))
@@ -269,27 +303,34 @@
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true
            const { isUseSpare, faultReason, repairDescription, sparePartDescription, imageFiles, equipmentId } = that.tableRowRecord
            const { dataId, id, procInstId, taskDefKey, variables } = that.selectShenpiData
            const flowTaskVo = {}
            flowTaskVo.status = that.approveData.status
            flowTaskVo.approveContent = flowTaskVo.comment = that.approveData.approveContent
            flowTaskVo.dataId = this.selectShenpiData.dataId
            flowTaskVo.taskId = this.selectShenpiData.id
            flowTaskVo.userId = flowTaskVo.assignee = this.selectShenpiData.assignee
            flowTaskVo.instanceId = this.selectShenpiData.procInstId
            flowTaskVo.targetKey = this.selectShenpiData.taskDefKey
            flowTaskVo.values = this.selectShenpiData.variables
            flowTaskVo.isUseSpare = isUseSpare
            flowTaskVo.faultReason = faultReason
            flowTaskVo.repairDescription = repairDescription
            flowTaskVo.sparePartDescription = sparePartDescription
            flowTaskVo.imageFilesResult = imageFiles
            flowTaskVo.equipmentId = equipmentId
            flowTaskVo.id = dataId
            flowTaskVo.dataId = dataId
            flowTaskVo.taskId = id
            flowTaskVo.instanceId = procInstId
            flowTaskVo.targetKey = taskDefKey
            flowTaskVo.values = variables
            console.log('表单提交数据', flowTaskVo)
            // httpAction(this.url.approve, flowTaskVo, 'post')
            //   .then((res) => {
            //     if (res.success) {
            //       that.$message.success(res.message)
            //       that.$emit('ok')
            //     } else {
            //       that.$message.warning(res.message)
            //     }
            //   }).finally(() => {
            //   that.confirmLoading = false
            // })
            httpAction(this.url.approve, flowTaskVo, 'post')
              .then((res) => {
                if (res.success) {
                  that.$message.success(res.message)
                  that.$emit('ok')
                } else {
                  that.$message.warning(res.message)
                }
              }).finally(() => {
              that.confirmLoading = false
            })
          } else {
            return false
          }
@@ -298,44 +339,8 @@
      handCancel() {
        this.visible = false
        this.$refs.form.clearValidate()
        if (this.$refs.form) this.$refs.form.clearValidate()
      }
    }
  }
</script>
<style scoped>
  .btn-custom {
    background-color: #4CAF50; /* 绿色背景 */
    color: #fff; /* 白色文字 */
  }
  .left_qiu {
    position: absolute;
    left: -74px;
    top: 0;
    width: 54px;
    border-radius: 50%;
    height: 54px;
    font-size: 13px;
    margin: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    background: #0099ff;
    transform: translate(0, 0);
  }
  /deep/ .ant-timeline-item-tail {
    left: -29px !important;
  }
  .left_qiu span {
    width: 3em;
    display: block;
    color: #fff;
    text-align: center;
  }
  @import '~@assets/less/common.less';
</style>
</script>