mirror of
https://gitee.com/victor123/jjjerp-java.git
synced 2025-12-06 17:19:14 +08:00
bug修复
This commit is contained in:
parent
39f8e195e8
commit
c5f6d0f0c4
@ -6,10 +6,11 @@
|
||||
>
|
||||
<div class="d-b-c search-box">
|
||||
<el-input
|
||||
@change="searchFunc"
|
||||
@blur="searchFunc"
|
||||
prefix-icon="Search"
|
||||
v-model="search"
|
||||
placeholder="搜索商品分类"
|
||||
clearable
|
||||
/>
|
||||
<el-button
|
||||
@click.stop="cahngeFunc('add')"
|
||||
@ -22,14 +23,14 @@
|
||||
style="max-width: 600px"
|
||||
:data="data"
|
||||
:props="defaultProps"
|
||||
default-expand-all
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<span class="custom-tree-node">
|
||||
<span class="name icon iconfont icon-wenjian"></span>
|
||||
<!-- <span class="name icon iconfont icon-yemian"></span> -->
|
||||
<span>{{ node.label }}</span>
|
||||
<span class="hover-icons">
|
||||
<span v-if="!data.isRoot" class="hover-icons">
|
||||
<el-icon @click.stop="cahngeFunc('edit', node.data)">
|
||||
<Edit />
|
||||
</el-icon>
|
||||
@ -75,7 +76,9 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
created() {
|
||||
console.log(this.$props.data, "data");
|
||||
},
|
||||
methods: {
|
||||
searchFunc(e) {
|
||||
this.$emit("search", this.search);
|
||||
|
||||
@ -29,18 +29,12 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单位" prop="unitId" :label-width="formLabelWidth">
|
||||
<!-- <el-input
|
||||
v-model="form.name"
|
||||
v-if="!form.multiUnit"
|
||||
autocomplete="off"
|
||||
></el-input> -->
|
||||
|
||||
<el-select v-model="form.unitId" placeholder="请选择">
|
||||
<el-option v-for="(item, index) in unitList" :key="index" :label="item.name"
|
||||
:value="item.basicUnitId" />
|
||||
</el-select>
|
||||
<!-- <el-checkbox v-model="form.multiUnit" @change="handleUnitChange"
|
||||
>多单位</el-checkbox
|
||||
> -->
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@ -129,90 +123,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="单规格" prop="" :label-width="formLabelWidth">
|
||||
<el-checkbox v-model="showSku"></el-checkbox>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="!showSku">
|
||||
<el-form-item label="多规格" prop="" :label-width="formLabelWidth">
|
||||
<el-select
|
||||
v-model="value1"
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
multipl
|
||||
:multiple-limit="3"
|
||||
style="width: 260px; margin-right: 16px; vertical-align: middle"
|
||||
@change="handleSpecChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in options"
|
||||
:key="index"
|
||||
:label="item.attributeName"
|
||||
:value="index"
|
||||
:disabled="item.disabled"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col v-if="manySkuSelected >= 1" :span="12">
|
||||
<el-form-item :label="skuOneTitle" :label-width="formLabelWidth">
|
||||
<el-select
|
||||
v-model="form.skuOne"
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
@change="onSkuChange"
|
||||
@remove-tag="onSkuOneDeSelect"
|
||||
style="width: 240px; margin-right: 16px; vertical-align: middle"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in skuOneList"
|
||||
:label="item"
|
||||
:key="index"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="manySkuSelected >= 2" :span="12">
|
||||
<el-form-item :label="skuTwoTitle" :label-width="formLabelWidth">
|
||||
<el-select
|
||||
v-model="form.skuTwo"
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
@change="onSkuChange"
|
||||
@remove-tag="onSkuOneDeSelect"
|
||||
style="width: 240px; margin-right: 16px; vertical-align: middle"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in skuTwoList"
|
||||
:label="item"
|
||||
:key="index"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="manySkuSelected >= 3" :span="8">
|
||||
<el-form-item :label="skuThreeTitle" :label-width="formLabelWidth">
|
||||
<el-select
|
||||
v-model="form.skuThree"
|
||||
multiple
|
||||
placeholder="请选择"
|
||||
@change="onSkuChange"
|
||||
@remove-tag="onSkuOneDeSelect"
|
||||
style="width: 240px; margin-right: 16px; vertical-align: middle"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in skuThreeList"
|
||||
:label="item"
|
||||
:key="index"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark" :label-width="formLabelWidth">
|
||||
<el-input v-model="form.remark" type="textarea" autocomplete="off"></el-input>
|
||||
@ -220,36 +130,8 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- <div class="btns">
|
||||
<el-button class="thebtn1" @click="handleButtonClick">批发价-批量</el-button>
|
||||
<el-button class="thebtn1" @click="handleButtonClick">进价-批量</el-button>
|
||||
<el-button class="thebtn1" @click="handleButtonClick">吊牌价-批量</el-button>
|
||||
<el-button class="thebtn1" @click="handleButtonClick">标准售价-批量</el-button>
|
||||
</div> -->
|
||||
<el-table :data="form.options" border style="margin-top: 6px">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<!-- <el-table-column prop="#" label="编号">
|
||||
<template #default="{ $index }">
|
||||
{{ handNum($index) }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column label="操作" width="80">
|
||||
<template #default="{ $index }">
|
||||
<div class="lineH-1">
|
||||
<el-icon
|
||||
class="c-p"
|
||||
style="margin-right: 8px"
|
||||
:size="20"
|
||||
@click="addOptions"
|
||||
>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
<el-icon class="c-p" :size="20" @click="removeOptions($index)">
|
||||
<Minus />
|
||||
</el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column prop="#" label="编码">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.productCode" label="" disabled />
|
||||
@ -260,11 +142,6 @@
|
||||
<el-input v-model="row.barCode" label="条码" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="单位">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.description" label="单位" />
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="多属性">
|
||||
<template #default="{ row }">
|
||||
<el-input disabled v-model="row.sku" label="多属性" />
|
||||
@ -487,24 +364,6 @@
|
||||
})
|
||||
.catch((error) => {});
|
||||
},
|
||||
// productGetMaxProductCode() {
|
||||
// let self = this;
|
||||
// ProductApi.productGetMaxProductCode()
|
||||
// .then((res) => {})
|
||||
// .catch((error) => {});
|
||||
// },
|
||||
// productToAdd() {
|
||||
// let self = this;
|
||||
// ProductApi.productToAdd()
|
||||
// .then((res) => {
|
||||
// self.options = res.data.attribute;
|
||||
// self.unitList= res.data.unit;
|
||||
// self.mfrsList=res.data.mfrs;
|
||||
// self.categoryList=res.data.category;
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// });
|
||||
// },
|
||||
someFunctionToGetIndex(skuType) {
|
||||
if (skuType == "skuOne") {
|
||||
return 0; // 返回 skuOne 对应的索引值
|
||||
@ -522,71 +381,6 @@
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
},
|
||||
// onSkuChange() {
|
||||
// this.autoSkuList();
|
||||
// },
|
||||
// onSkuOneDeSelect(value) {
|
||||
// this.removeByVal(this.form.skuOne, value);
|
||||
// this.autoSkuList();
|
||||
// },
|
||||
// onSkuTwoDeSelect(value) {
|
||||
// this.removeByVal(this.form.skuTwo, value);
|
||||
// this.autoSkuList();
|
||||
// },
|
||||
// onSkuThreeDeSelect(value) {
|
||||
// this.removeByVal(this.form.skuThree, value);
|
||||
// this.autoSkuList();
|
||||
// },
|
||||
// autoSkuList() {
|
||||
// let skuOneData = this.form.skuOne;
|
||||
// let skuTwoData = this.form.skuTwo;
|
||||
// let skuThreeData = this.form.skuThree;
|
||||
// // 清空现有的商品表格数据
|
||||
// let meTableData = [];
|
||||
// let currentBarCode = localStorage.getItem("firstBarCode");
|
||||
// // 计算可能的组合,并生成商品表格数据
|
||||
// skuOneData.forEach((sku1) => {
|
||||
// if (skuTwoData.length) {
|
||||
// skuTwoData.forEach((sku2) => {
|
||||
// if (skuThreeData.length) {
|
||||
// skuThreeData.forEach((sku3) => {
|
||||
// // 生成新的商品数据对象
|
||||
// let newData = {
|
||||
// sku: `${sku1}/${sku2}/${sku3}`, // 多属性字段值
|
||||
// productCode: currentBarCode,
|
||||
// };
|
||||
// // 将新的商品数据对象添加到商品表格数据数组中
|
||||
// meTableData.push(newData);
|
||||
// currentBarCode++;
|
||||
// });
|
||||
// } else {
|
||||
// // 生成新的商品数据对象(无第三个属性)
|
||||
// let newData = {
|
||||
// sku: `${sku1}/${sku2}`, // 多属性字段值
|
||||
// productCode: currentBarCode,
|
||||
// // 其他字段值根据需要添加
|
||||
// };
|
||||
// // 将新的商品数据对象添加到商品表格数据数组中
|
||||
// meTableData.push(newData);
|
||||
// currentBarCode++;
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// // 生成新的商品数据对象(无第二、第三个属性)
|
||||
// let newData = {
|
||||
// sku: `${sku1}`, // 多属性字段值
|
||||
// productCode: currentBarCode,
|
||||
// };
|
||||
// // 将新的商品数据对象添加到商品表格数据数组中
|
||||
// meTableData.push(newData);
|
||||
// currentBarCode++;
|
||||
// }
|
||||
// });
|
||||
|
||||
// // 更新组件中的商品表格数据源
|
||||
// this.form.options = meTableData;
|
||||
// console.log(this.form.options, "option");
|
||||
// },
|
||||
deleteImg(index) {
|
||||
this.form.image.splice(index, 1);
|
||||
},
|
||||
@ -706,35 +500,6 @@
|
||||
let currentBarCode = localStorage.getItem("firstBarCode") || 1000;
|
||||
return parseInt(currentBarCode) + index;
|
||||
},
|
||||
// handleSpecChange(value) {
|
||||
// this.manySkuSelected = value.length;
|
||||
// console.log(this.manySkuSelected, "manySkuSelected");
|
||||
// this.form.skuOne = [];
|
||||
// this.form.skuTwo = [];
|
||||
// this.form.skuThree = [];
|
||||
// if (value.length <= 3) {
|
||||
// let skuOneId = value[0];
|
||||
// let skuTwoId = value[1];
|
||||
// let skuThreeId = value[2];
|
||||
// console.log(skuOneId, "skuOneId");
|
||||
// this.options.forEach((item, index) => {
|
||||
// console.log(item, "index");
|
||||
// if (index == skuOneId) {
|
||||
// this.skuOneTitle = item.attributeName;
|
||||
// this.skuOneList = this.options[index].valueList;
|
||||
// }
|
||||
// if (index == skuTwoId) {
|
||||
// this.skuTwoTitle = item.attributeName;
|
||||
// this.skuTwoList = this.options[index].valueList;
|
||||
// }
|
||||
// if (index == skuThreeId) {
|
||||
// this.skuThreeTitle = item.attributeName;
|
||||
// this.skuThreeList = this.options[index].valueList;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// this.form.options = [];
|
||||
// },
|
||||
handleUnitChange() {
|
||||
if (this.form.multiUnit) {
|
||||
// 如果勾选了多单位,将输入框改为选择框
|
||||
@ -751,18 +516,15 @@
|
||||
/*添加用户*/
|
||||
addUser() {
|
||||
let self = this;
|
||||
// if(!self.form.skuList){
|
||||
// ElMessage.error("属性不能为空");
|
||||
// return;
|
||||
// }
|
||||
let params = self.form;
|
||||
self.editOpen = true;
|
||||
|
||||
console.log(params, "params");
|
||||
self.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
self.editOpen = true;
|
||||
self.loading = true;
|
||||
params.skuList = params.options;
|
||||
ProductApi.productAdd(params)
|
||||
ProductApi.productAdd(params,true)
|
||||
.then((data) => {
|
||||
self.loading = false;
|
||||
ElMessage({
|
||||
@ -776,9 +538,7 @@
|
||||
self.loading = false;
|
||||
self.editOpen = false;
|
||||
});
|
||||
} else {
|
||||
self.editOpen = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -820,13 +580,6 @@
|
||||
this.isProductUpload = false;
|
||||
console.log(this.form.image, "this.form.image ");
|
||||
},
|
||||
// returnImgsFunc(e) {
|
||||
// if (e != null && e.length > 0) {
|
||||
// this.filePath = e[0].filePath;
|
||||
// this.form.imageId = e[0].fileId;
|
||||
// }
|
||||
// this.isProductUpload = false;
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -308,11 +308,6 @@
|
||||
<el-input v-model="row.barCode" label="条码" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="单位">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.description" label="单位" />
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="多属性">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.sku" label="多属性" disabled />
|
||||
@ -359,27 +354,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="imageUrl" label="图片" width="150">
|
||||
<template #default="{ row }">
|
||||
<div class="draggable-list">
|
||||
<div
|
||||
v-if="row.imageUrl == ''"
|
||||
@click="openProductUpload('image', 'sku')"
|
||||
>
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div
|
||||
v-if="row.imageUrl != ''"
|
||||
class="item"
|
||||
@click="openProductUpload('image', 'sku')"
|
||||
>
|
||||
<img :src="row.imageUrl" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div v-show="activeTab === 'image'">
|
||||
@ -526,11 +500,11 @@ export default {
|
||||
this.dialogVisible = this.open_edit;
|
||||
if (this.dialogVisible) {
|
||||
console.log(this.dialogVisible, "this.form");
|
||||
this.$nextTick(() => {
|
||||
this.$nextTick(async () => {
|
||||
this.form = this.editform;
|
||||
this.productToAdd();
|
||||
if (this.copy) {
|
||||
this.productGetMaxProductCode();
|
||||
await this.productGetMaxProductCode();
|
||||
this.form.productCode = "";
|
||||
let firstBarCode = parseInt(localStorage.getItem("firstBarCode"), 10);
|
||||
this.form.skuList.forEach((option) => {
|
||||
@ -541,20 +515,23 @@ export default {
|
||||
}
|
||||
this.form.options = this.form.skuList;
|
||||
console.log(this.form.options, "this.options");
|
||||
// this.addOptions();
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
productGetMaxProductCode() {
|
||||
let self = this;
|
||||
ProductApi.productGetMaxProductCode()
|
||||
.then((res) => {
|
||||
localStorage.removeItem("firstBarCode");
|
||||
self.firstBarCode = res.data;
|
||||
localStorage.setItem("firstBarCode", self.firstBarCode);
|
||||
})
|
||||
.catch((error) => {});
|
||||
return new Promise((resolve, reject) => {
|
||||
ProductApi.productGetMaxProductCode()
|
||||
.then((res) => {
|
||||
localStorage.removeItem("firstBarCode");
|
||||
this.firstBarCode = res.data;
|
||||
localStorage.setItem("firstBarCode", this.firstBarCode);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
productToAdd() {
|
||||
let self = this;
|
||||
|
||||
@ -23,10 +23,6 @@
|
||||
placeholder="请输入商品名称"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="规格条码">
|
||||
<el-input v-model="searchForm.productExtendCode" size="small"
|
||||
placeholder="请输入规格条码"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="商品条码">
|
||||
<el-input
|
||||
v-model="searchForm.barCode"
|
||||
@ -402,7 +398,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
searchCategory(e) {
|
||||
console.log(e);
|
||||
this.categoryLists(e);
|
||||
console.log(e,'search');
|
||||
},
|
||||
changeCategory(name, e) {
|
||||
console.log(name);
|
||||
@ -498,7 +495,9 @@ export default {
|
||||
closeDialogFunc(e, f) {
|
||||
if (f == "add") {
|
||||
this.open_add = e.openDialog;
|
||||
if (e.type == "success") {
|
||||
if (e.type == "success") {
|
||||
this.getData();
|
||||
} else {
|
||||
this.getData();
|
||||
}
|
||||
}
|
||||
@ -539,12 +538,22 @@ export default {
|
||||
})
|
||||
.catch((error) => {});
|
||||
},
|
||||
categoryLists() {
|
||||
categoryLists(row) {
|
||||
let self = this;
|
||||
let Params = {};
|
||||
if (row) {
|
||||
Params.name = row;
|
||||
}
|
||||
ProductApi.categoryList(Params, true)
|
||||
.then((res) => {
|
||||
self.categoryList = res.data;
|
||||
const allCategories = {
|
||||
name: "所有系统分类",
|
||||
categoryId: 0,
|
||||
isRoot: true,
|
||||
children: res.data,
|
||||
};
|
||||
self.categoryList = [allCategories];
|
||||
self.getData(self.categoryList[0]);
|
||||
})
|
||||
.catch((error) => {});
|
||||
},
|
||||
@ -568,7 +577,6 @@ export default {
|
||||
} else {
|
||||
Params.categoryId = 0;
|
||||
}
|
||||
// Params.type = self.activeName;
|
||||
self.loading = true;
|
||||
ProductApi.productList(Params, true)
|
||||
.then((res) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user