日志记录功能

This commit is contained in:
ltt
2026-04-24 15:46:57 +08:00
parent cd084835f6
commit 1d10f5c75a
11 changed files with 230 additions and 3 deletions

View File

@@ -105,6 +105,7 @@
<script>
import api from "@/packageCa/apiCa/studentProfile.js"
import apiuser from "@/packageCa/apiCa/user.js"
export default {
data() {
return {
@@ -127,6 +128,27 @@
url: `/packageCa/pagesTest/testList`
})
},
// 添加日志
postLog(operationType, remarks, beforeData = "", afterData = ""){
try {
const data = {
OperationType: operationType,
Remarks: remarks,
BeforeOperationJson: beforeData,
AfterOperationJson: afterData
};
console.log(data);
// return;
// 异步记录日志,不阻塞主流程
apiuser.saveUserOperationLog(data).then((res) => {
console.log('[Operation Log] 记录成功', res);
}).catch((err) => {
console.error('[Operation Log] 记录失败', err);
});
} catch (e) {
console.error('[Operation Log] 记录异常', e);
}
},
//选中职业添加
async checkedJob(ITEM){
uni.showLoading({
@@ -141,6 +163,7 @@
icon: "none"
})
this.getGXCareerPlanList();
this.postLog(304,`【新增】新增了${ITEM.Name}意向职业`,"",JSON.stringify(ITEM))
} else {
uni.showToast({
title: res.Message,

View File

@@ -121,6 +121,7 @@
<script>
import api from "@/packageCa/apiCa/studentProfile.js"
import apiuser from "@/packageCa/apiCa/user.js"
export default {
data() {
return {
@@ -145,6 +146,27 @@
this.queryPlanList();
},
methods: {
// 添加日志
postLog(operationType, remarks, beforeData = "", afterData = ""){
try {
const data = {
OperationType: operationType,
Remarks: remarks,
BeforeOperationJson: beforeData,
AfterOperationJson: afterData
};
console.log(data);
// return;
// 异步记录日志,不阻塞主流程
apiuser.saveUserOperationLog(data).then((res) => {
console.log('[Operation Log] 记录成功', res);
}).catch((err) => {
console.error('[Operation Log] 记录失败', err);
});
} catch (e) {
console.error('[Operation Log] 记录异常', e);
}
},
// 切换目标标签
changeTarget(ITEM){
if(ITEM.EncodeId == this.checkedTargetCode){
@@ -221,6 +243,7 @@
})
this.queryPlanList();
this.delIds=[];
this.postLog(302,`【新增】新增了学习计划`,"",JSON.stringify(data))
} else {
uni.showToast({
title: res.Message,

View File

@@ -127,6 +127,7 @@
<script>
import api from "@/packageCa/apiCa/studentProfile.js"
import apiuser from "@/packageCa/apiCa/user.js"
export default {
data() {
return {
@@ -192,6 +193,7 @@
this.jobSkill = JSON.parse(data.JobSkill).slice(0,5);
this.professionalRequire = JSON.parse(data.ProfessionalRequire).slice(0,5);
this.isLoadingEnd = true;
this.postLog(303,`【新增】查看了${data.Name}的职业发展路径`,"",JSON.stringify(res.Data))
} else {
uni.showToast({
title: res.Message,
@@ -199,6 +201,27 @@
})
}
},
// 添加日志
postLog(operationType, remarks, beforeData = "", afterData = ""){
try {
const data = {
OperationType: operationType,
Remarks: remarks,
BeforeOperationJson: beforeData,
AfterOperationJson: afterData
};
console.log(data);
// return;
// 异步记录日志,不阻塞主流程
apiuser.saveUserOperationLog(data).then((res) => {
console.log('[Operation Log] 记录成功', res);
}).catch((err) => {
console.error('[Operation Log] 记录失败', err);
});
} catch (e) {
console.error('[Operation Log] 记录异常', e);
}
},
// 去测评
navTest(){
uni.navigateTo({

View File

@@ -175,6 +175,7 @@
<script>
import api from "@/packageCa/apiCa/studentProfile.js"
import apiuser from "@/packageCa/apiCa/user.js"
export default {
data() {
return {
@@ -199,6 +200,27 @@
this.querySmartTargets();
},
methods: {
// 添加日志
postLog(operationType, remarks, beforeData = "", afterData = ""){
try {
const data = {
OperationType: operationType,
Remarks: remarks,
BeforeOperationJson: beforeData,
AfterOperationJson: afterData
};
console.log(data);
// return;
// 异步记录日志,不阻塞主流程
apiuser.saveUserOperationLog(data).then((res) => {
console.log('[Operation Log] 记录成功', res);
}).catch((err) => {
console.error('[Operation Log] 记录失败', err);
});
} catch (e) {
console.error('[Operation Log] 记录异常', e);
}
},
goPlan(){
if(this.targetList.length==0){
uni.showToast({
@@ -248,6 +270,7 @@
icon: "success"
})
this.querySmartTargets();
this.postLog(301,`【新增】保存SMART目标`,"",JSON.stringify(this.targetForm))
} else {
uni.showToast({
title: res.Message,
@@ -300,6 +323,7 @@
Timeliness: "",
};
this.querySmartTargets();
this.postLog(301,`【删除】删除SMART目标`,"",JSON.stringify(this.targetForm))
} else {
uni.showToast({
title: res.Message,