日志记录功能
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
|
||||
<script>
|
||||
import api from "@/packageCa/apiCa/testManage.js"
|
||||
import apiuser from "@/packageCa/apiCa/user.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -179,6 +180,27 @@
|
||||
}, 300)
|
||||
}
|
||||
},
|
||||
// 添加日志
|
||||
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);
|
||||
}
|
||||
},
|
||||
// 提交题目
|
||||
submitTitle() {
|
||||
let testStr = "";
|
||||
@@ -250,7 +272,11 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.postLog(201,`【新增】保存${this.testTitle}`,"",JSON.stringify({
|
||||
TestType: this.testType,
|
||||
TestStr: testStr
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import api from "@/packageCa/apiCa/testManage.js"
|
||||
import apiuser from "@/packageCa/apiCa/user.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -249,6 +250,27 @@
|
||||
},400)
|
||||
|
||||
},
|
||||
// 添加日志
|
||||
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);
|
||||
}
|
||||
},
|
||||
// 提交题目
|
||||
submitTitle() {
|
||||
let testStr = "";
|
||||
@@ -282,6 +304,10 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
this.postLog(201,`【新增】保存职业兴趣测评`,"",JSON.stringify({
|
||||
TestType: 11,
|
||||
TestStr: testStr
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
<script>
|
||||
import api from "@/packageCa/apiCa/testManage.js"
|
||||
import apiuser from "@/packageCa/apiCa/user.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -142,6 +143,27 @@
|
||||
},400)
|
||||
}
|
||||
},
|
||||
// 添加日志
|
||||
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);
|
||||
}
|
||||
},
|
||||
// 提交题目
|
||||
submitTitle() {
|
||||
let testStr = "";
|
||||
@@ -195,6 +217,10 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
this.postLog(201,`【新增】保存人格测评`,"",JSON.stringify({
|
||||
TestType: 15,
|
||||
TestStr: testStr
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
<script>
|
||||
import api from "@/packageCa/apiCa/testManage.js"
|
||||
import apiuser from "@/packageCa/apiCa/user.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -145,6 +146,27 @@
|
||||
},300)
|
||||
}
|
||||
},
|
||||
// 添加日志
|
||||
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);
|
||||
}
|
||||
},
|
||||
// 提交题目
|
||||
submitTitle() {
|
||||
let testStr = "";
|
||||
@@ -197,6 +219,10 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
this.postLog(201,`【新增】保存工作测评`,"",JSON.stringify({
|
||||
TestType: 17,
|
||||
TestStr: testStr
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user