浏览代码

添加loading

xiaochan 1 月之前
父节点
当前提交
a471a1b06f
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/views/operate-monitoring/DeptOperateAnalyseByMonthly.vue

+ 8 - 1
src/views/operate-monitoring/DeptOperateAnalyseByMonthly.vue

@@ -16,6 +16,7 @@ const params = reactive({
 const store = reactive({
   templateTypeList: [],
   htmlData: "",
+  loading: false,
 });
 
 const rules = {
@@ -30,6 +31,7 @@ const renderTableRef = useCompShallowRef(RenderTable);
 const formRef = useCompShallowRef(ElForm);
 
 async function handleQueryBusiness(business) {
+  store.loading = true;
   const url = store.templateTypeList.find(
     item => item.code === params.templateType
   )?.url;
@@ -49,6 +51,9 @@ async function handleQueryBusiness(business) {
     })
     .catch(() => {
       return {};
+    })
+    .finally(() => {
+      store.loading = false;
     });
 }
 
@@ -103,7 +108,9 @@ onMounted(() => {
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button @click="handleQuery">查询</el-button>
+          <el-button @click="handleQuery" v-loading="store.loading"
+            >查询</el-button
+          >
         </el-form-item>
       </el-form>
     </header>