Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lfj/config #22

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/admin/common/Others/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,4 @@ export default class extends Vue {
::v-deep .el-form-item__label {
width: 100px;
}

</style>
6 changes: 5 additions & 1 deletion src/admin/common/Others/Divider/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ export default class extends Vue {
@Prop({ required: true }) state!: DividerState;
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.el-divider--horizontal {
min-width: 600px;
}
</style>
1 change: 0 additions & 1 deletion src/admin/common/Others/Tooltip/TooltipState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ export default interface TooltipState {
enterable: boolean; // 鼠标是否可进入到 tooltip 中 Boolean — true
hideAfter: number; // Tooltip 出现后自动隐藏延时,单位毫秒,为 0 则不会自动隐藏 number — 0
tabindex: number; // Tooltip 组件的 tabindex number — 0
btn:string;
}
9 changes: 6 additions & 3 deletions src/admin/common/Others/Tooltip/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@
:hide-after="state.hideAfter"
:tabindex="state.tabindex"
>
<el-button>{{ state.btn }}</el-button>
<AdminComponent :state="state" />
</el-tooltip>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import TooltipState from './TooltipState'

import AdminComponent from '@/admin/common/AdminComponent/index.vue'
@Component({
name: 'Tooltip'
name: 'Tooltip',
components: {
AdminComponent
}
})
export default class extends Vue {
@Prop({ required: true }) state!: TooltipState;
Expand Down
188 changes: 96 additions & 92 deletions src/arkfbp/index.ts
Original file line number Diff line number Diff line change
@@ -1,95 +1,99 @@
import { runWorkflowByClass } from 'arkfbp/lib/flow'
import { Loading } from 'element-ui'
import Filter from '@/utils/filter'
import { runWorkflowByClass } from "arkfbp/lib/flow";
import { Loading } from "element-ui";
import Filter from "@/utils/filter";

const flows = require.context('@/flows', true, /index\.ts$/)
const arkfbpFlows = require.context('@/arkfbp/flows', true, /index\.ts$/)
const flows = require.context("@/flows", true, /index\.ts$/);
const arkfbpFlows = require.context("@/arkfbp/flows", true, /index\.ts$/);

function getUrl(url: string, data: any, state: any) {
if (url.indexOf('<') !== -1) {
const property = url.slice(url.indexOf('<') + 1, url.lastIndexOf('>'))
if (url.indexOf("<") !== -1) {
const property = url.slice(url.indexOf("<") + 1, url.lastIndexOf(">"));
return (
url.slice(0, url.indexOf('<')) + data[property] + url.slice(url.indexOf('>') + 1)
)
url.slice(0, url.indexOf("<")) +
data[property] +
url.slice(url.indexOf(">") + 1)
);
}
if (url.indexOf('[') !== -1) {
const urlParams = url.slice(url.indexOf('[') + 1, url.lastIndexOf(']'))
let tempState = state
let tempParams: any
urlParams.split('.').forEach((v: string) => {
tempState = tempState[v]
tempParams = tempState
})
if (url.indexOf("[") !== -1) {
const urlParams = url.slice(url.indexOf("[") + 1, url.lastIndexOf("]"));
let tempState = state;
let tempParams: any;
urlParams.split(".").forEach((v: string) => {
tempState = tempState[v];
tempParams = tempState;
});
return (
url.slice(0, url.indexOf('[')) + tempParams + url.slice(url.indexOf(']') + 1)
)
url.slice(0, url.indexOf("[")) +
tempParams +
url.slice(url.indexOf("]") + 1)
);
}
return url
return url;
}

export function runFlowByFile(flowPath: string, inputs: any) {
let flow: any = {}
let flow: any = {};

if (flowPath.includes('arkfbp')) {
flow = arkfbpFlows(flowPath.replace('arkfbp/flows', '.') + '/index.ts')
if (flowPath.includes("arkfbp")) {
flow = arkfbpFlows(flowPath.replace("arkfbp/flows", ".") + "/index.ts");
} else {
flow = flows(flowPath.replace('flows', '.') + '/index.ts')
flow = flows(flowPath.replace("flows", ".") + "/index.ts");
}

return runWorkflowByClass(flow.Main, inputs)
return runWorkflowByClass(flow.Main, inputs);
}

export async function runAction(action: { flow: string, inputs: any }) {
export async function runAction(action: { flow: string; inputs: any }) {
if (!action.flow) {
return
return;
}
const loading = Loading.service({ fullscreen: true })
const flow = action.flow.split('.').join('/')
const outputs = await runFlowByFile(flow, action.inputs)
loading.close()
return outputs
const loading = Loading.service({ fullscreen: true });
const flow = action.flow.split(".").join("/");
const outputs = await runFlowByFile(flow, action.inputs);
loading.close();
return outputs;
}

export async function runFlow(state: any, flow: any, data: any) {
if (flow.type === 'assign') {
if (flow.type === "assign") {
await runAction({
flow: flow.name,
inputs: {
client: state,
clientServer: flow.client_config
}
})
});

return
return;
}

if (flow.type === 'api') {
let params: any = {}
if (typeof flow.request === 'string') {
let temp = state
flow.request.split('.').forEach((v: string) => {
temp = temp[v]
params = temp
})
if (flow.type === "api") {
let params: any = {};
if (typeof flow.request === "string") {
let temp = state;
flow.request.split(".").forEach((v: string) => {
temp = temp[v];
params = temp;
});
}

if (typeof flow.request === 'object') {
if (typeof flow.request === "object") {
Object.keys(flow.request).forEach(key => {
let temp = state
const vs = flow.request[key].split('.')
let temp = state;
const vs = flow.request[key].split(".");
vs.forEach((v: string) => {
if (v.includes('items[prop=')) {
const res = Filter(v, temp)
temp = temp['items'][res]
} else if (v.includes('columns[prop=')) {
const res = Filter(v, temp)
temp = temp['cloumns'][res]
if (v.includes("items[prop=")) {
const res = Filter(v, temp);
temp = temp["items"][res];
} else if (v.includes("columns[prop=")) {
const res = Filter(v, temp);
temp = temp["cloumns"][res];
} else {
temp = temp[v]
temp = temp[v];
}
})
params[key] = temp
})
});
params[key] = temp;
});
}

await runAction({
Expand All @@ -101,37 +105,37 @@ export async function runFlow(state: any, flow: any, data: any) {
client: state,
clientServer: flow.client_config
}
})
return
});
return;
}

if (flow.type === 'client') {
let params: any = {}
if (typeof flow.client_config === 'string') {
let temp = state
flow.request.split('.').forEach((v: string) => {
temp = temp[v]
params = temp
})
if (flow.type === "client") {
let params: any = {};
if (typeof flow.client_config === "string") {
let temp = state;
flow.request.split(".").forEach((v: string) => {
temp = temp[v];
params = temp;
});
}

if (typeof flow.request === 'object') {
if (typeof flow.request === "object") {
Object.keys(flow.request).forEach(key => {
let temp = state
const vs = flow.request[key].split('.')
let temp = state;
const vs = flow.request[key].split(".");
vs.forEach((v: string) => {
if (v.includes('items[prop=')) {
const res = Filter(v, temp)
temp = temp['items'][res]
} else if (v.includes('columns[prop=')) {
const res = Filter(v, temp)
temp = temp['cloumns'][res]
if (v.includes("items[prop=")) {
const res = Filter(v, temp);
temp = temp["items"][res];
} else if (v.includes("columns[prop=")) {
const res = Filter(v, temp);
temp = temp["cloumns"][res];
} else {
temp = temp[v]
temp = temp[v];
}
})
params[key] = temp
})
});
params[key] = temp;
});
}

await runAction({
Expand All @@ -144,23 +148,23 @@ export async function runFlow(state: any, flow: any, data: any) {
client: state,
clientServer: flow.client_config
}
})
return
});
return;
}

let params = state
let params = state;
if (flow.request) {
flow.request.split('.').forEach((v: string) => {
if (v.includes('items[prop=')) {
const res = Filter(v, params)
params = params['items'][res]
} else if (v.includes('columns[prop=')) {
const res = Filter(v, params)
params = params['cloumns'][res]
flow.request.split(".").forEach((v: string) => {
if (v.includes("items[prop=")) {
const res = Filter(v, params);
params = params["items"][res];
} else if (v.includes("columns[prop=")) {
const res = Filter(v, params);
params = params["cloumns"][res];
} else {
params = params[v]
params = params[v];
}
})
});
}

await runAction({
Expand All @@ -169,5 +173,5 @@ export async function runFlow(state: any, flow: any, data: any) {
params: params,
client: data
}
})
});
}
Loading