|
@@ -54,17 +54,15 @@ const [registerDrawer, { openDrawer }] = useDrawer();
|
|
const [registerIndexModal, { openModal: openIndexModal }] = useModal();
|
|
const [registerIndexModal, { openModal: openIndexModal }] = useModal();
|
|
const [rolePermissionDrawer, { openDrawer: openRolePermissionDrawer }] = useDrawer();
|
|
const [rolePermissionDrawer, { openDrawer: openRolePermissionDrawer }] = useDrawer();
|
|
const [registerDesc, { openDrawer: openRoleDesc }] = useDrawer();
|
|
const [registerDesc, { openDrawer: openRoleDesc }] = useDrawer();
|
|
-const isFirst = ref(true);
|
|
|
|
const apps = ref([]);
|
|
const apps = ref([]);
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
apps.value = await appList();
|
|
apps.value = await appList();
|
|
});
|
|
});
|
|
-watch(() => apps.value,(newVal) => {
|
|
|
|
- if (newVal.length > 0) {
|
|
|
|
- reload();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-);
|
|
|
|
|
|
+watch(apps, () => loadData());
|
|
|
|
+
|
|
|
|
+function loadData() {
|
|
|
|
+ reload();
|
|
|
|
+}
|
|
|
|
|
|
// 列表页面公共参数、方法
|
|
// 列表页面公共参数、方法
|
|
const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
|
|
const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
|
|
@@ -75,7 +73,6 @@ const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
|
|
columns: columns,
|
|
columns: columns,
|
|
striped: true,
|
|
striped: true,
|
|
immediate: false,
|
|
immediate: false,
|
|
-
|
|
|
|
formConfig: {
|
|
formConfig: {
|
|
labelWidth: 65,
|
|
labelWidth: 65,
|
|
rowProps: { gutter: 24 },
|
|
rowProps: { gutter: 24 },
|
|
@@ -90,13 +87,21 @@ const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
|
|
column: 'createTime',
|
|
column: 'createTime',
|
|
order: 'desc',
|
|
order: 'desc',
|
|
},
|
|
},
|
|
- beforeFetch: async (params) => {
|
|
|
|
- if (isFirst.value) {
|
|
|
|
- params.appId = apps.value[0].id;
|
|
|
|
- isFirst.value = false;
|
|
|
|
|
|
+ beforeFetch: (params) => {
|
|
|
|
+ if (params.appId == null && apps.value.length > 0) {
|
|
|
|
+ const ids = apps.value.map((item) => item.id);
|
|
|
|
+ const idsString = ids.join(',');
|
|
|
|
+ params.appId = idsString;
|
|
|
|
+ }
|
|
|
|
+ //模糊查询
|
|
|
|
+ if(params.roleName){
|
|
|
|
+ params.roleName ='*'+ params.roleName.trim()+'*';
|
|
}
|
|
}
|
|
|
|
+ if(params.roleCode){
|
|
|
|
+ params.roleCode ='*'+ params.roleCode.trim()+'*';
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- afterFetch: async (record) => {
|
|
|
|
|
|
+ afterFetch: (record) => {
|
|
const app = apps.value;
|
|
const app = apps.value;
|
|
record.forEach((item) => {
|
|
record.forEach((item) => {
|
|
// 获取当前角色的appName
|
|
// 获取当前角色的appName
|