Browse Source

Merge branch 'scaleManage0527' into test

reaper 4 years ago
parent
commit
b38cf40060

+ 1 - 1
src/components/knowledgeExtra/AddAssess/ScoreResultsTable.vue

@@ -231,7 +231,7 @@ export default {
           this.$refs[`scoreresultsdatas[${index}].result`] &&
             this.$refs[`scoreresultsdatas[${index}].result`].resizeTextarea();
         });
-      });
+      },500);
     },
     validateMinMax(scope, rule, value, callback) {
       const { min, max } = scope.row.content;

+ 62 - 62
src/components/knowledgeExtra/AddAssess/index.vue

@@ -161,7 +161,11 @@ it .ql-editor,
               :prop="`klScaleParent[${tableIndex}].content`"
               :rules="rules.title"
             >
-              <el-input maxlength="20" v-model.trim="table.content" />
+              <el-input
+                :prop="`klScaleParent[${tableIndex}].content`"
+                maxlength="20"
+                v-model.trim="table.content"
+              />
             </el-form-item>
             <div style="margin: 0 20px">
               <el-form-item label="内容类型:" label-width="100px">
@@ -202,6 +206,7 @@ it .ql-editor,
                   label="系数:"
                   label-width="70px"
                   :prop="`klScaleParent[${tableIndex}].factor`"
+                  :ref="`klScaleParent[${tableIndex}].factor`"
                   :rules="rules.tableFactor"
                 >
                   <el-input
@@ -218,6 +223,7 @@ it .ql-editor,
                   :rules="rules.tableConstant"
                 >
                   <el-input
+                    :ref="`klScaleParent[${tableIndex}].constant`"
                     type="number"
                     maxlength="6"
                     v-model.number="table.constant"
@@ -272,13 +278,14 @@ it .ql-editor,
           :tableResultType="table.resultType"
           @CHANGE_FORM_DATA="CHANGE_FORM_DATA"
           @CHANGE_TABLE_ROW="CHANGE_TABLE_ROW"
+          @CHANGE_ISSUE_CONTENT="CHANGE_ISSUE_CONTENT"
           ref="ScaleTable"
         />
         <div class="rich_text" v-if="table.textType === 12">
           <el-form-item
             label="概述:"
             label-width="70px"
-            ref="editor"
+            :ref="`klScaleParent[${tableIndex}].klScaleSaveGroup[0].content`"
             :prop="`klScaleParent[${tableIndex}].klScaleSaveGroup[0].content`"
             :rules="rules.fwbContent"
           >
@@ -352,9 +359,9 @@ const defaultDate = {
   two_resultType: 0,
   two_ruleCode: "",
   two_score: 0,
-  two_selectType: 1,
+  two_selectType: 21,
   two_status: 0,
-  two_textType: 0,
+  two_textType: 21,
   content: "",
   orderNo: 0,
   pushInfo: "",
@@ -362,8 +369,8 @@ const defaultDate = {
   result: "",
   ruleCode: "",
   score: null,
-  status: 0,
-  textType: 11
+  status: 1,
+  textType: 31
 };
 const defaultTable = {
   constant: 0,
@@ -379,7 +386,7 @@ const defaultTable = {
   resultType: 2,
   ruleCode: "string",
   score: null,
-  status: 0,
+  status: 1,
   textType: 11
 };
 export default {
@@ -415,9 +422,9 @@ export default {
                 two_resultType: 0,
                 two_ruleCode: "",
                 two_score: 0,
-                two_selectType: 1,
-                two_status: 0,
-                two_textType: 0,
+                two_selectType: 21,
+                two_status: 1,
+                two_textType: 21,
                 content: "",
                 orderNo: 0,
                 pushInfo: "",
@@ -425,8 +432,8 @@ export default {
                 result: "",
                 ruleCode: "",
                 score: null,
-                status: 0,
-                textType: 0
+                status: 1,
+                textType: 31
               }
             ],
             orderNo: 0,
@@ -434,7 +441,7 @@ export default {
             resultType: 2,
             ruleCode: "string",
             score: "",
-            status: 0,
+            status: 1,
             textType: 11
           }
         ],
@@ -487,43 +494,6 @@ export default {
         }
       },
       toolbarMode: 0,
-      ScoreResultsData: {
-        //得分结果提交格式
-        constant: null,
-        content: "得分结果",
-        factor: "",
-        klScaleSaveGroup: {
-          groupNum: 0,
-          klScaleSub: [
-            {
-              constant: 0,
-              content: "得分范围",
-              factor: 0,
-              klScaleDetail: [
-                {
-                  content: "string",
-                  orderNo: 0,
-                  pushInfo: "string",
-                  remark: "string",
-                  result: "string",
-                  ruleCode: "string",
-                  score: null,
-                  status: 0,
-                  textType: 0
-                }
-              ],
-              orderNo: 0,
-              remark: "string",
-              resultType: 0,
-              ruleCode: "string",
-              score: null,
-              selectType: 0,
-              status: 0,
-              textType: 0
-            }
-          ]
-        }
-      },
       scoreresults: {
         scoreresultsdatas: [
           // todo me: 最后处理数据记得将orderNo设不唯一的值
@@ -538,14 +508,27 @@ export default {
             result: "",
             ruleCode: null,
             score: null,
-            status: null,
-            textType: null
+            status: 2,
+            textType: 31
           }
         ]
       }
     };
   },
   methods: {
+    CHANGE_ISSUE_CONTENT(data) {
+      const { value, tableIndex, rowIndex, name } = data;
+      console.log(value, tableIndex, rowIndex, name);
+      const thisIssueId =
+        this.scaleData.klScaleParent[tableIndex].klScaleSaveGroup[rowIndex]
+          .issueId;
+      console.log(thisIssueId);
+      this.scaleData.klScaleParent[tableIndex].klScaleSaveGroup.forEach(
+        (item) => {
+          if (item.issueId === thisIssueId) item[name] = value;
+        }
+      );
+    },
     onEditorChange(e) {
       e.quill.deleteText(1000, 4);
       // e.quill.getLength()>1000
@@ -687,8 +670,8 @@ export default {
                     ruleCode: "string",
                     score: null,
                     selectType: 0,
-                    status: 0,
-                    textType: 0,
+                    status: 1,
+                    textType: 21,
                     klScaleDetail: []
                   }
                 ]
@@ -727,9 +710,9 @@ export default {
                 resultType: 0,
                 ruleCode: "string",
                 score: null,
-                selectType: 0,
-                status: 0,
-                textType: 0
+                selectType: 21,
+                status: 2,
+                textType: 21
               }
             ]
           }
@@ -739,7 +722,7 @@ export default {
         resultType: 0,
         ruleCode: "string",
         score: null,
-        status: 0,
+        status: 2,
         textType: 13
       };
       // 13. 将得分结果加入到提交数据中
@@ -768,11 +751,14 @@ export default {
     assessCommit() {
       // new Promise((resolve))
       let valid1 = new Promise((resolve, reject) => {
-        this.$refs["scaleFormRef"].validate((valid, object) => {
+        this.$refs["scaleFormRef"].validate((valid, object, err) => {
           if (valid) {
             resolve();
           } else {
             reject("c");
+            console.log("valid", valid, object, err);
+            let div = this.$refs["elscrollbar"];
+            console.log("div", div);
             return false;
           }
         });
@@ -816,8 +802,8 @@ export default {
           result: "",
           ruleCode: null,
           score: null,
-          status: null,
-          textType: null
+          status: 2,
+          textType: 31
         });
       } else {
         this.$delete(this.scoreresults.scoreresultsdatas, index);
@@ -918,11 +904,19 @@ export default {
             0,
             child
           );
+
           break;
         case 3: //type 3: 添加选项
           // 设置新的 groupId(相同的组id)、issueId(相同的组问题id)
           child.groupId = groupId;
           child.issueId = issueId;
+          // 添加相同问题的内容、常数、系数、选择
+          const thisRowData =
+            this.scaleData.klScaleParent[tableIndex].klScaleSaveGroup[rowIndex];
+          child.two_content = thisRowData.content;
+          child.two_factor = thisRowData.two_factor;
+          child.two_constant = thisRowData.two_constant;
+          child.two_selectType = thisRowData.two_selectType;
           // 将新的组插入到当前组后边
           this.scaleData.klScaleParent[tableIndex].klScaleSaveGroup.splice(
             rowIndex + 1,
@@ -1002,12 +996,17 @@ export default {
         };
 
         this.childScaleData.klScaleDetail.forEach((table, tableIndex) => {
+          console.log("?????");
           if (table.textType === 13) {
             // 计算结果
             scoreresults.scoreresultsdatas = table.subMenuList[0].subMenuList;
             scoreresults.scoreresultsdatas.forEach((item) => {
               item.content = JSON.parse(item.content);
             });
+            console.log(
+              "scoreresults.scoreresultsdatas",
+              scoreresults.scoreresultsdatas
+            );
           } else if (table.textType === 11) {
             // 选项
             obj.klScaleParent.push({
@@ -1099,7 +1098,8 @@ export default {
         // console.dir(scoreresults);
 
         this.scaleData = obj;
-        this.scoreresults = scoreresults;
+        if (scoreresults.scoreresultsdatas.length)
+          this.scoreresults = scoreresults;
       }
     }
   },

+ 32 - 4
src/components/knowledgeExtra/AddAssess/scale-table.vue

@@ -182,14 +182,14 @@
           <template slot-scope="scope">
             <div class="table_select_btn">
               <el-button
-                @click="handleSelectTypeBtn(scope.$index, 1)"
-                :style="scope.row.two_selectType != 1 ? { color: '#999' } : ''"
+                @click="handleSelectTypeBtn(scope.$index, 21)"
+                :style="scope.row.two_selectType != 21 ? { color: '#999' } : ''"
                 type="text"
                 >单选</el-button
               >
               <el-button
-                :style="scope.row.two_selectType != 2 ? { color: '#999' } : ''"
-                @click="handleSelectTypeBtn(scope.$index, 2)"
+                :style="scope.row.two_selectType != 22 ? { color: '#999' } : ''"
+                @click="handleSelectTypeBtn(scope.$index, 22)"
                 type="text"
                 >多选</el-button
               >
@@ -215,6 +215,9 @@
                 clearable
                 maxlength="300"
                 placeholder="请输入"
+                @input="
+                  changeDataFun($event, tableIndex, scope.$index, 'two_content')
+                "
               ></el-input>
             </el-form-item>
           </template>
@@ -235,6 +238,14 @@
                   type="number"
                   v-model.number="scope.row.two_factor"
                   placeholder="请输入"
+                  @input="
+                    changeDataFun(
+                      $event,
+                      tableIndex,
+                      scope.$index,
+                      'two_factor'
+                    )
+                  "
                 ></el-input>
               </el-form-item>
             </div>
@@ -257,6 +268,14 @@
                   v-model.number="scope.row.two_constant"
                   placeholder="请输入"
                   style="text-align: center"
+                  @input="
+                    changeDataFun(
+                      $event,
+                      tableIndex,
+                      scope.$index,
+                      'two_constant'
+                    )
+                  "
                 ></el-input>
               </el-form-item>
             </div>
@@ -454,6 +473,14 @@ export default {
     };
   },
   methods: {
+    changeDataFun(val, tableIndex, rowIndex, name) {
+      this.$emit("CHANGE_ISSUE_CONTENT", {
+        value: val,
+        tableIndex,
+        rowIndex,
+        name
+      });
+    },
     resizeTable() {
       setTimeout(() => {
         this.tableData.forEach((item, index) => {
@@ -512,6 +539,7 @@ export default {
         "two_selectType",
         type
       );
+      this.changeDataFun(type, this.tableIndex, index, "two_selectType");
     },
     // 计算表格选项内容的值
     optionLength(val) {