lin
2024-02-28 34dbf82112e28c111ffb2efdf2653ee42df80b21
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,15 @@
  import {
    getDictionary
  } from '@/api/system/dict'
  // import {
  //   getList as getHouseholdList,
  //   getDetatils as getHouseholdDetail
  // } from "@/api/userHouse/list/houseHold"
  import {
    getUserlnfoByDistrictlds
  } from "@/api/system/user"
  export default {
    data() {
@@ -78,27 +89,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: 12,
              offset: 8,
              value: 0,
              dicData: [{
                label: '开启',
@@ -117,6 +114,9 @@
              prop: 'voteRestrictions',
              type: 'radio',
              button: true,
              row: true,
              span: 12,
              offset: 8,
              dicData: [{
                label: '一人一票',
                value: 0
@@ -135,6 +135,9 @@
              prop: 'signatureFlag',
              type: 'radio',
              button: true,
              row: true,
              span: 12,
              offset: 8,
              dicData: [{
                label: '不需要',
                value: 0
@@ -148,11 +151,15 @@
                trigger: "blur",
              }, ],
              value: 0
            }, {
            },
            {
              label: '指定用户',
              prop: 'appointUser',
              type: 'radio',
              button: true,
              row: true,
              span: 12,
              offset: 8,
              dicData: [{
                label: '不限制',
                value: 0
@@ -168,11 +175,39 @@
              value: 0
            },
            {
              display: false,
              label: "选择用户",
              prop: "userIds",
              tags: true,
              type: "tree",
              multiple: true,
              span: 12,
              offset: 8,
              remote: true,
              hide: true,
              row: true,
              // dicUrl: `/api/blade-system/user/getUserlnfoByDistrictlds?districtlds={{}}`,
              props: {
                label: 'name',
                value: 'id',
              },
              dicData: [],
              rules: [{
                required: true,
                message: '请输入姓名',
                trigger: 'blur'
              }],
            },
            {
              label: "截止时间",
              span: 12,
              offset: 8,
              row: true,
              prop: "endTime",
              type: "datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              format: "yyyy-MM-dd HH:mm:ss",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              // format: "yyyy-MM-dd hh:mm:ss",
              // valueFormat: "yyyy-MM-dd hh:mm:ss",
              rules: [{
@@ -190,8 +225,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,9 +256,25 @@
      }
    },
    methods: {
      getuserInfoByDistrictId() {
        getUserlnfoByDistrictlds(this.discussion.articleRange).then(res => {
          const column = this.findObject(this.option.column, "userIds")
          column.dicData = res.data.data
        })
      },
      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
        row.userIds = JSON.stringify(row.userIds)
        if (row.appointUser == 0) {
          row.userIds = ''
        }
        addPd(row).then(
          () => {
            this.onLoad(this.discussion)
@@ -223,8 +291,11 @@
        )
      },
      init(data) {
        console.log("====>", data);
        this.$refs.DisCussFrom && this.$refs.DisCussFrom.resetForm()
        this.dialogVisibles = true
        this.disCussFrom = {}
        // this.disCussFrom = data;
        this.discussion = data
        this.articleId = data.id
        this.onLoad(data)
@@ -232,22 +303,24 @@
      handleClose() {
        this.dialogVisibles = false
        this.disCussFrom = {}
        this.$refs.DisCussFrom && this.$refs.DisCussFrom.resetForm()
        console.log(this.$refs, 90999)
      },
      onLoad(data, params = {
      onLoad(row, params = {
        eventType: 1,
        articleId: data.id
        articleId: row.id
      }) {
        this.loading = true
        getListPd(1, 10, Object.assign(params, this.query)).then(res => {
          const data = res.data.data
          this.page.total = data.total
          this.disCussFrom = data.records[0]
          this.loading = false
          if (this.disCussFrom && this.disCussFrom.userIds) {
            this.disCussFrom.userIds = JSON.parse(this.disCussFrom.userIds)
          }
          this.getuserInfoByDistrictId()
        })
      }
    }
@@ -258,4 +331,4 @@
  .el-pagination {
    margin-top: 20px;
  }
</style>
</style>