From 4d00f091ca662fcfc25e28af76f6ad38d8e53304 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期四, 12 九月 2024 16:57:34 +0800
Subject: [PATCH] 调整修改

---
 src/views/class/index.vue |  242 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 162 insertions(+), 80 deletions(-)

diff --git a/src/views/class/index.vue b/src/views/class/index.vue
index f79de1a..b3aeb84 100644
--- a/src/views/class/index.vue
+++ b/src/views/class/index.vue
@@ -1,103 +1,185 @@
 <template>
-    <div class="app-container">
-      <el-tabs v-model="activeName" @tab-click="handleClick">
-        <el-tab-pane label="鍏ㄩ儴" name="first" />
-        <el-tab-pane label="宸插仠鐢�" name="fourth" />
-      </el-tabs>
-      <div style="display: flex; flex-direction: row-reverse;">
-        <div style="width: 300px;">
-          <el-input
-            placeholder="鎸夌彮绾у悕绉版悳绱�"
-            v-model="input3"
-            class="input-with-select"
-            size="small"
-          >
-            <el-button slot="append" icon="el-icon-search"></el-button>
-          </el-input>
-        </div>
+  <div class="app-container">
+    <el-tabs v-model="activeName" @tab-click="fetchData">
+      <el-tab-pane label="鍏ㄩ儴" name="all" />
+      <el-tab-pane label="宸插仠鐢�" name="deactivated" />
+    </el-tabs>
+    <div style="display: flex; flex-direction: row-reverse">
+      <div style="width: 300px">
+        <el-input placeholder="鎸夌彮绾у悕绉版悳绱�" v-model="data.keyword" class="input-with-select" size="small">
+          <el-button slot="append" icon="el-icon-search" @click="fetchData"></el-button>
+        </el-input>
       </div>
-      <el-table
-        v-loading="listLoading"
-        :data="list"
-        element-loading-text="Loading"
-        fit
-      >
+    </div>
+    <div style="height: calc(100vh - 248px)">
+      <el-table v-loading="listLoading" :data="list" element-loading-text="Loading" fit v-if="activeName == 'all'"
+        height="100%">
         <el-table-column label="鐝骇鍚嶇О">
-          <template slot-scope=""> xxxxx </template>
+          <template slot-scope="scope">
+            <el-link type="primary" :underline="false">{{
+      scope.row.team.name
+    }}</el-link>
+          </template>
         </el-table-column>
-        <el-table-column label="鐝骇浜烘暟" width="80">
-          <template slot-scope=""> 鐢� </template>
+        <el-table-column label="鐝骇浜烘暟" width="200">
+          <template slot-scope="scope">{{ scope.row.playerCount }} 浜�</template>
         </el-table-column>
         <el-table-column label="璇惧寘/浼氬憳鍗�" width="200">
-          <template slot-scope=""> 10086 </template>
-        </el-table-column>
-        <el-table-column label="榛樿璇炬秷" width="200">
-          <template slot-scope=""> asfiaf </template>
+          <template slot-scope="scope">{{
+      scope.row.team.voucher.name
+    }}</template>
         </el-table-column>
         <el-table-column label="鏁欏笀" width="">
-          <template slot-scope=""> asfiaf </template>
+          <template slot-scope="scope">{{
+        concatenateArray(scope.row.team.sessionStaffs)
+      }}</template>
         </el-table-column>
-        <el-table-column label="瀛﹀憳浜烘暟" width="">
-          <template slot-scope=""> asfiaf </template>
-        </el-table-column>
-        <!-- <el-table-column label="Author" width="110" align="center">
+        <el-table-column label="鎿嶄綔" width="200">
           <template slot-scope="scope">
-            <span>{{ scope.row.author }}</span>
+            <el-button type="text" @click="handleExport(scope.row)">
+              瀵煎嚭
+            </el-button>
           </template>
         </el-table-column>
-        <el-table-column label="Pageviews" width="110" align="center">
-          <template slot-scope="scope">
-            {{ scope.row.pageviews }}
+      </el-table>
+      <el-table v-loading="listLoading" :data="list" element-loading-text="Loading" fit height="100%" v-else>
+        <el-table-column label="鐝骇鍚嶇О">
+          <template slot-scope="scope">{{ scope.row.name }} </template>
+        </el-table-column>
+        <el-table-column label="鍋滅敤鏃堕棿">
+          <template slot-scope="scope">{{ scope.row.modifyTime }} </template>
+        </el-table-column>
+        <el-table-column label="鎿嶄綔" width="200">
+          <template slot-scope="">
+            <el-link type="primary" :underline="false">鎭㈠</el-link>
           </template>
         </el-table-column>
-        <el-table-column class-name="status-col" label="Status" width="110" align="center">
-          <template slot-scope="scope">
-            <el-tag :type="scope.row.status | statusFilter">{{ scope.row.status }}</el-tag>
-          </template>
-        </el-table-column>
-        <el-table-column align="center" prop="created_at" label="Display_time" width="200">
-          <template slot-scope="scope">
-            <i class="el-icon-time" />
-            <span>{{ scope.row.display_time }}</span>
-          </template>
-        </el-table-column> -->
       </el-table>
     </div>
-  </template>
-  
-  <script>
-  import { getList } from "@/api/table";
-  
-  export default {
-    filters: {
-      statusFilter(status) {
-        const statusMap = {
-          published: "success",
-          draft: "gray",
-          deleted: "danger",
-        };
-        return statusMap[status];
-      },
-    },
-    data() {
-      return {
-        list: null,
-        listLoading: true,
-        activeName: "first",
+    <div>
+      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+        :current-page="data.pageIn.index + 1" :page-sizes="[10, 20, 30, 40]" :page-size="data.pageIn.size"
+        layout="total, sizes, prev, pager, next, jumper" :total="total">
+      </el-pagination>
+    </div>
+    <el-dialog title="瀵煎嚭" :visible.sync="dialogVisible" width="50%">
+      <el-form ref="form" :model="form" label-width="180px">
+        <el-form-item label="鏃ユ湡鑼冨洿">
+          <el-date-picker v-model="form.dateRange" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�"
+            end-placeholder="缁撴潫鏃ユ湡" value-format="yyyy-MM-dd"></el-date-picker>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="confirmExport">瀵� 鍑�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getTeamDtoAll, getDeletedItem } from "@/api/class";
+
+export default {
+  filters: {
+    statusFilter(status) {
+      const statusMap = {
+        published: "success",
+        draft: "gray",
+        deleted: "danger",
       };
+      return statusMap[status];
     },
-    created() {
-      this.fetchData();
+  },
+  data() {
+    return {
+      dialogVisible: false,
+      form: {
+        dateRange: [],
+        teamId: "",
+        name: "",
+      },
+      list: null,
+      listLoading: true,
+      activeName: "all",
+      total: 0,
+      data: {
+        staffId: JSON.parse(localStorage.getItem("user")).staffs[0].id,
+        keyword: "",
+        pageIn: {
+          //鍙�夛紝濡傛灉鏄垎椤垫煡璇紝闇�瑕佸姞涓娿��
+          index: 0, //蹇呴��
+          size: 10, //姣忛〉鐨勫ぇ灏忋�傞粯璁�20
+          sorts: {
+            name: "name", //鎺掑簭瀛楁鍚嶇О
+            direction: "ASC", //鎺掑簭鏂瑰悜
+          },
+        },
+        types: ["NORMAL"],
+      },
+    };
+  },
+  created() {
+    this.fetchData();
+  },
+  methods: {
+    handleExport(row) {
+      this.form.dateRange = [];
+      this.form.teamId = row.team.id;
+      this.form.name = row.team.name;
+      this.dialogVisible = true;
     },
-    methods: {
-      fetchData() {
+    confirmExport() {
+      this.download('exportSignIn?teamId=' + this.form.teamId + '&startTime=' + this.form.dateRange[0] + '&endTime=' + this.form.dateRange[1], {
+      }, `${this.form.name}涓婅绛惧埌琛�.xlsx`)
+    },
+    handleSizeChange(val) {
+      this.data.pageIn.size = val;
+      this.fetchData("pageIn");
+    },
+    handleCurrentChange(val) {
+      this.data.pageIn.index = val - 1;
+      this.fetchData("pageIn");
+    },
+    fetchData(_val) {
+      if (_val !== "pageIn") {
+        this.data.pageIn.index = 0;
+        this.data.pageIn.size = 10;
+      }
+      this.listLoading = true;
+      if (this.activeName == "all") {
         this.listLoading = true;
-        getList().then((response) => {
-          this.list = response.data.items;
+        getTeamDtoAll(this.data).then((response) => {
+          this.list = response.data.findTeamDtoAll.ls;
+          this.total = response.data.findTeamDtoAll.pageOut.total;
           this.listLoading = false;
         });
-      },
+      } else if (this.activeName == "deactivated") {
+        this.listLoading = true;
+        let data = {
+          itemType: "TEAM",
+          staffId: JSON.parse(localStorage.getItem("user")).staffs[0].id,
+          keyword: this.data.keyword,
+          pageIn: { ...this.data.pageIn },
+        };
+        getDeletedItem(data).then((response) => {
+          this.list = response.data.findDeletedItem.ls;
+          this.total = response.data.findDeletedItem.pageOut.total;
+          this.listLoading = false;
+        });
+      }
     },
-  };
-  </script>
-  
\ No newline at end of file
+    concatenateArray(arr) {
+      let result = "";
+      for (let i = 0; i < arr.length; i++) {
+        if (i == 0) {
+          result += arr[i].name;
+        } else {
+          result += "," + arr[i].name;
+        }
+      }
+      return result;
+    },
+  },
+};
+</script>

--
Gitblit v1.8.0