Browse Source

单元格初始化自动阔高

reaper 4 years ago
parent
commit
7dd171a395

+ 12 - 0
src/components/knowledgeExtra/AddAssess/ScoreResultsTable.vue

@@ -164,6 +164,7 @@
             :rules="rules.soureResult"
           >
             <el-input
+              :ref="`scoreresultsdatas[${scope.$index}].result`"
               type="textarea"
               rows="1"
               :autosize="true"
@@ -183,6 +184,7 @@
             :rules="rules.sourePushInfo"
           >
             <el-input
+              :ref="`scoreresultsdatas[${scope.$index}].pushInfo`"
               type="textarea"
               rows="1"
               :autosize="true"
@@ -208,6 +210,16 @@ export default {
     };
   },
   methods: {
+    resizeTable() {
+      setTimeout(() => {
+        this.list.forEach((item, index) => {
+          this.$refs[`scoreresultsdatas[${index}].pushInfo`] &&
+            this.$refs[`scoreresultsdatas[${index}].pushInfo`].resizeTextarea();
+          this.$refs[`scoreresultsdatas[${index}].result`] &&
+            this.$refs[`scoreresultsdatas[${index}].result`].resizeTextarea();
+        });
+      });
+    },
     validateMinMax(scope, rule, value, callback) {
       const { min, max } = scope.row.content;
       if (min || max) {

+ 15 - 5
src/components/knowledgeExtra/AddAssess/index.vue

@@ -14,8 +14,8 @@
     border-bottom: 30px solid #dee2ea;
     .table_top_box {
       display: flex;
-      // align-items: center;
-      // justify-content: space-between;
+      align-items: center;
+      justify-content: space-between;
       padding: 0 37px;
       .table_top_box_left {
         display: flex;
@@ -239,6 +239,7 @@ it .ql-editor,
           :tableResultType="table.resultType"
           @CHANGE_FORM_DATA="CHANGE_FORM_DATA"
           @CHANGE_TABLE_ROW="CHANGE_TABLE_ROW"
+          ref="ScaleTable"
         />
         <div class="rich_text" v-if="table.textType === 12">
           <el-form-item
@@ -280,6 +281,7 @@ it .ql-editor,
       ref="ScoreResultsRef"
     >
       <ScoreResultsTable
+        ref="ScoreResultsTable"
         v-if="ScoreResultsShow"
         :list="scoreresults.scoreresultsdatas"
         @CHANEG_SCORE_RESULT="CHANEG_SCORE_RESULT"
@@ -520,7 +522,7 @@ export default {
       console.dir(this.formtParams());
     },
     formtParams() {
-      console.log('this.scaleData.klScaleParent');
+      console.log("this.scaleData.klScaleParent");
       console.dir(this.scaleData.klScaleParent);
       // 提交数据的处理 start....
       // 1. 新建一个整体对象
@@ -545,7 +547,7 @@ export default {
               console.log(item.groupNum, group.groupId);
               return item.groupNum === group.groupId;
             });
-            console.log('groupFindIndex',groupFindIndex);
+            console.log("groupFindIndex", groupFindIndex);
             // 6. 查看数组中有没有同组的,如果没有同组的,直接push
             if (groupFindIndex === -1) {
               groupArr.push({
@@ -948,6 +950,14 @@ export default {
       this.$set(this.scaleData.klScaleParent[tableIndex], "klScaleSaveGroup", [
         { ...defaultDate }
       ]);
+    },
+    resizeTable() {
+      console.log("this.$refs.ScaleTable", this.$refs.ScaleTable);
+      this.$refs.ScaleTable.forEach((item) => {
+        item.resizeTable();
+      });
+      this.$refs.ScoreResultsTable.resizeTable();
+      // this.$refs.ScaleTable.resizeTable();
     }
   },
   watch: {
@@ -1078,7 +1088,7 @@ export default {
     // 判断是否需要得分结果
     ScoreResultsShow() {
       const index = this.scaleData.klScaleParent.findIndex(
-        (item) => item.resultType === 1
+        (item) => item.resultType === 2
       );
       if (index === -1) {
         return false;

+ 35 - 2
src/components/knowledgeExtra/AddAssess/scale-table.vue

@@ -193,6 +193,7 @@
               :rules="rules.issueContent"
             >
               <el-input
+                :ref="`klScaleParent[${tableIndex}].klScaleSaveGroup[${scope.$index}].two_content`"
                 type="textarea"
                 rows="1"
                 :autosize="true"
@@ -201,7 +202,6 @@
                 clearable
                 maxlength="300"
                 placeholder="请输入"
-
               ></el-input>
             </el-form-item>
           </template>
@@ -307,6 +307,7 @@
               :rules="rules.content"
             >
               <el-input
+                :ref="`klScaleParent[${tableIndex}].klScaleSaveGroup[${scope.$index}].content`"
                 type="textarea"
                 rows="1"
                 :autosize="true"
@@ -383,6 +384,7 @@
               :rules="rules.result"
             >
               <el-input
+                :ref="`klScaleParent[${tableIndex}].klScaleSaveGroup[${scope.$index}].result`"
                 type="textarea"
                 rows="1"
                 :autosize="true"
@@ -406,6 +408,7 @@
               :rules="rules.pushInfo"
             >
               <el-input
+                :ref="`klScaleParent[${tableIndex}].klScaleSaveGroup[${scope.$index}].pushInfo`"
                 type="textarea"
                 rows="1"
                 :autosize="true"
@@ -436,6 +439,36 @@ export default {
     };
   },
   methods: {
+    resizeTable() {
+      setTimeout(() => {
+        this.tableData.forEach((item, index) => {
+          this.$refs[
+            `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].content`
+          ] &&
+            this.$refs[
+              `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].content`
+            ].resizeTextarea();
+          this.$refs[
+            `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].two_content`
+          ] &&
+            this.$refs[
+              `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].two_content`
+            ].resizeTextarea();
+          this.$refs[
+            `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].result`
+          ] &&
+            this.$refs[
+              `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].result`
+            ].resizeTextarea();
+          this.$refs[
+            `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].pushInfo`
+          ] &&
+            this.$refs[
+              `klScaleParent[${this.tableIndex}].klScaleSaveGroup[${index}].pushInfo`
+            ].resizeTextarea();
+        });
+      }, 500);
+    },
     ruleCodeFocus(index) {
       this.ruleCodeIndex = index;
     },
@@ -593,7 +626,7 @@ export default {
   watch: {
     tableData: {
       handler() {
-        console.log('哈哈哈哈',this.tableData);
+        console.log("哈哈哈哈", this.tableData);
         this.getSpanArr(this.tableData);
       },
       deep: true

+ 10 - 4
src/components/knowledgeExtra/AddDevKnow.vue

@@ -61,7 +61,7 @@
                   ? { color: '#fff', background: '#00c7da' }
                   : ''
               "
-              @click="tabActive = 'one'"
+              @click="tabActiveChange('one')"
             >
               静态信息
             </div>
@@ -72,7 +72,7 @@
                   ? { color: '#fff', background: '#00c7da' }
                   : ''
               "
-              @click="tabActive = 'two'"
+              @click="tabActiveChange('two')"
               v-if="AssesComSHow"
             >
               评估内容
@@ -416,6 +416,13 @@ export default {
     }
   },
   methods: {
+    tabActiveChange(type) {
+      this.tabActive = type;
+      if(type=='two'){
+        console.log(this.$refs.assessRef);
+        this.$refs.assessRef.resizeTable()
+      }
+    },
     handleClear() {
       this.form.selectedTermName = "";
       this.form.selectedTerm = "";
@@ -741,13 +748,12 @@ export default {
         param.scale = assessParam;
         param.scale.conceptId = this.toAssesTermId;
         const userInfo = localStorage.getItem("userLoginDTO");
-        console.log('userInfo',userInfo);
+        console.log("userInfo", userInfo);
         param.scale.modifier = userInfo.linkman; //fix lei 字段暂时未知
       }
 
       console.log("param-------");
       console.dir(param);
-      return;
       if (!this.isEdit) {
         // 新增页面
         this.saveDisable = true;