|
@@ -116,7 +116,6 @@
|
|
|
import ForTab from "@/components/ForTab/index.vue";
|
|
|
@Component({ components: { ForTab } })
|
|
|
export default class productManagement extends Vue {
|
|
|
- loading : any = null
|
|
|
tagsData : any = [] // 标签值
|
|
|
isShow = 'home'
|
|
|
isEdit = true
|
|
@@ -124,8 +123,6 @@
|
|
|
isSingle : any = true
|
|
|
timeNum = 0;
|
|
|
timer : any = null
|
|
|
- data : any = []
|
|
|
- expandedKeys : any = []
|
|
|
materialSpec : any = 0
|
|
|
status : any = 0
|
|
|
ismakeup : any = 0
|
|
@@ -864,6 +861,7 @@
|
|
|
//点击树获取数据
|
|
|
onChangeTree(e : any) {
|
|
|
this.categoryIds = e.id;
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
api.byCategoryPage({ categoryId: e.id }, 'maindataMaterialCategory').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
(this.$refs.moduleView as any).setTableValue(res.data.records);
|
|
@@ -872,7 +870,8 @@
|
|
|
pageSize: res.data.size, //每页条数
|
|
|
total: res.data.total //总条数
|
|
|
};
|
|
|
- (this.$refs.moduleView as any).setPage(page)
|
|
|
+ (this.$refs.moduleView as any).setPage(page);
|
|
|
+ loading.close();
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -979,7 +978,7 @@
|
|
|
|
|
|
});
|
|
|
}
|
|
|
- // 新增
|
|
|
+ // 打开新增
|
|
|
onAdd() {
|
|
|
this.isShow = 'add'; // 展示类型
|
|
|
this.selectValue = '' // 物料属性名称
|
|
@@ -989,91 +988,96 @@
|
|
|
this.attributeList = [] // 属性规格
|
|
|
this.tableList = [] // 表格数据
|
|
|
this.materialSpec = 0; // 单规格
|
|
|
+ this.status = 0; // 物料状态
|
|
|
+ this.ismakeup = 0; // 商品组合
|
|
|
+ this.issued = 0; // 是否公布
|
|
|
this.isSingle = true; // 显示单表格
|
|
|
this.isEdit = false; // 是否编辑
|
|
|
(this as any).$refs.byTool.setTool({ return: true, save: true });
|
|
|
- setTimeout(() => {
|
|
|
+ this.$nextTick(() => {
|
|
|
(this as any).$refs.form.setValue(); // 设置表单数据
|
|
|
(this as any).$refs.singeTable.setValue([{}]) // 设置单表格数据
|
|
|
- }, 0)
|
|
|
+ });
|
|
|
}
|
|
|
- // 编辑
|
|
|
+ // 打开编辑
|
|
|
getDetail(e : any) {
|
|
|
console.log('编辑 ==> ', e);
|
|
|
(this as any).$refs.byTool.setTool({ return: true, save: true, delete: true });
|
|
|
- this.loading = this.$loading({ target: '.my-container' });
|
|
|
- // api.single({id:e.id},'maindataMaterial').then((res:any) => {})
|
|
|
- api.single({ id: e.vmCategoryId }, 'maindataMaterialVmcategory').then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- if (res.data) e.vmCategoryName = res.data.name;
|
|
|
- }
|
|
|
- });
|
|
|
- api.single({ id: e.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- if (res.data) e.organizationCategoryName = res.data.name;
|
|
|
- }
|
|
|
- });
|
|
|
- api.single({ id: e.categoryId }, 'maindataMaterialCategory').then((res : any) => {
|
|
|
- if (res.code === 200) e.categoryName = res.data.name;
|
|
|
- if (e.attributeId) {
|
|
|
- api.single({ id: e.attributeId }, 'maindataMaterialAttribute').then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- if (res.data) this.selectValue = res.data.name
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- this.intercept = e.attributeId // 拦截物料属性判断
|
|
|
- this.isEdit = true;
|
|
|
- this.editInfo = e;
|
|
|
- this.isShow = 'add';
|
|
|
- // 标签
|
|
|
- if (e.tags) {
|
|
|
- this.tagsData = e.tags.split(",")
|
|
|
- } else this.tagsData = [];
|
|
|
- this.materialSpec = e.materialSpec
|
|
|
- this.isSingle = e.materialSpec === 0 ? true : false;
|
|
|
- if (e.attributeList) this.attributeList = JSON.parse(e.attributeList);
|
|
|
- other.selectByMaterialId({ id: e.id }, 'maindataMaterialSku').then((res : any) => {
|
|
|
+ let loading = this.$loading({ target: '.my-container' });
|
|
|
+ api.single({ id: e.id }, 'maindataMaterial').then((v : any) => {
|
|
|
+ let data = v.data;
|
|
|
+ api.single({ id: data.vmCategoryId }, 'maindataMaterialVmcategory').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.status = e.status
|
|
|
- this.ismakeup = e.ismakeup
|
|
|
- this.issued = e.issued
|
|
|
- if (this.isSingle) {
|
|
|
- this.selectValue = '' // 物料属性名称
|
|
|
- this.towTable = '' // 表格数据
|
|
|
- this.attributeList = []; // 属性规格
|
|
|
- setTimeout(() => {
|
|
|
- (this as any).$refs.singeTable.setValue(res.data);
|
|
|
- }, 0)
|
|
|
- } else {
|
|
|
- this.forFun(this.attributeList[0], 0) // 生成sku
|
|
|
- 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();
|
|
|
- res.data.map((v : any, i : any) => {
|
|
|
- v = Object.assign(v, skuRuleList[i])
|
|
|
- v.dataIndex = i
|
|
|
- });
|
|
|
- newColumns.map((v : any) => {
|
|
|
- tableConfig.columns.unshift({
|
|
|
- width: '80px',
|
|
|
- title: v.title,
|
|
|
- field: v.field,
|
|
|
- })
|
|
|
- });
|
|
|
- this.tableList = (this as any).$lodash.cloneDeep(res.data);
|
|
|
- // console.log('表格配置 ==> ', tableConfig);
|
|
|
- console.log('skuRuleList ==> ', skuRuleList);
|
|
|
- console.log('表格数据 ==> ', this.tableList);
|
|
|
- this.setTableConfig = tableConfig;
|
|
|
- setTimeout(() => {
|
|
|
- (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
|
|
|
- (this as any).$refs.table.setValue(this.tableList) // 设置表格数据
|
|
|
- }, 300)
|
|
|
- }
|
|
|
+ if (res.data) data.vmCategoryName = res.data.name;
|
|
|
}
|
|
|
- (this as any).$refs.form.setValue(e)
|
|
|
- this.loading.close()
|
|
|
+ });
|
|
|
+ api.single({ id: data.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data) data.organizationCategoryName = res.data.name;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ api.single({ id: data.categoryId }, 'maindataMaterialCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) data.categoryName = res.data.name;
|
|
|
+ if (data.attributeId) {
|
|
|
+ api.single({ id: data.attributeId }, 'maindataMaterialAttribute').then((p : any) => {
|
|
|
+ if (p.code === 200) {
|
|
|
+ if (p.data) this.selectValue = p.data.name
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.intercept = data.attributeId // 拦截物料属性判断
|
|
|
+ this.isEdit = true;
|
|
|
+ this.editInfo = data;
|
|
|
+ this.isShow = 'add';
|
|
|
+ // 标签
|
|
|
+ if (data.tags) {
|
|
|
+ this.tagsData = data.tags.split(",")
|
|
|
+ } else this.tagsData = [];
|
|
|
+ this.materialSpec = data.materialSpec
|
|
|
+ this.isSingle = data.materialSpec === 0 ? true : false;
|
|
|
+ if (data.attributeList) this.attributeList = JSON.parse(data.attributeList);
|
|
|
+ other.selectByMaterialId({ id: data.id }, 'maindataMaterialSku').then((info : any) => {
|
|
|
+ if (info.code === 200) {
|
|
|
+ this.status = data.status
|
|
|
+ this.ismakeup = data.ismakeup
|
|
|
+ this.issued = data.issued
|
|
|
+ if (this.isSingle) {
|
|
|
+ this.selectValue = '' // 物料属性名称
|
|
|
+ this.towTable = '' // 表格数据
|
|
|
+ this.attributeList = []; // 属性规格
|
|
|
+ this.$nextTick(() => {
|
|
|
+ (this as any).$refs.singeTable.setValue(info.data);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.forFun(this.attributeList[0], 0) // 生成sku
|
|
|
+ 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();
|
|
|
+ info.data.map((v : any, i : any) => {
|
|
|
+ v = Object.assign(v, skuRuleList[i])
|
|
|
+ v.dataIndex = i
|
|
|
+ });
|
|
|
+ newColumns.map((v : any) => {
|
|
|
+ tableConfig.columns.unshift({
|
|
|
+ width: '80px',
|
|
|
+ title: v.title,
|
|
|
+ field: v.field,
|
|
|
+ })
|
|
|
+ });
|
|
|
+ this.tableList = (this as any).$lodash.cloneDeep(info.data);
|
|
|
+ // console.log('表格配置 ==> ', tableConfig);
|
|
|
+ console.log('skuRuleList ==> ', skuRuleList);
|
|
|
+ console.log('表格数据 ==> ', this.tableList);
|
|
|
+ this.setTableConfig = tableConfig;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ (this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
|
|
|
+ (this as any).$refs.table.setValue(this.tableList) // 设置表格数据
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ (this as any).$refs.form.setValue(data)
|
|
|
+ loading.close()
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -1126,10 +1130,10 @@
|
|
|
console.log('新表格数据 ==> ', skuRuleList);
|
|
|
this.tableList = skuRuleList;
|
|
|
this.setTableConfig = tableConfig;
|
|
|
- setTimeout(() => {
|
|
|
+ this.$nextTick(() => {
|
|
|
(this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
|
|
|
(this as any).$refs.table.setValue(this.tableList); // 设置表格数据
|
|
|
- }, 0)
|
|
|
+ });
|
|
|
}
|
|
|
// 更换物料属性数据
|
|
|
getSelectValue(e : any) {
|
|
@@ -1174,10 +1178,10 @@
|
|
|
console.log('表格数据 ==> ', skuRuleList);
|
|
|
this.setTableConfig = tableConfig;
|
|
|
this.tableList = skuRuleList;
|
|
|
- setTimeout(() => {
|
|
|
+ this.$nextTick(() => {
|
|
|
(this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
|
|
|
(this as any).$refs.table.setValue(skuRuleList); // 设置表格数据
|
|
|
- }, 0)
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
}).catch(() => { });
|
|
@@ -1186,8 +1190,8 @@
|
|
|
changeSingle() {
|
|
|
if (this.isSingle) {
|
|
|
if ((this as any).$refs.singeTable) this.singeTable = (this as any).$refs.singeTable.getValue()
|
|
|
- this.isSingle = false
|
|
|
- setTimeout(() => {
|
|
|
+ this.isSingle = false;
|
|
|
+ this.$nextTick(() => {
|
|
|
// 设置表格数据
|
|
|
if (this.towTable) {
|
|
|
if ((this as any).$refs.table) {
|
|
@@ -1196,17 +1200,17 @@
|
|
|
(this as any).$refs.table.setValue(this.towTable); // 设置表格数据
|
|
|
}
|
|
|
}
|
|
|
- }, 0)
|
|
|
+ });
|
|
|
} else {
|
|
|
if ((this as any).$refs.table) this.towTable = (this as any).$refs.table.getValue()
|
|
|
this.isSingle = true;
|
|
|
- setTimeout(() => {
|
|
|
+ this.$nextTick(() => {
|
|
|
// 设置单表格数据
|
|
|
if (this.singeTable) {
|
|
|
console.log('单表格数据 ==> ', this.singeTable);
|
|
|
(this as any).$refs.singeTable.setValue(this.singeTable);
|
|
|
} else (this as any).$refs.singeTable.setValue([{}]);
|
|
|
- }, 0)
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
// 添加规格
|