shuishen
2024-01-04 87b7c31da08b5d93af04e672d6dff862cf2eade8
src/views/article/components/discussionManageChild.vue
@@ -16,7 +16,8 @@
      <template slot-scope="scope" slot="menu">
        <!-- <el-button type="text" icon="el-icon-edit" size="small" @click.stop="openEdit(scope.row,scope.index)">编辑
        </el-button> -->
        <el-button type="primary" icon="el-icon-edit" size="small" @click.stop="openDilog(scope.row,scope.index)">编辑议题
                <el-button type="primary" icon="el-icon-edit" size="small"
                    @click.stop="openDilog(scope.row, scope.index)">编辑议题
        </el-button>
        <el-button type="primary" icon="el-icon-edit" size="small" @click.stop="openUser(scope.row,0)">参与用户
        </el-button>
@@ -44,7 +45,8 @@
          </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 === 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>
@@ -75,7 +77,7 @@
    addPd,
    updatePd,
    removePd
  } from "@/api/discuss/publicDiscuss";
} from "@/api/discuss/publicDiscuss"
  import {
    getLists,
@@ -84,16 +86,16 @@
    add,
    update,
    remove
  } from "@/api/discuss/topics";
} from "@/api/discuss/topics"
  import {
    getPage
  } from "@/api/discuss/userTopics";
} from "@/api/discuss/userTopics"
  import option from "@/option/discuss/publicDiscuss";
import option from "@/option/discuss/publicDiscuss"
  import {
    mapGetters
  } from "vuex";
} from "vuex"
  import {
    getDictionary
  } from '@/api/system/dict'
@@ -406,29 +408,29 @@
    computed: {
      ...mapGetters(["permission"]),
      ids() {
        let ids = [];
            let ids = []
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
                ids.push(ele.id)
            })
            return ids.join(",")
      }
    },
    methods: {
      rowSave(row, done, loading) {
        addPd(row).then(
          () => {
            this.onLoad(this.discussion);
                    this.onLoad(this.discussion)
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
                    })
                    done()
          },
          (error) => {
            window.console.log(error);
            loading();
                    window.console.log(error)
                    loading()
          }
        );
            )
      },
@@ -438,7 +440,7 @@
        //   title: data.title
        // }
        this.form.title = data.title
        this.form.articleId = data.id;
            this.form.articleId = data.id
        this.onLoad(data)
      },
@@ -459,15 +461,15 @@
      getUserPage(page, params = {}) {
        getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.pageUser.total = data.total;
          this.userData = data.records;
        });
                const data = res.data.data
                this.pageUser.total = data.total
                this.userData = data.records
            })
      },
      openEdit(row) {
        this.discussForm = row
        let times = new Date(row.endTime).getTime();
            let times = new Date(row.endTime).getTime()
        this.discussForm.endTime = times
        this.dialogVisiblesEdit = true
      },
@@ -477,20 +479,20 @@
        if (!row.id) {
          addPd(row).then(() => {
            this.dialogVisiblesEdit = false
            this.onLoad(this.discussion);
                    this.onLoad(this.discussion)
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
                    })
                })
        } else {
          updatePd(row).then(() => {
            this.dialogVisiblesEdit = false
            this.onLoad(this.discussion);
                    this.onLoad(this.discussion)
            this.$message({
              type: "success",
              message: "操作成功!"
            });
                    })
          })
        }
      },
@@ -502,7 +504,7 @@
            type: "warning"
          })
          .then(() => {
            return remove(row.id);
                    return remove(row.id)
          })
          .then(() => {
            // this.onLoad(this.page);
@@ -510,8 +512,8 @@
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
                    })
                })
      },
      handleClose() {
@@ -539,29 +541,29 @@
      openDilog(row, type) {
        this.dialogVisibles = true
        this.loading = true;
            this.loading = true
        this.publicDiscussId = row.id
        let params = {
          level: 1,
          publicDiscussId: row.id
        }
        getLists(1, 100, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.form = data;
          this.loading = false;
                const data = res.data.data
                this.form = data
                this.loading = false
          // this.selectionClear();
        })
      },
      handleSubmit(form, done) {
        done();
            done()
        form.publicDiscussId = this.publicDiscussId
        add(form).then(
          () => {
            this.$message({
              type: "success",
              message: "操作成功!",
            });
                    })
            form = {}
            this.editFlag = false
            let params = {
@@ -569,26 +571,26 @@
              publicDiscussId: this.publicDiscussId
            }
            getLists(1, 100, Object.assign(params, this.query)).then(res => {
              const data = res.data.data;
              this.form = data;
                        const data = res.data.data
                        this.form = data
            })
          },
          (error) => {
            window.console.log(error);
                    window.console.log(error)
            // loading();
          }
        );
            )
      },
      searchHide() {
        this.search = !this.search;
            this.search = !this.search
      },
      searchChange() {
        this.onLoad(this.discussion);
            this.onLoad(this.discussion)
      },
      searchReset() {
        this.query = {};
        this.page.currentPage = 1;
        this.onLoad(this.discussion);
            this.query = {}
            this.page.currentPage = 1
            this.onLoad(this.discussion)
      },
      handleAdd() {
@@ -600,21 +602,21 @@
        this.title = '编辑'
        this.box = true
        getDetailPd(row.id).then(res => {
          this.form = res.data.data;
        });
                this.form = res.data.data
            })
      },
      handleView(row) {
        this.title = '查看'
        this.view = true;
        this.box = true;
            this.view = true
            this.box = true
        getDetailPd(row.id).then(res => {
          this.form = res.data.data;
        });
                this.form = res.data.data
            })
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
                this.$message.warning("请选择至少一条数据")
                return
        }
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
@@ -622,16 +624,16 @@
            type: "warning"
          })
          .then(() => {
            return removePd(this.ids);
                    return removePd(this.ids)
          })
          .then(() => {
            this.selectionClear();
            this.onLoad(this.discussion);
                    this.selectionClear()
                    this.onLoad(this.discussion)
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
                    })
                })
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
@@ -640,39 +642,39 @@
            type: "warning"
          })
          .then(() => {
            return remove(row.id);
                    return remove(row.id)
          })
          .then(() => {
            this.onLoad(this.discussion);
                    this.onLoad(this.discussion)
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
                    })
                })
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetailPd(this.form.id).then((res) => {
            let data = res.data.data
            this.form = data;
          });
                    this.form = data
                })
        }
        if (["add"].includes(type)) {
          this.form.title = this.discussion.title;
          this.form.articleId = this.discussion.id;
                this.form.title = this.discussion.title
                this.form.articleId = this.discussion.id
        }
        done();
            done()
      },
      beforeClose(done) {
        done()
        this.form = {};
        this.view = false;
            this.form = {}
            this.view = false
      },
      selectionChange(list) {
        this.selectionList = list;
            this.selectionList = list
      },
      selectionClear() {
        this.selectionList = [];
            this.selectionList = []
        // this.$refs.table.clearSelection();
      },
      // currentChange(currentPage) {
@@ -687,17 +689,17 @@
        eventType: 1,
        articleId: data.id
      }) {
        this.loading = true;
            this.loading = true
        getListPd(1, 10, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
      }
    }
  };
}
</script>
<style lang="scss" scoped>