spring
2025-02-19 248d9f8b01d9a395af66f2336cb0b1eeeff2bd0a
src/views/business/materialOrder/customsInspection.vue
@@ -1,35 +1,35 @@
<template>
  <div class="ins_order_add">
  <div class="app-container">
    <div>
      <el-row class="title">
        <el-col :span="active > 1 && isShowTab ? 5 : 6" style="padding-left: 20px;text-align: left;">采购订单信息</el-col>
        <el-col v-if="active > 1 && isShowTab" :span="4" style="text-align: left;margin-top: 12px">
          <ul class="tab">
      <div class="header">
        <div>
          <span>采购订单信息</span>
          <ul class="tab" v-if="active > 1 && isShowTab">
            <li v-for="(m,i) in dataTitle" :key="i" :class="{active:i===dataIndex}" @click="handleDataTab(m,i)">{{m.label}}</li>
          </ul>
        </el-col>
        <el-col :span="active > 1  && isShowTab ? 15 : 18" style="text-align: right;">
          <el-select v-show="active==1" v-model="template" placeholder="下单模板" size="medium" style="margin-right: 10px;"
                     @change="selectInsOrderTemplateById">
        </div>
        <div>
          <el-select v-show="active==1" v-model="template" placeholder="下单模板" size="small" style="margin-right: 10px;"
                     @change="selectInsOrderTemplateByIdList">
            <el-option v-for="(a, ai) in templates" :key="ai" :label="a.name" :value="a.id">
              <span style="float: left">{{ a.name }}</span>
              <i class="el-icon-delete" style="float: right; color: #66b1ff; font-size: 16px"
                 @click.stop="handleDelete(a)"></i>
            </el-option>
          </el-select>
          <el-button v-show="active==1" size="medium" @click="templateDia=true">
          <el-button v-show="active==1" size="small" @click="templateDia=true">
            <span style="color: #3A7BFA;">保存模板</span>
          </el-button>
          <el-button v-show="active==1 && addObj.orderType === '进厂检验'" :loading="noNeedCheckLoad" size="medium" type="primary" @click="noNeedCheck">免检</el-button>
          <el-button v-show="active==1" :loading="saveLoad" size="medium" type="primary" @click="save">提交</el-button>
          <el-button size="medium" @click="goBack">
          <el-button v-show="active==1 && addObj.orderType === '进厂检验'" :loading="noNeedCheckLoad" size="small" type="primary" @click="noNeedCheck">免检</el-button>
          <el-button v-show="active==1" :loading="saveLoad" size="small" type="primary" @click="save">提交</el-button>
          <el-button size="small" @click="goBack">
            <span style="color: #3A7BFA;">返回</span>
          </el-button>
        </el-col>
      </el-row>
        </div>
      </div>
    </div>
    <div class="search">
      <el-form ref="addObj" :inline="true" :model="addObj" :rules="addObjRules" label-width="120px">
      <el-form ref="addObj" :inline="true" :model="addObj" :rules="addObjRules" label-width="90px">
        <el-row>
          <el-col :span="6">
            <el-form-item class="addObj-form-item" label="采购订单号:">
@@ -85,7 +85,7 @@
        <el-row>
          <el-col :span="6">
            <el-form-item class="addObj-form-item" label="单位:" prop="buyUnitMeas">
              <el-input v-model="addObj.buyUnitMeas" class="addObj-info" disabled size="small"></el-input>
              <el-input v-model="addObj.buyUnitMeas" class="addObj-info" clearable disabled size="small"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
@@ -98,14 +98,14 @@
          <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 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>
          <el-col :span="6">
            <el-form-item class="addObj-form-item" label="规格型号:" placeholder="请填写" prop="partDetail">
              <el-tooltip :content="addObj.partDetail" :disabled="!addObj.partDetail">
                <el-input v-model="addObj.partDetail" :disabled="active > 1" class="addObj-info" size="small"></el-input>
                <el-input v-model="addObj.partDetail" :disabled="active > 1" clearable class="addObj-info" size="small"></el-input>
              </el-tooltip>
            </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 types" :key="ai" :label="a.label" :value="a.value"></el-option>
                <el-option v-for="(a, ai) in dict.type.urgency_level" :key="ai" :label="a.label" :value="a.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
@@ -142,11 +142,10 @@
      </el-form>
    </div>
    <div>
      <div style="display: flex;flex-direction: row;justify-content: space-between;padding: 5px 0;">
        <div v-if="active==1" style="display: flex;background: transparent;">
          <div class="search_thing">
            <div class="search_label">样品型号:</div>
            <div class="search_input">
      <div style="display: flex;justify-content: space-between;">
        <div v-if="active==1">
          <el-form :inline="true" :model="addObj1" label-width="90px">
            <el-form-item label="样品型号:" style="margin-bottom: 6px">
              <el-select v-model="model" :placeholder="active>1 ? '' : '请输入'"
                         allow-create clearable default-first-option filterable
                         size="small"
@@ -154,29 +153,26 @@
                <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-form-item>
            <el-form-item label="检验标准:">
              <el-select v-model="standardMethodListId" :loading="methodLoad"
                         :placeholder="active>1 ? '' : '请输入'" clearable size="small"
                         @change="changeStandardMethodListId" @focus="methodFocus">
                <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-form>
            </div>
          </div>
        </div>
        <div class="search_thing">
          <el-button v-show="active==1" :disabled="sampleList.length === 2" size="medium" type="primary" @click="handleSplitCountNum">拆分</el-button>
        <div style="margin-top: 3px">
          <el-button v-show="active==1" :disabled="sampleList.length === 2" size="small" type="primary" @click="handleSplitCountNum">拆分</el-button>
        </div>
      </div>
      <el-table ref="sampleTable" :data="sampleList"
                border class="el-table sampleTable"
                class="el-table sampleTable"
                highlight-current-row
                max-height="400px" style="margin-top: 10px;"
                max-height="400px"
                tooltip-effect="dark"
                @selection-change="selectSample" @row-click="rowClick">
        <el-table-column v-if="active==1" :selectable="selectable" type="selection" width="65"></el-table-column>
@@ -247,7 +243,7 @@
        </el-table-column>
      </el-table>
      <el-table ref="productTable" v-loading="getProductLoad" :data="productList"
                :row-class-name="tableRowClassName" border
                :row-class-name="tableRowClassName"
                class="el-table"
                max-height="400px"
                style="margin-bottom: 10px;"
@@ -392,7 +388,7 @@
      width="32%">
      <span>{{ dialogMessage }}</span>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="$parent.playOrder(0)">确 定</el-button>
        <el-button type="primary" @click="goBack()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
@@ -436,26 +432,23 @@
<script>
import ValueTable from "@/components/Table/value-table.vue";
import {
  addInsOrder,
  addRawMaterOrderTemplate, delRawMaterOrderTemplate,
  getInsOrder,
  getUserNow,
  notificationRawOrder, selectRawMaterOrderTemplateById, selectStandardMethodEnum, selectStandardProductList,
  selectStandardTreeListByPartNo
} from "@/api/business/rawMaterialOrder";
export default {
  name: "CustomsInspection",
  dicts: ['check_type', 'urgency_level'],
  components: {
    ValueTable,
  },
  props: {
    active: {
      type: Number,
      default: () => 0
    },
    customsInspection: {
      type: Object,
      default: () => {}
    },
    currentId: {
      type: Number,
      default: () => 0
    },
    orderType: {
      type: Number,
      default: () => 0
    },
@@ -466,6 +459,9 @@
  },
  data() {
    return {
      customsInspection: {},
      orderType: '',
      active: 0,
      editTable:[], // 区间特殊值填写
      template: null,
      saveLoad: false, // 保存按钮loading
@@ -513,7 +509,7 @@
          { required: true, message: '请填写抽检数量', trigger: 'blur' }
        ],
        partDetail: [
          { required: true, message: '请填写零件描述', trigger: 'blur' }
          { required: true, message: '请填写规格型号', trigger: 'blur' }
        ],
        orderType: [
          { required: true, message: '请选择检验类别', trigger: 'change' }
@@ -556,6 +552,7 @@
      sampleId: null,
      // total: 0,
      totalArr: [],
      addObj1: {},
      model: null,
      standardMethodListId: null,
      inspectionItem:null,
@@ -612,7 +609,6 @@
  watch: {
    sampleList() {
      this.addObj.method = null
      // this.productList = []
    },
    productList: {
      deep: true,
@@ -641,11 +637,13 @@
    }
  },
  mounted() {
    this.getUserNow() // 获取当前用户信息
    this.selectCheckType() // 查询检验类型
    this.active = this.$route.query.active
    this.orderType = this.$route.query.orderType
    this.customsInspection = this.$route.query.customsInspection
    // this.getUserNowList() // 获取当前用户信息
    this.selectStandardMethods() // 获取检验标准下拉框数据
    this.selectEnumByCategoryForType() // 获取紧急程度下拉框
    this.getInfo() // 获取数据
  },
  methods: {
    save1 () {
@@ -704,7 +702,7 @@
        }
        // 查看
        // 请求接口,回显数据
        this.$axios.post(this.$api.insOrder.getInsOrder, {
        getInsOrder({
          orderId: orderId
        }).then(res => {
          if (res.code === 200) {
@@ -734,7 +732,7 @@
          }
        })
      } else {
        this.$axios.get(this.$api.rawMaterialOrder.notificationRawOrder+'?ifsInventoryId='+this.customsInspection.id).then(res => {
        notificationRawOrder({ifsInventoryId:this.customsInspection.id}).then(res => {
          if (res.code === 200) {
            if (res.data === 1) {
              this.dialogVisible2 = true
@@ -746,7 +744,7 @@
          }
        })
        // 报检流程
        this.$axios.get(this.$api.materialInspection.selectStandardTreeListByPartNo+'?partNo='+this.customsInspection.partNo).then(res => {
        selectStandardTreeListByPartNo({partNo:this.customsInspection.partNo}).then(res => {
          if (res.code === 200) {
            this.addObj.sample = res.data.label
            this.codeLevel = res.data.code
@@ -767,19 +765,16 @@
            this.selectTree = str.join(' - ')
            this.addListInfo(this.codeLevel, res.data) // 原材料样品是固定的,就默认赋值一条数据,可拆分
            this.selectInsOrderTemplate() // 原材料模板列表查询
          } else {
            this.dialogVisible = true
            this.dialogMessage = res.message
          }
        }).catch(err => {
          console.log('err---', err)
          this.dialogVisible = true
          this.dialogMessage = err.message
        })
      }
    },
    // 查询模板-反显模板
    selectInsOrderTemplateById(e) {
      this.$axios.get(this.$api.materialInspection.selectRawMaterOrderTemplateById + '?id=' + e).then(res => {
        if (res.code == 201) return
    selectInsOrderTemplateByIdList(e) {
      selectRawMaterOrderTemplateById({id: e}).then(res => {
        let obj = JSON.parse(res.data)
        this.sampleList = obj.sampleList;
        this.productList = obj.sampleList[0].insProduct
@@ -795,7 +790,7 @@
          item.insProduct = this.productList
        })
        this.templateLoading = true;
        this.$axios.post(this.$api.materialInspection.addRawMaterOrderTemplate, {
        addRawMaterOrderTemplate({
          partNo: this.addObj.partNo,
          name: this.templateName,
          thing: JSON.stringify({
@@ -803,12 +798,7 @@
            sampleList: sampleList,
            selectTree:this.selectTree
          })
        }, {
          headers: {
            'Content-Type': 'application/json'
          }
        }).then(res => {
          if (res.code == 201) return
          this.templateLoading = false;
          this.templateDia = false;
          this.$message.success('保存成功')
@@ -826,12 +816,7 @@
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$axios.post(this.$api.materialInspection.delRawMaterOrderTemplate, {
          id: row.id
        }).then(res => {
          if (res.code === 201) {
            return
          }
        delRawMaterOrderTemplate({id: row.id}).then(res => {
          this.$message.success('删除成功')
          this.selectInsOrderTemplate()
        }).catch(e => {
@@ -841,8 +826,7 @@
    },
    // 查询模板列表
    selectInsOrderTemplate() {
      this.$axios.get(this.$api.materialInspection.selectRawMaterOrderTemplate+'?partNo='+this.addObj.partNo).then(res => {
        if (res.code == 201) return
      selectStandardTreeListByPartNo({partNo:this.addObj.partNo}).then(res => {
        this.templates = res.data
      })
    },
@@ -1013,7 +997,7 @@
      this.addObj.model = (trees[4] == undefined ? null : trees[4])
      this.addObj.ifsInventoryId = this.customsInspection.id
      this.noNeedCheckLoad = true
      this.$axios.post(this.$api.rawMaterialOrder.addExemptionOrder, {
      addExemptionOrder({
        str: JSON.stringify({
          insOrder: this.addObj,
          list: JSON.stringify(sampleList.map(a => {
@@ -1041,7 +1025,7 @@
        if (res.code == 201) return
        this.noNeedCheckDia = false
        this.$message.success('已提交')
        this.$parent.playOrder(0)
        this.goBack()
      }).catch(e=>{
        this.noNeedCheckLoad = false
      })
@@ -1064,7 +1048,7 @@
      this.addObj.model = (trees[4] == undefined ? null : trees[4])
      this.addObj.ifsInventoryId = this.customsInspection.id
      this.saveLoad = true
      this.$axios.post(this.$api.insOrder.addInsOrder, {
      addInsOrder({
        str: JSON.stringify({
          insOrder: this.addObj,
          list: JSON.stringify(sampleList.map(a => {
@@ -1092,7 +1076,7 @@
        if (res.code == 201) return
        this.$message.success('已提交')
        this.bsm3Dia = false;
        this.$parent.playOrder(0)
        this.goBack()
      }).catch(e=>{
        this.saveLoad = false
      })
@@ -1427,16 +1411,9 @@
        }
      })
    },
    selectCheckType() {
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "检验类型"
      }).then(res => {
        this.checkType = res.data
      })
    },
    // 获取当前用户信息
    getUserNow() {
      this.$axios.get(this.$api.user.getUserNow).then(res => {
    getUserNowList() {
      getUserNow().then(res => {
        let selects = res.data
        if (selects == null) return
        this.addObj.userId = selects.id
@@ -1447,7 +1424,7 @@
    },
    // 获取检验标准下拉框数据
    selectStandardMethods() {
      this.$axios.get(this.$api.standardTree.selectStandardMethodEnum).then(res => {
      selectStandardMethodEnum().then(res => {
        this.methods = res.data
      })
    },
@@ -1460,7 +1437,7 @@
    },
    selectsStandardMethodByFLSSM() {
      this.methodLoad = true
      this.$axios.post(this.$api.standardTree.selectsStandardMethodByFLSSM, {
      selectsStandardMethodByFLSSM({
        tree: this.selectTree
      }).then(res => {
        this.methodLoad = false
@@ -1469,7 +1446,7 @@
            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, {
            selectsStandardMethodByFLSSM({
              tree: selectTree
            }).then(ress => {
              this.methods = ress.data.standardMethodList
@@ -1609,17 +1586,13 @@
      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(" - "),
        partNo: this.addObj.partNo,
        ifsInventoryId: this.customsInspection.id
      }, {
        headers: {
          'Content-Type': 'application/json'
        }
      }).then(res => {
        this.getProductLoad = false
        if (res.code === 200) {
@@ -1675,13 +1648,6 @@
        this.selectTree = arr0.join(' - ') + '- ' + e
      }
    },
    selectEnumByCategoryForType() {
      this.$axios.post(this.$api.enums.selectEnumByCategory, {
        category: "紧急程度"
      }).then(res => {
        this.types = res.data
      })
    },
    // 要求值变化时
    requestChange(e, row) {
      this.sampleList.map(item => {
@@ -1722,8 +1688,6 @@
                p.section = sections[a]
                p.ask = asks[a]
                p.tell = tells[a]
                // p.manHour = manHours[a]
                // p.price = prices[a]
              }
            })
            break
@@ -1751,12 +1715,6 @@
      if (row.tell.includes('[')) {
        this.$set(row, 'tellCopy', row.tell)
      }
      // if (row.manHour.includes('[')) {
      //   this.$set(row, 'manHourCopy', row.manHour)
      // }
      // if (row.price.includes('[')) {
      //   this.$set(row, 'priceCopy', row.price)
      // }
      let arr = this.productList.filter(m=>m.state==1&&row.sectionCopy&&row.sectionCopy.includes(m.sectionCopy)&&m.ask&&m.sectionCopy.indexOf('[')==-1)
      if (row.bsm === '1' && row.sectionCopy !== '' && row.sectionCopy !== null && row.sectionCopy !== undefined && row.state === 1&&arr.length==0) {
        if (row.sectionCopy.indexOf('[') > -1) {
@@ -1773,14 +1731,10 @@
          let section = arr[0].section
          let arr0 = JSON.parse(row.section)
          let arr1 = JSON.parse(row.ask)
          // let arr2 = JSON.parse(row.manHour)
          // let arr3 = JSON.parse(row.price)
          let arr4 = JSON.parse(row.tell)
          let index = arr0.indexOf(section)
          row.section = section
          row.ask = arr1[index]
          // row.manHour = arr2[index]
          // row.price = arr3[index]
          row.tell = arr4[index]
        } catch(e) {}
      }
@@ -1827,12 +1781,6 @@
        if (p.tell.includes('[')) {
          this.$set(p, 'tellCopy', p.tell)
        }
        // if (p.manHour.includes('[')) {
        //   this.$set(p, 'manHourCopy', p.manHour)
        // }
        // if (p.price.includes('[')) {
        //   this.$set(p, 'priceCopy', p.price)
        // }
        if (p.bsm === '1' && p.sectionCopy !== '' && p.sectionCopy !== null && p.sectionCopy !== undefined && p.state === 1) {
          if (p.sectionCopy.indexOf('[') > -1) {
            p.bsmRow = this.HaveJson(p)
@@ -1901,131 +1849,10 @@
</script>
<style scoped>
.addObj-form-item {
  width: 100%;
}
.ins_order_add {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.ins_order_add::-webkit-scrollbar {
  width: 0;
}
.title {
  height: 60px;
  line-height: 60px;
}
.search {
  width: calc(100% - 40px);
  background-color: #fff;
  padding: 5px 40px 5px 0;
}
.search_thing {
.header {
  display: flex;
  align-items: center;
  height: 50px;
}
.search_label {
  width: 120px;
  font-size: 14px;
  text-align: right;
}
.search_input {
  width: calc(100% - 120px);
}
.node_i {
  color: orange;
  font-size: 18px;
}
.el-select-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pairing {
  text-align: center;
  line-height: 36px;
  margin: 3px 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}
.askRts {
  width: 100px;
  font-size: 12px;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 2px solid rgba(0, 0, 0, 0.3);
  text-align: center;
  background-color: rgba(0, 0, 0, 0.1);
  outline: none;
  border-radius: 2px;
  line-height: 24px;
  margin-top: 5px;
}
.circulateTable {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.opticalProject {
  width: 38%;
}
.temperatureList {
  width: 60%;
}
.temperatureListTitle {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  line-height: 30px;
}
>>> .el-form-item__content {
  text-align: left;
  width: 65%;
}
.ins_order_add .el-input-group__append,
.el-input-group__prepend {
  padding: 0 10px;
}
.ins_order_add .el-tree-node__content {
  height: 32px;
  font-size: 14px;
  border-radius: 2px;
}
.ins_order_add .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
  color: #3A7BFA;
}
.ins_order_add .has-gutter .el-table__cell .cell {
  line-height: 30px;
  background-color: #fafafa;
}
.ins_order_add .has-gutter .el-table__cell {
  background-color: #fafafa !important;
}
.ins_order_add .el-table__row .cell {
  font-size: 12px;
}
.ins_order_add .el-table .warning-row .cell {
  color: #3A7BFA;
  margin-bottom: 10px;
}
.tab {
  list-style-type: none;