|
|
@@ -2,157 +2,292 @@
|
|
|
<div class="p-2">
|
|
|
<el-card shadow="hover">
|
|
|
<template #header>
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:platformConfig:add']">新增</el-button>
|
|
|
+ <div class="card-header">
|
|
|
+ <span class="title">平台基本信息管理</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-form ref="formRef" :model="form" :rules="rules" label-width="100px" v-loading="loading">
|
|
|
+ <!-- 平台名称 -->
|
|
|
+ <el-form-item label="平台名称" prop="platformName">
|
|
|
+ <el-input v-model="form.platformName" placeholder="请输入平台名称" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 第一行:所属公司、平台简称、站点域名 -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="所属公司" prop="company">
|
|
|
+ <el-input v-model="form.company" placeholder="请输入所属公司" />
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:platformConfig:remove']">删除</el-button>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="平台简称" prop="shortName">
|
|
|
+ <el-input v-model="form.shortName" placeholder="请输入平台简称" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="站点域名" prop="domain">
|
|
|
+ <el-input v-model="form.domain" placeholder="请输入站点域名" />
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- </template>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="配置键" prop="configKey" />
|
|
|
- <el-table-column label="配置名称" prop="name" />
|
|
|
- <el-table-column label="配置值" prop="value" show-overflow-tooltip />
|
|
|
- <el-table-column label="操作" width="150" align="center">
|
|
|
- <template #default="scope">
|
|
|
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:platformConfig:edit']">修改</el-button>
|
|
|
- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:platformConfig: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-card>
|
|
|
+ <!-- 第二行:ICP证书号、经营许可证、客服邮箱 -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="ICP证书号" prop="icpNo">
|
|
|
+ <el-input v-model="form.icpNo" placeholder="请输入ICP证书号" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="经营许可证" prop="license">
|
|
|
+ <el-input v-model="form.license" placeholder="请输入经营许可证">
|
|
|
+ <template #suffix>
|
|
|
+ <el-tooltip content="经营许可证编号" placement="top">
|
|
|
+ <el-icon><QuestionFilled /></el-icon>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客服邮箱" prop="serviceEmail">
|
|
|
+ <el-input v-model="form.serviceEmail" placeholder="请输入客服邮箱" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 第三行:客服时间、客服图标、客服链接 -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客服时间" prop="serviceTime">
|
|
|
+ <el-input v-model="form.serviceTime" placeholder="如:08:30-20:00" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客服图标" prop="serviceIcon">
|
|
|
+ <el-radio-group v-model="form.serviceIcon">
|
|
|
+ <el-radio value="code">code</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客服链接" prop="serviceLink">
|
|
|
+ <el-input v-model="form.serviceLink" placeholder="请输入客服链接" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
|
|
|
- <!-- 添加或修改对话框 -->
|
|
|
- <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
|
|
- <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
|
- <el-form-item label="配置键" prop="configKey">
|
|
|
- <el-input v-model="form.configKey" placeholder="请输入配置键" />
|
|
|
+ <!-- 第四行:反馈图标、反馈链接、公众号图标 -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="反馈图标" prop="feedbackIcon">
|
|
|
+ <el-radio-group v-model="form.feedbackIcon">
|
|
|
+ <el-radio value="dashboard">dashboard</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="反馈链接" prop="feedbackLink">
|
|
|
+ <el-input v-model="form.feedbackLink" placeholder="请输入在线反馈链接" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="公众号图标" prop="wechatIcon">
|
|
|
+ <el-radio-group v-model="form.wechatIcon">
|
|
|
+ <el-radio value="color">color</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 第五行:公众号链接、微博图标、微博链接 -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="公众号链接" prop="wechatLink">
|
|
|
+ <el-input v-model="form.wechatLink" placeholder="请输入公众号链接" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="微博图标" prop="weiboIcon">
|
|
|
+ <el-radio-group v-model="form.weiboIcon">
|
|
|
+ <el-radio value="radio">radio</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="微博链接" prop="weiboLink">
|
|
|
+ <el-input v-model="form.weiboLink" placeholder="请输入微博链接" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 客服热线 -->
|
|
|
+ <el-form-item label="客服热线" prop="servicePhone">
|
|
|
+ <el-input v-model="form.servicePhone" placeholder="请输入客服热线" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="配置名称" prop="name">
|
|
|
- <el-input v-model="form.name" placeholder="请输入配置名称" />
|
|
|
+
|
|
|
+ <!-- 详细页标题 -->
|
|
|
+ <el-form-item label="详细页标题" prop="detailTitle">
|
|
|
+ <el-input v-model="form.detailTitle" type="textarea" :rows="2" placeholder="请输入详细页标题">
|
|
|
+ <template #suffix>
|
|
|
+ <el-tooltip content="详细页标题说明" placement="top">
|
|
|
+ <el-icon><QuestionFilled /></el-icon>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="配置值" prop="value">
|
|
|
- <el-input v-model="form.value" type="textarea" placeholder="请输入配置值" />
|
|
|
+
|
|
|
+ <!-- 商品关键词 -->
|
|
|
+ <el-form-item label="商品关键词" prop="keywords">
|
|
|
+ <el-input v-model="form.keywords" type="textarea" :rows="2" placeholder="请输入商品关键词">
|
|
|
+ <template #suffix>
|
|
|
+ <el-tooltip content="商品关键词说明" placement="top">
|
|
|
+ <el-icon><QuestionFilled /></el-icon>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 图片上传:平台LOGO、平台图标、默认头像 -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="平台LOGO" prop="logo">
|
|
|
+ <image-upload v-model="form.logo" :limit="1" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="平台图标" prop="icon">
|
|
|
+ <image-upload v-model="form.icon" :limit="1" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="默认头像" prop="defaultAvatar">
|
|
|
+ <image-upload v-model="form.defaultAvatar" :limit="1" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 小程序二维码 -->
|
|
|
+ <el-form-item label="小程序二维码" prop="miniQrcode">
|
|
|
+ <image-upload v-model="form.miniQrcode" :limit="1" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 内容 -->
|
|
|
+ <el-form-item label="内容" prop="content">
|
|
|
+ <el-input v-model="form.content" type="textarea" :rows="3" placeholder="请输入内容" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 详细页描述 -->
|
|
|
+ <el-form-item label="详细页描述" prop="detailDesc">
|
|
|
+ <el-input v-model="form.detailDesc" type="textarea" :rows="3" placeholder="请输入详细页描述" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 提交按钮 -->
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="submitForm" v-hasPermi="['system:platformConfig:edit']">提交</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <template #footer>
|
|
|
- <div class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
+ </el-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="BasicSetting" lang="ts">
|
|
|
-import { listPlatformConfig, getPlatformConfig, addPlatformConfig, updatePlatformConfig, delPlatformConfig } from '@/api/system/platformConfig';
|
|
|
-import { ComponentInternalInstance, getCurrentInstance, ref, reactive, toRefs } from 'vue';
|
|
|
-import { ElForm } from 'element-plus';
|
|
|
+import { listPlatformConfig, saveBatchPlatformConfig } from '@/api/system/platformConfig';
|
|
|
+import { ComponentInternalInstance, getCurrentInstance, ref, reactive, toRefs, onMounted } from 'vue';
|
|
|
+import type { FormInstance } from 'element-plus';
|
|
|
+import { QuestionFilled } from '@element-plus/icons-vue';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
-const dataList = ref([]);
|
|
|
const loading = ref(true);
|
|
|
-const ids = ref<Array<number | string>>([]);
|
|
|
-const single = ref(true);
|
|
|
-const multiple = ref(true);
|
|
|
-const total = ref(0);
|
|
|
-
|
|
|
-const formRef = ref(ElForm);
|
|
|
-
|
|
|
-const dialog = reactive({ visible: false, title: '' });
|
|
|
+const formRef = ref<FormInstance>();
|
|
|
+const configList = ref<any[]>([]);
|
|
|
|
|
|
const data = reactive({
|
|
|
- form: {} as any,
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- configType: '0'
|
|
|
- },
|
|
|
+ form: {
|
|
|
+ platformName: '',
|
|
|
+ company: '',
|
|
|
+ shortName: '',
|
|
|
+ domain: '',
|
|
|
+ icpNo: '',
|
|
|
+ license: '',
|
|
|
+ serviceEmail: '',
|
|
|
+ serviceTime: '',
|
|
|
+ serviceIcon: 'code',
|
|
|
+ serviceLink: '',
|
|
|
+ feedbackIcon: 'dashboard',
|
|
|
+ feedbackLink: '',
|
|
|
+ wechatIcon: 'color',
|
|
|
+ wechatLink: '',
|
|
|
+ weiboIcon: 'radio',
|
|
|
+ weiboLink: '',
|
|
|
+ servicePhone: '',
|
|
|
+ detailTitle: '',
|
|
|
+ keywords: '',
|
|
|
+ logo: '',
|
|
|
+ icon: '',
|
|
|
+ defaultAvatar: '',
|
|
|
+ miniQrcode: '',
|
|
|
+ content: '',
|
|
|
+ detailDesc: ''
|
|
|
+ } as any,
|
|
|
rules: {
|
|
|
- configKey: [{ required: true, message: '配置键不能为空', trigger: 'blur' }],
|
|
|
- name: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
|
|
|
- value: [{ required: true, message: '配置值不能为空', trigger: 'blur' }]
|
|
|
+ platformName: [{ required: true, message: '平台名称不能为空', trigger: 'blur' }],
|
|
|
+ servicePhone: [{ required: true, message: '客服热线不能为空', trigger: 'blur' }]
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-const { queryParams, form, rules } = toRefs(data);
|
|
|
+const { form, rules } = toRefs(data);
|
|
|
|
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
|
- const res = await listPlatformConfig(queryParams.value);
|
|
|
- dataList.value = res.rows;
|
|
|
- total.value = res.total;
|
|
|
- loading.value = false;
|
|
|
-};
|
|
|
-
|
|
|
-const handleSelectionChange = (selection: any[]) => {
|
|
|
- ids.value = selection.map(item => item.id);
|
|
|
- single.value = selection.length !== 1;
|
|
|
- multiple.value = !selection.length;
|
|
|
-};
|
|
|
-
|
|
|
-const reset = () => {
|
|
|
- form.value = {
|
|
|
- id: undefined,
|
|
|
- configType: '0',
|
|
|
- configKey: undefined,
|
|
|
- name: undefined,
|
|
|
- value: undefined
|
|
|
- };
|
|
|
- formRef.value?.resetFields();
|
|
|
-};
|
|
|
-
|
|
|
-const handleAdd = () => {
|
|
|
- reset();
|
|
|
- dialog.visible = true;
|
|
|
- dialog.title = '添加基本配置';
|
|
|
-};
|
|
|
-
|
|
|
-const handleUpdate = async (row: any) => {
|
|
|
- reset();
|
|
|
- const id = row.id || ids.value[0];
|
|
|
- const res = await getPlatformConfig(id);
|
|
|
- Object.assign(form.value, res.data);
|
|
|
- dialog.visible = true;
|
|
|
- dialog.title = '修改基本配置';
|
|
|
-};
|
|
|
-
|
|
|
-const submitForm = () => {
|
|
|
- formRef.value.validate(async (valid: boolean) => {
|
|
|
- if (valid) {
|
|
|
- if (form.value.id) {
|
|
|
- await updatePlatformConfig(form.value);
|
|
|
- proxy?.$modal.msgSuccess('修改成功');
|
|
|
- } else {
|
|
|
- await addPlatformConfig(form.value);
|
|
|
- proxy?.$modal.msgSuccess('新增成功');
|
|
|
+ try {
|
|
|
+ const res = await listPlatformConfig({ configType: '0', pageNum: 1, pageSize: 100 });
|
|
|
+ configList.value = res.rows || [];
|
|
|
+ configList.value.forEach((item: any) => {
|
|
|
+ if (form.value.hasOwnProperty(item.configKey)) {
|
|
|
+ form.value[item.configKey] = item.value;
|
|
|
}
|
|
|
- dialog.visible = false;
|
|
|
- getList();
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const handleDelete = async (row?: any) => {
|
|
|
- const deleteIds = row?.id || ids.value;
|
|
|
- await proxy?.$modal.confirm('是否确认删除?');
|
|
|
- await delPlatformConfig(deleteIds);
|
|
|
- proxy?.$modal.msgSuccess('删除成功');
|
|
|
- getList();
|
|
|
+ });
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-const cancel = () => {
|
|
|
- dialog.visible = false;
|
|
|
- reset();
|
|
|
+const submitForm = async () => {
|
|
|
+ try {
|
|
|
+ await formRef.value?.validate();
|
|
|
+
|
|
|
+ const configKeys = Object.keys(form.value);
|
|
|
+ const batchData = configKeys.map(key => ({
|
|
|
+ configType: '0',
|
|
|
+ configKey: key,
|
|
|
+ name: key,
|
|
|
+ value: form.value[key] || ''
|
|
|
+ }));
|
|
|
+
|
|
|
+ await saveBatchPlatformConfig(batchData);
|
|
|
+ proxy?.$modal.msgSuccess('保存成功');
|
|
|
+ getList();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('保存失败:', error);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-getList();
|
|
|
+onMounted(() => {
|
|
|
+ getList();
|
|
|
+});
|
|
|
</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.card-header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.card-header .title {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+</style>
|