42cd0c29 by 任超

feat:系统管理

1 parent 765e2449
import request from '@/utils/request'
class dictionaries {
// 获取整个字典数据
async getDicData (data) {
return request({
url: '/SysDict/getJson',
method: 'get'
})
}
// 编辑
async editSysDict (data) {
return request({
url: '/SysDict/editSysDictByTypeId',
method: 'post',
data
})
}
// 获取字典表父级集合
async getSysDictParent (data) {
return request({
url: '/SysDict/getSysDictParent',
method: 'post',
data
})
}
// 编辑界面获取指定字典编码子集
async getSysDictByTypeId (id) {
return request({
url: '/SysDict/getSysDictByTypeId',
method: 'get',
params: {
typeId: id
}
})
}
// 接入业务信息表
async getAllSysJrywxx () {
return request({
url: '/sysJrywxx/getAllSysJrywxx',
method: 'get'
})
}
}
export default new dictionaries()
\ No newline at end of file
import request from '@/utils/request'
class system {
// 定时任务
// 定时任务查询接口
async getTaskListByName (data) {
return request({
url: '/sjsbTask/getTaskListByName',
method: 'post',
data
})
}
// 定时任务新增接口
async sjsbTaskSave (data) {
return request({
url: '/sjsbTask/save',
method: 'post',
data
})
}
// 修改定时任务执行时间接口
async updateCron (data) {
return request({
url: '/sjsbTask/updateCron',
method: 'post',
data
})
}
// 定时任务删除接口
async sjsbTaskRemove (id) {
return request({
url: '/sjsbTask/remove',
method: 'get',
params: {
id: id
}
})
}
// 暂停任务接口
async pauseJob (id) {
return request({
url: '/sjsbTask/pauseJob',
method: 'get',
params: {
id: id
}
})
}
// 恢复任务接口
async resumeJob (id) {
return request({
url: '/sjsbTask/resumeJob',
method: 'get',
params: {
id: id
}
})
}
// 激活任务接口
async activateJob (id) {
return request({
url: '/sjsbTask/activateJob',
method: 'get',
params: {
id: id
}
})
}
// 手动测试
async sjsbTaskRun (id) {
return request({
url: '/sjsbTask/run',
method: 'get',
params: {
id: id
}
})
}
}
export default new system()
\ No newline at end of file
......@@ -173,6 +173,35 @@ export const asyncRoutes = [
}
]
},
// 系统管理
{
path: '/system',
component: Layout,
meta: { title: '系统管理', icon: 'sqcx', breadcrumb: false },
redirect: '/system/dictionary-config',
alwaysShow: true,
name: 'system',
children: [
{
path: 'dictionary-config',
component: () => import('@/views/system/dictionary-config'),
name: 'dictionary-config',
meta: { title: '字典管理' }
},
{
path: 'validationRule',
component: () => import('@/views/system/validationRule'),
name: 'validationRule',
meta: { title: '上报效验规则配置' }
},
{
path: 'timedTask',
component: () => import('@/views/system/timedTask'),
name: 'timedTask',
meta: { title: '定时任务' }
}
]
}
]
const createRouter = () =>
......
......@@ -134,6 +134,7 @@
.svg-icon {
font-size: 18px;
margin-top: -5px;
}
}
......
/**
* 获取数据类型
* @param {All} [o] 需要检测的数据
* @returns {String}
*/
export function getType(o) {
return Object.prototype.toString.call(o).slice(8, -1);
}
/**
* 判断是否是指定数据类型
* @param {All} [o] 需要检测的数据
* @param {String} [type] 数据类型
* @returns {Boolean}
*/
export function isKeyType(o, type) {
return getType(o).toLowerCase() === type.toLowerCase();
}
export function deepCopy(sth) {
let copy;
if (null == sth || "object" != typeof sth) return sth;
if (isKeyType(sth, 'date')) {
copy = new Date();
copy.setTime(sth.getTime());
return copy;
}
if (isKeyType(sth, 'array')) {
copy = [];
for (let i = 0, len = sth.length; i < len; i++) {
copy[i] = deepCopy(sth[i]);
}
return copy;
}
if (isKeyType(sth, 'object')) {
copy = {};
for (let attr in sth) {
if (sth.hasOwnProperty(attr)) copy[attr] = deepCopy(sth[attr]);
}
return copy;
}
return null;
}
/**
* 关键信息隐藏
* @param str 字符串
* @param frontLen 字符串前面保留位数
* @param endLen 字符串后面保留位数
* @returns {string}
*/
export function hideCode(str, frontLen, endLen = 0) {
var len = str.length - frontLen - endLen;
var xing = '';
for (var i = 0; i < len; i++) {
xing += '*';
}
return str.substring(0, frontLen) + xing + str.substring(str.length - endLen);
};
// 数组去重
export function unique(arr) {
var obj = {};
return arr.filter(function (item, index, arr) {
return obj.hasOwnProperty(typeof item + item) ? false : (obj[typeof item + item] = true)
})
}
// 创造id
export function getUuid(len, radix) {
var chars = "0123456789abcdefghijklmnopqrstuvwxyz".split(
""
);
var uuid = [],
i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | (Math.random() * radix)];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
uuid[14] = "4";
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | (Math.random() * 16);
uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join("");
}
//js计算两个时间戳之间的时间差 (月)
export function intervalTime(startTime, endTime) {
// var timestamp=new Date().getTime(); //计算当前时间戳
var timestamp = (Date.parse(new Date())) / 1000;//计算当前时间戳 (毫秒级)
var date1 = ""; //开始时间
if (timestamp < startTime) {
date1 = startTime;
} else {
date1 = timestamp; //开始时间
}
var date2 = endTime; //结束时间
// var date3 = date2.getTime() - date1.getTime(); //时间差的毫秒数
var date3 = (date2 - date1) * 1000; //时间差的毫秒数
//计算出相差天数
var mon = Math.floor(date3 / (30 * 24 * 3600 * 1000 * 1000));
// return days + "天 " + hours + "小时 " + minutes + " 分钟" + seconds + " 秒"
return mon
}
// 日期转时间戳
export function js_strto_time(str_time) {
var str = str_time.replace(/-/g, '/') // 将-替换成/,因为下面这个构造函数只支持/分隔的日期字符串
var date = new Date(str) // 构造一个日期型数据,值为传入的字符串
return date.getTime()
}
// 时间戳转日期
export function timestampToTime(timestamp) {
var date = new Date(timestamp)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-'
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
var D = date.getDate() > 10 ? date.getDate() : '0' + date.getDate()
return Y + M + D
}
\ No newline at end of file
<template>
<!-- 编辑 -->
<dialogBox ref="addTask" width="60%" @submitForm="handleSubmit" :closed="true" @closeDialog="handleClose"
customClass="editValidRule" multiple title="新增定时任务">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="任务名" prop="job_name">
<el-input v-model="ruleForm.job_name" placeholder="任务名"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务分组" prop="job_group">
<el-input v-model="ruleForm.job_group" placeholder="任务分组"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="cron表达式" prop="cron_expression">
<el-input v-model="ruleForm.cron_expression" placeholder="cron表达式"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务类名" prop="bean_class">
<el-input v-model="ruleForm.bean_class" placeholder="任务执行时调用哪个类的方法 包名+类名"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="任务描述" prop="description">
<el-input v-model="ruleForm.description" placeholder="任务描述"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<message-tips :message="message" ref="msg" />
</dialogBox>
</template>
<script>
import system from '@/api/system.js'
export default {
props: {
taskData: {
type: Object,
default: null
}
},
data () {
return {
ruleForm: {
job_name: '',
job_group: '',
cron_expression: '',
bean_class: '',
description: ''
},
rules: {
job_name: [
{ required: true, message: '任务名', trigger: 'blur' }
],
job_group: [
{ required: true, message: '分组', trigger: 'blur' }
],
cron_expression: [
{ required: true, message: 'cron表达式', trigger: 'blur' }
],
bean_class: [
{ required: true, message: '任务类名', trigger: 'blur' }
],
description: [
{ required: true, message: '任务描述', trigger: 'blur' }
],
},
message: ''
}
},
methods: {
isShow () {
this.$refs.addTask.isShow()
setTimeout(() => {
if (this.taskData) {
this.ruleForm = _.cloneDeep(this.taskData)
}
}, 0)
},
handleSubmit () {
let _this = this
this.$refs['ruleForm'].validate(async (valid) => {
if (valid) {
if (!_this.taskData) {
try {
let res = await system.sjsbTaskSave(_this.ruleForm)
if (res.code == 200) {
_this.loading = false
_this.$message({
message: res.message,
type: 'success'
})
_this.handleClose()
_this.$parent.featchData()
}
} catch (error) {
_this.message = error
_this.$refs.msg.messageShow()
}
} else {
try {
let res = await system.updateCron(_this.ruleForm)
if (res.code == 200) {
_this.$message({
message: res.message,
type: 'success'
})
_this.handleClose()
_this.$parent.featchData()
}
} catch (error) {
_this.message = error
_this.$refs.msg.messageShow()
}
}
} else {
this.$message('请检查表单完整性')
return false;
}
})
},
handleClose () {
this.$refs.addTask.isHide()
this.$refs['ruleForm'].resetFields()
}
}
}
</script>
<style rel="stylesheet/less" lang="less" scoped>
</style>
<template>
<!-- 编辑 -->
<dialogBox ref="edit" width="60%" :closed="true" @closeDialog="handleClose" @submitForm="handleSubmit"
customClass="editDictionary" multiple title="字典信息">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="字典类型编码" prop="DCODE">
<el-input v-model.trim="ruleForm.DCODE" placeholder="字典类型编码"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="字典类型名称" prop="DNAME">
<el-input v-model.trim="ruleForm.DNAME" placeholder="字典类型名称"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="字典结构" prop="ISTREE">
<el-radio-group v-model="ruleForm.ISTREE">
<el-radio label="1">树形</el-radio>
<el-radio label="0">列表</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<lb-table :column="column" :heightNum="550" :key="key" :expand-row-keys="keyList" row-key="DICTID"
:tree-props="{ children: 'children' }" :pagination="false" :data="tableData">
</lb-table>
<message-tips :message="message" ref="msg" />
</dialogBox>
</template>
<script>
import dictionaries from '@/api/dictionaries'
import { getUuid } from '@/utils/tools'
export default {
props: {
dictList: Array,
dicData: Object
},
data () {
return {
key: 0,
message: '',
keyList: [],
ruleForm: {
DCODE: '',
DNAME: '',
ISTREE: '1'
},
column: [
{
width: '60',
renderHeader: (h, scope) => {
return <i class="el-icon-plus" onClick={() => { this.handleAdd() }} style="cursor:pointer;color:#409EFF">增加</i>
},
render: (h, scope) => {
return (
<span>{scope.row.index}</span>
)
}
},
{
prop: 'DCODE',
label: '字典项编码',
render: (h, scope) => {
return (
<div>
<el-input placeholder="字典项编码" v-show={scope.row.codeShow} v-fo value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.codeShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
<el-input placeholder="字典项编码" v-show={!scope.row.codeShow} value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.codeShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
</div>
)
}
},
{
prop: 'DNAME',
label: '字典项名称',
render: (h, scope) => {
return (
<div>
<el-input placeholder="字典项编码" v-show={scope.row.nameShow} v-fo value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
<el-input placeholder="字典项名称" v-show={!scope.row.nameShow} value={scope.row[scope.column.property]}
onFocus={() => { this.itemShowFalse(); scope.row.nameShow = true; }}
onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
</div>
)
}
},
{
width: '130px',
label: '移动',
render: (h, scope) => {
return (
<div>
<el-button type='text' disabled={scope.$index == 0} onClick={() => { this.moveUpward(scope.$index, scope.row) }}>上移</el-button>
<el-button type='text' disabled={(scope.$index + 1) == this.tableData.length} onClick={() => { this.moveDown(scope.$index, scope.row) }}>下移</el-button >
</div >
)
}
},
{
width: '150px',
label: '操作',
render: (h, scope) => {
return (
<div>
<el-button type="text" style="margin-right:10px" v-show={this.ruleForm.ISTREE == '1'} onClick={() => { this.handleAddSubordinate(scope.row) }}>增加下级</el-button>
<el-button type="text" style="margin-left:0" onClick={() => { this.handleMinus(scope.$index, scope.row) }}>删除</el-button>
</div>
)
}
}
],
tableData: [],
rules: {
DCODE: [
{ required: true, message: '字典类型编码', trigger: 'blur' }
],
}
}
},
methods: {
isShow () {
this.$refs.edit.isShow()
setTimeout(() => {
this.tableData = _.cloneDeep(this.dictList)
this.addIndexes()
let { DCODE, DNAME, ISTREE } = this.dicData
this.ruleForm = {
DCODE,
DNAME,
ISTREE
}
}, 0)
},
// 添加索引
addIndexes () {
this.tableData.forEach((item, index) => {
if (index == 0) {
item.codeShow = true
} else {
item.codeShow = false
item.nameShow = false
}
item.index = index + 1
})
},
itemShowFalse () {
this.tableData.forEach((item, index) => {
item.codeShow = false
item.nameShow = false
})
},
handleMinus (index, row) {
this.removeTreeListItem(this.tableData, row.DICTID)
},
removeTreeListItem (treeList, DICTID) {
if (!treeList || !treeList.length) {
return
}
for (let i = 0; i < treeList.length; i++) {
if (treeList[i].DICTID === DICTID) {
treeList.splice(i, 1);
break;
}
this.removeTreeListItem(treeList[i].children, DICTID)
}
},
async handleSubmit () {
let submitData = _.cloneDeep(this.tableData)
this.ruleForm.DICTID = this.dicData.DICTID
this.ruleForm.PARENTID = null
this.ruleForm.TYPEID = this.dicData.TYPEID
submitData.forEach((item) => {
item.ISTREE = this.ruleForm.ISTREE
})
submitData.unshift(this.ruleForm)
try {
let res = await dictionaries.editSysDict({ 'editDicts': submitData })
if (res.code == 200) {
this.$message({
message: res.message,
type: 'success'
})
this.handleClose()
this.$parent.featchData()
}
} catch (error) {
this.message = error
this.$refs.msg.messageShow()
}
},
handleClose () {
this.$refs['ruleForm'].resetFields();
this.$refs.edit.isHide()
},
// 增加下级
handleAddSubordinate (row) {
if (!row.children) {
row.children = []
}
row.children.push(
{
DCODE: '',
DNAME: '',
DICTID: getUuid(32),
TYPEID: row.TYPEID,
PARENTID: row.DICTID,
children: null,
ISTREE: this.ruleForm.ISTREE
}
)
this.keyList = [];
this.keyList.push(row.DICTID)
},
// 增加
handleAdd () {
this.$nextTick(() => {
let container = this.$el.querySelector('.el-table__body-wrapper');
container.scrollTop = container.scrollHeight;
})
this.tableData.push(
{
DCODE: '',
DNAME: '',
DICTID: getUuid(32),
TYPEID: this.dicData.TYPEID,
PARENTID: this.dicData.DICTID,
children: null,
ISTREE: this.ruleForm.ISTREE
}
)
this.addIndexes()
},
// 上移下移
moveUpward (index, row) {
if (index > 0) {
let upData = this.tableData[index - 1];
this.tableData.splice(index - 1, 1);
this.tableData.splice(index, 0, upData);
} else {
this.$message({
message: '已经是第一条,上移失败',
type: 'warning'
});
}
this.key++
},
moveDown (index, row) {
if ((index + 1) == this.tableData.length) {
this.$message({
message: '已经是最后一条,下移失败',
type: 'warning'
});
} else {
let downData = this.tableData[index + 1];
this.tableData.splice(index + 1, 1);
this.tableData.splice(index, 0, downData);
}
this.key++
}
}
}
</script>
<style rel="stylesheet/less" lang="less" scoped>
</style>
<template>
<!-- 编辑 -->
<dialogBox ref="validRule" width="60%" @submitForm="handleSubmit" :closed="true" @closeDialog="handleClose"
customClass="editValidRule" multiple title="上报效验规则设置">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="数据表名" prop="DATATABLE">
<el-input v-model="ruleForm.DATATABLE" placeholder="数据表名"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="中文名称" prop="CHINESETABLE">
<el-input v-model="ruleForm.CHINESETABLE" placeholder="中文名称"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="tab表头链接标识" prop="SOLEURL">
<el-input v-model="ruleForm.SOLEURL" placeholder="tab表头链接标识"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<lb-table :column="tableData.column" :heightNum="600" :pagination="false" :data="tableData.data">
</lb-table>
<message-tips :message="message" ref="msg" />
</dialogBox>
</template>
<script>
import ruleConfig from '@/api/ruleConfig'
export default {
props: {
ruleData: Object,
},
data () {
return {
message: '',
ruleForm: {
DATATABLE: '',
CHINESETABLE: '',
SOLEURL: ''
},
tableData: {
column: [
{
width: '60',
renderHeader: (h, scope) => {
return <i class="el-icon-plus" onClick={() => { this.handleAdd() }} style="cursor:pointer;color:#409EFF">增加</i>
},
render: (h, scope) => {
return (
<i class="el-icon-minus" onClick={() => { this.handleMinus(scope.$index, scope.row) }} style="cursor:pointer"></i>
)
}
},
{
prop: 'FIELD',
label: '字段名',
render: (h, scope) => {
return (
<el-input value={scope.row[scope.column.property]} onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
)
}
},
{
prop: 'CHINESENAME',
label: '中文名称',
render: (h, scope) => {
return (
<el-input value={scope.row[scope.column.property]} onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
)
}
},
// 是否必填
{
prop: 'REQUIRED',
label: '是否必填',
render: (h, scope) => {
return (
<el-checkbox v-model={scope.row[scope.column.property]} true-label={'1'} false-label={'0'}>必填</el-checkbox>
)
}
},
// 效验表达式
{
prop: 'EXPRESSION',
label: '效验表达式',
render: (h, scope) => {
return (
<el-select value={scope.row[scope.column.property]} clearable
onChange={(val) => { scope.row[scope.column.property] = val }}>
{
this.tagOptions.map(option => {
return (
<el-option label={option.label} value={option.value}></el-option>
)
})
}
</el-select>
)
}
},
{
prop: 'MESSAGE',
label: '提示信息',
render: (h, scope) => {
return (
<el-input placeholder="提示信息" value={scope.row[scope.column.property]} onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
)
}
}
],
data: []
},
tagOptions: [
{
label: '手机号',
value: '^[1][3,4,5,6,7,8,9][0-9]{9}$'
},
{
label: '身份证',
value: '^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$|^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$'
},
{
label: '军官证',
value: '^[\\u4E00-\\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$'
},
{
label: '护照',
value: '^([a-zA-z]|[0-9]){5,17}$'
},
{
label: '港澳身份证',
value: '^([A-Z]\\d{6,10}(\\(\\w{1}\\))?)$'
},
{
label: '台湾身份证',
value: '^\\d{8}|^[a-zA-Z0-9]{10}|^\\d{18}$'
},
{
label: '营业执照',
value: '(^(?:(?![IOZSV])[\\dA-Z]){2}\\d{6}(?:(?![IOZSV])[\\dA-Z]){10}$)|(^\\d{15}$)'
},
{
label: '户口簿',
value: '^\\d{9}$'
}
],
rules: {
DCODE: [
{ required: true, message: '字典类型编码', trigger: 'blur' }
],
}
}
},
methods: {
isShow () {
setTimeout(() => {
this.ruleForm = this.ruleData
this.tableData.data = this.ruleData.sysywsjbfieldlist
}, 0)
this.$refs.validRule.isShow()
},
handleEdit (scope) {
this.$set(scope.row, '_edit', true)
},
handleAdd () {
this.tableData.data.push({
field: '',
chinesename: '',
required: '1',
expression: null,
message: ''
})
},
handleMinus (index, row) {
this.tableData.data.splice(index, 1);
},
async handleSubmit () {
this.ruleForm.sysYwsjbFieldList = this.tableData.data
try {
let res = await ruleConfig.editSysYwsjbWithSysYwsjbField(this.ruleForm)
if (res.code == 200) {
this.$message({
message: res.message,
type: 'success'
})
this.handleClose()
this.$parent.featchData()
}
} catch (error) {
this.message = error
this.$refs.msg.messageShow()
}
},
handleClose () {
this.$refs['ruleForm'].resetFields();
this.$refs.validRule.isHide()
}
}
}
</script>
<style rel="stylesheet/less" lang="less" scoped>
</style>
import filter from '@/utils/filter.js'
class data extends filter {
constructor() {
super()
}
columns () {
return [
{
label: "序号",
prop: 'ROWNUM',
width: 60
},
{
prop: "DCODE",
label: "字典类型编码"
},
{
prop: "DNAME",
label: "字典类型名称"
},
{
label: "字典结构",
render: (h, scope) => {
return (
<div>
{scope.row.ISTREE == 1 ? '树形' : '列表'}
</div>
)
},
},
]
}
}
export default new data()
<template>
<div class="dictionary-config from-clues">
<div class="from-clues-header">
<el-form ref="form" :model="form" label-width="125px">
<el-row>
<el-col :span="5">
<el-form-item label="字典类型编码">
<el-input v-model="form.DCODE" placeholder="字典类型编码"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="字典类型名称">
<el-input v-model="form.DNAME" placeholder="字典类型名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="14" class="btnColRight">
<el-button @click="handleUpdateDic">刷新字典缓存</el-button>
<el-button type="primary" @click="handleSubmit">查询结果</el-button>
</el-col>
</el-row>
</el-form>
</div>
<div class="from-clues-content">
<lb-table :page-size="pageData.size" :current-page.sync="pageData.current" :total="pageData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
</lb-table>
<message-tips ref="msg" :message="message" />
</div>
<edit-dictionary ref="dictionary" :dictList="dictList" :dicData="dicRowData"></edit-dictionary>
</div>
</template>
<script>
// 字典
import data from "./data"
import dictionaries from '@/api/dictionaries'
import tableMixin from '@/mixins/tableMixin.js'
import editDictionary from '../components/editDictionary.vue'
export default {
name: "dictionary-config",
mixins: [tableMixin],
components: {
editDictionary
},
data () {
return {
message: '',
form: {
DCODE: '',
DNAME: '',
currentPage: 1
},
preContent: '',
tableData: {
columns: data.columns().concat([
{
label: "操作",
render: (h, scope) => {
return (
<div>
<el-button
type="text"
size="mini"
icon="el-icon-edit"
onClick={() => { this.handleEdit(scope.row) }}
>
编辑
</el-button>
</div>
);
},
}
]),
data: []
},
pageData: {
total: 0,
pageSize: 15,
current: 1,
},
dictList: [],
dicRowData: null
}
},
methods: {
async featchData () {
try {
this.form = Object.assign(this.form, this.formData)
let { result: { list, total, pages: pageSize, pageNum: current }
} = await dictionaries.getSysDictParent(this.form)
this.tableData.data = list
this.pageData = {
pageSize,
current,
total
}
} catch (error) {
this.message = error
this.$refs.msg.messageShow()
}
},
async handleEdit (row) {
this.dicRowData = row
try {
let { result: res } = await dictionaries.getSysDictByTypeId(row.TYPEID)
this.dictList = res
this.$refs.dictionary.isShow()
} catch (error) {
this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
}
},
// 更新字典
handleUpdateDic () {
this.$store.dispatch('dictionaries/generateDic').then((res) => {
if (res) {
this.$message({
message: '刷新成功!',
type: 'success'
});
}
})
}
}
}
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
@import "./index.scss";
</style>
import filter from '@/utils/filter.js'
class data extends filter {
constructor() {
super()
}
columns () {
return [
{
prop: "job_name",
label: "任务名称",
width: 130
},
{
prop: "description",
label: "任务描述",
width: 300
},
{
prop: "cron_expression",
label: "cron表达式"
},
{
prop: "bean_class",
width: 260,
label: "任务类"
},
{
prop: "job_group",
label: "任务分组"
},
{
label: "状态",
render: (h, scope) => {
return (
<div>
{ this.stateStatus(scope.row.job_status) }
</div>
)
},
}
]
}
}
export default new data()
<template>
<div class="timedTask from-clues">
<div class="from-clues-header">
<el-form ref="form" :model="form" label-width="80px">
<el-row>
<el-col :span="6">
<el-form-item label="搜索标题">
<el-input v-model="form.job_name" placeholder="请输入标题"></el-input>
</el-form-item>
</el-col>
<el-col :span="18" class="btnColRight">
<el-button type="primary" @click="handleSubmit">搜索</el-button>
<el-button type="primary" @click="handleAdd">新增</el-button>
</el-col>
</el-row>
</el-form>
</div>
<div class="from-clues-content">
<lb-table :page-size="pageData.size" :current-page.sync="pageData.current" :total="pageData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
</lb-table>
<add-task ref="task" :taskData="taskData" />
<message-tips ref="msg" :message="message" />
</div>
</div>
</template>
<script>
// 定时任务
import data from "./data"
import system from '@/api/system.js'
import tableMixin from '@/mixins/tableMixin.js'
import addTask from '../components/addTask.vue'
export default {
name: "timedTask",
mixins: [tableMixin],
components: {
addTask
},
data () {
return {
taskData: null,
form: {
job_name: '',
currentPage: 1
},
selectionList: [],
tableData: {
columns: [{
label: '序号',
type: 'index',
width: '50',
index: this.indexMethod,
}].concat(data.columns()).concat([
{
label: "操作",
width: 380,
render: (h, scope) => {
return (
<div>
<el-button type="text" size="mini" style="color: #67C23A"
v-show={scope.row.job_status !== '1' && scope.row.job_status !== '2'}
icon="el-icon-magic-stick"
onClick={() => { this.handleRecovery(scope.row) }}>激活
</el-button>
<el-button type="text" size="mini"
style="color: #67C23A;margin-left:0"
icon="el-icon-refresh-right"
v-show={scope.row.job_status === '2'}
onClick={() => { this.handleActivation(scope.row) }}>恢复
</el-button>
<el-button type="text" size="mini"
v-show={scope.row.job_status !== '1'}
icon="el-icon-stopwatch"
onClick={() => { this.handletest(scope.row) }}>手动测试
</el-button>
<el-button type="text" size="mini"
v-show={scope.row.job_status === '1'}
icon="el-icon-video-pause"
onClick={() => { this.handleSuspend(scope.row) }}>暂停
</el-button>
<el-button type="text" size="mini"
icon="el-icon-edit"
v-show={scope.row.job_status === '2' || scope.row.job_status === '-1' || scope.row.job_status === '0'}
onClick={() => { this.handleEdit(scope.row) }}>编辑
</el-button>
<el-button type="text" size="mini"
icon="el-icon-delete" style="color:#F56C6C"
v-show={scope.row.job_status !== '1'}
onClick={() => { this.handleDel(scope.row) }}>删除
</el-button>
</div>
);
},
},
]),
data: []
},
pageData: {
total: 0,
pageSize: 15,
current: 1,
},
}
},
methods: {
handleAdd () {
this.taskData = null
this.$refs.task.isShow()
},
async featchData () {
try {
this.form = Object.assign(this.form, this.formData)
let { result: { list, total, pages: pageSize, pageNum: current }
} = await system.getTaskListByName(this.form)
this.tableData.data = list
this.pageData = {
pageSize,
current,
total
}
} catch (error) {
this.message = error
this.$refs.msg.messageShow()
}
},
// 暂停
handleSuspend (row) {
this.$confirm('此操将进行暂停操作, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
system.pauseJob(row.id)
.then((res) => {
if ((res.code = 200)) {
this.$message({
type: 'success',
message: res.message,
})
this.featchData()
}
})
.catch((error) => {
this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消',
})
})
},
// 激活
handleRecovery (row) {
this.$confirm('此操将进行激活操作, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
system.activateJob(row.id)
.then((res) => {
if ((res.code = 200)) {
this.$message({
type: 'success',
message: res.message,
})
this.featchData()
}
})
.catch((error) => {
this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消',
})
})
},
// 恢复
handleActivation (row) {
this.$confirm('此操将进行恢复操作, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
system.resumeJob(row.id)
.then((res) => {
if ((res.code = 200)) {
this.$message({
type: 'success',
message: res.message,
})
this.featchData()
}
})
.catch((error) => {
this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消',
})
})
},
// 手动测试
handletest (row) {
this.$confirm('此操将进行手动测试, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
system.sjsbTaskRun(row.id)
.then((res) => {
if ((res.code = 200)) {
this.$alert(res.message, '提示', {
confirmButtonText: '确定',
type: 'success'
});
this.featchData()
}
})
.catch((error) => {
this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消',
})
})
},
handleEdit (row) {
this.taskData = row
this.$refs.task.isShow()
},
handleDel (row) {
this.$confirm('此操将进行删除操作, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
system.sjsbTaskRemove(row.id)
.then((res) => {
if ((res.code = 200)) {
this.$message({
type: 'success',
message: res.message,
})
this.featchData()
}
})
.catch((error) => {
this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消',
})
})
}
}
}
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/public.scss";
</style>
import filter from '@/utils/filter.js'
class data extends filter {
constructor() {
super()
}
columns () {
return [
{
prop: "DATATABLE",
label: "数据表名"
},
{
prop: "CHINESETABLE",
label: "中文名称"
},
{
prop: "SOLEURL",
label: "tab表头链接标识",
},
]
}
}
export default new data()
<template>
<div class="dictionary-config from-clues">
<div class="from-clues-header">
<el-form ref="form" :model="form" label-width="125px">
<el-row>
<el-col :span="6">
<el-form-item label="数据表名">
<el-input v-model="form.DATATABLE" placeholder="数据表名"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="中文名称">
<el-input v-model="form.CHINESETABLE" placeholder="中文名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="tab表头链接标识">
<el-input v-model="form.SOLEURL" placeholder="tab表头链接标识"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" class="btnColRight">
<el-button @click="handleUpdateDic">刷新规则缓存</el-button>
<el-button type="primary" @click="handleSubmit">查询结果</el-button>
</el-col>
</el-row>
</el-form>
</div>
<div class="from-clues-content">
<lb-table :page-size="pageData.size" :current-page.sync="pageData.current" :total="pageData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
</lb-table>
<message-tips ref="msg" :message="message" />
</div>
<edit-validRule ref="validRule" :ruleData="ruleData"></edit-validRule>
</div>
</template>
<script>
// 字典
import data from "./data"
import tableMixin from '@/mixins/tableMixin.js'
import ruleConfig from '@/api/ruleConfig'
import editValidRule from '../components/editValidRule.vue'
export default {
name: "dictionary-config",
mixins: [tableMixin],
components: {
editValidRule
},
data () {
return {
message: '',
form: {
DATATABLE: '',
CHINESETABLE: '',
SOLEURL: '',
currentPage: 1
},
preContent: '',
tableData: {
columns: [{
label: '序号',
type: 'index',
width: '50',
index: this.indexMethod,
}].concat(data.columns()).concat([
{
label: "操作",
render: (h, scope) => {
return (
<div>
<el-button
type="text"
size="mini"
icon="el-icon-edit"
onClick={() => { this.handleEdit(scope.$index, scope.row) }}
>
编辑
</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-delete"
style="color:#F56C6C"
onClick={() => { this.handleDel(scope.$index, scope.row) }}
>
删除
</el-button>
</div>
);
},
}
]),
data: []
},
pageData: {
total: 0,
pageSize: 15,
current: 1,
},
ruleData: null
}
},
methods: {
async featchData () {
try {
this.form = Object.assign(this.form, this.formData)
let { result: { list, total, pages: pageSize, pageNum: current }
} = await ruleConfig.getSysYwsjbList(this.form)
this.tableData.data = list
this.pageData = {
pageSize,
current,
total
}
} catch (error) {
this.message = error
this.$refs.msg.messageShow()
}
},
async handleEdit (index, row) {
try {
let { result: res } = await ruleConfig.eidtConfigRule(row.BSM_YWSJB)
this.ruleData = res
this.$refs.validRule.isShow()
} catch (error) {
this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
}
},
handleDel (index, row) {
let _this = this
this.$confirm('此操作将进行删除校验规则, 是否继续?', '提示', {
cancelButtonText: '取消',
confirmButtonText: '确定',
type: 'warning'
}).then(async () => {
try {
let res = await ruleConfig.deleteSysYwsjbWithSysYwsjbFieldByBsmYwsjb(row.BSM_YWSJB)
if (res.code == 200) {
_this.$message({
type: 'success',
message: '删除成功!'
});
_this.featchData()
}
} catch (error) {
_this.$alert(error, '提示', {
confirmButtonText: '确定',
type: 'error'
})
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
handleUpdateDic () {
this.$store.dispatch('dictionaries/generateDic').then((res) => {
if (res) {
this.$message({
message: '刷新成功!',
type: 'success'
})
}
})
}
}
}
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
@import "./index.scss";
</style>