Commit 94812605 by 莫晓莉

策略增删改查

parent 1eb11b8b
import request from '@/utils/request'
// 分页获取策略配置列表
export function getKettleRepositoryList(data) {
return request({
url: 'kettle/quartz/getKettleQuartzPageList',
data,
method: 'post'
})
}
// 新增策略配置
export function insert(data) {
return request({
url: 'kettle/quartz/insert',
data,
method: 'post'
})
}
//更新策略配置
export function update(data) {
return request({
url: 'kettle/quartz/update',
data,
method: 'post'
})
}
//删除策略配置
export function deleteStrategy(data) {
return request({
url: 'kettle/quartz/delete?id='+data,
method: 'post'
})
}
import request from '@/utils/request'
// 分页获取作业列表
export function getKettleJobList(data) {
return request({
url: 'kettle/job/getKettleJobList',
data,
method: 'post'
})
}
//添加作业
export function insert(data) {
return request({
url: 'kettle/job/insert',
data,
method: 'post'
})
}
//更新数据库资源库
export function update(data) {
return request({
url: 'kettle/repository/update',
data,
method: 'post'
})
}
//删除数据库资源库
export function deleteList(data) {
return request({
url: 'kettle/repository/delete?id='+data,
method: 'post'
})
}
......@@ -10,6 +10,7 @@
@click="showAll()"
></i>
</div>
<div v-show="jobShow" class="card-body">
<el-button class="btn-brush" icon="el-icon-plus"  @click="closeModal" >新增数据库资源库</el-button>
<div>
<el-table
......@@ -63,7 +64,7 @@
/>
</div>
</div>
</div>
</el-card>
<!-- 新增和编辑弹窗start -->
......@@ -184,7 +185,7 @@ export default {
page: 1,
size: 10,
},
loading: false,
loading: true,
headers: {}, // 头部信息
centerDialogVisible: false,
form: {
......@@ -231,17 +232,17 @@ export default {
{required:true,message:'请输入资源库数据库登录密码',trigger:'blur'}
],
},
options: [{
code: '选项1',
}, {
code: '选项2',
}, {
code: '选项3',
}, {
code: '选项4',
}, {
code: '选项5',
}],
// options: [{
// code: '选项1',
// }, {
// code: '选项2',
// }, {
// code: '选项3',
// }, {
// code: '选项4',
// }, {
// code: '选项5',
// }],
// value: '',
dialogMsgAdd:'添加数据库资源库',
dialogMsgEdit:'编辑数据库资源库',
......@@ -264,6 +265,10 @@ export default {
console.log('分页获取数据库资源库列表',res);
this.tableData = res.data.rows;
this.pageInfo.total = res.data.total;
//关闭加载样式
setTimeout(() => {
this.loading = false;
}, 500);
});
},
showAll(){
......@@ -346,7 +351,7 @@ export default {
// 删除
deleteList(row) {
var params={id:row.id};
this.$confirm('确认删除商品, 是否继续?', '提示', {
this.$confirm('确认删除该条数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
......@@ -445,4 +450,11 @@ export default {
color: #c4c4c4;
margin-right: 5px;
}
.el-card__body{
padding:0 !important;
/* padding: 15px 20px 20px 20px; */
}
.card-body{
padding: 15px 20px 20px 20px;
}
</style>
......@@ -13,10 +13,10 @@
></i>
</div>
<div v-show="jobShow" class="card-body">
<el-button class="btn-brush" icon="el-icon-plus"
 @click="addModalOne">新增策略</el-button
>
<div>
 @click="closeModal">新增策略</el-button>
<el-table
v-loading="loading"
:data="tableData"
......@@ -25,23 +25,8 @@
:header-cell-style="{ color: '#606266' }"
>
<el-table-column prop="id" label="策略编号" align="center" />
<el-table-column label="策略描述" align="center">
<!-- <template slot-scope="scope">
<img
:src="scope.row.coverImageUrl"
alt=""
style="width: 80px; height: 80px"
/>
</template> -->
每天凌晨3点执行
</el-table-column>
<el-table-column prop="doctorName" label="策略Cron" align="center" />
<!-- <el-table-column label="资源库更新时间" align="center">
<template slot-scope="scope">
<span>{{ scope.row.createTime | interceptionDate }}</span>
</template>
</el-table-column> -->
<el-table-column prop="description" label="策略描述" align="center"/>
<el-table-column prop="cron" label="策略Cron" align="center" />
<el-table-column prop label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
......@@ -55,14 +40,14 @@
size="mini"
type="danger"
icon="el-icon-delete"
@click="delJobVacancyFun(scope.row)"
@click="deleteStrategy(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<!-- 分页start -->
<div class="pagination">
<el-pagination
background
......@@ -74,6 +59,7 @@
@current-change="pageChange"
/>
</div>
<!-- 分页end -->
</div>
</el-card>
......@@ -81,27 +67,30 @@
<!-- 1、新增资源库作业start -->
<el-dialog
:title="curId?dialogMsgEdit:dialogMsgAdd"
:visible.sync="DialogVisibleOne"
:visible="DialogVisibleOne"
:before-close="closeModal"
width="60%"
center
top="2%">
<el-row :gutter="20">
<el-col :span="12" :offset="5">
<el-form ref="form" :model="form" label-width="auto">
<el-form-item label="策略描述:">
<el-input placeholder="请输入策略描述,例如每天凌晨一点执行" v-model="form.name" show-password class="input-length"></el-input>
<el-form ref="formName" :rules="rules" :model="form" label-width="auto">
<el-form-item prop="description" label="策略描述:">
<el-input placeholder="请输入策略描述,例如每天凌晨一点执行" v-model="form.description" class="input-length"></el-input>
</el-form-item>
<el-form-item label="策略Cron:">
<el-input placeholder="请输入策略Cron" v-model="form.name" show-password class="input-length"></el-input>
<span>生成cron表达式(生成后填入上面的框中)</span>
<el-form-item prop="cron" label="策略Cron:">
<el-input placeholder="请输入策略Cron" v-model="form.cron" class="input-length"></el-input>
<!-- <a href="https://cron.qqe2.com/"> -->
<span @click="See()" style="color: #337ab7;">生成cron表达式(生成后填入上面的框中)</span>
<!-- </a> -->
</el-form-item>
</el-form>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button class="btn-brush" type="success" icon="el-icon-check" @click="DialogVisibleOne = true">保存</el-button>
<el-button class="btn-brush" type="success" icon="el-icon-plus" @click="DialogVisibleOne = false">取消</el-button>
<el-button class="btn-brush" type="success" icon="el-icon-check" @click.native="curId ? update(): submitForm()" >保存</el-button>
<el-button class="btn-brush" type="success" icon="el-icon-plus" @click="closeModal()">取消</el-button>
</span>
</el-dialog>
<!--1、 新增资源库作业end -->
......@@ -112,26 +101,12 @@
<script>
import {
getNativeArticlePageList,
getKettleRepositoryList,
insert,
update,
create,
} from "@/api/communication/announcement";
import { getDoctorList } from "@/api/hospitalapi/doctor";
import { getToken } from "@/utils/auth";
// import { quillEditor } from "vue-quill-editor";
// import "quill/dist/quill.core.css";
// import "quill/dist/quill.snow.css";
// import "quill/dist/quill.bubble.css";
deleteStrategy
} from "@/api/sys/strategy";
export default {
// components: {
// quillEditor,
// },
filters: {
interceptionDate: function (value) {
if (!value) return;
return value.substr(0, 10);
},
},
data() {
return {
tableData: [],
......@@ -139,65 +114,171 @@ export default {
page: 1,
size: 10,
},
loading: false,
headers: {}, // 头部信息
jobShow: false, //作业监控记录
loading: true,
jobShow: true, //作业监控记录
DialogVisibleOne: false,//新增资源库作业弹窗
form: {},
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
form: {
description:'',
cron:''
},
// options: [{
// value: '选项1',
// label: '黄金糕'
// }, {
// value: '选项2',
// label: '双皮奶'
// }, {
// value: '选项3',
// label: '蚵仔煎'
// }, {
// value: '选项4',
// label: '龙须面'
// }, {
// value: '选项5',
// label: '北京烤鸭'
// }],
value: '',
dialogMsgAdd:'添加用户',
dialogMsgEdit:'编辑用户',
curId: null,
rules:{
description:[
{required:true,message:'请输入策略描述',trigger:'blur'}
],
cron:[
{required:true,message:'请输入策略Cron',trigger:'blur'}
],
},
};
},
created() {
this.getNativeArticlePageListFun();
this.setHeaders();
this.getKettleRepositoryList();
},
methods: {
// 新增
addModalOne() {
this.DialogVisibleOne=true;   
    },
//编辑
editModal(id) {
this.curId=1;
      console.log('编辑时候id不为为null');
this.DialogVisibleOne=true    
    },
setHeaders() {
this.headers = {
contentType: "application/x-www-form-urlencoded",
Authorization: getToken(),
};
showAll(){
this.jobShow=!this.jobShow;
},
getNativeArticlePageListFun() {
getNativeArticlePageList({ ...this.pageInfo, status: 1 }).then((res) => {
console.log(res);
//分页获取策略配置列表
getKettleRepositoryList() {
getKettleRepositoryList({ ...this.pageInfo}).then((res) => {
console.log('分页获取策略配置列表:',res);
this.tableData = res.data.rows;
this.pageInfo.total = res.data.total;
//关闭加载样式
setTimeout(() => {
this.loading = false;
}, 500);
});
},
// 提交新增数据
submitForm(){
this.$refs['formName'].validate((valid) => {
if (valid) {
insert(this.form).then(res=>{
console.log('提交新增数据:',res);
if (res.success) {
this.$message.success('新增成功!');
this.closeModal();//关闭弹窗
this.getKettleRepositoryList();//刷新列表
}else {
this.$message.error(res.errMsg)
}
})
} else {
console.log('error submit!!');
return false;
}
});
},
// 模态框操作
closeModal() {
console.log('打开弹窗------------------',this.DialogVisibleOne);
this.DialogVisibleOne = !this.DialogVisibleOne;
this.row = {};
this.form = {};
this.curId=null;
this.$refs['formName'].resetFields();//对该表单项进行重置,将其值重置为初始值并移除校验结果
},
//生成cron表达式(生成后填入上面的框中)
See(){
window.open('https://cron.qqe2.com/')
},
//编辑数据库资源库
editModal(row) {
this.curId=row.id;
      console.log('编辑时候id不为为null');
this.form = JSON.parse(JSON.stringify(row)) // 克隆
this.DialogVisibleOne=true;    
    },
// 编辑数据
update(){
this.$refs['formName'].validate((valid) => {
if (valid) {
update(this.form).then(res=>{
console.log('提交编辑数据:',res);
if (res.success) {
this.$message.success('编辑成功!');
this.centerDialogVisible=false;//关闭弹窗
this.form={};
this.curId=null;
this.closeModal();//关闭弹窗
this.getKettleRepositoryList();//刷新列表
}else {
this.$message.error(res.errMsg)
}
})
} else {
console.log('error submit!!');
return false;
}
});
},
// 删除
deleteStrategy(row) {
var params={id:row.id};
this.$confirm('确认删除该条数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteStrategy(row.id).then((res) => {
if (res.success) {
this.$message.success('删除成功')
this.getKettleRepositoryList();
} else {
this.$message.error(res.errMsg)
}
})
})
},
// 新增
// addModalOne() {
// this.DialogVisibleOne=true;   
//     },
//编辑
// editModal(id) {
// this.curId=1;
//       console.log('编辑时候id不为为null');
// this.DialogVisibleOne=true    
//     },
// getNativeArticlePageListFun() {
// getNativeArticlePageList({ ...this.pageInfo, status: 1 }).then((res) => {
// console.log(res);
// this.tableData = res.data.rows;
// this.pageInfo.total = res.data.total;
// });
// },
// 显示数量切换
sizeChange(e) {
this.pageInfo.size = e;
......@@ -206,7 +287,7 @@ export default {
pageChange(e) {
this.pageInfo.page = e;
this.getNativeArticlePageListFun();
this.getKettleRepositoryList();
},
// 编辑
......@@ -223,27 +304,27 @@ export default {
// });
// },
// 删除
delJobVacancyFun(val) {
this.article = val;
let param = {
...this.article,
status: 3,
};
update(param).then((res) => {
if (res.success) {
this.$message.success("删除成功");
this.getNativeArticlePageListFun();
} else {
this.$message.error(res.errMsg);
}
});
},
// delJobVacancyFun(val) {
// this.article = val;
// let param = {
// ...this.article,
// status: 3,
// };
// update(param).then((res) => {
// if (res.success) {
// this.$message.success("删除成功");
// this.getNativeArticlePageListFun();
// } else {
// this.$message.error(res.errMsg);
// }
// });
// },
// 添加活动
    addTask() {
      console.log('传递添加活动写死传递1:')
      this.$router.push({ path: '/oracle/add', query: { id: '1' }})
    },
//     addTask() {
//       console.log('传递添加活动写死传递1:')
//       this.$router.push({ path: '/oracle/add', query: { id: '1' }})
//     },
    // 编辑活动
//     goPage(id) {
//       console.log('传递编辑活动di:', id)
......@@ -270,18 +351,7 @@ export default {
font-size: 14px;
font-weight: bold;
}
/* .el-card__header {
padding: 15px 20px;
border-bottom: 1px solid #e6ebf5;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-size: 14px;
border-style: solid solid none;
border-width: 4px 0px 0;
} */
.el-card__body{
padding: 15px 20px 20px 20px;
}
.btn-icon {
float: right;
padding: 3px 0;
......@@ -296,4 +366,10 @@ export default {
.input-length{
width: 500px;
}
.el-card__body{
padding:0 !important;
}
.card-body{
padding: 15px 20px 20px 20px;
}
</style>
......@@ -13,6 +13,7 @@
></i>
</div>
<div v-show="!jobShow" class="card-body">
<div>
<el-button class="btn-brush" icon="el-icon-plus"
 @click="addModalOne">新增资源库作业</el-button>
......@@ -23,7 +24,7 @@
<el-button class="btn-brush right" icon="el-icon-plus"
 @click="addTask">刷新列表</el-button>
</div>
<div>
<el-table
v-loading="loading"
:data="tableData"
......@@ -32,20 +33,23 @@
:header-cell-style="{ color: '#606266' }"
>
<el-table-column prop="id" label="作业编号" width="100" align="center" />
<el-table-column label="作业类型" width="100" align="center">
文件
<el-table-column prop="type" label="作业类型" width="100" align="center">
<template slot-scope="scope">
{{ jobTypeList[scope.row.type] }}
</template>
</el-table-column>
<el-table-column prop="doctorName" label="作业名称" align="center" />
<el-table-column prop="username" label="作业策略" align="center" />
<el-table-column prop="name" label="作业名称" align="center" />
<el-table-column prop="customerQuarz" label="作业策略" align="center" />
<el-table-column label="作业更新时间" align="center" width="180">
<!-- <template slot-scope="scope">
<span>{{ scope.row.createTime | interceptionDate }}</span>
</template> -->
2020-11-29 14:07:38
<template slot-scope="scope">
{{ scope.row.updateTime | dateFormat }}
</template>
</el-table-column>
<el-table-column label="作业状态" width="100" align="center" >
已停止
<el-table-column prop="status" label="作业状态" width="100" align="center" >
<template slot-scope="scope">
{{ jobStatusList[scope.row.status] }}
</template>
</el-table-column>
<el-table-column prop label="操作" align="center">
<template slot-scope="scope">
......@@ -74,7 +78,7 @@
</el-table-column>
</el-table>
<!-- 分页 -->
<!-- 分页start -->
<div class="pagination">
<el-pagination
background
......@@ -86,6 +90,7 @@
@current-change="pageChange"
/>
</div>
<!-- 分页end -->
</div>
</el-card>
......@@ -333,18 +338,27 @@
<script>
import {
getNativeArticlePageList,
update,
create,
} from "@/api/communication/announcement";
import { getDoctorList } from "@/api/hospitalapi/doctor";
import { getToken } from "@/utils/auth";
getKettleJobList,
} from "@/api/task/homework";
// import { getDoctorList } from "@/api/hospitalapi/doctor";
// import { getToken } from "@/utils/auth";
export default {
filters: {
interceptionDate: function (value) {
if (!value) return;
return value.substr(0, 10);
},
dateFormat (val) {
if (val == null || val == '') {
return ''
} else {
let d = new Date(val) // val 为表格内取到的后台时间
let month = d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1
let day = d.getDate() < 10 ? '0' + d.getDate() : d.getDate()
let hours = d.getHours() < 10 ? '0' + d.getHours() : d.getHours()
let min = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()
let sec = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds()
let times = d.getFullYear() + '-' + month + '-' + day + ' ' + hours + ':' + min + ':' + sec
return times
}
}
},
data() {
return {
......@@ -353,38 +367,60 @@ export default {
page: 1,
size: 10,
},
loading: false,
loading: true,
headers: {}, // 头部信息
jobShow: false, //作业监控记录
DialogVisibleOne: false,//新增资源库作业弹窗
DialogVisibleTwo: false,//新增资源库作业弹窗
DialogVisibleThree: false, //编辑资源库作业弹窗
form: {},
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
// options: [{
// value: '选项1',
// label: '黄金糕'
// }, {
// value: '选项2',
// label: '双皮奶'
// }, {
// value: '选项3',
// label: '蚵仔煎'
// }, {
// value: '选项4',
// label: '龙须面'
// }, {
// value: '选项5',
// label: '北京烤鸭'
// }],
jobStatusList:['','正在运行', '已停止'],
jobTypeList:['','数据库资源库','上传的文件']
};
},
created() {
this.getNativeArticlePageListFun();
this.setHeaders();
this.getKettleJobList();//分页获取作业列表
// this.setHeaders();
},
methods: {
showAll(){
this.jobShow=!this.jobShow;
},
//分页获取作业列表
getKettleJobList() {
getKettleJobList({ ...this.pageInfo}).then((res) => {
console.log('分页获取作业列表:',res);
this.tableData = res.data.rows;
this.pageInfo.total = res.data.total;
//关闭加载样式
setTimeout(() => {
this.loading = false;
}, 500);
});
},
// 新增资源库作业弹窗
addModalOne() {
this.DialogVisibleOne=true;   
......@@ -399,20 +435,20 @@ export default {
    },
setHeaders() {
this.headers = {
contentType: "application/x-www-form-urlencoded",
Authorization: getToken(),
};
},
// setHeaders() {
// this.headers = {
// contentType: "application/x-www-form-urlencoded",
// Authorization: getToken(),
// };
// },
getNativeArticlePageListFun() {
getNativeArticlePageList({ ...this.pageInfo, status: 1 }).then((res) => {
console.log(res);
this.tableData = res.data.rows;
this.pageInfo.total = res.data.total;
});
},
// getNativeArticlePageListFun() {
// getNativeArticlePageList({ ...this.pageInfo, status: 1 }).then((res) => {
// console.log(res);
// this.tableData = res.data.rows;
// this.pageInfo.total = res.data.total;
// });
// },
// 显示数量切换
sizeChange(e) {
......@@ -439,27 +475,27 @@ export default {
// });
// },
// 删除
delJobVacancyFun(val) {
this.article = val;
let param = {
...this.article,
status: 3,
};
update(param).then((res) => {
if (res.success) {
this.$message.success("删除成功");
this.getNativeArticlePageListFun();
} else {
this.$message.error(res.errMsg);
}
});
},
// delJobVacancyFun(val) {
// this.article = val;
// let param = {
// ...this.article,
// status: 3,
// };
// update(param).then((res) => {
// if (res.success) {
// this.$message.success("删除成功");
// this.getNativeArticlePageListFun();
// } else {
// this.$message.error(res.errMsg);
// }
// });
// },
// 添加活动
    addTask() {
      console.log('传递添加活动写死传递1:')
      this.$router.push({ path: '/oracle/add', query: { id: '1' }})
    },
//     addTask() {
//       console.log('传递添加活动写死传递1:')
//       this.$router.push({ path: '/oracle/add', query: { id: '1' }})
//     },
    // 编辑活动
//     goPage(id) {
//       console.log('传递编辑活动di:', id)
......@@ -512,4 +548,11 @@ export default {
.input-length{
width: 500px;
}
.el-card__body{
padding:0 !important;
/* padding: 15px 20px 20px 20px; */
}
.card-body{
padding: 15px 20px 20px 20px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment