123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <div class="container-the-last-week">
- <!-- 本周研究汇总 -->
- <el-card>
- <div class="top-box">
- <div class="top-container">
- <!-- <el-select placeholder="行业" clearable v-model="industry" @change="conditionChange" style="margin-bottom: 20px">
- <el-option v-for="item in chartPermissionList" :label="item.PermissionName" :key="item.ChartPermissionId" :value="item.ChartPermissionId"></el-option>
- </el-select> -->
- <el-select placeholder="发布状态" clearable v-model="status" @change="conditionChange" style="margin-bottom: 20px">
- <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
- </el-select>
- <date-picker v-model="issueTime" type="date" range placeholder="发布时间" value-type="format" @change="conditionChange"> </date-picker>
- </div>
- <div>
- <el-button type="primary" @click="$router.push('/addThisWeek')">添加</el-button>
- </div>
- </div>
- <el-table :data="tableData" style="width: 100%" border>
- <el-table-column prop="" align="center" label="标题" min-width="260">
- <template slot-scope="scope">
- <span class="editsty" @click="goDetail(scope.row)">{{ scope.row.Title }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="Periods" align="center" label="期数" width="118"></el-table-column>
- <el-table-column prop="PublishDate" align="center" label="发布时间" min-width="118"></el-table-column>
- <el-table-column prop="LastUpdatedTime" align="center" label="更新时间" min-width="165"></el-table-column>
- <el-table-column prop="" align="center" label="发布状态" width="118">
- <template slot-scope="scope">
- <span>{{ scope.row.PublishStatus == 1 ? "已发布" : "未发布" }}</span>
- </template>
- </el-table-column>
- <el-table-column width="135" label="PV / UV" align="center" :render-header="renderHeader">
- <template slot-scope="scope">
- <div class="pv-uv-download">
- <span>{{ scope.row.Pv }}/{{ scope.row.Uv }}</span>
- <a :href="exportPvUv(scope.row.ArticleId)" download>
- <img src="~@/assets/img/rai_m/pvuv_download.png" alt="" />
- </a>
- </div>
- </template>
- </el-table-column>
- <el-table-column key="VisibleRange" width="156" label="可见范围" align="center">
- <template slot-scope="{ row }" v-if="row.PublishStatus === 1">
- <el-radio-group v-model="row.VisibleRange" @input="reportVisibleRange(row)">
- <el-radio :label="1">全部</el-radio>
- <el-radio :label="0">内部</el-radio>
- </el-radio-group>
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作" min-width="168">
- <template slot-scope="scope">
- <span v-if="scope.row.PublishStatus !== 1" class="editsty" @click="operationBtn(scope.row.ArticleId, '发布')">发布 </span>
- <span v-else class="editsty" @click="operationBtn(scope.row.ArticleId, '取消发布')">取消发布 </span>
- <span class="editsty" @click="editReport(scope.row.ArticleId)">编辑 </span>
- <span v-if="scope.row.PublishStatus !== 1 && !scope.row.Periods" class="deletesty" @click="operationBtn(scope.row.ArticleId, '删除')"
- >删除 </span
- >
- <span v-if="scope.row.PublishStatus == 1" class="editsty" @click="emailGroup(scope.row)">群发邮件</span>
- </template>
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <el-col :span="24" class="toolbar">
- <m-page :total="total" :page_no="page_no" :pageSize="10" @handleCurrentChange="handleCurrentChange" />
- </el-col>
- </el-card>
- </div>
- </template>
- <script>
- import mPage from "@/components/mPage.vue";
- import { raiInterface } from "@/api/api.js";
- export default {
- name: "",
- components: { mPage },
- props: {},
- data() {
- return {
- page_no: sessionStorage.getItem("theLastWeek") ? JSON.parse(sessionStorage.getItem("theLastWeek")).page_no : 1,
- total: 0, //条数
- PageSize: 10, //每页显示几条
- //industry: "", //行业
- status: "", //发布状态
- issueTime: "", //时间
- //chartPermissionList: [], //行业的数组
- options: [
- { id: 0, name: "未发布" },
- { id: 1, name: "已发布" },
- ], //发布的数组
- tableData: [], //表格
- };
- },
- computed: {
- sta() {
- return this.status === 0 ? this.status : this.status === 1 ? this.status : 2;
- },
- },
- watch: {},
- created() {},
- mounted() {
- if (sessionStorage.getItem("theLastWeek")) {
- const initialize = JSON.parse(sessionStorage.getItem("theLastWeek"));
- this.status = initialize.status;
- this.issueTime = initialize.issueTime;
- }
- this.getList();
- //this.getIndustryList()
- },
- methods: {
- //获取list数组
- async getList() {
- const res = await raiInterface.researchSummaryList({
- CurrentIndex: this.page_no,
- PageSize: this.PageSize,
- PublishStatus: this.sta - 0,
- CategoryName: this.industry,
- StartDate: this.issueTime[0],
- EndDate: this.issueTime[1],
- });
- if (res.Ret === 200) {
- this.tableData = res.Data.List;
- this.total = res.Data.Paging.Totals;
- }
- },
- //导出pv uv
- exportPvUv(id) {
- const url =
- process.env.API_ROOT + "/cygx/reportSelection/articleHistoryExport?ArticleId=" + id + "&Source=3&" + localStorage.getItem("auth") || "";
- return url;
- },
- //选择后的事件
- conditionChange() {
- this.page_no = 1;
- this.getList();
- },
- //发布,取消发布,删除
- operationBtn(id, value) {
- this.$confirm(`确定${value}该文章吗?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- if (value == "删除") {
- const res = await raiInterface.researchSummaryDelete({ ArticleId: id });
- if (res.Ret === 200) {
- this.$message.success("删除成功!");
- let page_num = Math.ceil((this.total - 1) / this.PageSize);
- if (this.page_no > page_num) {
- this.page_no = page_num;
- }
- this.getList();
- }
- } else {
- const res = await raiInterface.researchSummaryPublishAndCancel({ ArticleId: id });
- if (res.Ret === 200) {
- this.$message.success(value + "成功!");
- this.getList();
- }
- }
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: `已取消${value}`,
- });
- });
- },
- //文章详情
- goDetail(row) {
- let url =
- process.env.NODE_ENV === "production"
- ? "https://web.hzinsights.com/summary/2"
- : process.env.NODE_ENV === "test"
- ? "https://clpttest.hzinsights.com/summary/2"
- : "https://clpttest.hzinsights.com/summary/2";
- let href = `${url}/${row.ArticleId}`;
- window.open(href, "_blank");
- },
- //去往编辑页面
- editReport(id) {
- this.$router.push({
- path: "/editThisWeek",
- query: { id },
- });
- },
- //分页
- handleCurrentChange(page) {
- this.page_no = page;
- this.getList();
- },
- //table表头Pu/Uv自定义
- renderHeader(h, { column, $index }) {
- 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:报告被打开的次数,每次打开都计算一次(只统计有权限用户)"
- ),
- h(
- "p",
- { slot: "content", attrs: { style: "display:block;padding:5px 0;width:420px;" } },
- "uv:访问报告的人数,每篇报告同一个人访问只计算一次(只统计有权限用户)"
- ),
- h("el-button", { props: { icon: "el-icon-info" }, attrs: { style: "border:none;background:none" } }, ""),
- ]),
- ]);
- },
- emailGroup(row) {
- this.$confirm("确定要对正式/试用客户群发该报告吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- const res = await raiInterface.researchSummarySendMail({
- ArticleId: row.ArticleId,
- });
- if (res.Ret === 200) {
- this.$message.success("发送成功");
- }
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: `已取消`,
- });
- });
- },
- // 可见范围
- async reportVisibleRange(item) {
- const res = await raiInterface.researchSummaryVisibleRange({
- ArticleId: item.ArticleId,
- });
- if (res.Ret === 200) {
- this.$message.success("操作成功");
- this.getList();
- } else {
- this.getList();
- }
- },
- },
- /* 页面进入前是否清除参数 */
- beforeRouteEnter(to, from, next) {
- if (from.path != "/editThisWeek") {
- sessionStorage.removeItem("theLastWeek");
- }
- next();
- },
- /* 页面跳转前记录参数 */
- beforeRouteLeave(to, from, next) {
- let backData = {
- page_no: this.page_no,
- status: this.status, //状态
- issueTime: this.issueTime, //时间
- };
- sessionStorage.setItem("theLastWeek", JSON.stringify(backData));
- next();
- },
- };
- </script>
- <style scoped lang="scss">
- .container-the-last-week {
- .top-box {
- display: flex;
- justify-content: space-between;
- height: 40px;
- margin-bottom: 30px;
- .top-container {
- .el-select {
- margin-right: 20px;
- }
- }
- .el-button {
- padding: 0 30px;
- height: 40px;
- }
- }
- .mx-datepicker {
- width: 220px !important;
- margin-right: 25px;
- }
- .pv-uv-download {
- display: flex;
- align-items: center;
- justify-content: center;
- img {
- width: 14px;
- height: 14px;
- margin-left: 10px;
- }
- }
- }
- </style>
|