Commit 29f23935 authored by zhengke's avatar zhengke

修改

parent 282cce2c
......@@ -96,8 +96,9 @@
<!--已指定商品类别选择-->
<el-dialog title="已指定商品类别" :visible.sync="category" width="714px">
<div style="height:400px;overflow:auto;">
<el-tree :data="ProductCategoryTreeList" show-checkbox :check-strictly="true" :check-on-click-node="true" default-expand-all
node-key="Id" ref="tree" :default-checked-keys="checkedkeys" @check="TreeList" :props="defaultProps">
<el-tree :data="ProductCategoryTreeList" show-checkbox :check-strictly="true" :check-on-click-node="true"
default-expand-all node-key="Id" ref="tree" :default-checked-keys="checkedkeys" @check="TreeList"
:props="defaultProps">
</el-tree>
</div>
<div slot="footer" class="dialog-footer">
......@@ -301,11 +302,11 @@
let ProductList = []
this.checkedkeys = e.checkedKeys;
if (e.checkedNodes.length > 0) {
this.checkedkeys.forEach(x=>{
var objList = this.getObjById(this.ProductCategoryTreeList,x);
if(objList){
for(var i=0;i<this.AppointList.length;i++){
if(this.AppointList[i].ProductId==objList.Id){
this.checkedkeys.forEach(x => {
var objList = this.getObjById(this.ProductCategoryTreeList, x);
if (objList) {
for (var i = 0; i < this.AppointList.length; i++) {
if (this.AppointList[i].ProductId == objList.Id) {
return;
}
}
......@@ -327,9 +328,9 @@
}
},
deletecommod(data, index) {
this.tableData.forEach(x=>{
if(data.Id==x.Id){
x.disabled=false
this.tableData.forEach(x => {
if (data.Id == x.Id) {
x.disabled = false
this.commoditylist.splice(index, 1)
}
})
......@@ -339,16 +340,7 @@
this.apipost("/api/OSGoods/GetOfflineGoodsPageList", this.msg2, res => {
this.loading_t = false;
if (res.data.resultCode == 1) {
let pageData = res.data.data.pageData;
for (let i = 0; i < pageData.length; i++) {
pageData[i].disabled = false;
this.commoditylist.forEach(x => {
if (pageData[i].Id == x.Id) {
pageData[i].disabled = true;
}
})
}
this.tableData = pageData
this.tableData = res.data.data.pageData
this.count = res.data.data.count
}
})
......@@ -505,44 +497,39 @@
this.getProductCategoryTreeList();
for (let i = 0; i < ProductList.length; i++) {
this.checkedkeys.push(ProductList[i].ProductId)
var objList = this.getObjById(this.ProductCategoryTreeList,ProductList[i].ProductId);
if(objList){
var objList = this.getObjById(this.ProductCategoryTreeList, ProductList[i].ProductId);
if (objList) {
this.AppointList.push({
ProductId:objList.Id,
Name:objList.Name
ProductId: objList.Id,
Name: objList.Name
})
}
}
}
if (res.data.data.ServiceType == 2) {
let ProductList = res.data.data.ProductList;
let newData = []
for (let i = 0; i < ProductList.length; i++) {
this.apipost("/api/product/GetProductGoodsPageList", {
pageIndex: 1,
pageSize: 15,
Name: '',
GoodsStatus: 0,
IsSelectSellOut: 0,
CategoryIds: '',
Id: ProductList[i].ProductId,
StartTime: '',
EndTime: '',
}, res => {
if (res.data.resultCode == 1) {
let pageData = res.data.data.pageData;
newData.push(pageData[0])
}
this.commoditylist = [];
var myTable = [];
this.apipost("/api/OSGoods/GetOfflineGoodsPageList", this.msg2, res => {
if (res.data.resultCode == 1) {
myTable = res.data.data.pageData;
}
myTable.forEach(x => {
this.addMsg.ProductList.forEach(y => {
if (y.ProductId == x.Id) {
this.commoditylist.push(x);
x.disabled=true;
}
})
})
}
this.commoditylist = newData
this.tableData = myTable;
})
}
} else {
this.Error(res.data.message);
}
})
},
getObjById(list,id) {
getObjById(list, id) {
if (!list instanceof Array) {
return null
}
......@@ -554,7 +541,7 @@
} else {
//查不到继续遍历
if (item.ChildList) {
let value = this.getObjById(item.ChildList,id)
let value = this.getObjById(item.ChildList, id)
//查询到直接返回
if (value) {
return value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment