Commit 29f23935 authored by zhengke's avatar zhengke

修改

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