|
@@ -4,8 +4,6 @@
|
|
<div class="bill-left" v-show="isShow==='home'" key="item">
|
|
<div class="bill-left" v-show="isShow==='home'" key="item">
|
|
<div class="bill-tab">
|
|
<div class="bill-tab">
|
|
<div class="bill-title">导航</div>
|
|
<div class="bill-title">导航</div>
|
|
- <!-- <el-tree :data="data" node-key="id" :default-expanded-keys="expandedKeys" :props="props"
|
|
|
|
- @node-click="handleNodeClick"></el-tree> -->
|
|
|
|
<side-tree :propConfig="treeConfig" @onChange="onChangeTree" />
|
|
<side-tree :propConfig="treeConfig" @onChange="onChangeTree" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -49,7 +47,7 @@
|
|
</template>
|
|
</template>
|
|
<template v-slot:attributeName>
|
|
<template v-slot:attributeName>
|
|
<div v-if="isSingle" key="item4">
|
|
<div v-if="isSingle" key="item4">
|
|
- <by-table :propConfig="singleTable" @onChangeRow="getSingleValue" ref="singeTable"></by-table>
|
|
|
|
|
|
+ <by-table :propConfig="singleTable" @onChangeRow="getInputValue" ref="singeTable"></by-table>
|
|
</div>
|
|
</div>
|
|
<div v-if="!isSingle" key="item5">
|
|
<div v-if="!isSingle" key="item5">
|
|
<el-select :value="selectValue" clearable placeholder="请选择" style="width: 19.5%;"
|
|
<el-select :value="selectValue" clearable placeholder="请选择" style="width: 19.5%;"
|
|
@@ -241,7 +239,7 @@
|
|
attr: {
|
|
attr: {
|
|
size: 'mini',
|
|
size: 'mini',
|
|
placeholder: ' ',
|
|
placeholder: ' ',
|
|
- type: "number",
|
|
|
|
|
|
+ type: "integer",
|
|
},
|
|
},
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -254,7 +252,7 @@
|
|
attr: {
|
|
attr: {
|
|
size: 'mini',
|
|
size: 'mini',
|
|
placeholder: ' ',
|
|
placeholder: ' ',
|
|
- type: "number",
|
|
|
|
|
|
+ type: "integer",
|
|
},
|
|
},
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -489,20 +487,14 @@
|
|
attr: {
|
|
attr: {
|
|
size: 'small',
|
|
size: 'small',
|
|
rules: {
|
|
rules: {
|
|
- name: [{
|
|
|
|
- required: true, message: '请输入名称', trigger: 'blur'
|
|
|
|
- }],
|
|
|
|
- basePrice: [{
|
|
|
|
- required: true, message: '请输入基本售价', trigger: 'blur'
|
|
|
|
- }],
|
|
|
|
- categoryName: [{
|
|
|
|
- required: true, message: '请输入物料分类', trigger: 'change'
|
|
|
|
- }],
|
|
|
|
- // vmCategoryName: [{
|
|
|
|
- // required: true, message: '请输入虚拟分类', trigger: 'change'
|
|
|
|
|
|
+ // name: [{
|
|
|
|
+ // required: true, message: '请输入名称', trigger: 'blur'
|
|
|
|
+ // }],
|
|
|
|
+ // basePrice: [{
|
|
|
|
+ // required: true, message: '请输入基本售价', trigger: 'blur'
|
|
// }],
|
|
// }],
|
|
- // organizationCategoryName: [{
|
|
|
|
- // required: true, message: '请输入机构商品分类', trigger: 'change'
|
|
|
|
|
|
+ // categoryName: [{
|
|
|
|
+ // required: true, message: '请输入物料分类', trigger: 'change'
|
|
// }],
|
|
// }],
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -907,12 +899,30 @@
|
|
let data : any = {}
|
|
let data : any = {}
|
|
// 多规格
|
|
// 多规格
|
|
if (query.materialSpec === 1) {
|
|
if (query.materialSpec === 1) {
|
|
- if (this.tableList.length <= 0 || this.attributeList.length <= 0) return (this as any).$message({ type: 'warning', message: '多规格商品,物料属性不能为空!' });
|
|
|
|
|
|
+ if (this.tableList.length <= 0 || this.attributeList.length <= 0) return (this as any).$message.warning('多规格商品,物料属性不能为空!');
|
|
|
|
+
|
|
|
|
+ console.log('多规格表格数据 ==> ', this.tableList);
|
|
|
|
+ for (let v of this.tableList) {
|
|
|
|
+ if (!v.price) return this.$message.warning('物料价格必填');
|
|
|
|
+ if (parseInt(v.price) <= 0) return this.$message.warning('物料价格不能小于1');
|
|
|
|
+ if (!v.unit) return this.$message.warning('物料单位必填');
|
|
|
|
+ if (!v.stock) return this.$message.warning('物料库存必填');
|
|
|
|
+ if (parseInt(v.stock) <= 0) return this.$message.warning('物料库存必须为自然数');
|
|
|
|
+ if (!v.shelfLife) return this.$message.warning('物料保质期必填');
|
|
|
|
+ if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料保质期必须为自然数');
|
|
|
|
+ if (!v.weight) return this.$message.warning('物料重量必填');
|
|
|
|
+ if (parseInt(v.weight) <= 0) return this.$message.warning('物料重量不能小于1');
|
|
|
|
+ if (!v.length) return this.$message.warning('物料长必填');
|
|
|
|
+ if (parseInt(v.length) <= 0) return this.$message.warning('物料长不能小于1');
|
|
|
|
+ if (!v.width) return this.$message.warning('物料宽必填');
|
|
|
|
+ if (parseInt(v.width) <= 0) return this.$message.warning('物料宽不能小于1');
|
|
|
|
+ if (!v.height) return this.$message.warning('物料高必填');
|
|
|
|
+ if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
|
|
|
|
+ };
|
|
data = { maindataMaterial: query, maindataMaterialSkus: this.tableList }
|
|
data = { maindataMaterial: query, maindataMaterialSkus: this.tableList }
|
|
let newArray : any = []
|
|
let newArray : any = []
|
|
let materialSpecData : any = []
|
|
let materialSpecData : any = []
|
|
let attributeLength = this.attributeList.length
|
|
let attributeLength = this.attributeList.length
|
|
- console.log('表格数据 ==> ', this.tableList);
|
|
|
|
this.tableList.map((v : any) => {
|
|
this.tableList.map((v : any) => {
|
|
for (let kyes in v) {
|
|
for (let kyes in v) {
|
|
if (kyes.indexOf('_field_name') != -1) {
|
|
if (kyes.indexOf('_field_name') != -1) {
|
|
@@ -931,30 +941,47 @@
|
|
})
|
|
})
|
|
} else { // 单规格
|
|
} else { // 单规格
|
|
data = { maindataMaterial: query, maindataMaterialSkus: (this.$refs.singeTable as any).getValue() }
|
|
data = { maindataMaterial: query, maindataMaterialSkus: (this.$refs.singeTable as any).getValue() }
|
|
|
|
+ console.log('单规格表格数据 ==> ', data.maindataMaterialSkus);
|
|
|
|
+ for (let v of data.maindataMaterialSkus) {
|
|
|
|
+ if (!v.price) return this.$message.warning('物料价格必填');
|
|
|
|
+ if (parseInt(v.price) <= 0) return this.$message.warning('物料价格不能小于1');
|
|
|
|
+ if (!v.unit) return this.$message.warning('物料单位必填');
|
|
|
|
+ if (!v.stock) return this.$message.warning('物料库存必填');
|
|
|
|
+ if (parseInt(v.stock) <= 0) return this.$message.warning('物料库存必须为自然数');
|
|
|
|
+ if (!v.shelfLife) return this.$message.warning('物料保质期必填');
|
|
|
|
+ if (parseInt(v.shelfLife) <= 0) return this.$message.warning('物料保质期必须为自然数');
|
|
|
|
+ if (!v.weight) return this.$message.warning('物料重量必填');
|
|
|
|
+ if (parseInt(v.weight) <= 0) return this.$message.warning('物料重量不能小于1');
|
|
|
|
+ if (!v.length) return this.$message.warning('物料长必填');
|
|
|
|
+ if (parseInt(v.length) <= 0) return this.$message.warning('物料长不能小于1');
|
|
|
|
+ if (!v.width) return this.$message.warning('物料宽必填');
|
|
|
|
+ if (parseInt(v.width) <= 0) return this.$message.warning('物料宽不能小于1');
|
|
|
|
+ if (!v.height) return this.$message.warning('物料高必填');
|
|
|
|
+ if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
|
|
|
|
+ };
|
|
data.maindataMaterialSkus[0].isDeleted = 0;
|
|
data.maindataMaterialSkus[0].isDeleted = 0;
|
|
- // data.maindataMaterialSkus[0].skuTitle = query.name;
|
|
|
|
- // data.maindataMaterialSkus[0].skuSubtitle = query.shortName;
|
|
|
|
data.maindataMaterial.attributeList = ""
|
|
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 })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ // 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 })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+
|
|
});
|
|
});
|
|
}
|
|
}
|
|
// 新增
|
|
// 新增
|
|
@@ -965,6 +992,7 @@
|
|
this.textarea = '' // 描述
|
|
this.textarea = '' // 描述
|
|
this.tagsData = [] // 标签
|
|
this.tagsData = [] // 标签
|
|
this.attributeList = [] // 属性规格
|
|
this.attributeList = [] // 属性规格
|
|
|
|
+ this.tableList = [] // 表格数据
|
|
this.materialSpec = 0; // 单规格
|
|
this.materialSpec = 0; // 单规格
|
|
this.isSingle = true; // 显示单表格
|
|
this.isSingle = true; // 显示单表格
|
|
this.isEdit = false; // 是否编辑
|
|
this.isEdit = false; // 是否编辑
|
|
@@ -1015,7 +1043,18 @@
|
|
this.selectValue = '' // 物料属性名称
|
|
this.selectValue = '' // 物料属性名称
|
|
this.towTable = '' // 表格数据
|
|
this.towTable = '' // 表格数据
|
|
this.attributeList = []; // 属性规格
|
|
this.attributeList = []; // 属性规格
|
|
- (this as any).$refs.singeTable.setValue(res.data);
|
|
|
|
|
|
+ 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 {
|
|
} else {
|
|
this.forFun(this.attributeList[0], 0) // 生成sku
|
|
this.forFun(this.attributeList[0], 0) // 生成sku
|
|
let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
|
|
let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
|
|
@@ -1024,7 +1063,7 @@
|
|
res.data.map((v : any, i : any) => {
|
|
res.data.map((v : any, i : any) => {
|
|
v = Object.assign(v, skuRuleList[i])
|
|
v = Object.assign(v, skuRuleList[i])
|
|
v.dataIndex = i
|
|
v.dataIndex = i
|
|
- })
|
|
|
|
|
|
+ });
|
|
newColumns.map((v : any) => {
|
|
newColumns.map((v : any) => {
|
|
tableConfig.columns.unshift({
|
|
tableConfig.columns.unshift({
|
|
width: '80px',
|
|
width: '80px',
|
|
@@ -1032,8 +1071,17 @@
|
|
field: v.field,
|
|
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);
|
|
this.tableList = (this as any).$lodash.cloneDeep(res.data);
|
|
- // console.log('表格配置 ==> ', tableConfig);
|
|
|
|
|
|
+ console.log('表格配置 ==> ', tableConfig);
|
|
console.log('skuRuleList ==> ', skuRuleList);
|
|
console.log('skuRuleList ==> ', skuRuleList);
|
|
console.log('表格数据 ==> ', this.tableList);
|
|
console.log('表格数据 ==> ', this.tableList);
|
|
this.setTableConfig = tableConfig;
|
|
this.setTableConfig = tableConfig;
|
|
@@ -1252,15 +1300,12 @@
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- // 监听单表格数据
|
|
|
|
- getSingleValue(e : any) {
|
|
|
|
- // console.log('监听单表格 ==> ', e);
|
|
|
|
- e.volume = (e.length * e.width * e.height).toFixed(2);
|
|
|
|
- }
|
|
|
|
// 监听表格数据
|
|
// 监听表格数据
|
|
getInputValue(e : any) {
|
|
getInputValue(e : any) {
|
|
// console.log('监听表格 ==> ', e);
|
|
// console.log('监听表格 ==> ', e);
|
|
- e.volume = (e.length * e.width * e.height).toFixed(2);
|
|
|
|
|
|
+ if (e.length && e.width && e.height) {
|
|
|
|
+ e.volume = (e.length * e.width * e.height).toFixed(2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// 排序生成
|
|
// 排序生成
|
|
forFun(data : any, i : number, v ?: any) {
|
|
forFun(data : any, i : number, v ?: any) {
|