From 20913c80c3f5fc8e533cb92b90e6f20bcd68e032 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期三, 29 十一月 2023 17:49:32 +0800
Subject: [PATCH] feat: 1、优化导入 2、部门物品台账查询对接

---
 admin-web/src/views/departmentitem/ledgerquy/itemQuy/index.vue |  108 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 87 insertions(+), 21 deletions(-)

diff --git a/admin-web/src/views/departmentitem/ledgerquy/itemQuy/index.vue b/admin-web/src/views/departmentitem/ledgerquy/itemQuy/index.vue
index 9778858..df104d3 100644
--- a/admin-web/src/views/departmentitem/ledgerquy/itemQuy/index.vue
+++ b/admin-web/src/views/departmentitem/ledgerquy/itemQuy/index.vue
@@ -23,8 +23,7 @@
 import MyTableV2 from "@/components/myTable/myTableV2";
 import MyButton from "@/components/myButton/myButton";
 import SettingIplatform from '@/utils/settingIplatform';
-import * as finsystenant from '@/api/baseSetting/finsystenant'
-import {getBaseUrl} from '@/utils/base';
+import {doExport} from '@/api/deptGoods/ledgerQuery';
 
 export default {
   name: "index",
@@ -38,40 +37,66 @@
           dataIndex: 'agencyId',
           label: '鏈烘瀯',
           placeholder: '璇烽�夋嫨',
-          optionsConfig: { url: '/pc/fin/sys/tenant/select/tree_fin_tenant', props: null },
+          optionsConfig: {url: '/pc/fin/sys/tenant/select/tree_fin_tenant', props: null},
           defaultValue: '',
           options: [],
         },
         {
           type: 'select',
-          dataIndex: 'name',
+          dataIndex: 'departmentId',
           label: '閮ㄩ棬',
           placeholder: '璇烽�夋嫨',
           defaultValue: '',
+          optionsConfig: {
+            url: `/pc/fin/sys/tenant/department/list/all`,
+            label: 'name',
+            value: 'id',
+          },
           options: [],
         },
         {
-          type: 'text',
-          dataIndex: 'name',
+          type: 'select',
+          dataIndex: 'goodsTemplateId',
           label: '鐗╁搧鍚嶇О',
           placeholder: '璇疯緭鍏�',
+          optionsConfig: {
+            label: 'goodsName',
+            value: 'id',
+            url: SettingIplatform.apiBaseURL + '/pc/base/goods/template/query/goodsTemplate',
+          },
+          options: [],
           defaultValue: ''
         },
         {
-          type: 'select',
-          dataIndex: 'name',
+          type: 'cascader',
+          dataIndex: 'categoryId',
           label: '鍒嗙被',
           placeholder: '璇烽�夋嫨',
           defaultValue: '',
           options: [],
+          optionsConfig: {
+            label: 'label',
+            value: 'id',
+            url: SettingIplatform.apiBaseURL + '/pc/base/category/select/tree',
+            props: {checkStrictly: false, emitPath: false, value: 'id'}
+          },
         },
         {
           type: 'select',
-          dataIndex: 'name',
+          dataIndex: 'costType',
           label: '绫诲埆',
           placeholder: '璇烽�夋嫨',
           defaultValue: '',
-          options: [],
+          options: [{
+            label: 'A',
+            value: '1'
+          }, {
+            label: 'B',
+            value: '2'
+          }, {
+            label: 'C',
+            value: '3'
+          }],
         },
       ],
       // 鏍戞暟鎹�
@@ -93,29 +118,36 @@
       table: {
         showIndex: true, // 鏄惁鏄剧ず搴忓彿
         expand: false, // 鏄惁鏄剧ず璇︽儏鏁版嵁
-        url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/select/list', // 璇锋眰鍦板潃
+        url: SettingIplatform.apiBaseURL + '/pc/fin/warehouse/ledger/getDeptLedgerList', // 璇锋眰鍦板潃
         // 宸ュ叿鏉�
         tools: {
           columnsCtrl: {// 鍒楁帶鍒舵寜閽�
             show: false
           },
           generalExport: {// 閫氱敤瀵煎嚭鎸夐挳
-            show: true
+            show: false
           },
           // 鑷畾涔夊伐鍏锋潯鎸夐挳
           custom: [
-          ]
+            {
+              name: '瀵煎嚭',
+              icon: 'el-icon-download',
+              click: () => {
+                this.handleExport();
+              },
+            },
+          ],
         },
         // 鍒椾俊鎭�
         columns: [
-          {title: '鏈烘瀯', field: 'name', align: 'left',},
-          {title: '閮ㄩ棬', field: 'code', align: 'center'},
-          {title: '鍒嗙被', field: 'lv', align: 'center', },
-          {title: '鎵�灞炵被鍒�', field: 'lv', align: 'center', },
-          {title: '鐗╁搧鍚嶇О', field: 'summary', align: 'left',},
-          {title: '瑙勬牸鍨嬪彿', field: 'summary', align: 'left',},
-          {title: '鍗曚綅', field: 'summary', align: 'left',},
-          {title: '鍦ㄧ敤鏁伴噺', field: 'summary', align: 'left',},
+          {title: '鏈烘瀯', field: 'agencyName', align: 'left', minWidth: 130},
+          {title: '閮ㄩ棬', field: 'departName', align: 'left', minWidth: 130},
+          {title: '鍒嗙被', field: 'categoryName', align: 'left', minWidth: 130},
+          {title: '鎵�灞炵被鍒�', field: 'costType', align: 'center', width: 80},
+          {title: '鐗╁搧鍚嶇О', field: 'goodsTemplateName', align: 'left', minWidth: 130},
+          {title: '瑙勬牸鍨嬪彿', field: 'baseGoodsModelsName', align: 'left', minWidth: 130},
+          {title: '鍗曚綅', field: 'unit', align: 'center', width: 80},
+          {title: '鍦ㄧ敤鏁伴噺', field: 'kucun', align: 'center', width: 80},
         ],
         // 鎿嶄綔淇℃伅
         operation: {
@@ -137,6 +169,40 @@
   created() {
   },
   methods: {
+    // 瀵煎嚭
+    handleExport() {
+      let loading = this.$loading({
+        lock: true,
+        text: '瀵煎嚭涓紝璇风◢鍊�...',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      // 鍒ゆ柇鎬绘潯鏁版槸鍚﹀ぇ浜庢渶澶ф敮鎸佹潯鏁�
+      doExport({...this.filterFrom})
+          .then((res) => {
+            const blob = new Blob([res], {type: 'application/vnd.ms-excel'});
+            const fileName = `閮ㄩ棬鐗╁搧鏌ヨ.xls`;
+            if ('download' in document.createElement('a')) {
+              // 闈濱E涓嬭浇
+              const elink = document.createElement('a');
+              elink.download = fileName;
+              elink.style.display = 'none';
+              elink.href = URL.createObjectURL(blob);
+              document.body.appendChild(elink);
+              elink.click();
+              URL.revokeObjectURL(elink.href);
+              document.body.removeChild(elink);
+            } else {
+              // IE10+涓嬭浇
+              navigator.msSaveBlob(blob, fileName);
+            }
+            this.$message.success('瀵煎嚭鎴愬姛锛�');
+            loading.close();
+          })
+          .catch(() => {
+            loading.close();
+          });
+    },
     // 鏌ヨtable鍒楄〃
     search(pageNum) {
       if (pageNum != undefined) {

--
Gitblit v1.9.1