diff --git a/src/views/components/AccessDoor.vue b/src/views/components/AccessDoor.vue
index 9cce60d..dd0f1be 100644
--- a/src/views/components/AccessDoor.vue
+++ b/src/views/components/AccessDoor.vue
@@ -8,12 +8,12 @@
-
+
{{ scope.row.time | parseTime }}
-
+
{{ scope.row.name }}
diff --git a/src/views/environmentalScreen/index.js b/src/views/environmentalScreen/index.js
index 52e126e..b538acd 100644
--- a/src/views/environmentalScreen/index.js
+++ b/src/views/environmentalScreen/index.js
@@ -1,76 +1,131 @@
-export const allDeviceData = [{
- 'id': 1,
- 'ParentID': 0,
- 'SubClass': 0,
- 'IP': '',
- 'Name': '环境监控',
- 'NetStatus': 1,
- 'SUBTYPE': '1'
-}, {
- 'id': 11303,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:5005',
- 'Name': '温湿度',
- 'NetStatus': 1,
- 'SUBTYPE': '17'
-}, {
- 'id': 11355,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.102:5003:3',
- 'Name': '环境监测3_3',
- 'NetStatus': 1,
- 'SUBTYPE': '25'
-}, {
- 'id': 11379,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.102:5004:2',
- 'Name': '环境监测2_2',
- 'NetStatus': 1,
- 'SUBTYPE': '25'
-}, {
- 'id': 11403,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.102:5005',
- 'Name': '环境监测1',
- 'NetStatus': 1,
- 'SUBTYPE': '25'
-}, {
- 'id': 11440,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:5004',
- 'Name': '壁挂升降空气净化机',
- 'NetStatus': 1,
- 'SUBTYPE': '11'
-}, {
- 'id': 11486,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:5003',
- 'Name': '恒湿净化一体机',
- 'NetStatus': 1,
- 'SUBTYPE': '11'
-}, {
- 'id': 11519,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '',
- 'Name': '空调红外控制',
- 'NetStatus': 1,
- 'SUBTYPE': '1'
-}, {
- 'id': 11520,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:6003',
- 'Name': '开关量',
- 'NetStatus': 1,
- 'SUBTYPE': '11'
-}]
+export const allDeviceData = [
+ {
+ 'id': 1,
+ 'ParentID': 0,
+ 'SubClass': 0,
+ 'IP': '',
+ 'Name': '环境监控',
+ 'NetStatus': 1,
+ 'SUBTYPE': '1'
+ },
+ {
+ 'id': 11303,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:5005',
+ 'Name': '温湿度',
+ 'NetStatus': 1,
+ 'SUBTYPE': '17'
+ },
+ {
+ 'id': 11519,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '',
+ 'Name': '空调红外控制',
+ 'NetStatus': 1,
+ 'SUBTYPE': '1'
+ },
+ {
+ 'id': 11520,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:6003',
+ 'Name': '开关量',
+ 'NetStatus': 1,
+ 'SUBTYPE': '11'
+ },
+ {
+ 'id': 11605,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.000',
+ 'Name': 'PM2.5 浓度',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11606,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.001',
+ 'Name': 'PM10浓度',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11607,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.002',
+ 'Name': 'TWOC',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11608,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.003',
+ 'Name': '二氧化碳',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11609,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.004',
+ 'Name': '甲醛',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11682,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:5004',
+ 'Name': '壁挂升降空气净化机',
+ 'NetStatus': 1,
+ 'SUBTYPE': '11'
+ },
+ {
+ 'id': 11695,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:5003',
+ 'Name': '恒湿净化一体机',
+ 'NetStatus': 1,
+ 'SUBTYPE': '11'
+ },
+ {
+ 'id': 11728,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.102:5005',
+ 'Name': '环境监测1',
+ 'NetStatus': 1,
+ 'SUBTYPE': '25'
+ },
+ {
+ 'id': 11800,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.102:5003.3',
+ 'Name': '环境监测3_3',
+ 'NetStatus': 1,
+ 'SUBTYPE': '25'
+ },
+ {
+ 'id': 11824,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.102:5004.2',
+ 'Name': '环境监测2_2',
+ 'NetStatus': 1,
+ 'SUBTYPE': '25'
+ }
+]
export const mockIpData = {
// 温湿度
diff --git a/src/views/environmentalScreen/index.vue b/src/views/environmentalScreen/index.vue
index b042a99..9cfee22 100644
--- a/src/views/environmentalScreen/index.vue
+++ b/src/views/environmentalScreen/index.vue
@@ -155,34 +155,41 @@ export default {
await alarmApi.FetchYpGetSite().then((data) => {
if (data && data.length > 0) {
this.allDisplayConfigData = data
- // 处理设备IP列表
this.handleDeviceIpList()
} else {
this.allDisplayConfigData = []
}
+ // this.allDisplayConfigData = allDeviceData
})
- // 初始加载数据
+ // 初始加载+创建定时器
if (this.allDeviceIds.length > 0) {
this.currentDeviceName = this.ipToNameMap[this.allDeviceIds[0]] || ''
await this.getRealTimeData(this.allDeviceIds[0])
- console.log('初始加载IP数据:', this.allDeviceIds[0])
- } else {
- console.warn('无有效设备IP,停止轮询')
- this.newAlarm = []
- }
- },
- mounted() {
- this.iframeWin = this.$refs.myIframe?.contentWindow
- if (this.allDeviceIds.length > 0) {
+ // 移到这里创建定时器
this.dataTimer = setInterval(async() => {
const currentIp = this.getNextIp()
this.currentDeviceName = this.ipToNameMap[currentIp] || ''
await this.getRealTimeData(currentIp)
}, 10000)
console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
+ } else {
+ console.warn('无有效设备IP,停止轮询')
+ this.newAlarm = []
}
+ },
+ mounted() {
+ this.iframeWin = this.$refs.myIframe?.contentWindow
+
+ // if (this.allDeviceIds.length > 0) {
+ // this.dataTimer = setInterval(async() => {
+ // const currentIp = this.getNextIp()
+ // this.currentDeviceName = this.ipToNameMap[currentIp] || ''
+ // await this.getRealTimeData(currentIp)
+ // }, 10000)
+ // console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
+ // }
// 原有echarts刷新逻辑
this.echartsTimer = setInterval(() => {
@@ -228,6 +235,8 @@ export default {
*/
getNextIp() {
if (this.allDeviceIds.length === 0) return ''
+ // 先重置索引(防止数组长度变化导致越界)
+ this.currentIpIndex = this.currentIpIndex % this.allDeviceIds.length
const ip = this.allDeviceIds[this.currentIpIndex]
this.currentIpIndex = (this.currentIpIndex + 1) % this.allDeviceIds.length
console.log(`轮询切换 - 当前IP:${ip},下一个索引:${this.currentIpIndex}`)
diff --git a/src/views/home.vue b/src/views/home.vue
index 9f5c3c4..ec443e1 100644
--- a/src/views/home.vue
+++ b/src/views/home.vue
@@ -205,7 +205,7 @@ import { FetchWaitBorrower } from '@/api/archivesManage/lendManage'
import alarmApi from '@/api/home/alarm'
// import { allDeviceData, mockIpData } from '@/views/environmentalScreen/index.js'
-// // 同步mock方法
+// 同步mock方法
// const mockFetchDataForIP = (params) => {
// return new Promise((resolve) => {
// setTimeout(() => {
@@ -310,7 +310,8 @@ export default {
ipToNameMap: {}, // IP到设备名称映射
currentDeviceName: '', // 当前显示设备名称
currentIpIndex: 0, // IP轮询索引
- excludeIpList: ['192.168.99.101:6003'] // 排除IP列表
+ excludeIpList: ['192.168.99.101:6003'], // 排除IP列表
+ dataTimer: null // 数据轮询定时器
}
},
computed: {
@@ -318,12 +319,16 @@ export default {
'roles'
])
},
+ beforeDestroy() {
+ if (this.dataTimer) {
+ clearInterval(this.dataTimer)
+ this.dataTimer = null
+ console.log('轮询定时器已清除')
+ }
+ },
async created() {
this.getWaitBorrower()
- // console.log('allDeviceData:', allDeviceData)
- // this.allDisplayConfigData = allDeviceData
- // this.handleDeviceIpList()
// 真实请求请替换:
await alarmApi.FetchYpGetSite().then((data) => {
if (data && data.length > 0) {
@@ -333,28 +338,37 @@ export default {
} else {
this.allDisplayConfigData = []
}
+ // this.allDisplayConfigData = allDeviceData
+ // this.handleDeviceIpList()
})
- // 初始加载数据
+ // 初始加载+创建定时器
if (this.allDeviceIds.length > 0) {
this.currentDeviceName = this.ipToNameMap[this.allDeviceIds[0]] || ''
await this.getRealTimeData(this.allDeviceIds[0])
- console.log('初始加载IP数据:', this.allDeviceIds[0])
- } else {
- console.warn('无有效设备IP,停止轮询')
- this.newAlarm = []
- }
- },
- mounted() {
- if (this.allDeviceIds.length > 0) {
+
+ // 移到这里创建定时器
this.dataTimer = setInterval(async() => {
const currentIp = this.getNextIp()
this.currentDeviceName = this.ipToNameMap[currentIp] || ''
await this.getRealTimeData(currentIp)
}, 10000)
console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
+ } else {
+ console.warn('无有效设备IP,停止轮询')
+ this.newAlarm = []
}
},
+ mounted() {
+ // if (this.allDeviceIds.length > 0) {
+ // this.dataTimer = setInterval(async() => {
+ // const currentIp = this.getNextIp()
+ // this.currentDeviceName = this.ipToNameMap[currentIp] || ''
+ // await this.getRealTimeData(currentIp)
+ // }, 10000)
+ // console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
+ // }
+ },
methods: {
/**
* 处理设备IP列表(去重+排除+名称映射)
@@ -383,6 +397,8 @@ export default {
*/
getNextIp() {
if (this.allDeviceIds.length === 0) return ''
+ // 先重置索引(防止数组长度变化导致越界)
+ this.currentIpIndex = this.currentIpIndex % this.allDeviceIds.length
const ip = this.allDeviceIds[this.currentIpIndex]
this.currentIpIndex = (this.currentIpIndex + 1) % this.allDeviceIds.length
console.log(`轮询切换 - 当前IP:${ip},下一个索引:${this.currentIpIndex}`)
diff --git a/src/views/storeManage/warehouse3D/archivesStorage/index.js b/src/views/storeManage/warehouse3D/archivesStorage/index.js
index ffc195a..21c13dd 100644
--- a/src/views/storeManage/warehouse3D/archivesStorage/index.js
+++ b/src/views/storeManage/warehouse3D/archivesStorage/index.js
@@ -1,76 +1,131 @@
-export const allDeviceData = [{
- 'id': 1,
- 'ParentID': 0,
- 'SubClass': 0,
- 'IP': '',
- 'Name': '环境监控',
- 'NetStatus': 1,
- 'SUBTYPE': '1'
-}, {
- 'id': 11303,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:5005',
- 'Name': '温湿度',
- 'NetStatus': 1,
- 'SUBTYPE': '17'
-}, {
- 'id': 11355,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.102:5003:3',
- 'Name': '环境监测3_3',
- 'NetStatus': 1,
- 'SUBTYPE': '25'
-}, {
- 'id': 11379,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.102:5004:2',
- 'Name': '环境监测2_2',
- 'NetStatus': 1,
- 'SUBTYPE': '25'
-}, {
- 'id': 11403,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.102:5005',
- 'Name': '环境监测1',
- 'NetStatus': 1,
- 'SUBTYPE': '25'
-}, {
- 'id': 11440,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:5004',
- 'Name': '壁挂升降空气净化机',
- 'NetStatus': 1,
- 'SUBTYPE': '11'
-}, {
- 'id': 11486,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:5003',
- 'Name': '恒湿净化一体机',
- 'NetStatus': 1,
- 'SUBTYPE': '11'
-}, {
- 'id': 11519,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '',
- 'Name': '空调红外控制',
- 'NetStatus': 1,
- 'SUBTYPE': '1'
-}, {
- 'id': 11520,
- 'ParentID': 1,
- 'SubClass': 0,
- 'IP': '192.168.99.101:6003',
- 'Name': '开关量',
- 'NetStatus': 1,
- 'SUBTYPE': '11'
-}]
+export const allDeviceData = [
+ {
+ 'id': 1,
+ 'ParentID': 0,
+ 'SubClass': 0,
+ 'IP': '',
+ 'Name': '环境监控',
+ 'NetStatus': 1,
+ 'SUBTYPE': '1'
+ },
+ {
+ 'id': 11303,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:5005',
+ 'Name': '温湿度',
+ 'NetStatus': 1,
+ 'SUBTYPE': '17'
+ },
+ {
+ 'id': 11519,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '',
+ 'Name': '空调红外控制',
+ 'NetStatus': 1,
+ 'SUBTYPE': '1'
+ },
+ {
+ 'id': 11520,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:6003',
+ 'Name': '开关量',
+ 'NetStatus': 1,
+ 'SUBTYPE': '11'
+ },
+ {
+ 'id': 11605,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.000',
+ 'Name': 'PM2.5 浓度',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11606,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.001',
+ 'Name': 'PM10浓度',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11607,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.002',
+ 'Name': 'TWOC',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11608,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.003',
+ 'Name': '二氧化碳',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11609,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.004',
+ 'Name': '甲醛',
+ 'NetStatus': 1,
+ 'SUBTYPE': '101'
+ },
+ {
+ 'id': 11682,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:5004',
+ 'Name': '壁挂升降空气净化机',
+ 'NetStatus': 1,
+ 'SUBTYPE': '11'
+ },
+ {
+ 'id': 11695,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.101:5003',
+ 'Name': '恒湿净化一体机',
+ 'NetStatus': 1,
+ 'SUBTYPE': '11'
+ },
+ {
+ 'id': 11728,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.102:5005',
+ 'Name': '环境监测1',
+ 'NetStatus': 1,
+ 'SUBTYPE': '25'
+ },
+ {
+ 'id': 11800,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.102:5003.3',
+ 'Name': '环境监测3_3',
+ 'NetStatus': 1,
+ 'SUBTYPE': '25'
+ },
+ {
+ 'id': 11824,
+ 'ParentID': 1,
+ 'SubClass': 0,
+ 'IP': '192.168.99.102:5004.2',
+ 'Name': '环境监测2_2',
+ 'NetStatus': 1,
+ 'SUBTYPE': '25'
+ }
+]
export const mockIpData = {
// 温湿度
diff --git a/src/views/storeManage/warehouse3D/archivesStorage/index.vue b/src/views/storeManage/warehouse3D/archivesStorage/index.vue
index d44a6a0..b0bf2ec 100644
--- a/src/views/storeManage/warehouse3D/archivesStorage/index.vue
+++ b/src/views/storeManage/warehouse3D/archivesStorage/index.vue
@@ -112,18 +112,26 @@ export default {
await alarmApi.FetchYpGetSite().then((data) => {
if (data && data.length > 0) {
this.allDisplayConfigData = data
- // 处理设备IP列表
this.handleDeviceIpList()
} else {
this.allDisplayConfigData = []
}
+ // this.allDisplayConfigData = allDeviceData
+ // this.handleDeviceIpList()
})
+ // 初始加载+创建定时器
if (this.allDeviceIds.length > 0) {
- // 初始加载时设置设备名称
this.currentDeviceName = this.ipToNameMap[this.allDeviceIds[0]] || ''
await this.getRealTimeData(this.allDeviceIds[0])
- console.log('初始加载IP数据:', this.allDeviceIds[0])
+
+ // 移到这里创建定时器
+ this.timer = setInterval(async() => {
+ const currentIp = this.getNextIp()
+ this.currentDeviceName = this.ipToNameMap[currentIp] || ''
+ await this.getRealTimeData(currentIp)
+ }, 10000)
+ console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
} else {
console.warn('无有效设备IP,停止轮询')
this.newAlarm = []
@@ -134,15 +142,15 @@ export default {
_this.iframeWin = this.$refs.myIframe.contentWindow
window.addEventListener('message', this.handleMessageEvent)
- if (this.allDeviceIds.length > 0) {
- this.timer = setInterval(async() => {
- const currentIp = _this.getNextIp()
- // 轮询时更新设备名称
- _this.currentDeviceName = _this.ipToNameMap[currentIp] || ''
- await _this.getRealTimeData(currentIp)
- }, 10000)
- console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
- }
+ // if (this.allDeviceIds.length > 0) {
+ // this.timer = setInterval(async() => {
+ // const currentIp = _this.getNextIp()
+ // // 轮询时更新设备名称
+ // _this.currentDeviceName = _this.ipToNameMap[currentIp] || ''
+ // await _this.getRealTimeData(currentIp)
+ // }, 10000)
+ // console.log(`启动IP轮询,共${this.allDeviceIds.length}个有效IP:`, this.allDeviceIds)
+ // }
},
beforeDestroy() {
if (this.timer) {
@@ -172,16 +180,17 @@ export default {
},
/**
- * 获取下一个要轮询的IP(循环切换)
+ * 获取下一个轮询IP(循环切换)
*/
getNextIp() {
if (this.allDeviceIds.length === 0) return ''
+ // 先重置索引(防止数组长度变化导致越界)
+ this.currentIpIndex = this.currentIpIndex % this.allDeviceIds.length
const ip = this.allDeviceIds[this.currentIpIndex]
this.currentIpIndex = (this.currentIpIndex + 1) % this.allDeviceIds.length
console.log(`轮询切换 - 当前IP:${ip},下一个索引:${this.currentIpIndex}`)
return ip
},
-
/**
* 处理iframe消息事件
*/
diff --git a/src/views/system/archiveStatistics/mixins/statistics.js b/src/views/system/archiveStatistics/mixins/statistics.js
index bc930b0..2c26e02 100644
--- a/src/views/system/archiveStatistics/mixins/statistics.js
+++ b/src/views/system/archiveStatistics/mixins/statistics.js
@@ -62,30 +62,64 @@ export const statisticsCrud = {
// 组件共用方法
methods: {
// 档案借阅统计
+ // getBorrowerNumSta() {
+ // FetchInitBorrowerNumStatistics().then(res => {
+ // if (res) {
+ // delete res.total
+ // // 固定排序 '在库档案', '已借档案', '待借档案', '逾期档案', '异常档案'
+ // const borrowerArr = []
+ // for (const i in res) {
+ // const obj = {}
+ // obj.name = i
+ // obj.value = res[i]
+ // if (i === 'inStorage') {
+ // obj.sequence = 1
+ // } else if (i === 'borrow') {
+ // obj.sequence = 2
+ // } else if (i === 'waitBorrow') {
+ // obj.sequence = 3
+ // } else if (i === 'overdue') {
+ // obj.sequence = 4
+ // } else if (i === 'abnormal') {
+ // obj.sequence = 5
+ // }
+ // borrowerArr.push(obj)
+ // }
+ // this.arrSortByKey(borrowerArr, 'sequence', false)
+ // borrowerArr.forEach(item => {
+ // this.lendData.push(item.value)
+ // console.log(this.lendData)
+ // })
+ // }
+ // })
+ // },
getBorrowerNumSta() {
FetchInitBorrowerNumStatistics().then(res => {
if (res) {
delete res.total
- // 固定排序 '在库档案', '已借档案', '待借档案', '逾期档案', '异常档案'
+ // 新的固定排序: '逾期档案', '已借档案', '在库档案'
const borrowerArr = []
for (const i in res) {
const obj = {}
obj.name = i
obj.value = res[i]
- if (i === 'inStorage') {
+ // 重新定义排序序号
+ if (i === 'overdue') { // 逾期档案 - 第1位
obj.sequence = 1
- } else if (i === 'borrow') {
+ } else if (i === 'borrow') { // 已借档案 - 第2位
obj.sequence = 2
- } else if (i === 'waitBorrow') {
+ } else if (i === 'inStorage') { // 在库档案 - 第3位
obj.sequence = 3
- } else if (i === 'overdue') {
- obj.sequence = 4
- } else if (i === 'abnormal') {
- obj.sequence = 5
}
- borrowerArr.push(obj)
+ // 只添加需要的三类数据,过滤掉待借、异常档案
+ if (obj.sequence) {
+ borrowerArr.push(obj)
+ }
}
+ // 按sequence排序
this.arrSortByKey(borrowerArr, 'sequence', false)
+ // 清空原有数据(避免多次调用累加)
+ this.lendData = []
borrowerArr.forEach(item => {
this.lendData.push(item.value)
})