Compare commits
10 Commits
65017f4bc7
...
4a66867d89
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a66867d89 | |||
| 9329c8c22f | |||
| 312662e587 | |||
| 5eb65e38f2 | |||
| 8be8a98402 | |||
| 1cece2cf0c | |||
| 8fa26b3a44 | |||
| 4563f5ac91 | |||
| e22bfd9c65 | |||
| 1908146a75 |
@@ -48,6 +48,15 @@ export default {
|
||||
title: "积分消费记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/propCount",
|
||||
name: "propCount",
|
||||
component: () => import("@/views/biz/propSummary/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:bank-card-line",
|
||||
title: "道具统计"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/purchase",
|
||||
name: "purchase",
|
||||
@@ -83,6 +92,24 @@ export default {
|
||||
icon: "ri:settings-3-line",
|
||||
title: "系统设置"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/areas",
|
||||
name: "areas",
|
||||
component: () => import("@/views/biz/areas/index.vue"),
|
||||
meta: {
|
||||
icon: "ph:map-pin-area-bold",
|
||||
title: "地区"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/subscribe",
|
||||
name: "subscribe",
|
||||
component: () => import("@/views/biz/subscribe/index.vue"),
|
||||
meta: {
|
||||
icon: "material-symbols:activity-zone-outline",
|
||||
title: "订阅管理"
|
||||
}
|
||||
}
|
||||
]
|
||||
} satisfies RouteConfigsTable;
|
||||
|
||||
@@ -110,6 +110,12 @@ const columns: TableColumnList = [
|
||||
width: "260",
|
||||
slot: "status"
|
||||
},
|
||||
{
|
||||
label: "审核状态",
|
||||
prop: "auditStatus",
|
||||
width: "260",
|
||||
slot: "auditStatus"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
@@ -216,6 +222,18 @@ onMounted(() => {
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #auditStatus="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'danger'" size="small">
|
||||
{{
|
||||
row.status === 0
|
||||
? "未审核"
|
||||
: row.status === 1
|
||||
? "审核通过"
|
||||
: "审核驳回"
|
||||
}}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
|
||||
@@ -37,9 +37,6 @@ const getRoleList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
|
||||
console.log(params);
|
||||
|
||||
const data = await request(authApi("rolePage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
@@ -61,6 +58,26 @@ const getRoleList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 管理用户列表数据
|
||||
const managerUserOptions = ref([]);
|
||||
// 获取管理用户列表
|
||||
const getManagerUserList = async () => {
|
||||
try {
|
||||
const res = await request(authApi("getManagerUserPrimaryInfo"), {
|
||||
method: "POST"
|
||||
});
|
||||
if (res.status === 200) {
|
||||
console.info(managerUserOptions);
|
||||
managerUserOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取管理用户列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索方法
|
||||
const handleSearch = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
@@ -98,7 +115,13 @@ const columns: TableColumnList = [
|
||||
{
|
||||
label: "创建者",
|
||||
prop: "createUserId",
|
||||
width: "260"
|
||||
width: "260",
|
||||
formatter: row => {
|
||||
const manager = managerUserOptions.value.find(
|
||||
item => item.value === row.createUserId
|
||||
);
|
||||
return manager ? manager.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "描述",
|
||||
@@ -167,6 +190,7 @@ const handleDelete = row => {
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getRoleList();
|
||||
getManagerUserList();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
291
src/views/biz/areas/index.vue
Normal file
291
src/views/biz/areas/index.vue
Normal file
@@ -0,0 +1,291 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, bizApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "areas"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: undefined
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
code: "",
|
||||
name: "",
|
||||
level: "",
|
||||
parentCode: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 等级选项
|
||||
const levelOptions = [
|
||||
{ value: 1, label: "省级" },
|
||||
{ value: 2, label: "市级" },
|
||||
{ value: 3, label: "区县级" },
|
||||
{ value: 4, label: "街道/乡镇" }
|
||||
];
|
||||
|
||||
// 获取地区列表
|
||||
const getAreaList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("areaPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (data.status === 200) {
|
||||
tableData.value = data.data.rows;
|
||||
total.value = data.data.records;
|
||||
} else {
|
||||
ElMessage.error(data.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取地区列表失败:", error);
|
||||
ElMessage.error(error.message || "获取数据失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索方法
|
||||
const handleSearch = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getAreaList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
code: "",
|
||||
name: "",
|
||||
level: "",
|
||||
parentCode: ""
|
||||
};
|
||||
getAreaList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getAreaList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getAreaList();
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
label: "编码",
|
||||
prop: "code",
|
||||
width: "120",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "名称",
|
||||
prop: "name",
|
||||
width: "150"
|
||||
},
|
||||
{
|
||||
label: "等级",
|
||||
prop: "level",
|
||||
width: "100",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const level = levelOptions.find(item => item.value === row.level);
|
||||
return level ? level.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "上级编码",
|
||||
prop: "parentCode",
|
||||
width: "120",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "地区完整地址",
|
||||
prop: "detail",
|
||||
minWidth: "300"
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: 160,
|
||||
slot: "operation",
|
||||
align: "center"
|
||||
}
|
||||
];
|
||||
|
||||
// 添加删除方法
|
||||
const handleDelete = async (row: any) => {
|
||||
try {
|
||||
await ElMessageBox.confirm("确认要删除该地区记录吗?", "提示", {
|
||||
type: "warning"
|
||||
});
|
||||
|
||||
const res = await request(bizApi("deleteArea"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getAreaList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getAreaList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="areas-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="编码(前匹配)" prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入编码"
|
||||
clearable
|
||||
class="input-width"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
class="input-width"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="等级" prop="level">
|
||||
<el-select
|
||||
v-model="queryParams.level"
|
||||
placeholder="请选择等级"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in levelOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="上级编码" prop="parentCode">
|
||||
<el-input
|
||||
v-model="queryParams.parentCode"
|
||||
placeholder="请输入上级编码"
|
||||
clearable
|
||||
class="input-width"
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<el-button type="primary" link @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</pure-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.areas-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-width {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.type-select {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -158,17 +158,35 @@ const columns: TableColumnList = [
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "中标者",
|
||||
label: "中标",
|
||||
prop: "isWinner",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isWinner === 1 ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
label: "供货周期",
|
||||
prop: "supplyCycle",
|
||||
width: "90",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "供货地",
|
||||
prop: "productSourcingDetail",
|
||||
width: "180"
|
||||
},
|
||||
{
|
||||
label: "货款(元)",
|
||||
prop: "bidPrice",
|
||||
width: "90"
|
||||
},
|
||||
{
|
||||
label: "投标时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
@@ -301,7 +319,7 @@ onMounted(() => {
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="中标者" prop="isWinner">
|
||||
<el-form-item label="中标" prop="isWinner">
|
||||
<el-select
|
||||
v-model="queryParams.isWinner"
|
||||
placeholder="请选择"
|
||||
|
||||
@@ -54,6 +54,17 @@ const getFrontendUserList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 明细抽屉相关
|
||||
const detailDrawer = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const detailData = ref([]);
|
||||
const detailTotal = ref(0);
|
||||
const detailQueryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
bidId: ""
|
||||
});
|
||||
|
||||
// 公司列表数据
|
||||
const companyOptions = ref([]);
|
||||
// 获取公司列表
|
||||
@@ -133,7 +144,7 @@ const handleCurrentChange = (val: number) => {
|
||||
// 添加状态选项
|
||||
const bidStatusOptions = [
|
||||
{ value: 1, label: "完成" },
|
||||
{ value: 2, label: "未完成" },
|
||||
{ value: 2, label: "进行中" },
|
||||
{ value: 3, label: "超时" }
|
||||
];
|
||||
|
||||
@@ -167,6 +178,15 @@ const categoryOptions = [
|
||||
{ value: 2, label: "飞机" }
|
||||
];
|
||||
|
||||
// 紧急度
|
||||
const urgencyOptions = [
|
||||
{ value: 1, label: "加急", day: 1 },
|
||||
{ value: 2, label: "紧急", day: 3 },
|
||||
{ value: 3, label: "一般", day: 7 },
|
||||
{ value: 4, label: "近期", day: 30 },
|
||||
{ value: 5, label: "远期", day: 90 }
|
||||
];
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "用户名称",
|
||||
@@ -183,6 +203,7 @@ const columns: TableColumnList = [
|
||||
label: "是否公司",
|
||||
prop: "isCompany",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isCompany ? "是" : "否";
|
||||
}
|
||||
@@ -202,6 +223,7 @@ const columns: TableColumnList = [
|
||||
label: "发标类型",
|
||||
prop: "bidType",
|
||||
width: "100",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const type = bidTypeOptions.find(item => item.value === row.bidType);
|
||||
return type ? type.label : "";
|
||||
@@ -211,6 +233,7 @@ const columns: TableColumnList = [
|
||||
label: "发标领域",
|
||||
prop: "bidField",
|
||||
width: "100",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const field = bidFieldOptions.find(item => item.value === row.bidField);
|
||||
return field ? field.label : "";
|
||||
@@ -219,12 +242,14 @@ const columns: TableColumnList = [
|
||||
{
|
||||
label: "需求数量",
|
||||
prop: "needNum",
|
||||
align: "center",
|
||||
width: "90"
|
||||
},
|
||||
{
|
||||
label: "发标分类",
|
||||
prop: "category",
|
||||
width: "100",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const cat = categoryOptions.find(item => item.value === row.category);
|
||||
return cat ? cat.label : "";
|
||||
@@ -239,6 +264,7 @@ const columns: TableColumnList = [
|
||||
label: "状态",
|
||||
prop: "bidStatus",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const status = bidStatusOptions.find(
|
||||
item => item.value === row.bidStatus
|
||||
@@ -285,18 +311,27 @@ const columns: TableColumnList = [
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "有效天数",
|
||||
prop: "validDays",
|
||||
width: "90"
|
||||
label: "紧急度",
|
||||
prop: "urgency",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const urgency = urgencyOptions.find(item => item.value === row.urgency);
|
||||
return urgency ? urgency.label + "(" + urgency.day + "天)" : "";
|
||||
}
|
||||
},
|
||||
// {
|
||||
// label: "有效天数",
|
||||
// prop: "validDays",
|
||||
// width: "90"
|
||||
// },
|
||||
{
|
||||
label: "截止日期",
|
||||
prop: "expiryDate",
|
||||
width: "160",
|
||||
width: "120",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.expiryDate
|
||||
? dayjs(row.expiryDate).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
return row.expiryDate ? dayjs(row.expiryDate).format("YYYY-MM-DD") : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -337,6 +372,136 @@ const handleEdit = (row: any) => {
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
const handleDetail = row => {
|
||||
detailQueryParams.value.bidId = row.id;
|
||||
detailQueryParams.value.pageNum = 1;
|
||||
detailDrawer.value = true;
|
||||
getBidListDetail();
|
||||
};
|
||||
|
||||
// 明细表格列定义
|
||||
const detailColumns = [
|
||||
{
|
||||
label: "投标主体",
|
||||
prop: "isCompany",
|
||||
width: "180",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isCompany === 1
|
||||
? "[公司]" +
|
||||
companyOptions.value.find(item => item.value === row.companyId)
|
||||
?.label
|
||||
: "[个人]" +
|
||||
frontendUserOptions.value.find(item => item.value === row.userId)
|
||||
?.label;
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "中标",
|
||||
prop: "isWinner",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isWinner === 1 ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "投标时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "使用道具",
|
||||
prop: "usePurchase",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.usePurchase === 1 ? "使用" : "未使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "排他卡",
|
||||
prop: "useExcludeCardFlag",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.useExcludeCardFlag === 1 ? "使用" : "未使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "插队卡",
|
||||
prop: "useJumpCardFlag",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.useJumpCardFlag === 1 ? "使用" : "未使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "直通卡",
|
||||
prop: "useThroughCardFlag",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.useThroughCardFlag === 1 ? "使用" : "未使用";
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// 获取投标明细
|
||||
const getBidListDetail = async () => {
|
||||
try {
|
||||
detailLoading.value = true;
|
||||
const params = { ...detailQueryParams.value };
|
||||
const res = await request(bizApi("bidPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
detailData.value = res.data.rows;
|
||||
detailTotal.value = res.data.records;
|
||||
} else {
|
||||
ElMessage.error(res.msg || "获取投标记录失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取投标记录失败:", error);
|
||||
ElMessage.error(error.message || "获取投标记录失败");
|
||||
} finally {
|
||||
detailLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 明细分页改变
|
||||
const handleDetailSizeChange = (val: number) => {
|
||||
detailQueryParams.value.pageSize = val;
|
||||
getBidListDetail();
|
||||
};
|
||||
|
||||
const handleDetailCurrentChange = (val: number) => {
|
||||
detailQueryParams.value.pageNum = val;
|
||||
getBidListDetail();
|
||||
};
|
||||
|
||||
// 添加抽屉关闭处理函数
|
||||
const handleDrawerClose = () => {
|
||||
detailDrawer.value = false;
|
||||
// 重置查询参数
|
||||
detailQueryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
bidId: ""
|
||||
};
|
||||
// 清空数据
|
||||
detailData.value = [];
|
||||
detailTotal.value = 0;
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getBidList();
|
||||
@@ -472,10 +637,20 @@ onMounted(() => {
|
||||
row-key="id"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<el-button type="primary" link @click="handleEdit(row)">
|
||||
编辑
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:disabled="!row.bidNum || row.bidNum <= 0"
|
||||
@click="handleDetail(row)"
|
||||
>
|
||||
投标记录{{ row.bidNum ? `(${row.bidNum})` : "" }}
|
||||
</el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row)">
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
:disabled="true"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -492,6 +667,36 @@ onMounted(() => {
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 增加抽屉list明细 -->
|
||||
<el-drawer
|
||||
v-model="detailDrawer"
|
||||
title="投标记录"
|
||||
size="40%"
|
||||
:close-on-click-modal="true"
|
||||
@close="handleDrawerClose"
|
||||
>
|
||||
<div class="drawer-container">
|
||||
<pure-table
|
||||
v-loading="detailLoading"
|
||||
:data="detailData"
|
||||
:columns="detailColumns"
|
||||
row-key="id"
|
||||
/>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="detailQueryParams.pageNum"
|
||||
v-model:page-size="detailQueryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="detailTotal"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleDetailSizeChange"
|
||||
@current-change="handleDetailCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -532,4 +737,14 @@ onMounted(() => {
|
||||
.type-select {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.drawer-container {
|
||||
padding: 20px;
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -43,6 +43,37 @@ const memberTypeOptions = [
|
||||
{ value: "4", label: "月度会员" }
|
||||
];
|
||||
|
||||
// 添加涨分弹窗相关状态
|
||||
const raisePointDialog = ref(false);
|
||||
const raisePointForm = ref({
|
||||
pointNum: 0,
|
||||
reasonId: "",
|
||||
description: ""
|
||||
});
|
||||
const currentRow = ref(null);
|
||||
|
||||
// 涨分原因选项
|
||||
const reasonOptions = [
|
||||
{ value: 1, label: "购买" },
|
||||
{ value: 2, label: "活动奖励" },
|
||||
{ value: 3, label: "签到奖励" },
|
||||
{ value: 4, label: "任务奖励" },
|
||||
{ value: 5, label: "管理员调整" },
|
||||
{ value: 9, label: "其他" }
|
||||
];
|
||||
|
||||
// 明细抽屉相关
|
||||
const detailDrawer = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const detailData = ref([]);
|
||||
const detailTotal = ref(0);
|
||||
const detailQueryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
companyId: ""
|
||||
});
|
||||
|
||||
// 获取公司列表
|
||||
const getCompanyList = async () => {
|
||||
try {
|
||||
@@ -149,6 +180,7 @@ const columns: TableColumnList = [
|
||||
label: "是否公司",
|
||||
prop: "isCompany",
|
||||
width: "100",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isCompany ? "是" : "否";
|
||||
}
|
||||
@@ -223,8 +255,11 @@ const columns: TableColumnList = [
|
||||
|
||||
// 添加操作方法
|
||||
const handleDetail = row => {
|
||||
console.log("查看明细", row);
|
||||
// TODO: 实现查看明细逻辑
|
||||
detailQueryParams.value.userId = row.userId;
|
||||
detailQueryParams.value.companyId = row.companyId;
|
||||
detailQueryParams.value.pageNum = 1;
|
||||
detailDrawer.value = true;
|
||||
getPointDetail();
|
||||
};
|
||||
|
||||
const handleEdit = row => {
|
||||
@@ -232,6 +267,65 @@ const handleEdit = row => {
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleRaise = row => {
|
||||
currentRow.value = row;
|
||||
raisePointForm.value = {
|
||||
pointNum: 0,
|
||||
reasonId: "",
|
||||
description: ""
|
||||
};
|
||||
raisePointDialog.value = true;
|
||||
};
|
||||
|
||||
// 添加提交状态控制
|
||||
const submitting = ref(false);
|
||||
|
||||
// 修改提交方法
|
||||
const handleRaiseSubmit = async () => {
|
||||
console.log(submitting.value);
|
||||
|
||||
if (submitting.value) return; // 如果正在提交,直接返回
|
||||
|
||||
try {
|
||||
if (raisePointForm.value.pointNum <= 0) {
|
||||
ElMessage.warning("请输入正确的积分数量");
|
||||
return;
|
||||
}
|
||||
if (!raisePointForm.value.reasonId) {
|
||||
ElMessage.warning("请选择涨分原因");
|
||||
return;
|
||||
}
|
||||
|
||||
submitting.value = true; // 开始提交,设置状态
|
||||
|
||||
const params = {
|
||||
userId: currentRow.value.userId,
|
||||
companyId: currentRow.value.companyId,
|
||||
pointNum: raisePointForm.value.pointNum,
|
||||
reasonId: raisePointForm.value.reasonId,
|
||||
description: raisePointForm.value.description
|
||||
};
|
||||
|
||||
const res = await request(bizApi("raisePoint"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("涨分成功");
|
||||
raisePointDialog.value = false;
|
||||
getPointList(); // 刷新列表
|
||||
} else {
|
||||
ElMessage.error(res.msg || "涨分失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("涨分失败:", error);
|
||||
ElMessage.error(error.message || "涨分失败");
|
||||
} finally {
|
||||
submitting.value = false; // 无论成功失败,都重置状态
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
@@ -253,6 +347,98 @@ const handleDelete = row => {
|
||||
});
|
||||
};
|
||||
|
||||
// 获取积分明细
|
||||
const getPointDetail = async () => {
|
||||
try {
|
||||
detailLoading.value = true;
|
||||
const params = { ...detailQueryParams.value };
|
||||
const res = await request(bizApi("pointSpendPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
detailData.value = res.data.rows;
|
||||
detailTotal.value = res.data.records;
|
||||
} else {
|
||||
ElMessage.error(res.msg || "获取明细失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取积分明细失败:", error);
|
||||
ElMessage.error(error.message || "获取明细失败");
|
||||
} finally {
|
||||
detailLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 明细分页改变
|
||||
const handleDetailSizeChange = (val: number) => {
|
||||
detailQueryParams.value.pageSize = val;
|
||||
getPointDetail();
|
||||
};
|
||||
|
||||
const handleDetailCurrentChange = (val: number) => {
|
||||
detailQueryParams.value.pageNum = val;
|
||||
getPointDetail();
|
||||
};
|
||||
|
||||
// 明细表格列定义
|
||||
const detailColumns = [
|
||||
{
|
||||
label: "变动积分",
|
||||
prop: "spendingPoints",
|
||||
width: "80",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "类型",
|
||||
prop: "spendingType",
|
||||
width: "60",
|
||||
formatter: row => {
|
||||
return row.spendingType === 0 ? "充值" : "消费";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "变动原因",
|
||||
prop: "reasonId",
|
||||
width: "95",
|
||||
formatter: row => {
|
||||
const reason = reasonOptions.find(item => item.value === row.reasonId);
|
||||
return reason ? reason.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "备注说明",
|
||||
prop: "description",
|
||||
width: "150"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// 添加抽屉关闭处理函数
|
||||
const handleDrawerClose = () => {
|
||||
detailDrawer.value = false;
|
||||
// 重置查询参数
|
||||
detailQueryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
companyId: ""
|
||||
};
|
||||
// 清空数据
|
||||
detailData.value = [];
|
||||
detailTotal.value = 0;
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getPointList();
|
||||
@@ -340,10 +526,20 @@ onMounted(() => {
|
||||
<el-button link type="primary" size="small" @click="handleDetail(row)">
|
||||
明细
|
||||
</el-button>
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
<!-- <el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button> -->
|
||||
<el-button link type="primary" size="small" @click="handleRaise(row)">
|
||||
涨分
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleDelete(row)">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
size="small"
|
||||
disabled
|
||||
:style="{ opacity: 0.5 }"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -360,6 +556,144 @@ onMounted(() => {
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 添加涨分弹窗 -->
|
||||
<el-dialog
|
||||
v-model="raisePointDialog"
|
||||
title="积分调整"
|
||||
width="500px"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form
|
||||
ref="raisePointFormRef"
|
||||
:model="raisePointForm"
|
||||
label-width="100px"
|
||||
class="raise-point-form"
|
||||
>
|
||||
<el-form-item label="用户:">
|
||||
<span>{{
|
||||
frontendUserOptions.find(item => item.value === currentRow?.userId)
|
||||
?.label
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属公司:">
|
||||
<span>{{
|
||||
companyOptions.find(item => item.value === currentRow?.companyId)
|
||||
?.label || "-"
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="当前积分:">
|
||||
<span>{{ currentRow?.totalPoints }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="调整积分:" required>
|
||||
<el-input-number
|
||||
v-model="raisePointForm.pointNum"
|
||||
:min="1"
|
||||
:max="999999"
|
||||
placeholder="请输入调整积分"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="调整原因:" required>
|
||||
<el-select
|
||||
v-model="raisePointForm.reasonId"
|
||||
placeholder="请选择调整原因"
|
||||
class="reason-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reasonOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注说明:">
|
||||
<el-input
|
||||
v-model="raisePointForm.description"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注说明"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button :disabled="submitting" @click="raisePointDialog = false"
|
||||
>取 消</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="submitting"
|
||||
@click="handleRaiseSubmit"
|
||||
>
|
||||
{{ submitting ? "提交中..." : "确 定" }}
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加明细抽屉 -->
|
||||
<el-drawer
|
||||
v-model="detailDrawer"
|
||||
title="积分明细"
|
||||
size="40%"
|
||||
:close-on-click-modal="true"
|
||||
:before-close="() => (detailDrawer = false)"
|
||||
>
|
||||
<div class="detail-container">
|
||||
<pure-table
|
||||
v-loading="detailLoading"
|
||||
:data="detailData"
|
||||
:columns="detailColumns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleDetail(row)"
|
||||
>
|
||||
明细
|
||||
</el-button>
|
||||
<!-- <el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button> -->
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleRaise(row)"
|
||||
>
|
||||
涨分
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
size="small"
|
||||
disabled
|
||||
:style="{ opacity: 0.5 }"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</pure-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="detailQueryParams.pageNum"
|
||||
v-model:page-size="detailQueryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="detailTotal"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleDetailSizeChange"
|
||||
@current-change="handleDetailCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -396,4 +730,17 @@ onMounted(() => {
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
|
||||
.raise-point-form {
|
||||
padding: 20px;
|
||||
|
||||
.reason-select {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
padding-top: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
339
src/views/biz/propSummary/index.vue
Normal file
339
src/views/biz/propSummary/index.vue
Normal file
@@ -0,0 +1,339 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { request, bizApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "propSummary"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
companyId: "",
|
||||
propType: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 前端用户列表数据
|
||||
const frontendUserOptions = ref([]);
|
||||
// 获取前端用户列表
|
||||
const getFrontendUserList = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("getFrontendUserPrimaryInfo"), {
|
||||
method: "POST"
|
||||
});
|
||||
if (res.status === 200) {
|
||||
frontendUserOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取用户列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 公司列表数据
|
||||
const companyOptions = ref([]);
|
||||
// 获取公司列表
|
||||
const getCompanyList = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("getCompanyPrimaryInfo"), {
|
||||
method: "POST"
|
||||
});
|
||||
if (res.status === 200) {
|
||||
companyOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.companyName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取公司列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 道具类型选项
|
||||
const typeOptions = [
|
||||
{ value: 1, label: "实时达卡" },
|
||||
{ value: 2, label: "排他卡" },
|
||||
{ value: 3, label: "插队卡" },
|
||||
{ value: 4, label: "直通卡" },
|
||||
{ value: 5, label: "加量卡" },
|
||||
{ value: 6, label: "置顶卡" }
|
||||
];
|
||||
|
||||
// 获取道具统计列表
|
||||
const getPropSummaryList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("propSummaryPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (data.status === 200) {
|
||||
tableData.value = data.data.rows;
|
||||
total.value = data.data.records;
|
||||
} else {
|
||||
ElMessage.error(data.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取道具统计列表失败:", error);
|
||||
ElMessage.error(error.message || "获取数据失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索方法
|
||||
const handleSearch = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getPropSummaryList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
companyId: "",
|
||||
propType: ""
|
||||
};
|
||||
getPropSummaryList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getPropSummaryList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getPropSummaryList();
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
label: "用户名称",
|
||||
prop: "userId",
|
||||
width: "120",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const user = frontendUserOptions.value.find(
|
||||
item => item.value === row.userId
|
||||
);
|
||||
return user ? user.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "是否公司",
|
||||
prop: "isCompany",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isCompany === 1 ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "公司名称",
|
||||
prop: "companyId",
|
||||
width: "150",
|
||||
formatter: row => {
|
||||
const company = companyOptions.value.find(
|
||||
item => item.value === row.companyId
|
||||
);
|
||||
return company ? company.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "道具类型",
|
||||
prop: "propType",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const type = typeOptions.find(item => item.value === row.propType);
|
||||
return type ? type.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "总数量",
|
||||
prop: "totalCount",
|
||||
width: "90",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "已用数量",
|
||||
prop: "usedCount",
|
||||
width: "90",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "过期数量",
|
||||
prop: "expiredCount",
|
||||
width: "90",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "更新时间",
|
||||
prop: "updateTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.updateTime
|
||||
? dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getPropSummaryList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="prop-count-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<el-select
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请选择用户"
|
||||
clearable
|
||||
class="user-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in frontendUserOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="公司名称" prop="companyId">
|
||||
<el-select
|
||||
v-model="queryParams.companyId"
|
||||
placeholder="请选择公司"
|
||||
clearable
|
||||
class="company-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in companyOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="道具类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.propType"
|
||||
placeholder="请选择类型"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
/>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.prop-count-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.user-select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.company-select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.type-select {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
9
src/views/biz/propSummary/index2.vue
Normal file
9
src/views/biz/propSummary/index2.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "propSummary2"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>道具统计</h1>
|
||||
</template>
|
||||
454
src/views/biz/subscribe/index.vue
Normal file
454
src/views/biz/subscribe/index.vue
Normal file
@@ -0,0 +1,454 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, bizApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "subscribe"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: undefined
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
subType: "",
|
||||
subField: "",
|
||||
subCategory: "",
|
||||
useRealtimeCardFlag: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 前端用户列表数据
|
||||
const frontendUserOptions = ref([]);
|
||||
// 获取前端用户列表
|
||||
const getFrontendUserList = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("getFrontendUserPrimaryInfo"), {
|
||||
method: "POST"
|
||||
});
|
||||
if (res.status === 200) {
|
||||
frontendUserOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取用户列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 公司列表数据
|
||||
const companyOptions = ref([]);
|
||||
// 获取公司列表
|
||||
const getCompanyList = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("getCompanyPrimaryInfo"), {
|
||||
method: "POST"
|
||||
});
|
||||
if (res.status === 200) {
|
||||
companyOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.companyName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取公司列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 订阅类型选项
|
||||
const subTypeOptions = [
|
||||
{ value: 0, label: "未指定" },
|
||||
{ value: 1, label: "求购" },
|
||||
{ value: 2, label: "租赁" },
|
||||
{ value: 9, label: "全订阅" }
|
||||
];
|
||||
|
||||
// 订阅领域选项
|
||||
const subFieldOptions = [
|
||||
{ value: 0, label: "未指定" },
|
||||
{ value: 1, label: "民航" },
|
||||
{ value: 2, label: "通航" },
|
||||
{ value: 9, label: "全订阅" }
|
||||
];
|
||||
|
||||
// 订阅对象选项
|
||||
const subCategoryOptions = [
|
||||
{ value: 0, label: "未指定" },
|
||||
{ value: 1, label: "航材" },
|
||||
{ value: 2, label: "飞机" },
|
||||
{ value: 3, label: "工具" },
|
||||
{ value: 9, label: "全订阅" }
|
||||
];
|
||||
|
||||
// 获取订阅列表
|
||||
const getSubscribeList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("bidSubscribePage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (data.status === 200) {
|
||||
tableData.value = data.data.rows;
|
||||
total.value = data.data.records;
|
||||
} else {
|
||||
ElMessage.error(data.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取订阅列表失败:", error);
|
||||
ElMessage.error(error.message || "获取数据失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索方法
|
||||
const handleSearch = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getSubscribeList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
subType: "",
|
||||
subField: "",
|
||||
subCategory: "",
|
||||
useRealtimeCardFlag: ""
|
||||
};
|
||||
getSubscribeList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getSubscribeList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getSubscribeList();
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
label: "用户名称",
|
||||
prop: "userId",
|
||||
width: "120",
|
||||
formatter: row => {
|
||||
const user = frontendUserOptions.value.find(
|
||||
item => item.value === row.userId
|
||||
);
|
||||
return user ? user.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "是否公司",
|
||||
prop: "isCompany",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isCompany === 1 ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "公司名称",
|
||||
prop: "companyId",
|
||||
width: "150",
|
||||
formatter: row => {
|
||||
const company = companyOptions.value.find(
|
||||
item => item.value === row.companyId
|
||||
);
|
||||
return company ? company.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "订阅类型",
|
||||
prop: "subType",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const type = subTypeOptions.find(item => item.value === row.subType);
|
||||
return type ? type.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "订阅领域",
|
||||
prop: "subField",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const field = subFieldOptions.find(item => item.value === row.subField);
|
||||
return field ? field.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "订阅对象",
|
||||
prop: "subCategory",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const category = subCategoryOptions.find(
|
||||
item => item.value === row.subCategory
|
||||
);
|
||||
return category ? category.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "订阅关键字",
|
||||
prop: "subWords",
|
||||
width: "200"
|
||||
},
|
||||
{
|
||||
label: "使用实时达卡",
|
||||
prop: "useRealtimeCardFlag",
|
||||
width: "120",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.useRealtimeCardFlag === 1 ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "更新时间",
|
||||
prop: "updateTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.updateTime
|
||||
? dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: 160,
|
||||
slot: "operation",
|
||||
align: "center"
|
||||
}
|
||||
];
|
||||
|
||||
// 添加删除方法
|
||||
const handleDelete = async (row: any) => {
|
||||
try {
|
||||
await ElMessageBox.confirm("确认要删除该订阅记录吗?", "提示", {
|
||||
type: "warning"
|
||||
});
|
||||
|
||||
const res = await request(bizApi("deleteSubscribe"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getSubscribeList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getSubscribeList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="subscribe-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<el-select
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请选择用户"
|
||||
clearable
|
||||
class="user-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in frontendUserOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="公司名称" prop="companyId">
|
||||
<el-select
|
||||
v-model="queryParams.companyId"
|
||||
placeholder="请选择公司"
|
||||
clearable
|
||||
class="company-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in companyOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="订阅类型" prop="subType">
|
||||
<el-select
|
||||
v-model="queryParams.subType"
|
||||
placeholder="请选择类型"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in subTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="订阅领域" prop="subField">
|
||||
<el-select
|
||||
v-model="queryParams.subField"
|
||||
placeholder="请选择领域"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in subFieldOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="订阅对象" prop="subCategory">
|
||||
<el-select
|
||||
v-model="queryParams.subCategory"
|
||||
placeholder="请选择对象"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in subCategoryOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<el-button type="primary" link @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</pure-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.subscribe-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.user-select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.company-select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.type-select {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -29,6 +29,21 @@ const settingsData = ref({
|
||||
membership_config: {
|
||||
issuance_num_per_month_company: 10,
|
||||
issuance_num_per_month_person: 5
|
||||
},
|
||||
area_config: {
|
||||
separator: " "
|
||||
},
|
||||
email_config: {
|
||||
smtpServer: "smtp.163.com",
|
||||
smtpPort: "465",
|
||||
auth: true,
|
||||
sslEnable: true,
|
||||
fromEmail: "silent3035@163.com",
|
||||
fromEmailName: "Rocky",
|
||||
fromEmailUser: "",
|
||||
fromEmailPassword: "W0pPgIjQWMH0Tb2Y",
|
||||
verifyEmail: "",
|
||||
toEmails: ["silent3035@163.com", "zhanghuajun@rocky.com"]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -42,6 +57,21 @@ const purchaseTypeMap = {
|
||||
6: "跳转卡"
|
||||
};
|
||||
|
||||
// 添加分隔符选项
|
||||
const separatorOptions = [
|
||||
{ value: " ", label: "空格(默认)" },
|
||||
{ value: ",", label: "逗号" },
|
||||
{ value: "、", label: "顿号" },
|
||||
{ value: "-", label: "中划线" },
|
||||
{ value: "_", label: "下划线" },
|
||||
{ value: ">", label: "大于号" }
|
||||
];
|
||||
// 添加全局 loading 状态
|
||||
const fullscreenLoading = ref(false);
|
||||
// 添加邮箱相关状态
|
||||
const showEmailInput = ref(false);
|
||||
const newEmail = ref("");
|
||||
|
||||
// 加载设置数据
|
||||
const loadSettings = async () => {
|
||||
try {
|
||||
@@ -60,9 +90,69 @@ const loadSettings = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 保存设置
|
||||
// 验证邮箱配置信息
|
||||
const validateEmailConfig = (): boolean => {
|
||||
const {
|
||||
smtpServer,
|
||||
smtpPort,
|
||||
fromEmail,
|
||||
fromEmailPassword,
|
||||
fromEmailUser,
|
||||
fromEmailName,
|
||||
toEmails
|
||||
} = settingsData.value.email_config;
|
||||
|
||||
// 检查必填字段
|
||||
if (
|
||||
!smtpServer ||
|
||||
!smtpPort ||
|
||||
!fromEmail ||
|
||||
!fromEmailPassword ||
|
||||
!fromEmailUser ||
|
||||
!fromEmailName
|
||||
) {
|
||||
ElMessage.warning("请完整填写邮箱配置信息");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 验证发件邮箱格式
|
||||
if (!isValidEmail(fromEmail)) {
|
||||
ElMessage.warning("发件邮箱格式不正确");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 验证SMTP端口格式
|
||||
if (!/^\d+$/.test(smtpPort) || parseInt(smtpPort) <= 0) {
|
||||
ElMessage.warning("SMTP端口必须为有效的正整数");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 验证收件邮箱列表
|
||||
if (!toEmails || toEmails.length === 0) {
|
||||
ElMessage.warning("请至少添加一个收件邮箱");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 验证收件邮箱格式
|
||||
for (const email of toEmails) {
|
||||
if (!isValidEmail(email)) {
|
||||
ElMessage.warning(`收件邮箱 ${email} 格式不正确`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
// 修改保存设置函数
|
||||
const saveSettings = async (key: string) => {
|
||||
try {
|
||||
// 如果是邮箱配置,先进行验证
|
||||
if (key === "email_config" && !validateEmailConfig()) {
|
||||
return;
|
||||
}
|
||||
|
||||
fullscreenLoading.value = true;
|
||||
const params = {
|
||||
settingsKey: key,
|
||||
settingsContent: JSON.stringify(settingsData.value[key])
|
||||
@@ -79,6 +169,103 @@ const saveSettings = async (key: string) => {
|
||||
} catch (error) {
|
||||
console.error("保存系统设置失败:", error);
|
||||
ElMessage.error("保存系统设置失败");
|
||||
} finally {
|
||||
fullscreenLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 添加邮箱
|
||||
const handleAddEmail = () => {
|
||||
const email = newEmail.value.trim();
|
||||
// 检查邮箱数量是否达到上限
|
||||
if (settingsData.value.email_config.toEmails.length >= 10) {
|
||||
ElMessage.warning("最多只能添加10个收件邮箱");
|
||||
newEmail.value = "";
|
||||
showEmailInput.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
if (!settingsData.value.email_config.toEmails.includes(email)) {
|
||||
settingsData.value.email_config.toEmails.push(email);
|
||||
}
|
||||
newEmail.value = "";
|
||||
showEmailInput.value = false;
|
||||
} else {
|
||||
ElMessage.warning("请输入有效的邮箱地址");
|
||||
}
|
||||
};
|
||||
|
||||
// 移除邮箱
|
||||
const handleRemoveEmail = (index: number) => {
|
||||
settingsData.value.email_config.toEmails.splice(index, 1);
|
||||
};
|
||||
|
||||
// 邮箱输入框失焦处理
|
||||
const handleEmailInputBlur = () => {
|
||||
if (newEmail.value.trim()) {
|
||||
handleAddEmail();
|
||||
}
|
||||
showEmailInput.value = false;
|
||||
};
|
||||
|
||||
// 邮箱格式校验函数
|
||||
const isValidEmail = (email: string): boolean => {
|
||||
// 标准邮箱格式正则表达式
|
||||
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
return emailRegex.test(email);
|
||||
};
|
||||
|
||||
// 发送测试邮件
|
||||
const handleTestEmail = async () => {
|
||||
// 校验发件邮箱配置
|
||||
const { smtpServer, smtpPort, fromEmail, fromEmailPassword, fromEmailUser } =
|
||||
settingsData.value.email_config;
|
||||
if (
|
||||
!smtpServer ||
|
||||
!smtpPort ||
|
||||
!fromEmail ||
|
||||
!fromEmailPassword ||
|
||||
!fromEmailUser
|
||||
) {
|
||||
ElMessage.warning("请先完成邮箱配置信息");
|
||||
return;
|
||||
}
|
||||
|
||||
// 校验发件邮箱格式
|
||||
if (!isValidEmail(fromEmail)) {
|
||||
ElMessage.warning("发件邮箱格式不正确,请检查配置");
|
||||
return;
|
||||
}
|
||||
|
||||
const email = settingsData.value.email_config.verifyEmail.trim();
|
||||
|
||||
// 检查邮箱是否为空
|
||||
if (!email) {
|
||||
ElMessage.warning("请输入测试邮箱地址");
|
||||
return;
|
||||
}
|
||||
|
||||
// 校验邮箱格式
|
||||
if (!isValidEmail(email)) {
|
||||
ElMessage.warning("请输入有效的邮箱地址");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await request(bizApi("testEmail"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(settingsData.value.email_config)
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("测试邮件发送成功, 邮箱服务器配置无误。");
|
||||
} else {
|
||||
ElMessage.error(res.msg || "测试邮件发送失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("发送测试邮件失败:", error);
|
||||
ElMessage.error("发送测试邮件失败");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -89,6 +276,13 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<div class="settings-container">
|
||||
<div
|
||||
v-show="fullscreenLoading"
|
||||
v-loading.fullscreen.lock="fullscreenLoading"
|
||||
:element-loading-text="'保存中...'"
|
||||
class="settings-container"
|
||||
/>
|
||||
|
||||
<!-- 发标设置 -->
|
||||
<el-card class="settings-card">
|
||||
<template #header>
|
||||
@@ -235,6 +429,168 @@ onMounted(() => {
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 地域配置 -->
|
||||
<el-card class="settings-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>地域配置</span>
|
||||
<el-button type="primary" @click="saveSettings('area_config')"
|
||||
>保存</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<el-form
|
||||
label-width="160px"
|
||||
:model="settingsData.area_config"
|
||||
class="settings-form"
|
||||
>
|
||||
<el-form-item label="地址分隔符">
|
||||
<el-select
|
||||
v-model="settingsData.area_config.separator"
|
||||
placeholder="请选择分隔符"
|
||||
style="width: 180px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in separatorOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
<span
|
||||
>{{ item.label }} ({{ item.value === " " ? " " : item.value }})
|
||||
</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div class="form-tip">
|
||||
用于连接地区名称,例如:北京{{
|
||||
settingsData.area_config.separator
|
||||
}}朝阳区
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 邮箱配置 -->
|
||||
<el-card class="settings-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>邮箱配置</span>
|
||||
<el-button type="primary" @click="saveSettings('email_config')"
|
||||
>保存</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<el-form
|
||||
label-width="160px"
|
||||
:model="settingsData.email_config"
|
||||
class="settings-form"
|
||||
>
|
||||
<el-form-item label="SMTP服务器">
|
||||
<el-input
|
||||
v-model="settingsData.email_config.smtpServer"
|
||||
placeholder="请输入SMTP服务器地址"
|
||||
style="width: 320px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="SMTP端口">
|
||||
<el-input
|
||||
v-model="settingsData.email_config.smtpPort"
|
||||
placeholder="请输入SMTP端口"
|
||||
style="width: 320px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="认证">
|
||||
<el-switch v-model="settingsData.email_config.auth" disabled />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="SSL加密">
|
||||
<el-switch v-model="settingsData.email_config.sslEnable" disabled />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发件邮箱">
|
||||
<el-input
|
||||
v-model="settingsData.email_config.fromEmail"
|
||||
placeholder="请输入发件邮箱"
|
||||
style="width: 320px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发件邮箱名称">
|
||||
<el-input
|
||||
v-model="settingsData.email_config.fromEmailName"
|
||||
placeholder="请输入发件邮箱名称"
|
||||
style="width: 320px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发件邮箱用户名">
|
||||
<el-input
|
||||
v-model="settingsData.email_config.fromEmailUser"
|
||||
placeholder="请输入发件邮箱用户名 Fomail、阿里邮箱非空"
|
||||
style="width: 320px"
|
||||
/>
|
||||
<div class="form-tip">
|
||||
注意:邮箱用户名默认发件邮箱@前部分。Foxmail邮箱需要单独配置为与之绑定的qq号码或者XXXX@qq.com的XXXX;阿里云邮箱的用户名则是邮箱的完整地址。
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发件邮箱密码/授权密钥">
|
||||
<el-input
|
||||
v-model="settingsData.email_config.fromEmailPassword"
|
||||
type="password"
|
||||
placeholder="请输入发件邮箱密码/授权密钥"
|
||||
style="width: 320px"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="验证邮箱配置">
|
||||
<el-input
|
||||
v-model="settingsData.email_config.verifyEmail"
|
||||
placeholder="请输入验证邮箱"
|
||||
style="width: 320px"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="handleTestEmail">验证邮箱</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="收件邮箱列表">
|
||||
<div class="email-list">
|
||||
<el-tag
|
||||
v-for="(email, index) in settingsData.email_config.toEmails"
|
||||
:key="index"
|
||||
class="email-tag"
|
||||
closable
|
||||
@close="handleRemoveEmail(index)"
|
||||
>
|
||||
{{ email }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
v-if="showEmailInput"
|
||||
v-model="newEmail"
|
||||
class="email-input"
|
||||
placeholder="请输入邮箱并回车"
|
||||
@keyup.enter="handleAddEmail"
|
||||
@blur="handleEmailInputBlur"
|
||||
/>
|
||||
<el-button
|
||||
v-else
|
||||
class="button-new-email"
|
||||
:disabled="settingsData.email_config.toEmails.length >= 10"
|
||||
@click="showEmailInput = true"
|
||||
>
|
||||
+ 添加邮箱
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="form-tip">最多可添加10个收件邮箱地址</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -252,13 +608,45 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
max-width: 600px;
|
||||
max-width: 1500px;
|
||||
}
|
||||
|
||||
.settings-table {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.form-tip {
|
||||
margin-top: 8px;
|
||||
margin-left: 6px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加遮罩层相关样式
|
||||
:deep(.el-loading-mask) {
|
||||
background-color: rgb(255 255 255 / 80%);
|
||||
}
|
||||
|
||||
.email-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
|
||||
.email-tag {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.email-input {
|
||||
width: 320px;
|
||||
}
|
||||
|
||||
.button-new-email {
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -48,28 +48,6 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||
target: "http://127.0.0.1:9098",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/auth/, "/auth/user/rd")
|
||||
/* configure: (proxy, options) => {
|
||||
// 添加调试日志
|
||||
proxy.on("proxyReq", (proxyReq, req, res) => {
|
||||
console.log(res);
|
||||
console.log("代理请求:", {
|
||||
from: req.url,
|
||||
to: options.target + proxyReq.path
|
||||
});
|
||||
});
|
||||
proxy.on("proxyRes", (proxyRes, req, res) => {
|
||||
console.log(res);
|
||||
console.log("代理响应:", {
|
||||
path: req.url,
|
||||
status: proxyRes.statusCode
|
||||
});
|
||||
});
|
||||
proxy.on("error", (err, req, res) => {
|
||||
console.log(res);
|
||||
console.log(req);
|
||||
console.error("代理错误:", err);
|
||||
});
|
||||
} */
|
||||
}
|
||||
},
|
||||
// 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
|
||||
|
||||
Reference in New Issue
Block a user