|
@@ -46,6 +46,7 @@
|
|
|
import getDate from '@/libs/getDate.js'
|
|
|
import moment from 'moment'
|
|
|
import { STable } from '@/components'
|
|
|
+import { deviceLogList } from '@/api/device'
|
|
|
export default {
|
|
|
name: 'EquipmentModal',
|
|
|
components: { STable },
|
|
@@ -54,14 +55,14 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
- equipmentId: {
|
|
|
+ srcDeviceCode: {
|
|
|
type: [Number, String],
|
|
|
default: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
modalTit () {
|
|
|
- return this.equipmentId + '-掉线日志'
|
|
|
+ return this.srcDeviceCode + '-掉线日志'
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
@@ -86,27 +87,29 @@ export default {
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
- { title: '离线时间', dataIndex: 'orderDate', width: 200, align: 'center' }
|
|
|
+ { title: '离线时间', dataIndex: 'createDate', width: 200, align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
- // return getTenantsList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
- // if (res.status == 200) {
|
|
|
- // const no = (res.data.pageNo - 1) * res.data.pageSize
|
|
|
- // for (let i = 0; i < res.data.list.length; i++) {
|
|
|
- // const _item = res.data.list[i]
|
|
|
- // _item.no = no + i + 1
|
|
|
- // _item.status = _item.status + '' === '1'
|
|
|
- // }
|
|
|
- // return res.data
|
|
|
- // }
|
|
|
- // })
|
|
|
- return new Promise((resolve) => {
|
|
|
- const data = [
|
|
|
- { id: 1, no: 1, orderDate: '2020-10-30 09:14' },
|
|
|
- { id: 2, no: 2, orderDate: '2020-10-30 09:14' }
|
|
|
- ]
|
|
|
- resolve(data)
|
|
|
+ const searchData = Object.assign(parameter, this.queryParam)
|
|
|
+ if (this.time && this.time.length) {
|
|
|
+ searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
|
|
|
+ searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD')
|
|
|
+ } else {
|
|
|
+ searchData.beginDate = ''
|
|
|
+ searchData.endDate = ''
|
|
|
+ }
|
|
|
+ searchData.srcDeviceCode = this.srcDeviceCode
|
|
|
+ return deviceLogList(searchData).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ const no = (res.data.pageNo - 1) * res.data.pageSize
|
|
|
+ for (let i = 0; i < res.data.list.length; i++) {
|
|
|
+ const _item = res.data.list[i]
|
|
|
+ _item.no = no + i + 1
|
|
|
+ _item.status = _item.status + '' === '1'
|
|
|
+ }
|
|
|
+ return res.data
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -123,9 +126,7 @@ export default {
|
|
|
this.queryParam.beginDate = dateStrings[0]
|
|
|
this.queryParam.endDate = dateStrings[1]
|
|
|
}
|
|
|
- },
|
|
|
- // 获取详情
|
|
|
- getDetails () {}
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
// 父页面传过来的弹框状态
|
|
@@ -138,10 +139,8 @@ export default {
|
|
|
this.$emit('close')
|
|
|
}
|
|
|
},
|
|
|
- equipmentId (newValue, oldValue) {
|
|
|
- if (this.isShow && newValue) {
|
|
|
- this.getDetails()
|
|
|
- }
|
|
|
+ srcDeviceCode (newValue, oldValue) {
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
}
|
|
|
}
|
|
|
}
|