소스 검색

所有按钮点击时切换loading状态

刘洋 2 년 전
부모
커밋
cbe94d7d0e

+ 1 - 1
src/modules/admin-data/export/index.vue

@@ -3,7 +3,7 @@
     <div class="p-l-base p-t-medium-base fill-blank">
       <base-form ref="formRef" size="small" :rules="rules" :items="items" :model="model" :disabled="loading">
         <template #form-item-operation>
-          <el-button type="primary" @click="onSearch">查询</el-button>
+          <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           <el-button type="primary" custom-1 @click="onExport">导出</el-button>
         </template>
       </base-form>

+ 1 - 1
src/modules/admin-data/imformation-report/index.vue

@@ -3,7 +3,7 @@
     <div class="p-l-base p-t-medium-base fill-blank">
       <base-form ref="formRef" size="small" :items="items" :model="model">
         <template #form-item-operation>
-          <el-button type="primary" @click="onSearch">查询</el-button>
+          <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           <!-- <el-button type="primary" custom-1 @click="onExport">导出</el-button> -->
         </template>
       </base-form>

+ 10 - 2
src/modules/admin-data/task-setting/index.vue

@@ -13,7 +13,9 @@
           <span class="un-mark-count">{{ unMarkTasks?.unmarkCount ?? 0 }}</span>
         </template>
         <template #form-item-confirm>
-          <el-button type="primary" @click="onSubmit">{{ isGroupSetting ? '确认追加' : '确定' }}</el-button>
+          <el-button :loading="loading" type="primary" @click="onSubmit">{{
+            isGroupSetting ? '确认追加' : '确定'
+          }}</el-button>
         </template>
       </base-form>
       <div class="flex-1 overflow-hidden m-t-base">
@@ -215,24 +217,30 @@ const userIds = computed(() => {
 const onUserListChange = (list: ExtractMultipleApiResponse<'getUserList'>[]) => {
   userList.value = list || []
 }
-
+const loading = ref<boolean>(false)
 /** 按评卷员设置 */
 const onMarkerSetCount = async () => {
+  loading.value = true
   try {
     taskSettingModel.userId = userIds.value
     await useFetch('markerSetCount').fetch(taskSettingModel)
   } catch (error) {
     console.error(error)
+  } finally {
+    loading.value = false
   }
 }
 
 /** 按小组追加 */
 
 const onMarkGroupUpdateCount = async () => {
+  loading.value = true
   try {
     await useFetch('markGroupUpdateCount').fetch(taskSettingModel)
   } catch (error) {
     console.error(error)
+  } finally {
+    loading.value = false
   }
 }
 

+ 2 - 2
src/modules/admin-exam/edit-exam/index.vue

@@ -3,7 +3,7 @@
     <el-card shadow="never">
       <base-form ref="formRef" :label-width="useVW(160)" :items="items" :rules="rules" :model="model">
         <el-form-item>
-          <confirm-button @confirm="onSubmit" @cancel="back()"></confirm-button>
+          <confirm-button :loading="loading" @confirm="onSubmit" @cancel="back()"></confirm-button>
         </el-form-item>
       </base-form>
     </el-card>
@@ -31,7 +31,7 @@ const isEdit = !!props.id
 
 const { replace, back } = useRouter()
 
-const { fetch: saveExamInfo } = useFetch('saveExamInfo')
+const { fetch: saveExamInfo, loading } = useFetch('saveExamInfo')
 
 const initModel: ExtractApiParams<'saveExamInfo'> = {
   name: '',

+ 2 - 2
src/modules/admin-exam/manage/index.vue

@@ -3,7 +3,7 @@
     <div class="p-t-base p-l-base fill-blank">
       <base-form :items="items" :model="model" :label-width="useVW(88)" size="small">
         <template #form-item-button>
-          <el-button type="primary" @click="onSearch">查询</el-button>
+          <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           <el-button special @click="onCreateExam">创建考试</el-button>
         </template>
       </base-form>
@@ -67,7 +67,7 @@ const items: EpFormItem[] = [
   onRow({ slotName: 'button' }),
 ]
 
-const { data, fetchTable } = useTable('getExamList', model)
+const { data, fetchTable, loading } = useTable('getExamList', model)
 
 const columns: EpTableColumn<ExtractMultipleApiResponse<'getExamList'>>[] = [
   { prop: 'id', label: 'ID' },

+ 2 - 2
src/modules/admin-role/manage/index.vue

@@ -2,7 +2,7 @@
   <div class="flex direction-column full role-manage">
     <div class="flex items-center p-base fill-blank filter-form">
       <base-select v-model="role" size="small" :options="ROLE_OPTION" clearable></base-select>
-      <el-button class="m-l-base" size="small" type="primary" @click="onSearch">查询</el-button>
+      <el-button :loading="loading" class="m-l-base" size="small" type="primary" @click="onSearch">查询</el-button>
     </div>
     <div class="flex-1 p-base">
       <el-card table>
@@ -41,7 +41,7 @@ const columns: EpTableColumn[] = [
   { label: '操作', slotName: 'operation' },
 ]
 
-const { fetch, result: roleList } = useFetch('getRoleList')
+const { fetch, result: roleList, loading } = useFetch('getRoleList')
 
 async function onSearch() {
   fetch({ role: role.value })

+ 2 - 2
src/modules/admin-subject/manage/index.vue

@@ -3,7 +3,7 @@
     <div class="p-base p-t-medium-base p-b-medium-base fill-blank flex items-center">
       <span class="m-r-mini label">科目</span>
       <base-select v-model="model.code" clearable size="small" :options="subjectList"></base-select>
-      <el-button class="m-l-base" size="small" type="primary" @click="onSearch">查询</el-button>
+      <el-button :loading="loading" class="m-l-base" size="small" type="primary" @click="onSearch">查询</el-button>
       <el-button class="m-l-mini" size="small" type="primary" special @click="onAddMainQuestion">新增</el-button>
     </div>
     <div class="flex-1 p-base">
@@ -75,7 +75,7 @@ const { subjectList, forceRefresh } = useOptions(['subject'], {}, true, null)
 
 const model = reactive({ code: '' })
 
-const { data, fetchTable } = useTable('getSubjectList', model)
+const { data, fetchTable, loading } = useTable('getSubjectList', model)
 
 const columns: EpTableColumn<ExtractMultipleApiResponse<'getSubjectList'>>[] = [
   { label: '科目代码', prop: 'code' },

+ 1 - 1
src/modules/admin-user/manage/index.vue

@@ -16,7 +16,7 @@
         :items="formItems"
       >
         <template #form-item-button-group>
-          <el-button type="primary" @click="onSearch">查询</el-button>
+          <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           <span class="m-l-auto">
             <el-button link custom-1 @click="toggleExpand">
               更多

+ 2 - 2
src/modules/analysis/monitoring/index.vue

@@ -2,7 +2,7 @@
   <div class="flex direction-column full analysis-monitor-view">
     <div class="flex items-center justify-end p-l-base p-r-base fill-blank view-header">
       <div class="pointer circle-button" custom-1 @click="toggleSetting(true)"><svg-icon name="setting" /></div>
-      <el-button type="primary" @click="onRefresh">刷新</el-button>
+      <el-button type="primary" :loading="loading" @click="onRefresh">刷新</el-button>
     </div>
     <div class="flex flex-1 p-base scroll-y-auto">
       <div class="flex justify-around data-card-view">
@@ -272,7 +272,7 @@ const toggleSetting = (visible: boolean) => {
 
 const interval = computed(() => fetchModel.refresh * 60 * 1000)
 
-const { fetch, result } = useFetch('getStatistics')
+const { fetch, result, loading } = useFetch('getStatistics')
 
 const getData = (data: ExtractRecordValue<ExtractApiResponse<'getStatistics'>>, hasAll: boolean) => {
   return data?.slice(0, hasAll ? 4 : 3).concat(data?.slice(hasAll ? 4 : 3).slice(-3)) || []

+ 1 - 1
src/modules/analysis/statistics/index.vue

@@ -3,7 +3,7 @@
     <div class="p-l-base p-t-medium-base fill-blank">
       <base-form :disabled="loading" size="small" :label-width="useVW(60)" :model="model" :items="formItems">
         <template #form-item-operation>
-          <el-button :loading="loading" type="primary" @click="onRefresh">刷新</el-button>
+          <el-button :disabled="loading" :loading="loading" type="primary" @click="onRefresh">刷新</el-button>
         </template>
       </base-form>
     </div>

+ 2 - 2
src/modules/expert/assess/index.vue

@@ -24,7 +24,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(52)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -200,7 +200,7 @@ const columns: EpTableColumn<RowType>[] = [
   { label: '提交时间', prop: 'createTime' },
 ]
 
-const { fetch: getExpertAssessList, result: rfSampleList } = useFetch('getExpertAssessList')
+const { fetch: getExpertAssessList, result: rfSampleList, loading } = useFetch('getExpertAssessList')
 
 const {
   tableRef,

+ 2 - 2
src/modules/expert/expert/index.vue

@@ -24,7 +24,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(72)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -260,7 +260,7 @@ const columns: EpTableColumn<RowType>[] = [
   { label: '提交时间', prop: 'createTime' },
 ]
 
-const { fetch: getExpertPickList, result: expertPaperList } = useFetch('getExpertPickList')
+const { fetch: getExpertPickList, result: expertPaperList, loading } = useFetch('getExpertPickList')
 
 const {
   tableRef,

+ 2 - 2
src/modules/expert/sample/index.vue

@@ -24,7 +24,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(52)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -178,7 +178,7 @@ const columns: EpTableColumn<RowType>[] = [
   { label: '提交时间', prop: 'createTime' },
 ]
 
-const { fetch: getRfSampleList, result: rfSampleList } = useFetch('getRfSampleList')
+const { fetch: getRfSampleList, result: rfSampleList, loading } = useFetch('getRfSampleList')
 
 const {
   tableRef,

+ 2 - 2
src/modules/expert/standard/index.vue

@@ -16,7 +16,7 @@
       <div class="flex direction-column p-base radius-base fill-blank scroll-auto m-l-base table-view">
         <base-form ref="formRef" size="small" :model="formModel" :items="formItems" :label-width="useVW(52)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -165,7 +165,7 @@ const columns: EpTableColumn<RowType>[] = [
   { label: '提交时间', prop: 'createTime' },
 ]
 
-const { fetch: getStandardList, result: standardList } = useFetch('getStandardList')
+const { fetch: getStandardList, result: standardList, loading } = useFetch('getStandardList')
 
 const {
   tableRef,

+ 2 - 2
src/modules/expert/training/index.vue

@@ -22,7 +22,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(52)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -169,7 +169,7 @@ const columns: EpTableColumn<RowType>[] = [
   { label: '提交时间', prop: 'createTime' },
 ]
 
-const { fetch: getSampleList, result: sampleList } = useFetch('getSampleList')
+const { fetch: getSampleList, result: sampleList, loading } = useFetch('getSampleList')
 
 const { tableRef, tableData, current, next: checkNext, onCurrentChange } = useTableCheck(sampleList)
 

+ 2 - 2
src/modules/marking/arbitration/index.vue

@@ -29,7 +29,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(72)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :disabled="loading" :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -192,7 +192,7 @@ const columns: EpTableColumn[] = [
   { label: '大组长客主比', prop: 'chiefRatio', width: 45 },
 ]
 
-const { fetch: getArbitrationList, result: arbitrationList } = useFetch('getArbitrationList')
+const { fetch: getArbitrationList, result: arbitrationList, loading } = useFetch('getArbitrationList')
 
 const {
   tableRef,

+ 7 - 3
src/modules/marking/assess/index.vue

@@ -15,7 +15,7 @@
       <div class="flex-1 radius-base fill-blank tree-card">
         <div class="flex items-center justify-between">
           <span>选择评卷员</span>
-          <el-button size="small" type="primary" @click="onHandOutForceCheck">分发考核卷</el-button>
+          <el-button :loading="loading" size="small" type="primary" @click="onHandOutForceCheck">分发考核卷</el-button>
         </div>
         <div class="flex direction-column m-t-extra-base p-base radius-base fill-lighter tree-box">
           <el-input v-model="filterText" placeholder="输入评卷员账号或名称筛选" clearable></el-input>
@@ -35,7 +35,7 @@
     <div class="flex direction-column radius-base fill-blank table-card">
       <div class="flex items-center justify-between">
         <span>分发进度</span>
-        <el-button size="small" special @click="onSearch">查询</el-button>
+        <el-button :loading="tableLoading" size="small" special @click="onSearch">查询</el-button>
       </div>
       <base-table class="flex-1" size="small" :columns="columns" :data="handOutProgressList">
         <template #empty>
@@ -211,7 +211,11 @@ const columns: EpTableColumn<ExtractApiResponse<'getHandOutProgressList'>>[] = [
   { label: '总量', prop: 'totalCount' },
 ]
 
-const { fetch: getHandOutProgressList, result: handOutProgressList } = useFetch('getHandOutProgressList')
+const {
+  fetch: getHandOutProgressList,
+  result: handOutProgressList,
+  loading: tableLoading,
+} = useFetch('getHandOutProgressList')
 
 const onSearch = async () => {
   try {

+ 5 - 1
src/modules/marking/inquiry/index.vue

@@ -20,7 +20,11 @@
     <base-dialog v-model="visible" title="快捷查询命名">
       <el-input v-model="shortName"></el-input>
       <template #footer>
-        <confirm-button @confirm="onSetCustomQueryConfig" @cancel="toggleVisible(false)"></confirm-button>
+        <confirm-button
+          :loading="saving"
+          @confirm="onSetCustomQueryConfig"
+          @cancel="toggleVisible(false)"
+        ></confirm-button>
       </template>
     </base-dialog>
   </div>

+ 2 - 2
src/modules/marking/problem/index.vue

@@ -31,7 +31,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(78)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -221,7 +221,7 @@ const columns: EpTableColumn[] = [
   { label: '处理时间', prop: 'solveTime', width: 45 },
 ]
 
-const { fetch: getProblemHistory, result: problemHistory } = useFetch('getProblemHistory')
+const { fetch: getProblemHistory, result: problemHistory, loading } = useFetch('getProblemHistory')
 
 const {
   tableRef,

+ 2 - 2
src/modules/marking/repeat/index.vue

@@ -39,7 +39,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(80)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -197,7 +197,7 @@ const columns: EpTableColumn[] = [
   { label: '确认给分', prop: 'confirmScore', width: 72 },
 ]
 
-const { fetch: getReMarkPaperList, result: reMarkPaperList } = useFetch('getReMarkPaperList')
+const { fetch: getReMarkPaperList, result: reMarkPaperList, loading } = useFetch('getReMarkPaperList')
 
 const {
   tableRef,

+ 2 - 2
src/modules/marking/similar/index.vue

@@ -18,7 +18,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -138,7 +138,7 @@ const columns: EpTableColumn<RowType>[] = [
   },
 ]
 
-const { fetch: getSimilarPaperList, result: similarPaperList } = useFetch('getSimilarPaperList')
+const { fetch: getSimilarPaperList, result: similarPaperList, loading } = useFetch('getSimilarPaperList')
 
 const {
   tableRef,

+ 2 - 2
src/modules/marking/statistics/index.vue

@@ -3,7 +3,7 @@
     <div class="p-t-base p-l-base fill-blank">
       <base-form :items="items" :model="model" :label-width="useVW(80)" size="small">
         <template #form-item-button>
-          <el-button type="primary" @click="onSearch">查询</el-button>
+          <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
         </template>
       </base-form>
     </div>
@@ -57,7 +57,7 @@ const items: EpFormItem[] = [
   }),
 ]
 
-const { fetch: getPersonalStatistic, result } = useFetch('getPersonalStatistic')
+const { fetch: getPersonalStatistic, result, loading } = useFetch('getPersonalStatistic')
 
 const columns: EpTableColumn<ExtractApiResponse<'getPersonalStatistic'>>[] = [
   { label: '评卷员', prop: 'markerName' },

+ 2 - 2
src/modules/monitor/system-check/index.vue

@@ -27,7 +27,7 @@
       <div class="flex direction-column p-base radius-base fill-blank m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(52)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -234,7 +234,7 @@ const columns: EpTableColumn[] = [
   { label: '抽查次数', prop: 'checkCount', width: 45 },
 ]
 
-const { fetch: getSystemSpotList, result: systemSpotList } = useFetch('getSystemSpotList')
+const { fetch: getSystemSpotList, result: systemSpotList, loading } = useFetch('getSystemSpotList')
 
 const {
   tableRef,

+ 2 - 2
src/modules/quality/self-check/index.vue

@@ -3,7 +3,7 @@
     <div class="p-l-base p-t-medium-base fill-blank">
       <base-form size="small" :label-width="useVW(66)" :model="model" :items="items">
         <template #form-item-search>
-          <el-button type="primary" @click="onSearch">查询</el-button>
+          <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
         </template>
       </base-form>
     </div>
@@ -110,7 +110,7 @@ const items = computed<EpFormItem[]>(() => {
   ]
 })
 
-const { fetch: selfCheckAnalysis, result: selfCheckAnalysisList } = useFetch('selfCheckAnalysis')
+const { fetch: selfCheckAnalysis, result: selfCheckAnalysisList, loading } = useFetch('selfCheckAnalysis')
 
 const { onCurrentChange: onCheckSelfCheckAnalysis, current: currentSelfCheckAnalysis } =
   useTableCheck(selfCheckAnalysisList)

+ 1 - 1
src/modules/quality/spot-check/index.vue

@@ -3,7 +3,7 @@
     <div class="p-l-base p-t-medium-base fill-blank">
       <base-form size="small" :items="items" :model="model" :disabled="loading">
         <template #form-item-operation>
-          <el-button type="primary" @click="onSearch">查询</el-button>
+          <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
         </template>
       </base-form>
     </div>

+ 2 - 2
src/modules/quality/subjective-check/index.vue

@@ -25,7 +25,7 @@
       <div class="p-base radius-base fill-blank scroll-auto m-l-base table-view">
         <base-form size="small" :model="formModel" :items="formItems" :label-width="useVW(80)">
           <template #form-item-search>
-            <el-button type="primary" @click="onSearch">查询</el-button>
+            <el-button :loading="loading" type="primary" @click="onSearch">查询</el-button>
           </template>
         </base-form>
         <div>
@@ -243,7 +243,7 @@ const subColumns: EpTableColumn<RowType>[] = [
   { label: '修改成绩', prop: 'headerScore' },
 ]
 
-const { fetch: getSubjectiveCheckList, result: subjectiveCheckList } = useFetch('getSubjectiveCheckList')
+const { fetch: getSubjectiveCheckList, result: subjectiveCheckList, loading } = useFetch('getSubjectiveCheckList')
 
 const {
   tableRef,