lin
2024-03-22 ebfc739bdbbc0dd0fccd0bf47b7d2d5397c3c511
src/views/article/components/deitDiscussion.vue
@@ -32,14 +32,12 @@
    <el-dialog title="" append-to-body :visible.sync="popupTableUserShow" width="80%" :before-close="userHandleClose">
      <basic-container>
        <div>
          <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出
          </el-button>
        </div>
        <avue-crud :data="userData" :page="userPage" :option="userOption" @search-change="searchChange"
          @search-reset="searchReset">
          <template slot-scope="{type,size,row }" slot="menuLeft">
            <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出
            </el-button>
          </template>
        </avue-crud>
      </basic-container>
    </el-dialog>
@@ -70,6 +68,9 @@
  import {
    downloadXls
  } from "@/util/util"
  import {
    dateNow
  } from "@/util/date"
  import website from '@/config/website'
@@ -92,7 +93,7 @@
        ontitle: '编辑议题',
        editFlag: false,
        disCussFromListClone: {},
        disCussFrom: {
          discussContent: '',
          optionRange: 0,
@@ -150,6 +151,13 @@
                message: '请选项范围',
                trigger: 'blur'
              }],
            }, {
              label: '最多选择数',
              prop: 'optionNumber',
              min: 1,
              type: 'number',
              step: 1,
              value: 1
            },
            {
              label: '选项内容',
@@ -177,7 +185,9 @@
        },
        // 表单数据
        form: {},
        form: {
          optionRange: 0,
        },
        data: [],
        optionList: {
          headerAlign: 'center',
@@ -224,12 +234,13 @@
          delBtn: false,
          excelBtn: true,
          dialogClickModal: false,
          header: false,
          header: true,
          column: [{
            label: '姓名',
            prop: 'name',
            searchSpan: 4,
            search: true,
            searchLabelWidth: 46,
          }, {
            label: '头像',
            type: 'upload',
@@ -274,7 +285,19 @@
      }
    },
    watch: {},
    watch: {
      'froms.optionRange': {
        handler(newData) {
          console.log('** ** ** ** ** ** **', newData)
          const column = this.findObject(this.optionDiscuss.column, "optionNumber")
          if (newData == 1) {
            column.display = true
          } else {
            column.display = false
          }
        },
      },
    },
    methods: {
@@ -297,12 +320,11 @@
          }
          data = Qs.stringify(data)
          exportBlob(
            `/api/blade-userTopics/userTopics/exportUser?${this.website.tokenHeader}=${getToken()}&` +
            data
          ).then(res => {
            downloadXls(res.data, `投票人员${dateNow()}.xlsx`)
            NProgress.done()
          })
            `/api/blade-userTopics/userTopics/exportUser?${this.website.tokenHeader}=${getToken()}&` + data).then(
            res => {
              downloadXls(res.data, `投票人员${dateNow()}.xlsx`)
              NProgress.done()
            })
        })
      },
@@ -378,7 +400,17 @@
      handleSubmit(form, done) {
        done()
        form.articleId = this.articleId
        if (this.disCussFromListClone.length > 0) {
          this.disCussFromListClone.forEach(item => {
            if (form.children.length > 0) {
              let same = form.children.find(array => array.id === item.id)
              if (!same) {
                item.deleteFlag = 1
                form.children.push(item)
              }
            }
          })
        }
        add(form).then(
          () => {
            this.$message({
@@ -455,26 +487,25 @@
      edit(row) {
        this.disCussFrom = row
        this.disCussFromListClone = [].concat(row.children)
        this.editFlag = true
      },
      deletes(row) {
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          return remove(row.id)
        }).then(() => {
          let param = {}
          this.onLoad(this.userPage, param)
          this.$message({
            type: "success",
            message: "操作成功!"
          })
          .then(() => {
            return remove(row.id)
          })
          .then(() => {
            this.onLoad()
            this.$message({
              type: "success",
              message: "操作成功!"
            })
          })
        })
      },