spring
2025-04-09 414a9c839061e06468138c9f662a4d9cf4225599
src/views/business/productOrder/components/add.vue
@@ -226,7 +226,7 @@
              </el-form-item>
              <el-form-item label="检验标准:" style="margin-bottom: 6px;margin-top: 6px">
                <el-select v-model="standardMethodListId" :loading="methodLoad" :placeholder="active > 1 ? '' : '请输入'"
                  clearable size="small" @change="changeStandardMethodListId" @focus="methodFocus">
                  clearable size="small" @change="changeStandardMethodListId" @focus="methodFocus" multiple>
                  <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
                  </el-option>
                </el-select>
@@ -287,7 +287,7 @@
              <el-select v-model="scope.row.standardMethodListId" :disabled="scope.row.model == null || active > 1"
                :loading="methodLoad" :readonly="active > 1" clearable placeholder="检验标准" size="small"
                style="width: 100%;" @change="(value) => methodChange(value, scope.row)" @clear="productList = []"
                @focus="methodFocus">
                @focus="methodFocus" multiple>
                <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
                </el-option>
              </el-select>
@@ -352,10 +352,10 @@
              </span>
            </template>
          </el-table-column>
          <el-table-column label="条件" min-width="140" prop="radius" show-overflow-tooltip>
          <el-table-column label="试验条件" min-width="140" prop="radius" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-input v-if="(active == 1 || tabIndex == 4) && (isAskOnlyRead || isSpecial)" v-model="scope.row.radius"
                :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="条件" size="small" type="textarea"
                :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="试验条件" size="small" type="textarea"
                @change="e => requestChange(e, scope.row, 'radius')">
              </el-input>
              <span v-else>{{ scope.row.radius }}</span>
@@ -766,7 +766,7 @@
      totalArr: [],
      addObj1: {},
      model: null,
      standardMethodListId: null,
      standardMethodListId: [],
      symbolList: ['RTS'],
      inspectionItem: null,
      inspectionItemSubclass: null,
@@ -777,7 +777,7 @@
      temId: '',
      sonLaboratoryList: [],
      selectiveEcho: [], // 检验下单的时候勾选检验项目,如果使用筛选提交显示检验项目为空 回显列表
      quarterItemOptions: [], // 查询季度信息
      quarterItemOptions: [], // 查询可靠性信息
      specialStandardMethod: '',
      isSpecial: false,
    }
@@ -812,11 +812,11 @@
    },
    'addObj.sample'(val) {
      this.model = null
      this.standardMethodListId = null
      this.standardMethodListId = []
    },
    'addObj.sampleNum'(val) {
      this.model = null
      this.standardMethodListId = null
      this.standardMethodListId = []
    },
    tabIndex(val) {
      if (val == 4 && this.active == 2) {
@@ -856,6 +856,11 @@
          };
          this.addObj.type = String(this.addObj.type)
          this.sampleList = this.HaveJson(res.data.sampleProduct);
          this.sampleList.forEach(m => {
            if (m.standardMethodListId) {
              m.standardMethodListId = JSON.parse(m.standardMethodListId)
            }
          })
          this.specialStandardMethod = this.sampleList[0].specialStandardMethod
          this.getProNum()
          this.addObj.sampleNum = this.sampleList.length
@@ -1079,9 +1084,18 @@
    save() {
      this.$refs['addObj'].validate((valid) => {
        if (valid) {
          // 选择多个标准
          let isHaveStandardMethodListId = false
          this.sampleList.forEach(item => {
            // 赋值特殊标准
            item.specialStandardMethod = this.specialStandardMethod
            if (!item.standardMethodListId || item.standardMethodListId.length == 0) {
              isHaveStandardMethodListId = true
            }
          })
          if (isHaveStandardMethodListId) {
            return this.$message.error('请选择标准')
          }
          try {
            this.sampleList.forEach(item => {
              if (item.insulating) {
@@ -1106,6 +1120,32 @@
            if (e === true) throw e
          }
          let sampleList = this.HaveJson(this.sampleList)
          // 多选检验标准时,检验项不能重复选择
          for (let i = 0; i < sampleList.length; i++) {
            if (sampleList[i].insProduct.length > 0) {
              let set = new Set();
              for (let j = 0; j < sampleList[i].insProduct.length; j++) {
                if (sampleList[i].insProduct[j].state == 1) {
                  let num0 = set.size;
                  set.add(
                    sampleList[i].insProduct[j].inspectionItem +
                    "-" +
                    sampleList[i].insProduct[j].inspectionItemSubclass
                  );
                  let num1 = set.size;
                  if (num0 == num1) {
                    this.$message.error(
                      sampleList[i].insProduct[j].inspectionItem +
                      "-" +
                      sampleList[i].insProduct[j].inspectionItemSubclass +
                      "重复"
                    );
                    return;
                  }
                }
              }
            }
          }
          sampleList.forEach(a => {
            if (a.insProduct.length > 0) {
              a.insProduct.forEach(c => {
@@ -1269,6 +1309,9 @@
        })
      } else {
        // 常规提交
        sampleList.forEach(m => {
          m.standardMethodListId = JSON.stringify(m.standardMethodListId)
        })
        addInsOrder({ insOrder: this.addObj, sampleList: sampleList }).then(res => {
          this.saveLoad = false
          this.$message.success('已提交')
@@ -1418,7 +1461,7 @@
    },
    activeStandardTree() {
      let trees = this.selectTree.split(" - ")
      if (trees.length < 3) {
      if (trees.length < 4) {
        this.$message.error('未选择对象')
        return
      }
@@ -1452,7 +1495,7 @@
        this.sample.sample = this.addObj.sample
        this.sample.model = this.addObj.model
        this.sample.unit = this.addObj.unit
        this.sample.standardMethodListId = null
        this.sample.standardMethodListId = []
        this.sample.insProduct = []
        this.sample.id = this.count
        this.sample.childSampleList = []
@@ -1497,7 +1540,7 @@
        this.sample.sample = this.addObj.sample
        this.sample.model = this.addObj.model
        this.sample.unit = this.addObj.unit
        this.sample.standardMethodListId = null
        this.sample.standardMethodListId = []
        this.sample.insProduct = []
        this.sample.id = parseInt(i + 1)
        this.sample.childSampleList = []
@@ -1522,12 +1565,12 @@
    },
    rowClick(row, column, event) {
      this.currentMethod = row
      let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
      if (obj && obj.code == '技术要求') {
        this.isAskOnlyRead = true
      } else {
        this.isAskOnlyRead = false
      }
      // let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
      // if (obj && obj.code == '技术要求') {
      //   this.isAskOnlyRead = true
      // } else {
      //   this.isAskOnlyRead = false
      // }
      this.sampleId = row.id
      if (this.active !== 1) {
        this.sampleIds = []
@@ -1721,7 +1764,8 @@
      selectStandardProductList({
        model: this.addObj.model ? this.addObj.model : row.model,
        modelNum: row.modelNum,
        standardMethodListId: val,
        standardMethodListIds: val,
        state: 1,
        factory: selectTreeList.join(" - "),
        cores: row.cores,
        conductorMaterial: row.conductorMaterial,
@@ -1771,21 +1815,22 @@
          }
        }
      }
      if (val === null || val === '') return
      if (!val || val.length == 0) return
      this.currentMethod = row
      let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
      if (obj && obj.code == '技术要求') {
        this.isAskOnlyRead = true
      } else {
        this.isAskOnlyRead = false
      }
      // let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
      // if (obj && obj.code == '技术要求') {
      //   this.isAskOnlyRead = true
      // } else {
      //   this.isAskOnlyRead = false
      // }
      this.getProductLoad = true
      let selectTreeList = this.selectTree.split(" - ")
      this.addObj.model && (selectTreeList[selectTreeList.length - 1] = this.addObj.model)
      selectStandardProductList({
        model: this.addObj.model ? this.addObj.model : row.model,
        modelNum: row.modelNum,
        standardMethodListId: val,
        standardMethodListIds: val,
        state: 1,
        cores: row.cores,
        factory: selectTreeList.join(" - "),
      }).then(res => {
@@ -1985,14 +2030,14 @@
        if (this.sampleIds.length === 0) {
          this.$message.error("未选择样品")
        } else if (this.sampleIds.length === 1) {
          if (!this.sampleSelectionList[0].standardMethodListId) {
          if (!this.sampleSelectionList[0].standardMethodListId || this.sampleSelectionList[0].standardMethodListId.length == 0) {
            this.$message.error("样品未选择检验标准")
            return
          }
          this.auxiliaryShow = true
        } else {
          // 同时配置多个样品的电缆配置时必须选择相同的检验标准
          if (!this.sampleSelectionList.every(value => value.standardMethodListId)) {
          if (!this.sampleSelectionList.every(value => value.standardMethodListId && value.standardMethodListId.length > 0)) {
            this.$message.error("样品未选择检验标准")
          } else {
            if (!this.areObjectsValuesEqual(this.sampleSelectionList, 'standardMethodListId')) {
@@ -2013,14 +2058,14 @@
        if (this.sampleIds.length === 0) {
          this.$message.error("未选择样品")
        } else if (this.sampleIds.length === 1) {
          if (!this.sampleSelectionList[0].standardMethodListId) {
          if (!this.sampleSelectionList[0].standardMethodListId || this.sampleSelectionList[0].standardMethodListId.length == 0) {
            this.$message.error("样品未选择检验标准")
            return
          }
          this.cableConfigShow = true
        } else {
          // 同时配置多个样品的电缆配置时必须选择相同的检验标准
          if (!this.sampleSelectionList.every(value => value.standardMethodListId)) {
          if (!this.sampleSelectionList.every(value => value.standardMethodListId && value.standardMethodListId.length > 0)) {
            this.$message.error("样品未选择检验标准")
          } else {
            if (!this.areObjectsValuesEqual(this.sampleSelectionList, 'standardMethodListId')) {