Commit 3b42857b authored by 燕南天's avatar 燕南天

后台管理系统的优化

parent e502266a
...@@ -13,8 +13,8 @@ module.exports = { ...@@ -13,8 +13,8 @@ module.exports = {
proxyTable: {}, proxyTable: {},
// Various Dev Server settings // Various Dev Server settings
// host: 'localhost', // can be overwritten by process.env.HOST host: 'localhost', // can be overwritten by process.env.HOST
host: '192.168.1.107', // can be overwritten by process.env.HOST // host: '192.168.1.107', // can be overwritten by process.env.HOST
port: 9527, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined port: 9527, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true, autoOpenBrowser: true,
errorOverlay: true, errorOverlay: true,
......
...@@ -34,4 +34,23 @@ export function getStoreAdministrators() { ...@@ -34,4 +34,23 @@ export function getStoreAdministrators() {
}) })
} }
export function batchStores(data) {
return request({
url: '/store/batchStores',
method: 'post',
data: qs.stringify(data)
})
}
export function batchStoreShop(data) {
return request({
url: '/store/batchStoreShop',
method: 'post',
data: qs.stringify(data)
})
}
...@@ -41,3 +41,20 @@ export function getStores() { ...@@ -41,3 +41,20 @@ export function getStores() {
export function batchWorkers(data) {
return request({
url: 'worker/batchWorkers',
method: 'post',
data: qs.stringify(data)
})
}
export function batchWorkerShop(data) {
return request({
url: '/worker/batchWorkerShop',
method: 'post',
data: qs.stringify(data)
})
}
\ No newline at end of file
...@@ -44,14 +44,7 @@ export default { ...@@ -44,14 +44,7 @@ export default {
} }
const fileSize = file.size / 1024 / 1024; axios.post(upLoadUrl, formData).then(res => {
if (fileSize > 2) {
this.$message({
message: "上传图片不能大于2M",
type: "warning"
});
} else {
axios.post(upLoadUrl, formData).then(res => {
if (res.data.code == 1) { if (res.data.code == 1) {
this.imageUrl = res.data.data; this.imageUrl = res.data.data;
this.$emit("emitSuccess", res.data.data); this.$emit("emitSuccess", res.data.data);
...@@ -66,7 +59,6 @@ export default { ...@@ -66,7 +59,6 @@ export default {
}); });
} }
}); });
}
}, },
clearImg() { clearImg() {
this.imageUrl = ""; this.imageUrl = "";
......
...@@ -13,17 +13,52 @@ ...@@ -13,17 +13,52 @@
<el-col class="input-name" :span="7">店铺名称</el-col> <el-col class="input-name" :span="7">店铺名称</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.storeName" @keyup.enter.native="seachFun"></el-input></el-col> <el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.storeName" @keyup.enter.native="seachFun"></el-input></el-col>
</el-col> </el-col>
<el-col :span="4">
<el-col class="input-name":span="7">是否审核</el-col>
<el-col :span="17" style="line-height:40px">
<el-select v-model="seacherParam.isAuditing" placeholder="请选择">
<el-option
v-for="item in isAuditingData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-col>
</el-col>
<el-col :span="4">
<el-col class="input-name":span="7">是否展示</el-col>
<el-col :span="17" style="line-height:40px">
<el-select v-model="seacherParam.isShopping" placeholder="请选择">
<el-option
v-for="item in isShoppingData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-col>
</el-col>
</el-row> </el-row>
</el-card> </el-card>
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> --> <!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> -->
<div class="btns-wrapper-left"> <div class="btns-wrapper-left">
<el-button type="primary" plain @click="add">新增</el-button> <el-button type="primary" plain @click="add">新增</el-button>
<el-button type="success" plain @click="allShowFun" :disabled="!tableItemIDS.length">批量显示</el-button>
<el-button type="danger" plain @click="allSFun" :disabled="!tableItemIDS.length">批量审核</el-button>
</div> </div>
</div> </div>
<div class="table-wrapper"> <div class="table-wrapper">
<el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption"> <el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="serialNumber" label="推荐序号" sortable></el-table-column> <el-table-column prop="serialNumber" label="推荐序号" sortable></el-table-column>
<el-table-column prop="storeName" label="店铺名称"></el-table-column> <el-table-column prop="storeName" label="店铺名称"></el-table-column>
...@@ -426,8 +461,18 @@ export default { ...@@ -426,8 +461,18 @@ export default {
data() { data() {
return { return {
seacherParam: { seacherParam: {
storeName: "" storeName: "",
isAuditing:''
}, },
isAuditingData:[
{name:'审核通过',code:'1'},
{name:'未审核',code:'0'}
],
isShoppingData:[
{name:'已展示',code:1},
{name:'未展示',code:0}
],
// 表格数据 // 表格数据
dataOption: null, dataOption: null,
// 分页数据 // 分页数据
...@@ -483,6 +528,10 @@ export default { ...@@ -483,6 +528,10 @@ export default {
// 店铺管理员 // 店铺管理员
managerData: null, managerData: null,
// 全选的id
tableItemIDS:'',
}; };
}, },
...@@ -575,6 +624,9 @@ export default { ...@@ -575,6 +624,9 @@ export default {
this.maxPrice = prices.split("-")[1]; this.maxPrice = prices.split("-")[1];
}, },
submmitFun() { submmitFun() {
// window.location.href = 'http://localhost:9527/#/worker/workerList'
const param = Utils.deepClone(this.dialogBindData); const param = Utils.deepClone(this.dialogBindData);
param.consumeInterval = `${this.minPrice}-${this.maxPrice}`; param.consumeInterval = `${this.minPrice}-${this.maxPrice}`;
...@@ -605,8 +657,10 @@ export default { ...@@ -605,8 +657,10 @@ export default {
message: this.dialogType === 1 ? "添加成功" : "编辑成功", message: this.dialogType === 1 ? "添加成功" : "编辑成功",
type: "success" type: "success"
}); });
this.submmitSuccess = false; this.submmitSuccess = false;
this.handleClose(); this.handleClose();
}); });
}); });
}, },
...@@ -815,13 +869,53 @@ export default { ...@@ -815,13 +869,53 @@ export default {
return data[idx].administratorsName; return data[idx].administratorsName;
} }
} }
},
handleSelectionChange(val) {
const filterId = val => {
let arr = [];
if (val.length) {
for (const item of val) {
arr.push(item.storeId);
}
return arr;
} else {
return [];
}
};
this.tableItemIDS = filterId(val).join(",");
console.log(this.tableItemIDS)
},
// 全部审核
allSFun(){
const param = {
storeIds:this.tableItemIDS
}
store.batchStores(param).then(res=>{
this.getList()
})
},
allShowFun(){
const param = {
storeIds:this.tableItemIDS
}
debugger
store.batchStoreShop(param).then(res=>{
this.getList()
})
} }
}, },
computed: { computed: {
// 激活重置按钮 // 激活重置按钮
isActiveReset() { isActiveReset() {
for (const key in this.seacherParam) { for (const key in this.seacherParam) {
if (this.seacherParam[key]) { if (this.seacherParam[key] == 0 || this.seacherParam[key]) {
return false; return false;
} }
} }
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<el-row :gutter="15" v-if="this.dialogBindData.flag!=='1'"> <el-row :gutter="15" v-if="this.dialogBindData.flag!=='1'">
<el-col :span="8" class="content-left"><label>用户角色</label></el-col> <el-col :span="8" class="content-left"><label>用户角色</label></el-col>
<el-col :span="16" class="content-right"> <el-col :span="16" class="content-right">
<el-select size="small" v-if="dialogType===1 || dialogType===2" placeholder="请选择角色" v-model="dialogBindData.sysRole"> <el-select size="small" v-if="dialogType===1 || dialogType===2" placeholder="请选择角色" v-model="sysRoleId">
<el-option <el-option
v-for="item in chooseRole" v-for="item in chooseRole"
:key="item.roleId" :key="item.roleId"
...@@ -111,11 +111,11 @@ ...@@ -111,11 +111,11 @@
:value="item.roleId"> :value="item.roleId">
</el-option> </el-option>
</el-select> </el-select>
<span v-else>{{dialogBindData.sysRole}}</span> <span v-else>{{sysRoleName}}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="15"> <!-- <el-row :gutter="15">
<el-col :span="8" class="content-left"><label>店铺管理员</label></el-col> <el-col :span="8" class="content-left"><label>店铺管理员</label></el-col>
<el-col :span="16" class="content-right"> <el-col :span="16" class="content-right">
<el-select size="small" v-if="dialogType===1 || dialogType===2" placeholder="请选择店铺管理员" v-model="dialogBindData.administratorsId"> <el-select size="small" v-if="dialogType===1 || dialogType===2" placeholder="请选择店铺管理员" v-model="dialogBindData.administratorsId">
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</el-select> </el-select>
<span v-else>{{dialogBindData.administratorsName}}</span> <span v-else>{{dialogBindData.administratorsName}}</span>
</el-col> </el-col>
</el-row> </el-row> -->
<el-row :gutter="15"> <el-row :gutter="15">
...@@ -238,8 +238,12 @@ export default { ...@@ -238,8 +238,12 @@ export default {
administratorsId:"" administratorsId:""
}, },
//店铺管理员下拉数据
shopAdminsData:null, sysRoleName:'',
sysRoleId:'',
// //店铺管理员下拉数据
// shopAdminsData:null,
// 是否提交 // 是否提交
submmitSuccess: false, submmitSuccess: false,
...@@ -340,7 +344,6 @@ export default { ...@@ -340,7 +344,6 @@ export default {
}); });
}, },
edit(data) { edit(data) {
debugger
this.dialogType = 2; this.dialogType = 2;
// this.getRoleList(() => { // this.getRoleList(() => {
// this.getSectionsByDeptId(data.deptId, () => { // this.getSectionsByDeptId(data.deptId, () => {
...@@ -348,12 +351,18 @@ export default { ...@@ -348,12 +351,18 @@ export default {
// this.dialogState = true; // this.dialogState = true;
// }); // });
// }); // });
this.getRoleAndUserData(() => {
this.reBindData(data); this.sysRoleName = data.sysRole[0].roleName
this.sysRoleId = data.sysRole[0].roleId
this.getRoleAndUserData(() => {
this.reBindData(data);
this.dialogState = true; this.dialogState = true;
}); });
}, },
check(data) { check(data) {
this.sysRoleName = data.sysRole[0].roleName
this.sysRoleId = data.sysRole[0].roleId
this.dialogType = 3; this.dialogType = 3;
this.getRoleAndUserData(() => { this.getRoleAndUserData(() => {
this.reBindData(data); this.reBindData(data);
...@@ -375,65 +384,28 @@ export default { ...@@ -375,65 +384,28 @@ export default {
} }
}, },
submmitFun() { submmitFun() {
console.log(this.dialogBindData)
this.dialogBindData.sysRole = this.sysRoleId;
let isSubmitActive;
if (this.dialogType === 1) { this.submmitSuccess = true;
// alert(`添加${JSON.stringify(this.dialogBindData)}`); system.addOrEditSysUser(this.dialogBindData).then(res => {
isSubmitActive = if (res.data.code == 1) {
this.dialogBindData.userName && this.getList(() => {
this.dialogBindData.password && this.$message({
this.dialogBindData.realName && message: this.dialogType === 1 ? "添加成功" : "编辑成功",
this.dialogBindData.mobilePhone && type: "success"
this.dialogBindData.sysRole && });
this.dialogBindData.administratorsId; this.submmitSuccess = false;
// this.dialogBindData.administratorsName; this.handleClose();
} else {
// alert(`编辑${JSON.stringify(this.dialogBindData)}`);
isSubmitActive =
this.dialogBindData.userId &&
this.dialogBindData.userName &&
this.dialogBindData.password &&
this.dialogBindData.realName &&
this.dialogBindData.mobilePhone &&
this.dialogBindData.administratorsId;
// this.dialogBindData.administratorsName;
}
// // 发送添加请求
if (isSubmitActive) {
if (this.dialogBindData.password.length < 6) {
this.$message({
message: "密码长度必须大于六位!",
type: "warning"
}); });
} else { } else {
this.submmitSuccess = true; this.$message({
system.addOrEditSysUser(this.dialogBindData).then(res => { message: res.data.msg,
debugger; type: "warning"
if (res.data.code == 1) {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
type: "success"
});
this.submmitSuccess = false;
this.handleClose();
});
} else {
this.$message({
message: res.data.msg,
type: "warning"
});
this.submmitSuccess = false;
}
}); });
this.submmitSuccess = false;
} }
} else { });
this.$message({
message: "请完善提交信息",
type: "warning"
});
}
}, },
//关闭弹框 //关闭弹框
handleClose() { handleClose() {
...@@ -448,6 +420,8 @@ export default { ...@@ -448,6 +420,8 @@ export default {
} }
} }
this.sectionDatas = null; this.sectionDatas = null;
this.sysRoleName = ""
this.sysRoleId = ""
}, },
// 分页处理 // 分页处理
handleSizeChange(val) { handleSizeChange(val) {
...@@ -500,14 +474,13 @@ export default { ...@@ -500,14 +474,13 @@ export default {
.all([ .all([
//方法一 //方法一
system.queryAllSysRole().then(res => { system.queryAllSysRole().then(res => {
debugger
this.chooseRole = res.data; this.chooseRole = res.data;
}), }),
//方法二 //方法二
system.queryAllShopAdmin().then(res => { // system.queryAllShopAdmin().then(res => {
debugger // debugger
this.shopAdminsData = res.data.data; // this.shopAdminsData = res.data.data;
}) // })
]) ])
.then( .then(
axios.spread((acct, perms)=> { axios.spread((acct, perms)=> {
......
...@@ -13,6 +13,50 @@ ...@@ -13,6 +13,50 @@
<el-col class="input-name" :span="7">员工姓名</el-col> <el-col class="input-name" :span="7">员工姓名</el-col>
<el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.workerName" @keyup.enter.native="seachFun"></el-input></el-col> <el-col :span="17"><el-input placeholder="请输入关键字" v-model="seacherParam.workerName" @keyup.enter.native="seachFun"></el-input></el-col>
</el-col> </el-col>
<el-col :span="4">
<el-col class="input-name":span="7">所属店铺</el-col>
<el-col :span="17" style="line-height:40px">
<el-select v-model="seacherParam.storeId" placeholder="请选择">
<el-option
v-for="item in ownStoreData"
:key="item.storeId"
:label="item.storeName"
:value="item.storeId">
</el-option>
</el-select>
</el-col>
</el-col>
<el-col :span="4">
<el-col class="input-name":span="7">是否审核</el-col>
<el-col :span="17" style="line-height:40px">
<el-select v-model="seacherParam.isAuditing" placeholder="请选择">
<el-option
v-for="item in isAuditingData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-col>
</el-col>
<el-col :span="4">
<el-col class="input-name":span="7">是否展示</el-col>
<el-col :span="17" style="line-height:40px">
<el-select v-model="seacherParam.isShopping" placeholder="请选择">
<el-option
v-for="item in isShoppingData"
:key="item.code"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</el-col>
</el-col>
</el-row> </el-row>
</el-card> </el-card>
<el-card> <el-card>
...@@ -20,10 +64,13 @@ ...@@ -20,10 +64,13 @@
<!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> --> <!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> -->
<div class="btns-wrapper-left"> <div class="btns-wrapper-left">
<el-button type="primary" plain @click="add">新增</el-button> <el-button type="primary" plain @click="add">新增</el-button>
<el-button type="success" plain @click="allShowFun" :disabled="!tableItemIDS.length">批量显示</el-button>
<el-button type="danger" plain @click="allSFun" :disabled="!tableItemIDS.length">批量审核</el-button>
</div> </div>
</div> </div>
<div class="table-wrapper"> <div class="table-wrapper">
<el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption"> <el-table empty-text="暂无数据" :stripe="true" :data="dataOption" v-loading="!dataOption" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="serialNumber" label="推荐序号" sortable></el-table-column> <el-table-column prop="serialNumber" label="推荐序号" sortable></el-table-column>
<el-table-column prop="workerNumber" label="工号"></el-table-column> <el-table-column prop="workerNumber" label="工号"></el-table-column>
...@@ -348,8 +395,23 @@ export default { ...@@ -348,8 +395,23 @@ export default {
data() { data() {
return { return {
seacherParam: { seacherParam: {
workerName: "" workerName: "",
isAuditing:'',
isShopping:'',
storeId:""
}, },
isAuditingData:[
{code:'1',name:'已审核'},
{code:'0',name:'未审核'}
],
isShoppingData:[
{code:1,name:'已展示'},
{code:0,name:'未展示'}
],
ownStoreData:null,
// 表格数据 // 表格数据
dataOption: null, dataOption: null,
// 分页数据 // 分页数据
...@@ -386,12 +448,22 @@ export default { ...@@ -386,12 +448,22 @@ export default {
submmitSuccess: false, submmitSuccess: false,
// 店铺的下拉 // 店铺的下拉
storeData: null storeData: null,
tableItemIDS:''
}; };
}, },
beforeMount() { beforeMount() {
this.getList();
worker.getStores().then(res=>{
this.ownStoreData = res.data.data
this.getList();
})
}, },
mounted() {}, mounted() {},
methods: { methods: {
...@@ -619,13 +691,50 @@ export default { ...@@ -619,13 +691,50 @@ export default {
return data[idx].storeName; return data[idx].storeName;
} }
} }
},
handleSelectionChange(val) {
const filterId = val => {
let arr = [];
if (val.length) {
for (const item of val) {
arr.push(item.workerId);
}
return arr;
} else {
return [];
}
};
this.tableItemIDS = filterId(val).join(",");
console.log(this.tableItemIDS)
},
// 全部审核
allSFun(){
const param = {
workerIds:this.tableItemIDS
}
worker.batchWorkers(param).then(res=>{
this.getList()
})
},
allShowFun(){
const param = {
workerIds:this.tableItemIDS
}
worker.batchWorkerShop(param).then(res=>{
this.getList()
})
} }
}, },
computed: { computed: {
// 激活重置按钮 // 激活重置按钮
isActiveReset() { isActiveReset() {
for (const key in this.seacherParam) { for (const key in this.seacherParam) {
if (this.seacherParam[key]) { if (this.seacherParam[key] == 0 || this.seacherParam[key]) {
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment