Эх сурвалжийг харах

😎1、代码格式化 2、升级依赖

zuohuaijun 1 жил өмнө
parent
commit
34d617e992

+ 4 - 0
Admin.NET/Admin.NET.Core/Service/File/Dto/FileInput.cs

@@ -112,14 +112,17 @@ public class FileUploadInput
     /// 文件路径
     /// </summary>
     public string Path { get; set; }
+
     /// <summary>
     /// 所属实体ID
     /// </summary>
     public long BelongId { get; set; }
+
     /// <summary>
     /// 关联对象Id
     /// </summary>
     public long RelationId { get; set; }
+
     /// <summary>
     /// 关联对象名称
     /// </summary>
@@ -140,6 +143,7 @@ public class RelationQueryInput
     /// 关联对象Id
     /// </summary>
     public long? RelationId { get; set; }
+
     /// <summary>
     /// 文件,多个以","分割
     /// </summary>

+ 3 - 7
Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs

@@ -12,7 +12,6 @@ namespace Admin.NET.Core.Service;
 /// <summary>
 /// 系统文件服务 🧩
 /// </summary>
-/// <remarks>2024-10-18新增支持belondId, relationId, relationName</remarks>
 [ApiDescriptionSettings(Order = 410)]
 public class SysFileService : IDynamicApiController, ITransient
 {
@@ -65,9 +64,7 @@ public class SysFileService : IDynamicApiController, ITransient
     [DisplayName("上传文件")]
     public async Task<SysFile> UploadFile([FromForm] FileUploadInput input)
     {
-        var ans = await HandleUploadFile(input.File, input.Path, fileType: input.FileType, isPublic: input.IsPublic,belongId:input.BelongId,
-            relationId:input.RelationId, relationName:input.RelationName);
-        return ans;
+        return await HandleUploadFile(input.File, input.Path, fileType: input.FileType, isPublic: input.IsPublic, belongId: input.BelongId, relationId: input.RelationId, relationName: input.RelationName);
     }
 
     /// <summary>
@@ -299,8 +296,7 @@ public class SysFileService : IDynamicApiController, ITransient
     /// <param name="relationName"></param>
     /// <param name="relationId"></param>
     /// <returns></returns>
-    /// <remarks>新增支持belongId, relation</remarks>
-    private async Task<SysFile> HandleUploadFile(IFormFile file, string savePath, string allowSuffix = "", string fileType = "", bool isPublic = false,long belongId=0,string relationName = "", long relationId=0)
+    private async Task<SysFile> HandleUploadFile(IFormFile file, string savePath, string allowSuffix = "", string fileType = "", bool isPublic = false, long belongId = 0, string relationName = "", long relationId = 0)
     {
         if (file == null) throw Oops.Oh(ErrorCodeEnum.D8000);
 
@@ -367,7 +363,7 @@ public class SysFileService : IDynamicApiController, ITransient
             FileType = fileType,
             IsPublic = isPublic,
             BelongId = belongId,
-            RelationId= relationId,
+            RelationId = relationId,
             RelationName = relationName,
         };
 

+ 8 - 8
Web/package.json

@@ -2,7 +2,7 @@
 	"name": "admin.net",
 	"type": "module",
 	"version": "2.4.33",
-	"lastBuildTime": "2024.10.17",
+	"lastBuildTime": "2024.10.19",
 	"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
 	"author": "zuohuaijun",
 	"license": "MIT",
@@ -20,7 +20,7 @@
 		"@microsoft/signalr": "^8.0.7",
 		"@vue-office/docx": "^1.6.2",
 		"@vue-office/excel": "^1.7.11",
-		"@vue-office/pdf": "^2.0.6",
+		"@vue-office/pdf": "^2.0.7",
 		"@vueuse/core": "^11.1.0",
 		"@wangeditor/editor": "^5.1.23",
 		"@wangeditor/editor-for-vue": "^5.1.12",
@@ -32,8 +32,8 @@
 		"echarts": "^5.5.1",
 		"echarts-gl": "^2.0.9",
 		"echarts-wordcloud": "^2.1.0",
-		"element-plus": "^2.8.5",
-		"ezuikit-js": "^8.0.12",
+		"element-plus": "^2.8.6",
+		"ezuikit-js": "^8.0.13-alpha.2",
 		"js-cookie": "^3.0.5",
 		"js-table2excel": "^1.1.2",
 		"jsplumb": "^2.15.6",
@@ -58,7 +58,7 @@
 		"vue": "^3.5.12",
 		"vue-clipboard3": "^2.0.0",
 		"vue-demi": "^0.14.6",
-		"vue-draggable-plus": "^0.5.3",
+		"vue-draggable-plus": "^0.5.4",
 		"vue-grid-layout": "3.0.0-beta1",
 		"vue-i18n": "^10.0.4",
 		"vue-json-pretty": "^2.4.0",
@@ -74,8 +74,8 @@
 		"@types/node": "^20.16.10",
 		"@types/nprogress": "^0.2.3",
 		"@types/sortablejs": "^1.15.8",
-		"@typescript-eslint/eslint-plugin": "^8.9.0",
-		"@typescript-eslint/parser": "^8.9.0",
+		"@typescript-eslint/eslint-plugin": "^8.10.0",
+		"@typescript-eslint/parser": "^8.10.0",
 		"@vitejs/plugin-vue": "^5.1.4",
 		"@vitejs/plugin-vue-jsx": "^4.0.1",
 		"@vue/compiler-sfc": "^3.5.12",
@@ -86,7 +86,7 @@
 		"less": "^4.2.0",
 		"prettier": "^3.3.3",
 		"rollup-plugin-visualizer": "^5.12.0",
-		"sass": "^1.80.1",
+		"sass": "^1.80.2",
 		"terser": "^5.36.0",
 		"typescript": "^5.6.3",
 		"vite": "^5.4.9",

+ 11 - 12
Web/src/components/editableTable/editableColumn.ts

@@ -1,14 +1,13 @@
-
 export interface EditableColumn {
-  id: number,
-  label: string;
-  prop: string;
-  type?: 'input' | 'select';
-  options?: EditableColumnOption[];
-  editable?: boolean;
-  width?:number;
+	id: number;
+	label: string;
+	prop: string;
+	type?: 'input' | 'select';
+	options?: EditableColumnOption[];
+	editable?: boolean;
+	width?: number;
+}
+export interface EditableColumnOption {
+	label: string;
+	value: any;
 }
-export interface EditableColumnOption{
-  label:string;
-  value:any
-}

+ 61 - 56
Web/src/components/editableTable/editableTable.vue

@@ -1,77 +1,82 @@
-<template>
-  <!--可编辑表格 
-  1.实现表格内编辑并同步数据到父组件(emit);2. 支持自由录入和下拉选择 3.内置删除、移动功能 4. 支持任意业务模型
+<!--可编辑表格 
+  1.实现表格内编辑并同步数据到父组件(emit);
+  2. 支持自由录入和下拉选择 
+  3.内置删除、移动功能 
+  4. 支持任意业务模型
   使用注意:1. 业务模型需要id列,以支持删除 2.下拉选项用数组[label :string,value :any]输入 3. 父组件需要update:modelValue,并将父组件的数据更新
-   2024年10月7日 ccj
   -->
-  <el-table :data="localData"  border="true" stripe="true">
-    <el-table-column v-for="col in columns" :key="col.id" :label="col.label" :prop="col.prop" :width="col.width">
-      <template #default="{ row }">
-        <template v-if="isEditable(col)">
-          <el-input v-model="row[col.prop]" v-if="col.type === 'input'" />
-          <el-select v-model="row[col.prop]" v-if="col.type === 'select'">
-            <el-option v-for="item in col.options" :key="item.value" :label="item.label" :value="item.value" />
-          </el-select>
-        </template>
-        <template v-else>
-          {{ row[col.prop] }}
-        </template>
-      </template>
-    </el-table-column>
-    <el-table-column label="操作"  width="75">
-      <template #default="{ row }">
-        <el-button-group>
-          <el-button text type="danger" :icon="Delete" @click="removeUser(row.id)"></el-button>
-          <el-button text :icon="ArrowUp" @click="() => moveUser(row.id, 'up')" :disabled="isFirstRow(row)"></el-button>
-          <el-button text :icon="ArrowDown" @click="() => moveUser(row.id, 'down')" :disabled="isLastRow(row)"></el-button>
-        </el-button-group>
-      </template>
-    </el-table-column>
-  </el-table>
+<template>
+	<el-table :data="localData" border="true" stripe="true">
+		<el-table-column v-for="col in columns" :key="col.id" :label="col.label" :prop="col.prop" :width="col.width">
+			<template #default="{ row }">
+				<template v-if="isEditable(col)">
+					<el-input v-model="row[col.prop]" v-if="col.type === 'input'" />
+					<el-select v-model="row[col.prop]" v-if="col.type === 'select'">
+						<el-option v-for="item in col.options" :key="item.value" :label="item.label" :value="item.value" />
+					</el-select>
+				</template>
+				<template v-else>
+					{{ row[col.prop] }}
+				</template>
+			</template>
+		</el-table-column>
+		<el-table-column label="操作" width="75">
+			<template #default="{ row }">
+				<el-button-group>
+					<el-button text type="danger" :icon="Delete" @click="removeUser(row.id)"></el-button>
+					<el-button text :icon="ArrowUp" @click="() => moveUser(row.id, 'up')" :disabled="isFirstRow(row)"></el-button>
+					<el-button text :icon="ArrowDown" @click="() => moveUser(row.id, 'down')" :disabled="isLastRow(row)"></el-button>
+				</el-button-group>
+			</template>
+		</el-table-column>
+	</el-table>
 </template>
 
 <script setup lang="ts">
 import { ref, watch } from 'vue';
 import { EditableColumn } from './editableColumn';
-import { style } from '@logicflow/extension/es/bpmn-elements/presets/icons';
 import { ArrowUp, ArrowDown, Delete } from '@element-plus/icons-vue';
+
 const props = defineProps({
-  columns: {
-    type: Array as () => EditableColumn[],
-    required: true,
-  },
-  modelValue: {
-    type: Array as () => Array<Record<string, any>>,
-    required: true,
-  },
-})
+	columns: {
+		type: Array as () => EditableColumn[],
+		required: true,
+	},
+	modelValue: {
+		type: Array as () => Array<Record<string, any>>,
+		required: true,
+	},
+});
 
-const emit = defineEmits(["update:modelValue"])
-const localData = ref(props.modelValue)
+const emit = defineEmits(['update:modelValue']);
+const localData = ref(props.modelValue);
 
 const removeUser = (id: number) => {
-  localData.value = localData.value.filter(user => user.id !== id);
-  console.log('after remove:', localData.value)
-  emit('update:modelValue', localData.value)
+	localData.value = localData.value.filter((user) => user.id !== id);
+	// console.log('after remove:', localData.value);
+	emit('update:modelValue', localData.value);
 };
 
 const moveUser = (id: number, direction: 'up' | 'down') => {
-  const index = localData.value.findIndex(user => user.id === id);
-  if (direction === 'up' && index > 0) {
-    [localData.value[index], localData.value[index - 1]] = [localData.value[index - 1], localData.value[index]];
-  } else if (direction === 'down' && index < localData.value.length - 1) {
-    [localData.value[index], localData.value[index + 1]] = [localData.value[index + 1], localData.value[index]];
-  }
+	const index = localData.value.findIndex((user) => user.id === id);
+	if (direction === 'up' && index > 0) {
+		[localData.value[index], localData.value[index - 1]] = [localData.value[index - 1], localData.value[index]];
+	} else if (direction === 'down' && index < localData.value.length - 1) {
+		[localData.value[index], localData.value[index + 1]] = [localData.value[index + 1], localData.value[index]];
+	}
 };
-watch(localData, (val, oldVal) => {
-  console.log('new: ', val);
-  console.log('old:', oldVal);
-  console.log('props.data: ', props.modelValue)
-}, { deep: true })
+watch(
+	localData,
+	(val, oldVal) => {
+		// console.log('new: ', val);
+		// console.log('old:', oldVal);
+		// console.log('props.data: ', props.modelValue);
+	},
+	{ deep: true }
+);
 const isEditable = (col: EditableColumn) => col.editable !== false;
 const isFirstRow = (row: Record<string, any>) => localData.value[0].id === row.id;
 const isLastRow = (row: Record<string, any>) => localData.value[localData.value.length - 1].id === row.id;
-
 </script>
 
-<style scoped></style>
+<style scoped></style>

+ 21 - 21
Web/src/views/system/file/component/editSysfile.vue

@@ -33,28 +33,28 @@
 						</el-form-item>
 					</el-col>
 				</el-row>
+				<el-row>
+					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
+						<el-form-item label="关联对象名称" prop="relationName">
+							<el-input v-model="state.ruleForm.relationName" placeholder="关联对象名称" clearable />
+						</el-form-item>
+					</el-col>
+				</el-row>
+				<el-row>
+					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
+						<el-form-item label="关联对象Id" prop="relationId">
+							<el-input v-model="state.ruleForm.relationId" placeholder="关联对象ID" clearable />
+						</el-form-item>
+					</el-col>
+				</el-row>
+				<el-row>
+					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
+						<el-form-item label="所属ID" prop="fileName">
+							<el-input v-model="state.ruleForm.belongId" placeholder="所属ID" clearable />
+						</el-form-item>
+					</el-col>
+				</el-row>
 			</el-form>
-			<el-row>
-				<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-					<el-form-item label="关联对象名称" prop="relationName" >
-						<el-input v-model="state.ruleForm.relationName" placeholder="关联对象名称" clearable />
-					</el-form-item>
-				</el-col>
-			</el-row>
-			<el-row>
-				<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-					<el-form-item label="关联对象Id" prop="relationId" >
-						<el-input v-model="state.ruleForm.relationId" placeholder="关联对象ID" clearable />
-					</el-form-item>
-				</el-col>
-			</el-row>
-			<el-row>
-				<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
-					<el-form-item label="所属ID" prop="fileName" >
-						<el-input v-model="state.ruleForm.belongId" placeholder="所属ID" clearable />
-					</el-form-item>
-				</el-col>
-			</el-row>
 			<template #footer>
 				<span class="dialog-footer">
 					<el-button @click="cancel">取 消</el-button>

+ 5 - 5
Web/src/views/system/file/index.vue

@@ -70,10 +70,10 @@
 				<el-table-column label="操作" width="260" fixed="right" align="center" show-overflow-tooltip>
 					<template #default="scope">
 						<el-button-group>
-							<el-button icon="ele-View" size="small"  type="primary" @click="openFilePreviewDialog(scope.row)" v-auth="'sysFile:delete'"></el-button>
-							<el-button icon="ele-Download" size="small"  type="primary" @click="downloadFile(scope.row)" v-auth="'sysFile:downloadFile'"></el-button>
-							<el-button icon="ele-Delete" size="small"  type="danger" @click="delFile(scope.row)" v-auth="'sysFile:delete'"></el-button>
-							<el-button icon="ele-Edit" size="small"  type="primary" @click="openEditSysFile(scope.row)" v-auth="'sysFile:update'"></el-button>
+							<el-button icon="ele-View" size="small" type="primary" @click="openFilePreviewDialog(scope.row)" v-auth="'sysFile:delete'"></el-button>
+							<el-button icon="ele-Download" size="small" type="primary" @click="downloadFile(scope.row)" v-auth="'sysFile:downloadFile'"></el-button>
+							<el-button icon="ele-Delete" size="small" type="danger" @click="delFile(scope.row)" v-auth="'sysFile:delete'"></el-button>
+							<el-button icon="ele-Edit" size="small" type="primary" @click="openEditSysFile(scope.row)" v-auth="'sysFile:update'"></el-button>
 						</el-button-group>
 					</template>
 				</el-table-column>
@@ -201,7 +201,7 @@ const handleQuery = async () => {
 	state.loading = true;
 	let params = Object.assign(state.queryParams, state.tableParams);
 	var res = await getAPI(SysFileApi).apiSysFilePagePost(params);
-	console.log(res)
+	console.log(res);
 	state.fileData = res.data.result?.items ?? [];
 	state.tableParams.total = res.data.result?.total;
 	state.loading = false;