reaper před 4 roky
rodič
revize
b5dddc865b

+ 23 - 14
src/components/knowledgeExtra/AddAssess/ScoreResultsTable.vue

@@ -151,13 +151,9 @@
                     :id="`scoreresultsdatas[${scope.$index}].content.min`"
                     @input="
                       handleInput($event, scope.$index);
-                      value = scope.row.content.min + '';
-                      if (value.length > 6) value = value.slice(0, 6);
-                      if (value.length == 0) {
-                        scope.row.content.min = null;
-                        return;
-                      }
-                      scope.row.content.min = parseFloat(value);
+                      scope.row.content.min = numInputInput(
+                        scope.row.content.min
+                      );
                     "
                     v-model.number="scope.row.content.min"
                     clearable
@@ -184,13 +180,9 @@
                     :id="`scoreresultsdatas[${scope.$index}].content.max`"
                     @input="
                       handleInput($event, scope.$index);
-                      value = scope.row.content.max + '';
-                      if (value.length > 6) value = value.slice(0, 6);
-                      if (value.length == 0) {
-                        scope.row.content.max = null;
-                        return;
-                      }
-                      scope.row.content.max = parseFloat(value);
+                      scope.row.content.max = numInputInput(
+                        scope.row.content.max
+                      );
                     "
                     v-model.number="scope.row.content.max"
                     clearable
@@ -258,6 +250,23 @@ export default {
     };
   },
   methods: {
+    numInputInput(value, len = 6, decimals = 1) {
+      // value:修改的数字  len 总长度   decimals:允许小数点后几位
+      //todo 5位小数加一位小数
+      value += "";
+      if (value.length > len) value = value.slice(0, len);
+      if (value.length == 0) {
+        return null;
+      }
+      let index = value.lastIndexOf(".");
+      if (index != -1) {
+        index += 1;
+        let str = value.slice(0, index + decimals);
+        return parseFloat(str);
+      }
+
+      return parseFloat(value);
+    },
     handleInput(val, i) {
       // `scoreresultsdatas[${scope.$index}].content.min`
       this.$emit("clearValidate", [

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

@@ -234,15 +234,7 @@ it .ql-editor,
                     type="number"
                     maxlength="6"
                     v-model.number="table.factor"
-                    @input="
-                      value = table.factor + '';
-                      if (value.length > 6) value = value.slice(0, 6);
-                      if (value.length == 0) {
-                        table.factor = null;
-                        return;
-                      }
-                      table.factor = parseFloat(value);
-                    "
+                    @input="table.factor = numInputInput(table.factor)"
                   />
                 </el-form-item>
                 <el-form-item
@@ -258,15 +250,7 @@ it .ql-editor,
                     type="number"
                     maxlength="6"
                     v-model.number="table.constant"
-                    @input="
-                      value = table.constant + '';
-                      if (value.length > 6) value = value.slice(0, 6);
-                      if (value.length == 0) {
-                        table.constant = null;
-                        return;
-                      }
-                      table.constant = parseFloat(value);
-                    "
+                    @input="table.constant = numInputInput(table.constant)"
                   />
                 </el-form-item>
               </div>
@@ -571,6 +555,22 @@ export default {
     };
   },
   methods: {
+    numInputInput(value, len = 6, decimals = 1) {
+      // value:修改的数字  len 总长度   decimals:允许小数点后几位
+      value += "";
+      if (value.length > len) value = value.slice(0, len);
+      if (value.length == 0) {
+        return null;
+      }
+      let index = value.lastIndexOf(".");
+      if (index != -1) {
+        index += 1;
+        let str = value.slice(0, index + decimals);
+        return parseFloat(str);
+      }
+
+      return parseFloat(value);
+    },
     clearValidate(data) {
       this.$refs.ScoreResultsRef.clearValidate(data);
     },

+ 23 - 23
src/components/knowledgeExtra/AddAssess/scale-table.vue

@@ -275,6 +275,7 @@
               <el-form-item
                 :prop="`klScaleParent[${tableIndex}].klScaleSaveGroup[${scope.$index}].two_factor`"
                 :rules="rules.issueFactor"
+                :show-message="false"
               >
                 <el-input
                   type="number"
@@ -287,13 +288,7 @@
                       scope.$index,
                       'two_factor'
                     );
-                    value = scope.row.two_factor + '';
-                    if (value.length > 6) value = value.slice(0, 6);
-                    if (value.length == 0) {
-                      scope.row.two_factor = null;
-                      return;
-                    }
-                    scope.row.two_factor = parseFloat(value);
+                    scope.row.two_factor = numInputInput(scope.row.two_factor);
                   "
                 ></el-input>
               </el-form-item>
@@ -311,6 +306,7 @@
               <el-form-item
                 :prop="`klScaleParent[${tableIndex}].klScaleSaveGroup[${scope.$index}].two_constant`"
                 :rules="rules.issueConstant"
+                :show-message="false"
               >
                 <el-input
                   type="number"
@@ -325,13 +321,9 @@
                       scope.$index,
                       'two_constant'
                     );
-                    value = scope.row.two_constant + '';
-                    if (value.length > 6) value = value.slice(0, 6);
-                    if (value.length == 0) {
-                      scope.row.two_constant = null;
-                      return;
-                    }
-                    scope.row.two_constant = parseFloat(value);
+                    scope.row.two_constant = numInputInput(
+                      scope.row.two_constant
+                    );
                   "
                 ></el-input>
               </el-form-item>
@@ -457,15 +449,7 @@
                 :id="`klScaleParent[${tableIndex}].klScaleSaveGroup[${scope.$index}].score`"
                 type="number"
                 maxlength="6"
-                @input="
-                  value = scope.row.score + '';
-                  if (value.length > 6) value = value.slice(0, 6);
-                  if (value.length == 0) {
-                    scope.row.score = null;
-                    return;
-                  }
-                  scope.row.score = parseFloat(value);
-                "
+                @input="scope.row.score = numInputInput(scope.row.score)"
                 v-model.number="scope.row.score"
                 clearable
                 placeholder="请输入"
@@ -543,6 +527,22 @@ export default {
     };
   },
   methods: {
+    numInputInput(value, len = 6, decimals = 1) {
+      // value:修改的数字  len 总长度   decimals:允许小数点后几位
+      value += "";
+      if (value.length > len) value = value.slice(0, len);
+      if (value.length == 0) {
+        return null;
+      }
+      let index = value.lastIndexOf(".");
+      if (index != -1) {
+        index += 1;
+        let str = value.slice(0, index + decimals);
+        return parseFloat(str);
+      }
+
+      return parseFloat(value);
+    },
     changeDataFun(val, tableIndex, rowIndex, name) {
       this.$emit("CHANGE_ISSUE_CONTENT", {
         value: val,

+ 58 - 25
src/components/knowledgeExtra/AddDevKnow.vue

@@ -98,7 +98,7 @@
               评估内容
               <img
                 v-if="!staticTabShow"
-                @click.stop="staticTabShow = true"
+                @click.stop="handleAssesTab"
                 src="@/images/tab_add.png"
                 alt=""
               />
@@ -359,25 +359,20 @@ export default {
     }
   },
   created: function () {
-    const loading = this.$loading({
-      lock: true,
-      text: "Loading",
-      spinner: "el-icon-loading",
-      background: "rgba(0, 0, 0, 0.7)"
-    });
     const { isEdit, data, isCopy } = this.$route.params;
     if (isEdit || isCopy) {
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)"
+      });
       this.showType = data.type; // 编辑页确认显示类型
       this.isEdit = isEdit;
       this.isCopy = isCopy;
       this.title = isEdit ? "修改" : isCopy ? "复制" : "添加";
       (isEdit || isCopy) && this.changeWord(data);
-      if (isCopy) {
-        const _this = this;
-        setTimeout(() => {
-          _this.handleClear();
-        }, 300);
-      }
+
       api
         .getBaseRecordById({ id: data.id })
         .then((res) => {
@@ -416,6 +411,9 @@ export default {
                 data.name + (data.typeName ? "(" + data.typeName + ")" : "");
               this.form.selectedTerm =
                 data.name + (data.typeName ? "(" + data.typeName + ")" : "");
+              if (isCopy) {
+                this.handleClear();
+              }
               if (data.details.length) {
                 this.form.prags =
                   data &&
@@ -511,6 +509,34 @@ export default {
         div.scrollTop -= Math.abs(dom) + 120;
       }
     },
+    handleAssesTab() {
+      this.staticTabShow = true;
+      this.form = {
+        conceptId: "", //术语id
+        isTip: 0, //是否要覆盖,0不覆盖,1覆盖
+        selectedTerm: "", //术语标签
+        termType: "",
+        typeId: "",
+        selectedTermName: "",
+        selectedTermType: "",
+        // titleChange: '',
+        fileList: [],
+        name: "",
+        prags: [
+          {
+            //单个段落相关
+            title: "",
+            content: "",
+            isReason: 0,
+            orderNo: 0,
+            position: [],
+            text: ""
+          }
+        ],
+        fileTitle: "",
+        titleChange: ""
+      };
+    },
     closeStaticTab() {
       this.$alert("确定要删除该标签?删除后该标签内容将会被清空!", "提示", {
         confirmButtonText: "确定",
@@ -565,6 +591,7 @@ export default {
       if (newVal.typeName == "量表") {
         this.AssesComSHow = true;
       } else {
+        this.staticTabShow = true;
         this.AssesComSHow = false;
         this.tabActive = "one";
       }
@@ -752,6 +779,18 @@ export default {
       let viewHeight = 0; // 定位到表单校验的高度
       let viewHeightArr = []; // 表单校验出错高度的所有数组
       let outIsVia = true; // 外层验证是否通过
+      let fvalidate1 = new Promise((resolve, reject) => {
+        //wanglei 添加promise
+        this.$refs.groups1.validate((valid, object) => {
+          if (valid) {
+            resolve(true);
+          } else {
+            reject("top", object);
+            return false;
+          }
+        });
+      });
+      all.push(fvalidate1);
       if (this.staticTabShow) {
         if (this.isSuccessUpload === 1) {
           this.warning("文件上传中,请稍等");
@@ -773,21 +812,11 @@ export default {
               }
             });
         });
-        let fvalidate1 = new Promise((resolve, reject) => {
-          //wanglei 添加promise
-          this.$refs.groups1.validate((valid, object) => {
-            if (valid) {
-              resolve(true);
-            } else {
-              reject("top", object);
-              return false;
-            }
-          });
-        });
+
         // end....
         //验证段落表单
         // return;
-        all = [fvalidate, fvalidate1];
+        all.push(fvalidate);
         if (this.form.typeId !== 82 && this.form.typeId !== 83) {
           for (let i = 0; i < this.$refs.subForm.length; i++) {
             all.push(
@@ -829,6 +858,10 @@ export default {
         if (topErrIndex != -1) {
           console.log("????");
           outIsVia = false;
+          var div = this.$refs["elscrollbar"].$refs["wrap"];
+          this.$nextTick(() => {
+            div.scrollTop = 0;
+          });
         } else if (cErrIndex != -1 && fErrIndex != -1) {
           if (this.staticTabShow) {
             goOn = false;