Browse Source

周转率页面整改

lxf 1 năm trước cách đây
mục cha
commit
4b77001c62
1 tập tin đã thay đổi với 66 bổ sung242 xóa
  1. 66 242
      src/views/group/data-board/turnover-rate/index.vue

+ 66 - 242
src/views/group/data-board/turnover-rate/index.vue

@@ -1,225 +1,42 @@
 <template>
   <el-card class="box-card">
     <el-tabs v-model="activeName" type="card" @tab-change="getList">
-      <el-tab-pane label="瑜伽垫" :name="'1'">
-        <el-row :gutter="20">
-          <el-col :span="8">
-            <byTable
-              ref="data30"
-              :hidePagination="true"
-              :borderStatus="true"
-              :source="sourceList.data30"
-              :config="config"
-              :loading="sourceList.loading30"
-              :defaultSort="{ prop: 'turnoverRate', order: 'ascending' }"
-              highlight-current-row
-              :action-list="[
-                {
-                  text: '刷新(30天)',
-                  action: () => getData('30'),
-                },
-                {
-                  text: '导出Excel',
-                  action: () => deriveExcel('30'),
-                },
-              ]"
-              @get-list="getList">
-              <template #bomSpecName="{ item }">
-                <div>
-                  <el-tooltip class="box-item" effect="dark" placement="bottom">
-                    <template #content>
-                      <div style="max-width: 600px; word-break: break-all">{{ item.bomSpecName }}</div>
-                    </template>
-                    <div style="cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
-                      {{ item.bomSpecName }}
-                    </div>
-                  </el-tooltip>
-                </div>
-              </template>
-            </byTable>
-          </el-col>
-          <el-col :span="8">
-            <byTable
-              ref="data60"
-              :hidePagination="true"
-              :borderStatus="true"
-              :source="sourceList.data60"
-              :config="config"
-              :loading="sourceList.loading60"
-              :defaultSort="{ prop: 'turnoverRate', order: 'ascending' }"
-              highlight-current-row
-              :action-list="[
-                {
-                  text: '刷新(60天)',
-                  action: () => getData('60'),
-                },
-                {
-                  text: '导出Excel',
-                  action: () => deriveExcel('30'),
-                },
-              ]"
-              @get-list="getList">
-              <template #bomSpecName="{ item }">
-                <div>
-                  <el-tooltip class="box-item" effect="dark" placement="bottom">
-                    <template #content>
-                      <div style="max-width: 600px; word-break: break-all">{{ item.bomSpecName }}</div>
-                    </template>
-                    <div style="cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
-                      {{ item.bomSpecName }}
-                    </div>
-                  </el-tooltip>
-                </div>
-              </template>
-            </byTable>
-          </el-col>
-          <el-col :span="8">
-            <byTable
-              ref="data90"
-              :hidePagination="true"
-              :borderStatus="true"
-              :source="sourceList.data90"
-              :config="config"
-              :loading="sourceList.loading90"
-              :defaultSort="{ prop: 'turnoverRate', order: 'ascending' }"
-              highlight-current-row
-              :action-list="[
-                {
-                  text: '刷新(90天)',
-                  action: () => getData('90'),
-                },
-                {
-                  text: '导出Excel',
-                  action: () => deriveExcel('30'),
-                },
-              ]"
-              @get-list="getList">
-              <template #bomSpecName="{ item }">
-                <div>
-                  <el-tooltip class="box-item" effect="dark" placement="bottom">
-                    <template #content>
-                      <div style="max-width: 600px; word-break: break-all">{{ item.bomSpecName }}</div>
-                    </template>
-                    <div style="cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
-                      {{ item.bomSpecName }}
-                    </div>
-                  </el-tooltip>
-                </div>
-              </template>
-            </byTable>
-          </el-col>
-        </el-row>
-      </el-tab-pane>
-      <el-tab-pane label="瑜伽砖" :name="'2'">
-        <el-row :gutter="20">
-          <el-col :span="8">
-            <byTable
-              ref="data30"
-              :hidePagination="true"
-              :borderStatus="true"
-              :source="sourceList.data30"
-              :config="config"
-              :loading="sourceList.loading30"
-              :defaultSort="{ prop: 'turnoverRate', order: 'ascending' }"
-              highlight-current-row
-              :action-list="[
-                {
-                  text: '刷新',
-                  action: () => getData('30'),
-                },
-                {
-                  text: '导出Excel',
-                  action: () => deriveExcel(),
-                },
-              ]"
-              @get-list="getList">
-              <template #bomSpecName="{ item }">
-                <div>
-                  <el-tooltip class="box-item" effect="dark" placement="bottom">
-                    <template #content>
-                      <div style="max-width: 600px; word-break: break-all">{{ item.bomSpecName }}</div>
-                    </template>
-                    <div style="cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
-                      {{ item.bomSpecName }}
-                    </div>
-                  </el-tooltip>
-                </div>
-              </template>
-            </byTable>
-          </el-col>
-          <el-col :span="8">
-            <byTable
-              ref="data60"
-              :hidePagination="true"
-              :borderStatus="true"
-              :source="sourceList.data60"
-              :config="config"
-              :loading="sourceList.loading60"
-              :defaultSort="{ prop: 'turnoverRate', order: 'ascending' }"
-              highlight-current-row
-              :action-list="[
-                {
-                  text: '刷新',
-                  action: () => getData('60'),
-                },
-                {
-                  text: '导出Excel',
-                  action: () => deriveExcel(),
-                },
-              ]"
-              @get-list="getList">
-              <template #bomSpecName="{ item }">
-                <div>
-                  <el-tooltip class="box-item" effect="dark" placement="bottom">
-                    <template #content>
-                      <div style="max-width: 600px; word-break: break-all">{{ item.bomSpecName }}</div>
-                    </template>
-                    <div style="cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
-                      {{ item.bomSpecName }}
-                    </div>
-                  </el-tooltip>
-                </div>
-              </template>
-            </byTable>
-          </el-col>
-          <el-col :span="8">
-            <byTable
-              ref="data90"
-              :hidePagination="true"
-              :borderStatus="true"
-              :source="sourceList.data90"
-              :config="config"
-              :loading="sourceList.loading90"
-              :defaultSort="{ prop: 'turnoverRate', order: 'ascending' }"
-              highlight-current-row
-              :action-list="[
-                {
-                  text: '刷新',
-                  action: () => getData('90'),
-                },
-                {
-                  text: '导出Excel',
-                  action: () => deriveExcel(),
-                },
-              ]"
-              @get-list="getList">
-              <template #bomSpecName="{ item }">
-                <div>
-                  <el-tooltip class="box-item" effect="dark" placement="bottom">
-                    <template #content>
-                      <div style="max-width: 600px; word-break: break-all">{{ item.bomSpecName }}</div>
-                    </template>
-                    <div style="cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
-                      {{ item.bomSpecName }}
-                    </div>
-                  </el-tooltip>
-                </div>
-              </template>
-            </byTable>
-          </el-col>
-        </el-row>
-      </el-tab-pane>
+      <el-tab-pane label="瑜伽垫" :name="'1'"> </el-tab-pane>
+      <el-tab-pane label="瑜伽砖" :name="'2'"> </el-tab-pane>
     </el-tabs>
+    <byTable
+      ref="data"
+      :hidePagination="true"
+      :borderStatus="true"
+      :source="sourceList.data"
+      :config="config"
+      :loading="sourceList.loading"
+      :defaultSort="{ prop: 'turnoverRate', order: 'turnoverRateNinetyDays' }"
+      highlight-current-row
+      :action-list="[
+        {
+          text: '刷新',
+          action: () => getList(),
+        },
+        {
+          text: '导出Excel',
+          action: () => deriveExcel(),
+        },
+      ]"
+      @get-list="getList">
+      <template #bomSpecName="{ item }">
+        <div>
+          <el-tooltip class="box-item" effect="dark" placement="bottom">
+            <template #content>
+              <div style="max-width: 600px; word-break: break-all">{{ item.bomSpecName }}</div>
+            </template>
+            <div style="cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
+              {{ item.bomSpecName }}
+            </div>
+          </el-tooltip>
+        </div>
+      </template>
+    </byTable>
   </el-card>
 </template>
 
@@ -231,12 +48,8 @@ import { ElMessageBox } from "element-plus";
 const { proxy } = getCurrentInstance();
 const activeName = ref("1");
 const sourceList = ref({
-  loading30: false,
-  data30: [],
-  loading60: false,
-  data60: [],
-  loading90: false,
-  data90: [],
+  loading: false,
+  data: [],
 });
 const config = computed(() => {
   return [
@@ -255,9 +68,25 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "周转率",
-        prop: "turnoverRate",
-        width: 100,
+        label: "30天周转率",
+        prop: "turnoverRateThirtyDays",
+        width: 140,
+      },
+      sortable: true,
+    },
+    {
+      attrs: {
+        label: "60天周转率",
+        prop: "turnoverRateSixtyDays",
+        width: 140,
+      },
+      sortable: true,
+    },
+    {
+      attrs: {
+        label: "90天周转率",
+        prop: "turnoverRateNinetyDays",
+        width: 140,
       },
       sortable: true,
     },
@@ -270,35 +99,30 @@ const config = computed(() => {
     },
   ];
 });
-const getData = (days) => {
-  sourceList.value["loading" + days] = true;
-  proxy.post("/turnoverRateBoard/getTurnoverRateStatisticsList", { bomClassify: activeName.value, days: days, sortField: 1 }).then(async (res) => {
-    sourceList.value["data" + days] = res;
+const getList = () => {
+  sourceList.value.loading = true;
+  proxy.post("/turnoverRateBoard/getTurnoverRateStatisticsList", { bomClassify: activeName.value }).then(async (res) => {
+    sourceList.value.data = res;
     setTimeout(() => {
-      sourceList.value["loading" + days] = false;
+      sourceList.value.loading = false;
     }, 200);
     await nextTick();
-    proxy.$refs["data" + days].hocElTable.sort("turnoverRate", "ascending");
+    proxy.$refs.data.hocElTable.sort("turnoverRate", "turnoverRateNinetyDays");
   });
 };
-const getList = () => {
-  getData("30");
-  getData("60");
-  getData("90");
-};
 getList();
-const deriveExcel = (days) => {
+const deriveExcel = () => {
   ElMessageBox.confirm("你是否确认此操作", "提示", {
     confirmButtonText: "确定",
     cancelButtonText: "取消",
     type: "warning",
   })
     .then(() => {
-      proxy.postFile("/turnoverRateBoard/exportExcel", { bomClassify: activeName.value, days: days, sortField: 1 }).then((res) => {
+      proxy.postFile("/turnoverRateBoard/exportExcel", { bomClassify: activeName.value }).then((res) => {
         if (activeName.value == "1") {
-          proxy.downloadFile(res, "周转率-裸垫-" + days + "天.xlsx");
+          proxy.downloadFile(res, "周转率-裸垫.xlsx");
         } else {
-          proxy.downloadFile(res, "周转率-裸砖-" + days + "天.xlsx");
+          proxy.downloadFile(res, "周转率-裸砖.xlsx");
         }
       });
     })