浏览代码

fix:解决首页一直显示加载中的问题,增加导入权限

liuzl 2 年之前
父节点
当前提交
a19a62d53a
共有 1 个文件被更改,包括 26 次插入16 次删除
  1. 26 16
      src/views/base/partners/index.vue

+ 26 - 16
src/views/base/partners/index.vue

@@ -63,7 +63,13 @@
               @click="$refs.edit.open(queryForm.partnerId)">
               添加
             </el-button>
-            <el-button icon="el-icon-download" type="primary" @click="downloadTemplate">下载模板</el-button>
+            <el-button
+              v-permissions="['base:product:import']"
+              icon="el-icon-download"
+              type="primary"
+              @click="downloadTemplate">
+              下载模板
+            </el-button>
             <el-upload
               ref="uploadRef"
               action="#"
@@ -76,7 +82,7 @@
               :http-request="uploadrequest"
               :show-file-list="false"
               style="margin: 0 10px 10px 0 !important">
-              <el-button icon="el-icon-upload2" type="primary">导入</el-button>
+              <el-button v-permissions="['base:product:import']" icon="el-icon-upload2" type="primary">导入</el-button>
             </el-upload>
           </vab-query-form-left-panel>
           <vab-query-form-right-panel>
@@ -145,7 +151,7 @@
     data() {
       return {
         list: [],
-        listLoading: true,
+        listLoading: false,
         layout: 'total, sizes, prev, pager, next, jumper',
         total: 0,
         queryForm: {
@@ -218,7 +224,6 @@
     },
     methods: {
       async treeHandle(command, node) {
-        console.log(command, node, '111111111')
         if (command == 'edit') {
           this.addCompany(node)
         } else if (command == 'del') {
@@ -246,24 +251,29 @@
       async getCompanyList() {
         const [err, res] = await to(partnerApi.getCompanyList({}))
         if (err) return
-        if (res.code == 200 && res.data.list.length > 0) {
+        if (res.code == 200) {
           this.companyList = res.data.list || []
-          //默认第一选中
-          this.$nextTick(() => {
-            this.$refs.tree.setCurrentKey(res.data.list[0].id)
-            this.queryForm.partnerId = res.data.list[0].id
-            this.fetchData()
-          })
+          if (res.data.list.length > 0) {
+            //默认第一选中
+            this.$nextTick(() => {
+              this.$refs.tree.setCurrentKey(res.data.list[0].id)
+              this.queryForm.partnerId = res.data.list[0].id
+              this.fetchData()
+            })
+          }
         }
       },
       async fetchData() {
+        console.log(1111111)
         this.listLoading = true
-        const {
-          data: { list, total },
-        } = await partnerApi.getCompanyConcatList(this.queryForm)
-        this.list = list
-        this.total = total
+        const [err, res] = await to(partnerApi.getCompanyConcatList(this.queryForm))
         this.listLoading = false
+        console.log(this.listLoading)
+        if (err) return
+        if (res.code == 200) {
+          this.total = res.data.total
+          this.list = res.data.list || []
+        }
       },
 
       addCompany(node) {