Commit 62759e80 by 吕明尚

增加分配保洁页面

parent d6e028dc
......@@ -135,6 +135,21 @@ export const dynamicRoutes = [
]
},
{
path: '/share/store-position',
component: Layout,
hidden: true,
permissions: ['system:store:edit'],
children: [
{
path: 'clean/:storeId(\\d+)',
component: () => import('@/views/system/store/positionConsumer'),
name: 'CleanConsumer',
meta: {title: '分配管理员', activeMenu: '/system/store'}
}
]
},
{
path: '/system/dict-data',
component: Layout,
hidden: true,
......
......@@ -74,7 +74,7 @@
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="角色类型" align="center" prop="roleType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.consumer_role_type" :value="scope.row.roleType"/>
<dict-tag :options="dict.type.wechat_role_type" :value="scope.row.roleType"/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="sex">
......@@ -102,7 +102,7 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<select-consumer ref="select" :storeId="queryParams.storeId" @ok="handleQuery" />
<select-consumer ref="select" :storeId="queryParams.storeId" :position="queryParams.position" @ok="handleQuery"/>
</div>
</template>
......@@ -112,7 +112,7 @@ import selectConsumer from "./selectConsumer";
export default {
name: "CleanConsumer",
dicts: ['sys_user_sex','consumer_role_type'],
dicts: ['sys_user_sex', 'wechat_role_type'],
components: { selectConsumer },
data() {
return {
......@@ -140,6 +140,7 @@ export default {
},
created() {
const storeId = this.$route.params && this.$route.params.storeId;
this.queryParams.position = 1;
if (storeId) {
this.queryParams.storeId = storeId;
this.getList();
......@@ -149,6 +150,7 @@ export default {
/** 查询授权用户列表 */
getList() {
this.loading = true;
this.queryParams.position = 1;
allocatedUserList(this.queryParams).then(response => {
this.consumerList = response.rows;
this.total = response.total;
......@@ -184,7 +186,7 @@ export default {
cancelAuthUser(row) {
const storeId = this.queryParams.storeId;
this.$modal.confirm('确认要取消分配保洁员"' + row.nickName + '"吗?').then(function() {
return authUserCancel({ consumerId: row.id, storeId: storeId });
return authUserCancel({consumerId: row.id, storeId: storeId, position: 1});
}).then(() => {
this.getList();
this.$modal.msgSuccess("取消成功");
......@@ -195,7 +197,7 @@ export default {
const storeId = this.queryParams.storeId;
const consumerIds = this.consumerIds.join(",");
this.$modal.confirm('是否取消选中分配保洁员数据项?').then(function() {
return authUserCancelAll({ storeId: storeId, consumerIds: consumerIds });
return authUserCancelAll({storeId: storeId, consumerIds: consumerIds, position: 1});
}).then(() => {
this.getList();
this.$modal.msgSuccess("取消成功");
......
......@@ -147,6 +147,14 @@
@click="handleCleanConsumer(scope.row)"
v-hasPermi="['system:store:edit']"
>分配保洁</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-user"
@click="handlePositionConsumer(scope.row)"
v-hasPermi="['system:store:edit']"
>分配管理员
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -527,6 +535,10 @@ export default {
const storeId = row.id;
this.$router.push("/share/store-consumer/clean/" + storeId);
},
handlePositionConsumer: function (row) {
const storeId = row.id;
this.$router.push("/share/store-position/clean/" + storeId);
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="用户昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入用户昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="会员性别" prop="sex">-->
<!-- <el-input-->
<!-- v-model="queryParams.sex"-->
<!-- 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="openSelectUser"
v-hasPermi="['system:store:add']"
>添加管理员
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-circle-close"
size="mini"
:disabled="multiple"
@click="cancelAuthUserAll"
v-hasPermi="['system:store:remove']"
>批量取消
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-close"
size="mini"
@click="handleClose"
>关闭
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="consumerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="账号" align="center" prop="account"/>
<el-table-column label="用户昵称" align="center" prop="nickName"/>
<el-table-column label="手机号" align="center" prop="phone"/>
<el-table-column label="角色类型" align="center" prop="roleType">
<template slot-scope="scope">
<dict-tag :options="dict.type.wechat_role_type" :value="scope.row.roleType"/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="sex">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
</template>
</el-table-column>
<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-circle-close"
@click="cancelAuthUser(scope.row)"
v-hasPermi="['system:store: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"
/>
<select-consumer ref="select" :storeId="queryParams.storeId" :position="queryParams.position" @ok="handleQuery"/>
</div>
</template>
<script>
import {allocatedUserList, authUserCancel, authUserCancelAll} from "@/api/system/store";
import selectConsumer from "./selectConsumer";
export default {
name: "CleanConsumer",
dicts: ['sys_user_sex', 'wechat_role_type'],
components: {selectConsumer},
data() {
return {
// 遮罩层
loading: true,
// 选中用户组
consumerIds: [],
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 用户表格数据
consumerList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
storeId: undefined,
nickName: undefined,
phone: undefined
}
};
},
created() {
const storeId = this.$route.params && this.$route.params.storeId;
this.queryParams.position = 2;
if (storeId) {
this.queryParams.storeId = storeId;
this.getList();
}
},
methods: {
/** 查询授权用户列表 */
getList() {
this.loading = true;
this.queryParams.position = 2;
allocatedUserList(this.queryParams).then(response => {
this.consumerList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
// 返回按钮
handleClose() {
const obj = {path: "/share/store"};
this.$tab.closeOpenPage(obj);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.consumerIds = selection.map(item => item.id)
this.multiple = !selection.length
},
/** 打开授权用户表弹窗 */
openSelectUser() {
this.$refs.select.show();
},
/** 取消授权按钮操作 */
cancelAuthUser(row) {
const storeId = this.queryParams.storeId;
this.$modal.confirm('确认要取消分配管理员"' + row.nickName + '"吗?').then(function () {
return authUserCancel({consumerId: row.id, storeId: storeId, position: 2});
}).then(() => {
this.getList();
this.$modal.msgSuccess("取消成功");
}).catch(() => {
});
},
/** 批量取消授权按钮操作 */
cancelAuthUserAll(row) {
const storeId = this.queryParams.storeId;
const consumerIds = this.consumerIds.join(",");
this.$modal.confirm('是否取消选中分配管理员数据项?').then(function () {
return authUserCancelAll({storeId: storeId, consumerIds: consumerIds, position: 2});
}).then(() => {
this.getList();
this.$modal.msgSuccess("取消成功");
}).catch(() => {
});
}
}
};
</script>
......@@ -33,7 +33,7 @@
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="角色类型" align="center" prop="roleType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.consumer_role_type" :value="scope.row.roleType"/>
<dict-tag :options="dict.type.wechat_role_type" :value="scope.row.roleType"/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="sex">
......@@ -60,11 +60,14 @@
<script>
import { unallocatedUserList, authUserSelectAll } from "@/api/system/store";
export default {
dicts: ['sys_user_sex','consumer_role_type'],
dicts: ['sys_user_sex', 'wechat_role_type'],
props: {
// 角色编号
storeId: {
type: [Number, String]
},
position: {
type: [Number, String]
}
},
data() {
......@@ -91,6 +94,7 @@ export default {
// 显示弹框
show() {
this.queryParams.storeId = this.storeId;
this.queryParams.position = this.position;
this.getList();
this.visible = true;
},
......@@ -123,10 +127,10 @@ export default {
const storeId = this.queryParams.storeId;
const consumerIds = this.consumerIds.join(",");
if (consumerIds == "") {
this.$modal.msgError("请选择要分配的保洁员");
this.$modal.msgError("请选择要分配的员");
return;
}
authUserSelectAll({ storeId: storeId, consumerIds: consumerIds }).then(res => {
authUserSelectAll({storeId: storeId, consumerIds: consumerIds, position: this.position}).then(res => {
this.$modal.msgSuccess(res.msg);
if (res.code === 200) {
this.visible = 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