jiangping
2024-02-29 6b6f00cae647a1dae999a4a1a3b87512f16c76f6
admin/src/views/business/internalCompany.vue
@@ -16,9 +16,9 @@
<!--        </el-form>-->
        <!-- 表格和分页 -->
        <template v-slot:table-wrap>
            <ul class="toolbar" v-permissions="['business:company:create', 'business:company:delete']">
<!--                <li><el-button type="primary" v-permissions="['business:company:create']" @click="synchronous()">同步</el-button></li>-->
            <ul class="toolbar" v-permissions="['business:company:create', 'business:company:sync']">
                <li><el-button type="primary" v-permissions="['business:company:create']" @click="$refs.OperaInternalCompanyWindow.open('新建企业')">新建</el-button></li>
                <li><el-button type="primary"  v-permissions="['business:company:sync']" :loading="loading" @click="synchronous()">同步</el-button></li>
            </ul>
            <el-table
                v-loading="isWorking.search"
@@ -26,6 +26,7 @@
                stripe
                :tree-props="{children: 'childList'}"
                row-key="id"
                :expand-row-keys="[list && list.length > 0 ? list[0].id.toString() : '']"
                @selection-change="handleSelectionChange"
            >
<!--                <el-table-column type="selection" width="55"></el-table-column>-->
@@ -52,8 +53,9 @@
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
// import { companySync } from '@/api/business/company'
import { companySync } from '@/api/business/company'
import OperaInternalCompanyWindow from '@/components/business/OperaInternalCompanyWindow'
import { memberSync } from '@/api/business/member'
export default {
  name: 'internalCompany',
  extends: BaseTable,
@@ -61,6 +63,7 @@
  data () {
    return {
      // 搜索
      loading:false,
      searchForm: {
        type: 1
      },
@@ -92,13 +95,26 @@
        .finally(() => {
          this.isWorking.search = false
        })
    }
    },
    // 同步信息
    // async synchronous () {
    //   const message = await companySync({})
    //   this.$message.success(message)
    //   this.search()
    // }
    async synchronous () {
      this.$dialog.actionConfirm('操作确认提醒', '您确认同步全部信息吗?')
        .then(() => {
          this.loading = true
          companySync({})
            .then(res => {
              this.$tip.apiSuccess(res || '同步成功')
              this.search()
            })
            .catch(e => {
              this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.loading = false
            })
        })
        .catch(() => {})
    }
  }
}
</script>