log.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <div class="content-box">
  3. <div class="left">
  4. <!-- <el-icon :size="23" class="camera"><UserFilled /></el-icon> -->
  5. <span class="cameratxt">操作日志</span>
  6. </div>
  7. <div class="filter">
  8. <div class="condition">
  9. <span>操作日期 : </span>
  10. <el-date-picker
  11. type="date"
  12. placeholder="请选择日期"
  13. format="YYYY-MM-DD"
  14. value-format="YYYY-MM-DD"
  15. v-model="searchInput.create_time"
  16. />
  17. </div>
  18. <div class="condition">
  19. <span>车牌号 : </span>
  20. <el-select
  21. v-model="searchInput.car_number"
  22. class="m-2"
  23. placeholder="请选择车牌号"
  24. :clearable="true"
  25. >
  26. <el-option
  27. v-for="item in busNum.list"
  28. :key="item"
  29. :label="item.car_number"
  30. :value="item.car_number"
  31. />
  32. </el-select>
  33. </div>
  34. <!-- <div class="condition">
  35. <span>发车日期 : </span>
  36. <el-date-picker
  37. type="date"
  38. placeholder="请选择日期"
  39. format="YYYY-MM-DD"
  40. value-format="YYYY-MM-DD"
  41. v-model="searchInput.s_date"
  42. />
  43. </div> -->
  44. <el-button
  45. color="rgba(61, 81, 232, 1)"
  46. type="primary"
  47. class="search"
  48. @click="search"
  49. ><el-icon><Search /></el-icon><span>搜索</span></el-button
  50. >
  51. <el-button
  52. style="margin-left: 20px"
  53. color="rgba(61, 81, 232, 1)"
  54. type="primary"
  55. class="search"
  56. @click="resetSearch"
  57. ><el-icon><Search /></el-icon><span>重置</span></el-button
  58. >
  59. </div>
  60. <div class="footer">
  61. <el-table
  62. :row-class-name="tableRowClassName"
  63. :data="tableData.list"
  64. style="width: 100%;"
  65. :header-cell-style="{
  66. background: 'rgba(240, 243, 247, 1)',
  67. border: 0,
  68. }"
  69. >
  70. <el-table-column
  71. width="280"
  72. align="center"
  73. prop="create_time"
  74. label="操作日期"
  75. />
  76. <el-table-column
  77. align="center"
  78. width="100"
  79. prop="admin_name"
  80. label="操作账号"
  81. />
  82. <el-table-column
  83. align="center"
  84. width="150"
  85. prop="car_number"
  86. label="车牌"
  87. />
  88. <el-table-column align="center" prop="record1" label="操作详情" />
  89. </el-table>
  90. </div>
  91. <!-- 分页数据 -->
  92. <el-pagination
  93. background
  94. :current-page="currentPage"
  95. :page-size="pageSize"
  96. layout="total, prev, pager, next, jumper, slot"
  97. :total="total"
  98. @update:current-page="handleCurrentChange"
  99. />
  100. </div>
  101. </template>
  102. <script setup>
  103. import { ref, reactive, watch, onBeforeMount, onMounted } from "vue";
  104. import { useRouter } from "vue-router";
  105. import { Select, Pointer, Upload } from "@element-plus/icons-vue";
  106. import { JSEncrypt } from "jsencrypt"; // 加密密码
  107. import { ElMessage, ElMessageBox } from "element-plus";
  108. import { dayjs } from "element-plus";
  109. import axios from "axios";
  110. import lodash from "lodash";
  111. import adminApi from "@/api/admin.js";
  112. import { useStore } from "vuex";
  113. const store = useStore();
  114. const router = useRouter();
  115. const api = ref("");
  116. // 搜索框数据
  117. const searchInput = reactive({
  118. startTime: "",
  119. car_number: "",
  120. });
  121. const busNum = reactive({ list: [] }); // 车牌号
  122. // 表格数据
  123. const tableData = reactive({
  124. list: [], //汇总数据
  125. });
  126. const pageSize = ref(10);
  127. const currentPage = ref(1); // 当前页
  128. const total = ref(10); // 当前总数
  129. // 获取数据列表
  130. const getList = async () => {
  131. {
  132. let data = new FormData();
  133. let time = dayjs().format("YYYY-MM-DD");
  134. console.log(searchInput.car_number);
  135. console.log(searchInput.create_time == null);
  136. if (searchInput.car_number) {
  137. data.set("car_number", searchInput.car_number);
  138. }
  139. if (
  140. typeof searchInput.create_time == "undefined" ||
  141. searchInput.create_time == null
  142. ) {
  143. data.set("create_time", "");
  144. } else {
  145. data.set("create_time", searchInput.create_time);
  146. }
  147. data.set("page", currentPage.value);
  148. data.set("rows", pageSize.value);
  149. let res = await axios({
  150. method: "post",
  151. url: api.value + "/carBook/logslist.action",
  152. headers: {
  153. token: sessionStorage.getItem("token"),
  154. },
  155. data: data,
  156. });
  157. console.log(res, "操作日志");
  158. if (res.status == 200) {
  159. tableData.list = res.data.rows;
  160. // currentPage.value = res.data.currentPage;
  161. total.value = res.data.total;
  162. } else {
  163. tableData.list = res.data.rows;
  164. currentPage.value = 1;
  165. total.value = res.data.total;
  166. ElMessage({
  167. type: "error",
  168. showClose: true,
  169. message: res.data.message,
  170. center: true,
  171. });
  172. if (res.data.message == "token错误") {
  173. router.push({
  174. path: `/login`,
  175. });
  176. }
  177. }
  178. }
  179. };
  180. // 搜索按钮
  181. const search = lodash.debounce(() => {
  182. getList();
  183. }, 300);
  184. // 重置搜索框
  185. const resetSearch = lodash.debounce(() => {
  186. searchInput.create_time = "";
  187. searchInput.car_number = "";
  188. getList();
  189. }, 300);
  190. // 表格斑马纹颜色修改
  191. const tableRowClassName = ({ row, rowIndex }) => {
  192. if (rowIndex % 2 === 0) {
  193. return "even";
  194. } else if (rowIndex % 2 !== 0) {
  195. return "odd";
  196. }
  197. return "";
  198. };
  199. // 分页
  200. const handleCurrentChange = (value) => {
  201. currentPage.value = value;
  202. getList();
  203. };
  204. onMounted(() => {
  205. api.value = store.state.user.api;
  206. busNum.list = JSON.parse(sessionStorage.getItem("busSelect"));
  207. getList();
  208. });
  209. </script>
  210. <style scoped lang="scss">
  211. .content-box {
  212. width: calc(100% - 40px);
  213. height: calc(100% - 105px);
  214. margin: 20px auto;
  215. background-color: #fff;
  216. color: #fff;
  217. display: flex;
  218. flex-direction: column;
  219. .left {
  220. width: calc(100% - 60px);
  221. display: flex;
  222. align-items: center;
  223. justify-content: space-between;
  224. height: 60px;
  225. margin: 0 30px;
  226. // padding: 10px 0;
  227. border-bottom: 1px solid #ccc;
  228. color: #000;
  229. font-size: 18px;
  230. font-weight: 600;
  231. }
  232. .filter {
  233. display: flex;
  234. flex-wrap: wrap;
  235. align-items: center;
  236. // width: 100%;
  237. .condition {
  238. display: flex;
  239. align-items: center;
  240. margin: 15px 30px 15px 30px;
  241. color: #000;
  242. :deep(.el-input .el-input__inner) {
  243. font-size: 16px;
  244. }
  245. span {
  246. margin: 0 10px 0 0;
  247. }
  248. }
  249. }
  250. :deep(.sendBus) {
  251. // height: 420px;
  252. border-radius: 11px;
  253. .el-dialog__header {
  254. border-radius: 11px 11px 0 0;
  255. background: rgba(237, 241, 245, 1);
  256. font-weight: 600;
  257. margin: 0;
  258. .el-dialog__headerbtn {
  259. outline: none;
  260. }
  261. }
  262. .el-dialog__body {
  263. padding: 30px 20px 10px 20px;
  264. .el-form-item--feedback {
  265. .el-input__validateIcon {
  266. color: rgba(61, 81, 232, 1);
  267. }
  268. }
  269. .el-form-item.is-error .el-input__validateIcon {
  270. color: red;
  271. }
  272. .el-input {
  273. width: 200px;
  274. }
  275. .options {
  276. margin-left: 200px;
  277. }
  278. }
  279. }
  280. :deep(.mergeBus) {
  281. // height: 420px;
  282. border-radius: 11px;
  283. /* 去掉全选按钮 */
  284. .el-dialog__header {
  285. border-radius: 11px 11px 0 0;
  286. background: rgba(237, 241, 245, 1);
  287. font-weight: 600;
  288. margin: 0;
  289. .el-dialog__headerbtn {
  290. outline: none;
  291. }
  292. }
  293. .el-dialog__body {
  294. padding: 30px 20px 10px 20px;
  295. .el-table__header {
  296. font-size: 17px;
  297. }
  298. .el-table__body-wrapper {
  299. .el-table__row {
  300. height: 48px;
  301. font-size: 17px;
  302. color: #000;
  303. td {
  304. padding: 0;
  305. }
  306. }
  307. }
  308. .el-table__inner-wrapper::before {
  309. height: 0;
  310. }
  311. .el-table__inner-wrapper {
  312. .el-table__header-wrapper {
  313. .el-table__header {
  314. .disabledsele .cell .el-checkbox__inner {
  315. display: none !important;
  316. }
  317. .disabledsele .cell::before {
  318. content: "操作";
  319. text-align: center;
  320. line-height: 37px;
  321. }
  322. }
  323. }
  324. }
  325. .el-form-item--feedback {
  326. .el-input__validateIcon {
  327. color: rgba(61, 81, 232, 1);
  328. }
  329. }
  330. .el-form-item.is-error .el-input__validateIcon {
  331. color: red;
  332. }
  333. .el-input {
  334. width: 200px;
  335. }
  336. .options {
  337. margin-left: 200px;
  338. }
  339. }
  340. .btn {
  341. width: 100%;
  342. height: 40px;
  343. margin-bottom: 20px;
  344. display: flex;
  345. flex-direction: row-reverse;
  346. align-items: center;
  347. justify-content: space-between;
  348. .txt {
  349. font-size: 18px;
  350. color: #000;
  351. }
  352. }
  353. }
  354. .footer {
  355. width: calc(100% - 60px);
  356. flex:1;
  357. margin: 10px auto 10px;
  358. overflow: auto;
  359. :deep(.el-table__header-wrapper) {
  360. height: 48px;
  361. .el-table__header {
  362. height: 48px;
  363. font-size: 16px;
  364. }
  365. }
  366. .el-table--fit {
  367. height: 100%;
  368. :deep(.el-table__row) {
  369. height: 48px;
  370. font-size: 16px;
  371. color: #000;
  372. }
  373. :deep(.el-table__row td) {
  374. padding: 0;
  375. border: 0;
  376. }
  377. :deep(.el-button) {
  378. width: 50px;
  379. height: 26px;
  380. border-radius: 40px;
  381. font-size: 15px;
  382. }
  383. :deep(.look) {
  384. padding: 3px 10px;
  385. border-radius: 40px;
  386. // border: 0.74px solid rgba(30, 125, 251, 1);
  387. }
  388. :deep(.lookcar) {
  389. padding: 3px 10px;
  390. border-radius: 40px;
  391. // border: 0.74px solid #e6a23c;
  392. }
  393. :deep(.lookdel) {
  394. padding: 3px 5px;
  395. border-radius: 40px;
  396. // border: 0.74px solid #fa7070;
  397. }
  398. // 输出链接弹窗样式
  399. :deep(.link .el-dialog__header) {
  400. text-align: left;
  401. font-size: 20px;
  402. font-weight: 600;
  403. }
  404. :deep(.link .el-dialog__body) {
  405. padding: 10px 20px;
  406. height: 100px;
  407. margin-bottom: 10px;
  408. }
  409. .link {
  410. .linkcontent {
  411. text-align: left;
  412. height: 100px;
  413. border: 1px solid #ccc;
  414. p {
  415. margin: 5px 10px;
  416. }
  417. }
  418. }
  419. :deep(.playVideo .el-dialog__header) {
  420. text-align: left;
  421. font-size: 20px;
  422. font-weight: 600;
  423. background-color: #ccc;
  424. margin-right: 0;
  425. }
  426. :deep(.playVideo .el-dialog__body) {
  427. height: 600px;
  428. }
  429. .el-button--primary {
  430. margin-left: 5px;
  431. }
  432. :deep(.el-table__body .even) {
  433. background-color: #fff;
  434. }
  435. :deep(.el-table__body .odd) {
  436. background-color: rgba(240, 243, 247, 1);
  437. }
  438. }
  439. }
  440. .el-pagination {
  441. // width: 1600px;
  442. width: calc(100% - 60px);
  443. height: 60px;
  444. margin: 0 30px;
  445. justify-content: flex-end;
  446. :deep(.el-pagination__total) {
  447. color: #000;
  448. }
  449. :deep(.el-pagination__goto) {
  450. color: #000;
  451. }
  452. :deep(.el-pagination__classifier) {
  453. color: #000;
  454. }
  455. :deep(.el-input__wrapper) {
  456. border: 1px solid rgba(0, 0, 0, 1);
  457. border-radius: 5px;
  458. box-shadow: none;
  459. }
  460. :deep(.el-pager li) {
  461. margin: 0 5px;
  462. border: 1px solid rgba(0, 0, 0, 1);
  463. border-radius: 5px;
  464. background-color: transparent;
  465. }
  466. :deep(.el-pager li.is-active) {
  467. background-color: rgba(30, 125, 251, 1);
  468. }
  469. :deep(.btn-prev) {
  470. margin-right: 5px;
  471. border: 1px solid rgba(0, 0, 0, 1);
  472. border-radius: 5px;
  473. background-color: transparent;
  474. }
  475. :deep(.btn-next) {
  476. margin-left: 5px;
  477. border: 1px solid rgba(0, 0, 0, 1);
  478. border-radius: 5px;
  479. background-color: transparent;
  480. }
  481. }
  482. }
  483. .el-input {
  484. width: 192px;
  485. }
  486. </style>