项目微调
This commit is contained in:
9
frontend/auto-imports.d.ts
vendored
9
frontend/auto-imports.d.ts
vendored
@@ -1,9 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
// @ts-nocheck
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
// Generated by unplugin-auto-import
|
||||
export {}
|
||||
declare global {
|
||||
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
||||
}
|
||||
80
frontend/components.d.ts
vendored
80
frontend/components.d.ts
vendored
@@ -1,80 +0,0 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
403: typeof import('./src/components/ErrorMessage/403.vue')['default']
|
||||
404: typeof import('./src/components/ErrorMessage/404.vue')['default']
|
||||
500: typeof import('./src/components/ErrorMessage/500.vue')['default']
|
||||
ColSetting: typeof import('./src/components/ProTable/components/ColSetting.vue')['default']
|
||||
Default: typeof import('./src/components/echarts/pie/default.vue')['default']
|
||||
Dialog: typeof import('./src/components/Dialog/index.vue')['default']
|
||||
ElAside: typeof import('element-plus/es')['ElAside']
|
||||
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
|
||||
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
|
||||
ElButton: typeof import('element-plus/es')['ElButton']
|
||||
ElCard: typeof import('element-plus/es')['ElCard']
|
||||
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
||||
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
|
||||
ElCol: typeof import('element-plus/es')['ElCol']
|
||||
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
|
||||
ElContainer: typeof import('element-plus/es')['ElContainer']
|
||||
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
|
||||
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
|
||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||
ElDrawer: typeof import('element-plus/es')['ElDrawer']
|
||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
||||
ElFooter: typeof import('element-plus/es')['ElFooter']
|
||||
ElForm: typeof import('element-plus/es')['ElForm']
|
||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||
ElHeader: typeof import('element-plus/es')['ElHeader']
|
||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||
ElInput: typeof import('element-plus/es')['ElInput']
|
||||
ElMain: typeof import('element-plus/es')['ElMain']
|
||||
ElMenu: typeof import('element-plus/es')['ElMenu']
|
||||
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
||||
ElOption: typeof import('element-plus/es')['ElOption']
|
||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
||||
ElRow: typeof import('element-plus/es')['ElRow']
|
||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||
ElSegmented: typeof import('element-plus/es')['ElSegmented']
|
||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||
ElSelectV2: typeof import('element-plus/es')['ElSelectV2']
|
||||
ElSpace: typeof import('element-plus/es')['ElSpace']
|
||||
ElStatistic: typeof import('element-plus/es')['ElStatistic']
|
||||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||
ElTable: typeof import('element-plus/es')['ElTable']
|
||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||
ElTabPane: typeof import('element-plus/es')['ElTabPane']
|
||||
ElTabs: typeof import('element-plus/es')['ElTabs']
|
||||
ElTag: typeof import('element-plus/es')['ElTag']
|
||||
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
|
||||
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||
ElTree: typeof import('element-plus/es')['ElTree']
|
||||
Grid: typeof import('./src/components/Grid/index.vue')['default']
|
||||
GridItem: typeof import('./src/components/Grid/components/GridItem.vue')['default']
|
||||
ImportExcel: typeof import('./src/components/ImportExcel/index.vue')['default']
|
||||
Loading: typeof import('./src/components/Loading/index.vue')['default']
|
||||
Pagination: typeof import('./src/components/ProTable/components/Pagination.vue')['default']
|
||||
ProTable: typeof import('./src/components/ProTable/index.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
SearchForm: typeof import('./src/components/SearchForm/index.vue')['default']
|
||||
SearchFormItem: typeof import('./src/components/SearchForm/components/SearchFormItem.vue')['default']
|
||||
SvgIcon: typeof import('./src/components/staticExtend/SvgIcon/src/SvgIcon.vue')['default']
|
||||
SwitchDark: typeof import('./src/components/SwitchDark/index.vue')['default']
|
||||
TableColumn: typeof import('./src/components/ProTable/components/TableColumn.vue')['default']
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||
"@typescript-eslint/parser": "^6.7.0",
|
||||
"@vitejs/plugin-vue": "^5.0.5",
|
||||
"@vitejs/plugin-vue-jsx": "^3.0.2",
|
||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
||||
"@vue/eslint-config-typescript": "^13.0.0",
|
||||
"@vue/tsconfig": "^0.5.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
:page-size="pageable.pageSize"
|
||||
:page-sizes="[10, 25, 50, 100]"
|
||||
:total="pageable.total"
|
||||
:size="globalStore?.assemblySize ?? 'default'"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@@ -13,6 +14,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="Pagination">
|
||||
import { useGlobalStore } from "@/stores/modules/global";
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
interface Pageable {
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx" name="TableColumn">
|
||||
import { inject, ref, useSlots } from "vue";
|
||||
import { ColumnProps, RenderScope, HeaderRenderScope } from "@/components/ProTable/interface";
|
||||
import { filterEnum, formatValue, handleProp, handleRowAccordingToProp } from "@/utils";
|
||||
|
||||
|
||||
@@ -14,27 +14,12 @@
|
||||
<!-- 表格头部 操作按钮 -->
|
||||
<div class="table-header">
|
||||
<div class="header-button-lf">
|
||||
<slot
|
||||
name="tableHeader"
|
||||
:selected-list="selectedList"
|
||||
:selected-list-ids="selectedListIds"
|
||||
:is-selected="isSelected"
|
||||
/>
|
||||
<slot name="tableHeader" :selected-list="selectedList" :selected-list-ids="selectedListIds" :is-selected="isSelected" />
|
||||
</div>
|
||||
<div v-if="toolButton" class="header-button-ri">
|
||||
<slot name="toolButton">
|
||||
<el-button
|
||||
v-if="showToolButton('refresh')"
|
||||
:icon="Refresh"
|
||||
circle
|
||||
@click="getTableList"
|
||||
/>
|
||||
<el-button
|
||||
v-if="showToolButton('setting') && columns.length"
|
||||
:icon="Operation"
|
||||
circle
|
||||
@click="openColSetting"
|
||||
/>
|
||||
<el-button v-if="showToolButton('refresh')" :icon="Refresh" circle @click="getTableList" />
|
||||
<el-button v-if="showToolButton('setting') && columns.length" :icon="Operation" circle @click="openColSetting" />
|
||||
<el-button
|
||||
v-if="showToolButton('search') && searchColumns?.length"
|
||||
:icon="Search"
|
||||
@@ -53,7 +38,6 @@
|
||||
:border="border"
|
||||
:row-key="rowKey"
|
||||
@selection-change="selectionChange"
|
||||
class="custom-table-header"
|
||||
>
|
||||
<!-- 默认插槽 -->
|
||||
<slot />
|
||||
@@ -72,11 +56,7 @@
|
||||
<slot v-else :name="item.type" v-bind="scope" />
|
||||
</template>
|
||||
<!-- radio -->
|
||||
<el-radio
|
||||
v-if="item.type == 'radio'"
|
||||
v-model="radio"
|
||||
:label="scope.row[rowKey]"
|
||||
>
|
||||
<el-radio v-if="item.type == 'radio'" v-model="radio" :label="scope.row[rowKey]">
|
||||
<i></i>
|
||||
</el-radio>
|
||||
<!-- sort -->
|
||||
@@ -160,7 +140,7 @@ const props = withDefaults(defineProps<ProTableProps>(), {
|
||||
border: true,
|
||||
toolButton: true,
|
||||
rowKey: "id",
|
||||
searchCol: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }),
|
||||
searchCol: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 })
|
||||
});
|
||||
|
||||
// table 实例
|
||||
@@ -170,50 +150,25 @@ const tableRef = ref<InstanceType<typeof ElTable>>();
|
||||
const uuid = ref("id-" + generateUUID());
|
||||
|
||||
// column 列类型
|
||||
const columnTypes: TypeProps[] = [
|
||||
"selection",
|
||||
"radio",
|
||||
"index",
|
||||
"expand",
|
||||
"sort",
|
||||
];
|
||||
const columnTypes: TypeProps[] = ["selection", "radio", "index", "expand", "sort"];
|
||||
|
||||
// 是否显示搜索模块
|
||||
const isShowSearch = ref(true);
|
||||
|
||||
// 控制 ToolButton 显示
|
||||
const showToolButton = (key: "refresh" | "setting" | "search") => {
|
||||
return Array.isArray(props.toolButton)
|
||||
? props.toolButton.includes(key)
|
||||
: props.toolButton;
|
||||
return Array.isArray(props.toolButton) ? props.toolButton.includes(key) : props.toolButton;
|
||||
};
|
||||
|
||||
// 单选值
|
||||
const radio = ref("");
|
||||
|
||||
// 表格多选 Hooks
|
||||
const { selectionChange, selectedList, selectedListIds, isSelected } =
|
||||
useSelection(props.rowKey);
|
||||
const { selectionChange, selectedList, selectedListIds, isSelected } = useSelection(props.rowKey);
|
||||
|
||||
// 表格操作 Hooks
|
||||
const {
|
||||
tableData,
|
||||
pageable,
|
||||
searchParam,
|
||||
searchInitParam,
|
||||
getTableList,
|
||||
search,
|
||||
reset,
|
||||
handleSizeChange,
|
||||
handleCurrentChange,
|
||||
} = useTable(
|
||||
props.requestApi,
|
||||
props.initParam,
|
||||
props.pagination,
|
||||
props.dataCallback,
|
||||
props.requestError
|
||||
);
|
||||
console.log(props, "175175175175175175");
|
||||
const { tableData, pageable, searchParam, searchInitParam, getTableList, search, reset, handleSizeChange, handleCurrentChange } =
|
||||
useTable(props.requestApi, props.initParam, props.pagination, props.dataCallback, props.requestError);
|
||||
|
||||
// 清空选中数据列表
|
||||
const clearSelection = () => tableRef.value!.clearSelection();
|
||||
@@ -227,12 +182,6 @@ onMounted(() => {
|
||||
|
||||
// 处理表格数据
|
||||
const processTableData = computed(() => {
|
||||
console.log(
|
||||
props.data,
|
||||
tableData.value,
|
||||
props.pagination,
|
||||
"8888777777766666666188"
|
||||
);
|
||||
if (!props.data) return tableData.value;
|
||||
if (!props.pagination) return props.data;
|
||||
return props.data.slice(
|
||||
@@ -256,15 +205,10 @@ const setEnumMap = async ({ prop, enum: enumValue }: ColumnProps) => {
|
||||
if (!enumValue) return;
|
||||
|
||||
// 如果当前 enumMap 存在相同的值 return
|
||||
if (
|
||||
enumMap.value.has(prop!) &&
|
||||
(typeof enumValue === "function" || enumMap.value.get(prop!) === enumValue)
|
||||
)
|
||||
return;
|
||||
if (enumMap.value.has(prop!) && (typeof enumValue === "function" || enumMap.value.get(prop!) === enumValue)) return;
|
||||
|
||||
// 当前 enum 为静态数据,则直接存储到 enumMap
|
||||
if (typeof enumValue !== "function")
|
||||
return enumMap.value.set(prop!, unref(enumValue!));
|
||||
if (typeof enumValue !== "function") return enumMap.value.set(prop!, unref(enumValue!));
|
||||
|
||||
// 为了防止接口执行慢,而存储慢,导致重复请求,所以预先存储为[],接口返回后再二次存储
|
||||
enumMap.value.set(prop!, []);
|
||||
@@ -278,11 +222,8 @@ const setEnumMap = async ({ prop, enum: enumValue }: ColumnProps) => {
|
||||
provide("enumMap", enumMap);
|
||||
|
||||
// 扁平化 columns 的方法
|
||||
const flatColumnsFunc = (
|
||||
columns: ColumnProps[],
|
||||
flatArr: ColumnProps[] = []
|
||||
) => {
|
||||
columns.forEach(async (col) => {
|
||||
const flatColumnsFunc = (columns: ColumnProps[], flatArr: ColumnProps[] = []) => {
|
||||
columns.forEach(async col => {
|
||||
if (col._children?.length) flatArr.push(...flatColumnsFunc(col._children));
|
||||
flatArr.push(col);
|
||||
|
||||
@@ -294,13 +235,13 @@ const flatColumnsFunc = (
|
||||
// 设置 enumMap
|
||||
await setEnumMap(col);
|
||||
});
|
||||
return flatArr.filter((item) => !item._children?.length);
|
||||
return flatArr.filter(item => !item._children?.length);
|
||||
};
|
||||
|
||||
// 过滤需要搜索的配置项 && 排序
|
||||
const searchColumns = computed(() => {
|
||||
return flatColumns.value
|
||||
?.filter((item) => item.search?.el || item.search?.render)
|
||||
?.filter(item => item.search?.el || item.search?.render)
|
||||
.sort((a, b) => a.search!.order! - b.search!.order!);
|
||||
});
|
||||
|
||||
@@ -317,7 +258,7 @@ searchColumns.value?.forEach((column, index) => {
|
||||
|
||||
// 列设置 ==> 需要过滤掉不需要设置的列
|
||||
const colRef = ref();
|
||||
const colSetting = tableColumns!.filter((item) => {
|
||||
const colSetting = tableColumns!.filter(item => {
|
||||
const { type, prop, isSetting } = item;
|
||||
return !columnTypes.includes(type!) && prop !== "operation" && isSetting;
|
||||
});
|
||||
@@ -350,7 +291,7 @@ const dragSort = () => {
|
||||
const [removedItem] = processTableData.value.splice(oldIndex!, 1);
|
||||
processTableData.value.splice(newIndex!, 0, removedItem);
|
||||
emit("dragSort", { newIndex, oldIndex });
|
||||
},
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -373,11 +314,6 @@ defineExpose({
|
||||
handleSizeChange,
|
||||
handleCurrentChange,
|
||||
clearSelection,
|
||||
enumMap,
|
||||
enumMap
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.custom-table-header .el-table__header-wrapper .el-table__header){
|
||||
background-color: red !important; /* 修改为你想要的颜色 */
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -41,6 +41,48 @@ export const staticRouter: RouteRecordRaw[] = [
|
||||
isKeepAlive: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/singlePlanList",
|
||||
name: "singlePlanList",
|
||||
component:()=> import("@/views/plan/singlePlanList/index.vue"),
|
||||
meta: {
|
||||
title: "单个计划列表",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/preTest",
|
||||
name: "preTest",
|
||||
component:()=> import("@/views/plan/preTest/index.vue"),
|
||||
meta: {
|
||||
title: "预检测",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plan/autoTest",
|
||||
name: "autoTest",
|
||||
component:()=> import("@/views/plan/autoTest/index.vue"),
|
||||
meta: {
|
||||
title: "自动检测",
|
||||
icon: "List",
|
||||
isLink: "",
|
||||
isHide: false,
|
||||
isFull: false,
|
||||
isAffix: false,
|
||||
isKeepAlive: false,
|
||||
},
|
||||
},
|
||||
// 错误页面路由
|
||||
{
|
||||
path: "/403",
|
||||
|
||||
@@ -105,7 +105,6 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref,reactive,onMounted, defineExpose } from "vue";
|
||||
import type { ComponentSize, FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
interface RuleForm {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"moduleResolution": "Node",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "vue",
|
||||
"allowJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
|
||||
@@ -18,6 +18,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||
return {
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
// svg图标配置,可以使用svg图标
|
||||
createSvgIconsPlugin({
|
||||
iconDirs: [path.resolve(process.cwd(), "src/assets/icons")],
|
||||
@@ -58,8 +59,6 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||
dts: false,
|
||||
// dts: "src/types/components.d.ts",
|
||||
}),
|
||||
// 增加此行代码
|
||||
vueJsx(),
|
||||
],
|
||||
// 基础配置
|
||||
base: viteEnv.VITE_PUBLIC_PATH,
|
||||
|
||||
Reference in New Issue
Block a user