first commit
This commit is contained in:
181
orion-ops-vue/src/components/clear/AppBuildClearModal.vue
Normal file
181
orion-ops-vue/src/components/clear/AppBuildClearModal.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="应用构建 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.REL_ID.value">清理应用</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.REL_ID.value === submit.range">
|
||||
<span class="normal-label clear-label">清理应用</span>
|
||||
<AppSelector class="param-input"
|
||||
placeholder="请选择清理的应用"
|
||||
@change="(e) => submit.relIdList[0] = e"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 执行用户 -->
|
||||
<div class="choose-param-wrapper">
|
||||
<span class="normal-label clear-label">执行用户</span>
|
||||
<a-checkbox class="param-input" v-model="iCreated">只清理我执行的</a-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
import AppSelector from '@/components/app/AppSelector'
|
||||
|
||||
export default {
|
||||
name: 'AppBuildClearModal',
|
||||
components: {
|
||||
AppSelector
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
visible: false,
|
||||
loading: false,
|
||||
iCreated: true,
|
||||
submit: {
|
||||
range: null,
|
||||
profileId: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null,
|
||||
relIdList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(profileId) {
|
||||
this.submit.profileId = profileId
|
||||
this.iCreated = true
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.relIdList = []
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (!this.submit.profileId) {
|
||||
this.$message.warning('请选择需要清理的环境')
|
||||
return
|
||||
}
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.REL_ID.value) {
|
||||
if (!this.submit.relIdList.length) {
|
||||
this.$message.warning('请选择需要清理的应用')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
iCreated: this.iCreated ? 1 : 2,
|
||||
clearType: DATA_CLEAR_TYPE.APP_BUILD.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 236px;
|
||||
}
|
||||
|
||||
.choose-param-wrapper {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
</style>
|
||||
197
orion-ops-vue/src/components/clear/AppPipelineClearModal.vue
Normal file
197
orion-ops-vue/src/components/clear/AppPipelineClearModal.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="应用流水线 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.REL_ID.value">清理流水线</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.REL_ID.value === submit.range">
|
||||
<span class="normal-label clear-label">流水线</span>
|
||||
<AppPipelineSelector class="param-input"
|
||||
placeholder="请选择清理的流水线"
|
||||
@change="(e) => submit.relIdList[0] = e"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 创建用户 -->
|
||||
<div class="choose-param-wrapper">
|
||||
<span class="normal-label clear-label">创建用户</span>
|
||||
<a-checkbox class="param-input" v-model="iCreated">只清理我创建的</a-checkbox>
|
||||
</div>
|
||||
<!-- 执行用户 -->
|
||||
<div class="choose-param-wrapper">
|
||||
<span class="normal-label clear-label">审核用户</span>
|
||||
<a-checkbox class="param-input" v-model="iAudited">只清理我审核的</a-checkbox>
|
||||
</div>
|
||||
<!-- 执行用户 -->
|
||||
<div class="choose-param-wrapper">
|
||||
<span class="normal-label clear-label">执行用户</span>
|
||||
<a-checkbox class="param-input" v-model="iExecute">只清理我执行的</a-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
import AppPipelineSelector from '@/components/app/AppPipelineSelector'
|
||||
|
||||
export default {
|
||||
name: 'AppPipelineClearModal',
|
||||
components: {
|
||||
AppPipelineSelector
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
visible: false,
|
||||
loading: false,
|
||||
iCreated: true,
|
||||
iAudited: false,
|
||||
iExecute: false,
|
||||
submit: {
|
||||
range: null,
|
||||
profileId: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null,
|
||||
relIdList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(profileId) {
|
||||
this.submit.profileId = profileId
|
||||
this.iCreated = true
|
||||
this.iAudited = false
|
||||
this.iExecute = false
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.relIdList = []
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (!this.submit.profileId) {
|
||||
this.$message.warning('请选择需要清理的环境')
|
||||
return
|
||||
}
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.REL_ID.value) {
|
||||
if (!this.submit.relIdList.length) {
|
||||
this.$message.warning('请选择需要清理的应用')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
iCreated: this.iCreated ? 1 : 2,
|
||||
iAudited: this.iAudited ? 1 : 2,
|
||||
iExecute: this.iExecute ? 1 : 2,
|
||||
clearType: DATA_CLEAR_TYPE.APP_PIPELINE_EXEC.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 242px;
|
||||
}
|
||||
|
||||
.choose-param-wrapper {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
</style>
|
||||
197
orion-ops-vue/src/components/clear/AppReleaseClearModal.vue
Normal file
197
orion-ops-vue/src/components/clear/AppReleaseClearModal.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="应用发布 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.REL_ID.value">清理应用</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.REL_ID.value === submit.range">
|
||||
<span class="normal-label clear-label">清理应用</span>
|
||||
<AppSelector class="param-input"
|
||||
placeholder="请选择清理的应用"
|
||||
@change="(e) => submit.relIdList[0] = e"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 创建用户 -->
|
||||
<div class="choose-param-wrapper">
|
||||
<span class="normal-label clear-label">创建用户</span>
|
||||
<a-checkbox class="param-input" v-model="iCreated">只清理我创建的</a-checkbox>
|
||||
</div>
|
||||
<!-- 执行用户 -->
|
||||
<div class="choose-param-wrapper">
|
||||
<span class="normal-label clear-label">审核用户</span>
|
||||
<a-checkbox class="param-input" v-model="iAudited">只清理我审核的</a-checkbox>
|
||||
</div>
|
||||
<!-- 执行用户 -->
|
||||
<div class="choose-param-wrapper">
|
||||
<span class="normal-label clear-label">执行用户</span>
|
||||
<a-checkbox class="param-input" v-model="iExecute">只清理我执行的</a-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
import AppSelector from '@/components/app/AppSelector'
|
||||
|
||||
export default {
|
||||
name: 'AppReleaseClearModal',
|
||||
components: {
|
||||
AppSelector
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
visible: false,
|
||||
loading: false,
|
||||
iCreated: true,
|
||||
iAudited: false,
|
||||
iExecute: false,
|
||||
submit: {
|
||||
range: null,
|
||||
profileId: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null,
|
||||
relIdList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(profileId) {
|
||||
this.submit.profileId = profileId
|
||||
this.iCreated = true
|
||||
this.iAudited = false
|
||||
this.iExecute = false
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.relIdList = []
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (!this.submit.profileId) {
|
||||
this.$message.warning('请选择需要清理的环境')
|
||||
return
|
||||
}
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.REL_ID.value) {
|
||||
if (!this.submit.relIdList.length) {
|
||||
this.$message.warning('请选择需要清理的应用')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
iCreated: this.iCreated ? 1 : 2,
|
||||
iAudited: this.iAudited ? 1 : 2,
|
||||
iExecute: this.iExecute ? 1 : 2,
|
||||
clearType: DATA_CLEAR_TYPE.APP_RELEASE.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 236px;
|
||||
}
|
||||
|
||||
.choose-param-wrapper {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
</style>
|
||||
173
orion-ops-vue/src/components/clear/BatchExecClearModal.vue
Normal file
173
orion-ops-vue/src/components/clear/BatchExecClearModal.vue
Normal file
@@ -0,0 +1,173 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="批量执行 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.REL_ID.value">清理机器</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.REL_ID.value === submit.range">
|
||||
<span class="normal-label clear-label">清理机器</span>
|
||||
<MachineSelector class="param-input"
|
||||
placeholder="请选择清理的机器"
|
||||
@change="(e) => submit.relIdList[0] = e"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 管理员 -->
|
||||
<div class="all-user-wrapper" v-if="$isAdmin()">
|
||||
<span class="normal-label clear-label">执行用户</span>
|
||||
<a-checkbox class="param-input" v-model="iCreated">只清理我执行的</a-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
import MachineSelector from '@/components/machine/MachineSelector'
|
||||
|
||||
export default {
|
||||
name: 'BatchExecClearModal',
|
||||
components: { MachineSelector },
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
visible: false,
|
||||
loading: false,
|
||||
iCreated: true,
|
||||
submit: {
|
||||
range: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null,
|
||||
relIdList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.iCreated = true
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.relIdList = []
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.REL_ID.value) {
|
||||
if (!this.submit.relIdList.length) {
|
||||
this.$message.warning('请选择需要清理的机器')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
iCreated: this.iCreated ? 1 : 2,
|
||||
clearType: DATA_CLEAR_TYPE.BATCH_EXEC.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 236px;
|
||||
}
|
||||
|
||||
.all-user-wrapper {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
</style>
|
||||
164
orion-ops-vue/src/components/clear/EventLogClearModal.vue
Normal file
164
orion-ops-vue/src/components/clear/EventLogClearModal.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="操作日志 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.REL_ID.value">操作分类</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.REL_ID.value === submit.range">
|
||||
<span class="normal-label clear-label">操作分类</span>
|
||||
<a-select class="param-input"
|
||||
placeholder="请选择需要清理的操作分类"
|
||||
@change="(e) => submit.relIdList[0] = e">
|
||||
<a-select-option v-for="classify in EVENT_CLASSIFY" :key="classify.value" :value="classify.value">
|
||||
{{ classify.label }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, EVENT_CLASSIFY, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
|
||||
export default {
|
||||
name: 'EventLogClearModal',
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
EVENT_CLASSIFY,
|
||||
visible: false,
|
||||
loading: false,
|
||||
submit: {
|
||||
range: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null,
|
||||
relIdList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.relIdList = []
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.REL_ID.value) {
|
||||
if (!this.submit.relIdList.length) {
|
||||
this.$message.warning('请选择需要清理的操作分类')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
clearType: DATA_CLEAR_TYPE.USER_EVENT_LOG.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 236px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="报警记录 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
|
||||
export default {
|
||||
name: 'MachineAlarmHistoryClearModal',
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
visible: false,
|
||||
loading: false,
|
||||
submit: {
|
||||
range: null,
|
||||
machineId: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(machineId) {
|
||||
this.submit.machineId = machineId
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (!this.submit.machineId) {
|
||||
this.$message.warning('无机器id')
|
||||
return
|
||||
}
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
clearType: DATA_CLEAR_TYPE.MACHINE_ALARM_HISTORY.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 236px;
|
||||
}
|
||||
|
||||
</style>
|
||||
151
orion-ops-vue/src/components/clear/SchedulerRecordClearModal.vue
Normal file
151
orion-ops-vue/src/components/clear/SchedulerRecordClearModal.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="调度任务 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
|
||||
export default {
|
||||
name: 'SchedulerRecordClearModal',
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
visible: false,
|
||||
loading: false,
|
||||
submit: {
|
||||
range: null,
|
||||
relId: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(relId) {
|
||||
this.submit.relId = relId
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (!this.submit.relId) {
|
||||
this.$message.warning('无任务id')
|
||||
return
|
||||
}
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
clearType: DATA_CLEAR_TYPE.SCHEDULER_RECORD.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 236px;
|
||||
}
|
||||
|
||||
</style>
|
||||
161
orion-ops-vue/src/components/clear/TerminalLogClearModal.vue
Normal file
161
orion-ops-vue/src/components/clear/TerminalLogClearModal.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<a-modal v-model="visible"
|
||||
title="终端日志 清理"
|
||||
okText="清理"
|
||||
:width="400"
|
||||
:okButtonProps="{props: {disabled: loading}}"
|
||||
:maskClosable="false"
|
||||
:destroyOnClose="true"
|
||||
@ok="clear"
|
||||
@cancel="close">
|
||||
<a-spin :spinning="loading">
|
||||
<div class="data-clear-container">
|
||||
<!-- 清理区间 -->
|
||||
<div class="data-clear-range">
|
||||
<a-radio-group class="nowrap" v-model="submit.range">
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.DAY.value">保留天数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.TOTAL.value">保留条数</a-radio-button>
|
||||
<a-radio-button :value="DATA_CLEAR_RANGE.REL_ID.value">清理机器</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<!-- 清理参数 -->
|
||||
<div class="data-clear-params">
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.DAY.value === submit.range">
|
||||
<span class="normal-label clear-label">保留天数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveDay"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的天数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.TOTAL.value === submit.range">
|
||||
<span class="normal-label clear-label">保留条数</span>
|
||||
<a-input-number class="param-input"
|
||||
v-model="submit.reserveTotal"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
placeholder="清理后数据所保留的条数"/>
|
||||
</div>
|
||||
<div class="data-clear-param" v-if="DATA_CLEAR_RANGE.REL_ID.value === submit.range">
|
||||
<span class="normal-label clear-label">清理机器</span>
|
||||
<MachineSelector class="param-input"
|
||||
placeholder="请选择清理的机器"
|
||||
@change="(e) => submit.relIdList[0] = e"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DATA_CLEAR_RANGE, DATA_CLEAR_TYPE } from '@/lib/enum'
|
||||
import MachineSelector from '@/components/machine/MachineSelector'
|
||||
|
||||
export default {
|
||||
name: 'TerminalLogClearModal',
|
||||
components: { MachineSelector },
|
||||
data: function() {
|
||||
return {
|
||||
DATA_CLEAR_RANGE,
|
||||
visible: false,
|
||||
loading: false,
|
||||
submit: {
|
||||
range: null,
|
||||
reserveDay: null,
|
||||
reserveTotal: null,
|
||||
relIdList: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.submit.reserveDay = null
|
||||
this.submit.reserveTotal = null
|
||||
this.submit.relIdList = []
|
||||
this.submit.range = DATA_CLEAR_RANGE.DAY.value
|
||||
this.loading = false
|
||||
this.visible = true
|
||||
},
|
||||
clear() {
|
||||
if (this.submit.range === DATA_CLEAR_RANGE.DAY.value) {
|
||||
if (this.submit.reserveDay === null) {
|
||||
this.$message.warning('请输入需要保留的天数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.TOTAL.value) {
|
||||
if (this.submit.reserveTotal === null) {
|
||||
this.$message.warning('请输入需要保留的条数')
|
||||
return
|
||||
}
|
||||
} else if (this.submit.range === DATA_CLEAR_RANGE.REL_ID.value) {
|
||||
if (!this.submit.relIdList.length) {
|
||||
this.$message.warning('请选择需要清理的机器')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.$confirm({
|
||||
title: '确认清理',
|
||||
content: '清理后数据将无法恢复, 确定要清理吗?',
|
||||
mask: false,
|
||||
okText: '确认',
|
||||
okType: 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
this.doClear()
|
||||
}
|
||||
})
|
||||
},
|
||||
doClear() {
|
||||
this.loading = true
|
||||
this.$api.clearData({
|
||||
...this.submit,
|
||||
clearType: DATA_CLEAR_TYPE.TERMINAL_LOG.value
|
||||
}).then(({ data }) => {
|
||||
this.loading = false
|
||||
this.visible = false
|
||||
this.$emit('clear')
|
||||
this.$message.info(`共清理 ${data}条数据`)
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
.data-clear-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.data-clear-range {
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.clear-label {
|
||||
width: 64px;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.data-clear-param {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.param-input {
|
||||
margin-left: 8px;
|
||||
width: 236px;
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user