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 | 21 | }; |
| 22 | 22 | |
| 23 | 23 | enum Api { |
| 24 | - userPage = '/user/page', | |
| 24 | + userPage = '/user/tenant/page', | |
| 25 | 25 | tenantPage = '/admin/tenant/page', |
| 26 | 26 | saveTenantAdmin = '/user/save_tenant_admin', |
| 27 | 27 | updateOrCreateTenant = '/admin/tenant/updateOrCreateTenant', |
| ... | ... | @@ -92,9 +92,17 @@ export function getTenantPage(params: TenantPageRequestParams) { |
| 92 | 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 | 107 | export async function saveTenantAdmin(params: UserDTO) { |
| 100 | 108 | await defHttp.post({ | ... | ... |
| ... | ... | @@ -40,9 +40,9 @@ export interface TenantPageRequestParams extends BaseQueryParams { |
| 40 | 40 | |
| 41 | 41 | export interface TenantAdminPageRequestParams extends BaseQueryParams { |
| 42 | 42 | realName?: string; |
| 43 | - tenantCode: string; | |
| 43 | + // tenantCode: string; | |
| 44 | 44 | tenantId?: string; |
| 45 | - roleType?: string; | |
| 45 | + // roleType?: string; | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | export interface tenantProfileDTO { | ... | ... |
| ... | ... | @@ -29,18 +29,21 @@ |
| 29 | 29 | icon: 'ant-design:font-size-outlined', |
| 30 | 30 | auth: 'api:yt:js:test', |
| 31 | 31 | onClick: handleBindTest.bind(null, record), |
| 32 | + ifShow: record.status == 0, | |
| 32 | 33 | }, |
| 33 | 34 | { |
| 34 | 35 | label: '编辑', |
| 35 | 36 | icon: 'clarity:note-edit-line', |
| 36 | 37 | auth: 'api:yt:js:update', |
| 37 | 38 | onClick: handleCreateOrEdit.bind(null, record), |
| 39 | + ifShow: record.status == 0, | |
| 38 | 40 | }, |
| 39 | 41 | { |
| 40 | 42 | label: '删除', |
| 41 | 43 | icon: 'ant-design:delete-outlined', |
| 42 | 44 | auth: 'api:yt:js:delete', |
| 43 | 45 | color: 'error', |
| 46 | + ifShow: record.status == 0, | |
| 44 | 47 | popConfirm: { |
| 45 | 48 | title: '是否确认删除', |
| 46 | 49 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
| ... | ... | @@ -50,16 +53,16 @@ |
| 50 | 53 | /> |
| 51 | 54 | </template> |
| 52 | 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 | 65 | </template> |
| 61 | - <!-- <Authority value="api:yt:js:update:status"> | |
| 62 | - </Authority> --> | |
| 63 | 66 | </BasicTable> |
| 64 | 67 | <ConverScriptModal @register="registerModal" @success="handleSuccess" /> |
| 65 | 68 | </div> | ... | ... |
| ... | ... | @@ -20,27 +20,64 @@ |
| 20 | 20 | toolbar |
| 21 | 21 | /> |
| 22 | 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 | 41 | </BasicForm> |
| 24 | 42 | </div> |
| 25 | 43 | </BasicModal> |
| 44 | + <RoleDrawer @register="registerRoleDrawer" @success="handleSuccess" /> | |
| 26 | 45 | </template> |
| 27 | 46 | <script lang="ts"> |
| 28 | - import { defineComponent, ref, computed, unref, reactive } from 'vue'; | |
| 47 | + import { defineComponent, ref, computed, unref, reactive, onMounted } from 'vue'; | |
| 29 | 48 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
| 30 | 49 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 31 | 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 | 56 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
| 34 | 57 | import { findCurrentUserGroups } from '/@/api/system/group'; |
| 35 | 58 | import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel'; |
| 36 | 59 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 37 | 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 | 66 | export default defineComponent({ |
| 40 | 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 | 78 | emits: ['success', 'register'], |
| 43 | 79 | setup(_, { emit }) { |
| 80 | + const roleOptions = ref<TOption[]>([]); | |
| 44 | 81 | const isUpdate = ref(true); |
| 45 | 82 | const rowId = ref(''); |
| 46 | 83 | const organizationTreeData = ref<TreeItem[]>([]); |
| ... | ... | @@ -52,7 +89,29 @@ |
| 52 | 89 | const singleEditPostPhoneNumber = reactive({ |
| 53 | 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 | 115 | const [ |
| 57 | 116 | registerForm, |
| 58 | 117 | { setFieldsValue, updateSchema, resetFields, validate, getFieldsValue }, |
| ... | ... | @@ -163,6 +222,10 @@ |
| 163 | 222 | checkGroup, |
| 164 | 223 | basicTreeRef, |
| 165 | 224 | treeExpandData, |
| 225 | + roleOptions, | |
| 226 | + registerRoleDrawer, | |
| 227 | + handleOpenRole, | |
| 228 | + handleSuccess, | |
| 166 | 229 | }; |
| 167 | 230 | }, |
| 168 | 231 | }); |
| ... | ... | @@ -171,9 +234,11 @@ |
| 171 | 234 | :deep(.vben-basic-tree) { |
| 172 | 235 | width: 100% !important; |
| 173 | 236 | } |
| 237 | + | |
| 174 | 238 | :deep(.is-unflod) { |
| 175 | 239 | display: none !important; |
| 176 | 240 | } |
| 241 | + | |
| 177 | 242 | :deep(.is-flod) { |
| 178 | 243 | display: none !important; |
| 179 | 244 | } | ... | ... |
| 1 | -import { filterRoleList, isAccountExist, IsPhoneExist } from '/@/api/system/system'; | |
| 1 | +import { isAccountExist, IsPhoneExist } from '/@/api/system/system'; | |
| 2 | 2 | import { BasicColumn } from '/@/components/Table'; |
| 3 | 3 | import { FormSchema } from '/@/components/Table'; |
| 4 | 4 | import { emailRule, ChineseRegexp, EmailRegexp, phoneRegexp } from '/@/utils/rules'; |
| ... | ... | @@ -133,14 +133,9 @@ export const accountFormSchema: FormSchema[] = [ |
| 133 | 133 | { |
| 134 | 134 | label: '角色', |
| 135 | 135 | field: 'roleIds', |
| 136 | - component: 'ApiSelect', | |
| 136 | + component: 'Select', | |
| 137 | 137 | colProps: { span: 12 }, |
| 138 | - componentProps: { | |
| 139 | - mode: 'multiple', | |
| 140 | - api: filterRoleList, | |
| 141 | - labelField: 'name', | |
| 142 | - valueField: 'id', | |
| 143 | - }, | |
| 138 | + slot: 'roleSlot', | |
| 144 | 139 | rules: [ |
| 145 | 140 | { |
| 146 | 141 | required: true, | ... | ... |
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | label: '删除', |
| 47 | 47 | icon: 'ant-design:delete-outlined', |
| 48 | 48 | tooltip: '删除', |
| 49 | - auth: 'api:yt:user:saveTenantAdmin:delete', | |
| 49 | + auth: 'api:yt:admin:user:deleteTenantAdmin:delete', | |
| 50 | 50 | color: 'error', |
| 51 | 51 | popConfirm: { |
| 52 | 52 | title: '是否确认删除', |
| ... | ... | @@ -192,7 +192,7 @@ |
| 192 | 192 | showIndexColumn: false, |
| 193 | 193 | searchInfo: { |
| 194 | 194 | tenantId, |
| 195 | - roleType: RoleEnum.TENANT_ADMIN, | |
| 195 | + // roleType: RoleEnum.TENANT_ADMIN, | |
| 196 | 196 | }, |
| 197 | 197 | actionColumn: { |
| 198 | 198 | width: 100, | ... | ... |
| ... | ... | @@ -17,7 +17,6 @@ |
| 17 | 17 | import { saveTenantAdmin } from '/@/api/tenant/tenantApi'; |
| 18 | 18 | import { UserDTO } from '/@/api/tenant/tenantInfo'; |
| 19 | 19 | import { ChineseRegexp, EmailRegexp, emailRule, phoneRule } from '/@/utils/rules'; |
| 20 | - // import { isAccountExist } from '/@/api/system/system'; | |
| 21 | 20 | import { chineseAndEnlishRule } from '/@/utils/rules'; |
| 22 | 21 | |
| 23 | 22 | export default defineComponent({ |
| ... | ... | @@ -57,13 +56,11 @@ |
| 57 | 56 | return f.username == values.username; |
| 58 | 57 | } |
| 59 | 58 | }); |
| 60 | - console.log(findUserName); | |
| 61 | 59 | return [ |
| 62 | 60 | { |
| 63 | 61 | required: true, |
| 64 | 62 | validator(_, value) { |
| 65 | 63 | return new Promise((resolve, reject) => { |
| 66 | - console.log(value); | |
| 67 | 64 | if (value == '' || value === undefined) { |
| 68 | 65 | reject('请输入账号'); |
| 69 | 66 | } else if (ChineseRegexp.test(value)) { |
| ... | ... | @@ -133,7 +130,6 @@ |
| 133 | 130 | await resetFields(); |
| 134 | 131 | isUpdate.value = !!data?.isUpdate; |
| 135 | 132 | tenantId.value = data?.tenantId; |
| 136 | - console.log(data.judgeExistUserName); | |
| 137 | 133 | isJudgeUserNameExist.value = data.judgeExistUserName; |
| 138 | 134 | if (unref(isUpdate)) { |
| 139 | 135 | await updateSchema({ field: 'username', componentProps: { disabled: true } }); | ... | ... |
| ... | ... | @@ -120,8 +120,8 @@ |
| 120 | 120 | |
| 121 | 121 | //提交按钮 |
| 122 | 122 | async function handleSubmit() { |
| 123 | - setDrawerProps({ confirmLoading: true }); | |
| 124 | 123 | try { |
| 124 | + setDrawerProps({ confirmLoading: true }); | |
| 125 | 125 | const values = await validate(); |
| 126 | 126 | const req = { |
| 127 | 127 | id: values.id, |
| ... | ... | @@ -153,16 +153,9 @@ |
| 153 | 153 | const { createMessage } = useMessage(); |
| 154 | 154 | createMessage.error(`${e.message}`); |
| 155 | 155 | }) |
| 156 | - .finally(() => { | |
| 157 | - setTimeout(() => { | |
| 158 | - setDrawerProps({ confirmLoading: false }); | |
| 159 | - }, 300); | |
| 160 | - }); | |
| 156 | + .finally(() => {}); | |
| 161 | 157 | } catch (e) { |
| 162 | 158 | } finally { |
| 163 | - setTimeout(() => { | |
| 164 | - setDrawerProps({ confirmLoading: false }); | |
| 165 | - }, 300); | |
| 166 | 159 | } |
| 167 | 160 | } |
| 168 | 161 | return { | ... | ... |