gaoluyang
2025-03-31 ac126fc2454a75dd1b0b7dc904ababdc10abb286
src/views/business/materialOrder/copperOrder.vue
@@ -46,7 +46,7 @@
            <el-col :span="6">
              <el-form-item class="addObj-form-item" label="检验类型:">
                <el-select v-model="addObj.orderType" clearable disabled size="small" style="width: 100%">
                  <el-option v-for="(a, ai) in checkType" :key="ai" :label="a.label" :value="a.value"></el-option>
                  <el-option v-for="(a, ai) in dict.type.check_type" :key="ai" :label="a.label" :value="a.value"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
@@ -99,17 +99,17 @@
            </el-col>
            <el-col :span="6">
              <el-form-item class="addObj-form-item" label="备注:">
                <el-input v-model="addObj.remark" :autosize="{ minRows: 2, maxRows: 2}" :placeholder="active>1 ? '' : '请输入'" :readonly="active>1" clearable
                <el-input v-model="addObj.remark" :autosize="{ minRows: 2, maxRows: 2}" :placeholder="active>1 ? '' : '请输入'" :disabled="active>1" clearable
                          size="small" type="textarea"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div style="display: flex;justify-content: space-between;">
      <div style="display: flex;justify-content: space-between;background-color: #F5F7FB;margin-bottom: 6px">
        <div v-if="active==1">
          <el-form :inline="true" :model="addObj1" label-width="90px">
            <el-form-item label="样品型号:" style="margin-bottom: 6px">
            <el-form-item label="样品型号:" style="margin-bottom: 6px;margin-top: 6px">
              <el-select v-model="model" :placeholder="active>1 ? '' : '请输入'"
                         allow-create clearable default-first-option filterable
                         size="small"
@@ -118,7 +118,7 @@
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="检验标准:">
            <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">
@@ -128,12 +128,13 @@
            </el-form-item>
          </el-form>
        </div>
        <div style="margin-top: 3px">
          <el-button v-show="active==1" :disabled="sampleList.length === 2" size="small" type="primary" @click="handleSplitCountNum">拆分</el-button>
        <div style="margin-bottom: 6px;margin-top: 6px">
          <el-button v-show="active==1" :disabled="sampleList.length === 3" size="small" type="primary" @click="handleSplitCountNum">拆分</el-button>
        </div>
      </div>
      <div style="height: auto;">
        <el-table ref="sampleTable" :data="sampleList" class="el-table sampleTable" highlight-current-row
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
                  max-height="400px" tooltip-effect="dark" @selection-change="selectSample" @row-click="rowClick">
          <el-table-column v-if="active==1" :selectable="selectable" type="selection" width="60"></el-table-column>
          <el-table-column align="center" label="序号" type="index" width="65"></el-table-column>
@@ -192,13 +193,14 @@
                               size="small" style="width: 80%;"></el-input-number>
            </template>
          </el-table-column>
          <el-table-column align="center" label="待检项数量" prop="proNum" width="105"></el-table-column>
          <el-table-column align="center" label="待检项数量" prop="quantity" width="105"></el-table-column>
        </el-table>
        <el-table ref="productTable" v-loading="getProductLoad" :data="productList" :row-class-name="tableRowClassName" class="el-table"
                  :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
                  max-height="400px" style="margin-bottom: 10px;" tooltip-effect="dark"
                  @select="selectOne" @selection-change="selectProduct" @select-all="handleAll">
          <el-table-column v-if="active==1" :selectable="selectable" type="selection" width="65"></el-table-column>
          <el-table-column v-if="PROJECT === '装备电缆'" label="检验项分类" min-width="140" prop="inspectionItemClass" show-overflow-tooltip></el-table-column>
          <el-table-column label="检验项分类" min-width="140" prop="inspectionItemClass" show-overflow-tooltip></el-table-column>
          <el-table-column label="检验项" min-width="140" prop="inspectionItem" show-overflow-tooltip>
            <template slot="header" slot-scope="scope">
              <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px">
@@ -383,14 +385,12 @@
      </span>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :show-close="false"
      :visible.sync="noNeedCheckDia"
      title="免检提示"
      width="32%">
      <span>确认免检当前检验单?</span>
      <span slot="footer" class="dialog-footer">
        <el-button :loading="noNeedCheckLoad" @click="noNeedCheckDia = false">取 消</el-button>
        <el-button :loading="noNeedCheckLoad" type="primary" @click="handleNoNeedCheck">确 定</el-button>
      </span>
    </el-dialog>
@@ -398,8 +398,18 @@
</template>
<script>
// import ValueTable from '../../tool/value-table.vue'
import Vue from 'vue'
import {
  addRawCopperOrder,
  getInsOrder,
  getUserNow,
  addRawCopperOrderExemptionOrder,
  selectStandardTreeList2,
  selectsStandardMethodByFLSSM,
  selectInsOrderTemplate,
  selectStandardProductList,
  selectStandardMethodEnum
} from "@/api/business/rawMaterialOrder";
var validateSixDecimalPositives = (rule, value, callback) => {
  if (value == 0 || value == null) {
@@ -412,16 +422,13 @@
}
export default {
  name: 'CopperOrder',
  components: {},
  props: {
    currentId: {
      type: Number,
      default: () => 0
    }
  },
  dicts: ['check_type', 'urgency_level'],
  data() {
    return {
      active: '',
      currentId: '',
      sampleSelectionList: [],//样品表格选中数据
      editTable:[],
      noNeedCheckLoad: false, // 免检按钮loading
@@ -432,15 +439,16 @@
        custom: null,
        company: null,
        userId: null,
        companyId: '',
        type: '0', // 紧急程度
        code: null,
        remark: null, // 备注
        mating: 0,
        sample: null, // 样品名称
        appointed: '', // 约定时间
        buyUnitMeas: '', // 单位
        updateBatchNo: '', // 批次号
        partDetail: '', // 规格型号
        buyUnitMeas: null, // 单位
        updateBatchNo: null, // 批次号
        partDetail: null, // 规格型号
        declareDate: '', // 到货时间
        factory: null,
        laboratory: null,
@@ -453,8 +461,8 @@
        processing: 1,
        isLeave: 0,
        orderType: '进厂检验', // 检验类型
        supplierName: '', // 材料厂家
        qtyArrived: '', // 到货数量
        supplierName: null, // 材料厂家
        qtyArrived: null, // 到货数量
      },
      sample: {
        sampleCode: null,
@@ -468,7 +476,6 @@
        isLeave: 0,
        unit: null
      },
      type: [],
      selectStandardTree: false,
      search: null,
      list: [],
@@ -506,14 +513,13 @@
      bsm2: false,
      bsm2Val: null,
      bsm2Dia: false,
      bsm2Val2: [],
      bsm2Val3: [],
      bsmRow3: null,
      bsm3Val: null,
      bsm3Dia: false,
      // total: 0,
      RTS: '',
      totalArr: [],
      addObj1: {},
      model: null,
      standardMethodListId: null,
      symbolList:['RTS'],
@@ -524,7 +530,6 @@
      isShowInput: false,
      temId: '',
      selectiveEcho: [], // 检验下单的时候勾选检验项目,如果使用筛选提交显示检验项目为空 回显列表
      checkType: [], // 检验类型选项数据
      addObjRules: { // 表单校验规则
        sample: [
          { required: true, message: '请选择样品', trigger: 'change' }
@@ -551,7 +556,7 @@
          { required: true, message: '请填写规格型号', trigger: 'blur' }
        ],
        declareDate: [
          { required: true, message: '请填写到货时间', trigger: 'blur' }
          { required: true, message: '请填写到货时间', trigger: 'change' }
        ]
      },
      noNeedCheckDia: false,
@@ -579,23 +584,6 @@
        }
      }
    },
    productListSelected: {
      deep: true,
      handler(val) {
        if(val.length>0){
          for(let i =0 ; i< val.length; i++){
            if(val[i].inspectionItem.includes('松套管')){
              this.inspectionItemST = 1
              break;
            }else{
              this.inspectionItemST = 0
            }
          }
        }else{
          this.inspectionItemST = 0
        }
      }
    },
    sampleList: {
      deep: true,
      handler(val) {
@@ -613,14 +601,21 @@
  },
  mounted() {
    this.active = this.$route.query.active
    this.selectEnumByCategoryForType()
    this.getUserNow()
    this.selectStandardTreeList()
    this.selectStandardMethods()
    this.selectCheckType() // 查询检验类型
    this.getInfo() // 获取数据
    this.currentId = this.$route.query.currentId
    this.getInfoRow();
  },
  activated() {
    this.active = this.$route.query.active
    this.currentId = this.$route.query.currentId
    this.getInfoRow();
  },
  methods: {
    getInfoRow() {
      this.getUserNowInfo()
      this.selectStandardTreeList()
      this.selectStandardMethods()
      this.getInfo() // 获取数据
    },
    // 拆分
    handleSplitCountNum () {
      this.sample.joinName = null
@@ -642,7 +637,6 @@
        item.quantity = 1
      })
      this.count++
      this.computationalPairing(this.sampleList.length)
    },
    noNeedCheck () {
      this.$refs['addObj'].validate((valid) => {
@@ -679,7 +673,6 @@
      if (projectNum!=0){
        this.$message.error('免检不可选择检验项')
      } else {
        const pairing = []
        let trees = this.selectTree.split(" - ")
        if (trees.length < 3) {
          this.$message.error('未选择对象')
@@ -695,34 +688,35 @@
        }
        this.addObj.model = (trees[4] == undefined ? null : trees[4])
        this.noNeedCheckLoad = true
        this.$axios.post(this.$api.rawMaterialOrder.addRawCopperOrderExemptionOrder, {
          str: JSON.stringify({
            insOrder: this.addObj,
            list: JSON.stringify(sampleList.map(a => {
              if (a.modelNum) {
                // 根据x号判断型号参数与样品型号的拼接位置
                // 例如×4,就为500ML×4;4×,就为4×500ML
                const index = a.modelNum.indexOf('×')
                if (index === 0) {
                  a.model = a.model + a.modelNum
                } else if (index === -1) {
                  a.model = a.model + '-' + a.modelNum
                } else {
                  a.model = a.modelNum + a.model
                }
        addRawCopperOrderExemptionOrder({
          copperInsOrder: this.addObj,
          sampleList: sampleList.map(a => {
            if (a.insProduct.length > 0) {
              a.insProduct.forEach(c => {
                delete c.id
              })
            }
            if (a.modelNum) {
              // 根据x号判断型号参数与样品型号的拼接位置
              // 例如×4,就为500ML×4;4×,就为4×500ML
              const index = a.modelNum.indexOf('×')
              if (index === 0) {
                a.model = a.model + a.modelNum
              } else if (index === -1) {
                a.model = a.model + '-' + a.modelNum
              } else {
                a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ('-' + a.modelNum))
                a.model = a.modelNum + a.model
              }
              a.insProduct = a.insProduct.filter(b=>b.state === 1)
              return a
            })),
            pairing: JSON.stringify(pairing)
            } else {
              a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ('-' + a.modelNum))
            }
            a.insProduct = a.insProduct.filter(b=>b.state === 1)
            return a
          })
        }).then(res => {
          this.noNeedCheckLoad = false
          if (res.code == 201) return
          this.$message.success('已提交')
          this.$parent.playOrder(0)
          this.closeOpenPage()
        }).catch(e=>{
          this.noNeedCheckLoad = false
        })
@@ -733,16 +727,14 @@
      if (this.active != 1) {
        // 查看流程
        // 请求接口,回显数据
        this.$axios.post(this.$api.insOrder.getInsOrder, {
          orderId: this.currentId
        }).then(res => {
        getInsOrder({orderId: this.currentId}).then(res => {
          this.addObj = {
            ...res.data.insOrder
          }
          this.addObj.qtyArrived = res.data.insOrderTemplate.qtyArrived
          this.addObj.buyUnitMeas = res.data.insOrderTemplate.buyUnitMeas
          this.addObj.updateBatchNo = res.data.insOrderTemplate.updateBatchNo
          this.addObj.supplierName = res.data.insOrderTemplate.supplierName
          this.$set(this.addObj, 'qtyArrived', res.data.insOrderTemplate.qtyArrived)
          this.$set(this.addObj, 'buyUnitMeas', res.data.insOrderTemplate.buyUnitMeas)
          this.$set(this.addObj, 'updateBatchNo', res.data.insOrderTemplate.updateBatchNo)
          this.$set(this.addObj, 'supplierName', res.data.insOrderTemplate.supplierName)
          this.addObj.type = String(this.addObj.type)
          this.sampleList = this.HaveJson(res.data.sampleProduct);
          this.getProNum()
@@ -757,13 +749,6 @@
          })
        })
      }
    },
    selectCheckType() {
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "检验类型"
      }).then(res => {
        this.checkType = res.data
      })
    },
    //特殊值填写处理
    inputValueHandler(row,index){
@@ -825,13 +810,6 @@
          })
        })
      }
    },
    selectEnumByCategoryForType() {
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "紧急程度"
      }).then(res => {
        this.type = res.data
      })
    },
    containsValue(str) {
      if(str){
@@ -911,10 +889,6 @@
            this.$message.error('请选择检验标准')
            return
          }
          // if (!this.sampleList.every(m => m.quantity)) {
          //   this.$message.error('请选择待检项数量')
          //   return
          // }
          const sampleList = this.HaveJson(this.sampleList)
          sampleList.forEach(item => {
            item.quantity = 1
@@ -1156,43 +1130,40 @@
    },
    saveMethod(sampleList){
      this.saveLoad = true
      this.$axios.post(this.$api.insOrder.addRawCopperOrder, {
        str: JSON.stringify({
          insOrder: this.addObj,
          list: JSON.stringify(sampleList.map(a => {
            if (this.PROJECT === '装备电缆') {
              if (a.modelNum) {
                const index = a.modelNum.indexOf('×')
                if (index === 0) {
                  a.model = a.model + a.modelNum
                } else if (index === -1) {
                  a.model = a.model + '-' + a.modelNum
                } else {
                  a.model = a.modelNum + a.model
                }
              } else {
                a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ('-' + a.modelNum))
              }
      addRawCopperOrder({
        copperInsOrder: this.addObj,
        sampleList: sampleList.map(a => {
          if (a.insProduct.length > 0) {
            a.insProduct.forEach(c => {
              delete c.id
            })
          }
          if (a.modelNum) {
            const index = a.modelNum.indexOf('×')
            if (index === 0) {
              a.model = a.model + a.modelNum
            } else if (index === -1) {
              a.model = a.model + '-' + a.modelNum
            } else {
              a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ('-' + a.modelNum))
              a.model = a.modelNum + a.model
            }
            a.insProduct = a.insProduct.filter(b=>b.state === 1)
            return a
          })),
          pairing: JSON.stringify(this.bsm2Val2)
          } else {
            a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ('-' + a.modelNum))
          }
          a.insProduct = a.insProduct.filter(b=>b.state === 1)
          return a
        })
      }).then(res => {
        this.saveLoad = false
        if (res.code == 201) return
        this.$message.success('已提交')
        this.bsm3Dia = false;
        this.$parent.playOrder(0)
        this.closeOpenPage()
      }).catch(e=>{
        this.saveLoad = false
      })
    },
    getUserNow() {
      this.$axios.get(this.$api.user.getUserNow).then(res => {
    getUserNowInfo() {
      getUserNow().then(res => {
        let selects = res.data
        if (selects == null) return
        this.addObj.userId = selects.id
@@ -1201,15 +1172,12 @@
        this.addObj.code = selects.code
        this.addObj.phone = selects.phone
        this.addObj.companyId = selects.departId
        if(this.active==1){
          this.selectInsOrderTemplate()
        }
        // if(this.active==1){
        //   this.selectInsOrderTemplateInfo()
        // }
      })
    },
    getProNum() {
      this.sampleSelectionList.forEach((m, i) => {
        Vue.set(this.sampleSelectionList[i], 'proNum', m.insProduct.filter(a => a.state == 1).length)
      })
      this.$refs.sampleTable.doLayout()
    },
    searchFilter() {
@@ -1260,7 +1228,7 @@
    },
    selectStandardTreeList() {
      this.selectStandardTreeLoading = true
      this.$axios.get(this.$api.standardTree.selectStandardTreeList2).then(res => {
      selectStandardTreeList2().then(res => {
        this.list = res.data
        this.list.forEach(a => {
          this.expandedKeys.push(a.label)
@@ -1310,18 +1278,14 @@
    },
    selectsStandardMethodByFLSSM() {
      this.methodLoad = true
      this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
        tree: this.selectTree
      }).then(res => {
      selectsStandardMethodByFLSSM({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 => {
            selectsStandardMethodByFLSSM({tree: selectTree}).then(ress => {
              this.methods = ress.data.standardMethodList
            })
          } else {
@@ -1350,8 +1314,6 @@
        this.sampleList.push(this.HaveJson(this.sample))
        // this.count++
      }
      this.computationalPairing(this.sampleList.length)
      this.bsm2Val2 = this.HaveJson(this.bsm2Val3)
    },
    selectSample(val) {
      this.sampleIds = []
@@ -1481,25 +1443,17 @@
      backtrack([], nums);
      return result;
    },
    computationalPairing(n) {
      const nums = [];
      for (let i = 1; i <= n; i++) {
        nums.push(i);
      }
      this.bsm2Val3 = this.HaveJson(this.permute(nums))
    },
    tableRowClassName({row, rowIndex}) {
      if (row.state === 0) {
        return '';
      }
      return 'warning-row';
    },
    selectInsOrderTemplate() {
      this.$axios.get(this.$api.insOrder.selectInsOrderTemplate+'?company='+this.addObj.company).then(res => {
        if (res.code == 201) return
        this.templates = res.data
      })
    },
    // selectInsOrderTemplateInfo() {
    //   selectInsOrderTemplate({company: this.addObj.company}).then(res => {
    //     this.templates = res.data
    //   })
    // },
    methodChange(val, row) {
      if (val === null || val === '') return
      if (this.sampleList.length > 1) {
@@ -1519,15 +1473,11 @@
      this.getProductLoad = true
      let selectTreeList = this.selectTree.split(" - ")
      this.addObj.model&&(selectTreeList[selectTreeList.length - 1] = this.addObj.model)
      this.$axios.post(this.$api.standardTree.selectStandardProductList, {
      selectStandardProductList({
        model: this.addObj.model?this.addObj.model:row.model,
        modelNum: row.modelNum,
        standardMethodListId: val,
        factory: selectTreeList.join(" - "),
      }, {
        headers: {
          'Content-Type': 'application/json'
        }
      }).then(res => {
        res.data.forEach(a => {
          a.state = 0
@@ -1543,21 +1493,21 @@
          })
        }, 200)
      })
      this.searchTemList()
      // this.searchTemList()
    },
    searchTemList () {
      this.temperatureList = []
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "电力温度循环检验"
      }).then(res => {
        if (res.data.length > 0) {
          this.temperatureEngList = res.data
          res.data.forEach(item => {
            this.temperatureList.push(item.label)
          })
        }
      })
    },
    // searchTemList () {
    //   this.temperatureList = []
    //   this.$axios.post(this.$api.enums.selectEnumByCategory, {
    //     category: "电力温度循环检验"
    //   }).then(res => {
    //     if (res.data.length > 0) {
    //       this.temperatureEngList = res.data
    //       res.data.forEach(item => {
    //         this.temperatureList.push(item.label)
    //       })
    //     }
    //   })
    // },
    changeModel() {
      this.sampleList.forEach(a => {
        let obj = this.sampleIds.find(b => b == a.id)
@@ -1603,7 +1553,7 @@
      })
    },
    selectStandardMethods() {
      this.$axios.get(this.$api.standardTree.selectStandardMethodEnum).then(res => {
      selectStandardMethodEnum().then(res => {
        this.methods = res.data
      })
    },
@@ -1820,9 +1770,16 @@
    },
    goBack () {
      const obj = { path: "/business/materialOrder" };
      this.$tab.closeOpenPage(obj);
    }
      if (this.active == 1) {
        this.$router.go(-1)
      } else {
        this.closeOpenPage()
      }
    },
    closeOpenPage() {
      this.$router.go(-1)
      this.$tab.closeOpenPage()
    },
  }
}
</script>
@@ -1832,4 +1789,11 @@
  justify-content: space-between;
  margin-bottom: 10px;
}
>>>.warning-row {
  color: #1890FF;
}
.node_i {
  color: orange;
  font-size: 18px;
}
</style>