fix:修改数据源

This commit is contained in:
100011797 2023-03-31 22:59:48 +08:00
parent f6f99efe2b
commit 2d0fc7117a
5 changed files with 42 additions and 22 deletions

View File

@ -67,6 +67,14 @@
</j-upload>
</template>
</j-input>
<j-input
v-else-if="typeMap.get(itemType) === 'password'"
allowClear
type="password"
v-model:value="myValue"
style="width: 100%"
@change='inputChange'
/>
<j-input
v-else
allowClear
@ -148,7 +156,7 @@ const componentsType = ref<ITypes>({
double: 'inputNumber',
string: 'input',
array: 'input',
password: 'input',
password: 'password',
enum: 'select',
boolean: 'select',
date: 'date',

View File

@ -123,7 +123,6 @@ export const EventEmitter = {
}
export const isActionChange = (_metadata: any, _message: any) => {
console.log(_metadata, _message)
const _properties = _metadata?.properties || [];
const _functions = _metadata?.functions || [];
if (

View File

@ -68,7 +68,7 @@
]"
>
<j-input
:disabled="record.scale !== undefined"
:disabled="record.old_id"
v-model:value="record.name"
placeholder="请输入名称"
/>
@ -104,12 +104,10 @@
/>
</j-form-item>
</template>
<template v-else-if="column.key === 'precision'">
<j-form-item
:name="['data', index, 'precision']"
>
<template v-else-if="column.key === 'scale'">
<j-form-item :name="['data', index, 'scale']">
<j-input-number
v-model:value="record.precision"
v-model:value="record.scale"
:min="0"
:max="99999"
style="width: 100%"
@ -117,7 +115,15 @@
</j-form-item>
</template>
<template v-else-if="column.key === 'notnull'">
<j-form-item :name="['data', index, 'notnull']">
<j-form-item
:name="['data', index, 'notnull']"
:rules="[
{
required: true,
message: '请选择是否不能为空',
},
]"
>
<j-radio-group
v-model:value="record.notnull"
button-style="solid"
@ -132,7 +138,7 @@
</j-form-item>
</template>
<template v-else-if="column.key === 'comment'">
<j-form-item :name="['data', index, 'notnull']">
<j-form-item :name="['data', index, 'comment']">
<j-input
v-model:value="record.comment"
placeholder="请输入说明"
@ -147,7 +153,8 @@
:danger="true"
:popConfirm="{
title: `确认删除`,
onConfirm: () => clickDel(record, index),
onConfirm: () =>
clickDel(record, index),
}"
:disabled="record.status"
>
@ -174,7 +181,7 @@
<j-form-item
label="名称"
name="name"
:required="true"
:required="true"
:rules="[
{
required: true,
@ -217,6 +224,7 @@ import {
delSaveRow_api,
} from '@/api/system/dataSource';
import { onlyMessage } from '@/utils/comm';
import { randomString } from '@/utils/utils';
import { FormInstance, message } from 'ant-design-vue';
import { DataNode } from 'ant-design-vue/lib/tree';
import _ from 'lodash';
@ -243,13 +251,14 @@ const columns = [
},
{
title: '精度',
dataIndex: 'precision',
key: 'precision',
dataIndex: 'scale',
key: 'scale',
},
{
title: '不能为空',
dataIndex: 'notnull',
key: 'notnull',
width: 130
},
{
title: '说明',
@ -287,6 +296,7 @@ const queryTables = (key: string) => {
rdbTables_api(id, key).then((resp: any) => {
table.data = resp.result.columns.map(
(item: object, index: number) => ({
old_id: randomString(),
...item,
index,
}),
@ -348,7 +358,7 @@ const table = reactive({
const addRow = () => {
const initData: dbColumnType = {
precision: 0,
scale: 0,
length: 0,
notnull: false,
type: '',
@ -363,19 +373,22 @@ const clickDel = (row: any, index: number) => {
delSaveRow_api(id, leftData.selectedKeys[0], [row.name]).then(
(resp: any) => {
if (resp.status === 200) {
table.data.splice(index, 1)
table.data.splice(index, 1);
}
},
);
} else {
table.data.splice(index, 1)
};
table.data.splice(index, 1);
}
};
const clickSave = () => {
formRef.value.validate().then((_data: any) => {
const columns = cloneDeep(table.data);
columns.forEach((item) => delete item.index);
columns.forEach((item: any) => {
delete item?.old_id
delete item?.index
});
if (!columns.length) {
onlyMessage('请配置数据源字段', 'error');
return;

View File

@ -29,7 +29,7 @@ export type dbColumnType = {
previousName?: string,
type: String,
length: number,
precision: number,
scale: number,
notnull: boolean,
comment: string,
name: string,

View File

@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
jetlinks-ui-components@^1.0.5:
version "1.0.5"
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#c71ecae61776bff738f43efe46aac7264f092736"
integrity sha512-+1a/4nA5RCiInRFyyaVCMEWSBzNU8lzxOYTTpY0GiNhuJuhGE5AbBsVp9CXXF0lFECK2iqaAElY+QN4Wjms1Dw==
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#8cbd59900e692dd931d289f3d5a6f4541485fd9f"
integrity sha512-ytX39qMt3kkEisURoIKlv2rAhGSvI74/WLLqkP6dJdz4q1k3UpANDtcnrz9rGRwTAKszVQ6kCga6VL6kGJiteQ==
dependencies:
"@vueuse/core" "^9.12.0"
ant-design-vue "^3.2.15"