Commit d03205eb56440a3ae6e8ef6e9ec900af40118375

Authored by 杨泽宇
1 parent 7ddbdeb0

debug

src/components/Pagination/index.vue
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 /** 2 /**
3 * 单个图片上传公共组件 3 * 单个图片上传公共组件
4 * @module Pagination 4 * @module Pagination
5 - * @author Tengxi  
6 */ 5 */
7 6
8 import { scrollTo } from "@/utils/scroll"; 7 import { scrollTo } from "@/utils/scroll";
src/layout/enter.vue
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 /** 2 /**
3 * 公共布局入口组件 3 * 公共布局入口组件
4 * @module Enter 4 * @module Enter
5 - * @author Tengxi  
6 */ 5 */
7 import { onMounted, reactive, computed } from "vue"; 6 import { onMounted, reactive, computed } from "vue";
8 import Header from "./header.vue"; 7 import Header from "./header.vue";
src/layout/header.vue
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 /** 2 /**
3 * 公共布局头部组件 3 * 公共布局头部组件
4 * @module Header 4 * @module Header
5 - * @author Tengxi  
6 */ 5 */
7 import { getCurrentInstance, onMounted, reactive, computed } from "vue"; 6 import { getCurrentInstance, onMounted, reactive, computed } from "vue";
8 import * as store from "@/pinia/index"; 7 import * as store from "@/pinia/index";
src/layout/icon.vue 0 → 100644
  1 +<script setup lang="ts">
  2 +/**
  3 + * 公共布局入口组件
  4 + * @module Enter
  5 + */
  6 +import { onMounted, reactive, computed } from "vue";
  7 +import {
  8 + HomeFilled,
  9 + Shop,
  10 + List,
  11 + Tools,
  12 + PhoneFilled,
  13 + Avatar,
  14 + Menu as IconMenu,
  15 +} from "@element-plus/icons-vue";
  16 +/**
  17 + * @description 组件属性
  18 + * @prop {number} keyId 一级菜单id
  19 + */
  20 +interface Props {
  21 + keyId: number;
  22 +}
  23 +const props = withDefaults(defineProps<Props>(), {
  24 + keyId: 0,
  25 +});
  26 +</script>
  27 +
  28 +<template>
  29 + <el-icon>
  30 + <IconMenu v-if="keyId === -1" />
  31 + <HomeFilled v-else-if="keyId === 1000" />
  32 + <Tools v-else-if="keyId === 2000" />
  33 + <Shop v-else-if="keyId === 3000" />
  34 + <Avatar v-else-if="keyId === 4000" />
  35 + <PhoneFilled v-else-if="keyId === 5000" />
  36 + <List v-else />
  37 + </el-icon>
  38 +</template>
src/layout/menu.vue
@@ -2,18 +2,11 @@ @@ -2,18 +2,11 @@
2 /** 2 /**
3 * 公共布局侧导航 3 * 公共布局侧导航
4 * @module Menu 4 * @module Menu
5 - * @author Tengxi  
6 */ 5 */
7 import { ref, computed, onMounted, reactive } from "vue"; 6 import { ref, computed, onMounted, reactive } from "vue";
8 import * as store from "@/pinia/index"; 7 import * as store from "@/pinia/index";
9 import styles from "@/style/global.module.scss"; 8 import styles from "@/style/global.module.scss";
10 -// TIP 使用element plus ICON  
11 -import {  
12 - Location,  
13 - Document,  
14 - Menu as IconMenu,  
15 - Setting,  
16 -} from "@element-plus/icons-vue"; 9 +import MenuIcon from './icon.vue'
17 // TIP 获取scss样式变量 10 // TIP 获取scss样式变量
18 let styleData = computed(() => { 11 let styleData = computed(() => {
19 return styles; 12 return styles;
@@ -41,14 +34,20 @@ onMounted(() =&gt; { @@ -41,14 +34,20 @@ onMounted(() =&gt; {
41 :router="true" 34 :router="true"
42 :collapse-transition="false" 35 :collapse-transition="false"
43 :collapse="asyncData.isCollapse" 36 :collapse="asyncData.isCollapse"
44 - > 37 + >
  38 + <el-menu-item index="/">
  39 + <template #title>
  40 + <MenuIcon :keyId="-1"></MenuIcon>
  41 + <span>首页</span>
  42 + </template>
  43 + </el-menu-item>
45 <el-sub-menu 44 <el-sub-menu
46 :index="index + ''" 45 :index="index + ''"
47 v-for="(item, index) in asyncData.menuData" 46 v-for="(item, index) in asyncData.menuData"
48 :key="index" 47 :key="index"
49 > 48 >
50 <template #title> 49 <template #title>
51 - <el-icon><location /></el-icon> 50 + <MenuIcon :keyId="~~item.id"></MenuIcon>
52 <span>{{ item.name }}</span> 51 <span>{{ item.name }}</span>
53 </template> 52 </template>
54 <el-menu-item-group v-for="(ele, i) in item.menuList" :key="i"> 53 <el-menu-item-group v-for="(ele, i) in item.menuList" :key="i">
src/views/dashboard/index.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import {ref} from 'vue' 2 import {ref} from 'vue'
  3 +import {propertyList } from '@/api/tengxi'
3 import router from '@/router' 4 import router from '@/router'
4 const title = ref(import.meta.env.VITE_APP_TITLE).value 5 const title = ref(import.meta.env.VITE_APP_TITLE).value
  6 +propertyList().then(res => {
  7 + console.log(res)
  8 +}).catch(error => {
  9 + console.log(error)
  10 +})
5 console.log(router.getRoutes()) 11 console.log(router.getRoutes())
6 </script> 12 </script>
7 13
src/views/user/edit.vue
@@ -28,7 +28,8 @@ let form = reactive({ @@ -28,7 +28,8 @@ let form = reactive({
28 communityList: [], 28 communityList: [],
29 }); 29 });
30 let asyncData = reactive({ 30 let asyncData = reactive({
31 - userInfo: null 31 + userInfo: null,
  32 + userType: null
32 }) 33 })
33 const ruleFormRef = ref<InstanceType<typeof ElForm>>(); 34 const ruleFormRef = ref<InstanceType<typeof ElForm>>();
34 /** 35 /**
@@ -164,7 +165,9 @@ onMounted(() =&gt; { @@ -164,7 +165,9 @@ onMounted(() =&gt; {
164 asyncData.userInfo = store.family.loginStore().id 165 asyncData.userInfo = store.family.loginStore().id
165 asyncData.userType = store.family.loginStore().organizationType 166 asyncData.userType = store.family.loginStore().organizationType
166 getRoleList(); 167 getRoleList();
167 - getCommunityList(); 168 + if(~~asyncData.userType === 1) {
  169 + getCommunityList();
  170 + }
168 form.data = useRoute().query; 171 form.data = useRoute().query;
169 if (JSON.stringify(form.data) === "{}") { 172 if (JSON.stringify(form.data) === "{}") {
170 form.dataType = "add"; 173 form.dataType = "add";
src/views/user/index.vue
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import { reactive, ref, onMounted } from "vue"; 2 import { reactive, ref, onMounted } from "vue";
3 import { userList, userPwd, userStatus } from "@/api/user/user"; 3 import { userList, userPwd, userStatus } from "@/api/user/user";
4 import { parseTime } from "@/utils/tool"; 4 import { parseTime } from "@/utils/tool";
  5 +import * as store from "@/pinia";
5 import Pagination from "@/components/Pagination/index.vue"; 6 import Pagination from "@/components/Pagination/index.vue";
6 import { ElMessageBox, ElMessage } from "element-plus"; 7 import { ElMessageBox, ElMessage } from "element-plus";
7 interface Form { 8 interface Form {
@@ -32,6 +33,9 @@ let data = reactive({ @@ -32,6 +33,9 @@ let data = reactive({
32 }, 33 },
33 }, 34 },
34 }); 35 });
  36 +let asyncData = reactive({
  37 + userInfo: null,
  38 +});
35 /** 39 /**
36 * 列表 40 * 列表
37 */ 41 */
@@ -142,6 +146,7 @@ enum statusEnum { @@ -142,6 +146,7 @@ enum statusEnum {
142 "启用", 146 "启用",
143 } 147 }
144 onMounted(() => { 148 onMounted(() => {
  149 + asyncData.userInfo = store.family.loginStore().id;
145 getList(); 150 getList();
146 }); 151 });
147 </script> 152 </script>
@@ -205,35 +210,44 @@ onMounted(() =&gt; { @@ -205,35 +210,44 @@ onMounted(() =&gt; {
205 </el-table-column> 210 </el-table-column>
206 <el-table-column label="操作" align="center"> 211 <el-table-column label="操作" align="center">
207 <template #default="scope"> 212 <template #default="scope">
208 - <el-button type="text"  
209 - ><router-link :to="{ path: '/user/edit', query: scope.row }"  
210 - >编辑</router-link  
211 - ></el-button  
212 - >  
213 - <el-button type="text" @click="handleUpdate(scope.row, 'status')">{{  
214 - scope.row.status ? "禁用" : "启用"  
215 - }}</el-button>  
216 - <el-button type="text" @click="handleUpdate(scope.row, 'pwd')"  
217 - >初始密码</el-button  
218 - >  
219 - <el-button type="text"  
220 - ><router-link  
221 - :to="{ path: '/user/role', query: { id: scope.row.id } }"  
222 - >角色</router-link  
223 - ></el-button  
224 - >  
225 - <!-- 用户:商务管理员、机构管理员,不允许删除。 -->  
226 - <el-button  
227 - type="text"  
228 - @click="handleDelete(scope.row)"  
229 - v-show="  
230 - ![  
231 - 'SUPER_ADMIN',  
232 - 'BUSINESS_ADMIN',  
233 - ].includes(scope.row.roleList.map(i => i.code).join(',')) 213 + <!-- 超管可以做全部操作 -->
  214 + <template v-if="!['SUPER_ADMIN'].includes(
  215 + scope.row.roleList.map((i) => i.code).join(',')
  216 + )">
  217 + <el-button type="text"
  218 + ><router-link :to="{ path: '/user/edit', query: scope.row }"
  219 + >编辑</router-link
  220 + ></el-button
  221 + >
  222 + <el-button type="text" @click="handleUpdate(scope.row, 'status')">{{
  223 + scope.row.status ? "禁用" : "启用"
  224 + }}</el-button>
  225 + <el-button type="text" @click="handleUpdate(scope.row, 'pwd')"
  226 + >初始密码</el-button
  227 + >
  228 + <el-button type="text"
  229 + ><router-link
  230 + :to="{ path: '/user/role', query: { id: scope.row.id } }"
  231 + >角色</router-link
  232 + ></el-button
  233 + >
  234 + <el-button type="text" @click="handleDelete(scope.row)"
  235 + >删除</el-button
  236 + >
  237 + </template>
  238 + <!-- 物业管理员(机构管理员)、商务管理员只可以改密码 -->
  239 + <!-- 其他角色用户不可以做任何操作 以上均通过角色的code判断 -->
  240 + <template
  241 + v-if="
  242 + !['PROPERTY_ADMIN', 'BUSINESS_ADMIN'].includes(
  243 + scope.row.roleList.map((i) => i.code).join(',')
  244 + )
234 " 245 "
235 - >删除</el-button  
236 > 246 >
  247 + <el-button type="text" @click="handleUpdate(scope.row, 'pwd')"
  248 + >初始密码</el-button
  249 + >
  250 + </template>
237 </template> 251 </template>
238 </el-table-column> 252 </el-table-column>
239 </el-table> 253 </el-table>