瀏覽代碼

组的复制功能; bugfix:8576

reaper 4 年之前
父節點
當前提交
70317f99c6

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

@@ -200,7 +200,7 @@
                 resize="none"
                 resize="none"
                 v-model="scope.row.result"
                 v-model="scope.row.result"
                 clearable
                 clearable
-                maxlength="300"
+                maxlength="10"
                 placeholder="请输入"
                 placeholder="请输入"
               ></el-input>
               ></el-input>
             </el-form-item>
             </el-form-item>

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

@@ -587,7 +587,7 @@ export default {
     onEditorChange(e, ref) {
     onEditorChange(e, ref) {
       e.quill.deleteText(1000, 4);
       e.quill.deleteText(1000, 4);
       console.log(e.quill.getLength());
       console.log(e.quill.getLength());
-      this.$refs.scaleFormRef.clearValidate(ref)
+      this.$refs.scaleFormRef.clearValidate(ref);
     },
     },
     assessCommitTest() {
     assessCommitTest() {
       console.dir(this.formtParams());
       console.dir(this.formtParams());
@@ -907,7 +907,7 @@ export default {
     },
     },
     /**
     /**
      * 修改表格数据(添加、删除 :组、问题、选项)
      * 修改表格数据(添加、删除 :组、问题、选项)
-     * @param  type         类型:1/-1:新增/删除组; 2/-2:新增/删除问题; 3/-3:新增/删除选项
+     * @param  type         类型:1/-1:新增/删除组; 2/-2:新增/删除问题; 3/-3:新增/删除选项; 4:复制组; 5:复制问题
      * @param  tableIndex   单个量表的index
      * @param  tableIndex   单个量表的index
      * @param  rowIndex     表格 当前行的index
      * @param  rowIndex     表格 当前行的index
      * @param  groupId      当前组id
      * @param  groupId      当前组id
@@ -1008,6 +1008,41 @@ export default {
             rowIndex
             rowIndex
           );
           );
           break;
           break;
+        case 4: //type 4: 复制组=> 将组id符合的数据复制一份,重置组id和问题id
+          let copyData = this.scaleData.klScaleParent[
+            tableIndex
+          ].klScaleSaveGroup.filter((item) => item.groupId === groupId);
+          copyData = JSON.parse(JSON.stringify(copyData));
+          let newId = new Date().valueOf().toString();
+          // 筛选并设置相同的issueId
+          let newIssueIdArr = [];
+          copyData.forEach((item, i, arr) => {
+            item.groupId = newId;
+            if (i === 0 || item.issueId !== arr[i - 1].issueId) {
+              newIssueIdArr.push(
+                newId + "-" + new Date().valueOf().toString() + "-" + i
+              ); //加索引 防重复
+            } else if (item.issueId === arr[i - 1].issueId) {
+              newIssueIdArr.push(newIssueIdArr[i - 1]);
+            }
+          });
+          copyData.forEach((item, i) => {
+            item.issueId = newIssueIdArr[i];
+          });
+          let copyGroupIndex;
+          this.scaleData.klScaleParent[tableIndex].klScaleSaveGroup.forEach(
+            (item, i) => {
+              if (item.groupId === groupId) {
+                copyGroupIndex = i;
+              }
+            }
+          );
+          this.scaleData.klScaleParent[tableIndex].klScaleSaveGroup.splice(
+            copyGroupIndex + 1,
+            0,
+            ...copyData
+          );
+          break;
       }
       }
     },
     },
     CHANGE_FORM_DATA(tableIndex, rowIndex, name, val) {
     CHANGE_FORM_DATA(tableIndex, rowIndex, name, val) {

+ 29 - 8
src/components/knowledgeExtra/AddAssess/scale-table.vue

@@ -106,9 +106,24 @@
         :span-method="objectSpanMethod"
         :span-method="objectSpanMethod"
         :ref="`scaleTableRef[${tableIndex}]`"
         :ref="`scaleTableRef[${tableIndex}]`"
       >
       >
-        <el-table-column prop="issueId" label="组" width="70px">
+        <el-table-column prop="issueId" label="组" width="90px">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <div class="btn_box">
             <div class="btn_box">
+              <div class="btn_div">
+                <img
+                  @click="
+                    $emit('CHANGE_TABLE_ROW', {
+                      type: 4,
+                      tableIndex,
+                      rowIndex: scope.$index,
+                      groupId: scope.row.groupId,
+                    })
+                  "
+                  src="@/images/icon-copy.png"
+                  alt=""
+                  title="复制"
+                />
+              </div>
               <div class="btn_div">
               <div class="btn_div">
                 <img
                 <img
                   @click="
                   @click="
@@ -119,8 +134,9 @@
                       groupId: scope.row.groupId
                       groupId: scope.row.groupId
                     })
                     })
                   "
                   "
-                  src="../../../images/add-new-rule-sub.png"
+                  src="@/images/add-new-rule-sub.png"
                   alt=""
                   alt=""
+                  title="添加"
                 />
                 />
               </div>
               </div>
               <div
               <div
@@ -135,14 +151,15 @@
                       groupId: scope.row.groupId
                       groupId: scope.row.groupId
                     })
                     })
                   "
                   "
-                  src="../../../images/add-new-rule-del.png"
+                  src="@/images/add-new-rule-del.png"
                   alt=""
                   alt=""
+                  title="删除"
                 />
                 />
               </div>
               </div>
             </div>
             </div>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
-        <el-table-column prop="groupId" label="问题" width="70px">
+        <el-table-column prop="groupId" label="问题" width="90px">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <div class="btn_box">
             <div class="btn_box">
               <div class="btn_div">
               <div class="btn_div">
@@ -156,8 +173,9 @@
                       issueId: scope.row.issueId
                       issueId: scope.row.issueId
                     })
                     })
                   "
                   "
-                  src="../../../images/add-new-rule-sub.png"
+                  src="@/images/add-new-rule-sub.png"
                   alt=""
                   alt=""
+                  title="添加"
                 />
                 />
               </div>
               </div>
               <div
               <div
@@ -177,8 +195,9 @@
                       issueId: scope.row.issueId
                       issueId: scope.row.issueId
                     })
                     })
                   "
                   "
-                  src="../../../images/add-new-rule-del.png"
+                  src="@/images/add-new-rule-del.png"
                   alt=""
                   alt=""
+                  title="删除"
                 />
                 />
               </div>
               </div>
             </div>
             </div>
@@ -316,8 +335,9 @@
                       issueId: scope.row.issueId
                       issueId: scope.row.issueId
                     })
                     })
                   "
                   "
-                  src="../../../images/add-new-rule-sub.png"
+                  src="@/images/add-new-rule-sub.png"
                   alt=""
                   alt=""
+                  title="添加"
                 />
                 />
               </div>
               </div>
               <div
               <div
@@ -332,8 +352,9 @@
                       rowIndex: scope.$index
                       rowIndex: scope.$index
                     })
                     })
                   "
                   "
-                  src="../../../images/add-new-rule-del.png"
+                  src="@/images/add-new-rule-del.png"
                   alt=""
                   alt=""
+                  title="删除"
                 />
                 />
               </div>
               </div>
             </div>
             </div>