heartLog.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>使用记录</h5>
  5. </div>
  6. <div class="table">
  7. <el-table
  8. :data="tableData"
  9. border
  10. is-horizontal-resize
  11. :default-sort="{prop: 'date', order: 'descending'}"
  12. element-loading-background="rgba(0, 0, 0, 0.8)"
  13. class=""
  14. >
  15. <el-table-column
  16. type="index"
  17. label="序号"
  18. align="center"
  19. width="50">
  20. </el-table-column>
  21. <el-table-column
  22. prop="CreatedAt"
  23. label="日期"
  24. :formatter="filterFmtDate"
  25. sortable
  26. >
  27. </el-table-column>
  28. <el-table-column
  29. prop="OptName"
  30. label="操作者"
  31. sortable
  32. >
  33. </el-table-column>
  34. <el-table-column
  35. prop="OptInfo"
  36. label="操作信息"
  37. sortable
  38. >
  39. <template slot-scope="scope">
  40. <span v-if="scope.row.AdminType == 1" style="color: #005EA2">已领取</span>
  41. <span v-else style="color: green">已归还</span>
  42. </template>
  43. </el-table-column>
  44. </el-table-column>
  45. </el-table>
  46. <br>
  47. <el-pagination
  48. background
  49. :total="pageination.total"
  50. :page-size="pageination.pageItem"
  51. @current-change="pageChange"
  52. ></el-pagination>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import Global from '../Global.js'
  58. import {
  59. OptLogListQuery,
  60. testTable,
  61. testSelect, ShopManagerListQuery, ShopListQuery
  62. } from "../api/getApiRes";
  63. let qs = require('qs');
  64. export default {
  65. data() {
  66. return {
  67. dialogVisible: false,
  68. dialogTitle: '新增管理员',
  69. times: globalBt2(7),
  70. // panel 配置项目
  71. panel: {
  72. userCode: '',
  73. tel: '',
  74. userId: '',
  75. shopList: 0,
  76. shopId: '',
  77. options: [],
  78. shopOptions: [],
  79. draw: 1,
  80. start: 0,
  81. recordsTotal: 0,
  82. tableData: [],
  83. allTableData: [],
  84. limit: '10',
  85. multipleSort: false,
  86. loading: false,
  87. fileList: [],
  88. multipleSelection: [],
  89. detectedmac: '',
  90. time1: globalBt(),
  91. timeScope: globalBt2(30),
  92. },
  93. multipleSelection: [],
  94. pageination: {
  95. pageItem: 100,
  96. pageoptions: pageOptions(),
  97. total: 100,
  98. pageIndex: 1,
  99. },
  100. form: {
  101. name: '',
  102. userCode: '',
  103. shopId: '',
  104. },
  105. shops: [],
  106. tableData: [],
  107. serachBtnStatus: false,
  108. }
  109. },
  110. mounted() {
  111. this.panelSelect();
  112. this.shopPanelSelect();
  113. this.getTableQuery();
  114. },
  115. methods: {
  116. shopPanelSelect(){
  117. let that = this;
  118. let param = {
  119. token: localStorage.token,
  120. };
  121. let postdata = qs.stringify(param);
  122. ShopListQuery(postdata).then(res => {
  123. let json = res;
  124. if (json.Code == 0) {
  125. if (json.Rs == '') {
  126. that.$message.error('当前没有可选的店铺,请先在店面管理中添加店铺!');
  127. return false
  128. }
  129. that.panel.shopOptions = turnShopResToOption(json.Rs);
  130. that.panel.shopOptions.unshift({value: '', label: "全部"});
  131. } else {
  132. that.$message.error(json.Memo);
  133. }
  134. })
  135. },
  136. // 加载选项
  137. panelSelect() {
  138. let that = this;
  139. let param = {
  140. token: localStorage.token,
  141. start: 1,
  142. tableMax: 999,
  143. };
  144. let postdata = qs.stringify(param);
  145. ShopManagerListQuery(postdata).then(res => {
  146. let json = res;
  147. if (json.Code == 0) {
  148. that.panel.options = this.turnResToOptionByUsers(json.Rs);
  149. that.panel.options.unshift({value: '', label: "全部"});
  150. console.log(that.panel.options);
  151. } else {
  152. that.$message.error(json.Memo);
  153. }
  154. })
  155. },
  156. turnResToOptionByUsers(data) {
  157. if (!data) return false
  158. let ids = data.map(item => {
  159. return {
  160. label: item.Name + ' ' + item.Phone,
  161. key: parseInt(item.Id),
  162. value: parseInt(item.Id),
  163. }
  164. })
  165. return ids
  166. },
  167. clearForm() {
  168. // clear
  169. this.form.name = '';
  170. this.form.userCode = '';
  171. this.form.shopId = '';
  172. },
  173. handleSelectionChange(val) {
  174. this.multipleSelection = val;
  175. },
  176. // 查询按钮
  177. query() {
  178. // 按钮倒计时
  179. let that = this;
  180. that.serachBtnStatus = true;
  181. let totalTime = 2
  182. let clock = window.setInterval(() => {
  183. totalTime--
  184. if (totalTime < 0) {
  185. totalTime = 2;
  186. that.serachBtnStatus = false;
  187. }
  188. }, 1000)
  189. this.getTableQuery();
  190. this.$message.success('查询完毕');
  191. },
  192. // 页面数据查询
  193. getTableQuery() {
  194. let that = this;
  195. // this.getGetChildRegionSelect(0, 1);
  196. that.loading = true;
  197. // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
  198. let param = {
  199. token: localStorage.token,
  200. name: this.panel.name,
  201. phone: this.panel.phone,
  202. userId: this.panel.userId,
  203. bt: nonTfmtDatetoLength(that.panel.timeScope[0], 10) + " 00:00:00",
  204. et: nonTfmtDatetoLength(that.panel.timeScope[1], 10) + " 23:59:59",
  205. start: 1,//
  206. tableMax: 9999,//
  207. optShopId:this.panel.shopId,
  208. };
  209. let postdata = qs.stringify(param);
  210. OptLogListQuery(postdata).then(res => {
  211. let json = res;
  212. if (json.Code == 0) {
  213. that.loading = false;
  214. if (json.Rs) {
  215. that.allTableData = json.Rs;
  216. that.recordsTotal = json.Rs.length;
  217. } else {
  218. that.allTableData = [];
  219. that.recordsTotal = 0;
  220. }
  221. // 设置分页数据
  222. that.setPaginations();
  223. } else {
  224. that.$message.error(json.Memo);
  225. }
  226. })
  227. },
  228. // 设置分页数据
  229. setPaginations() {
  230. // 分页属性
  231. let that = this;
  232. that.pageination.total = that.recordsTotal;
  233. // 默认分页
  234. that.tableData = that.allTableData.filter((item, index) => {
  235. return index < that.pageination.pageItem;
  236. });
  237. },
  238. // 每页显示数量
  239. handleSizeChange() {
  240. let that = this;
  241. that.tableData = that.allTableData.filter((item, index) => {
  242. return index < that.pageination.pageItem;
  243. });
  244. that.draw = that.pageination.pageItem;
  245. that.getTableQuery();
  246. },
  247. // 翻页
  248. pageChange(pageIndex) {
  249. let that = this;
  250. // 获取当前页
  251. let index = that.pageination.pageItem * (pageIndex - 1);
  252. // 数据总数
  253. let nums = that.pageination.pageItem * pageIndex;
  254. // 容器
  255. let tables = [];
  256. for (var i = index; i < nums; i++) {
  257. if (that.allTableData[i]) {
  258. tables.push(that.allTableData[i])
  259. }
  260. this.tableData = tables;
  261. }
  262. that.start = index * that.draw;
  263. // that.getTableQuery();
  264. },
  265. // 自动排序
  266. sortChange(params) {
  267. console.log(params)
  268. },
  269. // 过滤时间
  270. filterFmtDate(value, row, column) {
  271. let that = this;
  272. return nonTfmtDate(column, 11);
  273. },
  274. },
  275. }
  276. </script>
  277. <style scoped>
  278. @import "../assets/css/panel.css";
  279. .context {
  280. height: 770px;
  281. overflow-y: scroll;
  282. display: block;
  283. margin: 0 auto;
  284. background-color: #fff !important;
  285. padding: 30px;
  286. padding-bottom: 60px;
  287. }
  288. .panel-body {
  289. padding: 20px;
  290. background: #F0F2F5;
  291. }
  292. .change {
  293. width: 100%;
  294. overflow: hidden;
  295. display: block;
  296. margin: 0 auto;
  297. padding-top: 10px;
  298. padding-bottom: 10px;
  299. }
  300. .change button {
  301. float: left;
  302. }
  303. .change button.pull-right {
  304. float: right;
  305. }
  306. .dialogTitle {
  307. width: 100%;
  308. overflow: hidden;
  309. display: block;
  310. margin: 0 auto;
  311. color: #000000;
  312. font-size: 18px;
  313. text-align: center;
  314. }
  315. .dialogTitle em {
  316. float: none;
  317. font-style: normal;
  318. color: #3799FF;
  319. margin: 0;
  320. }
  321. /deep/ .el-transfer-panel__item .el-checkbox__input {
  322. left: 40px;
  323. }
  324. .dialogFooter {
  325. width: 90%;
  326. overflow: hidden;
  327. display: block;
  328. margin: 0 auto;
  329. margin-top: 10px;
  330. }
  331. .dialogFooter button {
  332. float: right;
  333. margin-left: 10px;
  334. }
  335. /deep/ .el-date-editor .el-range__icon {
  336. line-height: 22px;
  337. }
  338. .panel /deep/ .el-date-editor .el-range-separator {
  339. line-height: 22px;
  340. }
  341. /*ipad only*/
  342. @media only screen and (max-width: 1366px) {
  343. .panel /deep/ .el-date-editor--daterange {
  344. width: 100%;
  345. }
  346. }
  347. </style>