|
@@ -4,14 +4,14 @@
|
|
|
<div class="bill-left" v-show="isShow==='home'" key="item">
|
|
|
<div class="bill-tab">
|
|
|
<div class="bill-title">导航</div>
|
|
|
- <side-tree :propConfig="treeConfig" @onChange="onChangeTree" />
|
|
|
+ <side-tree :propConfig="treeConfig" @onChange="onChangeTree" ref="sideTree" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="bill-main" v-show="isShow==='home'" key="item2">
|
|
|
<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
|
|
|
@resert="getDataList" @clickHandle="clickHandle" @detail="getDetail" @onRefresh="onRefresh" />
|
|
|
</div>
|
|
|
- <!-- 新增 -->
|
|
|
+ <!-- 新增/编辑 -->
|
|
|
<div class="detil" v-show="isShow==='add'" key="item3">
|
|
|
<by-tool :propConfig="toolConfig" @clickHandle="insideTools" ref="byTool" />
|
|
|
<div class="box-shadow">
|
|
@@ -92,7 +92,14 @@
|
|
|
<div @click="doComfirm" class="el-button el-button--primary el-button--small">确定</div>
|
|
|
<div @click="isAdd=false" class="el-button el-button--danger el-button--small">取消</div>
|
|
|
</div>
|
|
|
- <div><by-table :propConfig="tableConfig" @onChangeRow="getInputValue" ref="table"></by-table></div>
|
|
|
+ <div>
|
|
|
+ <by-table :propConfig="tableConfig" @onChangeRow="getInputValue" ref="table">
|
|
|
+ <template v-slot:stock="{row}">
|
|
|
+ <vxe-input v-if="!isEdit" v-model="row.stock" size="mini" type="integer"></vxe-input>
|
|
|
+ <span v-else>{{ row.stock }}</span>
|
|
|
+ </template>
|
|
|
+ </by-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -141,11 +148,6 @@
|
|
|
attributeId : any = ''
|
|
|
intercept : any = ''
|
|
|
// tab
|
|
|
- props = {
|
|
|
- label: 'name',
|
|
|
- value: 'id',
|
|
|
- children: 'children'
|
|
|
- }
|
|
|
toolConfig = {
|
|
|
tools: {
|
|
|
return: true,
|
|
@@ -239,15 +241,7 @@
|
|
|
width: '110px',
|
|
|
title: '库存',
|
|
|
field: 'stock',
|
|
|
- slot:true,
|
|
|
- // component: 'by-input',
|
|
|
- // compConfig: {
|
|
|
- // attr: {
|
|
|
- // size: 'mini',
|
|
|
- // placeholder: ' ',
|
|
|
- // type: "integer",
|
|
|
- // },
|
|
|
- // }
|
|
|
+ slot: true,
|
|
|
},
|
|
|
{
|
|
|
width: '120px',
|
|
@@ -393,14 +387,7 @@
|
|
|
width: '80px',
|
|
|
title: '库存',
|
|
|
field: 'stock',
|
|
|
- component: 'by-input',
|
|
|
- compConfig: {
|
|
|
- attr: {
|
|
|
- size: 'mini',
|
|
|
- placeholder: ' ',
|
|
|
- type: "number",
|
|
|
- },
|
|
|
- }
|
|
|
+ slot: true,
|
|
|
},
|
|
|
{
|
|
|
width: '100px',
|
|
@@ -493,15 +480,15 @@
|
|
|
attr: {
|
|
|
size: 'small',
|
|
|
rules: {
|
|
|
- // name: [{
|
|
|
- // required: true, message: '请输入名称', trigger: 'blur'
|
|
|
- // }],
|
|
|
- // basePrice: [{
|
|
|
- // required: true, message: '请输入基本售价', trigger: 'blur'
|
|
|
- // }],
|
|
|
- // categoryName: [{
|
|
|
- // required: true, message: '请输入物料分类', trigger: 'change'
|
|
|
- // }],
|
|
|
+ name: [{
|
|
|
+ required: true, message: '请输入名称', trigger: 'blur'
|
|
|
+ }],
|
|
|
+ basePrice: [{
|
|
|
+ required: true, message: '请输入基本售价', trigger: 'blur'
|
|
|
+ }],
|
|
|
+ categoryName: [{
|
|
|
+ required: true, message: '请输入物料分类', trigger: 'change'
|
|
|
+ }],
|
|
|
}
|
|
|
},
|
|
|
columns: [
|
|
@@ -969,24 +956,26 @@
|
|
|
data.maindataMaterial.attributeList = ""
|
|
|
}
|
|
|
// console.log('data ==> ', data);
|
|
|
- // if (this.isEdit) { // 编辑
|
|
|
- // other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // this.isShow = 'home';
|
|
|
- // this.getDataList();
|
|
|
- // this.$message({ type: 'success', message: res.msg })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // // 新增
|
|
|
- // } else {
|
|
|
- // other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // this.isShow = 'home';
|
|
|
- // this.getDataList();
|
|
|
- // this.$message({ type: 'success', message: res.msg })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
+ if (this.isEdit) { // 编辑
|
|
|
+ other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.isShow = 'home';
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
+ this.getDataList();
|
|
|
+ this.$message.success('保存成功!');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 新增
|
|
|
+ } else {
|
|
|
+ other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.isShow = 'home';
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
+ this.getDataList();
|
|
|
+ this.$message.success('保存成功!');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
});
|
|
|
}
|
|
@@ -1049,16 +1038,7 @@
|
|
|
this.selectValue = '' // 物料属性名称
|
|
|
this.towTable = '' // 表格数据
|
|
|
this.attributeList = []; // 属性规格
|
|
|
- let singleTable = (this as any).$lodash.cloneDeep(this.singleTable);
|
|
|
- singleTable.columns[5] = {
|
|
|
- width: "80px",
|
|
|
- field: "stock",
|
|
|
- title: "库存"
|
|
|
- };
|
|
|
-
|
|
|
- console.log(singleTable.columns);
|
|
|
setTimeout(() => {
|
|
|
- (this as any).$refs.singeTable.setConfig(singleTable); // 设置表格配置
|
|
|
(this as any).$refs.singeTable.setValue(res.data);
|
|
|
}, 0)
|
|
|
} else {
|
|
@@ -1077,17 +1057,8 @@
|
|
|
field: v.field,
|
|
|
})
|
|
|
});
|
|
|
- tableConfig.columns.map((v : any, i : any) => {
|
|
|
- if (v.title == '库存') {
|
|
|
- tableConfig.columns[i] = {
|
|
|
- width: "80px",
|
|
|
- field: "stock",
|
|
|
- title: "库存"
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
this.tableList = (this as any).$lodash.cloneDeep(res.data);
|
|
|
- console.log('表格配置 ==> ', tableConfig);
|
|
|
+ // console.log('表格配置 ==> ', tableConfig);
|
|
|
console.log('skuRuleList ==> ', skuRuleList);
|
|
|
console.log('表格数据 ==> ', this.tableList);
|
|
|
this.setTableConfig = tableConfig;
|
|
@@ -1180,15 +1151,13 @@
|
|
|
let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
|
|
|
let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
|
|
|
let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
|
|
|
- if (this.editInfo) {
|
|
|
- skuRuleList.map((v : any) => {
|
|
|
- v.skuTitle = this.editInfo.name;
|
|
|
- v.skuSubtitle = this.editInfo.shortName;
|
|
|
- })
|
|
|
- }
|
|
|
+ let giveInfo = (this as any).$refs.form.getValue();
|
|
|
skuRuleList.map((v : any, i : any) => {
|
|
|
v.dataIndex = i;
|
|
|
v.isDeleted = 0;
|
|
|
+ v.skuTitle = giveInfo.name;
|
|
|
+ v.skuSubtitle = giveInfo.shortName;
|
|
|
+ v.price = giveInfo.basePrice
|
|
|
})
|
|
|
newColumns.map((v : any) => {
|
|
|
tableConfig.columns.unshift({
|
|
@@ -1207,9 +1176,7 @@
|
|
|
}, 0)
|
|
|
}
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
-
|
|
|
- });
|
|
|
+ }).catch(() => {});
|
|
|
}
|
|
|
// 切换商品规格
|
|
|
changeSingle() {
|
|
@@ -1247,38 +1214,21 @@
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
let inputValue = (this as any).$refs['getValue_' + index][0].getValue();
|
|
|
- if (!inputValue) return this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: '请输入内容'
|
|
|
- });
|
|
|
- if (!/^\S*$/.test(inputValue)) return this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: '输入内容不能有空格'
|
|
|
- });
|
|
|
+ if (!inputValue) return (this as any).$message.warning('请输入内容');
|
|
|
+ if (!/^\S*$/.test(inputValue)) return (this as any).$message.warning('输入内容不能有空格');
|
|
|
if (this.attributeList[index].list.indexOf(inputValue) !== -1) return (this as any).$refs['getValue_' + index][0].clearValue();
|
|
|
if (inputValue) {
|
|
|
this.attributeList[index].list.push(inputValue);
|
|
|
}
|
|
|
(this as any).$refs['getValue_' + index][0].clearValue();
|
|
|
this.generateNow();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '添加成功!'
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消添加'
|
|
|
- });
|
|
|
- });
|
|
|
+ this.$message.success('添加成功!');
|
|
|
+ }).catch(() => this.$message.info('已取消添加'));
|
|
|
}
|
|
|
// 添加sku规格
|
|
|
doComfirm() {
|
|
|
- if (!this.normsValue || !this.norms) return (this as any).$message({ type: "warning", message: '请添加完整的规格!' })
|
|
|
- if (!/^\S*$/.test(this.normsValue) || !/^\S*$/.test(this.norms)) return this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: '输入内容不能有空格'
|
|
|
- });
|
|
|
+ if (!this.normsValue || !this.norms) return (this as any).$message.warning('请添加完整的规格');
|
|
|
+ if (!/^\S*$/.test(this.normsValue) || !/^\S*$/.test(this.norms)) return this.$message.warning('输入内容不能有空格');
|
|
|
this.$confirm('确定添加吗!确定后将可能影响原表格数据', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -1295,16 +1245,8 @@
|
|
|
this.normsValue = '';
|
|
|
this.isAdd = false;
|
|
|
this.generateNow();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '添加成功!'
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消添加'
|
|
|
- });
|
|
|
- });
|
|
|
+ this.$message.success('添加成功!');
|
|
|
+ }).catch(() => this.$message.info('已取消添加'));
|
|
|
}
|
|
|
// 监听表格数据
|
|
|
getInputValue(e : any) {
|
|
@@ -1356,16 +1298,8 @@
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
this.tagsData.splice(index, 1)
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 删除标签
|
|
|
handleClose(tag : any, index : any) {
|
|
@@ -1377,16 +1311,8 @@
|
|
|
}).then(() => {
|
|
|
this.attributeList[index].list.splice(this.attributeList[index].list.indexOf(tag), 1);
|
|
|
this.generateNow();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 删除数组
|
|
|
closeGroup(index : any) {
|
|
@@ -1398,16 +1324,8 @@
|
|
|
}).then(() => {
|
|
|
this.attributeList.splice(index, 1)
|
|
|
this.generateNow();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 删除表格数据
|
|
|
doDeleteTable(item : any) {
|
|
@@ -1425,23 +1343,15 @@
|
|
|
})
|
|
|
let filterList = this.tableList.filter((v : any) => v.isDeleted !== 1);
|
|
|
(this as any).$refs.table.setValue(filterList); // 设置表格数据
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 获取物料属性
|
|
|
getAttribute() {
|
|
|
api.pageList({}, 'maindataMaterialAttribute').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.selectList = res.data.records
|
|
|
- } else this.failHandle(res)
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
}
|
|
|
// 获取列表数据
|
|
@@ -1472,7 +1382,7 @@
|
|
|
total: res.data.total //总条数
|
|
|
};
|
|
|
(this.$refs.moduleView as any).setPage(page)
|
|
|
- } else this.failHandle(res)
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
}
|
|
|
// 工具栏方法
|
|
@@ -1498,20 +1408,13 @@
|
|
|
}).then(() => {
|
|
|
other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
+ this.$message.success('删除成功!');
|
|
|
this.isShow = 'home';
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
this.getDataList();
|
|
|
- } else this.failHandle(res)
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 工具栏删除
|
|
|
doDelete() {
|
|
@@ -1531,19 +1434,12 @@
|
|
|
}).then(() => {
|
|
|
other.deleteSpuAndSku({ ids: ids }, 'maindataMaterial').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
this.getDataList();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- } else this.failHandle(res)
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 操作删除
|
|
|
doDelete2(item : any) {
|
|
@@ -1555,19 +1451,12 @@
|
|
|
}).then(() => {
|
|
|
other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
+ (this as any).$refs.sideTree.request();
|
|
|
this.getDataList();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- } else this.failHandle(res)
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
}
|
|
|
// 刷新
|
|
|
onRefresh() {
|
|
@@ -1594,12 +1483,6 @@
|
|
|
...query
|
|
|
}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
|
|
|
}
|
|
|
- // 运行错误
|
|
|
- failHandle(err : any) {
|
|
|
- let msg = err.msg ? err.msg : '运行错误!';
|
|
|
- this.$message.error(msg)
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|