修改菜品分类接口

This commit is contained in:
ctw committed 2025-01-17 15:00:14 +08:00
1 parent 373de198e4
commit 0fa67d4d02
5 files changed
+54 -51

No files matched your search

+30 -30
View File
@@ -1,48 +1,48 @@
import request from "/@/utils/request"
export function fetchList(query?: Object) {
return request({
url: '/canteen/canteenCategory/page',
method: 'get',
params: query
})
return request({
url: "/canteen/canteenCategory/page",
method: "get",
params: query,
})
}
export function addObj(obj?: Object) {
return request({
url: '/canteen/canteenCategory',
method: 'post',
data: obj
})
return request({
url: "/canteen/canteenCategory",
method: "post",
data: obj,
})
}
export function getObj(id?: string) {
return request({
url: '/canteen/canteenCategory/' + id,
method: 'get'
})
return request({
url: "/canteen/canteenCategory/" + id,
method: "get",
})
}
export function delObjs(ids?: Object) {
return request({
url: '/canteen/canteenCategory',
method: 'delete',
data: ids
})
return request({
url: "/canteen/canteenCategory",
method: "delete",
data: ids,
})
}
export function putObj(obj?: Object) {
return request({
url: '/canteen/canteenCategory',
method: 'put',
data: obj
})
return request({
url: "/canteen/canteenCategory",
method: "put",
data: obj,
})
}
export function getAllSimple() {
return request({
url: '/canteen/canteenCategory/getAllSimple',
method: 'get',
})
export function getAllSimple(query?: any) {
return request({
url: "/canteen/canteenCategory/getAllSimple",
method: "get",
params: query,
})
}
+3 -6
View File
@@ -26,7 +26,7 @@
<script setup lang="ts" name="select-merchant">
import { reactive } from "vue"
import { fetchList as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
const selectId = defineModel()
@@ -37,10 +37,7 @@ const props = withDefaults(defineProps<Props>(), {
placeholder: "请选择",
})
const queryForm = reactive<any>({
current: 1,
size: 9999,
})
const queryForm = reactive<any>({})
const state = reactive<any>({
loading: true,
@@ -65,7 +62,7 @@ async function getOptions() {
...queryForm,
}
const { data } = await getCanteenCategory(_pa)
state.options = data.records ?? []
state.options = data ?? []
} finally {
setTimeout(() => (state.loading = false), 500)
}
+6 -4
View File
@@ -158,7 +158,7 @@ import { useMessage } from "/@/hooks/message"
import { rule } from "/@/utils/validate"
import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
import { fetchList as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { getObj, addObj, putObj, getCanteenDailyMenuList } from "/@/api/canteen/canteenDailyMenu"
const emit = defineEmits(["refresh"])
@@ -339,10 +339,12 @@ const handleClickSelect = async () => {
selectObjs.value = [...selectedFood.value]
await getDataListAndSelect() // 获取菜品数据并且勾选表格行
// 获取菜品分类数据
// 获取菜品分类
try {
const res = await getCanteenCategory({ current: 1, size: 999999 })
categoryOptions.value = res.data.records
const res = await getCanteenCategory()
if (res.code === 0) {
categoryOptions.value = res.data
}
} catch (error) {
categoryOptions.value = []
}
+13 -9
View File
@@ -81,7 +81,7 @@
<script setup lang="ts" name="systemCanteenDailyMenu">
import { ElMessageBox } from "element-plus"
import { delObjs, selectTimeFoodApi, selectWeekInfo } from "/@/api/canteen/canteenDailyMenu"
import { fetchList } from "/@/api/canteen/canteenCategory"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { useMessage } from "/@/hooks/message"
import { pageJoin } from "/@/api/wallet/mch-manage"
import { displayPrice } from "/@/utils/formatMoney"
@@ -218,16 +218,20 @@ const merchantInit = async () => {
}
}
// 菜品分类
const canteenCategoryOption = ref<any>([])
// 获取菜品分类
const getCanteenCategory = async () => {
const res = await fetchList({ current: 1, size: 9999 })
if (res.code === 0) {
canteenCategoryOption.value = res.data.records
}
}
onMounted(async () => {
await getCanteenCategory()
try {
// 获取菜品分类
const res = await getCanteenCategory()
if (res.code === 0) {
canteenCategoryOption.value = res.data
}
} catch (error) {
canteenCategoryOption.value = []
}
await merchantInit()
})
</script>
+2 -2
View File
@@ -127,7 +127,7 @@ import { fetchList, delObjs } from "/@/api/canteen/canteenSpu"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { displayPrice } from "/@/utils/formatMoney"
import { fetchList as getCanteenCategory } from "/@/api/canteen/canteenCategory"
import { getAllSimple as getCanteenCategory } from "/@/api/canteen/canteenCategory"
// 引入组件
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
@@ -151,7 +151,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
onMounted(async () => {
try {
const res = await getCanteenCategory()
categoryOptions.value = res.data.records
categoryOptions.value = res.data
} catch (error) {
categoryOptions.value = []
}