Merge remote-tracking branch 'origin/sdl_20220916_护理站人员功能' into dev

This commit is contained in:
曹辉 2022-11-01 10:49:28 +08:00
commit dd4e28954e
2 changed files with 20 additions and 36 deletions

View File

@ -402,7 +402,7 @@
></el-input> ></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="商品属性图片" align="center"> <el-table-column label="商品属性图片" align="center" width="300">
<template slot-scope="scope"> <template slot-scope="scope">
<stationAcatar <stationAcatar
@imgUrl="attributePitureUrl" @imgUrl="attributePitureUrl"
@ -668,16 +668,8 @@ export default {
}, },
], ],
// goodAttributeDetailsLists:[], // goodAttributeDetailsLists:[],
goodDetailsLists: [ goodDetailsLists: [],
{ ids: 9999999,
attributePitureUrl: "",
goodsPrice: "",
goodsStock: "",
sort: "",
ids: 9999,
},
],
ids: 9999,
// //
shangjia: { shangjia: {
id: null, id: null,
@ -794,14 +786,13 @@ export default {
sort: "", sort: "",
ids: this.ids, ids: this.ids,
}; };
this.goodDetailsLists.push(obj); this.goodDetailsLists.push(obj);
} }
}, },
// //
delgoodAttributeDetail(item) { delgoodAttributeDetail(item) {
console.log(item); console.log(item);
if (item.ids && !item.id) { if (item.ids && !item.attributeDetailsId) {
if (this.goodDetailsLists.length == 1) { if (this.goodDetailsLists.length == 1) {
this.$message.error("最后一条不可删除"); this.$message.error("最后一条不可删除");
} else { } else {
@ -809,12 +800,12 @@ export default {
(e) => e.ids != item.ids (e) => e.ids != item.ids
); );
} }
} else if (!item.ids && item.id) { } else if (!item.ids && item.attributeDetailsId) {
if (this.goodDetailsLists.length == 1) { if (this.goodDetailsLists.length == 1) {
this.$message.error("最后一条不可删除"); this.$message.error("最后一条不可删除");
} else { } else {
this.goodDetailsLists = this.goodDetailsLists.filter( this.goodDetailsLists = this.goodDetailsLists.filter(
(e) => e.id != item.id (e) => e.attributeDetailsId != item.attributeDetailsId
); );
} }
} }
@ -824,7 +815,6 @@ export default {
cancel() { cancel() {
this.open = false; this.open = false;
this.reset(); this.reset();
this.goodDetailsLists = [ this.goodDetailsLists = [
{ {
attributeName: "", attributeName: "",
@ -891,23 +881,23 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true;
this.title = "商品基本信息"; this.title = "商品基本信息";
console.log(this.ids);
this.goodDetailsLists = [ this.goodDetailsLists = [
{ {
attributePitureUrl: "", attributePitureUrl: "",
goodsPrice: "", goodsPrice: "",
goodsStock: "", goodsStock: "",
sort: "", sort: "",
ids: 99999999999999999999, ids: 9999999,
}, },
]; ];
this.open = true;
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.goodsInfoId || this.ids; const id = row.goodsInfoId || this.ids;
getGoodsInfo(id).then((response) => { getGoodsInfo(id).then((response) => {
this.form = response.data[0]; this.form = response.data[0];
this.goodDetailsLists = response.data[0].goodAttributeDetailsLists; this.goodDetailsLists = response.data[0].goodAttributeDetailsLists;
@ -929,6 +919,8 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
console.log(this.goodDetailsLists);
this.form.goodAttributeDetailsLists = [];
this.form.goodDetailsLists = this.goodDetailsLists; this.form.goodDetailsLists = this.goodDetailsLists;
console.log(this.form); console.log(this.form);
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
@ -991,9 +983,9 @@ export default {
e.attributePitureUrl = items.attributePitureUrl; e.attributePitureUrl = items.attributePitureUrl;
} }
}); });
} else if (!items.ids && items.id) { } else if (!items.ids && items.attributeDetailsId) {
this.goodDetailsLists.forEach((e) => { this.goodDetailsLists.forEach((e) => {
if (e.id == items.id) { if (e.attributeDetailsId == items.attributeDetailsId) {
e.attributePitureUrl = items.attributePitureUrl; e.attributePitureUrl = items.attributePitureUrl;
} }
}); });

View File

@ -131,13 +131,12 @@ export default {
fixedBox: true, // fixedBox: true, //
}, },
previews: {}, previews: {},
rows: {}, items: {},
}; };
}, },
created() { created() {
this.types = this.type; this.types = this.type;
this.rows = this.item; this.items = this.item;
if (this.img == null) { if (this.img == null) {
this.options.img = null; this.options.img = null;
} else if (this.img == "") { } else if (this.img == "") {
@ -145,19 +144,11 @@ export default {
} else { } else {
this.options.img = baseurl + this.img; this.options.img = baseurl + this.img;
} }
console.log(this.item);
}, },
watch: { watch: {
item: { item: {
handler(newimg, oldimg) { handler(newimg, oldimg) {
console.log(newimg,oldimg) this.items = this.item;
if (this.item == null) {
this.rows = null;
} else if (this.img == "") {
this.rows = null;
} else {
this.rows = this.item;
}
}, },
}, },
img: { img: {
@ -225,10 +216,11 @@ export default {
updateNurseStationHeads(formData).then((response) => { updateNurseStationHeads(formData).then((response) => {
this.options.img = baseurl + response.imgUrl; this.options.img = baseurl + response.imgUrl;
this.$emit("imgUrl", response.imgUrl); this.$emit("imgUrl", response.imgUrl);
console.log(this.rows); console.log(this.items);
console.log(this.types);
if (this.types == "attributePitureUrl") { if (this.types == "attributePitureUrl") {
this.rows.attributePitureUrl = response.imgUrl; this.items.attributePitureUrl = response.imgUrl;
this.$emit("item", JSON.stringify(this.rows)); this.$emit("item", JSON.stringify(this.items));
} }
this.openimg = false; this.openimg = false;
}); });