From a7689afd3cd1fe4bbbd907e9aa2931a940ae8e5b Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Fri, 05 Jan 2024 18:15:18 +0800
Subject: [PATCH] bug 修复

---
 src/views/article/components/deitDiscussion.vue |  660 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 327 insertions(+), 333 deletions(-)

diff --git a/src/views/article/components/deitDiscussion.vue b/src/views/article/components/deitDiscussion.vue
index a92bef0..cc2ca15 100644
--- a/src/views/article/components/deitDiscussion.vue
+++ b/src/views/article/components/deitDiscussion.vue
@@ -2,387 +2,381 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2024-01-04 15:18:13
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-01-05 17:23:39
+ * @LastEditTime: 2024-01-04 17:13:22
  * @FilePath: \jczz_web\src\views\article\components\deitDiscussion.vue
- * @Description: 
- * 
- * Copyright (c) 2024 by shuishen, All Rights Reserved. 
+ * @Description:
+ *
+ * Copyright (c) 2024 by shuishen, All Rights Reserved.
 -->
 <template>
-    <div>
-        <el-dialog title="" append-to-body :visible.sync="popupTableShow" width="80%" :before-close="handleClose">
-            <span slot="title" class="dialog-footer">
-                {{ ontitle }}
-            </span>
+  <div>
+    <el-dialog title="" append-to-body :visible.sync="popupTableShow" width="80%" :before-close="handleClose">
+      <span slot="title" class="dialog-footer">
+        {{ ontitle }}
+      </span>
 
-            <div id="" v-if="editFlag">
-                <avue-form @submit="handleSubmit" :option="optionDiscuss" @reset-change="handleReset" v-model="disCussFrom">
-                </avue-form>
-            </div>
+      <div id="" v-if="editFlag">
+        <avue-form @submit="handleSubmit" :option="optionDiscuss" @reset-change="handleReset" v-model="disCussFrom">
+        </avue-form>
+      </div>
 
-            <div id="" v-if="!editFlag">
-                <avue-crud :table-loading="loading" :option="optionList" :data="data" v-model="form" ref="crud"
-                    @row-update="rowUpdate" @row-del="rowDel">
-                    <template slot="menuLeft" v-if="!editFlag">
-                        <el-button type="primary" size="small" plain icon="el-icon-circle-plus-outline" @click="add()">添加
-                        </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="danger"
-                            @click="deletes(row)">删除</el-button>
-                        <el-button v-if="row.level === 2" :size="size" text type="primary" @click="openUser(row, 1)">
-                            选择此项人数:{{ row.number }} 详情</el-button>
-                    </template>
-                </avue-crud>
-            </div>
-        </el-dialog>
+      <div id="" v-if="!editFlag">
+        <avue-crud :table-loading="loading" :option="optionList" :data="data" v-model="form" ref="crud"
+          @row-update="rowUpdate" @row-del="rowDel">
+          <template slot="menuLeft" v-if="!editFlag">
+            <el-button type="primary" size="small" plain icon="el-icon-circle-plus-outline" @click="add()">添加
+            </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="danger" @click="deletes(row)">删除</el-button>
+            <el-button v-if="row.level === 2" :size="size" text type="primary" @click="openUser(row, 1)">
+              选择此项人数:{{ row.number }} 详情</el-button>
+          </template>
+        </avue-crud>
+      </div>
+    </el-dialog>
 
-        <el-dialog title="" append-to-body :visible.sync="popupTableUserShow" width="50%" :before-close="userHandleClose">
-            <avue-crud :data="userData" :page="userPage" :option="userOption"></avue-crud>
-        </el-dialog>
-    </div>
+    <el-dialog title="" append-to-body :visible.sync="popupTableUserShow" width="50%" :before-close="userHandleClose">
+      <avue-crud :data="userData" :page="userPage" :option="userOption"></avue-crud>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import {
+  import {
     getListPd,
     getDetailPd,
     addPd,
     updatePd,
     removePd
-} from "@/api/discuss/publicDiscuss"
+  } from "@/api/discuss/publicDiscuss"
 
-import {
+  import {
     getPage
-} from "@/api/discuss/userTopics"
+  } from "@/api/discuss/userTopics"
 
 
-import {
+  import {
     getLists,
     getList,
     getDetail,
     add,
     update,
     remove
-} from "@/api/discuss/topics"
+  } from "@/api/discuss/topics"
 
-export default {
-    data () {
-        return {
-            popupTableShow: false,
-            popupTableUserShow: false,
+  export default {
+    data() {
+      return {
+        popupTableShow: false,
+        popupTableUserShow: false,
 
-            loading: true,
+        loading: true,
 
-            ontitle: '编辑议题',
-            editFlag: false,
+        ontitle: '编辑议题',
+        editFlag: false,
 
-            disCussFrom: {
-                discussContent: '',
-                optionRange: 0,
-                sort: 1,
-                optionContent: '',
-                optionDetail: '',
-                number: '',
-                createTime: '',
-                updateTime: '',
-                deleteFlag: '',
-                publicDiscussId: '',
-                parentId: '',
-                level: '',
-                children: [{
-                    optionContent: '',
-                    optionDetail: '',
-                    number: '',
-                    createTime: '',
-                    updateTime: '',
-                    deleteFlag: '',
-                    publicDiscussId: '',
-                    parentId: '',
-                    level: '',
-                }]
+        disCussFrom: {
+          discussContent: '',
+          optionRange: 0,
+          sort: 1,
+          optionContent: '',
+          optionDetail: '',
+          number: '',
+          createTime: '',
+          updateTime: '',
+          deleteFlag: '',
+          articleId: '',
+          parentId: '',
+          level: '',
+          children: [{
+            optionContent: '',
+            optionDetail: '',
+            number: '',
+            createTime: '',
+            updateTime: '',
+            deleteFlag: '',
+            articleId: '',
+            parentId: '',
+            level: '',
+          }]
+        },
+        optionDiscuss: {
+          emptyText: '取消',
+          column: [{
+              label: '议题',
+              prop: 'discussContent',
+              type: 'input',
+              row: true,
             },
-            optionDiscuss: {
-                emptyText: '取消',
-                column: [
-                    {
-                        label: '议题',
-                        prop: 'discussContent',
-                        type: 'input',
-                        row: true,
-                    },
-                    {
-                        label: '选项范围',
-                        prop: 'optionRange',
-                        type: 'radio',
-                        button: true,
-                        row: true,
-                        dicData: [{
-                            label: '多选',
-                            value: 1
-                        }, {
-                            label: '单选',
-                            value: 0
-                        }]
-                    },
-                    {
-                        label: '排序',
-                        prop: 'sort',
-                        controlsPosition: '',
-                        type: 'number'
-                    },
-                    {
-                        label: '选项内容',
-                        prop: 'children',
-                        type: 'dynamic',
-                        span: 24,
-                        children: {
-                            column: [{
-                                label: '选项标题',
-                                prop: 'optionContent',
-                                type: 'input',
-                                rules: [{
-                                    required: true,
-                                    message: '请输入选项标题',
-                                    trigger: 'blur'
-                                }]
-                            }, {
-                                label: '选项说明',
-                                prop: 'optionDetail',
-                                type: 'input',
-                            }]
-                        }
-                    },
-                ]
+            {
+              label: '选项范围',
+              prop: 'optionRange',
+              type: 'radio',
+              button: true,
+              row: true,
+              dicData: [{
+                label: '多选',
+                value: 1
+              }, {
+                label: '单选',
+                value: 0
+              }]
             },
-
-            // 表单数据
-            form: {},
-            data: [],
-            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',
-                    }
-                ]
+            {
+              label: '排序',
+              prop: 'sort',
+              controlsPosition: '',
+              type: 'number'
             },
-
-            publicDiscussId: '',
-
-            userData: [],
-            userOption: {
-                addBtn: false,
-                menu: false,
+            {
+              label: '选项内容',
+              prop: 'children',
+              type: 'dynamic',
+              span: 24,
+              children: {
                 column: [{
-                    label: '姓名',
-                    prop: 'name'
+                  label: '选项标题',
+                  prop: 'optionContent',
+                  type: 'input',
+                  rules: [{
+                    required: true,
+                    message: '请输入选项标题',
+                    trigger: 'blur'
+                  }]
                 }, {
-                    label: '头像',
-                    prop: 'avatar'
-                }, {
-                    label: '手机',
-                    prop: 'phone'
-                }, {
-                    width: 220,
-                    overHidden: true,
-                    label: '小区名称',
-                    prop: 'aoiName'
-                }, {
-                    label: '地址',
-                    prop: 'addressName'
-                }, {
-                    label: '时间',
-                    prop: 'createTime'
+                  label: '选项说明',
+                  prop: 'optionDetail',
+                  type: 'input',
                 }]
+              }
             },
-            // 分页信息
-            userPage: {
-                pageSize: 10,
-                pageSizes: [10, 20, 30, 50, 100],
-                currentPage: 1,
-                total: 0
+          ]
+        },
+
+        // 表单数据
+        form: {},
+        data: [],
+        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',
+            }
+          ]
+        },
+
+        articleId: '',
+
+        userData: [],
+        userOption: {
+          addBtn: false,
+          menu: false,
+          column: [{
+            label: '姓名',
+            prop: 'name'
+          }, {
+            label: '头像',
+            prop: 'avatar'
+          }, {
+            label: '手机',
+            prop: 'phone'
+          }, {
+            label: '小区',
+            prop: 'aoiName'
+          }, {
+            label: '地址',
+            prop: 'addressName'
+          }, {
+            label: '时间',
+            prop: 'createTime'
+          }]
+        },
+        // 分页信息
+        userPage: {
+          pageSize: 10,
+          pageSizes: [10, 20, 30, 50, 100],
+          currentPage: 1,
+          total: 0
+        },
+      }
     },
 
-    watch: {
-    },
+    watch: {},
 
     methods: {
-        initData (newData) {
+      initData(newData) {
+        this.editFlag = false
+        this.popupTableShow = true
+        this.articleId = newData.id
+
+        this.onLoad()
+      },
+
+      handleClose() {
+        this.popupTableShow = false
+        this.disCussFrom = {}
+      },
+
+      handleSubmit(form, done) {
+        done()
+        form.articleId = this.articleId
+
+        add(form).then(
+          () => {
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            form = {}
             this.editFlag = false
-            this.popupTableShow = true
-            this.publicDiscussId = newData.id
-
-            this.onLoad()
-        },
-
-        handleClose () {
-            this.popupTableShow = false
-            this.disCussFrom = {}
-        },
-
-        handleSubmit (form, done) {
-            done()
-            form.publicDiscussId = this.publicDiscussId
-
-            add(form).then(
-                () => {
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!",
-                    })
-                    form = {}
-                    this.editFlag = false
-
-                    let params = {
-                        level: 1,
-                        publicDiscussId: this.publicDiscussId
-                    }
-
-                    getLists(1, 100, Object.assign(params, this.query)).then(res => {
-                        const data = res.data.data
-                        this.data = data
-                    })
-                },
-                (error) => {
-                    window.console.log(error)
-                }
-            )
-        },
-
-        handleReset () {
-            this.editFlag = false
-        },
-
-        // 提交修改
-        rowUpdate (row, index, done, loading) {
-            done()
-            if (!row.id) {
-                addPd(row).then(() => {
-                    this.onLoad()
-
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!"
-                    })
-                })
-            } else {
-                updatePd(row).then(() => {
-                    this.onLoad()
-
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!"
-                    })
-                })
-            }
-        },
-
-        rowDel (row) {
-            this.$confirm("确定将选择数据删除?", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-            })
-                .then(() => {
-                    return remove(row.id)
-                })
-                .then(() => {
-                    this.onLoad()
-
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!"
-                    })
-                })
-        },
-
-        add () {
-            this.editFlag = true
-        },
-
-        edit (row) {
-            this.disCussFrom = row
-            this.editFlag = true
-        },
-
-        deletes (row) {
-            this.$confirm("确定将选择数据删除?", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning"
-            })
-                .then(() => {
-                    return remove(row.id)
-                })
-                .then(() => {
-                    this.onLoad()
-
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!"
-                    })
-                })
-        },
-
-        openUser (row, type = 0) {
-            this.popupTableUserShow = true
-
-            if (type == 0) {
-                this.userParams = {
-                    publicDiscussId: row.id
-                }
-            } else {
-                this.userParams = {
-                    topicsId: row.id
-                }
-            }
-            this.getUserPage(this.userPage, this.userParams)
-        },
-
-        getUserPage (page, params = {}) {
-            getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
-                const data = res.data.data
-                this.userPage.total = data.total
-                this.userData = data.records
-            })
-        },
-
-        onLoad () {
-            this.loading = true
 
             let params = {
-                level: 1,
-                publicDiscussId: this.publicDiscussId
+              level: 1,
+              articleId: this.articleId
             }
 
             getLists(1, 100, Object.assign(params, this.query)).then(res => {
-                const data = res.data.data
-                this.data = data
-                this.loading = false
+              const data = res.data.data
+              this.data = data
             })
+          },
+          (error) => {
+            window.console.log(error)
+          }
+        )
+      },
+
+      handleReset() {
+        this.editFlag = false
+      },
+
+      // 提交修改
+      rowUpdate(row, index, done, loading) {
+        done()
+        if (!row.id) {
+          addPd(row).then(() => {
+            this.onLoad()
+
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+          })
+        } else {
+          updatePd(row).then(() => {
+            this.onLoad()
+
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+          })
         }
+      },
+
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.id)
+          })
+          .then(() => {
+            this.onLoad()
+
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+          })
+      },
+
+      add() {
+        this.editFlag = true
+      },
+
+      edit(row) {
+        this.disCussFrom = row
+        this.editFlag = true
+      },
+
+      deletes(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.id)
+          })
+          .then(() => {
+            this.onLoad()
+
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+          })
+      },
+
+      openUser(row, type = 0) {
+        this.popupTableUserShow = true
+
+        if (type == 0) {
+          this.userParams = {
+            articleId: row.id
+          }
+        } else {
+          this.userParams = {
+            topicsId: row.id
+          }
+        }
+        this.getUserPage(this.userPage, this.userParams)
+      },
+
+      getUserPage(page, params = {}) {
+        getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data
+          this.userPage.total = data.total
+          this.userData = data.records
+        })
+      },
+
+      onLoad() {
+        this.loading = true
+
+        let params = {
+          level: 1,
+          articleId: this.articleId
+        }
+
+        getLists(1, 100, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data
+          this.data = data
+          this.loading = false
+        })
+      }
     },
-}
+  }
 </script>
 
-<style lang="scss" scoped></style>
\ No newline at end of file
+<style lang="scss" scoped></style>

--
Gitblit v1.9.3