| | |
| | | <template #firmware_status="{ row }"> |
| | | <div v-if="row.firmware_status == 1" class="onlineStatus1"> |
| | | <el-tag type="info">无需升级</el-tag> |
| | | <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)">版本管理</el-tag> |
| | | <!-- <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)">版本管理</el-tag>--> |
| | | <!-- <div style="background-color: #f1f1f1; border-radius: 4px">无需升级</div> --> |
| | | </div> |
| | | <div v-if="row.firmware_status == 2" class="onlineStatus1"> |
| | | <!-- <el-tag type="success" effect="dark" class="active-element" @click="updateFirmware(row)" |
| | | >升级固件</el-tag |
| | | > --> |
| | | <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)">版本管理</el-tag> |
| | | <!-- <el-tag type="primary" effect="dark" class="active-element" @click="rollFirmware(row)">版本管理</el-tag>--> |
| | | <!-- <div @click="updateFirmware(row)" class="firmware_status">升级固件</div> --> |
| | | </div> |
| | | <div v-if="row.firmware_status == 3" class="onlineStatus"> |
| | | <el-tag type="success" effect="dark" class="active-element" @click="updateFirmware(row)">一致性升级</el-tag> |
| | | <!-- <el-tag type="success" effect="dark" class="active-element" @click="updateFirmware(row)">一致性升级</el-tag>--> |
| | | <!-- <div @click="updateFirmware(row)" class="firmware_status">一致性升级</div> --> |
| | | </div> |
| | | <div v-if="row.firmware_status == 4" class="onlineStatus"> |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | { |
| | | label: '4G增强', |
| | | prop: 'link_workmode', |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | { |
| | | label: '固件升级', |
| | | prop: 'firmware_status', |
| | | labelWidth: 145, |
| | | width: 100, |
| | | // hide: true, |
| | | viewDisabled: true, |
| | | addDisabled: true, |
| | | editDisplay: false, //编辑显示 |
| | | addDisplay: false, |
| | | viewDisplay: false, |
| | | }, |
| | | { |
| | | label: '设备SN', |
| | | prop: 'device_sn', |
| | |
| | | labelWidth: 145, |
| | | width: 110, |
| | | editDisplay: false, //编辑显示 |
| | | }, |
| | | { |
| | | label: '固件升级', |
| | | prop: 'firmware_status', |
| | | labelWidth: 145, |
| | | width: 100, |
| | | hide: true, |
| | | viewDisabled: true, |
| | | addDisabled: true, |
| | | editDisplay: false, //编辑显示 |
| | | addDisplay: false, |
| | | viewDisplay: false, |
| | | }, |
| | | { |
| | | label: '所属部门', |
| | |
| | | websocket?.initSocket() |
| | | }, |
| | | async messageHandler(payload) { |
| | | if (!payload) { |
| | | let loadData = JSON.parse(payload) |
| | | if (!loadData) { |
| | | return |
| | | } |
| | | if (payload.biz_code != 'ota_progress') { |
| | | |
| | | if (loadData.biz_code != 'ota_progress') { |
| | | return |
| | | } |
| | | var data = payload.data |
| | | this.data.forEach(e => { |
| | | if (e.device_sn == data.sn && data.output.status == 'in_progress') { |
| | | e.firmware_progress = data.output.progress.percent |
| | | console.log(loadData.data.output.progress.percent, '6666') |
| | | this.data.forEach((e, index) => { |
| | | if ((e.device_sn == loadData.data.sn || e.child_sn == loadData.data.sn) && loadData.data.output.status == 'in_progress') { |
| | | e.firmware_progress = loadData.data.output.progress.percent |
| | | if (e.children[0]) { |
| | | e.children[0].firmware_progress = loadData.data.output.progress.percent; |
| | | } |
| | | console.log('是否更新中2',e.children[0]) |
| | | } |
| | | |
| | | if (e.device_sn == data.sn && data.output.status == 'ok') { |
| | | if ((e.device_sn == loadData.data.sn || e.child_sn == loadData.data.sn) && loadData.data.output.status == 'ok') { |
| | | // 升级完成修改状态 |
| | | e.firmware_status = 1 |
| | | if (e.children[0]) { |
| | | e.children[0].firmware_status = 1 |
| | | } |
| | | const webscoket = this.websocketMap.get(e.workspace_id) |
| | | // 关闭 |
| | | webscoket?.close() |
| | |
| | | this.webSocketIdSet.delete(e.workspace_id) |
| | | } |
| | | }) |
| | | // this.$forceUpdate() |
| | | }, |
| | | init() { |
| | | (this.page = { |
| | |
| | | message: '操作成功!', |
| | | }) |
| | | this.onLoad(this.page) |
| | | done() |
| | | // done() |
| | | }) |
| | | }, |
| | | // 升级固件按钮事件 |
| | |
| | | this.$refs.crud.toggleSelection() |
| | | }) |
| | | }, |
| | | async getFullAreaCode(areaCode) { |
| | | console.log('getFullAreaCode', areaCode) |
| | | if (!areaCode) return '' |
| | | |
| | | const code = areaCode.toString() |
| | | |
| | | if (code.includes(',')) return code |
| | | |
| | | if (code.endsWith('0000000000')) { |
| | | return code |
| | | } else if (code.endsWith('00000000') && !code.endsWith('0000000000')) { |
| | | const provinceCode = code.substring(0, 2) + '0000000000' |
| | | return `${provinceCode},${code}` |
| | | } else { |
| | | const provinceCode = code.substring(0, 2) + '0000000000' |
| | | const cityCode = code.substring(0, 4) + '00000000' |
| | | return `${provinceCode},${cityCode},${code}` |
| | | } |
| | | }, |
| | | // async getFullAreaCode(areaCode) { |
| | | // console.log('getFullAreaCode', areaCode) |
| | | // if (!areaCode) return '' |
| | | // |
| | | // const code = areaCode.toString() |
| | | // |
| | | // if (code.includes(',')) return code |
| | | // |
| | | // if (code.endsWith('0000000000')) { |
| | | // return code |
| | | // } else if (code.endsWith('00000000') && !code.endsWith('0000000000')) { |
| | | // const provinceCode = code.substring(0, 2) + '0000000000' |
| | | // return `${provinceCode},${code}` |
| | | // } else { |
| | | // const provinceCode = code.substring(0, 2) + '0000000000' |
| | | // const cityCode = code.substring(0, 4) + '00000000' |
| | | // return `${provinceCode},${cityCode},${code}` |
| | | // } |
| | | // }, |
| | | beforeOpen(done, type) { |
| | | if (['edit', 'view'].includes(type)) { |
| | | getDetail(this.form.id).then(async res => { |
| | |
| | | this.page.total = data.total |
| | | data.records.forEach(e => { |
| | | e['hasChildren'] = e.has_children |
| | | if (e.firmware_status == 4) { |
| | | if (e.firmware_status == 4 || e.mode_code === 3) { |
| | | console.log('监听了没')// 机巢升级 firmware_status === 4 |
| | | this.connectWebSocket(e) |
| | | } |
| | | e.duration_of_insurance = [e?.insure_start_time?.slice(0, 10) || '', e?.insure_expired_time?.slice(0, 10) || ''] |
| | | }) |
| | | this.data = data.records |
| | | this.data = data.records.map(item => ({ |
| | | ...item, |
| | | firmware_progress: 0 |
| | | })); |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | |
| | | childSn: tree.child_sn, |
| | | } |
| | | getList(1, 10, params).then(res => { |
| | | const data = res.data.data.records |
| | | const data = res.data.data.records.map(item =>({ |
| | | ...item, |
| | | firmware_progress: 0 |
| | | })) |
| | | data.forEach(e => { |
| | | e.duration_of_insurance = [e?.insure_start_time?.slice(0, 10) || '', e?.insure_expired_time?.slice(0, 10) || ''] |
| | | }) |