|
@@ -3,14 +3,18 @@
|
|
|
<b-row class="prize-list-wrapper">
|
|
<b-row class="prize-list-wrapper">
|
|
|
<b-col md="6">
|
|
<b-col md="6">
|
|
|
<b-card title="獎項列表" style="height:75vh;">
|
|
<b-card title="獎項列表" style="height:75vh;">
|
|
|
- <b-table responsive hover :items="getPrizeList(prizeList)" bordered :fields="fields" @row-clicked="click"
|
|
|
|
|
- style="max-height: 65vh; overflow: auto;">
|
|
|
|
|
|
|
+ <b-table responsive hover sticky-header=true :items="getPrizeList(prizeList)" bordered :fields="fields" @row-clicked="click"
|
|
|
|
|
+ style="max-height: 57vh; overflow: auto;">
|
|
|
<template #cell(ICON)="data" class="text-center">
|
|
<template #cell(ICON)="data" class="text-center">
|
|
|
<div class="text-center">
|
|
<div class="text-center">
|
|
|
<feather-icon :icon="data.value" />
|
|
<feather-icon :icon="data.value" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</b-table>
|
|
</b-table>
|
|
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-3" variant="outline-primary" block
|
|
|
|
|
+ @click="showAddPrize">
|
|
|
|
|
+ 加碼
|
|
|
|
|
+ </b-button>
|
|
|
</b-card>
|
|
</b-card>
|
|
|
</b-col>
|
|
</b-col>
|
|
|
|
|
|
|
@@ -28,16 +32,14 @@
|
|
|
@click="hideModal">
|
|
@click="hideModal">
|
|
|
Close
|
|
Close
|
|
|
</b-button>
|
|
</b-button>
|
|
|
- <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="outline-primary" block
|
|
|
|
|
- v-b-modal.draw-animation @click="draw">
|
|
|
|
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="primary" block @click="draw">
|
|
|
Accept
|
|
Accept
|
|
|
</b-button>
|
|
</b-button>
|
|
|
-
|
|
|
|
|
</b-modal>
|
|
</b-modal>
|
|
|
|
|
|
|
|
- <b-modal ref="draw-error" centered title="抽獎" no-stacking hide-footer>
|
|
|
|
|
|
|
+ <b-modal ref="draw-error" centered title="抽獎錯誤" no-stacking hide-footer>
|
|
|
<b-card-text class="my-1 text-center">
|
|
<b-card-text class="my-1 text-center">
|
|
|
- 獎品數量以抽完
|
|
|
|
|
|
|
+ 抽獎錯誤
|
|
|
</b-card-text>
|
|
</b-card-text>
|
|
|
<b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-3" variant="outline-secondary" block
|
|
<b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-3" variant="outline-secondary" block
|
|
|
@click="hideModal">
|
|
@click="hideModal">
|
|
@@ -45,7 +47,7 @@
|
|
|
</b-button>
|
|
</b-button>
|
|
|
</b-modal>
|
|
</b-modal>
|
|
|
|
|
|
|
|
- <b-modal ref="draw-animation" id="draw-animation" title="抽獎" centered no-stacking hide-footer>
|
|
|
|
|
|
|
+ <b-modal ref="draw-animation" title="得獎者是......" centered no-stacking hide-footer>
|
|
|
<br>
|
|
<br>
|
|
|
<div :key="index" v-for="(item, index) in drawList" :class=counterId(index)>
|
|
<div :key="index" v-for="(item, index) in drawList" :class=counterId(index)>
|
|
|
<i :datafinal=item.department>部門</i>
|
|
<i :datafinal=item.department>部門</i>
|
|
@@ -58,15 +60,40 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="outline-primary" block
|
|
|
|
|
|
|
+ <div v-if="onlyOne(drawNumber)">
|
|
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="outline-primary" block
|
|
|
|
|
+ @click="donate">
|
|
|
|
|
+ 捐出
|
|
|
|
|
+ </b-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="primary" block @click="store">
|
|
|
|
|
+ Accept
|
|
|
|
|
+ </b-button>
|
|
|
|
|
+ </b-modal>
|
|
|
|
|
+
|
|
|
|
|
+ <b-modal ref="add-prize" centered title="加碼" no-stacking hide-footer>
|
|
|
|
|
+ <label>獎品:</label>
|
|
|
|
|
+ <b-form-input v-model="addPrizeName" />
|
|
|
|
|
+ <br>
|
|
|
|
|
+ <label>加碼者: </label>
|
|
|
|
|
+ <b-form-input v-model="addPrizeUser" />
|
|
|
|
|
+ <br>
|
|
|
|
|
+ <label>數量: </label>
|
|
|
|
|
+ <b-form-spinbutton v-model="addPrizeNumber" min="1" />
|
|
|
|
|
+
|
|
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-3" variant="outline-secondary" block
|
|
|
@click="hideModal">
|
|
@click="hideModal">
|
|
|
|
|
+ Close
|
|
|
|
|
+ </b-button>
|
|
|
|
|
+ <b-button v-ripple.400="'rgba(255, 255, 255, 0.15)'" class="mt-2" variant="primary" block @click="addPrize">
|
|
|
Accept
|
|
Accept
|
|
|
</b-button>
|
|
</b-button>
|
|
|
</b-modal>
|
|
</b-modal>
|
|
|
|
|
|
|
|
<b-col md="6">
|
|
<b-col md="6">
|
|
|
<b-card title="抽獎紀錄" style="height:75vh;">
|
|
<b-card title="抽獎紀錄" style="height:75vh;">
|
|
|
- <b-table responsive :items="getRecipientsList(recipientsList)" bordered
|
|
|
|
|
|
|
+ <b-table responsive sticky-header=true :items="getRecipientsList(recipientsList)" bordered
|
|
|
style="max-height: 65vh; overflow: auto;">
|
|
style="max-height: 65vh; overflow: auto;">
|
|
|
<template #cell(ICON)="data" class="text-center">
|
|
<template #cell(ICON)="data" class="text-center">
|
|
|
<div class="text-center">
|
|
<div class="text-center">
|
|
@@ -111,7 +138,6 @@ export default {
|
|
|
activityId: this.$route.params.activity_id,
|
|
activityId: this.$route.params.activity_id,
|
|
|
activity: {},
|
|
activity: {},
|
|
|
userList: [],
|
|
userList: [],
|
|
|
- userIdList: [],
|
|
|
|
|
departmentList: [],
|
|
departmentList: [],
|
|
|
prizeList: [],
|
|
prizeList: [],
|
|
|
recipientsList: [],
|
|
recipientsList: [],
|
|
@@ -126,7 +152,55 @@ export default {
|
|
|
prizeId: '',
|
|
prizeId: '',
|
|
|
drawList: [],
|
|
drawList: [],
|
|
|
|
|
|
|
|
- departments: ["行政管理部", "行政管理部庶務科", "人力資源科", "行政管理部文書科", "南區辦事處", "中區辦事處", "工程管理一部", "工程管理二部", "c3工地", "發展與企畫部", "工程製圖科", "工務部", "大地工程部", "財務部", "六張犁工地", "中華郵政工地", "法務部調查局工地", "三峽國光工地", "河濱高中工地", "運輸及土木工程部", "城鄉發展部", "軌道工程部", "董事長室", "總經理室", "企業發展中心", "成本中心", "資訊中心", "環境及水資源工程部", "環境水務部", "環境永續部", "機電系統工程部", "結構工程部", "工程設計群", "工程監理群", "總管理處", "建築及設施群", "數位工程發展部", "淡海輕軌計畫監造專案", "安坑輕軌計畫監造專案", "先進技術中心", "塭仔圳市地重劃公共工程專案管理與監造專案", "萬大果菜市場專案"]
|
|
|
|
|
|
|
+ addPrizeName: '',
|
|
|
|
|
+ addPrizeUser: '',
|
|
|
|
|
+ addPrizeNumber: 1,
|
|
|
|
|
+
|
|
|
|
|
+ departments: [
|
|
|
|
|
+ "行政管理部",
|
|
|
|
|
+ "行政管理部庶務科",
|
|
|
|
|
+ "人力資源科",
|
|
|
|
|
+ "行政管理部文書科",
|
|
|
|
|
+ "南區辦事處",
|
|
|
|
|
+ "中區辦事處",
|
|
|
|
|
+ "工程管理一部",
|
|
|
|
|
+ "工程管理二部",
|
|
|
|
|
+ "c3工地",
|
|
|
|
|
+ "發展與企畫部",
|
|
|
|
|
+ "工程製圖科",
|
|
|
|
|
+ "工務部",
|
|
|
|
|
+ "大地工程部",
|
|
|
|
|
+ "財務部",
|
|
|
|
|
+ "六張犁工地",
|
|
|
|
|
+ "中華郵政工地",
|
|
|
|
|
+ "法務部調查局工地",
|
|
|
|
|
+ "三峽國光工地",
|
|
|
|
|
+ "河濱高中工地",
|
|
|
|
|
+ "運輸及土木工程部",
|
|
|
|
|
+ "城鄉發展部",
|
|
|
|
|
+ "軌道工程部",
|
|
|
|
|
+ "董事長室",
|
|
|
|
|
+ "總經理室",
|
|
|
|
|
+ "企業發展中心",
|
|
|
|
|
+ "成本中心",
|
|
|
|
|
+ "資訊中心",
|
|
|
|
|
+ "環境及水資源工程部",
|
|
|
|
|
+ "環境水務部",
|
|
|
|
|
+ "環境永續部",
|
|
|
|
|
+ "機電系統工程部",
|
|
|
|
|
+ "結構工程部",
|
|
|
|
|
+ "工程設計群",
|
|
|
|
|
+ "工程監理群",
|
|
|
|
|
+ "總管理處",
|
|
|
|
|
+ "建築及設施群",
|
|
|
|
|
+ "數位工程發展部",
|
|
|
|
|
+ "淡海輕軌計畫監造專案",
|
|
|
|
|
+ "安坑輕軌計畫監造專案",
|
|
|
|
|
+ "先進技術中心",
|
|
|
|
|
+ "塭仔圳市地重劃公共工程專案管理與監造專案",
|
|
|
|
|
+ "萬大果菜市場專案",
|
|
|
|
|
+ "來賓"
|
|
|
|
|
+ ]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -138,10 +212,6 @@ export default {
|
|
|
this.userList = res.data;
|
|
this.userList = res.data;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- useJwt.postData('/api/user/index').then(res => {
|
|
|
|
|
- this.userIdList = res.data;
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
useJwt.postData('/api/prize/index_by_activity', { activityId: this.activityId }).then(res => {
|
|
useJwt.postData('/api/prize/index_by_activity', { activityId: this.activityId }).then(res => {
|
|
|
this.prizeList = res.data;
|
|
this.prizeList = res.data;
|
|
|
});
|
|
});
|
|
@@ -183,16 +253,28 @@ export default {
|
|
|
getRecipientsList(recipientsList) {
|
|
getRecipientsList(recipientsList) {
|
|
|
var output = [];
|
|
var output = [];
|
|
|
recipientsList.forEach(element => {
|
|
recipientsList.forEach(element => {
|
|
|
- output.push({ '獎項': this.getPrizeName(element.prize_id), '獲獎人': this.userIdList[element.user_id], '時間': this.dateFormat(element.created_at) });
|
|
|
|
|
|
|
+ output.push({ '獎項': this.getPrizeName(element.prize_id), '獲獎人': this.userList[element.user_id], '時間': this.dateFormat(element.created_at) });
|
|
|
});
|
|
});
|
|
|
return output;
|
|
return output;
|
|
|
},
|
|
},
|
|
|
counterId(id) {
|
|
counterId(id) {
|
|
|
return "counter_" + id;
|
|
return "counter_" + id;
|
|
|
},
|
|
},
|
|
|
|
|
+ onlyOne(number) {
|
|
|
|
|
+ if (number == 1) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ },
|
|
|
showDraw() {
|
|
showDraw() {
|
|
|
this.$refs['draw-modal'].show();
|
|
this.$refs['draw-modal'].show();
|
|
|
},
|
|
},
|
|
|
|
|
+ showDrawAnimation() {
|
|
|
|
|
+ this.$refs['draw-animation'].show();
|
|
|
|
|
+ },
|
|
|
|
|
+ showAddPrize() {
|
|
|
|
|
+ this.$refs['add-prize'].show();
|
|
|
|
|
+ },
|
|
|
showDrawError() {
|
|
showDrawError() {
|
|
|
this.$refs['draw-error'].show();
|
|
this.$refs['draw-error'].show();
|
|
|
},
|
|
},
|
|
@@ -200,6 +282,7 @@ export default {
|
|
|
this.$refs['draw-modal'].hide();
|
|
this.$refs['draw-modal'].hide();
|
|
|
this.$refs['draw-error'].hide();
|
|
this.$refs['draw-error'].hide();
|
|
|
this.$refs['draw-animation'].hide();
|
|
this.$refs['draw-animation'].hide();
|
|
|
|
|
+ this.$refs['add-prize'].hide();
|
|
|
this.updateDataset();
|
|
this.updateDataset();
|
|
|
},
|
|
},
|
|
|
updateDataset() {
|
|
updateDataset() {
|
|
@@ -223,16 +306,69 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
draw() {
|
|
draw() {
|
|
|
- useJwt.postData('/api/draw/draw', { activity_id: this.activityId, prize_id: this.prizeId, region: this.region, number: this.drawNumber }).then(res => {
|
|
|
|
|
- if(res.data){
|
|
|
|
|
|
|
+ useJwt.postData('/api/draw/draw', {
|
|
|
|
|
+ activity_id: this.activityId,
|
|
|
|
|
+ prize_id: this.prizeId,
|
|
|
|
|
+ region: this.region,
|
|
|
|
|
+ number: this.drawNumber
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.data) {
|
|
|
this.drawList = res.data;
|
|
this.drawList = res.data;
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.count();
|
|
this.count();
|
|
|
- }, 100);
|
|
|
|
|
|
|
+ }, 500);
|
|
|
|
|
+ this.showDrawAnimation();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.showDrawError();
|
|
|
|
|
+ console.log("draw error");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ store() {
|
|
|
|
|
+ var idList = [];
|
|
|
|
|
+ this.drawList.forEach(element => {
|
|
|
|
|
+ idList.push(element.user_id);
|
|
|
|
|
+ });
|
|
|
|
|
+ useJwt.postData('/api/draw/store', {
|
|
|
|
|
+ users: idList,
|
|
|
|
|
+ prize_id: String(this.prizeId),
|
|
|
|
|
+ number: this.drawNumber
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.data) {
|
|
|
|
|
+ console.log("store success");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("store error");
|
|
|
|
|
+ }
|
|
|
|
|
+ this.hideModal();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ donate() {
|
|
|
|
|
+ var idList = [];
|
|
|
|
|
+ this.drawList.forEach(element => {
|
|
|
|
|
+ idList.push(element.user_id);
|
|
|
|
|
+ });
|
|
|
|
|
+ useJwt.postData('/api/draw/donate', { users: idList }).then(res => {
|
|
|
|
|
+ if (res.data) {
|
|
|
|
|
+ console.log("donate success");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("donate error");
|
|
|
|
|
+ }
|
|
|
|
|
+ this.hideModal();
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ addPrize() {
|
|
|
|
|
+ useJwt.postData('/api/prize/store', {
|
|
|
|
|
+ activity_id: this.activityId,
|
|
|
|
|
+ name: this.addPrizeName,
|
|
|
|
|
+ provider: this.addPrizeUser,
|
|
|
|
|
+ count: this.addPrizeNumber
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.data) {
|
|
|
|
|
+ console.log("add prize success");
|
|
|
} else {
|
|
} else {
|
|
|
- this.hideModal();
|
|
|
|
|
- console.log("error");
|
|
|
|
|
|
|
+ console.log("add prize error");
|
|
|
}
|
|
}
|
|
|
|
|
+ this.hideModal();
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
count() {
|
|
count() {
|