thisWeek.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="container-the-last-week">
  3. <!-- 本周研究汇总 -->
  4. <el-card>
  5. <div class="top-box">
  6. <div class="top-container">
  7. <!-- <el-select placeholder="行业" clearable v-model="industry" @change="conditionChange" style="margin-bottom: 20px">
  8. <el-option v-for="item in chartPermissionList" :label="item.PermissionName" :key="item.ChartPermissionId" :value="item.ChartPermissionId"></el-option>
  9. </el-select> -->
  10. <el-select placeholder="发布状态" clearable v-model="status" @change="conditionChange" style="margin-bottom: 20px">
  11. <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
  12. </el-select>
  13. <date-picker v-model="issueTime" type="date" range placeholder="发布时间" value-type="format" @change="conditionChange"> </date-picker>
  14. </div>
  15. <div>
  16. <el-button type="primary" @click="$router.push('/addThisWeek')">添加</el-button>
  17. </div>
  18. </div>
  19. <el-table :data="tableData" style="width: 100%" border>
  20. <el-table-column prop="" align="center" label="标题" min-width="260">
  21. <template slot-scope="scope">
  22. <span class="editsty" @click="goDetail(scope.row)">{{ scope.row.Title }}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="Periods" align="center" label="期数" width="118"></el-table-column>
  26. <el-table-column prop="PublishDate" align="center" label="发布时间" min-width="118"></el-table-column>
  27. <el-table-column prop="LastUpdatedTime" align="center" label="更新时间" min-width="165"></el-table-column>
  28. <el-table-column prop="" align="center" label="发布状态" width="118">
  29. <template slot-scope="scope">
  30. <span>{{ scope.row.PublishStatus == 1 ? "已发布" : "未发布" }}</span>
  31. </template>
  32. </el-table-column>
  33. <el-table-column width="135" label="PV / UV" align="center" :render-header="renderHeader">
  34. <template slot-scope="scope">
  35. <div class="pv-uv-download">
  36. <span>{{ scope.row.Pv }}/{{ scope.row.Uv }}</span>
  37. <a :href="exportPvUv(scope.row.ArticleId)" download>
  38. <img src="~@/assets/img/rai_m/pvuv_download.png" alt="" />
  39. </a>
  40. </div>
  41. </template>
  42. </el-table-column>
  43. <el-table-column key="VisibleRange" width="156" label="可见范围" align="center">
  44. <template slot-scope="{ row }" v-if="row.PublishStatus === 1">
  45. <el-radio-group v-model="row.VisibleRange" @input="reportVisibleRange(row)">
  46. <el-radio :label="1">全部</el-radio>
  47. <el-radio :label="0">内部</el-radio>
  48. </el-radio-group>
  49. </template>
  50. </el-table-column>
  51. <el-table-column align="center" label="操作" min-width="168">
  52. <template slot-scope="scope">
  53. <span v-if="scope.row.PublishStatus !== 1" class="editsty" @click="operationBtn(scope.row.ArticleId, '发布')">发布&nbsp;&nbsp;</span>
  54. <span v-else class="editsty" @click="operationBtn(scope.row.ArticleId, '取消发布')">取消发布&nbsp;&nbsp;</span>
  55. <span class="editsty" @click="editReport(scope.row.ArticleId)">编辑&nbsp;&nbsp;</span>
  56. <span v-if="scope.row.PublishStatus !== 1 && !scope.row.Periods" class="deletesty" @click="operationBtn(scope.row.ArticleId, '删除')"
  57. >删除&nbsp;&nbsp;</span
  58. >
  59. <span v-if="scope.row.PublishStatus == 1" class="editsty" @click="emailGroup(scope.row)">群发邮件</span>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <!-- 分页 -->
  64. <el-col :span="24" class="toolbar">
  65. <m-page :total="total" :page_no="page_no" :pageSize="10" @handleCurrentChange="handleCurrentChange" />
  66. </el-col>
  67. </el-card>
  68. </div>
  69. </template>
  70. <script>
  71. import mPage from "@/components/mPage.vue";
  72. import { raiInterface } from "@/api/api.js";
  73. export default {
  74. name: "",
  75. components: { mPage },
  76. props: {},
  77. data() {
  78. return {
  79. page_no: sessionStorage.getItem("theLastWeek") ? JSON.parse(sessionStorage.getItem("theLastWeek")).page_no : 1,
  80. total: 0, //条数
  81. PageSize: 10, //每页显示几条
  82. //industry: "", //行业
  83. status: "", //发布状态
  84. issueTime: "", //时间
  85. //chartPermissionList: [], //行业的数组
  86. options: [
  87. { id: 0, name: "未发布" },
  88. { id: 1, name: "已发布" },
  89. ], //发布的数组
  90. tableData: [], //表格
  91. };
  92. },
  93. computed: {
  94. sta() {
  95. return this.status === 0 ? this.status : this.status === 1 ? this.status : 2;
  96. },
  97. },
  98. watch: {},
  99. created() {},
  100. mounted() {
  101. if (sessionStorage.getItem("theLastWeek")) {
  102. const initialize = JSON.parse(sessionStorage.getItem("theLastWeek"));
  103. this.status = initialize.status;
  104. this.issueTime = initialize.issueTime;
  105. }
  106. this.getList();
  107. //this.getIndustryList()
  108. },
  109. methods: {
  110. //获取list数组
  111. async getList() {
  112. const res = await raiInterface.researchSummaryList({
  113. CurrentIndex: this.page_no,
  114. PageSize: this.PageSize,
  115. PublishStatus: this.sta - 0,
  116. CategoryName: this.industry,
  117. StartDate: this.issueTime[0],
  118. EndDate: this.issueTime[1],
  119. });
  120. if (res.Ret === 200) {
  121. this.tableData = res.Data.List;
  122. this.total = res.Data.Paging.Totals;
  123. }
  124. },
  125. //导出pv uv
  126. exportPvUv(id) {
  127. const url =
  128. process.env.API_ROOT + "/cygx/reportSelection/articleHistoryExport?ArticleId=" + id + "&Source=3&" + localStorage.getItem("auth") || "";
  129. return url;
  130. },
  131. //选择后的事件
  132. conditionChange() {
  133. this.page_no = 1;
  134. this.getList();
  135. },
  136. //发布,取消发布,删除
  137. operationBtn(id, value) {
  138. this.$confirm(`确定${value}该文章吗?`, "提示", {
  139. confirmButtonText: "确定",
  140. cancelButtonText: "取消",
  141. type: "warning",
  142. })
  143. .then(async () => {
  144. if (value == "删除") {
  145. const res = await raiInterface.researchSummaryDelete({ ArticleId: id });
  146. if (res.Ret === 200) {
  147. this.$message.success("删除成功!");
  148. let page_num = Math.ceil((this.total - 1) / this.PageSize);
  149. if (this.page_no > page_num) {
  150. this.page_no = page_num;
  151. }
  152. this.getList();
  153. }
  154. } else {
  155. const res = await raiInterface.researchSummaryPublishAndCancel({ ArticleId: id });
  156. if (res.Ret === 200) {
  157. this.$message.success(value + "成功!");
  158. this.getList();
  159. }
  160. }
  161. })
  162. .catch(() => {
  163. this.$message({
  164. type: "info",
  165. message: `已取消${value}`,
  166. });
  167. });
  168. },
  169. //文章详情
  170. goDetail(row) {
  171. let url =
  172. process.env.NODE_ENV === "production"
  173. ? "https://web.hzinsights.com/summary/2"
  174. : process.env.NODE_ENV === "test"
  175. ? "https://clpttest.hzinsights.com/summary/2"
  176. : "https://clpttest.hzinsights.com/summary/2";
  177. let href = `${url}/${row.ArticleId}`;
  178. window.open(href, "_blank");
  179. },
  180. //去往编辑页面
  181. editReport(id) {
  182. this.$router.push({
  183. path: "/editThisWeek",
  184. query: { id },
  185. });
  186. },
  187. //分页
  188. handleCurrentChange(page) {
  189. this.page_no = page;
  190. this.getList();
  191. },
  192. //table表头Pu/Uv自定义
  193. renderHeader(h, { column, $index }) {
  194. return h("div", { attrs: { style: "padding:0;" } }, [
  195. h("span", column.label),
  196. h("el-tooltip", { props: { placement: "top" } }, [
  197. h(
  198. "p",
  199. { slot: "content", attrs: { style: "display:block;padding:5px 0;width:420px;" } },
  200. "pv:报告被打开的次数,每次打开都计算一次(只统计有权限用户)"
  201. ),
  202. h(
  203. "p",
  204. { slot: "content", attrs: { style: "display:block;padding:5px 0;width:420px;" } },
  205. "uv:访问报告的人数,每篇报告同一个人访问只计算一次(只统计有权限用户)"
  206. ),
  207. h("el-button", { props: { icon: "el-icon-info" }, attrs: { style: "border:none;background:none" } }, ""),
  208. ]),
  209. ]);
  210. },
  211. emailGroup(row) {
  212. this.$confirm("确定要对正式/试用客户群发该报告吗?", "提示", {
  213. confirmButtonText: "确定",
  214. cancelButtonText: "取消",
  215. type: "warning",
  216. })
  217. .then(async () => {
  218. const res = await raiInterface.researchSummarySendMail({
  219. ArticleId: row.ArticleId,
  220. });
  221. if (res.Ret === 200) {
  222. this.$message.success("发送成功");
  223. }
  224. })
  225. .catch(() => {
  226. this.$message({
  227. type: "info",
  228. message: `已取消`,
  229. });
  230. });
  231. },
  232. // 可见范围
  233. async reportVisibleRange(item) {
  234. const res = await raiInterface.researchSummaryVisibleRange({
  235. ArticleId: item.ArticleId,
  236. });
  237. if (res.Ret === 200) {
  238. this.$message.success("操作成功");
  239. this.getList();
  240. } else {
  241. this.getList();
  242. }
  243. },
  244. },
  245. /* 页面进入前是否清除参数 */
  246. beforeRouteEnter(to, from, next) {
  247. if (from.path != "/editThisWeek") {
  248. sessionStorage.removeItem("theLastWeek");
  249. }
  250. next();
  251. },
  252. /* 页面跳转前记录参数 */
  253. beforeRouteLeave(to, from, next) {
  254. let backData = {
  255. page_no: this.page_no,
  256. status: this.status, //状态
  257. issueTime: this.issueTime, //时间
  258. };
  259. sessionStorage.setItem("theLastWeek", JSON.stringify(backData));
  260. next();
  261. },
  262. };
  263. </script>
  264. <style scoped lang="scss">
  265. .container-the-last-week {
  266. .top-box {
  267. display: flex;
  268. justify-content: space-between;
  269. height: 40px;
  270. margin-bottom: 30px;
  271. .top-container {
  272. .el-select {
  273. margin-right: 20px;
  274. }
  275. }
  276. .el-button {
  277. padding: 0 30px;
  278. height: 40px;
  279. }
  280. }
  281. .mx-datepicker {
  282. width: 220px !important;
  283. margin-right: 25px;
  284. }
  285. .pv-uv-download {
  286. display: flex;
  287. align-items: center;
  288. justify-content: center;
  289. img {
  290. width: 14px;
  291. height: 14px;
  292. margin-left: 10px;
  293. }
  294. }
  295. }
  296. </style>