shaogen1995 4 лет назад
Родитель
Сommit
1ccca0c4bd
3 измененных файлов с 41 добавлено и 83 удалено
  1. 8 18
      src/views/collect/collect0.vue
  2. 1 1
      src/views/collect/collect0_look.vue
  3. 32 64
      src/views/holding/holding3.vue

+ 8 - 18
src/views/collect/collect0.vue

@@ -47,6 +47,7 @@
             <el-button style="margin: 0 20px 0" @click="inquire">查询</el-button>
 <!-- 导出 -->
 <download-excel
+      :before-generate="derive"
       class = "export-excel-wrapper"
       :data = "json_data"
       :fields = "json_fields"
@@ -199,11 +200,8 @@ export default {
   watch: {},
   // 方法集合
   methods: {
-    // 点击查询
-    async inquire () {
-      this.mydata.pageNum = 1
-      this.getHolding3List(this.mydata)
-      // 根据查询条件得到所有符合条件的给导出
+    // 点击导出
+    async derive () {
       const res = await getHolding3List({ ...this.mydata, pageNum: 1, pageSize: 99999 })
       this.json_data = res.data.list
       this.json_data.forEach(v => {
@@ -217,6 +215,11 @@ export default {
         else if (v.textureType === 1) v.textureType = '复合质地'
       })
     },
+    // 点击查询
+    async inquire () {
+      this.mydata.pageNum = 1
+      this.getHolding3List(this.mydata)
+    },
     // 分页器
     currentChange (val) {
       // console.log('当前页改变了', val)
@@ -278,19 +281,6 @@ export default {
     this.getHolding3List(this.mydata)
     // 显示图还是表格
     this.tabInd = this.INtabInd
-    // 进页面拿到所有数据,给导出
-    const res = await getHolding3List({ pageNum: 1, pageSize: 99999 })
-    this.json_data = res.data.list
-    this.json_data.forEach(v => {
-      v.numTypeId = this.mycategory(v.numTypeId)
-      if (v.amountType === 0) v.amountType = '单件'
-      else if (v.amountType === 1) v.amountType = '一套多件'
-      v.integrity = this.spoil(v.integrity)
-      v.repair = this.mySave(v.repair)
-      v.level = this.myWwjb(v.level)
-      if (v.textureType === 0) v.textureType = '单一质地'
-      else if (v.textureType === 1) v.textureType = '复合质地'
-    })
   },
   beforeCreate () {}, // 生命周期 - 创建之前
   beforeMount () {}, // 生命周期 - 挂载之前

+ 1 - 1
src/views/collect/collect0_look.vue

@@ -478,7 +478,7 @@ export default {
       const temp2 = temp.role[0]
       if (temp2 === 'sys_admin' || temp2 === 'sys_collect') {
         this.userLogo = true
-      } // 超级管理员和保管部主任
+      } // 超级管理员和征集部主任
     }
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)

+ 32 - 64
src/views/holding/holding3.vue

@@ -47,6 +47,7 @@
             <el-button style="margin: 0 20px 0" @click="inquire">查询</el-button>
 <!-- 导出 -->
 <download-excel
+      :before-generate="derive"
       class = "export-excel-wrapper"
       :data = "json_data"
       :fields = "json_fields"
@@ -221,11 +222,9 @@ export default {
   watch: {},
   // 方法集合
   methods: {
-    // 点击查询
-    async inquire () {
-      this.mydata.pageNum = 1
-      this.getHolding3List(this.mydata)
-      // 根据查询条件得到所有符合条件的给导出
+
+    // 点击导出
+    async derive () {
       const res = await getHolding3List({ ...this.mydata, pageNum: 1, pageSize: 99999 })
       this.json_data = res.data.list
       this.json_data.forEach(v => {
@@ -252,6 +251,7 @@ export default {
             }
           }
         })
+
         v.numTypeId = this.mycategory(v.numTypeId)
         if (v.amountType === 0) v.amountType = '单件'
         else if (v.amountType === 1) v.amountType = '一套多件'
@@ -262,6 +262,11 @@ export default {
         else if (v.textureType === 1) v.textureType = '复合质地'
       })
     },
+    // 点击查询
+    async inquire () {
+      this.mydata.pageNum = 1
+      this.getHolding3List(this.mydata)
+    },
     // 分页器
     currentChange (val) {
       // console.log('当前页改变了', val)
@@ -289,28 +294,28 @@ export default {
       this.tableData = res.data.list
       this.tableData.forEach(v => {
       // 位置信息处理
-        this.options.forEach(p => {
-        // eslint-disable-next-line
-          if(p.id== v.storageId.split(',')[0]) {
-            if (p.children) {
-              v.myweizhi = p.name
-              p.children.forEach(p2 => {
-              // eslint-disable-next-line
-                  if(p2.id==v.storageId.split(',')[1]) {
-                  if (p2.children) {
-                    v.myweizhi += '/' + p2.name
-                    p2.children.forEach(p3 => {
-                    // eslint-disable-next-line
-                            if (p3.id == v.storageId.split(',')[2]) {
-                        v.myweizhi += '/' + p3.name
-                      }
-                    })
-                  }
-                }
-              })
-            }
-          }
-        })
+        // this.options.forEach(p => {
+        // // eslint-disable-next-line
+        //   if(p.id== v.storageId.split(',')[0]) {
+        //     if (p.children) {
+        //       v.myweizhi = p.name
+        //       p.children.forEach(p2 => {
+        //       // eslint-disable-next-line
+        //           if(p2.id==v.storageId.split(',')[1]) {
+        //           if (p2.children) {
+        //             v.myweizhi += '/' + p2.name
+        //             p2.children.forEach(p3 => {
+        //             // eslint-disable-next-line
+        //                     if (p3.id == v.storageId.split(',')[2]) {
+        //                 v.myweizhi += '/' + p3.name
+        //               }
+        //             })
+        //           }
+        //         }
+        //       })
+        //     }
+        //   }
+        // })
         // if (v.textureType === 0) v.textureType = '单一质地'
         // else if (v.textureType === 1) v.textureType = '复合质地'
         if (v.status === 0) v.status = '待入库'
@@ -349,43 +354,6 @@ export default {
     this.getHolding3List(this.mydata)
     // 显示图还是表格
     this.tabInd = this.INtabInd
-    // 进页面拿到所有数据,给导出
-    const res = await getHolding3List({ pageNum: 1, pageSize: 99999 })
-    this.json_data = res.data.list
-    this.json_data.forEach(v => {
-      // 位置信息处理
-      this.options.forEach(p => {
-        // eslint-disable-next-line
-          if(p.id== v.storageId.split(',')[0]) {
-          if (p.children) {
-            v.myweizhi = p.name
-            p.children.forEach(p2 => {
-              // eslint-disable-next-line
-                  if(p2.id==v.storageId.split(',')[1]) {
-                if (p2.children) {
-                  v.myweizhi += '/' + p2.name
-                  p2.children.forEach(p3 => {
-                    // eslint-disable-next-line
-                            if (p3.id == v.storageId.split(',')[2]) {
-                      v.myweizhi += '/' + p3.name
-                    }
-                  })
-                }
-              }
-            })
-          }
-        }
-      })
-
-      v.numTypeId = this.mycategory(v.numTypeId)
-      if (v.amountType === 0) v.amountType = '单件'
-      else if (v.amountType === 1) v.amountType = '一套多件'
-      v.integrity = this.spoil(v.integrity)
-      v.repair = this.mySave(v.repair)
-      v.level = this.myWwjb(v.level)
-      if (v.textureType === 0) v.textureType = '单一质地'
-      else if (v.textureType === 1) v.textureType = '复合质地'
-    })
   },
   beforeCreate () {}, // 生命周期 - 创建之前
   beforeMount () {}, // 生命周期 - 挂载之前