gaoluyang
8 天以前 fcadf16afa65a8a5ca53a33c4b8f4bf2efe2ea03
src/views/business/productOrder/components/addOrder.vue
@@ -42,7 +42,28 @@
    </div>
    <div v-show="!cableConfigShow&&!auxiliaryShow" style="margin-top: 10px">
      <div class="search">
        <el-form ref="addObj" :inline="true" :model="addObj" :rules="addObjRules" label-width="108px" label-position="right">
        <el-form ref="newJuOrder" :inline="true" :model="addObj" label-width="108px" label-position="right">
          <el-row>
            <el-col :span="6"><el-form-item label="产品名称"><el-input v-model="addObj.sample" disabled size="small"><template slot="append"><el-button :disabled="active>1" icon="el-icon-search" @click="selectStandardTree = true" /></template></el-input></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="生产单位"><el-input v-model="addObj.production" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="委托单位"><el-input v-model="addObj.company" disabled size="small"><template slot="append"><el-button :disabled="active>1" icon="el-icon-search" @click="openCompanyList" /></template></el-input></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="检验类别"><el-select v-model="addObj.orderType" :disabled="active>1" size="small"><el-option v-for="item in dict.type.check_type1" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-form-item></el-col>
          </el-row>
          <el-row>
            <el-col :span="6"><el-form-item label="样品数量"><el-input v-model="addObj.testQuantity" :disabled="active>1" placeholder="如:2桶、500mL" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="样品编号"><el-input v-model="sampleCode" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="样品外观"><el-input v-model="addObj.sampleStatus" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="送样人"><el-input v-model="addObj.prepareUser" :disabled="active>1" size="small" /></el-form-item></el-col>
          </el-row>
          <el-row>
            <el-col :span="6"><el-form-item label="生产日期"><el-date-picker v-model="addObj.productionDate" type="date" value-format="yyyy-MM-dd" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="生产批号"><el-input v-model="addObj.productionBatch" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="送样日期"><el-date-picker v-model="addObj.sampleDate" type="date" value-format="yyyy-MM-dd" :disabled="active>1" size="small" /></el-form-item></el-col>
            <el-col :span="6"><el-form-item label="联系方式"><el-input v-model="addObj.phone" :disabled="active>1" size="small" /></el-form-item></el-col>
          </el-row>
          <el-row><el-col :span="6"><el-form-item label="环境条件"><el-input v-model="addObj.temperature" :disabled="active>1" placeholder="温度" size="small" /></el-form-item></el-col><el-col :span="6"><el-form-item label="湿度"><el-input v-model="addObj.humidity" :disabled="active>1" size="small" /></el-form-item></el-col><el-col :span="6"><el-form-item label="备注"><el-input v-model="addObj.remark" :disabled="active>1" size="small" /></el-form-item></el-col></el-row>
        </el-form>
        <el-form v-if="false" ref="addObj" :inline="true" :model="addObj" :rules="addObjRules" label-width="108px" label-position="right">
          <el-row>
            <el-col :span="6">
              <el-form-item label="委托编号:" prop="entrustCode">
@@ -205,7 +226,7 @@
          </el-row>
        </el-form>
      </div>
      <div>
      <div v-if="false">
        <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">
@@ -427,7 +448,7 @@
              <el-col :span="24">
                <span><i
                    :class="`node_i ${data.children != undefined ? (data.code==='[1]'?'el-icon-folder-opened':'el-icon-folder') : 'el-icon-tickets'}`"></i>
                  {{ data.code }} {{ data.label }}</span>
                  {{ data.label }}</span>
              </el-col>
            </el-row>
          </div>
@@ -615,7 +636,6 @@
import {
  isLeafPath,
  buildSelectTree,
  deriveTreeFields,
  dropLastLabel,
} from "@/utils/standardTree";
@@ -644,6 +664,7 @@
      active: '',
      tabIndex: '',
      currentId: '',
      sampleCode: '',
      sampleSelectionList: [],//样品表格选中数据
      editTable:[],
      template: null,
@@ -1157,6 +1178,14 @@
        return str.replaceAll(find, value);
      },
      save() {
        if (this.addObj.standardTreeId) {
          if (!this.addObj.sample || !this.addObj.company || !this.addObj.orderType || !this.addObj.testQuantity) {
            this.$message.error('请填写产品名称、委托单位、检验类别和样品数量');
            return;
          }
          this.saveData([]);
          return;
        }
        this.$refs['addObj'].validate((valid) => {
          if (valid) {
            this.sampleList.forEach(item => {
@@ -1337,6 +1366,10 @@
        }
      },
      saveMethod(sampleList){
        if (this.addObj.standardTreeId) {
          this.saveData([]);
          return;
        }
        if (this.addObj.quarterItemId) {
          this.addObj.quarterItemId = this.addObj.quarterItemId[1]
        }
@@ -1383,7 +1416,10 @@
        })
      }else{
        // 常规提交
        addInsOrder({insOrder: {...this.addObj,typeSource:-1}, sampleList: sampleList}).then(res => {
        const payload = this.addObj.standardTreeId
          ? { insOrder: {...this.addObj,typeSource:-1}, standardTreeId: this.addObj.standardTreeId, sampleCode: this.sampleCode }
          : { insOrder: {...this.addObj,typeSource:-1}, sampleList: sampleList }
        addInsOrder(payload).then(res => {
          this.saveLoad = false
          this.$message.success('已提交')
          this.bsm3Dia = false;
@@ -1512,38 +1548,15 @@
        return data.label.indexOf(value) !== -1;
      },
      activeStandardTree() {
        const fields = deriveTreeFields(this.selectTreeNode)
        if (fields.labels.length < 2) {
          this.$message.error('未选择对象')
        if (!this.selectTreeNode || this.selectTreeNode.data.code !== '[2]') {
          this.$message.error('请选择二级产品')
          return
        }
        this.addObj.factory = fields.factory
        this.addObj.laboratory = fields.laboratory
        this.addObj.sampleType = fields.sampleType
        this.addObj.sample = fields.sample || fields.sampleType
        this.addObj.sampleView = this.addObj.sample
        this.addObj.sampleViewEn = this.sampleViewEn
        this.addObj.model = fields.model
        const productName = this.selectTreeNode.data.label
        this.addObj.sample = productName
        this.addObj.standardTreeId = this.selectTreeNode.data.id
        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.model = this.addObj.model
          this.sample.unit = this.addObj.unit
          this.sample.standardMethodListId = null
          this.sample.insProduct = []
          this.sample.id = this.count
          this.sample.childSampleList = []
          this.sample.insulating = null
          this.sample.sheath = null
          this.sampleList.push(this.HaveJson(this.sample))
          this.count++
        }
        this.$refs.sampleTable.doLayout()
        // this.selectsStandardMethodByFLSSM()
      },
      // 用指定型号替换树路径末段(末段即标准/型号)
      buildFactoryPath(model) {