AssetRfidRecord.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <Navbar title="资产异常出入记录" :is-go-back="false" />
  3. <div class="globalMain">
  4. <ul class="siteList">
  5. <li class="site">
  6. <span class="labels">
  7. <span class="noRequired"> * </span>
  8. <label>资产名称</label>
  9. </span>
  10. <a-input
  11. v-model:value="searchParams.assetInstanceName"
  12. placeholder="请输入资产名称"
  13. style="width: 70%"
  14. @change="searchRecord"
  15. />
  16. </li>
  17. <li class="site">
  18. <span class="labels">
  19. <span class="noRequired"> * </span>
  20. <label>资产编号</label>
  21. </span>
  22. <a-input
  23. v-model:value="searchParams.assetInstanceNo"
  24. placeholder="请输入资产编号"
  25. style="width: 70%"
  26. @change="searchRecord"
  27. />
  28. </li>
  29. <li class="site">
  30. <span class="labels">
  31. <span class="noRequired"> * </span>
  32. <label>资产EPC</label>
  33. </span>
  34. <a-input
  35. v-model:value="searchParams.epc"
  36. placeholder="请输入资产EPC"
  37. style="width: 70%"
  38. @change="searchRecord"
  39. />
  40. </li>
  41. <li class="site">
  42. <span class="labels">
  43. <span class="noRequired"> * </span>
  44. <label>资产位置</label>
  45. </span>
  46. <a-input
  47. v-model:value="searchParams.position"
  48. placeholder="请输入资产位置"
  49. style="width: 70%"
  50. @change="searchRecord"
  51. />
  52. </li>
  53. <li class="site">
  54. <span class="labels">
  55. <span class="noRequired"> * </span>
  56. <label>异常类型</label>
  57. </span>
  58. <a-input
  59. v-model:value="searchParams.assetInstanceRecordType"
  60. placeholder="请输入异常类型"
  61. style="width: 70%"
  62. @change="searchRecord"
  63. />
  64. </li>
  65. <li class="site">
  66. <span class="labels">
  67. <span class="noRequired"> * </span>
  68. <label>开始日期</label>
  69. </span>
  70. <a-config-provider :locale="zhCN">
  71. <a-date-picker
  72. v-model:value="startValue"
  73. format="YYYY-MM-DD HH:mm:ss"
  74. :show-time="{
  75. format: 'HH:mm:ss',
  76. defaultValue: dayjs('00:00:00', 'HH:mm:ss'),
  77. }"
  78. style="width: 70%"
  79. placeholder="请选择开始时间"
  80. @change="startTimeChange"
  81. />
  82. </a-config-provider>
  83. </li>
  84. <li class="site">
  85. <span class="labels">
  86. <span class="noRequired"> * </span>
  87. <label>结束日期</label>
  88. </span>
  89. <a-config-provider :locale="zhCN">
  90. <a-date-picker
  91. v-model:value="endValue"
  92. format="YYYY-MM-DD HH:mm:ss"
  93. :show-time="{
  94. format: 'HH:mm:ss',
  95. defaultValue: dayjs('00:00:00', 'HH:mm:ss'),
  96. }"
  97. style="width: 70%"
  98. placeholder="请选择结束时间"
  99. @change="endTimeChange"
  100. />
  101. </a-config-provider>
  102. </li>
  103. <li class="site" style="display: flex">
  104. <div style="width: 300px">
  105. <a-button
  106. type="primary"
  107. style="margin-left: 20px"
  108. @click="searchRecord"
  109. >
  110. 查询
  111. </a-button>
  112. <a-button type="dashed" style="margin-left: 8px" @click="clearParams">
  113. 清空
  114. </a-button>
  115. </div>
  116. </li>
  117. </ul>
  118. </div>
  119. <CommonTable
  120. ref="table"
  121. :total="total"
  122. :columns="columns"
  123. :is-loading="isLoading"
  124. :data-source="dataSource"
  125. @get-pager="getPageParams"
  126. />
  127. </template>
  128. <script setup>
  129. import dayjs from 'dayjs';
  130. import 'dayjs/locale/zh-cn';
  131. import CommonTable from '../../common/CommonTable.vue';
  132. import Common from '../../common/Common.js';
  133. import { ref, reactive, onMounted } from 'vue';
  134. import zhCN from 'ant-design-vue/es/locale/zh_CN';
  135. import { recordColumns, rfidQuery, debounce } from './configDatas.js';
  136. dayjs.locale('zh-cn');
  137. const total = ref(0);
  138. const table = ref(null);
  139. const endValue = ref(); // 日期
  140. const startValue = ref(); // 日期
  141. const dataSource = ref([]); //表格数据
  142. const isLoading = ref(false); //表格loading
  143. const columns = ref(recordColumns); //表格列
  144. const searchParams = reactive({
  145. start: 1,
  146. epc: null,
  147. length: 20,
  148. endDate: null,
  149. position: null,
  150. startDate: null,
  151. assetInstanceNo: null,
  152. assetInstanceName: null,
  153. assetInstanceRecordType: null,
  154. });
  155. // 从子组件获取的分页参数
  156. const getPageParams = (start, length) => {
  157. searchParams.start = start;
  158. searchParams.length = length;
  159. queryInfo();
  160. };
  161. // 查询回到第一页(防抖)
  162. const searchRecord = debounce(() => {
  163. table.value.backFirstPage();
  164. }, 500);
  165. // 查询日期
  166. const startTimeChange = (_, dateString) => {
  167. searchParams.startDate = dateString;
  168. searchRecord();
  169. console.log(dateString);
  170. };
  171. const endTimeChange = (_, dateString) => {
  172. searchParams.endDate = dateString;
  173. searchRecord();
  174. };
  175. // 查询表格数据
  176. const queryInfo = () => {
  177. isLoading.value = true;
  178. const params = { ...searchParams };
  179. rfidQuery(params).then(
  180. success => {
  181. total.value = success.totalSize;
  182. dataSource.value = success.dataList;
  183. isLoading.value = false;
  184. },
  185. error => {
  186. Common.processException(error);
  187. isLoading.value = false;
  188. },
  189. );
  190. };
  191. onMounted(() => {
  192. searchRecord();
  193. });
  194. // 清空查询条件
  195. const clearParams = () => {
  196. endValue.value = null;
  197. startValue.value = null;
  198. searchParams.epc = null;
  199. searchParams.endDate = null;
  200. searchParams.position = null;
  201. searchParams.startDate = null;
  202. searchParams.assetInstanceNo = null;
  203. searchParams.assetInstanceName = null;
  204. searchParams.assetInstanceRecordType = null;
  205. searchRecord();
  206. };
  207. </script>
  208. <style scoped>
  209. .globalMain {
  210. max-width: 99%;
  211. margin-left: auto;
  212. margin-right: auto;
  213. list-style: none;
  214. box-sizing: border-box;
  215. margin-top: 20px;
  216. }
  217. .labels {
  218. display: inline-block;
  219. width: 70px;
  220. }
  221. .required {
  222. width: 10px;
  223. color: red;
  224. }
  225. .noRequired {
  226. width: 10px;
  227. color: #f7f7f7;
  228. }
  229. .siteList {
  230. margin: -10px 0 -8px -24px !important;
  231. display: flex;
  232. flex-wrap: wrap;
  233. justify-content: space-between;
  234. }
  235. .siteList .site {
  236. width: 300px;
  237. display: flex;
  238. justify-content: center;
  239. align-items: center;
  240. position: relative;
  241. }
  242. .siteList > li {
  243. margin-bottom: 8px;
  244. margin-left: 0px;
  245. }
  246. @media (min-width: 500px) {
  247. .siteList {
  248. margin-left: 0;
  249. margin-right: -25px;
  250. justify-content: flex-start;
  251. }
  252. .siteList > li {
  253. margin-right: 8px;
  254. }
  255. }
  256. </style>