| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <template>
- <el-card class="content-z">
- <a-row :gutter="15">
- <a-col :span="4">
- <leftTree @selected="getTreeData" />
- </a-col>
- <a-col :span="20">
- <!-- 操作按钮区域 -->
- <div class="table-operator" style="margin: 5px 0;float: right">
- <a-button v-permission="['pc:system:user:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
- <!-- <a-button ghost type="danger" icon="download" @click="handleExportXls('角色信息')">导出</a-button>-->
- <!-- <a-upload-->
- <!-- name="file"-->
- <!-- :show-upload-list="false"-->
- <!-- :multiple="false"-->
- <!-- :headers="tokenHeader"-->
- <!-- :action="url.importExcelUrl"-->
- <!-- @change="handleImportExcel"-->
- <!-- >-->
- <!-- <a-button ghost type="danger" icon="import">导入</a-button>-->
- <!-- </a-upload>-->
- <a-dropdown v-if="selectedRowKeys.length > 0">
- <a-menu slot="overlay">
- <a-menu-item key="1" v-permission="['pc:system:user:remove']" @click="batchDel">
- <a-icon type="delete" />
- 批量删除
- </a-menu-item>
- </a-menu>
- <a-button style="margin-left: 8px">
- 批量操作
- <a-icon type="down" />
- </a-button>
- </a-dropdown>
- </div>
- <!-- 查询区域 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="searchQuery">
- <a-form-item>
- <a-input
- v-model="queryParam.value"
- style="width: 150px"
- placeholder="姓名/部门/手机号"
- />
- </a-form-item>
- <a-form-item>
- <sys-list-select-tag
- v-model="queryParam.roleId"
- dict-code="role"
- placeholder="选择职务"
- style="width: 150px"
- />
- </a-form-item>
- <a-form-item>
- <j-dict-select-tag
- v-model="queryParam.status"
- style="width: 150px"
- placeholder="状态选项"
- dict-code="sys_normal_disable"
- />
- </a-form-item>
- <a-form-item>
- <a-button type="primary" @click="searchQuery">查询</a-button>
- <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
- </a-form-item>
- </a-form>
- </div>
- <!-- table区域-begin -->
- <div>
- <div class="ant-alert ant-alert-info" style="margin: 16px 0;">
- <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择 <a style="font-weight: 600">{{
- selectedRowKeys.length }}</a>项
- <a style="margin-left: 24px" @click="onClearSelected">清空</a>
- </div>
- <a-table
- ref="table"
- size="middle"
- bordered
- row-key="userId"
- :columns="columns"
- :data-source="dataSource"
- :pagination="ipagination"
- :loading="loading"
- :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
- @change="handleTableChange"
- >
- <template slot="dept" slot-scope="text, record">
- {{ record['dept'].deptName }}
- </template>
- <!-- <template slot="leader" slot-scope="text, record">-->
- <!-- {{ record['dept'].leader }}-->
- <!-- </template>-->
- <template slot="status" slot-scope="text, record">
- <a-switch
- v-if="JSPermission(['pc:system:user:edit'])"
- :checked="record.status==='1'?false:true"
- checked-children="启用"
- un-checked-children="停用"
- @change="changeStatus({$event,record})"
- />
- <span v-else>{{ record.status==='1'?'停用':'启用' }}</span>
- </template>
- <span slot="action" slot-scope="text, record">
- <a-button v-permission="['pc:system:user:edit']" size="small" type="primary" @click="handleEdit(record)">
- 编辑
- </a-button>
- <a-divider type="vertical" />
- <a-dropdown>
- <a-button size="small" class="ant-dropdown-link" type="primary">
- 更多 <a-icon type="down" />
- </a-button>
- <a-menu slot="overlay">
- <a-menu-item>
- <a-popconfirm title="确认重置密码吗?重置后的密码是 123456" @confirm="() => rePwd(record)">
- <a v-permission="['pc:system:user:resetPwd']" href="javascript:;">重置密码</a>
- </a-popconfirm>
- </a-menu-item>
- <!-- <a-menu-item>-->
- <!-- <a href="javascript:;" @click="loginLog(record)">登录日志</a>-->
- <!-- </a-menu-item>-->
- <!-- <a-menu-item>-->
- <!-- <a href="javascript:;" @click="handleLog(record)">操作记录</a>-->
- <!-- </a-menu-item>-->
- </a-menu>
- </a-dropdown>
- <a-divider type="vertical" />
- <a-popconfirm
- v-permission="['pc:system:user:remove']"
- title="确定删除吗?"
- @confirm="() => handleDelete(record.userId)"
- >
- <a-button size="small" type="danger">
- 删除
- </a-button>
- </a-popconfirm>
- </span>
- </a-table>
- <check-and-edit-model ref="modalForm" @ok="modalFormOk" />
- </div>
- <!-- table区域-end -->
- <!-- 表单区域 -->
- </a-col>
- </a-row>
- </el-card>
- </template>
- <script>
- import { listMixin } from '@/mixin/listMixin'
- import columns from './indexColumns'
- import CheckAndEditModel from './CheckAndEditModel'
- import leftTree from '@/components/leftTree'
- import { httpAction } from '@/api/request'
- import JSPermission from '@/utils/JSPermission'
- export default {
- components: {
- CheckAndEditModel,
- leftTree
- },
- mixins: [listMixin],
- data() {
- return {
- // 查询条件
- queryParam: {},
- // 表头
- columns: columns(this),
- url: {
- list: '/system/user/list',
- delete: '/system/user/',
- exportXlsUrl: '/exportXlsUrl',
- importExcelUrl: `${process.env.VUE_APP_BASE_API}/importExcelUrl`
- }
- }
- },
- created() {
- },
- methods: {
- JSPermission,
- getTreeData(data) {
- this.queryParam.deptId = data.id
- this.loadData()
- },
- rePwd(record) {
- httpAction('/system/user/resetPwd', record, 'put').then((res) => {
- if (res.code === 200) {
- this.$message.success(res.msg)
- } else {
- console.log(res)
- }
- })
- },
- changeStatus({ $event, record }) {
- console.log($event, record)
- record.status = $event ? '0' : '1'
- httpAction('/system/user/changeStatus', record, 'put').then((res) => {
- if (res.code === 200) {
- this.$message.success(res.msg)
- } else {
- console.log(res)
- }
- })
- },
- handleLog() {
- },
- loginLog() {
- },
- updateQueryParam(data) {
- this.queryParam.unit = data.id
- this.queryParam.unitName = data.departName
- }
- }
- }
- </script>
- <style scoped>
- @import '~@/assets/less/common.less'
- </style>
|