|
|
@@ -151,7 +151,7 @@
|
|
|
>
|
|
|
<span
|
|
|
class="el-icon-success disbale"
|
|
|
- v-if="value.select == 1"
|
|
|
+ v-if="value.select == 2"
|
|
|
></span>
|
|
|
<span
|
|
|
class="el-icon-success"
|
|
|
@@ -326,68 +326,9 @@ export default {
|
|
|
this.getLeftList();
|
|
|
this.getRightLst()
|
|
|
},
|
|
|
- watch: {
|
|
|
- leftCheckedList () {
|
|
|
- if (this.leftItemList.length === this.leftCheckedList.length) {
|
|
|
- this.checkedAll = true
|
|
|
- } else {
|
|
|
- this.checkedAll = false
|
|
|
- }
|
|
|
- },
|
|
|
- // ptClassId() {
|
|
|
- // this.getRightItemList()
|
|
|
- // },
|
|
|
- // ptRightId() {
|
|
|
- // this.getItemList()
|
|
|
- // }
|
|
|
- // leftItemList: {
|
|
|
- // handler (newVal) {
|
|
|
- // newVal.forEach(item => {
|
|
|
- // if (item.Uselect && item.select !== 1) {
|
|
|
- // this.leftCheckedList.push(item)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
- // deep: true
|
|
|
- // },
|
|
|
- // leftItemList () {
|
|
|
- // this.leftItemList.forEach(item => {
|
|
|
- // if (item.Uselect && item.select !== 1) {
|
|
|
- // this.leftCheckedList.push(item)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // deep: true
|
|
|
-
|
|
|
- // }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- // leftCheckedList () {
|
|
|
- // let list = [];
|
|
|
- // if (this.leftItemList) {
|
|
|
- // this.leftItemList.forEach(item => {
|
|
|
- // if (item.Uselect && item.select !== 1) {
|
|
|
- // list.push(item)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // return list
|
|
|
- // },
|
|
|
- // rightCheckedList () {
|
|
|
- // let list = [];
|
|
|
- // if (this.rightItemList) {
|
|
|
- // this.rightItemList.forEach(item => {
|
|
|
- // if (item.Uselect) {
|
|
|
- // list.push(item)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // return list
|
|
|
- // }
|
|
|
- },
|
|
|
methods: {
|
|
|
getLeftList () {
|
|
|
this.$service.ghsItemClass.getAllClass().then(res => {
|
|
|
- console.log(res)
|
|
|
this.leftClassList = res.list
|
|
|
this.ptClassName = res.list[0].name
|
|
|
this.ptClassId = res.list[0].id
|
|
|
@@ -396,7 +337,6 @@ export default {
|
|
|
},
|
|
|
getRightLst () {
|
|
|
this.$service.itemClass.getAllClass().then(res => {
|
|
|
- console.log(res)
|
|
|
this.rightClassList = res.list
|
|
|
this.ptRightName = res.list[0].name
|
|
|
this.ptRightId = res.list[0].id
|
|
|
@@ -411,8 +351,7 @@ export default {
|
|
|
classId: this.ptClassId
|
|
|
}
|
|
|
this.$service.ptItem.list(data).then(res => {
|
|
|
- console.log(res)
|
|
|
- res.list.forEach(item => {
|
|
|
+ res.list.forEach(item => {
|
|
|
item.Uselect = false
|
|
|
item.flag = true
|
|
|
item.price = '0'
|
|
|
@@ -435,8 +374,7 @@ export default {
|
|
|
classId: this.ptRightId
|
|
|
}
|
|
|
this.$service.item.list(data).then(res => {
|
|
|
- console.log(res)
|
|
|
- res.list.forEach(item => {
|
|
|
+ res.list.forEach(item => {
|
|
|
item.select = true
|
|
|
item.uname = item.name
|
|
|
})
|
|
|
@@ -450,15 +388,25 @@ export default {
|
|
|
}).catch(err => { })
|
|
|
},
|
|
|
allSelectItem (e) {
|
|
|
+ this.leftCheckedList = []
|
|
|
if (this.checkedAll) {
|
|
|
this.leftItemList.forEach(item => {
|
|
|
- if (item.select != 1) {
|
|
|
+ if (item.select != 2) {
|
|
|
item.Uselect = true
|
|
|
}
|
|
|
+ if (item.Uselect && item.select !== 2) {
|
|
|
+ this.leftCheckedList.push(item)
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
+ // this.leftItemList.forEach(item => {
|
|
|
+ // if (item.Uselect && item.select !== 1) {
|
|
|
+ // this.leftCheckedList.push(item)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
} else {
|
|
|
this.leftItemList.forEach(item => {
|
|
|
- if (item.select != 1) {
|
|
|
+ if (item.select != 2) {
|
|
|
item.Uselect = false
|
|
|
}
|
|
|
})
|
|
|
@@ -468,9 +416,9 @@ export default {
|
|
|
this.count += 2
|
|
|
},
|
|
|
classTabChange (item, index) {
|
|
|
- if(this.rightItemList.length !== this.rightItemList2.length) {
|
|
|
+ if (this.rightItemList.length !== this.rightItemList2.length) {
|
|
|
this.$confirm('有选中的花材,是否继续切换', '提示', {
|
|
|
- type: 'warning'
|
|
|
+ type: 'warning'
|
|
|
}).then(() => {
|
|
|
this.leftTabCurrent = index
|
|
|
this.ptClassName = item.name
|
|
|
@@ -480,33 +428,41 @@ export default {
|
|
|
this.$message({
|
|
|
type: 'info',
|
|
|
message: '已取消切换'
|
|
|
- });
|
|
|
+ });
|
|
|
});
|
|
|
} else {
|
|
|
this.leftTabCurrent = index
|
|
|
this.ptClassName = item.name
|
|
|
this.ptClassId = item.id
|
|
|
- this.isSelect(item, index)
|
|
|
+ this.pageNum = 1
|
|
|
+ this.getItemList()
|
|
|
}
|
|
|
},
|
|
|
classIfyClick () {
|
|
|
this.pageNum++
|
|
|
- console.log(this.pageNum, this.maxPage)
|
|
|
if (this.maxPage == 1) {
|
|
|
this.getItemList()
|
|
|
}
|
|
|
},
|
|
|
leftSelect (value, index) {
|
|
|
- console.log(this.leftItemList, 'this.leftItemList')
|
|
|
this.leftCheckedList = []
|
|
|
- if (value.select != 1) {
|
|
|
+ let list = []
|
|
|
+ if (value.select != 2) {
|
|
|
this.leftItemList[index].Uselect = !this.leftItemList[index].Uselect
|
|
|
}
|
|
|
this.leftItemList.forEach(item => {
|
|
|
- if (item.Uselect && item.select !== 1) {
|
|
|
+ if (item.Uselect && item.select !== 2) {
|
|
|
this.leftCheckedList.push(item)
|
|
|
}
|
|
|
+ if(item.select !== 2) {
|
|
|
+ list.push(item)
|
|
|
+ }
|
|
|
})
|
|
|
+ if(this.leftCheckedList.length == list.length) {
|
|
|
+ this.checkedAll = true
|
|
|
+ } else {
|
|
|
+ this.checkedAll = false
|
|
|
+ }
|
|
|
},
|
|
|
rightSelect (item, index) {
|
|
|
this.rightCheckedList = []
|
|
|
@@ -520,9 +476,9 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
rightTabClick (item, index) {
|
|
|
- if(this.rightItemList.length !== this.rightItemList2.length) {
|
|
|
+ if (this.rightItemList.length !== this.rightItemList2.length) {
|
|
|
this.$confirm('有选中的花材,是否继续切换', '提示', {
|
|
|
- type: 'warning'
|
|
|
+ type: 'warning'
|
|
|
}).then(() => {
|
|
|
this.rightTabCurrent = index
|
|
|
this.ptRightName = item.name
|
|
|
@@ -532,18 +488,18 @@ export default {
|
|
|
this.$message({
|
|
|
type: 'info',
|
|
|
message: '已取消切换'
|
|
|
- });
|
|
|
+ });
|
|
|
});
|
|
|
} else {
|
|
|
this.rightTabCurrent = index
|
|
|
this.ptRightName = item.name
|
|
|
this.ptRightId = item.id
|
|
|
- this.isSelect()
|
|
|
+ this.pageNum1 = 1
|
|
|
+ this.getRightItemList()
|
|
|
}
|
|
|
},
|
|
|
// 判断是否有选中
|
|
|
- isSelect() {
|
|
|
- console.log(this.rightItemList.length, this.rightItemList2.length)
|
|
|
+ isSelect () {
|
|
|
this.pageNum = 1
|
|
|
this.pageNum1 = 1
|
|
|
this.getRightItemList()
|
|
|
@@ -551,7 +507,6 @@ export default {
|
|
|
},
|
|
|
rightScroll () {
|
|
|
this.pageNum1++
|
|
|
- console.log(this.pageNum1, this.maxPage1)
|
|
|
if (this.maxPage1 == 1) {
|
|
|
this.getRightItemList()
|
|
|
}
|
|
|
@@ -568,6 +523,7 @@ export default {
|
|
|
})
|
|
|
this.rightItemList = [...checkList, ...this.rightItemList]
|
|
|
this.leftCheckedList = []
|
|
|
+ this.checkedAll = false
|
|
|
} else {
|
|
|
this.$message.warning('请先选择花材')
|
|
|
}
|
|
|
@@ -575,14 +531,12 @@ export default {
|
|
|
// 向左移动
|
|
|
turnLsft () {
|
|
|
if (this.rightCheckedList.length !== 0) {
|
|
|
- console.log(this.rightCheckedList)
|
|
|
let checkList = JSON.parse(JSON.stringify(this.rightCheckedList))
|
|
|
checkList.forEach((item, index) => {
|
|
|
- item.select = 2
|
|
|
+ item.select = 1
|
|
|
item.Uselect = false
|
|
|
// this.rightItemList.splice(item, 1);
|
|
|
let i = this.rightItemList.findIndex(val => val.id == item.id)
|
|
|
- console.log(i)
|
|
|
this.rightItemList.splice(i, 1)
|
|
|
})
|
|
|
this.leftItemList = [...checkList, ...this.leftItemList]
|
|
|
@@ -618,10 +572,9 @@ export default {
|
|
|
// 保存
|
|
|
saveBtn () {
|
|
|
let list = [],
|
|
|
- num = 0,
|
|
|
- param = [],
|
|
|
- obj = {}
|
|
|
- console.log(this.rightItemList2, this.rightItemList)
|
|
|
+ num = 0,
|
|
|
+ param = [],
|
|
|
+ obj = {}
|
|
|
// this.rightItemList2.forEach(item => {
|
|
|
// this.rightItemList.forEach((value, index) => {
|
|
|
// if (item.id === value.id) {
|
|
|
@@ -631,11 +584,10 @@ export default {
|
|
|
// })
|
|
|
// })
|
|
|
this.rightItemList.forEach(item => {
|
|
|
- if(item.flag == true) {
|
|
|
+ if (item.flag == true) {
|
|
|
list.push(item)
|
|
|
}
|
|
|
})
|
|
|
- console.log(list)
|
|
|
list.forEach(item => {
|
|
|
obj.itemId = item.id
|
|
|
obj.classId = this.ptRightId
|
|
|
@@ -645,11 +597,9 @@ export default {
|
|
|
obj.name = item.uname
|
|
|
param.push(obj)
|
|
|
})
|
|
|
- console.log(JSON.stringify(param))
|
|
|
- this.$service.item.batchAdd({data: JSON.stringify(param)}).then(res => {
|
|
|
- console.log(res)
|
|
|
+ this.$service.item.batchAdd({ data: JSON.stringify(param) }).then(res => {
|
|
|
this.isSelect()
|
|
|
- }).catch(err => {})
|
|
|
+ }).catch(err => { })
|
|
|
}
|
|
|
},
|
|
|
};
|