fix: MML必填初始值的设置
This commit is contained in:
@@ -64,6 +64,22 @@ let state: StateType = reactive({
|
|||||||
function fnTreeSelect(_: any, info: any) {
|
function fnTreeSelect(_: any, info: any) {
|
||||||
state.mmlSelect = info.node.dataRef;
|
state.mmlSelect = info.node.dataRef;
|
||||||
state.from = {};
|
state.from = {};
|
||||||
|
// 遍历判断是否有初始value
|
||||||
|
if (Array.isArray(state.mmlSelect.param)) {
|
||||||
|
for (const param of state.mmlSelect.param) {
|
||||||
|
if (typeof param.value !== 'undefined' && param.value != '') {
|
||||||
|
const valueType = param.type;
|
||||||
|
if (['enum', 'int'].includes(valueType)) {
|
||||||
|
state.from[param.name] = Number(param.value);
|
||||||
|
} else if (valueType === 'bool') {
|
||||||
|
state.from[param.name] = Boolean(param.value);
|
||||||
|
} else {
|
||||||
|
state.from[param.name] = param.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
state.autoCompleteValue =
|
state.autoCompleteValue =
|
||||||
`${state.mmlSelect.operation} ${state.mmlSelect.object}`.trim();
|
`${state.mmlSelect.operation} ${state.mmlSelect.object}`.trim();
|
||||||
// state.mmlCmdLog = '';
|
// state.mmlCmdLog = '';
|
||||||
@@ -569,7 +585,7 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<a-form
|
<a-form
|
||||||
layout="vertical"
|
layout="horizontal"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:validate-on-rule-change="false"
|
:validate-on-rule-change="false"
|
||||||
:validateTrigger="[]"
|
:validateTrigger="[]"
|
||||||
@@ -587,8 +603,15 @@ onMounted(() => {
|
|||||||
<a-textarea :placeholder="t('common.ipnutPlease')" auto-size />
|
<a-textarea :placeholder="t('common.ipnutPlease')" auto-size />
|
||||||
</a-auto-complete>
|
</a-auto-complete>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
|
||||||
<template v-if="state.mmlSelect.operation && state.mmlSelect.param">
|
<template v-if="state.mmlSelect.operation && state.mmlSelect.param">
|
||||||
|
<a-form
|
||||||
|
layout="vertical"
|
||||||
|
autocomplete="off"
|
||||||
|
:validate-on-rule-change="false"
|
||||||
|
:validateTrigger="[]"
|
||||||
|
>
|
||||||
<a-divider orientation="left">
|
<a-divider orientation="left">
|
||||||
{{ t('views.mmlManage.cmdParamPanel') }}
|
{{ t('views.mmlManage.cmdParamPanel') }}
|
||||||
</a-divider>
|
</a-divider>
|
||||||
@@ -664,8 +687,8 @@ onMounted(() => {
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</template>
|
</a-form>
|
||||||
</a-form>
|
</template>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 命令展示 -->
|
<!-- 命令展示 -->
|
||||||
|
|||||||
@@ -60,6 +60,22 @@ let state: StateType = reactive({
|
|||||||
function fnTreeSelect(_: any, info: any) {
|
function fnTreeSelect(_: any, info: any) {
|
||||||
state.mmlSelect = info.node.dataRef;
|
state.mmlSelect = info.node.dataRef;
|
||||||
state.from = {};
|
state.from = {};
|
||||||
|
// 遍历判断是否有初始value
|
||||||
|
if (Array.isArray(state.mmlSelect.param)) {
|
||||||
|
for (const param of state.mmlSelect.param) {
|
||||||
|
if (typeof param.value !== 'undefined' && param.value != '') {
|
||||||
|
const valueType = param.type;
|
||||||
|
if (['enum', 'int'].includes(valueType)) {
|
||||||
|
state.from[param.name] = Number(param.value);
|
||||||
|
} else if (valueType === 'bool') {
|
||||||
|
state.from[param.name] = Boolean(param.value);
|
||||||
|
} else {
|
||||||
|
state.from[param.name] = param.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
state.autoCompleteValue =
|
state.autoCompleteValue =
|
||||||
`${state.mmlSelect.operation} ${state.mmlSelect.object}`.trim();
|
`${state.mmlSelect.operation} ${state.mmlSelect.object}`.trim();
|
||||||
// state.mmlCmdLog = '';
|
// state.mmlCmdLog = '';
|
||||||
@@ -537,7 +553,7 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<a-form
|
<a-form
|
||||||
layout="vertical"
|
layout="horizontal"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:validate-on-rule-change="false"
|
:validate-on-rule-change="false"
|
||||||
:validateTrigger="[]"
|
:validateTrigger="[]"
|
||||||
@@ -555,8 +571,15 @@ onMounted(() => {
|
|||||||
<a-textarea :placeholder="t('common.ipnutPlease')" auto-size />
|
<a-textarea :placeholder="t('common.ipnutPlease')" auto-size />
|
||||||
</a-auto-complete>
|
</a-auto-complete>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
|
||||||
<template v-if="state.mmlSelect.operation && state.mmlSelect.param">
|
<template v-if="state.mmlSelect.operation && state.mmlSelect.param">
|
||||||
|
<a-form
|
||||||
|
layout="vertical"
|
||||||
|
autocomplete="off"
|
||||||
|
:validate-on-rule-change="false"
|
||||||
|
:validateTrigger="[]"
|
||||||
|
>
|
||||||
<a-divider orientation="left">
|
<a-divider orientation="left">
|
||||||
{{ t('views.mmlManage.cmdParamPanel') }}
|
{{ t('views.mmlManage.cmdParamPanel') }}
|
||||||
</a-divider>
|
</a-divider>
|
||||||
@@ -632,8 +655,8 @@ onMounted(() => {
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</template>
|
</a-form>
|
||||||
</a-form>
|
</template>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 命令展示 -->
|
<!-- 命令展示 -->
|
||||||
|
|||||||
@@ -60,6 +60,22 @@ let state: StateType = reactive({
|
|||||||
function fnTreeSelect(_: any, info: any) {
|
function fnTreeSelect(_: any, info: any) {
|
||||||
state.mmlSelect = info.node.dataRef;
|
state.mmlSelect = info.node.dataRef;
|
||||||
state.from = {};
|
state.from = {};
|
||||||
|
// 遍历判断是否有初始value
|
||||||
|
if (Array.isArray(state.mmlSelect.param)) {
|
||||||
|
for (const param of state.mmlSelect.param) {
|
||||||
|
if (typeof param.value !== 'undefined' && param.value != '') {
|
||||||
|
const valueType = param.type;
|
||||||
|
if (['enum', 'int'].includes(valueType)) {
|
||||||
|
state.from[param.name] = Number(param.value);
|
||||||
|
} else if (valueType === 'bool') {
|
||||||
|
state.from[param.name] = Boolean(param.value);
|
||||||
|
} else {
|
||||||
|
state.from[param.name] = param.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
state.autoCompleteValue =
|
state.autoCompleteValue =
|
||||||
`${state.mmlSelect.operation} ${state.mmlSelect.object}`.trim();
|
`${state.mmlSelect.operation} ${state.mmlSelect.object}`.trim();
|
||||||
// state.mmlCmdLog = '';
|
// state.mmlCmdLog = '';
|
||||||
@@ -542,7 +558,7 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<a-form
|
<a-form
|
||||||
layout="vertical"
|
layout="horizontal"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:validate-on-rule-change="false"
|
:validate-on-rule-change="false"
|
||||||
:validateTrigger="[]"
|
:validateTrigger="[]"
|
||||||
@@ -560,8 +576,15 @@ onMounted(() => {
|
|||||||
<a-textarea :placeholder="t('common.ipnutPlease')" auto-size />
|
<a-textarea :placeholder="t('common.ipnutPlease')" auto-size />
|
||||||
</a-auto-complete>
|
</a-auto-complete>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
|
||||||
<template v-if="state.mmlSelect.operation && state.mmlSelect.param">
|
<template v-if="state.mmlSelect.operation && state.mmlSelect.param">
|
||||||
|
<a-form
|
||||||
|
layout="vertical"
|
||||||
|
autocomplete="off"
|
||||||
|
:validate-on-rule-change="false"
|
||||||
|
:validateTrigger="[]"
|
||||||
|
>
|
||||||
<a-divider orientation="left">
|
<a-divider orientation="left">
|
||||||
{{ t('views.mmlManage.cmdParamPanel') }}
|
{{ t('views.mmlManage.cmdParamPanel') }}
|
||||||
</a-divider>
|
</a-divider>
|
||||||
@@ -637,8 +660,8 @@ onMounted(() => {
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</template>
|
</a-form>
|
||||||
</a-form>
|
</template>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 命令展示 -->
|
<!-- 命令展示 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user