From f070b02da9a1ba5a98234cadcd38da7031d06610 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88?= <2960252003@qq.com>
Date: Wed, 17 Apr 2024 11:23:49 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=9A=84=E7=BB=9F=E8=AE=A1?=
=?UTF-8?q?=E5=9B=BE=E5=92=8C=E7=A5=A8=E6=8D=AE=E7=9A=84=E7=8A=B6=E6=80=81?=
=?UTF-8?q?=E5=88=86=E6=A0=87=E7=AD=BE=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/vite.config.dev.ts | 4 +-
index.html | 5 +-
package.json | 9 +-
src/api/interceptor.ts | 4 +-
src/api/role.ts | 9 +-
src/api/ticket.ts | 10 +-
src/api/user.ts | 14 +-
src/components/footer/index.vue | 18 +-
src/components/navbar/index.vue | 8 +-
src/config/settings.json | 2 +-
src/image/票据服务.png | Bin 0 -> 3112 bytes
src/router/routes/modules/system.ts | 2 +-
src/router/routes/modules/ticket.ts | 2 +-
src/router/routes/modules/user.ts | 2 +-
src/store/modules/role/index.ts | 4 +-
src/store/modules/ticket/index.ts | 11 +-
src/store/modules/user/index.ts | 15 +-
src/types/global.ts | 2 +
src/utils/excel.ts | 69 +
.../workplace/components/data-panel.vue | 284 +-
src/views/dashboard/workplace/locale/en-US.ts | 2 +
src/views/dashboard/workplace/locale/zh-CN.ts | 2 +
src/views/login/components/login-form.vue | 130 +-
src/views/login/index.vue | 102 +-
src/views/login/locale/en-US.ts | 6 +-
src/views/login/locale/zh-CN.ts | 22 +-
.../system/dept/components/dept-edit.vue | 14 +-
src/views/system/dept/index.vue | 63 +-
src/views/system/dept/locale/en-US.ts | 6 +-
src/views/system/dept/locale/zh-CN.ts | 11 +-
.../system/role/components/role-edit.vue | 15 +-
src/views/system/role/index.vue | 124 +-
src/views/system/role/locale/en-US.ts | 8 +
src/views/system/role/locale/zh-CN.ts | 8 +
.../system/user/components/user-edit.vue | 87 +-
src/views/system/user/index.vue | 103 +-
src/views/system/user/locale/en-US.ts | 4 +
src/views/system/user/locale/zh-CN.ts | 9 +-
.../ticket/manage/components/form-edit.vue | 101 +-
.../ticket/manage/components/ticket-edit.vue | 126 +-
src/views/ticket/manage/index.vue | 248 +-
src/views/ticket/manage/locale/en-US.ts | 35 +-
src/views/ticket/manage/locale/zh-CN.ts | 36 +-
.../setting/components/password-reset.vue | 4 +-
.../user/setting/components/user-panel.vue | 2 +-
yarn.lock | 12304 ++++++++--------
46 files changed, 7371 insertions(+), 6675 deletions(-)
create mode 100644 src/image/票据服务.png
create mode 100644 src/utils/excel.ts
diff --git a/config/vite.config.dev.ts b/config/vite.config.dev.ts
index 6e3a086..75f7f76 100644
--- a/config/vite.config.dev.ts
+++ b/config/vite.config.dev.ts
@@ -13,8 +13,8 @@ export default mergeConfig(
},
proxy: {
'/api': {
- target: 'http://59.110.238.182:8081',
- // target: 'http://192.168.3.158:8081',
+ target: 'http://106.53.179.133:8081',
+ // target: 'http://192.168.243.246:8081',
// target: 'http://localhost:5173',
changeOrigin: true,
},
diff --git a/index.html b/index.html
index 3eeb81f..a8bba25 100644
--- a/index.html
+++ b/index.html
@@ -3,10 +3,9 @@
-
+
- 中山学院学习平台
+ 票据管理系统
diff --git a/package.json b/package.json
index 67786de..a86716a 100644
--- a/package.json
+++ b/package.json
@@ -13,10 +13,7 @@
"type:check": "vue-tsc --noEmit --skipLibCheck",
"lint-staged": "npx lint-staged",
"prepare": "husky install",
-
"start": "npm run dev"
-
-
},
"lint-staged": {
"*.{js,ts,jsx,tsx}": [
@@ -40,6 +37,8 @@
"axios": "^0.24.0",
"dayjs": "^1.11.5",
"echarts": "^5.4.0",
+ "exceljs": "^4.4.0",
+ "file-saver": "^2.0.5",
"lodash": "^4.17.21",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
@@ -50,12 +49,14 @@
"vue": "^3.2.40",
"vue-echarts": "^6.2.3",
"vue-i18n": "^9.2.2",
- "vue-router": "^4.0.14"
+ "vue-router": "^4.0.14",
+ "xlsx": "^0.18.5"
},
"devDependencies": {
"@arco-plugins/vite-vue": "^1.4.5",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
+ "@types/file-saver": "^2.0.7",
"@types/lodash": "^4.14.186",
"@types/mockjs": "^1.0.7",
"@types/nprogress": "^0.2.0",
diff --git a/src/api/interceptor.ts b/src/api/interceptor.ts
index 360865f..b9f43c9 100644
--- a/src/api/interceptor.ts
+++ b/src/api/interceptor.ts
@@ -75,10 +75,12 @@ axios.interceptors.response.use(
const { response } = error;
console.log('error', error);
- if (response.status === '401') {
+ if (response.status === 401) {
+
router.push({
name: 'login',
});
+
}
else {
Message.error({
diff --git a/src/api/role.ts b/src/api/role.ts
index 9681312..1587fc2 100644
--- a/src/api/role.ts
+++ b/src/api/role.ts
@@ -18,8 +18,13 @@ export interface RoleListRecord extends RoleRecord {
}
// 查询所有的角色列表、
-export function queryRoleList() {
- return axios.get('/api/rest/role');
+export function queryRoleList(data: any) {
+ // return axios.get('/api/rest/role',data);
+ return axios({
+ url: '/api/rest/role', // 路径
+ method: 'get',
+ params: data, // 参数
+ })
}
// 切换启用状态
diff --git a/src/api/ticket.ts b/src/api/ticket.ts
index d22ebec..d470181 100644
--- a/src/api/ticket.ts
+++ b/src/api/ticket.ts
@@ -7,7 +7,7 @@ export interface TicketCreateRecord {
type: string;
contactEmail: string;
companyName: string;
- attachId: string;
+ attachId: [];
auditorId: string;
submit: boolean;
userId: undefined;
@@ -15,6 +15,9 @@ export interface TicketCreateRecord {
}
export interface TicketRecord extends TicketCreateRecord {
+auditor: any;
+createTime(createTime: any): unknown;
+deptName: any;
value: any;
id: undefined;
status: string
@@ -83,3 +86,8 @@ export function home(data: any){
params: data, // 参数
});
}
+
+// 首页统计图
+export function chart(){
+ return axios.get('/api/rest/bill/trend')
+}
\ No newline at end of file
diff --git a/src/api/user.ts b/src/api/user.ts
index c2b13be..5e532d5 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -29,6 +29,8 @@ export interface PasswordReSetModel {
// 添加用户数据
export interface CreateRecord {
+value: any;
+code: any;
username: string;
nickName: string;
@@ -107,10 +109,15 @@ export function resetPassword(data: PasswordReSetModel) {
}
// 注册用户
-export function create(data: CreateRecord) {
+export function register(data: CreateRecord) {
return axios.post('/api/rest/user/register', data);
}
+// 新建用户
+export function create(data: CreateRecord) {
+ return axios.post('/api/rest/user', data);
+}
+
// 模糊查询用户列表
export function queryUserList(params: any) {
return axios({
@@ -158,6 +165,11 @@ export function deptAudit(id: string,roleId:string){
});
}
+// 获取验证码
+export function code(data: string){
+ return axios.get(`/api/rest/user/send-email?email=${data}`);
+}
+
export function switchRole(roleId: number) {
return axios.patch(`/api/user/self/switch-role/${roleId}`);
}
diff --git a/src/components/footer/index.vue b/src/components/footer/index.vue
index 9a250cc..9ba905a 100644
--- a/src/components/footer/index.vue
+++ b/src/components/footer/index.vue
@@ -1,16 +1,16 @@
-
+
diff --git a/src/components/navbar/index.vue b/src/components/navbar/index.vue
index cc2c7ae..70ca45e 100644
--- a/src/components/navbar/index.vue
+++ b/src/components/navbar/index.vue
@@ -2,10 +2,7 @@
-
+
+ {{
+ userStore.nickName
+ }}
>lvU-}w@tQQ?8Ta(l%QZ=DN=_8{LnyThfro|mMFeNlJUw|S=b
zJ_CSZ{lW3DsXn>1P9MJ;k=m<<>GTHtvI!UUbu6@bGG>Uqv9;ASSwG3+PN3KCL!jDn
zitj{);ZJNJAWa%(qZR{@cSGS14#uDrg_40QV{^U_AOuA*<55YCnEy%`_HdMv=^Ono
zU@){y8N@M>C-7?uCYlFuPJXPvI%&OK_f%+SQzQASWXYNB&kLNEyeDu?9bQ4#C7zpf
z2VYst^SV~knP~3EQQ=PH$O(e+2g?_o(AOO}AETA=V&3ujb}=(MK5B>edw-F7!eKkn
zRZRy($BW8ZXZE9xyh!3QCUCm{JLzr
zDhr}reDS%Y62A79kMUGrG-_&GhyNnqJv_G!z#NF+&0Ror{Mj`!k#Pdmk^8ud>G!oi
zUxPPP(QW{5-Q{w{wgky4?2;c{tJkTUuJqfoZ%gfEl_b`EWRnq_lZ|>QMuy7mRwro!SfwB+6^XoBHf$QVL?o>UHxL#3`$&$wh
zZb#bt;U}s6jd7~?0(nn`zz^OR8?{m}TJ6VF&ntSiOm1~A@xQyxWoJMLV@W&Tj^4$4
zEy&&Dyb%A^ckfu>_a`S!g`l#pCel=C=xEia$Bgz^K|nb94cV4@8440f8!lrPVFaK}
z>pDY314bZs)_s{ZheLG@{LdLEf^bdWroBi70)Pp@=HlK95_MNg-%#ODF!9U?N#YMU
z6q_B~))foD94|6oUi^&^Bxb1LiKXXL8EWqo+B4+!Tmp!YNy@d~=7OjuLQwzi#7t2!
zAmRP9D%LC%PBzhV->(@1h~Dqc%#}wIXDQeGi7~GM9lOWfiaxYV)E}SOMN=ZBTCc=$
zcSD@~5syLuxb^1|rURn9Ulf-M5_^bD`*aB58qKF;*(U3)JG(d@XXIaLaUU@3mwI;fDb^2=hN6Kh?guQnh==>Z8i{
zMJ*g>LuSToIXIk~`)P{ZmJ*q=mW#YWFQ0tF8ZWPwhNb=P<;fq*Yv6MlxZ=?qh7`5B
zfju5vF8%aw_#b5r5j~L<`Qn|ghy`8QYgsp`fAFAx&^Rt%jk`D47?F0kTEtZhmJy`gf~>Y^Bq|sU@A_CJ}Cj
z%P)SG)r{C2w1=ntwcmFi%Q-3tPA)k6V_#vBU2ch6VNw17)jsSmYk43+j#k@3HmEXB
zb{}BqSyO7=N{7reuUK?YdNeXKa_^&BMus(L@<}i7yVX;4XD=7WT13&
z)=DU;#^{jqWe6z+cJ9%@!cElt4TjD>t8yvJZsXjhZI^FlZ&Aqa8xmCi^$rCUQd=y~
zv@hX3$J$wX_k~OFz_dK~p(D)^Q($@P8lvh@IeW!LU17p)e?e*R{GfUwa6_!!KBXJ0
zbz}ok+&Q48vtatG8(R;_8CIY|{8uj@dt*=^E9b~xC%LKl=4EgK9O%O(S#b(pG}+SD
z5vr?%RoWB5k$%!ARoaJ|q!zu38H_q@Hq|GjdaV_pyW@~!QiTV@5;GmZGnxRl~`2OIT-*ws|UU*(}9
zawM1O>~t}&!cRb9sWt9sg%COjmqt`z5tN
zPVritcRJO0gsfj$c@VTl)R?RMK8Q&e^4`Nuj`+YloD1Ce!YmjzCl0+HNO?Lvm%3=U
z{B0@gb}$rV%O8(OO2Bs%m!6`~u47yBlPFz`dPF>SKp9LcEI6JztFdTWPglqI`|cyG
zlbs&aW+$r*Tk9iN9-ez))Q|Q^ia8gBfu6NuBQM9LuTpg8r|D-*+^pcucL##<7iJpt
z2zyp=dkNQGHhgte>L{UTW#(?L&-Y?qwVt94&6`2#iUp5YdkMym>LcN2SC>odyXYG6
zyrxm^&m5ZS3Li#ioI_F9)^SJfAb>w8Ce)4OF@S>lnoi7b1SF0x@7YBn~
zII+vT=1+*-r6}%()lZFt3us*(HYi)rBL?R5TEe0JnY!v;D=<#)ncM71N2cPsOG^+^
zyj`N^d+pS>XLTn?6D<}|uLlO2tU5$?f%~J6`82hTJ`5!?RW1f8
zj=buEla<gEGr{PZ<$=zapUm>l|j)bkeodHp?I!h1MUF&
zXkWb=T|{?jP8QA>F@QNH%{7UBE8A?k<%Wr}*Q5gbJS$kRFGpGnP8l9NohI(ca|8$X@u!k7rU%if$i)e)ow;e27Fu~KjsGYH2&iZwEK#d(E1}ktW%(fSsh^PP&5G5?A6J(&eJDhMW9>{
z0xd#;Cv8wjjF1bf=fvdsK4
F;omT~tc(Bv
literal 0
HcmV?d00001
diff --git a/src/router/routes/modules/system.ts b/src/router/routes/modules/system.ts
index 34cff69..f696972 100644
--- a/src/router/routes/modules/system.ts
+++ b/src/router/routes/modules/system.ts
@@ -9,7 +9,7 @@ const SYSTEM: AppRouteRecordRaw = {
locale: 'menu.system',
icon: 'icon-computer',
requiresAuth: true,
- order: 1,
+ order: 2,
},
children: [
// {
diff --git a/src/router/routes/modules/ticket.ts b/src/router/routes/modules/ticket.ts
index c6d1be0..4a2447c 100644
--- a/src/router/routes/modules/ticket.ts
+++ b/src/router/routes/modules/ticket.ts
@@ -9,7 +9,7 @@ const TICKET: AppRouteRecordRaw = {
locale: 'menu.ticket',
icon: 'icon-folder-add',
requiresAuth: true,
- order: 4,
+ order: 1,
},
children: [
{
diff --git a/src/router/routes/modules/user.ts b/src/router/routes/modules/user.ts
index 371519d..5650ebb 100644
--- a/src/router/routes/modules/user.ts
+++ b/src/router/routes/modules/user.ts
@@ -9,7 +9,7 @@ const USER: AppRouteRecordRaw = {
locale: 'menu.user',
icon: 'icon-user',
requiresAuth: true,
- order: 7,
+ order: 3,
},
children: [
// {
diff --git a/src/store/modules/role/index.ts b/src/store/modules/role/index.ts
index 6394c30..818ff73 100644
--- a/src/store/modules/role/index.ts
+++ b/src/store/modules/role/index.ts
@@ -27,8 +27,8 @@ const useRoleStore = defineStore('role', {
},
actions: {
// 获取所有的角色列表
- async getRoleList() {
- return queryRoleList();
+ async getRoleList(params: any) {
+ return queryRoleList(params);
},
async enabledRole(id: string) {
diff --git a/src/store/modules/ticket/index.ts b/src/store/modules/ticket/index.ts
index 417855a..7bdd555 100644
--- a/src/store/modules/ticket/index.ts
+++ b/src/store/modules/ticket/index.ts
@@ -11,7 +11,8 @@ import {
audit,
uploadFile,
attachment,
- home
+ home,
+ chart,
} from '@/api/ticket';
import { ticketStore } from './type';
@@ -61,7 +62,7 @@ const useTicketStore = defineStore('ticket', {
return update(data);
},
- async uploadFileTicket(file: any) {
+ async uploadFile(file: any) {
return uploadFile(file);
},
@@ -75,7 +76,11 @@ const useTicketStore = defineStore('ticket', {
async getHome(data: any){
return home(data);
- }
+ },
+
+ async getChart(){
+ return chart();
+ },
},
});
diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts
index 70afbe2..ba1f921 100644
--- a/src/store/modules/user/index.ts
+++ b/src/store/modules/user/index.ts
@@ -10,10 +10,12 @@ import {
enabled,
remove,
create,
+ register,
UserRecord,
update,
userDetail,
- deptAudit
+ deptAudit,
+ code
} from '@/api/user';
import { setToken, clearToken } from '@/utils/auth';
import { removeRouteListener } from '@/utils/route-listener';
@@ -92,11 +94,16 @@ const useUserStore = defineStore('user', {
return remove(id);
},
- // Register user
+ // Create user
async createUser(data: UserRecord) {
return create(data);
},
+ // register user
+ async registerUser(data: UserRecord) {
+ return register(data);
+ },
+
// Update user
async updateUser(data: UserRecord) {
return update(data);
@@ -110,6 +117,10 @@ const useUserStore = defineStore('user', {
return deptAudit(deptId,roleId)
},
+ async getCode(params: string){
+ return code(params)
+ },
+
logoutCallBack() {
const appStore = useAppStore();
this.resetInfo();
diff --git a/src/types/global.ts b/src/types/global.ts
index 05a25fe..b1e4dac 100644
--- a/src/types/global.ts
+++ b/src/types/global.ts
@@ -26,6 +26,8 @@ export interface PostData {
export interface Pagination {
page: number;
size: number;
+ current: number;
+ total: null | number;
}
export type TimeRanger = [string, string];
diff --git a/src/utils/excel.ts b/src/utils/excel.ts
new file mode 100644
index 0000000..fa670b2
--- /dev/null
+++ b/src/utils/excel.ts
@@ -0,0 +1,69 @@
+// 新建 @/utils/excel.ts
+
+import saveAs from 'file-saver'; // https://www.npmjs.com/package/file-saver
+import ExcelJS from 'exceljs'; // https://github.com/exceljs/exceljs/blob/master/README_zh.md
+import dayjs from 'dayjs'; // https://dayjs.fenxianglu.cn/
+import * as XLSX from 'xlsx'; // https://www.npmjs.com/package/xlsx
+import { Message } from '@arco-design/web-vue'; // https://arco.design/vue/component/message
+import { FileItem } from '@arco-design/web-vue/es/upload/interfaces'; // arco类型
+
+export interface DownloadExcelPrams {
+ columns: { title: string, key: string }[];
+ rows: object[];
+ name: string
+}
+
+// 导出下载文件
+export function downloadExcel({ columns, rows, name = '未命名文件' }: DownloadExcelPrams) {
+
+ const workbook = new ExcelJS.Workbook();
+ workbook.creator = 'Start-front';
+ workbook.lastModifiedBy = 'Start-front';
+ workbook.created = new Date(1985, 8, 30);
+ workbook.modified = new Date();
+ workbook.lastPrinted = new Date(2016, 9, 27);
+
+ // 将工作簿添加一个sheet页sheet1
+ const sheet1 = workbook.addWorksheet(name);
+ // 表头数据添加
+ sheet1.columns = columns.map(item => ({
+ header: item.title,
+ key: item.key,
+ width: 20
+ }));
+ // 表格内容添加
+ rows.map(item => sheet1.addRow(item));
+ workbook.xlsx.writeBuffer().then(buffer => {
+ saveAs(
+ new Blob([buffer], { type: 'application/octet-stream' }),
+ `${name}.xlsx`
+ );
+ });
+};
+
+
+// 读取文件为json格式
+export function readExcle(fileItem:FileItem) {
+ console.log('读取文件...',fileItem);
+ return new Promise((resove,reject)=>{
+ try {
+ let workbook:XLSX.Sheet;
+ const reader = new FileReader();
+ reader.readAsBinaryString(fileItem.file as File); // 发起异步请求
+ reader.onload = function(ev){
+ const data = ev.target?.result;
+ workbook = XLSX.read(data, {type: 'binary'});
+ const sheetNames = workbook.SheetNames; // 工作表名称集合
+ sheetNames.forEach((name:string) => {
+ const worksheet = workbook.Sheets[name]; // 只能通过工作表名称来获取指定工作表
+ const jsonres = XLSX.utils.sheet_to_json(worksheet);
+ resove(jsonres)
+ });
+ } // onload
+ } catch (error) {
+ Message.error('读取失败,请选择正确文件');
+ reject(error);
+ }
+ })
+}
+
diff --git a/src/views/dashboard/workplace/components/data-panel.vue b/src/views/dashboard/workplace/components/data-panel.vue
index 53ccd03..460efa5 100644
--- a/src/views/dashboard/workplace/components/data-panel.vue
+++ b/src/views/dashboard/workplace/components/data-panel.vue
@@ -1,114 +1,122 @@
-
-
-
-
-
-
-
-
- {{ $t('workplace.pecs') }}
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('workplace.pecs') }}
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('workplace.pecs') }}
-
-
-
-
-
-
-
-
-
-
-
- {{ $t('workplace.pecs') }}
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ {{ $t('workplace.pecs') }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('workplace.pecs') }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('workplace.pecs') }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('workplace.pecs') }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/login/locale/en-US.ts b/src/views/login/locale/en-US.ts
index 8611b12..f7f36e1 100644
--- a/src/views/login/locale/en-US.ts
+++ b/src/views/login/locale/en-US.ts
@@ -1,11 +1,11 @@
export default {
'login.form.title': 'ZSC Learning Platform',
- 'login.form.userName.errMsg': 'Username cannot be empty',
+ 'login.form.userName.errMsg': 'Username cannot be empty(Email)',
'login.form.password.errMsg': 'Password cannot be empty',
'login.form.login.errMsg': 'Login error, refresh and try again',
'login.form.login.success': 'welcome to use',
- 'login.form.userName.placeholder': 'Username: admin',
- 'login.form.password.placeholder': 'Password: admin',
+ 'login.form.userName.placeholder': 'Username(Email)',
+ 'login.form.password.placeholder': 'Password',
'login.form.rememberPassword': 'Remember password',
'login.form.forgetPassword': 'Forgot password',
'login.form.login': 'login',
diff --git a/src/views/login/locale/zh-CN.ts b/src/views/login/locale/zh-CN.ts
index eb6d97c..b9b32be 100644
--- a/src/views/login/locale/zh-CN.ts
+++ b/src/views/login/locale/zh-CN.ts
@@ -1,6 +1,6 @@
export default {
- 'login.form.title': '中山学院学习平台',
- 'login.form.userName.errMsg': '用户名不能为空',
+ 'login.form.title': '票据管理系统',
+ 'login.form.userName.errMsg': '账号不能为空',
'login.form.password.errMsg': '密码不能为空',
'login.form.login.errMsg': '登录出错,请刷新重试',
'login.form.login.success': '欢迎使用',
@@ -10,11 +10,15 @@ export default {
'login.form.forgetPassword': '忘记密码',
'login.form.login': '登录',
'login.form.register': '注册账号',
- 'login.banner.slogan1': '开箱即用的高质量模板',
- 'login.banner.subSlogan1': '丰富的的页面模板,覆盖大多数典型业务场景',
- 'login.banner.slogan2': '内置了常见问题的解决方案',
- 'login.banner.subSlogan2': '国际化,路由配置,状态管理应有尽有',
- 'login.banner.slogan3': '接入可视化增强工具AUX',
- 'login.banner.subSlogan3': '实现灵活的区块式开发',
- 'create.user': '注册用户'
+
+ 'login.banner.slogan1': '数据查询',
+ 'login.banner.subSlogan1': '用户可以通过关键词、条件组合等方式进行快速查询和检索',
+ 'login.banner.slogan2': '数据存储',
+ 'login.banner.subSlogan2': '系统具备强大的数据存储功能,能够将海量数据存储在数据库中',
+ 'login.banner.slogan3': '数据输出',
+ 'login.banner.subSlogan3': '系统可以将查询和分析结果以表格和图表导出',
+
+ 'create.user': '注册用户',
+ 'user.info.emailCode.placeholder':'请输入Email(用于获取验证码)',
+ 'user.info.email.required':'Email不能为空',
};
diff --git a/src/views/system/dept/components/dept-edit.vue b/src/views/system/dept/components/dept-edit.vue
index 8b1a3f8..8d3e690 100644
--- a/src/views/system/dept/components/dept-edit.vue
+++ b/src/views/system/dept/components/dept-edit.vue
@@ -1,25 +1,26 @@
- {{ modalTitle }}
+ {{ t('create') }}
- {{ modalTitle }}
+
+ {{ t('edit') }}
{{ modalTitle }}
-
+
@@ -58,7 +60,7 @@ const props = defineProps({
});
const { t } = useI18n();
const modalTitle = computed(() => {
- return props.isCreate ? t('create') : t('edit');
+ return props.isCreate ? t('createDept') : t('editDept');
});
const { visible, setVisible } = useVisible(false);
const deptStore = useDeptStore();
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index 7182660..771ff40 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -1,13 +1,13 @@
-
+
@@ -118,6 +118,8 @@
:data="renderData"
:bordered="false"
:size="size"
+ :pagination="false"
+ style="margin-bottom: 40px"
>
{{ rowIndex + 1 }}
@@ -146,12 +148,28 @@
type="error"
@ok="handleDelete(record)"
>
-
+
+
{{ $t('delete') }}
+
@@ -161,6 +179,7 @@ import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import useLoading from '@/hooks/loading';
import useTableOption from '@/hooks/table-option';
+import { Pagination } from '@/types/global';
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
import dayjs from 'dayjs';
import { Message } from '@arco-design/web-vue';
@@ -187,6 +206,12 @@ const generateFormModel = () => {
code: '',
};
};
+const pagination: Pagination = {
+ page: 1,
+ size: 10,
+ current: 1,
+ total: 10,
+};
const { t } = useI18n();
const renderData = ref([]);
@@ -202,10 +227,16 @@ const columns = computed(() => [
{
title: t('deptTable.columns.name'),
dataIndex: 'name',
+ sortable: {
+ sortDirections: ['ascend', 'descend'],
+ },
},
{
title: t('deptTable.columns.id'),
dataIndex: 'id',
+ sortable: {
+ sortDirections: ['ascend', 'descend'],
+ },
},
{
title: t('deptTable.columns.remark'),
@@ -215,6 +246,9 @@ const columns = computed(() => [
title: t('deptTable.columns.createTime'),
dataIndex: 'createTime',
slotName: 'createTime',
+ sortable: {
+ sortDirections: ['ascend', 'descend'],
+ },
},
{
title: t('deptTable.columns.enabled'),
@@ -233,8 +267,11 @@ const fetchData = async (params?: Partial) => {
setLoading(true);
try {
const res = await deptStore.getDeptList(params);
- const { data } = res;
- renderData.value = data;
+
+ renderData.value = res.data.records;
+ pagination.page = res.data.page;
+ pagination.current = res.data.current;
+ pagination.total = res.data.total;
} catch (err) {
// you can report use errorHandler or other
} finally {
@@ -245,12 +282,26 @@ const fetchData = async (params?: Partial) => {
// 查询
const search = () => {
fetchData({
+ ...pagination,
...formModel.value,
- });
+ } as unknown as any);
};
search();
+// 分页发生改变
+const onPageChange = (current: number) => {
+ pagination.page = current;
+ pagination.current = current;
+ search();
+};
+
+// 数据条数改变
+const onSizeChange = (size: number) => {
+ pagination.size = size;
+ search();
+};
+
// 重置
const reset = () => {
formModel.value = generateFormModel();
diff --git a/src/views/system/dept/locale/en-US.ts b/src/views/system/dept/locale/en-US.ts
index 8e0c5ba..221edab 100644
--- a/src/views/system/dept/locale/en-US.ts
+++ b/src/views/system/dept/locale/en-US.ts
@@ -21,5 +21,9 @@ export default {
'dept.info.remark': 'Remark',
'dept.info.remark.placeholder': 'Please enter Remark',
- 'Confirm the deletion of this department' :'Confirm the deletion of this department?'
+ 'Confirm the deletion of this department' :'Confirm the deletion of this department?',
+
+ // modalTitle
+ 'createDept': 'Create Dept',
+ 'editDept': 'Edit Dept Info'
};
diff --git a/src/views/system/dept/locale/zh-CN.ts b/src/views/system/dept/locale/zh-CN.ts
index ccf02a0..586576a 100644
--- a/src/views/system/dept/locale/zh-CN.ts
+++ b/src/views/system/dept/locale/zh-CN.ts
@@ -5,8 +5,8 @@ export default {
'searchTable.form.deptName.placeholder': '请输入部门名称',
'deptTable.columns.index': '序号',
- 'deptTable.columns.name': '区域名称',
- 'deptTable.columns.id': '区域ID',
+ 'deptTable.columns.name': '部门名称',
+ 'deptTable.columns.id': '部门ID',
'deptTable.columns.remark': '备注',
'deptTable.columns.enabled': '是否启用',
'deptTable.columns.createTime': '创建时间',
@@ -21,5 +21,10 @@ export default {
'dept.info.remark': '备注',
'dept.info.remark.placeholder': '请输入备注',
- 'Confirm the deletion of this department' :'确认删除此部门?'
+ 'Confirm the deletion of this department' :'确认删除此部门?',
+
+
+ // modalTitle
+ 'createDept': '新增部门',
+ 'editDept': '修改部门信息'
};
diff --git a/src/views/system/role/components/role-edit.vue b/src/views/system/role/components/role-edit.vue
index 6304321..eb45b3f 100644
--- a/src/views/system/role/components/role-edit.vue
+++ b/src/views/system/role/components/role-edit.vue
@@ -1,25 +1,26 @@
- {{ modalTitle }}
+ {{ t('create') }}
- {{ modalTitle }}
+
+ {{ t('edit') }}
{{ modalTitle }}
-
+
@@ -60,7 +63,7 @@ const props = defineProps({
});
const { t } = useI18n();
const modalTitle = computed(() => {
- return props.isCreate ? t('create') : t('edit');
+ return props.isCreate ? t('createRole') : t('editRole');
});
const { visible, setVisible } = useVisible(false);
const createEditRef = ref();
diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue
index 5e867d6..bca158d 100644
--- a/src/views/system/role/index.vue
+++ b/src/views/system/role/index.vue
@@ -1,7 +1,46 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('searchTable.form.search') }}
+
+
+
+
+
+ {{ $t('searchTable.form.reset') }}
+
+
+
+
+
@@ -77,6 +116,7 @@
:bordered="false"
:size="size"
@page-change="onPageChange"
+ style="margin-bottom: 40px"
>
{{ rowIndex + 1 }}
@@ -105,12 +145,28 @@
type="error"
@ok="handleDelete(record)"
>
-
+
+
{{ $t('delete') }}
+
@@ -119,6 +175,7 @@
import { computed, ref, reactive, watch, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import useLoading from '@/hooks/loading';
+import { Pagination } from '@/types/global';
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
import { Message } from '@arco-design/web-vue';
import useTableOption from '@/hooks/table-option';
@@ -143,6 +200,19 @@ const {
deepClone,
} = useTableOption();
const roleStore = useRoleStore();
+const generateFormModel = () => {
+ return {
+ name: undefined,
+ };
+};
+
+const formModel = ref(generateFormModel());
+const pagination: Pagination = {
+ page: 1,
+ size: 10,
+ current: 1,
+ total: 10,
+};
// 表格头部
const columns = computed(() => [
@@ -154,19 +224,21 @@ const columns = computed(() => [
{
title: t('roleTable.columns.name'),
dataIndex: 'name',
+ sortable: {
+ sortDirections: ['ascend', 'descend'],
+ },
},
{
title: t('roleTable.columns.remark'),
dataIndex: 'remark',
},
- // {
- // title: t('roleTable.columns.authorities'),
- // dataIndex: 'authorities',
- // },
{
title: t('roleTable.columns.createTime'),
dataIndex: 'createTime',
slotName: 'createTime',
+ sortable: {
+ sortDirections: ['ascend', 'descend'],
+ },
},
{
title: t('roleTable.columns.enabled'),
@@ -181,11 +253,15 @@ const columns = computed(() => [
]);
// 获取表格数据
-const fetchData = async () => {
+const fetchData = async (params: any) => {
setLoading(true);
try {
- const res = await roleStore.getRoleList();
- renderData.value = res.data;
+ const res = await roleStore.getRoleList(params);
+ console.log('info', res.data);
+ renderData.value = res.data.records;
+ pagination.page = res.data.page;
+ pagination.current = res.data.current;
+ pagination.total = res.data.total;
} catch (err) {
// you can report use errorHandler or other
} finally {
@@ -193,7 +269,33 @@ const fetchData = async () => {
}
};
-fetchData();
+// 模糊查询
+const search = () => {
+ fetchData({
+ ...pagination,
+ ...formModel.value,
+ } as unknown as any);
+};
+
+search();
+
+// 分页发生改变
+const onPageChange = (current: number) => {
+ pagination.page = current;
+ pagination.current = current;
+ search();
+};
+
+// 数据条数改变
+const onSizeChange = (size: number) => {
+ pagination.size = size;
+ search();
+};
+
+// 重置
+const reset = () => {
+ formModel.value = generateFormModel();
+};
// 是否启用
const enabledStatus = async (record: string) => {
@@ -220,7 +322,7 @@ const handleDelete = async (record: RoleRecord) => {
content: t('delete.role.sucess'),
duration: 5 * 1000,
});
- fetchData();
+ search();
} else {
Message.error({
content: t('delete.role.fail'),
diff --git a/src/views/system/role/locale/en-US.ts b/src/views/system/role/locale/en-US.ts
index 22a7d1d..d78ea57 100644
--- a/src/views/system/role/locale/en-US.ts
+++ b/src/views/system/role/locale/en-US.ts
@@ -14,6 +14,9 @@ export default {
'delete.role.sucess': 'Delete Role Sucess',
'delete.role.fail': 'Delete Role Fail',
+ 'searchTable.form.name':'Name',
+ 'searchTable.form.name.placeholder':'Please enter Name',
+
'role.info.name': 'Name',
'role.info.name.placeholder': 'Please enter Name',
'role.info.name.required': 'Name is required',
@@ -27,4 +30,9 @@ export default {
'modify.status.sucess':'Modify status sucess',
'modify.status.fail':'Modify status fail',
+
+
+ // modalTitle
+ 'createRole': 'Create Role',
+ 'editRole': 'Edit Role Info',
};
diff --git a/src/views/system/role/locale/zh-CN.ts b/src/views/system/role/locale/zh-CN.ts
index 48599b6..5906d53 100644
--- a/src/views/system/role/locale/zh-CN.ts
+++ b/src/views/system/role/locale/zh-CN.ts
@@ -14,6 +14,9 @@ export default {
'delete.role.sucess': '删除角色成功',
'delete.role.fail': '删除角色失败',
+ 'searchTable.form.name':'角色名称',
+ 'searchTable.form.name.placeholder':'请输入角色名称',
+
'role.info.name': '角色名称',
'role.info.name.placeholder': '请输入角色名称',
'role.info.name.required': '角色不能为空',
@@ -27,4 +30,9 @@ export default {
'modify.status.sucess':'修改状态成功',
'modify.status.fail':'修改状态失败',
+
+
+ // modalTitle
+ 'createRole': '新增角色',
+ 'editRole': '修改角色信息'
};
diff --git a/src/views/system/user/components/user-edit.vue b/src/views/system/user/components/user-edit.vue
index 243a337..91065d6 100644
--- a/src/views/system/user/components/user-edit.vue
+++ b/src/views/system/user/components/user-edit.vue
@@ -1,26 +1,27 @@
- {{ modalTitle }}
+ {{ t('create') }}
- {{ modalTitle }}
+
+ {{ t('edit') }}
{{ modalTitle }}
-
+
{{ formData.username }}
-
-
-
+
+
+
+
{
- return props.isCreate ? t('create') : t('edit');
+ return props.isCreate ? t('createUser') : t('editUser');
});
const { visible, setVisible } = useVisible(false);
const checkKeys = ref([]);
@@ -180,32 +181,16 @@ let formDifer = {};
const userStore = useUserStore();
// 部门数据
-// const deptOptions = computedAsync(async () => {
-// const { data } = await deptList();
-// const deptData = data.filter((item: any) => {
-// return item.enabled !== false;
-// });
-// return deptData;
-// });
-
const deptOptions = ref();
const getDeptData = async () => {
const res = await deptList();
- deptOptions.value = res.data;
+ deptOptions.value = res.data.records;
};
// 角色数据
-// const roleOptions = computedAsync(async () => {
-// const res = await queryRoleList();
-// const roleData = res.data.filter((item: any) => {
-// return item.enabled !== false;
-// });
-// return roleData;
-// });
-
const roleOptions = ref();
const getRoleData = async () => {
- const res = await queryRoleList();
- roleOptions.value = res.data.filter((item: any) => {
+ const res = await queryRoleList('');
+ roleOptions.value = res.data.records.filter((item: any) => {
return item.enabled !== false;
});
};
@@ -215,7 +200,6 @@ const handleClick = () => {
getDeptData();
getRoleData();
const userId = props.prem?.id;
-
// 编辑
if (!props.isCreate && userId) {
formData.value = props.prem;
@@ -242,6 +226,7 @@ const handleSubmit = async () => {
formData.value.permissionIds = checkKeys.value;
// 新增
if (props.isCreate) {
+ // formData.value.username = formData.value.email;
const res = await userStore.createUser(formData.value);
if (res.status === 200) {
Message.success({
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index cb882c5..2567fc0 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -1,7 +1,7 @@
-
+
-
+
+
+
+
+
+ {{ $t('searchTable.operation.download') }}
+
@@ -152,12 +163,15 @@
{{ rowIndex + 1 + (pagination.current - 1) * pagination.size }}
@@ -177,12 +191,12 @@
:is-create="false"
@refresh="fetchData"
/>
-
+ />
+