diff --git a/frontend/auto-imports.d.ts b/frontend/auto-imports.d.ts new file mode 100644 index 0000000..78813d8 --- /dev/null +++ b/frontend/auto-imports.d.ts @@ -0,0 +1,9 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const ElMessage: typeof import('element-plus/es')['ElMessage'] +} diff --git a/frontend/components.d.ts b/frontend/components.d.ts new file mode 100644 index 0000000..1a822d2 --- /dev/null +++ b/frontend/components.d.ts @@ -0,0 +1,80 @@ +/* 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'] + } +} diff --git a/frontend/src/api/plan/autoTest.json b/frontend/src/api/plan/autoTest.json new file mode 100644 index 0000000..67ab275 --- /dev/null +++ b/frontend/src/api/plan/autoTest.json @@ -0,0 +1,192 @@ +{ + "code": "A0000", + "data": [ + { + "id": 0, + "name": "频率准备度检测", + "children": [ + { + "pid": 0, + "id": "0-1", + "name": "额定工作条件下的检测", + "children": [ + { + "pid": "0-1", + "id": "0-1-1", + "name": "输入:频率 42.5Hz..." + }, + { + "pid": "0-1", + "id": "0-1-2", + "name": "输入:频率 50.0Hz..." + }, + { + "pid": "0-1", + "id": "0-1-3", + "name": "输入:频率 50.05Hz..." + } + ] + }, + { + "pid": 0, + "id": "0-2", + "name": "电压对频率测量的影响", + "children": [ + { + "pid": "0-2", + "id": "0-2-1", + "name": "输入:频率 50.05Hz Ua =10%Un..." + }, + { + "pid": "0-2", + "id": "0-2-1", + "name": "输入:频率 51.05Hz Ua =10%Un..." + }, + { + "pid": "0-2", + "id": "0-2-2", + "name": "输入:频率 52.05Hz Ua =10%Un..." + } + ] + }, + { + "pid": 0, + "id": "0-3", + "name": "谐波对频率测量的影响", + "children": [ + { + "pid": "0-3", + "id": "0-3-1", + "name": "输入:频率 50.05Hz Ua =100%Un..." + } + ] + } + ] + }, + { + "id": 1, + "name": "电压准确度检测", + "children": [ + { + "pid": 1, + "id": "1-1", + "name": "额定工作条件下的检测", + "children": [ + { + "pid": "1-1", + "id": "1-1-1", + "name": "输入:频率 42.5Hz..." + }, + { + "pid": "1-1", + "id": "1-1-2", + "name": "输入:频率 50.0Hz..." + }, + { + "pid": "1-1", + "id": "1-1-3", + "name": "输入:频率 50.05Hz..." + } + ] + }, + { + "pid": 0, + "id": "1-2", + "name": "电压对频率测量的影响", + "children": [ + { + "pid": "1-2", + "id": "1-2-1", + "name": "输入:频率 50.05Hz Ua =10%Un..." + }, + { + "pid": "1-2", + "id": "1-2-1", + "name": "输入:频率 51.05Hz Ua =10%Un..." + }, + { + "pid": "1-2", + "id": "1-2-2", + "name": "输入:频率 52.05Hz Ua =10%Un..." + } + ] + }, + { + "pid": 0, + "id": "0-3", + "name": "谐波对频率测量的影响", + "children": [ + { + "pid": "0-3", + "id": "0-3-1", + "name": "输入:频率 50.05Hz Ua =100%Un..." + } + ] + } + ] + }, + + { + "id": 2, + "name": "谐波准确度检测", + "children": [ + { + "pid": 2, + "id": "2-1", + "name": "额定工作条件下的检测", + "children": [ + { + "pid": "2-1", + "id": "2-1-1", + "name": "输入:频率 42.5Hz..." + }, + { + "pid": "2-1", + "id": "2-1-2", + "name": "输入:频率 50.0Hz..." + }, + { + "pid": "2-1", + "id": "2-1-3", + "name": "输入:频率 50.05Hz..." + } + ] + }, + { + "pid": 2, + "id": "2-2", + "name": "电压对频率测量的影响", + "children": [ + { + "pid": "2-2", + "id": "2-2-1", + "name": "输入:频率 50.05Hz Ua =10%Un..." + }, + { + "pid": "2-2", + "id": "2-2-1", + "name": "输入:频率 51.05Hz Ua =10%Un..." + }, + { + "pid": "2-2", + "id": "2-2-2", + "name": "输入:频率 52.05Hz Ua =10%Un..." + } + ] + }, + { + "pid": 2, + "id": "2-3", + "name": "谐波对频率测量的影响", + "children": [ + { + "pid": "2-3", + "id": "2-3-1", + "name": "输入:频率 50.05Hz Ua =100%Un..." + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/frontend/src/api/plan/autoTest.ts b/frontend/src/api/plan/autoTest.ts new file mode 100644 index 0000000..911dd84 --- /dev/null +++ b/frontend/src/api/plan/autoTest.ts @@ -0,0 +1,10 @@ +import http from "@/api"; + +//获取自动检测列表 +export const getPlanList = (data: any) => { + return http.post( + "http://192.168.1.123:4523/m1/2573730-0-default/plan/planList/list", + data, + { loading: false } + ); +}; diff --git a/frontend/src/api/plan/planList.ts b/frontend/src/api/plan/planList.ts index fbebcc1..5371ea5 100644 --- a/frontend/src/api/plan/planList.ts +++ b/frontend/src/api/plan/planList.ts @@ -7,5 +7,5 @@ export const getPlanList = (data: any) => { data, { loading: false } ); - }; +}; \ No newline at end of file diff --git a/frontend/src/components/ProTable/index.vue b/frontend/src/components/ProTable/index.vue index d7ed330..0ca7dcf 100644 --- a/frontend/src/components/ProTable/index.vue +++ b/frontend/src/components/ProTable/index.vue @@ -14,12 +14,27 @@
- +
- - + +
- - + @@ -153,7 +160,7 @@ const props = withDefaults(defineProps(), { 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 实例 @@ -163,26 +170,50 @@ const tableRef = ref>(); 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 +); +console.log(props, "175175175175175175"); // 清空选中数据列表 const clearSelection = () => tableRef.value!.clearSelection(); @@ -196,7 +227,12 @@ onMounted(() => { // 处理表格数据 const processTableData = computed(() => { - console.log(props.data,tableData.value,props.pagination,"8888777777766666666188"); + 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( @@ -220,10 +256,15 @@ 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!, []); @@ -237,8 +278,11 @@ 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); @@ -250,13 +294,13 @@ const flatColumnsFunc = (columns: ColumnProps[], flatArr: ColumnProps[] = []) => // 设置 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!); }); @@ -273,7 +317,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; }); @@ -306,7 +350,7 @@ const dragSort = () => { const [removedItem] = processTableData.value.splice(oldIndex!, 1); processTableData.value.splice(newIndex!, 0, removedItem); emit("dragSort", { newIndex, oldIndex }); - } + }, }); }; @@ -329,11 +373,11 @@ defineExpose({ handleSizeChange, handleCurrentChange, clearSelection, - enumMap + enumMap, }); \ No newline at end of file + diff --git a/frontend/src/components/echarts/pie/default.vue b/frontend/src/components/echarts/pie/default.vue index 8113409..9c37185 100644 --- a/frontend/src/components/echarts/pie/default.vue +++ b/frontend/src/components/echarts/pie/default.vue @@ -99,6 +99,7 @@ const init = () => { }, 0); }; const resizeCharts = () => { + console.log(77777); if (chart.value) { chart.value.resize(); } diff --git a/frontend/src/hooks/useTable.ts b/frontend/src/hooks/useTable.ts index 8ad8624..916af4c 100644 --- a/frontend/src/hooks/useTable.ts +++ b/frontend/src/hooks/useTable.ts @@ -25,14 +25,14 @@ export const useTable = ( // 每页显示条数 pageSize: 10, // 总条数 - total: 0 + total: 0, }, // 查询参数(只包括查询) searchParam: {}, // 初始化默认的查询参数 searchInitParam: {}, // 总参数(包含分页和查询参数) - totalParam: {} + totalParam: {}, }); /** @@ -42,12 +42,12 @@ export const useTable = ( get: () => { return { pageNum: state.pageable.pageNum, - pageSize: state.pageable.pageSize + pageSize: state.pageable.pageSize, }; }, set: (newVal: any) => { console.log("我是分页更新之后的值", newVal); - } + }, }); /** @@ -58,8 +58,15 @@ export const useTable = ( if (!api) return; try { // 先把初始化参数和分页参数放到总参数里面 - Object.assign(state.totalParam, initParam, isPageable ? pageParam.value : {}); - let { data } = await api({ ...state.searchInitParam, ...state.totalParam }); + Object.assign( + state.totalParam, + initParam, + isPageable ? pageParam.value : {} + ); + let { data } = await api({ + ...state.searchInitParam, + ...state.totalParam, + }); dataCallBack && (data = dataCallBack(data)); state.tableData = isPageable ? data.list : data; // 解构后台返回的分页数据 (如果有分页更新分页信息) @@ -82,7 +89,11 @@ export const useTable = ( // 防止手动清空输入框携带参数(这里可以自定义查询参数前缀) for (let key in state.searchParam) { // 某些情况下参数为 false/0 也应该携带参数 - if (state.searchParam[key] || state.searchParam[key] === false || state.searchParam[key] === 0) { + if ( + state.searchParam[key] || + state.searchParam[key] === false || + state.searchParam[key] === 0 + ) { nowSearchParam[key] = state.searchParam[key]; } } @@ -139,6 +150,6 @@ export const useTable = ( reset, handleSizeChange, handleCurrentChange, - updatedTotalParam + updatedTotalParam, }; }; diff --git a/frontend/src/layouts/components/Footer/index.vue b/frontend/src/layouts/components/Footer/index.vue index 0351286..bd7d29a 100644 --- a/frontend/src/layouts/components/Footer/index.vue +++ b/frontend/src/layouts/components/Footer/index.vue @@ -18,13 +18,13 @@