|
|
|
|
@ -1,34 +1,54 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<xy-dialog ref="dialog" :width='60' :is-show.sync="isShow" type="normal" title="花名册"
|
|
|
|
|
>
|
|
|
|
|
<xy-dialog ref="dialog" :width='60' :is-show.sync="isShow" type="normal" title="花名册">
|
|
|
|
|
<template v-slot:normalContent>
|
|
|
|
|
<xy-table :list="bookList" :isPage="false"
|
|
|
|
|
:table-item="table">
|
|
|
|
|
<Button type="primary" style="margin-left: 10px;margin-bottom:10px" @click="$refs['addBook'].type='add',
|
|
|
|
|
$refs['addBook'].setlistTeam(listTeam),
|
|
|
|
|
$refs['addBook'].setTeamId(id,name),
|
|
|
|
|
$refs['addBook'].isShow=true">新增人员</Button>
|
|
|
|
|
<xy-table :list="bookList" :isPage="false" :table-item="table">
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column fixed="right" label="操作" width="260" header-align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div>
|
|
|
|
|
<Button type="primary" size="small" @click="$refs['addBook'].type='editor',
|
|
|
|
|
$refs['addBook'].id=scope.row.id,
|
|
|
|
|
$refs['addBook'].setlistTeam(listTeam),
|
|
|
|
|
$refs['addBook'].setTeamId(id,name),
|
|
|
|
|
$refs['addBook'].isShow=true">编辑</Button>
|
|
|
|
|
<Poptip transfer confirm title="确认要删除吗?" @on-ok="delRow(scope.row.id)">
|
|
|
|
|
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
|
|
|
|
|
</Poptip>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
</xy-table>
|
|
|
|
|
</template>
|
|
|
|
|
</xy-dialog>
|
|
|
|
|
|
|
|
|
|
<addBook ref="addBook" @refresh="getBooks"></addBook>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import addBook from "@/views/books/components/addBook.vue"
|
|
|
|
|
import {
|
|
|
|
|
index
|
|
|
|
|
index,
|
|
|
|
|
destroy
|
|
|
|
|
} from "@/api/system/baseForm.js"
|
|
|
|
|
export default {
|
|
|
|
|
|
|
|
|
|
components: {
|
|
|
|
|
addBook
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isShow: false,
|
|
|
|
|
id: '',
|
|
|
|
|
name:'',
|
|
|
|
|
tableName: 'books',
|
|
|
|
|
bookList: [],
|
|
|
|
|
listTeam:[],
|
|
|
|
|
table: [{
|
|
|
|
|
label: '序号',
|
|
|
|
|
type: 'index',
|
|
|
|
|
@ -59,6 +79,7 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getTeamList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async getBooks() {
|
|
|
|
|
@ -74,6 +95,28 @@
|
|
|
|
|
})
|
|
|
|
|
this.bookList = res.data
|
|
|
|
|
},
|
|
|
|
|
async getTeamList() {
|
|
|
|
|
const res = await index({
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 999,
|
|
|
|
|
table_name: 'teams'
|
|
|
|
|
})
|
|
|
|
|
this.listTeam = res.data
|
|
|
|
|
},
|
|
|
|
|
delRow(id) {
|
|
|
|
|
if (id) {
|
|
|
|
|
destroy({
|
|
|
|
|
id: id,
|
|
|
|
|
table_name: 'books',
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '删除成功'
|
|
|
|
|
})
|
|
|
|
|
this.getBooks()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
isShow(newVal) {
|
|
|
|
|
@ -81,6 +124,7 @@
|
|
|
|
|
this.getBooks()
|
|
|
|
|
} else {
|
|
|
|
|
this.bookList = []
|
|
|
|
|
this.name = ''
|
|
|
|
|
this.$refs['dialog'].reset()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|