From f100ef511bfd5cb27e553a41abcb8fbd7dcc3fe4 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 16 Jan 2024 17:41:11 +0800
Subject: [PATCH] 字段添加

---
 src/views/article/discussionManage.vue |  381 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 201 insertions(+), 180 deletions(-)

diff --git a/src/views/article/discussionManage.vue b/src/views/article/discussionManage.vue
index 413f365..f5751d6 100644
--- a/src/views/article/discussionManage.vue
+++ b/src/views/article/discussionManage.vue
@@ -12,9 +12,9 @@
             </template>
 
             <template slot-scope="{type,size,row }" slot="menu">
-                <!-- <el-button icon="el-icon-circle-plus-outline" :size="size" :type="type" @click.stop="openDilog(row, 1)">
-                    创建议题
-                </el-button> -->
+                <el-button icon="el-icon-s-tools" :size="size" :type="type" @click.stop="openDilog(row, 1)">
+                    设置
+                </el-button>
 
                 <el-button icon="el-icon-edit" :size="size" :type="type" @click.stop="openEditPopup(row, 1)">
                     编辑议题
@@ -35,13 +35,13 @@
                 </el-button>
             </template>
 
-            <template slot-scope="{ row }" slot="publish">
-                <el-tag>{{ row.publish == "1" ? "已发布" : row.publish == "0" ? "未发布" : "未发布" }}
+            <template slot-scope="{ row, size }" slot="publish">
+                <el-tag :size="size" :type="showStatus(row.publish, 1).type" v-text="showStatus(row.publish, 1).text">
                 </el-tag>
             </template>
 
-            <template slot-scope="{ row }" slot="iscomment">
-                <el-tag>{{ row.iscomment == "1" ? "开启" : row.iscomment == "0" ? "关闭" : "关闭" }}
+            <template slot-scope="{ row, size }" slot="iscomment">
+                <el-tag :size="size" :type="showStatus(row.iscomment, 2).type" v-text="showStatus(row.iscomment, 2).text">
                 </el-tag>
             </template>
         </avue-crud>
@@ -49,20 +49,8 @@
         <deitDiscussion ref="DeitDiscussion">
         </deitDiscussion>
 
-        <el-dialog title="" append-to-body :visible.sync="dialogVisibles" width="80%" :before-close="handleClose">
-            <discussionManageChild ref="discussionManageChild" />
-            <!-- <span slot="title" class="dialog-footer">
-        {{discussForm.ontitle}}
-      </span> -->
-            <!--  <div id="" v-if="discussForm.eventType == 1">
-        <avue-form @submit="handleSubmit" :option="optionDiscuss" v-model="discussForm"></avue-form>
-      </div> -->
+        <discussionManageChild ref="discussionManageChild" />
 
-            <!-- <div id="" v-else>
-        <avue-form @submit="handleSubmit" :option="optionEnroll" v-model="discussForm">
-        </avue-form>
-      </div> -->
-        </el-dialog>
     </basic-container>
 </template>
 
@@ -121,7 +109,6 @@
                 userIds: '',
                 eventType: 1,
             },
-            dialogVisibles: false,
             form: {},
             query: {},
             loading: true,
@@ -133,145 +120,198 @@
             datetime: "",
             selectionList: [],
             option: {
+                labelWidth: 96,
+                searchLabelWidth: 96,
+                searchShow: true,
+                searchMenuSpan: 3,
+                menuWidth: 500,
+
                 height: "auto",
                 calcHeight: 54,
                 dialogWidth: 950,
                 tip: false,
-                searchShow: true,
-                searchMenuSpan: 3,
-                menuWidth: 450,
                 border: false,
                 //stripe:true,
                 index: true,
-                viewBtn: true,
+                viewBtn: false,
                 selection: true,
                 excelBtn: true,
                 dialogClickModal: false,
-                column: [{
-                    label: "议事标题",
-                    prop: "title",
-                    span: 24,
-                    row: true,
-                    searchSpan: 4,
-                    search: true,
-                    rules: [{
-                        required: true,
-                        message: "请输入议事标题",
-                        trigger: "blur",
-                    },],
-                },
-                {
-                    label: "范围",
-                    prop: "articleList",
-                    span: 24,
-                    minRows: 2,
-                    type: "tree",
-                    multiple: true,
-                    dicData: [],
-                    rules: [{
-                        required: true,
-                        message: "请选择范围",
-                        trigger: "blur",
-                    },],
-                    props: {
-                        label: "name",
-                        value: 'id'
-                    },
-                    hide: true,
-                },
-                {
-                    label: "发布时间",
-                    prop: "dateTime",
-                    type: "datetime",
-                    format: "yyyy-MM-dd",
-                    valueFormat: "yyyy-MM-dd",
-                    searchSpan: 5,
-                    searchRange: true,
-                    hide: true,
-                    addDisplay: false,
-                    editDisplay: false,
-                    viewDisplay: false,
-                    search: true,
-                    rules: [{
-                        required: true,
-                        message: "请选择发布时间",
-                        trigger: "blur",
-                    },],
-                },
-                {
-                    label: "封面",
-                    prop: "url",
-                    // align:'center',
-                    width: 80,
-                    type: "upload",
-                    listType: "picture-img",
-                    action: "/api/blade-resource/oss/endpoint/put-file",
-                    propsHttp: {
-                        res: "data",
-                        url: "link",
-                    },
-                    // hide: true,
-                    span: 24,
-                },
-                {
-                    label: "发布时间",
-                    prop: "createTime",
-                    type: "date",
-                    format: "yyyy-MM-dd",
-                    valueFormat: "yyyy-MM-dd HH:mm:ss",
-                },
-                {
-                    span: 24,
-                    label: "评论区",
-                    prop: "iscomment",
-                    width: 80,
-                    slot: true,
-                    type: "switch",
-                    activeColor: "#13ce66",
-                    inactiveColor: "#ccc",
-                    value: '1',
-                    dicData: [{
-                        label: "关闭",
-                        value: "0",
+                column: [
+                    {
+                        overHidden: true,
+                        label: "议事标题",
+                        prop: "title",
+                        span: 24,
+                        row: true,
+                        searchSpan: 4,
+                        search: true,
+                        rules: [{
+                            required: true,
+                            message: "请输入议事标题",
+                            trigger: "blur",
+                        },],
                     },
                     {
-                        label: "开启",
-                        value: "1",
-                    }
-                    ],
-                },
-                {
-                    label: "视频",
-                    prop: "videoUrl",
-                    type: "upload",
-                    accept: "video/mp4",
-                    display: false,
-                    hide: true,
-                    span: 24,
-                    listType: "picture-img",
-                    action: "/api/depl/put-depl",
-                    propsHttp: {
-                        url: "data",
-                    },
-                },
-                {
-                    label: "议事内容",
-                    prop: "content",
-                    component: "AvueUeditor",
-                    options: {
-                        action: "/api/blade-resource/oss/endpoint/put-file",
-                        // customConfig: {
-                        //   lineHeights: ['1', '1.15', '1.6', '2', '2.5', '3']
-                        // },//wangEditor编辑的配置
+                        label: "范围",
+                        prop: "articleList",
+                        span: 24,
+                        minRows: 2,
+                        tags: true,
+                        type: "tree",
+                        multiple: true,
+                        dicData: [],
+                        rules: [{
+                            required: true,
+                            message: "请选择范围",
+                            trigger: "blur",
+                        },],
                         props: {
+                            label: "name",
+                            value: 'id'
+                        },
+                        hide: true,
+                    },
+                    {
+                        width: 110,
+                        label: "封面",
+                        prop: "url",
+                        // align:'center',
+                        type: "upload",
+                        listType: "picture-img",
+                        action: "/api/blade-resource/oss/endpoint/put-file",
+                        propsHttp: {
                             res: "data",
                             url: "link",
                         },
+                        // hide: true,
+                        span: 24,
                     },
-                    hide: true,
-                    minRows: 6,
-                    span: 24,
-                },
+                    {
+                        width: 110,
+                        label: "文章类型",
+                        prop: "articleType",
+                        addDisplay: true,
+                        editDisplay: true,
+                        viewDisplay: true,
+                        searchSpan: 4,
+                        checkStrictly: true,
+                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=investigateType",
+                        props: {
+                            label: "dictValue",
+                            value: "dictKey",
+                        },
+                        search: true,
+                        type: "tree",
+                        rules: [{
+                            required: true,
+                            message: "请选择文章类型",
+                            trigger: "blur",
+                        },],
+                    },
+                    {
+                        label: "发布时间",
+                        prop: "dateTime",
+                        type: "daterange",
+                        format: "yyyy-MM-dd",
+                        valueFormat: "yyyy-MM-dd",
+                        searchSpan: 6,
+                        searchRange: true,
+                        hide: true,
+                        addDisplay: false,
+                        editDisplay: false,
+                        viewDisplay: false,
+                        search: true,
+                        rules: [{
+                            required: true,
+                            message: "请选择发布时间",
+                            trigger: "blur",
+                        },],
+                    },
+                    {
+                        width: 100,
+                        label: "发布时间",
+                        prop: "createTime",
+                        type: "date",
+                        format: "yyyy-MM-dd",
+                        valueFormat: "yyyy-MM-dd HH:mm:ss",
+                    },
+                    {
+                        width: 100,
+                        label: "发布状态",
+                        prop: "publish",
+                        searchSpan: 4,
+                        value: "0",
+                        slot: true,
+                        search: true,
+                        type: "select",
+                        rules: [{
+                            required: true,
+                            message: "请选择发布状态",
+                            trigger: "blur",
+                        },],
+                        dicData: [{
+                            label: "未发布",
+                            value: "0",
+                        },
+                        {
+                            label: "已发布",
+                            value: "1",
+                        }
+                        ],
+                    },
+                    {
+                        span: 24,
+                        label: "评论区",
+                        prop: "iscomment",
+                        width: 80,
+                        slot: true,
+                        type: "switch",
+                        activeColor: "#13ce66",
+                        inactiveColor: "#ccc",
+                        value: '1',
+                        dicData: [{
+                            label: "关闭",
+                            value: "0",
+                        },
+                        {
+                            label: "开启",
+                            value: "1",
+                        }
+                        ],
+                    },
+                    {
+                        label: "视频",
+                        prop: "videoUrl",
+                        type: "upload",
+                        accept: "video/mp4",
+                        display: false,
+                        hide: true,
+                        span: 24,
+                        listType: "picture-img",
+                        action: "/api/depl/put-depl",
+                        propsHttp: {
+                            url: "data",
+                        },
+                    },
+                    {
+                        label: "议事内容",
+                        prop: "content",
+                        component: "AvueUeditor",
+                        options: {
+                            action: "/api/blade-resource/oss/endpoint/put-file",
+                            // customConfig: {
+                            //   lineHeights: ['1', '1.15', '1.6', '2', '2.5', '3']
+                            // },//wangEditor编辑的配置
+                            props: {
+                                res: "data",
+                                url: "link",
+                            },
+                        },
+                        hide: true,
+                        minRows: 6,
+                        span: 24,
+                    },
                 ],
             },
             data: [],
@@ -420,6 +460,7 @@
                 editBtn: this.vaildData(this.permission.article_edit, true),
             }
         },
+
         ids () {
             let ids = []
             this.selectionList.forEach((ele) => {
@@ -427,6 +468,22 @@
             })
             return ids.join(",")
         },
+
+        showStatus () {
+            return (data, type) => {
+                if (data == 0) {
+                    return {
+                        text: type == 1 ? '未发布' : '关闭',
+                        type: 'info'
+                    }
+                } else if (data == 1) {
+                    return {
+                        text: type == 1 ? '已发布' : '开启',
+                        type: 'success'
+                    }
+                }
+            }
+        }
     },
     methods: {
         openEditPopup (row) {
@@ -439,48 +496,12 @@
 
         openDilog (row, type) {
             var that = this
-            this.dialogVisibles = true
             this.$nextTick(() => {
                 that.$refs.discussionManageChild.init(row)
             })
-            // this.discussForm.eventType = type
-            // this.discussForm.articleId = row.id
-            // this.discussForm.title = row.title
-            // if (type == 0) {
-            //   this.discussForm.ontitle = '公益报名'
-            // } else {
-            //   this.discussForm.ontitle = '创建议题'
-            // }
         },
 
-        handleSubmit (form, done) {
-            done()
-            addPd(form).then(
-                () => {
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!",
-                    })
-                    this.dialogVisibles = false
-                    done()
-                },
-                (error) => {
-                    window.console.log(error)
-                    // loading();
-                }
-            )
-        },
-
-        handleClose (done) {
-            done()
-            // this.$confirm('确认关闭?')
-            //   .then(_ => {
-            //     done();
-            //   })
-            //   .catch(_ => {});
-        },
         rowSave (row, done, loading) {
-            console.log(row, 9999)
             if (row.videoUrl.length == 0) {
                 row.videoUrl = ""
             }
@@ -753,4 +774,4 @@
 .avue-upload__icon {
     line-height: 6;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3