fix:修改数据源
This commit is contained in:
parent
f6f99efe2b
commit
2d0fc7117a
|
@ -67,6 +67,14 @@
|
||||||
</j-upload>
|
</j-upload>
|
||||||
</template>
|
</template>
|
||||||
</j-input>
|
</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
|
<j-input
|
||||||
v-else
|
v-else
|
||||||
allowClear
|
allowClear
|
||||||
|
@ -148,7 +156,7 @@ const componentsType = ref<ITypes>({
|
||||||
double: 'inputNumber',
|
double: 'inputNumber',
|
||||||
string: 'input',
|
string: 'input',
|
||||||
array: 'input',
|
array: 'input',
|
||||||
password: 'input',
|
password: 'password',
|
||||||
enum: 'select',
|
enum: 'select',
|
||||||
boolean: 'select',
|
boolean: 'select',
|
||||||
date: 'date',
|
date: 'date',
|
||||||
|
|
|
@ -123,7 +123,6 @@ export const EventEmitter = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isActionChange = (_metadata: any, _message: any) => {
|
export const isActionChange = (_metadata: any, _message: any) => {
|
||||||
console.log(_metadata, _message)
|
|
||||||
const _properties = _metadata?.properties || [];
|
const _properties = _metadata?.properties || [];
|
||||||
const _functions = _metadata?.functions || [];
|
const _functions = _metadata?.functions || [];
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<j-input
|
<j-input
|
||||||
:disabled="record.scale !== undefined"
|
:disabled="record.old_id"
|
||||||
v-model:value="record.name"
|
v-model:value="record.name"
|
||||||
placeholder="请输入名称"
|
placeholder="请输入名称"
|
||||||
/>
|
/>
|
||||||
|
@ -104,12 +104,10 @@
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'precision'">
|
<template v-else-if="column.key === 'scale'">
|
||||||
<j-form-item
|
<j-form-item :name="['data', index, 'scale']">
|
||||||
:name="['data', index, 'precision']"
|
|
||||||
>
|
|
||||||
<j-input-number
|
<j-input-number
|
||||||
v-model:value="record.precision"
|
v-model:value="record.scale"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="99999"
|
:max="99999"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
|
@ -117,7 +115,15 @@
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'notnull'">
|
<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
|
<j-radio-group
|
||||||
v-model:value="record.notnull"
|
v-model:value="record.notnull"
|
||||||
button-style="solid"
|
button-style="solid"
|
||||||
|
@ -132,7 +138,7 @@
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'comment'">
|
<template v-else-if="column.key === 'comment'">
|
||||||
<j-form-item :name="['data', index, 'notnull']">
|
<j-form-item :name="['data', index, 'comment']">
|
||||||
<j-input
|
<j-input
|
||||||
v-model:value="record.comment"
|
v-model:value="record.comment"
|
||||||
placeholder="请输入说明"
|
placeholder="请输入说明"
|
||||||
|
@ -147,7 +153,8 @@
|
||||||
:danger="true"
|
:danger="true"
|
||||||
:popConfirm="{
|
:popConfirm="{
|
||||||
title: `确认删除`,
|
title: `确认删除`,
|
||||||
onConfirm: () => clickDel(record, index),
|
onConfirm: () =>
|
||||||
|
clickDel(record, index),
|
||||||
}"
|
}"
|
||||||
:disabled="record.status"
|
:disabled="record.status"
|
||||||
>
|
>
|
||||||
|
@ -217,6 +224,7 @@ import {
|
||||||
delSaveRow_api,
|
delSaveRow_api,
|
||||||
} from '@/api/system/dataSource';
|
} from '@/api/system/dataSource';
|
||||||
import { onlyMessage } from '@/utils/comm';
|
import { onlyMessage } from '@/utils/comm';
|
||||||
|
import { randomString } from '@/utils/utils';
|
||||||
import { FormInstance, message } from 'ant-design-vue';
|
import { FormInstance, message } from 'ant-design-vue';
|
||||||
import { DataNode } from 'ant-design-vue/lib/tree';
|
import { DataNode } from 'ant-design-vue/lib/tree';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
@ -243,13 +251,14 @@ const columns = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '精度',
|
title: '精度',
|
||||||
dataIndex: 'precision',
|
dataIndex: 'scale',
|
||||||
key: 'precision',
|
key: 'scale',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '不能为空',
|
title: '不能为空',
|
||||||
dataIndex: 'notnull',
|
dataIndex: 'notnull',
|
||||||
key: 'notnull',
|
key: 'notnull',
|
||||||
|
width: 130
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '说明',
|
title: '说明',
|
||||||
|
@ -287,6 +296,7 @@ const queryTables = (key: string) => {
|
||||||
rdbTables_api(id, key).then((resp: any) => {
|
rdbTables_api(id, key).then((resp: any) => {
|
||||||
table.data = resp.result.columns.map(
|
table.data = resp.result.columns.map(
|
||||||
(item: object, index: number) => ({
|
(item: object, index: number) => ({
|
||||||
|
old_id: randomString(),
|
||||||
...item,
|
...item,
|
||||||
index,
|
index,
|
||||||
}),
|
}),
|
||||||
|
@ -348,7 +358,7 @@ const table = reactive({
|
||||||
|
|
||||||
const addRow = () => {
|
const addRow = () => {
|
||||||
const initData: dbColumnType = {
|
const initData: dbColumnType = {
|
||||||
precision: 0,
|
scale: 0,
|
||||||
length: 0,
|
length: 0,
|
||||||
notnull: false,
|
notnull: false,
|
||||||
type: '',
|
type: '',
|
||||||
|
@ -363,19 +373,22 @@ const clickDel = (row: any, index: number) => {
|
||||||
delSaveRow_api(id, leftData.selectedKeys[0], [row.name]).then(
|
delSaveRow_api(id, leftData.selectedKeys[0], [row.name]).then(
|
||||||
(resp: any) => {
|
(resp: any) => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
table.data.splice(index, 1)
|
table.data.splice(index, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
table.data.splice(index, 1)
|
table.data.splice(index, 1);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickSave = () => {
|
const clickSave = () => {
|
||||||
formRef.value.validate().then((_data: any) => {
|
formRef.value.validate().then((_data: any) => {
|
||||||
const columns = cloneDeep(table.data);
|
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) {
|
if (!columns.length) {
|
||||||
onlyMessage('请配置数据源字段', 'error');
|
onlyMessage('请配置数据源字段', 'error');
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -29,7 +29,7 @@ export type dbColumnType = {
|
||||||
previousName?: string,
|
previousName?: string,
|
||||||
type: String,
|
type: String,
|
||||||
length: number,
|
length: number,
|
||||||
precision: number,
|
scale: number,
|
||||||
notnull: boolean,
|
notnull: boolean,
|
||||||
comment: string,
|
comment: string,
|
||||||
name: string,
|
name: string,
|
||||||
|
|
|
@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
|
||||||
|
|
||||||
jetlinks-ui-components@^1.0.5:
|
jetlinks-ui-components@^1.0.5:
|
||||||
version "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"
|
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#8cbd59900e692dd931d289f3d5a6f4541485fd9f"
|
||||||
integrity sha512-+1a/4nA5RCiInRFyyaVCMEWSBzNU8lzxOYTTpY0GiNhuJuhGE5AbBsVp9CXXF0lFECK2iqaAElY+QN4Wjms1Dw==
|
integrity sha512-ytX39qMt3kkEisURoIKlv2rAhGSvI74/WLLqkP6dJdz4q1k3UpANDtcnrz9rGRwTAKszVQ6kCga6VL6kGJiteQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@vueuse/core" "^9.12.0"
|
"@vueuse/core" "^9.12.0"
|
||||||
ant-design-vue "^3.2.15"
|
ant-design-vue "^3.2.15"
|
||||||
|
|
Loading…
Reference in New Issue