浏览代码

数据添加

reaper 4 年之前
父节点
当前提交
a5114612d3
共有 3 个文件被更改,包括 53 次插入28 次删除
  1. 9 8
      src/components/knowledgeExtra/AddAssess/index.vue
  2. 42 18
      src/components/knowledgeExtra/AddDevKnow.vue
  3. 2 2
      vue.config.js

+ 9 - 8
src/components/knowledgeExtra/AddAssess/index.vue

@@ -718,14 +718,15 @@ export default {
         });
       });
       console.log(123);
-      Promise.all([valid1, valid2])
-        .then(() => {
-          console.log("allllll");
-          console.dir(this.formtParams());
-        })
-        .catch(() => {
-          console.log("fillllll");
-        });
+      return [valid1, valid2];
+      // Promise.all([valid1, valid2])
+      //   .then(() => {
+      //     console.log("allllll");
+      //     console.dir(this.formtParams());
+      //   })
+      //   .catch(() => {
+      //     console.log("fillllll");
+      //   });
     },
     /**
      * 增/删/得分结果表格

+ 42 - 18
src/components/knowledgeExtra/AddDevKnow.vue

@@ -136,20 +136,17 @@
                 </div>
               </el-form-item>
             </el-form>
-            <div class="btn">
-              <el-button
-                type="primary"
-                :disabled="saveDisable"
-                @click="submitForm"
-                >确 定</el-button
-              >
-            </div>
           </div>
         </el-tab-pane>
         <el-tab-pane label="评估内容" name="two">
           <AddAssess ref="assessRef" />
         </el-tab-pane>
       </el-tabs>
+      <div class="btn">
+        <el-button type="primary" :disabled="saveDisable" @click="submitForm"
+          >确 定</el-button
+        >
+      </div>
     </div>
   </el-scrollbar>
 </template>
@@ -162,6 +159,7 @@ import DevInfo from "./DevInfo";
 import config from "@api/config";
 import $ from "jquery";
 import AddAssess from "./AddAssess";
+import { resolve } from "path";
 
 export default {
   name: "AddDevKnow",
@@ -171,6 +169,7 @@ export default {
   },
   data() {
     return {
+      toAssesTermId: null,
       isFixedTop: true,
       isEdit: false,
       isCopy: false,
@@ -409,6 +408,8 @@ export default {
     },
     changeWord(newVal) {
       // console.log(newVal, '选中');
+      console.log("newVal", newVal);
+      this.toAssesTermId = newVal.id;
       this.showType = newVal.type || -1;
       const name = newVal.name;
       const typeName = newVal.typeName;
@@ -585,10 +586,7 @@ export default {
       }
     },
 
-    submitForm() {
-      // 评估内容验证 --wanglei
-      this.$refs.assessRef.assessCommit();
-      // end....
+    async submitForm() {
       if (this.isSuccessUpload === 1) {
         this.warning("文件上传中,请稍等");
         return;
@@ -599,13 +597,30 @@ export default {
       let goOn = true,
         it = null;
       let outIsVia = true; // 外层验证是否通过
-      this.$refs.groups.validate((valid) => {
-        if (!valid) {
+
+      let validate = new Promise((resolve, reject) => {
+        //wanglei 添加promise
+        this.$refs.groups.validate((valid) => {
+          if (!valid) {
+            reject();
+            return false;
+          } else {
+            resolve();
+          }
+        });
+      });
+
+      // 三个表单校验,需全部通过后让goOn outIsVia 为true;
+      await Promise.all([...this.$refs.assessRef.assessCommit(), validate])
+        .then(() => {
+          console.log("allllll");
+        })
+        .catch(() => {
+          console.log("fillllll");
           goOn = false;
           outIsVia = false;
-          return false;
-        }
-      });
+        });
+      // end....
       //验证段落表单
       let viewHeight = 0; // 定位到表单校验的高度
       let viewHeightArr = []; // 表单校验出错高度的所有数组
@@ -685,6 +700,13 @@ export default {
       }
       // this.showSaveDialog(param,'是否'+(this.isEdit?'修改':'保存')+'该静态知识?');
 
+      // 评估内容的数据
+      const assessParam = this.$refs.assessRef.formtParams();
+      param.scale = assessParam;
+      param.scale.conceptId = this.toAssesTermId;
+      param.scale.modifier = '';  //fix lei 字段暂时未知
+      console.log("param-------");
+      console.dir(param);
       if (!this.isEdit) {
         // 新增页面
         this.saveDisable = true;
@@ -916,7 +938,9 @@ export default {
 }
 .btn {
   text-align: right;
-  padding-right: 20px;
+  margin: 0 20px;
+  padding: 30px;
+  background: #fff;
 }
 .el-message-box {
   /deep/ .el-icon-warning {

+ 2 - 2
vue.config.js

@@ -1,7 +1,7 @@
 const path = require('path');
-// const proxy_path = 'http://192.168.2.236:80';
+const proxy_path = 'http://192.168.2.236:80';
 // const proxy_path = 'http://192.168.2.241:88';
-const proxy_path = 'http://192.168.2.236:88';
+// const proxy_path = 'http://192.168.2.236:88';
 // const proxy_path = 'http://192.168.3.101:5050';
 // const proxy_path = 'http://192.168.3.117:5050';//周铁刚
 // const proxy_path = 'http://192.168.3.113:5050'; //王峰