Merge branch 'master' of https://gitea.zianxin.com/zax/biz-pc-cloud
This commit is contained in:
commit
af636ecea4
7 files changed
+242
-14
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function getSetting() {
|
||||
return request({
|
||||
url: "/hard/hardPanelSetting/setting",
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
export function saveOrUpdate(obj?: Object) {
|
||||
return request({
|
||||
url: "/hard/hardPanelSetting",
|
||||
method: "post",
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
@@ -1,16 +1,7 @@
|
||||
<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-select style="width: 100%" v-model="state.selectId" :placeholder="props.placeholder" clearable
|
||||
:multiple="props.multiple" 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>
|
||||
@@ -32,6 +23,7 @@ const selectId = defineModel()
|
||||
|
||||
export type Props = {
|
||||
placeholder?: string
|
||||
multiple?: boolean
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
@@ -43,6 +35,7 @@ const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: [],
|
||||
multiple: false,
|
||||
})
|
||||
|
||||
watch(
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import Cookies from "js-cookie"
|
||||
|
||||
/**
|
||||
* 打开大屏地址
|
||||
* @param url 大屏地址
|
||||
*/
|
||||
export const openPlanUrl = (url: string, replaceCurrentPage = false): boolean => {
|
||||
try {
|
||||
const token = Cookies.get("token")
|
||||
const refreshToken = Cookies.get("refresh_token")
|
||||
if (!token || !refreshToken) {
|
||||
throw new Error()
|
||||
}
|
||||
if (url == null) throw new Error()
|
||||
const fullUrl = `${url}?token=${token}&refresh_token=${refreshToken}`
|
||||
const target = replaceCurrentPage ? "_self" : "_blank"
|
||||
window.open(fullUrl, target)
|
||||
return true
|
||||
} catch (error: any) {
|
||||
console.log("打开大屏地址错误:", error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,9 @@
|
||||
value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn")
|
||||
}}</el-button>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">
|
||||
{{ $t("common.queryBtn") }}
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div class="layout-padding" v-loading="loading">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="panel">
|
||||
import { openPlanUrl } from "/@/utils/plan"
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
openPlanUrl("http://localhost:5173/#/canteen")
|
||||
loading.value = true
|
||||
router.back()
|
||||
} catch (error: any) {
|
||||
console.log("打开大屏地址错误:", error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="180px"
|
||||
v-loading="state.loading">
|
||||
<!-- **************************** start 喜爱菜品排行 start **************************** -->
|
||||
<el-divider class="my-12">喜爱菜品排行配置</el-divider>
|
||||
<el-form-item prop="cleaningData.carGap">
|
||||
<template #label>
|
||||
<div class="flex items-center gap-1">
|
||||
<span>需要排除的菜品分类</span>
|
||||
</div>
|
||||
</template>
|
||||
<select-ctcg v-model="form.nutritionSetting.topExcludeCategoryIds" multiple placeholder="请选择需要排除的菜品分类" />
|
||||
</el-form-item>
|
||||
<!-- **************************** end 同步间隔配置 end **************************** -->
|
||||
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="cleaningData">
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as hardPanelSetting from "/@/api/hard/hard-panel-setting"
|
||||
|
||||
const dataFormRef = ref();
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: false,
|
||||
})
|
||||
|
||||
const form = reactive<any>({
|
||||
// 营养分析配置
|
||||
nutritionSetting: {
|
||||
// 喜爱菜品排行需要排除的菜品分类
|
||||
topExcludeCategoryIds: [],
|
||||
},
|
||||
})
|
||||
|
||||
const dataRules = ref({
|
||||
// 车辆考勤配置
|
||||
"nutritionSetting.topExcludeCategoryIds": [{ required: true, message: '喜爱菜品排行需要排除的菜品分类不能为空', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getSetting()
|
||||
})
|
||||
|
||||
async function getSetting() {
|
||||
state.loading = true
|
||||
try {
|
||||
const { data } = await hardPanelSetting.getSetting()
|
||||
if (!data.nutritionSetting) {
|
||||
data.nutritionSetting = {
|
||||
topExcludeCategoryIds: [],
|
||||
}
|
||||
}
|
||||
if (data) {
|
||||
Object.assign(form, data)
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
state.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
state.loading = true
|
||||
try {
|
||||
const _form = {
|
||||
...form,
|
||||
}
|
||||
await hardPanelSetting.saveOrUpdate(_form)
|
||||
useMessage().success('修改成功');
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
state.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
getSetting,
|
||||
onSubmit
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view flex flex-col">
|
||||
<el-tabs v-model="state.currentTab" class="demo-tabs" @tab-click="tabClick">
|
||||
<el-tab-pane v-for="(v) in data.tabs" :key="v.name" :label="v.label" :name="v.name" />
|
||||
</el-tabs>
|
||||
<div class="flex-1 overflow-y-scroll px-8">
|
||||
<div class="w-full" v-if="state.currentTab === 'CANTEEN'">
|
||||
</div>
|
||||
|
||||
<div class="w-full" v-if="state.currentTab === 'SHOP'">
|
||||
</div>
|
||||
|
||||
<div class="w-full" v-if="state.currentTab === 'SERVICE'">
|
||||
</div>
|
||||
|
||||
<div class="w-full" v-if="state.currentTab === 'NUTRITION'">
|
||||
<NutritionSetting ref="nutritionSettingRef" />
|
||||
</div>
|
||||
|
||||
<div class="h-20" />
|
||||
</div>
|
||||
<div class="flex justify-center">
|
||||
<el-button type="primary" @click="onSubmit">保存配置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="deviceLog">
|
||||
const NutritionSetting = defineAsyncComponent(() => import("./components/nutrition-setting.vue"));
|
||||
|
||||
const data = {
|
||||
tabs: [
|
||||
{
|
||||
label: "智慧食堂",
|
||||
name: "CANTEEN",
|
||||
},
|
||||
{
|
||||
label: "智慧超市",
|
||||
name: "SHOP",
|
||||
},
|
||||
{
|
||||
label: "智慧服务",
|
||||
name: "SERVICE",
|
||||
},
|
||||
{
|
||||
label: "营养分析",
|
||||
name: "NUTRITION",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
const nutritionSettingRef = ref()
|
||||
|
||||
const state = reactive<any>({
|
||||
currentTab: data.tabs[0].name,
|
||||
})
|
||||
|
||||
function tabClick(e: any) {
|
||||
console.log("tabClick", e);
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
if (state.currentTab == "CANTEEN") {
|
||||
return
|
||||
}
|
||||
if (state.currentTab == "SHOP") {
|
||||
return
|
||||
}
|
||||
if (state.currentTab == "SERVICE") {
|
||||
return
|
||||
}
|
||||
if (state.currentTab == "NUTRITION") {
|
||||
nutritionSettingRef.value.onSubmit()
|
||||
return
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user