index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <normalTable
  3. :isSelect="false"
  4. v-if="refresh"
  5. rowKey="w_deviceid"
  6. ref="list"
  7. size="small"
  8. :param="tablename == 'loginHistory' ? param2 : param"
  9. :columns="utils.TBLayout(tablename)"
  10. >
  11. <template #tb_cell="{ data }">
  12. <div v-if="data.column.dataIndex == 'issend'">
  13. {{ data.record.issend == 0 ? "未发送" : "已发送" }}
  14. </div>
  15. <div v-else-if="data.column.dataIndex == 'content'">
  16. <div
  17. v-if="param.content.type == '1'"
  18. style="white-space: normal; width: 800px"
  19. >
  20. {{ data.record.content }}
  21. </div>
  22. <div style="width: 200px; display: flex; flex-wrap: wrap" v-else>
  23. <a-tag v-for="item in data.record.content"
  24. >{{ item.title }} : {{ item.value }}</a-tag
  25. >
  26. </div>
  27. </div>
  28. <div v-else-if="data.column.dataIndex == 'isreceive'">
  29. {{ data.record.isreceive ? "已接收" : "未接收" }}
  30. </div>
  31. <div v-else-if="data.column.dataIndex == 'action'">
  32. {{ data.record.action == "off" ? "离线" : "在线" }}
  33. </div>
  34. <div v-else-if="data.column.dataIndex == 'invalid'">
  35. {{ data.record.isreceive ? "已失效" : "未失效" }}
  36. </div>
  37. </template>
  38. <template #operation>
  39. <div style="display: flex; margin-bottom: 16px">
  40. <div style="margin-right: 16px" v-if="tablename != 'loginHistory'">
  41. <span>时间:</span>
  42. <a-range-picker
  43. style="width: 400px"
  44. v-model:value="timer"
  45. value-format="YYYY-MM-DD"
  46. @change="dateRangeChange"
  47. allowClear
  48. />
  49. </div>
  50. <div style="margin-right: 16px">
  51. <span>类型:</span>
  52. <a-select
  53. ref="select"
  54. v-model:value="param.content.type"
  55. style="width: 120px"
  56. @change="change"
  57. >
  58. <a-select-option value="2" v-if="detailData.isfeedback"
  59. >操作队列</a-select-option
  60. >
  61. <a-select-option value="0">操作记录</a-select-option>
  62. <a-select-option value="1">上传记录</a-select-option>
  63. <a-select-option value="3">上线记录</a-select-option>
  64. </a-select>
  65. </div>
  66. </div>
  67. </template>
  68. </normalTable>
  69. </template>
  70. <script setup>
  71. import customBtn from "@/components/customHandleBtn/index.vue";
  72. import normalTable from "@/template/normalTable/index.vue";
  73. import { useBaseStore } from "@/stores/modules/base";
  74. import {
  75. ref,
  76. defineProps,
  77. defineEmits,
  78. onMounted,
  79. provide,
  80. computed,
  81. inject,
  82. } from "vue";
  83. import { useRouter } from "vue-router";
  84. import Api from "@/api/api";
  85. import utils from "@/utils/utils";
  86. let base = useBaseStore();
  87. let router = useRouter();
  88. let emit = defineEmits([]);
  89. let props = defineProps(["data"]);
  90. let detailData = inject("detailData");
  91. let param = ref({
  92. id: 20230701132202,
  93. content: {
  94. w_deviceid: router.currentRoute.value.query.id,
  95. type: detailData.isfeedback ? "2" : "0",
  96. pageNumber: 1,
  97. pageSize: 10,
  98. where: {
  99. enddate: "",
  100. begindate: "",
  101. },
  102. },
  103. });
  104. let param2 = ref({
  105. id: 20231123163602,
  106. content: {
  107. w_deviceid: router.currentRoute.value.query.id,
  108. pageNumber: 1,
  109. pageSize: 10,
  110. },
  111. });
  112. let timer = ref([]);
  113. let list = ref();
  114. let tablename = ref("detailHistoryTable");
  115. let refresh = ref(true);
  116. let dateRangeChange = (time) => {
  117. console.log(timer.value);
  118. if (timer.value) {
  119. param.value.content.where.enddate = timer.value[1];
  120. param.value.content.where.begindate = timer.value[0];
  121. } else {
  122. param.value.content.where.enddate = "";
  123. param.value.content.where.begindate = "";
  124. }
  125. list.value.listData();
  126. };
  127. let change = () => {
  128. if (param.value.content.type == "2") {
  129. tablename.value = "handleQueue";
  130. } else if (param.value.content.type == "0") {
  131. tablename.value = "detailHistoryTable";
  132. } else if (param.value.content.type == "1") {
  133. tablename.value = "uploadHistory";
  134. } else if (param.value.content.type == "3") {
  135. tablename.value = "loginHistory";
  136. }
  137. refresh.value = false;
  138. setTimeout(() => {
  139. refresh.value = true;
  140. });
  141. };
  142. </script>
  143. <style scoped>
  144. </style>