用户管理启用禁用

This commit is contained in:
fengachen
2021-09-10 11:14:39 +08:00
parent 9bbe7ae7ef
commit 5792523d10
3 changed files with 89 additions and 49 deletions
+5
View File
@@ -129,8 +129,12 @@
} }
this.picUrl = true this.picUrl = true
let arr = paths.split(',') let arr = paths.split(',')
console.log(this.fileList)
for(var a=0;a<arr.length;a++){ for(var a=0;a<arr.length;a++){
this.fileList.forEach((item)=>{ this.fileList.forEach((item)=>{
if(this.returnId){
item.url = this.getImgUrl(item.response.result.id,item.name)
}
if (item.url === arr[a]){ if (item.url === arr[a]){
item.uid = uidGenerator() item.uid = uidGenerator()
item.response.status = 'history' item.response.status = 'history'
@@ -189,6 +193,7 @@
getAvatarView(){ getAvatarView(){
if(this.fileList.length>0){ if(this.fileList.length>0){
let url = this.fileList[this.fileList.length-1].url let url = this.fileList[this.fileList.length-1].url
// console.log( getFileAccessHttpUrl(url),'url')
return getFileAccessHttpUrl(url) return getFileAccessHttpUrl(url)
} }
}, },
@@ -53,7 +53,7 @@
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> <a-button @click="searchReset" icon="reload" class="reset-button" style="margin-left: 8px">重置</a-button>
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
+40 -5
View File
@@ -56,7 +56,8 @@
<div class="table-operator" style="border-top: 5px"> <div class="table-operator" style="border-top: 5px">
<a-button @click="handleAdd" type="primary" icon="plus" v-has="'user:add'">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus" v-has="'user:add'">新增</a-button>
<a-button @click="downTemplate('用户导入模板')" type="primary" icon="download">下载模板</a-button> <a-button @click="downTemplate('用户导入模板')" type="primary" icon="download">下载模板</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
@change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<a-button @click="handleExportXls('用户列表')" type="primary" icon="export">导出</a-button> <a-button @click="handleExportXls('用户列表')" type="primary" icon="export">导出</a-button>
@@ -71,6 +72,7 @@
bordered bordered
size="middle" size="middle"
rowKey="id" rowKey="id"
:scroll="{x:true}"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
@@ -80,6 +82,8 @@
@change="handleTableChange"> @change="handleTableChange">
<span slot="action" class="action-span-cell" slot-scope="text, record"> <span slot="action" class="action-span-cell" slot-scope="text, record">
<!-- 1是启用 2是禁用 按钮需要反着来-->
<a @click="handleEnable(record)" :class="{'color-red':record.status === 1}">{{record.status === 1 ? '禁用' : '启用'}}</a>
<a @click="handleEdit(record)" v-has="'user:edit'">编辑</a> <a @click="handleEdit(record)" v-has="'user:edit'">编辑</a>
<a @click="resetPassword(record)">重置密码</a> <a @click="resetPassword(record)">重置密码</a>
<a @click="handleDelete(record.id)" v-has="'sys:user:del'">删除</a> <a @click="handleDelete(record.id)" v-has="'sys:user:del'">删除</a>
@@ -101,8 +105,10 @@
<script> <script>
import UserModal from './modules/UserModal' import UserModal from './modules/UserModal'
import {getAction, getFileAccessHttpUrl} from '@/api/manage' import {getAction, getFileAccessHttpUrl} from '@/api/manage'
import {frozenBatch} from '@api/api'
import '@/assets/less/TableExpand.less' import '@/assets/less/TableExpand.less'
import {JeroListMixin} from '@/mixins/JeroListMixin' import {JeroListMixin} from '@/mixins/JeroListMixin'
import '@/assets/less/TableExpand.less'
// import JInput from '@/components/jero/JInput' // import JInput from '@/components/jero/JInput'
import JEllipsis from '@comp/jero/JEllipsis' import JEllipsis from '@comp/jero/JEllipsis'
import {queryDepartTreeList, resetUserPassword} from '@api/api' import {queryDepartTreeList, resetUserPassword} from '@api/api'
@@ -140,7 +146,7 @@ export default {
{ {
title: '用户姓名', title: '用户姓名',
align: 'center', align: 'center',
width: 100, width: 160,
dataIndex: 'realname', dataIndex: 'realname',
scopedSlots: {customRender: 'text'}, scopedSlots: {customRender: 'text'},
}, },
@@ -154,7 +160,7 @@ export default {
{ {
title: '手机号', title: '手机号',
align: 'center', align: 'center',
width: 100, width: 160,
dataIndex: 'phone', dataIndex: 'phone',
scopedSlots: {customRender: 'text'}, scopedSlots: {customRender: 'text'},
}, },
@@ -188,14 +194,21 @@ export default {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
align: 'center', align: 'center',
width: 170 width: 170,
scopedSlots: {customRender: 'text'},
},
{
title: '状态',
align: 'center',
width: 80,
dataIndex: 'status_dictText',
scopedSlots: {customRender: 'text'},
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
scopedSlots: {customRender: 'action'}, scopedSlots: {customRender: 'action'},
align: 'center', align: 'center',
width: 170
} }
], ],
// 组织机构 下拉数据 // 组织机构 下拉数据
@@ -275,6 +288,25 @@ export default {
this.$message.warning(res.message) this.$message.warning(res.message)
} }
}) })
},
/*
* 启用禁用
* */
handleEnable(record) {
let status
if(record.status === 1) {
status = 2
}else if(record.status === 2){
status = 1
}
frozenBatch({ids: record.id, status}).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warn(res.message)
}
})
} }
} }
@@ -282,4 +314,7 @@ export default {
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
.color-red {
color: red;
}
</style> </style>