Commit 7822d4251224a9b4a1e735f53e88862b8c65c821
Merge branch 'ft_local_dev' into 'main'
fix:修改Teambition上的问题 See merge request huang/yun-teng-iot-front!409
Showing
9 changed files
with
102 additions
and
42 deletions
@@ -21,7 +21,7 @@ export type OtherParams = { | @@ -21,7 +21,7 @@ export type OtherParams = { | ||
21 | }; | 21 | }; |
22 | 22 | ||
23 | enum Api { | 23 | enum Api { |
24 | - userPage = '/user/page', | 24 | + userPage = '/user/tenant/page', |
25 | tenantPage = '/admin/tenant/page', | 25 | tenantPage = '/admin/tenant/page', |
26 | saveTenantAdmin = '/user/save_tenant_admin', | 26 | saveTenantAdmin = '/user/save_tenant_admin', |
27 | updateOrCreateTenant = '/admin/tenant/updateOrCreateTenant', | 27 | updateOrCreateTenant = '/admin/tenant/updateOrCreateTenant', |
@@ -92,9 +92,17 @@ export function getTenantPage(params: TenantPageRequestParams) { | @@ -92,9 +92,17 @@ export function getTenantPage(params: TenantPageRequestParams) { | ||
92 | return getPageData<TenantDTO>(params, Api.tenantPage); | 92 | return getPageData<TenantDTO>(params, Api.tenantPage); |
93 | } | 93 | } |
94 | 94 | ||
95 | -export function getTenantAdminPage(params: TenantAdminPageRequestParams) { | ||
96 | - return getPageData<UserDTO>(params, Api.userPage); | ||
97 | -} | 95 | +// export function getTenantAdminPage(params: TenantAdminPageRequestParams) { |
96 | +// return getPageData<UserDTO>(params, Api.userPage); | ||
97 | +// } | ||
98 | + | ||
99 | +//分页 | ||
100 | +export const getTenantAdminPage = (params: TenantAdminPageRequestParams) => { | ||
101 | + return defHttp.get<TenantAdminPageRequestParams>({ | ||
102 | + url: Api.userPage, | ||
103 | + params, | ||
104 | + }); | ||
105 | +}; | ||
98 | 106 | ||
99 | export async function saveTenantAdmin(params: UserDTO) { | 107 | export async function saveTenantAdmin(params: UserDTO) { |
100 | await defHttp.post({ | 108 | await defHttp.post({ |
@@ -40,9 +40,9 @@ export interface TenantPageRequestParams extends BaseQueryParams { | @@ -40,9 +40,9 @@ export interface TenantPageRequestParams extends BaseQueryParams { | ||
40 | 40 | ||
41 | export interface TenantAdminPageRequestParams extends BaseQueryParams { | 41 | export interface TenantAdminPageRequestParams extends BaseQueryParams { |
42 | realName?: string; | 42 | realName?: string; |
43 | - tenantCode: string; | 43 | + // tenantCode: string; |
44 | tenantId?: string; | 44 | tenantId?: string; |
45 | - roleType?: string; | 45 | + // roleType?: string; |
46 | } | 46 | } |
47 | 47 | ||
48 | export interface tenantProfileDTO { | 48 | export interface tenantProfileDTO { |
@@ -29,18 +29,21 @@ | @@ -29,18 +29,21 @@ | ||
29 | icon: 'ant-design:font-size-outlined', | 29 | icon: 'ant-design:font-size-outlined', |
30 | auth: 'api:yt:js:test', | 30 | auth: 'api:yt:js:test', |
31 | onClick: handleBindTest.bind(null, record), | 31 | onClick: handleBindTest.bind(null, record), |
32 | + ifShow: record.status == 0, | ||
32 | }, | 33 | }, |
33 | { | 34 | { |
34 | label: '编辑', | 35 | label: '编辑', |
35 | icon: 'clarity:note-edit-line', | 36 | icon: 'clarity:note-edit-line', |
36 | auth: 'api:yt:js:update', | 37 | auth: 'api:yt:js:update', |
37 | onClick: handleCreateOrEdit.bind(null, record), | 38 | onClick: handleCreateOrEdit.bind(null, record), |
39 | + ifShow: record.status == 0, | ||
38 | }, | 40 | }, |
39 | { | 41 | { |
40 | label: '删除', | 42 | label: '删除', |
41 | icon: 'ant-design:delete-outlined', | 43 | icon: 'ant-design:delete-outlined', |
42 | auth: 'api:yt:js:delete', | 44 | auth: 'api:yt:js:delete', |
43 | color: 'error', | 45 | color: 'error', |
46 | + ifShow: record.status == 0, | ||
44 | popConfirm: { | 47 | popConfirm: { |
45 | title: '是否确认删除', | 48 | title: '是否确认删除', |
46 | confirm: handleDeleteOrBatchDelete.bind(null, record), | 49 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
@@ -50,16 +53,16 @@ | @@ -50,16 +53,16 @@ | ||
50 | /> | 53 | /> |
51 | </template> | 54 | </template> |
52 | <template #status="{ record }"> | 55 | <template #status="{ record }"> |
53 | - <Switch | ||
54 | - :checked="record.status === 1" | ||
55 | - :loading="record.pendingStatus" | ||
56 | - checkedChildren="启用" | ||
57 | - unCheckedChildren="禁用" | ||
58 | - @change="(checked:boolean)=>statusChange(checked,record)" | ||
59 | - /> | 56 | + <Authority value="api:yt:js:update:status"> |
57 | + <Switch | ||
58 | + :checked="record.status === 1" | ||
59 | + :loading="record.pendingStatus" | ||
60 | + checkedChildren="启用" | ||
61 | + unCheckedChildren="禁用" | ||
62 | + @change="(checked:boolean)=>statusChange(checked,record)" | ||
63 | + /> | ||
64 | + </Authority> | ||
60 | </template> | 65 | </template> |
61 | - <!-- <Authority value="api:yt:js:update:status"> | ||
62 | - </Authority> --> | ||
63 | </BasicTable> | 66 | </BasicTable> |
64 | <ConverScriptModal @register="registerModal" @success="handleSuccess" /> | 67 | <ConverScriptModal @register="registerModal" @success="handleSuccess" /> |
65 | </div> | 68 | </div> |
@@ -20,27 +20,64 @@ | @@ -20,27 +20,64 @@ | ||
20 | toolbar | 20 | toolbar |
21 | /> | 21 | /> |
22 | </template> | 22 | </template> |
23 | + <template #roleSlot="{ model, field }"> | ||
24 | + <a-select | ||
25 | + mode="multiple" | ||
26 | + allowClear | ||
27 | + placeholder="请选择角色" | ||
28 | + v-model:value="model[field]" | ||
29 | + :options="roleOptions.map((item) => ({ value: item.value, label: item.label }))" | ||
30 | + > | ||
31 | + <template #dropdownRender="{ menuNode: menu }"> | ||
32 | + <v-nodes :vnodes="menu" /> | ||
33 | + <a-divider style="margin: 4px 0" /> | ||
34 | + <div @click="handleOpenRole" style="padding: 4px 0; cursor: pointer"> | ||
35 | + <plus-outlined /> | ||
36 | + 新增角色 | ||
37 | + </div> | ||
38 | + </template> | ||
39 | + </a-select> | ||
40 | + </template> | ||
23 | </BasicForm> | 41 | </BasicForm> |
24 | </div> | 42 | </div> |
25 | </BasicModal> | 43 | </BasicModal> |
44 | + <RoleDrawer @register="registerRoleDrawer" @success="handleSuccess" /> | ||
26 | </template> | 45 | </template> |
27 | <script lang="ts"> | 46 | <script lang="ts"> |
28 | - import { defineComponent, ref, computed, unref, reactive } from 'vue'; | 47 | + import { defineComponent, ref, computed, unref, reactive, onMounted } from 'vue'; |
29 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 48 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
30 | import { BasicForm, useForm } from '/@/components/Form/index'; | 49 | import { BasicForm, useForm } from '/@/components/Form/index'; |
31 | import { accountFormSchema } from './account.data'; | 50 | import { accountFormSchema } from './account.data'; |
32 | - import { findCurrentUserRelation, SaveOrUpdateUserInfo } from '/@/api/system/system'; | 51 | + import { |
52 | + findCurrentUserRelation, | ||
53 | + SaveOrUpdateUserInfo, | ||
54 | + filterRoleList, | ||
55 | + } from '/@/api/system/system'; | ||
33 | import { BasicTree, TreeItem } from '/@/components/Tree'; | 56 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
34 | import { findCurrentUserGroups } from '/@/api/system/group'; | 57 | import { findCurrentUserGroups } from '/@/api/system/group'; |
35 | import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel'; | 58 | import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel'; |
36 | import { useMessage } from '/@/hooks/web/useMessage'; | 59 | import { useMessage } from '/@/hooks/web/useMessage'; |
37 | import { copyTransTreeFun } from '/@/utils/fnUtils'; | 60 | import { copyTransTreeFun } from '/@/utils/fnUtils'; |
61 | + import { TOption } from '/@/views/rule/linkedge/config/config.data'; | ||
62 | + import { PlusOutlined } from '@ant-design/icons-vue'; | ||
63 | + import { useDrawer } from '/@/components/Drawer'; | ||
64 | + import RoleDrawer from '../role/RoleDrawer.vue'; | ||
38 | 65 | ||
39 | export default defineComponent({ | 66 | export default defineComponent({ |
40 | name: 'AccountModal', | 67 | name: 'AccountModal', |
41 | - components: { BasicModal, BasicForm, BasicTree }, | 68 | + components: { |
69 | + BasicModal, | ||
70 | + BasicForm, | ||
71 | + BasicTree, | ||
72 | + PlusOutlined, | ||
73 | + RoleDrawer, | ||
74 | + VNodes: (_, { attrs }) => { | ||
75 | + return attrs.vnodes; | ||
76 | + }, | ||
77 | + }, | ||
42 | emits: ['success', 'register'], | 78 | emits: ['success', 'register'], |
43 | setup(_, { emit }) { | 79 | setup(_, { emit }) { |
80 | + const roleOptions = ref<TOption[]>([]); | ||
44 | const isUpdate = ref(true); | 81 | const isUpdate = ref(true); |
45 | const rowId = ref(''); | 82 | const rowId = ref(''); |
46 | const organizationTreeData = ref<TreeItem[]>([]); | 83 | const organizationTreeData = ref<TreeItem[]>([]); |
@@ -52,7 +89,29 @@ | @@ -52,7 +89,29 @@ | ||
52 | const singleEditPostPhoneNumber = reactive({ | 89 | const singleEditPostPhoneNumber = reactive({ |
53 | phoneNumber: '', | 90 | phoneNumber: '', |
54 | }); | 91 | }); |
92 | + const getRoleList = async () => { | ||
93 | + const res = await filterRoleList(); | ||
94 | + console.log(res); | ||
95 | + roleOptions.value = res.map((m) => { | ||
96 | + return { | ||
97 | + label: m.name, | ||
98 | + value: m.id, | ||
99 | + }; | ||
100 | + }); | ||
101 | + }; | ||
102 | + onMounted(async () => { | ||
103 | + await getRoleList(); | ||
104 | + }); | ||
105 | + const [registerRoleDrawer, { openDrawer }] = useDrawer(); | ||
55 | 106 | ||
107 | + const handleOpenRole = () => { | ||
108 | + openDrawer(true, { | ||
109 | + isUpdate: false, | ||
110 | + }); | ||
111 | + }; | ||
112 | + const handleSuccess = async () => { | ||
113 | + await getRoleList(); | ||
114 | + }; | ||
56 | const [ | 115 | const [ |
57 | registerForm, | 116 | registerForm, |
58 | { setFieldsValue, updateSchema, resetFields, validate, getFieldsValue }, | 117 | { setFieldsValue, updateSchema, resetFields, validate, getFieldsValue }, |
@@ -163,6 +222,10 @@ | @@ -163,6 +222,10 @@ | ||
163 | checkGroup, | 222 | checkGroup, |
164 | basicTreeRef, | 223 | basicTreeRef, |
165 | treeExpandData, | 224 | treeExpandData, |
225 | + roleOptions, | ||
226 | + registerRoleDrawer, | ||
227 | + handleOpenRole, | ||
228 | + handleSuccess, | ||
166 | }; | 229 | }; |
167 | }, | 230 | }, |
168 | }); | 231 | }); |
@@ -171,9 +234,11 @@ | @@ -171,9 +234,11 @@ | ||
171 | :deep(.vben-basic-tree) { | 234 | :deep(.vben-basic-tree) { |
172 | width: 100% !important; | 235 | width: 100% !important; |
173 | } | 236 | } |
237 | + | ||
174 | :deep(.is-unflod) { | 238 | :deep(.is-unflod) { |
175 | display: none !important; | 239 | display: none !important; |
176 | } | 240 | } |
241 | + | ||
177 | :deep(.is-flod) { | 242 | :deep(.is-flod) { |
178 | display: none !important; | 243 | display: none !important; |
179 | } | 244 | } |
1 | -import { filterRoleList, isAccountExist, IsPhoneExist } from '/@/api/system/system'; | 1 | +import { isAccountExist, IsPhoneExist } from '/@/api/system/system'; |
2 | import { BasicColumn } from '/@/components/Table'; | 2 | import { BasicColumn } from '/@/components/Table'; |
3 | import { FormSchema } from '/@/components/Table'; | 3 | import { FormSchema } from '/@/components/Table'; |
4 | import { emailRule, ChineseRegexp, EmailRegexp, phoneRegexp } from '/@/utils/rules'; | 4 | import { emailRule, ChineseRegexp, EmailRegexp, phoneRegexp } from '/@/utils/rules'; |
@@ -133,14 +133,9 @@ export const accountFormSchema: FormSchema[] = [ | @@ -133,14 +133,9 @@ export const accountFormSchema: FormSchema[] = [ | ||
133 | { | 133 | { |
134 | label: '角色', | 134 | label: '角色', |
135 | field: 'roleIds', | 135 | field: 'roleIds', |
136 | - component: 'ApiSelect', | 136 | + component: 'Select', |
137 | colProps: { span: 12 }, | 137 | colProps: { span: 12 }, |
138 | - componentProps: { | ||
139 | - mode: 'multiple', | ||
140 | - api: filterRoleList, | ||
141 | - labelField: 'name', | ||
142 | - valueField: 'id', | ||
143 | - }, | 138 | + slot: 'roleSlot', |
144 | rules: [ | 139 | rules: [ |
145 | { | 140 | { |
146 | required: true, | 141 | required: true, |
@@ -33,7 +33,7 @@ export const columns: BasicColumn[] = [ | @@ -33,7 +33,7 @@ export const columns: BasicColumn[] = [ | ||
33 | 33 | ||
34 | export const searchFormSchema: FormSchema[] = [ | 34 | export const searchFormSchema: FormSchema[] = [ |
35 | { | 35 | { |
36 | - field: 'textSearch', | 36 | + field: 'name', |
37 | label: '租户配置名称', | 37 | label: '租户配置名称', |
38 | colProps: { span: 6 }, | 38 | colProps: { span: 6 }, |
39 | component: 'Input', | 39 | component: 'Input', |
@@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
46 | label: '删除', | 46 | label: '删除', |
47 | icon: 'ant-design:delete-outlined', | 47 | icon: 'ant-design:delete-outlined', |
48 | tooltip: '删除', | 48 | tooltip: '删除', |
49 | - auth: 'api:yt:user:saveTenantAdmin:delete', | 49 | + auth: 'api:yt:admin:user:deleteTenantAdmin:delete', |
50 | color: 'error', | 50 | color: 'error', |
51 | popConfirm: { | 51 | popConfirm: { |
52 | title: '是否确认删除', | 52 | title: '是否确认删除', |
@@ -192,7 +192,7 @@ | @@ -192,7 +192,7 @@ | ||
192 | showIndexColumn: false, | 192 | showIndexColumn: false, |
193 | searchInfo: { | 193 | searchInfo: { |
194 | tenantId, | 194 | tenantId, |
195 | - roleType: RoleEnum.TENANT_ADMIN, | 195 | + // roleType: RoleEnum.TENANT_ADMIN, |
196 | }, | 196 | }, |
197 | actionColumn: { | 197 | actionColumn: { |
198 | width: 100, | 198 | width: 100, |
@@ -17,7 +17,6 @@ | @@ -17,7 +17,6 @@ | ||
17 | import { saveTenantAdmin } from '/@/api/tenant/tenantApi'; | 17 | import { saveTenantAdmin } from '/@/api/tenant/tenantApi'; |
18 | import { UserDTO } from '/@/api/tenant/tenantInfo'; | 18 | import { UserDTO } from '/@/api/tenant/tenantInfo'; |
19 | import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules'; | 19 | import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules'; |
20 | - // import { isAccountExist } from '/@/api/system/system'; | ||
21 | import { chineseAndEnlishRule } from '/@/utils/rules'; | 20 | import { chineseAndEnlishRule } from '/@/utils/rules'; |
22 | 21 | ||
23 | export default defineComponent({ | 22 | export default defineComponent({ |
@@ -57,13 +56,11 @@ | @@ -57,13 +56,11 @@ | ||
57 | return f.username == values.username; | 56 | return f.username == values.username; |
58 | } | 57 | } |
59 | }); | 58 | }); |
60 | - console.log(findUserName); | ||
61 | return [ | 59 | return [ |
62 | { | 60 | { |
63 | required: true, | 61 | required: true, |
64 | validator(_, value) { | 62 | validator(_, value) { |
65 | return new Promise((resolve, reject) => { | 63 | return new Promise((resolve, reject) => { |
66 | - console.log(value); | ||
67 | if (value == '' || value === undefined) { | 64 | if (value == '' || value === undefined) { |
68 | reject('请输入账号'); | 65 | reject('请输入账号'); |
69 | } else if (ChineseRegexp.test(value)) { | 66 | } else if (ChineseRegexp.test(value)) { |
@@ -133,7 +130,6 @@ | @@ -133,7 +130,6 @@ | ||
133 | await resetFields(); | 130 | await resetFields(); |
134 | isUpdate.value = !!data?.isUpdate; | 131 | isUpdate.value = !!data?.isUpdate; |
135 | tenantId.value = data?.tenantId; | 132 | tenantId.value = data?.tenantId; |
136 | - console.log(data.judgeExistUserName); | ||
137 | isJudgeUserNameExist.value = data.judgeExistUserName; | 133 | isJudgeUserNameExist.value = data.judgeExistUserName; |
138 | if (unref(isUpdate)) { | 134 | if (unref(isUpdate)) { |
139 | await updateSchema({ field: 'username', componentProps: { disabled: true } }); | 135 | await updateSchema({ field: 'username', componentProps: { disabled: true } }); |
@@ -120,8 +120,8 @@ | @@ -120,8 +120,8 @@ | ||
120 | 120 | ||
121 | //提交按钮 | 121 | //提交按钮 |
122 | async function handleSubmit() { | 122 | async function handleSubmit() { |
123 | - setDrawerProps({ confirmLoading: true }); | ||
124 | try { | 123 | try { |
124 | + setDrawerProps({ confirmLoading: true }); | ||
125 | const values = await validate(); | 125 | const values = await validate(); |
126 | const req = { | 126 | const req = { |
127 | id: values.id, | 127 | id: values.id, |
@@ -153,16 +153,9 @@ | @@ -153,16 +153,9 @@ | ||
153 | const { createMessage } = useMessage(); | 153 | const { createMessage } = useMessage(); |
154 | createMessage.error(`${e.message}`); | 154 | createMessage.error(`${e.message}`); |
155 | }) | 155 | }) |
156 | - .finally(() => { | ||
157 | - setTimeout(() => { | ||
158 | - setDrawerProps({ confirmLoading: false }); | ||
159 | - }, 300); | ||
160 | - }); | 156 | + .finally(() => {}); |
161 | } catch (e) { | 157 | } catch (e) { |
162 | } finally { | 158 | } finally { |
163 | - setTimeout(() => { | ||
164 | - setDrawerProps({ confirmLoading: false }); | ||
165 | - }, 300); | ||
166 | } | 159 | } |
167 | } | 160 | } |
168 | return { | 161 | return { |