Przeglądaj źródła

😎1、文件上传增加wps格式 2、隐藏默认租户信息 3、代码清理

zuohuaijun 1 rok temu
rodzic
commit
c25652cc44

+ 1 - 1
Admin.NET/Admin.NET.Application/Configuration/Upload.json

@@ -4,7 +4,7 @@
   "Upload": {
     "Path": "Upload/{yyyy}/{MM}/{dd}", // 文件上传目录
     "MaxSize": 20480, // 文件最大限制KB:1024*20
-    "ContentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "video/mp4" ],
+    "ContentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "video/mp4", "application/wps-office.docx", "application/wps-office.xlsx" ],
     "EnableMd5": false // 启用文件MDF5验证-防止重复上传
   },
   "OSSProvider": {

+ 8 - 2
Admin.NET/Admin.NET.Core/Service/Tenant/SysTenantService.cs

@@ -65,6 +65,7 @@ public class SysTenantService : IDynamicApiController, ITransient
             .LeftJoin<SysOrg>((u, a, b) => u.OrgId == b.Id)
             .WhereIF(!string.IsNullOrWhiteSpace(input.Phone), (u, a) => a.Phone.Contains(input.Phone.Trim()))
             .WhereIF(!string.IsNullOrWhiteSpace(input.Name), (u, a, b) => b.Name.Contains(input.Name.Trim()))
+            .Where(u => u.Id.ToString() != SqlSugarConst.MainConfigId) // 排除默认主库/主租户
             .OrderBy(u => u.OrderNo)
             .Select((u, a, b) => new TenantOutput
             {
@@ -122,16 +123,18 @@ public class SysTenantService : IDynamicApiController, ITransient
 
         switch (input.TenantType)
         {
+            // Id隔离时设置与主库一致
             case TenantTypeEnum.Id:
-                // ID隔离时设置与主库一致
                 var config = _sysTenantRep.AsSugarClient().CurrentConnectionConfig;
                 input.DbType = config.DbType;
                 input.Connection = config.ConnectionString;
                 break;
+
             case TenantTypeEnum.Db:
                 if (string.IsNullOrWhiteSpace(input.Connection))
                     throw Oops.Oh(ErrorCodeEnum.Z1004);
                 break;
+
             default:
                 throw Oops.Oh(ErrorCodeEnum.D3004);
         }
@@ -297,18 +300,21 @@ public class SysTenantService : IDynamicApiController, ITransient
         isExist = await _sysUserRep.IsAnyAsync(u => u.Account == input.AdminAccount && u.Id != input.UserId);
         if (isExist)
             throw Oops.Oh(ErrorCodeEnum.D1301);
+
+        // Id隔离时设置与主库一致
         switch (input.TenantType)
         {
             case TenantTypeEnum.Id:
-                // ID隔离时设置与主库一致
                 var config = _sysTenantRep.AsSugarClient().CurrentConnectionConfig;
                 input.DbType = config.DbType;
                 input.Connection = config.ConnectionString;
                 break;
+
             case TenantTypeEnum.Db:
                 if (string.IsNullOrWhiteSpace(input.Connection))
                     throw Oops.Oh(ErrorCodeEnum.Z1004);
                 break;
+
             default:
                 throw Oops.Oh(ErrorCodeEnum.D3004);
         }

+ 55 - 70
Web/src/views/home/widgets/components/myapp.vue

@@ -3,7 +3,7 @@
 		<ul class="myMods">
 			<li v-for="mod in myMods" :key="mod.path!">
 				<router-link :to="{ path: mod.path! }">
-					<SvgIcon :name="mod.meta?.icon" style="font-size: 18px;" />
+					<SvgIcon :name="mod.meta?.icon" style="font-size: 18px" />
 					<p>{{ mod.meta?.title }}</p>
 				</router-link>
 			</li>
@@ -17,18 +17,10 @@
 		<el-drawer title="添加应用" v-model="modsDrawer" :size="520" destroy-on-close :before-close="beforeClose">
 			<div class="setMods mt15">
 				<h4>我的常用 ( {{ myMods.length }} )</h4>
-				<draggable tag="ul"
-					v-model="myMods"
-					animation="200"
-					item-key="id"
-					group="app"
-					class="draggable-box"
-					force-fallback
-					fallback-on-body
-				>
+				<draggable tag="ul" v-model="myMods" animation="200" item-key="id" group="app" class="draggable-box" force-fallback fallback-on-body>
 					<template #item="{ element }">
 						<li>
-							<SvgIcon :name="element.meta.icon" style="font-size: 18px;" />
+							<SvgIcon :name="element.meta.icon" style="font-size: 18px" />
 							<p>{{ element.meta.title }}</p>
 						</li>
 					</template>
@@ -36,27 +28,20 @@
 			</div>
 			<div class="setMods">
 				<h4>全部应用 ( {{ filterMods.length }} )</h4>
-				<draggable
-					tag="ul"
-					v-model="filterMods"
-					animation="200"
-					item-key="id"
-					group="app"
-					class="draggable-box"
-					force-fallback
-					fallback-on-body
-				>
+				<draggable tag="ul" v-model="filterMods" animation="200" item-key="id" group="app" class="draggable-box" force-fallback fallback-on-body>
 					<template #item="{ element }">
 						<li :style="{ background: element.meta.color || '#909399' }">
-							<SvgIcon :name="element.meta.icon" style="font-size: 18px;" />
+							<SvgIcon :name="element.meta.icon" style="font-size: 18px" />
 							<p>{{ element.meta.title }}</p>
 						</li>
 					</template>
 				</draggable>
 			</div>
 			<template #footer>
-				<el-button @click="beforeClose">取消</el-button>
-				<el-button type="primary" @click="saveMods">保存</el-button>
+				<div style="margin: 0 20px 20px 0">
+					<el-button @click="beforeClose">取消</el-button>
+					<el-button type="primary" @click="saveMods">保存</el-button>
+				</div>
 			</template>
 		</el-drawer>
 	</el-card>
@@ -64,83 +49,83 @@
 
 <script lang="ts">
 export default {
-	title: "快捷入口",
-	icon: "ele-Monitor",
-	description: "可以配置的快捷入口"
-}
+	title: '快捷入口',
+	icon: 'ele-Monitor',
+	description: '可以配置的快捷入口',
+};
 </script>
 
 <script setup lang="ts" name="myapp">
-import draggable from 'vuedraggable'
-import { onMounted, ref } from 'vue'
-import { Local } from '/@/utils/storage'
-import { useRequestOldRoutes } from '/@/stores/requestOldRoutes'
-import { MenuOutput } from '/@/api-services/models'
-import { ElMessage } from 'element-plus'
+import draggable from 'vuedraggable';
+import { onMounted, ref } from 'vue';
+import { Local } from '/@/utils/storage';
+import { useRequestOldRoutes } from '/@/stores/requestOldRoutes';
+import { MenuOutput } from '/@/api-services/models';
+import { ElMessage } from 'element-plus';
 
-const mods = ref<MenuOutput[]>([]) // 所有应用
-const myMods = ref<MenuOutput[]>([]) // 我的常用
-const myModsName = ref<Array<string | null | undefined>>([]) // 我的常用
-const filterMods = ref<MenuOutput[]>([]) // 过滤我的常用后的应用
-const modsDrawer = ref<boolean>(false)
+const mods = ref<MenuOutput[]>([]); // 所有应用
+const myMods = ref<MenuOutput[]>([]); // 我的常用
+const myModsName = ref<Array<string | null | undefined>>([]); // 我的常用
+const filterMods = ref<MenuOutput[]>([]); // 过滤我的常用后的应用
+const modsDrawer = ref<boolean>(false);
 
 onMounted(() => {
-	getMods()
-})
+	getMods();
+});
 
 const addMods = () => {
-	modsDrawer.value = true
-}
+	modsDrawer.value = true;
+};
 
 const getMods = () => {
-	myModsName.value = Local.get('my-mods') || []
-	var menuTree = useRequestOldRoutes().requestOldRoutes as MenuOutput[] || []
-	filterMenu(menuTree)
+	myModsName.value = Local.get('my-mods') || [];
+	var menuTree = (useRequestOldRoutes().requestOldRoutes as MenuOutput[]) || [];
+	filterMenu(menuTree);
 	myMods.value = mods.value.filter((item: MenuOutput) => {
 		return myModsName.value.includes(item.name);
-	})
-	
+	});
+
 	filterMods.value = mods.value.filter((item: MenuOutput) => {
-		return !myModsName.value.includes(item.name)
-	})
-}
+		return !myModsName.value.includes(item.name);
+	});
+};
 
 // 递归拿到所有可显示非iframe的2级菜单
 const filterMenu = (map: MenuOutput[]) => {
 	map.forEach((item: MenuOutput) => {
 		if (item.meta?.isHide || item.type == 3 || item.status != 1) {
-			return false
+			return false;
 		}
 		if (item.meta?.isIframe) {
-			item.path = `/i/${item.name}`
+			item.path = `/i/${item.name}`;
 		}
 		if (item.children && item.children.length > 0) {
-			filterMenu(item.children)
+			filterMenu(item.children);
 		} else {
-			mods.value.push(item)
+			mods.value.push(item);
 		}
-	})
-}
+	});
+};
 
 // 保存我的常用
 const saveMods = () => {
-	const myModsName = myMods.value.map((v: MenuOutput) => v.name)
-	Local.set('my-mods', myModsName)
-	ElMessage.success('设置常用成功')
-	modsDrawer.value = false
-}
+	const myModsName = myMods.value.map((v: MenuOutput) => v.name);
+	Local.set('my-mods', myModsName);
+	ElMessage.success('设置常用成功');
+	modsDrawer.value = false;
+};
 
 // 取消
 const beforeClose = () => {
-	myModsName.value = Local.get('my-mods') || []
+	myModsName.value = Local.get('my-mods') || [];
 	myMods.value = mods.value.filter((item: MenuOutput) => {
-		return myModsName.value.includes(item.name)
-	})
+		return myModsName.value.includes(item.name);
+	});
 	filterMods.value = mods.value.filter((item: MenuOutput) => {
-		return !myModsName.value.includes(item.name)
-	})
-	modsDrawer.value = false
-}
+		return !myModsName.value.includes(item.name);
+	});
+	modsDrawer.value = false;
+};
 </script>
 
 <style scoped lang="scss">
@@ -202,7 +187,7 @@ const beforeClose = () => {
 
 .draggable-box {
 	border: 1px dashed var(--el-color-primary);
-	padding: 15px
+	padding: 15px;
 }
 
 .setMods {

+ 1 - 1
Web/src/views/home/widgets/components/progressing.vue

@@ -5,7 +5,7 @@
 			<span style=""> 项目进度 </span>
 		</template>
 		<div class="progress">
-			<el-progress type="dashboard" :percentage="85.5" :width="160" color="var(--el-color-primary)">
+			<el-progress type="dashboard" :percentage="99.9" :width="160" color="var(--el-color-primary)">
 				<template #default="{ percentage }">
 					<div class="percentage-value">{{ percentage }}%</div>
 					<div class="percentage-label">当前进度</div>

+ 1 - 1
Web/src/views/home/widgets/components/welcome.vue

@@ -26,7 +26,7 @@
 					<div class="tips-item-icon">
 						<el-icon><ele-MilkTea /></el-icon>
 					</div>
-					<div class="tips-item-message">项目目的:让前端工作更快乐</div>
+					<div class="tips-item-message">让开发更简单、更通用、更流行!</div>
 				</div>
 			</div>
 			<div class="actions">

+ 1 - 1
Web/src/views/home/widgets/index.vue

@@ -266,7 +266,7 @@ const close = () => {
 .widgets-top-title {
 	// font-size: 18px;
 	// font-weight: bold;
-	color: #999
+	color: #999;
 }
 
 .widgets {