|
@@ -288,7 +288,7 @@ it .ql-editor,
|
|
|
<!-- 暂时用的按钮 -->
|
|
|
<button
|
|
|
style="position: fixed; bottom: 20px; right: 20px; font-size: 16px"
|
|
|
- @click="assessCommit"
|
|
|
+ @click="assessCommitTest"
|
|
|
>
|
|
|
暂时用的按钮
|
|
|
</button>
|
|
@@ -306,7 +306,6 @@ import { container, ImageExtend, QuillWatch } from "quill-image-extend-module";
|
|
|
Quill.register("modules/ImageExtend", ImageExtend);
|
|
|
import ScoreResultsTable from "./ScoreResultsTable.vue";
|
|
|
import rules from "./rules";
|
|
|
-import { resolve } from "path";
|
|
|
const defaultDate = {
|
|
|
groupId: new Date().valueOf().toString(),
|
|
|
issueId: new Date().valueOf().toString() + "-" + new Date().valueOf(),
|
|
@@ -512,6 +511,9 @@ export default {
|
|
|
console.log(e.quill.getLength());
|
|
|
// e.quill.getLength()>1000
|
|
|
},
|
|
|
+ assessCommitTest() {
|
|
|
+ console.dir(this.formtParams());
|
|
|
+ },
|
|
|
formtParams() {
|
|
|
// 提交数据的处理 start....
|
|
|
// 1. 新建一个整体对象
|
|
@@ -522,24 +524,63 @@ export default {
|
|
|
};
|
|
|
// 2. 遍历数据
|
|
|
this.scaleData.klScaleParent.forEach((table, tableIndex) => {
|
|
|
- // 3. 将第一层数据格式顺序放进新对象(对应一个表格的数据)
|
|
|
- params.klScaleParent.push({
|
|
|
- ...table,
|
|
|
- klScaleSaveGroup: []
|
|
|
- });
|
|
|
- // 4. 建立一个新数组 用于后边赋值 params.klScaleParent[tableIndex].klScaleSaveGroup = groupArr;
|
|
|
- let groupArr = [];
|
|
|
- // 5. 遍历数据 添加组、问题、以及选项。
|
|
|
- table.klScaleSaveGroup.forEach((group, groupIndex) => {
|
|
|
- const groupFindIndex = groupArr.findIndex(
|
|
|
- (item) => item.groupNum === group.groupId
|
|
|
- );
|
|
|
- // 6. 查看数组中有没有同组的,如果没有同组的,直接push
|
|
|
- if (groupFindIndex === -1) {
|
|
|
- groupArr.push({
|
|
|
- groupNum: 0,
|
|
|
- klScaleSub: [
|
|
|
- {
|
|
|
+ if (table.textType === 11) {
|
|
|
+ // 3. 将第一层数据格式顺序放进新对象(对应一个表格的数据)
|
|
|
+ params.klScaleParent.push({
|
|
|
+ ...table,
|
|
|
+ klScaleSaveGroup: []
|
|
|
+ });
|
|
|
+ // 4. 建立一个新数组 用于后边赋值 params.klScaleParent[tableIndex].klScaleSaveGroup = groupArr;
|
|
|
+ let groupArr = [];
|
|
|
+ // 5. 遍历数据 添加组、问题、以及选项。
|
|
|
+ table.klScaleSaveGroup.forEach((group, groupIndex) => {
|
|
|
+ const groupFindIndex = groupArr.findIndex(
|
|
|
+ (item) => item.groupNum === group.groupId
|
|
|
+ );
|
|
|
+ // 6. 查看数组中有没有同组的,如果没有同组的,直接push
|
|
|
+ if (groupFindIndex === -1) {
|
|
|
+ groupArr.push({
|
|
|
+ groupNum: 0,
|
|
|
+ klScaleSub: [
|
|
|
+ {
|
|
|
+ issueId: group.issueId,
|
|
|
+ constant: group.two_constant,
|
|
|
+ content: group.two_content,
|
|
|
+ factor: group.two_factor,
|
|
|
+ orderNo: 0,
|
|
|
+ remark: group.two_remark,
|
|
|
+ resultType: group.two_resultType,
|
|
|
+ ruleCode: group.two_ruleCode,
|
|
|
+ score: group.two_score,
|
|
|
+ selectType: group.two_selectType,
|
|
|
+ status: group.two_status,
|
|
|
+ textType: group.two_textType,
|
|
|
+ klScaleDetail: [
|
|
|
+ {
|
|
|
+ content: group.content,
|
|
|
+ orderNo: 0,
|
|
|
+ pushInfo: group.pushInfo,
|
|
|
+ remark: group.remark,
|
|
|
+ result: group.result,
|
|
|
+ ruleCode: group.ruleCode,
|
|
|
+ score: group.score,
|
|
|
+ status: group.status,
|
|
|
+ textType: group.textType
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 7. 查看数组中有没有同组的,如果有,则判断同组的是否有issueId相同的
|
|
|
+ const issueIdFindIndex = groupArr[
|
|
|
+ groupFindIndex
|
|
|
+ ].klScaleSub.findIndex(
|
|
|
+ (issItem) => issItem.issueId === group.issueId
|
|
|
+ );
|
|
|
+ if (issueIdFindIndex === -1) {
|
|
|
+ // 8. 如果没有相同的issueId,则在该组中添加当前项的问题
|
|
|
+ groupArr[groupFindIndex].klScaleSub.push({
|
|
|
issueId: group.issueId,
|
|
|
constant: group.two_constant,
|
|
|
content: group.two_content,
|
|
@@ -565,65 +606,55 @@ export default {
|
|
|
textType: group.textType
|
|
|
}
|
|
|
]
|
|
|
- }
|
|
|
- ]
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 7. 查看数组中有没有同组的,如果有,则判断同组的是否有issueId相同的
|
|
|
- const issueIdFindIndex = groupArr[
|
|
|
- groupFindIndex
|
|
|
- ].klScaleSub.findIndex(
|
|
|
- (issItem) => issItem.issueId === group.issueId
|
|
|
- );
|
|
|
- if (issueIdFindIndex === -1) {
|
|
|
- // 8. 如果没有相同的issueId,则在该组中添加当前项的问题
|
|
|
- groupArr[groupFindIndex].klScaleSub.push({
|
|
|
- issueId: group.issueId,
|
|
|
- constant: group.two_constant,
|
|
|
- content: group.two_content,
|
|
|
- factor: group.two_factor,
|
|
|
- orderNo: 0,
|
|
|
- remark: group.two_remark,
|
|
|
- resultType: group.two_resultType,
|
|
|
- ruleCode: group.two_ruleCode,
|
|
|
- score: group.two_score,
|
|
|
- selectType: group.two_selectType,
|
|
|
- status: group.two_status,
|
|
|
- textType: group.two_textType,
|
|
|
- klScaleDetail: [
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 9. 如果有相同的issueId,则在该组的该问题中,添加一个新的选项
|
|
|
+ groupArr[groupFindIndex].klScaleSub[
|
|
|
+ issueIdFindIndex
|
|
|
+ ].klScaleDetail.push({
|
|
|
+ content: group.content,
|
|
|
+ orderNo: 0,
|
|
|
+ pushInfo: group.pushInfo,
|
|
|
+ remark: group.remark,
|
|
|
+ result: group.result,
|
|
|
+ ruleCode: group.ruleCode,
|
|
|
+ score: group.score,
|
|
|
+ status: group.status,
|
|
|
+ textType: group.textType
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 10. 将groupArr赋值到提交数据中
|
|
|
+ params.klScaleParent[tableIndex].klScaleSaveGroup = groupArr;
|
|
|
+ } else if (table.textType === 12) {
|
|
|
+ // 文本类型单独处理
|
|
|
+ console.dir(table);
|
|
|
+ params.klScaleParent.push({
|
|
|
+ ...table,
|
|
|
+ klScaleSaveGroup: [
|
|
|
+ {
|
|
|
+ groupNum: 0,
|
|
|
+ klScaleSub: [
|
|
|
{
|
|
|
- content: group.content,
|
|
|
+ constant: 0,
|
|
|
+ content: table.klScaleSaveGroup[0].content,
|
|
|
+ factor: 0,
|
|
|
orderNo: 0,
|
|
|
- pushInfo: group.pushInfo,
|
|
|
- remark: group.remark,
|
|
|
- result: group.result,
|
|
|
- ruleCode: group.ruleCode,
|
|
|
- score: group.score,
|
|
|
- status: group.status,
|
|
|
- textType: group.textType
|
|
|
+ remark: "string",
|
|
|
+ resultType: 0,
|
|
|
+ ruleCode: "string",
|
|
|
+ score: 0,
|
|
|
+ selectType: 0,
|
|
|
+ status: 0,
|
|
|
+ textType: 0,
|
|
|
+ klScaleDetail: []
|
|
|
}
|
|
|
]
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 9. 如果有相同的issueId,则在该组的该问题中,添加一个新的选项
|
|
|
- groupArr[groupFindIndex].klScaleSub[
|
|
|
- issueIdFindIndex
|
|
|
- ].klScaleDetail.push({
|
|
|
- content: group.content,
|
|
|
- orderNo: 0,
|
|
|
- pushInfo: group.pushInfo,
|
|
|
- remark: group.remark,
|
|
|
- result: group.result,
|
|
|
- ruleCode: group.ruleCode,
|
|
|
- score: group.score,
|
|
|
- status: group.status,
|
|
|
- textType: group.textType
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- // 10. 将groupArr赋值到提交数据中
|
|
|
- params.klScaleParent[tableIndex].klScaleSaveGroup = groupArr;
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 11.将得分结果中的content转成字符串 max和min
|