fix: 字段管理新增一个字段

This commit is contained in:
sy2084 2024-07-24 20:27:13 +08:00
parent da56c2438b
commit 15160e4d18
3 changed files with 24 additions and 3 deletions

View File

@ -79,6 +79,19 @@
{{ record.is_search ? "是" : "否" }}
</template>
</template>
<template v-if="column.dataIndex === 'original_type'">
<a-select
v-if="editableData[record.field_id]"
placeholder="请选择"
v-model:value="record.original_type"
:options="originalTypes"
allow-clear
>
</a-select>
<template v-else>
{{ record.original_type_name }}
</template>
</template>
<template v-if="column.dataIndex === 'action'">
<a-space v-if="editableData[record.field_id]">
<a-button type="primary" size="small" @click="handleSave(record)"
@ -108,7 +121,7 @@
<script setup>
import { onMounted, reactive, ref, watch } from "vue";
import { viewCfgCols } from "@/views/config-manage/module-cfg/config";
import { viewCfgCols, originalTypes } from "@/views/config-manage/module-cfg/config";
import {
getFieldTypeSelect,
getFieldNumSelect,
@ -201,6 +214,7 @@ const addField = () => {
is_search: 0,
field_type_id: undefined,
belong_to_table: undefined,
original_type: undefined,
original_sql: undefined,
sort: 0,
};
@ -236,6 +250,7 @@ const handleSave = (record) => {
{ field: 'field_name', msg: "请填写字段名称" },
{ field: 'field_numerical_type_id', msg: "请选择字段类型" },
{ field: 'belong_to_table', msg: "请填写关联表" },
{ field: 'original_type', msg: '请选择数据源类型' },
{ field: 'original_sql', msg: "请填写sql数据源" },
]
for(let i = 0; i < validateFields.length; i++) {

View File

@ -16,6 +16,12 @@ export const viewCfgCols = [
{ dataIndex: 'is_search', title: '是否可搜索', align: 'center'},
{ dataIndex: 'sort', title: '排序', align: 'center'},
{ dataIndex: 'belong_to_table', title: '所属表名称', align: 'center'},
{ dataIndex: 'original_sql', title: 'sql数据源', align: 'center'},
{ dataIndex: 'original_type', title: '数据源类型', align: 'center'},
{ dataIndex: 'original_sql', title: '数据源', align: 'center', width: 400},
{ dataIndex: 'action', title: '操作', align: 'center'},
];
export const originalTypes = [
{ label: 'sql', value: 1 },
{ label: 'json', value: 2 },
]

View File

@ -3,7 +3,7 @@
<div class="project">
<span>项目: </span>
<a-select
style="min-width: 120px"
style="min-width: 160px"
placeholder="请选择项目"
v-model:value="projectVal"
:options="projectOptions"