index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="68px"
  9. >
  10. <el-form-item prop="starttime">
  11. <el-date-picker
  12. clearable
  13. size="small"
  14. v-model="queryParams.starttime"
  15. type="datetime"
  16. placeholder="请选择开始时间"
  17. value-format="yyyy-MM-dd HH:mm:ss"
  18. >
  19. </el-date-picker>
  20. </el-form-item>
  21. <el-form-item prop="endtime">
  22. <el-date-picker
  23. clearable
  24. size="small"
  25. v-model="queryParams.endtime"
  26. type="datetime"
  27. placeholder="请选择结束时间"
  28. value-format="yyyy-MM-dd HH:mm:ss"
  29. >
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item prop="ename">
  33. <el-input
  34. v-model="queryParams.ename"
  35. placeholder="请输入名字"
  36. ></el-input>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button size="btr" @click="handleQuery">搜索</el-button>
  40. <el-button size="btr" @click="resetQuery">重置</el-button>
  41. </el-form-item>
  42. </el-form>
  43. <el-row :gutter="10" class="mb8">
  44. <el-col :span="1.5">
  45. <el-button
  46. type="primary"
  47. plain
  48. icon="el-icon-plus"
  49. size="mini"
  50. @click="handleDao"
  51. >导出</el-button
  52. >
  53. </el-col>
  54. </el-row>
  55. <el-table
  56. v-loading="loading"
  57. :data="bdglevenList"
  58. :header-cell-style="{ background: '#003C69', color: 'white' }"
  59. >
  60. <!-- <el-table-column label="序号" align="center" prop="id" /> -->
  61. <el-table-column label="序号" type="index" width="50" align="center">
  62. <template scope="scope">
  63. <span>{{
  64. (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
  65. }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="编号" align="center" prop="pin" />
  69. <el-table-column label="姓名" align="center" prop="ename" />
  70. <el-table-column
  71. label="单位"
  72. align="center"
  73. prop="deptname"
  74. show-overflow-tooltip
  75. />
  76. <el-table-column label="时间" align="center" prop="checktime">
  77. </el-table-column>
  78. <el-table-column label="设备编号" align="center" prop="sn" />
  79. <!-- <el-table-column
  80. label="操作"
  81. align="center"
  82. class-name="small-padding fixed-width"
  83. width="200"
  84. >
  85. <template slot-scope="scope">
  86. <el-button
  87. size="btk"
  88. type="text"
  89. @click="handleChakan(scope.row)"
  90. v-hasPermi="['grassrootsregistration:bdgldiary:edit']"
  91. ><span class="chakan">查看</span></el-button
  92. >
  93. </template>
  94. </el-table-column> -->
  95. </el-table>
  96. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  97. @pagination="getToat" />
  98. </div>
  99. </template>
  100. <script>
  101. import axios from "axios";
  102. import { listBarracks, attendancerecordList } from "@/api/access/accessControl";
  103. export default {
  104. name: "access",
  105. data() {
  106. return {
  107. // 查询参数
  108. queryParams: {
  109. pageNum: 1,
  110. pageSize: 10,
  111. },
  112. bdglevenList: [],
  113. // 显示搜索条件
  114. showSearch: true,
  115. // 遮罩层
  116. loading: false,
  117. // 总条数
  118. total: 0,
  119. forms: {},
  120. };
  121. },
  122. created() {
  123. this.getTiem()
  124. },
  125. methods: {
  126. getToat(){
  127. if(this.queryParams.starttime&&this.queryParams.endtime){
  128. this.getList(this.queryParams.starttime,this.queryParams.endtime,this.queryParams.ename);
  129. }else{
  130. this.getTiem()
  131. }
  132. },
  133. // 导出操作
  134. handleDao() {
  135. if (this.queryParams.starttime && this.queryParams.endtime) {
  136. var forms = {};
  137. forms.startTime = this.queryParams.starttime;
  138. forms.endTime = this.queryParams.endtime;
  139. listBarracks(forms).then((res) => {
  140. // console.log(res);
  141. this.$download.name(res.msg);
  142. // this.exportLoading = false;
  143. });
  144. } else {
  145. this.$message.error("导出必须有开始结束时间!");
  146. }
  147. },
  148. // 获取当月的时间
  149. getTiem() {
  150. var date = new Date();
  151. // 当月第一天
  152. var firstDay = date.setDate(1);
  153. // 当月最后一天
  154. const currentMonth = date.getMonth();
  155. const nextMonth = currentMonth + 1;
  156. const nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1);
  157. var lastDay = new Date(nextMonthFirstDay);
  158. var starttimes =
  159. new Date(firstDay).toISOString().slice(0, 10) + " " + "00:00:00";
  160. var endtimes =
  161. new Date(lastDay).toISOString().slice(0, 10) + " " + "23:50:00";
  162. this.getList(starttimes,endtimes);
  163. },
  164. handleQuery() {
  165. if(this.queryParams.starttime&&this.queryParams.endtime){
  166. this.getList(this.queryParams.starttime,this.queryParams.endtime,this.queryParams.ename);
  167. }
  168. },
  169. // 重置
  170. resetQuery() {
  171. this.queryParams.pageNum = 0;
  172. this.queryParams.pageSize = 10;
  173. this.queryParams.starttime = "";
  174. this.queryParams.endtime = "";
  175. this.queryParams.ename = "";
  176. this.getTiem();
  177. },
  178. getList(starttimes,endtimes,name,) {
  179. this.loading = true;
  180. var formes = {};
  181. formes.starttime=starttimes;
  182. formes.endtime= endtimes;
  183. formes.ename= name;
  184. formes.pageNum= this.queryParams.pageNum;
  185. formes.pageSize= this.queryParams.pageSize;
  186. console.log(formes);
  187. attendancerecordList(formes).then((res) => {
  188. this.loading = false;
  189. this.bdglevenList = res.rows;
  190. this.total=res.total
  191. });
  192. // axios
  193. // .post(
  194. // "http://192.168.5.188:85/api/v2/transaction/get/?key=2633p84hnnlavzcy9afjcbtj1jdnega0ftscjkka6h7a",
  195. // {
  196. // starttime,
  197. // endtime,
  198. // }
  199. // )
  200. // .then((res) => {
  201. // this.loading = false;
  202. // if (res.data.ret != 174) {
  203. // this.bdglevenList = res.data.data.items;
  204. // this.total = res.data.data.items.length;
  205. // }
  206. // });
  207. },
  208. },
  209. };
  210. </script>
  211. <style scoped>
  212. /* 对话框背景颜色 */
  213. ::v-deep .el-dialog {
  214. width: 1016px !important;
  215. background: #004d86 !important;
  216. }
  217. ::v-deep .el-textarea__inner {
  218. width: 882px;
  219. height: 104px;
  220. }
  221. ::v-deep .el-dialog__header {
  222. border-bottom: 1px solid #718a9d;
  223. }
  224. ::v-deep .el-dialog__title {
  225. color: #fff;
  226. font: 18px;
  227. }
  228. ::v-deep .el-dialog__headerbtn .el-dialog__close {
  229. color: #fff;
  230. }
  231. ::v-deep .el-form-item__label {
  232. font: 16px;
  233. color: #fff;
  234. width: 100px !important;
  235. }
  236. ::v-deep .el-input__inner {
  237. background: transparent;
  238. color: #fff;
  239. border: 1px solid white !important;
  240. border-color: #fff !important;
  241. }
  242. /* 单位框背景颜色 */
  243. ::v-deep .vue-treeselect__control {
  244. background: #004d86 !important;
  245. }
  246. /*调整表单间距 */
  247. ::v-deep .el-form-item__content {
  248. width: 200px;
  249. }
  250. ::v-deep .el-dialog__body {
  251. /* margin: 0px 20px; */
  252. box-sizing: border-box;
  253. padding: 30px 0px 30px 42px;
  254. }
  255. /* 刷新图标 */
  256. /* .el-icon-refresh {
  257. width: 76px;
  258. height: 36px;
  259. color: #fff;
  260. background-color: #1d96ff !important;
  261. border-radius: 4px;
  262. border: none;
  263. margin-left: 20px;
  264. font-size: 14px;
  265. } */
  266. /* 下拉菜单字体/背景颜色 */
  267. /* .el-select-dropdown__item.hover,
  268. .el-select-dropdown__item:hover {
  269. background-color: #004d86;
  270. color: #fff;
  271. } */
  272. /* .el-select-dropdown__item {
  273. color: #fff;
  274. } */
  275. /* 时间选择 */
  276. ::v-deep .el-input--small .el-input__inner {
  277. width: 200px;
  278. height: 36px;
  279. line-height: 36px;
  280. }
  281. .el-date-editor.el-input {
  282. width: 200px;
  283. height: 36px;
  284. line-height: 36px;
  285. }
  286. ::v-deep .el-date-editor.el-input .el-input__inner {
  287. height: 36px;
  288. line-height: 36px;
  289. }
  290. /* 调整输入框提示文字颜色 */
  291. ::v-deep .vue-treeselect__placeholder {
  292. color: #bdbdbd4f !important;
  293. }
  294. ::v-deep input::-webkit-input-placeholder {
  295. color: #bdbdbd4f !important;
  296. }
  297. ::v-deep input:-moz-placeholder {
  298. color: #bdbdbd4f !important;
  299. }
  300. ::v-deep .el-select__input {
  301. color: #fff !important;
  302. }
  303. </style>