oil-station/fuintAdmin/src/views/staff/list.vue

886 lines
32 KiB
Vue
Raw Normal View History

2023-10-09 11:06:01 +08:00
<template>
<div class="app-container">
2023-10-10 18:58:08 +08:00
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.realName"
placeholder="请输入姓名"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="auditedStatus">
<el-select
2023-10-12 15:49:06 +08:00
v-model="queryParams.status"
2023-10-10 18:58:08 +08:00
placeholder="状态"
clearable
style="width: 240px"
>
2023-10-12 15:49:06 +08:00
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
2023-10-10 18:58:08 +08:00
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
2023-10-12 15:49:06 +08:00
<!-- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>-->
2023-10-09 11:06:01 +08:00
2023-10-10 18:58:08 +08:00
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleAdd"
>新增员工</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
2023-10-09 11:06:01 +08:00
2023-10-10 18:58:08 +08:00
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<el-table-column label="ID" align="center" prop="id" width="80" />
2023-10-11 18:45:54 +08:00
<el-table-column label="姓名" align="center" prop="realName" />
<el-table-column label="手机号" align="center" prop="mobile" width="110"/>
<el-table-column label="核销权限" align="center" prop="writeOff">
2023-10-12 15:49:06 +08:00
2023-10-10 18:58:08 +08:00
</el-table-column>
2023-10-11 18:45:54 +08:00
<el-table-column label="特殊权限" align="center" prop="specialPrem">
2023-10-12 15:49:06 +08:00
2023-10-11 18:45:54 +08:00
</el-table-column>
<el-table-column label="退款权限" align="center" prop="refund">
2023-10-10 18:58:08 +08:00
<template slot-scope="scope">
2023-10-11 18:45:54 +08:00
<dict-tag :options="dict.type.ywqx" :value="scope.row.refund"/>
2023-10-10 18:58:08 +08:00
</template>
</el-table-column>
2023-10-11 18:45:54 +08:00
<el-table-column label="员工状态" align="center" prop="status">
<template slot-scope="scope">
2023-11-02 18:38:22 +08:00
<el-tag v-if="scope.row.status=='qy'">启用</el-tag>
<el-tag type="info" v-if="scope.row.status=='jy'">禁用</el-tag>
2023-10-11 18:45:54 +08:00
</template>
</el-table-column>
<el-table-column label="公众号" align="center" prop="official">
<template slot-scope="scope">
<dict-tag :options="dict.type.official" :value="scope.row.official"/>
</template>
</el-table-column>
<el-table-column label="一键加油" align="center" prop="isRefuel">
<template slot-scope="scope">
<dict-tag :options="dict.type.display" :value="scope.row.isRefuel"/>
</template>
</el-table-column>
<el-table-column label="模板通知" align="center" prop="notice">
<template slot-scope="scope">
<dict-tag :options="dict.type.notice" :value="scope.row.notice"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="150">
2023-10-10 18:58:08 +08:00
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
2023-10-11 18:45:54 +08:00
<el-table-column label="更新时间" align="center" prop="updateTime" width="150">
2023-10-10 18:58:08 +08:00
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</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)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
2023-10-09 11:06:01 +08:00
2023-10-10 18:58:08 +08:00
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
2023-10-09 11:06:01 +08:00
<!-- 添加或修改对话框 -->
2023-10-25 18:20:42 +08:00
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="60%" append-to-body>
2023-10-09 11:06:01 +08:00
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
2023-10-11 18:45:54 +08:00
<el-col :span="8">
2023-10-09 11:06:01 +08:00
<el-form-item label="姓名" prop="realName">
<el-input v-model="form.realName" placeholder="请输入姓名" maxlength="30" />
</el-form-item>
</el-col>
2023-10-11 18:45:54 +08:00
<el-col :span="8">
2023-10-09 11:06:01 +08:00
<el-form-item label="手机号" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入联系人电话" maxlength="30"/>
</el-form-item>
</el-col>
2023-10-11 18:45:54 +08:00
<el-col :span="8">
2023-11-02 18:38:22 +08:00
<el-form-item label="角色组" prop="roleId">
<el-select v-model="form.roleId" placeholder="请选择角色">
2023-10-11 18:45:54 +08:00
<el-option
2023-11-02 18:38:22 +08:00
v-for="item in roleList"
:key="item.dutyId"
:label="item.dutyName"
:value="item.dutyId"
2023-10-11 18:45:54 +08:00
></el-option>
</el-select>
</el-form-item>
</el-col>
2023-10-09 11:06:01 +08:00
</el-row>
<el-row>
2023-10-11 18:45:54 +08:00
<el-col :span="8">
<el-form-item label="登录密码" prop="password">
2023-11-02 18:38:22 +08:00
<el-input v-model="form.password" type="password" placeholder="请输入登录密码" maxlength="30"/>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="退款权限" prop="refund">
<el-select v-model="form.refund" placeholder="请选择权限">
2023-10-09 11:06:01 +08:00
<el-option
2023-10-11 18:45:54 +08:00
v-for="dict in dict.type.ywqx"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="退款密码" prop="refundPassword">
2023-11-02 18:38:22 +08:00
<el-input v-model="form.refundPassword" type="password" placeholder="请输入退款密码" maxlength="30"/>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
</el-row>
<el-row>
2023-10-25 18:20:42 +08:00
<el-col :span="8" style="display: flex;margin-bottom: 20px">
2023-10-11 18:45:54 +08:00
<template>
<span style="margin-right: 10px">核销权限</span>
2023-10-12 15:49:06 +08:00
<el-checkbox-group v-model="writeOff" ref="" @change="getCheckbox">
2023-10-11 18:45:54 +08:00
<el-checkbox
v-for="dict in dict.type.write_off"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-checkbox>
</el-checkbox-group>
</template>
</el-col>
2023-10-25 18:20:42 +08:00
<el-col :span="16" style="display: flex">
2023-10-31 18:18:30 +08:00
<span style="margin-right: 10px">特殊权限</span>
<el-checkbox-group v-model="specialPrem" @change="getCheckbox">
2023-10-24 14:00:29 +08:00
<el-checkbox
2023-10-31 18:18:30 +08:00
v-for="dict in dict.type.special_prem"
2023-10-24 14:00:29 +08:00
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-checkbox>
</el-checkbox-group>
</el-col>
</el-row>
<el-row>
<el-col :span="24" style="display: flex;margin-bottom: 10px">
2023-10-31 18:18:30 +08:00
<span style="margin-right: 10px;width: 70px">审核权限</span>
<el-checkbox-group v-model="auditPrem" @change="getCheckbox">
2023-10-11 18:45:54 +08:00
<el-checkbox
2023-10-31 18:18:30 +08:00
v-for="dict in dict.type.shqx"
2023-10-11 18:45:54 +08:00
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-checkbox>
</el-checkbox-group>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="一键加油" prop="isRefuel">
<el-select v-model="form.isRefuel">
<el-option
v-for="dict in dict.type.display"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content">加油时选择加油员场景使用,选择不显示加油员将无法被指定<br/>(需系统开启加油选择加油员功能)终端支持:(PCPOS小程序)</div>
2023-10-24 14:00:29 +08:00
<span>加油时选择加油员场...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="POS加油员" prop="pos">
<el-select v-model="form.pos">
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 启用后,当前账户登录POS端后油品收银必选加油员才可进行<br/>下步操作(需系统开启加油选择加油员功能) </div>
2023-10-24 14:00:29 +08:00
<span>启用后,当前账户登录...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交易统计" prop="transaction">
<el-select v-model="form.transaction">
<el-option
v-for="dict in dict.type.transaction"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
2023-10-09 11:06:01 +08:00
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 交易订单显示信息终端支持:(PC<br/>POS小程序) </div>
2023-10-24 14:00:29 +08:00
<span>交易订单显示信息...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-09 11:06:01 +08:00
</el-form-item>
</el-col>
</el-row>
<el-row>
2023-10-11 18:45:54 +08:00
<el-col :span="8">
<el-form-item label="收款通知" prop="notice">
<el-select v-model="form.notice">
<el-option
v-for="dict in dict.type.notice"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 收款成功接收的公众号模板消息通知,<br/>关注公众号,且本站小程序中会员手机号<br/>信息与当前员工手机号一致 </div>
2023-10-24 14:00:29 +08:00
<span>收款成功接收的...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
2023-10-12 15:49:06 +08:00
<el-form-item label="指定油枪" prop="oilGunId" v-show="form.notice == 'zdyx'">
2023-10-11 18:45:54 +08:00
<el-select v-model="form.oilGunId">
<el-option
v-for="dict in dict.type.notice"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
2023-10-24 14:00:29 +08:00
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content">多选,已选油枪号的交易将发送<br/>模板消息)</div>
<span>多选,已选油枪号...</span>
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="时间范围" prop="timeFrame">
2023-10-12 15:49:06 +08:00
<el-select v-model="form.timeFrame">
2023-10-11 18:45:54 +08:00
<el-option
v-for="dict in dict.type.time_frame"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content">当前账户下可查看交易的时间范围(PC<br/>POS端)</div>
2023-10-24 14:00:29 +08:00
<span>当前账户下可查看...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="交班模式" prop="handoverMode">
2023-10-12 15:49:06 +08:00
<el-select v-model="form.handoverMode">
2023-10-11 18:45:54 +08:00
<el-option
v-for="dict in dict.type.handover"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<span> 根据需求自行选择模式 </span>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交班权限" prop="handoverPrem">
<el-select v-model="form.handoverPrem" placeholder="请选择所属店铺">
<el-option
v-for="dict in dict.type.ywqx"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 若无权限,则无法查看交班统计信息和<br/>进行交班操作 </div>
2023-10-24 14:00:29 +08:00
<span>若无权限,则无法查看...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交班退出" prop="handoverOut">
<el-select v-model="form.handoverOut">
<el-option
v-for="dict in dict.type.handover_quit"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
2023-10-24 14:00:29 +08:00
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 进行交班处理后是否退出当前账户 </div>
<span>进行交班处理后是否...</span>
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="交班记录" prop="record">
<el-select v-model="form.record">
<el-option
v-for="dict in dict.type.jbjl"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 全部记录:查看所有员工交班记录,名下<br/>记录:员工自己名下记录(需有交班权限才可查看),<br/>禁用权限:无权限查看交班记录,记录为空 </div>
2023-10-24 14:00:29 +08:00
<span>全部记录:查看所有...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交班商户号" prop="merchantStatus">
<el-select v-model="form.merchantStatus">
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 交班信息是否显示商户号统计信息,<br/>用后当前员工则无商户号统计信息 </div>
2023-10-24 14:00:29 +08:00
<span>交班信息是否显示商...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="员工筛选" prop="screen">
<el-select v-model="form.screen">
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 交易信息是否可以筛选员工进行查<br/>,启用后可筛选则反之 </div>
2023-10-24 14:00:29 +08:00
<span>交易信息是否可以...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="POS权限" prop="posPrem">
2023-10-12 15:49:06 +08:00
<div class="block">
<el-cascader
v-model="posPrem"
:options="posOptions"
:props="props"
@change="handleNodeClick1"
clearable></el-cascader>
2023-10-14 18:02:31 +08:00
<br/>
2023-10-24 14:00:29 +08:00
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> POS手持机中功能对应操作权限 </div>
<span>POS手持机中...</span>
</el-tooltip>
2023-10-12 15:49:06 +08:00
</div>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="小程序权限" prop="appletPrem">
2023-10-12 15:49:06 +08:00
<div class="block">
<el-cascader
v-model="appletPrem"
:options="appletOptions"
:props="props"
@change="handleNodeClick2"
clearable></el-cascader>
2023-10-14 18:02:31 +08:00
<br/>
2023-10-24 14:00:29 +08:00
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 小程序管理端功能对应操作权限 </div>
<span>小程序管理端功能...</span>
</el-tooltip>
2023-10-12 15:49:06 +08:00
</div>
2023-10-11 18:45:54 +08:00
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="账户状态" prop="status">
<el-select v-model="form.status">
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
2023-10-14 18:02:31 +08:00
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 状态禁用后,当前账户则无法进行<br/>登录和操作</div>
2023-10-24 14:00:29 +08:00
<span>状态禁用后,当前账户...</span>
2023-10-14 18:02:31 +08:00
</el-tooltip>
2023-10-09 11:06:01 +08:00
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
2023-10-11 18:45:54 +08:00
<el-form-item label="备注信息">
<el-input v-model="form.description" type="textarea" placeholder="请输入内容"></el-input>
2023-10-09 11:06:01 +08:00
</el-form-item>
</el-col>
</el-row>
</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>
2023-10-10 18:58:08 +08:00
import {getName} from "../../utils/fuint";
2023-10-31 18:18:30 +08:00
import {addStaff, delStaff, getStaff, listStaff, queryStaff, updateStaff} from "@/api/staff/staff";
2023-10-12 15:49:06 +08:00
import {getDuty, listDuty} from "@/api/staff/duty";
2023-10-09 11:06:01 +08:00
export default {
name: "StaffList",
2023-10-16 18:04:58 +08:00
dicts: ['ywqx','write_off','display','zhzt','transaction','time_frame','handover','handover_quit',
2023-10-24 14:00:29 +08:00
'jbjl','official','notice','special_prem','role','shqx'],
2023-10-09 11:06:01 +08:00
data() {
return {
2023-11-02 18:38:22 +08:00
// 角色列表
roleList:[],
2023-10-14 18:02:31 +08:00
drawer: false,
2023-10-09 11:06:01 +08:00
// 标题
title: "",
// 遮罩层
2023-10-10 18:58:08 +08:00
loading: false,
2023-10-09 11:06:01 +08:00
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
storeOptions: [],
2023-10-12 15:49:06 +08:00
// role:[],
posPrem:'',
posOptions:[
2023-10-31 18:18:30 +08:00
{value: '首页权限',label: '首页权限',
children:[
{value: '禁用普通收款', label: '禁用普通收款' },
{value: '禁用会员收款', label: '禁用会员收款' },
{value: '禁用新增会员', label: '禁用新增会员' },
{value: '禁用订单记录', label: '禁用订单记录' },
{value: '禁用员工交班', label: '禁用员工交班' },
]},
{value: '会员储值',label: '会员储值',children:[{value: '禁止会员充值', label: '禁止会员充值' },]},
{value: '会员实体卡',label: '会员实体卡',children:[{value: '禁止绑卡换卡', label: '禁止绑卡换卡' },]},
{value: '会员积分',label: '会员积分',children:[{value: '增加', label: '增加' },{value: '减少', label: '减少' },]},
{value: '加油金变动',label: '加油金变动',children:[{value: '增加', label: '增加' },{value: '减少', label: '减少' },]},
{value: '会员卡券',label: '会员卡券',
children:[
{value: '优惠券赠送', label: '优惠券赠送' },
{value: '兑换券赠送', label: '兑换券赠送' },
]},
{value: '会员成长值',label: '会员成长值',
children:[
{value: '成长值增加', label: '成长值增加' },
{value: '成长值减少', label: '成长值减少' },
]},
2023-10-12 15:49:06 +08:00
],
props: { multiple: true },
appletPrem:'',
appletOptions:[
2023-10-31 18:18:30 +08:00
{value: '交易',label: '交易',children:[{value: '油品交易', label: '油品交易' },]},
{value: '库存',label: '库存',
children:[
{value: '库存盘点', label: '库存盘点' },
{value: '库存查询', label: '库存查询' },
]},
{value: '核销',label: '核销',
children:[
{value: '扫码核销', label: '扫码核销' },
{value: '核销记录', label: '核销记录' },
]},
2023-10-12 15:49:06 +08:00
],
2023-10-11 18:45:54 +08:00
writeOff:[],
2023-10-12 15:49:06 +08:00
write:[],
2023-10-11 18:45:54 +08:00
specialPrem:[],
2023-10-24 14:00:29 +08:00
auditPrem:[],
2023-10-12 15:49:06 +08:00
special:[],
2023-10-09 11:06:01 +08:00
// 总条数
total: 0,
// 表格数据
list: [],
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 默认排序
defaultSort: {prop: 'createTime', order: 'descending'},
// 表单参数
2023-10-11 18:45:54 +08:00
form: {
2023-11-02 18:38:22 +08:00
id:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'',
2023-10-12 15:49:06 +08:00
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
merchantStatus:'qy',screen:'qy', posPrem:'', appletPrem:'', notice:'advice_jy', oilGunId:'', timeFrame:'bx', refund:'yqx',
2023-11-02 18:38:22 +08:00
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',roleId:''
2023-10-11 18:45:54 +08:00
},
2023-10-09 11:06:01 +08:00
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
realName: '',
mobile: '',
2023-10-12 15:49:06 +08:00
status: ''
2023-10-09 11:06:01 +08:00
},
// 表单校验
rules: {
realName: [
{ required: true, message: "姓名不能为空", trigger: "blur" },
{ min: 2, max: 30, message: '姓名长度必须介于 2 和 20 之间', trigger: 'blur' }
],
mobile: [
{ required: true, message: "手机号不能为空", trigger: "blur" },
2023-10-31 18:18:30 +08:00
{ min: 11, max: 20, message: '手机号长度必须11', trigger: 'blur' },
2023-10-09 11:06:01 +08:00
],
2023-11-02 18:38:22 +08:00
roleId: [
2023-10-11 18:45:54 +08:00
{ required: true, message: "请选择员工角色", trigger: "blur" }
],
isRefuel: [
{ required: true, message: "请选择加油状态", trigger: "blur" }
],
pos: [
2023-10-31 18:18:30 +08:00
{ required: true, message: "请选择", trigger: "blur" }
2023-10-11 18:45:54 +08:00
],
transaction: [
{ required: true, message: "请选择", trigger: "blur" }
],
notice: [
{ required: true, message: "请选择", trigger: "blur" }
],
timeFrame: [
{ required: true, message: "请选择", trigger: "blur" }
],
handoverMode: [
{ required: true, message: "请选择", trigger: "blur" }
],
handoverPrem: [
{ required: true, message: "请选择", trigger: "blur" }
],
handoverOut: [
{ required: true, message: "请选择", trigger: "blur" }
],
record: [
{ required: true, message: "请选择", trigger: "blur" }
],
merchantStatus: [
{ required: true, message: "请选择", trigger: "blur" }
],
screen: [
{ required: true, message: "请选择", trigger: "blur" }
],
status: [
{ required: true, message: "请选择", trigger: "blur" }
2023-10-09 11:06:01 +08:00
]
}
};
},
created() {
this.getList();
2023-11-02 18:38:22 +08:00
this.getDuty();
2023-10-10 18:58:08 +08:00
// this.getStoreList();
2023-10-09 11:06:01 +08:00
},
methods: {
2023-10-14 18:02:31 +08:00
showDesc(){
this.drawer = true;
},
2023-10-12 15:49:06 +08:00
handleNodeClick1(data) {
this.form.posPrem = JSON.stringify(data);
},
handleNodeClick2(data) {
this.form.appletPrem = JSON.stringify(data);
},
2023-10-11 18:45:54 +08:00
getCheckbox(){
2023-10-12 15:49:06 +08:00
this.form.writeOff = this.writeOff.toString();
this.form.specialPrem = this.specialPrem.toString();
2023-10-24 14:00:29 +08:00
this.form.auditPrem = this.auditPrem.toString();
2023-10-11 18:45:54 +08:00
},
// 页面跳转
toTarget(url) {
this.$router.push( { path: url } );
},
2023-10-10 18:58:08 +08:00
getName,
2023-10-09 11:06:01 +08:00
// 查询列表
getList() {
2023-10-12 15:49:06 +08:00
this.loading = true;
listStaff(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
2023-10-11 18:45:54 +08:00
this.list = response.data.records;
2023-10-10 18:58:08 +08:00
this.total = response.data.total;
2023-10-12 15:49:06 +08:00
this.loading = false;
2023-10-09 11:06:01 +08:00
}
);
},
2023-10-12 15:49:06 +08:00
// 查询角色列表
2023-10-11 18:45:54 +08:00
getDuty(){
listDuty().then(response => {
2023-11-02 18:38:22 +08:00
this.roleList = response.data
2023-10-11 18:45:54 +08:00
})
},
2023-10-09 11:06:01 +08:00
// 店铺列表
getStoreList() {
2023-10-10 18:58:08 +08:00
listStaff().then(response => {
this.storeOptions = response.data.records;
2023-10-09 11:06:01 +08:00
}
);
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 重置按钮操作
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
this.handleQuery();
},
// 状态修改
handleStatusChange(row) {
let text = row.auditedStatus == "A" ? "启用" : "禁用";
this.$modal.confirm('确认要' + text + '"' + row.realName + '"吗?').then(function() {
2023-10-12 15:49:06 +08:00
// return updateStaffStatus(row.id, row.auditedStatus);
return updateStaff({id:row.id, auditedStatus:row.auditedStatus})
2023-10-09 11:06:01 +08:00
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.auditedStatus = row.auditedStatus === "A" ? "A" : "N";
});
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.operId)
this.multiple = !selection.length
},
// 排序触发事件
handleSortChange(column, prop, order) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
// 新增按钮操作
handleAdd() {
this.reset();
this.open = true;
this.title = "新增员工";
},
// 表单重置
reset() {
2023-10-12 15:49:06 +08:00
this.posPrem = '';
this.appletPrem = '';
2023-10-24 14:00:29 +08:00
this.writeOff = [];
this.auditPrem = [];
2023-10-09 11:06:01 +08:00
this.form = {
2023-11-02 18:38:22 +08:00
id:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'A',
2023-10-12 15:49:06 +08:00
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
merchantStatus:'qy',screen:'qy', posPrem:'', appletPrem:'', notice:'advice_jy', oilGunId:'', timeFrame:'bx', refund:'yqx',
2023-11-02 18:38:22 +08:00
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',roleId:''
2023-10-09 11:06:01 +08:00
};
this.resetForm("form");
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 提交按钮
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (!this.form.id) {
2023-10-31 18:18:30 +08:00
queryStaff({mobile:this.form.mobile}).then( response => {
if(response.data!=null){
this.$modal.msgError("手机号已存在");
}else {
this.form.posPrem = JSON.stringify(this.form.posPrem);
this.form.appletPrem = JSON.stringify(this.form.appletPrem);
addStaff(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
})
2023-10-09 11:06:01 +08:00
} else {
2023-10-11 18:45:54 +08:00
updateStaff(this.form).then(response => {
2023-10-09 11:06:01 +08:00
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
}
});
},
// 修改按钮操作
handleUpdate(row) {
2023-10-12 15:49:06 +08:00
this.reset();
2023-10-11 18:45:54 +08:00
this.open = true;
2023-10-09 11:06:01 +08:00
const id = row.id || this.ids;
2023-10-11 18:45:54 +08:00
getStaff(id).then(response => {
this.form = response.data;
2023-11-02 18:38:22 +08:00
this.form.password = '123456'
this.form.refundPassword = '123456'
2023-10-09 11:06:01 +08:00
this.open = true;
this.title = "编辑员工信息";
2023-10-31 18:18:30 +08:00
if (this.auditPrem.length > 0){
this.auditPrem = this.form.auditPrem.split(",");
}
if (this.writeOff.length > 0){
this.writeOff = this.form.writeOff.split(",");
}
if (this.specialPrem.length > 0){
this.specialPrem = this.form.specialPrem.split(",");
}
if (this.posPrem != null && this.posPrem != ""){
this.posPrem = JSON.parse(this.form.posPrem);
}
if (this.appletPrem != null && this.appletPrem != ""){
this.appletPrem = JSON.parse(this.form.appletPrem);
}
2023-10-09 11:06:01 +08:00
});
},
// 删除按钮操作
handleDelete(row) {
const name = row.realName || this.id;
2023-10-26 11:04:48 +08:00
this.$modal.confirm('是否确认删除"' + name + '"的员工信息?').then(function() {
2023-10-11 18:45:54 +08:00
return delStaff(row.id);
2023-10-09 11:06:01 +08:00
}).then(() => {
2023-10-28 13:33:42 +08:00
this.queryParams.page = 1
2023-10-09 11:06:01 +08:00
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>
2023-10-11 18:45:54 +08:00
<style scoped>
.app-container{
width: 100%;
2023-10-18 18:31:46 +08:00
height: 100%;
2023-10-11 18:45:54 +08:00
background: #f6f8f9;
}
.pagin-box{
background: white;
box-sizing: border-box;
padding: 20px;
}
.baoguo{
background: white;
box-sizing: border-box;
padding: 20px;
margin-bottom: 20px;
}
</style>