| | |
| | | 机场 |
| | | </a-menu-item> |
| | | </a-menu> |
| | | |
| | | <div class="device-table-wrap table flex-display flex-column"> |
| | | <a-table :columns="columns" :data-source="data.device" :pagination="paginationProp" @change="refreshData" row-key="device_sn" :expandedRowKeys="expandRows" |
| | | :row-selection="rowSelection" :rowClassName="rowClassName" :scroll="{ x: '100%', y: 600 }" |
| | |
| | | </template> |
| | | </div> |
| | | </template> |
| | | |
| | | <template v-for="col in ['sn', 'workspace']" #[col]="{ text }" :key="col"> |
| | | <a-tooltip :title="text"> |
| | | <span>{{ text }}</span> |
| | |
| | | :device="currentDevice"> |
| | | </DeviceHmsDrawer> |
| | | </div> |
| | | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { ColumnProps, TableState } from 'ant-design-vue/lib/table/interface' |
| | | import { h, onMounted, reactive, ref, UnwrapRef } from 'vue' |
| | | import { IPage } from '/@/api/http/type' |
| | | import { BindBody, bindDevice, getBindingDevices, unbindDevice, updateDevice } from '/@/api/manage' |
| | | import { BindBody, bindDevice, getBindingDevices, getDeviceList, unbindDevice, updateDevice } from '/@/api/manage' |
| | | import { EDeviceTypeName, ELocalStorageKey } from '/@/types' |
| | | import { EditOutlined, CheckOutlined, CloseOutlined, DeleteOutlined, FileSearchOutlined, CloudServerOutlined } from '@ant-design/icons-vue' |
| | | import { Device, DeviceFirmwareStatusEnum } from '/@/types/device' |
| | |
| | | const deleteTip = ref<boolean>(false) |
| | | const deleteSn = ref<string>() |
| | | const columns: ColumnProps[] = [ |
| | | { title: '设备型号', dataIndex: 'device_name', width: 100, className: 'titleStyle' }, |
| | | { title: '设备SN', dataIndex: 'device_sn', width: 100, className: 'titleStyle', ellipsis: true, slots: { customRender: 'sn' } }, |
| | | { title: '设备型号', dataIndex: 'deviceName', width: 100, className: 'titleStyle' }, |
| | | { title: '设备SN', dataIndex: 'deviceSn', width: 100, className: 'titleStyle', ellipsis: true, slots: { customRender: 'sn' } }, |
| | | { |
| | | title: '设备组织名称', |
| | | dataIndex: 'nickname', |
| | |
| | | ellipsis: true, |
| | | slots: { customRender: 'nickname' } |
| | | }, |
| | | { title: '固件版本', dataIndex: 'firmware_version', width: 150, className: 'titleStyle', slots: { customRender: 'firmware_version' } }, |
| | | { title: '固件版本', dataIndex: 'firmwareVersion', width: 150, className: 'titleStyle', slots: { customRender: 'firmware_version' } }, |
| | | { title: '在线状态', dataIndex: 'status', width: 100, className: 'titleStyle', slots: { customRender: 'status' } }, |
| | | { |
| | | title: '所属项目', |
| | | dataIndex: 'workspace_name', |
| | | dataIndex: 'workspaceName', |
| | | width: 100, |
| | | className: 'titleStyle', |
| | | ellipsis: true, |
| | |
| | | return obj |
| | | } |
| | | }, |
| | | { title: '加入组织时间', dataIndex: 'bound_time', width: 150, sorter: (a: Device, b: Device) => a.bound_time.localeCompare(b.bound_time), className: 'titleStyle' }, |
| | | { title: '在线时间', dataIndex: 'login_time', width: 150, sorter: (a: Device, b: Device) => a.login_time.localeCompare(b.login_time), className: 'titleStyle' }, |
| | | { title: '加入组织时间', dataIndex: 'boundTime', width: 150, sorter: (a: Device, b: Device) => a.bound_time.localeCompare(b.bound_time), className: 'titleStyle' }, |
| | | { title: '在线时间', dataIndex: 'loginTime', width: 150, sorter: (a: Device, b: Device) => a.login_time.localeCompare(b.login_time), className: 'titleStyle' }, |
| | | { |
| | | title: '操作', |
| | | dataIndex: 'actions', |
| | |
| | | // 获取分页信息 |
| | | function getPaginationBody () { |
| | | return { |
| | | page: paginationProp.current, |
| | | page_size: paginationProp.pageSize |
| | | current: paginationProp.current, |
| | | size: paginationProp.pageSize |
| | | } as IPage |
| | | } |
| | | |
| | |
| | | useDeviceUpgradeEvent(onDeviceUpgradeWs) |
| | | |
| | | // 获取设备列表信息 |
| | | function getDevices (domain: number, closeLoading?: boolean) { |
| | | if (!closeLoading) { |
| | | loading.value = true |
| | | } |
| | | getBindingDevices(workspaceId, getPaginationBody(), domain).then(res => { |
| | | if (res.code !== 0) { |
| | | function getDevices (params:any) { |
| | | loading.value = true |
| | | const paginationBody = getPaginationBody() |
| | | |
| | | getDeviceList(Object.assign(params, paginationBody)).then(res => { |
| | | if (res.code !== 5000) { |
| | | return |
| | | } |
| | | const resData: Device[] = res.data.list |
| | | expandRows.value = [] |
| | | resData.forEach((val: any) => { |
| | | if (val.children) { |
| | | val.children = [val.children] |
| | | } |
| | | if (judgeCurrentType(EDeviceTypeName.Dock)) { |
| | | expandRows.value.push(val.device_sn) |
| | | } |
| | | }) |
| | | data.device = resData |
| | | paginationProp.total = res.data.pagination.total |
| | | paginationProp.current = res.data.pagination.page |
| | | paginationProp.pageSize = res.data.pagination.page_size |
| | | |
| | | console.log(res, '++++++++++') |
| | | const list = res.data.records |
| | | data.device = list |
| | | |
| | | loading.value = false |
| | | }).catch(err => { |
| | | console.log('错误:', err) |
| | | loading.value = false |
| | | }) |
| | | } |