| | |
| | | </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"> |
| | |
| | | </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"> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div v-if="canSelectProduct" style="display: flex; align-items: center; gap: 12px; padding: 10px 0;"> |
| | | <span>检测范围:</span> |
| | | <el-radio-group v-model="inspectionScope" size="small" @change="changeInspectionScope"> |
| | | <el-radio-button label="all">全部检验</el-radio-button> |
| | | <el-radio-button label="specified">指定检验项</el-radio-button> |
| | | </el-radio-group> |
| | | <span>已选 {{ selectedProductCount }} / 共 {{ productList.length }} 项</span> |
| | | </div> |
| | | <el-table ref="productTable" v-loading="getProductLoad" :data="productList" |
| | | :row-class-name="tableRowClassName" border class="el-table" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" |
| | | 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="selectable0" type="selection" width="65"></el-table-column> |
| | | <el-table-column v-if="canSelectProduct" :selectable="selectable0" type="selection" width="65"></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"> |
| | | <span>检验项</span> |
| | | <el-input |
| | | v-if="active==1" |
| | | v-if="canSelectProduct" |
| | | v-model="inspectionItem" |
| | | placeholder="请输入" |
| | | size="mini" |
| | |
| | | <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px"> |
| | | <span>检验项子项</span> |
| | | <el-input |
| | | v-if="active==1" |
| | | v-if="canSelectProduct" |
| | | v-model="inspectionItemSubclass" |
| | | placeholder="请输入" |
| | | size="mini" |
| | |
| | | <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px"> |
| | | <span>试验方法</span> |
| | | <el-input |
| | | v-if="active==1" |
| | | v-if="canSelectProduct" |
| | | v-model="methodS" |
| | | placeholder="请输入" |
| | | size="mini" |
| | |
| | | <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> |
| | |
| | | import {mapGetters} from "vuex"; |
| | | import { bigEval } from "@/utils/bigEval"; |
| | | import {addQuarter, updateQuarterOnOrder} from "@/api/business/finishedProductSampling"; |
| | | import { |
| | | isLeafPath, |
| | | buildSelectTree, |
| | | dropLastLabel, |
| | | } from "@/utils/standardTree"; |
| | | |
| | | export default { |
| | | name: 'AddOrder', |
| | |
| | | }, |
| | | computed:{ |
| | | ...mapGetters(["nickName", 'nameEn', 'userName']), |
| | | canSelectProduct() { |
| | | return this.active == 1 || (this.tabIndex == 4 && this.active == 2) |
| | | }, |
| | | selectedProductCount() { |
| | | return this.productList.filter(item => item.state == 1).length |
| | | }, |
| | | newJuLaboratoryList() { |
| | | return (this.dict.type.sys_sub_lab || []).filter(item => item.label === '新聚') |
| | | }, |
| | |
| | | active: '', |
| | | tabIndex: '', |
| | | currentId: '', |
| | | sampleCode: '', |
| | | sampleSelectionList: [],//样品表格选中数据 |
| | | editTable:[], |
| | | template: null, |
| | |
| | | testQuantity: [ |
| | | { required: true, message: '请填写抽检数量', trigger: 'blur' } |
| | | ], |
| | | production: [ |
| | | { required: true, message: '请填写生产单位', trigger: 'blur' } |
| | | ], |
| | | productionEn: [ |
| | | { required: true, message: '请填写生产单位EN', trigger: 'blur' } |
| | | ], |
| | | }, |
| | | sample: { |
| | | sampleCode: null, |
| | |
| | | list: [], |
| | | selectStandardTreeLoading: false, |
| | | selectTree: null, |
| | | // 当前选中的树节点(用于按层级推导字段) |
| | | selectTreeNode: null, |
| | | sampleViewEn: null, |
| | | expandedKeys: [], |
| | | sampleList: [], |
| | |
| | | quarterItemOptions: [], // 查询季度信息 |
| | | specialStandardMethod: '', |
| | | isSpecial: false, |
| | | inspectionScope: 'all', |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | ...res.data.insOrder |
| | | }; |
| | | this.addObj.type = String(this.addObj.type) |
| | | this.sampleList = this.HaveJson(res.data.sampleProduct); |
| | | this.specialStandardMethod = this.sampleList[0].specialStandardMethod |
| | | this.getProNum() |
| | | this.addObj.sampleNum = this.sampleList.length |
| | | this.$nextTick(() => { |
| | | this.$refs.sampleTable.doLayout() |
| | | if (this.addObj.sampleNum > 0) { |
| | | this.$refs.sampleTable.setCurrentRow(this.sampleList[0], true) |
| | | this.rowClick(this.sampleList[0]) |
| | | } |
| | | const samples = this.HaveJson(res.data.sampleProduct) |
| | | const loadSamples = this.canSelectProduct |
| | | ? Promise.all(samples.map(sample => this.loadSelectableProducts(sample))) |
| | | : Promise.resolve(samples) |
| | | loadSamples.then(sampleList => { |
| | | this.sampleList = sampleList |
| | | this.specialStandardMethod = this.sampleList[0].specialStandardMethod |
| | | this.getProNum() |
| | | this.addObj.sampleNum = this.sampleList.length |
| | | this.$nextTick(() => { |
| | | this.$refs.sampleTable.doLayout() |
| | | if (this.addObj.sampleNum > 0) { |
| | | this.$refs.sampleTable.setCurrentRow(this.sampleList[0], true) |
| | | this.rowClick(this.sampleList[0]) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | 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 => { |
| | |
| | | if (this.tabIndex != 4) { |
| | | delete c.id |
| | | } |
| | | if (c.isNew) { |
| | | c.id = null |
| | | delete c.isNew |
| | | } |
| | | }) |
| | | } |
| | | if (a.endModels) { |
| | | a.model = a.endModels |
| | | } |
| | | a.insProduct = a.insProduct.filter(b=>b.state === 1) |
| | | if (!this.canSelectProduct || this.active == 1) { |
| | | a.insProduct = a.insProduct.filter(b=>b.state === 1) |
| | | } |
| | | }) |
| | | 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.$message.warning('请至少选择一个检验项') |
| | | return |
| | | }else{ |
| | | let isRTS = this.totalArr.find(a => a.ask != null && this.symbolList.find(b=>a.ask.includes(b)) && a.state == 1) |
| | | if (isRTS) { |
| | |
| | | if (this.tabIndex != 4) { |
| | | delete c.id |
| | | } |
| | | if (c.isNew) { |
| | | c.id = null |
| | | delete c.isNew |
| | | } |
| | | }) |
| | | } |
| | | if (a.endModels) { |
| | | a.model = a.endModels |
| | | } |
| | | a.insProduct = a.insProduct.filter(b=>b.state === 1) |
| | | if (!this.canSelectProduct || this.active == 1) { |
| | | a.insProduct = a.insProduct.filter(b=>b.state === 1) |
| | | } |
| | | }) |
| | | this.saveMethod(sampleList) |
| | | }else{ |
| | |
| | | } |
| | | }, |
| | | saveMethod(sampleList){ |
| | | if (this.addObj.standardTreeId) { |
| | | this.saveData([]); |
| | | return; |
| | | } |
| | | if (this.addObj.quarterItemId) { |
| | | this.addObj.quarterItemId = this.addObj.quarterItemId[1] |
| | | } |
| | |
| | | }) |
| | | }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; |
| | |
| | | }, |
| | | nodeOpen(data, node, el) { |
| | | $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder-opened') |
| | | if (node.data.code === '[3]') { |
| | | if (data.sampleTypeEn !== undefined && data.sampleTypeEn !== null) { |
| | | this.sampleViewEn = data.sampleTypeEn |
| | | } else if (node.data.code === '[4]') { |
| | | } else if (data.sampleEn !== undefined && data.sampleEn !== null) { |
| | | this.sampleViewEn = data.sampleEn |
| | | } |
| | | }, |
| | |
| | | $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder') |
| | | }, |
| | | handleNodeClick(val, node, el) { |
| | | this.selectTree = '' |
| | | 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 |
| | | } |
| | | }) |
| | | |
| | | } |
| | | } |
| | | if (node.data.code === '[3]') { |
| | | this.selectTreeNode = node |
| | | this.models = val.children || [] |
| | | this.selectTree = buildSelectTree(node, '') |
| | | if (val.sampleTypeEn !== undefined && val.sampleTypeEn !== null) { |
| | | this.sampleViewEn = val.sampleTypeEn |
| | | } else if (node.data.code === '[4]') { |
| | | if (node.data.children!==null && node.data.children.length>0) { |
| | | this.sampleViewEn = val.sampleEn |
| | | } |
| | | } |
| | | 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--) { |
| | | data2 += " - " + data[index] |
| | | } |
| | | this.selectTree = data2.replace(' - ', '') |
| | | }, |
| | | getNodeParent(val) { |
| | | if (val.parent != null) { |
| | | if (val.data.children === null) { |
| | | this.selectTree += ' - ' + val.label + ' - ' + '' |
| | | } else { |
| | | this.selectTree += ' - ' + val.label |
| | | } |
| | | this.getNodeParent(val.parent) |
| | | } else if (val.sampleEn !== undefined && val.sampleEn !== null) { |
| | | this.sampleViewEn = val.sampleEn |
| | | } |
| | | }, |
| | | selectStandardTreeList() { |
| | |
| | | return data.label.indexOf(value) !== -1; |
| | | }, |
| | | activeStandardTree() { |
| | | let trees = this.selectTree.split(" - ") |
| | | if (trees.length < 3) { |
| | | this.$message.error('未选择对象') |
| | | if (!this.selectTreeNode || this.selectTreeNode.data.code !== '[2]') { |
| | | 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.sampleView = this.addObj.sample |
| | | this.addObj.sampleViewEn = this.sampleViewEn |
| | | this.addObj.model = (trees[4] == undefined ? null : trees[4]) |
| | | 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) { |
| | | const tree = this.selectTree || '' |
| | | if (!tree || !model) return tree |
| | | const tokens = tree.split(' - ') |
| | | tokens[tokens.length - 1] = model |
| | | return tokens.join(' - ') |
| | | }, |
| | | selectsStandardMethodByFLSSMList() { |
| | | this.methodLoad = true |
| | |
| | | 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) |
| | | const list = (res.data && res.data.standardMethodList) || [] |
| | | // 当前是叶子(标准)却查不到标准时,回退到父级再查一次 |
| | | // 用路径判定叶子:模板回填时 selectTreeNode 为空,节点对象判定会失效 |
| | | if (list.length === 0 && isLeafPath(this.selectTree)) { |
| | | const parentTree = dropLastLabel(this.selectTree) |
| | | if (parentTree) { |
| | | selectsStandardMethodByFLSSM({ |
| | | tree: selectTree |
| | | tree: parentTree |
| | | }).then(ress => { |
| | | this.methods = ress.data.standardMethodList |
| | | this.methods = (ress.data && ress.data.standardMethodList) || [] |
| | | }) |
| | | } else { |
| | | this.methods = res.data.standardMethodList |
| | | return |
| | | } |
| | | } catch (e) {} |
| | | } |
| | | this.methods = list |
| | | }) |
| | | }, |
| | | addStandardTree() { |
| | |
| | | } |
| | | this.productList = row.insProduct |
| | | this.productList0 = JSON.parse(JSON.stringify(this.productList)) |
| | | this.inspectionScope = this.productList.length === 0 |
| | | ? (this.active == 1 ? 'all' : 'specified') |
| | | : (this.productList.every(item => item.state == 1) ? 'all' : 'specified') |
| | | setTimeout(() => { |
| | | this.productList.forEach(a => { |
| | | if (a.state == 1) { |
| | |
| | | }) |
| | | this.changeProductList0() |
| | | this.currentMethod.insProduct = this.productList0 |
| | | this.inspectionScope = this.productList.length > 0 && this.productList.every(item => item.state == 1) |
| | | ? 'all' |
| | | : 'specified' |
| | | this.getProNum() |
| | | }, |
| | | permute(nums) { |
| | |
| | | } |
| | | } |
| | | this.getProductLoad = true |
| | | let selectTreeList = this.selectTree.split(" - ") |
| | | this.addObj.model&&(selectTreeList[selectTreeList.length - 1] = this.addObj.model) |
| | | selectStandardProductList({ |
| | | model: this.addObj.model?this.addObj.model:row.model, |
| | | modelNum: row.modelNum, |
| | | standardMethodListId: val, |
| | | factory: selectTreeList.join(" - "), |
| | | factory: this.buildFactoryPath(this.addObj.model), |
| | | cores: row.cores, |
| | | conductorMaterial: row.conductorMaterial, |
| | | conductorType: row.conductorType, |
| | | }).then(res => { |
| | | res.data.forEach(a => { |
| | | a.state = 0 |
| | | a.state = this.inspectionScope === 'all' ? 1 : 0 |
| | | }) |
| | | row.insProduct = this.HaveJson(res.data) |
| | | this.getProductLoad = false |
| | |
| | | this.productList.forEach(a => { |
| | | if (a.state == 1) this.toggleSelection(a) |
| | | }) |
| | | if (this.inspectionScope === 'all') { |
| | | this.handleAll(this.productList.filter(item => this.selectable0(item))) |
| | | } |
| | | }, 200) |
| | | }) |
| | | }, |
| | |
| | | this.isAskOnlyRead = false |
| | | } |
| | | this.getProductLoad = true |
| | | let selectTreeList = this.selectTree.split(" - ") |
| | | this.addObj.model&&(selectTreeList[selectTreeList.length - 1] = this.addObj.model) |
| | | selectStandardProductList({ |
| | | model: this.addObj.model?this.addObj.model:row.model, |
| | | modelNum: row.modelNum, |
| | | standardMethodListId: val, |
| | | cores: row.cores, |
| | | factory: selectTreeList.join(" - "), |
| | | factory: this.buildFactoryPath(this.addObj.model), |
| | | }).then(res => { |
| | | res.data.forEach(a => { |
| | | a.state = 0 |
| | | a.state = this.inspectionScope === 'all' ? 1 : 0 |
| | | }) |
| | | row.insProduct = this.HaveJson(res.data) |
| | | this.getProductLoad = false |
| | |
| | | this.productList.forEach(a => { |
| | | if (a.state == 1) this.toggleSelection(a) |
| | | }) |
| | | if (this.inspectionScope === 'all') { |
| | | this.handleAll(this.productList.filter(item => this.selectable0(item))) |
| | | } |
| | | }, 200) |
| | | }) |
| | | }, |
| | |
| | | }, |
| | | handleChangeModel(e) { |
| | | this.productList = [] |
| | | let num = this.selectTree.split('-').length; |
| | | if (num != 5) { |
| | | this.selectTree = this.selectTree + ' - ' + e |
| | | const tree = this.selectTree || '' |
| | | // 路径末段已是标准(叶子):替换末段;否则追加 |
| | | // 用路径判定:模板回填(obj.selectTree)时没有可用的树节点对象 |
| | | if (isLeafPath(tree)) { |
| | | this.selectTree = this.buildFactoryPath(e) |
| | | } else { |
| | | let arr = this.selectTree.split('-') |
| | | let arr0 = arr.slice(0, arr.length - 1) |
| | | this.selectTree = arr0.join('-') + '- ' + e |
| | | this.selectTree = tree ? tree + ' - ' + e : e |
| | | } |
| | | }, |
| | | // 要求值变化时 |
| | |
| | | } |
| | | }, |
| | | selectable0(row,index) { |
| | | if (this.active > 1||row.repetitionTag) { |
| | | if (!this.canSelectProduct||row.repetitionTag) { |
| | | return false |
| | | } else { |
| | | return true |
| | |
| | | return item |
| | | }) |
| | | } |
| | | this.productList.forEach(item => { |
| | | if (item.id == row.id) { |
| | | item.state = row.state; |
| | | } |
| | | }) |
| | | this.changeProductList0() |
| | | this.currentMethod.insProduct = this.productList0 |
| | | this.inspectionScope = e.length > 0 ? 'all' : 'specified' |
| | | this.getProNum() |
| | | this.$nextTick(() => { |
| | | this.$refs.productTable.doLayout() |
| | | }) |
| | | }, |
| | | changeInspectionScope(scope) { |
| | | if (scope !== 'all' || this.productList.length === 0) return |
| | | this.$refs.productTable.clearSelection() |
| | | this.productList.forEach(item => { |
| | | if (this.selectable0(item)) this.$refs.productTable.toggleRowSelection(item, true) |
| | | }) |
| | | this.handleAll(this.productList.filter(item => this.selectable0(item))) |
| | | }, |
| | | inspectionProductKey(product) { |
| | | return [ |
| | | product.structureItemParameterId, |
| | | product.inspectionItemClass, |
| | | product.inspectionItem, |
| | | product.inspectionItemSubclass |
| | | ].join('|') |
| | | }, |
| | | loadSelectableProducts(sample) { |
| | | const selectedProducts = sample.insProduct || [] |
| | | if (!sample.standardMethodListId) return Promise.resolve(sample) |
| | | const product = selectedProducts[0] || {} |
| | | const factory = this.buildFactoryPath(product.model || sample.model) |
| | | return selectStandardProductList({ |
| | | model: sample.model, |
| | | modelNum: sample.modelNum, |
| | | standardMethodListId: sample.standardMethodListId, |
| | | factory, |
| | | cores: sample.cores, |
| | | conductorMaterial: sample.conductorMaterial, |
| | | conductorType: sample.conductorType |
| | | }).then(res => { |
| | | const selectedKeys = new Set(selectedProducts.map(item => this.inspectionProductKey(item))) |
| | | const availableProducts = (res.data || []) |
| | | .filter(item => !selectedKeys.has(this.inspectionProductKey(item))) |
| | | .map((item, index) => ({...item, id: `new-${sample.id}-${index}`, state: 0, isNew: true})) |
| | | sample.insProduct = selectedProducts.concat(availableProducts) |
| | | return sample |
| | | }).catch(() => sample) |
| | | }, |
| | | submitTell() { |
| | | if (!this.tell) { |
| | | this.$message.error('请输入不通过原因') |