MrShi
2025-08-19 ff087240b3dee29ce4e14ad0836e76b9fdf312cf
admin/src/views/business/company.vue
@@ -4,9 +4,16 @@
      <ul class="toolbar" v-permissions="['business:company:create', 'business:company:sync']">
        <li><el-button type="primary" v-permissions="['business:company:create']" :loading="loading"  @click="synchronous()">全量同步企业微信组织</el-button></li>
      </ul>
      <el-table :height="tableHeightNew" v-loading="isWorking.search" :data="list" stripe
                :tree-props="{ children: 'childList', hasChildren: 'hasChildren' }" row-key="id"
                @selection-change="handleSelectionChange" default-expand-all>
      <el-table :height="tableHeightNew"
                v-loading="isWorking.search"
                :data="list"
                stripe
                lazy
                :load="loadData"
                :tree-props="{ children: 'childList', hasChildren: 'hasChildren' }"
                row-key="id"
                @selection-change="handleSelectionChange"
                :default-expand-all="false">
        <el-table-column prop="name" label="组织名称" min-width="100px"></el-table-column>
        <el-table-column prop="namePath" label="组织路径" min-width="100px"></el-table-column>
        <el-table-column prop="qwId" label="企业微信标识" min-width="100px"></el-table-column>
@@ -21,7 +28,7 @@
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import { companySync } from '@/api/business/company'
import {allList, companySync} from '@/api/business/company'
export default {
  name: 'internalCompany',
  extends: BaseTable,
@@ -48,11 +55,12 @@
  },
  methods: {
    // 页码变更处理
    handlePageChange (pageIndex) {
    handlePageChange (pid) {
      this.__checkApi()
      this.isWorking.search = true
      this.api.treeList({})
      this.api.allList({parentId:pid})
        .then(data => {
          console.log(data)
          this.list = data
        })
        .catch(e => {
@@ -62,6 +70,20 @@
          this.isWorking.search = false
        })
    },
    // 获取子级数据
    loadData (row, treeNode, resolve) {
      console.log(row, treeNode)
      this.api.allList({parentId: row.id})
          .then(data => {
            resolve(data)
          })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
          .finally(() => {
            this.isWorking.search = false
          })
    },
    // 同步信息
    async synchronous () {
      this.$dialog.actionConfirm(' 您确认同步全部信息吗?', '操作确认提醒')