修改每日菜谱问题和调整首页布局以及移除不必要的导入

This commit is contained in:
ctw committed 2025-01-17 14:15:01 +08:00
1 parent 611f1d634d
commit 373de198e4
11 files changed
+200 -159

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@
</template>
<script setup lang="ts" name="select-merchant">
import { reactive, computed, defineModel, withDefaults, defineProps } from "vue"
import { reactive } from "vue"
import { fetchList as getCanteenCategory } from "/@/api/canteen/canteenCategory"
const selectId = defineModel()
+1 -1
View File
@@ -25,7 +25,7 @@
</template>
<script setup lang="ts" name="select-merchant">
import { reactive, computed, defineModel, withDefaults, defineProps } from "vue"
import { reactive } from "vue"
import * as cocApi from "/@/api/canteen/canteenOnlineCategory"
const selectId = defineModel()
+54 -43
View File
@@ -1,73 +1,84 @@
<template>
<el-tree-select class="w100" v-model="state.selectId" :data="state.options"
@visible-change="(e: boolean) => e && getOptions()"
:props="{ value: 'id', label: 'name', children: 'children' }" clearable check-strictly
:render-after-expand="false" :placeholder="props.placeholder" />
<el-tree-select
class="w100"
v-model="state.selectId"
:data="state.options"
@visible-change="(e: boolean) => e && getOptions()"
:props="{ value: 'id', label: 'name', children: 'children' }"
clearable
check-strictly
:render-after-expand="false"
:placeholder="props.placeholder"
/>
</template>
<script setup lang="ts" name="select-dept">
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue'
import * as deptApi from "/@/api/admin/dept";
import { reactive } from "vue"
import * as deptApi from "/@/api/admin/dept"
const selectId = defineModel()
export type Props = {
placeholder?: string,
placeholder?: string
}
const props = withDefaults(defineProps<Props>(), {
placeholder: "请选择",
placeholder: "请选择",
})
const queryForm = reactive<any>({
name: "",
current: 1,
size: 10,
name: "",
current: 1,
size: 10,
})
const state = reactive<any>({
loading: true,
selectId: selectId,
options: []
loading: true,
selectId: selectId,
options: [],
})
watch(selectId, (newVal, oldValue) => {
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
}, { immediate: true })
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
},
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true
const _pa = {
...queryForm
}
const { data } = await deptApi.deptTree(_pa)
state.options = data ?? []
} finally {
setTimeout(() => state.loading = false, 500);
}
try {
state.loading = true
const _pa = {
...queryForm,
}
const { data } = await deptApi.deptTree(_pa)
state.options = data ?? []
} finally {
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params
getOptions()
}
if (params != queryForm.name) {
queryForm.name = params
getOptions()
}
}
function filterTreeData(treeData: Array<any>) {
return treeData.filter(item => {
if (item.children && item.children.length) {
item.disabled = true;
item.children = filterTreeData(item.children)
}
return item
})
return treeData.filter((item) => {
if (item.children && item.children.length) {
item.disabled = true
item.children = filterTreeData(item.children)
}
return item
})
}
function clear() {
state.selectId = null
getOptions()
state.selectId = null
getOptions()
}
</script>
</script>
+1 -1
View File
@@ -25,7 +25,7 @@
</template>
<script setup lang="ts" name="select-merchant">
import { reactive, defineModel, withDefaults, defineProps } from "vue"
import { reactive } from "vue"
import * as mchApi from "/@/api/wallet/mch-manage"
const selectId = defineModel()
+1 -1
View File
@@ -21,7 +21,7 @@
</template>
<script setup lang="ts" name="select-user">
import { reactive, computed, defineModel, withDefaults, defineProps } from "vue"
import { reactive } from "vue"
import * as userApi from "/@/api/admin/user"
const selectId = defineModel()
+63 -51
View File
@@ -1,79 +1,91 @@
<template>
<el-select style="width: 100%;" v-model="state.selectId" :placeholder="props.placeholder" clearable
remote-show-suffix filterable remote :remote-method="remoteSearch" :loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()">
<el-option v-for="v in state.options" :key="v.id" :label="`${v.name}`" :value="v.id">
<div class="flex items-center">
<div class="color-primary">{{ v.name }}</div>
<div class="flex items-center just ml5">
<el-tag size="small">
{{ state.walletType.find((i: any) => i.value == v.uniqueCode)?.label }}
</el-tag>
</div>
</div>
</el-option>
</el-select>
<el-select
style="width: 100%"
v-model="state.selectId"
:placeholder="props.placeholder"
clearable
remote-show-suffix
filterable
remote
:remote-method="remoteSearch"
:loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()"
>
<el-option v-for="v in state.options" :key="v.id" :label="`${v.name}`" :value="v.id">
<div class="flex items-center">
<div class="color-primary">{{ v.name }}</div>
<div class="flex items-center just ml5">
<el-tag size="small">
{{ state.walletType.find((i: any) => i.value == v.uniqueCode)?.label }}
</el-tag>
</div>
</div>
</el-option>
</el-select>
</template>
<script setup lang="ts" name="select-wallet-type">
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue'
import * as walletTypeApi from '/@/api/wallet/wallet-type'
import { useDict } from '/@/hooks/dict'
import { reactive } from "vue"
import * as walletTypeApi from "/@/api/wallet/wallet-type"
import { useDict } from "/@/hooks/dict"
const selectId = defineModel()
export type Props = {
placeholder?: string,
placeholder?: string
}
const props = withDefaults(defineProps<Props>(), {
placeholder: "请选择",
placeholder: "请选择",
})
const queryForm = reactive<any>({
name: "",
current: 1,
size: 10,
name: "",
current: 1,
size: 10,
})
const state = reactive<any>({
loading: true,
selectId: selectId,
options: [],
walletType: []
loading: true,
selectId: selectId,
options: [],
walletType: [],
})
watch(selectId, (newVal, oldValue) => {
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
}, { immediate: true })
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
},
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true
const _pa = {
...queryForm
}
const { data } = await walletTypeApi.fetchList(_pa)
state.options = data.records ?? []
try {
state.loading = true
const _pa = {
...queryForm,
}
const { data } = await walletTypeApi.fetchList(_pa)
state.options = data.records ?? []
const { wallet_type } = useDict('wallet_type')
state.walletType = wallet_type
} finally {
setTimeout(() => state.loading = false, 500);
}
const { wallet_type } = useDict("wallet_type")
state.walletType = wallet_type
} finally {
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params
getOptions()
}
if (params != queryForm.name) {
queryForm.name = params
getOptions()
}
}
function clear() {
state.selectId = null
getOptions()
state.selectId = null
getOptions()
}
</script>
</script>
+1 -1
View File
@@ -20,7 +20,7 @@
</template>
<script setup lang="ts" name="select-hard-group">
import { reactive, defineModel, withDefaults, defineProps } from "vue"
import { reactive } from "vue"
import * as hardGroup from "/@/api/hard/hard-group"
const selectId = defineModel()