Compare commits
169 Commits
e15601c13c
...
RISE
| Author | SHA1 | Date | |
|---|---|---|---|
| 71357f9621 | |||
|
|
8d8a7db748 | ||
|
|
98bc6585c8 | ||
|
|
01ef25b70a | ||
|
|
98799a2555 | ||
|
|
7e0371134b | ||
|
|
9b60b7f29c | ||
|
|
74596fd81f | ||
|
|
055ff1f1e9 | ||
|
|
2b7ea0754d | ||
|
|
33929c0f39 | ||
|
|
129a83510f | ||
|
|
832eb3916b | ||
|
|
eec90d963d | ||
|
|
1ca0e3c452 | ||
|
|
b273c44104 | ||
|
|
7497986573 | ||
|
|
451004d84e | ||
|
|
8bc778345b | ||
|
|
90ae916b93 | ||
|
|
2114f79fb1 | ||
|
|
53c46d0fc7 | ||
|
|
697c48e5a8 | ||
|
|
d1170b73b2 | ||
|
|
0b609732d4 | ||
|
|
2d6b2c56a4 | ||
|
|
1c49821117 | ||
|
|
65f99ff477 | ||
|
|
ff1d38752d | ||
|
|
c611c3e720 | ||
|
|
d8a3302786 | ||
|
|
ae72e88d78 | ||
|
|
ad808230ce | ||
|
|
817a73d079 | ||
|
|
9ccbe8b524 | ||
|
|
d9f7f85422 | ||
|
|
ff2023709b | ||
|
|
065ceff8de | ||
|
|
bf1c61dae1 | ||
|
|
533fd7c952 | ||
|
|
c54a8d05bb | ||
|
|
e633a25b0a | ||
|
|
6dc986144c | ||
|
|
ad78c6c70d | ||
|
|
d4f140e488 | ||
|
|
cb2280406e | ||
|
|
4fe8453fdf | ||
|
|
594a58cae4 | ||
|
|
4af5660df2 | ||
|
|
e33ac977d4 | ||
|
|
9003ef9c1c | ||
|
|
9acb919fdc | ||
|
|
553dbe5137 | ||
|
|
4910a9a50e | ||
|
|
30edd38fee | ||
|
|
b35de9dce8 | ||
|
|
a7da30f6c4 | ||
|
|
3710ca2fd5 | ||
|
|
ddbdbecba6 | ||
|
|
f3c2c0f4ea | ||
|
|
7f45ca074f | ||
|
|
63034bd182 | ||
|
|
15d9ca27eb | ||
|
|
33b228da9a | ||
|
|
7e4f5e1e9b | ||
|
|
d92cb8634b | ||
|
|
26eef99007 | ||
|
|
f53c65224b | ||
|
|
4a76ec3e26 | ||
|
|
b527ddc277 | ||
|
|
99baffe114 | ||
|
|
346bd73202 | ||
|
|
8c149c86dd | ||
|
|
482f513cdb | ||
|
|
4eaf05e3a0 | ||
|
|
3ee82accbd | ||
|
|
0a32e457a5 | ||
|
|
3fa24f558a | ||
|
|
19c3ac20fa | ||
|
|
3ce63a6c5a | ||
|
|
67891627f8 | ||
|
|
77a0c38a7a | ||
|
|
10227b512d | ||
|
|
cbc23f6b5a | ||
|
|
03f10180dc | ||
|
|
5963bbafd6 | ||
|
|
92aa64f1dd | ||
|
|
338ed20da2 | ||
|
|
328bc38e9d | ||
|
|
f7dee0da5e | ||
|
|
bd856df1c2 | ||
|
|
af08f469fb | ||
|
|
0425faf220 | ||
|
|
bfd864bb2c | ||
|
|
e70362c905 | ||
|
|
8e859ecc8a | ||
|
|
35b5a2f84e | ||
|
|
91bf640eff | ||
|
|
8e62636281 | ||
|
|
8575b5e0b1 | ||
|
|
afb93bf333 | ||
|
|
236e5f5594 | ||
|
|
4b33dc9aab | ||
|
|
42ab802371 | ||
|
|
7200f8fe5f | ||
|
|
a8b3b9fb20 | ||
|
|
0ef35bf5fd | ||
|
|
d0b7d6875c | ||
|
|
bff955c49a | ||
|
|
35d179b1b9 | ||
|
|
877d9f0848 | ||
|
|
ec690ecab5 | ||
|
|
5a53648ee7 | ||
|
|
a0218f1c8f | ||
|
|
57dd7026e6 | ||
|
|
0e54f887cb | ||
|
|
15b3efe51e | ||
|
|
1cf529cead | ||
|
|
e87c9ac3f8 | ||
|
|
68a02f2a43 | ||
|
|
c571c78788 | ||
|
|
f92612c394 | ||
|
|
b997b3ba48 | ||
|
|
271710e870 | ||
|
|
94c3473958 | ||
|
|
adc511cfdc | ||
|
|
33bc94fce5 | ||
|
|
81c5665094 | ||
|
|
fde9d3555e | ||
|
|
b352145e4f | ||
|
|
9fe1acb177 | ||
|
|
40024afcc4 | ||
|
|
c70f302247 | ||
|
|
99282b3c1b | ||
|
|
dad11c8131 | ||
|
|
9da3a92b69 | ||
|
|
ac4df43795 | ||
|
|
a5a77b509b | ||
|
|
9a4490b2c6 | ||
|
|
3a86e24722 | ||
|
|
e637d19037 | ||
|
|
83ed9dad05 | ||
|
|
b088900886 | ||
|
|
fdabc8efcc | ||
|
|
57085824b6 | ||
|
|
8767ec8593 | ||
|
|
ca3092c685 | ||
|
|
618fee859a | ||
|
|
25f31978e5 | ||
|
|
450e1be7bd | ||
|
|
9bbfc6e736 | ||
|
|
44256b55cc | ||
|
|
ea7e48fc49 | ||
|
|
f63ce726c1 | ||
|
|
700c2e6a83 | ||
|
|
2317909261 | ||
|
|
5125ea04c9 | ||
|
|
f047d9a461 | ||
|
|
bff8907f88 | ||
|
|
cc9e0a1022 | ||
|
|
1e6d6ae981 | ||
|
|
c3daa41f10 | ||
|
|
48b31285c8 | ||
|
|
7f61c9bdce | ||
|
|
69439fdfab | ||
|
|
e3437921e5 | ||
|
|
9ecb26732f | ||
|
|
4a1e096925 | ||
|
|
39bab0f1c2 |
14594
docs/默认模块.openapi.json
14594
docs/默认模块.openapi.json
File diff suppressed because it is too large
Load Diff
45
src/App.vue
45
src/App.vue
@@ -17,6 +17,7 @@ import { Local, Session } from '/@/utils/storage';
|
||||
import mittBus from '/@/utils/mitt';
|
||||
import { needRoleSelection, isRoleDialogTriggered, setRoleDialogTriggered } from '/@/utils/roleSelect';
|
||||
import setIntroduction from '/@/utils/setIconfont';
|
||||
import { listAllRole } from '/@/api/admin/role';
|
||||
|
||||
// 引入组件
|
||||
const LockScreen = defineAsyncComponent(() => import('/@/layout/lockScreen/index.vue'));
|
||||
@@ -58,6 +59,34 @@ onBeforeMount(() => {
|
||||
});
|
||||
// 角色选择弹框是否已在本轮打开过(防止事件被触发两次)
|
||||
let roleDialogOpenedThisSession = false
|
||||
|
||||
/** 校验缓存中的 roleId 是否仍在 listAllRole 结果中;若不存在则清除 roleId/roleCode/roleName 并返回 true(需要弹框) */
|
||||
async function validateCachedRoleId(): Promise<boolean> {
|
||||
const cachedRoleId = Local.get('roleId');
|
||||
if (cachedRoleId == null || cachedRoleId === '') return false;
|
||||
try {
|
||||
const res = await listAllRole();
|
||||
const data = res?.data;
|
||||
const allRoles: any[] = Array.isArray(data)
|
||||
? data
|
||||
: data && typeof data === 'object'
|
||||
? (Object.values(data) as any[]).flat()
|
||||
: [];
|
||||
const exists = allRoles.some(
|
||||
(r: any) => r && String(r.roleId) === String(cachedRoleId)
|
||||
);
|
||||
if (!exists) {
|
||||
Local.remove('roleId');
|
||||
Local.remove('roleCode');
|
||||
Local.remove('roleName');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 唯一入口:只通过事件打开,且只打开一次;延迟打开以等待异步组件挂载
|
||||
mittBus.on('openRoleSelectDialog', () => {
|
||||
@@ -67,7 +96,7 @@ onMounted(() => {
|
||||
changeRoleFirRef.value?.open()
|
||||
}, 300)
|
||||
})
|
||||
nextTick(() => {
|
||||
nextTick(async () => {
|
||||
// 监听布局配置弹窗点击打开
|
||||
mittBus.on('openSettingsDrawer', () => {
|
||||
settingsRef.value.openDrawer();
|
||||
@@ -81,10 +110,16 @@ onMounted(() => {
|
||||
if (Session.get('isTagsViewCurrenFull')) {
|
||||
stores.setCurrenFullscreen(Session.get('isTagsViewCurrenFull'));
|
||||
}
|
||||
// 与请求拦截器共用同一逻辑:先设标志再 emit,由监听器统一打开(监听器内会延迟 300ms 以等待异步组件挂载)
|
||||
if (Session.getToken() && needRoleSelection() && !isRoleDialogTriggered()) {
|
||||
setRoleDialogTriggered(true)
|
||||
mittBus.emit('openRoleSelectDialog')
|
||||
// 有 token 时:先校验缓存 roleId 是否仍有效,无效则清缓存并弹框选角色
|
||||
if (Session.getToken()) {
|
||||
const needOpenByInvalidRole = await validateCachedRoleId();
|
||||
if (needOpenByInvalidRole && !isRoleDialogTriggered()) {
|
||||
setRoleDialogTriggered(true);
|
||||
mittBus.emit('openRoleSelectDialog');
|
||||
} else if (!needOpenByInvalidRole && needRoleSelection() && !isRoleDialogTriggered()) {
|
||||
setRoleDialogTriggered(true);
|
||||
mittBus.emit('openRoleSelectDialog');
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -146,6 +146,32 @@ export const putObj = (obj: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 按文档接口修改部门
|
||||
* POST /basic/basicdept/edit
|
||||
* @param obj
|
||||
*/
|
||||
export const editObj = (obj: any) => {
|
||||
return request({
|
||||
url: '/basic/basicdept/edit',
|
||||
method: 'post',
|
||||
data: obj,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 按文档接口批量删除部门
|
||||
* POST /basic/basicdept/delete
|
||||
* @param ids
|
||||
*/
|
||||
export const delObjs = (ids: string[]) => {
|
||||
return request({
|
||||
url: '/basic/basicdept/delete',
|
||||
method: 'post',
|
||||
data: ids,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据部门代码获取培训部门
|
||||
* @param obj
|
||||
|
||||
@@ -59,8 +59,9 @@ export const makeHoliday = (obj: any) => {
|
||||
*/
|
||||
export const getObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/basicholiday/${id}`,
|
||||
url: '/basic/basicholiday/detail',
|
||||
method: 'get',
|
||||
params: { id },
|
||||
});
|
||||
};
|
||||
|
||||
@@ -70,8 +71,9 @@ export const getObj = (id: string | number) => {
|
||||
*/
|
||||
export const delObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/basicholiday/${id}`,
|
||||
method: 'delete',
|
||||
url: '/basic/basicholiday/delete',
|
||||
method: 'post',
|
||||
data: [id],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -81,8 +83,8 @@ export const delObj = (id: string | number) => {
|
||||
*/
|
||||
export const putObj = (obj: any) => {
|
||||
return request({
|
||||
url: '/basic/basicholiday',
|
||||
method: 'put',
|
||||
url: '/basic/basicholiday/edit',
|
||||
method: 'post',
|
||||
data: obj,
|
||||
});
|
||||
};
|
||||
@@ -110,3 +112,20 @@ export const getHolidayDayList = (query?: any) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 学年学期列表
|
||||
*/
|
||||
export const getAllYearAndTerm = () => {
|
||||
return request({
|
||||
url: '/basic/basicholiday/getAllYearAndTerm',
|
||||
method: 'get',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 学年列表(兼容页面调用)
|
||||
*/
|
||||
export const queryAllSchoolYear = () => {
|
||||
return getAllYearAndTerm();
|
||||
};
|
||||
|
||||
|
||||
@@ -47,8 +47,9 @@ export const addObj = (obj: any) => {
|
||||
*/
|
||||
export const getObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/basicnation/${id}`,
|
||||
url: '/basic/basicnation/detail',
|
||||
method: 'get',
|
||||
params: { id },
|
||||
});
|
||||
};
|
||||
|
||||
@@ -58,8 +59,9 @@ export const getObj = (id: string | number) => {
|
||||
*/
|
||||
export const delObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/basicnation/${id}`,
|
||||
method: 'delete',
|
||||
url: '/basic/basicnation/delete',
|
||||
method: 'post',
|
||||
data: [id],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -69,8 +71,8 @@ export const delObj = (id: string | number) => {
|
||||
*/
|
||||
export const putObj = (obj: any) => {
|
||||
return request({
|
||||
url: '/basic/basicnation',
|
||||
method: 'put',
|
||||
url: '/basic/basicnation/edit',
|
||||
method: 'post',
|
||||
data: obj,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,8 +47,9 @@ export const addObj = (obj: any) => {
|
||||
*/
|
||||
export const getObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/basicyear/${id}`,
|
||||
url: '/basic/basicyear/detail',
|
||||
method: 'get',
|
||||
params: { id },
|
||||
});
|
||||
};
|
||||
|
||||
@@ -58,8 +59,9 @@ export const getObj = (id: string | number) => {
|
||||
*/
|
||||
export const delObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/basicyear/${id}`,
|
||||
method: 'delete',
|
||||
url: '/basic/basicyear/delete',
|
||||
method: 'post',
|
||||
data: [id],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -69,8 +71,8 @@ export const delObj = (id: string | number) => {
|
||||
*/
|
||||
export const putObj = (obj: any) => {
|
||||
return request({
|
||||
url: '/basic/basicyear',
|
||||
method: 'put',
|
||||
url: '/basic/basicyear/edit',
|
||||
method: 'post',
|
||||
data: obj,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,8 +47,9 @@ export const addObj = (obj: any) => {
|
||||
*/
|
||||
export const getObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/major/${id}`,
|
||||
url: '/basic/major/detail',
|
||||
method: 'get',
|
||||
params: { id },
|
||||
});
|
||||
};
|
||||
|
||||
@@ -58,8 +59,9 @@ export const getObj = (id: string | number) => {
|
||||
*/
|
||||
export const delObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/major/${id}`,
|
||||
method: 'delete',
|
||||
url: '/basic/major/delete',
|
||||
method: 'post',
|
||||
data: [id],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -69,8 +71,8 @@ export const delObj = (id: string | number) => {
|
||||
*/
|
||||
export const putObj = (obj: any) => {
|
||||
return request({
|
||||
url: '/basic/major',
|
||||
method: 'put',
|
||||
url: '/basic/major/edit',
|
||||
method: 'post',
|
||||
data: obj,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,8 +47,9 @@ export const addObj = (obj: any) => {
|
||||
*/
|
||||
export const getObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/schoolnews/${id}`,
|
||||
url: '/basic/schoolnews/detail',
|
||||
method: 'get',
|
||||
params: { id },
|
||||
});
|
||||
};
|
||||
|
||||
@@ -58,8 +59,9 @@ export const getObj = (id: string | number) => {
|
||||
*/
|
||||
export const delObj = (id: string | number) => {
|
||||
return request({
|
||||
url: `/basic/schoolnews/${id}`,
|
||||
method: 'delete',
|
||||
url: '/basic/schoolnews/delete',
|
||||
method: 'post',
|
||||
data: [id],
|
||||
});
|
||||
};
|
||||
|
||||
@@ -69,8 +71,8 @@ export const delObj = (id: string | number) => {
|
||||
*/
|
||||
export const putObj = (obj: any) => {
|
||||
return request({
|
||||
url: '/basic/schoolnews',
|
||||
method: 'put',
|
||||
url: '/basic/schoolnews/edit',
|
||||
method: 'post',
|
||||
data: obj,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -124,6 +124,20 @@ export function canFillForm(purchaseId: string) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载履约验收模板(根据金额判断使用down/up目录)
|
||||
* @param purchaseId 采购申请ID
|
||||
* @returns Promise<Blob> - 模板文件 blob
|
||||
*/
|
||||
export function downloadTemplate(purchaseId: string) {
|
||||
return request({
|
||||
url: '/purchase/purchasingAccept/download-template',
|
||||
method: 'get',
|
||||
params: { purchaseId },
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据品目类型获取验收项配置
|
||||
*/
|
||||
|
||||
@@ -252,12 +252,13 @@ export function searchTeachers(keyword: string) {
|
||||
* @param id 采购申请ID
|
||||
* @param representorTeacherNo 指定采购代表人(单人,用户ID或工号)
|
||||
* @param representors 部门多人由系统抽取(多人,用户ID或工号逗号分隔)
|
||||
* @param identity 身份:purchase_rep-采购代表,judge-评委
|
||||
*/
|
||||
export function saveRepresentor(id: number, representorTeacherNo?: string, representors?: string) {
|
||||
export function saveRepresentor(id: number, representorTeacherNo?: string, representors?: string, identity?: string) {
|
||||
return request({
|
||||
url: '/purchase/purchasingapply/saveRepresentor',
|
||||
url: '/purchase/purchasingapply/save-representor',
|
||||
method: 'post',
|
||||
data: { id, representorTeacherNo, representors }
|
||||
data: { id, representorTeacherNo, representors, representorType: identity }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -369,6 +370,15 @@ export function downloadFileById(fileId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function previewFileById(fileId: string) {
|
||||
return request({
|
||||
url: '/purchase/purchasingfiles/previewById',
|
||||
method: 'get',
|
||||
params: { fileId },
|
||||
responseType: 'blob'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取文件下载地址列表
|
||||
* @param purchaseId 采购申请ID
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import request from "/@/utils/request"
|
||||
import request from '/@/utils/request'
|
||||
|
||||
/**
|
||||
* 根据分页查询参数获取列表数据。
|
||||
@@ -9,7 +9,7 @@ export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan',
|
||||
method: 'post',
|
||||
data: obj
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function getObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan/detail',
|
||||
method: 'get',
|
||||
params: obj
|
||||
params: obj,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
data: ids,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -61,7 +61,20 @@ export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan/edit',
|
||||
method: 'post',
|
||||
data: obj
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计班主任查看情况
|
||||
* GET /api/stuwork/weekPlan/readStatistics
|
||||
* @param params 包含 deptCode, weekPlanId(可选)
|
||||
*/
|
||||
export function readStatistics(params: { deptCode: string; weekPlanId?: string }) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan/readStatistics',
|
||||
method: 'get',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,17 +97,16 @@ export function putObj(obj?: Object) {
|
||||
*/
|
||||
export function validateExist(rule: any, value: any, callback: any, isEdit: boolean) {
|
||||
if (isEdit) {
|
||||
return callback();
|
||||
return callback()
|
||||
}
|
||||
|
||||
getObj({ [rule.field]: value }).then((response) => {
|
||||
const result = response.data;
|
||||
getObj({ [rule.field]: value }).then(response => {
|
||||
const result = response.data
|
||||
if (result !== null && result.length > 0) {
|
||||
callback(new Error('数据已经存在'));
|
||||
callback(new Error('数据已经存在'))
|
||||
} else {
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -441,6 +441,7 @@
|
||||
else {
|
||||
setPropsDataValue(row, $route.query, 'id', 'flowInstId', 'isHiJob', 'isView', 'isRead', 'isApp', 'isForm')
|
||||
}
|
||||
|
||||
if (row.isHiJob !== '0') {
|
||||
await handleToDoneDetail(row, data, row.isApp, row.isForm);
|
||||
} else {
|
||||
|
||||
@@ -114,6 +114,34 @@ const isActive = (v: RouteItem) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
/** 标题为「轮播图」的 tag 不展示(切换角色后常误出现,直接过滤) */
|
||||
const isCarouselTag = (v: RouteItem) => other.setTagsViewNameI18n(v) === '轮播图';
|
||||
/** 仅首页作为固定 tag,其它 isAffix(如后端菜单的轮播图)不再默认占一条 tag */
|
||||
const isAffixTagAllowed = (v: RouteItem) => v.path === '/home' || v.path === '/home/index';
|
||||
/** 后端菜单 sortOrder/sort_order/weight 为 1 的项常被误当“默认”加载为 tag,排除(首页除外) */
|
||||
const isSortOrderOneExcluded = (v: RouteItem) => {
|
||||
const meta = v.meta as any;
|
||||
const order =
|
||||
meta?.sortOrder ?? meta?.sort_order ?? meta?.weight ?? (v as any).sort_order ?? (v as any).weight;
|
||||
return Number(order) === 1 && !isAffixTagAllowed(v);
|
||||
};
|
||||
/** 递归扁平化路由(含 children),用于校验 path 是否在当前角色菜单中 */
|
||||
const flattenRoutes = (routes: RouteItem[]): RouteItem[] => {
|
||||
let list: RouteItem[] = [];
|
||||
(routes || []).forEach((r: RouteItem) => {
|
||||
list.push(r);
|
||||
if ((r as any).children?.length) list.push(...flattenRoutes((r as any).children));
|
||||
});
|
||||
return list;
|
||||
};
|
||||
/** 当前 tag 的 path 是否存在于当前角色路由列表中(避免恢复出“不存在的 tag”) */
|
||||
const pathInCurrentRoutes = (tag: RouteItem): boolean => {
|
||||
const flat = flattenRoutes(state.tagsViewRoutesList);
|
||||
return flat.some(
|
||||
(r: RouteItem) =>
|
||||
r.path === tag.path || (r.meta?.isDynamic && (r.meta as any).isDynamicPath === tag.path)
|
||||
);
|
||||
};
|
||||
// 存储 tagsViewList 到浏览器临时缓存中,页面刷新时,保留记录
|
||||
const addBrowserSetSession = (tagsViewList: Array<object>) => {
|
||||
Session.set('tagsViewList', tagsViewList);
|
||||
@@ -128,11 +156,20 @@ const getTagsViewRoutes = async () => {
|
||||
};
|
||||
// pinia 中获取路由信息:如果是设置了固定的(isAffix),进行初始化显示
|
||||
const initTagsView = async () => {
|
||||
if (Session.get('tagsViewList') && getThemeConfig.value.isCacheTagsView) {
|
||||
state.tagsViewList = await Session.get('tagsViewList');
|
||||
const cached = Session.get('tagsViewList');
|
||||
const hasValidCache = cached && getThemeConfig.value.isCacheTagsView && Array.isArray(cached);
|
||||
// 仅当当前角色已有路由列表时,才从缓存恢复;恢复时只保留当前路由中存在的 path,避免切换角色后出现“不存在的 tag”
|
||||
if (hasValidCache && state.tagsViewRoutesList.length > 0) {
|
||||
state.tagsViewList = cached.filter(
|
||||
(v: RouteItem) =>
|
||||
!isCarouselTag(v) &&
|
||||
!isSortOrderOneExcluded(v) &&
|
||||
pathInCurrentRoutes(v) &&
|
||||
(v.meta?.isAffix ? isAffixTagAllowed(v) : true)
|
||||
);
|
||||
} else {
|
||||
await state.tagsViewRoutesList.map((v: RouteItem) => {
|
||||
if (v.meta?.isAffix && !v.meta.isHide) {
|
||||
if (v.meta?.isAffix && !v.meta.isHide && !isCarouselTag(v) && isAffixTagAllowed(v) && !isSortOrderOneExcluded(v)) {
|
||||
v.url = setTagsViewHighlight(v);
|
||||
state.tagsViewList.push({ ...v });
|
||||
storesKeepALiveNames.addCachedView(v);
|
||||
@@ -158,6 +195,8 @@ const solveAddTagsView = async (path: string, to?: RouteToFrom) => {
|
||||
// 防止:Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.
|
||||
let findItem = state.tagsViewRoutesList.find((v: RouteItem) => v.path === isDynamicPath);
|
||||
if (!findItem) return false;
|
||||
if (isCarouselTag(findItem)) return false;
|
||||
if (isSortOrderOneExcluded(findItem)) return false;
|
||||
if (findItem.meta.isAffix) return false;
|
||||
if (findItem.meta.isLink && !findItem.meta.isIframe) return false;
|
||||
to?.meta?.isDynamic ? (findItem.params = to.params) : (findItem.query = to?.query);
|
||||
@@ -211,6 +250,8 @@ const addTagsView = (path: string, to?: RouteToFrom) => {
|
||||
item = state.tagsViewRoutesList.find((v: RouteItem) => v.path === path);
|
||||
}
|
||||
if (!item) return false;
|
||||
if (isCarouselTag(item)) return false;
|
||||
if (isSortOrderOneExcluded(item)) return false;
|
||||
if (item?.meta?.isLink && !item.meta.isIframe) return false;
|
||||
if (to?.meta?.isDynamic) item.params = to?.params ? to?.params : route.params;
|
||||
else item.query = to?.query ? to?.query : route.query;
|
||||
@@ -279,7 +320,7 @@ const closeOtherTagsView = (path: string) => {
|
||||
if (Session.get('tagsViewList')) {
|
||||
state.tagsViewList = [];
|
||||
Session.get('tagsViewList').map((v: RouteItem) => {
|
||||
if (v.meta?.isAffix && !v.meta.isHide) {
|
||||
if (v.meta?.isAffix && !v.meta?.isHide && !isCarouselTag(v) && pathInCurrentRoutes(v) && isAffixTagAllowed(v) && !isSortOrderOneExcluded(v)) {
|
||||
v.url = setTagsViewHighlight(v);
|
||||
storesKeepALiveNames.delOthersCachedViews(v);
|
||||
state.tagsViewList.push({ ...v });
|
||||
@@ -295,7 +336,7 @@ const closeAllTagsView = () => {
|
||||
storesKeepALiveNames.delAllCachedViews();
|
||||
state.tagsViewList = [];
|
||||
Session.get('tagsViewList').map((v: RouteItem) => {
|
||||
if (v.meta?.isAffix && !v.meta.isHide) {
|
||||
if (v.meta?.isAffix && !v.meta?.isHide && !isCarouselTag(v) && pathInCurrentRoutes(v) && isAffixTagAllowed(v) && !isSortOrderOneExcluded(v)) {
|
||||
v.url = setTagsViewHighlight(v);
|
||||
state.tagsViewList.push({ ...v });
|
||||
router.push({ path: state.tagsViewList[state.tagsViewList.length - 1].path });
|
||||
@@ -547,7 +588,7 @@ onBeforeMount(() => {
|
||||
router.push('/home/index');
|
||||
state.tagsViewList = [];
|
||||
state.tagsViewRoutesList.map((v: RouteItem) => {
|
||||
if (v.meta?.isAffix && !v.meta.isHide) {
|
||||
if (v.meta?.isAffix && !v.meta?.isHide && !isCarouselTag(v) && isAffixTagAllowed(v) && !isSortOrderOneExcluded(v)) {
|
||||
v.url = setTagsViewHighlight(v);
|
||||
state.tagsViewList.push({ ...v });
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ export const useUserInfo = defineStore('userInfo', {
|
||||
return new Promise((resolve, reject) => {
|
||||
login(data)
|
||||
.then((res) => {
|
||||
debugger
|
||||
this.setTokenCache(res.access_token, res.refresh_token);
|
||||
Local.remove('roleCode');
|
||||
Local.remove('roleName');
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, toRef } from 'vue'
|
||||
import { listAllRole } from '/@/api/admin/role'
|
||||
import { Local } from '/@/utils/storage'
|
||||
import { Local, Session } from '/@/utils/storage'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
|
||||
/** 弹框标题,如「角色切换」「登录角色选择」 */
|
||||
@@ -108,9 +108,14 @@ const handleChangeRole = (label: string) => {
|
||||
Local.set('roleName', obj.roleName)
|
||||
Local.set('roleId', obj.roleId)
|
||||
useMessage().success('操作成功')
|
||||
// 清掉 tags 缓存,重载后只保留首页 tag
|
||||
Session.remove('tagsViewList')
|
||||
// 清除 pinia 持久化的 tagsView 路由,避免重载后先恢复旧角色菜单再被新路由覆盖前就初始化出“不存在的 tag”
|
||||
try {
|
||||
window.localStorage.removeItem('tagsViewRoutes')
|
||||
} catch (_) {}
|
||||
setTimeout(() => {
|
||||
// 切换角色后统一回到首页,避免停留在诸如 jsonflow/run-job/do-job 等内部路由
|
||||
window.location.hash = '#/'
|
||||
window.location.hash = '#/home'
|
||||
window.location.reload()
|
||||
}, 500)
|
||||
}
|
||||
|
||||
204
src/views/basic/basicdept/form.vue
Normal file
204
src/views/basic/basicdept/form.vue
Normal file
@@ -0,0 +1,204 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑部门' : '新增部门'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="760px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="部门编码" prop="deptCode">
|
||||
<el-input v-model="form.deptCode" placeholder="请输入部门编码" clearable :disabled="!!form.id" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="form.deptName" placeholder="请输入部门名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="父级部门" prop="parentCode">
|
||||
<el-tree-select
|
||||
v-model="form.parentCode"
|
||||
:data="treeData"
|
||||
:props="{ value: 'deptCode', label: 'deptName', children: 'children' }"
|
||||
node-key="deptCode"
|
||||
check-strictly
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
placeholder="请选择父级部门" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="部门层级" prop="deptLevel">
|
||||
<el-select v-model="form.deptLevel" placeholder="请选择层级" clearable style="width: 100%">
|
||||
<el-option label="一级" value="1" />
|
||||
<el-option label="二级" value="2" />
|
||||
<el-option label="三级" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="form.sort" :min="0" :step="1" :precision="0" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="二级学院" prop="secondFlag">
|
||||
<el-radio-group v-model="form.secondFlag">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="教学部门" prop="teachFlag">
|
||||
<el-radio-group v-model="form.teachFlag">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="培训部门" prop="trainFlag">
|
||||
<el-radio-group v-model="form.trainFlag">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" type="textarea" :rows="3" maxlength="200" show-word-limit placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicDeptDialog">
|
||||
import { nextTick, reactive, ref } from 'vue'
|
||||
import { addObj, editObj, fetchTree } from '/@/api/basic/basicdept'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const formRef = ref()
|
||||
const treeData = ref<any[]>([])
|
||||
|
||||
const form = reactive({
|
||||
id: '',
|
||||
deptCode: '',
|
||||
deptName: '',
|
||||
parentCode: '',
|
||||
deptLevel: '1',
|
||||
sort: 0,
|
||||
secondFlag: '0',
|
||||
teachFlag: '0',
|
||||
trainFlag: '0',
|
||||
remarks: ''
|
||||
})
|
||||
|
||||
const rules = ref({
|
||||
deptCode: [{ required: true, message: '部门编码不能为空', trigger: 'blur' }],
|
||||
deptName: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
|
||||
parentCode: [{ required: true, message: '父级部门不能为空', trigger: 'change' }],
|
||||
deptLevel: [{ required: true, message: '部门层级不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
deptCode: '',
|
||||
deptName: '',
|
||||
parentCode: '',
|
||||
deptLevel: '1',
|
||||
sort: 0,
|
||||
secondFlag: '0',
|
||||
teachFlag: '0',
|
||||
trainFlag: '0',
|
||||
remarks: ''
|
||||
})
|
||||
}
|
||||
|
||||
const loadTreeData = async () => {
|
||||
try {
|
||||
const res = await fetchTree()
|
||||
treeData.value = Array.isArray(res.data) ? res.data : []
|
||||
} catch {
|
||||
treeData.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const openDialog = async (row?: any) => {
|
||||
visible.value = true
|
||||
resetForm()
|
||||
await loadTreeData()
|
||||
|
||||
if (row) {
|
||||
Object.assign(form, {
|
||||
id: row.id || '',
|
||||
deptCode: row.deptCode || '',
|
||||
deptName: row.deptName || '',
|
||||
parentCode: row.parentCode || '',
|
||||
deptLevel: row.deptLevel || '1',
|
||||
sort: typeof row.sort === 'number' ? row.sort : Number(row.sort || 0),
|
||||
secondFlag: row.secondFlag ?? '0',
|
||||
teachFlag: row.teachFlag ?? '0',
|
||||
trainFlag: row.trainFlag ?? '0',
|
||||
remarks: row.remarks || ''
|
||||
})
|
||||
}
|
||||
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate()
|
||||
})
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const payload = {
|
||||
...form,
|
||||
sort: Number(form.sort || 0)
|
||||
}
|
||||
if (form.id) {
|
||||
await editObj(payload)
|
||||
useMessage().success('编辑成功')
|
||||
} else {
|
||||
await addObj(payload)
|
||||
useMessage().success('新增成功')
|
||||
}
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || (form.id ? '编辑失败' : '新增失败'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
185
src/views/basic/basicdept/index.vue
Normal file
185
src/views/basic/basicdept/index.vue
Normal file
@@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<div class="modern-page-container">
|
||||
<div class="page-wrapper">
|
||||
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Search /></el-icon>
|
||||
筛选条件
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
|
||||
<el-form-item label="部门编码" prop="deptCode">
|
||||
<el-input v-model="searchForm.deptCode" placeholder="请输入部门编码" clearable style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="searchForm.deptName" placeholder="请输入部门名称" clearable style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门层级" prop="deptLevel">
|
||||
<el-select v-model="searchForm.deptLevel" placeholder="请选择层级" clearable style="width: 160px">
|
||||
<el-option label="一级" value="1" />
|
||||
<el-option label="二级" value="2" />
|
||||
<el-option label="三级" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="content-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Document /></el-icon>
|
||||
部门管理
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptCode" label="部门编码" min-width="130" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="deptName" label="部门名称" min-width="180" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="parentCode" label="父级编码" min-width="130" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="deptLevel" label="层级" width="90" align="center" />
|
||||
<el-table-column prop="sort" label="排序" width="90" align="center" />
|
||||
<el-table-column label="二级学院" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" :type="scope.row.secondFlag === '1' ? 'success' : 'info'" effect="plain">
|
||||
{{ scope.row.secondFlag === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="教学部门" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" :type="scope.row.teachFlag === '1' ? 'success' : 'info'" effect="plain">
|
||||
{{ scope.row.teachFlag === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="培训部门" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" :type="scope.row.trainFlag === '1' ? 'success' : 'info'" effect="plain">
|
||||
{{ scope.row.trainFlag === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="EditPen" link type="primary" @click="formDialogRef.openDialog(scope.row)">编辑</el-button>
|
||||
<el-button icon="Delete" link type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120" />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicDept">
|
||||
import { defineAsyncComponent, reactive, ref } from 'vue'
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { delObjs, fetchList } from '/@/api/basic/basicdept'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { List, Search } from '@element-plus/icons-vue'
|
||||
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
|
||||
const searchForm = reactive({
|
||||
deptCode: '',
|
||||
deptName: '',
|
||||
deptLevel: ''
|
||||
})
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.deptCode = ''
|
||||
searchForm.deptName = ''
|
||||
searchForm.deptLevel = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
if (!id) {
|
||||
useMessage().warning('未获取到部门ID')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除该部门吗?')
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs([id])
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
</style>
|
||||
169
src/views/basic/basicholiday/form.vue
Normal file
169
src/views/basic/basicholiday/form.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="form.id ? '编辑节假日' : '新增节假日'"
|
||||
width="640px"
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="105px">
|
||||
<el-form-item label="日期范围" prop="dateRange">
|
||||
<el-date-picker
|
||||
v-model="form.dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="节假日类型" prop="holidayType">
|
||||
<el-radio-group v-model="form.holidayType">
|
||||
<el-radio label="0">周六周日</el-radio>
|
||||
<el-radio label="1">节假日</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="学年学期" prop="year">
|
||||
<el-select v-model="form.year" placeholder="请选择学年学期" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in schoolYearTermList"
|
||||
:key="item.id || item.year"
|
||||
:label="buildYearTermLabel(item)"
|
||||
:value="item.id || item.year" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" type="textarea" :rows="3" maxlength="255" show-word-limit placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleSubmit">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicHolidayForm">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { addObj, getAllYearAndTerm, getObj, putObj } from '/@/api/basic/basicholiday'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const formRef = ref()
|
||||
const schoolYearTermList = ref<any[]>([])
|
||||
|
||||
const createForm = () => ({
|
||||
id: '',
|
||||
dateRange: [] as string[],
|
||||
holidayType: '1',
|
||||
year: '',
|
||||
remarks: ''
|
||||
})
|
||||
|
||||
const form = reactive(createForm())
|
||||
|
||||
const rules = computed(() => ({
|
||||
dateRange: [{ required: true, message: '请选择日期范围', trigger: 'change' }],
|
||||
holidayType: [{ required: true, message: '请选择节假日类型', trigger: 'change' }],
|
||||
year: [{ required: true, message: '请选择学年学期', trigger: 'change' }]
|
||||
}))
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(form, createForm())
|
||||
formRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
const buildYearTermLabel = (item: any) => {
|
||||
if (item?.year && item?.yearTerm) {
|
||||
return `${item.year} 第${item.yearTerm}学期`
|
||||
}
|
||||
return item?.year || item?.id || '-'
|
||||
}
|
||||
|
||||
const getYearAndTermList = async () => {
|
||||
try {
|
||||
const res = await getAllYearAndTerm()
|
||||
schoolYearTermList.value = Array.isArray(res?.data) ? res.data : []
|
||||
} catch {
|
||||
schoolYearTermList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const parseDateRange = (row: any) => {
|
||||
if (Array.isArray(row?.dateRange) && row.dateRange.length === 2) {
|
||||
return row.dateRange
|
||||
}
|
||||
if (row?.holidayDate) {
|
||||
return [row.holidayDate, row.holidayDate]
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
const openDialog = async (id?: string) => {
|
||||
visible.value = true
|
||||
resetForm()
|
||||
if (!id) return
|
||||
|
||||
try {
|
||||
const res: any = await getObj(id)
|
||||
const row = res?.data || {}
|
||||
form.id = row.id || ''
|
||||
form.dateRange = parseDateRange(row)
|
||||
form.holidayType = row.holidayType?.toString?.() || '1'
|
||||
form.year = row.yearId || row.year || ''
|
||||
form.remarks = row.remarks || ''
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取详情失败')
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value?.validate()
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
const payload: any = {
|
||||
id: form.id || undefined,
|
||||
dateRange: form.dateRange,
|
||||
holidayType: form.holidayType,
|
||||
year: form.year,
|
||||
remarks: form.remarks
|
||||
}
|
||||
|
||||
// 编辑场景补齐单日字段,避免后端仅识别 holidayDate 导致更新失败
|
||||
if (form.id && form.dateRange?.length) {
|
||||
payload.holidayDate = form.dateRange[0]
|
||||
}
|
||||
|
||||
try {
|
||||
if (form.id) {
|
||||
await putObj(payload)
|
||||
useMessage().success('修改成功')
|
||||
} else {
|
||||
await addObj(payload)
|
||||
useMessage().success('新增成功')
|
||||
}
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || (form.id ? '修改失败' : '新增失败'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getYearAndTermList()
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
198
src/views/basic/basicholiday/index.vue
Normal file
198
src/views/basic/basicholiday/index.vue
Normal file
@@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<div class="modern-page-container">
|
||||
<div class="page-wrapper">
|
||||
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Search /></el-icon>
|
||||
筛选条件
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
|
||||
<el-form-item label="节假日类型" prop="holidayType">
|
||||
<el-select v-model="searchForm.holidayType" placeholder="请选择类型" clearable style="width: 180px">
|
||||
<el-option label="周六周日" value="0" />
|
||||
<el-option label="节假日" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学年" prop="year">
|
||||
<el-select v-model="searchForm.year" placeholder="请选择学年" clearable filterable style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in schoolYearList"
|
||||
:key="item.id || item.year"
|
||||
:label="item.year"
|
||||
:value="item.year" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学期" prop="yearTerm">
|
||||
<el-select v-model="searchForm.yearTerm" placeholder="请选择学期" clearable style="width: 160px">
|
||||
<el-option label="第一学期" value="1" />
|
||||
<el-option label="第二学期" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="content-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Document /></el-icon>
|
||||
节假日维护
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="holidayDate" label="日期" width="130" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="holidayType" label="类型" width="110" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.holidayType === '1' ? 'danger' : 'info'" size="small" effect="plain">
|
||||
{{ scope.row.holidayType === '1' ? '节假日' : '周六周日' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="year" label="学年" min-width="130" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="yearTerm" label="学期" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" type="primary" effect="plain">
|
||||
{{ scope.row.yearTerm === '1' ? '第一学期' : scope.row.yearTerm === '2' ? '第二学期' : (scope.row.yearTerm || '-') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remarks" label="备注" min-width="180" show-overflow-tooltip align="center" />
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="EditPen" link type="primary" @click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="Delete" link type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120" />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicHoliday">
|
||||
import { defineAsyncComponent, onMounted, reactive, ref } from 'vue'
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { delObj, fetchList, queryAllSchoolYear } from '/@/api/basic/basicholiday'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { Document, List, Search } from '@element-plus/icons-vue'
|
||||
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const schoolYearList = ref<any[]>([])
|
||||
|
||||
const searchForm = reactive({
|
||||
holidayType: '',
|
||||
year: '',
|
||||
yearTerm: ''
|
||||
})
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.holidayType = ''
|
||||
searchForm.year = ''
|
||||
searchForm.yearTerm = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
if (!id) {
|
||||
useMessage().warning('未获取到节假日ID')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除该节假日记录吗?')
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObj(id)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
const getSchoolYearList = async () => {
|
||||
try {
|
||||
const res = await queryAllSchoolYear()
|
||||
schoolYearList.value = Array.isArray(res?.data) ? res.data : []
|
||||
} catch {
|
||||
schoolYearList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getSchoolYearList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
</style>
|
||||
130
src/views/basic/basicnation/form.vue
Normal file
130
src/views/basic/basicnation/form.vue
Normal file
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑民族' : '新增民族'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="620px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-form-item label="民族编码" prop="nationCode">
|
||||
<el-input v-model="form.nationCode" placeholder="请输入民族编码" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="民族名称" prop="nationName">
|
||||
<el-input v-model="form.nationName" placeholder="请输入民族名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="form.sort" :min="0" :step="1" :precision="0" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="10万以下民族" prop="isLower">
|
||||
<el-radio-group v-model="form.isLower">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicNationDialog">
|
||||
import { nextTick, reactive, ref } from 'vue'
|
||||
import { addObj, getObj, putObj } from '/@/api/basic/basicnation'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const formRef = ref()
|
||||
|
||||
const form = reactive({
|
||||
id: '',
|
||||
nationCode: '',
|
||||
nationName: '',
|
||||
sort: 0,
|
||||
isLower: '0'
|
||||
})
|
||||
|
||||
const rules = ref({
|
||||
nationCode: [{ required: true, message: '民族编码不能为空', trigger: 'blur' }],
|
||||
nationName: [{ required: true, message: '民族名称不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
nationCode: '',
|
||||
nationName: '',
|
||||
sort: 0,
|
||||
isLower: '0'
|
||||
})
|
||||
}
|
||||
|
||||
const openDialog = async (id?: string) => {
|
||||
visible.value = true
|
||||
resetForm()
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate()
|
||||
})
|
||||
if (!id) return
|
||||
|
||||
form.id = id
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getObj(id)
|
||||
const row = res?.data || {}
|
||||
Object.assign(form, {
|
||||
id: row.id || '',
|
||||
nationCode: row.nationCode || '',
|
||||
nationName: row.nationName || '',
|
||||
sort: typeof row.sort === 'number' ? row.sort : Number(row.sort || 0),
|
||||
isLower: row.isLower ?? '0'
|
||||
})
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const payload = {
|
||||
...form,
|
||||
sort: Number(form.sort || 0)
|
||||
}
|
||||
if (form.id) {
|
||||
await putObj(payload)
|
||||
useMessage().success('编辑成功')
|
||||
} else {
|
||||
await addObj(payload)
|
||||
useMessage().success('新增成功')
|
||||
}
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || (form.id ? '编辑失败' : '新增失败'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
164
src/views/basic/basicnation/index.vue
Normal file
164
src/views/basic/basicnation/index.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="modern-page-container">
|
||||
<div class="page-wrapper">
|
||||
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Search /></el-icon>
|
||||
筛选条件
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
|
||||
<el-form-item label="民族编码" prop="nationCode">
|
||||
<el-input v-model="searchForm.nationCode" placeholder="请输入民族编码" clearable style="width: 220px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="民族名称" prop="nationName">
|
||||
<el-input v-model="searchForm.nationName" placeholder="请输入民族名称" clearable style="width: 220px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="content-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Document /></el-icon>
|
||||
民族管理
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="nationCode" label="民族编码" min-width="180" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="nationName" label="民族名称" min-width="180" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="sort" label="排序" width="100" align="center" />
|
||||
<el-table-column label="10万以下民族" width="130" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" :type="scope.row.isLower === '1' ? 'warning' : 'info'" effect="plain">
|
||||
{{ scope.row.isLower === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="EditPen" link type="primary" @click="formDialogRef.openDialog(scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="Delete" link type="danger" @click="handleDelete(scope.row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120" />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicNation">
|
||||
import { defineAsyncComponent, reactive, ref } from 'vue'
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { delObj, fetchList } from '/@/api/basic/basicnation'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { Document, List, Search } from '@element-plus/icons-vue'
|
||||
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
|
||||
const searchForm = reactive({
|
||||
nationCode: '',
|
||||
nationName: ''
|
||||
})
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.nationCode = ''
|
||||
searchForm.nationName = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
if (!id) {
|
||||
useMessage().warning('未获取到民族ID')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除该民族吗?')
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObj(id)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
</style>
|
||||
219
src/views/basic/basicyear/form.vue
Normal file
219
src/views/basic/basicyear/form.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑学期维护' : '新增学期维护'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="780px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="130px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="开始年份" prop="startYear">
|
||||
<el-input v-model="form.startYear" maxlength="4" placeholder="例如:2025" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="结束年份" prop="endYear">
|
||||
<el-input v-model="form.endYear" maxlength="4" placeholder="例如:2026" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="学期" prop="yearTerm">
|
||||
<el-select v-model="form.yearTerm" placeholder="请选择学期" clearable style="width: 100%">
|
||||
<el-option label="第一学期" value="1" />
|
||||
<el-option label="第二学期" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="当前学年" prop="isCurrent">
|
||||
<el-radio-group v-model="form.isCurrent">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="教学学年" prop="isNextTeach">
|
||||
<el-radio-group v-model="form.isNextTeach">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="水电开始时间" prop="waterStartTime">
|
||||
<el-date-picker
|
||||
v-model="form.waterStartTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择时间"
|
||||
clearable
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="水电结束时间" prop="waterEndTime">
|
||||
<el-date-picker
|
||||
v-model="form.waterEndTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择时间"
|
||||
clearable
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="查询开始时间" prop="waterSearchStartTime">
|
||||
<el-date-picker
|
||||
v-model="form.waterSearchStartTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择时间"
|
||||
clearable
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="查询结束时间" prop="waterSearchEndTime">
|
||||
<el-date-picker
|
||||
v-model="form.waterSearchEndTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择时间"
|
||||
clearable
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" type="textarea" :rows="3" maxlength="200" show-word-limit placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicYearDialog">
|
||||
import { nextTick, reactive, ref } from 'vue'
|
||||
import { addObj, getObj, putObj } from '/@/api/basic/basicyear'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const formRef = ref()
|
||||
|
||||
const form = reactive({
|
||||
id: '',
|
||||
startYear: '',
|
||||
endYear: '',
|
||||
yearTerm: '',
|
||||
isCurrent: '0',
|
||||
isNextTeach: '0',
|
||||
remarks: '',
|
||||
waterStartTime: '',
|
||||
waterEndTime: '',
|
||||
waterSearchStartTime: '',
|
||||
waterSearchEndTime: ''
|
||||
})
|
||||
|
||||
const rules = ref({
|
||||
startYear: [{ required: true, message: '开始年份不能为空', trigger: 'blur' }],
|
||||
endYear: [{ required: true, message: '结束年份不能为空', trigger: 'blur' }],
|
||||
yearTerm: [{ required: true, message: '学期不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
startYear: '',
|
||||
endYear: '',
|
||||
yearTerm: '',
|
||||
isCurrent: '0',
|
||||
isNextTeach: '0',
|
||||
remarks: '',
|
||||
waterStartTime: '',
|
||||
waterEndTime: '',
|
||||
waterSearchStartTime: '',
|
||||
waterSearchEndTime: ''
|
||||
})
|
||||
}
|
||||
|
||||
const openDialog = async (id?: string) => {
|
||||
visible.value = true
|
||||
resetForm()
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate()
|
||||
})
|
||||
if (!id) return
|
||||
|
||||
form.id = id
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getObj(id)
|
||||
const row = res?.data || {}
|
||||
Object.assign(form, {
|
||||
id: row.id || '',
|
||||
startYear: row.startYear || '',
|
||||
endYear: row.endYear || '',
|
||||
yearTerm: row.yearTerm || '',
|
||||
isCurrent: row.isCurrent ?? '0',
|
||||
isNextTeach: row.isNextTeach ?? '0',
|
||||
remarks: row.remarks || '',
|
||||
waterStartTime: row.waterStartTime || '',
|
||||
waterEndTime: row.waterEndTime || '',
|
||||
waterSearchStartTime: row.waterSearchStartTime || '',
|
||||
waterSearchEndTime: row.waterSearchEndTime || ''
|
||||
})
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
if (form.id) {
|
||||
await putObj(form)
|
||||
useMessage().success('编辑成功')
|
||||
} else {
|
||||
await addObj(form)
|
||||
useMessage().success('新增成功')
|
||||
}
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || (form.id ? '编辑失败' : '新增失败'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
185
src/views/basic/basicyear/index.vue
Normal file
185
src/views/basic/basicyear/index.vue
Normal file
@@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<div class="modern-page-container">
|
||||
<div class="page-wrapper">
|
||||
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Search /></el-icon>
|
||||
筛选条件
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
|
||||
<el-form-item label="开始年份" prop="startYear">
|
||||
<el-input v-model="searchForm.startYear" placeholder="请输入开始年份" clearable style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束年份" prop="endYear">
|
||||
<el-input v-model="searchForm.endYear" placeholder="请输入结束年份" clearable style="width: 180px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学期" prop="yearTerm">
|
||||
<el-select v-model="searchForm.yearTerm" placeholder="请选择学期" clearable style="width: 160px">
|
||||
<el-option label="第一学期" value="1" />
|
||||
<el-option label="第二学期" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="content-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Document /></el-icon>
|
||||
学期维护
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="year" label="学年" min-width="130" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="yearTerm" label="学期" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" type="primary" effect="plain">
|
||||
{{ scope.row.yearTerm === '1' ? '第一学期' : scope.row.yearTerm === '2' ? '第二学期' : (scope.row.yearTerm || '-') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isCurrent" label="当前学年" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" :type="scope.row.isCurrent === '1' ? 'success' : 'info'" effect="plain">
|
||||
{{ scope.row.isCurrent === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isNextTeach" label="教学学年" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" :type="scope.row.isNextTeach === '1' ? 'success' : 'info'" effect="plain">
|
||||
{{ scope.row.isNextTeach === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="waterStartTime" label="水电开始时间" min-width="170" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="waterEndTime" label="水电结束时间" min-width="170" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="waterSearchStartTime" label="查询开始时间" min-width="170" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="waterSearchEndTime" label="查询结束时间" min-width="170" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="remarks" label="备注" min-width="150" show-overflow-tooltip align="center" />
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="EditPen" link type="primary" @click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="Delete" link type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120" />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicYear">
|
||||
import { defineAsyncComponent, reactive, ref } from 'vue'
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { delObj, fetchList } from '/@/api/basic/basicyear'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { Document, List, Search } from '@element-plus/icons-vue'
|
||||
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
|
||||
const searchForm = reactive({
|
||||
startYear: '',
|
||||
endYear: '',
|
||||
yearTerm: ''
|
||||
})
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.startYear = ''
|
||||
searchForm.endYear = ''
|
||||
searchForm.yearTerm = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
if (!id) {
|
||||
useMessage().warning('未获取到学年学期ID')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除该学期维护记录吗?')
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObj(id)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
</style>
|
||||
233
src/views/basic/major/form.vue
Normal file
233
src/views/basic/major/form.vue
Normal file
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑专业' : '新增专业'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="760px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="专业代码" prop="majorCode">
|
||||
<el-input v-model="form.majorCode" placeholder="请输入专业代码" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="专业名称" prop="majorName">
|
||||
<el-input v-model="form.majorName" placeholder="请输入专业名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="所属学院" prop="deptCode">
|
||||
<el-select v-model="form.deptCode" placeholder="请选择学院" clearable filterable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="学制" prop="majorYears">
|
||||
<el-select v-model="form.majorYears" placeholder="请选择学制" clearable filterable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in majorYearsList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="培养层次" prop="majorLevel">
|
||||
<el-select v-model="form.majorLevel" placeholder="请选择培养层次" clearable filterable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in majorLevelList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="中德班" prop="isGerman">
|
||||
<el-radio-group v-model="form.isGerman">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="专业规范名称" prop="majorProName">
|
||||
<el-input v-model="form.majorProName" placeholder="请输入专业规范名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="国际专业名称" prop="countryMajorName">
|
||||
<el-input v-model="form.countryMajorName" placeholder="请输入国际专业名称" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" type="textarea" :rows="3" maxlength="200" show-word-limit placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicMajorDialog">
|
||||
import { nextTick, onMounted, reactive, ref } from 'vue'
|
||||
import { addObj, getObj, putObj } from '/@/api/basic/major'
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { getDictsByTypes } from '/@/api/admin/dict'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const formRef = ref()
|
||||
const deptList = ref<any[]>([])
|
||||
const majorYearsList = ref<any[]>([])
|
||||
const majorLevelList = ref<any[]>([])
|
||||
|
||||
const form = reactive({
|
||||
id: '',
|
||||
majorCode: '',
|
||||
majorName: '',
|
||||
deptCode: '',
|
||||
majorYears: '',
|
||||
majorProName: '',
|
||||
majorLevel: '',
|
||||
isGerman: '0',
|
||||
countryMajorName: '',
|
||||
remarks: ''
|
||||
})
|
||||
|
||||
const rules = ref({
|
||||
majorCode: [{ required: true, message: '专业代码不能为空', trigger: 'blur' }],
|
||||
majorName: [{ required: true, message: '专业名称不能为空', trigger: 'blur' }],
|
||||
deptCode: [{ required: true, message: '所属学院不能为空', trigger: 'change' }],
|
||||
majorYears: [{ required: true, message: '学制不能为空', trigger: 'change' }],
|
||||
majorLevel: [{ required: true, message: '培养层次不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
majorCode: '',
|
||||
majorName: '',
|
||||
deptCode: '',
|
||||
majorYears: '',
|
||||
majorProName: '',
|
||||
majorLevel: '',
|
||||
isGerman: '0',
|
||||
countryMajorName: '',
|
||||
remarks: ''
|
||||
})
|
||||
}
|
||||
|
||||
const parseDictList = (list: any[]) => {
|
||||
if (!Array.isArray(list)) return []
|
||||
return list.map((item: any) => ({
|
||||
label: item.label || item.dictLabel || item.name || item.value || '',
|
||||
value: item.value || item.dictValue || item.code || item.label || ''
|
||||
}))
|
||||
}
|
||||
|
||||
const loadOptions = async () => {
|
||||
try {
|
||||
const [deptRes, dictRes] = await Promise.all([
|
||||
getDeptList(),
|
||||
getDictsByTypes(['basic_major_years', 'basic_major_level'])
|
||||
])
|
||||
deptList.value = Array.isArray(deptRes?.data) ? deptRes.data : []
|
||||
majorYearsList.value = parseDictList(dictRes?.data?.basic_major_years || [])
|
||||
majorLevelList.value = parseDictList(dictRes?.data?.basic_major_level || [])
|
||||
} catch {
|
||||
deptList.value = []
|
||||
majorYearsList.value = []
|
||||
majorLevelList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const openDialog = async (id?: string) => {
|
||||
visible.value = true
|
||||
resetForm()
|
||||
if (!deptList.value.length) {
|
||||
await loadOptions()
|
||||
}
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate()
|
||||
})
|
||||
if (!id) return
|
||||
|
||||
form.id = id
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getObj(id)
|
||||
const row = res?.data || {}
|
||||
Object.assign(form, {
|
||||
id: row.id || '',
|
||||
majorCode: row.majorCode || '',
|
||||
majorName: row.majorName || '',
|
||||
deptCode: row.deptCode || '',
|
||||
majorYears: row.majorYears || '',
|
||||
majorProName: row.majorProName || '',
|
||||
majorLevel: row.majorLevel || '',
|
||||
isGerman: row.isGerman ?? '0',
|
||||
countryMajorName: row.countryMajorName || '',
|
||||
remarks: row.remarks || ''
|
||||
})
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
if (form.id) {
|
||||
await putObj(form)
|
||||
useMessage().success('编辑成功')
|
||||
} else {
|
||||
await addObj(form)
|
||||
useMessage().success('新增成功')
|
||||
}
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || (form.id ? '编辑失败' : '新增失败'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadOptions()
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
191
src/views/basic/major/index.vue
Normal file
191
src/views/basic/major/index.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<div class="modern-page-container">
|
||||
<div class="page-wrapper">
|
||||
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Search /></el-icon>
|
||||
筛选条件
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
|
||||
<el-form-item label="专业代码" prop="majorCode">
|
||||
<el-input v-model="searchForm.majorCode" placeholder="请输入专业代码" clearable style="width: 220px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="专业名称" prop="majorName">
|
||||
<el-input v-model="searchForm.majorName" placeholder="请输入专业名称" clearable style="width: 220px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属学院" prop="deptCode">
|
||||
<el-select v-model="searchForm.deptCode" placeholder="请选择学院" clearable filterable style="width: 220px">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="content-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Document /></el-icon>
|
||||
专业管理
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="majorCode" label="专业代码" min-width="120" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="majorName" label="专业名称" min-width="160" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="majorProName" label="专业规范名称" min-width="200" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="deptCode" label="所属学院编码" min-width="130" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="majorYears" label="学制" width="90" align="center" />
|
||||
<el-table-column prop="majorLevel" label="培养层次" width="100" align="center" />
|
||||
<el-table-column label="中德班" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag size="small" :type="scope.row.isGerman === '1' ? 'success' : 'info'" effect="plain">
|
||||
{{ scope.row.isGerman === '1' ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="countryMajorName" label="国际专业名称" min-width="160" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="remarks" label="备注" min-width="160" show-overflow-tooltip align="center" />
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="EditPen" link type="primary" @click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="Delete" link type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120" />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="BasicMajor">
|
||||
import { defineAsyncComponent, onMounted, reactive, ref } from 'vue'
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { delObj, fetchList } from '/@/api/basic/major'
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { Document, List, Search } from '@element-plus/icons-vue'
|
||||
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const deptList = ref<any[]>([])
|
||||
|
||||
const searchForm = reactive({
|
||||
majorCode: '',
|
||||
majorName: '',
|
||||
deptCode: ''
|
||||
})
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.majorCode = ''
|
||||
searchForm.majorName = ''
|
||||
searchForm.deptCode = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
if (!id) {
|
||||
useMessage().warning('未获取到专业ID')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除该专业吗?')
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObj(id)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
deptList.value = Array.isArray(res?.data) ? res.data : []
|
||||
} catch {
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDeptListData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
</style>
|
||||
133
src/views/basic/schoolnews/detail.vue
Normal file
133
src/views/basic/schoolnews/detail.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="校园新闻预览"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="980px">
|
||||
<div v-loading="loading" class="article-container">
|
||||
<div class="article-header">
|
||||
<h1 class="article-title">{{ detailData.title || '-' }}</h1>
|
||||
<div class="article-meta">
|
||||
<span>发布时间:{{ detailData.pubTime || '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="detailData.thumb" class="thumb-wrapper">
|
||||
<el-image :src="detailData.thumb" :preview-src-list="[detailData.thumb]" fit="cover" class="thumb-image" />
|
||||
</div>
|
||||
<div class="article-content" v-html="detailData.content || '-'"></div>
|
||||
<div v-if="detailData.remarks" class="article-remarks">备注:{{ detailData.remarks }}</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="SchoolNewsDetailDialog">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { getObj } from '/@/api/basic/schoolnews'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
|
||||
const detailData = reactive({
|
||||
id: '',
|
||||
title: '',
|
||||
content: '',
|
||||
thumb: '',
|
||||
remarks: '',
|
||||
pubTime: ''
|
||||
})
|
||||
|
||||
const openDialog = async (id: string) => {
|
||||
if (!id) {
|
||||
useMessage().warning('未获取到新闻ID')
|
||||
return
|
||||
}
|
||||
visible.value = true
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getObj(id)
|
||||
const data = res?.data || {}
|
||||
Object.assign(detailData, {
|
||||
id: data.id || '',
|
||||
title: data.title || '',
|
||||
content: data.content || '',
|
||||
thumb: data.thumb || '',
|
||||
remarks: data.remarks || '',
|
||||
pubTime: data.pubTime || ''
|
||||
})
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取新闻详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.article-container {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
.article-header {
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.article-title {
|
||||
margin: 0 0 10px;
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
line-height: 1.4;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
color: #909399;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.thumb-wrapper {
|
||||
margin: 10px 0 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.thumb-image {
|
||||
width: 360px;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.article-content {
|
||||
font-size: 16px;
|
||||
line-height: 1.8;
|
||||
color: #303133;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.article-content :deep(img) {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.article-remarks {
|
||||
margin-top: 16px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
padding: 10px 12px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
156
src/views/basic/schoolnews/form.vue
Normal file
156
src/views/basic/schoolnews/form.vue
Normal file
@@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑校园新闻' : '新增校园新闻'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="820px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="新闻标题" prop="title">
|
||||
<el-input v-model="form.title" maxlength="120" show-word-limit placeholder="请输入新闻标题" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="发布时间" prop="pubTime">
|
||||
<el-date-picker
|
||||
v-model="form.pubTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择发布时间"
|
||||
clearable
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="缩略图" prop="thumb">
|
||||
<UploadImg
|
||||
v-model="form.thumb"
|
||||
:width="'180px'"
|
||||
:height="'110px'"
|
||||
upload-file-url="/admin/sys-file/upload" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="新闻内容" prop="content">
|
||||
<Editor v-model:get-html="form.content" height="360" placeholder="请输入新闻内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" type="textarea" :rows="3" maxlength="200" show-word-limit placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="SchoolNewsDialog">
|
||||
import { nextTick, reactive, ref } from 'vue'
|
||||
import { addObj, getObj, putObj } from '/@/api/basic/schoolnews'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import Editor from '/@/components/Editor/index.vue'
|
||||
import UploadImg from '/@/components/Upload/Image.vue'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const formRef = ref()
|
||||
|
||||
const form = reactive({
|
||||
id: '',
|
||||
title: '',
|
||||
content: '',
|
||||
thumb: '',
|
||||
remarks: '',
|
||||
pubTime: ''
|
||||
})
|
||||
|
||||
const rules = ref({
|
||||
title: [{ required: true, message: '新闻标题不能为空', trigger: 'blur' }],
|
||||
content: [{ required: true, message: '新闻内容不能为空', trigger: 'blur' }],
|
||||
pubTime: [{ required: true, message: '发布时间不能为空', trigger: 'change' }],
|
||||
thumb: [{ required: true, message: '请上传缩略图', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const resetForm = () => {
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
title: '',
|
||||
content: '',
|
||||
thumb: '',
|
||||
remarks: '',
|
||||
pubTime: ''
|
||||
})
|
||||
}
|
||||
|
||||
const openDialog = async (id?: string) => {
|
||||
visible.value = true
|
||||
resetForm()
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate()
|
||||
})
|
||||
if (!id) return
|
||||
|
||||
form.id = id
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getObj(id)
|
||||
const row = res?.data || {}
|
||||
Object.assign(form, {
|
||||
id: row.id || '',
|
||||
title: row.title || '',
|
||||
content: row.content || '',
|
||||
thumb: row.thumb || '',
|
||||
remarks: row.remarks || '',
|
||||
pubTime: row.pubTime || ''
|
||||
})
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取新闻详情失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
if (form.id) {
|
||||
await putObj(form)
|
||||
useMessage().success('编辑成功')
|
||||
} else {
|
||||
await addObj(form)
|
||||
useMessage().success('新增成功')
|
||||
}
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || (form.id ? '编辑失败' : '新增失败'))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openDialog
|
||||
})
|
||||
</script>
|
||||
189
src/views/basic/schoolnews/index.vue
Normal file
189
src/views/basic/schoolnews/index.vue
Normal file
@@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<div class="modern-page-container">
|
||||
<div class="page-wrapper">
|
||||
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Search /></el-icon>
|
||||
筛选条件
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch" class="search-form">
|
||||
<el-form-item label="新闻标题" prop="title">
|
||||
<el-input v-model="searchForm.title" placeholder="请输入新闻标题" clearable style="width: 220px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布时间" prop="pubTime">
|
||||
<el-date-picker
|
||||
v-model="searchForm.pubTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择发布时间"
|
||||
clearable
|
||||
style="width: 220px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="content-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<el-icon class="title-icon"><Document /></el-icon>
|
||||
校园新闻列表
|
||||
</span>
|
||||
<div class="header-actions">
|
||||
<el-button icon="FolderAdd" type="primary" @click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="70" align="center">
|
||||
<template #header>
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 + ((state.pagination?.current || 1) - 1) * (state.pagination?.size || 10) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="title" label="新闻标题" min-width="220" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="thumb" label="缩略图" width="120" align="center">
|
||||
<template #default="scope">
|
||||
<el-image
|
||||
v-if="scope.row.thumb"
|
||||
:src="scope.row.thumb"
|
||||
:preview-src-list="[scope.row.thumb]"
|
||||
fit="cover"
|
||||
style="width: 70px; height: 45px">
|
||||
<template #error>
|
||||
<span>-</span>
|
||||
</template>
|
||||
</el-image>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="pubTime" label="发布时间" width="180" show-overflow-tooltip align="center" />
|
||||
<el-table-column prop="remarks" label="备注" min-width="180" show-overflow-tooltip align="center" />
|
||||
<el-table-column label="操作" width="240" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="View" link type="primary" @click="handlePreview(scope.row.id)">
|
||||
预览
|
||||
</el-button>
|
||||
<el-button icon="EditPen" link type="primary" @click="formDialogRef.openDialog(scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="Delete" link type="danger" @click="handleDelete(scope.row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据" :image-size="120" />
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<DetailDialog ref="detailDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="SchoolNews">
|
||||
import { defineAsyncComponent, reactive, ref } from 'vue'
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { delObj, fetchList } from '/@/api/basic/schoolnews'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { Document, List, Search } from '@element-plus/icons-vue'
|
||||
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
const DetailDialog = defineAsyncComponent(() => import('./detail.vue'))
|
||||
|
||||
const formDialogRef = ref()
|
||||
const detailDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const showSearch = ref(true)
|
||||
|
||||
const searchForm = reactive({
|
||||
title: '',
|
||||
pubTime: ''
|
||||
})
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
},
|
||||
createdIsNeed: true
|
||||
})
|
||||
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.title = ''
|
||||
searchForm.pubTime = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const handleDelete = async (id: string) => {
|
||||
if (!id) {
|
||||
useMessage().warning('未获取到新闻ID')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除该校园新闻吗?')
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObj(id)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
const handlePreview = (id: string) => {
|
||||
detailDialogRef.value?.openDialog(id)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import '/@/assets/styles/modern-page.scss';
|
||||
</style>
|
||||
@@ -128,7 +128,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="home">
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { ref, onMounted, onActivated, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { fetchTodoPage } from '/@/api/jsonflow/do-job'
|
||||
import { fetchList as fetchNoticeList } from '/@/api/jsonflow/ws-notice'
|
||||
@@ -278,6 +278,11 @@ onMounted(() => {
|
||||
loadMessageList()
|
||||
})
|
||||
|
||||
// 页面激活时刷新待办列表(处理从待办返回的情况)
|
||||
onActivated(() => {
|
||||
loadTodoList()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (timeTimer) {
|
||||
clearInterval(timeTimer)
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="采购人员" prop="purchaserName">
|
||||
<el-input v-model="form.purchaserName" placeholder="请输入采购人员" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="资产管理员" prop="assetAdminName">
|
||||
<el-input v-model="form.assetAdminName" placeholder="请输入资产管理员" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="remark" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入remark"/>
|
||||
@@ -49,7 +59,7 @@
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj, validateExist } from '/@/api/purchase/purchasingAccept';
|
||||
import { getObj, addObj, putObj, validateExist, getCommonConfigWithBatches } from '/@/api/purchase/purchasingAccept';
|
||||
|
||||
// ========== 2. 组件定义 ==========
|
||||
// 定义组件事件
|
||||
@@ -70,6 +80,10 @@ const form = reactive({
|
||||
acceptAddress: '', // 验收地点
|
||||
batch: '', // 验收批次
|
||||
question: '', // 问题意见
|
||||
purchaserId: '', // 采购人员ID
|
||||
purchaserName: '', // 采购人员姓名
|
||||
assetAdminId: '', // 资产管理员ID
|
||||
assetAdminName: '', // 资产管理员姓名
|
||||
});
|
||||
|
||||
// ========== 4. 字典数据处理 ==========
|
||||
@@ -86,6 +100,17 @@ const getPurchasingAcceptData = async (id: string) => {
|
||||
const { data } = await getObj({ id: id });
|
||||
// 直接将第一条数据赋值给表单
|
||||
Object.assign(form, data[0]);
|
||||
|
||||
// 获取采购人员和资产管理员信息
|
||||
if (form.purchaseId) {
|
||||
const { data: commonData } = await getCommonConfigWithBatches(form.purchaseId);
|
||||
if (commonData && commonData.common) {
|
||||
form.purchaserId = commonData.common.purchaserId || '';
|
||||
form.purchaserName = commonData.common.purchaserName || '';
|
||||
form.assetAdminId = commonData.common.assetAdminId || '';
|
||||
form.assetAdminName = commonData.common.assetAdminName || '';
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
useMessage().error('获取数据失败');
|
||||
} finally {
|
||||
|
||||
@@ -98,10 +98,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { ref, computed, onUnmounted } from 'vue'
|
||||
import { FolderOpened, Download, Document } from '@element-plus/icons-vue'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import { listDownloadUrls, getArchiveDownloadUrl } from '/@/api/purchase/purchasingrequisition'
|
||||
import { listDownloadUrls, getArchiveDownloadUrl, downloadFileById, previewFileById } from '/@/api/purchase/purchasingrequisition'
|
||||
import other from '/@/utils/other'
|
||||
|
||||
interface FileItem {
|
||||
@@ -117,6 +117,7 @@ const loading = ref(false)
|
||||
const downloading = ref(false)
|
||||
const previewVisible = ref(false)
|
||||
const previewUrl = ref('')
|
||||
const previewLoading = ref(false)
|
||||
const purchaseId = ref('')
|
||||
const purchaseNo = ref('')
|
||||
const fileList = ref<FileItem[]>([])
|
||||
@@ -155,9 +156,9 @@ const isPdfFile = (fileName: string): boolean => {
|
||||
return ext === 'pdf'
|
||||
}
|
||||
|
||||
const handlePreview = (row: FileItem) => {
|
||||
if (!row.downloadUrl) {
|
||||
useMessage().warning('文件预览地址不存在')
|
||||
const handlePreview = async (row: FileItem) => {
|
||||
if (!row.id) {
|
||||
useMessage().warning('文件ID不存在')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -167,16 +168,41 @@ const handlePreview = (row: FileItem) => {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用iframe预览PDF(通过后端下载接口获取文件流)
|
||||
previewUrl.value = row.downloadUrl
|
||||
previewLoading.value = true
|
||||
previewVisible.value = true
|
||||
previewUrl.value = ''
|
||||
|
||||
try {
|
||||
const res = await previewFileById(row.id)
|
||||
const blob = res as unknown as Blob
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
previewUrl.value = url
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || '预览失败')
|
||||
previewVisible.value = false
|
||||
} finally {
|
||||
previewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDownloadFile = (row: FileItem) => {
|
||||
if (row.downloadUrl) {
|
||||
window.open(row.downloadUrl, '_blank')
|
||||
} else {
|
||||
useMessage().warning('文件下载地址不存在')
|
||||
const handleDownloadFile = async (row: FileItem) => {
|
||||
if (!row.id) {
|
||||
useMessage().warning('文件ID不存在')
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await downloadFileById(row.id)
|
||||
const blob = res as unknown as Blob
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = row.fileTitle || 'download'
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || '下载失败')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +223,12 @@ const handleDownloadAll = () => {
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
if (previewUrl.value) {
|
||||
window.URL.revokeObjectURL(previewUrl.value)
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<!-- 上传履约验收模版 -->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="履约验收文件" prop="templateFileIds">
|
||||
<upload-file v-model="templateFiles" :limit="1" :file-type="['doc', 'docx', 'pdf']" :data="{ purchaseId: purchaseId || '', fileType: '110' }" upload-file-url="/purchase/purchasingfiles/upload" :disabled="readonly" />
|
||||
<el-link v-if="!readonly" type="primary" :href="lyysTemplateUrl" :download="lyysTemplateDownloadName" target="_blank" style="margin-top: 8px; display: inline-flex; align-items: center;">
|
||||
<upload-file v-model="templateFiles" :limit="1" :file-type="['pdf']" :data="{ purchaseId: purchaseId || '', fileType: '110' }" upload-file-url="/purchase/purchasingfiles/upload" :disabled="readonly" />
|
||||
<el-link v-if="!readonly" type="primary" @click="handleDownloadTemplate" style="margin-top: 8px; display: inline-flex; align-items: center;">
|
||||
<el-icon><Download /></el-icon>
|
||||
<span style="margin-left: 4px;">下载{{ lyysTemplateLabel }}</span>
|
||||
</el-link>
|
||||
@@ -39,7 +39,9 @@
|
||||
import { ref, reactive, computed, watch, onMounted } from 'vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { Download } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import UploadFile from "/@/components/Upload/index.vue";
|
||||
import { downloadTemplate } from "/@/api/purchase/purchasingAccept";
|
||||
|
||||
/** 项目类型 A:货物 B:工程 C:服务 */
|
||||
const LYYS_TEMPLATE_MAP: Record<string, { label: string }> = {
|
||||
@@ -54,6 +56,8 @@ const props = defineProps<{
|
||||
purchaseId?: string
|
||||
/** 项目类型 A:货物 B:工程 C:服务,用于模版下载 */
|
||||
projectType?: string
|
||||
/** 预算金额,用于判断模板目录 */
|
||||
budget?: number
|
||||
batchNum?: number
|
||||
}>()
|
||||
|
||||
@@ -64,9 +68,33 @@ const formRef = ref<FormInstance>()
|
||||
const templateFiles = ref<any[]>([])
|
||||
|
||||
const projectTypeKey = computed(() => (props.projectType === 'A' || props.projectType === 'B' || props.projectType === 'C' ? props.projectType : 'A'))
|
||||
const lyysTemplateLabel = computed(() => LYYS_TEMPLATE_MAP[projectTypeKey.value]?.label || LYYS_TEMPLATE_MAP.A.label)
|
||||
const lyysTemplateLabel = computed(() => {
|
||||
const amountLabel = (props.budget && props.budget >= 50000) ? '(≥5万)' : '(<5万)'
|
||||
return LYYS_TEMPLATE_MAP[projectTypeKey.value]?.label + amountLabel || LYYS_TEMPLATE_MAP.A.label + amountLabel
|
||||
})
|
||||
const lyysTemplateDownloadName = computed(() => `${lyysTemplateLabel.value}.docx`)
|
||||
const lyysTemplateUrl = computed(() => `/templates/lyys-template-${projectTypeKey.value}.docx`)
|
||||
|
||||
/** 下载模板 - 调用后台接口 */
|
||||
const handleDownloadTemplate = async () => {
|
||||
if (!props.purchaseId) {
|
||||
ElMessage.warning('采购ID不存在')
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await downloadTemplate(props.purchaseId)
|
||||
const blob = res as unknown as Blob
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = lyysTemplateDownloadName.value
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '下载模板失败')
|
||||
}
|
||||
}
|
||||
|
||||
const form = reactive({
|
||||
acceptType: '2', // 固定为上传模式
|
||||
|
||||
@@ -208,6 +208,12 @@ const loadContractOptions = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const onContractSelectVisibleChange = (visible: boolean) => {
|
||||
if (visible && form.hasContract === '1' && contractOptions.value.length === 0) {
|
||||
loadContractOptions()
|
||||
}
|
||||
}
|
||||
|
||||
const searchPurchaser = async (query: string) => {
|
||||
if (!query) {
|
||||
purchaserOptions.value = []
|
||||
@@ -240,9 +246,29 @@ const searchAssetAdmin = async (query: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onContractSelectVisibleChange = (visible: boolean) => {
|
||||
if (visible && form.hasContract === '1' && contractOptions.value.length === 0) {
|
||||
loadContractOptions()
|
||||
const onPurchaserChange = (teacherNo: string) => {
|
||||
if (!teacherNo) {
|
||||
form.purchaserId = ''
|
||||
form.purchaserName = ''
|
||||
return
|
||||
}
|
||||
const selected = purchaserOptions.value.find((item: any) => item.teacherNo === teacherNo)
|
||||
if (selected) {
|
||||
form.purchaserId = selected.teacherNo
|
||||
form.purchaserName = selected.realName || selected.name
|
||||
}
|
||||
}
|
||||
|
||||
const onAssetAdminChange = (teacherNo: string) => {
|
||||
if (!teacherNo) {
|
||||
form.assetAdminId = ''
|
||||
form.assetAdminName = ''
|
||||
return
|
||||
}
|
||||
const selected = assetAdminOptions.value.find((item: any) => item.teacherNo === teacherNo)
|
||||
if (selected) {
|
||||
form.assetAdminId = selected.teacherNo
|
||||
form.assetAdminName = selected.realName || selected.name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,32 +322,6 @@ onMounted(() => {
|
||||
}
|
||||
})
|
||||
|
||||
const onPurchaserChange = (teacherNo: string) => {
|
||||
if (!teacherNo) {
|
||||
form.purchaserId = ''
|
||||
form.purchaserName = ''
|
||||
return
|
||||
}
|
||||
const selected = purchaserOptions.value.find((item: any) => item.teacherNo === teacherNo)
|
||||
if (selected) {
|
||||
form.purchaserId = selected.teacherNo
|
||||
form.purchaserName = selected.realName || selected.name
|
||||
}
|
||||
}
|
||||
|
||||
const onAssetAdminChange = (teacherNo: string) => {
|
||||
if (!teacherNo) {
|
||||
form.assetAdminId = ''
|
||||
form.assetAdminName = ''
|
||||
return
|
||||
}
|
||||
const selected = assetAdminOptions.value.find((item: any) => item.teacherNo === teacherNo)
|
||||
if (selected) {
|
||||
form.assetAdminId = selected.teacherNo
|
||||
form.assetAdminName = selected.realName || selected.name
|
||||
}
|
||||
}
|
||||
|
||||
const rules: FormRules = {
|
||||
isInstallment: [{ required: true, message: '请选择是否分期验收', trigger: 'change' }],
|
||||
totalPhases: [{ required: true, message: '请输入分期次数', trigger: 'blur' }],
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
:readonly="false"
|
||||
:purchase-id="String(purchaseId)"
|
||||
:project-type="acceptProjectType"
|
||||
:budget="applyInfo?.budget"
|
||||
:batch-num="b.batch"
|
||||
/>
|
||||
</div>
|
||||
@@ -177,7 +178,13 @@ const loadData = async () => {
|
||||
|
||||
if (config?.common) {
|
||||
applyInfo.value = config.common
|
||||
// 仅当存在已保存批次时,才用接口数据回填公共信息;否则保持 open() 中的默认清空值
|
||||
// 采购人员和资产管理员始终回填
|
||||
commonForm.value.purchaserId = config.common.purchaserId || ''
|
||||
commonForm.value.purchaserName = config.common.purchaserName || ''
|
||||
commonForm.value.assetAdminId = config.common.assetAdminId || ''
|
||||
commonForm.value.assetAdminName = config.common.assetAdminName || ''
|
||||
|
||||
// 其他字段仅当存在已保存批次时回填
|
||||
if (config?.batches?.length) {
|
||||
Object.assign(commonForm.value, {
|
||||
hasContract: config.common.hasContract || '0',
|
||||
|
||||
@@ -967,6 +967,7 @@ import { addObj, tempStore, getObj, editObj, getApplyFiles } from '/@/api/purcha
|
||||
import { getTree } from '/@/api/purchase/purchasingcategory';
|
||||
import { getDicts } from '/@/api/admin/dict';
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
import { usePurchaseRulesSingleton } from '/@/hooks/usePurchaseRules';
|
||||
import UploadFile from '/@/components/Upload/index.vue';
|
||||
import other from '/@/utils/other';
|
||||
@@ -980,6 +981,7 @@ import * as orderVue from '/@/api/order/order-key-vue';
|
||||
|
||||
/** 采购中心角色编码:审批时仅该角色可编辑采购方式/采购形式 */
|
||||
const PURCHASE_CENTER_ROLE_CODE = 'PURCHASE_CENTER';
|
||||
const PURCHASE_DEPT_APPLY_ROLE_CODE = 'ROLE_PURCHASE_DEPT_APPLY';
|
||||
|
||||
// 兼容流程 dynamic-link 引用:接收 currJob / currElTab,并支持 handleJob 事件
|
||||
const props = defineProps({
|
||||
@@ -1035,9 +1037,23 @@ const isPurchaseCenter = ref(false);
|
||||
/** 流程嵌入时:采购中心审核节点放开所有字段编辑;非采购中心节点只读 */
|
||||
function flowFieldDisabled(_key: string) {
|
||||
if (isFlowEmbed.value && isPurchaseCenter.value) return false;
|
||||
if (isFlowEmbed.value && isApplicant.value) return false;
|
||||
return !!isFlowEmbed.value;
|
||||
}
|
||||
|
||||
/** 当前用户是否为申请人(在流程中可编辑) */
|
||||
const isApplicant = computed(() => {
|
||||
|
||||
const stores = useUserInfo();
|
||||
const currentUser = stores.userInfos?.user || {};
|
||||
console.log(currentUser)
|
||||
if (!dataForm.createBy) return false;
|
||||
|
||||
// const stores = useUserInfo();
|
||||
// const currentUser = stores.userInfos?.user || {};
|
||||
return dataForm.createBy === currentUser.username;
|
||||
});
|
||||
|
||||
// 定义变量内容
|
||||
const formRef = ref();
|
||||
const dataForm = reactive({
|
||||
@@ -1058,6 +1074,7 @@ const dataForm = reactive({
|
||||
categoryCode: '',
|
||||
remark: '',
|
||||
status: '',
|
||||
createBy: '', // 创建人用户名,用于判断是否为申请人
|
||||
// 部门自行采购字段
|
||||
businessNegotiationTable: '',
|
||||
marketPurchaseMinutes: '',
|
||||
@@ -1754,6 +1771,7 @@ async function loadDetail(applyId: string | number) {
|
||||
categoryCode: detail.categoryCode ?? '',
|
||||
remark: detail.remark ?? '',
|
||||
status: detail.status ?? '',
|
||||
createBy: detail.createBy ?? '',
|
||||
businessNegotiationTable: detail.businessNegotiationTable ?? '',
|
||||
marketPurchaseMinutes: detail.marketPurchaseMinutes ?? '',
|
||||
onlineMallMaterials: detail.onlineMallMaterials ?? '',
|
||||
@@ -1888,13 +1906,17 @@ const flowMethods = {
|
||||
},
|
||||
};
|
||||
|
||||
/** 流程嵌入时采购申请权限:根据前端缓存的角色(cloud-ui:roleCode)判断,非采购中心整表只读,采购中心仅采购方式/采购形式可编辑 */
|
||||
/** 流程嵌入时采购申请权限:根据前端缓存的角色(cloud-ui:roleCode)判断,非采购中心整表只读,采购中心仅采购方式/采购形式可编辑;申请人在流程中可编辑 */
|
||||
function applyPurchaseApplyFormPerm() {
|
||||
if (!isFlowEmbed.value) return;
|
||||
const roleCode = Session.getRoleCode() || '';
|
||||
isPurchaseCenter.value = roleCode === PURCHASE_CENTER_ROLE_CODE;
|
||||
if (isApplicant.value) {
|
||||
flowFormDisabled.value = false;
|
||||
} else {
|
||||
flowFormDisabled.value = !isPurchaseCenter.value;
|
||||
}
|
||||
}
|
||||
|
||||
/** 流程嵌入时的“保存”回调:校验后调用 editObj,并通知流程已保存 */
|
||||
async function flowSubmitForm() {
|
||||
@@ -1917,6 +1939,7 @@ async function flowSubmitForm() {
|
||||
'purchaseRequirementTemplate',
|
||||
'serviceInviteSelect',
|
||||
'servicePublicSelectAuto',
|
||||
'deptSelfMeetingMinutes', // 部门自行采购会议纪要
|
||||
'purchaseRequirement',
|
||||
'meetingMinutes',
|
||||
'feasibilityReport',
|
||||
@@ -2353,6 +2376,7 @@ const handleSubmit = async () => {
|
||||
'purchaseRequirementTemplate',
|
||||
'serviceInviteSelect',
|
||||
'servicePublicSelectAuto',
|
||||
'deptSelfMeetingMinutes', // 部门自行采购会议纪要
|
||||
'purchaseRequirement',
|
||||
'meetingMinutes',
|
||||
'feasibilityReport',
|
||||
@@ -2452,6 +2476,7 @@ const handleTempStore = async () => {
|
||||
'purchaseRequirementTemplate',
|
||||
'serviceInviteSelect',
|
||||
'servicePublicSelectAuto',
|
||||
'deptSelfMeetingMinutes', // 部门自行采购会议纪要
|
||||
'purchaseRequirement',
|
||||
'meetingMinutes',
|
||||
'feasibilityReport',
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
<!-- 需求部门/内审部门操作按钮 -->
|
||||
<el-button v-if="canSubmitToAsset" type="primary" @click="handleSubmitToAsset">提交至资产管理处</el-button>
|
||||
<!-- 通用操作按钮 -->
|
||||
<el-button v-if="canReturn" type="warning" @click="handleReturn">退回修改</el-button>
|
||||
<el-button v-if="canReturn" type="primary" @click="handleReturn">提交招标代理</el-button>
|
||||
<el-button v-if="canComplete" type="success" @click="handleComplete">确认流程结束</el-button>
|
||||
<el-button @click="handleClose">关闭</el-button>
|
||||
</div>
|
||||
|
||||
@@ -109,11 +109,21 @@
|
||||
<el-icon><List /></el-icon>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="purchaseNo" label="申请单编号" min-width="140" show-overflow-tooltip>
|
||||
<el-table-column prop="purchaseNo" label="申请单编号" min-width="180">
|
||||
<template #header>
|
||||
<el-icon><DocumentCopy /></el-icon>
|
||||
<span style="margin-left: 4px">申请单编号</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<div class="purchase-no-cell">
|
||||
<el-tooltip :content="scope.row.purchaseNo" placement="top" :show-after="0" v-if="scope.row.purchaseNo">
|
||||
<span class="purchase-no-text">{{ scope.row.purchaseNo }}</span>
|
||||
</el-tooltip>
|
||||
<el-button v-if="scope.row.purchaseNo" type="primary" link size="small" class="copy-btn" @click.stop="copyToClipboard(scope.row.purchaseNo)">
|
||||
<el-icon><CopyDocument /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="projectName" label="采购项目名称" min-width="200" show-overflow-tooltip>
|
||||
<template #header>
|
||||
@@ -185,6 +195,30 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="purchaseMode" label="采购形式" width="140" align="center">
|
||||
<template #header>
|
||||
<el-icon><Shop /></el-icon>
|
||||
<span style="margin-left: 4px">采购形式</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<div class="purchase-mode-cell">
|
||||
<el-tag v-if="scope.row.purchaseMode === '1'" type="success">部门自行采购</el-tag>
|
||||
<el-tag v-else-if="scope.row.purchaseMode === '2'" type="primary">学校统一采购</el-tag>
|
||||
<span v-else>-</span>
|
||||
<el-tag v-if="scope.row.purchaseMode === '1' && scope.row.purchaseChannel === '2'" type="warning" size="small" class="entrust-tag">委</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="purchaseType" label="采购方式" width="120" align="center">
|
||||
<template #header>
|
||||
<el-icon><Shop /></el-icon>
|
||||
<span style="margin-left: 4px">采购方式</span>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.purchaseTypeLabel" type="primary">{{ scope.row.purchaseTypeLabel }}</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="审核状态" width="100" align="center">
|
||||
<template #header>
|
||||
<el-icon><InfoFilled /></el-icon>
|
||||
@@ -274,7 +308,7 @@
|
||||
@refresh="getDataList" />
|
||||
|
||||
<!-- 履约验收弹窗 -->
|
||||
<PurchasingAcceptModal ref="acceptModalRef" @refresh="getDataList" />
|
||||
<PurchasingAcceptModal ref="acceptModalRef" />
|
||||
|
||||
<!-- 查看审批过程(申请单审批 / 文件审批) -->
|
||||
<el-dialog
|
||||
@@ -290,7 +324,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 实施采购:iframe 嵌入 implement.vue,供列表与流程页面使用 -->
|
||||
<ImplementForm ref="implementFormRef" @refresh="getDataList" />
|
||||
<ImplementForm ref="implementFormRef" />
|
||||
|
||||
<!-- 文件归档弹窗 -->
|
||||
<FileArchiveDialog ref="fileArchiveDialogRef" />
|
||||
@@ -309,6 +343,12 @@
|
||||
destroy-on-close
|
||||
>
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="身份">
|
||||
<el-radio-group v-model="representorForm.identity">
|
||||
<el-radio label="purchase_rep">采购代表</el-radio>
|
||||
<el-radio label="judge">评委</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择方式">
|
||||
<el-radio-group v-model="representorForm.mode">
|
||||
<el-radio label="single">指定采购代表人</el-radio>
|
||||
@@ -356,7 +396,7 @@ import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useAuth } from '/@/hooks/auth';
|
||||
import { getDicts } from '/@/api/admin/dict';
|
||||
import { getTree } from '/@/api/purchase/purchasingcategory';
|
||||
import { List, Document, DocumentCopy, Search, Money, CircleCheck, InfoFilled, Calendar, OfficeBuilding, Warning, DocumentChecked, Edit, Delete, Upload, FolderOpened, Download, User, RefreshRight } from '@element-plus/icons-vue'
|
||||
import { List, Document, DocumentCopy, Search, Money, CircleCheck, InfoFilled, Calendar, OfficeBuilding, Warning, DocumentChecked, Edit, Delete, Upload, FolderOpened, Download, User, RefreshRight, Shop, CopyDocument } from '@element-plus/icons-vue'
|
||||
import other from '/@/utils/other'
|
||||
import { Session } from '/@/utils/storage'
|
||||
|
||||
@@ -407,7 +447,7 @@ const updateFilesDialogRef = ref()
|
||||
/** 采购代表弹窗 */
|
||||
const representorDialogVisible = ref(false)
|
||||
const representorCurrentRow = ref<any>(null)
|
||||
const representorForm = reactive({ mode: 'single' as 'single' | 'multi', teacherNo: '', multiIds: [] as string[] })
|
||||
const representorForm = reactive({ mode: 'single' as 'single' | 'multi', teacherNo: '', multiIds: [] as string[], identity: 'purchase_rep' as 'purchase_rep' | 'judge' })
|
||||
const representorDeptMembers = ref<any[]>([])
|
||||
const representorSubmitting = ref(false)
|
||||
|
||||
@@ -444,7 +484,7 @@ const handleSaveRepresentor = async () => {
|
||||
try {
|
||||
const teacherNo = representorForm.mode === 'single' ? representorForm.teacherNo : undefined
|
||||
const multiIds = representorForm.mode === 'multi' ? representorForm.multiIds.join(',') : undefined
|
||||
await saveRepresentor(Number(id), teacherNo, multiIds)
|
||||
await saveRepresentor(Number(id), teacherNo, multiIds, representorForm.identity)
|
||||
useMessage().success('保存采购代表成功')
|
||||
representorDialogVisible.value = false
|
||||
getDataList()
|
||||
@@ -547,6 +587,26 @@ const handleImplement = (row: any) => {
|
||||
implementFormRef.value?.openDialog(row);
|
||||
};
|
||||
|
||||
/** 复制到剪贴板 */
|
||||
const copyToClipboard = async (text: string) => {
|
||||
if (!text) return;
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
useMessage().success('复制成功');
|
||||
} catch (err) {
|
||||
// 降级方案
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.opacity = '0';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
useMessage().success('复制成功');
|
||||
}
|
||||
};
|
||||
|
||||
/** 打开招标文件审核 */
|
||||
const handleDocAudit = (row: any) => {
|
||||
docAuditDialogRef.value?.open(row);
|
||||
@@ -591,6 +651,7 @@ const handleSubmit = async (row: any) => {
|
||||
/** 操作栏「更多」菜单项配置 */
|
||||
const getActionMenuItems = (row: any) => {
|
||||
const isTemp = row?.status === '-1';
|
||||
const isRunning = row?.status === '0';
|
||||
const isCompleted = row?.status === '1';
|
||||
const items = [
|
||||
{
|
||||
@@ -615,7 +676,7 @@ const getActionMenuItems = (row: any) => {
|
||||
command: 'accept',
|
||||
label: '履约验收',
|
||||
icon: DocumentChecked,
|
||||
visible: () => hasAuth('purchase_accept'),
|
||||
visible: () => isCompleted && hasAuth('purchase_accept'),
|
||||
},
|
||||
{
|
||||
command: 'implement',
|
||||
@@ -639,13 +700,13 @@ const getActionMenuItems = (row: any) => {
|
||||
command: 'representor',
|
||||
label: '采购代表',
|
||||
icon: User,
|
||||
visible: () => isDeptAuditRole.value,
|
||||
visible: () => isCompleted && isDeptAuditRole.value,
|
||||
},
|
||||
{
|
||||
command: 'updateFiles',
|
||||
label: '更新材料',
|
||||
icon: RefreshRight,
|
||||
visible: () => isCompleted && hasAuth('purchase_purchasingapply_edit'),
|
||||
visible: () => (isCompleted || isRunning) && hasAuth('purchase_purchasingapply_edit'),
|
||||
},
|
||||
// {
|
||||
// command: 'downloadFileApply',
|
||||
@@ -911,5 +972,70 @@ onMounted(() => {
|
||||
.status-tag-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
:deep(.el-tag) {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
:deep(.el-tag--success) {
|
||||
--el-tag-bg-color: #e8f5e9;
|
||||
--el-tag-border-color: #c8e6c9;
|
||||
--el-tag-text-color: #2e7d32;
|
||||
}
|
||||
|
||||
:deep(.el-tag--warning) {
|
||||
--el-tag-bg-color: #fff8e1;
|
||||
--el-tag-border-color: #ffecb3;
|
||||
--el-tag-text-color: #f57c00;
|
||||
}
|
||||
|
||||
:deep(.el-tag--danger) {
|
||||
--el-tag-bg-color: #ffebee;
|
||||
--el-tag-border-color: #ffcdd2;
|
||||
--el-tag-text-color: #c62828;
|
||||
}
|
||||
|
||||
:deep(.el-tag--primary) {
|
||||
--el-tag-bg-color: #e3f2fd;
|
||||
--el-tag-border-color: #bbdefb;
|
||||
--el-tag-text-color: #1565c0;
|
||||
}
|
||||
|
||||
:deep(.el-tag--info) {
|
||||
--el-tag-bg-color: #f5f5f5;
|
||||
--el-tag-border-color: #e0e0e0;
|
||||
--el-tag-text-color: #616161;
|
||||
}
|
||||
|
||||
.purchase-no-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
|
||||
.purchase-no-text {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.purchase-mode-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
|
||||
.entrust-tag {
|
||||
font-size: 11px;
|
||||
padding: 0 4px;
|
||||
height: 18px;
|
||||
line-height: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -68,6 +68,13 @@
|
||||
@click="formDialogRef.openDialog()">
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Histogram"
|
||||
type="success"
|
||||
class="ml10"
|
||||
@click="handleReadStatistics()">
|
||||
统计班主任查看情况
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'stuwork_weekPlan_export'"
|
||||
@@ -132,7 +139,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="250" align="center" fixed="right">
|
||||
<el-table-column label="操作" width="360" align="center" fixed="right">
|
||||
<template #header>
|
||||
<el-icon><Setting /></el-icon>
|
||||
<span style="margin-left: 4px">操作</span>
|
||||
@@ -183,28 +190,32 @@
|
||||
|
||||
<!-- 详情对话框 -->
|
||||
<DetailDialog ref="detailDialogRef" @refresh="getDataList(false)" />
|
||||
<!-- 班主任查看情况统计 -->
|
||||
<ReadStatisticsDialog ref="readStatisticsDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WeekPlan">
|
||||
import { ref, reactive, defineAsyncComponent, onMounted, nextTick } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/stuwork/weekplan";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { fetchList, delObjs } from '/@/api/stuwork/weekplan'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { queryAllSchoolYear } from '/@/api/basic/basicyear'
|
||||
import TableColumnControl from '/@/components/TableColumnControl/index.vue'
|
||||
import {
|
||||
List, Calendar, Clock, Document, User, Setting, Menu, Search, EditPen
|
||||
List, Calendar, Clock, Document, User, Setting, Menu, Search, EditPen, Histogram,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useTableColumnControl } from '/@/hooks/tableColumn'
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const DetailDialog = defineAsyncComponent(() => import('./detail.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
const DetailDialog = defineAsyncComponent(() => import('./detail.vue'))
|
||||
const ReadStatisticsDialog = defineAsyncComponent(() => import('./readStatistics.vue'))
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const detailDialogRef = ref()
|
||||
const readStatisticsDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const columnControlRef = ref<any>()
|
||||
// 搜索变量
|
||||
@@ -261,7 +272,7 @@ const {
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
tableStyle,
|
||||
} = useTable(state)
|
||||
|
||||
// 查询
|
||||
@@ -293,6 +304,12 @@ const handleViewDetail = async (id: string) => {
|
||||
detailDialogRef.value?.openDialog(id)
|
||||
}
|
||||
|
||||
// 查看班主任查看情况统计
|
||||
const handleReadStatistics = async (row?: any) => {
|
||||
await nextTick()
|
||||
readStatisticsDialogRef.value?.openDialog(row?.id || '')
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
|
||||
144
src/views/stuwork/weekplan/readStatistics.vue
Normal file
144
src/views/stuwork/weekplan/readStatistics.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="班主任查看情况统计"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
width="900px"
|
||||
draggable
|
||||
>
|
||||
<!-- 查询条件:学院选择 -->
|
||||
<el-form :inline="true" class="filter-form">
|
||||
<el-form-item label="学院">
|
||||
<el-select
|
||||
v-model="selectedDeptCode"
|
||||
placeholder="请选择学院"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 220px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">
|
||||
查询
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
:data="dataList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="70" align="center" />
|
||||
<el-table-column prop="deptName" label="学院" min-width="120" align="center" />
|
||||
<el-table-column prop="classNo" label="班号" min-width="100" align="center" />
|
||||
<el-table-column prop="className" label="班级名称" min-width="160" align="center" />
|
||||
<el-table-column prop="teacherRealName" label="班主任" min-width="120" align="center" />
|
||||
<el-table-column label="是否查看" width="110" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
:type="scope.row.hasRead ? 'success' : 'info'"
|
||||
effect="plain"
|
||||
size="small"
|
||||
>
|
||||
{{ scope.row.hasRead ? '已查看' : '未查看' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="readTime" label="查看时间" min-width="180" align="center" />
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WeekPlanReadStatisticsDialog">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import { readStatistics } from '/@/api/stuwork/weekplan'
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const dataList = ref<any[]>([])
|
||||
const deptList = ref<any[]>([])
|
||||
const selectedDeptCode = ref('')
|
||||
const currentWeekPlanId = ref('')
|
||||
|
||||
const openDialog = async (weekPlanId: string) => {
|
||||
visible.value = true
|
||||
dataList.value = []
|
||||
currentWeekPlanId.value = weekPlanId || ''
|
||||
}
|
||||
|
||||
const handleQuery = async () => {
|
||||
if (!selectedDeptCode.value) {
|
||||
useMessage().warning('请选择学院')
|
||||
return
|
||||
}
|
||||
await fetchData()
|
||||
}
|
||||
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res: any = await readStatistics({
|
||||
deptCode: selectedDeptCode.value,
|
||||
weekPlanId: currentWeekPlanId.value || undefined,
|
||||
})
|
||||
if (Array.isArray(res?.data)) {
|
||||
dataList.value = res.data
|
||||
} else if (Array.isArray(res?.data?.data)) {
|
||||
dataList.value = res.data.data
|
||||
} else {
|
||||
dataList.value = []
|
||||
}
|
||||
} catch (err: any) {
|
||||
if (!err?._messageShown) {
|
||||
useMessage().error(err?.msg || '统计班主任查看情况失败')
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data && Array.isArray(res.data)) {
|
||||
deptList.value = res.data
|
||||
} else {
|
||||
deptList.value = []
|
||||
}
|
||||
} catch (err) {
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDeptListData()
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.filter-form {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user