Compare commits
14 Commits
master
...
65017f4bc7
| Author | SHA1 | Date | |
|---|---|---|---|
| 65017f4bc7 | |||
| 7cbca0ee87 | |||
| 0df937a933 | |||
| fbe0883037 | |||
| a8d6138159 | |||
| ecf70caf37 | |||
| e8960e0db6 | |||
| ac571ea4b0 | |||
| 02522561fc | |||
| c167d50f0e | |||
| 67b1945747 | |||
| 453208f593 | |||
| e39ea741ea | |||
| ee1ae711f5 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -19,4 +19,5 @@ tests/**/coverage/
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
tsconfig.tsbuildinfo
|
||||
tsconfig.tsbuildinfo
|
||||
/.husky/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# shellcheck source=./_/husky.sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
#. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
PATH="/usr/local/bin:$PATH"
|
||||
|
||||
npx --no-install commitlint --edit "$1"
|
||||
npx --no-install commitlint --edit "$1"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
[ -n "$CI" ] && exit 0
|
||||
@@ -7,4 +6,4 @@
|
||||
PATH="/usr/local/bin:$PATH"
|
||||
|
||||
# Perform lint check on files in the staging area through .lintstagedrc configuration
|
||||
pnpm exec lint-staged
|
||||
pnpm exec lint-staged
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { http } from "@/utils/http";
|
||||
import { baseUrlApi } from "./utils";
|
||||
// import { baseUrlApi } from "./utils";
|
||||
import { authApi } from "./utils";
|
||||
|
||||
type Result = {
|
||||
success: boolean;
|
||||
@@ -9,5 +10,6 @@ type Result = {
|
||||
export const getAsyncRoutes = () => {
|
||||
// return http.request<Result>("get", "/get-async-routes");
|
||||
// 暂时返回空动态路由
|
||||
return http.request<Result>("get", baseUrlApi("auth/async-routes"));
|
||||
// return http.request<Result>("get", baseUrlApi("auth/async-routes"));
|
||||
return http.request<Result>("get", authApi("async-routes"));
|
||||
};
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { http } from "@/utils/http";
|
||||
import { baseUrlApi } from "./utils";
|
||||
// import { baseUrlApi } from "./utils";
|
||||
// import { bizApi} from "./utils";
|
||||
import { authApi } from "./utils";
|
||||
|
||||
export type UserResult = {
|
||||
success: boolean;
|
||||
status: number;
|
||||
data: {
|
||||
/** 头像 */
|
||||
avatar: string;
|
||||
@@ -40,10 +43,17 @@ export const getLogin = (data?: object) => {
|
||||
// return http.request<UserResult>("post", "/login", { data });
|
||||
// console.log(http.request<any>("get", baseUrlApi("/user/roles")));
|
||||
// console.log(data);
|
||||
return http.request<UserResult>("post", baseUrlApi("login"), { data });
|
||||
// return http.request<UserResult>("post", baseUrlApi("login"), { data });
|
||||
return http.request<UserResult>("post", authApi("login"), { data });
|
||||
};
|
||||
|
||||
/** 刷新`token` */
|
||||
export const refreshTokenApi = (data?: object) => {
|
||||
return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
|
||||
return http.request<RefreshTokenResult>("post", authApi("/refresh-token"), {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
export const getCaptcha = () => {
|
||||
return http.request<any>("get", authApi("/captcha"));
|
||||
};
|
||||
|
||||
@@ -1,4 +1,42 @@
|
||||
// 第一个代理后端地址
|
||||
export const baseUrlApi = (url: string) => `/base/${url}`;
|
||||
// 第二个代理后端地址
|
||||
export const baseUrlAuthrApi = (url: string) => `/auth/${url}`;
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
// 创建通用请求方法
|
||||
export const request = async (url: string, options: RequestInit = {}) => {
|
||||
const defaultHeaders = {
|
||||
"Content-Type": "application/json"
|
||||
};
|
||||
|
||||
// 获取token
|
||||
const token = getToken();
|
||||
|
||||
// 非登录接口才添加token
|
||||
if (!url.includes("/login") && token) {
|
||||
// defaultHeaders["Authorization"] = `Bearer ${token}`; // 添加Bearer前缀
|
||||
defaultHeaders["Authorization"] = `Bearer ${token.accessToken}`; // 添加Bearer前缀
|
||||
}
|
||||
|
||||
const config = {
|
||||
...options,
|
||||
headers: {
|
||||
...defaultHeaders,
|
||||
...options.headers
|
||||
}
|
||||
};
|
||||
|
||||
const response = await fetch(url, config);
|
||||
const data = await response.json();
|
||||
|
||||
if (data.code === 200 || data.status === 200) {
|
||||
return data;
|
||||
} else {
|
||||
throw new Error(data.message || "请求失败");
|
||||
}
|
||||
};
|
||||
|
||||
// API URL 生成器
|
||||
export const authApi = (path: string) => `/auth/${path}`;
|
||||
|
||||
export const bizApi = (path: string) => `/biz/${path}`;
|
||||
|
||||
// 登录接口
|
||||
export const loginApi = (path: string) => `/auth/${path}`;
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "飞机管理",
|
||||
rank: 5
|
||||
rank: 5,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "工具管理",
|
||||
rank: 7
|
||||
rank: 7,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "适航资源",
|
||||
rank: 2
|
||||
rank: 2,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
51
src/router/modules/auth.ts
Normal file
51
src/router/modules/auth.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
const Layout = () => import("@/layout/index.vue");
|
||||
|
||||
export default {
|
||||
path: "/auth",
|
||||
name: "res-auth",
|
||||
component: Layout,
|
||||
redirect: "/auth/company",
|
||||
meta: {
|
||||
icon: "ep:lollipop",
|
||||
title: "auth管理",
|
||||
rank: 1
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/auth/backendUser",
|
||||
name: "backendUser",
|
||||
component: () => import("@/views/auth/backendUser/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:admin-fill",
|
||||
title: "管理端用户"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/auth/company",
|
||||
name: "company",
|
||||
component: () => import("@/views/auth/company/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:building-line",
|
||||
title: "公司管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/auth/frontendUser",
|
||||
name: "frontendUser",
|
||||
component: () => import("@/views/auth/frontendUser/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:admin-line",
|
||||
title: "用户管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/auth/role",
|
||||
name: "role",
|
||||
component: () => import("@/views/auth/role/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:shield-user-line",
|
||||
title: "角色管理"
|
||||
}
|
||||
}
|
||||
]
|
||||
} satisfies RouteConfigsTable;
|
||||
88
src/router/modules/biz.ts
Normal file
88
src/router/modules/biz.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
const Layout = () => import("@/layout/index.vue");
|
||||
|
||||
export default {
|
||||
path: "/biz",
|
||||
name: "res-biz",
|
||||
component: Layout,
|
||||
redirect: "/biz/issuanceBid",
|
||||
meta: {
|
||||
icon: "ri:ubuntu-fill",
|
||||
title: "biz管理",
|
||||
rank: 2
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/biz/issuanceBid",
|
||||
name: "issuanceBid",
|
||||
component: () => import("@/views/biz/issuanceBid/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:terminal-window-line",
|
||||
title: "招标管理",
|
||||
showParent: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/bid",
|
||||
name: "bid",
|
||||
component: () => import("@/views/biz/bid/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:artboard-line",
|
||||
title: "投标管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/membershipPoint",
|
||||
name: "membershipPoint",
|
||||
component: () => import("@/views/biz/membershipPoint/index.vue"),
|
||||
meta: {
|
||||
icon: "mingcute:coin-3-line",
|
||||
title: "积分管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/pointSpend",
|
||||
name: "pointSpend",
|
||||
component: () => import("@/views/biz/pointSpend/index.vue"),
|
||||
meta: {
|
||||
icon: "mdi:format-list-bulleted",
|
||||
title: "积分消费记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/purchase",
|
||||
name: "purchase",
|
||||
component: () => import("@/views/biz/purchase/index.vue"),
|
||||
meta: {
|
||||
icon: "material-symbols:tools-ladder",
|
||||
title: "道具管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/purchaseSpend",
|
||||
name: "purchaseSpend",
|
||||
component: () => import("@/views/biz/purchaseSpend/index.vue"),
|
||||
meta: {
|
||||
icon: "mdi:format-list-bulleted-square",
|
||||
title: "道具消费记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/opsLog",
|
||||
name: "opsLog",
|
||||
component: () => import("@/views/biz/opsLog/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:file-list-3-line",
|
||||
title: "日志管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/sysSettings",
|
||||
name: "sysSettings",
|
||||
component: () => import("@/views/biz/sysSettings/index.vue"),
|
||||
meta: {
|
||||
icon: "ri:settings-3-line",
|
||||
title: "系统设置"
|
||||
}
|
||||
}
|
||||
]
|
||||
} satisfies RouteConfigsTable;
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "飞行记录",
|
||||
rank: 1
|
||||
rank: 1,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "航材管理",
|
||||
rank: 6
|
||||
rank: 6,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "资源共享",
|
||||
rank: 3
|
||||
rank: 3,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "数据统计",
|
||||
rank: 4
|
||||
rank: 4,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "系统管理",
|
||||
rank: 9
|
||||
rank: 9,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "人员管理",
|
||||
rank: 8
|
||||
rank: 8,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -66,12 +66,20 @@ export const useUserStore = defineStore({
|
||||
},
|
||||
/** 登入 */
|
||||
async loginByUsername(data) {
|
||||
console.info("```````````````````````````````````````````````");
|
||||
// console.info(data);
|
||||
return new Promise<UserResult>((resolve, reject) => {
|
||||
getLogin(data)
|
||||
.then(data => {
|
||||
console.log("loginByUsername");
|
||||
/* console.log("loginByUsername");
|
||||
console.log(data.data);
|
||||
if (data?.success) setToken(data.data);
|
||||
console.log(data.status);
|
||||
console.log(data); */
|
||||
//if (data?.success) setToken(data.data);
|
||||
// if(data?.status==200) setToken(data.data);
|
||||
if (data && data.status == 200) {
|
||||
setToken(data.data);
|
||||
}
|
||||
resolve(data);
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -80,7 +88,7 @@ export const useUserStore = defineStore({
|
||||
});
|
||||
},
|
||||
/** 前端登出(不调用接口) */
|
||||
logOut() {
|
||||
async logOut() {
|
||||
this.username = "";
|
||||
this.roles = [];
|
||||
this.permissions = [];
|
||||
@@ -88,6 +96,7 @@ export const useUserStore = defineStore({
|
||||
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
||||
resetRouter();
|
||||
router.push("/login");
|
||||
return Promise.resolve();
|
||||
},
|
||||
/** 刷新`token` */
|
||||
async handRefreshToken(data) {
|
||||
@@ -103,6 +112,19 @@ export const useUserStore = defineStore({
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 设置用户信息 */
|
||||
async setUserInfo(data) {
|
||||
this.username = data.username;
|
||||
this.roles = data.roles || [];
|
||||
// 设置其他用户信息...
|
||||
return Promise.resolve(data);
|
||||
},
|
||||
/** 重置token */
|
||||
resetToken() {
|
||||
removeToken();
|
||||
this.roles = [];
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -124,6 +124,8 @@ export function removeToken() {
|
||||
|
||||
/** 格式化token(jwt格式) */
|
||||
export const formatToken = (token: string): string => {
|
||||
/* console.log("token", token);
|
||||
console.info("Bearer " + token); */
|
||||
return "Bearer " + token;
|
||||
};
|
||||
|
||||
|
||||
343
src/views/auth/backendUser/index.vue
Normal file
343
src/views/auth/backendUser/index.vue
Normal file
@@ -0,0 +1,343 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "backendUser"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
name: "",
|
||||
nickName: "",
|
||||
phoneNum: "",
|
||||
email: ""
|
||||
});
|
||||
|
||||
// 定义数据列表
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 角色列表数据
|
||||
const roleOptions = ref([]);
|
||||
// 获得角色列表
|
||||
const getRoleList = async () => {
|
||||
try {
|
||||
const res = await request(authApi("getRoles"), {
|
||||
method: "post"
|
||||
});
|
||||
// console.info(res);
|
||||
if (res.status === 200) {
|
||||
roleOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.roleName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取角色列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 获得后端用户列表
|
||||
|
||||
const getUserList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(authApi("backendUserPage"), {
|
||||
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;
|
||||
getUserList();
|
||||
};
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
name: "",
|
||||
nickName: "",
|
||||
phoneNum: "",
|
||||
email: ""
|
||||
};
|
||||
getUserList();
|
||||
};
|
||||
// 分页变化
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "账号",
|
||||
prop: "name",
|
||||
width: "160",
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: "昵称",
|
||||
prop: "nickName",
|
||||
width: "180"
|
||||
},
|
||||
{
|
||||
label: "电话",
|
||||
prop: "phoneNum",
|
||||
width: "120"
|
||||
},
|
||||
{
|
||||
label: "邮件",
|
||||
prop: "email",
|
||||
width: "200"
|
||||
},
|
||||
{
|
||||
label: "角色",
|
||||
prop: "roleId",
|
||||
width: "150",
|
||||
formatter: row => {
|
||||
const role = roleOptions.value.find(item => item.value === row.roleId);
|
||||
return role ? role.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "上次登陆时间",
|
||||
prop: "createTime",
|
||||
width: "155",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "155",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: "160",
|
||||
slot: "operation"
|
||||
}
|
||||
];
|
||||
|
||||
function handleClick(row) {
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
// 添加编辑和删除方法
|
||||
const handleEdit = row => {
|
||||
console.log("编辑", row);
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
ElMessage.success("删除成功");
|
||||
getUserList(); // 刷新列表
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
ElMessage.error(error.message || "删除失败");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消删除
|
||||
});
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getUserList();
|
||||
getRoleList(); // 获取角色列表数据
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="backendUser-container">
|
||||
<div class="search-box">
|
||||
<el-form
|
||||
ref="queryForm"
|
||||
:model="queryParams"
|
||||
:inline="true"
|
||||
class="search-form"
|
||||
>
|
||||
<div class="form-row">
|
||||
<el-form-item label="账号" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入账号"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="昵称" prop="nickName">
|
||||
<el-input
|
||||
v-model="queryParams.nickName"
|
||||
placeholder="请输入昵称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="电话" prop="phoneNum">
|
||||
<el-input
|
||||
v-model="queryParams.phoneNum"
|
||||
placeholder="请输入电话"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input
|
||||
v-model="queryParams.email"
|
||||
placeholder="请输入邮箱"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<el-tag :type="row.status == '1' ? 'success' : 'danger'" size="small">
|
||||
{{ row.status == "1" ? "正常" : "异常" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @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>
|
||||
.backendUser-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
.search-form {
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-form-item) {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 0;
|
||||
|
||||
// 调整输入框宽度
|
||||
.el-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.search-buttons {
|
||||
flex: 0 0 auto;
|
||||
min-width: auto;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
269
src/views/auth/company/index.vue
Normal file
269
src/views/auth/company/index.vue
Normal file
@@ -0,0 +1,269 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { clone } from "@pureadmin/utils";
|
||||
import PureTableBar from "@/components/RePureTableBar/src/bar";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi } from "@/api/utils";
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
defineOptions({
|
||||
name: "company"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
companyName: "",
|
||||
companyCode: "",
|
||||
status: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 获取公司列表数据
|
||||
const getCompanyList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
|
||||
console.log(params);
|
||||
|
||||
const data = await request(authApi("companyPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
/* tableData.value = data.data.records;
|
||||
total.value = data.data.total; */
|
||||
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;
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
companyName: "",
|
||||
companyCode: "",
|
||||
status: ""
|
||||
};
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "名称",
|
||||
prop: "companyName",
|
||||
width: "260",
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: "编码",
|
||||
prop: "companyCode",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: "260",
|
||||
slot: "status"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "260",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: "160",
|
||||
slot: "operation"
|
||||
}
|
||||
];
|
||||
|
||||
function handleClick(row) {
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
// 添加编辑和删除方法
|
||||
const handleEdit = row => {
|
||||
console.log("编辑", row);
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
ElMessage.success("删除成功");
|
||||
getCompanyList(); // 刷新列表
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
ElMessage.error(error.message || "删除失败");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消删除
|
||||
});
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="company-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="公司名称" prop="companyName">
|
||||
<el-input
|
||||
v-model="queryParams.companyName"
|
||||
placeholder="请输入公司名称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="公司编码" prop="companyCode">
|
||||
<el-input
|
||||
v-model="queryParams.companyCode"
|
||||
placeholder="请输入公司编码"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="status-select"
|
||||
>
|
||||
<el-option label="正常" value="1" />
|
||||
<el-option label="异常" value="0" />
|
||||
</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 #status="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'danger'" size="small">
|
||||
{{ row.status === 1 ? "正常" : "异常" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @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>
|
||||
.company-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
// 取消 el-form-item 的底部边距
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.status-select {
|
||||
width: 90px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
419
src/views/auth/frontendUser/index.vue
Normal file
419
src/views/auth/frontendUser/index.vue
Normal file
@@ -0,0 +1,419 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { clone } from "@pureadmin/utils";
|
||||
import PureTableBar from "@/components/RePureTableBar/src/bar";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi } from "@/api/utils";
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
defineOptions({
|
||||
name: "frontendUser"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
name: "",
|
||||
nikeName: "",
|
||||
phoneNum: "",
|
||||
companyId: "",
|
||||
email: "",
|
||||
status: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 公司列表数据
|
||||
const companyOptions = ref([]);
|
||||
|
||||
// 获取公司列表
|
||||
const getCompanyList = async () => {
|
||||
try {
|
||||
const res = await request(authApi("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 roleOptions = ref([]);
|
||||
// 获得角色列表
|
||||
const getRoleList = async () => {
|
||||
try {
|
||||
const res = await request(authApi("getRoles"), {
|
||||
method: "post"
|
||||
});
|
||||
// console.info(res);
|
||||
if (res.status === 200) {
|
||||
roleOptions.value = res.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.roleName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取角色列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 获得前端用户列表
|
||||
const getUserList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(authApi("frontendUserPage"), {
|
||||
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;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
name: "",
|
||||
nikeName: "",
|
||||
phoneNum: "",
|
||||
companyId: "",
|
||||
email: "",
|
||||
status: ""
|
||||
};
|
||||
getUserList();
|
||||
};
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "账号",
|
||||
prop: "name",
|
||||
width: "160",
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: "昵称",
|
||||
prop: "nickName",
|
||||
width: "180"
|
||||
},
|
||||
{
|
||||
label: "电话",
|
||||
prop: "phoneNum",
|
||||
width: "120"
|
||||
},
|
||||
{
|
||||
label: "邮件",
|
||||
prop: "email",
|
||||
width: "200"
|
||||
},
|
||||
{
|
||||
label: "所属公司",
|
||||
prop: "companyId",
|
||||
width: "150",
|
||||
formatter: row => {
|
||||
const company = companyOptions.value.find(
|
||||
item => item.value === row.companyId
|
||||
);
|
||||
return company ? company.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "角色",
|
||||
prop: "roleId",
|
||||
width: "150",
|
||||
formatter: row => {
|
||||
const role = roleOptions.value.find(item => item.value === row.roleId);
|
||||
return role ? role.label : "";
|
||||
}
|
||||
},
|
||||
// {
|
||||
// label: "微信ID",
|
||||
// prop: "wxOpenid",
|
||||
// width: "260"
|
||||
// },
|
||||
{
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: "100",
|
||||
slot: "status"
|
||||
},
|
||||
{
|
||||
label: "上次登陆时间",
|
||||
prop: "createTime",
|
||||
width: "155",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "155",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: "160",
|
||||
slot: "operation"
|
||||
}
|
||||
];
|
||||
|
||||
function handleClick(row) {
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
// 添加编辑和删除方法
|
||||
const handleEdit = row => {
|
||||
console.log("编辑", row);
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
ElMessage.success("删除成功");
|
||||
getUserList(); // 刷新列表
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
ElMessage.error(error.message || "删除失败");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消删除
|
||||
});
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getUserList();
|
||||
getCompanyList(); // 获取公司列表数据
|
||||
getRoleList(); // 获取角色列表数据
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="frontendUser-container">
|
||||
<div class="search-box">
|
||||
<el-form
|
||||
ref="queryForm"
|
||||
:model="queryParams"
|
||||
:inline="true"
|
||||
class="search-form"
|
||||
>
|
||||
<!-- 第一行 -->
|
||||
<div class="form-row">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="nikeName">
|
||||
<el-input
|
||||
v-model="queryParams.nikeName"
|
||||
placeholder="请输入昵称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="电话号码" prop="phoneNum">
|
||||
<el-input
|
||||
v-model="queryParams.phoneNum"
|
||||
placeholder="请输入电话号码"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input
|
||||
v-model="queryParams.email"
|
||||
placeholder="请输入邮箱"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</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="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="status-select"
|
||||
>
|
||||
<el-option label="正常" value="1" />
|
||||
<el-option label="禁用" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<el-tag :type="row.status == '1' ? 'success' : 'danger'" size="small">
|
||||
{{ row.status == "1" ? "正常" : "异常" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @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>
|
||||
.frontendUser-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
.search-form {
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-form-item) {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 0;
|
||||
|
||||
// 调整输入框宽度
|
||||
.el-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.search-buttons {
|
||||
flex: 0 0 auto;
|
||||
min-width: auto;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status-select {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.company-select {
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
255
src/views/auth/role/index.vue
Normal file
255
src/views/auth/role/index.vue
Normal file
@@ -0,0 +1,255 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { clone } from "@pureadmin/utils";
|
||||
import PureTableBar from "@/components/RePureTableBar/src/bar";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi } from "@/api/utils";
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
defineOptions({
|
||||
name: "company"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
roleName: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 获取公司列表数据
|
||||
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)
|
||||
});
|
||||
|
||||
/* tableData.value = data.data.records;
|
||||
total.value = data.data.total; */
|
||||
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;
|
||||
getRoleList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
roleName: ""
|
||||
};
|
||||
getRoleList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getRoleList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getRoleList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "名称",
|
||||
prop: "roleName",
|
||||
width: "260",
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: "创建者",
|
||||
prop: "createUserId",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "描述",
|
||||
prop: "description",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "260",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "更新时间",
|
||||
prop: "updateTime",
|
||||
width: "260",
|
||||
formatter: row => {
|
||||
return row.updateTime
|
||||
? dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: "160",
|
||||
slot: "operation"
|
||||
}
|
||||
];
|
||||
|
||||
function handleClick(row) {
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
// 添加编辑和删除方法
|
||||
const handleEdit = row => {
|
||||
console.log("编辑", row);
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
ElMessage.success("删除成功");
|
||||
getRoleList(); // 刷新列表
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
ElMessage.error(error.message || "删除失败");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消删除
|
||||
});
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getRoleList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="company-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="角色名称" prop="roleName">
|
||||
<el-input
|
||||
v-model="queryParams.roleName"
|
||||
placeholder="请输入角色名称"
|
||||
clearable
|
||||
@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 #status="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'danger'" size="small">
|
||||
{{ row.status === 1 ? "正常" : "异常" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @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>
|
||||
.company-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
// 取消 el-form-item 的底部边距
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.status-select {
|
||||
width: 90px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
387
src/views/biz/bid/index.vue
Normal file
387
src/views/biz/bid/index.vue
Normal file
@@ -0,0 +1,387 @@
|
||||
<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: "bid"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
usePurchase: "",
|
||||
isWinner: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
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 getBidList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("bidPage"), {
|
||||
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;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
usePurchase: "",
|
||||
isWinner: ""
|
||||
};
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
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",
|
||||
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: "isWinner",
|
||||
width: "90",
|
||||
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",
|
||||
formatter: row => {
|
||||
return row.usePurchase === 1 ? "使用" : "未使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "排他卡",
|
||||
prop: "useExcludeCardFlag",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.useExcludeCardFlag === 1 ? "使用" : "未使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "插队卡",
|
||||
prop: "useJumpCardFlag",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.useJumpCardFlag === 1 ? "使用" : "未使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "直通卡",
|
||||
prop: "useThroughCardFlag",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.useThroughCardFlag === 1 ? "使用" : "未使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
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("deleteBid"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getBidList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getBidList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bid-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="usePurchase">
|
||||
<el-select
|
||||
v-model="queryParams.usePurchase"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option label="使用" :value="1" />
|
||||
<el-option label="未使用" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="中标者" prop="isWinner">
|
||||
<el-select
|
||||
v-model="queryParams.isWinner"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option label="是" :value="1" />
|
||||
<el-option label="否" :value="0" />
|
||||
</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>
|
||||
.bid-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>
|
||||
535
src/views/biz/issuanceBid/index.vue
Normal file
535
src/views/biz/issuanceBid/index.vue
Normal file
@@ -0,0 +1,535 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi, bizApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "issuanceBid"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
bidType: "",
|
||||
bidField: "",
|
||||
category: "",
|
||||
bidStatus: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
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 getBidList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("issuanceBidPage"), {
|
||||
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;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
bidType: "",
|
||||
bidField: "",
|
||||
category: "",
|
||||
bidStatus: ""
|
||||
};
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getBidList();
|
||||
};
|
||||
|
||||
// 添加状态选项
|
||||
const bidStatusOptions = [
|
||||
{ value: 1, label: "完成" },
|
||||
{ value: 2, label: "未完成" },
|
||||
{ value: 3, label: "超时" }
|
||||
];
|
||||
|
||||
// 添加中标状态选项
|
||||
const existsWinnerOptions = [
|
||||
{ value: 1, label: "存在" },
|
||||
{ value: 0, label: "不存在" }
|
||||
];
|
||||
|
||||
// 添加道具使用状态选项
|
||||
const usePurchaseOptions = [
|
||||
{ value: 1, label: "使用" },
|
||||
{ value: 0, label: "未使用" }
|
||||
];
|
||||
|
||||
// 添加发标类型选项
|
||||
const bidTypeOptions = [
|
||||
{ value: 1, label: "求购" },
|
||||
{ value: 2, label: "租赁" }
|
||||
];
|
||||
|
||||
// 添加发标领域选项
|
||||
const bidFieldOptions = [
|
||||
{ value: 1, label: "民航" },
|
||||
{ value: 2, label: "通航" }
|
||||
];
|
||||
|
||||
// 添加发标分类选项
|
||||
const categoryOptions = [
|
||||
{ value: 1, label: "航材" },
|
||||
{ value: 2, label: "飞机" }
|
||||
];
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
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",
|
||||
formatter: row => {
|
||||
return row.isCompany ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "公司名称",
|
||||
prop: "companyId",
|
||||
width: "150",
|
||||
formatter: row => {
|
||||
const company = companyOptions.value.find(
|
||||
item => item.value === row.companyId
|
||||
);
|
||||
return company ? company.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "发标类型",
|
||||
prop: "bidType",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const type = bidTypeOptions.find(item => item.value === row.bidType);
|
||||
return type ? type.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "发标领域",
|
||||
prop: "bidField",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const field = bidFieldOptions.find(item => item.value === row.bidField);
|
||||
return field ? field.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "需求数量",
|
||||
prop: "needNum",
|
||||
width: "90"
|
||||
},
|
||||
{
|
||||
label: "发标分类",
|
||||
prop: "category",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const cat = categoryOptions.find(item => item.value === row.category);
|
||||
return cat ? cat.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "型号/件号",
|
||||
prop: "pnNum",
|
||||
width: "120"
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
prop: "bidStatus",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
const status = bidStatusOptions.find(
|
||||
item => item.value === row.bidStatus
|
||||
);
|
||||
return status ? status.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "中标者",
|
||||
prop: "existsWinner",
|
||||
width: "100",
|
||||
formatter: row => {
|
||||
const winner = existsWinnerOptions.find(
|
||||
item => item.value === row.existsWinner
|
||||
);
|
||||
return winner ? winner.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "使用道具",
|
||||
prop: "usePurchase",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
const purchase = usePurchaseOptions.find(
|
||||
item => item.value === row.usePurchase
|
||||
);
|
||||
return purchase ? purchase.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "置顶卡",
|
||||
prop: "useTopCardFlag",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.useTopCardFlag === 0 ? "未使用" : "使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "加量卡",
|
||||
prop: "useRaiseCardFlag",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.useRaiseCardFlag === 0 ? "未使用" : "使用";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "有效天数",
|
||||
prop: "validDays",
|
||||
width: "90"
|
||||
},
|
||||
{
|
||||
label: "截止日期",
|
||||
prop: "expiryDate",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.expiryDate
|
||||
? dayjs(row.expiryDate).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("deleteIssuanceBid"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getBidList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getBidList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="issuanceBid-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="isCompany">
|
||||
<el-select
|
||||
v-model="queryParams.isCompany"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
class="company-type-select"
|
||||
>
|
||||
<el-option label="是" :value="true" />
|
||||
<el-option label="否" :value="false" />
|
||||
</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="bidType">
|
||||
<el-select
|
||||
v-model="queryParams.bidType"
|
||||
placeholder="请选择发标类型"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in bidTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发标领域" prop="bidField">
|
||||
<el-select
|
||||
v-model="queryParams.bidField"
|
||||
placeholder="请选择发标领域"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in bidFieldOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发标分类" prop="category">
|
||||
<el-select
|
||||
v-model="queryParams.category"
|
||||
placeholder="请选择发标分类"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in categoryOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="状态" prop="bidStatus">
|
||||
<el-select
|
||||
v-model="queryParams.bidStatus"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in bidStatusOptions"
|
||||
: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>
|
||||
.issuanceBid-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;
|
||||
}
|
||||
|
||||
.company-type-select {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.type-select {
|
||||
width: 120px;
|
||||
}
|
||||
</style>
|
||||
399
src/views/biz/membershipPoint/index.vue
Normal file
399
src/views/biz/membershipPoint/index.vue
Normal file
@@ -0,0 +1,399 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi, bizApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "membershipPoint"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
companyId: "",
|
||||
memberType: "",
|
||||
memberLevel: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 公司列表数据
|
||||
const companyOptions = ref([]);
|
||||
|
||||
// 添加会员类型选项
|
||||
const memberTypeOptions = [
|
||||
{ value: "1", label: "普通会员" },
|
||||
{ value: "2", label: "包年会员" },
|
||||
{ value: "3", label: "季度会员" },
|
||||
{ value: "4", label: "月度会员" }
|
||||
];
|
||||
|
||||
// 获取公司列表
|
||||
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 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 getPointList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request("/biz/membershipPointPage", {
|
||||
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;
|
||||
getPointList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
companyId: "",
|
||||
memberType: "",
|
||||
memberLevel: ""
|
||||
};
|
||||
getPointList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getPointList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getPointList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
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: "100",
|
||||
formatter: row => {
|
||||
return row.isCompany ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "所属公司",
|
||||
prop: "companyId",
|
||||
width: "180",
|
||||
formatter: row => {
|
||||
const company = companyOptions.value.find(
|
||||
item => item.value === row.companyId
|
||||
);
|
||||
return company ? company.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "总积分",
|
||||
prop: "totalPoints",
|
||||
width: "100"
|
||||
},
|
||||
{
|
||||
label: "会员类型",
|
||||
prop: "memberType",
|
||||
width: "120",
|
||||
formatter: row => {
|
||||
const type = memberTypeOptions.find(item => item.value == row.memberType);
|
||||
return type ? type.label : "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "会员等级",
|
||||
prop: "memberLevel",
|
||||
width: "120"
|
||||
},
|
||||
{
|
||||
label: "会员开始时间",
|
||||
prop: "memberStartTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.memberStartTime
|
||||
? dayjs(row.memberStartTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "会员截止时间",
|
||||
prop: "memberExpireTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.memberExpireTime
|
||||
? dayjs(row.memberExpireTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: "150",
|
||||
slot: "operation"
|
||||
}
|
||||
];
|
||||
|
||||
// 添加操作方法
|
||||
const handleDetail = row => {
|
||||
console.log("查看明细", row);
|
||||
// TODO: 实现查看明细逻辑
|
||||
};
|
||||
|
||||
const handleEdit = row => {
|
||||
console.log("编辑", row);
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
ElMessage.success("删除成功");
|
||||
getPointList(); // 刷新列表
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
ElMessage.error(error.message || "删除失败");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消删除
|
||||
});
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getPointList();
|
||||
getCompanyList(); // 获取公司列表数据
|
||||
getFrontendUserList(); // 获取前端用户列表数据
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="membershipPoint-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="memberType">
|
||||
<el-select
|
||||
v-model="queryParams.memberType"
|
||||
placeholder="请选择会员类型"
|
||||
clearable
|
||||
class="member-type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in memberTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="会员等级" prop="memberLevel">
|
||||
<el-input
|
||||
v-model="queryParams.memberLevel"
|
||||
placeholder="请输入会员等级"
|
||||
clearable
|
||||
@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 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="danger" size="small" @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>
|
||||
.membershipPoint-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.company-select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.member-type-select {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.user-select {
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
334
src/views/biz/opsLog/index.vue
Normal file
334
src/views/biz/opsLog/index.vue
Normal file
@@ -0,0 +1,334 @@
|
||||
<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: "opsLog"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: undefined
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
opsType: "",
|
||||
keyWords: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
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 opsTypeOptions = [
|
||||
{ value: 1, label: "登录" },
|
||||
{ value: 2, label: "设置订阅" },
|
||||
{ value: 3, label: "搜索" },
|
||||
{ value: 4, label: "发标" },
|
||||
{ value: 5, label: "投标" },
|
||||
{ value: 6, label: "购买道具" }
|
||||
];
|
||||
|
||||
// 获取日志列表
|
||||
const getOpsLogList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("opsLogPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (data.status === 200 && data.data != null) {
|
||||
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;
|
||||
getOpsLogList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
opsType: "",
|
||||
keyWords: ""
|
||||
};
|
||||
getOpsLogList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getOpsLogList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getOpsLogList();
|
||||
};
|
||||
|
||||
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",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const company = companyOptions.value.find(
|
||||
item => item.value === row.companyId
|
||||
);
|
||||
return company ? company.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作类型",
|
||||
prop: "opsType",
|
||||
width: "120",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const type = opsTypeOptions.find(item => item.value === row.opsType);
|
||||
return type ? type.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "关键词",
|
||||
prop: "keyWords",
|
||||
width: "200"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getOpsLogList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="ops-log-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="opsType">
|
||||
<el-select
|
||||
v-model="queryParams.opsType"
|
||||
placeholder="请选择操作类型"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in opsTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关键词" prop="keyWords">
|
||||
<el-input
|
||||
v-model="queryParams.keyWords"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
class="input-width"
|
||||
/>
|
||||
</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>
|
||||
.ops-log-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;
|
||||
}
|
||||
|
||||
.input-width {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
412
src/views/biz/pointSpend/index.vue
Normal file
412
src/views/biz/pointSpend/index.vue
Normal file
@@ -0,0 +1,412 @@
|
||||
<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: "pointSpend"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
managerId: "",
|
||||
spendType: "",
|
||||
membershipPointsId: "",
|
||||
purchaseId: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
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 managerUserOptions = ref([]);
|
||||
// 获取管理用户列表
|
||||
const getManagerUserList = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("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 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 getPointSpendList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("pointSpendPage"), {
|
||||
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;
|
||||
getPointSpendList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
managerId: "",
|
||||
spendType: "",
|
||||
membershipPointsId: "",
|
||||
purchaseId: ""
|
||||
};
|
||||
getPointSpendList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getPointSpendList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getPointSpendList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
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: "managerId",
|
||||
width: "120",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const manager = managerUserOptions.value.find(
|
||||
item => item.value === row.managerId
|
||||
);
|
||||
return manager ? manager.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "类型",
|
||||
prop: "spendingType",
|
||||
width: "90",
|
||||
formatter: row => {
|
||||
return row.spendingType === 0 ? "充值" : "消费";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "会员积分ID",
|
||||
prop: "membershipPointsId",
|
||||
width: "120"
|
||||
},
|
||||
{
|
||||
label: "积分数",
|
||||
prop: "spendingPoints",
|
||||
width: "90"
|
||||
},
|
||||
{
|
||||
label: "道具ID",
|
||||
prop: "purchaseId",
|
||||
width: "120"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).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("deletePointSpend"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getPointSpendList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getPointSpendList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
getManagerUserList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="point-spend-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="managerId">
|
||||
<el-select
|
||||
v-model="queryParams.managerId"
|
||||
placeholder="请选择管理者"
|
||||
clearable
|
||||
class="user-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in managerUserOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="类型" prop="spendType">
|
||||
<el-select
|
||||
v-model="queryParams.spendType"
|
||||
placeholder="请选择类型"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option label="充值" :value="0" />
|
||||
<el-option label="消费" :value="1" />
|
||||
</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>
|
||||
.point-spend-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>
|
||||
383
src/views/biz/purchase/index.vue
Normal file
383
src/views/biz/purchase/index.vue
Normal file
@@ -0,0 +1,383 @@
|
||||
<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: "purchase"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: undefined
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
purchasesType: "",
|
||||
isUsed: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
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 purchaseTypeOptions = [
|
||||
{ value: 1, label: "实时达卡" },
|
||||
{ value: 2, label: "排他卡" },
|
||||
{ value: 3, label: "插队卡" },
|
||||
{ value: 4, label: "直通卡" },
|
||||
{ value: 5, label: "加量卡" },
|
||||
{ value: 6, label: "置顶卡" }
|
||||
];
|
||||
|
||||
// 获取道具列表
|
||||
const getPurchaseList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("inappPurchasePage"), {
|
||||
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;
|
||||
getPurchaseList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
purchasesType: "",
|
||||
isUsed: ""
|
||||
};
|
||||
getPurchaseList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getPurchaseList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getPurchaseList();
|
||||
};
|
||||
|
||||
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: "purchasesType",
|
||||
width: "120",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
const type = purchaseTypeOptions.find(
|
||||
item => item.value === row.purchasesType
|
||||
);
|
||||
return type ? type.label : "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "使用",
|
||||
prop: "isUsed",
|
||||
width: "90",
|
||||
align: "center",
|
||||
formatter: row => {
|
||||
return row.isUsed === 1 ? "是" : "否";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).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("deletePurchase"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getPurchaseList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getPurchaseList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="purchase-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="purchasesType">
|
||||
<el-select
|
||||
v-model="queryParams.purchasesType"
|
||||
placeholder="请选择类型"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in purchaseTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="使用状态" prop="isUsed">
|
||||
<el-select
|
||||
v-model="queryParams.isUsed"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
class="type-select"
|
||||
>
|
||||
<el-option label="是" :value="1" />
|
||||
<el-option label="否" :value="0" />
|
||||
</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>
|
||||
.purchase-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>
|
||||
388
src/views/biz/purchaseSpend/index.vue
Normal file
388
src/views/biz/purchaseSpend/index.vue
Normal file
@@ -0,0 +1,388 @@
|
||||
<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: "purchaseSpend"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: undefined
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
purchasesId: "",
|
||||
subscribeId: "",
|
||||
issuanceBidId: "",
|
||||
biddingId: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
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 getPurchaseSpendList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
const data = await request(bizApi("purchaseSpendPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
|
||||
if (data.status === 200 && data.data != null) {
|
||||
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;
|
||||
getPurchaseSpendList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
userId: "",
|
||||
isCompany: "",
|
||||
companyId: "",
|
||||
purchasesId: "",
|
||||
subscribeId: "",
|
||||
issuanceBidId: "",
|
||||
biddingId: ""
|
||||
};
|
||||
getPurchaseSpendList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getPurchaseSpendList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getPurchaseSpendList();
|
||||
};
|
||||
|
||||
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: "道具ID",
|
||||
prop: "purchasesId",
|
||||
width: "120",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "订阅ID",
|
||||
prop: "subscribeId",
|
||||
width: "120",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "发标ID",
|
||||
prop: "issuanceBidId",
|
||||
width: "120",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "投标ID",
|
||||
prop: "biddingId",
|
||||
width: "120",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "160",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).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("deletePurchaseSpend"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ id: row.id })
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("删除成功");
|
||||
getPurchaseSpendList();
|
||||
} else {
|
||||
ElMessage.error(res.msg || "删除失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加编辑方法
|
||||
const handleEdit = (row: any) => {
|
||||
// TODO: 实现编辑功能
|
||||
console.log("编辑行:", row);
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getPurchaseSpendList();
|
||||
getFrontendUserList();
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="purchase-spend-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="道具ID" prop="purchasesId">
|
||||
<el-input
|
||||
v-model="queryParams.purchasesId"
|
||||
placeholder="请输入道具ID"
|
||||
clearable
|
||||
class="input-width"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="订阅ID" prop="subscribeId">
|
||||
<el-input
|
||||
v-model="queryParams.subscribeId"
|
||||
placeholder="请输入订阅ID"
|
||||
clearable
|
||||
class="input-width"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="发标ID" prop="issuanceBidId">
|
||||
<el-input
|
||||
v-model="queryParams.issuanceBidId"
|
||||
placeholder="请输入发标ID"
|
||||
clearable
|
||||
class="input-width"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="投标ID" prop="biddingId">
|
||||
<el-input
|
||||
v-model="queryParams.biddingId"
|
||||
placeholder="请输入投标ID"
|
||||
clearable
|
||||
class="input-width"
|
||||
/>
|
||||
</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>
|
||||
.purchase-spend-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;
|
||||
}
|
||||
|
||||
.input-width {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
9
src/views/biz/settings/index.vue
Normal file
9
src/views/biz/settings/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "settings"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>设置</h1>
|
||||
</template>
|
||||
264
src/views/biz/sysSettings/index.vue
Normal file
264
src/views/biz/sysSettings/index.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { request, bizApi } from "@/api/utils";
|
||||
|
||||
defineOptions({
|
||||
name: "sysSettings"
|
||||
});
|
||||
|
||||
// 定义配置数据
|
||||
const settingsData = ref({
|
||||
issuance_bids: {
|
||||
max_vadlid_days: 7,
|
||||
bidding_num: 3,
|
||||
cut_in_num: 5
|
||||
},
|
||||
subscribe: {
|
||||
subscribe_words: 3,
|
||||
word_length: 10
|
||||
},
|
||||
purchases: [
|
||||
{ purchase_type: 1, valid_day: 7, need_points: 2000 },
|
||||
{ purchase_type: 2, need_points: 3000 },
|
||||
{ purchase_type: 3, need_points: 300 },
|
||||
{ purchase_type: 4, need_points: 200000 },
|
||||
{ purchase_type: 5, need_points: 100 },
|
||||
{ purchase_type: 6, need_points: 1000 }
|
||||
],
|
||||
membership_config: {
|
||||
issuance_num_per_month_company: 10,
|
||||
issuance_num_per_month_person: 5
|
||||
}
|
||||
});
|
||||
|
||||
// 道具类型映射
|
||||
const purchaseTypeMap = {
|
||||
1: "置顶卡",
|
||||
2: "提升卡",
|
||||
3: "排他卡",
|
||||
4: "直通卡",
|
||||
5: "插队卡",
|
||||
6: "跳转卡"
|
||||
};
|
||||
|
||||
// 加载设置数据
|
||||
const loadSettings = async () => {
|
||||
try {
|
||||
const res = await request(bizApi("getSysSettings"), {
|
||||
method: "POST"
|
||||
});
|
||||
console.info(res);
|
||||
if (res.status === 200) {
|
||||
res.data.forEach(item => {
|
||||
settingsData.value[item.settingsKey] = JSON.parse(item.settingsContent);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取系统设置失败:", error);
|
||||
ElMessage.error("获取系统设置失败");
|
||||
}
|
||||
};
|
||||
|
||||
// 保存设置
|
||||
const saveSettings = async (key: string) => {
|
||||
try {
|
||||
const params = {
|
||||
settingsKey: key,
|
||||
settingsContent: JSON.stringify(settingsData.value[key])
|
||||
};
|
||||
const res = await request(bizApi("updateSysSettings"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
if (res.status === 200) {
|
||||
ElMessage.success("保存成功");
|
||||
} else {
|
||||
ElMessage.error(res.msg || "保存失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("保存系统设置失败:", error);
|
||||
ElMessage.error("保存系统设置失败");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadSettings();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="settings-container">
|
||||
<!-- 发标设置 -->
|
||||
<el-card class="settings-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>发标设置</span>
|
||||
<el-button type="primary" @click="saveSettings('issuance_bids')"
|
||||
>保存</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<el-form
|
||||
label-width="160px"
|
||||
:model="settingsData.issuance_bids"
|
||||
class="settings-form"
|
||||
>
|
||||
<el-form-item label="最大有效天数">
|
||||
<el-input-number
|
||||
v-model="settingsData.issuance_bids.max_vadlid_days"
|
||||
:min="1"
|
||||
:max="30"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="投标数量">
|
||||
<el-input-number
|
||||
v-model="settingsData.issuance_bids.bidding_num"
|
||||
:min="1"
|
||||
:max="10"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="插队数量">
|
||||
<el-input-number
|
||||
v-model="settingsData.issuance_bids.cut_in_num"
|
||||
:min="1"
|
||||
:max="10"
|
||||
/>
|
||||
</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('subscribe')"
|
||||
>保存</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<el-form
|
||||
label-width="160px"
|
||||
:model="settingsData.subscribe"
|
||||
class="settings-form"
|
||||
>
|
||||
<el-form-item label="订阅关键词数量">
|
||||
<el-input-number
|
||||
v-model="settingsData.subscribe.subscribe_words"
|
||||
:min="1"
|
||||
:max="10"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键词最大长度">
|
||||
<el-input-number
|
||||
v-model="settingsData.subscribe.word_length"
|
||||
:min="1"
|
||||
:max="20"
|
||||
/>
|
||||
</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('purchases')"
|
||||
>保存</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="settingsData.purchases" border class="settings-table">
|
||||
<el-table-column label="道具类型" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ purchaseTypeMap[row.purchase_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="有效天数" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-if="row.valid_day !== undefined"
|
||||
v-model="row.valid_day"
|
||||
:min="1"
|
||||
:max="30"
|
||||
controls-position="right"
|
||||
/>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所需积分" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.need_points"
|
||||
:min="1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- 会员配置 -->
|
||||
<el-card class="settings-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>会员配置</span>
|
||||
<el-button type="primary" @click="saveSettings('membership_config')"
|
||||
>保存</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<el-form
|
||||
label-width="160px"
|
||||
:model="settingsData.membership_config"
|
||||
class="settings-form"
|
||||
>
|
||||
<el-form-item label="公司每月发标数量">
|
||||
<el-input-number
|
||||
v-model="
|
||||
settingsData.membership_config.issuance_num_per_month_company
|
||||
"
|
||||
:min="1"
|
||||
:max="100"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="个人每月发标数量">
|
||||
<el-input-number
|
||||
v-model="
|
||||
settingsData.membership_config.issuance_num_per_month_person
|
||||
"
|
||||
:min="1"
|
||||
:max="50"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.settings-container {
|
||||
padding: 20px;
|
||||
|
||||
.settings-card {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.settings-form {
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.settings-table {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -12,6 +12,9 @@ import { bg, avatar, illustration } from "./utils/static";
|
||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||
import { ref, reactive, toRaw, onMounted, onBeforeUnmount } from "vue";
|
||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||
import { request, loginApi } from "@/api/utils";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { setToken, getToken } from "@/utils/auth";
|
||||
|
||||
import dayIcon from "@/assets/svg/day.svg?component";
|
||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
||||
@@ -34,32 +37,57 @@ const { title } = useNav();
|
||||
|
||||
const ruleForm = reactive({
|
||||
username: "admin",
|
||||
password: "admin123"
|
||||
password: "comcat@2019"
|
||||
});
|
||||
|
||||
const onLogin = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
await formEl.validate((valid, fields) => {
|
||||
await formEl.validate(async (valid, fields) => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
useUserStoreHook()
|
||||
.loginByUsername({
|
||||
username: ruleForm.username,
|
||||
password: ruleForm.password
|
||||
})
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
// 获取后端路由
|
||||
return initRouter().then(() => {
|
||||
router.push(getTopMenu(true).path).then(() => {
|
||||
message("登录成功", { type: "success" });
|
||||
});
|
||||
});
|
||||
} else {
|
||||
message("登录失败", { type: "error" });
|
||||
}
|
||||
})
|
||||
.finally(() => (loading.value = false));
|
||||
try {
|
||||
const res = await request(loginApi("login"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
username: ruleForm.username,
|
||||
password: ruleForm.password,
|
||||
isBackendUser: 1
|
||||
})
|
||||
});
|
||||
|
||||
console.log("登录响应:", res);
|
||||
|
||||
if (res.status === 200) {
|
||||
console.log("登录成功,开始初始化路由");
|
||||
console.log("accessToken:", res.data.accessToken);
|
||||
|
||||
// 存储token 格式为 DataInfo<T>
|
||||
//setToken(res.data.accessToken);
|
||||
setToken(res.data);
|
||||
|
||||
// 获取token
|
||||
console.log("获取token:", getToken());
|
||||
console.log(getToken());
|
||||
|
||||
// 更新用户信息
|
||||
const userStore = useUserStoreHook();
|
||||
await userStore.setUserInfo(res.data);
|
||||
|
||||
// 初始化路由
|
||||
await initRouter();
|
||||
|
||||
// 显示成功消息
|
||||
ElMessage.success("登录成功");
|
||||
|
||||
// 跳转到首页
|
||||
await router.push(getTopMenu(true).path);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("登录错误详情:", error);
|
||||
ElMessage.error(error.message || "登录失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -36,6 +36,40 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||
target: "http://127.0.0.1:3290",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/otherApi/, "")
|
||||
},
|
||||
// biz 接口
|
||||
"/biz": {
|
||||
target: "http://127.0.0.1:8089",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/biz/, "/biz/rd")
|
||||
},
|
||||
// auth 接口
|
||||
"/auth": {
|
||||
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