进度条

This commit is contained in:
hekaiyu 2025-04-21 18:30:53 +08:00
parent a6f6516923
commit e421c87bf2
4 changed files with 203 additions and 53 deletions

13
src/api/backup.js Normal file
View File

@ -0,0 +1,13 @@
import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
const backupAdd = (params)=>postAction("/idcDataBackup/add",params);
const backupEdit = (params)=>putAction("/idcDataBackup/edit",params);
const backupDeleteById = (params)=>deleteAction("/idcDataBackup/deleteById",params);
export {
backupAdd,
backupEdit,
backupDeleteById
}

View File

@ -2,21 +2,21 @@
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <!-- <div class="table-page-search-wrapper">-->
<a-form layout="inline" @keyup.enter.native="searchQuery"> <!-- <a-form layout="inline" @keyup.enter.native="searchQuery">-->
<a-row :gutter="24"> <!-- <a-row :gutter="24">-->
<!-- -->
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <!-- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
<a-col :md="4" :sm="4"> <!-- <a-col :md="4" :sm="4">-->
<a-button type="primary" style="left: 10px" @click="backup" icon="plus">一键备份</a-button> <!-- <a-button type="primary" style="left: 10px" @click="backup" icon="plus">一键备份</a-button>-->
<a-button type="primary" @click="searchReset" icon="plus" <!-- <a-button type="primary" @click="handleAdd" icon="plus"-->
style="margin-left: 8px;left: 10px">添加</a-button> <!-- style="margin-left: 8px;left: 10px">添加</a-button>-->
</a-col> <!-- </a-col>-->
</span> <!-- </span>-->
</a-row> <!-- </a-row>-->
</a-form> <!-- </a-form>-->
</div> <!-- </div>-->
<div class="linese"></div> <div class="linese"></div>
<!-- table区域-begin --> <!-- table区域-begin -->
@ -27,23 +27,24 @@
<!-- :locale="myLocale"--> <!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示--> <!-- 字符串超长截取省略号显示-->
<template slot="Status" slot-scope="text"> <template slot="sourceType" slot-scope="text">
<span style="color:black;" v-if="text === 0">未备份</span> <span style="color:black;" v-if="text === 1">原始库</span>
<span style="color:darkorange;" v-if="text === 1">备份中</span> <span style="color:darkorange;" v-if="text === 2">标准库</span>
<span style="color:#87d068;" v-if="text === 2">完成</span> <span style="color:#87d068;" v-if="text === 3">专题库</span>
</template> </template>
<template slot="endisStatus" slot-scope="text"> <template slot="backupStatus" slot-scope="text">
<span style="color:black;" v-if="text === 0">未启用</span> <span style="color:black;" v-if="text === 0">未启用</span>
<span style="color:#87d068;" v-if="text === 1">启用</span> <span style="color:#87d068;" v-if="text === 1">启用</span>
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">详情</a> <a @click="handleEdit(record)">编辑</a>
<!-- <a-divider type="vertical" />
<a>查看日志</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a v-if="record.backupStatus === 0" @click="handleStartStop(record.id,1)">启动</a>
<a>删除</a> <a v-if="record.backupStatus === 1" @click="handleStartStop(record.id,0)">暂停</a>
</a-popconfirm> --> <a-divider type="vertical" />
<a @click="handleRun(record.sourceType)">一键备份</a>
<a-divider type="vertical" />
<a @click="handleRun(record.sourceType)">同步日志</a>
</span> </span>
</a-table> </a-table>
</div> </div>
@ -51,6 +52,7 @@
<!-- table区域-end --> <!-- table区域-end -->
<!-- 表单区域 --> <!-- 表单区域 -->
<backupModal ref="modalForm" @ok="modalFormOk"></backupModal>
</a-card> </a-card>
</template> </template>
@ -58,12 +60,14 @@
import { getAction, deleteAction, putAction, postAction } from '@/api/manage' import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis"; import JEllipsis from "@/components/jeecg/JEllipsis";
import backupModal from './modules/backupModal'
export default { export default {
name: "backup", name: "backup",
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: { components: {
JEllipsis, JEllipsis,
backupModal,
VNodes: { VNodes: {
functional: true, functional: true,
render: (h, ctx) => ctx.props.vnodes, render: (h, ctx) => ctx.props.vnodes,
@ -94,45 +98,30 @@ export default {
{ {
title: '任务名称', title: '任务名称',
align: "center", align: "center",
dataIndex: 'name', dataIndex: 'taskName',
}, },
{ {
title: '数据库', title: '数据库',
align: "center", align: "center",
dataIndex: 'dataBaseName', dataIndex: 'sourceType',
}, scopedSlots: { customRender: 'sourceType' }
{
title: '调度开始时间',
align: "center",
dataIndex: 'startTime'
},
{
title: '调度结束时间',
align: "center",
dataIndex: 'endTime',
},
{
title: '表达式',
align: "center",
dataIndex: 'larmder',
},
{
title: '调度状态',
align: "center",
dataIndex: 'Status',
scopedSlots: { customRender: 'Status' },
}, },
{ {
title: '是否启用', title: '是否启用',
align: "center", align: "center",
dataIndex: 'endisStatus', dataIndex: 'backupStatus',
scopedSlots: { customRender: 'endisStatus' }, scopedSlots: { customRender: 'backupStatus' }
},
{
title: '备注',
align: "center",
dataIndex: 'remark'
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
align: "center", align: "center",
width: 180, width: 260,
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
} }
] ]
@ -170,7 +159,25 @@ export default {
getAction("/idcDataBackup/list?pageNo=1&pageSize=10").then((res) => { getAction("/idcDataBackup/list?pageNo=1&pageSize=10").then((res) => {
if (res.success) { if (res.success) {
console.log(res) console.log(res)
this.dataSource = res.result; this.dataSource = res.result.records;
} else {
this.$message.warning(res.message);
}
});
},
handleRun(sourceType) {
postAction("/idcDataBackup/dmExportByUserName",{sourceType:sourceType}).then((res) => {
if (res.success) {
this.$message.success(res.result);
} else {
this.$message.warning(res.message);
}
});
},
handleStartStop(id,backupStatus) {
postAction("/idcDataBackup/edit",{id:id,backupStatus:backupStatus}).then((res) => {
if (res.success) {
this.loadData()
} else { } else {
this.$message.warning(res.message); this.$message.warning(res.message);
} }
@ -191,6 +198,10 @@ export default {
this.$refs.modalForm.edit(record); this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "编辑"; this.$refs.modalForm.title = "编辑";
}, },
handleAdd() {
this.$refs.modalForm.add();
this.$refs.modalForm.title = "新增";
},
handleDistribute: function (id) { handleDistribute: function (id) {
var that = this; var that = this;
taskDistributeTask({ id: id }).then((res) => { taskDistributeTask({ id: id }).then((res) => {

View File

@ -0,0 +1,126 @@
<template>
<a-modal
:title="title"
:width="800"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
okText="保存"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="任务名称" >
<a-input v-decorator="['taskName']" ></a-input>
</a-form-item>
<a-form-item label="仓库类型">
<a-select placeholder="选择仓库类型" option-filter-prop="children" size="large" v-decorator="['sourceType']">
<a-select-option key="1" :value="1">原始库</a-select-option>
<a-select-option key="2" :value="2">标准库</a-select-option>
<a-select-option key="3" :value="3">专题库</a-select-option>
</a-select>
</a-form-item>
<a-form-item
label="描述">
<a-textarea placeholder="请输入描述" :rows="3" v-decorator="['remark', {}]" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import JCron from "@/components/jeecg/JCron";
import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
import pick from 'lodash.pick'
import {backupAdd,backupEdit} from "@api/backup";
// import moment from "moment"
export default {
name: "backupModal",
components: {
JCron,
JSelectMultiple
},
data () {
return {
title:"操作",
buttonStyle: 'solid',
visible: false,
status:'',
model: {},
confirmLoading: false,
form: this.$form.createForm(this),
strategys:[],
dataStrategySelected:'',
idcDataStrategyId:""
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.visible =true;
let that = this;
that.form.resetFields();
this.model = Object.assign({},record);
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'taskName','sourceType','remark'));
});
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
//
this.form.validateFields((err, values) => {
console.log('values',values)
if (!err) {
that.confirmLoading = true;
if(!this.model.id){
backupAdd(values).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}else{
backupEdit({id:this.model.id,taskName:values.taskName,sourceType:values.sourceType,remark:values.remark}).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
}
})
},
handleCancel () {
this.close()
},
}
}
</script>
<style scoped>
.disabled{
pointer-events: none;
}
</style>

View File

@ -75,7 +75,7 @@ export default {
queryParam: { queryParam: {
ipInfo: '', ipInfo: '',
createTimeRange: [], createTimeRange: [],
logType: '1', logType: '2',
keyWord: '', keyWord: '',
}, },
tabKey: "1", tabKey: "1",