diff --git a/src/api/canteen/canteenOnlineSpu.ts b/src/api/canteen/canteenOnlineSpu.ts index fc63d22..35d14d3 100644 --- a/src/api/canteen/canteenOnlineSpu.ts +++ b/src/api/canteen/canteenOnlineSpu.ts @@ -1,41 +1,48 @@ import request from "/@/utils/request" export function fetchList(query?: Object) { - return request({ - url: '/canteen/canteenOnlineSpu/page', - method: 'get', - params: query - }) + return request({ + url: "/canteen/canteenOnlineSpu/page", + method: "get", + params: query, + }) } export function addObj(obj?: Object) { - return request({ - url: '/canteen/canteenOnlineSpu', - method: 'post', - data: obj - }) + return request({ + url: "/canteen/canteenOnlineSpu", + method: "post", + data: obj, + }) } export function getObj(id?: string) { - return request({ - url: '/canteen/canteenOnlineSpu/' + id, - method: 'get' - }) + return request({ + url: "/canteen/canteenOnlineSpu/" + id, + method: "get", + }) } export function delObjs(ids?: Object) { - return request({ - url: '/canteen/canteenOnlineSpu', - method: 'delete', - data: ids - }) + return request({ + url: "/canteen/canteenOnlineSpu", + method: "delete", + data: ids, + }) } export function putObj(obj?: Object) { - return request({ - url: '/canteen/canteenOnlineSpu', - method: 'put', - data: obj - }) + return request({ + url: "/canteen/canteenOnlineSpu", + method: "put", + data: obj, + }) } +export function saveCanteenSpuBatch(obj?: Object) { + return request({ + url: "/canteen/canteenOnlineSpu/saveCanteenSpuBatch", + method: "post", + data: obj, + }) +} diff --git a/src/views/admin/system/menu/index.vue b/src/views/admin/system/menu/index.vue index fab17be..1215092 100644 --- a/src/views/admin/system/menu/index.vue +++ b/src/views/admin/system/menu/index.vue @@ -1,7 +1,7 @@ @@ -107,7 +111,7 @@ const state: BasicTableProps = reactive({ createdIsNeed: false, pageList: pageList, queryForm: { - // parentId: -1, + parentId: "-1", menuName: "", }, isPage: false, @@ -122,7 +126,7 @@ onMounted(async () => { const expandRowKeys = computed(() => { const list = state.dataList const arr: any[] = [] - list?.forEach((item) => { + list?.map((item) => { if (item.children && item.children.length) { arr.push(item.id) } @@ -130,21 +134,6 @@ const expandRowKeys = computed(() => { return arr }) -// 根据类型判断是否有子节点 -// const setHasChildren = (arr: any[]) => { -// arr.forEach((item) => { -// // 添加 hasChildren 属性 -// item.hasChildren = item.menuType !== "1" -// }) -// } -// const tableList = computed(() => { -// const list = state.dataList -// // if (Array.isArray(list)) { -// // setHasChildren(list) -// // } -// return list -// }) - // 打开新增菜单弹窗 const onOpenAddMenu = (type?: string, row?: any) => { menuDialogRef.value.openDialog(type, row) @@ -159,35 +148,54 @@ const deleteMenuDisabled = (row: any) => { return (row.children || []).length > 0 } -// 搜索事件 -const query = () => { - state.dataList = [] - state.queryForm.parentId = undefined - getDataList() -} - // 清空搜索条件 const resetQuery = () => { queryRef.value.resetFields() + state.queryForm.parentId = "-1" state.dataList = [] getDataList() } -// const load = (row: any, treeNode: unknown, resolve: (date: any[]) => void) => { -// const param = { -// parentId: row.id, -// } -// pageList(param).then((res) => { -// const childrenList = res.data -// if (Array.isArray(childrenList)) { -// setHasChildren(childrenList) -// } -// if (childrenList && childrenList.length) { -// resolve(childrenList) -// } -// }) -// } +const load = (row: any, treeNode: unknown, resolve: (date: any[]) => void) => { + const param = { + parentId: row.id, + } + pageList(param).then((res) => { + const childrenList = res.data + if (Array.isArray(childrenList)) { + setHasChildren(childrenList) + } + if (childrenList && childrenList.length) { + resolve(childrenList) + } + }) +} +// 根据类型判断是否有子节点 +const setHasChildren = (arr: any[]) => { + arr.forEach((item) => { + // 添加 hasChildren 属性 + item.hasChildren = item.menuType !== "1" + }) +} +const tableList = computed(() => { + const list = state.dataList + if (Array.isArray(list)) { + setHasChildren(list) + } + return list +}) + +const query = () => { + state.dataList = [] + if (state.queryForm.menuName) { + state.queryForm.parentId = "" + } else { + state.queryForm.parentId = "-1" + } + + getDataList() +} // 删除操作 const handleDelete = async (row: any) => { try { @@ -205,3 +213,14 @@ const handleDelete = async (row: any) => { } } + + diff --git a/src/views/canteen/canteenCategory/form.vue b/src/views/canteen/canteenCategory/form.vue index fa647d3..7fc0de3 100644 --- a/src/views/canteen/canteenCategory/form.vue +++ b/src/views/canteen/canteenCategory/form.vue @@ -10,12 +10,7 @@ - + diff --git a/src/views/canteen/canteenCategory/index.vue b/src/views/canteen/canteenCategory/index.vue index d6883ef..e67f37e 100644 --- a/src/views/canteen/canteenCategory/index.vue +++ b/src/views/canteen/canteenCategory/index.vue @@ -66,8 +66,8 @@ - - + + + + + @@ -213,6 +207,7 @@ import { fetchList, delObjs, getSupermarketCategory, getSupermarketBrand } from import { useMessage, useMessageBox } from "/@/hooks/message" import { useDict } from "/@/hooks/dict" import UploadExcel from "./components/upload-excel.vue" +import UploadExcelUpdate from "./components/upload-excel-update.vue" import { displayPrice } from "/@/utils/formatMoney" import { getSupplierSimpleAll } from "/@/api/supermarketerp/smErpSupplier"