Browse Source

得分结果表格,得分结果表格增删功能

reaper 4 years ago
parent
commit
31bed214de

+ 108 - 8
src/components/knowledgeExtra/AddAssess/ScoreResultsTable.vue

@@ -6,20 +6,90 @@
       border
       style="width: 100%; margin: 20px 0"
     >
-      <el-table-column prop="issueId" label=""> </el-table-column>
-      <el-table-column prop="issueId" label="得分范围"> </el-table-column>
-      <el-table-column prop="issueId" label="结果"> </el-table-column>
-      <el-table-column prop="issueId" label="建议"></el-table-column>
+      <el-table-column prop="orderNo" width="70px" label="">
+        <template slot-scope="scope">
+          <div class="btn_box">
+            <div class="btn_div">
+              <img
+                @click="$emit('CHANEG_SCORE_RESULT', 1, scope.$index)"
+                src="@/images/add-new-rule-sub.png"
+                alt=""
+              />
+            </div>
+            <div class="btn_div" v-if="list.length > 1">
+              <img
+                @click="$emit('CHANEG_SCORE_RESULT', 0, scope.$index)"
+                src="@/images/add-new-rule-del.png"
+                alt=""
+              />
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column prop="content" label="得分范围">
+        <template slot-scope="scope">
+          <!-- <div>{{ scope.row.content.max }},{{ scope.row.content.min }}</div> -->
+          <div class="range_box">
+            <div class="range_child">
+              <el-form-item label="大于:" label-width="50px">
+                <el-input
+                  type="text"
+                  v-model="scope.row.content.max"
+                  clearable
+                  placeholder="请输入"
+                ></el-input>
+              </el-form-item>
+            </div>
+            <div class="range_child">
+              <el-form-item label="小于:" label-width="50px">
+                <el-input
+                  type="text"
+                  v-model="scope.row.content.min"
+                  clearable
+                  placeholder="请输入"
+                ></el-input>
+              </el-form-item>
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column prop="result" label="结果">
+        <template slot="header">
+          <div class="custom_table_header">结果</div>
+        </template>
+        <template slot-scope="scope">
+          <el-form-item>
+            <el-input
+              type="text"
+              v-model="scope.row.result"
+              clearable
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column prop="pushInfo" label="建议">
+        <template slot-scope="scope">
+          <el-form-item>
+            <el-input
+              type="text"
+              v-model="scope.row.pushInfo"
+              clearable
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+      </el-table-column>
     </el-table>
   </div>
 </template>
 
 <script>
 export default {
-  data() {
-    return {
-      list: []
-    };
+  props: {
+    list: {
+      default: []
+    }
   }
 };
 </script>
@@ -37,5 +107,35 @@ export default {
   /deep/.el-table th {
     padding: 0;
   }
+  .btn_box {
+    width: 100%;
+    height: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: space-around;
+    .btn_div {
+      flex: 1;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+    }
+    img {
+      width: 16px;
+      height: 16px;
+      cursor: pointer;
+    }
+  }
+  .range_box {
+    display: flex;
+    .range_child {
+      flex: 1;
+      &:nth-child(1) {
+        margin-right: 20px;
+      }
+    }
+  }
+  /deep/.el-input--mini .el-input__inner {
+    width: 100%;
+  }
 }
 </style>

+ 87 - 2
src/components/knowledgeExtra/AddAssess/index.vue

@@ -256,8 +256,11 @@ it .ql-editor,
             删除标题
           </div>
         </div>
-        <ScoreResultsTable />
       </div>
+      <ScoreResultsTable
+        :list="scoreresultsdatas"
+        @CHANEG_SCORE_RESULT="CHANEG_SCORE_RESULT"
+      />
     </el-form>
   </div>
 </template>
@@ -324,11 +327,13 @@ export default {
       scaleData: {
         conceptId: 0,
         klScaleParent: [
+          // 表格层
           {
             constant: 0,
             content: "",
             factor: 0,
             klScaleSaveGroup: [
+              // 问题层+结果层(包括分组)
               {
                 groupId: 0,
                 issueId: 0,
@@ -411,10 +416,90 @@ export default {
           }
         }
       },
-      toolbarMode: 0
+      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: 0,
+                  status: 0,
+                  textType: 0
+                }
+              ],
+              orderNo: 0,
+              remark: "string",
+              resultType: 0,
+              ruleCode: "string",
+              score: 0,
+              selectType: 0,
+              status: 0,
+              textType: 0
+            }
+          ]
+        }
+      },
+      scoreresultsdatas: [
+        // todo me: 最后处理数据记得将orderNo设不唯一的值
+        {
+          content: {
+            max: null,
+            min: null
+          },
+          orderNo: null,
+          pushInfo: "",
+          remark: null,
+          result: "",
+          ruleCode: null,
+          score: null,
+          status: null,
+          textType: null
+        }
+      ]
     };
   },
   methods: {
+    /**
+     * 增/删/得分结果表格
+     * @param  type : 1:add  0:remove
+     * @param  index :当前行索引
+     */
+    CHANEG_SCORE_RESULT(type, index) {
+      console.log(type, index);
+      if (type === 1) {
+        this.scoreresultsdatas.splice(index + 1, 0, {
+          content: {
+            max: null,
+            min: null
+          },
+          orderNo: null,
+          pushInfo: "",
+          remark: null,
+          result: "",
+          ruleCode: null,
+          score: null,
+          status: null,
+          textType: null
+        });
+      } else {
+        this.$delete(this.scoreresultsdatas, index);
+      }
+    },
     /**
      * 增/删/移动表格
      * @param  tableIndex :当前表格