lichao 3 роки тому
батько
коміт
3ad3988aa1

+ 9 - 0
src/api/warehouseBusiness/warehouseAnalysis.js

@@ -0,0 +1,9 @@
+import request from '@/utils/request';
+
+export function getList(query) {
+  return request({
+    url: "/warehousing/analysis/list",
+    method: 'get',
+    params: query
+  })
+}

+ 105 - 42
src/views/Warehousing/analysis/index.vue

@@ -27,7 +27,7 @@
         </el-col>
         <el-col :xs="12" :sm="6">
           <el-form-item label="仓库">
-            <el-select v-model="queryParams.fWarehouseid" placeholder="请选择仓库库区">
+            <el-select v-model="queryParams.fWarehouseid" placeholder="请选择仓库库区" clearable filterable>
               <el-option
                 v-for="(item, index) in warehouseOptions"
                 :key="index.fId"
@@ -57,17 +57,12 @@
         <el-col :xs="12" :sm="6">
           <el-form-item label="截止日期">
             <el-date-picker
-              v-model="queryParams.a"
-              type="daterange"
-              value-format="yyyy-MM-dd HH:mm:ss"
-              :default-time="['00:00:00', '23:59:59']"
+              v-model="queryParams.fBsdate"
+              type="date"
+              value-format="yyyy-MM-dd"
               clearable
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              :picker-options="pickerOptions"
-              unlink-panels
               style="width: 230px"
+              placeholder="选择日期"
             ></el-date-picker>
           </el-form-item>
         </el-col>
@@ -172,7 +167,7 @@
       </el-row>
     </el-form>
 
-    <el-tabs v-model="activeName">
+    <el-tabs v-model="activeName" @tab-click="tabsHandle">
       <el-tab-pane label="出库" name="outStock"></el-tab-pane>
       <el-tab-pane label="在库" name="inStock"></el-tab-pane>
     </el-tabs>
@@ -183,6 +178,7 @@
       show-summary
       :summary-method="getSum"
       :height="tableHeight"
+      stripe
     >
       <el-table-column
         type="index"
@@ -200,7 +196,20 @@
         :fixed="item.fixed"
         :show-overflow-tooltip="true"
         sortable
+        v-if="item.show"
       >
+        <template slot-scope="scope">
+          <span v-if="item.label == 'fBsdate'">
+            {{ scope.row.fBsdate | fBsdateFormat }}
+          </span>
+          <span v-else-if="item.label == 'fBilltype'">
+            {{ scope.row.fBilltype | billTypeFormat(billTypeList) }}
+          </span>
+          <span v-else-if="item.label == 'fCorpid'">
+            {{ scope.row.fCorpid | fMblnoFormat(fMblnoOptions) }}
+          </span>
+          <span v-else>{{ scope.row[item.label] }}</span>
+        </template>
       </el-table-column>
     </el-table>
     <pagination
@@ -217,6 +226,7 @@
 import { listCorps } from "@/api/basicdata/corps";
 import { listWarehousesss } from "@/api/basicdata/warehouse";
 import { queryClerkRoleList } from "@/api/warehouseBusiness/warehouseInStock";
+import { getList } from "@/api/warehouseBusiness/warehouseAnalysis";
 import Cookies from "js-cookie";
 import {addSet, resetModule, select} from '@/api/system/set';
 import draggable from "vuedraggable";
@@ -241,34 +251,9 @@ export default {
       fMblnoOptions: [], //客户
       warehouseOptions: [], //仓库
       userOptions: [],
-      pickerOptions: {
-        shortcuts: [{
-          text: '最近一周',
-          onClick(picker) {
-            const end = new Date();
-            const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
-            picker.$emit('pick', [start, end]);
-          }
-        }, {
-          text: '最近一个月',
-          onClick(picker) {
-            const end = new Date();
-            const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
-            picker.$emit('pick', [start, end]);
-          }
-        }, {
-          text: '最近三个月',
-          onClick(picker) {
-            const end = new Date();
-            const start = new Date();
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
-            picker.$emit('pick', [start, end]);
-          }
-        }]
-      },
+      billTypeList: [],
       activeName: 'outStock',
+      disabledName: 'outStock',
 
       // 设置列开关
       showSetting: false,
@@ -284,6 +269,7 @@ export default {
           name: "业务类型",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "2",
@@ -291,6 +277,7 @@ export default {
           name: "客户名称",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "3",
@@ -298,6 +285,7 @@ export default {
           name: "提单号",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "4",
@@ -305,13 +293,15 @@ export default {
           name: "件数",
           checked: 0,
           width: 80,
+          show: true,
         },
         {
           surface: "5",
           label: "fGrossweight",
           name: "毛重",
           checked: 0,
-          width: 100,
+          width: 120,
+          show: true,
         },
         {
           surface: "6",
@@ -319,13 +309,15 @@ export default {
           name: "仓库",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "7",
-          label: "fBsdate",
+          label: "fOriginalbilldate",
           name: "入库日期",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "8",
@@ -333,6 +325,7 @@ export default {
           name: "出库日期",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "9",
@@ -340,6 +333,7 @@ export default {
           name: "仓管员",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "10",
@@ -347,6 +341,7 @@ export default {
           name: "制单人",
           checked: 0,
           width: 150,
+          show: true,
         },
         {
           surface: "11",
@@ -354,6 +349,7 @@ export default {
           name: "制单日期",
           checked: 0,
           width: 150,
+          show: true,
         },
       ],
     }
@@ -361,6 +357,9 @@ export default {
   created() {
     this.setRowList = this.tableDate;
     this.getRowList = this.tableDate;
+    this.getDicts("data_billtype_type").then((response) => {
+      this.billTypeList = response.data;
+    });
     listCorps({ type: 1 }).then((response) => {
       this.fMblnoOptions = response.rows;
     });
@@ -370,19 +369,66 @@ export default {
     queryClerkRoleList().then((response) => {
       this.userOptions = response.data;
     });
+    this.getList();
   },
   mounted() {
     this.$nextTick(() => {
       // 监听浏览器高度变化,改变表格高度
       window.onresize = () => {
-        this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
+        this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 85
       }
     })
   },
+  filters: {
+    fBsdateFormat(row) {
+      if (row) {
+        const dateMat = new Date(row);
+        const year = dateMat.getFullYear();
+        const month = dateMat.getMonth() + 1;
+        const day = dateMat.getDate();
+        const timeFormat = year + "-" + month + "-" + day;
+        return timeFormat;
+      }
+    },
+    billTypeFormat(row, billTypeList) {
+      let type;
+      billTypeList.map((e) => {
+        if (row == e.dictValue) {
+          type = e.dictLabel;
+        }
+      });
+      return type;
+    },
+    fMblnoFormat(row, fMblnoOptions) {
+      let name;
+      fMblnoOptions.map((e) => {
+        if (row == e.fId) {
+          name = e.fName;
+        }
+      });
+      return name;
+    },
+  },
   methods: {
     getList() {
+      const data = {
+        type: 2, // 1入 2出
+        ...this.queryParams
+      }
+      if (this.activeName == 'outStock') {
+        data.type = 2;
+      } else {
+        data.type = 1;
+      }
+      this.loading = true
+      getList(data).then(res => {
+        this.dataList = res.rows
+        this.total = res.total;
+      }).finally(() => {
+        this.loading = false
+      })
       setTimeout(() => {
-        this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
+        this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 85
       }, 300)
     },
     // 搜索
@@ -441,6 +487,23 @@ export default {
       });
       return sums;
     },
+    tabsHandle(data) {
+      if (this.disabledName == data.name) return
+      this.disabledName = data.name
+      this.tableDate.forEach(item => {
+        if (this.activeName == 'inStock') {
+          if (item.label == 'fBsdate') {
+            item.show = false
+          }
+        } else {
+          item.show = true
+        }
+      })
+      this.getList()
+      this.$nextTick(() => {
+        this.$refs.table.doLayout()
+      })
+    },
 
 
     //列设置全选