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,
y: 0,
title: 0,
value: 0,
value: 0,
show: false
},
fontSize: 12,

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -56,7 +56,7 @@
import ChartScreenHeader from '@/components/chart/ChartScreenHeader'
import chart from '@/components/chart/chart'
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 axios from 'axios'
import chartTempData from '@/components/charts/chartTempData'

View File

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

View File

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

View File

@@ -200,7 +200,7 @@ export default {
endpointTabTitle: [
{ prop: 'panelTab', name: this.$t('overall.detail') },
{ 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') }
]
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -604,7 +604,7 @@ export default {
queryDate () {
this.chartLoading = true
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.elements = [{}]
if (!isNaN(this.currentMsg.alertRule.threshold)) {

View File

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

View File

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