From 1dcf5559fb78f588412abfa5beadbb72d418ba92 Mon Sep 17 00:00:00 2001 From: TanYibin <5491541@qq.com> Date: Tue, 14 Mar 2023 18:40:15 +0800 Subject: [PATCH] 用户管理页所属仓库展示优化 --- ant-design-vue-jeecg/src/views/system/UserList.vue | 36 ++++++++++++++++++++++++++++++++---- ant-design-vue-jeecg/src/views/system/modules/UserModal.vue | 10 +++++----- huaheng-wms-core/src/main/java/org/jeecg/modules/system/entity/SysUser.java | 13 +++++++++++++ 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/system/UserList.vue b/ant-design-vue-jeecg/src/views/system/UserList.vue index 402cde8..4d5e8e7 100644 --- a/ant-design-vue-jeecg/src/views/system/UserList.vue +++ b/ant-design-vue-jeecg/src/views/system/UserList.vue @@ -115,6 +115,12 @@ :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" @change="handleTableChange"> + <span slot="selectedWarehouses" slot-scope="selectedWarehouses" > + <a-tag v-for="selectedWarehouse in selectedWarehouses" :key="selectedWarehouse" color=pink> + {{ solutionWarehouse(selectedWarehouse) }} + </a-tag> + </span> + <template slot="avatarslot" slot-scope="text, record"> <div class="anty-img-wrap"> <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/> @@ -186,7 +192,7 @@ import UserModal from './modules/UserModal' import PasswordModal from './modules/PasswordModal' import {putAction, getFileAccessHttpUrl} from '@/api/manage'; -import {frozenBatch} from '@/api/api' +import {frozenBatch, getAllWarehouseList} from '@/api/api' import {JeecgListMixin} from '@/mixins/JeecgListMixin' import SysUserAgentModal from "./modules/SysUserAgentModal"; import JInput from '@/components/jeecg/JInput' @@ -211,6 +217,7 @@ export default { description: '这是用户管理页面', queryParam: {}, recycleBinVisible: false, + allWarehouseList: [], columns: [ /*{ title: '#', @@ -265,8 +272,10 @@ export default { { title: '所属仓库', align: "center", - width: 100, - dataIndex: 'selectedWarehouse' + width: 200, + dataIndex: 'selectedWarehouses', + key: 'selectedWarehouses', + scopedSlots: {customRender: 'selectedWarehouses'} }, // { // title: '部门', @@ -315,11 +324,30 @@ export default { return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; } }, + created() { + this.loadFrom(); + }, methods: { + loadFrom() { + getAllWarehouseList().then((res) => { + if (res.success) { + this.allWarehouseList = res.result + } + }); + }, + solutionWarehouse(value) { + var actions = [] + Object.keys(this.allWarehouseList).some((key) => { + if (this.allWarehouseList[key].code == ('' + value)) { + actions.push(this.allWarehouseList[key].name) + return true + } + }) + return actions.join('') + }, getAvatarView: function (avatar) { return getFileAccessHttpUrl(avatar) }, - batchFrozen: function (status) { if (this.selectedRowKeys.length <= 0) { this.$message.warning('请选择一条记录!'); diff --git a/ant-design-vue-jeecg/src/views/system/modules/UserModal.vue b/ant-design-vue-jeecg/src/views/system/modules/UserModal.vue index 0a4136e..1754a6e 100644 --- a/ant-design-vue-jeecg/src/views/system/modules/UserModal.vue +++ b/ant-design-vue-jeecg/src/views/system/modules/UserModal.vue @@ -251,11 +251,11 @@ export default { this.departIdShow = false; } - if (record.hasOwnProperty("id")) { - that.getUserRoles(record.id); - that.getWarehouse(record.id); - that.getUserDeparts(record.id); - } + // if (record.hasOwnProperty("id")) { + // that.getUserRoles(record.id); + // that.getWarehouse(record.id); + // that.getUserDeparts(record.id); + // } console.log('that.model=', that.model) }, isDisabledAuth(code) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/entity/SysUser.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/entity/SysUser.java index 09cbbd9..6fe4756 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/entity/SysUser.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/entity/SysUser.java @@ -1,13 +1,16 @@ package org.jeecg.modules.system.entity; import java.io.Serializable; +import java.util.Arrays; import java.util.Date; +import java.util.List; import org.jeecg.common.aspect.annotation.Dict; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableLogic; import com.fasterxml.jackson.annotation.JsonFormat; @@ -189,4 +192,14 @@ public class SysUser implements Serializable { /** 设备id uniapp推送用 */ private String clientId; + + @TableField(exist = false) + private List<String> selectedWarehouses; + + public void setSelectedWarehouse(String selectedWarehouse) { + if (selectedWarehouse != null) { + this.selectedWarehouse = selectedWarehouse; + this.selectedWarehouses = Arrays.asList(selectedWarehouse.split(",")); + } + } } -- libgit2 0.22.2