Zhenxing.Lu 16 stundas atpakaļ
vecāks
revīzija
52f9377196
2 mainītis faili ar 26 papildinājumiem un 9 dzēšanām
  1. 7 1
      src/api/wechat/server.ts
  2. 19 8
      src/views/wechat/wx/index.vue

+ 7 - 1
src/api/wechat/server.ts

@@ -9,7 +9,8 @@ enum Api {
   GetServerList = '/wechat-api/server/list',
   DeleteServer = '/wechat-api/server/delete',
   GetServerById = '/wechat-api/server',
-  RefreshWorkPhone = '/wechat-api/workphone/wxaccount/refresh'
+  RefreshWorkPhone = '/wechat-api/workphone/wxaccount/refresh',
+  RefreshQxWorkPhone = '/wechat-api/workphone/Qxaccount/refresh',
 }
 
 /**
@@ -78,3 +79,8 @@ export const RefreshWorkPhone = (errorMessageMode: ErrorMessageMode = 'notice')
     url: Api.RefreshWorkPhone
   }, { errorMessageMode })
 }
+export const RefreshQxWorkPhone = (errorMessageMode: ErrorMessageMode = 'notice') => {
+  return defHttp.post<BaseDataResp<ServerInfo>>({
+    url: Api.RefreshQxWorkPhone
+  }, { errorMessageMode })
+}

+ 19 - 8
src/views/wechat/wx/index.vue

@@ -2,8 +2,11 @@
   <div>
     <BasicTable @register="registerTable" :loading="loading">
       <template #toolbar v-if="permCode === '001'">
-        <a-button type="primary" @click="handleRefresh" :loading="refreshLoading" :disabled="refreshLoading">
-          {{ t('wechat.wx.refreshWorkPhone') }}
+        <a-button type="primary" @click="handleRefreshWorkPhone" :loading="refreshWorkPhoneLoading" :disabled="refreshWorkPhoneLoading">
+          同步企微
+        </a-button>
+        <a-button type="primary" @click="handleRefreshWxWorkPhone" :loading="refreshWxWorkPhoneLoading" :disabled="refreshWxWorkPhoneLoading">
+          同步个微
         </a-button>
         <a-button type="primary" @click="handleCreate">
           {{ t('wechat.wx.addWx') }}
@@ -217,7 +220,7 @@
   import { getPermCode } from '@/api/sys/user';
   import { useDrawer } from '@/components/Drawer';
   import WxDrawer from './WxDrawer.vue';
-  import { getServerList, RefreshWorkPhone } from '@/api/wechat/server';
+  import { getServerList, RefreshWorkPhone, RefreshQxWorkPhone } from '@/api/wechat/server';
   import { getContactList } from '@/api/wechat/contact';
   import { useI18n } from 'vue-i18n';
 
@@ -245,7 +248,8 @@
   const blackWhiteModalVisible = ref(false);
   const tokenVisible = ref(false);
   const loading = ref(false); // 添加 loading 状态
-  const refreshLoading = ref(false);
+  const refreshWorkPhoneLoading = ref(false);
+  const refreshWxWorkPhoneLoading = ref(false);
   const recordId = ref(undefined);
   const blackWhiteForm = reactive({
     allowList: [],
@@ -478,11 +482,18 @@
       isUpdate: !isUpdate.value,
     });
   }
-  // 同步工作手机
-  async function handleRefresh() {
-    refreshLoading.value = true
+  // 同步个微
+  async function handleRefreshWorkPhone() {
+    refreshWorkPhoneLoading.value = true
+    await RefreshQxWorkPhone()
+    refreshWorkPhoneLoading.value = false
+    reload()
+  }
+  // 同步企微
+  async function handleRefreshWxWorkPhone() {
+    refreshWxWorkPhoneLoading.value = true
     await RefreshWorkPhone()
-    refreshLoading.value = false
+    refreshWxWorkPhoneLoading.value = false
     reload()
   }
   function handleSwitchChange(checked, event) {