review code.
This commit is contained in:
@@ -67,15 +67,15 @@
|
||||
<a-tag v-for="definedExtraKey in definedExtraKeys"
|
||||
color="arcoblue"
|
||||
:title="`添加参数 ${definedExtraKey}`"
|
||||
@click="addExtraParam(definedExtraKey)"
|
||||
@click="addExtraParam(definedExtraKey.name, definedExtraKey.type)"
|
||||
checkable
|
||||
checked>
|
||||
{{ definedExtraKey }}
|
||||
{{ definedExtraKey.name }}
|
||||
</a-tag>
|
||||
<!-- 添加参数 -->
|
||||
<a-button title="添加参数"
|
||||
style="width: 180px;"
|
||||
@click="addExtraParam(undefined)"
|
||||
@click="addExtraParam(undefined,undefined)"
|
||||
long>
|
||||
<icon-plus />
|
||||
</a-button>
|
||||
@@ -114,7 +114,7 @@
|
||||
return {
|
||||
id: undefined,
|
||||
keyName: undefined,
|
||||
valueType: ValueTypeEnum.STRING.value,
|
||||
valueType: ValueTypeEnum.INTEGER.value,
|
||||
extraSchema: undefined,
|
||||
description: undefined,
|
||||
};
|
||||
@@ -155,13 +155,13 @@
|
||||
defineExpose({ openAdd, openUpdate });
|
||||
|
||||
// 添加额外参数
|
||||
const addExtraParam = (name: string | undefined) => {
|
||||
const addExtraParam = (name: string | undefined, type: any) => {
|
||||
if (name && extraSchemaArr.value.findIndex(v => v.name === name) != -1) {
|
||||
return;
|
||||
}
|
||||
extraSchemaArr.value.push({
|
||||
name: name,
|
||||
type: ValueTypeEnum.STRING.value
|
||||
type: type || ValueTypeEnum.STRING.value
|
||||
});
|
||||
};
|
||||
|
||||
@@ -194,11 +194,11 @@
|
||||
return false;
|
||||
}
|
||||
// 不合法
|
||||
if (!new RegExp(/^[a-zA-Z0-9]{2,32}$/).test(extraSchema.name as string)) {
|
||||
if (!new RegExp(/^[a-zA-Z0-9_]{2,32}$/).test(extraSchema.name as string)) {
|
||||
formRef.value.setFields({
|
||||
[`extra${i + 1}`]: {
|
||||
status: 'error',
|
||||
message: '配置项需要为 2-32 位的数字以及字母'
|
||||
message: '配置项需要为 2-32 位的数字,字母或下滑线'
|
||||
}
|
||||
});
|
||||
return false;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<!-- 配置项 -->
|
||||
<template #keyName="{ record }">
|
||||
<span class="pointer" @click="copy(record.keyName)">
|
||||
<icon-copy class="span-blue" /> {{ record.keyName }}
|
||||
<icon-copy /> {{ record.keyName }}
|
||||
</span>
|
||||
</template>
|
||||
<!-- 配置值类型 -->
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<a-modal v-model:visible="visible"
|
||||
title-align="start"
|
||||
width="60%"
|
||||
:body-style="{padding: '16px 4px'}"
|
||||
:body-style="{padding: '16px 8px'}"
|
||||
:top="80"
|
||||
:title="title"
|
||||
:align-center="false"
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
import { ValueTypeEnum } from './enum.types';
|
||||
|
||||
/**
|
||||
* 快捷定义字段
|
||||
*/
|
||||
export const definedExtraKeys = ['status', 'type', 'color'];
|
||||
export const definedExtraKeys = [{
|
||||
name: 'status',
|
||||
type: ValueTypeEnum.STRING.value
|
||||
}, {
|
||||
name: 'type',
|
||||
type: ValueTypeEnum.STRING.value
|
||||
}, {
|
||||
name: 'color',
|
||||
type: ValueTypeEnum.COLOR.value
|
||||
}];
|
||||
|
||||
/**
|
||||
* 内置字段
|
||||
|
||||
@@ -4,8 +4,8 @@ export const keyName = [{
|
||||
required: true,
|
||||
message: '请输入配置项'
|
||||
}, {
|
||||
match: /^[a-zA-Z0-9]{2,32}$/,
|
||||
message: '配置项需要为 2-32 位的数字以及字母'
|
||||
match: /^[a-zA-Z0-9_]{2,32}$/,
|
||||
message: '配置项需要为 2-32 位的数字,字母或下滑线'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const valueType = [{
|
||||
|
||||
Reference in New Issue
Block a user