Commit e664230b authored by 冷冷's avatar 冷冷

添加新特性。 图形化路由控制

parent 3af91219
......@@ -19,45 +19,22 @@ import request from '@/router/axios'
export function fetchList(query) {
return request({
url: '/admin/route/page',
url: '/route',
method: 'get',
params: query
})
}
export function addObj(obj) {
return request({
url: '/admin/route/',
method: 'post',
data: obj
})
}
export function getObj(id) {
return request({
url: '/admin/route/' + id,
method: 'get'
})
}
export function delObj(id) {
return request({
url: '/admin/route/' + id,
method: 'delete'
})
}
export function putObj(obj) {
return request({
url: '/admin/route',
url: '/route',
method: 'put',
data: obj
})
}
export function applyObj() {
export function fallback(obj) {
return request({
url: '/admin/route/apply',
method: 'get'
url: '/route/fallback',
method: 'get',
data: obj
})
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
import request from '@/router/axios'
export function fetchList(query) {
return request({
url: '/admin/token/page',
method: 'get',
params: query
})
}
export function delObj(id) {
return request({
url: '/admin/token/' + id,
method: 'delete'
})
}
......@@ -3,7 +3,7 @@
const env = process.env
let baseUrl = '';
// 图表库为avue和pig2套地址
let iconfontVersion = ['667895_5lt01cjobo7', '567566_qo5lxgtishg']
let iconfontVersion = ['667895_4y8d30c1og', '567566_qo5lxgtishg']
let iconfontUrl = `//at.alicdn.com/t/font_$key.css`;
let codeUrl = `/code`
let actUrl = `${window.origin}/act/modeler.html?modelId=`;
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
const DIC = {
vaild: [{
label: '否',
value: 'false'
}, {
label: '是',
value: 'true'
}]
}
export const tableOption = {
'border': true,
'index': true,
'indexLabel': '序号',
'stripe': true,
'menuAlign': 'center',
'align': 'center',
'addBtn': false,
'editBtn': false,
'delBtn': false,
'dic': [],
'column': [{
label: '令牌',
prop: 'token_value',
align: 'center'
}, {
label: '用户ID',
prop: 'user_id',
align: 'center'
}, {
label: '用户名',
prop: 'user_name',
align: 'center'
}, {
label: '类型',
prop: 'token_type',
align: 'center'
}, {
label: '过期时间',
prop: 'expires_in',
align: 'center'
}, {
label: '客户端',
prop: 'client_id',
align: 'center'
}, {
label: '授权类型',
prop: 'grant_type',
align: 'center'
}]
}
......@@ -84,6 +84,8 @@
},
methods: {
getList() {
this.listQuery.orderByField = 'create_time'
this.listQuery.isAsc = false
this.tableLoading = true
fetchList(this.listQuery).then(response => {
this.tableData = response.data.records
......
<!--
- Copyright (c) 2018-2025, lengleng All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- Neither the name of the pig4cloud.com developer nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
- Author: lengleng (wangiegie@gmail.com)
-->
<template>
<div class="app-container pull-auto">
<basic-container>
<vue-json-editor v-model="json" :show-btns="false"></vue-json-editor>
<div align="center">
<el-button @click="edit()">更新</el-button>
<el-button type="warning" @click="fallback()">回滚</el-button>
</div>
</basic-container>
</div>
</template>
<script>
import vueJsonEditor from 'vue-json-editor'
import {fetchList, putObj,fallback} from '@/api/route'
export default {
data () {
return {
json: null
}
},
// 注入vueJsonEditor组件
components: {
vueJsonEditor
},
created () {
this.getList()
},
methods: {
getList () {
fetchList().then(response => {
this.json = response.data
console.log(this.json)
})
},
fallback (){
fallback(this.json).then(response => {
this.$notify({
title: '成功',
message: '回滚成功',
type: 'success',
duration: 2000
})
})
},
edit (){
putObj(this.json).then(response => {
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
})
},
}
}
</script>
<!--
- Copyright (c) 2018-2025, lengleng All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- Neither the name of the pig4cloud.com developer nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
- Author: lengleng (wangiegie@gmail.com)
-->
<template>
<div class="app-container pull-auto">
<basic-container>
<avue-crud ref="crud"
:page="page"
:data="tableData"
:table-loading="tableLoading"
:option="tableOption"
@current-change="currentChange"
@refresh-change="refreshChange"
@size-change="sizeChange"
@row-del="rowDel">
<template slot-scope="scope"
slot="menu">
<el-button type="danger"
v-if="permissions.sys_client_del"
icon="el-icon-delete"
size="mini"
plain
@click="handleDel(scope.row,scope.index)">删除</el-button>
</template>
</avue-crud>
</basic-container>
</div>
</template>
<script>
import { fetchList, delObj } from '@/api/token'
import { tableOption } from '@/const/crud/token'
import { mapGetters } from 'vuex'
export default {
name: 'token',
data() {
return {
tableData: [],
page: {
total: 0, // 总页数
currentPage: 1, // 当前页数
pageSize: 20 // 每页显示多少条
},
tableLoading: false,
tableOption: tableOption
}
},
created() {
this.getList()
},
mounted: function() { },
computed: {
...mapGetters(['permissions'])
},
methods: {
getList() {
this.tableLoading = true
fetchList({
page: this.page.currentPage,
limit: this.page.pageSize
}).then(response => {
this.tableData = response.data.records
this.page.total = response.data.total
this.tableLoading = false
})
},
currentChange(val) {
this.page.currentPage = val
this.getList()
},
sizeChange(val) {
this.page.pageSize = val
this.getList()
},
handleDel(row, index) {
this.$refs.crud.rowDel(row, index)
},
rowDel: function(row, index) {
var _this = this
this.$confirm('是否确认删除ID为' + row.token_value, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function() {
return delObj(row.token_value)
})
.then(data => {
_this.tableData.splice(index, 1)
_this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
})
.catch(function(err) { })
},
/**
* 刷新回调
*/
refreshChange() {
this.getList()
}
}
}
</script>
<style lang="scss" scoped>
</style>
......@@ -36,6 +36,13 @@ module.exports = {
'^/code': '/code'
}
},
'/route': {
target: url,
ws: true,
pathRewrite: {
'^/route': '/route'
}
},
'/gen': {
target: url,
ws: true,
......
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