diff --git a/src/api/node_source.js b/src/api/node_source.js new file mode 100644 index 0000000000000000000000000000000000000000..a9ba2687101c2b83b6a1747a9872450bdffb4454 --- /dev/null +++ b/src/api/node_source.js @@ -0,0 +1,76 @@ +import request from '../utils/request' + +export function getSource(data) { + return request({ + url: '/node/getSourceList', + method: 'post', + data + }) +} + +export function setSource(data) { + return request({ + url: '/node/setSourceList', + method: 'post', + data, + headers: { + tip: 'no' + } + }) +} + +export function scanSourceListOnce(data) { + return request({ + url: '/node/scanSourceListOnce', + method: 'post', + data + }) +} + +export function scanSourceListCycle(data) { + return request({ + url: '/node/scanSourceListCycle', + method: 'post', + data + }) +} + +export function setSourceDataBase(data) { + return request({ + url: '/node/setSourceDatabase', + method: 'post', + data + }) +} + +export function getSourceDataBase(data) { + return request({ + url: '/node/getSourceDatabase', + method: 'post', + data + }) +} + +export function delSourceDataBase(data) { + return request({ + url: '/node/delSourceDatabaseByID', + method: 'post', + data + }) +} + +export function getScanSource(data) { + return request({ + url: '/node/getScanSource', + method: 'post', + data + }) +} + +export function rollbackSourceList(data) { + return request({ + url: '/node/rollbackSourceList', + method: 'post', + data + }) +} diff --git a/src/pages/node/node-layout/source/source_list.vue b/src/pages/node/node-layout/source/source_list.vue index 3363fdf1a1e842db0967e424eeaf4a6d74ccb3df..c3b45f452bf9d91f83fee7233c44c76d7bb19c2a 100644 --- a/src/pages/node/node-layout/source/source_list.vue +++ b/src/pages/node/node-layout/source/source_list.vue @@ -2,6 +2,11 @@
软件源设置 + + 检测源配置{{ nodeCheck&&nodeCheck.time?'('+nodeCheck.time+'s后可操作)':'' }} + + 定时检测源配置 + 回滚源配置
{ + if (res.code === 200) { + this.$notification.success({ message: res.msg }) + this.scanSourceListVisible = false + } + }) + }, + openScanSourceModal() { + this.scanSourceListVisible = true + getScanSource({ nodeId: this.node.id }).then(res => { + if (res.code === 200) { + this.openCycle = res.data.isFlag === '1' + if (!this.openCycle) { + this.cycle = 60 + this.cycleType = 'ss' + } else { + this.cycle = res.data.Cycle + this.cycleType = res.data.cycleType + } + } + }) + }, + scanSourceOk() { + if (this.openCycle) { + if (this.cycleType === 'ss' && (this.cycle < 60 || this.cycle > 30 * 24 * 60 * 60)) { + this.$notification.error({ message: '周期间隔请保证60~2592000秒钟之间' }) + return + } + if (this.cycleType === 'mm' && (this.cycle < 1 || this.cycle > 30 * 24 * 60)) { + this.$notification.error({ message: '周期间隔请保证1~43200分钟之间' }) + return + } + if (this.cycleType === 'hh' && (this.cycle < 1 || this.cycle > 30 * 24)) { + this.$notification.error({ message: '周期间隔请保证1~720小时之间' }) + return + } + if (this.cycleType === 'dd' && (this.cycle < 1 || this.cycle > 30)) { + this.$notification.error({ message: '周期间隔请保证1~30天之间' }) + return + } + } + const param = { nodeId: this.node.id, isFlag: this.openCycle ? 1 : 0, Cycle: this.cycle, cycleType: this.cycleType } + scanSourceListCycle(param).then(res => { + if (res.code === 200) { + this.$notification.success({ message: (this.openCycle ? '开启' : '关闭') + '周期检测软件源配置成功' }) + this.scanSourceListVisible = false + } + }) + }, getPlanSourceList() { getPlanSourceList().then(res => { if (res && res.code === 200) {