AppMain.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <section class="app-main" :style="{ paddingTop: appMainPaddingTop }">
  3. <!-- <el-button type="success" style="width:16%;margin-left: 0" @click="uploadRouteTable">上传路由表</el-button> -->
  4. <transition name="fade-transform" mode="out-in">
  5. <keep-alive include="Monitor">
  6. <router-view :key="key" />
  7. </keep-alive>
  8. </transition>
  9. <el-card v-if="shuo" class="box-card">
  10. <div v-if="mainShow">
  11. <div class="title">
  12. {{ topic }}
  13. </div>
  14. <div class="text">
  15. <p class="p">{{ message }}</p>
  16. </div>
  17. <div class="block">
  18. <el-pagination
  19. style="width: 100%"
  20. @current-change="handleCurrentChange"
  21. :current-page="pagination.current"
  22. :page-size="pagination.size"
  23. layout="prev, pager, next"
  24. pager-count="3"
  25. :total="total"
  26. >
  27. </el-pagination>
  28. </div>
  29. </div>
  30. <el-button type="primary" size="small" class="btn" @click="shuo = false"
  31. >确 定</el-button
  32. >
  33. </el-card>
  34. </section>
  35. </template>
  36. <script>
  37. // import { asyncRoutes } from '@/router/router.config'
  38. import { uploadRoute } from "@/api/user";
  39. import { getNotifications } from "@/api/dashboard";
  40. export default {
  41. name: "AppMain",
  42. computed: {
  43. key() {
  44. return this.$route.path;
  45. },
  46. appMainPaddingTop() {
  47. // const path = this.$route.path
  48. // if (path.indexOf('dashboard') === 1 || path.indexOf('map') === 1) return '0px'
  49. // else return '43px'
  50. const tagsViewShow = this.$store.state.settings.tagsView;
  51. if (tagsViewShow) return "43px";
  52. else return "0px";
  53. },
  54. },
  55. data() {
  56. return {
  57. shuo: true,
  58. mainShow: true,
  59. pagination: {
  60. size: 1,
  61. current: 1,
  62. type: 8,
  63. tableName: "SCADA_HISTORY",
  64. },
  65. total: 0,
  66. topic: "",
  67. message: "",
  68. };
  69. },
  70. mounted() {
  71. this.getNotificationList();
  72. },
  73. methods: {
  74. handleCurrentChange(value) {
  75. console.log("2333", value);
  76. this.pagination.current = value;
  77. this.getNotificationListPage();
  78. },
  79. // 获取消息列表
  80. getNotificationListPage() {
  81. const data = Object.assign({}, this.pagination, this.filter);
  82. // console.log("lz2222222", data);
  83. this.mainShow = false;
  84. getNotifications(data).then((res) => {
  85. if (res.code == 1) {
  86. if (res.result.records.length > 0) {
  87. this.topic = res.result.records[0].topic;
  88. this.message = res.result.records[0].message;
  89. this.total = res.result.total;
  90. this.mainShow = true;
  91. }
  92. }
  93. });
  94. },
  95. getNotificationList() {
  96. const data = Object.assign({}, this.pagination, this.filter);
  97. // console.log("lz2222222", data);
  98. this.shuo = false;
  99. getNotifications(data).then((res) => {
  100. if (res.code == 1) {
  101. if (res.result.records.length > 0) {
  102. this.topic = res.result.records[0].topic;
  103. this.message = res.result.records[0].message;
  104. this.total = res.result.total;
  105. }
  106. }
  107. });
  108. this.shuo = true;
  109. },
  110. uploadRouteTable() {
  111. const data = {
  112. 1: JSON.stringify({
  113. name: "sys",
  114. // value: asyncRoutes,
  115. type: "tofly-master",
  116. notes: "使用与当前系统。",
  117. }),
  118. };
  119. uploadRoute(JSON.stringify(data)).then((res) => {
  120. this.$message.success("上传成功");
  121. });
  122. },
  123. },
  124. };
  125. </script>
  126. <style scoped>
  127. .app-main {
  128. /* min-height: calc(100vh - 64px); */
  129. height: calc(100vh - 64px);
  130. width: 100%;
  131. position: relative;
  132. overflow: hidden;
  133. background: #fff;
  134. }
  135. .box-card {
  136. width: 300px;
  137. height: 300px;
  138. position: absolute;
  139. right: 0;
  140. bottom: 0;
  141. }
  142. .btn {
  143. position: absolute;
  144. bottom: 10px;
  145. right: 10px;
  146. }
  147. .title {
  148. height: 40px;
  149. width: 250px;
  150. overflow: hidden;
  151. text-overflow: ellipsis;
  152. white-space: nowrap;
  153. cursor: pointer;
  154. }
  155. .text {
  156. height: 160px;
  157. }
  158. .p {
  159. margin: 0;
  160. text-overflow: -o-ellipsis-lastline;
  161. overflow: hidden;
  162. text-overflow: ellipsis;
  163. display: -webkit-box;
  164. -webkit-line-clamp: 8;
  165. line-clamp: 8;
  166. -webkit-box-orient: vertical;
  167. }
  168. .block {
  169. width: 150px;
  170. }
  171. .fixed-header + .app-main {
  172. padding-top: 43px;
  173. }
  174. </style>
  175. <style lang="scss">
  176. .el-popup-parent--hidden {
  177. .fixed-header {
  178. padding-right: 15px;
  179. }
  180. }
  181. /deep/.el-pager {
  182. width: 100px;
  183. }
  184. </style>