spring
2025-04-09 414a9c839061e06468138c9f662a4d9cf4225599
src/views/business/productOrder/components/add.vue
@@ -20,10 +20,10 @@
          <el-button
            v-if="active == 1 && addObj.sampleType != undefined && (addObj.sampleType.indexOf('电缆') > -1 || addObj.sampleType.indexOf('综合') > -1)"
            size="small" type="primary" @click="openCableConfig">电缆配置</el-button>
          <el-button v-if="active == 1 && addObj.sampleType != undefined && addObj.sampleType.indexOf('电缆') > -1" size="small"
            type="primary" @click="openAuxiliaryCore">辅助线芯配置</el-button>
          <el-button v-show="active == 1 || (tabIndex == 4 && active == 2)" :loading="saveLoad" size="small" type="primary"
            @click="save">提交</el-button>
          <el-button v-if="active == 1 && addObj.sampleType != undefined && addObj.sampleType.indexOf('电缆') > -1"
            size="small" type="primary" @click="openAuxiliaryCore">辅助线芯配置</el-button>
          <el-button v-show="active == 1 || (tabIndex == 4 && active == 2)" :loading="saveLoad" size="small"
            type="primary" @click="save">提交</el-button>
          <!-- 审核 -->
          <el-button v-show="active == 3" :disabled="saveLoad" :loading="saveLoad" size="small"
            @click="upInsOrderOfState(2)">不通过</el-button>
@@ -144,14 +144,14 @@
            </el-col>
            <el-col :span="6">
              <el-form-item label="生产单位:" prop="production">
                <el-input v-model="addObj.production" :disabled="active > 1 && tabIndex != 4" clearable placeholder="请输入"
                  size="small"></el-input>
                <el-input v-model="addObj.production" :disabled="active > 1 && tabIndex != 4" clearable
                  placeholder="请输入" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="生产单位EN:" prop="productionEn">
                <el-input v-model="addObj.productionEn" :disabled="active > 1 && tabIndex != 4" clearable placeholder="请输入"
                  size="small"></el-input>
                <el-input v-model="addObj.productionEn" :disabled="active > 1 && tabIndex != 4" clearable
                  placeholder="请输入" size="small"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
@@ -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>
@@ -365,7 +365,8 @@
            <template slot="header" slot-scope="scope">
              <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px">
                <span>试验方法</span>
                <el-input v-if="active == 1" v-model="methodS" placeholder="请输入" size="mini" @input="searchFilterList" />
                <el-input v-if="active == 1" v-model="methodS" placeholder="请输入" size="mini"
                  @input="searchFilterList" />
              </div>
            </template>
          </el-table-column>
@@ -522,8 +523,8 @@
            <div class="search_label" style="width: 80px;">要求值:</div>
            <div class="search_input">
              <el-radio-group v-model="item.bsm1Val" v-removeAriaHidden @input="upBsmAll(item)">
                <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai"
                  :label="a">{{ JSON.parse(item.bsmRow.askCopy)[ai] }}</el-radio>
                <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai" :label="a">{{
                  JSON.parse(item.bsmRow.askCopy)[ai] }}</el-radio>
              </el-radio-group>
            </div>
          </el-col>
@@ -765,7 +766,7 @@
      totalArr: [],
      addObj1: {},
      model: null,
      standardMethodListId: null,
      standardMethodListId: [],
      symbolList: ['RTS'],
      inspectionItem: null,
      inspectionItemSubclass: null,
@@ -776,7 +777,7 @@
      temId: '',
      sonLaboratoryList: [],
      selectiveEcho: [], // 检验下单的时候勾选检验项目,如果使用筛选提交显示检验项目为空 回显列表
      quarterItemOptions: [], // 查询季度信息
      quarterItemOptions: [], // 查询可靠性信息
      specialStandardMethod: '',
      isSpecial: false,
    }
@@ -811,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) {
@@ -855,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
@@ -1078,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) {
@@ -1105,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 => {
@@ -1268,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('已提交')
@@ -1376,7 +1420,7 @@
    handleNodeClick(val, node, el) {
      this.selectTree = ''
      this.models = val.children
      this.selectTree = getReversedTreePath(node)
      this.selectTree = this.getReversedTreePath(node)
    },
    /**
   * 获取反向拼接的树路径字符串
@@ -1417,21 +1461,31 @@
    },
    activeStandardTree() {
      let trees = this.selectTree.split(" - ")
      if (trees.length < 3) {
      if (trees.length < 4) {
        this.$message.error('未选择对象')
        return
      }
      this.addObj.factory = trees[0]
      this.addObj.laboratory = trees[1]
      this.addObj.sampleType = trees[2]
      if (trees[3] === undefined || trees[3] === '' || trees[3] === '- ') {
        this.addObj.sample = trees[2]
      if (trees[2] == '包材' || trees[2] == '原辅材') {
        this.addObj.sampleType = trees[4]
        if (trees[5] === undefined || trees[5] === '' || trees[5] === '- ') {
          this.addObj.sample = trees[4]
        } else {
          this.addObj.sample = trees[5]
        }
        this.addObj.model = (trees[6] == undefined ? null : trees[6])
      } else {
        this.addObj.sample = trees[3]
        this.addObj.sampleType = trees[3]
        if (trees[4] === undefined || trees[4] === '' || trees[4] === '- ') {
          this.addObj.sample = trees[3]
        } else {
          this.addObj.sample = trees[4]
        }
        this.addObj.model = (trees[5] == undefined ? null : trees[5])
      }
      this.addObj.sampleView = this.addObj.sample
      this.addObj.sampleViewEn = this.sampleViewEn
      this.addObj.model = (trees[4] == undefined ? null : trees[4])
      this.selectStandardTree = false
      this.sampleList = []
      for (var i = 0; i < this.addObj.sampleNum; i++) {
@@ -1441,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 = []
@@ -1486,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 = []
@@ -1511,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 = []
@@ -1710,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,
@@ -1760,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 => {
@@ -1974,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')) {
@@ -2002,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')) {