修改
This commit is contained in:
parent
97e02f1231
commit
24e3580d81
@ -49,4 +49,13 @@ export function delGoodsCategory(id) {
|
||||
url: '/system/goodsCategory/' + id,
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//不分页
|
||||
export function getStationCategoryList(parentId) {
|
||||
return request({
|
||||
url: `/system/goodsCategory/getStationCategoryList?parentId=${parentId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@ -9,18 +9,9 @@
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="所属护理站" prop="nurseStationName">
|
||||
<el-select
|
||||
v-model="queryParams.nurseStationId"
|
||||
placeholder="请选择护理站"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in handstationlist"
|
||||
:key="item.id"
|
||||
:label="item.nurseStationName"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button type="" class="stationbtn" @click="ParamsStation(true)">{{
|
||||
queryParams.nurseStationName
|
||||
}}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input
|
||||
@ -65,7 +56,6 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@ -132,7 +122,6 @@
|
||||
align="center"
|
||||
prop="goodsCategoryName"
|
||||
/>
|
||||
|
||||
<el-table-column label="商品用途" align="center" prop="goodsPurpose">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.goodsPurpose == "BUSINESS" ? "买卖" : "" }}
|
||||
@ -161,7 +150,6 @@
|
||||
<div v-else></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
||||
<el-table-column
|
||||
@ -202,6 +190,7 @@
|
||||
:visible.sync="open"
|
||||
width="1200px"
|
||||
append-to-body
|
||||
:before-close="cancel"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
@ -224,7 +213,7 @@
|
||||
@click="clickinnerVisible"
|
||||
v-if="StationName == '请选择所属护理站'"
|
||||
style="
|
||||
width: 200px;
|
||||
width: 210px;
|
||||
text-align: left;
|
||||
height: 36px;
|
||||
color: #c0c4cc;
|
||||
@ -237,17 +226,27 @@
|
||||
@click="clickinnerVisible"
|
||||
v-else
|
||||
style="
|
||||
width: 200px;
|
||||
width: 210px;
|
||||
text-align: left;
|
||||
height: 36px;
|
||||
padding-left: -10px;
|
||||
overflow: hidden;
|
||||
"
|
||||
>{{ StationName }}</el-button
|
||||
>
|
||||
</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
|
||||
@ -260,7 +259,7 @@
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="商品用途" prop="goodsPurpose">
|
||||
<el-select
|
||||
@ -279,11 +278,20 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="商品度量单位" prop="goodsUnit">
|
||||
<el-input
|
||||
max="8"
|
||||
v-model="form.goodsUnit"
|
||||
placeholder="请输入商品度量单位"
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品顺序" prop="sort">
|
||||
<el-input
|
||||
max="8"
|
||||
v-model.number="form.sort"
|
||||
placeholder="值越大排名越靠前"
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品图片" prop="goodsPictureUrl">
|
||||
<stationAcatar
|
||||
@imgUrl="imgUrl"
|
||||
@ -291,7 +299,6 @@
|
||||
:type="'goodsPictureUrl'"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-table
|
||||
ref="goodDetailsLists"
|
||||
:data="goodDetailsLists"
|
||||
@ -310,9 +317,9 @@
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.goodsPrice"
|
||||
type="number"
|
||||
oninput="if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+3)} if(value.length>7){value=value.slice(0,7)}"
|
||||
min="0"
|
||||
type="number"
|
||||
placeholder="小数点后两位(元)"
|
||||
></el-input>
|
||||
</template>
|
||||
@ -321,17 +328,18 @@
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.goodsStock"
|
||||
maxlength="9"
|
||||
oninput="value=value.replace(/[^\d]/g,'')"
|
||||
maxLength="9"
|
||||
></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="显示顺序" align="center">
|
||||
<el-table-column label="商品属性顺序" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.attributeDetailsSort"
|
||||
maxlength="9"
|
||||
v-model.number="scope.row.attributeDetailsSort"
|
||||
oninput="value=value.replace(/[^\d]/g,'')"
|
||||
placeholder="值越大排名越靠前"
|
||||
maxLength="9"
|
||||
></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -366,14 +374,13 @@
|
||||
style="margin-top: 20px"
|
||||
>
|
||||
<editor
|
||||
@imgs="imgs"
|
||||
@imgs="imgs"
|
||||
:min-height="100"
|
||||
style="width: 90%; margin: 0 auto"
|
||||
v-model="form.goodsRemark"
|
||||
></editor>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
@ -381,7 +388,7 @@
|
||||
</el-dialog>
|
||||
<!-- 新增护理站名称弹框 -->
|
||||
<el-dialog
|
||||
:title="title"
|
||||
title="选择护理站"
|
||||
:visible.sync="innerVisible"
|
||||
width="1000px"
|
||||
append-to-body
|
||||
@ -429,11 +436,7 @@
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="nurseStationlist"
|
||||
@cell-dblclick="nurseclick"
|
||||
v-loading="loading2"
|
||||
>
|
||||
<el-table :data="nurseStationlist" @cell-dblclick="nurseclick">
|
||||
<el-table-column label="请选择" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@ -487,502 +490,19 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getGoodsInfo,
|
||||
delGoodsInfo,
|
||||
addGoodsInfo,
|
||||
updateGoodsInfo,
|
||||
updatePicture,
|
||||
goodsInfoList,
|
||||
goodsCategory,
|
||||
editGoodsWhetherShelf,
|
||||
stationList,
|
||||
} from "@/api/system/OperateGoodsInfo";
|
||||
import editor from "@/components/Editor";
|
||||
import stationAcatar from "../stationAvatar/index.vue";
|
||||
import baseurl from "@/api/baseurl.js";
|
||||
|
||||
export default {
|
||||
components: { stationAcatar, editor },
|
||||
name: "OperateGoodsInfo",
|
||||
data() {
|
||||
return {
|
||||
imgsurl: { pictureUrlList: [] },
|
||||
imgone: "",
|
||||
imageUrl: "", //商品图片
|
||||
value: "",
|
||||
datas: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
loading2: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
total2: 0,
|
||||
|
||||
// 商品基本信息表格数据
|
||||
goodsInfoList: [],
|
||||
// 护理站列表
|
||||
nurseStationlist: [],
|
||||
// 查询商品分类列表
|
||||
goodsCategorylist: [],
|
||||
handstationlist: [], //页面搜索list
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// open2: false,
|
||||
innerVisible: false,
|
||||
StationName: "请选择所属护理站",
|
||||
nursetotal: 0,
|
||||
nurseStationId: null,
|
||||
goods: [
|
||||
{
|
||||
value: "BUSINESS",
|
||||
label: "买卖",
|
||||
},
|
||||
{
|
||||
value: "LEASE",
|
||||
label: "租赁",
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
value: 0,
|
||||
label: "否",
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "是",
|
||||
},
|
||||
],
|
||||
// goodAttributeDetailsLists:[],
|
||||
goodDetailsLists: [],
|
||||
ids: 9999999,
|
||||
// 查询参数
|
||||
shangjia: {
|
||||
id: null,
|
||||
whetherShelf: null,
|
||||
},
|
||||
getListByUserquery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
queryParams: {
|
||||
id: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
},
|
||||
//权限查询
|
||||
getListByUserquery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
nurseStationId: null,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodsName: [
|
||||
{ required: true, message: "请输入商品名称", trigger: "blur" },
|
||||
],
|
||||
goodsCategoryId: [
|
||||
{ required: true, message: "请选择商品分类名称", trigger: "blur" },
|
||||
],
|
||||
|
||||
goodsPurpose: [
|
||||
{ required: true, message: "请选择商品用途", trigger: "blur" },
|
||||
],
|
||||
goodsUnit: [
|
||||
{ required: true, message: "请输入商品度量单位", trigger: "blur" },
|
||||
],
|
||||
goodsPictureUrl: [
|
||||
{ required: true, message: "请输入选择图片", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.info();
|
||||
this.infos();
|
||||
},
|
||||
methods: {
|
||||
imgs(item) {
|
||||
this.imgsurl.pictureUrlList.push(item);
|
||||
},
|
||||
upwhetherShelf(row) {
|
||||
console.log(row);
|
||||
if (row.whetherShelf == false) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 0,
|
||||
};
|
||||
} else if (row.whetherShelf == true) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 1,
|
||||
};
|
||||
}
|
||||
editGoodsWhetherShelf(obj).then((res) => {
|
||||
console.log(obj);
|
||||
if (obj.whetherShelf == 0) {
|
||||
this.$modal.msgSuccess("已修改上架状态为未上架");
|
||||
} else {
|
||||
this.$modal.msgSuccess("已修改上架状态为上架");
|
||||
}
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 查询商品基本信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
goodsInfoList(this.queryParams).then((response) => {
|
||||
response.rows.forEach((e) => {
|
||||
if (e.whetherShelf == 1) {
|
||||
e.whetherShelf = true;
|
||||
} else if (e.whetherShelf == 0) {
|
||||
e.whetherShelf = false;
|
||||
}
|
||||
});
|
||||
this.goodsInfoList = response.rows;
|
||||
console.log(this.goodsInfoList);
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 添加
|
||||
addgoodAttributeDetail() {
|
||||
console.log(this.goodDetailsLists);
|
||||
if (this.goodDetailsLists.length == 5) {
|
||||
this.$message.error("最多只能5条");
|
||||
} else {
|
||||
this.ids++;
|
||||
var obj = {
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: this.ids,
|
||||
};
|
||||
this.goodDetailsLists.push(obj);
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
delgoodAttributeDetail(item) {
|
||||
console.log(item);
|
||||
if (item.ids && !item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.ids != item.ids
|
||||
);
|
||||
}
|
||||
} else if (!item.ids && item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.attributeDetailsId != item.attributeDetailsId
|
||||
);
|
||||
}
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
if (this.imgsurl.pictureUrlList.length > 0) {
|
||||
updatePicture(this.imgsurl).then((res) => {});
|
||||
}
|
||||
this.imgsurl = { pictureUrlList: [] };
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributeName: "",
|
||||
goodAttributeDetailsLists: [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
clickinnerVisible() {
|
||||
this.innerVisible = true;
|
||||
},
|
||||
nurseclick(row) {
|
||||
// console.log(this.form);
|
||||
console.log(row);
|
||||
this.form.nurseStationId = row.id;
|
||||
this.StationName = row.nurseStationName;
|
||||
this.innerVisible = false;
|
||||
},
|
||||
handleQuery2() {
|
||||
// this.getListByUserquery.pageNum = 1;
|
||||
this.info();
|
||||
},
|
||||
resetQuery2() {
|
||||
this.resetForm("queryForm");
|
||||
(this.getListByUserquery = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
}),
|
||||
this.handleQuery2();
|
||||
},
|
||||
addcancel() {
|
||||
this.innerVisible = false;
|
||||
this.resetQuery2();
|
||||
},
|
||||
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
};
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: 9999999,
|
||||
},
|
||||
];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
goodsName: null,
|
||||
goodsCategoryName: null,
|
||||
goodsPurpose: null,
|
||||
};
|
||||
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
console.log(selection);
|
||||
this.ids = selection.map((item) => item.goodsInfoId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.nurseStationId = "";
|
||||
this.title = "商品基本信息";
|
||||
// this.nurseName = "请选择护理员";
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [
|
||||
{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: "",
|
||||
ids: 9999999,
|
||||
},
|
||||
];
|
||||
this.open = true;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.goodsInfoId || this.ids;
|
||||
this.StationName = row.nurseStationName;
|
||||
if (this.StationName == null) {
|
||||
this.StationName = "请选择所属护理站";
|
||||
}
|
||||
console.log(this.StationName);
|
||||
getGoodsInfo(id).then((response) => {
|
||||
this.form = response.data[0];
|
||||
this.imgone = this.form.goodsPictureUrl;
|
||||
if (response.data[0].goodAttributeDetailsLists) {
|
||||
this.goodDetailsLists = response.data[0].goodAttributeDetailsLists;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "修改商品基本信息";
|
||||
});
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log(this.form);
|
||||
console.log(this.goodDetailsLists);
|
||||
this.form.goodAttributeDetailsLists = [];
|
||||
this.form.goodDetailsLists = this.goodDetailsLists;
|
||||
console.log(this.form);
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.goodsInfoId != null) {
|
||||
this.form.id = this.form.goodsInfoId;
|
||||
this.form.goodDetailsLists.forEach((e) => {
|
||||
e.goodsPrice = Number(e.goodsPrice);
|
||||
});
|
||||
updateGoodsInfo(this.form).then((response) => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.imgone);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
this.imgsurl = { pictureUrlList: [] };
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
this.form.goodDetailsLists.forEach((e) => {
|
||||
e.goodsPrice = Number(e.goodsPrice);
|
||||
});
|
||||
addGoodsInfo(this.form).then((response) => {
|
||||
console.log(this.form);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
console.log("row :>> ", row);
|
||||
this.$confirm("是否确认删除订单信息的数据项?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
delGoodsInfo(row.goodsInfoId).then((res) => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
obj.pictureUrlList.push(row.goodsPictureUrl);
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
this.$message.success("删除成功");
|
||||
this.getList();
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
imgUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
this.form.goodsPictureUrl = imgUrl;
|
||||
},
|
||||
attributePitureUrl(imgUrl) {
|
||||
console.log(imgUrl);
|
||||
// this.form.attributePitureUrl = imgUrl;
|
||||
},
|
||||
attributePitureitem(item) {
|
||||
let items = JSON.parse(item);
|
||||
if (items.ids && !items.id) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.ids == items.ids) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
} else if (!items.ids && items.attributeDetailsId) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.attributeDetailsId == items.attributeDetailsId) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//权限列表
|
||||
info() {
|
||||
goodsCategory().then((res) => {
|
||||
console.log(this.form);
|
||||
this.goodsCategorylist = res.rows;
|
||||
});
|
||||
this.loading2 = true;
|
||||
stationList(this.getListByUserquery).then((res) => {
|
||||
this.nurseStationlist = res.rows;
|
||||
this.total2 = res.total;
|
||||
this.loading2 = false;
|
||||
});
|
||||
},
|
||||
infos() {
|
||||
var queryFor = {
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
};
|
||||
stationList(queryFor).then((res) => {
|
||||
console.log(res);
|
||||
this.handstationlist = res.rows;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
import indexjs from "./indexjs.js";
|
||||
export default indexjs;
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.stationbtn {
|
||||
width: 208px;
|
||||
text-align: left;
|
||||
height: 32px;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
}
|
||||
::v-deep .el-cascader .el-input input::-webkit-input-placeholder {
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
504
src/views/system/OperateGoodsInfo/indexjs.js
Normal file
504
src/views/system/OperateGoodsInfo/indexjs.js
Normal file
@ -0,0 +1,504 @@
|
||||
import {
|
||||
getGoodsInfo,
|
||||
delGoodsInfo,
|
||||
addGoodsInfo,
|
||||
updateGoodsInfo,
|
||||
updatePicture,
|
||||
goodsInfoList,
|
||||
goodsCategory,
|
||||
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 },
|
||||
name: "OperateGoodsInfo",
|
||||
data() {
|
||||
return {
|
||||
imgsurl: { pictureUrlList: [] },
|
||||
imgone: "",
|
||||
imageUrl: "", //商品图片
|
||||
value: "",
|
||||
datas: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
total2: 0,
|
||||
// 商品基本信息表格数据
|
||||
goodsInfoList: [],
|
||||
// 护理站列表
|
||||
nurseStationlist: [],
|
||||
// 查询商品分类列表
|
||||
goodsCategorylist: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// open2: false,
|
||||
innerVisible: false,
|
||||
StationName: "请选择所属护理站",
|
||||
nursetotal: 0,
|
||||
nurseStationId: null,
|
||||
goods: [{
|
||||
value: "BUSINESS",
|
||||
label: "买卖",
|
||||
},
|
||||
{
|
||||
value: "LEASE",
|
||||
label: "租赁",
|
||||
},
|
||||
],
|
||||
options: [{
|
||||
value: 0,
|
||||
label: "否",
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "是",
|
||||
},
|
||||
],
|
||||
// goodAttributeDetailsLists:[],
|
||||
goodDetailsLists: [],
|
||||
ids: 9999999,
|
||||
// 查询参数
|
||||
shangjia: {
|
||||
id: null,
|
||||
whetherShelf: null,
|
||||
},
|
||||
queryParams: {
|
||||
id: null,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
},
|
||||
//权限查询
|
||||
getListByUserquery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
nurseStationId: null,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
goodsName: [
|
||||
{ required: true, message: "请输入商品名称", trigger: "blur" },
|
||||
],
|
||||
goodsCategoryId: [
|
||||
{ required: true, message: "请选择商品分类名称", trigger: "blur" },
|
||||
],
|
||||
goodsPurpose: [
|
||||
{ required: true, message: "请选择商品用途", trigger: "blur" },
|
||||
],
|
||||
goodsUnit: [
|
||||
{ required: true, message: "请输入商品度量单位", trigger: "blur" },
|
||||
],
|
||||
goodsPictureUrl: [
|
||||
{ required: true, message: "请选择图片", trigger: "blur" },
|
||||
],
|
||||
sort: [
|
||||
{ required: true, message: "请输入商品顺序", trigger: "blur" },
|
||||
|
||||
],
|
||||
},
|
||||
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
|
||||
}
|
||||
}))
|
||||
});
|
||||
}, 300);
|
||||
},
|
||||
},
|
||||
ruleForm: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
// this.goodsCategoryinfo();
|
||||
},
|
||||
methods: {
|
||||
imgs(item) {
|
||||
this.imgsurl.pictureUrlList.push(item);
|
||||
},
|
||||
upwhetherShelf(row) {
|
||||
if (row.whetherShelf == false) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 0,
|
||||
};
|
||||
} else if (row.whetherShelf == true) {
|
||||
var obj = {
|
||||
id: row.goodsInfoId,
|
||||
whetherShelf: 1,
|
||||
};
|
||||
}
|
||||
editGoodsWhetherShelf(obj).then((res) => {
|
||||
if (obj.whetherShelf == 0) {
|
||||
this.$modal.msgSuccess("已修改上架状态为未上架");
|
||||
} else {
|
||||
this.$modal.msgSuccess("已修改上架状态为上架");
|
||||
}
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 查询商品基本信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
goodsInfoList(this.queryParams).then((response) => {
|
||||
response.rows.forEach((e) => {
|
||||
if (e.whetherShelf == 1) {
|
||||
e.whetherShelf = true;
|
||||
} else if (e.whetherShelf == 0) {
|
||||
e.whetherShelf = false;
|
||||
}
|
||||
});
|
||||
this.goodsInfoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 添加
|
||||
addgoodAttributeDetail() {
|
||||
// if (this.goodDetailsLists.length == 5) {
|
||||
// this.$message.error("最多只能5条");
|
||||
// } else {
|
||||
this.ids++;
|
||||
var obj = {
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
attributeDetailsSort: null,
|
||||
ids: this.ids,
|
||||
};
|
||||
this.goodDetailsLists.push(obj);
|
||||
// }
|
||||
},
|
||||
// 删除
|
||||
delgoodAttributeDetail(item) {
|
||||
if (item.ids && !item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.ids != item.ids
|
||||
);
|
||||
}
|
||||
} else if (!item.ids && item.attributeDetailsId) {
|
||||
if (this.goodDetailsLists.length == 1) {
|
||||
this.$message.error("最后一条不可删除");
|
||||
} else {
|
||||
this.goodDetailsLists = this.goodDetailsLists.filter(
|
||||
(e) => e.attributeDetailsId != item.attributeDetailsId
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.form.goodsPictureUrl);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
if (this.imgsurl.pictureUrlList.length > 0) {
|
||||
updatePicture(this.imgsurl).then((res) => {});
|
||||
}
|
||||
this.imgsurl = { pictureUrlList: [] };
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [{
|
||||
attributeName: "",
|
||||
goodAttributeDetailsLists: [{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
attributeDetailsSort: null,
|
||||
}, ],
|
||||
}, ];
|
||||
// 清空选中的节点
|
||||
this.$refs.cascader.$refs.panel.clearCheckedNodes();
|
||||
// 设置为空可以让节点不高亮显示
|
||||
this.$refs.cascader.$refs.panel.activePath = [];
|
||||
},
|
||||
//页面所属护理站
|
||||
ParamsStation(item) {
|
||||
this.info();
|
||||
this.homestation = item
|
||||
this.innerVisible = true
|
||||
this.form.nurseStationId = this.queryParams.nurseStationId
|
||||
},
|
||||
//选择护理站
|
||||
clickinnerVisible() {
|
||||
this.info();
|
||||
this.innerVisible = true;
|
||||
},
|
||||
nurseclick(row) {
|
||||
if (this.homestation) {
|
||||
this.queryParams.nurseStationName = row.nurseStationName;
|
||||
this.queryParams.nurseStationId = row.id;
|
||||
} else {
|
||||
this.form.nurseStationId = row.id;
|
||||
this.StationName = row.nurseStationName;
|
||||
}
|
||||
this.innerVisible = false;
|
||||
},
|
||||
handleQuery2() {
|
||||
this.info();
|
||||
},
|
||||
resetQuery2() {
|
||||
this.resetForm("queryForm");
|
||||
this.getListByUserquery = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
}
|
||||
this.handleQuery2();
|
||||
},
|
||||
addcancel() {
|
||||
this.innerVisible = false;
|
||||
this.resetQuery2();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
storeInfoId: null,
|
||||
nurseStationId: null,
|
||||
goodsCategoryId: null,
|
||||
goodsName: null,
|
||||
// goodsCode: null,
|
||||
whetherShelf: null,
|
||||
shelfTime: null,
|
||||
goodsPictureUrl: null,
|
||||
goodsRemark: null,
|
||||
goodsUnit: null,
|
||||
goodsPurpose: null,
|
||||
sort: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
};
|
||||
this.goodDetailsLists = [{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
attributeDetailsSort: null,
|
||||
ids: 9999999,
|
||||
}, ];
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
goodsName: null,
|
||||
goodsCategoryName: null,
|
||||
goodsPurpose: null,
|
||||
};
|
||||
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.goodsInfoId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.homestation = null;
|
||||
this.nurseStationId = "";
|
||||
this.title = "商品基本信息";
|
||||
// this.nurseName = "请选择护理员";
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.goodDetailsLists = [{
|
||||
attributePitureUrl: "",
|
||||
goodsPrice: "",
|
||||
goodsStock: "",
|
||||
sort: null,
|
||||
ids: 9999999,
|
||||
}, ];
|
||||
this.open = true;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.homestation = null;
|
||||
const id = row.goodsInfoId || this.ids;
|
||||
this.StationName = row.nurseStationName;
|
||||
if (this.StationName == null) {
|
||||
this.StationName = "请选择所属护理站";
|
||||
}
|
||||
getGoodsInfo(id).then((response) => {
|
||||
// response.data.parentIdList = response.data.parentIdList.split(',')
|
||||
this.form = response.data;
|
||||
this.imgone = this.form.goodsPictureUrl;
|
||||
if (response.data.goodAttributeDetailsLists) {
|
||||
this.goodDetailsLists = response.data.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() {
|
||||
this.form.goodAttributeDetailsLists = [];
|
||||
this.form.goodDetailsLists = this.goodDetailsLists;
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.goodsInfoId != null) {
|
||||
this.form.id = this.form.goodsInfoId;
|
||||
this.form.goodDetailsLists.forEach(e => {
|
||||
e.goodsPrice = Number(e.goodsPrice)
|
||||
if (e.attributeDetailsSort == '') {
|
||||
e.attributeDetailsSort = null
|
||||
}
|
||||
// e.sort = e.attributeDetailsSort
|
||||
})
|
||||
updateGoodsInfo(this.form).then((response) => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsPictureUrl) {
|
||||
obj.pictureUrlList.push(this.imgone);
|
||||
}
|
||||
this.imgsurl = { pictureUrlList: [] };
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
this.form.goodDetailsLists.forEach(e => {
|
||||
e.goodsPrice = Number(e.goodsPrice)
|
||||
})
|
||||
// this.nurseStationId=this.form.nurseStationId
|
||||
addGoodsInfo(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.StationName = "请选择所属护理站";
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$confirm("是否确认删除订单信息的数据项?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
delGoodsInfo(row.goodsInfoId).then((res) => {
|
||||
var obj = { pictureUrlList: [] };
|
||||
obj.pictureUrlList.push(row.goodsPictureUrl);
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
this.$message.success("删除成功");
|
||||
this.getList();
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
imgUrl(imgUrl) {
|
||||
this.form.goodsPictureUrl = imgUrl;
|
||||
},
|
||||
attributePitureUrl(imgUrl) {
|
||||
// this.form.attributePitureUrl = imgUrl;
|
||||
},
|
||||
attributePitureitem(item) {
|
||||
let items = JSON.parse(item);
|
||||
if (items.ids && !items.id) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.ids == items.ids) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
} else if (!items.ids && items.attributeDetailsId) {
|
||||
this.goodDetailsLists.forEach((e) => {
|
||||
if (e.attributeDetailsId == items.attributeDetailsId) {
|
||||
e.attributePitureUrl = items.attributePitureUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//商品分类
|
||||
goodsCategoryinfo() {
|
||||
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) => {
|
||||
this.nurseStationlist = res.rows;
|
||||
this.total2 = res.total;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -1,88 +1,111 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="商品分类名称" prop="goodsCategoryName">
|
||||
<el-input
|
||||
v-model="queryParams.goodsCategoryName"
|
||||
placeholder="请输入商品分类名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类编码" prop="goodsCategoryCode">
|
||||
<el-input
|
||||
v-model="queryParams.goodsCategoryCode"
|
||||
placeholder="请输入商品分类编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示顺序" prop="sort">
|
||||
<el-input
|
||||
v-model="queryParams.sort"
|
||||
placeholder="请输入显示顺序"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:goodsCategory:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<!--部门数据-->
|
||||
<el-col :span="4" :xs="24">
|
||||
<!-- <div class="head-container">
|
||||
<el-input
|
||||
v-model="goodsCategoryName"
|
||||
placeholder="请输入区域名称"
|
||||
clearable
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
</div> -->
|
||||
<div class="head-container" style="height: 580px; overflow-y: auto">
|
||||
<el-tree
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
@node-click="handleNodeClick"
|
||||
@node-expand="handleNodeClick"
|
||||
></el-tree>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:goodsCategory:edit']"
|
||||
>修改</el-button
|
||||
<!--用户数据-->
|
||||
<el-col :span="20" :xs="24">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="100px"
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:goodsCategory:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-form-item label="商品分类名称" prop="goodsCategoryName">
|
||||
<el-input
|
||||
v-model="queryParams.goodsCategoryName"
|
||||
placeholder="请输入商品分类名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类编码" prop="goodsCategoryCode">
|
||||
<el-input
|
||||
v-model="queryParams.goodsCategoryCode"
|
||||
placeholder="请输入商品分类编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="显示顺序" prop="sort">
|
||||
<el-input
|
||||
v-model="queryParams.sort"
|
||||
placeholder="请输入显示顺序"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:goodsCategory:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:goodsCategory:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:goodsCategory:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
@ -93,74 +116,105 @@
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="goodsCategoryList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
label="商品分类名称"
|
||||
align="center"
|
||||
prop="goodsCategoryName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="商品分类编码"
|
||||
align="center"
|
||||
prop="goodsCategoryCode"
|
||||
/>
|
||||
<!-- <el-table-column label="商品分类图片地址" align="center" prop="goodsCategoryPicture" /> -->
|
||||
<el-table-column
|
||||
label="分类概述"
|
||||
align="center"
|
||||
prop="categoryRemark"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column label="显示顺序" align="center" prop="sort" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:goodsCategory:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:goodsCategory:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="goodsCategoryList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column
|
||||
:show-overflow-tooltip="true"
|
||||
label="商品分类名称"
|
||||
align="center"
|
||||
prop="goodsCategoryName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="商品分类编码"
|
||||
align="center"
|
||||
prop="goodsCategoryCode"
|
||||
/>
|
||||
<!-- <el-table-column label="商品分类图片地址" align="center" prop="goodsCategoryPicture" /> -->
|
||||
<el-table-column
|
||||
label="分类概述"
|
||||
align="center"
|
||||
prop="categoryRemark"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column label="显示顺序" align="center" prop="sort" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:goodsCategory:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:goodsCategory:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改商品分类信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="open"
|
||||
width="500px"
|
||||
append-to-body
|
||||
:before-close="cancel"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item
|
||||
label="父级分类名称"
|
||||
prop="parentName"
|
||||
:required="true"
|
||||
v-if="form.parentId"
|
||||
>
|
||||
<el-cascader
|
||||
:props="treeOption"
|
||||
@change="change"
|
||||
style="width: 340px"
|
||||
:show-all-levels="false"
|
||||
:clearable="true"
|
||||
ref="cascader"
|
||||
:placeholder="form.parentName ? form.parentName : ''"
|
||||
>
|
||||
</el-cascader>
|
||||
<!-- <el-input
|
||||
v-model="form.parentName"
|
||||
placeholder="请输入父级分类名称"
|
||||
maxlength="10"
|
||||
disabled
|
||||
/> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类名称" prop="goodsCategoryName">
|
||||
<el-input
|
||||
v-model="form.goodsCategoryName"
|
||||
@ -215,14 +269,39 @@ import {
|
||||
updatePicture,
|
||||
addGoodsCategory,
|
||||
updateGoodsCategory,
|
||||
getStationCategoryList,
|
||||
} 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 {
|
||||
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,
|
||||
};
|
||||
})
|
||||
);
|
||||
});
|
||||
}, 300);
|
||||
},
|
||||
},
|
||||
imgone: "",
|
||||
baseurl: "",
|
||||
// 遮罩层
|
||||
@ -252,6 +331,8 @@ export default {
|
||||
goodsCategoryPicture: null,
|
||||
categoryRemark: null,
|
||||
sort: null,
|
||||
parentId: 0,
|
||||
parentName: "",
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -273,14 +354,68 @@ export default {
|
||||
{ required: true, message: "显示顺序不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
// 树选项
|
||||
deptOptions: undefined,
|
||||
categoryLevel: null,
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "goodsCategoryName",
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
watch: {},
|
||||
|
||||
created() {
|
||||
this.baseurl = baseurl;
|
||||
this.getList();
|
||||
this.info();
|
||||
},
|
||||
methods: {
|
||||
change(e) {
|
||||
this.form.parentId = e[e.length - 1];
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.loading = true;
|
||||
this.queryParams.parentId = data.id;
|
||||
this.queryParams.parentName = data.goodsCategoryName;
|
||||
this.categoryLevel = data.categoryLevel;
|
||||
this.handleQuery();
|
||||
getStationCategoryList(data.id).then((res) => {
|
||||
res.data.forEach((e) => {
|
||||
e.children = [
|
||||
{
|
||||
goodsCategoryName: "",
|
||||
},
|
||||
];
|
||||
});
|
||||
this.loading = false;
|
||||
data.children = res.data;
|
||||
});
|
||||
},
|
||||
/** 查询商品分类信息列表 */
|
||||
info() {
|
||||
this.loading = true;
|
||||
getStationCategoryList(0).then((res) => {
|
||||
res.data.forEach((e) => {
|
||||
e.children = [
|
||||
{
|
||||
goodsCategoryName: "",
|
||||
},
|
||||
];
|
||||
});
|
||||
var obj = [
|
||||
{
|
||||
goodsCategoryName: "商品分类名称",
|
||||
children: res.data,
|
||||
id: 0,
|
||||
},
|
||||
];
|
||||
this.deptOptions = obj;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGoodsCategory(this.queryParams).then((response) => {
|
||||
@ -291,15 +426,18 @@ export default {
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
console.log(this.form);
|
||||
if (this.form.parentId) {
|
||||
// 清空选中的节点
|
||||
this.$refs.cascader.$refs.panel.clearCheckedNodes();
|
||||
// 设置为空可以让节点不高亮显示
|
||||
this.$refs.cascader.$refs.panel.activePath = [];
|
||||
}
|
||||
var obj = { pictureUrlList: [] };
|
||||
if (this.imgone != this.form.goodsCategoryPicture) {
|
||||
obj.pictureUrlList.push(this.form.goodsCategoryPicture);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
this.open = false;
|
||||
this.reset();
|
||||
@ -317,6 +455,8 @@ export default {
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
parentId: null,
|
||||
parentName: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -327,6 +467,11 @@ export default {
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
parentId: 0,
|
||||
};
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
@ -341,6 +486,13 @@ export default {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加商品分类信息";
|
||||
console.log(this.queryParams);
|
||||
// if (this.queryParams.parentId != 0) {
|
||||
this.form.parentId = this.queryParams.parentId;
|
||||
// }
|
||||
this.form.parentName = this.queryParams.parentName;
|
||||
this.form.categoryLevel = this.categoryLevel;
|
||||
console.log(this.form);
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
@ -356,8 +508,6 @@ export default {
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log(this.form);
|
||||
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
@ -367,19 +517,19 @@ export default {
|
||||
obj.pictureUrlList.push(this.imgone);
|
||||
}
|
||||
if (obj.pictureUrlList.length > 0) {
|
||||
updatePicture(obj).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
updatePicture(obj).then((res) => {});
|
||||
}
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.info();
|
||||
});
|
||||
} else {
|
||||
addGoodsCategory(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.info();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -387,9 +537,10 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
console.log(row);
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal
|
||||
.confirm('是否确认删除商品分类信息编号为"' + ids + '"的数据项?')
|
||||
.confirm("是否确认删除?")
|
||||
.then(function () {
|
||||
return delGoodsCategory(ids);
|
||||
})
|
||||
@ -422,3 +573,9 @@ export default {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-cascader .el-input input::-webkit-input-placeholder {
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -9,6 +9,9 @@ import {
|
||||
editGoodsWhetherShelf,
|
||||
} from "@/api/system/goodsInfo";
|
||||
import editor from "@/components/Editor";
|
||||
import {
|
||||
getStationCategoryList,
|
||||
} from "@/api/system/goodsCategory";
|
||||
import { getListByUser } from "@/api/system/userlist.js";
|
||||
import stationAcatar from "../stationAvatar/index.vue";
|
||||
import baseurl from "@/api/baseurl.js";
|
||||
@ -135,6 +138,26 @@ export default {
|
||||
{ required: true, message: "请输入商品顺序", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
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
|
||||
}
|
||||
}))
|
||||
});
|
||||
}, 300);
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -351,22 +374,20 @@ export default {
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
console.log(row);
|
||||
// this.reset();
|
||||
const id = row.goodsInfoId || this.ids;
|
||||
getGoodsInfo(id).then((response) => {
|
||||
console.log(response);
|
||||
this.form = response.data[0];
|
||||
this.form = response.data;
|
||||
this.form.nurseStationName = row.nurseStationName;
|
||||
this.imgone = this.form.goodsPictureUrl;
|
||||
if (response.data[0].goodAttributeDetailsLists) {
|
||||
this.goodDetailsLists = response.data[0].goodAttributeDetailsLists;
|
||||
if (response.data.goodAttributeDetailsLists) {
|
||||
this.goodDetailsLists = response.data.goodAttributeDetailsLists;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "修改商品基本信息";
|
||||
});
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log(this.form);
|
||||
@ -499,6 +520,9 @@ export default {
|
||||
|
||||
});
|
||||
},
|
||||
change(e) {
|
||||
this.form.goodsCategoryId = e[e.length - 1]
|
||||
},
|
||||
infos() {
|
||||
var queryFor = {
|
||||
pageNum: 1,
|
||||
|
||||
@ -220,7 +220,6 @@
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="商品名称" prop="goodsName">
|
||||
<el-input
|
||||
v-model="form.goodsName"
|
||||
@ -230,7 +229,17 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类名称" prop="goodsCategoryId">
|
||||
<el-select
|
||||
<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
|
||||
@ -243,7 +252,7 @@
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="商品用途" prop="goodsPurpose">
|
||||
<el-select
|
||||
@ -478,5 +487,9 @@ import goodsInfojs from "./goodsInfojs";
|
||||
export default goodsInfojs;
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-cascader .el-input input::-webkit-input-placeholder {
|
||||
color: black;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@ -908,10 +908,10 @@ export default {
|
||||
sort: null,
|
||||
nurseStationConsumables: [
|
||||
{
|
||||
nurseStationId: "",
|
||||
nurseStationId: null,
|
||||
consumableUnit: null,
|
||||
sort: "",
|
||||
consumablePrice: "",
|
||||
sort: null,
|
||||
consumablePrice: null,
|
||||
consumableDetail: null,
|
||||
nurseStationName: "请选择所属护理站",
|
||||
},
|
||||
|
||||
@ -289,7 +289,6 @@
|
||||
:min-height="82"
|
||||
style="width: 90%"
|
||||
maxlength="300"
|
||||
|
||||
v-model="form.nurseStationItem.nurseItemContent"
|
||||
></editor>
|
||||
</el-form-item>
|
||||
@ -804,7 +803,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
imgs(item) {
|
||||
console.log(item)
|
||||
this.imgsurl.pictureUrlList.push(item);
|
||||
},
|
||||
imgUrl(imgUrl) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user