修改每日菜谱

This commit is contained in:
ctw committed 2025-01-12 21:51:34 +08:00
1 parent 002f8ad6b1
commit 33d90c45b0
8 files changed
+408 -328

No files matched your search

+24 -24
View File
@@ -25,61 +25,61 @@
</template>
<script setup lang="ts" name="select-merchant">
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue';
import * as cocApi from '/@/api/canteen/canteenOnlineCategory';
import { reactive, computed, defineModel, withDefaults, defineProps } from "vue"
import { fetchList as getCanteenCategory } from "/@/api/canteen/canteenCategory"
const selectId = defineModel();
const selectId = defineModel()
export type Props = {
placeholder?: string;
};
placeholder?: string
}
const props = withDefaults(defineProps<Props>(), {
placeholder: '请选择',
});
placeholder: "请选择",
})
const queryForm = reactive<any>({
current: 1,
size: 10,
});
size: 9999,
})
const state = reactive<any>({
loading: true,
selectId: selectId,
options: [],
});
})
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return;
state.selectId = newVal;
getOptions();
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
},
{ immediate: true }
);
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true;
state.loading = true
const _pa = {
...queryForm,
};
const { data } = await cocApi.fetchList(_pa);
state.options = data.records ?? [];
}
const { data } = await getCanteenCategory(_pa)
state.options = data.records ?? []
} finally {
setTimeout(() => (state.loading = false), 500);
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params;
getOptions();
queryForm.name = params
getOptions()
}
}
function clear() {
state.selectId = null;
getOptions();
state.selectId = null
getOptions()
}
</script>
@@ -25,61 +25,61 @@
</template>
<script setup lang="ts" name="select-merchant">
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue';
import { fetchList as getCanteenCategory } from '/@/api/canteen/canteenCategory';
import { reactive, computed, defineModel, withDefaults, defineProps } from "vue"
import * as cocApi from "/@/api/canteen/canteenOnlineCategory"
const selectId = defineModel();
const selectId = defineModel()
export type Props = {
placeholder?: string;
};
placeholder?: string
}
const props = withDefaults(defineProps<Props>(), {
placeholder: '请选择',
});
placeholder: "请选择",
})
const queryForm = reactive<any>({
current: 1,
size: 9999,
});
size: 10,
})
const state = reactive<any>({
loading: true,
selectId: selectId,
options: [],
});
})
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return;
state.selectId = newVal;
getOptions();
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
},
{ immediate: true }
);
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true;
state.loading = true
const _pa = {
...queryForm,
};
const { data } = await getCanteenCategory(_pa);
state.options = data.records ?? [];
}
const { data } = await cocApi.fetchList(_pa)
state.options = data.records ?? []
} finally {
setTimeout(() => (state.loading = false), 500);
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params;
getOptions();
queryForm.name = params
getOptions()
}
}
function clear() {
state.selectId = null;
getOptions();
state.selectId = null
getOptions()
}
</script>