Bladeren bron

bug-730:适宜技术协定方和专家适宜技术增加启用禁用状态

张田田 1 week geleden
bovenliggende
commit
30e9ff25b7
3 gewijzigde bestanden met toevoegingen van 77 en 1 verwijderingen
  1. 18 0
      src/api/technology.js
  2. 30 1
      src/views/business/LocalExpertTech.vue
  3. 29 0
      src/views/business/SuitableTech.vue

+ 18 - 0
src/api/technology.js

@@ -61,6 +61,24 @@ export function deleteSuitableTech(data) {
   });
 }
 
+// 适宜技术协定方启用/禁用
+export function changeSuitableTechStatus(data) {
+  return request({
+    url: "/basis/suitableTechnologyAccordMgr/changeStatus",
+    method: "post",
+    data,
+  });
+}
+
+// 本地专家适宜技术启用/禁用
+export function changeLocalExpertTechStatus(data) {
+  return request({
+    url: "/basis/localExpertSuitableTechnologyMgr/changeStatus",
+    method: "post",
+    data,
+  });
+}
+
 // 本地适宜技术协定方列表
 export function getLocalSuitableTechList(data) {
   return request({

+ 30 - 1
src/views/business/LocalExpertTech.vue

@@ -92,6 +92,17 @@
             <el-table-column prop="cardType" label="证型" width="120" align="center"></el-table-column>
             <el-table-column prop="westernDisease" label="西医病名" width="120" align="center"></el-table-column>
             <el-table-column prop="expert" label="专家" width="100" align="center"></el-table-column>
+            <el-table-column prop="status" label="应用" width="90" align="center">
+              <template slot-scope="scope">
+                <el-switch
+                  :value="scope.row.status === 0"
+                  :disabled="scope.row.createUser != currentUserId"
+                  active-color="#5386f6"
+                  inactive-color="#dcdfe6"
+                  @change="handleStatusChange(scope.row, $event)"
+                ></el-switch>
+              </template>
+            </el-table-column>
             <el-table-column label="操作" width="180" align="center">
               <template slot-scope="scope">
                 <div class="flex-center">
@@ -401,7 +412,7 @@ import {
   getSymptomListMethod as getSymptomListMethodApi,
   getTherapyListMethod as getTherapyListMethodApi,
 } from "@/request/api";
-import { getLocalSuitableTechList, deleteLocalSuitableTech, saveLocalSuitableTech, getLocalSuitableTechInfo, getMappedNondrugItemList } from "@/api/technology.js";
+import { getLocalSuitableTechList, deleteLocalSuitableTech, saveLocalSuitableTech, getLocalSuitableTechInfo, getMappedNondrugItemList, changeLocalExpertTechStatus } from "@/api/technology.js";
 import { getXDiseaseName } from "@/api/knowledge.js";
 import SuitableTechDetail from "./components/SuitableTechDetail.vue";
 
@@ -466,6 +477,12 @@ export default {
       viewData: {},
     }
   },
+  computed: {
+    currentUserId() {
+      const userInfo = this.$store.state.user.userInfo || {};
+      return userInfo.pid;
+    },
+  },
   created() {
     this.getList()
   },
@@ -723,6 +740,18 @@ export default {
     handleExpandChange(row, expandedRows) {
       this.expandRows = expandedRows.map(item => item.pid)
     },
+    async handleStatusChange(row, val) {
+      const status = val ? 0 : 1;
+      try {
+        const res = await changeLocalExpertTechStatus({ pid: row.pid, status });
+        if (res.ResultCode === 0) {
+          this.$message.success(status === 0 ? '已启用' : '已禁用');
+          row.status = status;
+        }
+      } catch (e) {
+        this.$message.error('操作失败');
+      }
+    },
     formatDetailList(row) {
       const parts = []
       const extractNames = (arr) => {

+ 29 - 0
src/views/business/SuitableTech.vue

@@ -234,6 +234,22 @@
                 {{ scope.row.purposeType === "1" ? "是" : "否" }}
               </template>
             </el-table-column>
+            <el-table-column
+              prop="status"
+              label="应用"
+              width="90"
+              align="center"
+            >
+              <template slot-scope="scope">
+                <el-switch
+                  :value="scope.row.status === 0"
+                  :disabled="scope.row.createUser != currentUserId"
+                  active-color="#5386f6"
+                  inactive-color="#dcdfe6"
+                  @change="handleStatusChange(scope.row, $event)"
+                ></el-switch>
+              </template>
+            </el-table-column>
             <el-table-column
               prop="createUserName"
               label="创建者"
@@ -617,6 +633,7 @@ import {
   saveSuitableTech,
   deleteSuitableTech,
   getMappedNondrugItemList,
+  changeSuitableTechStatus,
 } from "@/api/technology.js";
 import { getXDiseaseName } from "@/api/knowledge.js";
 
@@ -1035,6 +1052,18 @@ export default {
     handleExpandChange(row, expandedRows) {
       this.expandRows = expandedRows.map((item) => item.pid);
     },
+    async handleStatusChange(row, val) {
+      const status = val ? 0 : 1;
+      try {
+        const res = await changeSuitableTechStatus({ pid: row.pid, status });
+        if (res.ResultCode === 0) {
+          this.$message.success(status === 0 ? '已启用' : '已禁用');
+          row.status = status;
+        }
+      } catch (e) {
+        this.$message.error('操作失败');
+      }
+    },
     formatTreatClass(val) {
       const map = {
         1: "艾灸疗法",