hcong
2024-11-12 2527a643d7ac70c7a4742b297972d46c8b1495a4
src/views/fysp/check/components/CompProblemAddOrUpd.vue
@@ -2,7 +2,12 @@
  <div class="main-container">
    <el-form :model="problem" label-width="auto" style="max-width: 95%">
      <el-form-item label="问题类型" prop="proType">
        <el-select v-model="proType" @change="onProTypeChange" class="row" :disabled="readonly">
        <el-select
          v-model="proType"
          @change="onProTypeChange"
          class="row"
          :disabled="readonly"
        >
          <el-option
            v-for="item in problemTypeOptions"
            :key="item.typeid"
@@ -42,7 +47,11 @@
        </el-select>
      </el-form-item>
      <el-form-item label="问题建议" prop="advise">
        <el-select v-model="deepCopyProblem.advise" class="row" :disabled="readonly">
        <el-select
          v-model="deepCopyProblem.advise"
          class="row"
          :disabled="readonly"
        >
          <el-option
            v-for="item in adviseOptions"
            :key="item.adGuid"
@@ -63,10 +72,18 @@
      <div class="t-card_item">
        问题图片&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <div>
          <el-button @click="chosePicFromAnyPic" v-show="!readonly">从任意图片选取</el-button>
          <el-button @click="chosePicFromDevicePic" v-show="!readonly">从设备图片选取</el-button>
          <el-button @click="chosePicFromLedgerPic" v-show="!readonly">从台账选取</el-button>
          <el-button @click="choseChangePic" v-show="!readonly">从文件夹选取</el-button>
          <el-button @click="chosePicFromAnyPic" v-show="!readonly"
            >从场景图片选取</el-button
          >
          <el-button @click="chosePicFromDevicePic" v-show="!readonly"
            >从设备图片选取</el-button
          >
          <el-button @click="chosePicFromLedgerPic" v-show="!readonly"
            >从台账选取</el-button
          >
          <el-button @click="choseChangePic" v-show="!readonly"
            >从文件夹选取</el-button
          >
        </div>
      </div>
      <el-upload
@@ -82,32 +99,35 @@
        :disabled="readonly"
        accept="image/*"
      >
        <el-button type="primary" id="uploadBtnId" style="display: none"></el-button>
        <el-button
          type="primary"
          id="uploadBtnId"
          style="display: none"
        ></el-button>
        <el-icon v-show="fileList.length != 3">
          <Plus />
        </el-icon>
      </el-upload>
      <el-form-item>
        <el-button type="primary" @click="onSubmit" v-show="!readonly">保存</el-button>
        <el-button @click="this.$emit('submited', false)" v-show="!readonly">取消</el-button>
        <el-button type="primary" @click="onSubmit" v-show="!readonly"
          >保存</el-button
        >
        <el-button @click="this.$emit('submited', false)" v-show="!readonly"
          >取消</el-button
        >
      </el-form-item>
    </el-form>
    <el-dialog
      title="任意图片"
      width="80%"
      v-model="anyPhotoDialog"
      :before-close="beforeAnyPhotoDialogclose"
      class="dialog_style"
    >
      <ArbitraryPhoto
      :max-select="3"
        v-if="anyPhotoDialog"
      v-model:dialog-visible="anyPhotoDialog"
        @selectByAnyPhonoEvent="handleSelectedAnyPhono"
        :subtask="subtask"
        :defaultFile="fileList"
        ref="arbitraryPhotoRef"
      >
      </ArbitraryPhoto>
    </el-dialog>
    <el-dialog
      title="台账图片"
      width="80%"
@@ -216,11 +236,31 @@
      month: -1,
      ledgerPicDialog: false,
      rules: {
        proType: { required: true, message: '问题类型不能为空', trigger: 'change' },
        description: { required: true, message: '问题描述不能为空', trigger: 'change' },
        locationid: { required: true, message: '问题位置不能为空', trigger: 'change' },
        advise: { required: true, message: '问题建议不能为空', trigger: 'change' },
        proRemark: { required: true, message: '补充说明不能为空', trigger: 'change' }
        proType: {
          required: true,
          message: '问题类型不能为空',
          trigger: 'change'
        },
        description: {
          required: true,
          message: '问题描述不能为空',
          trigger: 'change'
        },
        locationid: {
          required: true,
          message: '问题位置不能为空',
          trigger: 'change'
        },
        advise: {
          required: true,
          message: '问题建议不能为空',
          trigger: 'change'
        },
        proRemark: {
          required: true,
          message: '补充说明不能为空',
          trigger: 'change'
        }
      },
      deviceTopTypes: [
        { id: 0, label: '监控设备' },
@@ -261,7 +301,9 @@
    },
    adviseOptions() {
      var problemGuid = this.currProTypeGuid || this.problem.guid;
      var array = this.suggestions.filter((item) => item.adProblemtypeguid == problemGuid);
      var array = this.suggestions.filter(
        (item) => item.adProblemtypeguid == problemGuid
      );
      return array;
    }
  },
@@ -314,7 +356,9 @@
      this.deviceImgObjList = [];
      for (const deviceTopTypeElement of this.deviceTopTypes) {
        const topTypeId = deviceTopTypeElement.id;
        await deviceApi.fetchDevices(this.subtask.sceneId, topTypeId).then((result) => {
        await deviceApi
          .fetchDevices(this.subtask.sceneId, topTypeId)
          .then((result) => {
          // 标准化属性名
          for (let i = 0; i < result.data.length; i++) {
            var element = this.convertKeys(result.data[i]);
@@ -385,7 +429,10 @@
            this.deepCopyProblem.description = currDescription;
            this.proRemark = '';
          } else {
            currDescription = currProName.substring(0, currProName.lastIndexOf('('));
            currDescription = currProName.substring(
              0,
              currProName.lastIndexOf('(')
            );
            this.problemTypeList.forEach((item) => {
              if (item.description === currDescription) {
@@ -478,23 +525,24 @@
      this.deepCopyProblem.advise = '';
    },
    findProByProDesName(name) {
      let result
      this.problemTypeList.forEach(item=>{
      let result;
      this.problemTypeList.forEach((item) => {
        if (item.description == name) {
          result = item;
        }
      })
      return result
      });
      return result;
    },
    onProDesChange(value) {
      let currPro = this.findProByProDesName(value)
      let currPro = this.findProByProDesName(value);
      this.deepCopyProblem.advise = '';
      this.currProTypeGuid = currPro.guid;
      // this.deepCopyProblem.description = currPro.description;
      this.changeProblemname();
      this.deepCopyProblem.advise = '';
      var adName = this.adviseOptions.length == 0 ? '' : this.adviseOptions[0].adName;
      var adName =
        this.adviseOptions.length == 0 ? '' : this.adviseOptions[0].adName;
      this.deepCopyProblem.advise = adName;
    },
    onProLocationChange(value) {
@@ -572,7 +620,9 @@
          delete deepCopyPro['description'];
          deepCopyPro.proName = deepCopyPro.problemname;
          delete deepCopyPro['problemname'];
          deepCopyPro.ptGuid = that.findProTypeByGuid(that.currProTypeGuid).guid;
          deepCopyPro.ptGuid = that.findProTypeByGuid(
            that.currProTypeGuid
          ).guid;
          deepCopyPro.locationId = deepCopyPro.locationid;
          delete deepCopyPro['locationid'];
          data.append('problemVo', JSON.stringify(deepCopyPro));
@@ -682,14 +732,6 @@
}
.row {
  width: 100%;
}
::v-deep .el-dialog {
  --el-dialog-margin-top: 2vh;
  height: 98vh;
}
::v-deep .el-dialog__body {
  width: 95%;
  height: 100%;
}
::v-deep .el-upload-list--picture-card .el-upload-list__item-thumbnail {
  object-fit: cover !important;