From deb617da7e3ab9d18a38cceab2ddd10946de4557 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BF=9E=E5=AE=9D=E5=B1=B1?= <1253070437@qq.com>
Date: Fri, 19 Jul 2024 01:38:00 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E9=87=8D?=
=?UTF-8?q?=E5=86=99=E7=94=A8=E6=88=B7=E3=80=81=E6=9C=BA=E6=9E=84=E3=80=81?=
=?UTF-8?q?=E8=A7=92=E8=89=B2=E3=80=81=E8=81=8C=E4=BD=8D=E8=AE=BE=E8=AE=A1?=
=?UTF-8?q?=E5=99=A8=EF=BC=8C=E5=8A=A0=E5=85=A5v-model=E5=BC=95=E7=94=A8?=
=?UTF-8?q?=E5=BD=A2=E5=BC=8F=EF=BC=8C=E4=B8=9A=E5=8A=A1=E5=86=85=E5=AE=8C?=
=?UTF-8?q?=E6=88=90=E6=9B=BF=E6=8D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/XnOrgSelector/README.md | 36 ++
.../src/components/XnOrgSelector/index.vue | 579 +++++++++++++++++
.../components/XnPositionSelector/README.md | 36 ++
.../components/XnPositionSelector/index.vue | 579 +++++++++++++++++
.../src/components/XnRoleSelector/README.md | 36 ++
.../src/components/XnRoleSelector/index.vue | 607 ++++++++++++++++++
.../src/components/XnUserSelector/index.vue | 59 +-
snowy-admin-web/src/style/index.less | 2 +
snowy-admin-web/src/views/biz/org/form.vue | 7 -
snowy-admin-web/src/views/biz/user/index.vue | 15 +-
.../src/views/dev/message/form.vue | 7 -
snowy-admin-web/src/views/sys/org/form.vue | 7 -
snowy-admin-web/src/views/sys/role/index.vue | 7 -
snowy-admin-web/src/views/sys/user/index.vue | 16 +-
14 files changed, 1914 insertions(+), 79 deletions(-)
create mode 100644 snowy-admin-web/src/components/XnOrgSelector/README.md
create mode 100644 snowy-admin-web/src/components/XnOrgSelector/index.vue
create mode 100644 snowy-admin-web/src/components/XnPositionSelector/README.md
create mode 100644 snowy-admin-web/src/components/XnPositionSelector/index.vue
create mode 100644 snowy-admin-web/src/components/XnRoleSelector/README.md
create mode 100644 snowy-admin-web/src/components/XnRoleSelector/index.vue
diff --git a/snowy-admin-web/src/components/XnOrgSelector/README.md b/snowy-admin-web/src/components/XnOrgSelector/README.md
new file mode 100644
index 00000000..47d6aa04
--- /dev/null
+++ b/snowy-admin-web/src/components/XnOrgSelector/README.md
@@ -0,0 +1,36 @@
+## 小诺机构选择器
+
+### 说明
+
+改组件为小诺机构选择器,可返回id用逗号隔离的字符串或id数组类型的数据格式
+
+@author yubaoshan
+
+@data 2024年7月5日23:59:23
+
+### props定义
+
+| 序号 | 编码 | 类型 | 说明 | 默认 |
+|-----|-------------------------|---------------|------------------------------|--------|
+| 1 | radioModel | Boolean | 是否单选;与addShow隐藏同时可用 | false |
+| 2 | dataIsConverterFlw | Boolean | 是否为工作流格式 | false |
+| 3 | orgTreeApi | function | 机构树接口 | - |
+| 4 | orgPageApi | function | 机构分页接口 | - |
+| 5 | orgListByIdListApi | function | 通过id数组查询list数据接口 | 已配置 |
+| 6 | value | object或string | 通过v-model:value绑定数据 | - |
+| 7 | dataType | string | 数据类型object或string | string |
+| 8 | show | Boolean | 是否显示已选择机构(非表单内、单纯的选择机构需要隐藏) | true |
+| 9 | addShow | Boolean | 是否默认的增加人员按钮,与radioModel为或的关系 | true |
+
+### emits定义
+
+| 序号 | 方法名 | 参数类型 | 说明 |
+|----|--------|----------------|---------------------------------|
+| 1 | value | 根据 dataType 而定 | 当选择机构后通过v-model:value绑定到组件上 |
+| 2 | onBack | 根据 dataType 而定 | 通过@onBack 方法返回选中的数据,触发点为选中或删除机构 |
+
+### slot定义
+
+| 序号 | 插槽名 | 用途 | 用途 |
+|----|--------|-------------------|-------------------|
+| 1 | button | 在机构新增按钮后可以插入自定义按钮 | 不满足新增机构按钮样式,可以自定义 |
diff --git a/snowy-admin-web/src/components/XnOrgSelector/index.vue b/snowy-admin-web/src/components/XnOrgSelector/index.vue
new file mode 100644
index 00000000..c5df64e0
--- /dev/null
+++ b/snowy-admin-web/src/components/XnOrgSelector/index.vue
@@ -0,0 +1,579 @@
+
+
+
+
{{
+ data.name
+ }}
+
+
+
+
+ 选择
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+ 待选择列表 {{ tableRecordNum }} 条
+
+
+
+
+
+
+
+ {{ $TOOL.dictTypeData('ORG_CATEGORY', record.category) }}
+
+
+
+
+
+
+
+
+
+
+ 已选择: {{ selectedData.length }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/snowy-admin-web/src/components/XnPositionSelector/README.md b/snowy-admin-web/src/components/XnPositionSelector/README.md
new file mode 100644
index 00000000..2964be34
--- /dev/null
+++ b/snowy-admin-web/src/components/XnPositionSelector/README.md
@@ -0,0 +1,36 @@
+## 小诺职位选择器
+
+### 说明
+
+改组件为小诺职位选择器,可返回id用逗号隔离的字符串或id数组类型的数据格式
+
+@author yubaoshan
+
+@data 2024年7月5日23:59:23
+
+### props定义
+
+| 序号 | 编码 | 类型 | 说明 | 默认 |
+|-----|---------------------|---------------|------------------------------|--------|
+| 1 | radioModel | Boolean | 是否单选;与addShow隐藏同时可用 | false |
+| 2 | dataIsConverterFlw | Boolean | 是否为工作流格式 | false |
+| 3 | orgTreeApi | function | 机构树接口 | - |
+| 4 | positionPageApi | function | 职位分页接口 | - |
+| 5 | positionListByIdListApi | function | 通过id数组查询list数据接口 | 已配置 |
+| 6 | value | object或string | 通过v-model:value绑定数据 | - |
+| 7 | dataType | string | 数据类型object或string | string |
+| 8 | show | Boolean | 是否显示已选择职位(非表单内、单纯的选择职位需要隐藏) | true |
+| 9 | addShow | Boolean | 是否默认的增加人员按钮,与radioModel为或的关系 | true |
+
+### emits定义
+
+| 序号 | 方法名 | 参数类型 | 说明 |
+|----|--------|----------------|---------------------------------|
+| 1 | value | 根据 dataType 而定 | 当选择职位后通过v-model:value绑定到组件上 |
+| 2 | onBack | 根据 dataType 而定 | 通过@onBack 方法返回选中的数据,触发点为选中或删除职位 |
+
+### slot定义
+
+| 序号 | 插槽名 | 用途 | 用途 |
+|----|--------|-------------------|-------------------|
+| 1 | button | 在职位新增按钮后可以插入自定义按钮 | 不满足新增职位按钮样式,可以自定义 |
diff --git a/snowy-admin-web/src/components/XnPositionSelector/index.vue b/snowy-admin-web/src/components/XnPositionSelector/index.vue
new file mode 100644
index 00000000..81aa5875
--- /dev/null
+++ b/snowy-admin-web/src/components/XnPositionSelector/index.vue
@@ -0,0 +1,579 @@
+
+
+
+
{{
+ data.name
+ }}
+
+
+
+
+ 选择
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+ 待选择列表 {{ tableRecordNum }} 条
+
+
+
+
+
+
+
+ {{ $TOOL.dictTypeData('POSITION_CATEGORY', record.category) }}
+
+
+
+
+
+
+
+
+
+
+ 已选择: {{ selectedData.length }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/snowy-admin-web/src/components/XnRoleSelector/README.md b/snowy-admin-web/src/components/XnRoleSelector/README.md
new file mode 100644
index 00000000..0b26be8f
--- /dev/null
+++ b/snowy-admin-web/src/components/XnRoleSelector/README.md
@@ -0,0 +1,36 @@
+## 小诺角色选择器
+
+### 说明
+
+改组件为小诺角色选择器,可返回id用逗号隔离的字符串或id数组类型的数据格式
+
+@author yubaoshan
+
+@data 2024年7月5日23:59:23
+
+### props定义
+
+| 序号 | 编码 | 类型 | 说明 | 默认 |
+|-----|---------------------|---------------|------------------------------|--------|
+| 1 | radioModel | Boolean | 是否单选;与addShow隐藏同时可用 | false |
+| 2 | dataIsConverterFlw | Boolean | 是否为工作流格式 | false |
+| 3 | orgTreeApi | function | 机构树接口 | - |
+| 4 | rolePageApi | function | 角色分页接口 | - |
+| 5 | roleListByIdListApi | function | 通过id数组查询list数据接口 | 已配置 |
+| 6 | value | object或string | 通过v-model:value绑定数据 | - |
+| 7 | dataType | string | 数据类型object或string | string |
+| 8 | show | Boolean | 是否显示已选择角色(非表单内、单纯的选择角色需要隐藏) | true |
+| 9 | addShow | Boolean | 是否默认的增加人员按钮,与radioModel为或的关系 | true |
+
+### emits定义
+
+| 序号 | 方法名 | 参数类型 | 说明 |
+|----|--------|----------------|---------------------------------|
+| 1 | value | 根据 dataType 而定 | 当选择角色后通过v-model:value绑定到组件上 |
+| 2 | onBack | 根据 dataType 而定 | 通过@onBack 方法返回选中的数据,触发点为选中或删除角色 |
+
+### slot定义
+
+| 序号 | 插槽名 | 用途 | 用途 |
+|----|--------|-------------------|-------------------|
+| 1 | button | 在角色新增按钮后可以插入自定义按钮 | 不满足新增角色按钮样式,可以自定义 |
diff --git a/snowy-admin-web/src/components/XnRoleSelector/index.vue b/snowy-admin-web/src/components/XnRoleSelector/index.vue
new file mode 100644
index 00000000..86c55279
--- /dev/null
+++ b/snowy-admin-web/src/components/XnRoleSelector/index.vue
@@ -0,0 +1,607 @@
+
+
+
+
{{
+ data.name
+ }}
+
+
+
+
+ 选择
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+ 待选择列表 {{ tableRecordNum }} 条
+
+
+
+
+
+
+
+ {{ $TOOL.dictTypeData('ROLE_CATEGORY', record.category) }}
+
+
+
+
+
+
+
+
+
+
+ 已选择: {{ selectedData.length }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/snowy-admin-web/src/components/XnUserSelector/index.vue b/snowy-admin-web/src/components/XnUserSelector/index.vue
index c183612b..3c6cb356 100644
--- a/snowy-admin-web/src/components/XnUserSelector/index.vue
+++ b/snowy-admin-web/src/components/XnUserSelector/index.vue
@@ -1,6 +1,6 @@
-
+
import { message } from 'ant-design-vue'
import { remove, isEmpty, cloneDeep } from 'lodash-es'
+ import userCenterApi from '@/api/sys/userCenterApi'
// 弹窗是否打开
const visible = ref(false)
const deleteShow = ref('')
@@ -187,16 +188,13 @@
default: () => false
},
orgTreeApi: {
- type: Function,
- default: () => undefined
+ type: Function
},
userPageApi: {
- type: Function,
- default: () => undefined
+ type: Function
},
userListByIdListApi: {
- type: Function,
- default: () => undefined
+ type: Function
},
value: {
default: () => ''
@@ -238,6 +236,16 @@
const current = ref(0) // 当前页数
const pageSize = ref(20) // 每页条数
const total = ref(0) // 数据总数
+ // 获取选中列表的api
+ const userListByIdList = (param) => {
+ if (typeof props.userListByIdListApi === 'function') {
+ return props.userListByIdListApi(param)
+ } else {
+ return userCenterApi.userCenterGetUserListByIdList(param).then((data) => {
+ return Promise.resolve(data)
+ })
+ }
+ }
// 打开弹框
const showUserPlusModal = (ids = []) => {
const data = goDataConverter(ids)
@@ -260,10 +268,6 @@
message.warning('未配置选择器需要的userPageApi接口')
return
}
- if (typeof props.userListByIdListApi !== 'function') {
- message.warning('未配置选择器需要的userListByIdListApi接口')
- return
- }
visible.value = true
// 获取机构树
props
@@ -291,23 +295,20 @@
})
searchFormState.value.size = pageSize.value
loadData()
- if (props.userListByIdListApi) {
- if (isEmpty(recordIds.value)) {
- return
- }
- const param = {
- idList: recordIds.value
- }
- selectedTableListLoading.value = true
- props
- .userListByIdListApi(param)
- .then((data) => {
- selectedData.value = data
- })
- .finally(() => {
- selectedTableListLoading.value = false
- })
+ if (isEmpty(recordIds.value)) {
+ return
}
+ const param = {
+ idList: recordIds.value
+ }
+ selectedTableListLoading.value = true
+ userListByIdList(param)
+ .then((data) => {
+ selectedData.value = data
+ })
+ .finally(() => {
+ selectedTableListLoading.value = false
+ })
}
// 点击头像删除用户
const deleteUser = (user) => {
@@ -543,7 +544,7 @@
idList: recordIds.value
}
// 这里必须转为数组类型的
- props.userListByIdListApi(param).then((data) => {
+ userListByIdList(param).then((data) => {
userObj.value = data
})
}
diff --git a/snowy-admin-web/src/style/index.less b/snowy-admin-web/src/style/index.less
index 2c7f5cb0..b866230b 100644
--- a/snowy-admin-web/src/style/index.less
+++ b/snowy-admin-web/src/style/index.less
@@ -363,6 +363,8 @@ body,
.gen-preview-content,
.ant-menu,
.ant-tabs-dropdown-menu,
+.xn-table,
+.selector-table,
.admin-ui-main{
&::-webkit-scrollbar {
diff --git a/snowy-admin-web/src/views/biz/org/form.vue b/snowy-admin-web/src/views/biz/org/form.vue
index 85d8e809..537e5beb 100644
--- a/snowy-admin-web/src/views/biz/org/form.vue
+++ b/snowy-admin-web/src/views/biz/org/form.vue
@@ -43,7 +43,6 @@
@@ -59,7 +58,6 @@
diff --git a/snowy-admin-web/src/views/dev/message/form.vue b/snowy-admin-web/src/views/dev/message/form.vue
index ffd5e3f2..1811b99e 100644
--- a/snowy-admin-web/src/views/dev/message/form.vue
+++ b/snowy-admin-web/src/views/dev/message/form.vue
@@ -19,7 +19,6 @@
@@ -37,7 +36,6 @@
import { message } from 'ant-design-vue'
import messageApi from '@/api/dev/messageApi'
import userApi from '@/api/sys/userApi'
- import userCenterApi from '@/api/sys/userCenterApi'
import tool from '@/utils/tool'
const sendLoading = ref(false)
@@ -94,11 +92,6 @@
return userApi.userSelector(param).then((data) => {
return Promise.resolve(data)
})
- },
- checkedUserListApi: (param) => {
- return userCenterApi.userCenterGetUserListByIdList(param).then((data) => {
- return Promise.resolve(data)
- })
}
}
// 调用这个函数将子组件的一些数据和方法暴露出去
diff --git a/snowy-admin-web/src/views/sys/org/form.vue b/snowy-admin-web/src/views/sys/org/form.vue
index d711bcff..c98fe299 100644
--- a/snowy-admin-web/src/views/sys/org/form.vue
+++ b/snowy-admin-web/src/views/sys/org/form.vue
@@ -43,7 +43,6 @@
@@ -59,7 +58,6 @@
diff --git a/snowy-admin-web/src/views/sys/user/index.vue b/snowy-admin-web/src/views/sys/user/index.vue
index 311f267d..976e2303 100644
--- a/snowy-admin-web/src/views/sys/user/index.vue
+++ b/snowy-admin-web/src/views/sys/user/index.vue
@@ -140,11 +140,12 @@
-
@@ -159,8 +160,6 @@
import downloadUtil from '@/utils/downloadUtil'
import userApi from '@/api/sys/userApi'
import orgApi from '@/api/sys/orgApi'
- import userCenterApi from '@/api/sys/userCenterApi'
- import RoleSelectorPlus from '@/components/Selector/roleSelectorPlus.vue'
import Form from './form.vue'
import ImpExp from './impExp.vue'
import GrantResourceForm from './grantResourceForm.vue'
@@ -365,7 +364,7 @@
id: record.id
}
userApi.userOwnRole(param).then((data) => {
- RoleSelectorPlusRef.value.showRolePlusModal(data)
+ RoleSelectorPlusRef.value.showModel(data)
})
}
// 角色选择回调
@@ -376,7 +375,7 @@
}
if (value.length > 0) {
value.forEach((item) => {
- params.roleIdList.push(item.id)
+ params.roleIdList.push(item)
})
}
userApi.grantRole(params).then(() => {})
@@ -405,11 +404,6 @@
return userApi.userRoleSelector(param).then((data) => {
return Promise.resolve(data)
})
- },
- checkedRoleListApi: (param) => {
- return userCenterApi.userCenterGetRoleListByIdList(param).then((data) => {
- return Promise.resolve(data)
- })
}
}