white.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <div id="pages">
  3. <mu-appbar style="width: 100%;" color="primary" :title="curTitle">
  4. <router-link to="/" slot="left">
  5. <mu-icon value="arrow_back"></mu-icon>
  6. </router-link>
  7. <mu-button flat color="primary" slot="right" @click="showPanel">{{btnText}}</mu-button>
  8. </mu-appbar>
  9. <mu-bottom-sheet :open.sync="popupVisible">
  10. <div class="modal-content">
  11. <div class="modal-body">
  12. <div class="location">
  13. <span>{{$t("query criteria")}}</span>
  14. <div class="timePickerPart">
  15. <span @click="changeTime(1)">{{bt}}</span> <em>{{$t("to")}}</em>
  16. <span @click="changeTime(2)">{{et}}</span>
  17. </div>
  18. <div v-show="open">
  19. <mu-flex justify-content="between" align-items="end" wrap="wrap">
  20. <mu-paper :z-depth="1" class="demo-date-picker">
  21. <mu-date-picker :date.sync="date" color="#FFA200" :date-time-format="enDateFormat"
  22. @change="confirmDay"></mu-date-picker>
  23. </mu-paper>
  24. </mu-flex>
  25. </div>
  26. <input type="text" placeholder="MAC" v-model="MAC" id="macInput">
  27. <input type="text" :placeholder="$t('keyword')" v-model="keyWord" id="keyWordInput">
  28. </div>
  29. </div>
  30. <div class="modalBottom">
  31. <div class="reset" @click="resetModal">
  32. {{$t("Reset")}}
  33. </div>
  34. <div class="pullUp" @click="searchModal">
  35. {{$t("query")}}
  36. </div>
  37. </div>
  38. </div>
  39. </mu-bottom-sheet>
  40. <div class="container">
  41. <div class="row">
  42. <p class="tips" v-if="!lists">{{$t("no use data")}}</p>
  43. <mu-list textline="two-line" v-for="list in lists" :key="list.Id">
  44. <mu-list-item avatar :ripple="false" button>
  45. <mu-list-item-content>
  46. <mu-list-item-title>{{list.Name}}</mu-list-item-title>
  47. <mu-list-item-sub-title>{{list.Mac}}</mu-list-item-sub-title>
  48. <mu-list-item-sub-title>{{list.Memo}}</mu-list-item-sub-title>
  49. </mu-list-item-content>
  50. <mu-list-item-action>
  51. <mu-list-item-after-text>{{list.CreateTime | timeFileter}}</mu-list-item-after-text>
  52. <mu-list-item-after-text>{{list.Regionname}}</mu-list-item-after-text>
  53. <mu-list-item-after-text>{{$t("operator")}}: {{list.Usercode}}</mu-list-item-after-text>
  54. </mu-list-item-action>
  55. </mu-list-item>
  56. <mu-divider></mu-divider>
  57. </mu-list>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import axios from 'axios';
  64. let qs = require('qs');
  65. import Global from '../Global.js'
  66. const enDateFormat = {
  67. formatDisplay (date) {
  68. return `${dayList[date.getDay()]}, ${monthList[date.getMonth()]} ${date.getDate()}`;
  69. },
  70. formatMonth (date) {
  71. return `${monthLongList[date.getMonth()]} ${date.getFullYear()}`;
  72. },
  73. getWeekDayArray (firstDayOfWeek) {
  74. let beforeArray = [];
  75. let afterArray = [];
  76. for (let i = 0; i < dayAbbreviation.length; i++) {
  77. if (i < firstDayOfWeek) {
  78. afterArray.push(dayAbbreviation[i]);
  79. } else {
  80. beforeArray.push(dayAbbreviation[i]);
  81. }
  82. }
  83. return beforeArray.concat(afterArray);
  84. },
  85. getMonthList () {
  86. return monthList;
  87. }
  88. };
  89. export default {
  90. data() {
  91. return {
  92. enDateFormat,
  93. curTitle:this.$t("whiteList"),
  94. lists: [],
  95. popupVisible:false,//true false
  96. open:false,//true false
  97. MAC:'',//
  98. keyWord:'',//
  99. bt: globaltime2StringNoMin(new Date() - 3 * 24 * 3600 * 1000),
  100. et: globaltime2StringNoMin(new Date()),
  101. date: new Date(),
  102. btnText: this.$t("search"),
  103. }
  104. },
  105. mounted() {
  106. this.writeData();
  107. },
  108. filters: {
  109. timeFileter: function (time) {
  110. return globalfmtDate(time, 10)
  111. },
  112. },
  113. methods: {
  114. changeTime(val) {
  115. this.open = true;
  116. let curVal = val == 1 ? new Date(this.bt) : new Date(this.et);
  117. this.selectTime = val;
  118. this.date = curVal;
  119. },
  120. showPanel() {
  121. this.popupVisible = true;
  122. this.btnText = this.$t("close");
  123. },
  124. whenClose(){
  125. this.popupVisible = false;
  126. this.btnText = this.$t("search");
  127. },
  128. confirmDay(date) {
  129. if (this.selectTime == 1) {
  130. this.bt = globaltime2StringNoMin(date);
  131. } else {
  132. this.et = globaltime2StringNoMin(date);
  133. }
  134. this.open = false;
  135. },
  136. // 重置
  137. resetModal() {
  138. this.MAC = '';
  139. this.keyWord = '';
  140. this.bt = globaltime2StringNoMin(new Date() - 3 * 24 * 3600 * 1000);
  141. this.et = globaltime2StringNoMin(new Date());
  142. this.Toast('已重置','success');
  143. },
  144. // 查询
  145. searchModal() {
  146. let that = this;
  147. this.popupVisible = false;
  148. this.writeData();
  149. this.Toast('已查询','success');
  150. },
  151. writeData() {
  152. const that = this;
  153. let url = headapi + 'v1/Detector/WhiteListQuery';
  154. let param = {
  155. token: localStorage.token,
  156. detectedmac:that.MAC,
  157. keywords:that.keyWord,
  158. bt:that.bt + ' 00:00:00',
  159. et:that.et + ' 23:59:59',
  160. };
  161. let postdata = qs.stringify(param);
  162. axios.post(url, postdata).then(function (data) {
  163. let json = data.data;
  164. if (json.Code == 0) {
  165. that.lists = json.Rs;
  166. } else {
  167. that.Toast(that.TransMemo(json.Memo));
  168. }
  169. }, function (response) {
  170. console.info(response);
  171. })
  172. }
  173. },
  174. }
  175. </script>
  176. <style scoped>
  177. /*mu-header*/
  178. .mu-primary-color {
  179. line-height: 60px;
  180. height: 60px;
  181. background: url("../static/images/comm/headerBg.png") top center no-repeat;
  182. background-size: 100%;
  183. }
  184. /deep/ .mu-appbar-left {
  185. padding-top: 15px;
  186. }
  187. /deep/ .material-icons {
  188. color: #fff;
  189. }
  190. /deep/ .mu-appbar-title {
  191. text-align: center;
  192. }
  193. #pages {
  194. position: absolute;
  195. top: 0;
  196. bottom: 0;
  197. width: 100%;
  198. height: 100%;
  199. overflow: hidden;
  200. overflow-y: scroll;
  201. display: block;
  202. margin: 0 auto;
  203. }
  204. .modal-content {
  205. width: 100%;
  206. display: block;
  207. margin: 0 auto;
  208. z-index: 99999;
  209. overflow: hidden;
  210. }
  211. /*mu-bottom-sheet*/
  212. .mu-bottom-sheet {
  213. top: 60px !important;
  214. bottom: 410px;
  215. background: none;
  216. }
  217. .location {
  218. width: 100%;
  219. overflow: hidden;
  220. display: block;
  221. margin: 0 auto;
  222. }
  223. .location span {
  224. width: 100%;
  225. overflow: hidden;
  226. display: block;
  227. margin: 0 auto;
  228. margin-top: 10px;
  229. margin-bottom: 10px;
  230. }
  231. .location input {
  232. width: 95px;
  233. height: 30px;
  234. border: 1px solid #D5D5D5;
  235. float: left;
  236. text-indent: 10px;
  237. }
  238. .modal-body {
  239. width: 100%;
  240. overflow: hidden;
  241. display: block;
  242. margin: 0 auto;
  243. background: #fff;
  244. padding-top: 20px;
  245. padding-left: 5%;
  246. padding-right: 5%;
  247. padding-bottom: 20px;
  248. }
  249. .modalBottom {
  250. width: 100%;
  251. overflow: hidden;
  252. display: block;
  253. margin: 0 auto;
  254. background: #fff;
  255. }
  256. .modalBottom .reset {
  257. width: 50%;
  258. float: left;
  259. height: 40px;
  260. line-height: 40px;
  261. background: #FFF6CF;
  262. text-align: center;
  263. }
  264. .modalBottom .pullUp {
  265. width: 50%;
  266. float: right;
  267. height: 40px;
  268. line-height: 40px;
  269. background: #FFCC00;
  270. text-align: center;
  271. }
  272. .location select {
  273. width: 95px;
  274. height: 30px;
  275. border: 1px solid #D5D5D5;
  276. float: left;
  277. margin-right: 10px;
  278. margin-top: 10px;
  279. margin-bottom: 10px;
  280. }
  281. .location select#detector {
  282. margin-right: 0;
  283. float: left;
  284. }
  285. #macInput {
  286. width: 200px;
  287. margin-bottom: 10px;
  288. }
  289. #keyWordInput {
  290. width: 200px;
  291. }
  292. .timePickerPart {
  293. width: 100%;
  294. overflow: hidden;
  295. display: block;
  296. margin: 0 auto;
  297. }
  298. .timePickerPart em {
  299. width: 25px;
  300. height: 30px;
  301. line-height: 50px;
  302. float: left;
  303. }
  304. .timePickerPart span {
  305. width: 135px;
  306. height: 30px;
  307. line-height: 30px;
  308. border: 1px solid #D5D5D5;
  309. float: left;
  310. margin-right: 8px;
  311. margin-top: 10px;
  312. margin-bottom: 10px;
  313. text-align: center;
  314. }
  315. .demo-date-picker {
  316. width: 100%;
  317. overflow: hidden;
  318. display: block;
  319. margin: 0 auto;
  320. border: none;
  321. box-shadow: none;
  322. }
  323. .mu-datepicker {
  324. width: 100%;
  325. overflow: hidden;
  326. display: block;
  327. margin: 0 auto;
  328. }
  329. .mu-list {
  330. background: #fff;
  331. }
  332. .tips {
  333. width: 100%;
  334. overflow: hidden;
  335. display: block;
  336. margin: 0 auto;
  337. text-align: center;
  338. margin-top: 20px;
  339. }
  340. </style>