Bella 2 жил өмнө
parent
commit
7a00e95364

+ 23 - 2
src/views/servicesManagement/allServices.vue

@@ -1,5 +1,11 @@
 <template>
-  <div class="content">
+  <div
+    class="content"
+    v-loading="loading"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+  >
     <el-input
       class="search"
       v-model="input"
@@ -64,12 +70,13 @@
                 ? 'info'
                 : 'danger'
             "
+            @click="changeStatus(scope.row)"
           >
             {{
               scope.row.status == "1"
                 ? "安装"
                 : scope.row.status == "2"
-                ? "未配置"
+                ? "已安装"
                 : "卸载"
             }}
           </el-button>
@@ -83,6 +90,7 @@
 </template>
 
 <script>
+import publicFunc from "@/utils/publicFunc";
 import checkbox from "@/components/Checkbox/index";
 import page from "@/components/pagination/index";
 import { getServiceList } from "@/api/service/service";
@@ -94,6 +102,7 @@ export default {
       show: true,
       form: {},
       tableData: [],
+      loading: false,
       // tableData: [
       //   {
       //     photo:
@@ -139,6 +148,17 @@ export default {
     this.initData();
   },
   methods: {
+    changeStatus(data) {
+      console.log(data);
+      if (data.status === "1") {
+        this.loading = true
+        setTimeout(()=>{
+          this.tableData.find((item) => item.id === data.id).status = "2";
+          this.loading = false
+        },3000)
+        
+      }
+    },
     handleSelectionChange() {
       //
     },
@@ -151,6 +171,7 @@ export default {
         if (res.data.code === 0) {
           res.data.data.forEach((v) => {
             this.tableData.push({
+              id: publicFunc.buildGuid("service"),
               updatetime: "2023-01-01 00:00",
               name: v.name,
               introduction: v.introduction,