Explorar el Código

2021-12-17 设备删除太慢了,加了个 loading

East hace 3 años
padre
commit
60671e25f9

+ 2 - 2
src/utils/chenApi.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-18 13:40:39
- * @LastEditTime: 2021-12-14 08:48:14
+ * @LastEditTime: 2021-12-17 10:21:52
  * @LastEditors: Please set LastEditors
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \hyyfClient\src\utils\chenApi.js
@@ -295,7 +295,7 @@ export function getAlarmInfo(params) {
 // 设备概况
 export function getDeviceSummer(params) {
   return axios({
-    url: 'http://120.27.234.126:8010/device/farm/device/getCountDeviceFailureRate',
+    url: '/admin/farm/device/getCountDeviceFailureRate',
     method: 'get',
     params: params
   })

+ 11 - 3
src/views/DeviceMana/Device.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-12-07 14:27:28
- * @LastEditTime: 2021-12-16 09:48:19
+ * @LastEditTime: 2021-12-17 10:26:32
  * @LastEditors: Please set LastEditors
  * @Description: 设备管理页面
  * @FilePath: \hyyfClient\src\views\DeviceMana\Device.vue
@@ -11,7 +11,7 @@
     <div class="manage-items">
       <manage-item
         v-for="(item, index) in manageItems"
-        :key="item.key"
+        :key="item.title"
         v-bind="item"
       >
         <template #icon>
@@ -141,6 +141,7 @@ export default {
         this.$message.warning("请选中设备再删除");
         return;
       }
+
       let ids = "";
       if (flag) {
         const items = [];
@@ -155,9 +156,16 @@ export default {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
       }).then(async () => {
+        const loading = this.$loading({
+          lock: true,
+          text: "加载中...",
+          spinner: "el-icon-loading",
+          background: "rgba(0, 0, 0, 0.7)",
+        });
         const res = await postDeviceDel({
-          ids: ids,
+          id: ids,
         });
+        loading.close();
         this.reflash();
         if (res.code === 10000) {
           this.$message.success("删除成功");

+ 2 - 2
src/views/DeviceMana/device/AddOrEdit.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-12-08 09:57:19
- * @LastEditTime: 2021-12-09 16:07:27
+ * @LastEditTime: 2021-12-17 09:59:52
  * @LastEditors: Please set LastEditors
  * @Description: 设备详情 - 新增 or 编辑 设备 的 dialog
  * @FilePath: \hyyfClient\src\views\DeviceMana\device\AddOrEdit.vue
@@ -120,7 +120,7 @@ export default {
       }
       request({ ...this.form }).then((res) => {
         if (res.code === 10000) {
-          this.$message.success(`${this.form.id ? "添加" : "修改"}成功`);
+          this.$message.success(`${this.form.id ? "修改" : "添加"}成功`);
           this.handleCancel();
           this.$emit("reflash");
         }