Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
add # list
Browse files Browse the repository at this point in the history
  • Loading branch information
dedztbh committed Apr 26, 2017
1 parent 6c7a8ec commit 74fa330
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 18 deletions.
48 changes: 36 additions & 12 deletions src/components/pages/Event/Event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<resize-watcher @resize="magic" listenWindow listenDOM></resize-watcher>
<spinner v-if="loading" :class="{'hide': loading}"></spinner>
<div v-show="!loading">
<i-button type="text" size="small" @click="add"><Icon type="plus" :size="24" style="margin: 15px 30px 15px 30px"></Icon></i-button>
<i-button type="text" size="small" @click="add">
<Icon type="plus" :size="24" style="margin: 15px 30px 15px 30px"></Icon>
</i-button>
<Table
:columns="columns"
:data="events"
Expand Down Expand Up @@ -31,18 +33,21 @@
<style scoped>
.container {
display: -webkit-flex;
display: flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
.text-center {
text-align:center
text-align: center
}
.hide {
height: 0;
}
.button {
margin-bottom: 10px;
}
Expand Down Expand Up @@ -94,14 +99,21 @@
title: 'Actions',
key: 'action',
fixed: 'right',
width: 150,
width: 170,
render (row, column, index) {
return `<i-button type="text" size="small" @click="edit(${index})">
return `
<i-button type="text" size="small" @click="edit(${index})">
<Icon type="edit" :size="16"></Icon></i-button>
<i-button type="text" size="small" @click="fakeDelete(${index})">
<Icon type="trash-a" :size="16"></Icon></i-button>
<i-button type="text" size="small" @click="view(${index})">
<Icon type="ios-eye" :size="16"></Icon></i-button>`
<Tooltip content="Check-in" placement="left">
<i-button type="text" size="small" @click="viewCheckin(${index})">
<Icon type="ios-eye" :size="16"></Icon></i-button>
</Tooltip>
<Tooltip content="Sign-up" placement="left">
<i-button type="text" size="small" @click="view#(${index})">
<Icon type="ios-list" :size="16"></Icon></i-button>
</Tooltip>`
}
}
]
Expand All @@ -124,13 +136,17 @@
let newEvent = copy(event)
newEvent.eventTime = moment(newEvent.eventTime).format('YYYY-MM-DD ddd HH:mm')
switch (newEvent.eventStatus) {
case 0: newEvent.eventStatus = 'Scheduled'
case 0:
newEvent.eventStatus = 'Scheduled'
break
case 1: newEvent.eventStatus = 'Boarding'
case 1:
newEvent.eventStatus = 'Boarding'
break
case 2: newEvent.eventStatus = 'Complete'
case 2:
newEvent.eventStatus = 'Complete'
break
default: newEvent.eventStatus = 'Unknown'
default:
newEvent.eventStatus = 'Unknown'
}
return newEvent
})
Expand Down Expand Up @@ -193,13 +209,21 @@
add () {
this.mode = 'Add'
},
view (index) {
viewCheckin (index) {
this.$router.push({
name: 'EventCheckList',
params: {
eventId: this.events[index].eventId
}
})
},
view# (index) {
this.$router.push({
name: 'EventSignList',
params: {
eventId: this.events[index].eventId
}
})
}
},
mounted () {
Expand Down
5 changes: 1 addition & 4 deletions src/components/pages/Event/EventCheckList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
},
methods: {
updateList () {
console.log('called')
// console.log('called')
const self = this
this.loading = true
this.$store.dispatch('fetchEventCheckList', {
Expand Down Expand Up @@ -170,9 +170,6 @@
}
})
},
magic () {
this.width = document.documentElement.clientWidth - this.sidenav
},
print () {
window.print()
},
Expand Down
168 changes: 168 additions & 0 deletions src/components/pages/Event/EventSignList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<template>
<div>
<spinner v-if="loading" :class="{'hide': loading}"></spinner>
<div v-show="!loading">
<Tooltip content="Go back" placement="top">
<i-button type="text" size="small" @click="$router.push({name: 'Event'})"
style="margin: 15px 5px 15px 30px">
<Icon type="chevron-left" :size="24"></Icon>
</i-button>
</Tooltip>
<Tooltip content="Print page" placement="top">
<i-button type="text" size="small" style="margin: 15px 0 15px 5px" @click="print">
<Icon type="printer" :size="24"></Icon>
</i-button>
</Tooltip>
<Tooltip content="Export csv" placement="top">
<i-button type="text" size="small" style="margin: 15px 0 15px 5px" @click="exportCsv">
<Icon type="ios-download" :size="24"></Icon>
</i-button>
</Tooltip>
<div class="print-section" style="margin-top: 30px">
<div class="container">
<h1 v-if="event !== undefined">{{event.eventName}}</h1>
<div v-if="event !== undefined">
<span>Time: {{eventTime}}</span>
<span style="margin-left: 20px">Total:{{data.length}}</span>
</div>
<h1 v-else>No Data!</h1>
</div>
<div class="container">
<Table
:columns="columns"
:data="data"
style="margin: 0 30px 30px 30px"
:width="661"
ref="table"></Table>
</div>
</div>
</div>
</div>
</template>

<style scoped>
.container {
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
flex-direction: column;
}
.hide {
height: 0;
}
.text-center {
text-align: center;
}
</style>
<script>
import Spinner from '../../Spinner'
import moment from 'moment'
import copy from '@/copy'
export default {
components: {
Spinner
},
name: 'EventSignList',
data () {
return {
sidenav: 0,
loading: false,
columns: [
{
title: 'Last Name',
key: 'lastName',
width: 132
},
{
title: 'First Name',
key: 'firstName',
width: 132
},
{
title: 'Nick Name',
key: 'preferredName',
width: 132
},
{
title: 'Dorm',
key: 'dorm',
width: 132
},
{
title: 'Sign-up Time',
key: '#Time',
width: 132
}
],
data: [],
showModal: false,
event: undefined
}
},
methods: {
updateList () {
// console.log('called')
const self = this
this.loading = true
this.$store.dispatch('fetchEventCheckList', {
eventId: this.$route.params['eventId'],
callback (ret) {
if (ret.success) {
self.data = ret.data.records.filter(r => {
return r.#Time >= 0
}).sort((a, b) => {
return (a.student.lastName < b.student.lastName ? -1 : (a.student.lastName > b.student.lastName ? 1 : 0))
}).map(r => {
let record = copy(r)
record.lastName = record.student.lastName
record.firstName = record.student.firstName
record.preferredName = record.student.preferredName
record.dorm = record.student.dorm
record.#Time = moment(record.#Time).format('ddd HH:mm:ss')
return record
})
self.loading = false
} else {
self.$Message.error('An error has occurred, try reload this page.')
}
self.loading = false
}
})
},
print () {
window.print()
},
exportCsv () {
this.$refs.table.exportCsv({
filename: 'EventSignList'
})
}
},
mounted () {
const self = this
if (this.$store.state.event.events.length === 0) {
this.$nextTick(() => {
self.$router.push({
name: 'Event'
})
})
} else {
this.loading = true
this.event = this.$store.state.event.events.filter(ev => {
return ev.eventId === self.$route.params['eventId']
})[0]
this.updateList()
}
},
computed: {
eventTime () {
return moment(this.event.eventTime).format('ddd MM/DD HH:mm')
}
}
}
</script>
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Vue.use(VueResize)
export const EventBus = new Vue()

export const axia = axios.create({
// baseURL: `https://api.aofactivities.com`
baseURL: `https://check.guardiantech.com.cn`
baseURL: `https://api.aofactivities.com`
// baseURL: `https://check.guardiantech.com.cn`
})

/* eslint-disable no-new */
Expand Down
6 changes: 6 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Router from 'vue-router'
import Dashboard from '@/components/pages/Dashboard/Dashboard.vue'
import Event from '@/components/pages/Event/Event.vue'
import EventCheckList from '@/components/pages/Event/EventCheckList.vue'
import EventSignList from '@/components/pages/Event/EventSignList.vue'
import EventGroup from '@/components/pages/EventGroup/EventGroup.vue'
import Sheet from '@/components/pages/Sheet/Sheet.vue'
import Student from '@/components/pages/Student/Student.vue'
Expand Down Expand Up @@ -31,6 +32,11 @@ export default new Router({
name: 'EventCheckList',
component: EventCheckList
},
{
path: '/eventsignlist/:eventId',
name: 'EventSignList',
component: EventSignList
},
{
path: '/event',
name: 'Event',
Expand Down

0 comments on commit 74fa330

Please # to comment.