Selaa lähdekoodia

准备填充数据

zweizhao 7 vuotta sitten
vanhempi
commit
66bce61f12
3 muutettua tiedostoa jossa 150 lisäystä ja 2 poistoa
  1. 4 0
      components/menu/data.js
  2. 146 0
      pages/main/index/group_list.vue
  3. 0 2
      vue.config.js

+ 4 - 0
components/menu/data.js

@@ -32,6 +32,10 @@ export default [{
     path: 'cloud_job',
   },
   {
+    title: '协作群组',
+    path: 'group_list',
+  },
+  {
     title: '工猫结算订单',
     path: 'gongmall',
   }]

+ 146 - 0
pages/main/index/group_list.vue

@@ -0,0 +1,146 @@
+<template>
+  <div id="withdraw">
+    <!-- <el-select @change="changeSelect" v-model="selectValue" placeholder="请选择">
+      <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
+    </el-select>-->
+    <div class="table">
+      <el-table
+        v-if="tableData.length"
+        height="100%"
+        border
+        style="width: 100%"
+        :data="tableData"
+        :row-class-name="tableRowClassName"
+      >
+        <el-table-column
+          v-for="(prop, index) of tableProps"
+          :key="index"
+          :prop="prop"
+          :label="tableHeaders[index]"
+        >
+          <template slot-scope="scope">
+            <el-button
+              type="text"
+              v-if="prop === 'uid'"
+              @click="clickUID(scope.row)"
+            >{{scope.row[prop]}}</el-button>
+            <el-button
+              v-else-if="prop === 'ctrl' && scope.row['status'] !== '1'"
+              type="text"
+              @click="clickSuper(scope.row)"
+            >超管查看</el-button>
+            <span v-else>{{scope.row[prop]}}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <el-pagination
+      @current-change="getTableData"
+      :current-page.sync="currentPage"
+      :page-size="10"
+      layout="total, prev, pager, next"
+      :total="totalCount"
+    ></el-pagination>
+  </div>
+</template>
+
+<script>
+const tableHeaders = [
+  "企业方",
+  "管理人员",
+  "关联工作",
+  "操作",
+]
+const tableProps = [
+  "uid",
+  "real_name",
+  "amount",
+  "ctrl"
+]
+
+export default {
+  data() {
+    return {
+      options: [
+        {
+          value: -1,
+          label: '全部'
+        },
+        {
+          value: 0,
+          label: '提交'
+        },
+        {
+          value: 1,
+          label: '成功'
+        },
+        {
+          value: 2,
+          label: '失败'
+        },
+        {
+          value: 3,
+          label: '进行中'
+        },
+      ],
+      selectValue: -1,
+      // 数据总条目
+      totalCount: 0,
+      currentPage: 1,
+      // 列表头显示内容
+      tableHeaders,
+      // 列表头字段
+      tableProps,
+      // 列表数据
+      tableData: []
+    };
+  },
+  mounted() {
+    this.getTableData()
+  },
+  methods: {
+    changeSelect(status) {
+      this.getTableData()
+    },
+    // 点击重试
+    async clickSuper(row) {
+      console.log(row.uid)
+    },
+    // 点击用户的 uid
+    clickUID(row) {
+      console.log(row.uid)
+      // console.log("click uid: " + uid)
+    },
+    // 根据状态显示图表样式
+    tableRowClassName({ row, rowIndex }) {
+      let className = ""
+      if(row.status === "1") className = "success-row"
+      return className
+    },
+    // 格式化列表数据
+    formatTableData(data) {
+      return data.map(i => ({
+        ...i,
+        statusShow: i.status === "1" ? "到账" : "失败",
+        created_atShow: new Date(Number(i.created_at) * 1000).toLocaleString(),
+        taken_atShow: new Date(Number(i.taken_at) * 1000).toLocaleString()
+      }));
+    },
+    // 获取列表数据
+    async getTableData(page = this.currentPage) {
+      this.tableData = []
+      const res = await this.$post("/api/admin/group/list", { page, page_size: 20 })
+      const data = res.data
+      this.tableData = this.formatTableData(res.data.list)
+      this.totalCount = Number(data.total)
+      this.totalPage = data.totalPage
+    }
+  }
+};
+</script>
+
+<style scoped>
+.table {
+  height: calc(100% - 40px);
+}
+</style>

+ 0 - 2
vue.config.js

@@ -28,8 +28,6 @@ module.exports = {
       .set('utils',resolve('src/utils'))
 
     config.devServer
-      .set('host', 'local-rooter.proginn.com')
-      .set('port', 20201)
       .set('historyApiFallback', false)
       .set('noInfo', true)
       .set('open', true)