Compare commits
No commits in common. "104ad8372af6aae3ed246c0fc95455ca260ee3e0" and "d56b4e702abb19a8743ca33958a6fed9977a5e8c" have entirely different histories.
104ad8372a
...
d56b4e702a
|
|
@ -1,3 +1,4 @@
|
||||||
|
import Vue from "vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
import { Notification, MessageBox, Message } from "element-ui";
|
import { Notification, MessageBox, Message } from "element-ui";
|
||||||
|
|
@ -8,8 +9,8 @@ import "element-ui/lib/theme-chalk/index.css";
|
||||||
// 字体图标
|
// 字体图标
|
||||||
|
|
||||||
export function getBaseUrl(){
|
export function getBaseUrl(){
|
||||||
// return "http://gateway.mytwins.top"
|
return "http://gateway.mytwins.top"
|
||||||
return "http://192.168.101.8:8000"
|
// return "http://192.168.101.8:8000"
|
||||||
// return "http://localhost:8000"
|
// return "http://localhost:8000"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
<template>
|
||||||
|
<div :class="{'hidden':hidden}" class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
:background="background"
|
||||||
|
:current-page.sync="currentPage"
|
||||||
|
:page-size.sync="pageSize"
|
||||||
|
:layout="layout"
|
||||||
|
:page-sizes="pageSizes"
|
||||||
|
:total="total"
|
||||||
|
v-bind="$attrs"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Pagination',
|
||||||
|
props: {
|
||||||
|
total: {
|
||||||
|
required: true,
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: Number,
|
||||||
|
default: 20
|
||||||
|
},
|
||||||
|
pageSizes: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return [10, 20, 30, 50]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
layout: {
|
||||||
|
type: String,
|
||||||
|
default: 'total, sizes, prev, pager, next, jumper'
|
||||||
|
},
|
||||||
|
background: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
autoScroll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
hidden: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
currentPage: {
|
||||||
|
get() {
|
||||||
|
return this.page
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:page', val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pageSize: {
|
||||||
|
get() {
|
||||||
|
return this.limit
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:limit', val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.$emit('pagination', { page: this.currentPage, limit: val })
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.$emit('pagination', { page: val, limit: this.pageSize })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pagination-container {
|
||||||
|
background: #fff;
|
||||||
|
padding: 32px 16px;
|
||||||
|
}
|
||||||
|
.pagination-container.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<!-- @author Shiyn/ huangmx 20200807优化-->
|
||||||
|
<template>
|
||||||
|
<div class="top-right-btn">
|
||||||
|
<el-row>
|
||||||
|
<el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top">
|
||||||
|
<el-button size="mini" circle icon="el-icon-search" @click="toggleSearch()" />
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
|
||||||
|
<el-button size="mini" circle icon="el-icon-refresh" @click="refresh()" />
|
||||||
|
</el-tooltip>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "RightToolbar",
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
showSearch: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
//搜索
|
||||||
|
toggleSearch() {
|
||||||
|
this.$emit("update:showSearch", !this.showSearch);
|
||||||
|
},
|
||||||
|
//刷新
|
||||||
|
refresh() {
|
||||||
|
this.$emit("queryTable");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -26,6 +26,7 @@ Vue.use(Tip);
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
Vue.prototype.BASE_URL = 'http://' + (process.env.NODE_ENV === 'development-' ? "localhost" : "localhost");
|
||||||
|
|
||||||
Vue.prototype.$isNotEmpty = function (obj) {
|
Vue.prototype.$isNotEmpty = function (obj) {
|
||||||
return (obj !== undefined && obj !== null && obj !== '' && obj !== 'null')
|
return (obj !== undefined && obj !== null && obj !== '' && obj !== 'null')
|
||||||
|
|
@ -48,6 +49,13 @@ Vue.prototype.$deepCopy = function (obj) {
|
||||||
return JSON.parse(JSON.stringify(obj))
|
return JSON.parse(JSON.stringify(obj))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import Pagination from "@/components/Pagination";
|
||||||
|
//自定义表格工具扩展
|
||||||
|
import RightToolbar from "@/components/RightToolbar"
|
||||||
|
// 全局组件挂载
|
||||||
|
Vue.component('Pagination', Pagination)
|
||||||
|
Vue.component('RightToolbar', RightToolbar)
|
||||||
|
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
router,
|
router,
|
||||||
|
|
|
||||||
|
|
@ -258,14 +258,12 @@ export default {
|
||||||
}
|
}
|
||||||
console.log(JSON.stringify(this.setup.process))
|
console.log(JSON.stringify(this.setup.process))
|
||||||
addProcessDefinition(template).then(res => {
|
addProcessDefinition(template).then(res => {
|
||||||
if (res.code === 1000){
|
if (this.isNew){
|
||||||
if (this.isNew){
|
this.$message.success("更新表单成功")
|
||||||
this.$message.success("更新表单成功")
|
}else {
|
||||||
}else {
|
this.$message.success("创建表单成功")
|
||||||
this.$message.success("创建表单成功")
|
|
||||||
}
|
|
||||||
this.$router.push("/formsPanel")
|
|
||||||
}
|
}
|
||||||
|
this.$router.push("/formsPanel")
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$message.error(err)
|
this.$message.error(err)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
<span class="item-desc" v-else>👉 无论请求结果如何,均通过</span>
|
<span class="item-desc" v-else>👉 无论请求结果如何,均通过</span>
|
||||||
<div v-if="config.http.handlerByScript">
|
<div v-if="config.http.handlerByScript">
|
||||||
<div>
|
<div>
|
||||||
<el-button @click="requestTestHandler">测试</el-button>
|
<el-button @click="testHander">测试</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>请求成功😀:</span>
|
<span>请求成功😀:</span>
|
||||||
|
|
@ -161,57 +161,12 @@ export default {
|
||||||
delItem(items, index) {
|
delItem(items, index) {
|
||||||
items.splice(index, 1)
|
items.splice(index, 1)
|
||||||
},
|
},
|
||||||
//url规范性检查
|
testHander() {
|
||||||
restfulCheck(url) {
|
let http = this.config.http;
|
||||||
const httpProtocolPattern = /^http:/;
|
if (http.url == null || http.url === '') {
|
||||||
const httpsProtocolPattern = /^https:/;
|
this.$message.error("请填写请求路径!")
|
||||||
const restfulUrlPattern = /\/\w+\/\w+(\/\{[^}]+\})*/;
|
return
|
||||||
if (httpProtocolPattern.test(url) || httpsProtocolPattern.test(url)) {
|
|
||||||
return restfulUrlPattern.test(url);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
//是否含有动态参数
|
|
||||||
hasUrlParams(url) {
|
|
||||||
const pattern = /{[^{}]+}/g;
|
|
||||||
let match;
|
|
||||||
while ((match = pattern.exec(url)) !== null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
//获取到动态参数的名称
|
|
||||||
getDynamicParamNames(url) {
|
|
||||||
const pattern = /{([^{}]+)}/g;
|
|
||||||
let match;
|
|
||||||
const paramNames = [];
|
|
||||||
while ((match = pattern.exec(url)) !== null) {
|
|
||||||
if (match[0].startsWith('{') && match[0].endsWith('}')) {
|
|
||||||
const paramName = match[1];
|
|
||||||
paramNames.push(paramName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return paramNames;
|
|
||||||
},
|
|
||||||
//替换rul动态参数
|
|
||||||
replaceDynamicParams(url, params) {
|
|
||||||
const dynamicParamPattern = /{\s*(\w+)\s*}/g;
|
|
||||||
return url.replace(dynamicParamPattern, (match, param) => {
|
|
||||||
return params[param] || '0';
|
|
||||||
});
|
|
||||||
},
|
|
||||||
//获取到参数值
|
|
||||||
getParamsValue(params, paramName) {
|
|
||||||
for (let param of params) {
|
|
||||||
if (param.name === paramName) {
|
|
||||||
return param.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
//设置头部
|
|
||||||
setHeaders(http) {
|
|
||||||
let headers = {}
|
let headers = {}
|
||||||
for (let header of http.headers) {
|
for (let header of http.headers) {
|
||||||
if (header.isField) {
|
if (header.isField) {
|
||||||
|
|
@ -227,99 +182,15 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$set(headers, "Content-Type", "application/json")
|
this.$set(headers, "Content-Type", "application/json")
|
||||||
}
|
}
|
||||||
return headers;
|
|
||||||
},
|
|
||||||
//设置post和put参数
|
|
||||||
setPostAndPutParams(http) {
|
|
||||||
let params = {}
|
|
||||||
for (let param of http.params) {
|
|
||||||
params[param.name] = param.value
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
},
|
|
||||||
//设置get和delete的参数
|
|
||||||
setGetAndDeleteParams(http) {
|
|
||||||
let dynamicParams = []
|
|
||||||
let url = http.url
|
|
||||||
let hasParams = this.hasUrlParams(url)
|
|
||||||
if (hasParams) {
|
|
||||||
dynamicParams = this.getDynamicParamNames(url);
|
|
||||||
let replaceParams = {}
|
|
||||||
for (let paramsName of dynamicParams) {
|
|
||||||
let value = this.getParamsValue(http.params, paramsName)
|
|
||||||
if (null == value) {
|
|
||||||
this.$message.error(paramsName + '参数未设置')
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
replaceParams[paramsName] = value
|
|
||||||
}
|
|
||||||
url = this.replaceDynamicParams(url, replaceParams);
|
|
||||||
}
|
|
||||||
if (http.method === "DELETE") {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
let getParams = []
|
|
||||||
for (let param of http.params) {
|
|
||||||
if (dynamicParams.indexOf(param.name) === -1 && param.name !== '' && param.value !== '') {
|
|
||||||
getParams.push(param.name + "=" + param.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getParams.length > 0) {
|
|
||||||
url += "?"
|
|
||||||
for (let i = 0; i < getParams.length; i++) {
|
|
||||||
if (i !== getParams.length-1) {
|
|
||||||
url += getParams[i] + "&";
|
|
||||||
} else {
|
|
||||||
url += getParams[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
},
|
|
||||||
//请求测试
|
|
||||||
requestTestHandler() {
|
|
||||||
let http = this.config.http;
|
|
||||||
if (http.url == null || http.url === '') {
|
|
||||||
this.$message.error("请填写请求路径!")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!this.restfulCheck(http.url)) {
|
|
||||||
this.$message.error("当前只支持 RESTful URL!")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let headers = this.setHeaders(http)
|
|
||||||
let request
|
|
||||||
switch (http.method) {
|
|
||||||
case "GET":
|
|
||||||
case "DELETE":
|
|
||||||
let url = this.setGetAndDeleteParams(http)
|
|
||||||
if (null == url) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
request = axios.request({
|
|
||||||
method: http.method,
|
|
||||||
url: url,
|
|
||||||
headers: headers,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "POST":
|
|
||||||
case "PUT":
|
|
||||||
request = axios.request({
|
|
||||||
method: http.method,
|
|
||||||
url: http.url,
|
|
||||||
headers: headers,
|
|
||||||
data: this.setPostAndPutParams(http)
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
console.log("==================[测试打印内容]==================")
|
console.log("==================[测试打印内容]==================")
|
||||||
request.then(res => {
|
axios.request({
|
||||||
|
method: http.method,
|
||||||
|
url: http.url,
|
||||||
|
headers: headers
|
||||||
|
}).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
let data = res.data
|
let data = res.data
|
||||||
console.log(data)
|
|
||||||
let successFun = eval("(false ||" + http.success + ")");
|
let successFun = eval("(false ||" + http.success + ")");
|
||||||
let result = successFun(data);
|
let result = successFun(data);
|
||||||
console.log(result, "成功函数执行的返回结果")
|
console.log(result, "成功函数执行的返回结果")
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,6 @@ export default {
|
||||||
this.showError = true
|
this.showError = true
|
||||||
this.errorInfo = '请设置WEBHOOK的URL地址'
|
this.errorInfo = '请设置WEBHOOK的URL地址'
|
||||||
}
|
}
|
||||||
if (this.restfulCheck(this.config.props.http.url)){
|
|
||||||
this.showError = false
|
|
||||||
}else {
|
|
||||||
this.showError = true
|
|
||||||
this.errorInfo = 'WEBHOOK的URL地址不符合RESTful标准'
|
|
||||||
}
|
|
||||||
}else if(this.config.props.type === 'EMAIL'){
|
}else if(this.config.props.type === 'EMAIL'){
|
||||||
if(!this.$isNotEmpty(this.config.props.email.subject)
|
if(!this.$isNotEmpty(this.config.props.email.subject)
|
||||||
|| this.config.props.email.to.length === 0
|
|| this.config.props.email.to.length === 0
|
||||||
|
|
@ -73,18 +67,7 @@ export default {
|
||||||
err.push(`${this.config.name} 触发动作未设置完善`)
|
err.push(`${this.config.name} 触发动作未设置完善`)
|
||||||
}
|
}
|
||||||
return !this.showError
|
return !this.showError
|
||||||
},
|
}
|
||||||
//url规范性检查
|
|
||||||
restfulCheck(url) {
|
|
||||||
const httpProtocolPattern = /^http:/;
|
|
||||||
const httpsProtocolPattern = /^https:/;
|
|
||||||
const restfulUrlPattern = /\/\w+\/\w+(\/\{[^}]+\})*/;
|
|
||||||
if (httpProtocolPattern.test(url) || httpsProtocolPattern.test(url)) {
|
|
||||||
return restfulUrlPattern.test(url);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue