From c3439872107011ec7fb9bd1fbdbb4e65d0cb822d Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期四, 14 九月 2023 16:04:29 +0800
Subject: [PATCH] modified: src/components/view/standard.vue
---
src/components/view/standard.vue | 103 ++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 77 insertions(+), 26 deletions(-)
diff --git a/src/components/view/standard.vue b/src/components/view/standard.vue
index 7984cb2..6fa6e73 100644
--- a/src/components/view/standard.vue
+++ b/src/components/view/standard.vue
@@ -526,7 +526,26 @@
this.$refs[formName].validate((valid) => {
if (valid) {
let obj=JSON.parse(JSON.stringify(this.leftAdd))
- console.log(obj);
+ if(obj.type.length===1){
+ obj.type=this.getType(obj.type[0])
+ this.$axios.post(this.$api.url.leftAddOneTwo,obj,{
+ headers: { "Content-Type": "application/json" }
+ }).then(res=>{
+ this.$message({
+ message: res.message,
+ type: 'success'
+ });
+ this.leftAdd.type=[]
+ this.leftAdd.father=null
+ this.leftAdd.standard=null
+ this.leftAdd.name=null
+ this.leftAdd.specifications=null
+ this.selectMaterialTree()
+ this.bomLeftAdd=false
+ this.selectVersion()
+ })
+ return
+ }
let one=this.list.filter(item=>{
return item.name===obj.type[0]
})[0]
@@ -544,7 +563,14 @@
message: res.message,
type: 'success'
});
- this.selectMaterialTree()
+ this.leftAdd.type=[]
+ this.leftAdd.father=null
+ this.leftAdd.standard=null
+ this.leftAdd.name=null
+ this.leftAdd.specifications=null
+ this.selectMaterialTree()
+ this.bomLeftAdd=false
+ this.selectVersion()
})
}else{
let three=two.children.filter(item=>{
@@ -560,7 +586,14 @@
message: res.message,
type: 'success'
});
- this.selectMaterialTree()
+ this.leftAdd.type=[]
+ this.leftAdd.father=null
+ this.leftAdd.standard=null
+ this.leftAdd.name=null
+ this.leftAdd.specifications=null
+ this.selectMaterialTree()
+ this.bomLeftAdd=false
+ this.selectVersion()
})
}else{
//鏂板鏍囧噯鍨嬪彿
@@ -580,7 +613,14 @@
message: res.message,
type: 'success'
});
- this.selectMaterialTree()
+ this.leftAdd.type=[]
+ this.leftAdd.father=null
+ this.leftAdd.standard=null
+ this.leftAdd.name=null
+ this.leftAdd.specifications=null
+ this.selectMaterialTree()
+ this.bomLeftAdd=false
+ this.selectVersion()
})
}else{
let specificationsDto={
@@ -594,7 +634,13 @@
message: res.message,
type: 'success'
});
+ this.leftAdd.type=[]
+ this.leftAdd.father=null
+ this.leftAdd.standard=null
+ this.leftAdd.name=null
+ this.leftAdd.specifications=null
this.selectMaterialTree()
+ this.bomLeftAdd=false
this.selectVersion()
})
}
@@ -1034,6 +1080,29 @@
arr[idx].name = '鍗婃垚鍝�'
}
})
+ if(res.data.length<1){
+ let obj={
+ name: '鎴愬搧',
+ }
+ let obj2={
+ name: '鍗婃垚鍝�',
+ }
+ this.list.push(obj)
+ this.list.push(obj2)
+ }
+ if(res.data.length===1){
+ if(res.data[0].name==='鎴愬搧'){
+ this.list.push({
+ name: '鍗婃垚鍝�',
+ })
+ }
+ if(res.data[0].name==='鍗婃垚鍝�'){
+ this.list.push({
+ name: '鎴愬搧',
+ })
+ }
+ }
+ console.log(this.list);
this.selectDataList()
// 榛樿绗竴涓簲绾ц妭鐐规悳绱紝鏂板閰嶇疆椤�
const treeOptions = JSON.parse(JSON.stringify(this.list));
@@ -1126,12 +1195,16 @@
handler(newVal, oldVal) {
if(this.isLeftAdd){
let tree=JSON.parse(JSON.stringify(this.list))
+ console.log(tree);
let father=null;
if(newVal.father!=null&&newVal.father!=''&&newVal.type.length>0){
let one=tree.filter(item=>{
return item.name===newVal.type[0]
})[0]
console.log(one);
+ if(one.children===undefined){
+ return
+ }
let two=one.children.filter(item=>{
return item.name===newVal.father
})[0]
@@ -1167,28 +1240,6 @@
handler(newval,oldVal){
if(newval){
let treeOptions = JSON.parse(JSON.stringify(this.list));
- if(treeOptions.length<1){
- let obj={
- name: '鎴愬搧',
- }
- let obj2={
- name: '鍗婃垚鍝�',
- }
- treeOptions.push(obj)
- treeOptions.push(obj2)
- }
- if(treeOptions.length===1){
- if(treeOptions[0].name==='鎴愬搧'){
- treeOptions.push({
- name: '鍗婃垚鍝�',
- })
- }
- if(treeOptions[0].name==='鍗婃垚鍝�'){
- treeOptions.push({
- name: '鎴愬搧',
- })
- }
- }
this.replaceProp(treeOptions)
this.formTypeOptions=treeOptions
this.restaurants=this.loadFatherType()
--
Gitblit v1.9.3