index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="layout-pd">
  3. <el-row>
  4. <!--操作-->
  5. <el-col :xs="24">
  6. <el-card class="mt8" shadow="hover">
  7. <el-form :model="Data.Filter" @submit.stop.prevent>
  8. <el-form-item prop="name" style="width: 100%">
  9. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
  10. <el-form-item label="石油公司">
  11. <el-input v-model="Data.Filter.CompanyName" placeholder="请输入石油公司" clearable></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
  15. <el-form-item label="油枪号">
  16. <el-input v-model="Data.Filter.name" placeholder="请输入油枪号" clearable></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
  20. <el-form-item label="加油站">
  21. <el-input v-model="Data.Filter.StationName" placeholder="请输入加油站名称" clearable></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
  25. <el-form-item label="在线状态">
  26. <el-select v-model="Data.Filter.onlineStatus" placeholder="请选择在线状态">
  27. <el-option v-for="(value, key) in selectList.Online" :key="key" :label="value" :value="value" />
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
  32. <el-form-item label="出厂时间">
  33. <el-date-picker v-model="Data.time1" type="datetimerange" value-format="YYYY-MM-DD HH:mm:ss"
  34. range-separator="To" start-placeholder="开始日期" end-placeholder="结束日期" />
  35. </el-form-item>
  36. </el-col>
  37. </el-form-item>
  38. </el-form>
  39. <hr>
  40. <!-- 按钮 -->
  41. <el-row justify="space-between" class="submit-button" style="margin-bottom:-6px">
  42. <el-row>
  43. <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
  44. <el-button type="primary" icon="ele-RefreshRight" @click="onReset"> 重置 </el-button>
  45. </el-row>
  46. </el-row>
  47. </el-card>
  48. </el-col>
  49. <!--表格-->
  50. <el-col :xs="24">
  51. <el-card style="height: 47vh" class="my-fill mt8" shadow="hover">
  52. <el-table ref="multipleTableRef" v-loading="Data.loading" stripe :data="Data.tableModel" row-key="id"
  53. style="width: 100%">
  54. <el-table-column v-for="column in Data.dynamicColumns" :key="column.prop" :prop="column.prop"
  55. :label="column.label" />
  56. </el-table>
  57. <div class="my-flex my-flex-end" style="margin-top: 20px">
  58. <el-pagination v-model:currentPage="Data.pageInput.currentPage" v-model:page-size="Data.pageInput.pageSize"
  59. :total="Data.total" :page-sizes="[5, 10, 20, 50, 100]" small background @size-change="onSizeChange"
  60. @current-change="onCurrentChange" layout="total, sizes, prev, pager, next, jumper" />
  61. </div>
  62. </el-card>
  63. </el-col>
  64. </el-row>
  65. </div>
  66. </template>
  67. <script setup lang="ts" name="partsManagement/oilGun">
  68. import { onMounted, reactive, watch } from "vue";
  69. import { oilGunFilterModel_SearchFilter, oilGunFilterModel, PageInputoilGunFilterModel } from "/@/api/admin/reportManagement/oilGun/oilGunDto";
  70. import { OilGunApi } from "/@/api/admin/reportManagement/oilGun/oilGunApi";
  71. /**页面对象 */
  72. const Data = reactive({
  73. time1: '',
  74. /** 选择框列表 */
  75. statusList: [] as any,
  76. supplierList: [] as any,
  77. /**加载显示 */
  78. loading: false,
  79. /**条件查询模块 */
  80. Filter: {
  81. /**油枪号 */
  82. name: "",
  83. /**加油站名称 */
  84. StationName: "",
  85. /**石油公司 */
  86. CompanyName: "",
  87. /**在线状态 */
  88. onlineStatus: "",
  89. /**出厂开始的时间 */
  90. OutBeginTime: "",
  91. /**出厂结束的时间 */
  92. OutEndTime: "",
  93. } as oilGunFilterModel_SearchFilter,
  94. /**表格信息 */
  95. tableModel: [] as Array<oilGunFilterModel>,
  96. /**动态表头 */
  97. dynamicColumns: [
  98. { prop: 'name', label: '油枪号' },
  99. { prop: 'companyName', label: '石油公司' },
  100. { prop: 'stationName', label: '加油站名称' },
  101. { prop: 'fuelName', label: '油品' },
  102. { prop: 'code', label: '编码' },
  103. { prop: 'alarming', label: '自锁' },
  104. { prop: 'fuelId', label: '油机号' },
  105. { prop: 'supplierName', label: '加油机厂商' },
  106. { prop: 'onlineStatus', label: '在线状态' },
  107. { prop: 'cheatStatus', label: '作弊状态' },
  108. { prop: 'monitoringUUID', label: '监控微处理器编号' },
  109. { prop: 'displayControlsUUID', label: '加密显示屏编号' },
  110. { prop: 'encoderControlsUUID', label: '编码器编号' },
  111. { prop: 'productTime', label: '出厂时间' },
  112. { prop: 'soldTime', label: '安装时间' },
  113. ],
  114. /**分页总数 */
  115. total: 0,
  116. /**分页标识 */
  117. pageInput: {
  118. currentPage: 1,
  119. pageSize: 10,
  120. } as PageInputoilGunFilterModel,
  121. })
  122. /** 选择框列表 */
  123. const selectList = reactive({
  124. Online: ["在线", "离线"],
  125. Device: [
  126. "启用",
  127. "备案",
  128. "维修",
  129. "出厂注册"],
  130. Level: [1, 2, 3, 4, 5]
  131. })
  132. onMounted(() => {
  133. init()
  134. })
  135. // 条件查询
  136. const init = async () => {
  137. Data.loading = true
  138. const res: any = await new OilGunApi().getPage({ ...Data.pageInput, filter: Data.Filter })
  139. console.log(res)
  140. Data.tableModel = res?.data.list ?? []
  141. Data.total = res?.data?.total ?? 0
  142. Data.loading = false
  143. }
  144. const onQuery = () => {
  145. init()
  146. }
  147. /**重置查询条件 */
  148. const resetQuery = () => {
  149. Data.Filter.StationName = ''
  150. Data.Filter.CompanyName = ''
  151. Data.Filter.onlineStatus = ''
  152. Data.Filter.OutBeginTime = ''
  153. Data.Filter.OutEndTime = ''
  154. Data.Filter.name = ''
  155. Data.time1 = ''
  156. Data.pageInput.currentPage = 1
  157. Data.pageInput.pageSize = 10
  158. }
  159. /**重置 */
  160. const onReset = () => {
  161. resetQuery()
  162. init()
  163. }
  164. /**
  165. * 页条变化
  166. * @param val
  167. */
  168. const onSizeChange = (val: number) => {
  169. Data.pageInput.pageSize = val
  170. init()
  171. }
  172. /**
  173. * 页数 变化
  174. * @param val
  175. */
  176. const onCurrentChange = (val: number) => {
  177. Data.pageInput.currentPage = val
  178. init()
  179. }
  180. /**
  181. * 监听时间变换
  182. */
  183. watch(() => Data.time1, (newVal) => {
  184. if (newVal.length === 0) {
  185. return
  186. }
  187. Data.Filter.OutBeginTime = newVal[0]?.[0] ?? ''
  188. Data.Filter.OutEndTime = newVal[0]?.[1] ?? ''
  189. })
  190. </script>
  191. <style scoped lang="scss">
  192. .el-input,
  193. .el-select {
  194. width: 240px;
  195. }
  196. /* 输入框标签固定四个字符宽度 */
  197. ::v-deep .el-form-item__label {
  198. // 字体大小14,4个字符,12px右间距
  199. width: 14*4px+12px;
  200. justify-content: start;
  201. }
  202. /* 数据表头 设置灰色样式 */
  203. ::v-deep .el-table th.el-table__cell {
  204. background-color: #F6F6F6;
  205. }
  206. </style>