zhanghua
2022-10-18 5b2dd794ec680d47e907ff43a264a7f82c30a130
src/views/operate/message/myIndex/index.vue
@@ -51,15 +51,13 @@
                    </el-table-column>
                    <el-table-column prop="channelCode" label="消息分类" min-width="10">
                        <template slot-scope="scope">
                            <span>{{scope.row.channelCode === '01' ? '站内信':scope.row.channelCode ==='02'?"邮件":'短信'}}</span>
                            <span>{{scope.row.channelCode === '01' ? '站内信':scope.row.channelCode
                            ==='02'?"邮件":'短信'}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="status" label="发布状态" min-width="5">
                        <template slot-scope="scope">
                            {{scope.row.status === 0 ? '未发布' :'已发布'}}
                            <!-- <el-switch class="switchStyle" v-model="scope.row.status" active-text="开" inactive-text="关"
                                active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)">
                            </el-switch> -->
                        </template>
                    </el-table-column>
                    <el-table-column prop="operation" label="操作" min-width="15">
@@ -67,7 +65,8 @@
                            <div class="operation">
                                <el-link icon="el-icon-view" :underline="false" @click="dialogView = true">查看</el-link>
                                <el-link icon="el-icon-edit" class="leftPx" :underline="false">编辑</el-link>
                                <el-link class="leftPx" icon="el-icon-delete-solid" :underline="false">删除</el-link>
                                <el-link class="leftPx" icon="el-icon-delete-solid" :underline="false"
                                    @click="handleDelete([scope.row.id])">删除</el-link>
                            </div>
                        </template>
                    </el-table-column>
@@ -75,7 +74,7 @@
                <!-- 新建消息 -->
                <el-dialog title="新建消息" :visible.sync="dialogCreate" v-if="dialogCreate" width="80%"
                    :before-close="handleConfirmClose">
                    <MyCreate></MyCreate>
                    <MyCreate @closeMyDialog="closeDialog"></MyCreate>
                </el-dialog>
                <!-- 消息详情 -->
                <el-dialog title="消息详情" :visible.sync="dialogView" v-if="dialogView" width="45%"
@@ -85,10 +84,10 @@
                <!-- tools -->
                <div class="tools">
                    <div class="funs">
                        <div class="funsItem">
                        <div class="funsItem funs-sp">
                            <el-checkbox v-model="all" @change="selectAll()">全选</el-checkbox>
                        </div>
                        <div class="funsItem">
                        <div class="funsItem funs-sp">
                            <el-checkbox v-model="unsame" @change="disSame(tableData)">反选</el-checkbox>
                        </div>
                        <div class="funsItem">
@@ -116,14 +115,14 @@
import MyCreate from './createUser'
export default {
    components: {
        MyView,MyCreate
        MyView, MyCreate
    },
    data() {
        return {
            tableData: [],
            context: "",
            dialogCreate:false,
            dialogView:false,
            dialogCreate: false,
            dialogView: false,
            totalNum: null,
            pageSize: 10,
            currentPage: 1,
@@ -157,6 +156,29 @@
        this.setTableData();
    },
    methods: {
        handleDelete(idarr) {
            this.$confirm('确认删除?')
                .then(_ => {
                    this.$axios({
                        method: 'post',
                        url: 'sccg/message/delete?ids=' + idarr,
                    })
                        .then(res => {
                            if (res.code === 200) {
                                this.$message({
                                    type: 'success',
                                    message: '删除成功',
                                })
                                this.setTableData();
                            } else {
                                this.$message({
                                    type: 'error',
                                    message: res.message
                                })
                            }
                        })
                })
        },
        // 设置表格数据
        async setTableData() {
            const arr = await this.getMessageList();
@@ -166,7 +188,7 @@
        // 获取消息数据
        async getMessageList() {
            let arr = [];
            const {currentPage,pageSize} = this;
            const { currentPage, pageSize } = this;
            await this.$axios({
                method: 'post',
                url: 'sccg/message/list',
@@ -289,23 +311,24 @@
            this.search();
        },
        // 关闭弹窗
        handleClose(done){
        handleClose(done) {
            done();
        },
        // 确认关闭弹窗
        handleConfirmClose(done){
        handleConfirmClose(done) {
            this.$confirm('确认关闭?')
            .then(_=>{
                done();
            })
            .catch(err=>{
                console.log(err);
            })
                .then(_ => {
                    done();
                })
                .catch(err => {
                    console.log(err);
                })
        },
        // 自定义关闭弹窗
        closeDialog({flag,index}){
        closeDialog({ flag, index }) {
            this.dialogCreate = flag;
            this.dialogView = flag;
            if(index ===1 ){
            if (index === 1) {
                this.setTableData();
            }
        }
@@ -379,12 +402,15 @@
        margin-top: 20px;
        padding-bottom: 50px;
        border: 1pox solid #fff;
        .el-link{
        .el-link {
            color: #4b9bb7;
        }
        .leftPx{
        .leftPx {
            margin-left: 10px;
        }
        .mainTitle {
            line-height: 60px;
        }
@@ -405,11 +431,15 @@
            .funs {
                display: flex;
                .funs-sp {
                    border: 1px solid #17324c;
                }
                .funsItem {
                    line-height: 28px;
                    display: flex;
                    align-items: center;
                    border: 1px solid #17324c;
                    border-radius: 4px;
                    font-size: 12px;
                    margin-left: 10px;