shuishen
2024-01-24 d16d10d94fddff86bdfd87113e7fd2cebe8b7cd7
src/views/article/components/discussionManageChild.vue
@@ -1,14 +1,16 @@
<template>
  <div>
    <el-dialog title="" append-to-body :visible.sync="dialogVisibles" width="80%" :before-close="handleClose">
    <el-dialog title="" append-to-body :visible.sync="dialogVisibles" width="50%" :before-close="handleClose">
      <avue-form ref="DisCussFrom" :option="option" v-model="disCussFrom" @submit="handleSubmit"></avue-form>
    </el-dialog>
  </div>
</template>
<script>
  import {
    getPersonPublicSelect
  } from "@/api/public"
  import {
    getListPd,
    getDetailPd,
@@ -28,6 +30,13 @@
  import {
    getDictionary
  } from '@/api/system/dict'
  import {
    getList as getHouseholdList,
    getDetatils as getHouseholdDetail
  } from "@/api/userHouse/list/houseHold"
  export default {
    data() {
@@ -78,27 +87,13 @@
          searchMenuSpan: 3,
          menuWidth: 500,
          column: [{
              label: 'ID',
              prop: 'id',
              searchSpan: 4,
              display: false,
            },
            {
              label: '标题',
              prop: 'title',
              searchSpan: 4,
            },
            {
              label: '参与人数',
              prop: 'topsCount',
              searchSpan: 4,
              display: false,
            },
            {
              label: '开启投票',
              prop: 'openFlag',
              type: 'radio',
              button: true,
              row: true,
              span: 6,
              offset: 8,
              value: 0,
              dicData: [{
                label: '开启',
@@ -117,6 +112,9 @@
              prop: 'voteRestrictions',
              type: 'radio',
              button: true,
              row: true,
              span: 12,
              offset: 8,
              dicData: [{
                label: '一人一票',
                value: 0
@@ -135,6 +133,9 @@
              prop: 'signatureFlag',
              type: 'radio',
              button: true,
              row: true,
              span: 6,
              offset: 8,
              dicData: [{
                label: '不需要',
                value: 0
@@ -148,27 +149,58 @@
                trigger: "blur",
              }, ],
              value: 0
            }, {
              label: '指定用户',
              prop: 'appointUser',
              type: 'radio',
              button: true,
              dicData: [{
                label: '不限制',
                value: 0
              }, {
                label: '指定用户',
                value: 1
              }],
            },
            // {
            //   label: '指定用户',
            //   prop: 'appointUser',
            //   type: 'radio',
            //   button: true,
            //   row: true,
            //   span: 12,
            //   offset: 8,
            //   dicData: [{
            //     label: '不限制',
            //     value: 0
            //   }, {
            //     label: '指定用户',
            //     value: 1
            //   }],
            //   rules: [{
            //     required: true,
            //     message: "请选择是否指定用户",
            //     trigger: "blur",
            //   }, ],
            //   value: 0
            // },
            {
              display: false,
              label: "选择用户",
              prop: "userIds",
              type: 'select',
              span: 6,
              offset: 8,
              remote: true,
              hide: true,
              row: true,
              dicUrl: "",
              props: {
                label: 'name',
                value: 'id',
              },
              dicData: [],
              rules: [{
                required: true,
                message: "请选择是否指定用户",
                trigger: "blur",
              }, ],
              value: 0
                message: '请输入姓名',
                trigger: 'blur'
              }],
            },
            {
              label: "截止时间",
              span: 6,
              offset: 8,
              row: true,
              prop: "endTime",
              type: "datetime",
              format: "yyyy-MM-dd hh:mm:ss",
@@ -190,8 +222,25 @@
        discussion: {},
      }
    },
    created() {
      this.getUserList()
    },
    mounted() {
    },
    watch: {
      'disCussFrom.appointUser': {
        handler(newData) {
          const column = this.findObject(this.option.column, "userIds")
          if (newData == 1) {
            column.display = true
          } else {
            column.display = false
          }
        },
      },
    },
    computed: {
      ...mapGetters(["permission"]),
@@ -204,6 +253,12 @@
      }
    },
    methods: {
      getUserList() {
        let dicUrl = `/api/blade-household/household/selectHouseholdList?searchKey={{key}}&limit=20`
        const column = this.findObject(this.option.column, "userIds")
        column.dicUrl = dicUrl
      },
      handleSubmit(row, done) {
        row.articleId = this.articleId
        row.eventType = 1
@@ -223,6 +278,7 @@
        )
      },
      init(data) {
        this.$refs.DisCussFrom && this.$refs.DisCussFrom.resetForm()
        this.dialogVisibles = true
        this.disCussFrom = {}
        this.discussion = data
@@ -232,7 +288,6 @@
      handleClose() {
        this.dialogVisibles = false
        this.disCussFrom = {}
        this.$refs.DisCussFrom && this.$refs.DisCussFrom.resetForm()
        console.log(this.$refs, 90999)
@@ -247,7 +302,15 @@
          const data = res.data.data
          this.page.total = data.total
          this.disCussFrom = data.records[0]
          this.loading = false
          if (this.disCussFrom.userIds) {
            getPersonPublicSelect({
              id: this.disCussFrom.userIds
            }).then(res => {
              const column = this.findObject(this.option.column, "userIds")
              column.dicData = res.data.data
              this.loading = false
            })
          }
        })
      }
    }
@@ -258,4 +321,4 @@
  .el-pagination {
    margin-top: 20px;
  }
</style>
</style>