fix: 修改未执行eslint的代码

This commit is contained in:
zhangyu
2022-04-11 17:24:10 +08:00
parent 29289e9235
commit f0b5f13a70
23 changed files with 256 additions and 1457 deletions

File diff suppressed because one or more lines are too long

View File

@@ -69,7 +69,7 @@ export default {
x: 0, x: 0,
y: 0, y: 0,
title: 0, title: 0,
value: 0, value: 0,
show: false show: false
}, },
fontSize: 12, fontSize: 12,

File diff suppressed because it is too large Load Diff

View File

@@ -297,4 +297,3 @@ export default {
setChart(this.chartId, null) setChart(this.chartId, null)
} }
} }

View File

@@ -56,7 +56,7 @@
import ChartScreenHeader from '@/components/chart/ChartScreenHeader' import ChartScreenHeader from '@/components/chart/ChartScreenHeader'
import chart from '@/components/chart/chart' import chart from '@/components/chart/chart'
import { isChartPie, isTimeSeries, getGroupHeight, isGroup } from '@/components/chart/chart/tools' import { isChartPie, isTimeSeries, getGroupHeight, isGroup } from '@/components/chart/chart/tools'
import {alertMessage as alertMessageConstant, chartType, fromRoute} from '@/components/common/js/constants' import { alertMessage as alertMessageConstant, chartType, fromRoute } from '@/components/common/js/constants'
import bus from '@/libs/bus' import bus from '@/libs/bus'
import axios from 'axios' import axios from 'axios'
import chartTempData from '@/components/charts/chartTempData' import chartTempData from '@/components/charts/chartTempData'

View File

@@ -149,7 +149,6 @@ export default {
}) })
}, },
returnColor (obj) { returnColor (obj) {
console.log(obj, this.severityDataWeight)
let color = '' let color = ''
if (!obj) { if (!obj) {
color = '#23bf9a' color = '#23bf9a'

View File

@@ -108,7 +108,7 @@ export default {
label: this.$t('project.endpoint.state'), label: this.$t('project.endpoint.state'),
prop: 'state', prop: 'state',
show: true, show: true,
minWidth: 200, minWidth: 200
} }
// { // {
// label: this.$t('project.endpoint.status'), // label: this.$t('project.endpoint.status'),

View File

@@ -200,7 +200,7 @@ export default {
endpointTabTitle: [ endpointTabTitle: [
{ prop: 'panelTab', name: this.$t('overall.detail') }, { prop: 'panelTab', name: this.$t('overall.detail') },
{ prop: 'endpointAlertMessage', name: this.$t('overall.alert') }, { prop: 'endpointAlertMessage', name: this.$t('overall.alert') },
{ prop: 'endpointQuery', name: this.$t('project.metrics.metrics') }, { prop: 'endpointQuery', name: this.$t('project.metrics.metrics') },
{ prop: 'log', name: this.$t('overall.logs') } { prop: 'log', name: this.$t('overall.logs') }
] ]
}, },

View File

@@ -200,14 +200,12 @@ export function arrLength (rule, value, callback) { // 校验数组
} }
} }
export function datePicker (rule, value, callback) { // 校验时间选择 export function datePicker (rule, value, callback) { // 校验时间选择
if(value[0]&&value[1]){ if (value[0] && value[1]) {
callback() callback()
}else{ } else {
callback(new Error(vm.$t('validate.required'))) callback(new Error(vm.$t('validate.required')))
} }
}
}
export function sysObjectIdInput (rule, value, callback) { export function sysObjectIdInput (rule, value, callback) {
const sysId = /^(\d{1,9}\.){0,}[\d]+$/ const sysId = /^(\d{1,9}\.){0,}[\d]+$/

View File

@@ -5,7 +5,7 @@ export default {
type: Array type: Array
}, },
targetTab: String, targetTab: String,
from: String, from: String
}, },
data () { data () {
return { return {

View File

@@ -114,7 +114,7 @@ export default {
label: this.$t('asset.alertNum'), label: this.$t('asset.alertNum'),
prop: 'alertNum', prop: 'alertNum',
show: true, show: true,
width: 120, width: 120
}, { }, {
label: this.$t('asset.endpointNum2'), label: this.$t('asset.endpointNum2'),
prop: 'endpointNum', prop: 'endpointNum',

View File

@@ -169,88 +169,88 @@
</template> </template>
<script> <script>
import bus from "@/libs/bus"; import bus from '@/libs/bus'
import { put } from "@/http"; import { put } from '@/http'
import { arrLength, datePicker } from "@/components/common/js/validate"; import { arrLength, datePicker } from '@/components/common/js/validate'
import moment from "moment-timezone"; import moment from 'moment-timezone'
export default { export default {
name: "backupsBox", name: 'backupsBox',
props: { props: {
obj: { obj: {
type: Object, type: Object
}, }
}, },
data() { data () {
return { return {
editBackup: { editBackup: {
status: "", status: '',
checkDays: [], checkDays: [],
checkDay: [], checkDay: [],
timepicker: "", timepicker: '',
datepicker: "", datepicker: '',
retention: "", retention: '',
state: "", state: '',
schedule: { schedule: {
repeat: "", repeat: '',
stime: "", stime: '',
type: "", type: '',
nums: [], nums: []
}, }
}, },
whoshow: "", whoshow: '',
activeName: "", activeName: '',
dateFormatStr: localStorage.getItem("nz-default-dateFormat") dateFormatStr: localStorage.getItem('nz-default-dateFormat')
? localStorage.getItem("nz-default-dateFormat") ? localStorage.getItem('nz-default-dateFormat')
: "YYYY-MM-DD HH:ss:mm", : 'YYYY-MM-DD HH:ss:mm',
rules: { rules: {
type: [ type: [
{ {
required: true, required: true,
message: this.$t("validate.required"), message: this.$t('validate.required'),
trigger: "change", trigger: 'change'
}, }
], ],
datepicker: [{ validator: datePicker, trigger: "blur" }], datepicker: [{ validator: datePicker, trigger: 'blur' }],
checkDays: [ checkDays: [
{ {
required: true, required: true,
message: this.$t("validate.required"), message: this.$t('validate.required'),
trigger: "change", trigger: 'change'
}, },
{ validator: arrLength, trigger: "blur" }, { validator: arrLength, trigger: 'blur' }
], ],
retention: [ retention: [
{ {
required: true, required: true,
message: this.$t("validate.required"), message: this.$t('validate.required'),
trigger: ["blur", "change"], trigger: ['blur', 'change']
}, }
], ],
Status: [ Status: [
{ {
required: true, required: true,
message: this.$t("validate.required"), message: this.$t('validate.required'),
trigger: "change", trigger: 'change'
}, }
], ],
repeat: [ repeat: [
{ {
required: true, required: true,
message: this.$t("validate.required"), message: this.$t('validate.required'),
trigger: "blur", trigger: 'blur'
}, }
], ],
checkDay: [{ validator: arrLength, trigger: "blur" }], checkDay: [{ validator: arrLength, trigger: 'blur' }]
}, },
week: [ week: [
this.$t("week.Mon"), this.$t('week.Mon'),
this.$t("week.Tue"), this.$t('week.Tue'),
this.$t("week.Wed"), this.$t('week.Wed'),
this.$t("week.Thu"), this.$t('week.Thu'),
this.$t("week.Fri"), this.$t('week.Fri'),
this.$t("week.Sat"), this.$t('week.Sat'),
this.$t("week.Sun"), this.$t('week.Sun')
], ],
month: [ month: [
1, 1,
@@ -284,209 +284,207 @@ export default {
29, 29,
30, 30,
31, 31,
"Last", 'Last'
], ]
}; }
}, },
components: {}, components: {},
computed: {}, computed: {},
created() { created () {
const dateFormatStr = localStorage.getItem("nz-default-dateFormat"); const dateFormatStr = localStorage.getItem('nz-default-dateFormat')
if (dateFormatStr) { if (dateFormatStr) {
this.dateFormatStr = dateFormatStr.split(" ")[0]; this.dateFormatStr = dateFormatStr.split(' ')[0]
} else { } else {
this.dateFormatStr = "YYYY-MM-DD"; this.dateFormatStr = 'YYYY-MM-DD'
} }
}, },
beforeMount() {}, beforeMount () {},
mounted() {}, mounted () {},
methods: { methods: {
changeCheck(item) { changeCheck (item) {
if (this.editBackup.type == 3) { if (this.editBackup.type == 3) {
const nums = []; const nums = []
this.editBackup.nums = []; this.editBackup.nums = []
for (const i in this.editBackup.checkDay) { for (const i in this.editBackup.checkDay) {
nums.push(Number(this.editBackup.checkDay[i]) + 1); nums.push(Number(this.editBackup.checkDay[i]) + 1)
} }
this.editBackup.nums = nums; this.editBackup.nums = nums
} else if (this.editBackup.type == 4) { } else if (this.editBackup.type == 4) {
const nums = []
const nums = []; this.editBackup.nums = []
this.editBackup.nums = [];
this.editBackup.checkDays.forEach((e, i) => { this.editBackup.checkDays.forEach((e, i) => {
if (e === 31) { if (e === 31) {
nums.push(-1); nums.push(-1)
} else { } else {
nums.push(Number(this.editBackup.checkDays[i]) + 1); nums.push(Number(this.editBackup.checkDays[i]) + 1)
} }
}); })
this.editBackup.nums = nums; this.editBackup.nums = nums
} }
this.$forceUpdate(); this.$forceUpdate()
}, },
statusChange(item) { statusChange (item) {
this.$forceUpdate(); this.$forceUpdate()
if (item == true) { if (item == true) {
this.editBackup.state = 1; this.editBackup.state = 1
} else { } else {
this.editBackup.state = 0; this.editBackup.state = 0
} }
}, },
save() { save () {
this.$refs.backupsForm.validate((valid) => { this.$refs.backupsForm.validate((valid) => {
if (valid) { if (valid) {
this.editBackup.datepicker[0] = bus this.editBackup.datepicker[0] = bus
.timeFormate(this.editBackup.datepicker[0]) .timeFormate(this.editBackup.datepicker[0])
.split(" ")[0]; .split(' ')[0]
this.editBackup.stime = this.editBackup.datepicker.join(" "); this.editBackup.stime = this.editBackup.datepicker.join(' ')
let offset = localStorage.getItem("nz-sys-timezone"); let offset = localStorage.getItem('nz-sys-timezone')
offset = moment.tz(offset).format("Z"); offset = moment.tz(offset).format('Z')
this.editBackup.stime = new Date(this.editBackup.stime).getTime(); this.editBackup.stime = new Date(this.editBackup.stime).getTime()
offset = Number.parseInt(offset); offset = Number.parseInt(offset)
this.editBackup.stime -= offset * 60 * 60 * 1000; this.editBackup.stime -= offset * 60 * 60 * 1000
put("/sys/backup", { put('/sys/backup', {
state: Number(this.editBackup.state), state: Number(this.editBackup.state),
schedule: { schedule: {
type: Number(this.editBackup.type), type: Number(this.editBackup.type),
stime: this.editBackup.stime, stime: this.editBackup.stime,
repeat: Number(this.editBackup.repeat), repeat: Number(this.editBackup.repeat),
nums: this.editBackup.nums, nums: this.editBackup.nums
}, },
retention: Number(this.editBackup.retention), retention: Number(this.editBackup.retention)
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.esc(true); this.esc(true)
} }
}); })
} }
}); })
}, },
inputchange(n) { inputchange (n) {
this.$forceUpdate(); this.$forceUpdate()
}, },
datasourceChange(tab) { datasourceChange (tab) {
switch (tab.name) { switch (tab.name) {
case "2": case '2':
this.whoshow = 2; this.whoshow = 2
break; break
case "1": case '1':
this.whoshow = 1; this.whoshow = 1
break; break
case "3": case '3':
this.whoshow = 3; this.whoshow = 3
break; break
case "4": case '4':
this.whoshow = 4; this.whoshow = 4
break; break
} }
this.$forceUpdate(); this.$forceUpdate()
}, },
clickOutside() { clickOutside () {
this.esc(false); this.esc(false)
}, },
/* 关闭弹框 */ /* 关闭弹框 */
esc(refresh) { esc (refresh) {
this.$emit("close", refresh); this.$emit('close', refresh)
}, }
}, },
watch: { watch: {
obj: { obj: {
deep: true, deep: true,
immediate: true, immediate: true,
handler(n) { handler (n) {
this.editBackup = JSON.parse(JSON.stringify(n)); this.editBackup = JSON.parse(JSON.stringify(n))
this.editBackup.checkDay = []; this.editBackup.checkDay = []
this.editBackup.checkDays = []; this.editBackup.checkDays = []
this.editBackup.type = this.editBackup.type + ""; this.editBackup.type = this.editBackup.type + ''
const stime1 = this.utcTimeToTimezoneStr(this.editBackup.stime); const stime1 = this.utcTimeToTimezoneStr(this.editBackup.stime)
const stime = this.utcTimeToTimezone(this.editBackup.stime); const stime = this.utcTimeToTimezone(this.editBackup.stime)
const time = stime1.split(" "); const time = stime1.split(' ')
time[0] = stime; time[0] = stime
this.$set(this.editBackup, "datepicker", time); this.$set(this.editBackup, 'datepicker', time)
if (this.editBackup.state == 1) { if (this.editBackup.state == 1) {
this.editBackup.status = true; this.editBackup.status = true
this.$emit("statechange", true); this.$emit('statechange', true)
} else { } else {
this.editBackup.status = false; this.editBackup.status = false
this.$emit("statechange", false); this.$emit('statechange', false)
} }
switch (this.editBackup.type) { switch (this.editBackup.type) {
case "1": case '1':
this.activeName = "1"; this.activeName = '1'
this.whoshow = 1; this.whoshow = 1
break; break
case "2": case '2':
this.activeName = "2"; this.activeName = '2'
this.whoshow = 2; this.whoshow = 2
break; break
case "3": case '3':
this.activeName = "3"; this.activeName = '3'
this.whoshow = 3; this.whoshow = 3
break; break
case "4": case '4':
this.activeName = "4"; this.activeName = '4'
this.whoshow = 4; this.whoshow = 4
break; break
} }
const checkdays = []; const checkdays = []
this.checkDay = []; this.checkDay = []
if (this.editBackup.type == 3) { if (this.editBackup.type == 3) {
this.editBackup.nums.forEach((e) => { this.editBackup.nums.forEach((e) => {
if (e == -1 ) { if (e == -1) {
checkdays.push(6); checkdays.push(6)
}else{ } else {
checkdays.push(e - 1); checkdays.push(e - 1)
} }
}); })
this.$set(this.editBackup, "checkDay", checkdays); this.$set(this.editBackup, 'checkDay', checkdays)
} else if (this.editBackup.type == 4) { } else if (this.editBackup.type == 4) {
this.editBackup.nums.forEach((e) => { this.editBackup.nums.forEach((e) => {
if (e == -1) { if (e == -1) {
checkdays.push(31); checkdays.push(31)
} else { } else {
checkdays.push(e - 1); checkdays.push(e - 1)
} }
}); })
this.$set(this.editBackup, "checkDays", checkdays); this.$set(this.editBackup, 'checkDays', checkdays)
} }
this.$forceUpdate(); this.$forceUpdate()
}, }
}, },
"editBackup.status": { 'editBackup.status': {
deep: true, deep: true,
handler(n) { handler (n) {
if (n) { if (n) {
this.editBackup.state = 1; this.editBackup.state = 1
this.editBackup.status = n; this.editBackup.status = n
this.$emit("statechange", true); this.$emit('statechange', true)
} else { } else {
this.editBackup.state = 0; this.editBackup.state = 0
this.editBackup.status = n; this.editBackup.status = n
this.$emit("statechange", false); this.$emit('statechange', false)
} }
}, }
}, },
"editBackup.datepicker": { 'editBackup.datepicker': {
deep: true, deep: true,
handler(n) { handler (n) {
this.editBackup.datepicker[0] = bus this.editBackup.datepicker[0] = bus
.timeFormate(new Date(n[0])) .timeFormate(new Date(n[0]))
.split(" ")[0]; .split(' ')[0]
}, }
}, }
}, }
}; }
</script> </script>
<style lang='' scoped> <style lang='' scoped>
</style> </style>

View File

@@ -642,7 +642,7 @@ export default {
handler (n, o) { handler (n, o) {
this.isEdit = true this.isEdit = true
this.editAlertRule = JSON.parse(JSON.stringify(n)) this.editAlertRule = JSON.parse(JSON.stringify(n))
console.log(this.editAlertRule); console.log(this.editAlertRule)
if (this.editAlertRule.id || this.editAlertRule.name) { if (this.editAlertRule.id || this.editAlertRule.name) {
this.expressions = [this.editAlertRule.expr] this.expressions = [this.editAlertRule.expr]
this.showTypeSelect = true // 当 edit 时禁用 type下拉框 this.showTypeSelect = true // 当 edit 时禁用 type下拉框

View File

@@ -93,7 +93,7 @@ export default {
default: return false default: return false
} }
}, },
isThresholdConfig(type) { isThresholdConfig (type) {
switch (type) { switch (type) {
case 'line': case 'line':
case 'area': case 'area':

View File

@@ -148,7 +148,7 @@ import alertMessageLabelMixin from '@/components/common/alert/alertMessageLabelM
export default { export default {
name: 'alertMessageTable', name: 'alertMessageTable',
components: { components: {
alertRuleInfo: alertRuleInfo, alertRuleInfo: alertRuleInfo
}, },
props: { props: {
nowTime: { nowTime: {

View File

@@ -300,7 +300,7 @@ export default {
hideTableTooltip, hideTableTooltip,
tableDataSort (item) { tableDataSort (item) {
let orderBy = '' let orderBy = ''
let str = item.prop const str = item.prop
if (str === 'dc') { if (str === 'dc') {
orderBy = str orderBy = str
} }

View File

@@ -35,7 +35,7 @@
<span v-if="item.prop === 'fileName'"> {{ scope.row.fileName }} </span> <span v-if="item.prop === 'fileName'"> {{ scope.row.fileName }} </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :resizable="false" fixed="right" <el-table-column :resizable="false" fixed="right"
width="165px" width="165px"
> >
<div <div
@@ -65,11 +65,10 @@
</template> </template>
<script> <script>
import { post ,put} from '@/http' import { post, put } from '@/http'
import lodash from 'lodash' import lodash from 'lodash'
import bus from '@/libs/bus' import bus from '@/libs/bus'
export default { export default {
name: 'backupsTable', name: 'backupsTable',
mixins: [], mixins: [],
@@ -79,11 +78,11 @@ export default {
customTableTitle: Array, customTableTitle: Array,
isConfigurations: Boolean, isConfigurations: Boolean,
tableData: Array, tableData: Array,
tableData2: Array, tableData2: Array
}, },
data () { data () {
return { return {
// tableData: [ // tableData: [
// { // {
// retention: '', // retention: '',
@@ -110,34 +109,32 @@ export default {
computed: {}, computed: {},
methods: { methods: {
Restore(row){ Restore (row) {
put('/sys/backup/restore',{filename:row.fileName}).then(res=>{ put('/sys/backup/restore', { filename: row.fileName }).then(res => {
if(res.code == 200){ if (res.code == 200) {
this.$emit('getTableData','backup') this.$emit('getTableData', 'backup')
} }
}) })
}, },
del(item){ del (item) {
console.log(item); console.log(item)
}, },
changeDate(item){ changeDate (item) {
let time =Date.parse(item) const time = Date.parse(item)
let time1 = this.timeFormate(time) const time1 = this.timeFormate(time)
return time1 return time1
}, },
getNum(item){ getNum (item) {
return bus.getNumStr(item) return bus.getNumStr(item)
}, },
backupNow (item) { backupNow (item) {
post('/sys/backup').then((res) => { post('/sys/backup').then((res) => {
// console.log(res) // console.log(res)
}) })
}, },
edit () { edit () {
this.$emit('edit', this.tableData[0]) this.$emit('edit', this.tableData[0])
} }
}, },

View File

@@ -115,12 +115,12 @@ export default {
label: 'MAC', label: 'MAC',
prop: 'mac', prop: 'mac',
show: true, show: true,
minWidth: 200, minWidth: 200
}, { }, {
label: this.$t('config.ipamip.asset'), label: this.$t('config.ipamip.asset'),
prop: 'asset', prop: 'asset',
show: true, show: true,
width: 200, width: 200
}, { }, {
label: this.$t('overall.state'), label: this.$t('overall.state'),
prop: 'state', prop: 'state',

View File

@@ -83,7 +83,7 @@ export default {
}, },
data () { data () {
return { return {
username: '', username: '',
name: '', name: '',
language: 'en', language: 'en',
// 顶部菜单相关 // 顶部菜单相关

View File

@@ -35,7 +35,7 @@ export default {
}, },
data () { data () {
return { return {
containerShow: true, containerShow: true
} }
}, },
methods: { methods: {

View File

@@ -604,7 +604,7 @@ export default {
queryDate () { queryDate () {
this.chartLoading = true this.chartLoading = true
let chartInfo = {} let chartInfo = {}
if (this.currentMsg.alertRule.type === 1 || this.currentMsg.alertRule.type === 3) { if (this.currentMsg.alertRule.type === 1 || this.currentMsg.alertRule.type === 3) {
chartInfo = lodash.cloneDeep(lineData) chartInfo = lodash.cloneDeep(lineData)
chartInfo.elements = [{}] chartInfo.elements = [{}]
if (!isNaN(this.currentMsg.alertRule.threshold)) { if (!isNaN(this.currentMsg.alertRule.threshold)) {

View File

@@ -101,60 +101,59 @@ export default {
created () {}, created () {},
mounted () { mounted () {
this.getTableData() this.getTableData()
}, },
methods: { methods: {
getTableData (item) { getTableData (item) {
if(!item){ if (!item) {
this.$get('/sys/backup').then((res) => { this.$get('/sys/backup').then((res) => {
if (res.code === 200) { if (res.code === 200) {
if (res.data) { if (res.data) {
this.tableData[0].retention = res.data.retention this.tableData[0].retention = res.data.retention
this.tableData[0].state = res.data.state == 1? true :false this.tableData[0].state = res.data.state == 1
for (const i in res.data.schedule) { for (const i in res.data.schedule) {
this.tableData[0].schedule[i] = res.data.schedule[i] this.tableData[0].schedule[i] = res.data.schedule[i]
}
}
} }
}) }
this.$post('/sys/backup/list').then((res) => { }
if (res.code === 200) { })
if (res.data) { this.$post('/sys/backup/list').then((res) => {
this.tableData2 = res.data if (res.code === 200) {
if (res.data) {
} this.tableData2 = res.data
}
}
})
} else if (item == 'backup') {
this.$get('/sys/backup').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData[0].retention = res.data.retention
this.tableData[0].state = res.data.state == 1
for (const i in res.data.schedule) {
this.tableData[0].schedule[i] = res.data.schedule[i]
} }
}) }
}else if(item == 'backup'){ }
this.$get('/sys/backup').then((res) => { })
if (res.code === 200) { } else if (item == 'recent') {
if (res.data) { this.$post('/sys/backup/list').then((res) => {
this.tableData[0].retention = res.data.retention if (res.code === 200) {
this.tableData[0].state = res.data.state == 1? true :false if (res.data) {
for (const i in res.data.schedule) { this.tableData2 = res.data
this.tableData[0].schedule[i] = res.data.schedule[i] }
} }
} })
} }
})
}else if(item == 'recent'){
this.$post('/sys/backup/list').then((res) => {
if (res.code === 200) {
if (res.data) {
this.tableData2 = res.data
}
}
})
}
}, },
edit (row) { edit (row) {
this.object = { ...row , this.object = {
checkDay:'', ...row,
checkDays:'', checkDay: '',
datepicker:'' checkDays: '',
datepicker: ''
} }
this.object.name = this.$t('backup.edit') this.object.name = this.$t('backup.edit')
if (this.object.schedule) { if (this.object.schedule) {
@@ -169,7 +168,7 @@ export default {
this.getTableData('backup') this.getTableData('backup')
} }
this.rightBoxshow = false this.rightBoxshow = false
}, }
}, },
watch: {} watch: {}

View File

@@ -82,7 +82,6 @@ export default {
}, },
methods: { methods: {
edit (row, copyFlag) { edit (row, copyFlag) {
console.log(row,copyFlag);
this.object = { ...row } this.object = { ...row }
if (copyFlag) { if (copyFlag) {
this.object.name = this.object.name + '-copy' this.object.name = this.object.name + '-copy'