Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Commit

Permalink
[#164] feat: WishBook 어드민 페이지를 추가한다
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDevLuffy committed May 30, 2020
1 parent 5607ec2 commit f8833b4
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 3 deletions.
9 changes: 9 additions & 0 deletions tecobrary-admin/src/front/src/api/wishBook.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import request from '@/utils/request'

export const getWishBooks = (query) => request({
url: '/api/wishbook',
method: 'get',
params: Object.assign(query, {
page: query.page
})
})
126 changes: 123 additions & 3 deletions tecobrary-admin/src/front/src/views/wishbook/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,125 @@
<template>
<div>
희망도서 현재 내역
<div class="app-container">
<!-- 검색부 -->
<el-form :inline="true" :model="queryForm">
<el-form-item label="제목">
<el-input v-model="queryForm.title"></el-input>
</el-form-item>
<el-form-item label="저자">
<el-input v-model="queryForm.author"></el-input>
</el-form-item>
<el-form-item label="출판사">
<el-input v-model="queryForm.publisher"></el-input>
</el-form-item>
<el-form-item label="isbn">
<el-input v-model="queryForm.isbn"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">검색</el-button>
</el-form-item>
</el-form>

<!-- 책 리스트 -->
<el-table
empty-text="희망도서가 없습니다."
:data="wishBooks.content"
style="width: 100%; min-height: 400px;"
highlight-current-row
fit
>
<el-table-column align="center" label="번호" width="100">
<span slot-scope="scope">{{ scope.row.id }}</span>
</el-table-column>
<el-table-column align="center" label="제목">
<span slot-scope="scope" class="link-type" @click="onClickTitle(scope.row.id)">{{ scope.row.title }}</span>
</el-table-column>
<el-table-column align="center" label="작가">
<span slot-scope="scope">{{ scope.row.author }}</span>
</el-table-column>
<el-table-column align="center" label="출판사">
<span slot-scope="scope">{{ scope.row.publisher }}</span>
</el-table-column>
<el-table-column align="center" label="ISBN">
<span slot-scope="scope">{{ scope.row.isbn }}</span>
</el-table-column>
<el-table-column align="center" label="신청자">
<span slot-scope="scope">{{ scope.row.requestUser }}</span>
</el-table-column>
<el-table-column align="center" label="신청일자">
<span slot-scope="scope">{{ scope.row.createdAt }}</span>
</el-table-column>
</el-table>

<!-- 페이지네이션 -->
<div class="block" style="margin: 16px;">
<el-pagination
:current-page="queryForm.page"
:page-sizes="[10, 20, 30, 50]"
:page-size="queryForm.size"
layout="total, sizes, prev, pager, next, jumper"
:total="wishBooks.totalElements"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
</div>
</div>
</template>
</template>

<script>
import {getWishBooks} from "@/api/wishBook";
export default {
data() {
return {
queryForm: {
title: '',
author: '',
publisher: '',
isbn: '',
page: 0,
size: 10
},
wishBooks: {
totalElements: 1,
totalPages: 1,
number: 1,
content: []
},
}
},
async beforeMount() {
await this.fetchWishBooks()
},
methods: {
async fetchWishBooks() {
try {
const response = await getWishBooks(this.queryForm)
const {content, totalElements, totalPages, number} = response
this.wishBooks.content = content
this.wishBooks.totalElements = totalElements
this.wishBooks.totalPages = totalPages
this.wishBooks.number = number
console.log(this.wishBooks)
} catch (e) {
console.log(e)
}
},
async onSubmit() {
await this.fetchWishBooks()
},
handleSizeChange(size) {
this.queryForm.size = size
},
handleCurrentChange(page) {
this.queryForm.page = page
}
}
}
</script>

0 comments on commit f8833b4

Please sign in to comment.