|
@@ -14,6 +14,7 @@
|
|
|
:search-schema="searchSchema"
|
|
:search-schema="searchSchema"
|
|
|
:columns="tableColumns"
|
|
:columns="tableColumns"
|
|
|
:edit-schema="editSchema"
|
|
:edit-schema="editSchema"
|
|
|
|
|
+ :before-load-list="beforeLoadList"
|
|
|
:before-submit="beforeSubmit"
|
|
:before-submit="beforeSubmit"
|
|
|
:before-render-form="beforeRenderForm"
|
|
:before-render-form="beforeRenderForm"
|
|
|
:before-render-detail="beforeRenderDetail"
|
|
:before-render-detail="beforeRenderDetail"
|
|
@@ -287,7 +288,8 @@ const statusLabelMap = {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 搜索表单配置
|
|
// 搜索表单配置
|
|
|
-const searchSchema = [
|
|
|
|
|
|
|
+// 注意:必须定义为 computed,且分类 options 取 .value,确保分类异步加载完成后下拉选项响应式更新
|
|
|
|
|
+const searchSchema = computed(() => [
|
|
|
{
|
|
{
|
|
|
field: 'name',
|
|
field: 'name',
|
|
|
label: '菜品名称',
|
|
label: '菜品名称',
|
|
@@ -298,7 +300,18 @@ const searchSchema = [
|
|
|
field: 'categoryId',
|
|
field: 'categoryId',
|
|
|
label: '分类',
|
|
label: '分类',
|
|
|
type: 'select',
|
|
type: 'select',
|
|
|
- props: { placeholder: '请选择分类', options: categoryOptions },
|
|
|
|
|
|
|
+ props: { placeholder: '请选择分类', options: categoryOptions.value },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ field: 'mealType',
|
|
|
|
|
+ label: '适用餐段',
|
|
|
|
|
+ type: 'select',
|
|
|
|
|
+ props: {
|
|
|
|
|
+ placeholder: '请选择适用餐段',
|
|
|
|
|
+ options: mealTypeOptions,
|
|
|
|
|
+ multiple: true,
|
|
|
|
|
+ clearable: true,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
field: 'status',
|
|
field: 'status',
|
|
@@ -306,7 +319,15 @@ const searchSchema = [
|
|
|
type: 'select',
|
|
type: 'select',
|
|
|
props: { placeholder: '请选择状态', options: dishStatusOptions },
|
|
props: { placeholder: '请选择状态', options: dishStatusOptions },
|
|
|
},
|
|
},
|
|
|
-]
|
|
|
|
|
|
|
+])
|
|
|
|
|
+
|
|
|
|
|
+/** 加载列表前钩子:将餐段数组转为逗号分隔字符串,供后端 FIND_IN_SET 查询 */
|
|
|
|
|
+function beforeLoadList(params) {
|
|
|
|
|
+ if (Array.isArray(params.mealType) && params.mealType.length > 0) {
|
|
|
|
|
+ params.mealType = params.mealType.join(',')
|
|
|
|
|
+ }
|
|
|
|
|
+ return params
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// 表格列配置
|
|
// 表格列配置
|
|
|
const tableColumns = computed(() => [
|
|
const tableColumns = computed(() => [
|