| | |
| | | </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" |
| | |
| | | </div> |
| | | </el-col> |
| | | <el-col v-if="distributeData.userId" :span="22" class="search_thing"> |
| | | <div class="search_label"><span class="required-span">* </span>试验室:</div> |
| | | <div class="search_label">试验室:</div> |
| | | <div class="search_input"> |
| | | <el-select v-model="distributeData.sonLaboratory" filterable placeholder="请选择" size="small" style="width: 100%;"> |
| | | <el-option v-for="item in sonLaboratoryList" :key="item.value" :label="item.label" :value="item.value"> |
| | | <el-option v-for="item in newJuLaboratoryList" :key="item.value" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | |
| | | }, |
| | | 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 === '新聚') |
| | | }, |
| | | }, |
| | | dicts: ['check_type1', 'urgency_level', 'form_type', 'sample_status_list'], |
| | | dicts: ['check_type1', 'urgency_level', 'form_type', 'sample_status_list', 'sys_sub_lab'], |
| | | data() { |
| | | return { |
| | | active: '', |
| | |
| | | ], |
| | | testQuantity: [ |
| | | { required: true, message: '请填写抽检数量', trigger: 'blur' } |
| | | ], |
| | | production: [ |
| | | { required: true, message: '请填写生产单位', trigger: 'blur' } |
| | | ], |
| | | productionEn: [ |
| | | { required: true, message: '请填写生产单位EN', trigger: 'blur' } |
| | | ], |
| | | }, |
| | | sample: { |
| | |
| | | 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]) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | 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{ |
| | |
| | | this.distributeData.appointed = ress.data |
| | | }) |
| | | setTimeout(() => { |
| | | this.distributeData.sonLaboratory = this.newJuLaboratoryList.length > 0 ? this.newJuLaboratoryList[0].value : '' |
| | | this.issuedDialogVisible = true; |
| | | }, 1000) |
| | | }) |
| | |
| | | } |
| | | if (this.distributeData.userId == null || this.distributeData.userId == '') { |
| | | this.$message.error('指派人员未填写') |
| | | return |
| | | } |
| | | if (this.distributeData.userId&&(this.distributeData.sonLaboratory== null ||this.distributeData.sonLaboratory== '')) { |
| | | this.$message.error('试验室未填写') |
| | | return |
| | | } |
| | | this.upLoad = true; |
| | |
| | | } |
| | | 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) { |
| | |
| | | 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) |
| | | }) |
| | | }, |
| | |
| | | factory: selectTreeList.join(" - "), |
| | | }).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) |
| | | }) |
| | | }, |
| | |
| | | } |
| | | }, |
| | | 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 = [ |
| | | product.factory || this.addObj.factory, |
| | | product.laboratory || this.addObj.laboratory, |
| | | product.sampleType || this.addObj.sampleType, |
| | | product.sample || sample.sample, |
| | | product.model || sample.model |
| | | ].join(' - ') |
| | | 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) { |
| | |
| | | }) |
| | | }, |
| | | changeUser(){ |
| | | if(this.sonLaboratoryList.length>0){ |
| | | this.distributeData.sonLaboratory = this.sonLaboratoryList[0].value |
| | | if(this.newJuLaboratoryList.length>0){ |
| | | this.distributeData.sonLaboratory = this.newJuLaboratoryList[0].value |
| | | } |
| | | }, |
| | | addProductList(productList,row,index){ |