shuishen
2024-01-29 2cec09706b01d65def3f945bdcde13e620a71c2e
src/views/article/components/publicSignUpChild.vue
@@ -1,382 +1,381 @@
<template>
  <div>
    <el-dialog title="" append-to-body :visible.sync="dialogVisiblesUser" width="80%" :before-close="userHandleClose">
      <avue-crud ref="DataUser" :option="userOption" :data="dataUser" v-model="dataUser" :page="pageUser"
        @search-change="searchChange" @search-reset="searchReset"></avue-crud>
    </el-dialog>
  </div>
    <div>
        <el-dialog title="" append-to-body :visible.sync="dialogVisiblesUser" width="80%" :before-close="userHandleClose">
            <avue-crud ref="DataUser" :option="userOption" :data="dataUser" v-model="dataUser" :page="pageUser"
                @search-change="searchChange" @search-reset="searchReset"></avue-crud>
        </el-dialog>
    </div>
  <!-- </basicContainer> -->
    <!-- </basicContainer> -->
</template>
<script>
  import {
import {
    getListPd,
    getDetailPd,
    addPd,
    updatePd,
    removePd,
  } from "@/api/discuss/publicDiscuss"
  import {
} from "@/api/discuss/publicDiscuss"
import {
    getPageUser,
  } from "@/api/discuss/userPublicEnroll"
  import option from "@/option/discuss/publicDiscuss"
  import {
} from "@/api/discuss/userPublicEnroll"
import option from "@/option/discuss/publicDiscuss"
import {
    mapGetters
  } from "vuex"
  import {
} from "vuex"
import {
    getDictionary
  } from '@/api/system/dict'
} from '@/api/system/dict'
  import website from '@/config/website'
import website from '@/config/website'
  export default {
    data() {
      return {
        option1: {
          menu: false,
          addBtn: false,
          column: [{
            label: '姓名',
            prop: 'name'
          }, {
            label: '头像',
            prop: 'avatar'
          }, {
            label: '手机',
            prop: 'phone'
          }, {
            width: 220,
            overHidden: true,
            label: '小区名称',
            prop: 'aoiName'
          }, {
            label: '地址',
            prop: 'addressName'
          }, {
            label: '时间',
            prop: 'createTime'
          }]
        },
        discussForm: {
          ontitle: '',
          title: '',
          openFlag: 0,
          numberRestrictions: 0,
          voteRestrictions: 0,
          userRestrictions: 0,
          endTime: '',
          articleId: '',
          createTime: '',
          updateTime: '',
          deleteFlag: '',
          repeatVote: 0,
          voteNumberPublic: 0,
          appointUser: '',
          userIds: '',
          eventType: 1,
        },
        dialogVisibles: false,
        dialogVisiblesUser: false,
        // 弹框标题
        title: '',
        // 是否展示弹框
        box: false,
        // 是否显示查询
        search: true,
        // 加载中
        loading: true,
        // 是否为查看模式
        view: false,
        // 查询信息
        query: {},
        // 分页信息
        page: {
          pageSize: 10,
          pageSizes: [10, 20, 30, 50, 100],
          currentPage: 1,
          total: 0
        },
        // 分页信息
        pageUser: {
          pageSize: 10,
          pageSizes: [10, 20, 30, 50, 100],
          currentPage: 1,
          total: 0
        },
        // 表单数据
        form: {},
        // 选择行
        selectionList: [],
        userOption: {
          labelWidth: 96,
          searchLabelWidth: 96,
          searchShow: true,
          searchMenuSpan: 3,
          // menuWidth: 500,
          menu: false,
          height: "auto",
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          border: false,
          //stripe:true,
          index: true,
          editBtn: false,
          addBtn: false,
          viewBtn: false,
          selection: true,
          delBtn: false,
          excelBtn: true,
          dialogClickModal: false,
          column: [{
              label: '姓名',
              prop: 'name',
              search: true,
            }, {
              label: '头像',
              type: 'upload',
              listType: "picture-img",
              prop: 'avatar'
export default {
    data () {
        return {
            option1: {
                menu: false,
                addBtn: false,
                column: [{
                    label: '姓名',
                    prop: 'name'
                }, {
                    label: '头像',
                    prop: 'avatar'
                }, {
                    label: '手机',
                    prop: 'phone'
                }, {
                    width: 220,
                    overHidden: true,
                    label: '小区名称',
                    prop: 'aoiName'
                }, {
                    label: '地址',
                    prop: 'addressName'
                }, {
                    label: '时间',
                    prop: 'createTime'
                }]
            },
            {
              label: '签名',
              type: 'upload',
              listType: "picture-img",
              prop: 'signaturePath'
            discussForm: {
                ontitle: '',
                title: '',
                openFlag: 0,
                numberRestrictions: 0,
                voteRestrictions: 0,
                userRestrictions: 0,
                endTime: '',
                articleId: '',
                createTime: '',
                updateTime: '',
                deleteFlag: '',
                repeatVote: 0,
                voteNumberPublic: 0,
                appointUser: '',
                userIds: '',
                eventType: 1,
            },
            {
              label: '手机',
              prop: 'phone',
              search: true,
            }, {
              label: '小区',
              prop: 'aoiName'
            }, {
              label: '地址',
              prop: 'addressName'
            }, {
              label: '时间',
              prop: 'createTime'
            }
          ]
        },
        // 表单列表
        data: [],
        dataUser: [],
      }
            dialogVisibles: false,
            dialogVisiblesUser: false,
            // 弹框标题
            title: '',
            // 是否展示弹框
            box: false,
            // 是否显示查询
            search: true,
            // 加载中
            loading: true,
            // 是否为查看模式
            view: false,
            // 查询信息
            query: {},
            // 分页信息
            page: {
                pageSize: 10,
                pageSizes: [10, 20, 30, 50, 100],
                currentPage: 1,
                total: 0
            },
            // 分页信息
            pageUser: {
                pageSize: 10,
                pageSizes: [10, 20, 30, 50, 100],
                currentPage: 1,
                total: 0
            },
            // 表单数据
            form: {},
            // 选择行
            selectionList: [],
            userOption: {
                labelWidth: 96,
                searchLabelWidth: 96,
                searchShow: true,
                searchMenuSpan: 3,
                // menuWidth: 500,
                menu: false,
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                border: true,
                //stripe:true,
                index: true,
                editBtn: false,
                addBtn: false,
                viewBtn: false,
                selection: true,
                delBtn: false,
                excelBtn: true,
                dialogClickModal: false,
                column: [{
                    label: '姓名',
                    prop: 'name',
                    search: true,
                }, {
                    label: '头像',
                    type: 'upload',
                    listType: "picture-img",
                    prop: 'avatar'
                },
                {
                    label: '签名',
                    type: 'upload',
                    listType: "picture-img",
                    prop: 'signaturePath'
                },
                {
                    label: '手机',
                    prop: 'phone',
                    search: true,
                }, {
                    label: '小区',
                    prop: 'aoiName'
                }, {
                    label: '地址',
                    prop: 'addressName'
                }, {
                    label: '时间',
                    prop: 'createTime'
                }
                ]
            },
            // 表单列表
            data: [],
            dataUser: [],
        }
    },
    mounted() {
      // this.init();
      // this.onLoad(this.page);
    mounted () {
        // this.init();
        // this.onLoad(this.page);
    },
    computed: {
      ...mapGetters(["permission"]),
      ids() {
        let ids = []
        this.selectionList.forEach(ele => {
          ids.push(ele.id)
        })
        return ids.join(",")
      }
        ...mapGetters(["permission"]),
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        }
    },
    methods: {
      searchReset() {
        this.query = {}
        this.getUser(this.userPage)
      },
        searchReset () {
            this.query = {}
            this.getUser(this.userPage)
        },
      searchChange(params, done) {
        this.query = params
        this.userPage.currentPage = 1
        this.getUser(this.userPage, params)
        done()
      },
      init(data) {
        this.houseCode = data.houseCode
        this.onLoad(this.page)
      },
      getUser(page, params) {
        getPageUser(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data
          this.pageUser.total = data.total
          this.dataUser = data.records
          this.dataUser.forEach(item => {
            if (item.avatar.length > 0) {
              item.avatar = website.minioUrl + item.avatar
        searchChange (params, done) {
            this.query = params
            this.userPage.currentPage = 1
            this.getUser(this.userPage, params)
            done()
        },
        init (data) {
            this.houseCode = data.houseCode
            this.onLoad(this.page)
        },
        getUser (page, params) {
            getPageUser(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.pageUser.total = data.total
                this.dataUser = data.records
                this.dataUser.forEach(item => {
                    if (item.avatar.length > 0) {
                        item.avatar = website.minioUrl + item.avatar
                    }
                    if (item.signaturePath && item.signaturePath.length > 0) {
                        item.signaturePath = website.minioUrl + item.signaturePath
                        console.log("=====>", item.signaturePath)
                    }
                })
                this.loading = false
                // this.selectionClear()
            })
        },
        userHandleClose () {
            this.dialogVisiblesUser = false
            this.dataUser = []
            // this.$refs.DataUser && this.$refs.DataUser.resetForm()
            // console.log(this.$refs, 90999)
        },
        openUser (row) {
            this.dialogVisiblesUser = true
            let params = {
                articleId: row.id
            }
            if (item.signaturePath && item.signaturePath.length > 0) {
              item.signaturePath = website.minioUrl + item.signaturePath
              console.log("=====>", item.signaturePath)
            this.getUser(this.pageUser, params)
        },
        openDilog (row, type) {
            this.dialogVisibles = true
            this.discussForm = row
            let times = new Date(row.endTime).getTime()
            this.discussForm.endTime = times
            console.table(this.discussForm)
            if (type == 0) {
                this.discussForm.ontitle = '公益报名'
            } else {
                this.discussForm.ontitle = '创建议题'
            }
          })
          this.loading = false
          // this.selectionClear()
        })
      },
      userHandleClose() {
        this.dialogVisiblesUser = false
        this.dataUser = []
        // this.$refs.DataUser && this.$refs.DataUser.resetForm()
        // console.log(this.$refs, 90999)
      },
        },
      openUser(row) {
        this.dialogVisiblesUser = true
        let params = {
          articleId: row.id
        }
        this.getUser(this.pageUser, params)
      },
      openDilog(row, type) {
        this.dialogVisibles = true
        this.discussForm = row
        let times = new Date(row.endTime).getTime()
        this.discussForm.endTime = times
        console.table(this.discussForm)
        if (type == 0) {
          this.discussForm.ontitle = '公益报名'
        } else {
          this.discussForm.ontitle = '创建议题'
        }
      },
      searchHide() {
        this.search = !this.search
      },
      searchChange() {
        this.onLoad(this.page)
      },
      searchReset() {
        this.query = {}
        this.page.currentPage = 1
        this.onLoad(this.page)
      },
      handleSubmit(form, done) {
        done()
        if (!this.discussForm.id) {
          addPd(this.discussForm).then(() => {
            this.dialogVisibles = false
        searchHide () {
            this.search = !this.search
        },
        searchChange () {
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!"
            })
          })
        } else {
          updatePd(this.discussForm).then(() => {
            this.dialogVisibles = false
        },
        searchReset () {
            this.query = {}
            this.page.currentPage = 1
            this.onLoad(this.page)
            this.$message({
              type: "success",
              message: "操作成功!"
        },
        handleSubmit (form, done) {
            done()
            if (!this.discussForm.id) {
                addPd(this.discussForm).then(() => {
                    this.dialogVisibles = false
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
            } else {
                updatePd(this.discussForm).then(() => {
                    this.dialogVisibles = 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()
            })
        }
      },
      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 lang="scss" scoped>
  .el-pagination {
.el-pagination {
    margin-top: 20px;
  }
}
</style>