|
|
@@ -1,361 +1,326 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
- <el-form-item label="配置标识,默认配置固定为default" prop="configKey">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.configKey"
|
|
|
- placeholder="请输入配置标识,默认配置固定为default"
|
|
|
- clearable
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="品牌标题/机器人名称" prop="robotName">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.robotName"
|
|
|
- placeholder="请输入品牌标题/机器人名称"
|
|
|
- clearable
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="品牌副标题" prop="brandSubtitle">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.brandSubtitle"
|
|
|
- placeholder="请输入品牌副标题"
|
|
|
- clearable
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="欢迎主标题" prop="welcomeTitle">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.welcomeTitle"
|
|
|
- placeholder="请输入欢迎主标题"
|
|
|
- clearable
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="欢迎副标题" prop="welcomeSubtitle">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.welcomeSubtitle"
|
|
|
- placeholder="请输入欢迎副标题"
|
|
|
- clearable
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="主按钮文案" prop="touchText">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.touchText"
|
|
|
- placeholder="请输入主按钮文案"
|
|
|
- clearable
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="主按钮颜色" prop="buttonColor">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.buttonColor"
|
|
|
- placeholder="请输入主按钮颜色"
|
|
|
- clearable
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="Plus"
|
|
|
- @click="handleAdd"
|
|
|
- v-hasPermi="['base:opsScreenThemeConfig:add']"
|
|
|
- >新增</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- plain
|
|
|
- icon="Edit"
|
|
|
- :disabled="single"
|
|
|
- @click="handleUpdate"
|
|
|
- v-hasPermi="['base:opsScreenThemeConfig:edit']"
|
|
|
- >修改</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- icon="Delete"
|
|
|
- :disabled="multiple"
|
|
|
- @click="handleDelete"
|
|
|
- v-hasPermi="['base:opsScreenThemeConfig:remove']"
|
|
|
- >删除</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="warning"
|
|
|
- plain
|
|
|
- icon="Download"
|
|
|
- @click="handleExport"
|
|
|
- v-hasPermi="['base:opsScreenThemeConfig:export']"
|
|
|
- >导出</el-button>
|
|
|
- </el-col>
|
|
|
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
- </el-row>
|
|
|
+ <div class="app-container theme-config-page">
|
|
|
+ <el-card class="theme-card" shadow="never">
|
|
|
+ <template #header>
|
|
|
+ <div>
|
|
|
+ <div class="page-title">展示主题配置</div>
|
|
|
+ <div class="page-desc">用于配置机器人屏幕待机页的品牌信息、背景图、欢迎文案和按钮样式。</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="opsScreenThemeConfigList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="主键ID" align="center" prop="id" />
|
|
|
- <el-table-column label="配置标识,默认配置固定为default" align="center" prop="configKey" />
|
|
|
- <el-table-column label="Logo图片地址" align="center" prop="logoUrl" />
|
|
|
- <el-table-column label="品牌标题/机器人名称" align="center" prop="robotName" />
|
|
|
- <el-table-column label="品牌副标题" align="center" prop="brandSubtitle" />
|
|
|
- <el-table-column label="待机页背景图地址" align="center" prop="backgroundImage" width="100">
|
|
|
- <template #default="scope">
|
|
|
- <image-preview :src="scope.row.backgroundImage" :width="50" :height="50"/>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="欢迎主标题" align="center" prop="welcomeTitle" />
|
|
|
- <el-table-column label="欢迎副标题" align="center" prop="welcomeSubtitle" />
|
|
|
- <el-table-column label="主按钮文案" align="center" prop="touchText" />
|
|
|
- <el-table-column label="主按钮颜色" align="center" prop="buttonColor" />
|
|
|
- <el-table-column label="备注" align="center" prop="remark" />
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
- <template #default="scope">
|
|
|
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['base:opsScreenThemeConfig:edit']">修改</el-button>
|
|
|
- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['base:opsScreenThemeConfig:remove']">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination
|
|
|
- v-show="total>0"
|
|
|
- :total="total"
|
|
|
- v-model:page="queryParams.pageNum"
|
|
|
- v-model:limit="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
+ <el-alert
|
|
|
+ v-if="!hasRemoteConfig"
|
|
|
+ title="当前未配置待机页主题,屏幕端将使用本地默认主题。如需自定义展示内容,请填写配置并保存。"
|
|
|
+ type="info"
|
|
|
+ :closable="false"
|
|
|
+ show-icon
|
|
|
+ class="mb16"
|
|
|
+ />
|
|
|
|
|
|
- <!-- 添加或修改展示主题配置对话框 -->
|
|
|
- <el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
|
|
- <el-form ref="opsScreenThemeConfigRef" :model="form" :rules="rules" label-width="100px">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="配置标识,默认配置固定为default" prop="configKey">
|
|
|
- <el-input v-model="form.configKey" placeholder="请输入配置标识,默认配置固定为default" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-form
|
|
|
+ ref="opsScreenThemeConfigRef"
|
|
|
+ :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="120px"
|
|
|
+ v-loading="loading"
|
|
|
+ >
|
|
|
+ <!-- 品牌信息 -->
|
|
|
+ <el-divider content-position="left">品牌信息</el-divider>
|
|
|
+ <el-row :gutter="20">
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="Logo图片地址" prop="logoUrl">
|
|
|
- <el-input v-model="form.logoUrl" type="textarea" placeholder="请输入内容" />
|
|
|
+ <el-form-item label="Logo 图片" prop="logoUrl">
|
|
|
+ <image-upload v-model="form.logoUrl" :limit="1" :file-size="0.2" />
|
|
|
+ <div class="form-tip">建议上传 png/jpg/jpeg 格式图片,大小不超过 200KB;未配置时屏幕端使用本地默认 Logo。</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="品牌标题/机器人名称" prop="robotName">
|
|
|
- <el-input v-model="form.robotName" placeholder="请输入品牌标题/机器人名称" />
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="品牌标题" prop="robotName">
|
|
|
+ <el-input v-model="form.robotName" placeholder="请输入品牌标题" maxlength="50" show-word-limit />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="品牌副标题" prop="brandSubtitle">
|
|
|
- <el-input v-model="form.brandSubtitle" placeholder="请输入品牌副标题" />
|
|
|
+ <el-input v-model="form.brandSubtitle" placeholder="请输入品牌副标题" maxlength="100" show-word-limit />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 背景设置 -->
|
|
|
+ <el-divider content-position="left">背景设置</el-divider>
|
|
|
+ <el-row :gutter="20">
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="待机页背景图地址" prop="backgroundImage">
|
|
|
- <image-upload v-model="form.backgroundImage"/>
|
|
|
+ <el-form-item label="背景图" prop="backgroundImage">
|
|
|
+ <image-upload v-model="form.backgroundImage" :limit="1" :file-size="2" />
|
|
|
+ <div class="form-tip">建议上传适配屏幕比例的横图,png/jpg/jpeg 格式,大小不超过 2MB;未配置时屏幕端使用本地默认背景。</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 欢迎文案 -->
|
|
|
+ <el-divider content-position="left">欢迎文案</el-divider>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="欢迎主标题" prop="welcomeTitle">
|
|
|
- <el-input v-model="form.welcomeTitle" placeholder="请输入欢迎主标题" />
|
|
|
+ <el-input v-model="form.welcomeTitle" placeholder="请输入欢迎主标题" maxlength="50" show-word-limit />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="欢迎副标题" prop="welcomeSubtitle">
|
|
|
- <el-input v-model="form.welcomeSubtitle" placeholder="请输入欢迎副标题" />
|
|
|
+ <el-input v-model="form.welcomeSubtitle" placeholder="请输入欢迎副标题" maxlength="150" show-word-limit />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="主按钮文案" prop="touchText">
|
|
|
- <el-input v-model="form.touchText" placeholder="请输入主按钮文案" />
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 按钮设置 -->
|
|
|
+ <el-divider content-position="left">按钮设置</el-divider>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="按钮文案" prop="touchText">
|
|
|
+ <el-input v-model="form.touchText" placeholder="请输入按钮文案" maxlength="50" show-word-limit />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="主按钮颜色" prop="buttonColor">
|
|
|
- <el-input v-model="form.buttonColor" placeholder="请输入主按钮颜色" />
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="按钮颜色" prop="buttonColor">
|
|
|
+ <div class="color-row">
|
|
|
+ <el-color-picker v-model="form.buttonColor" />
|
|
|
+ <el-input v-model="form.buttonColor" placeholder="#2f8ee5" class="color-input" />
|
|
|
+ <el-button @click="form.buttonColor = DEFAULT_FORM.buttonColor">默认蓝色</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="form-tip">按钮阴影颜色由屏幕端根据按钮颜色自动生成,不单独配置。</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 备注 -->
|
|
|
+ <el-divider content-position="left">备注</el-divider>
|
|
|
+ <el-row :gutter="20">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
+ <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" maxlength="500" show-word-limit :rows="3" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <div class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
+
|
|
|
+ <!-- 底部操作 -->
|
|
|
+ <div class="bottom-actions">
|
|
|
+ <el-button icon="Refresh" @click="handleRefresh">刷新</el-button>
|
|
|
+ <el-button icon="Delete" @click="handleClearConfig">清空配置</el-button>
|
|
|
+ <el-button type="primary" icon="Check" @click="submitForm">保存配置</el-button>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="OpsScreenThemeConfig">
|
|
|
-import { listOpsScreenThemeConfig, getOpsScreenThemeConfig, delOpsScreenThemeConfig, addOpsScreenThemeConfig, updateOpsScreenThemeConfig } from "@/api/base/opsScreenThemeConfig"
|
|
|
+import { listOpsScreenThemeConfig, addOpsScreenThemeConfig, updateOpsScreenThemeConfig, delOpsScreenThemeConfig } from '@/api/base/opsScreenThemeConfig'
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
|
-const opsScreenThemeConfigList = ref([])
|
|
|
-const open = ref(false)
|
|
|
-const loading = ref(true)
|
|
|
-const showSearch = ref(true)
|
|
|
-const ids = ref([])
|
|
|
-const single = ref(true)
|
|
|
-const multiple = ref(true)
|
|
|
-const total = ref(0)
|
|
|
-const title = ref("")
|
|
|
+const loading = ref(false)
|
|
|
+const hasRemoteConfig = ref(false)
|
|
|
|
|
|
-const data = reactive({
|
|
|
- form: {},
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- configKey: undefined,
|
|
|
- logoUrl: undefined,
|
|
|
- robotName: undefined,
|
|
|
- brandSubtitle: undefined,
|
|
|
- backgroundImage: undefined,
|
|
|
- welcomeTitle: undefined,
|
|
|
- welcomeSubtitle: undefined,
|
|
|
- touchText: undefined,
|
|
|
- buttonColor: undefined,
|
|
|
- },
|
|
|
- rules: {
|
|
|
- configKey: [
|
|
|
- { required: true, message: "配置标识,默认配置固定为default不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-const { queryParams, form, rules } = toRefs(data)
|
|
|
-
|
|
|
-/** 查询展示主题配置列表 */
|
|
|
-function getList() {
|
|
|
- loading.value = true
|
|
|
- listOpsScreenThemeConfig(queryParams.value).then(response => {
|
|
|
- opsScreenThemeConfigList.value = response.rows
|
|
|
- total.value = response.total
|
|
|
- loading.value = false
|
|
|
- })
|
|
|
+const DEFAULT_FORM = {
|
|
|
+ id: null,
|
|
|
+ configKey: 'default',
|
|
|
+ logoUrl: null,
|
|
|
+ robotName: null,
|
|
|
+ brandSubtitle: null,
|
|
|
+ backgroundImage: null,
|
|
|
+ welcomeTitle: null,
|
|
|
+ welcomeSubtitle: null,
|
|
|
+ touchText: null,
|
|
|
+ buttonColor: '#2f8ee5',
|
|
|
+ remark: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null
|
|
|
}
|
|
|
|
|
|
-/** 取消按钮 */
|
|
|
-function cancel() {
|
|
|
- open.value = false
|
|
|
- reset()
|
|
|
+const form = ref({ ...DEFAULT_FORM })
|
|
|
+
|
|
|
+const rules = {
|
|
|
+ robotName: [
|
|
|
+ { max: 50, message: '品牌标题不能超过 50 字', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ brandSubtitle: [
|
|
|
+ { max: 100, message: '品牌副标题不能超过 100 字', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ welcomeTitle: [
|
|
|
+ { max: 50, message: '欢迎主标题不能超过 50 字', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ welcomeSubtitle: [
|
|
|
+ { max: 150, message: '欢迎副标题不能超过 150 字', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ touchText: [
|
|
|
+ { max: 50, message: '按钮文案不能超过 50 字', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ buttonColor: [
|
|
|
+ { validator: validateColor, trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ remark: [
|
|
|
+ { max: 500, message: '备注不能超过 500 字', trigger: 'blur' }
|
|
|
+ ]
|
|
|
}
|
|
|
|
|
|
-/** 表单重置 */
|
|
|
-function reset() {
|
|
|
- form.value = {
|
|
|
- id: null,
|
|
|
- configKey: null,
|
|
|
- logoUrl: null,
|
|
|
- robotName: null,
|
|
|
- brandSubtitle: null,
|
|
|
- backgroundImage: null,
|
|
|
- welcomeTitle: null,
|
|
|
- welcomeSubtitle: null,
|
|
|
- touchText: null,
|
|
|
- buttonColor: null,
|
|
|
- remark: null,
|
|
|
- createBy: null,
|
|
|
- createTime: null,
|
|
|
- updateBy: null,
|
|
|
- updateTime: null
|
|
|
+function validateColor(rule, value, callback) {
|
|
|
+ if (!value) {
|
|
|
+ callback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const reg = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/
|
|
|
+ if (!reg.test(value)) {
|
|
|
+ callback(new Error('按钮颜色格式不正确,请输入类似 #2f8ee5 的颜色值'))
|
|
|
+ return
|
|
|
}
|
|
|
- proxy.resetForm("opsScreenThemeConfigRef")
|
|
|
+ callback()
|
|
|
}
|
|
|
|
|
|
-/** 搜索按钮操作 */
|
|
|
-function handleQuery() {
|
|
|
- queryParams.value.pageNum = 1
|
|
|
- getList()
|
|
|
+/** 加载配置 */
|
|
|
+function loadConfig(showSuccess = false) {
|
|
|
+ loading.value = true
|
|
|
+ listOpsScreenThemeConfig({ configKey: 'default', pageNum: 1, pageSize: 1 }).then(response => {
|
|
|
+ const rows = response.rows || []
|
|
|
+ if (rows.length > 0) {
|
|
|
+ form.value = normalizeConfig(rows[0])
|
|
|
+ hasRemoteConfig.value = true
|
|
|
+ } else {
|
|
|
+ form.value = { ...DEFAULT_FORM }
|
|
|
+ hasRemoteConfig.value = false
|
|
|
+ }
|
|
|
+ if (showSuccess) {
|
|
|
+ proxy.$modal.msgSuccess('刷新成功')
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ form.value = { ...DEFAULT_FORM }
|
|
|
+ hasRemoteConfig.value = false
|
|
|
+ if (showSuccess) {
|
|
|
+ proxy.$modal.msgError('刷新失败,已显示空配置表单')
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ loading.value = false
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
-/** 重置按钮操作 */
|
|
|
-function resetQuery() {
|
|
|
- proxy.resetForm("queryRef")
|
|
|
- handleQuery()
|
|
|
+function normalizeConfig(config) {
|
|
|
+ return {
|
|
|
+ ...DEFAULT_FORM,
|
|
|
+ ...(config || {}),
|
|
|
+ configKey: 'default'
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-/** 多选框选中数据 */
|
|
|
-function handleSelectionChange(selection) {
|
|
|
- ids.value = selection.map(item => item.id)
|
|
|
- single.value = selection.length != 1
|
|
|
- multiple.value = !selection.length
|
|
|
+/** 刷新 */
|
|
|
+function handleRefresh() {
|
|
|
+ loadConfig(true)
|
|
|
}
|
|
|
|
|
|
-/** 新增按钮操作 */
|
|
|
-function handleAdd() {
|
|
|
- reset()
|
|
|
- open.value = true
|
|
|
- title.value = "添加展示主题配置"
|
|
|
+/** 清空配置 */
|
|
|
+function handleClearConfig() {
|
|
|
+ if (!form.value.id) {
|
|
|
+ form.value = { ...DEFAULT_FORM }
|
|
|
+ hasRemoteConfig.value = false
|
|
|
+ proxy.$modal.msgSuccess('当前未配置待机页主题,屏幕端将使用本地默认主题')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ proxy.$modal.confirm('确认清空配置吗?该操作将删除当前运维端主题配置,删除后屏幕端将使用本地默认主题。').then(() => {
|
|
|
+ return delOpsScreenThemeConfig(form.value.id)
|
|
|
+ }).then(() => {
|
|
|
+ proxy.$modal.msgSuccess('已清空配置,屏幕端将使用本地默认主题')
|
|
|
+ form.value = { ...DEFAULT_FORM }
|
|
|
+ hasRemoteConfig.value = false
|
|
|
+ }).catch(() => {})
|
|
|
}
|
|
|
|
|
|
-/** 修改按钮操作 */
|
|
|
-function handleUpdate(row) {
|
|
|
- reset()
|
|
|
- const _id = row.id || ids.value
|
|
|
- getOpsScreenThemeConfig(_id).then(response => {
|
|
|
- form.value = response.data
|
|
|
- open.value = true
|
|
|
- title.value = "修改展示主题配置"
|
|
|
+/** 保存配置 */
|
|
|
+function normalizePayload(data) {
|
|
|
+ const payload = {
|
|
|
+ ...data,
|
|
|
+ configKey: 'default'
|
|
|
+ }
|
|
|
+ const stringFields = [
|
|
|
+ 'logoUrl',
|
|
|
+ 'robotName',
|
|
|
+ 'brandSubtitle',
|
|
|
+ 'backgroundImage',
|
|
|
+ 'welcomeTitle',
|
|
|
+ 'welcomeSubtitle',
|
|
|
+ 'touchText',
|
|
|
+ 'buttonColor',
|
|
|
+ 'remark'
|
|
|
+ ]
|
|
|
+ stringFields.forEach(key => {
|
|
|
+ if (typeof payload[key] === 'string') {
|
|
|
+ const value = payload[key].trim()
|
|
|
+ payload[key] = value === '' ? null : value
|
|
|
+ }
|
|
|
})
|
|
|
+ if (!payload.buttonColor) {
|
|
|
+ payload.buttonColor = DEFAULT_FORM.buttonColor
|
|
|
+ }
|
|
|
+ return payload
|
|
|
}
|
|
|
|
|
|
-/** 提交按钮 */
|
|
|
function submitForm() {
|
|
|
- proxy.$refs["opsScreenThemeConfigRef"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (form.value.id != null) {
|
|
|
- updateOpsScreenThemeConfig(form.value).then(() => {
|
|
|
- proxy.$modal.msgSuccess("修改成功")
|
|
|
- open.value = false
|
|
|
- getList()
|
|
|
- })
|
|
|
- } else {
|
|
|
- addOpsScreenThemeConfig(form.value).then(() => {
|
|
|
- proxy.$modal.msgSuccess("新增成功")
|
|
|
- open.value = false
|
|
|
- getList()
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ proxy.$refs.opsScreenThemeConfigRef.validate(valid => {
|
|
|
+ if (!valid) return
|
|
|
+ const payload = normalizePayload(form.value)
|
|
|
+ const request = payload.id ? updateOpsScreenThemeConfig(payload) : addOpsScreenThemeConfig(payload)
|
|
|
+ request.then(() => {
|
|
|
+ proxy.$modal.msgSuccess('保存成功')
|
|
|
+ loadConfig()
|
|
|
+ }).catch(() => {
|
|
|
+ proxy.$modal.msgError('保存失败,请稍后重试')
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-/** 删除按钮操作 */
|
|
|
-function handleDelete(row) {
|
|
|
- const _ids = row.id || ids.value
|
|
|
- proxy.$modal.confirm('是否确认删除展示主题配置编号为"' + _ids + '"的数据项?').then(function() {
|
|
|
- return delOpsScreenThemeConfig(_ids)
|
|
|
- }).then(() => {
|
|
|
- getList()
|
|
|
- proxy.$modal.msgSuccess("删除成功")
|
|
|
- }).catch(() => {})
|
|
|
-}
|
|
|
+onMounted(() => {
|
|
|
+ loadConfig()
|
|
|
+})
|
|
|
+</script>
|
|
|
|
|
|
-/** 导出按钮操作 */
|
|
|
-function handleExport() {
|
|
|
- proxy.download('base/opsScreenThemeConfig/export', {
|
|
|
- ...queryParams.value
|
|
|
- }, `opsScreenThemeConfig_${new Date().getTime()}.xlsx`)
|
|
|
+<style scoped>
|
|
|
+.theme-config-page {
|
|
|
+ min-height: calc(100vh - 84px);
|
|
|
}
|
|
|
-
|
|
|
-getList()
|
|
|
-</script>
|
|
|
+.theme-card {
|
|
|
+ max-width: 1100px;
|
|
|
+}
|
|
|
+.page-title {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #303133;
|
|
|
+}
|
|
|
+.page-desc {
|
|
|
+ margin-top: 6px;
|
|
|
+ font-size: 13px;
|
|
|
+ color: #909399;
|
|
|
+}
|
|
|
+.mb16 {
|
|
|
+ margin-bottom: 16px;
|
|
|
+}
|
|
|
+.form-tip {
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 4px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #909399;
|
|
|
+ line-height: 1.5;
|
|
|
+}
|
|
|
+.color-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 10px;
|
|
|
+}
|
|
|
+.color-input {
|
|
|
+ width: 130px;
|
|
|
+}
|
|
|
+.bottom-actions {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ gap: 10px;
|
|
|
+ padding-top: 18px;
|
|
|
+ border-top: 1px solid #ebeef5;
|
|
|
+}
|
|
|
+</style>
|