Commit 11e79dd5 by YG8999

保洁及保洁记录、门店分配保洁功能

parent ec91d9ba
import request from '@/utils/request'
// 查询保洁员用户列表
export function listConsumer(query) {
return request({
url: '/system/cleanConsumer/list',
method: 'get',
params: query
})
}
// 查询保洁员用户详细
export function getConsumer(id) {
return request({
url: '/system/cleanConsumer/' + id,
method: 'get'
})
}
// 新增保洁员用户
export function addConsumer(data) {
return request({
url: '/system/cleanConsumer',
method: 'post',
data: data
})
}
// 修改保洁员用户
export function updateConsumer(data) {
return request({
url: '/system/cleanConsumer',
method: 'put',
data: data
})
}
// 删除保洁员用户
export function delConsumer(id) {
return request({
url: '/system/cleanConsumer/' + id,
method: 'delete'
})
}
......@@ -42,3 +42,50 @@ export function delStore(id) {
method: 'delete'
})
}
// 查询门店已分配保洁员列表
export function allocatedUserList(query) {
return request({
url: '/system/store/consumer/allocatedList',
method: 'get',
params: query
})
}
// 查询为分配保洁列表
export function unallocatedUserList(query) {
return request({
url: '/system/store/consumer/unallocatedList',
method: 'get',
params: query
})
}
// 取消分配
export function authUserCancel(data) {
return request({
url: '/system/store/consumer/cancel',
method: 'put',
data: data
})
}
// 批量取消分配
export function authUserCancelAll(data) {
return request({
url: '/system/store/consumer/cancelAll',
method: 'put',
params: data
})
}
// 分配保洁
export function authUserSelectAll(data) {
return request({
url: '/system/store/consumer/selectAll',
method: 'put',
params: data
})
}
......@@ -121,6 +121,20 @@ export const dynamicRoutes = [
]
},
{
path: '/share/store-consumer',
component: Layout,
hidden: true,
permissions: ['system:store:edit'],
children: [
{
path: 'clean/:storeId(\\d+)',
component: () => import('@/views/system/store/cleanConsumer'),
name: 'CleanConsumer',
meta: { title: '分配保洁', activeMenu: '/system/store' }
}
]
},
{
path: '/system/dict-data',
component: Layout,
hidden: true,
......
<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="handleAdd"
v-hasPermi="['system:cleanConsumer: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:cleanConsumer: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:cleanConsumer:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:cleanConsumer:export']"
>导出</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="openId" />
<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.consumer_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-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:cleanConsumer:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:cleanConsumer: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-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户昵称" />
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="性别" prop="sex">
<!-- <el-input v-model="form.sex" placeholder="请输入会员性别" />-->
<el-select v-model="form.sex" placeholder="请选择性别" clearable>
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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>
</div>
</el-dialog>
</div>
</template>
<script>
import { listConsumer, getConsumer, delConsumer, addConsumer, updateConsumer } from "@/api/system/cleanConsumer";
export default {
name: "Consumer",
dicts: ['sys_user_sex','consumer_role_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 会员用户表格数据
consumerList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
nickName: null,
phone: null,
level: null,
roleType: null,
sex: null,
amount: null,
freeAmount: null,
totalTimes: null,
duration: null
},
// 表单参数
form: {},
// 表单校验
rules: {
nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
],
phone: [
{ required: true, message: "手机号不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询会员用户列表 */
getList() {
this.loading = true;
listConsumer(this.queryParams).then(response => {
this.consumerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
openId: null,
nickName: null,
phone: null,
level: null,
roleType: null,
sex: null,
amount: null,
freeAmount: null,
totalTimes: null,
duration: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加保洁员";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getConsumer(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改保洁员";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateConsumer(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addConsumer(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除保洁员编号为"' + ids + '"的数据项?').then(function() {
return delConsumer(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/consumer/export', {
...this.queryParams
}, `consumer_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<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="openId" />
<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.consumer_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" @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','consumer_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;
if (storeId) {
this.queryParams.storeId = storeId;
this.getList();
}
},
methods: {
/** 查询授权用户列表 */
getList() {
this.loading = true;
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 });
}).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 });
}).then(() => {
this.getList();
this.$modal.msgSuccess("取消成功");
}).catch(() => {});
}
}
};
</script>
......@@ -115,6 +115,13 @@
@click="handleDelete(scope.row)"
v-hasPermi="['system:store:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-user"
@click="handleCleanConsumer(scope.row)"
v-hasPermi="['system:store:edit']"
>分配保洁</el-button>
</template>
</el-table-column>
</el-table>
......@@ -278,6 +285,11 @@ export default {
this.title = "修改门店";
});
},
/** 分配用户操作 */
handleCleanConsumer: function(row) {
const storeId = row.id;
this.$router.push("/share/store-consumer/clean/" + storeId);
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
......
<template>
<!-- 授权用户 -->
<el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<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>
<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>
<el-table @row-click="clickRow" ref="table" :data="consumerList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="微信用户" align="center" prop="openId" />
<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.consumer_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>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSelectUser">确 定</el-button>
<el-button @click="visible = false">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import { unallocatedUserList, authUserSelectAll } from "@/api/system/store";
export default {
dicts: ['sys_user_sex','consumer_role_type'],
props: {
// 角色编号
storeId: {
type: [Number, String]
}
},
data() {
return {
// 遮罩层
visible: false,
// 选中数组值
consumerIds: [],
// 总条数
total: 0,
// 未授权用户数据
consumerList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
storeId: undefined,
nickName: undefined,
phone: undefined
}
};
},
methods: {
// 显示弹框
show() {
this.queryParams.storeId = this.storeId;
this.getList();
this.visible = true;
},
clickRow(row) {
this.$refs.table.toggleRowSelection(row);
},
// 多选框选中数据
handleSelectionChange(selection) {
this.consumerIds = selection.map(item => item.id);
},
// 查询表数据
getList() {
unallocatedUserList(this.queryParams).then(res => {
this.consumerList = res.rows;
this.total = res.total;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 选择授权用户操作 */
handleSelectUser() {
const storeId = this.queryParams.storeId;
const consumerIds = this.consumerIds.join(",");
if (consumerIds == "") {
this.$modal.msgError("请选择要分配的保洁员");
return;
}
authUserSelectAll({ storeId: storeId, consumerIds: consumerIds }).then(res => {
this.$modal.msgSuccess(res.msg);
if (res.code === 200) {
this.visible = false;
this.$emit("ok");
}
});
}
}
};
</script>
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