linwe
2023-11-24 c792fad86e2f7434bd56a580641fa044401500d0
src/views/article/discussionManage.vue
@@ -17,12 +17,39 @@
      </template>
    </avue-crud>
    <el-dialog title="" append-to-body :visible.sync="dialogVisibles" width="50%" :before-close="handleClose">
    <el-dialog title="" append-to-body :visible.sync="dialogVisibles" width="60%" :before-close="handleClose">
      <span slot="title" class="dialog-footer">
        {{ontitle}}
      </span>
      <avue-form @submit="handleSubmit" :option="optionDiscuss" v-model="disCussFrom">
      </avue-form>
      <div id="" v-if="editFlag">
        <avue-form @submit="handleSubmit" :option="optionDiscuss" @reset-change="handleReset" v-model="disCussFrom">
        </avue-form>
      </div>
      <div id="">
        <avue-crud :option="optionList" :data="form" ref="crud" @row-save="rowSave" @row-update="rowUpdate"
          @row-del="rowDel">
          <template slot="menuLeft">
            <el-button type="primary" size="small" plain icon="el-icon-circle-plus-outline" @click="add()">添加
            </el-button>
            <!--  <el-button v-if="editFlag" type="primary" size="small" plain icon="el-icon-circle-plus-outline" @click="canl()">取消
            </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="primary" @click="deletes(row)">删除</el-button>
            <el-button v-if="row.level === 2" :size="size" text type="primary" @click="handleAdd(row)">选择此项人数
              :{{row.number}} 详情</el-button>
          </template>
        </avue-crud>
      </div>
    </el-dialog>
  </basicContainer>
</template>
@@ -37,6 +64,7 @@
  } from "@/api/discuss/publicDiscuss";
  import {
    getLists,
    getList,
    getDetail,
    add,
@@ -55,7 +83,29 @@
  export default {
    data() {
      return {
        editFlag: false,
        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',
            }
          ]
        },
        optionDiscuss: {
          emptyText: '取消',
          column: [{
              label: '议题',
              prop: 'discussContent',
@@ -63,7 +113,7 @@
              row: true,
            }, {
              label: '选项范围',
              prop: 'option',
              prop: 'optionRange',
              type: 'radio',
              button: true,
              row: true,
@@ -107,7 +157,7 @@
        },
        disCussFrom: {
          discussContent: '',
          option: 0,
          optionRange: 0,
          sort: 1,
          optionContent: '',
          optionDetail: '',
@@ -152,7 +202,7 @@
          total: 0
        },
        // 表单数据
        form: {},
        form: [],
        // 选择行
        selectionList: [],
        // 表单配置
@@ -179,13 +229,54 @@
    },
    methods: {
      deletes(row) {
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            // this.onLoad(this.page);
            this.dialogVisibles = false
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleClose() {
        this.editFlag = false
        this.dialogVisibles = false
        this.disCussFrom = {}
      },
      edit(row) {
        this.disCussFrom = row
        this.editFlag = true
      },
      add() {
        this.editFlag = true
      },
      handleReset() {
        this.editFlag = false
      },
      openDilog(row, type) {
        this.dialogVisibles = true
        this.loading = true;
        let params = {}
        getList(1, 100, Object.assign(params, this.query)).then(res => {
        // this.disCussFrom.publicDiscussId = row.id
        let params = {
          level: 1
        }
        getLists(1, 100, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.dataTop = data.records;
          this.form = data;
          this.loading = false;
          this.selectionClear();
        })
@@ -199,8 +290,14 @@
              type: "success",
              message: "操作成功!",
            });
            this.dialogVisibles = false
            done();
            this.editFlag = false
            let params = {
              level: 1
            }
            getLists(1, 100, Object.assign(params, this.query)).then(res => {
              const data = res.data.data;
              this.form = data;
            })
          },
          (error) => {
            window.console.log(error);