Commit 282cce2c authored by zhengke's avatar zhengke

修改

parent 787a3940
......@@ -47,7 +47,7 @@
<div class="app-image" :style="{backgroundImage:'url(' + item.CoverImage + ')',backgroundSize:'cover'}">
</div>
<i class="el-icon-error" style="position: absolute;right: -5px;top:-5px;color: #F56C6C;font-size: 20px"
@click="deletecommod(index,1)"></i>
@click="deletecommod(item,index)"></i>
</div>
</div>
</el-form-item>
......@@ -96,7 +96,7 @@
<!--已指定商品类别选择-->
<el-dialog title="已指定商品类别" :visible.sync="category" width="714px">
<div style="height:400px;overflow:auto;">
<el-tree :data="ProductCategoryTreeList" show-checkbox :check-on-click-node="true" default-expand-all
<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>
......@@ -105,32 +105,6 @@
<el-button type="primary" @click="getProductList" size="small">确 定</el-button>
</div>
</el-dialog>
<!--已指定商品选择-->
<el-dialog title="已指定商品" :visible.sync="commodity" width="1024px">
<template>
<button class="el-button el-button--primary el-button--small" style="float: right;"
@click="addcommoditybtn">新增</button>
<el-table :data="commoditylist" style="width: 984px">
<el-table-column prop="Id" label="ID" width="80">
</el-table-column>
<el-table-column label="商品图" width="80">
<template slot-scope="scope">
<img style="width:50px;height:50px;margin-right:1px" :src="scope.row.CoverImage" alt="">
</template>
</el-table-column>
<el-table-column prop="Name" label="商品名称" width="604">
</el-table-column>
<el-table-column prop="address" label="操作">
<template slot-scope="scope">
<div class="cell">
<button type="button" class="el-button el-button--danger el-button--mini is-plain"
@click="deletecommod(scope,2)"><span>删除</span></button>
</div>
</template>
</el-table-column>
</el-table>
</template>
</el-dialog>
<!--选择的商品列表-->
<el-dialog title="添加商品" :visible.sync="addcommodity" width="1024px">
<template>
......@@ -146,8 +120,8 @@
@click="batchAdd">批量添加</button>
</div>
</div>
<el-table v-loading="loading_t" :data="tableData" @selection-change="handleSelectionChange"
style="width: 984px">
<el-table v-loading="loading_t" :data="tableData" ref="dataTable" @selection-change="handleSelectionChange"
style="width: 984px;height:400px;overflow:auto;">
<el-table-column type="selection" width="55">
</el-table-column>
<el-table-column prop="Id" label="ID" width="80">
......@@ -232,7 +206,6 @@
},
ProductCategoryTreeList: [],
checkedkeys: [], //默认选中的
commodity: false,
AppointList: [], //指定商品分类
addcommodity: false,
commoditylist: [], //商品的list
......@@ -312,7 +285,7 @@
});
} else if (val == 2) {
this.checkedkeys = []
this.commodity = true
this.addcommodity = true
}
},
TreeList(val, e) {
......@@ -328,16 +301,21 @@
let ProductList = []
this.checkedkeys = e.checkedKeys;
if (e.checkedNodes.length > 0) {
for (let i = 0; i < e.checkedNodes.length; i++) {
if (e.checkedNodes[i].ChildList.length == 0) {
ProductList.push({
'ProductId': e.checkedNodes[i].Id,
'Name': e.checkedNodes[i].Name
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;
}
}
this.AppointList.push({
ProductId: objList.Id,
Name: objList.Name
})
}
}
})
}
this.AppointList = ProductList
},
//删除对应商品类型
deleteProduct(item, index) {
......@@ -348,24 +326,13 @@
}
}
},
addcommoditybtn() {
this.addcommodity = true;
for (let i = 0; i < this.tableData.length; i++) {
this.tableData[i].disabled = false;
for (let j = 0; j < this.commoditylist.length; j++) {
if (this.commoditylist[j].Id == this.tableData[i].Id) {
this.tableData[i].disabled = true
}
deletecommod(data, index) {
this.tableData.forEach(x=>{
if(data.Id==x.Id){
x.disabled=false
this.commoditylist.splice(index, 1)
}
}
},
deletecommod(data, type) {
if (type == 1) {
this.commoditylist.splice(data, 1)
} else {
this.commoditylist.splice(data.$index, 1)
}
})
},
getProductGoodsPageList() {
this.loading_t = true
......@@ -427,6 +394,7 @@
this.Success('添加成功');
}
this.commoditylist = this.unique(this.commoditylist.concat(newdata))
this.$refs.dataTable.clearSelection()
},
// 数组去重
unique(arr) {
......
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