jwyu 1 жил өмнө
parent
commit
084b16bb4c

+ 36 - 0
src/api/modules/smartReport.js

@@ -0,0 +1,36 @@
+import http from "@/api/http.js"
+
+//智能研报模块
+
+const apiSmartReport={
+    //报告列表
+    reportList:params=>{
+        return http.get('/report/list',params)
+    },
+
+    //分类数据
+    classifyList:params=>{
+        return http.get('/classify/list',params)
+    },
+
+    //删除报告
+    delReport:params=>{
+        return http.post('/report/delete',params)
+    },
+
+    //报告推送
+    reportMsgSend:params=>{
+        return http.post('/report/ths/sendTemplateMsg',params)
+    },
+
+    //报告取消发布
+    publishCancel:params=>{
+        return http.post('/report/publish/cancle',params)
+    }
+
+
+}
+
+export {
+	apiSmartReport
+}

+ 5 - 0
src/routes/modules/oldRoutes.js

@@ -235,6 +235,11 @@ export default [
         name: "英文品种配置",
         component: () => import("@/views/report_manage/reportVariety.vue"),
       },
+      {
+        path: "smartReportList",
+        name: "智能研报",
+        component: () => import("@/views/smartReport/reportList.vue"),
+      },
       {
         path: "smartReportEdit",
         name: "智能报告",

+ 635 - 0
src/views/smartReport/reportList.vue

@@ -0,0 +1,635 @@
+<template>
+    <div class="smart-report-list">
+        <el-card class="box-card">
+            <div slot="header" class="header">
+                <el-form :inline="true" :model="searchform" @submit.native.prevent>
+                <el-form-item label="">
+                    <el-button
+                        v-permission="permissionBtn.reportManageBtn.reportManage_reportAdd"
+                        type="primary"
+                        size="medium"
+                        @click="$router.push({ path: '/addreportNew' })"
+                    >添加研报</el-button>
+                </el-form-item>
+                <el-form-item label="">
+                    <el-select
+                    v-model="searchform.timeType"
+                    placeholder="选择时间类型"
+                    size="medium"
+                    style="width:110px"
+                    @change="search"
+                    >
+                    <el-option label="发布时间" value="publish_time"></el-option>
+                    <el-option label="更新时间" value="modify_time"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="">
+                    <el-date-picker
+                        @change="search"
+                        v-model="searchform.dateValue"
+                        type="daterange"
+                        unlink-panels
+                        value-format="yyyy-MM-dd"
+                        range-separator="至"
+                        start-placeholder="起始日期"
+                        end-placeholder="结束日期"
+                        size="medium"
+                        style="width: 280px"
+                    />
+                </el-form-item>
+                <el-form-item label="">
+                    <el-select
+                        @change="search"
+                        v-model="searchform.frequency"
+                        placeholder="更新频度筛选"
+                        size="medium"
+                        clearable
+                        style="width: 140px"
+                    >
+                        <el-option label="年度" value="年度"></el-option>
+                        <el-option label="半年度" value="半年度"></el-option>
+                        <el-option label="季度" value="季度"></el-option>
+                        <el-option label="月度" value="月度"></el-option>
+                        <el-option label="双周度" value="双周度"></el-option>
+                        <el-option label="周度" value="周度"></el-option>
+                        <el-option label="日度" value="日度"></el-option>
+                        <el-option label="不定时" value="不定时"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="">
+                    <el-cascader
+                        @change="search"
+                        :options="optionsArr"
+                        v-model="searchform.classifynameArr"
+                        clearable
+                        placeholder="类型筛选"
+                        size="medium"
+                    />
+                </el-form-item>
+                <el-form-item label="">
+                    <el-select
+                        v-model.number="searchform.publishState"
+                        placeholder="发布筛选"
+                        size="medium"
+                        clearable
+                        style="width: 140px"
+                        @change="search"
+                    >
+                        <el-option label="已发布" :value="2"></el-option>
+                        <el-option label="未发布" :value="1"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="">
+                    <el-select
+                        v-permission="permissionBtn.reportManageBtn.reportManage_reportList_sendTime"
+                        @change="search"
+                        v-model.number="searchform.msgIsSend"
+                        placeholder="推送消息状态"
+                        size="medium"
+                        clearable
+                        style="width: 140px"
+                    >
+                        <el-option label="未推送消息" :value="1"></el-option>
+                        <el-option label="已推送消息" :value="2"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item>
+                    <el-input
+                        @input="search"
+                        placeholder="标题 / 创建人"
+                        v-model="searchform.key_word"
+                        clearable
+                        size="medium"
+                    >
+                        <i class="el-icon-search" slot="prefix" @click="search"></i>
+                    </el-input>
+                </el-form-item>
+                </el-form>
+            </div>
+            <template>
+                <el-table
+                    ref="table"
+                    :key="tableKey"
+                    :data="tableData"
+                    v-loading="listLoading"
+                    @sort-change="sortChange"
+                    element-loading-text="数据加载中..."
+                    border
+                    style="width: 100%"
+                >
+                <el-table-column
+                    prop="Title"
+                    label="报告标题"
+                    align="center"
+                    min-width="140"
+                >
+                    <template slot-scope="scope">
+                    <div @click="lookreportdtl(scope.row)">
+                        <span style="cursor: pointer; color: #4099ef" >{{ scope.row.Title }}</span>
+                        <span
+                            style="cursor: pointer; color: #4099ef"
+                            v-if="scope.row.MsgSendTime"
+                        >({{ scope.row.MsgSendTime.substring(5, 7)}}{{ scope.row.MsgSendTime.substring(8, 10) }})</span>
+                        <span
+                        style="cursor: pointer; color: #4099ef"
+                        v-else-if="scope.row.PublishTime"
+                        >({{ scope.row.PublishTime.substring(5, 7)
+                        }}{{ scope.row.PublishTime.substring(8, 10) }})</span
+                        >
+                        <span
+                        style="cursor: pointer; color: #4099ef"
+                        v-else-if="scope.row.CreateTime"
+                        >({{ scope.row.CreateTime.substring(5, 7)
+                        }}{{ scope.row.CreateTime.substring(8, 10) }})</span
+                        >
+
+                    </div>
+                    </template>
+                </el-table-column>
+                <el-table-column
+                    prop="Abstract"
+                    label="摘要"
+                    align="center"
+                    min-width="140"
+                ></el-table-column>
+                <el-table-column label="报告类型" align="center" min-width="140">
+                    <template slot-scope="scope"
+                    >{{ scope.row.ClassifyNameFirst }}
+                    <span v-if="scope.row.ClassifyNameSecond"
+                        >/ {{ scope.row.ClassifyNameSecond }}</span
+                    ></template
+                    >
+                </el-table-column>
+                <el-table-column
+                    prop="AdminRealName"
+                    label="创建人"
+                    align="center"
+                    min-width="100"
+                ></el-table-column>
+                <el-table-column label="发布状态" align="center">
+                    <template slot-scope="scope">
+                    <span v-if="scope.row.State == '2'" style="color: #46c371"
+                        >已发布</span
+                    >
+                    <span v-if="scope.row.State == '1'">未发布</span>
+                    </template>
+                </el-table-column>
+                <el-table-column
+                    prop="PublishTime"
+                    label="发布时间"
+                    min-width="124"
+                    align="center"
+                    :formatter="formatterColumn"
+                >
+                    <template slot-scope="scope">
+                    <span>{{scope.row.PrePublishTime?scope.row.PrePublishTime:scope.row.PublishTime|formatTime}}</span>
+                    <svg style="position: relative;top:2px" v-if="scope.row.PrePublishTime&&scope.row.State == '1'" width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+                        <path d="M15.2002 8C15.2002 4.13401 12.0662 1 8.20019 1C4.3342 1 1.20019 4.13401 1.2002 8C1.2002 11.866 4.3342 15 8.2002 15C12.0662 15 15.2002 11.866 15.2002 8ZM5.2002 10L5.2002 9L8.17491 9L11.2002 4.5L11.9073 5.20711L8.58912 10L5.2002 10Z" fill="#0052D9"/>
+                    </svg>
+                    </template>
+                </el-table-column>
+                <el-table-column v-if="permissionBtn.checkPermissionBtn(permissionBtn.reportManageBtn.reportManage_reportList_sendTime)"
+                    prop="MsgSendTime"
+                    label="报告推送时间"
+                    min-width="124"
+                    align="center"
+                >
+                    <template slot-scope="scope">{{
+                    scope.row.MsgSendTime | formatTime
+                    }}</template>
+                </el-table-column>
+                <el-table-column
+                    prop="ModifyTime"
+                    label="更新时间"
+                    min-width="124"
+                    align="center"
+                    :formatter="formatterColumn"
+                ></el-table-column>
+                <el-table-column label="期数" align="center">
+                    <template slot-scope="scope">第{{ scope.row.Stage }}期</template>
+                </el-table-column>
+                <el-table-column label="频度" align="center">
+                    <template slot-scope="scope">{{ scope.row.Frequency }}</template>
+                </el-table-column>
+                <el-table-column
+                    :label="hasUV?'PV / UV':'PV'"
+                    align="center"
+                    :render-header="renderHeader"
+                    width="140"
+                >
+                    <template slot-scope="scope"
+                    >{{ hasUV? scope.row.Pv+'/'+scope.row.Uv:scope.row.Pv }}</template
+                    >
+                </el-table-column>
+                <el-table-column label="操作" align="center" min-width="130">
+                    <template slot-scope="scope">
+                    <div class="opt-btns">
+                        <template
+                        v-if="scope.row.State == 1"
+                        >
+                        <span
+                            v-permission="permissionBtn.reportManageBtn.reportManage_publish"
+                            class="editsty"
+                            @click="publishreport(scope.row)"
+                            v-if="scope.row.CanEdit"
+                            >发布</span
+                        >
+                        <span
+                            v-permission="permissionBtn.reportManageBtn.reportManage_reportEdit"
+                            class="editsty"
+                            @click="editreport(scope.row, 'edit')"
+                            v-if="scope.row.CanEdit"
+                            >编辑</span
+                        >
+                        <span
+                            v-permission="permissionBtn.reportManageBtn.reportManage_reportEdit"
+                            class="editsty"
+                            @click="editreport(scope.row, 'editing')"
+                            v-else
+                            >{{ scope.row.Editor || "" }}编辑中...</span
+                        >
+                        <span
+                            v-permission="permissionBtn.reportManageBtn.reportManage_reportDel"
+                            class="deletesty"
+                            @click="handleDelReport(scope.row)"
+                            v-if="scope.row.CanEdit"
+                            >删除</span
+                        >
+                        </template>
+                        <template v-if="scope.row.State == 2">
+                        <span v-if="permissionBtn.checkPermissionBtn(permissionBtn.reportManageBtn.reportManage_cancelPublish)"
+                            @click="canclepublish(scope.row)"
+                            style="color: red; cursor: pointer"
+                            >取消发布</span
+                        >
+                        <span
+                            v-if="scope.row.MsgIsSend == 0 && permissionBtn.checkPermissionBtn(permissionBtn.reportManageBtn.reportManage_sendMsg)"
+                            style="color: #4099ef; cursor: pointer"
+                            @click="handleSendMsg(scope.row)"
+                            >推送消息</span
+                        >
+                        <span v-else-if="scope.row.MsgIsSend != 0&&permissionBtn.checkPermissionBtn(permissionBtn.reportManageBtn.reportManage_sendMsg)"
+                            style="color: red">已推送消息</span>
+                        </template>
+                        <span
+                        style="color: #46c371; cursor: pointer"
+                        v-if="permissionBtn.checkPermissionBtn(permissionBtn.reportManageBtn.reportManage_audioUpload)"
+                        @click="openupload(scope.row.Id)"
+                        >音频上传</span
+                        >
+                        <a
+                        v-permission="permissionBtn.reportManageBtn.reportManage_audioDownload"
+                        :href="hostapi + '?ReportId=' + parseInt(scope.row.Id)"
+                        v-if="scope.row.VideoUrl"
+                        :download="scope.row.VideoName"
+                        style="cursor: pointer; color: #4099ef"
+                        >音频下载</a
+                        >
+                    </div>
+                    </template>
+                </el-table-column>
+                </el-table>
+            </template>
+            <el-col :span="24" class="toolbar">
+                <el-pagination
+                    v-if="ispage"
+                    layout="total,prev,pager,next,jumper"
+                    background
+                    @current-change="handleCurrentChange"
+                    :page-size="pageSize"
+                    @size-change="handleSizeChange"
+                    :total="total"
+                    style="float: right"
+                />
+            </el-col>
+        </el-card>
+        <!-- 上传音频弹框 -->
+        <el-dialog
+            title="上传音频"
+            :visible.sync="uploadDialog"
+            :modal-append-to-body="false"
+            :close-on-click-modal="false"
+            :center="true"
+            v-dialogDrag
+            custom-class="dialogclass"
+            width="510px"
+        >
+            <div slot="title" style="display: flex; align-items: center">
+                <img
+                :src="$icons.up"
+                style="color: #fff; width: 16px; height: 16px; margin-right: 5px"
+                />
+                <span style="font-size: 16px">上传音频</span>
+            </div>
+            <el-form
+                :model="uploadForm"
+                ref="uploadForm"
+                label-position="right"
+                label-width="0px"
+                @submit.native.prevent
+            >
+                <el-form-item label="">
+                <input
+                    type="file"
+                    name="file"
+                    @change="fileSelected()"
+                    id="file"
+                    class="true-file"
+                    style="display: none"
+                />
+                <el-input
+                    type="text"
+                    v-model="uploadForm.audioname"
+                    readonly
+                    placeholder="上传报告录音"
+                    size="medium"
+                    style="width: 350px"
+                ></el-input>
+                <el-button type="primary" size="medium" @click.native="clickinput"
+                    >选择文件</el-button
+                >
+                </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer" style="text-align: center">
+                <el-button
+                type="primary"
+                plain
+                size="medium"
+                @click.native="uploadDialog = false"
+                >取 消</el-button
+                >
+                <el-button
+                type="primary"
+                size="medium"
+                :loading="uploadloading"
+                @click.native="uploadaudio"
+                >{{ uploadloading ? "上传中" : "上 传" }}</el-button
+                >
+            </div>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { voiceupload } from "api/api.js";
+import {apiSmartReport}  from '@/api/modules/smartReport'
+export default {
+    computed:{
+        Role() {
+            let role = localStorage.getItem("Role") || "";
+            return role;
+        },
+        //是否有UV
+        hasUV(){
+            return this.permissionBtn.checkPermissionBtn(this.permissionBtn.reportManageBtn.reportManage_reportList_uv)
+        }
+    },
+    data() {
+        return {
+            hostapi: process.env.VUE_APP_API_ROOT + "/voice/download",
+            searchform: {
+                timeType:'publish_time',
+                dateValue: "",
+                frequency: "",
+                classifynameArr: "",
+                state: "",
+                key_word: "",
+                publish_sort: "desc",
+                msgIsSend: "",
+                publishState:'',
+            },
+            tableKey:0,
+            tableData:[],
+            PageIndex: 1,
+            total: 0,
+            pageSize: 15,
+            ispage: true,
+            listLoading: false,
+            optionsArr: [],//分类数据
+
+            uploadDialog: false,
+            uploadForm: {
+                id: "",
+                formdata: null,
+                audioname: "",
+            },
+            uploadloading: false,
+        }
+    },
+    methods:{
+        // 删除某个报告
+        handleDelReport(item){
+            //删除
+            this.$confirm("确认删除吗?", "提示", {
+                type: "warning",
+            }).then(() => {
+                apiSmartReport.delReport({ ReportIds: item.Id }).then((res) => {
+                    if (res.Ret === 200) {
+                        this.$message.success(res.Msg);
+                        this.getReportList();
+                    }
+                });
+            }).catch(() => {});
+        },
+
+        //取消发布
+        handleReportPublishCancel(item){
+            apiSmartReport.publishCancel({ ReportIds: item.Id }).then((res) => {
+                if (res.Ret === 200) {
+                    this.$message.success(res.Msg);
+                    this.getReportList();
+                }
+            });
+        },
+
+        // 推送消息
+        async handleSendMsg(item){
+            const res = await apiSmartReport.reportMsgSend({
+                ReportId: [item.Id],
+            });
+            if (res.Ret == 200) {
+                item.ThsMsgIsSend = 1;
+                this.$message.success("发送成功");
+            }
+        },
+
+        // 报告列表
+        async getReportList(){
+            let params = {
+                CurrentIndex: this.PageIndex,
+                PageSize: this.pageSize,
+                Frequency: this.searchform.frequency,
+                ClassifyNameFirst: this.searchform.classifynameArr
+                ? this.searchform.classifynameArr[0]
+                : "",
+                ClassifyNameSecond:
+                this.searchform.classifynameArr &&
+                this.searchform.classifynameArr.length > 1
+                    ? this.searchform.classifynameArr[1]
+                    : "",
+                State: this.searchform.state ? this.searchform.state : null,
+                KeyWord: this.searchform.key_word,
+                MsgIsSend: this.searchform.msgIsSend,
+                State:this.searchform.publishState,
+                TimeType:this.searchform.timeType
+            };
+            if (this.searchform.dateValue) {
+                params.StartDate = this.searchform.dateValue[0];
+                params.EndDate = this.searchform.dateValue[1];
+            }
+            this.listLoading = true;
+            const res=await apiSmartReport.reportList(params)
+            if (res.Ret === 200) {
+                this.tableData = res.Data.List || [];
+                this.tableKey++
+                this.total = parseInt(res.Data.Paging.Totals);
+            }
+            this.listLoading = false;
+        },
+
+        //分页页码跳转
+        handleCurrentChange(current) {
+            this.PageIndex = current;
+            this.getReportList();
+        },
+
+        //搜索
+        search() {
+            this.ispage = false;
+            this.$nextTick(() => {
+                this.PageIndex = 1;
+                this.getReportList();
+                this.ispage = true;
+            });
+        },
+
+        //分页页码改变
+        handleSizeChange(val) {
+            this.pageSize = val;
+            this.getlist();
+        },
+
+        renderHeader(h, { column, $index }) {
+            //table表头自定义
+            return h("div", { attrs: { style: "padding:0;" } }, [
+                h("span", column.label),
+                h("el-tooltip", { props: { placement: "top" } }, [
+                h(
+                    "p",
+                    {
+                    slot: "content",
+                    attrs: { style: "display:block;padding:5px 0;width:420px;" },
+                    },
+                    "pv:报告被打开的次数,每次打开都计算一次(只统计有权限用户)"
+                ),
+                this.hasUV?h(
+                    "p",
+                    {
+                    slot: "content",
+                    attrs: { style: "display:block;padding:5px 0;width:420px;" },
+                    },
+                    "uv:访问报告的人数,每篇报告同一个人访问只计算一次(只统计有权限用户)"
+                ):h(''),
+                h(
+                    "el-button",
+                    {
+                    props: { icon: "el-icon-info" },
+                    attrs: { style: "border:none;background:none" },
+                    },
+                    ""
+                ),
+                ]),
+            ]);
+        },
+
+        //报告类型
+        getclassifylist() {
+            //获取分类列表
+            let params = { CurrentIndex: 0, PageSize: 1000, KeyWord: "" };
+            apiSmartReport.classifyList(params).then((res) => {
+                if (res.Ret == 200 && Array.isArray(res.Data.List)) {
+                    this.optionsArr = [];
+                    res.Data.List.forEach((item, index) => {
+                        let newitem = {
+                            label: item.ClassifyName,
+                            value: item.ClassifyName,
+                        };
+                        if (item.Child) {
+                            let childnode = [];
+                            item.Child.forEach((itemchild, i) => {
+                                childnode.push({
+                                    label: itemchild.ClassifyName,
+                                    value: itemchild.ClassifyName,
+                                });
+                            });
+                            newitem.children = childnode;
+                        }
+                        this.optionsArr.push(newitem);
+                    });
+                }
+            });
+        },
+
+        //唤醒上传弹窗
+        openupload(id) {
+            this.uploadForm = { id: id, formdata: null, audioname: "" };
+            this.uploadDialog = true;
+        },
+        //上传模拟点击
+        clickinput() {
+            $("#file").click();
+        },
+        //选择文件上传
+        fileSelected() {
+            const that = this;
+            if (document.getElementById("file").files[0]) {
+                let hostfile = document.getElementById("file").files[0];
+                let size = Math.floor(hostfile.size / 1024 / 1024);
+                if (size > 200) {
+                    that.$message.error("上传文件大小不能大于200M!");
+                    hostfile = {};
+                    return false;
+                }
+                if (
+                    hostfile.name.includes(".mp3") ||
+                    hostfile.name.includes(".wav") ||
+                    hostfile.name.includes(".wma")
+                ) {
+                let form = new FormData();
+                form.append("file", hostfile); //hostfile.name
+                form.append("ReportId", this.uploadForm.id);
+                    this.uploadForm.formdata = form;
+                    this.uploadForm.audioname = hostfile.name;
+                } else {
+                    that.$message.error("上传文件格式不正确!");
+                }
+            }
+        },
+        uploadaudio() {
+            if (this.uploadForm.formdata == null) {
+                this.$message.error("请选择文件");
+                return false;
+            }
+            this.uploadloading = true;
+            voiceupload(this.uploadForm.formdata).then((res) => {
+                if (res.Ret === 200) {
+                    this.$message.success("上传成功");
+                    this.getReportList();
+                }
+                this.uploadloading = false;
+                $("#file").val("");
+                this.uploadDialog = false;
+            });
+        },
+    },
+
+    created() {
+        this.getclassifylist()
+        this.getReportList()
+    },
+}
+</script>
+
+<style>
+
+</style>