Files
vermouth789 fe39320977 123
123
2026-01-11 00:11:34 +08:00

94 lines
3.0 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
let axios_config = require("./config")
import {ZeroCodeAxios} from "@/request/request"
const components = {}
const data = function () {
return {
scan_form: {
ip: "",
port: ""
},
tableData: [],
columns: []
}
}
function mounted() {
}
const methods = {
get_config_data(config_data) {
console.log(config_data)
// 执行转译data
let new_data = {
"interaction_name": config_data["interaction_name"],
"return_data": config_data["return_data"],
"submit_data": {
"interaction_source_name": config_data["submit_data"]["interaction_source_name"],
"interaction_source_uuid": config_data["submit_data"]["interaction_source_uuid"],
"interaction_object_type": config_data["submit_data"]["interaction_object_type"],
"interaction_style": config_data["submit_data"]["interaction_style"],
"target_table": config_data["submit_data"]["target_table"],
"target_api_url": config_data["submit_data"]["target_api_url"],
"target_api_ID": config_data["submit_data"]["target_api_ID"],
}
}
let re = this.format_data(config_data["submit_data"]["data"])
new_data["submit_data"]["data"] = re
return new_data
},
format_data(dict) {
if (typeof dict == "string") {
dict = eval(dict)
} else {
for (const key in dict) {
let value = dict[key]
if (typeof value == "object") {
this.format_data(value)
} else {
if (typeof value == 'number') {
dict[key] = value
} else {
if (value.includes("this.")) {
if (dict.hasOwnProperty(key)) {
dict[key] = eval(value)
}
} else {
if (value.includes(".")) {
if (dict.hasOwnProperty(key)) {
dict[key] = eval(value)
}
} else {
dict[key] = value
}
}
}
}
}
}
return dict
},
submit_scan() {
const {url, method, data: originalData, then} = axios_config.submit_scan.axios;
const data = JSON.parse(JSON.stringify(originalData));
let new_data = this.get_config_data(data)
// 发起请求
ZeroCodeAxios({
method,
url,
data: new_data,
}).then(res => {
// 执行回调函数then回调
eval(then)
})
}
}
export default {
data: data,
methods: methods,
mounted: mounted,
components: components,
}