| | |
| | | <template> |
| | | <div id=""> |
| | | 公益报名 |
| | | |
| | | </div> |
| | | <basicContainer> |
| | | <avue-crud :data="data" ref="crud" :table-loading="loading" @current-change="currentChange" |
| | | @search-change="searchChange" @search-reset="searchReset" @size-change="sizeChange" :option="option" |
| | | v-model="data" :page="page" @selection-change="selectionChange" @row-del="rowDel" @refresh-change="refreshChange" |
| | | @on-load="onLoad"> |
| | | <template slot="menuLeft"> |
| | | <!-- <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删 除 |
| | | </el-button> --> |
| | | <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.user_delete" |
| | | @click="handleDelete">批量删除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basicContainer> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getListPd, |
| | | getDetailPd, |
| | | addPd, |
| | | updatePd, |
| | | removePd |
| | | } from "@/api/discuss/publicDiscuss"; |
| | | import option from "@/option/discuss/publicDiscuss"; |
| | | import { |
| | | mapGetters |
| | | } from "vuex"; |
| | | import { |
| | | getDictionary |
| | | } from '@/api/system/dict' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | // 弹框标题 |
| | | title: '', |
| | | // 是否展示弹框 |
| | | box: false, |
| | | // 是否显示查询 |
| | | search: true, |
| | | // 加载中 |
| | | loading: true, |
| | | // 是否为查看模式 |
| | | view: false, |
| | | // 查询信息 |
| | | query: {}, |
| | | // 分页信息 |
| | | page: { |
| | | pageSize: 10, |
| | | pageSizes: [10, 20, 30, 50, 100], |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | // 表单数据 |
| | | form: {}, |
| | | // 选择行 |
| | | selectionList: [], |
| | | // 表单配置 |
| | | option: option, |
| | | // 表单列表 |
| | | data: [], |
| | | } |
| | | }, |
| | | mounted() { |
| | | // this.init(); |
| | | // this.onLoad(this.page); |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | methods: { |
| | | init() {}, |
| | | searchHide() { |
| | | this.search = !this.search; |
| | | }, |
| | | searchChange() { |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page); |
| | | }, |
| | | handleSubmit() { |
| | | if (!this.form.id) { |
| | | addPd(this.form).then(() => { |
| | | this.box = false; |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | } else { |
| | | updatePd(this.form).then(() => { |
| | | this.box = false; |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }) |
| | | } |
| | | }, |
| | | handleAdd() { |
| | | this.title = '新增' |
| | | this.form = {} |
| | | this.box = true |
| | | }, |
| | | handleEdit(row) { |
| | | this.title = '编辑' |
| | | this.box = true |
| | | getDetailPd(row.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | }, |
| | | handleView(row) { |
| | | this.title = '查看' |
| | | this.view = true; |
| | | this.box = true; |
| | | getDetailPd(row.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return removePd(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.selectionClear(); |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | | beforeClose(done) { |
| | | done() |
| | | this.form = {}; |
| | | this.view = false; |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | // this.$refs.table.clearSelection(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | this.onLoad(this.page); |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | this.onLoad(this.page); |
| | | }, |
| | | onLoad(page, params = { |
| | | eventType: 0 |
| | | }) { |
| | | this.loading = true; |
| | | getListPd(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | <style lang="scss" scoped> |
| | | .el-pagination { |
| | | margin-top: 20px; |
| | | } |
| | | </style> |