qushaowei
2023-11-18 eb48d3bada053e26def2a94d46dbe115a5a7bb2f
src/views/eam/modules/dailyInspectionOrder/DailyInspectionOrderExeDrawer.vue
@@ -28,6 +28,13 @@
              >报工</a-button>
              <a-button
                :style="{marginRight: '8px'}"
                @click="handleNormalReport"
                :disabled="buttonDistable"
                type="primary"
                v-has="'dailyInspectionOrder:normalReport'"
              >结果正常并报工</a-button>
              <a-button
                :style="{marginRight: '8px'}"
                @click="handleReset"
                :disabled="revocationDistable"
                type="primary"
@@ -129,8 +136,8 @@
                  :pagination="ipagination"
                  :loading="loading"
                  @change="handleTableChange"
                  :scroll="{ x: 'calc(1000px + 50%)', y: 900 }"
                >
                  <!-- :scroll="{ x: 'calc(1000px + 50%)', y: 900 }" -->
                  <template
                    v-for="col in columns"
                    :slot="col.dataIndex"
@@ -150,7 +157,7 @@
                        style="max-width:80px;font-size: 12px;font-style: italic;"
                      />
                      <a-select
                        v-if="col.dataIndex == 'inspectionProjectResult' && record.testValueType == '2'"
                        v-if="col.dataIndex == 'inspectionProjectResult' "
                        :value="text"
                        @change="(e) => handleChange(e, record.key, col, index)"
                        style="width: 100%"
@@ -162,7 +169,7 @@
                        <a-select-option value="3">故障停机</a-select-option>
                        <a-select-option value="4">没开机</a-select-option>
                      </a-select>
                      <a-input-number
                      <!-- <a-input-number
                        :value="text"
                        v-if="col.dataIndex == 'inspectionProjectResult' && record.testValueType == '1'"
                        :min="0"
@@ -170,7 +177,7 @@
                        @change="(e)=>handleChange(e, record.key, col, index,record)"
                        style="width: 100%"
                        :disabled="record.disabled"
                      />
                      /> -->
                      <a-textarea
                        :value="text"
                        v-if="col.dataIndex == 'abnormalDesc'"
@@ -311,7 +318,7 @@
  },
  data() {
    return {
      title: "日常点检工单执行",
      title: "自主维护点检执行",
      visible: false,
      maskClosable: true,
      confirmLoading: false,
@@ -340,18 +347,18 @@
          },
          width: 50,
        },
        {
          title: '部位',
          align: 'center',
          dataIndex: 'location',
        },
        // class: "notshow"
        {
          title: '示意图',
          align: 'center',
          dataIndex: 'photo',
          scopedSlots: { customRender: 'photo' },
        },
        // {
        //   title: '部位',
        //   align: 'center',
        //   dataIndex: 'location',
        // },
        // // class: "notshow"
        // {
        //   title: '示意图',
        //   align: 'center',
        //   dataIndex: 'photo',
        //   scopedSlots: { customRender: 'photo' },
        // },
        // class: "notshow"
        {
          title: '点检项目',
@@ -383,25 +390,26 @@
          align: 'center',
          dataIndex: 'inspectionProjectResult',
          scopedSlots: { customRender: 'inspectionProjectResult' },
          className: 'red',
        },
        // className: 'red',
        // {
        //   title: '判定',
        //   align: 'center',
        //   dataIndex: 'judgmentResult',
        //   customRender: (text) => {
        //     if (text == 'pass') {
        //       return "正常";
        //     } else if (text == 'fail') {
        //       return "异常";
        //     }
        //   },
        // },
        {
          title: '判定',
          align: 'center',
          dataIndex: 'judgmentResult',
          customRender: (text) => {
            if (text == 'pass') {
              return "正常";
            } else if (text == 'fail') {
              return "异常";
            }
          },
        },
        {
          title: '异常描述',
          title: '*异常描述',
          align: 'center',
          dataIndex: 'abnormalDesc',
          scopedSlots: { customRender: 'abnormalDesc' },
          className: 'red',
        },
        // {
        //   title: '异常拍照',
@@ -414,8 +422,8 @@
          align: 'center',
          dataIndex: 'treatmentMeasure',
          scopedSlots: { customRender: 'treatmentMeasure' },
          className: 'red',
        },
        // className: 'red',
      ],
      url: {
        list: "/eam/inspectionOrderDetail/list",
@@ -426,6 +434,7 @@
        editStatus: "/eam/inspectionOrder/editStatus",
        revocation: "/eam/inspectionOrder/revocation",
        report: "/eam/inspectionOrder/report",
        normalReport: "/eam/inspectionOrder/normalReport",
      },
    }
  },
@@ -561,14 +570,21 @@
      for (let i = 0; i < that.dataSource.length; i++) {
        let o = this.dataSource[i]
        if (o.inspectionProjectResult == null || o.inspectionProjectResult == '') {
          that.$message.warning('请输入点检结果!')
          that.$message.warning("请填写第" + (i + 1) + "点检结果!");
          that.confirmLoading = false;
          return
        }
        if (o.treatmentMeasure == null || o.treatmentMeasure == '') {
          that.$message.warning('请选择异常处置!')
          that.confirmLoading = false;
          return
        if (o.inspectionProjectResult == '2' || o.inspectionProjectResult == '3') {
          if (o.abnormalDesc == null || o.abnormalDesc == '') {
            that.$message.warning("请填写第" + (i + 1) + "异常描述!");
            that.confirmLoading = false;
            return
          }
          if (o.treatmentMeasure == null || o.treatmentMeasure == '') {
            that.$message.warning("请填写第" + (i + 1) + "异常处置!");
            that.confirmLoading = false;
            return
          }
        }
      }
      formData.inspectionOrderDetailList = that.dataSource;
@@ -602,6 +618,43 @@
      })
    },
    //报工
    handleNormalReport() {
      const that = this;
      that.confirmLoading = true;
      let formData = Object.assign(this.model);
      formData.inspectionOrderDetailList = that.dataSource;
      formData.id = that.model.id;
      formData.status = "5";
      formData.equipmentId = that.model.equipmentId;
      this.$confirm({
        title: '点检工单报工',
        content: '提示:点检结果全部正常,报工后点检工单完工,请谨慎操作!',
        okText: '确认',
        cancelText: '取消',
        onOk() {
          requestPut(that.url.normalReport, formData).then((res) => {
            if (res.success) {
              that.model.status = '5'
              that.$message.success(res.message)
              that.buttonDistable = false
              that.revocationDistable = true
              that.SWbuttonDistable = true
              that.$emit('ok');
              that.alterFlag = new Date();
              that.close();
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = false;
            //
          })
        },
      })
    },
    //保存
    handleOk() {
      const that = this;
@@ -610,14 +663,21 @@
      for (let i = 0; i < that.dataSource.length; i++) {
        let o = this.dataSource[i]
        if (o.inspectionProjectResult == null || o.inspectionProjectResult == '') {
          that.$message.warning('请输入点检结果!')
          that.$message.warning("请填写第" + (i + 1) + "点检结果!");
          that.confirmLoading = false;
          return
        }
        if (o.treatmentMeasure == null || o.treatmentMeasure == '') {
          that.$message.warning('请选择异常处置!')
          that.confirmLoading = false;
          return
        if (o.inspectionProjectResult == '2' || o.inspectionProjectResult == '3') {
          if (o.abnormalDesc == null || o.abnormalDesc == '') {
            that.$message.warning("请填写第" + (i + 1) + "异常描述!");
            that.confirmLoading = false;
            return
          }
          if (o.treatmentMeasure == null || o.treatmentMeasure == '') {
            that.$message.warning("请填写第" + (i + 1) + "异常处置!");
            that.confirmLoading = false;
            return
          }
        }
      }
      formData.inspectionOrderDetails = that.dataSource
@@ -671,29 +731,29 @@
      if (target) {
        if (column.dataIndex == 'inspectionProjectResult') {
          if (target.testValueType === "1") {
            target[column.dataIndex] = value;
            let maxValue = target.maxValue
            let minValue = target.minValue
            if (value > minValue && value < maxValue) {
              target['judgmentResult'] = "pass";
            } else {
              target['judgmentResult'] = "fail";
            }
            if (value == null || value == "") {
              target['judgmentResult'] = "";
            }
          } else {
            target[column.dataIndex] = value;
            if (value == "1") {
              target['judgmentResult'] = "pass";
            } else {
              target['judgmentResult'] = "fail";
            }
            if (value == null || value == "") {
              target['judgmentResult'] = "";
            }
          }
          // if (target.testValueType === "1") {
          //   target[column.dataIndex] = value;
          //   let maxValue = target.maxValue
          //   let minValue = target.minValue
          //   if (value > minValue && value < maxValue) {
          //     target['judgmentResult'] = "pass";
          //   } else {
          //     target['judgmentResult'] = "fail";
          //   }
          //   if (value == null || value == "") {
          //     target['judgmentResult'] = "";
          //   }
          // } else {
          target[column.dataIndex] = value;
          // if (value == "1") {
          //   target['judgmentResult'] = "pass";
          // } else {
          //   target['judgmentResult'] = "fail";
          // }
          // if (value == null || value == "") {
          //   target['judgmentResult'] = "";
          // }
          // }
        }
        if (column.dataIndex == 'abnormalDesc') {
          target[column.dataIndex] = value.target.value;
@@ -737,43 +797,7 @@
      })
    },
    getSrc(record) {
      if (!record.path) {
        return '';
      }
      //本地:local\Minio:minio\阿里云:alioss
      if (record.uploadType == 'local') {
        let ssoLoginFlag = Vue.ls.get("ssoLoginFlag");
        let deployMode = Vue.ls.get("deployMode");
        if (ssoLoginFlag && deployMode == "container") {
          var baseProject = Vue.ls.get("baseProject");
          console.log("baseProject==>" + baseProject)
          var hostname = window.location.protocol + "//" + window.location.host;
          var url = hostname + '/' + baseProject + '/sys/common/static';
          return getFileAccessHttpUrl(record.path + record.encodeName, url, window._CONFIG['hyperTextTransfer'])
        } else {
          //根据发布状态修改https 或 http
          return getFileAccessHttpUrl(record.path + record.encodeName, this.url.urlDownload, window._CONFIG['hyperTextTransfer'])
        }
      } else if (record.uploadType == 'alioss') {
        const OSS = require('ali-oss')
        const client = new OSS({
          // region以杭州为例(oss-cn-hangzhou),其他region按实际情况填写。
          region: window._CONFIG['region'],
          // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。
          accessKeyId: window._CONFIG['accessKeyId'],
          accessKeySecret: window._CONFIG['accessKeySecret'],
          bucket: window._CONFIG['bucket'],
        })
        // object-key表示从OSS下载文件时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。
        return client.signatureUrl(record.path)
      }
    },
  },
}
@@ -796,7 +820,7 @@
.hight {
  color: #f5222d;
}
/deep/ .red {
.red {
  color: red;
}
</style>