Yue 1 өдөр өмнө
parent
commit
7d337ef929

+ 10 - 1
UI/VAP_V3.VUE/src/assets/sass/_table.scss

@@ -36,11 +36,20 @@
 			height: calc(100% - 10px);
 			height: calc(100% - 10px);
 			box-sizing: border-box;
 			box-sizing: border-box;
 			background-color: var(--table-bg);
 			background-color: var(--table-bg);
-			z-index: 1;
+			z-index: 2;
 			overflow: hidden !important;
 			overflow: hidden !important;
+			// 使用 will-change 提示浏览器优化性能
+			will-change: transform;
+			// 启用硬件加速
+			transform: translateZ(0);
 			&.no-shadow {
 			&.no-shadow {
 				box-shadow: none;
 				box-shadow: none;
 			}
 			}
+			// 确保内部内容可以正确应用transform
+			> div {
+				will-change: transform;
+				transform: translateZ(0);
+			}
 		}
 		}
 		.fixed-columns {
 		.fixed-columns {
 			left: 0;
 			left: 0;

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 322 - 458
UI/VAP_V3.VUE/src/components/table/VbDataTable.vue


+ 5 - 4
UI/VAP_V3.VUE/src/components/table/partials/body/TableBody.vue

@@ -7,7 +7,8 @@ import BodyTreeTr from "@@@/table/partials/body/BodyTreeTr.vue"
 const propOpts = inject(symbolKeys.body, {
 const propOpts = inject(symbolKeys.body, {
 	isTree: false,
 	isTree: false,
 	childrenField: "children",
 	childrenField: "children",
-	bodyClass: "fw-semibold text-gray-600"
+	bodyClass: "fw-semibold text-gray-600",
+	keyField: "id"
 })
 })
 const depth = 0
 const depth = 0
 const rows = inject(symbolKeys.displayData, ref([]))
 const rows = inject(symbolKeys.displayData, ref([]))
@@ -18,15 +19,15 @@ const hasChildren = (row: any) => {
 </script>
 </script>
 <template>
 <template>
 	<tbody v-if="rows?.length > 0" ref="tbody" :class="propOpts.bodyClass">
 	<tbody v-if="rows?.length > 0" ref="tbody" :class="propOpts.bodyClass">
-		<template v-for="(row, i) in rows" :key="i">
-			<BodyTr :row="row" :depth="depth" :index="i + 1">
+		<template v-for="(row, i) in rows" :key="row[propOpts.keyField]">
+			<BodyTr :row="row" :depth="depth" :index="(i as number) + 1">
 				<template v-for="(_, name) in $slots" #[name]="{ row }">
 				<template v-for="(_, name) in $slots" #[name]="{ row }">
 					<slot :name="name" :row="row" />
 					<slot :name="name" :row="row" />
 				</template>
 				</template>
 			</BodyTr>
 			</BodyTr>
 			<template v-if="propOpts.isTree && hasChildren(row)">
 			<template v-if="propOpts.isTree && hasChildren(row)">
 				<BodyTreeTr
 				<BodyTreeTr
-					:index="i + 1"
+					:index="(i as number) + 1"
 					:rows="row[propOpts.childrenField]"
 					:rows="row[propOpts.childrenField]"
 					:childrenField="propOpts.childrenField"
 					:childrenField="propOpts.childrenField"
 					:depth="depth + 1">
 					:depth="depth + 1">

+ 36 - 52
UI/VAP_V3.VUE/src/components/table/partials/toolbar/TableSearchFrom.vue

@@ -5,8 +5,8 @@ const propOpts = inject(symbolKeys.searchFrom, {
 	searchFormRowItems: ref([]),
 	searchFormRowItems: ref([]),
 	searchFormItems: ref([]),
 	searchFormItems: ref([]),
 	queryParams: ref({}),
 	queryParams: ref({}),
-	searchFormSpan: 4,
-	tableSearchBtnSpan: 1.5
+	showSearchBtn: true,
+	showSearchBtnText: true
 })
 })
 const searchFormRef = ref<any>()
 const searchFormRef = ref<any>()
 const { searchFormRowItems, searchFormItems, queryParams } = propOpts
 const { searchFormRowItems, searchFormItems, queryParams } = propOpts
@@ -15,7 +15,7 @@ const formSlotSuffix = inject(symbolKeys.formSlotSuffix, "tool-form_")
 
 
 const _searchFormItems = computed(() => {
 const _searchFormItems = computed(() => {
 	if (propOpts.searchFormItems || propOpts.searchFormRowItems) {
 	if (propOpts.searchFormItems || propOpts.searchFormRowItems) {
-		const items = searchFormItems.value ?? []
+		const items = searchFormItems.value || []
 		if (
 		if (
 			!items.find((v) => {
 			!items.find((v) => {
 				return v.field == "searchbtn"
 				return v.field == "searchbtn"
@@ -26,9 +26,9 @@ const _searchFormItems = computed(() => {
 				component: "slot",
 				component: "slot",
 				span: 1.5
 				span: 1.5
 			})
 			})
-		return items
+		return items as any
 	}
 	}
-	return propOpts.searchFormItems
+	return propOpts.searchFormItems as any
 })
 })
 
 
 // form表单的插槽 需要tool-form_开头,并去除tool-form_传递给VbForm组件
 // form表单的插槽 需要tool-form_开头,并去除tool-form_传递给VbForm组件
@@ -51,56 +51,40 @@ function resetForm() {
 </script>
 </script>
 
 
 <template>
 <template>
-	<VbForm
-		v-if="searchFormRowItems || searchFormItems"
-		ref="searchFormRef"
-		v-model:data="queryParams"
-		:row-items="searchFormRowItems"
-		:items="_searchFormItems"
-		:span="propOpts.searchFormSpan">
-		<template v-for="(_, name) in $slots" #[`${formatterFormSlot(name)}`]>
-			<slot v-if="name.toString().search(formSlotSuffix) == 0" :name="name" />
-		</template>
-		<template #searchbtn>
+	<div class="w-100 d-flex">
+		<div class="w-100 me-2">
+			<VbForm
+				v-if="searchFormRowItems || searchFormItems"
+				ref="searchFormRef"
+				v-model:data="queryParams"
+				:row-items="searchFormRowItems"
+				:items="_searchFormItems">
+				<template v-for="(_, name) in $slots" #[`${formatterFormSlot(name)}`]>
+					<slot v-if="name.toString().search(formSlotSuffix) == 0" :name="name" />
+				</template>
+			</VbForm>
+			<el-form
+				v-else-if="$slots['table-search-form']"
+				ref="searchFormRef"
+				:inline="true"
+				:model="propOpts.queryParams"
+				label-width="100px"
+				class="el-row mb-3">
+				<slot name="table-search-form" />
+			</el-form>
+		</div>
+		<div v-if="propOpts.showSearchBtn" class="mb-3 d-flex">
 			<slot v-if="$slots.searchbtn" name="searchbtn"></slot>
 			<slot v-if="$slots.searchbtn" name="searchbtn"></slot>
-			<el-col v-else :span="propOpts.tableSearchBtnSpan">
+			<template v-else>
 				<el-button class="btn btn-primary" @click="query">
 				<el-button class="btn btn-primary" @click="query">
-					<template #icon>
-						<VbIcon icon-name="magnifier" icon-type="solid"></VbIcon>
-					</template>
-					搜索
+					<VbIcon icon-name="magnifier" icon-type="solid"></VbIcon>
+					<span class="ms-2" v-if="propOpts.showSearchBtnText">搜索</span>
 				</el-button>
 				</el-button>
 				<el-button class="btn btn-light-primary" @click="resetForm">
 				<el-button class="btn btn-light-primary" @click="resetForm">
-					<template #icon>
-						<VbIcon icon-name="arrows-loop" icon-type="solid"></VbIcon>
-					</template>
-					重置
+					<VbIcon icon-name="arrows-loop" icon-type="solid"></VbIcon>
+					<span class="ms-2" v-if="propOpts.showSearchBtnText">重置</span>
 				</el-button>
 				</el-button>
-			</el-col>
-		</template>
-	</VbForm>
-	<el-form
-		v-else-if="$slots['table-search-form']"
-		ref="searchFormRef"
-		:inline="true"
-		:model="propOpts.queryParams"
-		class="el-row mb-3">
-		<slot name="table-search-form" />
-		<el-col :span="propOpts.tableSearchBtnSpan">
-			<el-form-item>
-				<el-button class="btn btn-primary" @click="query">
-					<template #icon>
-						<VbIcon icon-name="magnifier" icon-type="solid"></VbIcon>
-					</template>
-					搜索
-				</el-button>
-				<el-button class="btn btn-light-primary" @click="resetForm">
-					<template #icon>
-						<VbIcon icon-name="arrows-loop" icon-type="solid"></VbIcon>
-					</template>
-					重置
-				</el-button>
-			</el-form-item>
-		</el-col>
-	</el-form>
+			</template>
+		</div>
+	</div>
 </template>
 </template>

+ 3 - 3
UI/VAP_V3.VUE/src/components/table/partials/toolbar/TableToolbar.vue

@@ -32,13 +32,13 @@ const onColumnsChange = (v: Header[]) => {
 		</div>
 		</div>
 
 
 		<transition name="vb-fade">
 		<transition name="vb-fade">
-			<div v-if="showSearchBar">
-				<TableSearchFrom :key="'toolSearchForm' + new Date().getTime()">
+			<template v-if="showSearchBar">
+				<TableSearchFrom>
 					<template v-for="(_, name) in $slots" #[name]>
 					<template v-for="(_, name) in $slots" #[name]>
 						<slot :name="name" />
 						<slot :name="name" />
 					</template>
 					</template>
 				</TableSearchFrom>
 				</TableSearchFrom>
-			</div>
+			</template>
 		</transition>
 		</transition>
 
 
 		<el-row :gutter="10">
 		<el-row :gutter="10">

+ 3 - 2
UI/VAP_V3.VUE/src/components/table/symbol.ts

@@ -9,8 +9,8 @@ export default {
 		searchFormRowItems: Ref<VbFormRowItem[]>
 		searchFormRowItems: Ref<VbFormRowItem[]>
 		searchFormItems: Ref<VbFormItem[]>
 		searchFormItems: Ref<VbFormItem[]>
 		queryParams: Ref<any>
 		queryParams: Ref<any>
-		searchFormSpan?: number
-		tableSearchBtnSpan?: number
+		showSearchBtn?: boolean
+		showSearchBtnText?: boolean
 	}>,
 	}>,
 	toolBtns: Symbol("toolBtns") as InjectionKey<Ref<ToolBtn[]>>,
 	toolBtns: Symbol("toolBtns") as InjectionKey<Ref<ToolBtn[]>>,
 	selectedRowCount: Symbol("selectedRowCount") as InjectionKey<Ref<number>>,
 	selectedRowCount: Symbol("selectedRowCount") as InjectionKey<Ref<number>>,
@@ -39,6 +39,7 @@ export default {
 		isTree: boolean
 		isTree: boolean
 		childrenField: string
 		childrenField: string
 		bodyClass: string
 		bodyClass: string
+		keyField: string
 	}>,
 	}>,
 	bodyTr: Symbol("bodyTr") as InjectionKey<{
 	bodyTr: Symbol("bodyTr") as InjectionKey<{
 		selectedIds: Ref<any[]>
 		selectedIds: Ref<any[]>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно