|
@@ -1,252 +1,220 @@
|
|
|
<template>
|
|
|
- <a-card :bordered="false">
|
|
|
- <div class="table-page-search-wrapper">
|
|
|
- <a-form layout="inline">
|
|
|
- <a-row :gutter="48">
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="员工姓名">
|
|
|
- <a-input
|
|
|
- allowClear
|
|
|
- v-model.trim="queryParam.name"
|
|
|
- id="userList-name"
|
|
|
- :maxLength="30"
|
|
|
- @pressEnter="$refs.table.refresh(true)"
|
|
|
- placeholder="请输入员工姓名" />
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="手机号码">
|
|
|
- <a-input
|
|
|
- allowClear
|
|
|
- v-model.trim="queryParam.phone"
|
|
|
- id="userList-phone"
|
|
|
- :maxLength="11"
|
|
|
- @pressEnter="$refs.table.refresh(true)"
|
|
|
- placeholder="请输入手机号码" />
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="状态">
|
|
|
- <v-select code="ENABLE_FLAG" id="userList-loginFlag" v-model="queryParam.loginFlag" allowClear placeholder="请选择状态"></v-select>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;" id="userList-handSubmit">查询</a-button>
|
|
|
- <a-button @click="reset" id="userList-reset">重置</a-button>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- </a-form>
|
|
|
- </div>
|
|
|
- <a-divider />
|
|
|
- <div class="table-operator">
|
|
|
- <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_supervision_user_add'" id="userList-openModal">新建</a-button>
|
|
|
- </div>
|
|
|
- <s-table
|
|
|
- :columns="columns"
|
|
|
- :data="loadData"
|
|
|
- ref="table"
|
|
|
- size="default"
|
|
|
- rowKey="id"
|
|
|
- bordered>
|
|
|
- <template slot="loginFlag" slot-scope="text">
|
|
|
- <span :style="{ color: text == '1' ? '#12b512' : 'red' }">{{ text == '1' ? '已启用' : '已禁用' }}</span>
|
|
|
- </template>
|
|
|
- <span slot="action" slot-scope="text, record">
|
|
|
- <!-- 点检关联门店 -->
|
|
|
- <a-tooltip placement="bottom">
|
|
|
- <template slot="title">
|
|
|
- <span>编辑</span>
|
|
|
- </template>
|
|
|
- <a-icon type="edit" style="font-size: 20px;color: #1890FF;padding: 0 10px;" @click="handleEdit(record)" v-hasPermission="'B_supervision_user_edit'"/>
|
|
|
- </a-tooltip>
|
|
|
- <a-tooltip placement="bottom" v-if="record.storeSetFlag==1">
|
|
|
- <template slot="title">
|
|
|
- <span>关联点检门店</span>
|
|
|
- </template>
|
|
|
- <a-icon type="apartment" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="selectStore(record)" v-hasPermission="'M_supervision_user_spotCheckStore'"/>
|
|
|
- </a-tooltip>
|
|
|
- <a-tooltip placement="bottom" v-if="record.loginFlag==1">
|
|
|
- <template slot="title">
|
|
|
- <span>重置密码</span>
|
|
|
- </template>
|
|
|
- <a-icon type="unlock" style="font-size: 20px;color: #08c0de;padding: 0 10px;" @click="resetPassword(record)" v-hasPermission="'B_supervision_user_restPwd'"/>
|
|
|
- </a-tooltip>
|
|
|
- <a-tooltip placement="bottom">
|
|
|
- <template slot="title">
|
|
|
- <span>删除</span>
|
|
|
- </template>
|
|
|
- <a-icon type="delete" style="font-size: 20px;color: red;padding: 0 10px;" @click="delect(record)" v-hasPermission="'B_supervision_user_delete'"/>
|
|
|
- </a-tooltip>
|
|
|
- </span>
|
|
|
- </s-table>
|
|
|
- <!-- 新增用户弹窗 -->
|
|
|
- <userModal :visible="showModal" @refresh="$refs.table.refresh(true)" :data="itemData" @close="showModal = false"></userModal>
|
|
|
- <!-- 点检门店弹窗 已选门店 -->
|
|
|
- <usedStoreModal :visible="showStoreModal" :userId="userId" @close="showStoreModal=false"></usedStoreModal>
|
|
|
- </a-card>
|
|
|
+ <a-card :bordered="false">
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline">
|
|
|
+ <a-row :gutter="48">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="员工姓名">
|
|
|
+ <a-input allowClear v-model.trim="queryParam.name" id="userList-name" :maxLength="30" @pressEnter="$refs.table.refresh(true)"
|
|
|
+ placeholder="请输入员工姓名30个字以内" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="手机号码">
|
|
|
+ <a-input allowClear v-model.trim="queryParam.phone" id="userList-phone" :maxLength="11" @pressEnter="$refs.table.refresh(true)"
|
|
|
+ placeholder="请输入手机号码" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="状态">
|
|
|
+ <v-select code="ENABLE_FLAG" id="userList-loginFlag" v-model="queryParam.loginFlag" allowClear placeholder="请选择状态"></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;" id="userList-handSubmit">查询</a-button>
|
|
|
+ <a-button @click="reset" id="userList-reset">重置</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ <a-divider />
|
|
|
+ <div class="table-operator">
|
|
|
+ <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_supervision_user_add'" id="userList-openModal">新建</a-button>
|
|
|
+ </div>
|
|
|
+ <s-table :columns="columns" :data="loadData" ref="table" size="default" rowKey="id" bordered>
|
|
|
+ <template slot="loginFlag" slot-scope="text">
|
|
|
+ <span :style="{ color: text == '1' ? '#12b512' : 'red' }">{{ text == '1' ? '已启用' : '已禁用' }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="action" slot-scope="text, record">
|
|
|
+ <!-- 点检关联门店 -->
|
|
|
+ <a-icon type="edit" title="编辑" :style="{fontSize: '20px',color:' #1890FF',padding:' 0 10px'}" @click="handleEdit(record)"
|
|
|
+ v-hasPermission="'B_supervision_user_edit'" />
|
|
|
+ <a-icon type="apartment" title="关联点检门店" v-if="record.storeSetFlag==1" v-hasPermission="'M_supervision_user_spotCheckStore'"
|
|
|
+ :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="selectStore(record)" />
|
|
|
+ <a-icon type="unlock" title="重置密码" v-if="record.loginFlag==1" v-hasPermission="'B_supervision_user_restPwd'" :style="{fontSize: '20px',color:' #08c0de',padding: '0 10px'}"
|
|
|
+ @click="resetPassword(record)" />
|
|
|
+ <a-icon type="delete" title="删除" :style="{fontSize: '20px',color: '#f00',padding: '0 10px'}" @click="delect(record)"
|
|
|
+ v-hasPermission="'B_supervision_user_delete'" />
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ <!-- 新增用户弹窗 -->
|
|
|
+ <userModal :visible="showModal" @refresh="$refs.table.refresh(true)" :data="itemData" @close="showModal = false"></userModal>
|
|
|
+ <!-- 点检门店弹窗 已选门店 -->
|
|
|
+ <usedStoreModal :visible="showStoreModal" :userId="userId" @close="showStoreModal=false"></usedStoreModal>
|
|
|
+ </a-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {
|
|
|
- STable,
|
|
|
- VSelect
|
|
|
-} from '@/components'
|
|
|
-import userModal from './userModal.vue'
|
|
|
-import usedStoreModal from './usedStoreModal.vue'
|
|
|
-import {
|
|
|
- resetPSD,
|
|
|
- getPowerUserList,
|
|
|
- delectUserPower
|
|
|
-} from '@/api/supervision-user.js'
|
|
|
-export default {
|
|
|
- name: 'UserList',
|
|
|
- components: {
|
|
|
- STable,
|
|
|
- VSelect,
|
|
|
- userModal,
|
|
|
- usedStoreModal
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- // 查询参数
|
|
|
- queryParam: {
|
|
|
- name: '', // 员工姓名
|
|
|
- phone: '', // 手机号码
|
|
|
- loginFlag: '' // 状态
|
|
|
- },
|
|
|
- showModal: false, // 新增弹框showModal控制打开或关闭 false--默认关闭 true--打开
|
|
|
- showStoreModal: false, // 点检门店弹框showStoreModal控制打开或关闭 false--默认关闭 true--打开
|
|
|
- itemData: {}, // 编辑行数据
|
|
|
- userId: '', // 用户id
|
|
|
- columns: [{
|
|
|
- title: '序号',
|
|
|
- dataIndex: 'no',
|
|
|
- width: 60,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '创建时间',
|
|
|
- dataIndex: 'createDate',
|
|
|
- width: 200,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '员工姓名',
|
|
|
- dataIndex: 'name',
|
|
|
- width: 150,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '手机号码',
|
|
|
- dataIndex: 'phone',
|
|
|
- width: 150,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '角色',
|
|
|
- dataIndex: 'roleNames',
|
|
|
- width: 200,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '启用状态',
|
|
|
- dataIndex: 'loginFlag',
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- scopedSlots: {
|
|
|
- customRender: 'loginFlag'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '操作',
|
|
|
- dataIndex: 'action',
|
|
|
- width: 200,
|
|
|
- align: 'center',
|
|
|
- scopedSlots: {
|
|
|
- customRender: 'action'
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
- loadData: parameter => {
|
|
|
- return getPowerUserList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
- const no = (res.data.pageNo - 1) * res.data.pageSize
|
|
|
- for (let i = 0; i < res.data.list.length; i++) {
|
|
|
- const _item = res.data.list[i]
|
|
|
- _item.no = no + i + 1
|
|
|
- }
|
|
|
- return res.data
|
|
|
- })
|
|
|
- },
|
|
|
- optionAlertShow: false
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 刷新列表
|
|
|
- refreshTable () {
|
|
|
- this.$refs.table.refresh(true)
|
|
|
- },
|
|
|
- // 重置
|
|
|
- reset () {
|
|
|
- this.queryParam = {
|
|
|
- name: '',
|
|
|
- phone: '',
|
|
|
- loginFlag: ''
|
|
|
- }
|
|
|
- this.$refs.table.refresh(true)
|
|
|
- },
|
|
|
- // 新建
|
|
|
- openModal () {
|
|
|
- this.itemData = {}
|
|
|
- this.showModal = true
|
|
|
- },
|
|
|
- // 选择点检门店
|
|
|
- selectStore (row) {
|
|
|
- this.userId = row.id
|
|
|
- this.showStoreModal = true
|
|
|
- },
|
|
|
- // 重置密码
|
|
|
- resetPassword (row) {
|
|
|
- resetPSD({
|
|
|
- id: row.id
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.$message.success(res.message)
|
|
|
- } else {
|
|
|
- this.$message.error(res.message)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 删除
|
|
|
- delect (row) {
|
|
|
- const _this = this
|
|
|
- this.$confirm({
|
|
|
- title: '提示',
|
|
|
- content: '删除后数据无法恢复,确认删除?',
|
|
|
- okText: '确定',
|
|
|
- cancelText: '取消',
|
|
|
- onOk () {
|
|
|
- delectUserPower({
|
|
|
- id: row.id
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$message.success(res.message)
|
|
|
- _this.refreshTable()
|
|
|
- } else {
|
|
|
- _this.$message.error(res.message)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 编辑
|
|
|
- handleEdit (row) {
|
|
|
- this.itemData = row
|
|
|
- console.log(this.itemData)
|
|
|
- this.showModal = true
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ import {
|
|
|
+ STable,
|
|
|
+ VSelect
|
|
|
+ } from '@/components'
|
|
|
+ import userModal from './userModal.vue'
|
|
|
+ import usedStoreModal from './usedStoreModal.vue'
|
|
|
+ import {
|
|
|
+ resetPSD,
|
|
|
+ getPowerUserList,
|
|
|
+ delectUserPower
|
|
|
+ } from '@/api/supervision-user.js'
|
|
|
+ export default {
|
|
|
+ name: 'UserList',
|
|
|
+ components: {
|
|
|
+ STable,
|
|
|
+ VSelect,
|
|
|
+ userModal,
|
|
|
+ usedStoreModal
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 查询参数
|
|
|
+ queryParam: {
|
|
|
+ name: '', // 员工姓名
|
|
|
+ phone: '', // 手机号码
|
|
|
+ loginFlag: '' // 状态
|
|
|
+ },
|
|
|
+ showModal: false, // 新增弹框showModal控制打开或关闭 false--默认关闭 true--打开
|
|
|
+ showStoreModal: false, // 点检门店弹框showStoreModal控制打开或关闭 false--默认关闭 true--打开
|
|
|
+ itemData: {}, // 编辑行数据
|
|
|
+ userId: '', // 用户id
|
|
|
+ columns: [{
|
|
|
+ title: '序号',
|
|
|
+ dataIndex: 'no',
|
|
|
+ width: 60,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建时间',
|
|
|
+ dataIndex: 'createDate',
|
|
|
+ width: 200,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '员工姓名',
|
|
|
+ dataIndex: 'name',
|
|
|
+ width: 150,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '手机号码',
|
|
|
+ dataIndex: 'phone',
|
|
|
+ width: 150,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '角色',
|
|
|
+ dataIndex: 'roleNames',
|
|
|
+ width: 200,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '启用状态',
|
|
|
+ dataIndex: 'loginFlag',
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: {
|
|
|
+ customRender: 'loginFlag'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ width: 200,
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: {
|
|
|
+ customRender: 'action'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ return getPowerUserList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ const no = (res.data.pageNo - 1) * res.data.pageSize
|
|
|
+ for (let i = 0; i < res.data.list.length; i++) {
|
|
|
+ const _item = res.data.list[i]
|
|
|
+ _item.no = no + i + 1
|
|
|
+ }
|
|
|
+ return res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ optionAlertShow: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 刷新列表
|
|
|
+ refreshTable() {
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ reset() {
|
|
|
+ this.queryParam = {
|
|
|
+ name: '',
|
|
|
+ phone: '',
|
|
|
+ loginFlag: ''
|
|
|
+ }
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ // 新建
|
|
|
+ openModal() {
|
|
|
+ this.itemData = {}
|
|
|
+ this.showModal = true
|
|
|
+ },
|
|
|
+ // 选择点检门店
|
|
|
+ selectStore(row) {
|
|
|
+ this.userId = row.id
|
|
|
+ this.showStoreModal = true
|
|
|
+ },
|
|
|
+ // 重置密码
|
|
|
+ resetPassword(row) {
|
|
|
+ resetPSD({
|
|
|
+ id: row.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ delect(row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '删除后数据无法恢复,确认删除?',
|
|
|
+ okText: '确定',
|
|
|
+ cancelText: '取消',
|
|
|
+ onOk() {
|
|
|
+ delectUserPower({
|
|
|
+ id: row.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.refreshTable()
|
|
|
+ } else {
|
|
|
+ _this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 编辑
|
|
|
+ handleEdit(row) {
|
|
|
+ this.itemData = row
|
|
|
+ console.log(this.itemData)
|
|
|
+ this.showModal = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
.table-page-search-wrapper .ant-form-inline .ant-form-item {
|