handleSubmit (e) {
e.preventDefault()
const that = this
that.form.validateFields(async (err, values) => {
if (!err) {
values['areaCode'] = that.areaCode || 33
values['datetime'] = getCurrentTime()
let resultList = []
resultList = await that.GetSearchDangerousCompanyList(values)
if (that.processNames && that.processNames.length > 0) {
resultList = resultList.filter(item => {
const itemProcessNameList = item.processNames ? item.processNames.split(',') : []
let result = false
itemProcessNameList.forEach(i => {
const findResult = that.processNames.find(d => {
return d === i
})
if (findResult) {
result = true
}
})
return result
})
}
if (that.Grade && that.Grade.length > 0) {
resultList = resultList.filter(item => {
return that.Grade.includes(item.hazardRankName)
})
}
this.searchDangerousList = resultList
}
})
}
drawRiskBar () {
const canvas = document.getElementById('riskBar')
const context = canvas.getContext('2d')
const majorHeight = this.majorRiskCount / this.total * canvas.height
const largerHeight = this.largerRiskCount / this.total * canvas.height
const generalHeight = this.generalRiskCount / this.total * canvas.height
const lowHeight = this.lowRiskCount / this.total * canvas.height
const offlineHeight = this.offlineCount / this.total * canvas.height
context.fillStyle = '#FF4646'
context.fillRect(0, 0, 20, majorHeight)
context.fillStyle = '#FE9056'
context.fillRect(0, majorHeight, 20, largerHeight)
context.fillStyle = '#FFC900'
context.fillRect(0, majorHeight + largerHeight, 20, generalHeight)
context.fillStyle = '#81BCFF'
context.fillRect(0, majorHeight + largerHeight + generalHeight, 20, lowHeight)
context.fillStyle = '#7D8B8D'
context.fillRect(0, majorHeight + largerHeight + generalHeight + lowHeight, 20, offlineHeight)
// 绘制切面
context.beginPath()
context.arc(10, 10, 10.5, Math.PI, 0)
context.lineTo(21, 0)
context.lineTo(0, 0)
context.closePath()
context.arc(10, 170, 10.5, Math.PI, 0, true)
context.lineTo(21, 180)
context.lineTo(0, 180)
context.closePath()
context.clip()
context.clearRect(0, 0, 20, 180)
}
}