licp
2024-12-20 d975fc4756806f5b51f006c19c33571b9b8c0b3b
src/components/do/b1-ins-order/add.vue
@@ -134,9 +134,9 @@
  <div class="ins_order_add" style=" display: block; ">
    <div v-show="!configShow&&!equipConfigShow&&!cableConfigShow">
      <el-row class="title">
        <el-col :span="6" style="padding-left: 20px;text-align: left;">委托单信息&nbsp;&nbsp;&nbsp;单位成本总价:<span
        <el-col :span="8" style="padding-left: 20px;text-align: left;">委托单信息&nbsp;&nbsp;&nbsp;单位成本总价:<span
            style="color: #3A7BFA">¥{{total.toFixed(2)}}</span></el-col>
        <el-col :span="18" style="text-align: right;">
        <el-col :span="16" style="text-align: right;">
          <el-select v-model="template" size="medium" placeholder="下单模板" style="margin-right: 10px;" v-show="active==1"
            @change="selectInsOrderTemplateById">
            <el-option v-for="(a, ai) in templates" :key="ai" :value="a.id" :label="a.name">
@@ -216,7 +216,7 @@
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
            <div class="search_label"><span class="required-span">* </span>样品名称:</div>
            <div class="search_label"><span class="required-span">* </span>样品类型:</div>
            <div class="search_input">
              <el-input readonly size="small" v-model="addObj.sample">
                <template slot="append"><el-button slot="append" icon="el-icon-search" @click="selectStandardTree = true"
@@ -234,7 +234,7 @@
            <div class="search_label"><span class="required-span">* </span>样品数量:</div>
            <div class="search_input">
              <el-input-number size="small" v-model="addObj.sampleNum" :min="1" :max="100" :precision="0"
                style="width: 65%;" @change="addStandardTree" :disabled="active>1"></el-input-number>
                style="width: 100%;" @change="addStandardTree" :disabled="active>1"></el-input-number>
            </div>
          </el-col>
          <!-- <el-col class="search_thing" :span="6">
@@ -356,11 +356,11 @@
                :disabled="active>1"
                type="date"
                placeholder="选择日期"
                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </el-col>
          <el-col class="search_thing" :span="6">
          <el-col class="search_thing" :span="6" v-if="addObj.formType!='其他成品'&&addObj.formType">
            <div class="search_label"><span class="required-span">* </span>样机完成时间:</div>
            <div class="search_input">
              <el-date-picker
@@ -368,7 +368,7 @@
                :disabled="active>1"
                type="date"
                placeholder="选择日期"
                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
                size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%;">
              </el-date-picker>
            </div>
          </el-col>
@@ -409,11 +409,33 @@
      <div style="height: auto;">
        <div class="search" v-if="active==1" style="display: flex;background: transparent;">
          <div class="search_thing">
            <div class="search_label">样品型号:</div>
            <div class="search_label">样品名称:</div>
            <div class="search_input">
              <el-select v-model="model" :placeholder="active>1 ? '' : '请输入'" filterable allow-create default-first-option size="small"
                @change="changeModel">
              <el-input size="small" v-model="allInfo.sample" @change="changeModel('sample')"></el-input>
            </div>
          </div>
          <div class="search_thing">
            <div class="search_label">样品类别:</div>
            <div class="search_input">
              <el-select v-model="allInfo.model" :placeholder="active>1 ? '' : '请输入'" filterable allow-create default-first-option size="small"
                @change="changeModel('model')">
                <el-option v-for="item in models" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="search_thing">
            <div class="search_label">产品型号:</div>
            <div class="search_input">
              <el-input size="small" v-model="allInfo.modelNum" @change="changeModel('modelNum')"></el-input>
            </div>
          </div>
          <div class="search_thing">
            <div class="search_label">试验标准:</div>
            <div class="search_input">
              <el-select v-model="allInfo.testRequirements" :placeholder="active>1 ? '' : '请输入'" filterable allow-create default-first-option size="small"
                @change="changeModel('testRequirements')">
                <el-option v-for="item in standard" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </div>
@@ -439,7 +461,7 @@
          <el-table-column type="index" label="序号" width="65" align="center"></el-table-column>
          <el-table-column prop="sample" label="样品名称" align="center" min-width="100">
            <template slot-scope="scope">
              <el-input size="small" v-model="scope.row.sample" clearable :readonly="active>1"></el-input>
              <el-input size="small" v-model="scope.row.sample" clearable :readonly="active>1" placeholder="必填"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="sampleCode" label="样品编号" min-width="100" align="center">
@@ -448,18 +470,18 @@
                :readonly="active>1"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="model" label="样品型号" align="center" min-width="100">
          <el-table-column prop="model" label="样品类别" align="center" min-width="100">
            <template slot-scope="scope">
              <el-select v-model="scope.row.model" filterable allow-create default-first-option placeholder="样品型号"
              <el-select v-model="scope.row.model" filterable allow-create default-first-option placeholder="样品类别"
                size="small" @change="handleChangeModel" :disabled="active>1" style="width: 100%;">
                <el-option v-for="item in models" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column prop="modelNum" label="型号参数" min-width="100" align="center" v-if="!(active>1)">
          <el-table-column prop="modelNum" label="产品型号" min-width="100" align="center" v-if="!(active>1)">
            <template slot-scope="scope">
              <el-input size="small" v-model="scope.row.modelNum" clearable placeholder="非必填"
              <el-input size="small" v-model="scope.row.modelNum" clearable placeholder="必填"
                @keyup.enter.native="methodChange(scope.row.standardMethodListId, scope.row)"
                @clear="methodChange(scope.row.standardMethodListId, scope.row)"></el-input>
            </template>
@@ -467,7 +489,7 @@
          <el-table-column prop="testRequirements" label="试验标准" align="center" min-width="100">
            <template slot-scope="scope">
              <el-select v-model="scope.row.testRequirements" :disabled="scope.row.model==null||active>1"
                placeholder="试验标准" size="small" :readonly="active>1" style="width: 100%;" clearable>
                placeholder="试验标准" size="small" :readonly="active>1" style="width: 100%;" clearable @change="changeModel0(scope.row)">
                <el-option v-for="item in standard" :key="item.id" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
@@ -540,7 +562,7 @@
            <template slot-scope="scope">
              <el-input size="small" placeholder="要求描述" v-model="scope.row.tell" clearable type="textarea"
                :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'tell')"
                v-if="active==1"></el-input>
                v-if="active==1" :disabled="!!scope.row.tell&&scope.row.tell.includes('[')&&scope.row.tell.includes(']')&&scope.row.tell.includes(',')"></el-input>
              <span v-else>
                <template >{{ scope.row.tell }}</template>
              </span>
@@ -550,7 +572,7 @@
            <template slot-scope="scope">
              <el-input size="small" placeholder="要求值" v-model="scope.row.ask" clearable type="textarea"
                :autosize="{ minRows: 1, maxRows: 3}" @change="e=>requestChange(e,scope.row,'ask')"
                v-if="active==1&&scope.row.inspectionValueType!='5'"></el-input>
                v-if="active==1&&scope.row.inspectionValueType!='5'" :disabled="!!scope.row.ask&&scope.row.ask.includes('[')&&scope.row.ask.includes(']')&&scope.row.ask.includes(',')"></el-input>
              <span v-else>
                <!-- <template v-if="(scope.row.ask.indexOf('D')>-1
                ||scope.row.ask.indexOf('W')>-1
@@ -592,11 +614,6 @@
        :delUrl="$api.insOrderPlan.delfile" style="height: 100%;margin-top: 16px;" v-show="currentPage==1"/>
      </div>
    </div>
    <p style="font-size: 12px;color: red;margin-top: 20px;margin-bottom: 20px;">双方承诺:<br/>
      1、委托方承诺提供的信息与样品的真实性;<br/>
      2、委托送样检验结果仅适用于收到的样品;<br/>
      3、试验过程导致的样品损坏、配件损坏、损耗,本测试场不承担赔偿责任;<br/>
      4、实验室承诺公正开展检测活动,并承诺保守在检测活动过程中所获知的保密信息。</p>
    <el-dialog title="选择单位" :visible.sync="selectUserDia" width="70%">
      <div class="body" style="height: 60vh;" v-if="selectUserDia">
        <ValueTable ref="ValueTable2" :url="$api.user.selectCustomPageList" :componentData="componentData2" />
@@ -1038,6 +1055,12 @@
      <filePreview v-if="lookFileVisible" :fileUrl="currentFile.url"
      :currentFile="currentFile" style="max-height: 87vh;overflow-y: auto;"/>
    </el-dialog>
    <p style="font-size: 12px;color: red;margin-top: 20px;margin-bottom: 20px;">双方承诺:<br/>
      1、委托方承诺提供的信息与样品的真实性;<br/>
      2、委托送样检验结果仅适用于收到的样品;<br/>
      3、试验过程导致的样品损坏、配件损坏、损耗,本测试场不承担赔偿责任;<br/>
      4、实验室承诺公正开展检测活动,并承诺保守在检测活动过程中所获知的保密信息。
      </p>
  </div>
</template>
@@ -1303,11 +1326,17 @@
          requiredUp: []
        },
        ruleInfo:{
          rule:null,
          rule:1,
          num:null,
        },
        powerShow:false,
        powerTable:[]
        powerTable:[],
        allInfo:{
          model:null,
          sample:null,
          modelNum:null,
          testRequirements:null,
        }
      }
    },
    watch: {
@@ -1358,12 +1387,21 @@
        }
      },
      'addObj.sample'(val) {
        this.model = null
        this.allInfo.model = null
        this.allInfo.sample = null
        this.allInfo.modelNum = null
        this.allInfo.testRequirements = null
        this.standardMethodListId = []
      },
      'addObj.sampleNum'(val) {
        this.model = null
        this.allInfo.model = null
        this.allInfo.sample = null
        this.allInfo.modelNum = null
        this.allInfo.testRequirements = null
        this.standardMethodListId = []
      },
      active(val){
        this.saveLoad = false
      }
    },
    mounted() {
@@ -1412,7 +1450,7 @@
          })
        })
        // 文件信息
        this.componentData0.entity.insOrderId = this.currentId
        this.componentData0.entity.insOrderId = this.currentId;
        this.$refs.fileList.selectList()
      }
    },
@@ -1893,12 +1931,12 @@
          this.$message.error('请输入样品型号')
        }else if (!this.addObj.appointed) {
          this.$message.error('请选择约定时间')
        }else if (!this.addObj.issueTime) {
          this.$message.error('请选择样机完成时间')
        } else if (!this.sampleList.every(m => m.standardMethodListId&&m.standardMethodListId.length>0)) {
        }else if (!this.sampleList.every(m => m.standardMethodListId&&m.standardMethodListId.length>0)) {
          this.$message.error('请选择检验标准')
        } else if(this.addObj.formType&&this.addObj.formType!='其他成品'&&!this.addObj.issueUser){
          this.$message.error('请选择通知至样机员')
        }else if(this.addObj.formType&&this.addObj.formType!='其他成品'&&!this.addObj.issueTime){
          this.$message.error('请选择样机完成时间')
        }else{
          //校验检验项的要求值和要求描述,仅委托要求
          // if(this.active==1&&this.isAskOnlyRead){
@@ -1925,15 +1963,23 @@
              }
            }
          }
          let index0 = sampleList.findIndex(m=>!m.sample)
          if(index0>-1) return this.$message.error('请填写样品名称')
          let index1 = sampleList.findIndex(m=>!m.modelNum)
          if(index1>-1) return this.$message.error('请填写产品型号')
          let projectNum = this.totalArr.filter(a => a.state == 1).length
          if(projectNum==0){
            this.$confirm('检验项目为空,是否确认提交?', "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning"
            }).then(() => {
              this.saveMethod(sampleList)
            }).catch(() => {})
            // this.$confirm('检验项目为空,是否确认提交?', "提示", {
            //   confirmButtonText: "确定",
            //   cancelButtonText: "取消",
            //   type: "warning"
            // }).then(() => {
            //   this.saveMethod(sampleList)
            // }).catch(() => {})
            return this.$message.error('请添加检验项目')
          }else{
            let isRTS = this.totalArr.find(a => a.ask != null && this.symbolList.find(b=>a.ask&&a.ask.includes(b)) && a.state == 1)
            if (isRTS&&this.PROJECT=='检测中心') {
@@ -2277,10 +2323,20 @@
      },
      saveMethod(sampleList){
        let isHaveAsk = this.totalArr.filter(a => (a.ask === null||a.ask=='')&&a.state==1)
        let isHaveAsk0 = this.totalArr.filter(a => (a.ask=='/'||a.ask=='-'||a.ask=='——'||((/\d/.test(a.ask))&&(a.ask.includes('<')||a.ask.includes('>')||a.ask.includes('=')||a.ask.includes('>')||a.ask.includes('<')||a.ask.includes('≥')||a.ask.includes('≤'))))&&a.state==1)
        let stateArr = this.totalArr.filter(a=>a.state==1)
        if (isHaveAsk.length > 0) {
          this.$message({
            type: 'error',
            message: '请填写要求值后再提交'
          })
          return false;
        }
        if (isHaveAsk0.length <stateArr.length) {
          this.$message({
            type: 'error',
            message: '要求值输入格式不对,可输入/、-、——代表不判定,<、=、>、≥、≤加上数字代表范围,请重新输入',
            duration: 8 * 1000
          })
          return false;
        }
@@ -2475,22 +2531,6 @@
        this.models = val.children
        this.getNodeParent(node)
        let flag = false
        if (node.level == 3) {
          if(node.data.children.length>0){
            node.data.children.forEach(a => {
              let key = Object.keys(a)
              if(!key.includes('level')) {
                flag = true
              }
            })
          }
        }
        this.selectTree = this.selectTree.replace(' - ', '')
        if(flag) {
          this.selectTree =  '-  - ' + this.selectTree
        }
        let data = this.selectTree.split(' - ')
        let data2 = ''
        for (let index = data.length - 1; index >= 0; index--) {
@@ -2521,27 +2561,24 @@
        return data.label.indexOf(value) !== -1;
      },
      activeStandardTree() {
        let trees = this.selectTree.split(" - ")
        if(this.selectTree == null || this.selectTree == '') return this.$message.error('未选择样品类型')
        let trees = this.selectTree.split(" - ").filter(m=>m)
        if (trees.length < 3) {
          this.$message.error('未选择对象')
          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]
        } else {
          this.addObj.sample = trees[3]
        }
        this.addObj.model = (trees[4] == undefined ? null : trees[4])
        this.addObj.factory = '中天科技检测中心'
        this.addObj.laboratory = '通信产品实验室'
        this.addObj.sampleType = trees[0]
        this.addObj.sample = trees[1]
        this.addObj.model = trees[2]
        this.selectStandardTree = false
        this.sampleList = []
        for (var i = 0; i < this.addObj.sampleNum; i++) {
          this.sample.joinName = null
          this.sample.joinModel = null
          this.sample.joinNum = 1
          this.sample.sample = this.addObj.sample
          // this.sample.sample = this.addObj.sample
          this.sample.model = this.addObj.model
          this.sample.unit = this.addObj.unit
          this.sample.standardMethodListId = []
@@ -2559,23 +2596,10 @@
      selectsStandardMethodByFLSSM() {
        this.methodLoad = true
        this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
          tree: this.selectTree
          tree: '中天科技检测中心'+' - '+'通信产品实验室'+' - '+this.selectTree
        }).then(res => {
          this.methodLoad = false
          try {
            if (res.data.standardMethodList.length == 0 && this.selectTree.split('-').length == 5) {
              let arr = this.selectTree.split('-')
              let arr0 = arr.slice(0, arr.length - 1)
              let selectTree = arr0.join('-').substring(0, arr0.join('-').length - 1)
              this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
                tree: selectTree
              }).then(ress => {
                this.methods = ress.data.standardMethodList
              })
            } else {
              this.methods = res.data.standardMethodList
            }
          } catch (e) {}
          this.methods = res.data.standardMethodList
        })
      },
      addStandardTree() {
@@ -2586,7 +2610,7 @@
          this.sample.joinName = null
          this.sample.joinModel = null
          this.sample.joinNum = 1
          this.sample.sample = this.addObj.sample
          // this.sample.sample = this.addObj.sample
          this.sample.model = this.addObj.model
          this.sample.unit = this.addObj.unit
          this.sample.standardMethodListId = []
@@ -2723,29 +2747,6 @@
          }
          return item
        })
        const select = this.selectTree.split(' - ')
        if (row.inspectionItem === '温度循环' && select[2] === '光缆' && row.state === 1&&this.isAskOnlyRead) {
          this.circulateShow = true;
          return
        } else if (row.inspectionItem === '温度循环' && select[2] === '光缆' && row.state === 0) {
          this.circulateShow = false;
        }
        if ((row.inspectionItem === '温升试验' || row.inspectionItem === '热循环') && row.state === 1) {
          // console.log('row---', row)
          this.temperatureTitle = `${row.inspectionItem}要求填写`
          this.isShowInput = row.inspectionItem === '热循环'
          this.temId = row.id
          this.temperatureShow = true;
          return
        } else if ((row.inspectionItem === '温升试验' || row.inspectionItem === '热循环') && row.state === 0) {
          this.temperatureShow = false;
        }
        // if (row.inspectionItem === '单根垂直燃烧' && select[2] === '光缆' && row.state === 1) {
        //   this.singleVerticalCombustionShow = true;
        //   return
        // } else if (row.inspectionItem === '单根垂直燃烧' && select[2] === '光缆' && row.state === 0) {
        //   this.singleVerticalCombustionShow = false;
        // }
        this.changeProductList0()
        if(this.sampleSelectionList.length>0){
@@ -2829,7 +2830,23 @@
      // 保存模板
      addTemplateDia() {
        if (this.templateName) {
          this.templateLoading = true;
          if(this.templates.find(m=>m.name==this.templateName)){
            this.$confirm('已存在同名模板,是否进行替换?', "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning"
            }).then(() => {
              this.saveTemplateDia()
            }).catch(() => {})
          }else{
            this.saveTemplateDia()
          }
        } else {
          this.$message.error('请填写模板名称')
        }
      },
      saveTemplateDia(){
        this.templateLoading = true;
          this.$axios.post(this.$api.insOrder.addInsOrderTemplate, {
            name: this.templateName,
            thing: JSON.stringify({
@@ -2849,9 +2866,6 @@
            this.selectInsOrderTemplate()
            this.templateName = ''
          })
        } else {
          this.$message.error('请填写模板名称')
        }
      },
      // 查询模板
      selectInsOrderTemplateById(e) {
@@ -2892,7 +2906,7 @@
        }).then(res => {
          this.orderType = res.data
          if (res.data.length > 0) {
            this.addObj.orderType = res.data[0].value
            this.addObj.orderType = 'C'
          }
        })
      },
@@ -2915,7 +2929,7 @@
        this.$axios.post(this.$api.standardTree.selectStandardProductList, {
          model: (this.addObj.model?this.addObj.model:row.model) + '-' + row.modelNum+';'+row.testRequirements,
          standardMethodListId: val.join(','),
          factory: selectTreeList.join(" - "),
          factory: '中天科技检测中心'+' - '+'通信产品实验室'+' - '+selectTreeList.join(" - "),
        }, {
          headers: {
            'Content-Type': 'application/json'
@@ -2953,13 +2967,22 @@
          }
        })
      },
      changeModel() {
      changeModel(type) {
        this.sampleList.forEach(a => {
          let obj = this.sampleIds.find(b => b == a.id)
          if (obj) {
            a.model = this.model
            this.$set(a,type, this.allInfo[type])
            if(type=='testRequirements'&&a.standardMethodListId&&a.standardMethodListId.length>0){
              this.methodChange(a.standardMethodListId, a)
            }
            // a[type] = this.allInfo[type]
          }
        })
      },
      changeModel0(row){
        if(row.standardMethodListId&&row.standardMethodListId.length>0){
          this.methodChange(row.standardMethodListId, row)
        }
      },
      changeStandardMethodListId() {
        this.sampleList.forEach(a => {
@@ -3065,30 +3088,6 @@
            this.$refs.productTable.clearSelection()
            return
          }
          const select = this.selectTree.split(' - ')
          if (p.inspectionItem === '温度循环' && select[2] === '光缆' && p.state === 1&&this.isAskOnlyRead) {
            this.circulateShow = true;
            return
          } else if (p.inspectionItem === '温度循环' && select[2] === '光缆' && p.state === 0) {
            this.circulateShow = false;
          }
          if ((p.inspectionItem === '温升试验' || p.inspectionItem === '热循环') && p.state === 1) {
            // console.log('p---', p)
            this.temperatureTitle = `${p.inspectionItem}要求填写`
            this.isShowInput = p.inspectionItem === '热循环'
            this.temId = p.id
            this.temperatureShow = true;
            return
          } else if ((p.inspectionItem === '温升试验' || p.inspectionItem === '热循环') && p.state === 0) {
            this.temperatureShow = false;
          }
          /* if (p.ask.includes('RTS')&&p.state === 1) {
            p.rts = ''
            this.bsm3Val = ''
            this.bsm3 = true
            this.bsm3Dia = true
            this.bsmRow3.push(p)
          } */
        })
        if (e.length > 0) {
          this.sampleList.map(item => {