Browse Source

Merge branch 'feature/add-sync-btn' into 'develop'

Feature/add sync btn

See merge request dcuc-tjdsj/auth-web!56
林倩 3 năm trước cách đây
mục cha
commit
d54180776a

+ 10 - 8
src/api/sync.js

@@ -25,9 +25,19 @@ export const dataSourceSyncUrl = `${baseUrl}/dataClaSync`
 
 // 字段分级分类同步
 export const fieldSortSyncUrl = `${baseUrl}/fieldClaSync`
+
 // 人员同步
 export const userSyncUrl = `${baseUrl}/userSync`
 
+// 人员增量同步
+export const userAddSyncUrl = `${baseUrl}/userAddSync`
+
+// 机构同步
+export const orgSyncUrl = `${baseUrl}/orgSync`
+
+// 机构增量同步
+export const orgAddSyncUrl = `${baseUrl}/orgAddSync`
+
 
 
 export function sync(url) {
@@ -46,11 +56,3 @@ export function appSync() {
 }
 
 
-// 机构同步
-export function authOrgSync() {
-    return request({
-        url: `${baseUrl}/orgSync`,
-        method: "GET"
-    });
-}
-

+ 1 - 0
src/components/operate-bar/index.vue

@@ -13,6 +13,7 @@
       @click="handleSubmitPageOpt(item)"
       >{{ item }}</dg-button
     >
+     <slot></slot>
   </dg-row>
 </template>
 

+ 21 - 6
src/pages/auth-subject-manage/org-prop-manage/index.vue

@@ -16,7 +16,20 @@
 
     <div class="buttonGroup">
       <dg-button type="primary" @click="handleImport" icon="el-icon-upload2">导入</dg-button>
-      <dg-button type="primary" @click="handleSynchro" icon="el-icon-refresh">同步</dg-button>
+        <dg-button
+        type="primary"
+        @click="handleSync(orgSyncUrl)"
+        icon="el-icon-refresh"
+        v-permission="'QXGL_SQGL_ZTGL_JGTB'"
+        >同步</dg-button
+      >
+      <dg-button
+        type="primary"
+        @click="handleSync(orgAddSyncUrl)"
+        icon="el-icon-refresh"
+        v-permission="'QXGL_SQGL_ZTGL_JGZLTB'"
+        >增量同步</dg-button
+      >
     </div>
 
     <dg-row gutter="1rem">
@@ -61,7 +74,7 @@
 import Tree from '@/components/tree';
 import { orgDetail } from '../DataConfig';
 import { orgInfoDetail } from '@/api/data-auth';
-import { authOrgSync } from '@/api/sync';
+import { sync, orgAddSyncUrl, orgSyncUrl } from '@/api/sync';
 import importFile from '@/components/import';
 import { orgImportUrl } from '@/api/import';
 export default {
@@ -73,7 +86,9 @@ export default {
       formInfo: {},
       keyword: '',
       currentId: '',
-      key: 0
+      key: 0,
+      orgAddSyncUrl,
+      orgSyncUrl
     };
   },
   computed: {}, // 计算属性
@@ -109,10 +124,10 @@ export default {
     /**
      * @description:同步方法,假同步
      */
-    handleSynchro() {
-      authOrgSync().then((res) => {
+    handleSync(url) {
+      sync(url).then((res) => {
         this.$message.success('同步中,若数据量大,可能会存在延迟,请稍后自行刷新!');
-        this.handleSearch();
+        // this.handleSearch();
       });
     },
     /**

+ 18 - 5
src/pages/auth-subject-manage/user-prop-manage/index.vue

@@ -10,7 +10,18 @@
     <!-- 搜索项 -->
     <search-bar ref="searchbar" :conditionForm="conditionForm" @submitSearch="receiveSearch"></search-bar>
     <!-- 操作栏 -->
-    <operate-bar :pageOptList="pageOptList" @submitPageOpt="receviceOpt"></operate-bar>
+    <operate-bar :pageOptList="pageOptList" @submitPageOpt="receviceOpt">
+      <dg-button type="primary" @click="receviceOpt('同步')" icon="el-icon-refresh" v-permission="'QXGL_SQGL_ZTGL_RYTB'"
+        >同步</dg-button
+      >
+      <dg-button
+        type="primary"
+        @click="receviceOpt('增量同步')"
+        icon="el-icon-refresh"
+        v-permission="'QXGL_SQGL_ZTGL_RYZLTB'"
+        >增量同步</dg-button
+      >
+    </operate-bar>
     <!-- 表格 -->
     <new-table ref="table" :tableUrl="tableUrl" :tableHeader="UserTableData" :condition="condition">
       <!-- 单位名称 -->
@@ -54,9 +65,9 @@
 
 <script>
 import newTable from '@/components/new-table';
-import { UserTableData, userPropConditionForm, pageOptList } from '../DataConfig';
+import { UserTableData, userPropConditionForm } from '../DataConfig';
 import { authUserTableUrl } from '@/api/data-auth';
-import { userSyncUrl } from '@/api/sync';
+import { userSyncUrl, userAddSyncUrl } from '@/api/sync';
 import baseApi from '@/api/jz-base';
 import detail from './detail';
 import { userImportUrl } from '@/api/import';
@@ -76,7 +87,7 @@ export default {
       conditionForm: userPropConditionForm,
       UserTableData,
       tableUrl: authUserTableUrl,
-      pageOptList,
+      pageOptList: ['导入'],
       LatestSyncTime: ''
     };
   },
@@ -86,8 +97,10 @@ export default {
     receviceOpt(type) {
       if (type == '导入') {
         this.handleImport(userImportUrl, 'user');
-      } else if (type == '同步') {
+      }  else if (type == '同步') {
         this.handleSync(userSyncUrl);
+      } else if (type == '增量同步') {
+        this.handleSync(userAddSyncUrl);
       }
     },
     /**