From 0f8dc2f32547caa547dea9a7c06edac0192437d5 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期三, 26 六月 2024 17:57:14 +0800 Subject: [PATCH] 成员管理 搜索 分页 表格请求 启用停用 --- Source/plt-web/plt-web-ui/src/views/user/userManage.vue | 218 ++++++++++++++++++++++++++---------------------------- 1 files changed, 105 insertions(+), 113 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/user/userManage.vue b/Source/plt-web/plt-web-ui/src/views/user/userManage.vue index 7bda956..2f0309a 100644 --- a/Source/plt-web/plt-web-ui/src/views/user/userManage.vue +++ b/Source/plt-web/plt-web-ui/src/views/user/userManage.vue @@ -1,131 +1,123 @@ <template> <basic-container> - <avue-crud :data="data" - :option="option"> + <avue-crud + :data="tableData" + :option="option" + :page.sync="page" + :table-loading="tableLoading" + @on-load="getTableList" + @refresh-change="handleRefresh" + @search-change="handleSearch" + @search-reset="handleReset" + @size-change="sizeChange" + @current-change="currentChange" + > + <template slot="status" slot-scope="{row}"> + <el-tag v-if="row.status === 0" type="success">鍚敤</el-tag> + <el-tag v-if="row.status === 1" type="danger">鍋滅敤</el-tag> + </template> + + <template slot="lockFlag" slot-scope="{row}"> + <el-tag v-if="!row.lockFlag" type="success">鏈攣瀹�</el-tag> + <el-tag v-if="row.lockFlag" type="danger">閿佸畾</el-tag> + </template> + + <template #menu="{row,index,size}"> + <el-button size="small" type="text" @click="stopUserHandler(row)"> + <span style="color: #fa3434" v-if="row.status === 0"><i class="el-icon-video-pause"></i> 鍋滅敤</span> + <span style="color: #55b61d" v-if="row.status === 1"><i class="el-icon-video-pause"></i> 鍚敤</span> + </el-button> + </template> </avue-crud> </basic-container> </template> <script> -import basicOption from '@/option/user/basic-option' +import basicOption from '@/util/basic-option' +import {getDataUsers, stopUser} from '@/api/user/userManageApi' +import {column} from "./userManage" +import func from '@/util/func' + export default { name: "userManage", data() { return { - data: [ - { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - }, - { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - }, - { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - }, { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - , { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - , { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - , { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - , { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - , { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - , { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - , { - id: 1, - name: '寮犱笁', - sex: '鐢�' - }, { - id: 2, - name: '鏉庡洓', - sex: '濂�' - } - ], + tableLoading: false, + tableData: [], option: { ...basicOption, - column: [ - { - label: '濮撳悕', - prop: 'name', - search:true - }, { - label: '鎬у埆', - prop: 'sex', - search:true + calcHeight: -60, + column: column + }, + page: { + currentPage: 1, + pageSize: 10, + total: 0, + pageSizes: [10, 30, 50, 100], + }, + searchParams: {}, + } + }, + created() { + }, + methods: { + // 琛ㄦ牸璇锋眰 + getTableList() { + getDataUsers(this.page.currentPage, this.page.pageSize, this.searchParams).then(res => { + const data = res.data.data; + this.tableData = data; + this.page.total = res.data.total; + }); + }, + + // 琛ㄦ牸鍙充晶鍒锋柊鍥炬爣 + handleRefresh() { + this.getTableList(); + }, + + // 鎼滅储鏌ヨ + handleSearch(params, done) { + if (!func.isEmptyObject(params)) { + for (let key in params) { + if (params.hasOwnProperty(key)) { + // 鍒ゆ柇濡傛灉 key 鏄� 'pkPersonName'锛屽垯鏀逛负 'pkPerson' 鍒嗗埆涓烘樉绀哄�煎拰淇濆瓨鍊� + let newKey = key === 'pkPersonName' ? 'pkPerson' : key; + this.searchParams[`conditionMap["${newKey}"]`] = params[key]; } - ] + } + } else { + this.searchParams = {}; } + this.getTableList(); + done(); + }, + + // 閲嶇疆鎼滅储鏉′欢 + handleReset() { + this.searchParams = {}; + this.getTableList(); + }, + + // 鏉℃暟 + sizeChange(val) { + this.page.pageSize = val; + }, + + // 椤电爜 + currentChange(val) { + this.page.currentPage = val; + }, + + // 鍋滅敤鍚敤 + stopUserHandler(row){ + let params = {}; + params = { + idList:row.oid, + flag: row.status === 0 ? true : false + } + stopUser(params).then(res => { + console.log(res) + }) } } -- Gitblit v1.9.3