reaper 4 years ago
parent
commit
2d199a7d96

+ 13 - 10
src/components/knowledgeExtra/AddAssess/ScoreResultsTable.vue

@@ -250,21 +250,24 @@ export default {
     };
   },
   methods: {
-    numInputInput(value, len = 6, decimals = 1) {
+    numInputInput(value, len = 5, decimals = 1) {
       // value:修改的数字  len 总长度   decimals:允许小数点后几位
-      //todo 5位数加一位小数
+      //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);
+        let [int, dec] = value.split(".");
+        if (dec.length > decimals) {
+          dec = dec.slice(0, dec.length - 1);
+        }
+        if (int.length > len) {
+          int = int.slice(0, int.length - 1);
+        }
+        return parseFloat(int + "." + dec);
+      }
+      if (value.length > len) {
+        value = value.slice(0, value.length - 1);
       }
-
       return parseFloat(value);
     },
     handleInput(val, i) {

+ 13 - 30
src/components/knowledgeExtra/AddAssess/index.vue

@@ -502,7 +502,6 @@ export default {
             name: "upfile",
             size: 1,
             sizeError: (err) => {
-              console.log("errrrrr", err);
               this.$message({
                 showClose: true,
                 message: "请上传 1M 以内的图片!",
@@ -555,39 +554,38 @@ export default {
     };
   },
   methods: {
-    numInputInput(value, len = 6, decimals = 1) {
+    numInputInput(value, len = 5, 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);
+        let [int, dec] = value.split(".");
+        if (dec.length > decimals) {
+          dec = dec.slice(0, dec.length - 1);
+        }
+        if (int.length > len) {
+          int = int.slice(0, int.length - 1);
+        }
+        return parseFloat(int + "." + dec);
+      }
+      if (value.length > len) {
+        value = value.slice(0, value.length - 1);
       }
-
       return parseFloat(value);
     },
     clearValidate(data) {
       this.$refs.ScoreResultsRef.clearValidate(data);
     },
     getDom(ref) {
-      console.log("getBoundingClientRect", document.getElementById(ref));
-      // const dom = this.getElementTop(document.getElementById(ref));
       let dom = document.getElementById(ref).getBoundingClientRect().top;
-      console.log("dom,dom", dom);
       return dom;
     },
     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;
@@ -904,7 +902,6 @@ export default {
             const top = document.getElementById(id).getBoundingClientRect().top;
             this.$emit("scrollTo", top);
             // `klScaleParent[${tableIndex}].content`
-            console.log(this.$refs[`klScaleParent[${tableIndex}].content`]);
             const inp = this.$refs[`klScaleParent[${tableIndex + 1}].content`];
             inp && inp[0].focus();
           }, 50);
@@ -1069,7 +1066,6 @@ export default {
             tableIndex
           ].klScaleSaveGroup.filter((item) => item.issueId === issueId);
           copyIssueData = JSON.parse(JSON.stringify(copyIssueData));
-          console.dir(copyIssueData);
           let newIssueIdArrIssue = [];
           copyIssueData.forEach((item, i, arr) => {
             if (i === 0 || item.issueId !== arr[i - 1].issueId) {
@@ -1121,7 +1117,6 @@ export default {
       }
     },
     resizeTable() {
-      console.log("!!!!");
       this.$nextTick(() => {
         this.$refs.ScaleTable.forEach((item) => {
           item.resizeTable();
@@ -1134,11 +1129,9 @@ export default {
     initText() {
       "upload";
       let quillArr;
-      console.log("this.$refs.scalequillEditor", this.$refs.scalequillEditor);
       if (this.$refs.scalequillEditor && this.$refs.scalequillEditor.length) {
         quillArr = this.$refs.scalequillEditor;
       }
-      console.log("s_quill", quillArr);
       // return;
       quillArr &&
         quillArr.forEach((item) => {
@@ -1146,27 +1139,22 @@ export default {
           quill.root.addEventListener(
             "paste",
             (evt) => {
-              console.log("evt", evt);
               if (
                 evt.clipboardData &&
                 evt.clipboardData.files &&
                 evt.clipboardData.files.length
               ) {
-                console.log("ddadada");
                 evt.preventDefault();
                 [].forEach.call(evt.clipboardData.files, (file) => {
-                  console.log("file", file);
                   if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i))
                     return;
                   if (file.size > 1024 * 1000) return;
                   let formData = new FormData();
                   formData.append("upfile", file);
                   api.uploadFile(formData).then((res) => {
-                    console.log("formData", res);
                     if (res.data.code == "0") {
                       let imgUrl = config.imgHost + res.data.data.url;
                       var range = quill.getSelection();
-                      console.log("range", range);
                       if (range) {
                         // this.uploadAttachment(res, file, null);
                         let length = quill.getSelection().index;
@@ -1214,17 +1202,12 @@ 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({

+ 13 - 10
src/components/knowledgeExtra/AddAssess/scale-table.vue

@@ -527,20 +527,24 @@ export default {
     };
   },
   methods: {
-    numInputInput(value, len = 6, decimals = 1) {
+    numInputInput(value, len = 5, 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);
+        let [int, dec] = value.split(".");
+        if (dec.length > decimals) {
+          dec = dec.slice(0, dec.length - 1);
+        }
+        if (int.length > len) {
+          int = int.slice(0, int.length - 1);
+        }
+        return parseFloat(int + "." + dec);
+      }
+      if (value.length > len) {
+        value = value.slice(0, value.length - 1);
       }
-
       return parseFloat(value);
     },
     changeDataFun(val, tableIndex, rowIndex, name) {
@@ -552,7 +556,6 @@ export default {
       });
     },
     resizeTable() {
-      console.log("???????");
       setTimeout(() => {
         this.tableData.forEach((item, index) => {
           this.$refs[

+ 0 - 15
src/components/knowledgeExtra/AddDevKnow.vue

@@ -499,10 +499,7 @@ export default {
   },
   methods: {
     scrollTo(dom) {
-      console.log("domTop", dom);
       var div = this.$refs["elscrollbar"].$refs["wrap"];
-      console.log("scrollTop-before", div.scrollTop);
-      console.log("domTop", dom);
       if (dom >= 0) {
         div.scrollTop += dom - 120;
       } else {
@@ -576,7 +573,6 @@ export default {
       this.form.selectedTermName = "";
       this.form.selectedTerm = "";
       this.form.titleChange = "";
-      // console.log('处理清空的操作');
     },
 
     handleMouseenter() {
@@ -856,7 +852,6 @@ export default {
         let fErrIndex = resArr.findIndex((item) => item == "f");
         let topErrIndex = resArr.findIndex((item) => item == "top");
         if (topErrIndex != -1) {
-          console.log("????");
           outIsVia = false;
           var div = this.$refs["elscrollbar"].$refs["wrap"];
           this.$nextTick(() => {
@@ -887,17 +882,13 @@ export default {
           this.$nextTick(() => {
             setTimeout(() => {
               let domTop = this.$refs.assessRef.getDom(cErrArr[0]);
-              console.log("domTop", domTop);
               var div = this.$refs["elscrollbar"].$refs["wrap"];
-              console.log("scrollTop-before", div.scrollTop);
-              console.log("domTop", domTop);
               if (domTop >= 0) {
                 div.scrollTop += domTop - 120;
               } else {
                 div.scrollTop -= Math.abs(domTop) + 120;
               }
 
-              console.log("scrollTop-after", div.scrollTop);
             }, 100);
           });
         } else if (cErrIndex == -1 && fErrIndex != -1) {
@@ -911,23 +902,18 @@ export default {
           assessRule = true;
         }
       });
-      console.log(this.staticTabShow, goOn);
       if (this.staticTabShow && !goOn) {
         setTimeout(() => {
           var div = this.$refs["elscrollbar"].$refs["wrap"];
           if (outIsVia) {
             // 外层校验通过,跳转至下层校验具体位置
-            console.log("div.scrollTop111", div.scrollTop);
-            console.log("viewHeightArr[0]", viewHeightArr[0]);
             let sTop = viewHeightArr[0].getBoundingClientRect().top;
-            console.log("sTop", sTop);
             this.$nextTick(() => {
               if (sTop >= 0) {
                 div.scrollTop += sTop - 120;
               } else {
                 div.scrollTop -= Math.abs(sTop) + 120;
               }
-              console.log("div.scrollTop--end", div.scrollTop);
             });
           } else {
             // 外层校验没通过,页面滚动到顶部
@@ -1017,7 +1003,6 @@ export default {
       // return;
       if (!this.isEdit) {
         // 新增页面
-        console.log("!!!");
         this.saveDisable = true;
         this.sendSaveOrEdit(param);
         return;