sunhongyao341504 пре 2 година
родитељ
комит
d31d780515

+ 1 - 1
.env.development

@@ -14,7 +14,7 @@ VITE_DROP_CONSOLE = true
 #VITE_PROXY = [["/appApi","http://localhost:8001"],["/upload","http://localhost:8001/upload"]]
 # VITE_PROXY=[["/temp","http://172.16.23.144:8800"],["/upload","http://172.16.23.144:8086"]]
 # VITE_PROXY=[["/skyeye-admin-api","http://172.16.23.144:8800/api"]]
-VITE_PROXY=[["/skyeye-admin-api","http://192.168.1.102:8800/api"],["/push_stream_host","http://192.168.1.100:8080"]]
+VITE_PROXY=[["/skyeye-admin-api","http://192.168.1.102:8800/api"],["/push_stream_host","http://192.168.1.144:8080"]]
 
 # API 接口地址
 VITE_GLOB_API_URL = 

+ 8 - 0
src/api/system/role.ts

@@ -132,3 +132,11 @@ export function permissionList() {
     method: 'GET',
   });
 }
+
+/** @description: 获取功能权限 */
+export function getFeaturePermissions() {
+  return http.request({
+    url: '/role/listFunctionPermission',
+    method: 'get',
+  });
+}

+ 35 - 29
src/views/system/role/CreateUserDrawer.vue

@@ -85,12 +85,15 @@
   import { ElMessage } from 'element-plus';
   import type { userFormParamsType } from './types';
 
-  import { addRole, roleUserInfo, updateRole } from '@/api/system/role';
+  import { addRole, getFeaturePermissions, roleUserInfo, updateRole } from '@/api/system/role';
   import useScene from '@/views/system-config/scene-manage/use-scene';
 
   const sceneInfos = useScene();
   const { tableData, getSceneDetail } = sceneInfos;
 
+  // 默认功能权限全部勾选,有未勾选的添加至excludeFeaturePermissionMap中:[workdshopCode]: [permission数组]
+  const excludeFeaturePermissionMap = {};
+
   const rules = {
     roleCode: {
       required: true,
@@ -143,23 +146,7 @@
     return newList;
   });
 
-  const modeList = [
-    {
-      key: 10,
-      id: 1,
-      label: 10,
-    },
-    {
-      key: 11,
-      id: 2,
-      label: 11,
-    },
-    {
-      key: 12,
-      id: 3,
-      label: 12,
-    },
-  ];
+  const modeList = ref<{ key: number; label: string }[]>([]);
 
   const emit = defineEmits(['change']);
 
@@ -204,7 +191,7 @@
   const treeRef = ref();
   const expandedKeys = ref();
   const selectedNodeKey = ref<string>('');
-  const modeTreeData = computed(() => (selectedNodeKey.value ? modeList : []));
+  const modeTreeData = computed(() => (selectedNodeKey.value ? modeList.value : []));
 
   const formParams = ref<userFormParamsType>(defaultTreeValueRef());
 
@@ -253,18 +240,29 @@
 
     const nodes = checkedInfo.checkedNodes;
     console.log('nodes', nodes);
-    // const selectNodes =
 
     const halfKeys = checkedInfo.halfCheckedKeys;
     formParams.value.permissionList = checkedInfo.halfCheckedKeys;
-    formParams.value.permissionList = nodes
-      .filter((item) => item.isShop)
-      .map((node) => {
-        return {
-          workshopCode: node.code,
-          permissionId: '0',
-        };
-      });
+    // const permissionShopNodes = nodes.filter((item) => item.isShop);
+    // const newPerm = [] as any[];
+    // permissionShopNodes.forEach((node) => {
+    //   modeList.value.forEach((item) => {
+    //     newPerm.push({
+    //       workshopCode: node.code,
+    //       permissionId: item.key,
+    //     });
+    //   });
+    // });
+    // formParams.value.permissionList = newPerm;
+
+    // formParams.value.permissionList = nodes
+    //   .filter((item) => item.isShop)
+    //   .map((node) => {
+    //     return {
+    //       workshopCode: node.code,
+    //       permissionId: '0',
+    //     };
+    //   });
     formParams.value.permissionKeys = halfKeys;
     const allTreeNodes = treeRef.value.store._getAllNodes().map((item) => item.data.code);
     if (nodes.length < allTreeNodes.length) {
@@ -274,7 +272,10 @@
     }
   }
 
-  function checkedModeTree() {}
+  function checkedModeTree(_, tree) {
+    console.log('feat===', tree);
+    excludeFeaturePermissionMap[selectedNodeKey.value] = tree.setCheckedKeys;
+  }
 
   function openDrawer(roleId?) {
     isAll.value = false;
@@ -359,6 +360,11 @@
 
   onMounted(() => {
     getSceneDetail();
+    getFeaturePermissions().then((res) => {
+      if (res[0]?.children) {
+        modeList.value = res[0].children;
+      }
+    });
   });
 
   defineExpose({

+ 8 - 3
src/views/system/tenant/tenant.vue

@@ -22,7 +22,7 @@
     <el-card :bordered="false" class="proCard">
       <BasicTable
         :columns="columns"
-        :request="loadDataTable"
+        :dataSource="tenantItems"
         :row-key="(row) => row.id"
         ref="tableRef"
         :actionColumn="actionColumn"
@@ -69,6 +69,8 @@
   const drawerTitle = ref('添加租户');
   const treeData = ref([]);
 
+  const tenantItems = ref<any[]>([]);
+
   const params = reactive({
     tenantName: '',
     tenantCode: '',
@@ -107,7 +109,8 @@
       ...unref(params),
       ...res,
     };
-    return await tenantList(_params);
+    const list = await tenantList(_params);
+    tenantItems.value = list;
   };
 
   function openCreateDrawer() {
@@ -137,7 +140,9 @@
     });
   }
 
-  onMounted(async () => {});
+  onMounted(async () => {
+    loadDataTable();
+  });
 </script>
 
 <style lang="scss" scoped></style>