修改
This commit is contained in:
parent
3900b1dfea
commit
0f302aae64
@ -190,6 +190,7 @@
|
||||
:visible.sync="open"
|
||||
width="1200px"
|
||||
append-to-body
|
||||
:before-close="cancel"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
@ -234,7 +235,18 @@
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类名称" prop="goodsCategoryId">
|
||||
<el-select
|
||||
<!-- v-model="form.parentIdList" -->
|
||||
<el-cascader
|
||||
:props="treeOption"
|
||||
@change="change"
|
||||
style="width: 210px"
|
||||
:show-all-levels="false"
|
||||
:clearable="true"
|
||||
ref="cascader"
|
||||
:placeholder="form.goodsCategoryName ? form.goodsCategoryName : ''"
|
||||
>
|
||||
</el-cascader>
|
||||
<!-- <el-select
|
||||
style="width: 210px"
|
||||
v-model="form.goodsCategoryId"
|
||||
clearable
|
||||
@ -247,7 +259,7 @@
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="商品用途" prop="goodsPurpose">
|
||||
<el-select
|
||||
@ -489,5 +501,8 @@ export default indexjs;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
}
|
||||
::v-deep .el-cascader .el-input input::-webkit-input-placeholder {
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -9,9 +9,13 @@ import {
|
||||
editGoodsWhetherShelf,
|
||||
stationList,
|
||||
} from "@/api/system/OperateGoodsInfo";
|
||||
import {
|
||||
getStationCategoryList,
|
||||
} from "@/api/system/goodsCategory";
|
||||
import editor from "@/components/Editor";
|
||||
import stationAcatar from "../stationAvatar/index.vue";
|
||||
import baseurl from "@/api/baseurl.js";
|
||||
let id = 0;
|
||||
|
||||
export default {
|
||||
components: { stationAcatar, editor },
|
||||
@ -36,7 +40,6 @@ export default {
|
||||
// 总条数
|
||||
total: 0,
|
||||
total2: 0,
|
||||
|
||||
// 商品基本信息表格数据
|
||||
goodsInfoList: [],
|
||||
// 护理站列表
|
||||
@ -131,19 +134,38 @@ export default {
|
||||
],
|
||||
},
|
||||
homestation: null,
|
||||
treeOption: {
|
||||
lazy: true,
|
||||
checkStrictly: true, // 是否可选择任意一级
|
||||
lazyLoad(node, resolve) {
|
||||
const id = (node.level === 0) ? 0 : node.data.id;
|
||||
setTimeout(() => {
|
||||
getStationCategoryList(id).then(res => { // 接口请求
|
||||
res.data.forEach(e => {
|
||||
e.value = e.id
|
||||
e.label = e.goodsCategoryName
|
||||
})
|
||||
resolve(res.data.map(item => {
|
||||
return {
|
||||
...item
|
||||
}
|
||||
}))
|
||||
});
|
||||
}, 1000);
|
||||
},
|
||||
},
|
||||
ruleForm: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.goodsCategoryinfo();
|
||||
// this.goodsCategoryinfo();
|
||||
},
|
||||
methods: {
|
||||
imgs(item) {
|
||||
this.imgsurl.pictureUrlList.push(item);
|
||||
// console.log(this.imgsurl)
|
||||
},
|
||||
upwhetherShelf(row) {
|
||||
console.log(row);
|
||||
if (row.whetherShelf == false) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
@ -156,7 +178,6 @@ export default {
|
||||
};
|
||||
}
|
||||
editGoodsWhetherShelf(obj).then((res) => {
|
||||
console.log(obj);
|
||||
if (obj.whetherShelf == 0) {
|
||||
this.$modal.msgSuccess("已修改上架状态为未上架");
|
||||
} else {
|
||||
@ -199,7 +220,6 @@ export default {
|
||||
},
|
||||
// 删除
|
||||
delgoodAttributeDetail(item) {
|
||||
console.log(item);
|
||||
if (item.ids && !item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
@ -217,19 +237,15 @@ export default {
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log(this.goodDetailsLists);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
console.log(this.form);
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.form.goodsPictureUrl);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
if (this.imgsurl.pictureUrlList.length > 0) {
|
||||
updatePicture(this.imgsurl).then((res) => {});
|
||||
@ -247,6 +263,11 @@ export default {
|
||||
attributeDetailsSort: null,
|
||||
}, ],
|
||||
}, ];
|
||||
// 清空选中的节点
|
||||
this.$refs.cascader.$refs.panel.clearCheckedNodes();
|
||||
// 设置为空可以让节点不高亮显示
|
||||
this.$refs.cascader.$refs.panel.activePath = [];
|
||||
|
||||
},
|
||||
//页面所属护理站
|
||||
ParamsStation(item) {
|
||||
@ -335,7 +356,6 @@ export default {
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
console.log(selection);
|
||||
this.ids = selection.map((item) => item.goodsInfoId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
@ -366,23 +386,25 @@ export default {
|
||||
if (this.StationName == null) {
|
||||
this.StationName = "请选择所属护理站";
|
||||
}
|
||||
console.log(this.StationName);
|
||||
getGoodsInfo(id).then((response) => {
|
||||
// response.data[0].parentIdList = response.data[0].parentIdList[0].split(',')
|
||||
this.form = response.data[0];
|
||||
this.imgone = this.form.goodsPictureUrl;
|
||||
if (response.data[0].goodAttributeDetailsLists) {
|
||||
this.goodDetailsLists = response.data[0].goodAttributeDetailsLists;
|
||||
}
|
||||
// console.log(this.form.parentIdList)
|
||||
// this.form.goodsCategoryId = this.form.goodsCategoryName
|
||||
// this.form.value = this.form.goodsCategoryId
|
||||
// this.form.label = this.form.goodsCategoryName
|
||||
this.open = true;
|
||||
this.title = "修改商品基本信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log(this.form)
|
||||
this.form.goodAttributeDetailsLists = [];
|
||||
this.form.goodDetailsLists = this.goodDetailsLists;
|
||||
console.log(this.form);
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.goodsInfoId != null) {
|
||||
@ -401,9 +423,7 @@ export default {
|
||||
}
|
||||
this.imgsurl = { pictureUrlList: [] };
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
|
||||
@ -416,7 +436,6 @@ export default {
|
||||
})
|
||||
// this.nurseStationId=this.form.nurseStationId
|
||||
addGoodsInfo(this.form).then((response) => {
|
||||
console.log(this.form);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.open = false;
|
||||
@ -428,7 +447,6 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
console.log("row :>> ", row);
|
||||
this.$confirm("是否确认删除订单信息的数据项?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
@ -439,9 +457,7 @@ export default {
|
||||
var obj = { pictureUrlList: [] };
|
||||
obj.pictureUrlList.push(row.goodsPictureUrl);
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
this.$message.success("删除成功");
|
||||
this.getList();
|
||||
@ -450,11 +466,9 @@ export default {
|
||||
.catch(() => {});
|
||||
},
|
||||
imgUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
this.form.goodsPictureUrl = imgUrl;
|
||||
},
|
||||
attributePitureUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
// this.form.attributePitureUrl = imgUrl;
|
||||
},
|
||||
attributePitureitem(item) {
|
||||
@ -475,11 +489,17 @@ export default {
|
||||
},
|
||||
//商品分类
|
||||
goodsCategoryinfo() {
|
||||
goodsCategory().then((res) => {
|
||||
console.log(this.form);
|
||||
this.goodsCategorylist = res.rows;
|
||||
getStationCategoryList(0).then((res) => {
|
||||
res.data.forEach(e => {
|
||||
e.value = e.id
|
||||
e.label = e.goodsCategoryName
|
||||
})
|
||||
this.goodsCategorylist = res.data;
|
||||
});
|
||||
},
|
||||
change(e) {
|
||||
this.form.goodsCategoryId = e[e.length - 1]
|
||||
},
|
||||
//护理站
|
||||
info() {
|
||||
stationList(this.getListByUserquery).then((res) => {
|
||||
|
||||
@ -185,6 +185,8 @@
|
||||
|
||||
<!-- 添加或修改商品分类信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-cascader :props="props"></el-cascader>
|
||||
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item
|
||||
label="父级分类名称"
|
||||
@ -192,12 +194,12 @@
|
||||
:required="true"
|
||||
v-if="form.parentId"
|
||||
>
|
||||
<el-input
|
||||
<!-- <el-input
|
||||
v-model="form.parentName"
|
||||
placeholder="请输入商品分类名称"
|
||||
placeholder="请输入父级分类名称"
|
||||
maxlength="10"
|
||||
disabled
|
||||
/>
|
||||
/> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类名称" prop="goodsCategoryName">
|
||||
<el-input
|
||||
@ -257,11 +259,28 @@ import {
|
||||
} from "@/api/system/goodsCategory";
|
||||
import stationAcatar from "../stationAvatar/index.vue";
|
||||
import baseurl from "@/api/baseurl";
|
||||
let id = 0;
|
||||
export default {
|
||||
name: "GoodsCategory",
|
||||
components: { stationAcatar },
|
||||
data() {
|
||||
return {
|
||||
props: {
|
||||
lazy: true,
|
||||
lazyLoad(node, resolve) {
|
||||
console.log(node)
|
||||
const { level } = node;
|
||||
setTimeout(() => {
|
||||
const nodes = Array.from({ length: level + 1 }).map((item) => ({
|
||||
value: ++id,
|
||||
label: `选项${id}`,
|
||||
leaf: level >= 2,
|
||||
}));
|
||||
// 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
||||
resolve(nodes);
|
||||
}, 1000);
|
||||
},
|
||||
},
|
||||
imgone: "",
|
||||
baseurl: "",
|
||||
// 遮罩层
|
||||
@ -328,7 +347,7 @@ export default {
|
||||
|
||||
created() {
|
||||
this.baseurl = baseurl;
|
||||
// this.getList();
|
||||
this.getList();
|
||||
this.info();
|
||||
},
|
||||
methods: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user