jsk 商超
This commit is contained in:
parent
7e81bee3ba
commit
d33855f05b
|
|
@ -57,7 +57,7 @@ export function deleteSupermarketApi(data) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 通过角色查人员
|
||||
export function userListByRoleApi(data) {
|
||||
return request({
|
||||
|
|
@ -69,6 +69,17 @@ export function deleteSupermarketApi(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
// 商品列表
|
||||
export function shopPageListApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/supermarket_product/list',
|
||||
method: 'get',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -79,4 +90,3 @@ export function deleteSupermarketApi(data) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -78,11 +78,11 @@
|
|||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
>
|
||||
<el-form-item label="所属区域" prop="areaId">
|
||||
<el-cascader v-model="queryParams.areaId"
|
||||
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'label'
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
|
|
@ -149,7 +149,7 @@
|
|||
:disabled="multiple"
|
||||
@click="handleBatchDel"
|
||||
>批量删除</el-button>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
|
|
@ -160,23 +160,23 @@
|
|||
:show-file-list="false"
|
||||
:disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:on-success="handleFileSuccess"
|
||||
>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
size="mini"
|
||||
>批量导入
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
size="mini"
|
||||
@click="importTemplate"
|
||||
@click="importTemplate"
|
||||
>模板下载
|
||||
</el-button>
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
|
@ -189,22 +189,22 @@
|
|||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="商品名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="商品类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="100"/>
|
||||
<el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="商品编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="商品名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="商品类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="100"/>
|
||||
<el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="商品进价(元)" align="center" key="unitPrice" prop="unitPrice" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零售价(元)" align="center" key="salePrice" prop="salePrice" :show-overflow-tooltip="true">
|
||||
<el-table-column label="零售价(元)" align="center" key="salePrice" prop="salePrice" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ (scope.row.salePrice/100).toFixed(2)||"" }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="100" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
|
@ -247,7 +247,7 @@
|
|||
<el-form-item label="所属区域" prop="areaId">
|
||||
<el-cascader v-model="form.areaId" :disabled="isEditType"
|
||||
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'label'
|
||||
|
|
@ -265,14 +265,14 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||
<el-button @click="open=false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
<!-- 添加或修改用户配置对话框 -->
|
||||
<material-dialog :visible.sync="dialogVisible" :title="title" :treeOptions="treeOptions" :treeAreaOptions="treeAreaOptions" @submit="handleDialogSubmit" ref="materialDialog" />
|
||||
|
|
@ -323,7 +323,7 @@ export default {
|
|||
areaId:null,
|
||||
materialName:"",
|
||||
barCode:"",
|
||||
materialCode:"",
|
||||
materialCode:"",
|
||||
materialTypeIds:[]
|
||||
},
|
||||
// 总条数
|
||||
|
|
@ -351,13 +351,13 @@ export default {
|
|||
},
|
||||
]
|
||||
},
|
||||
parentId: undefined,
|
||||
parentId: undefined,
|
||||
treeAreaOptions:[],//区域树
|
||||
batchIds:[],
|
||||
batchIds:[],
|
||||
//导入参数
|
||||
upload: {
|
||||
upload: {
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
isUploading: false,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
// 上传的地址
|
||||
|
|
@ -384,26 +384,26 @@ export default {
|
|||
/** 查询新增页面-上级类型下拉树结构 */
|
||||
getTreeData() {
|
||||
shopMaterialTreeApi().then((response) => {
|
||||
this.treeOptions = this.handleTree(response.rows,'materialTypeId');
|
||||
this.treeOptions = this.handleTree(response.rows,'materialTypeId');
|
||||
this.addLevel(this.treeOptions)
|
||||
console.log("this.treeOptions",this.treeOptions)
|
||||
if(this.treeOptions && this.treeOptions.length > 0){
|
||||
console.log("this.treeOptions",this.treeOptions)
|
||||
if(this.treeOptions && this.treeOptions.length > 0){
|
||||
this.getList();
|
||||
} else {
|
||||
} else {
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
},
|
||||
handleTree(data, idKey, parentIdKey = 'parentId', childrenKey = 'children') {
|
||||
// 用于存储节点数据的Map,以idKey为键
|
||||
const nodeMap = new Map();
|
||||
const nodeMap = new Map();
|
||||
// 用于存储根节点的数组
|
||||
const rootNodes = [];
|
||||
const rootNodes = [];
|
||||
|
||||
// 遍历数据,构建nodeMap并找到根节点
|
||||
data.forEach(node => {
|
||||
// 将节点添加到nodeMap中,并初始化children为空数组
|
||||
nodeMap.set(node[idKey], { ...node, [childrenKey]: [] });
|
||||
nodeMap.set(node[idKey], { ...node, [childrenKey]: [] });
|
||||
// 如果parentId为null或父节点不存在于nodeMap中,则该节点为根节点
|
||||
if (node[parentIdKey] === null || !nodeMap.has(node[parentIdKey])) {
|
||||
// 将根节点添加到rootNodes数组中
|
||||
|
|
@ -418,12 +418,12 @@ export default {
|
|||
});
|
||||
|
||||
// 返回根节点数组,它现在包含了完整的树形结构
|
||||
return rootNodes;
|
||||
return rootNodes;
|
||||
},
|
||||
addLevel(nodes, level = 0) {
|
||||
nodes.forEach(node => {
|
||||
node.level = level; // 设置当前节点的层级
|
||||
if (node.children) { // 如果节点有子节点,递归处理子节点
|
||||
node.level = level; // 设置当前节点的层级
|
||||
if (node.children) { // 如果节点有子节点,递归处理子节点
|
||||
this.addLevel(node.children, level + 1);
|
||||
}
|
||||
});
|
||||
|
|
@ -433,19 +433,19 @@ export default {
|
|||
console.log(data)
|
||||
// this.handleQuery();
|
||||
},
|
||||
handleCheckChange(data, checked, indeterminate) {
|
||||
handleCheckChange(data, checked, indeterminate) {
|
||||
this.handleQuery();
|
||||
},
|
||||
/* 树节点增加 */
|
||||
appendTreeNode(data) {
|
||||
console.log(data)
|
||||
this.isEditType=false;
|
||||
this.isEditType=false;
|
||||
this.form={}
|
||||
this.resetForm("form");
|
||||
this.$set(this.form,"parentId",data.materialTypeId)
|
||||
this.$set(this.form,"parentId",data.materialTypeId)
|
||||
this.open = true;
|
||||
this.title = "新增";
|
||||
},
|
||||
},
|
||||
/* 树节点修改 */
|
||||
editTreeNode(data) {
|
||||
this.isEditType=true;
|
||||
|
|
@ -516,7 +516,7 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
|
|
@ -526,7 +526,7 @@ export default {
|
|||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.pageSize = 10;
|
||||
this.queryParams.pageSize = 10;
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 查询列表 */
|
||||
|
|
@ -539,7 +539,7 @@ export default {
|
|||
"areaId": this.queryParams.areaId,
|
||||
"materialName": this.queryParams.materialName,
|
||||
"barCode": this.queryParams.barCode,
|
||||
"materialCode": this.queryParams.materialCode,
|
||||
"materialCode": this.queryParams.materialCode,
|
||||
"materialTypeIds": this.$refs.typeTree.getCheckedKeys(),
|
||||
}
|
||||
getMaterialListApi(params).then((response) => {
|
||||
|
|
@ -551,7 +551,7 @@ export default {
|
|||
//新增修改弹窗-区域树
|
||||
getAreaTreeData() {
|
||||
systemAreaTreeApi({}).then((response) => {
|
||||
this.treeAreaOptions = response.data;
|
||||
this.treeAreaOptions = response.data;
|
||||
});
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
|
|
@ -563,7 +563,7 @@ export default {
|
|||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.title = "修改";
|
||||
this.dialogVisible = true;
|
||||
this.dialogVisible = true;
|
||||
// 在显示对话框后,可以通过 $refs 访问子组件方法设置表单数据
|
||||
this.$nextTick(() => {
|
||||
// 假设子组件提供了 setFormData 方法
|
||||
|
|
@ -600,10 +600,10 @@ export default {
|
|||
this.getList();
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
handleSelectionChange(selection){
|
||||
this.batchIds = []
|
||||
this.batchIds = selection.map((item) => item.materialId)
|
||||
this.batchIds = selection.map((item) => item.materialId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
|
@ -611,11 +611,11 @@ export default {
|
|||
handleBatchDel(){
|
||||
console.log(this.batchIds)
|
||||
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
//批量导入
|
||||
// /api/v1/menumaterial/batch/import/material
|
||||
|
|
@ -624,7 +624,7 @@ export default {
|
|||
this.upload.isUploading = true
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.isUploading = false
|
||||
this.$refs.upload.clearFiles()
|
||||
this.$modal.msgSuccess("后台导入中,请稍后刷新列表!");
|
||||
|
|
@ -637,7 +637,7 @@ export default {
|
|||
downloadFileByUrl(url)
|
||||
},
|
||||
|
||||
|
||||
|
||||
// getParentName(list, id) {
|
||||
// try {
|
||||
// list.forEach((e) => {
|
||||
|
|
@ -652,7 +652,7 @@ export default {
|
|||
// });
|
||||
// } catch (error) {}
|
||||
// },
|
||||
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue