超市报表
This commit is contained in:
1 parent
d8a296f47f
commit
08cf048bde
12 files changed
+140
-101
No files matched your search
+7
-30
@@ -1,38 +1,15 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# 表示是最顶层的配置文件
|
||||
root = true
|
||||
|
||||
# 对所有文件生效
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# 对 JS、TS、Vue 文件的配置
|
||||
[*.{js,jsx,ts,tsx,vue}]
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
# 对 JSON、YAML 文件的配置
|
||||
[*.{json,yml,yaml}]
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
# 对 Markdown 文件的配置
|
||||
[*.md]
|
||||
insert_final_newline = false
|
||||
trim_trailing_whitespace = false
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{js,ts,vue,json}]
|
||||
indent_size = 2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
+8
-41
@@ -1,45 +1,12 @@
|
||||
# 设置默认行为,以防人们没有设置 core.autocrlf
|
||||
* text=auto
|
||||
|
||||
# 明确声明你想要始终规范化并在检出时转换为原生行结束符的文本文件
|
||||
*.vue text eol=lf
|
||||
# 禁用行尾转换
|
||||
* text=auto eol=lf
|
||||
*.js text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.jsx text eol=lf
|
||||
*.tsx text eol=lf
|
||||
*.vue text eol=lf
|
||||
*.json text eol=lf
|
||||
*.css text eol=lf
|
||||
*.scss text eol=lf
|
||||
*.sass text eol=lf
|
||||
*.html text eol=lf
|
||||
*.htm text eol=lf
|
||||
*.xml text eol=lf
|
||||
*.md text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.yaml text eol=lf
|
||||
|
||||
# 明确声明你不想规范化并希望原样保留的文件
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.jpeg binary
|
||||
*.gif binary
|
||||
*.ico binary
|
||||
*.svg binary
|
||||
*.eot binary
|
||||
*.ttf binary
|
||||
*.woff binary
|
||||
*.woff2 binary
|
||||
*.otf binary
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 禁用空白行处理
|
||||
*.js -whitespace
|
||||
*.ts -whitespace
|
||||
*.vue -whitespace
|
||||
*.json -whitespace
|
||||
+39
-25
@@ -1,34 +1,48 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
docker/dist
|
||||
# Cursor
|
||||
.cursor/
|
||||
.cursorrules
|
||||
.cursorignore
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# local env files
|
||||
.env
|
||||
.env.development
|
||||
.env.prod
|
||||
.env.dev-local
|
||||
.env.*.local
|
||||
# 临时文件
|
||||
*.tmp
|
||||
*.temp
|
||||
|
||||
# Log files
|
||||
# 日志文件
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
# 依赖目录
|
||||
node_modules/
|
||||
.pnpm-store/
|
||||
|
||||
# lock
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
pnpm-lock.yaml
|
||||
# 构建输出
|
||||
dist/
|
||||
build/
|
||||
|
||||
.env.development
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
|
||||
|
||||
# 操作系统文件
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# 编辑器文件
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# 测试覆盖率
|
||||
coverage/
|
||||
.nyc_output/
|
||||
|
||||
# 缓存文件
|
||||
.cache/
|
||||
.parcel-cache/
|
||||
@@ -40,6 +40,7 @@
|
||||
lazy
|
||||
:load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
@expand-change="handleExpandChange"
|
||||
>
|
||||
<el-table-column :label="$t('sysmenu.name')" fixed prop="name" align="left" show-overflow-tooltip min-width="200" />
|
||||
<el-table-column :label="$t('sysmenu.sortOrder')" prop="sortOrder" align="center" show-overflow-tooltip />
|
||||
@@ -107,6 +108,8 @@ const tableRef = ref()
|
||||
const menuDialogRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const queryRef = ref()
|
||||
// 保存已展开的节点ID
|
||||
const expandedRowIds = ref<Set<string>>(new Set())
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
createdIsNeed: false,
|
||||
pageList: pageList,
|
||||
@@ -136,6 +139,10 @@ const expandRowKeys = computed(() => {
|
||||
|
||||
// 打开新增菜单弹窗
|
||||
const onOpenAddMenu = (type?: string, row?: any) => {
|
||||
// 如果是添加子菜单,记录父节点ID,以便刷新后自动展开
|
||||
if (row && row.id) {
|
||||
expandedRowIds.value.add(row.id)
|
||||
}
|
||||
menuDialogRef.value.openDialog(type, row)
|
||||
}
|
||||
// 打开编辑菜单弹窗
|
||||
@@ -149,11 +156,24 @@ const deleteMenuDisabled = (row: any) => {
|
||||
}
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
const resetQuery = async () => {
|
||||
queryRef.value.resetFields()
|
||||
state.queryForm.parentId = "-1"
|
||||
state.dataList = []
|
||||
getDataList()
|
||||
await getDataList()
|
||||
// 恢复展开状态
|
||||
await restoreExpandedRows()
|
||||
}
|
||||
|
||||
// 监听展开/折叠事件
|
||||
const handleExpandChange = (row: any, expanded: boolean) => {
|
||||
if (expanded) {
|
||||
// 展开时记录
|
||||
expandedRowIds.value.add(row.id)
|
||||
} else {
|
||||
// 折叠时移除
|
||||
expandedRowIds.value.delete(row.id)
|
||||
}
|
||||
}
|
||||
|
||||
const load = (row: any, treeNode: unknown, resolve: (date: any[]) => void) => {
|
||||
@@ -186,15 +206,64 @@ const tableList = computed(() => {
|
||||
return list
|
||||
})
|
||||
|
||||
const query = () => {
|
||||
// 恢复展开状态(支持多级展开)
|
||||
const restoreExpandedRows = async () => {
|
||||
await nextTick()
|
||||
if (!tableRef.value || expandedRowIds.value.size === 0) return
|
||||
|
||||
// 递归加载并展开节点
|
||||
const loadAndExpandRows = async (list: any[]) => {
|
||||
for (const row of list || []) {
|
||||
if (expandedRowIds.value.has(row.id)) {
|
||||
// 如果节点有子节点且未加载,先加载子节点
|
||||
if (row.hasChildren && (!row.children || row.children.length === 0)) {
|
||||
try {
|
||||
const res = await pageList({ parentId: row.id })
|
||||
const childrenList = res.data
|
||||
if (Array.isArray(childrenList) && childrenList.length > 0) {
|
||||
setHasChildren(childrenList)
|
||||
row.children = childrenList
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载子节点失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 展开该节点
|
||||
try {
|
||||
tableRef.value.toggleRowExpansion(row, true)
|
||||
// 等待 DOM 更新,确保子节点渲染完成
|
||||
await nextTick()
|
||||
} catch (error) {
|
||||
console.error('展开节点失败:', error)
|
||||
}
|
||||
|
||||
// 如果有子节点,递归处理
|
||||
if (row.children && row.children.length > 0) {
|
||||
await loadAndExpandRows(row.children)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await loadAndExpandRows(state.dataList)
|
||||
}
|
||||
|
||||
const query = async () => {
|
||||
state.dataList = []
|
||||
if (state.queryForm.menuName) {
|
||||
state.queryForm.parentId = ""
|
||||
// 搜索时清空展开记录
|
||||
expandedRowIds.value.clear()
|
||||
} else {
|
||||
state.queryForm.parentId = "-1"
|
||||
}
|
||||
|
||||
getDataList()
|
||||
await getDataList()
|
||||
// 刷新后恢复展开状态
|
||||
if (!state.queryForm.menuName) {
|
||||
await restoreExpandedRows()
|
||||
}
|
||||
}
|
||||
// 删除操作
|
||||
const handleDelete = async (row: any) => {
|
||||
@@ -206,7 +275,11 @@ const handleDelete = async (row: any) => {
|
||||
|
||||
try {
|
||||
await delObj(row.id)
|
||||
getDataList()
|
||||
// 删除后刷新数据
|
||||
state.dataList = []
|
||||
await getDataList()
|
||||
// 恢复展开状态
|
||||
await restoreExpandedRows()
|
||||
useMessage().success(t("common.delSuccessText"))
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
|
||||
@@ -353,3 +353,4 @@ const handleCurrentChange = (page: number) => {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -203,3 +203,4 @@ defineExpose({
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -219,3 +219,4 @@ const trendClass = computed(() => {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,3 +24,4 @@ export { default as ProductRankingTable } from './ProductRankingTable.vue';
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -224,3 +224,4 @@ export const SUCCESS_MESSAGES = {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -213,3 +213,4 @@ export const TABLE_CONFIG = {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -140,3 +140,4 @@ API调用失败
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -132,3 +132,4 @@ exportInventoryInOutExcel(params)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user