From a2641e87ba7fe08912ea1440f85c3f395395c6be Mon Sep 17 00:00:00 2001
From: zpzgiser <45806316+zpzgiser@users.noreply.github.com>
Date: Tue, 20 Jul 2021 22:29:08 +0800
Subject: [PATCH] 换表格组件

---
 src/views/securityUnitOperation/economicTable.vue |  241 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 177 insertions(+), 64 deletions(-)

diff --git a/src/views/securityUnitOperation/economicTable.vue b/src/views/securityUnitOperation/economicTable.vue
index 5ca4f7a..6cc4a65 100644
--- a/src/views/securityUnitOperation/economicTable.vue
+++ b/src/views/securityUnitOperation/economicTable.vue
@@ -1,7 +1,7 @@
 <template>
   <basic-container>
-    <div class="operation-table">
-      <el-row>
+    <!-- <div class="operation-table"> -->
+    <!-- <el-row>
         <el-col>
           <span>时间范围:</span>
           <el-date-picker
@@ -40,20 +40,21 @@
           <el-button>查询</el-button>
           <el-button>重置</el-button>
         </el-col>
-      </el-row>
-      <el-row>
+      </el-row> -->
+    <!-- <el-row>
         <el-col>
           <div class="table">
-            <el-button @click="downExcel">下载</el-button>
-            <avue-crud
-              :option="tableOption"
-              :data="tableData"
-              :page.sync="tablePage"
-              :permission="permissionList"
-              :before-open="beforeOpen"
-            >
-            </avue-crud>
-            <!-- <el-table id="table" :data="tableData" style="width: 100%">
+            <el-button @click="downExcel">下载</el-button> -->
+    <avue-crud
+      :option="tableOption"
+      :data="tableData"
+      :page.sync="tablePage"
+      :permission="permissionList"
+      :before-open="beforeOpen"
+      @date-change="dateChange"
+    >
+    </avue-crud>
+    <!-- <el-table id="table" :data="tableData" style="width: 100%">
             <el-table-column type="index" label="序号" width="50">
             </el-table-column>
             <el-table-column prop="company" label="公司名称" width="180">
@@ -71,21 +72,22 @@
             </el-table-column>
             <el-table-column prop="bz" label="备注"> </el-table-column>
           </el-table> -->
-            <el-pagination
+    <!-- <el-pagination
               background
               layout="prev, pager, next"
               :total="tableData.length"
             >
-            </el-pagination>
-          </div>
+            </el-pagination> -->
+    <!-- </div>
         </el-col>
-      </el-row>
-    </div>
+      </el-row> -->
+    <!-- </div> -->
   </basic-container>
 </template>
 <script>
 import FileSaver from "file-saver";
 import XLSX from "xlsx";
+import { mapGetters } from "vuex";
 export default {
   name: "公司经济情况智能分析详情表",
   data() {
@@ -127,7 +129,7 @@
         {
           company: "江西省永安保安服务有限公司",
           subOffice: "南昌市公安局",
-          time: "2021年6月",
+          time: "2021-06-1",
           sbjnrs: "12200",
           sbjnze: "400",
           gspqrs: "110",
@@ -137,7 +139,7 @@
         {
           company: "南昌市赣水保安服务有限公司",
           subOffice: "东湖分局",
-          time: "2021年6月",
+          time: "2020-05-21",
           sbjnrs: "12200",
           sbjnze: "400",
           gspqrs: "110",
@@ -147,7 +149,7 @@
         {
           company: "江西中业兴达保安服务有限公司",
           subOffice: "西湖分局",
-          time: "2021年6月",
+          time: "2021-08-11",
           sbjnrs: "12200",
           sbjnze: "400",
           gspqrs: "110",
@@ -161,54 +163,153 @@
         total: 0
       },
       tableOption: {
-        lazy: true,
-        tip: false,
-        simplePage: true,
-        searchShow: true,
-        searchMenuSpan: 6,
-        dialogWidth: "60%",
-        tree: true,
-        border: true,
-        index: true,
-        selection: true,
-        viewBtn: false,
+        excelBtn: true,
+        delBtn: false,
         editBtn: false,
         addBtn: false,
-        delBtn: false,
-        menuWidth: 150,
+        selection: false,
+        menu: false,
+        // dateBtn: true,
+        align: "center",
+        height: "auto",
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        index: true,
+        viewBtn: true,
         dialogClickModal: false,
         column: [
           {
-            label: "公司名称",
-            prop: "company"
+            label: "类别",
+            hide: true,
+            prop: "",
+            search: true,
+            searchSpan: 4,
+            display: true,
+            type: "select",
+            props: {
+              label: "label",
+              value: "value"
+            },
+            // cascaderItem: ["city", "area"],
+            // dicUrl:subofficeOptions,
+            dicData: [
+              {
+                value: "0",
+                label: "全部"
+              },
+              {
+                value: "1",
+                label: "社保缴纳人数"
+              },
+              {
+                value: "2",
+                label: "社保缴纳总额"
+              },
+              {
+                value: "3",
+                label: "公司派遣人数"
+              },
+              {
+                value: "4",
+                label: "社保缴纳人数占比"
+              }
+            ],
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择类别",
+                trigger: "blur"
+              }
+            ]
           },
           {
-            label: "所属分局",
-            prop: "subOffice"
+            label: "所属辖区",
+            prop: "subOffice",
+            searchSpan: 4,
+            type: "select",
+            props: {
+              label: "label",
+              value: "value"
+            },
+            // cascaderItem: ["city", "area"],
+            // dicUrl:subofficeOptions,
+            dicData: [
+              {
+                value: "0",
+                label: "南昌市公安局"
+              },
+              {
+                value: "2",
+                label: "东湖分局"
+              },
+              {
+                value: "3",
+                label: "西湖分局"
+              },
+              {
+                value: "4",
+                label: "青云谱分局"
+              },
+              {
+                value: "5",
+                label: "青山湖分局"
+              }
+            ],
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择所属辖区",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "时间",
-            prop: "time"
+            prop: "time",
+            type: "date",
+            format: "yyyy-MM-dd hh:mm:ss",
+            valueFormat: "yyyy-MM-dd hh:mm:ss",
+            searchSpan: 6,
+            searchRange: true,
+            search: true,
+            display: false
           },
           {
+            label: "公司名称",
+            prop: "company",
+            search: true,
+            searchSpan: 4,
+            display: false
+          },
+
+          {
             label: "社保缴纳人数",
-            prop: "sbjnrs"
+            prop: "sbjnrs",
+            display: false
           },
           {
             label: "社保缴纳总额(万)",
-            prop: "sbjnze"
+            prop: "sbjnze",
+            display: false
           },
           {
             label: "公司派遣人数",
-            prop: "gspqrs"
+            prop: "gspqrs",
+            display: false
           },
           {
             label: "社保缴纳人数占比(%)",
-            prop: "sbjnrszb"
+            prop: "sbjnrszb",
+            display: false
           },
           {
             label: "备注",
-            prop: "bz"
+            prop: "bz",
+            display: false
           }
         ]
       },
@@ -261,27 +362,39 @@
       companyName: ""
     };
   },
-  methods: {
-    downExcel() {
-      let et = XLSX.utils.table_to_book(document.getElementById("table"));
-      let etout = XLSX.write(et, {
-        bookType: "xlsx",
-        bookSST: true,
-        type: "array"
-      });
-      try {
-        FileSaver.saveAs(
-          new Blob([etout], {
-            type: "application/octet-stream"
-          }),
-          `表.xlsx`
-        ); //导出的文件名
-      } catch (e) {
-        console.log(e, etout);
-      }
-      return etout;
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.post_add, false),
+        viewBtn: this.vaildData(this.permission.post_view, false),
+        delBtn: this.vaildData(this.permission.post_delete, false),
+        editBtn: this.vaildData(this.permission.post_edit, false)
+      };
     }
   },
+  methods: {
+    dateChange() {}
+    // downExcel() {
+    //   let et = XLSX.utils.table_to_book(document.getElementById("table"));
+    //   let etout = XLSX.write(et, {
+    //     bookType: "xlsx",
+    //     bookSST: true,
+    //     type: "array"
+    //   });
+    //   try {
+    //     FileSaver.saveAs(
+    //       new Blob([etout], {
+    //         type: "application/octet-stream"
+    //       }),
+    //       `表.xlsx`
+    //     ); //导出的文件名
+    //   } catch (e) {
+    //     console.log(e, etout);
+    //   }
+    //   return etout;
+    // }
+  },
   mounted() {}
 };
 </script>

--
Gitblit v1.9.3