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

后台管理系统的优化

parent e502266a
......@@ -13,8 +13,8 @@ module.exports = {
proxyTable: {},
// Various Dev Server settings
// host: 'localhost', // can be overwritten by process.env.HOST
host: '192.168.1.107', // 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
port: 9527, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true,
errorOverlay: true,
......
......@@ -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() {
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 {
}
const fileSize = file.size / 1024 / 1024;
if (fileSize > 2) {
this.$message({
message: "上传图片不能大于2M",
type: "warning"
});
} else {
axios.post(upLoadUrl, formData).then(res => {
axios.post(upLoadUrl, formData).then(res => {
if (res.data.code == 1) {
this.imageUrl = res.data.data;
this.$emit("emitSuccess", res.data.data);
......@@ -66,7 +59,6 @@ export default {
});
}
});
}
},
clearImg() {
this.imageUrl = "";
......
......@@ -13,17 +13,52 @@
<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>
<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-card>
<el-card>
<div slot="header" class="clearfix">
<!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> -->
<div class="btns-wrapper-left">
<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 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="storeName" label="店铺名称"></el-table-column>
......@@ -426,8 +461,18 @@ export default {
data() {
return {
seacherParam: {
storeName: ""
storeName: "",
isAuditing:''
},
isAuditingData:[
{name:'审核通过',code:'1'},
{name:'未审核',code:'0'}
],
isShoppingData:[
{name:'已展示',code:1},
{name:'未展示',code:0}
],
// 表格数据
dataOption: null,
// 分页数据
......@@ -483,6 +528,10 @@ export default {
// 店铺管理员
managerData: null,
// 全选的id
tableItemIDS:'',
};
},
......@@ -575,6 +624,9 @@ export default {
this.maxPrice = prices.split("-")[1];
},
submmitFun() {
// window.location.href = 'http://localhost:9527/#/worker/workerList'
const param = Utils.deepClone(this.dialogBindData);
param.consumeInterval = `${this.minPrice}-${this.maxPrice}`;
......@@ -605,8 +657,10 @@ export default {
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
type: "success"
});
this.submmitSuccess = false;
this.handleClose();
});
});
},
......@@ -815,13 +869,53 @@ export default {
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: {
// 激活重置按钮
isActiveReset() {
for (const key in this.seacherParam) {
if (this.seacherParam[key]) {
if (this.seacherParam[key] == 0 || this.seacherParam[key]) {
return false;
}
}
......
......@@ -103,7 +103,7 @@
<el-row :gutter="15" v-if="this.dialogBindData.flag!=='1'">
<el-col :span="8" class="content-left"><label>用户角色</label></el-col>
<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
v-for="item in chooseRole"
:key="item.roleId"
......@@ -111,11 +111,11 @@
:value="item.roleId">
</el-option>
</el-select>
<span v-else>{{dialogBindData.sysRole}}</span>
<span v-else>{{sysRoleName}}</span>
</el-col>
</el-row>
<el-row :gutter="15">
<!-- <el-row :gutter="15">
<el-col :span="8" class="content-left"><label>店铺管理员</label></el-col>
<el-col :span="16" class="content-right">
<el-select size="small" v-if="dialogType===1 || dialogType===2" placeholder="请选择店铺管理员" v-model="dialogBindData.administratorsId">
......@@ -128,7 +128,7 @@
</el-select>
<span v-else>{{dialogBindData.administratorsName}}</span>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="15">
......@@ -238,8 +238,12 @@ export default {
administratorsId:""
},
//店铺管理员下拉数据
shopAdminsData:null,
sysRoleName:'',
sysRoleId:'',
// //店铺管理员下拉数据
// shopAdminsData:null,
// 是否提交
submmitSuccess: false,
......@@ -340,7 +344,6 @@ export default {
});
},
edit(data) {
debugger
this.dialogType = 2;
// this.getRoleList(() => {
// this.getSectionsByDeptId(data.deptId, () => {
......@@ -348,12 +351,18 @@ export default {
// 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;
});
},
check(data) {
this.sysRoleName = data.sysRole[0].roleName
this.sysRoleId = data.sysRole[0].roleId
this.dialogType = 3;
this.getRoleAndUserData(() => {
this.reBindData(data);
......@@ -375,65 +384,28 @@ export default {
}
},
submmitFun() {
console.log(this.dialogBindData)
let isSubmitActive;
if (this.dialogType === 1) {
// alert(`添加${JSON.stringify(this.dialogBindData)}`);
isSubmitActive =
this.dialogBindData.userName &&
this.dialogBindData.password &&
this.dialogBindData.realName &&
this.dialogBindData.mobilePhone &&
this.dialogBindData.sysRole &&
this.dialogBindData.administratorsId;
// this.dialogBindData.administratorsName;
} 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"
this.dialogBindData.sysRole = this.sysRoleId;
this.submmitSuccess = true;
system.addOrEditSysUser(this.dialogBindData).then(res => {
if (res.data.code == 1) {
this.getList(() => {
this.$message({
message: this.dialogType === 1 ? "添加成功" : "编辑成功",
type: "success"
});
this.submmitSuccess = false;
this.handleClose();
});
} else {
this.submmitSuccess = true;
system.addOrEditSysUser(this.dialogBindData).then(res => {
debugger;
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.$message({
message: res.data.msg,
type: "warning"
});
this.submmitSuccess = false;
}
} else {
this.$message({
message: "请完善提交信息",
type: "warning"
});
}
});
},
//关闭弹框
handleClose() {
......@@ -448,6 +420,8 @@ export default {
}
}
this.sectionDatas = null;
this.sysRoleName = ""
this.sysRoleId = ""
},
// 分页处理
handleSizeChange(val) {
......@@ -500,14 +474,13 @@ export default {
.all([
//方法一
system.queryAllSysRole().then(res => {
debugger
this.chooseRole = res.data;
}),
//方法二
system.queryAllShopAdmin().then(res => {
debugger
this.shopAdminsData = res.data.data;
})
// system.queryAllShopAdmin().then(res => {
// debugger
// this.shopAdminsData = res.data.data;
// })
])
.then(
axios.spread((acct, perms)=> {
......
......@@ -13,6 +13,50 @@
<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>
<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-card>
<el-card>
......@@ -20,10 +64,13 @@
<!-- <span><i class="iconfont icon-sousuo"></i>表格数据</span> -->
<div class="btns-wrapper-left">
<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 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="workerNumber" label="工号"></el-table-column>
......@@ -348,8 +395,23 @@ export default {
data() {
return {
seacherParam: {
workerName: ""
workerName: "",
isAuditing:'',
isShopping:'',
storeId:""
},
isAuditingData:[
{code:'1',name:'已审核'},
{code:'0',name:'未审核'}
],
isShoppingData:[
{code:1,name:'已展示'},
{code:0,name:'未展示'}
],
ownStoreData:null,
// 表格数据
dataOption: null,
// 分页数据
......@@ -386,12 +448,22 @@ export default {
submmitSuccess: false,
// 店铺的下拉
storeData: null
storeData: null,
tableItemIDS:''
};
},
beforeMount() {
this.getList();
worker.getStores().then(res=>{
this.ownStoreData = res.data.data
this.getList();
})
},
mounted() {},
methods: {
......@@ -619,13 +691,50 @@ export default {
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: {
// 激活重置按钮
isActiveReset() {
for (const key in this.seacherParam) {
if (this.seacherParam[key]) {
if (this.seacherParam[key] == 0 || this.seacherParam[key]) {
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