gaoluyang
2025-03-07 573265f7d79341298ba4287be38f00ddbc66e7ec
src/views/business/materialOrder/customsInspection.vue
@@ -97,8 +97,8 @@
          </el-col>
          <el-col :span="6">
            <el-form-item class="addObj-form-item" label="检验类别:" prop="orderType">
              <el-select v-model="addObj.orderType" :disabled="active>1 || orderType===1" clearable size="small" style="width: 100%">
                <el-option v-for="(a, ai) in dict.type.check_type" :key="ai" :label="a.label" :value="a.value"></el-option>
              <el-select v-model="addObj.orderType" :disabled="active>1 || orderType==1" clearable size="small" style="width: 100%">
                <el-option v-for="a in dict.type.check_type" :key="a.value" :label="a.label" :value="a.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
@@ -114,7 +114,7 @@
          <el-col :span="6">
            <el-form-item class="addObj-form-item" label="紧急程度:" placeholder="请选择" prop="type">
              <el-select v-model="addObj.type" :disabled="active>1" class="addObj-info" clearable size="small" style="width: 100%">
                <el-option v-for="(a, ai) in dict.type.urgency_level" :key="ai" :label="a.label" :value="a.value"></el-option>
                <el-option v-for="a in dict.type.urgency_level" :key="a.value" :label="a.label" :value="a.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
@@ -235,7 +235,7 @@
        </el-table-column>
        <el-table-column align="center" label="待检项数量" prop="quantity" width="105">
          <template slot-scope="scope">
            <el-select v-model="scope.row.quantity" :disabled="active>1|| scope.$index !== 0 || sampleList.length > 1" clearable
            <el-select v-model="scope.row.quantity" disabled clearable
                       size="small">
              <el-option v-for="item in quantityList" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
@@ -388,7 +388,7 @@
      width="32%">
      <span>{{ dialogMessage }}</span>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="goBack()">确 定</el-button>
        <el-button type="primary" @click="dialogVisible= false,closeOpenPage()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
@@ -432,11 +432,17 @@
<script>
import {
  addExemptionOrder,
  addInsOrder,
  addRawMaterOrderTemplate, delRawMaterOrderTemplate,
  addRawMaterOrderTemplate,
  delRawMaterOrderTemplate,
  getInsOrder,
  getUserNow,
  notificationRawOrder, selectRawMaterOrderTemplateById, selectStandardMethodEnum, selectStandardProductList,
  notificationRawOrder, selectRawMaterOrderTemplate,
  selectRawMaterOrderTemplateById,
  selectsStandardMethodByFLSSM,
  selectStandardMethodEnum,
  selectStandardProductList,
  selectStandardTreeListByPartNo
} from "@/api/business/rawMaterialOrder";
@@ -445,20 +451,14 @@
  dicts: ['check_type', 'urgency_level'],
  components: {},
  props: {
    currentId: {
      type: Number,
      default: () => 0
    },
    isReport: {
      type: Number,
      default: () => null
    }
  },
  data() {
    return {
      customsInspection: {},
      orderType: '',
      active: 0,
      currentId: 0,
      isReport: '',
      editTable:[], // 区间特殊值填写
      template: null,
      saveLoad: false, // 保存按钮loading
@@ -633,14 +633,26 @@
      this.standardMethodListId = null
    }
  },
  mounted() {
  created() {
    this.active = this.$route.query.active
    this.orderType = this.$route.query.orderType
    this.currentId = this.$route.query.currentId
    this.isReport = this.$route.query.isReport
    this.customsInspection = this.$route.query.customsInspection
    // this.getUserNowList() // 获取当前用户信息
    this.getInfo();
  },
  activated() {
    this.active = this.$route.query.active
    this.orderType = this.$route.query.orderType
    this.currentId = this.$route.query.currentId
    this.isReport = this.$route.query.isReport
    this.customsInspection = this.$route.query.customsInspection
    this.getInfo();
  },
  getInfo() {
    this.getUserNowList() // 获取当前用户信息
    this.selectStandardMethods() // 获取检验标准下拉框数据
    this.getInfo() // 获取数据
  },
  methods: {
    save1 () {
@@ -682,7 +694,7 @@
    },
    // 获取数据
    getInfo () {
      if (this.active === 2) {
      if (this.active == 2) {
        let orderId = ''
        if (!this.customsInspection.enterOrderId && this.customsInspection.quarterOrderId) {
          this.isShowTab = false
@@ -695,7 +707,7 @@
          orderId = this.dataIndex === 0 ? this.customsInspection.enterOrderId : this.customsInspection.quarterOrderId
        } else if (!this.customsInspection.enterOrderId && !this.customsInspection.quarterOrderId) {
          this.isShowTab = false
          orderId = this.isReport === 1 ? this.customsInspection.insOrderId : this.customsInspection.id
          orderId = this.isReport == 1 ? this.customsInspection.insOrderId : this.customsInspection.id
        }
        // 查看
        // 请求接口,回显数据
@@ -742,27 +754,25 @@
        })
        // 报检流程
        selectStandardTreeListByPartNo({partNo:this.customsInspection.partNo}).then(res => {
          if (res.code === 200) {
            this.addObj.sample = res.data.label
            this.codeLevel = res.data.code
            this.addObj.qtyArrived = this.customsInspection.qtyArrived
            this.addObj.partNo = this.customsInspection.partNo
            this.addObj.partDetail = this.customsInspection.partDesc
            this.addObj.receiverDate = this.customsInspection.receiverDate
            this.addObj.orderNo = this.customsInspection.orderNo
            this.addObj.declareUser = this.customsInspection.declareUser
            this.addObj.testQuantity = this.customsInspection.testQuantity
            this.addObj.buyUnitMeas = this.customsInspection.buyUnitMeas
            this.addObj.updateBatchNo = this.customsInspection.updateBatchNo
            if (this.orderType === 1) {
              this.addObj.orderType = 'Quarterly inspection'
            }
            const str = res.data.treeName.split('-')
            this.selectTreeTem = str.join(' - ')
            this.selectTree = str.join(' - ')
            this.addListInfo(this.codeLevel, res.data) // 原材料样品是固定的,就默认赋值一条数据,可拆分
            this.selectInsOrderTemplate() // 原材料模板列表查询
          this.addObj.sample = res.data.label
          this.codeLevel = res.data.code
          this.$set(this.addObj, 'qtyArrived', this.customsInspection.qtyArrived)
          this.$set(this.addObj, 'partNo', this.customsInspection.partNo)
          this.$set(this.addObj, 'receiverDate', this.customsInspection.receiverDate)
          this.$set(this.addObj, 'orderNo', this.customsInspection.orderNo)
          this.$set(this.addObj, 'declareUser', this.customsInspection.declareUser)
          this.$set(this.addObj, 'testQuantity', this.customsInspection.testQuantity)
          this.$set(this.addObj, 'buyUnitMeas', this.customsInspection.buyUnitMeas)
          this.$set(this.addObj, 'updateBatchNo', this.customsInspection.updateBatchNo)
          this.$set(this.addObj, 'partDetail', this.customsInspection.partDesc)
          if (this.orderType == 1) {
            this.$set(this.addObj, 'orderType', 'Quarterly inspection')
          }
          const str = res.data.treeName.split('-')
          this.selectTreeTem = str.join(' - ')
          this.selectTree = str.join(' - ')
          this.addListInfo(this.codeLevel, res.data) // 原材料样品是固定的,就默认赋值一条数据,可拆分
          this.selectInsOrderTemplate() // 原材料模板列表查询
        }).catch(err => {
          this.dialogVisible = true
          this.dialogMessage = err.message
@@ -823,7 +833,7 @@
    },
    // 查询模板列表
    selectInsOrderTemplate() {
      selectStandardTreeListByPartNo({partNo:this.addObj.partNo}).then(res => {
      selectRawMaterOrderTemplate({partNo:this.addObj.partNo}).then(res => {
        this.templates = res.data
      })
    },
@@ -892,10 +902,6 @@
        if (valid) {
          if (!this.sampleList.every(m => m.standardMethodListId)) {
            this.$message.error('请选择检验标准')
            return
          }
          if (!this.sampleList.every(m => m.quantity)) {
            this.$message.error('请选择待检项数量')
            return
          }
          const sampleList = this.HaveJson(this.sampleList)
@@ -977,7 +983,6 @@
        item.insProduct = this.productList
      })
      this.getTotal(sampleList)
      const pairing = []
      let trees = this.selectTree.split(" - ")
      if (trees.length < 3) {
        this.$message.error('未选择对象')
@@ -995,40 +1000,35 @@
      this.addObj.ifsInventoryId = this.customsInspection.id
      this.noNeedCheckLoad = true
      addExemptionOrder({
        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
              }
        insOrder: this.addObj,
        sampleList: 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.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.noNeedCheckDia = false
        this.$message.success('已提交')
        this.goBack()
        this.closeOpenPage()
      }).catch(e=>{
        this.noNeedCheckLoad = false
      })
    },
    saveMethod(sampleList){
      const pairing = []
      let trees = this.selectTree.split(" - ")
      if (trees.length < 3) {
        this.$message.error('未选择对象')
@@ -1046,34 +1046,35 @@
      this.addObj.ifsInventoryId = this.customsInspection.id
      this.saveLoad = true
      addInsOrder({
        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
              }
        insOrder: 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.saveLoad = false
        if (res.code == 201) return
        this.$message.success('已提交')
        this.bsm3Dia = false;
        this.goBack()
        this.closeOpenPage()
      }).catch(e=>{
        this.saveLoad = false
      })
@@ -1592,19 +1593,17 @@
        ifsInventoryId: this.customsInspection.id
      }).then(res => {
        this.getProductLoad = false
        if (res.code === 200) {
          res.data.forEach(a => {
            a.state = 0
        res.data.forEach(a => {
          a.state = 0
        })
        this.productList = this.HaveJson(res.data)
        this.productList0 = JSON.parse(JSON.stringify(this.productList))
        this.$refs.sampleTable.setCurrentRow(row)
        setTimeout(() => {
          this.productList.forEach(a => {
            if (a.state == 1) this.toggleSelection(a)
          })
          this.productList = this.HaveJson(res.data)
          this.productList0 = JSON.parse(JSON.stringify(this.productList))
          this.$refs.sampleTable.setCurrentRow(row)
          setTimeout(() => {
            this.productList.forEach(a => {
              if (a.state == 1) this.toggleSelection(a)
            })
          }, 200)
        }
        }, 200)
      }).catch(err => {
        console.log('err-',err)
      })
@@ -1838,9 +1837,16 @@
      return row[property] === value;
    },
    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>