瀏覽代碼

方案重置01

zsw007 3 年之前
父節點
當前提交
d411cb18d6
共有 2 個文件被更改,包括 92 次插入79 次删除
  1. 90 77
      src/components/cdssManage/hospital/Hospital.vue
  2. 2 2
      vue.config.js

+ 90 - 77
src/components/cdssManage/hospital/Hospital.vue

@@ -22,7 +22,7 @@
     <div class="contents">
       <el-table :data="list" border style="width: 100%">
         <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
-         <el-table-column :resizable="false" prop="id" label="医院ID"></el-table-column>
+        <el-table-column :resizable="false" prop="id" label="医院ID"></el-table-column>
         <el-table-column :resizable="false" prop="name" label="医院名称" show-overflow-tooltip></el-table-column>
         <el-table-column :resizable="false" prop="spell" label="医院名称拼音" show-overflow-tooltip></el-table-column>
         <el-table-column :resizable="false" prop="address" label="医院地址" show-overflow-tooltip></el-table-column>
@@ -40,7 +40,13 @@
           <template slot-scope="scope">
             <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
             <span style="margin:0 3px;">|</span>
-            <el-button @click="resetFildF(scope.row)" v-if="scope.row.id !== -1"  :style="scope.row.id !== -1? 'color: #48c5d7;' : 'color: #bfbfbf;'" type="text" size="small">方案重置</el-button>
+            <el-button
+              @click="resetFildF(scope.row)"
+              v-if="scope.row.id !== -1"
+              :style="scope.row.id !== -1? 'color: #48c5d7;' : 'color: #bfbfbf;'"
+              type="text"
+              size="small"
+            >方案重置</el-button>
             <el-button type="text" size="small" v-else disabled>方案重置</el-button>
             <span style="margin:0 3px;">|</span>
             <el-button
@@ -78,18 +84,18 @@
 </template>
 
 <script>
-import api from '@api/cdss.js';
-import config from '@api/config.js';
-import utils from '@api/utils.js';
+import api from "@api/cdss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
 
 export default {
-  name: 'HospitalCDSS',
+  name: "HospitalCDSS",
   data: function() {
     return {
       list: [],
       searched: false,
       filter: {
-        hospitalName: '' // 医院名称
+        hospitalName: "" // 医院名称
       },
       currentPage: 1,
       pageSize: config.pageSize,
@@ -140,9 +146,9 @@ export default {
 
     // 启用/禁用医院
     startOrEndHos(row, type) {
-      let msg = '';
+      let msg = "";
       let status = 1;
-      if (type === 'start') {
+      if (type === "start") {
         msg = `确定要启用${row.name}吗?`;
         status = 1;
       } else {
@@ -150,9 +156,9 @@ export default {
         status = 0;
       }
 
-      this.$alert(msg, '提示', {
-        confirmButtonText: '确定',
-        type: 'warning'
+      this.$alert(msg, "提示", {
+        confirmButtonText: "确定",
+        type: "warning"
       })
         .then(() => {
           api
@@ -161,12 +167,12 @@ export default {
               status: status
             })
             .then(res => {
-              if (res.data.code === '0') {
+              if (res.data.code === "0") {
                 this.getDataList();
                 this.$message({
                   showClose: true,
-                  message: '保存成功',
-                  type: 'success',
+                  message: "保存成功",
+                  type: "success",
                   duration: 1000
                 });
               }
@@ -181,13 +187,14 @@ export default {
       this.searched = true;
       const loading = this.$loading({
         lock: true,
-        text: 'Loading',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)'
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)"
       });
       api.getHospitalPageCDSS(params).then(res => {
         loading.close();
-        if (res.data.code === '0') {
+        console.log('数据列表???', res);
+        if (res.data.code === "0") {
           this.list = res.data.data && res.data.data.records;
         }
         this.total = res.data.data && res.data.data.total;
@@ -216,7 +223,7 @@ export default {
     // 获取医院下拉列表
     _getHospitalInfo() {
       api.getHospitalInfo().then(res => {
-        if (res.data.code === '0') {
+        if (res.data.code === "0") {
           this.HospitalInfoList = res.data.data;
         }
       });
@@ -235,7 +242,7 @@ export default {
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
       this.$router.push({
-        name: 'AddHospitalCDSS',
+        name: "AddHospitalCDSS",
         params: Object.assign(pam, {
           isEdit: false
         })
@@ -252,7 +259,7 @@ export default {
           }
         : { currentPage: this.currentPage, pageSize: this.pageSize };
       this.$router.push({
-        name: 'AddHospitalCDSS',
+        name: "AddHospitalCDSS",
         params: Object.assign(pam, {
           isEdit: true,
           data: { ...item }
@@ -267,7 +274,7 @@ export default {
     // 清空搜索参数
     clearFilter() {
       this.filter = {
-        hospitalName: ''
+        hospitalName: ""
       };
     },
 
@@ -281,16 +288,16 @@ export default {
       this.$message({
         showClose: true,
         message: msg,
-        type: type || 'warning'
+        type: type || "warning"
       });
     },
     showConfirmDialog(msg, resolve) {
-      this.$alert(msg, '提示', {
-        confirmButtonText: '删除',
+      this.$alert(msg, "提示", {
+        confirmButtonText: "删除",
         // cancelButtonText: '取消',
         // cancelButtonClass: 'cancelBtn',
         // confirmButtonClass: 'confirmC',
-        type: 'warning'
+        type: "warning"
       })
         .then(() => {
           resolve();
@@ -299,63 +306,69 @@ export default {
     },
     // 删除关联
     showDelDialog(row) {
-      // console.log(row); return 
-      this.showConfirmDialog(`医院删除后无法恢复,确定要删除${row.name}吗?`, () => {
-        api
-          .deleteHosRecordCDSS({ id: row.id })
-          .then(res => {
-            // console.log(res, '=============');
-            if (res.data.code == '0') {
-              if (!this.searched) {
-                //未点确认时清空搜索条件
-                this.clearFilter();
+      // console.log(row); return
+      this.showConfirmDialog(
+        `医院删除后无法恢复,确定要删除${row.name}吗?`,
+        () => {
+          api
+            .deleteHosRecordCDSS({ id: row.id })
+            .then(res => {
+              // console.log(res, '=============');
+              if (res.data.code == "0") {
+                if (!this.searched) {
+                  //未点确认时清空搜索条件
+                  this.clearFilter();
+                }
+                if (this.list.length == 1) {
+                  //当前在最后一页且只有一条数据时,删除后跳到前一页
+                  this.currentPage =
+                    this.currentPage === 1 ? 1 : this.currentPage - 1;
+                }
+                this.getDataList();
+                this._getHospitalInfo(); // 更新下拉列表
+                this.warning(res.data.msg || "操作成功", "success");
+              } else {
+                this.warning(res.data.msg);
               }
-              if (this.list.length == 1) {
-                //当前在最后一页且只有一条数据时,删除后跳到前一页
-                this.currentPage =
-                  this.currentPage === 1 ? 1 : this.currentPage - 1;
+            })
+            .catch(error => {
+              if (error.code === "900010001") {
+                return false;
               }
-              this.getDataList();
-              this._getHospitalInfo();  // 更新下拉列表
-              this.warning(res.data.msg || '操作成功', 'success');
-            } else {
-              this.warning(res.data.msg);
-            }
-          })
-          .catch(error => {
-            if (error.code === '900010001') {
-              return false;
-            }
-            this.warning(error);
-          });
-      });
+              this.warning(error);
+            });
+        }
+      );
     },
     // 方案重置
-    resetFildF(row){
-      this.$confirm(`此操作将重置${row.name}数据, 是否继续?`, '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
+    resetFildF(row) {
+      this.$confirm(`此操作将重置${row.name}数据, 是否继续?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
           api.getResetFildF({
-            id: row.id
-          })
-          .then(res => {
-            if(res.data.code === '0'){
-              this.getDataList()
+            hospitalId: row.id
+          }).then(res => {
+            console.log("重置数据", res);
+            const tokenStr = JSON.parse(localStorage.getItem("token"));
+            if (res.data.code === "0" && tokenStr) {
+              this.getDataList();
               this.$message({
-                  showClose: true,
-                  message: '重置成功',
-                  type: 'success',
-                  duration: 1000
-                });
+                showClose: true,
+                message: "重置成功",
+                type: "success",
+                duration: 1000
+              });
             }
-          })
-        }).catch(() => {
+          });
+        })
+        .catch(() => {
           this.$message({
-            type: 'info',
-            message: '已取消重置'
-          });          
+            type: "info",
+            message: "已取消重置"
+          });
         });
     }
   }
@@ -364,7 +377,7 @@ export default {
 
 
 <style lang="less" scoped>
-@import '../../../less/admin.less';
+@import "../../../less/admin.less";
 .delete {
   color: red;
 }

+ 2 - 2
vue.config.js

@@ -1,6 +1,6 @@
 const path = require('path');
-const proxy_path = 'http://192.168.2.241:88';
-// const proxy_path = 'http://192.168.2.236:5050';
+//const proxy_path = 'http://192.168.2.241:88';
+const proxy_path = 'http://192.168.2.236:5050';
 // 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'; //王峰