Bläddra i källkod

【日志汇总查询】联调查询、导出接口,列表字段

002390 1 år sedan
förälder
incheckning
6f7a25ba7f

+ 10 - 1
src/api/business/report/summary.js

@@ -2,9 +2,18 @@ import request from "@/utils/request";
 
 export function LIST(data, params) {
   return request({
-    url: "/pu/priceApply/list",
+    url: "/log/summary/list",
     method: "POST",
     params: params,
     data: data,
   });
+}
+
+export function EXPORRT(data) {
+  return request({
+    url: "/log/summary/download",
+    method: "post",
+    data: data,
+    responseType: 'blob'
+  });
 }

+ 46 - 28
src/views/report/summary-sheet/columns.js

@@ -1,88 +1,106 @@
 export default function useColumns() {
   const SearchColumns = [
     {
-      item: { key: "", title: "开始时间", },
+      item: { key: "dateStart", title: "开始时间", },
       attr: {
         is: "el-date-picker",
         type: "date",
         placeholder: "选择日期",
         valueFormat: "yyyy-MM-dd",
-        clearable: true,
       },
     },
     {
-      item: { key: "", title: "结束时间", },
+      item: { key: "dateOver", title: "结束时间", },
       attr: {
         is: "el-date-picker",
         type: "date",
         placeholder: "选择日期",
         valueFormat: "yyyy-MM-dd",
-        clearable: true,
       },
     },
     {
-      item: { key: "", title: "日志类型", },
+      item: { key: "logType", title: "日志类型", },
       attr: {
         is: "el-select",
-        clearable: true,
+        dictName: "log_type",
       },
     },
     {
-      item: { key: "", title: "员工", },
+      item: { key: "userName", title: "员工", },
       attr: {
         is: "el-popover-select-v2",
         referName: "CONTACTS_PARAM",
         valueKey: "name",
         dataMapping: {
-          // buyer: "code",
+          userCode: "code",
         },
       },
     },
-    // {
-    //   item: { key: "", title: "员工姓名", },
-    //   attr: {
-    //     is: "el-input",
-    //     clearable: true,
-    //   },
-    // },
+    {
+      item: { key: "deptName", title: "部门", },
+      attr: {
+        is: "el-popover-select-v2",
+        referName: "DEPT_PARAM",
+        valueKey: "name",
+        // dataMapping: {
+        //   deptCode: "code",
+        // },
+      },
+    },
   ];
 
   const TableColumns = [
     {
-      item: { key: "", title: "员工工号", },
+      item: { key: "userCode", title: "员工工号", width: 100, },
       attr: {},
     },
     {
-      item: { key: "", title: "员工姓名", },
+      item: { key: "userName", title: "员工姓名", width: 100, },
       attr: {},
     },
     {
-      item: { key: "", title: "一级部门", },
+      item: { key: "firstDepartment", title: "一级部门", },
       attr: {},
     },
     {
-      item: { key: "", title: "二级部门", },
+      item: { key: "secondDepartment", title: "二级部门", },
       attr: {},
     },
     {
-      item: { key: "", title: "三级部门", },
+      item: { key: "thirdDepartment", title: "三级部门", },
       attr: {},
     },
     {
-      item: { key: "", title: "应交份数", },
-      attr: {},
+      item: { key: "payableCopies", title: "应交份数", width: 100, },
+      attr: {
+        formatter: (prop) => {
+          return prop.payableCopies
+        },
+      },
     },
     {
-      item: { key: "", title: "实交份数", },
-      attr: {},
+      item: { key: "actualDeliveryCopies", title: "实交份数", width: 100, },
+      attr: {
+        formatter: (prop) => {
+          return prop.actualDeliveryCopies
+        },
+      },
     },
     {
-      item: { key: "", title: "缺交份数", },
-      attr: {},
+      item: { key: "lackCopies", title: "缺交份数", width: 100, },
+      attr: {
+        formatter: (prop) => {
+          return prop.lackCopies
+        },
+      },
     },
     {
-      item: { key: "", title: "休假", },
-      attr: {},
+      item: { key: "beFurlough", title: "休假", width: 100, },
+      attr: {
+        formatter: (prop) => {
+          return prop.beFurlough
+        },
+      },
     },
   ].map(({ item, attr }) => ({
     attr,

+ 39 - 5
src/views/report/summary-sheet/index.vue

@@ -2,6 +2,7 @@
 <script>
 import { dicts } from "./dicts";
 import useColumns from "./columns";
+import { LIST, EXPORRT } from "@/api/business/report/summary";
 export default {
   name: "SummarySheet",
   dicts: [...dicts],
@@ -15,7 +16,12 @@ export default {
     const page = this.$init.page();
     return {
       page,
-      params,
+      params: {
+        ...params,
+        dateStart: new Date().Format("yyyy-MM-dd"),
+        dateOver: new Date().Format("yyyy-MM-dd"),
+        logType: "3",
+      },
       TableColumns,
       SearchColumns,
       size: "mini",
@@ -28,22 +34,50 @@ export default {
   methods: {
     // 重置
     useReset() {
-      this.params = this.$init.params(this.SearchColumns);
+      this.params = {
+        ...this.$init.params(this.SearchColumns),
+        dateStart: new Date().Format("yyyy-MM-dd"),
+        dateOver: new Date().Format("yyyy-MM-dd"),
+        logType: "3",
+      };
       this.page = this.$init.page();
       this.useQuery(this.params, this.page);
     },
-    useQuery(params, page) {
+    async useQuery(params, page) {
       try {
         this.loading = true;
+        let { code, rows, total } = await LIST({ ...params, ...page });
+        if (code == 200) {
+          this.tableData = rows;
+          this.page.total = total;
+        }
       } catch (error) {
       } finally {
         this.loading = false;
       }
     },
     // 导出
-    useExport() {
+    async useExport() {
       try {
-      } catch (error) {}
+        this.$modal.loading("处理中,请稍后...");
+        const res = await EXPORRT({ ...this.params });
+        if (res) {
+          const blob = new Blob([res], {
+            type: "application/vnd.ms-excel;charset=UTF-8",
+          });
+          const downloadElement = document.createElement("a");
+          const href = window.URL.createObjectURL(blob);
+          downloadElement.href = href;
+          downloadElement.download = `日志汇总查询${new Date().getTime()}.xlsx`;
+          document.body.appendChild(downloadElement);
+          downloadElement.click();
+          document.body.removeChild(downloadElement);
+          window.URL.revokeObjectURL(href);
+        }
+      } catch (error) {
+      } finally {
+        this.$modal.closeLoading();
+      }
     },
     useSelect(selection) {
       this.selectData = selection;