Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c28cc5b35 | |||
| 6ba76f11c4 | |||
| 5c1bd0cac0 | |||
| 4a66867d89 | |||
| 9329c8c22f | |||
| 312662e587 | |||
| 5eb65e38f2 | |||
| 8be8a98402 | |||
| 1cece2cf0c | |||
| 8fa26b3a44 | |||
| 4563f5ac91 | |||
| e22bfd9c65 | |||
| 1908146a75 | |||
| 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*
|
*.ntvs*
|
||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
tsconfig.tsbuildinfo
|
tsconfig.tsbuildinfo
|
||||||
|
/.husky/
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# shellcheck source=./_/husky.sh
|
# shellcheck source=./_/husky.sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
#. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
PATH="/usr/local/bin:$PATH"
|
PATH="/usr/local/bin:$PATH"
|
||||||
|
|
||||||
npx --no-install commitlint --edit "$1"
|
npx --no-install commitlint --edit "$1"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
. "$(dirname "$0")/common.sh"
|
. "$(dirname "$0")/common.sh"
|
||||||
|
|
||||||
[ -n "$CI" ] && exit 0
|
[ -n "$CI" ] && exit 0
|
||||||
@@ -7,4 +6,4 @@
|
|||||||
PATH="/usr/local/bin:$PATH"
|
PATH="/usr/local/bin:$PATH"
|
||||||
|
|
||||||
# Perform lint check on files in the staging area through .lintstagedrc configuration
|
# 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 { http } from "@/utils/http";
|
||||||
import { baseUrlApi } from "./utils";
|
// import { baseUrlApi } from "./utils";
|
||||||
|
import { authApi } from "./utils";
|
||||||
|
|
||||||
type Result = {
|
type Result = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
@@ -9,5 +10,6 @@ type Result = {
|
|||||||
export const getAsyncRoutes = () => {
|
export const getAsyncRoutes = () => {
|
||||||
// return http.request<Result>("get", "/get-async-routes");
|
// 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 { http } from "@/utils/http";
|
||||||
import { baseUrlApi } from "./utils";
|
// import { baseUrlApi } from "./utils";
|
||||||
|
// import { bizApi} from "./utils";
|
||||||
|
import { authApi } from "./utils";
|
||||||
|
|
||||||
export type UserResult = {
|
export type UserResult = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
status: number;
|
||||||
data: {
|
data: {
|
||||||
/** 头像 */
|
/** 头像 */
|
||||||
avatar: string;
|
avatar: string;
|
||||||
@@ -40,10 +43,17 @@ export const getLogin = (data?: object) => {
|
|||||||
// return http.request<UserResult>("post", "/login", { data });
|
// return http.request<UserResult>("post", "/login", { data });
|
||||||
// console.log(http.request<any>("get", baseUrlApi("/user/roles")));
|
// console.log(http.request<any>("get", baseUrlApi("/user/roles")));
|
||||||
// console.log(data);
|
// 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` */
|
/** 刷新`token` */
|
||||||
export const refreshTokenApi = (data?: object) => {
|
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 @@
|
|||||||
// 第一个代理后端地址
|
import { getToken } from "@/utils/auth";
|
||||||
export const baseUrlApi = (url: string) => `/base/${url}`;
|
|
||||||
// 第二个代理后端地址
|
// 创建通用请求方法
|
||||||
export const baseUrlAuthrApi = (url: string) => `/auth/${url}`;
|
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: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "飞机管理",
|
title: "飞机管理",
|
||||||
rank: 5
|
rank: 5,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "工具管理",
|
title: "工具管理",
|
||||||
rank: 7
|
rank: 7,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "适航资源",
|
title: "适航资源",
|
||||||
rank: 2
|
rank: 2,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
60
src/router/modules/auth.ts
Normal file
60
src/router/modules/auth.ts
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
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/personalCenter",
|
||||||
|
name: "personalCenter",
|
||||||
|
component: () => import("@/views/auth/personalCenter/index.vue"),
|
||||||
|
meta: {
|
||||||
|
icon: "material-symbols:manage-accounts",
|
||||||
|
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;
|
||||||
115
src/router/modules/biz.ts
Normal file
115
src/router/modules/biz.ts
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
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/propCount",
|
||||||
|
name: "propCount",
|
||||||
|
component: () => import("@/views/biz/propSummary/index.vue"),
|
||||||
|
meta: {
|
||||||
|
icon: "ri:bank-card-line",
|
||||||
|
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: "系统设置"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/biz/areas",
|
||||||
|
name: "areas",
|
||||||
|
component: () => import("@/views/biz/areas/index.vue"),
|
||||||
|
meta: {
|
||||||
|
icon: "ph:map-pin-area-bold",
|
||||||
|
title: "地区"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/biz/subscribe",
|
||||||
|
name: "subscribe",
|
||||||
|
component: () => import("@/views/biz/subscribe/index.vue"),
|
||||||
|
meta: {
|
||||||
|
icon: "material-symbols:activity-zone-outline",
|
||||||
|
title: "订阅管理"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
} satisfies RouteConfigsTable;
|
||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "飞行记录",
|
title: "飞行记录",
|
||||||
rank: 1
|
rank: 1,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "航材管理",
|
title: "航材管理",
|
||||||
rank: 6
|
rank: 6,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "资源共享",
|
title: "资源共享",
|
||||||
rank: 3
|
rank: 3,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "数据统计",
|
title: "数据统计",
|
||||||
rank: 4
|
rank: 4,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "系统管理",
|
title: "系统管理",
|
||||||
rank: 9
|
rank: 9,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
meta: {
|
meta: {
|
||||||
icon: "ep:apple",
|
icon: "ep:apple",
|
||||||
title: "人员管理",
|
title: "人员管理",
|
||||||
rank: 8
|
rank: 8,
|
||||||
|
showLink: false
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,12 +66,20 @@ export const useUserStore = defineStore({
|
|||||||
},
|
},
|
||||||
/** 登入 */
|
/** 登入 */
|
||||||
async loginByUsername(data) {
|
async loginByUsername(data) {
|
||||||
|
console.info("```````````````````````````````````````````````");
|
||||||
|
// console.info(data);
|
||||||
return new Promise<UserResult>((resolve, reject) => {
|
return new Promise<UserResult>((resolve, reject) => {
|
||||||
getLogin(data)
|
getLogin(data)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("loginByUsername");
|
/* console.log("loginByUsername");
|
||||||
console.log(data.data);
|
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);
|
resolve(data);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -80,7 +88,7 @@ export const useUserStore = defineStore({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 前端登出(不调用接口) */
|
/** 前端登出(不调用接口) */
|
||||||
logOut() {
|
async logOut() {
|
||||||
this.username = "";
|
this.username = "";
|
||||||
this.roles = [];
|
this.roles = [];
|
||||||
this.permissions = [];
|
this.permissions = [];
|
||||||
@@ -88,6 +96,7 @@ export const useUserStore = defineStore({
|
|||||||
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
||||||
resetRouter();
|
resetRouter();
|
||||||
router.push("/login");
|
router.push("/login");
|
||||||
|
return Promise.resolve();
|
||||||
},
|
},
|
||||||
/** 刷新`token` */
|
/** 刷新`token` */
|
||||||
async handRefreshToken(data) {
|
async handRefreshToken(data) {
|
||||||
@@ -103,6 +112,19 @@ export const useUserStore = defineStore({
|
|||||||
reject(error);
|
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格式) */
|
/** 格式化token(jwt格式) */
|
||||||
export const formatToken = (token: string): string => {
|
export const formatToken = (token: string): string => {
|
||||||
|
/* console.log("token", token);
|
||||||
|
console.info("Bearer " + token); */
|
||||||
return "Bearer " + token;
|
return "Bearer " + token;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
353
src/views/auth/backendUser/index.vue
Normal file
353
src/views/auth/backendUser/index.vue
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
<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: "lastVisitTime",
|
||||||
|
width: "155",
|
||||||
|
formatter: row => {
|
||||||
|
return row.lastVisitTime
|
||||||
|
? dayjs(row.lastVisitTime).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: "更新时间",
|
||||||
|
prop: "updateTime",
|
||||||
|
width: "155",
|
||||||
|
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("删除成功");
|
||||||
|
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>
|
||||||
287
src/views/auth/company/index.vue
Normal file
287
src/views/auth/company/index.vue
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
<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: "auditStatus",
|
||||||
|
width: "260",
|
||||||
|
slot: "auditStatus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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 #auditStatus="{ row }">
|
||||||
|
<el-tag :type="row.status === 1 ? 'success' : 'danger'" size="small">
|
||||||
|
{{
|
||||||
|
row.status === 0
|
||||||
|
? "未审核"
|
||||||
|
: row.status === 1
|
||||||
|
? "审核通过"
|
||||||
|
: "审核驳回"
|
||||||
|
}}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #operation="{ row }">
|
||||||
|
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</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>
|
||||||
405
src/views/auth/personalCenter/index.vue
Normal file
405
src/views/auth/personalCenter/index.vue
Normal file
@@ -0,0 +1,405 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { request, authApi } from "@/api/utils";
|
||||||
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
import type { FormInstance } from "element-plus";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { Refresh } from "@element-plus/icons-vue";
|
||||||
|
import { id } from "element-plus/es/locales.mjs";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "personalCenter"
|
||||||
|
});
|
||||||
|
|
||||||
|
// 定义用户信息
|
||||||
|
const userInfo = ref({
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
nickName: "",
|
||||||
|
phoneNum: "",
|
||||||
|
email: "",
|
||||||
|
roleId: "",
|
||||||
|
avatar: "",
|
||||||
|
createTime: "",
|
||||||
|
updateTime: "",
|
||||||
|
lastVisitTime: "",
|
||||||
|
description: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 是否显示修改密码对话框
|
||||||
|
const showPasswordDialog = ref(false);
|
||||||
|
|
||||||
|
// 表单引用
|
||||||
|
const passwordFormRef = ref<FormInstance>();
|
||||||
|
|
||||||
|
// 修改密码表单
|
||||||
|
const passwordForm = ref({
|
||||||
|
id: "",
|
||||||
|
oldPassword: "",
|
||||||
|
newPassword: "",
|
||||||
|
confirmPassword: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 修改密码表单规则
|
||||||
|
const passwordRules = {
|
||||||
|
oldPassword: [{ required: true, message: "请输入原密码", trigger: "blur" }],
|
||||||
|
newPassword: [
|
||||||
|
{ required: true, message: "请输入新密码", trigger: "blur" },
|
||||||
|
{ min: 8, max: 18, message: "密码长度必须在8-18位之间", trigger: "blur" },
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
// 检查是否包含数字
|
||||||
|
const hasNumber = /\d/.test(value);
|
||||||
|
// 检查是否包含字母
|
||||||
|
const hasLetter = /[a-zA-Z]/.test(value);
|
||||||
|
// 检查是否包含特殊符号
|
||||||
|
const hasSymbol = /[!@#$%^&*()_+\-=\[\]{};:'",.<>/?\\|]/.test(value);
|
||||||
|
|
||||||
|
// 计算包含的字符类型数量
|
||||||
|
const typeCount = [hasNumber, hasLetter, hasSymbol].filter(
|
||||||
|
Boolean
|
||||||
|
).length;
|
||||||
|
|
||||||
|
if (typeCount < 2) {
|
||||||
|
callback(new Error("密码必须包含数字、字母、符号中的任意两种"));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
confirmPassword: [
|
||||||
|
{ required: true, message: "请确认新密码", trigger: "blur" },
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (value !== passwordForm.value.newPassword) {
|
||||||
|
callback(new Error("两次输入的密码不一致"));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加表单引用
|
||||||
|
const userFormRef = ref<FormInstance>();
|
||||||
|
|
||||||
|
// 添加表单验证规则
|
||||||
|
const userFormRules = {
|
||||||
|
phoneNum: [
|
||||||
|
{ required: true, message: "请输入手机号", trigger: "blur" },
|
||||||
|
{
|
||||||
|
pattern: /^1[3-9]\d{9}$/,
|
||||||
|
message: "请输入正确的手机号格式",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
email: [
|
||||||
|
{ required: true, message: "请输入邮箱", trigger: "blur" },
|
||||||
|
{
|
||||||
|
pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
|
||||||
|
message: "请输入正确的邮箱格式",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取用户信息
|
||||||
|
const getUserInfo = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request(authApi("getUserInfo"), {
|
||||||
|
method: "POST"
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
// 格式化时间
|
||||||
|
const data = {
|
||||||
|
...res.data,
|
||||||
|
createTime: res.data.createTime
|
||||||
|
? dayjs(res.data.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "",
|
||||||
|
updateTime: res.data.updateTime
|
||||||
|
? dayjs(res.data.updateTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "",
|
||||||
|
lastVisitTime: res.data.lastVisitTime
|
||||||
|
? dayjs(res.data.lastVisitTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: ""
|
||||||
|
};
|
||||||
|
userInfo.value = data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取用户信息失败:", error);
|
||||||
|
ElMessage.error("获取用户信息失败");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 修改更新用户信息方法
|
||||||
|
const updateUserInfo = async () => {
|
||||||
|
if (!userFormRef.value) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 先进行表单验证
|
||||||
|
await userFormRef.value.validate();
|
||||||
|
|
||||||
|
// 创建一个新对象,只包含需要更新的字段
|
||||||
|
const updateData = {
|
||||||
|
id: userInfo.value.id,
|
||||||
|
name: userInfo.value.name,
|
||||||
|
nickName: userInfo.value.nickName,
|
||||||
|
phoneNum: userInfo.value.phoneNum,
|
||||||
|
email: userInfo.value.email,
|
||||||
|
roleId: userInfo.value.roleId,
|
||||||
|
avatar: userInfo.value.avatar,
|
||||||
|
description: userInfo.value.description
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await request(authApi("updateManagerUserInfo"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(updateData)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
ElMessage.success("更新成功");
|
||||||
|
// 更新 store 中的用户信息
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
await userStore.setUserInfo(res.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.message) {
|
||||||
|
ElMessage.error(error.message);
|
||||||
|
} else {
|
||||||
|
console.error("更新用户信息失败:", error);
|
||||||
|
ElMessage.error("更新用户信息失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 修改密码
|
||||||
|
const handleChangePassword = async (formEl: FormInstance | undefined) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
|
||||||
|
await formEl.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
const res = await request(authApi("updateManagerPassword"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
id: userInfo.value.id,
|
||||||
|
oldPassword: passwordForm.value.oldPassword,
|
||||||
|
newPassword: passwordForm.value.newPassword
|
||||||
|
})
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
ElMessage.success("密码修改成功,请重新登录");
|
||||||
|
showPasswordDialog.value = false;
|
||||||
|
// 退出登录
|
||||||
|
const userStore = useUserStoreHook();
|
||||||
|
await userStore.logOut();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("修改密码失败:", error);
|
||||||
|
ElMessage.error("修改密码失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 重置密码表单
|
||||||
|
const resetPasswordForm = () => {
|
||||||
|
if (passwordFormRef.value) {
|
||||||
|
passwordFormRef.value.resetFields();
|
||||||
|
}
|
||||||
|
passwordForm.value = {
|
||||||
|
id: "",
|
||||||
|
oldPassword: "",
|
||||||
|
newPassword: "",
|
||||||
|
confirmPassword: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getUserInfo();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="personal-center-container">
|
||||||
|
<el-card class="info-card">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="header-left">
|
||||||
|
<span>个人信息</span>
|
||||||
|
<el-button
|
||||||
|
class="refresh-btn"
|
||||||
|
:icon="Refresh"
|
||||||
|
circle
|
||||||
|
@click="getUserInfo"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="header-buttons">
|
||||||
|
<el-button type="primary" @click="updateUserInfo"
|
||||||
|
>保存修改</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="showPasswordDialog = true">修改密码</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-form
|
||||||
|
ref="userFormRef"
|
||||||
|
:model="userInfo"
|
||||||
|
:rules="userFormRules"
|
||||||
|
label-width="100px"
|
||||||
|
class="user-form"
|
||||||
|
>
|
||||||
|
<el-form-item label="账号">
|
||||||
|
<el-input v-model="userInfo.name" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="昵称">
|
||||||
|
<el-input v-model="userInfo.nickName" placeholder="请输入昵称" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="手机号" prop="phoneNum">
|
||||||
|
<el-input
|
||||||
|
v-model="userInfo.phoneNum"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
maxlength="11"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="邮箱" prop="email">
|
||||||
|
<el-input
|
||||||
|
v-model="userInfo.email"
|
||||||
|
placeholder="请输入邮箱"
|
||||||
|
type="email"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="上次登录时间">
|
||||||
|
<el-input v-model="userInfo.lastVisitTime" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-input v-model="userInfo.createTime" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="更新时间">
|
||||||
|
<el-input v-model="userInfo.updateTime" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="描述">
|
||||||
|
<el-input
|
||||||
|
v-model="userInfo.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
placeholder="请输入描述信息"
|
||||||
|
maxlength="500"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 修改密码对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="showPasswordDialog"
|
||||||
|
title="修改密码"
|
||||||
|
width="500px"
|
||||||
|
@close="resetPasswordForm"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="passwordFormRef"
|
||||||
|
:model="passwordForm"
|
||||||
|
:rules="passwordRules"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="原密码" prop="oldPassword">
|
||||||
|
<el-input
|
||||||
|
v-model="passwordForm.oldPassword"
|
||||||
|
type="password"
|
||||||
|
placeholder="请输入原密码"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="新密码" prop="newPassword">
|
||||||
|
<el-input
|
||||||
|
v-model="passwordForm.newPassword"
|
||||||
|
type="password"
|
||||||
|
placeholder="请输入新密码"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="确认密码" prop="confirmPassword">
|
||||||
|
<el-input
|
||||||
|
v-model="passwordForm.confirmPassword"
|
||||||
|
type="password"
|
||||||
|
placeholder="请确认新密码"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="showPasswordDialog = false">取消</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="handleChangePassword(passwordFormRef)"
|
||||||
|
>
|
||||||
|
确认修改
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.personal-center-container {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.info-card {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.header-left {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.refresh-btn {
|
||||||
|
padding: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-form {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
:deep(.el-input),
|
||||||
|
:deep(.el-textarea) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-textarea__inner) {
|
||||||
|
min-height: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
279
src/views/auth/role/index.vue
Normal file
279
src/views/auth/role/index.vue
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
<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 };
|
||||||
|
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 managerUserOptions = ref([]);
|
||||||
|
// 获取管理用户列表
|
||||||
|
const getManagerUserList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request(authApi("getManagerUserPrimaryInfo"), {
|
||||||
|
method: "POST"
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
console.info(managerUserOptions);
|
||||||
|
managerUserOptions.value = res.data.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取管理用户列表失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索方法
|
||||||
|
const handleSearch = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
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",
|
||||||
|
formatter: row => {
|
||||||
|
const manager = managerUserOptions.value.find(
|
||||||
|
item => item.value === row.createUserId
|
||||||
|
);
|
||||||
|
return manager ? manager.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
getManagerUserList();
|
||||||
|
});
|
||||||
|
</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>
|
||||||
291
src/views/biz/areas/index.vue
Normal file
291
src/views/biz/areas/index.vue
Normal file
@@ -0,0 +1,291 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
import { request, bizApi } from "@/api/utils";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "areas"
|
||||||
|
});
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
height?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
height: undefined
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 定义查询参数
|
||||||
|
const queryParams = ref({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
code: "",
|
||||||
|
name: "",
|
||||||
|
level: "",
|
||||||
|
parentCode: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 定义表格数据
|
||||||
|
const tableData = ref([]);
|
||||||
|
const loading = ref(false);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
// 等级选项
|
||||||
|
const levelOptions = [
|
||||||
|
{ value: 1, label: "省级" },
|
||||||
|
{ value: 2, label: "市级" },
|
||||||
|
{ value: 3, label: "区县级" },
|
||||||
|
{ value: 4, label: "街道/乡镇" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 获取地区列表
|
||||||
|
const getAreaList = async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const params = { ...queryParams.value };
|
||||||
|
const data = await request(bizApi("areaPage"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data.status === 200) {
|
||||||
|
tableData.value = data.data.rows;
|
||||||
|
total.value = data.data.records;
|
||||||
|
} else {
|
||||||
|
ElMessage.error(data.msg || "获取数据失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取地区列表失败:", error);
|
||||||
|
ElMessage.error(error.message || "获取数据失败");
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索方法
|
||||||
|
const handleSearch = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getAreaList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 重置方法
|
||||||
|
const handleReset = () => {
|
||||||
|
queryParams.value = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
code: "",
|
||||||
|
name: "",
|
||||||
|
level: "",
|
||||||
|
parentCode: ""
|
||||||
|
};
|
||||||
|
getAreaList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页改变
|
||||||
|
const handleSizeChange = (val: number) => {
|
||||||
|
queryParams.value.pageSize = val;
|
||||||
|
getAreaList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCurrentChange = (val: number) => {
|
||||||
|
queryParams.value.pageNum = val;
|
||||||
|
getAreaList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
label: "编码",
|
||||||
|
prop: "code",
|
||||||
|
width: "120",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "名称",
|
||||||
|
prop: "name",
|
||||||
|
width: "150"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "等级",
|
||||||
|
prop: "level",
|
||||||
|
width: "100",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
const level = levelOptions.find(item => item.value === row.level);
|
||||||
|
return level ? level.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "上级编码",
|
||||||
|
prop: "parentCode",
|
||||||
|
width: "120",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "地区完整地址",
|
||||||
|
prop: "detail",
|
||||||
|
minWidth: "300"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 160,
|
||||||
|
slot: "operation",
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 添加删除方法
|
||||||
|
const handleDelete = async (row: any) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm("确认要删除该地区记录吗?", "提示", {
|
||||||
|
type: "warning"
|
||||||
|
});
|
||||||
|
|
||||||
|
const res = await request(bizApi("deleteArea"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({ id: row.id })
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
ElMessage.success("删除成功");
|
||||||
|
getAreaList();
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg || "删除失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("删除失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加编辑方法
|
||||||
|
const handleEdit = (row: any) => {
|
||||||
|
// TODO: 实现编辑功能
|
||||||
|
console.log("编辑行:", row);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面加载时获取数据
|
||||||
|
onMounted(() => {
|
||||||
|
getAreaList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="areas-container">
|
||||||
|
<div class="search-box">
|
||||||
|
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="编码(前匹配)" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.code"
|
||||||
|
placeholder="请输入编码"
|
||||||
|
clearable
|
||||||
|
class="input-width"
|
||||||
|
@keyup.enter="handleSearch"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
clearable
|
||||||
|
class="input-width"
|
||||||
|
@keyup.enter="handleSearch"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="等级" prop="level">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.level"
|
||||||
|
placeholder="请选择等级"
|
||||||
|
clearable
|
||||||
|
class="type-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in levelOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="上级编码" prop="parentCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.parentCode"
|
||||||
|
placeholder="请输入上级编码"
|
||||||
|
clearable
|
||||||
|
class="input-width"
|
||||||
|
@keyup.enter="handleSearch"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||||
|
<el-button @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<pure-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:height="height"
|
||||||
|
row-key="id"
|
||||||
|
>
|
||||||
|
<template #operation="{ row }">
|
||||||
|
<el-button type="primary" link @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="danger" link @click="handleDelete(row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</pure-table>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="queryParams.pageNum"
|
||||||
|
v-model:page-size="queryParams.pageSize"
|
||||||
|
:page-sizes="[10, 20, 30, 50]"
|
||||||
|
:total="total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.areas-container {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.search-box {
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
:deep(.el-form-item) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-width {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-select {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
405
src/views/biz/bid/index.vue
Normal file
405
src/views/biz/bid/index.vue
Normal file
@@ -0,0 +1,405 @@
|
|||||||
|
<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",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.isWinner === 1 ? "是" : "否";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "供货周期",
|
||||||
|
prop: "supplyCycle",
|
||||||
|
width: "90",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "供货地",
|
||||||
|
prop: "productSourcingDetail",
|
||||||
|
width: "180"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "货款(元)",
|
||||||
|
prop: "bidPrice",
|
||||||
|
width: "90"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "投标时间",
|
||||||
|
prop: "createTime",
|
||||||
|
width: "160",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.createTime
|
||||||
|
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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>
|
||||||
750
src/views/biz/issuanceBid/index.vue
Normal file
750
src/views/biz/issuanceBid/index.vue
Normal file
@@ -0,0 +1,750 @@
|
|||||||
|
<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 detailDrawer = ref(false);
|
||||||
|
const detailLoading = ref(false);
|
||||||
|
const detailData = ref([]);
|
||||||
|
const detailTotal = ref(0);
|
||||||
|
const detailQueryParams = ref({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
bidId: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 公司列表数据
|
||||||
|
const companyOptions = ref([]);
|
||||||
|
// 获取公司列表
|
||||||
|
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 urgencyOptions = [
|
||||||
|
{ value: 1, label: "加急", day: 1 },
|
||||||
|
{ value: 2, label: "紧急", day: 3 },
|
||||||
|
{ value: 3, label: "一般", day: 7 },
|
||||||
|
{ value: 4, label: "近期", day: 30 },
|
||||||
|
{ value: 5, label: "远期", day: 90 }
|
||||||
|
];
|
||||||
|
|
||||||
|
const columns: TableColumnList = [
|
||||||
|
{
|
||||||
|
label: "用户名称",
|
||||||
|
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 ? "是" : "否";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
const type = bidTypeOptions.find(item => item.value === row.bidType);
|
||||||
|
return type ? type.label : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "发标领域",
|
||||||
|
prop: "bidField",
|
||||||
|
width: "100",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
const field = bidFieldOptions.find(item => item.value === row.bidField);
|
||||||
|
return field ? field.label : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "需求数量",
|
||||||
|
prop: "needNum",
|
||||||
|
align: "center",
|
||||||
|
width: "90"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "发标分类",
|
||||||
|
prop: "category",
|
||||||
|
width: "100",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
const cat = categoryOptions.find(item => item.value === row.category);
|
||||||
|
return cat ? cat.label : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "型号/件号",
|
||||||
|
prop: "pnNum",
|
||||||
|
width: "120"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "bidStatus",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
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: "urgency",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
const urgency = urgencyOptions.find(item => item.value === row.urgency);
|
||||||
|
return urgency ? urgency.label + "(" + urgency.day + "天)" : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// label: "有效天数",
|
||||||
|
// prop: "validDays",
|
||||||
|
// width: "90"
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
label: "截止日期",
|
||||||
|
prop: "expiryDate",
|
||||||
|
width: "120",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.expiryDate ? dayjs(row.expiryDate).format("YYYY-MM-DD") : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDetail = row => {
|
||||||
|
detailQueryParams.value.bidId = row.id;
|
||||||
|
detailQueryParams.value.pageNum = 1;
|
||||||
|
detailDrawer.value = true;
|
||||||
|
getBidListDetail();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 明细表格列定义
|
||||||
|
const detailColumns = [
|
||||||
|
{
|
||||||
|
label: "投标主体",
|
||||||
|
prop: "isCompany",
|
||||||
|
width: "180",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.isCompany === 1
|
||||||
|
? "[公司]" +
|
||||||
|
companyOptions.value.find(item => item.value === row.companyId)
|
||||||
|
?.label
|
||||||
|
: "[个人]" +
|
||||||
|
frontendUserOptions.value.find(item => item.value === row.userId)
|
||||||
|
?.label;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "中标",
|
||||||
|
prop: "isWinner",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.isWinner === 1 ? "是" : "否";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "投标时间",
|
||||||
|
prop: "createTime",
|
||||||
|
width: "160",
|
||||||
|
formatter: row => {
|
||||||
|
return row.createTime
|
||||||
|
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "使用道具",
|
||||||
|
prop: "usePurchase",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.usePurchase === 1 ? "使用" : "未使用";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "排他卡",
|
||||||
|
prop: "useExcludeCardFlag",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.useExcludeCardFlag === 1 ? "使用" : "未使用";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "插队卡",
|
||||||
|
prop: "useJumpCardFlag",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.useJumpCardFlag === 1 ? "使用" : "未使用";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "直通卡",
|
||||||
|
prop: "useThroughCardFlag",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.useThroughCardFlag === 1 ? "使用" : "未使用";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 获取投标明细
|
||||||
|
const getBidListDetail = async () => {
|
||||||
|
try {
|
||||||
|
detailLoading.value = true;
|
||||||
|
const params = { ...detailQueryParams.value };
|
||||||
|
const res = await request(bizApi("bidPage"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
detailData.value = res.data.rows;
|
||||||
|
detailTotal.value = res.data.records;
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg || "获取投标记录失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取投标记录失败:", error);
|
||||||
|
ElMessage.error(error.message || "获取投标记录失败");
|
||||||
|
} finally {
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 明细分页改变
|
||||||
|
const handleDetailSizeChange = (val: number) => {
|
||||||
|
detailQueryParams.value.pageSize = val;
|
||||||
|
getBidListDetail();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDetailCurrentChange = (val: number) => {
|
||||||
|
detailQueryParams.value.pageNum = val;
|
||||||
|
getBidListDetail();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加抽屉关闭处理函数
|
||||||
|
const handleDrawerClose = () => {
|
||||||
|
detailDrawer.value = false;
|
||||||
|
// 重置查询参数
|
||||||
|
detailQueryParams.value = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
bidId: ""
|
||||||
|
};
|
||||||
|
// 清空数据
|
||||||
|
detailData.value = [];
|
||||||
|
detailTotal.value = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面加载时获取数据
|
||||||
|
onMounted(() => {
|
||||||
|
getBidList();
|
||||||
|
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
|
||||||
|
:disabled="!row.bidNum || row.bidNum <= 0"
|
||||||
|
@click="handleDetail(row)"
|
||||||
|
>
|
||||||
|
投标记录{{ row.bidNum ? `(${row.bidNum})` : "" }}
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
link
|
||||||
|
:disabled="true"
|
||||||
|
@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>
|
||||||
|
|
||||||
|
<!-- 增加抽屉list明细 -->
|
||||||
|
<el-drawer
|
||||||
|
v-model="detailDrawer"
|
||||||
|
title="投标记录"
|
||||||
|
size="40%"
|
||||||
|
:close-on-click-modal="true"
|
||||||
|
@close="handleDrawerClose"
|
||||||
|
>
|
||||||
|
<div class="drawer-container">
|
||||||
|
<pure-table
|
||||||
|
v-loading="detailLoading"
|
||||||
|
:data="detailData"
|
||||||
|
:columns="detailColumns"
|
||||||
|
row-key="id"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="detailQueryParams.pageNum"
|
||||||
|
v-model:page-size="detailQueryParams.pageSize"
|
||||||
|
:page-sizes="[10, 20, 30, 50]"
|
||||||
|
:total="detailTotal"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleDetailSizeChange"
|
||||||
|
@current-change="handleDetailCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer-container {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
746
src/views/biz/membershipPoint/index.vue
Normal file
746
src/views/biz/membershipPoint/index.vue
Normal file
@@ -0,0 +1,746 @@
|
|||||||
|
<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 raisePointDialog = ref(false);
|
||||||
|
const raisePointForm = ref({
|
||||||
|
pointNum: 0,
|
||||||
|
reasonId: "",
|
||||||
|
description: ""
|
||||||
|
});
|
||||||
|
const currentRow = ref(null);
|
||||||
|
|
||||||
|
// 涨分原因选项
|
||||||
|
const reasonOptions = [
|
||||||
|
{ value: 1, label: "购买" },
|
||||||
|
{ value: 2, label: "活动奖励" },
|
||||||
|
{ value: 3, label: "签到奖励" },
|
||||||
|
{ value: 4, label: "任务奖励" },
|
||||||
|
{ value: 5, label: "管理员调整" },
|
||||||
|
{ value: 9, label: "其他" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 明细抽屉相关
|
||||||
|
const detailDrawer = ref(false);
|
||||||
|
const detailLoading = ref(false);
|
||||||
|
const detailData = ref([]);
|
||||||
|
const detailTotal = ref(0);
|
||||||
|
const detailQueryParams = ref({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
userId: "",
|
||||||
|
companyId: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取公司列表
|
||||||
|
const getCompanyList = async () => {
|
||||||
|
try {
|
||||||
|
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",
|
||||||
|
align: "center",
|
||||||
|
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 => {
|
||||||
|
detailQueryParams.value.userId = row.userId;
|
||||||
|
detailQueryParams.value.companyId = row.companyId;
|
||||||
|
detailQueryParams.value.pageNum = 1;
|
||||||
|
detailDrawer.value = true;
|
||||||
|
getPointDetail();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEdit = row => {
|
||||||
|
console.log("编辑", row);
|
||||||
|
// TODO: 实现编辑逻辑
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRaise = row => {
|
||||||
|
currentRow.value = row;
|
||||||
|
raisePointForm.value = {
|
||||||
|
pointNum: 0,
|
||||||
|
reasonId: "",
|
||||||
|
description: ""
|
||||||
|
};
|
||||||
|
raisePointDialog.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加提交状态控制
|
||||||
|
const submitting = ref(false);
|
||||||
|
|
||||||
|
// 修改提交方法
|
||||||
|
const handleRaiseSubmit = async () => {
|
||||||
|
console.log(submitting.value);
|
||||||
|
|
||||||
|
if (submitting.value) return; // 如果正在提交,直接返回
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (raisePointForm.value.pointNum <= 0) {
|
||||||
|
ElMessage.warning("请输入正确的积分数量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!raisePointForm.value.reasonId) {
|
||||||
|
ElMessage.warning("请选择涨分原因");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
submitting.value = true; // 开始提交,设置状态
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
userId: currentRow.value.userId,
|
||||||
|
companyId: currentRow.value.companyId,
|
||||||
|
pointNum: raisePointForm.value.pointNum,
|
||||||
|
reasonId: raisePointForm.value.reasonId,
|
||||||
|
description: raisePointForm.value.description
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await request(bizApi("raisePoint"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
ElMessage.success("涨分成功");
|
||||||
|
raisePointDialog.value = false;
|
||||||
|
getPointList(); // 刷新列表
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg || "涨分失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("涨分失败:", error);
|
||||||
|
ElMessage.error(error.message || "涨分失败");
|
||||||
|
} finally {
|
||||||
|
submitting.value = false; // 无论成功失败,都重置状态
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDelete = row => {
|
||||||
|
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
// TODO: 调用删除接口
|
||||||
|
ElMessage.success("删除成功");
|
||||||
|
getPointList(); // 刷新列表
|
||||||
|
} catch (error) {
|
||||||
|
console.error("删除失败:", error);
|
||||||
|
ElMessage.error(error.message || "删除失败");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// 取消删除
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取积分明细
|
||||||
|
const getPointDetail = async () => {
|
||||||
|
try {
|
||||||
|
detailLoading.value = true;
|
||||||
|
const params = { ...detailQueryParams.value };
|
||||||
|
const res = await request(bizApi("pointSpendPage"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
detailData.value = res.data.rows;
|
||||||
|
detailTotal.value = res.data.records;
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg || "获取明细失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取积分明细失败:", error);
|
||||||
|
ElMessage.error(error.message || "获取明细失败");
|
||||||
|
} finally {
|
||||||
|
detailLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 明细分页改变
|
||||||
|
const handleDetailSizeChange = (val: number) => {
|
||||||
|
detailQueryParams.value.pageSize = val;
|
||||||
|
getPointDetail();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDetailCurrentChange = (val: number) => {
|
||||||
|
detailQueryParams.value.pageNum = val;
|
||||||
|
getPointDetail();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 明细表格列定义
|
||||||
|
const detailColumns = [
|
||||||
|
{
|
||||||
|
label: "变动积分",
|
||||||
|
prop: "spendingPoints",
|
||||||
|
width: "80",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "类型",
|
||||||
|
prop: "spendingType",
|
||||||
|
width: "60",
|
||||||
|
formatter: row => {
|
||||||
|
return row.spendingType === 0 ? "充值" : "消费";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "变动原因",
|
||||||
|
prop: "reasonId",
|
||||||
|
width: "95",
|
||||||
|
formatter: row => {
|
||||||
|
const reason = reasonOptions.find(item => item.value === row.reasonId);
|
||||||
|
return reason ? reason.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "备注说明",
|
||||||
|
prop: "description",
|
||||||
|
width: "150"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建时间",
|
||||||
|
prop: "createTime",
|
||||||
|
width: "160",
|
||||||
|
formatter: row => {
|
||||||
|
return row.createTime
|
||||||
|
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 添加抽屉关闭处理函数
|
||||||
|
const handleDrawerClose = () => {
|
||||||
|
detailDrawer.value = false;
|
||||||
|
// 重置查询参数
|
||||||
|
detailQueryParams.value = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
userId: "",
|
||||||
|
companyId: ""
|
||||||
|
};
|
||||||
|
// 清空数据
|
||||||
|
detailData.value = [];
|
||||||
|
detailTotal.value = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面加载时获取数据
|
||||||
|
onMounted(() => {
|
||||||
|
getPointList();
|
||||||
|
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="primary" size="small" @click="handleRaise(row)">
|
||||||
|
涨分
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
disabled
|
||||||
|
:style="{ opacity: 0.5 }"
|
||||||
|
@click="handleDelete(row)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</pure-table>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="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>
|
||||||
|
|
||||||
|
<!-- 添加涨分弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="raisePointDialog"
|
||||||
|
title="积分调整"
|
||||||
|
width="500px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="raisePointFormRef"
|
||||||
|
:model="raisePointForm"
|
||||||
|
label-width="100px"
|
||||||
|
class="raise-point-form"
|
||||||
|
>
|
||||||
|
<el-form-item label="用户:">
|
||||||
|
<span>{{
|
||||||
|
frontendUserOptions.find(item => item.value === currentRow?.userId)
|
||||||
|
?.label
|
||||||
|
}}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="所属公司:">
|
||||||
|
<span>{{
|
||||||
|
companyOptions.find(item => item.value === currentRow?.companyId)
|
||||||
|
?.label || "-"
|
||||||
|
}}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="当前积分:">
|
||||||
|
<span>{{ currentRow?.totalPoints }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="调整积分:" required>
|
||||||
|
<el-input-number
|
||||||
|
v-model="raisePointForm.pointNum"
|
||||||
|
:min="1"
|
||||||
|
:max="999999"
|
||||||
|
placeholder="请输入调整积分"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="调整原因:" required>
|
||||||
|
<el-select
|
||||||
|
v-model="raisePointForm.reasonId"
|
||||||
|
placeholder="请选择调整原因"
|
||||||
|
class="reason-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in reasonOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注说明:">
|
||||||
|
<el-input
|
||||||
|
v-model="raisePointForm.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入备注说明"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button :disabled="submitting" @click="raisePointDialog = false"
|
||||||
|
>取 消</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="submitting"
|
||||||
|
@click="handleRaiseSubmit"
|
||||||
|
>
|
||||||
|
{{ submitting ? "提交中..." : "确 定" }}
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 添加明细抽屉 -->
|
||||||
|
<el-drawer
|
||||||
|
v-model="detailDrawer"
|
||||||
|
title="积分明细"
|
||||||
|
size="40%"
|
||||||
|
:close-on-click-modal="true"
|
||||||
|
:before-close="() => (detailDrawer = false)"
|
||||||
|
>
|
||||||
|
<div class="detail-container">
|
||||||
|
<pure-table
|
||||||
|
v-loading="detailLoading"
|
||||||
|
:data="detailData"
|
||||||
|
:columns="detailColumns"
|
||||||
|
:height="height"
|
||||||
|
row-key="id"
|
||||||
|
>
|
||||||
|
<template #operation="{ row }">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleDetail(row)"
|
||||||
|
>
|
||||||
|
明细
|
||||||
|
</el-button>
|
||||||
|
<!-- <el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</el-button> -->
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleRaise(row)"
|
||||||
|
>
|
||||||
|
涨分
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
disabled
|
||||||
|
:style="{ opacity: 0.5 }"
|
||||||
|
@click="handleDelete(row)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</pure-table>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="detailQueryParams.pageNum"
|
||||||
|
v-model:page-size="detailQueryParams.pageSize"
|
||||||
|
:page-sizes="[10, 20, 30, 50]"
|
||||||
|
:total="detailTotal"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleDetailSizeChange"
|
||||||
|
@current-change="handleDetailCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.raise-point-form {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.reason-select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
padding-top: 20px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</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>
|
||||||
339
src/views/biz/propSummary/index.vue
Normal file
339
src/views/biz/propSummary/index.vue
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { request, bizApi } from "@/api/utils";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "propSummary"
|
||||||
|
});
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
height?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
height: null
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 定义查询参数
|
||||||
|
const queryParams = ref({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
userId: "",
|
||||||
|
companyId: "",
|
||||||
|
propType: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 定义表格数据
|
||||||
|
const tableData = ref([]);
|
||||||
|
const loading = ref(false);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
// 前端用户列表数据
|
||||||
|
const frontendUserOptions = ref([]);
|
||||||
|
// 获取前端用户列表
|
||||||
|
const getFrontendUserList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request(bizApi("getFrontendUserPrimaryInfo"), {
|
||||||
|
method: "POST"
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
frontendUserOptions.value = res.data.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取用户列表失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 公司列表数据
|
||||||
|
const companyOptions = ref([]);
|
||||||
|
// 获取公司列表
|
||||||
|
const getCompanyList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request(bizApi("getCompanyPrimaryInfo"), {
|
||||||
|
method: "POST"
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
companyOptions.value = res.data.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.companyName
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取公司列表失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 道具类型选项
|
||||||
|
const typeOptions = [
|
||||||
|
{ value: 1, label: "实时达卡" },
|
||||||
|
{ value: 2, label: "排他卡" },
|
||||||
|
{ value: 3, label: "插队卡" },
|
||||||
|
{ value: 4, label: "直通卡" },
|
||||||
|
{ value: 5, label: "加量卡" },
|
||||||
|
{ value: 6, label: "置顶卡" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 获取道具统计列表
|
||||||
|
const getPropSummaryList = async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const params = { ...queryParams.value };
|
||||||
|
const data = await request(bizApi("propSummaryPage"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data.status === 200) {
|
||||||
|
tableData.value = data.data.rows;
|
||||||
|
total.value = data.data.records;
|
||||||
|
} else {
|
||||||
|
ElMessage.error(data.msg || "获取数据失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取道具统计列表失败:", error);
|
||||||
|
ElMessage.error(error.message || "获取数据失败");
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索方法
|
||||||
|
const handleSearch = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getPropSummaryList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 重置方法
|
||||||
|
const handleReset = () => {
|
||||||
|
queryParams.value = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
userId: "",
|
||||||
|
companyId: "",
|
||||||
|
propType: ""
|
||||||
|
};
|
||||||
|
getPropSummaryList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页改变
|
||||||
|
const handleSizeChange = (val: number) => {
|
||||||
|
queryParams.value.pageSize = val;
|
||||||
|
getPropSummaryList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCurrentChange = (val: number) => {
|
||||||
|
queryParams.value.pageNum = val;
|
||||||
|
getPropSummaryList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
label: "用户名称",
|
||||||
|
prop: "userId",
|
||||||
|
width: "120",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
const user = frontendUserOptions.value.find(
|
||||||
|
item => item.value === row.userId
|
||||||
|
);
|
||||||
|
return user ? user.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否公司",
|
||||||
|
prop: "isCompany",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.isCompany === 1 ? "是" : "否";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "公司名称",
|
||||||
|
prop: "companyId",
|
||||||
|
width: "150",
|
||||||
|
formatter: row => {
|
||||||
|
const company = companyOptions.value.find(
|
||||||
|
item => item.value === row.companyId
|
||||||
|
);
|
||||||
|
return company ? company.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "道具类型",
|
||||||
|
prop: "propType",
|
||||||
|
width: "100",
|
||||||
|
formatter: row => {
|
||||||
|
const type = typeOptions.find(item => item.value === row.propType);
|
||||||
|
return type ? type.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "总数量",
|
||||||
|
prop: "totalCount",
|
||||||
|
width: "90",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "已用数量",
|
||||||
|
prop: "usedCount",
|
||||||
|
width: "90",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "过期数量",
|
||||||
|
prop: "expiredCount",
|
||||||
|
width: "90",
|
||||||
|
align: "center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建时间",
|
||||||
|
prop: "createTime",
|
||||||
|
width: "160",
|
||||||
|
formatter: row => {
|
||||||
|
return row.createTime
|
||||||
|
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "更新时间",
|
||||||
|
prop: "updateTime",
|
||||||
|
width: "160",
|
||||||
|
formatter: row => {
|
||||||
|
return row.updateTime
|
||||||
|
? dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 页面加载时获取数据
|
||||||
|
onMounted(() => {
|
||||||
|
getPropSummaryList();
|
||||||
|
getFrontendUserList();
|
||||||
|
getCompanyList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="prop-count-container">
|
||||||
|
<div class="search-box">
|
||||||
|
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="用户" prop="userId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.userId"
|
||||||
|
placeholder="请选择用户"
|
||||||
|
clearable
|
||||||
|
class="user-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in frontendUserOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="公司名称" prop="companyId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.companyId"
|
||||||
|
placeholder="请选择公司"
|
||||||
|
clearable
|
||||||
|
class="company-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in companyOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="道具类型" prop="type">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.propType"
|
||||||
|
placeholder="请选择类型"
|
||||||
|
clearable
|
||||||
|
class="type-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||||
|
<el-button @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<pure-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:height="height"
|
||||||
|
row-key="id"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="queryParams.pageNum"
|
||||||
|
v-model:page-size="queryParams.pageSize"
|
||||||
|
:page-sizes="[10, 20, 30, 50]"
|
||||||
|
:total="total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.prop-count-container {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.search-box {
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
:deep(.el-form-item) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-select {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-select {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-select {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
9
src/views/biz/propSummary/index2.vue
Normal file
9
src/views/biz/propSummary/index2.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
name: "propSummary2"
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<h1>道具统计</h1>
|
||||||
|
</template>
|
||||||
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>
|
||||||
454
src/views/biz/subscribe/index.vue
Normal file
454
src/views/biz/subscribe/index.vue
Normal file
@@ -0,0 +1,454 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
import { request, bizApi } from "@/api/utils";
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "subscribe"
|
||||||
|
});
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
height?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
height: undefined
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 定义查询参数
|
||||||
|
const queryParams = ref({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
userId: "",
|
||||||
|
isCompany: "",
|
||||||
|
companyId: "",
|
||||||
|
subType: "",
|
||||||
|
subField: "",
|
||||||
|
subCategory: "",
|
||||||
|
useRealtimeCardFlag: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
// 定义表格数据
|
||||||
|
const tableData = ref([]);
|
||||||
|
const loading = ref(false);
|
||||||
|
const total = ref(0);
|
||||||
|
|
||||||
|
// 前端用户列表数据
|
||||||
|
const frontendUserOptions = ref([]);
|
||||||
|
// 获取前端用户列表
|
||||||
|
const getFrontendUserList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request(bizApi("getFrontendUserPrimaryInfo"), {
|
||||||
|
method: "POST"
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
frontendUserOptions.value = res.data.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取用户列表失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 公司列表数据
|
||||||
|
const companyOptions = ref([]);
|
||||||
|
// 获取公司列表
|
||||||
|
const getCompanyList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await request(bizApi("getCompanyPrimaryInfo"), {
|
||||||
|
method: "POST"
|
||||||
|
});
|
||||||
|
if (res.status === 200) {
|
||||||
|
companyOptions.value = res.data.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.companyName
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取公司列表失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 订阅类型选项
|
||||||
|
const subTypeOptions = [
|
||||||
|
{ value: 0, label: "未指定" },
|
||||||
|
{ value: 1, label: "求购" },
|
||||||
|
{ value: 2, label: "租赁" },
|
||||||
|
{ value: 9, label: "全订阅" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 订阅领域选项
|
||||||
|
const subFieldOptions = [
|
||||||
|
{ value: 0, label: "未指定" },
|
||||||
|
{ value: 1, label: "民航" },
|
||||||
|
{ value: 2, label: "通航" },
|
||||||
|
{ value: 9, label: "全订阅" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 订阅对象选项
|
||||||
|
const subCategoryOptions = [
|
||||||
|
{ value: 0, label: "未指定" },
|
||||||
|
{ value: 1, label: "航材" },
|
||||||
|
{ value: 2, label: "飞机" },
|
||||||
|
{ value: 3, label: "工具" },
|
||||||
|
{ value: 9, label: "全订阅" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 获取订阅列表
|
||||||
|
const getSubscribeList = async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const params = { ...queryParams.value };
|
||||||
|
const data = await request(bizApi("bidSubscribePage"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(params)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data.status === 200) {
|
||||||
|
tableData.value = data.data.rows;
|
||||||
|
total.value = data.data.records;
|
||||||
|
} else {
|
||||||
|
ElMessage.error(data.msg || "获取数据失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取订阅列表失败:", error);
|
||||||
|
ElMessage.error(error.message || "获取数据失败");
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索方法
|
||||||
|
const handleSearch = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getSubscribeList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 重置方法
|
||||||
|
const handleReset = () => {
|
||||||
|
queryParams.value = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
userId: "",
|
||||||
|
isCompany: "",
|
||||||
|
companyId: "",
|
||||||
|
subType: "",
|
||||||
|
subField: "",
|
||||||
|
subCategory: "",
|
||||||
|
useRealtimeCardFlag: ""
|
||||||
|
};
|
||||||
|
getSubscribeList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页改变
|
||||||
|
const handleSizeChange = (val: number) => {
|
||||||
|
queryParams.value.pageSize = val;
|
||||||
|
getSubscribeList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCurrentChange = (val: number) => {
|
||||||
|
queryParams.value.pageNum = val;
|
||||||
|
getSubscribeList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
label: "用户名称",
|
||||||
|
prop: "userId",
|
||||||
|
width: "120",
|
||||||
|
formatter: row => {
|
||||||
|
const user = frontendUserOptions.value.find(
|
||||||
|
item => item.value === row.userId
|
||||||
|
);
|
||||||
|
return user ? user.label : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否公司",
|
||||||
|
prop: "isCompany",
|
||||||
|
width: "90",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.isCompany === 1 ? "是" : "否";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "公司名称",
|
||||||
|
prop: "companyId",
|
||||||
|
width: "150",
|
||||||
|
formatter: row => {
|
||||||
|
const company = companyOptions.value.find(
|
||||||
|
item => item.value === row.companyId
|
||||||
|
);
|
||||||
|
return company ? company.label : "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "订阅类型",
|
||||||
|
prop: "subType",
|
||||||
|
width: "100",
|
||||||
|
formatter: row => {
|
||||||
|
const type = subTypeOptions.find(item => item.value === row.subType);
|
||||||
|
return type ? type.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "订阅领域",
|
||||||
|
prop: "subField",
|
||||||
|
width: "100",
|
||||||
|
formatter: row => {
|
||||||
|
const field = subFieldOptions.find(item => item.value === row.subField);
|
||||||
|
return field ? field.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "订阅对象",
|
||||||
|
prop: "subCategory",
|
||||||
|
width: "100",
|
||||||
|
formatter: row => {
|
||||||
|
const category = subCategoryOptions.find(
|
||||||
|
item => item.value === row.subCategory
|
||||||
|
);
|
||||||
|
return category ? category.label : "-";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "订阅关键字",
|
||||||
|
prop: "subWords",
|
||||||
|
width: "200"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "使用实时达卡",
|
||||||
|
prop: "useRealtimeCardFlag",
|
||||||
|
width: "120",
|
||||||
|
align: "center",
|
||||||
|
formatter: row => {
|
||||||
|
return row.useRealtimeCardFlag === 1 ? "是" : "否";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建时间",
|
||||||
|
prop: "createTime",
|
||||||
|
width: "160",
|
||||||
|
formatter: row => {
|
||||||
|
return row.createTime
|
||||||
|
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "更新时间",
|
||||||
|
prop: "updateTime",
|
||||||
|
width: "160",
|
||||||
|
formatter: row => {
|
||||||
|
return row.updateTime
|
||||||
|
? dayjs(row.updateTime).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 160,
|
||||||
|
slot: "operation",
|
||||||
|
align: "center"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// 添加删除方法
|
||||||
|
const handleDelete = async (row: any) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm("确认要删除该订阅记录吗?", "提示", {
|
||||||
|
type: "warning"
|
||||||
|
});
|
||||||
|
|
||||||
|
const res = await request(bizApi("deleteSubscribe"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({ id: row.id })
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
ElMessage.success("删除成功");
|
||||||
|
getSubscribeList();
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg || "删除失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("删除失败:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加编辑方法
|
||||||
|
const handleEdit = (row: any) => {
|
||||||
|
// TODO: 实现编辑功能
|
||||||
|
console.log("编辑行:", row);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面加载时获取数据
|
||||||
|
onMounted(() => {
|
||||||
|
getSubscribeList();
|
||||||
|
getFrontendUserList();
|
||||||
|
getCompanyList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="subscribe-container">
|
||||||
|
<div class="search-box">
|
||||||
|
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="用户" prop="userId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.userId"
|
||||||
|
placeholder="请选择用户"
|
||||||
|
clearable
|
||||||
|
class="user-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in frontendUserOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="公司名称" prop="companyId">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.companyId"
|
||||||
|
placeholder="请选择公司"
|
||||||
|
clearable
|
||||||
|
class="company-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in companyOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="订阅类型" prop="subType">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.subType"
|
||||||
|
placeholder="请选择类型"
|
||||||
|
clearable
|
||||||
|
class="type-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in subTypeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="订阅领域" prop="subField">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.subField"
|
||||||
|
placeholder="请选择领域"
|
||||||
|
clearable
|
||||||
|
class="type-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in subFieldOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="订阅对象" prop="subCategory">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.subCategory"
|
||||||
|
placeholder="请选择对象"
|
||||||
|
clearable
|
||||||
|
class="type-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in subCategoryOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||||
|
<el-button @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<pure-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:height="height"
|
||||||
|
row-key="id"
|
||||||
|
>
|
||||||
|
<template #operation="{ row }">
|
||||||
|
<el-button type="primary" link @click="handleEdit(row)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="danger" link @click="handleDelete(row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</pure-table>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="queryParams.pageNum"
|
||||||
|
v-model:page-size="queryParams.pageSize"
|
||||||
|
:page-sizes="[10, 20, 30, 50]"
|
||||||
|
:total="total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.subscribe-container {
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
.search-box {
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
:deep(.el-form-item) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-select {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-select {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-select {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
652
src/views/biz/sysSettings/index.vue
Normal file
652
src/views/biz/sysSettings/index.vue
Normal file
@@ -0,0 +1,652 @@
|
|||||||
|
<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
|
||||||
|
},
|
||||||
|
area_config: {
|
||||||
|
separator: " "
|
||||||
|
},
|
||||||
|
email_config: {
|
||||||
|
smtpServer: "smtp.163.com",
|
||||||
|
smtpPort: "465",
|
||||||
|
auth: true,
|
||||||
|
sslEnable: true,
|
||||||
|
fromEmail: "silent3035@163.com",
|
||||||
|
fromEmailName: "Rocky",
|
||||||
|
fromEmailUser: "",
|
||||||
|
fromEmailPassword: "W0pPgIjQWMH0Tb2Y",
|
||||||
|
verifyEmail: "",
|
||||||
|
toEmails: ["silent3035@163.com", "zhanghuajun@rocky.com"]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 道具类型映射
|
||||||
|
const purchaseTypeMap = {
|
||||||
|
1: "置顶卡",
|
||||||
|
2: "提升卡",
|
||||||
|
3: "排他卡",
|
||||||
|
4: "直通卡",
|
||||||
|
5: "插队卡",
|
||||||
|
6: "跳转卡"
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加分隔符选项
|
||||||
|
const separatorOptions = [
|
||||||
|
{ value: " ", label: "空格(默认)" },
|
||||||
|
{ value: ",", label: "逗号" },
|
||||||
|
{ value: "、", label: "顿号" },
|
||||||
|
{ value: "-", label: "中划线" },
|
||||||
|
{ value: "_", label: "下划线" },
|
||||||
|
{ value: ">", label: "大于号" }
|
||||||
|
];
|
||||||
|
// 添加全局 loading 状态
|
||||||
|
const fullscreenLoading = ref(false);
|
||||||
|
// 添加邮箱相关状态
|
||||||
|
const showEmailInput = ref(false);
|
||||||
|
const newEmail = ref("");
|
||||||
|
|
||||||
|
// 加载设置数据
|
||||||
|
const loadSettings = async () => {
|
||||||
|
try {
|
||||||
|
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 validateEmailConfig = (): boolean => {
|
||||||
|
const {
|
||||||
|
smtpServer,
|
||||||
|
smtpPort,
|
||||||
|
fromEmail,
|
||||||
|
fromEmailPassword,
|
||||||
|
fromEmailUser,
|
||||||
|
fromEmailName,
|
||||||
|
toEmails
|
||||||
|
} = settingsData.value.email_config;
|
||||||
|
|
||||||
|
// 检查必填字段
|
||||||
|
if (
|
||||||
|
!smtpServer ||
|
||||||
|
!smtpPort ||
|
||||||
|
!fromEmail ||
|
||||||
|
!fromEmailPassword ||
|
||||||
|
!fromEmailUser ||
|
||||||
|
!fromEmailName
|
||||||
|
) {
|
||||||
|
ElMessage.warning("请完整填写邮箱配置信息");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证发件邮箱格式
|
||||||
|
if (!isValidEmail(fromEmail)) {
|
||||||
|
ElMessage.warning("发件邮箱格式不正确");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证SMTP端口格式
|
||||||
|
if (!/^\d+$/.test(smtpPort) || parseInt(smtpPort) <= 0) {
|
||||||
|
ElMessage.warning("SMTP端口必须为有效的正整数");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证收件邮箱列表
|
||||||
|
if (!toEmails || toEmails.length === 0) {
|
||||||
|
ElMessage.warning("请至少添加一个收件邮箱");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证收件邮箱格式
|
||||||
|
for (const email of toEmails) {
|
||||||
|
if (!isValidEmail(email)) {
|
||||||
|
ElMessage.warning(`收件邮箱 ${email} 格式不正确`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 修改保存设置函数
|
||||||
|
const saveSettings = async (key: string) => {
|
||||||
|
try {
|
||||||
|
// 如果是邮箱配置,先进行验证
|
||||||
|
if (key === "email_config" && !validateEmailConfig()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fullscreenLoading.value = true;
|
||||||
|
const params = {
|
||||||
|
settingsKey: key,
|
||||||
|
settingsContent: JSON.stringify(settingsData.value[key])
|
||||||
|
};
|
||||||
|
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("保存系统设置失败");
|
||||||
|
} finally {
|
||||||
|
fullscreenLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加邮箱
|
||||||
|
const handleAddEmail = () => {
|
||||||
|
const email = newEmail.value.trim();
|
||||||
|
// 检查邮箱数量是否达到上限
|
||||||
|
if (settingsData.value.email_config.toEmails.length >= 10) {
|
||||||
|
ElMessage.warning("最多只能添加10个收件邮箱");
|
||||||
|
newEmail.value = "";
|
||||||
|
showEmailInput.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||||
|
if (!settingsData.value.email_config.toEmails.includes(email)) {
|
||||||
|
settingsData.value.email_config.toEmails.push(email);
|
||||||
|
}
|
||||||
|
newEmail.value = "";
|
||||||
|
showEmailInput.value = false;
|
||||||
|
} else {
|
||||||
|
ElMessage.warning("请输入有效的邮箱地址");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 移除邮箱
|
||||||
|
const handleRemoveEmail = (index: number) => {
|
||||||
|
settingsData.value.email_config.toEmails.splice(index, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 邮箱输入框失焦处理
|
||||||
|
const handleEmailInputBlur = () => {
|
||||||
|
if (newEmail.value.trim()) {
|
||||||
|
handleAddEmail();
|
||||||
|
}
|
||||||
|
showEmailInput.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 邮箱格式校验函数
|
||||||
|
const isValidEmail = (email: string): boolean => {
|
||||||
|
// 标准邮箱格式正则表达式
|
||||||
|
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||||
|
return emailRegex.test(email);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 发送测试邮件
|
||||||
|
const handleTestEmail = async () => {
|
||||||
|
// 校验发件邮箱配置
|
||||||
|
const { smtpServer, smtpPort, fromEmail, fromEmailPassword, fromEmailUser } =
|
||||||
|
settingsData.value.email_config;
|
||||||
|
if (
|
||||||
|
!smtpServer ||
|
||||||
|
!smtpPort ||
|
||||||
|
!fromEmail ||
|
||||||
|
!fromEmailPassword ||
|
||||||
|
!fromEmailUser
|
||||||
|
) {
|
||||||
|
ElMessage.warning("请先完成邮箱配置信息");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验发件邮箱格式
|
||||||
|
if (!isValidEmail(fromEmail)) {
|
||||||
|
ElMessage.warning("发件邮箱格式不正确,请检查配置");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const email = settingsData.value.email_config.verifyEmail.trim();
|
||||||
|
|
||||||
|
// 检查邮箱是否为空
|
||||||
|
if (!email) {
|
||||||
|
ElMessage.warning("请输入测试邮箱地址");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验邮箱格式
|
||||||
|
if (!isValidEmail(email)) {
|
||||||
|
ElMessage.warning("请输入有效的邮箱地址");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await request(bizApi("testEmail"), {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(settingsData.value.email_config)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 200) {
|
||||||
|
ElMessage.success("测试邮件发送成功, 邮箱服务器配置无误。");
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg || "测试邮件发送失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("发送测试邮件失败:", error);
|
||||||
|
ElMessage.error("发送测试邮件失败");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadSettings();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="settings-container">
|
||||||
|
<div
|
||||||
|
v-show="fullscreenLoading"
|
||||||
|
v-loading.fullscreen.lock="fullscreenLoading"
|
||||||
|
:element-loading-text="'保存中...'"
|
||||||
|
class="settings-container"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 发标设置 -->
|
||||||
|
<el-card class="settings-card">
|
||||||
|
<template #header>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- 地域配置 -->
|
||||||
|
<el-card class="settings-card">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span>地域配置</span>
|
||||||
|
<el-button type="primary" @click="saveSettings('area_config')"
|
||||||
|
>保存</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-form
|
||||||
|
label-width="160px"
|
||||||
|
:model="settingsData.area_config"
|
||||||
|
class="settings-form"
|
||||||
|
>
|
||||||
|
<el-form-item label="地址分隔符">
|
||||||
|
<el-select
|
||||||
|
v-model="settingsData.area_config.separator"
|
||||||
|
placeholder="请选择分隔符"
|
||||||
|
style="width: 180px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in separatorOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
>{{ item.label }} ({{ item.value === " " ? " " : item.value }})
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<div class="form-tip">
|
||||||
|
用于连接地区名称,例如:北京{{
|
||||||
|
settingsData.area_config.separator
|
||||||
|
}}朝阳区
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 邮箱配置 -->
|
||||||
|
<el-card class="settings-card">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span>邮箱配置</span>
|
||||||
|
<el-button type="primary" @click="saveSettings('email_config')"
|
||||||
|
>保存</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-form
|
||||||
|
label-width="160px"
|
||||||
|
:model="settingsData.email_config"
|
||||||
|
class="settings-form"
|
||||||
|
>
|
||||||
|
<el-form-item label="SMTP服务器">
|
||||||
|
<el-input
|
||||||
|
v-model="settingsData.email_config.smtpServer"
|
||||||
|
placeholder="请输入SMTP服务器地址"
|
||||||
|
style="width: 320px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="SMTP端口">
|
||||||
|
<el-input
|
||||||
|
v-model="settingsData.email_config.smtpPort"
|
||||||
|
placeholder="请输入SMTP端口"
|
||||||
|
style="width: 320px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="认证">
|
||||||
|
<el-switch v-model="settingsData.email_config.auth" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="SSL加密">
|
||||||
|
<el-switch v-model="settingsData.email_config.sslEnable" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="发件邮箱">
|
||||||
|
<el-input
|
||||||
|
v-model="settingsData.email_config.fromEmail"
|
||||||
|
placeholder="请输入发件邮箱"
|
||||||
|
style="width: 320px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="发件邮箱名称">
|
||||||
|
<el-input
|
||||||
|
v-model="settingsData.email_config.fromEmailName"
|
||||||
|
placeholder="请输入发件邮箱名称"
|
||||||
|
style="width: 320px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="发件邮箱用户名">
|
||||||
|
<el-input
|
||||||
|
v-model="settingsData.email_config.fromEmailUser"
|
||||||
|
placeholder="请输入发件邮箱用户名 Fomail、阿里邮箱非空"
|
||||||
|
style="width: 320px"
|
||||||
|
/>
|
||||||
|
<div class="form-tip">
|
||||||
|
注意:邮箱用户名默认发件邮箱@前部分。Foxmail邮箱需要单独配置为与之绑定的qq号码或者XXXX@qq.com的XXXX;阿里云邮箱的用户名则是邮箱的完整地址。
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="发件邮箱密码/授权密钥">
|
||||||
|
<el-input
|
||||||
|
v-model="settingsData.email_config.fromEmailPassword"
|
||||||
|
type="password"
|
||||||
|
placeholder="请输入发件邮箱密码/授权密钥"
|
||||||
|
style="width: 320px"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="验证邮箱配置">
|
||||||
|
<el-input
|
||||||
|
v-model="settingsData.email_config.verifyEmail"
|
||||||
|
placeholder="请输入验证邮箱"
|
||||||
|
style="width: 320px"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="handleTestEmail">验证邮箱</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="收件邮箱列表">
|
||||||
|
<div class="email-list">
|
||||||
|
<el-tag
|
||||||
|
v-for="(email, index) in settingsData.email_config.toEmails"
|
||||||
|
:key="index"
|
||||||
|
class="email-tag"
|
||||||
|
closable
|
||||||
|
@close="handleRemoveEmail(index)"
|
||||||
|
>
|
||||||
|
{{ email }}
|
||||||
|
</el-tag>
|
||||||
|
<el-input
|
||||||
|
v-if="showEmailInput"
|
||||||
|
v-model="newEmail"
|
||||||
|
class="email-input"
|
||||||
|
placeholder="请输入邮箱并回车"
|
||||||
|
@keyup.enter="handleAddEmail"
|
||||||
|
@blur="handleEmailInputBlur"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
v-else
|
||||||
|
class="button-new-email"
|
||||||
|
:disabled="settingsData.email_config.toEmails.length >= 10"
|
||||||
|
@click="showEmailInput = true"
|
||||||
|
>
|
||||||
|
+ 添加邮箱
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="form-tip">最多可添加10个收件邮箱地址</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<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: 1500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-table {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-tip {
|
||||||
|
margin-top: 8px;
|
||||||
|
margin-left: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加遮罩层相关样式
|
||||||
|
:deep(.el-loading-mask) {
|
||||||
|
background-color: rgb(255 255 255 / 80%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.email-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.email-tag {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.email-input {
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-new-email {
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -12,6 +12,9 @@ import { bg, avatar, illustration } from "./utils/static";
|
|||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
import { ref, reactive, toRaw, onMounted, onBeforeUnmount } from "vue";
|
import { ref, reactive, toRaw, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
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 dayIcon from "@/assets/svg/day.svg?component";
|
||||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
import darkIcon from "@/assets/svg/dark.svg?component";
|
||||||
@@ -34,32 +37,57 @@ const { title } = useNav();
|
|||||||
|
|
||||||
const ruleForm = reactive({
|
const ruleForm = reactive({
|
||||||
username: "admin",
|
username: "admin",
|
||||||
password: "admin123"
|
password: "comcat@2019"
|
||||||
});
|
});
|
||||||
|
|
||||||
const onLogin = async (formEl: FormInstance | undefined) => {
|
const onLogin = async (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
await formEl.validate((valid, fields) => {
|
await formEl.validate(async (valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
useUserStoreHook()
|
try {
|
||||||
.loginByUsername({
|
const res = await request(loginApi("login"), {
|
||||||
username: ruleForm.username,
|
method: "POST",
|
||||||
password: ruleForm.password
|
body: JSON.stringify({
|
||||||
})
|
username: ruleForm.username,
|
||||||
.then(res => {
|
password: ruleForm.password,
|
||||||
if (res.success) {
|
isBackendUser: 1
|
||||||
// 获取后端路由
|
})
|
||||||
return initRouter().then(() => {
|
});
|
||||||
router.push(getTopMenu(true).path).then(() => {
|
|
||||||
message("登录成功", { type: "success" });
|
console.log("登录响应:", res);
|
||||||
});
|
|
||||||
});
|
if (res.status === 200) {
|
||||||
} else {
|
console.log("登录成功,开始初始化路由");
|
||||||
message("登录失败", { type: "error" });
|
console.log("accessToken:", res.data.accessToken);
|
||||||
}
|
|
||||||
})
|
// 存储token 格式为 DataInfo<T>
|
||||||
.finally(() => (loading.value = false));
|
//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,18 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
|||||||
target: "http://127.0.0.1:3290",
|
target: "http://127.0.0.1:3290",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path.replace(/^\/otherApi/, "")
|
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")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
|
// 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
|
||||||
|
|||||||
Reference in New Issue
Block a user