Prechádzať zdrojové kódy

等级评估部分功能

chenminghua 3 rokov pred
rodič
commit
977389ff91

+ 19 - 6
src/views/HealthControl/assess/assessconfig.vue

@@ -27,8 +27,13 @@
         top="15vh"
         custom-class="modal"
         :close-on-click-modal="false"
+        :before-close="onClickDialogClose"
       >
-        <popup-create :data="editform" :station="stations"/>
+        <popup-create
+          :data="editform"
+          :station="stations"
+          @onClick="onClickComplete"
+        />
       </el-dialog>
     </div>
   </div>
@@ -105,9 +110,13 @@ export default {
     onClickSearch() {
       this.requestList();
     },
+    // 弹窗右上角关闭按钮
+    onClickDialogClose() {
+      this.isvisiable = false;
+      this.editform = {};
+    },
     // 操作按钮
     onClickOption(e, row) {
-      console.log(row)
       let that = this;
       if ("delete" == e.target.getAttribute("value")) {
         that
@@ -118,10 +127,14 @@ export default {
           .catch((_) => {});
       }
       if ("edit" == e.target.getAttribute("value")) {
-        that.isvisiable = true
+        that.isvisiable = true;
         that.editform = row;
       }
     },
+    onClickComplete(value) {
+      this.isvisiable = false;
+      this.requestList();
+    },
     // 获取模型数据列表
     requestList() {
       let that = this;
@@ -144,7 +157,7 @@ export default {
         },
       });
     },
-    requestStations(){
+    requestStations() {
       let that = this;
       that.API.requestData({
         method: "GET",
@@ -153,8 +166,8 @@ export default {
           let array = [];
           res.data.forEach((item) => {
             if (item.id.indexOf("FDC") !== -1) {
-              array.push(item)
-            } 
+              array.push(item);
+            }
           });
           that.stations = array;
         },

+ 30 - 21
src/views/HealthControl/assess/compoenets/popupcreate.vue

@@ -14,7 +14,6 @@
             <div class="search-input item-content">
               <el-select
                 v-model="form.wpids"
-                @change="onChangeStation(form.wpids)"
                 multiple
                 collapse-tags
                 popper-class="select"
@@ -34,7 +33,6 @@
             <div class="search-input item-content">
               <el-select
                 v-model="form.timetypes"
-                @change="onChangeStation(form.timetypes)"
                 multiple
                 popper-class="select"
               >
@@ -51,11 +49,7 @@
           <div class="query-item flex-row">
             <div class="lable item-name">是否启用:</div>
             <div class="search-input item-content">
-              <el-select
-                v-model="form.isenable"
-                @change="onChangeStation(form.isenable)"
-                popper-class="select"
-              >
+              <el-select v-model="form.isenable" popper-class="select">
                 <el-option
                   v-for="item in enables"
                   :key="item.value"
@@ -77,6 +71,8 @@
 </template>
 
 <script>
+import axios from "axios";
+
 export default {
   name: "popup-create",
   props: {
@@ -94,6 +90,10 @@ export default {
       ],
     };
   },
+  // 自定义事件
+  emits: {
+    onClick: null,
+  },
   created() {
     this.stations = this.station;
     this.form = this.convertArray(this.data);
@@ -106,27 +106,36 @@ export default {
       this.requestSave();
     },
     requestSave() {
-      let that = this;
-      that.API.requestData({
-        method: "POST",
-        baseURL: "http://10.155.32.4:8034/",
-        subUrl: "/evaluation/saveModelMain",
-        data: {
-          name: that.form.name,
-          wpids: that.form.wpids,
-          timetypes: that.form.timetypes,
-          createdate: new Date(),
-          isenable: that.form.isenable,
-        },
-        success(res) {
-          console.log(res);
+      if (this.form.name == undefined) return;
+      let params = {
+        name: this.form.name,
+        wpids: this.form.wpids.toString(),
+        timetypes: this.form.timetypes.toString(),
+        isenable: this.form.isenable,
+      };
+      if (this.form.id) {
+        params.id = this.form.id;
+      }
+
+      axios({
+        method: "post",
+        url: "http://10.155.32.4:8034/evaluation/saveModelMain/",
+        data: params,
+        header: {
+          "Content-Type": "application/json",
         },
+      }).then((res) => {
+        if (res.data.success) {
+          this.form = {};
+          this.$emit("onClick", true);
+        }
       });
     },
     convertArray(form) {
       if (form.wpids != undefined && form.timetypes != undefined) {
         form.wpids = form.wpids.split(",");
         form.timetypes = form.timetypes.split(",");
+        form.isenable = form.isenable == "是" ? 1 : 0;
       }
       return form;
     },