index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <!-- <div class="nowTime">
  6. <i class="fa fa-clock-o"></i>
  7. {{currentTime}}
  8. </div> -->
  9. <el-form :inline="true">
  10. <el-form-item>
  11. <el-date-picker
  12. v-model="date"
  13. :editable="false"
  14. format="yyyy-MM-dd"
  15. value-format="yyyy-MM-dd"
  16. @change="getDesktopList"
  17. :clearable="false"
  18. type="date"
  19. placeholder="选择日期"
  20. ></el-date-picker>
  21. </el-form-item>
  22. <el-form-item style="float:right;">
  23. <span style="color:#aaa;font-size:12px;">(员工安装客户端,领导即可查看工作桌面远程监管)</span>
  24. <el-link type="primary" :underline="false" href="http://gsgj.ttkuaiban.com/download.html" target="_blank">客户端下载</el-link>
  25. </el-form-item>
  26. </el-form>
  27. </el-col>
  28. <!-- 卡片列表 -->
  29. <div>
  30. <el-col :span="24" v-if="desktopList.length == 0" style="padding: 200px 0;text-align:center;cursor:pointer">
  31. <el-link :underline="false" type="primary" @click="getHavePic">今日暂无截图,点击查看近期</el-link>
  32. </el-col>
  33. <el-col :span="6" v-for="(item, index) in desktopList" :key="index" class="one_div">
  34. <el-card :body-style="{ padding: '0px' }" shadow="hover" class="one_card">
  35. <div class="one_card_img">
  36. <el-image :src="item.pic_url" class="image" lazy>
  37. <div slot="error" class="image-slot">
  38. <el-image :src="require('../../assets/image/noPic.png')" class="image" lazy></el-image>
  39. </div>
  40. </el-image>
  41. <div :id="'over'+index" class="over">
  42. <el-button type="primary" plain @click.native="jumpTo(item.id)">
  43. <i class="fa fa-link"></i> 所有截图
  44. </el-button>
  45. </div>
  46. </div>
  47. <div class="one_card_txt">
  48. <!-- -1-未知 null 0-研发,1-查资料,2-看文档,3-做设计,4-美工,5-运营,6-看小说,7-打游戏,8-听音乐 9-聊天 -->
  49. <span>{{converType(item.pic_type == null ? 0 : item.pic_type+1)}}</span>
  50. <div class="bottom clearfix">
  51. <el-link>
  52. <i class="fa fa-circle"></i>
  53. {{item.name}}
  54. </el-link>
  55. <time class="time">{{item.time}}</time>
  56. </div>
  57. </div>
  58. </el-card>
  59. </el-col>
  60. </div>
  61. </section>
  62. </template>
  63. <script>
  64. import util from "../../common/js/util";
  65. export default {
  66. data() {
  67. return {
  68. filters: {
  69. keyName: ""
  70. },
  71. user: JSON.parse(sessionStorage.getItem("user")),
  72. date: util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
  73. timer: "",
  74. currentTime: util.formatDate.format(
  75. new Date(new Date()),
  76. "yyyy-MM-dd hh:mm:ss"
  77. ),
  78. desktopList: []
  79. };
  80. },
  81. methods: {
  82. getTime() {
  83. var _this = this; //声明一个变量指向Vue实例this,保证作用域一致
  84. this.timer = setInterval(function() {
  85. _this.currentTime = util.formatDate.format(
  86. new Date(new Date()),
  87. "yyyy-MM-dd hh:mm:ss"
  88. );
  89. }, 1000);
  90. },
  91. //获取项目列表
  92. getDesktopList() {
  93. this.listLoading = true;
  94. this.http.post(
  95. this.port.desktop.list,
  96. {date: this.date},
  97. res => {
  98. this.listLoading = false;
  99. if (res.code == "ok") {
  100. this.desktopList = res.data;
  101. } else {
  102. this.$message({
  103. message: res.msg,
  104. type: "error"
  105. });
  106. }
  107. },
  108. error => {
  109. this.listLoading = false;
  110. this.$message({
  111. message: error,
  112. type: "error"
  113. });
  114. });
  115. },
  116. // 获取最近有数据的日期
  117. getHavePic() {
  118. this.http.post(
  119. this.port.desktop.getScreenshotDate,
  120. {date: new Date()},
  121. res => {
  122. if (res.code == "ok") {
  123. if(res.data != null) {
  124. this.date = res.data;
  125. this.getDesktopList();
  126. }
  127. } else {
  128. this.$message({
  129. message: res.msg,
  130. type: "error"
  131. });
  132. }
  133. },
  134. error => {
  135. this.$message({
  136. message: error,
  137. type: "error"
  138. });
  139. });
  140. },
  141. jumpTo(id) {
  142. this.$router.push("/desktop/" + id + "/" + this.date);
  143. },
  144. //类型枚举转换
  145. converType(type) {
  146. switch (type) {
  147. case 0:
  148. return "其他工作";
  149. case 1:
  150. return "研发";
  151. case 2:
  152. return "上网";
  153. case 3:
  154. return "文档";
  155. case 4:
  156. return "设计";
  157. case 5:
  158. return "美工";
  159. case 6:
  160. return "运营";
  161. case 7:
  162. return "看小说";
  163. case 8:
  164. return "影视娱乐";
  165. case 9:
  166. return "听音乐";
  167. case 10:
  168. return "聊天";
  169. default:
  170. return "未知";
  171. }
  172. }
  173. },
  174. created() {
  175. this.getTime();
  176. },
  177. mounted() {
  178. this.getDesktopList();
  179. },
  180. beforeDestroy() {
  181. if (this.timer) {
  182. clearInterval(this.timer);
  183. }
  184. }
  185. };
  186. </script>
  187. <style lang="scss" scoped>
  188. .nowTime {
  189. height: 35px;
  190. line-height: 28px;
  191. font-size: 18px;
  192. color: #20a0ff;
  193. margin-left: 10px;
  194. i {
  195. margin-right: 10px;
  196. }
  197. }
  198. .one_div {
  199. padding: 15px;
  200. .one_card {
  201. .one_card_img {
  202. position: relative;
  203. .image {
  204. width: 100%;
  205. }
  206. .over {
  207. display: none;
  208. width: 100%;
  209. height: 98%;
  210. background: rgba(0, 0, 0, 0.2);
  211. position: absolute;
  212. top: 0;
  213. text-align: center;
  214. }
  215. }
  216. .one_card_txt {
  217. padding: 13px;
  218. .bottom {
  219. margin-top: 13px;
  220. line-height: 12px;
  221. i {
  222. color: #9ed0ff;
  223. margin-right: 5px;
  224. }
  225. .time {
  226. float: right;
  227. margin-top: 2px;
  228. color: #999;
  229. }
  230. }
  231. }
  232. }
  233. .one_card:hover {
  234. .one_card_img {
  235. .over {
  236. display: block !important;
  237. }
  238. }
  239. }
  240. }
  241. </style>
  242. <style lang="scss">
  243. .image {
  244. .el-image__inner {
  245. height: 11.6vw !important;
  246. }
  247. }
  248. .one_card_img {
  249. .over {
  250. .el-button {
  251. margin-top: 25%;
  252. }
  253. }
  254. }
  255. </style>