Explorar el Código

feat: 设备下的ota

lvkun hace 2 años
padre
commit
5a6f962d7a
Se han modificado 1 ficheros con 48 adiciones y 1 borrados
  1. 48 1
      src/pages/Iot/device/components/ota.vue

+ 48 - 1
src/pages/Iot/device/components/ota.vue

@@ -1,8 +1,55 @@
 <template>
-  <a-card>ota</a-card>
+  <a-card>
+
+  </a-card>
 </template>
 
 <script setup lang="ts" >
+import { DeviceContriller } from '@/controller'
+import { onMounted, reactive } from 'vue'
+import { useRoute } from 'vue-router'
+
+const route = useRoute()
+
+const deviceId = route.query.id as string
+
+const queryState = reactive<IOT.API.DEVICE.OtaQueryParams & {total: number}>({
+  page: 1,
+  pageSize: 10,
+  deviceId: deviceId,
+  otaLabel: '',
+  otaStatus: 'DELIVERED',
+  otaVersion: '',
+  total: 0
+})
+
+const state = reactive<{
+  loading: boolean,
+  dataSource: IOT.API.DEVICE.Ota[]
+  otaDetail: Partial<IOT.API.DEVICE.Ota>
+}>({
+  loading: false,
+  dataSource: [],
+  otaDetail: {}
+})
+
+const getOtaPkgPageByDeviceId = async () => {
+  state.loading = true
+  const { data, sum } = await DeviceContriller.OtaPageByDeviceId(queryState)
+  state.loading = false
+  state.dataSource = data
+  queryState.total = sum
+}
+
+const getOtaPkgByDeviceId = async () => {
+  const { data } = await DeviceContriller.OtaByDeviceId(queryState.deviceId)
+  state.otaDetail = data
+}
+
+onMounted(() => {
+  getOtaPkgByDeviceId()
+  getOtaPkgPageByDeviceId()
+})
 </script>
 
 <style lang="less" >