2 files modified
1 files added
| New file |
| | |
| | | <!-- |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2024-01-04 15:18:13 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2024-01-04 17:13:22 |
| | | * @FilePath: \jczz_web\src\views\article\components\deitDiscussion.vue |
| | | * @Description: |
| | | * |
| | | * Copyright (c) 2024 by shuishen, All Rights Reserved. |
| | | --> |
| | | <template> |
| | | <div> |
| | | <el-dialog title="" append-to-body :visible.sync="popupTableShow" width="80%" :before-close="handleClose"> |
| | | <span slot="title" class="dialog-footer"> |
| | | {{ ontitle }} |
| | | </span> |
| | | |
| | | <div id="" v-if="editFlag"> |
| | | <avue-form @submit="handleSubmit" :option="optionDiscuss" @reset-change="handleReset" v-model="disCussFrom"> |
| | | </avue-form> |
| | | </div> |
| | | |
| | | <div id="" v-if="!editFlag"> |
| | | <avue-crud :table-loading="loading" :option="optionList" :data="data" v-model="form" ref="crud" |
| | | @row-update="rowUpdate" @row-del="rowDel"> |
| | | <template slot="menuLeft" v-if="!editFlag"> |
| | | <el-button type="primary" size="small" plain icon="el-icon-circle-plus-outline" @click="add()">添加 |
| | | </el-button> |
| | | </template> |
| | | <template #icon="scope"> |
| | | <i :class="scope.row.icon" style="font-size:14px"></i> |
| | | </template> |
| | | <template #menu="{ row, size }"> |
| | | <el-button v-if="row.level === 1" :size="size" text type="primary" @click="edit(row)">编辑</el-button> |
| | | <el-button v-if="row.level === 1" :size="size" text type="danger" |
| | | @click="deletes(row)">删除</el-button> |
| | | <el-button v-if="row.level === 2" :size="size" text type="primary" @click="openUser(row, 1)"> |
| | | 选择此项人数:{{ row.number }} 详情</el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog title="" append-to-body :visible.sync="popupTableUserShow" width="50%" :before-close="userHandleClose"> |
| | | <avue-crud :data="userData" :page="userPage" :option="userOption"></avue-crud> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getListPd, |
| | | getDetailPd, |
| | | addPd, |
| | | updatePd, |
| | | removePd |
| | | } from "@/api/discuss/publicDiscuss" |
| | | |
| | | import { |
| | | getPage |
| | | } from "@/api/discuss/userTopics" |
| | | |
| | | |
| | | import { |
| | | getLists, |
| | | getList, |
| | | getDetail, |
| | | add, |
| | | update, |
| | | remove |
| | | } from "@/api/discuss/topics" |
| | | |
| | | export default { |
| | | data () { |
| | | return { |
| | | popupTableShow: false, |
| | | popupTableUserShow: false, |
| | | |
| | | loading: true, |
| | | |
| | | ontitle: '编辑议题', |
| | | editFlag: false, |
| | | |
| | | disCussFrom: { |
| | | discussContent: '', |
| | | optionRange: 0, |
| | | sort: 1, |
| | | optionContent: '', |
| | | optionDetail: '', |
| | | number: '', |
| | | createTime: '', |
| | | updateTime: '', |
| | | deleteFlag: '', |
| | | publicDiscussId: '', |
| | | parentId: '', |
| | | level: '', |
| | | children: [{ |
| | | optionContent: '', |
| | | optionDetail: '', |
| | | number: '', |
| | | createTime: '', |
| | | updateTime: '', |
| | | deleteFlag: '', |
| | | publicDiscussId: '', |
| | | parentId: '', |
| | | level: '', |
| | | }] |
| | | }, |
| | | optionDiscuss: { |
| | | emptyText: '取消', |
| | | column: [ |
| | | { |
| | | label: '议题', |
| | | prop: 'discussContent', |
| | | type: 'input', |
| | | row: true, |
| | | }, |
| | | { |
| | | label: '选项范围', |
| | | prop: 'optionRange', |
| | | type: 'radio', |
| | | button: true, |
| | | row: true, |
| | | dicData: [{ |
| | | label: '多选', |
| | | value: 1 |
| | | }, { |
| | | label: '单选', |
| | | value: 0 |
| | | }] |
| | | }, |
| | | { |
| | | label: '排序', |
| | | prop: 'sort', |
| | | controlsPosition: '', |
| | | type: 'number' |
| | | }, |
| | | { |
| | | label: '选项内容', |
| | | prop: 'children', |
| | | type: 'dynamic', |
| | | span: 24, |
| | | children: { |
| | | column: [{ |
| | | label: '选项标题', |
| | | prop: 'optionContent', |
| | | type: 'input', |
| | | rules: [{ |
| | | required: true, |
| | | message: '请输入选项标题', |
| | | trigger: 'blur' |
| | | }] |
| | | }, { |
| | | label: '选项说明', |
| | | prop: 'optionDetail', |
| | | type: 'input', |
| | | }] |
| | | } |
| | | }, |
| | | ] |
| | | }, |
| | | |
| | | // 表单数据 |
| | | form: {}, |
| | | data: [], |
| | | optionList: { |
| | | headerAlign: 'center', |
| | | align: 'center', |
| | | border: true, |
| | | addBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | defaultExpandAll: true, |
| | | rowKey: 'id', |
| | | rowParentKey: 'parentId', |
| | | column: [ |
| | | { |
| | | label: '标题', |
| | | prop: 'discussContent', |
| | | }, |
| | | { |
| | | label: '选项内容', |
| | | prop: 'optionContent', |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | publicDiscussId: '', |
| | | |
| | | userData: [], |
| | | userOption: { |
| | | addBtn: false, |
| | | menu: false, |
| | | column: [{ |
| | | label: '姓名', |
| | | prop: 'name' |
| | | }, { |
| | | label: '头像', |
| | | prop: 'avatar' |
| | | }, { |
| | | label: '手机', |
| | | prop: 'phone' |
| | | }, { |
| | | label: '小区', |
| | | prop: 'aoiName' |
| | | }, { |
| | | label: '地址', |
| | | prop: 'addressName' |
| | | }, { |
| | | label: '时间', |
| | | prop: 'createTime' |
| | | }] |
| | | }, |
| | | // 分页信息 |
| | | userPage: { |
| | | pageSize: 10, |
| | | pageSizes: [10, 20, 30, 50, 100], |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | } |
| | | }, |
| | | |
| | | watch: { |
| | | }, |
| | | |
| | | methods: { |
| | | initData (newData) { |
| | | this.editFlag = false |
| | | this.popupTableShow = true |
| | | this.publicDiscussId = newData.id |
| | | |
| | | this.onLoad() |
| | | }, |
| | | |
| | | handleClose () { |
| | | this.popupTableShow = false |
| | | this.disCussFrom = {} |
| | | }, |
| | | |
| | | handleSubmit (form, done) { |
| | | done() |
| | | form.publicDiscussId = this.publicDiscussId |
| | | |
| | | add(form).then( |
| | | () => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }) |
| | | form = {} |
| | | this.editFlag = false |
| | | |
| | | let params = { |
| | | level: 1, |
| | | publicDiscussId: this.publicDiscussId |
| | | } |
| | | |
| | | getLists(1, 100, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data |
| | | this.data = data |
| | | }) |
| | | }, |
| | | (error) => { |
| | | window.console.log(error) |
| | | } |
| | | ) |
| | | }, |
| | | |
| | | handleReset () { |
| | | this.editFlag = false |
| | | }, |
| | | |
| | | // 提交修改 |
| | | rowUpdate (row, index, done, loading) { |
| | | done() |
| | | if (!row.id) { |
| | | addPd(row).then(() => { |
| | | this.onLoad() |
| | | |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | }) |
| | | } else { |
| | | updatePd(row).then(() => { |
| | | this.onLoad() |
| | | |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | rowDel (row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad() |
| | | |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | add () { |
| | | this.editFlag = true |
| | | }, |
| | | |
| | | edit (row) { |
| | | this.disCussFrom = row |
| | | this.editFlag = true |
| | | }, |
| | | |
| | | deletes (row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad() |
| | | |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | openUser (row, type = 0) { |
| | | this.popupTableUserShow = true |
| | | |
| | | if (type == 0) { |
| | | this.userParams = { |
| | | publicDiscussId: row.id |
| | | } |
| | | } else { |
| | | this.userParams = { |
| | | topicsId: row.id |
| | | } |
| | | } |
| | | this.getUserPage(this.userPage, this.userParams) |
| | | }, |
| | | |
| | | getUserPage (page, params = {}) { |
| | | getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data |
| | | this.userPage.total = data.total |
| | | this.userData = data.records |
| | | }) |
| | | }, |
| | | |
| | | onLoad () { |
| | | this.loading = true |
| | | |
| | | let params = { |
| | | level: 1, |
| | | publicDiscussId: this.publicDiscussId |
| | | } |
| | | |
| | | getLists(1, 100, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data |
| | | this.data = data |
| | | this.loading = false |
| | | }) |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped></style> |
| | |
| | | <template slot-scope="scope" slot="menu"> |
| | | <!-- <el-button type="text" icon="el-icon-edit" size="small" @click.stop="openEdit(scope.row,scope.index)">编辑 |
| | | </el-button> --> |
| | | <el-button type="primary" icon="el-icon-edit" size="small" @click.stop="openDilog(scope.row,scope.index)">编辑议题 |
| | | <el-button type="primary" icon="el-icon-edit" size="small" |
| | | @click.stop="openDilog(scope.row, scope.index)">编辑议题 |
| | | </el-button> |
| | | <el-button type="primary" icon="el-icon-edit" size="small" @click.stop="openUser(scope.row,0)">参与用户 |
| | | </el-button> |
| | |
| | | </template> |
| | | <template #menu="{row,size}"> |
| | | <el-button v-if="row.level === 1" :size="size" text type="primary" @click="edit(row)">编辑</el-button> |
| | | <el-button v-if="row.level === 1" :size="size" text type="danger" @click="deletes(row)">删除</el-button> |
| | | <el-button v-if="row.level === 1" :size="size" text type="danger" |
| | | @click="deletes(row)">删除</el-button> |
| | | <el-button v-if="row.level === 2" :size="size" text type="primary" @click="openUser(row,1)">选择此项人数 |
| | | :{{row.number}} 详情</el-button> |
| | | </template> |
| | |
| | | addPd, |
| | | updatePd, |
| | | removePd |
| | | } from "@/api/discuss/publicDiscuss"; |
| | | } from "@/api/discuss/publicDiscuss" |
| | | |
| | | import { |
| | | getLists, |
| | |
| | | add, |
| | | update, |
| | | remove |
| | | } from "@/api/discuss/topics"; |
| | | } from "@/api/discuss/topics" |
| | | |
| | | import { |
| | | getPage |
| | | } from "@/api/discuss/userTopics"; |
| | | } from "@/api/discuss/userTopics" |
| | | |
| | | import option from "@/option/discuss/publicDiscuss"; |
| | | import option from "@/option/discuss/publicDiscuss" |
| | | import { |
| | | mapGetters |
| | | } from "vuex"; |
| | | } from "vuex" |
| | | import { |
| | | getDictionary |
| | | } from '@/api/system/dict' |
| | |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | ids() { |
| | | let ids = []; |
| | | let ids = [] |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | ids.push(ele.id) |
| | | }) |
| | | return ids.join(",") |
| | | } |
| | | }, |
| | | methods: { |
| | | rowSave(row, done, loading) { |
| | | addPd(row).then( |
| | | () => { |
| | | this.onLoad(this.discussion); |
| | | this.onLoad(this.discussion) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }) |
| | | done() |
| | | }, |
| | | (error) => { |
| | | window.console.log(error); |
| | | loading(); |
| | | window.console.log(error) |
| | | loading() |
| | | } |
| | | ); |
| | | ) |
| | | }, |
| | | |
| | | |
| | |
| | | // title: data.title |
| | | // } |
| | | this.form.title = data.title |
| | | this.form.articleId = data.id; |
| | | this.form.articleId = data.id |
| | | this.onLoad(data) |
| | | }, |
| | | |
| | |
| | | |
| | | getUserPage(page, params = {}) { |
| | | getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.pageUser.total = data.total; |
| | | this.userData = data.records; |
| | | }); |
| | | const data = res.data.data |
| | | this.pageUser.total = data.total |
| | | this.userData = data.records |
| | | }) |
| | | }, |
| | | |
| | | openEdit(row) { |
| | | this.discussForm = row |
| | | let times = new Date(row.endTime).getTime(); |
| | | let times = new Date(row.endTime).getTime() |
| | | this.discussForm.endTime = times |
| | | this.dialogVisiblesEdit = true |
| | | }, |
| | |
| | | if (!row.id) { |
| | | addPd(row).then(() => { |
| | | this.dialogVisiblesEdit = false |
| | | this.onLoad(this.discussion); |
| | | this.onLoad(this.discussion) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | } else { |
| | | updatePd(row).then(() => { |
| | | this.dialogVisiblesEdit = false |
| | | this.onLoad(this.discussion); |
| | | this.onLoad(this.discussion) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | return remove(row.id) |
| | | }) |
| | | .then(() => { |
| | | // this.onLoad(this.page); |
| | |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | handleClose() { |
| | |
| | | |
| | | openDilog(row, type) { |
| | | this.dialogVisibles = true |
| | | this.loading = true; |
| | | this.loading = true |
| | | this.publicDiscussId = row.id |
| | | let params = { |
| | | level: 1, |
| | | publicDiscussId: row.id |
| | | } |
| | | getLists(1, 100, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.form = data; |
| | | this.loading = false; |
| | | const data = res.data.data |
| | | this.form = data |
| | | this.loading = false |
| | | // this.selectionClear(); |
| | | }) |
| | | }, |
| | | |
| | | handleSubmit(form, done) { |
| | | done(); |
| | | done() |
| | | form.publicDiscussId = this.publicDiscussId |
| | | add(form).then( |
| | | () => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | }) |
| | | form = {} |
| | | this.editFlag = false |
| | | let params = { |
| | |
| | | publicDiscussId: this.publicDiscussId |
| | | } |
| | | getLists(1, 100, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.form = data; |
| | | const data = res.data.data |
| | | this.form = data |
| | | }) |
| | | }, |
| | | (error) => { |
| | | window.console.log(error); |
| | | window.console.log(error) |
| | | // loading(); |
| | | } |
| | | ); |
| | | ) |
| | | }, |
| | | searchHide() { |
| | | this.search = !this.search; |
| | | this.search = !this.search |
| | | }, |
| | | searchChange() { |
| | | this.onLoad(this.discussion); |
| | | this.onLoad(this.discussion) |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.discussion); |
| | | this.query = {} |
| | | this.page.currentPage = 1 |
| | | this.onLoad(this.discussion) |
| | | }, |
| | | |
| | | handleAdd() { |
| | |
| | | this.title = '编辑' |
| | | this.box = true |
| | | getDetailPd(row.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | this.form = res.data.data |
| | | }) |
| | | }, |
| | | handleView(row) { |
| | | this.title = '查看' |
| | | this.view = true; |
| | | this.box = true; |
| | | this.view = true |
| | | this.box = true |
| | | getDetailPd(row.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | this.form = res.data.data |
| | | }) |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | this.$message.warning("请选择至少一条数据") |
| | | return |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return removePd(this.ids); |
| | | return removePd(this.ids) |
| | | }) |
| | | .then(() => { |
| | | this.selectionClear(); |
| | | this.onLoad(this.discussion); |
| | | this.selectionClear() |
| | | this.onLoad(this.discussion) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | return remove(row.id) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.discussion); |
| | | this.onLoad(this.discussion) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }) |
| | | }) |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetailPd(this.form.id).then((res) => { |
| | | let data = res.data.data |
| | | this.form = data; |
| | | }); |
| | | this.form = data |
| | | }) |
| | | } |
| | | if (["add"].includes(type)) { |
| | | this.form.title = this.discussion.title; |
| | | this.form.articleId = this.discussion.id; |
| | | this.form.title = this.discussion.title |
| | | this.form.articleId = this.discussion.id |
| | | } |
| | | done(); |
| | | done() |
| | | }, |
| | | beforeClose(done) { |
| | | done() |
| | | this.form = {}; |
| | | this.view = false; |
| | | this.form = {} |
| | | this.view = false |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | this.selectionList = list |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.selectionList = [] |
| | | // this.$refs.table.clearSelection(); |
| | | }, |
| | | // currentChange(currentPage) { |
| | |
| | | eventType: 1, |
| | | articleId: data.id |
| | | }) { |
| | | this.loading = true; |
| | | this.loading = true |
| | | getListPd(1, 10, 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(); |
| | | }); |
| | | const data = res.data.data |
| | | this.page.total = data.total |
| | | this.data = data.records |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | </template> |
| | | |
| | | <template slot-scope="{type,size,row }" slot="menu"> |
| | | <el-button icon="el-icon-circle-plus-outline" :size="size" :type="type" @click.stop="openDilog(row, 1)"> |
| | | <!-- <el-button icon="el-icon-circle-plus-outline" :size="size" :type="type" @click.stop="openDilog(row, 1)"> |
| | | 创建议题 |
| | | </el-button> --> |
| | | |
| | | <el-button icon="el-icon-edit" :size="size" :type="type" @click.stop="openEditPopup(row, 1)"> |
| | | 编辑议题 |
| | | </el-button> |
| | | |
| | | <el-button icon="el-icon-user" :size="size" :type="type" @click.stop="openUserPopup(row, 1)"> |
| | | 参与用户 |
| | | </el-button> |
| | | |
| | | <el-button v-if="row.publish == '1'" icon="el-icon-close" :size="size" :type="type" |
| | | @click.stop="updateFb(row)"> |
| | | 撤销 |
| | | </el-button> |
| | | |
| | | <el-button v-if="row.publish == '0'" icon="el-icon-check" :size="size" :type="type" |
| | | @click.stop="updateFb(row)"> |
| | | 发布 |
| | |
| | | </el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | |
| | | <deitDiscussion ref="DeitDiscussion"> |
| | | </deitDiscussion> |
| | | |
| | | <el-dialog title="" append-to-body :visible.sync="dialogVisibles" width="80%" :before-close="handleClose"> |
| | | <discussionManageChild ref="discussionManageChild" /> |
| | |
| | | import { |
| | | mapGetters |
| | | } from "vuex" |
| | | import deitDiscussion from "./components/deitDiscussion" |
| | | import discussionManageChild from "./components/discussionManageChild" |
| | | |
| | | export default { |
| | | components: { |
| | | discussionManageChild |
| | | deitDiscussion, |
| | | discussionManageChild, |
| | | }, |
| | | |
| | | data () { |
| | | return { |
| | | discussForm: { |
| | |
| | | }, |
| | | }, |
| | | methods: { |
| | | openEditPopup (row) { |
| | | this.$refs.DeitDiscussion.initData(row) |
| | | }, |
| | | |
| | | openUserPopup (row) { |
| | | this.$refs.DeitDiscussion.openUser(row) |
| | | }, |
| | | |
| | | openDilog (row, type) { |
| | | var that = this |
| | | this.dialogVisibles = true |