From fcadf16afa65a8a5ca53a33c4b8f4bf2efe2ea03 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 16 九月 2026 09:21:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_新疆_新聚' into dev_新疆_新聚
---
src/views/business/productOrder/components/addOrder.vue | 196 ++++++++++++++++++++++--------------------------
1 files changed, 89 insertions(+), 107 deletions(-)
diff --git a/src/views/business/productOrder/components/addOrder.vue b/src/views/business/productOrder/components/addOrder.vue
index c880056..000296d 100644
--- a/src/views/business/productOrder/components/addOrder.vue
+++ b/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>
@@ -612,6 +633,11 @@
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',
@@ -638,6 +664,7 @@
active: '',
tabIndex: '',
currentId: '',
+ sampleCode: '',
sampleSelectionList: [],//鏍峰搧琛ㄦ牸閫変腑鏁版嵁
editTable:[],
template: null,
@@ -744,6 +771,8 @@
list: [],
selectStandardTreeLoading: false,
selectTree: null,
+ // 褰撳墠閫変腑鐨勬爲鑺傜偣锛堢敤浜庢寜灞傜骇鎺ㄥ瀛楁锛�
+ selectTreeNode: null,
sampleViewEn: null,
expandedKeys: [],
sampleList: [],
@@ -1149,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 => {
@@ -1329,6 +1366,10 @@
}
},
saveMethod(sampleList){
+ if (this.addObj.standardTreeId) {
+ this.saveData([]);
+ return;
+ }
if (this.addObj.quarterItemId) {
this.addObj.quarterItemId = this.addObj.quarterItemId[1]
}
@@ -1375,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;
@@ -1470,9 +1514,9 @@
},
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
}
},
@@ -1480,47 +1524,13 @@
$($(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() {
@@ -1538,42 +1548,23 @@
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
@@ -1581,20 +1572,21 @@
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() {
@@ -1833,13 +1825,11 @@
}
}
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,
@@ -1900,14 +1890,12 @@
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 = this.inspectionScope === 'all' ? 1 : 0
@@ -1949,13 +1937,13 @@
},
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
}
},
// 瑕佹眰鍊煎彉鍖栨椂
@@ -2091,13 +2079,7 @@
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(' - ')
+ const factory = this.buildFactoryPath(product.model || sample.model)
return selectStandardProductList({
model: sample.model,
modelNum: sample.modelNum,
--
Gitblit v1.9.3