|
@@ -349,6 +349,11 @@ const defaultTable = {
|
|
};
|
|
};
|
|
export default {
|
|
export default {
|
|
components: { ScaleTable, quillEditor, ScoreResultsTable },
|
|
components: { ScaleTable, quillEditor, ScoreResultsTable },
|
|
|
|
+ props: {
|
|
|
|
+ childScaleData: {
|
|
|
|
+ default: null
|
|
|
|
+ }
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
rules: rules,
|
|
rules: rules,
|
|
@@ -515,6 +520,8 @@ export default {
|
|
console.dir(this.formtParams());
|
|
console.dir(this.formtParams());
|
|
},
|
|
},
|
|
formtParams() {
|
|
formtParams() {
|
|
|
|
+ console.log('this.scaleData.klScaleParent');
|
|
|
|
+ console.dir(this.scaleData.klScaleParent);
|
|
// 提交数据的处理 start....
|
|
// 提交数据的处理 start....
|
|
// 1. 新建一个整体对象
|
|
// 1. 新建一个整体对象
|
|
const params = {
|
|
const params = {
|
|
@@ -534,13 +541,15 @@ export default {
|
|
let groupArr = [];
|
|
let groupArr = [];
|
|
// 5. 遍历数据 添加组、问题、以及选项。
|
|
// 5. 遍历数据 添加组、问题、以及选项。
|
|
table.klScaleSaveGroup.forEach((group, groupIndex) => {
|
|
table.klScaleSaveGroup.forEach((group, groupIndex) => {
|
|
- const groupFindIndex = groupArr.findIndex(
|
|
|
|
- (item) => item.groupNum === group.groupId
|
|
|
|
- );
|
|
|
|
|
|
+ const groupFindIndex = groupArr.findIndex((item) => {
|
|
|
|
+ console.log(item.groupNum, group.groupId);
|
|
|
|
+ return item.groupNum === group.groupId;
|
|
|
|
+ });
|
|
|
|
+ console.log('groupFindIndex',groupFindIndex);
|
|
// 6. 查看数组中有没有同组的,如果没有同组的,直接push
|
|
// 6. 查看数组中有没有同组的,如果没有同组的,直接push
|
|
if (groupFindIndex === -1) {
|
|
if (groupFindIndex === -1) {
|
|
groupArr.push({
|
|
groupArr.push({
|
|
- groupNum: 0,
|
|
|
|
|
|
+ groupNum: group.groupId,
|
|
klScaleSub: [
|
|
klScaleSub: [
|
|
{
|
|
{
|
|
issueId: group.issueId,
|
|
issueId: group.issueId,
|
|
@@ -947,6 +956,122 @@ export default {
|
|
console.log("监听");
|
|
console.log("监听");
|
|
},
|
|
},
|
|
deep: true
|
|
deep: true
|
|
|
|
+ },
|
|
|
|
+ childScaleData() {
|
|
|
|
+ console.log("child Mounted");
|
|
|
|
+ console.dir(this.childScaleData);
|
|
|
|
+ if (this.childScaleData) {
|
|
|
|
+ // 修改时的默认数据赋值 逻辑:遍历接口数据 赋值给结构体数据
|
|
|
|
+ let obj = {
|
|
|
|
+ ...this.data,
|
|
|
|
+ klScaleParent: []
|
|
|
|
+ };
|
|
|
|
+ delete obj.klScaleDetail;
|
|
|
|
+ let scoreresults = {
|
|
|
|
+ scoreresultsdatas: []
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ this.childScaleData.klScaleDetail.forEach((table, tableIndex) => {
|
|
|
|
+ if (table.textType === 13) {
|
|
|
|
+ // 计算结果
|
|
|
|
+ scoreresults.scoreresultsdatas = table.subMenuList[0].subMenuList;
|
|
|
|
+ scoreresults.scoreresultsdatas.forEach((item) => {
|
|
|
|
+ item.content = JSON.parse(item.content);
|
|
|
|
+ });
|
|
|
|
+ } else if (table.textType === 11) {
|
|
|
|
+ // 选项
|
|
|
|
+ obj.klScaleParent.push({
|
|
|
|
+ constant: table.constant,
|
|
|
|
+ content: table.content,
|
|
|
|
+ factor: table.factor,
|
|
|
|
+ orderNo: table.orderNo,
|
|
|
|
+ remark: table.remark,
|
|
|
|
+ resultType: table.resultType,
|
|
|
|
+ ruleCode: table.ruleCode,
|
|
|
|
+ score: table.score,
|
|
|
|
+ status: table.status,
|
|
|
|
+ textType: table.textType,
|
|
|
|
+ klScaleSaveGroup: []
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ table.subMenuList.forEach((issueItem, issueIndex) => {
|
|
|
|
+ const arr = issueItem.subMenuList.map(
|
|
|
|
+ (optionItem, optionIndex) => {
|
|
|
|
+ return {
|
|
|
|
+ groupId: issueItem.groupNum,
|
|
|
|
+ issueId: optionItem.parentId,
|
|
|
|
+ two_constant: issueItem.constant,
|
|
|
|
+ two_content: issueItem.content,
|
|
|
|
+ two_factor: issueItem.factor,
|
|
|
|
+ two_orderNo: issueItem.orderNo,
|
|
|
|
+ two_remark: issueItem.remark,
|
|
|
|
+ two_resultType: issueItem.resultType,
|
|
|
|
+ two_ruleCode: issueItem.ruleCode,
|
|
|
|
+ two_score: issueItem.score,
|
|
|
|
+ two_selectType: issueItem.selectType,
|
|
|
|
+ two_status: issueItem.status,
|
|
|
|
+ two_textType: issueItem.textType,
|
|
|
|
+ content: optionItem.content,
|
|
|
|
+ orderNo: optionItem.orderNo,
|
|
|
|
+ pushInfo: optionItem.pushInfo,
|
|
|
|
+ remark: optionItem.remark,
|
|
|
|
+ result: optionItem.result,
|
|
|
|
+ ruleCode: optionItem.ruleCode,
|
|
|
|
+ score: optionItem.score,
|
|
|
|
+ status: optionItem.status,
|
|
|
|
+ textType: optionItem.textType
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ obj.klScaleParent[tableIndex].klScaleSaveGroup.push(...arr);
|
|
|
|
+ });
|
|
|
|
+ } else if (table.textType === 12) {
|
|
|
|
+ // 文本
|
|
|
|
+ obj.klScaleParent.push({
|
|
|
|
+ constant: table.constant,
|
|
|
|
+ content: table.content,
|
|
|
|
+ factor: table.factor,
|
|
|
|
+ orderNo: table.orderNo,
|
|
|
|
+ remark: table.remark,
|
|
|
|
+ resultType: table.resultType,
|
|
|
|
+ ruleCode: table.ruleCode,
|
|
|
|
+ score: table.score,
|
|
|
|
+ status: table.status,
|
|
|
|
+ textType: table.textType,
|
|
|
|
+ klScaleSaveGroup: [
|
|
|
|
+ {
|
|
|
|
+ two_constant: null,
|
|
|
|
+ two_content: null,
|
|
|
|
+ two_factor: null,
|
|
|
|
+ two_orderNo: null,
|
|
|
|
+ two_remark: null,
|
|
|
|
+ two_resultType: null,
|
|
|
|
+ two_ruleCode: null,
|
|
|
|
+ two_score: null,
|
|
|
|
+ two_selectType: null,
|
|
|
|
+ two_status: null,
|
|
|
|
+ two_textType: null,
|
|
|
|
+ content: table.subMenuList[0].content,
|
|
|
|
+ orderNo: table.subMenuList[0].groupNum,
|
|
|
|
+ pushInfo: table.subMenuList[0].pushInfo,
|
|
|
|
+ remark: table.subMenuList[0].remark,
|
|
|
|
+ result: table.subMenuList[0].result,
|
|
|
|
+ ruleCode: table.subMenuList[0].ruleCode,
|
|
|
|
+ score: table.subMenuList[0].score,
|
|
|
|
+ status: table.subMenuList[0].status,
|
|
|
|
+ textType: table.subMenuList[0].textType
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ console.log("??????????");
|
|
|
|
+ console.dir(obj);
|
|
|
|
+ console.dir(scoreresults);
|
|
|
|
+
|
|
|
|
+ this.scaleData = obj;
|
|
|
|
+ this.scoreresults = scoreresults;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -964,6 +1089,7 @@ export default {
|
|
created() {
|
|
created() {
|
|
this.editorOption.modules.toolbar.container =
|
|
this.editorOption.modules.toolbar.container =
|
|
this.toolbars[this.toolbarMode];
|
|
this.toolbars[this.toolbarMode];
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ mounted() {}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|