Commit 931c7144 authored by shaoan123's avatar shaoan123

对接表字段的附加表接口

parent 42e0676c
Pipeline #28038 skipped with stages
......@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, Checkbox, Divider, notification, Row } from 'antd';
import {
createTable, loadTableFields
createTable, loadTableFields, addFields
} from '@/services/platform/bs'
import styles from './index.less'
......@@ -19,6 +19,7 @@ const editor = props => {
const [indeterminate, setIndeterminate] = useState(true);
const [isVisible, setIsVisible] = useState(true);
const [checkAll, setCheckAll] = useState(false);
const [chartName, setChartName] = useState('');//附加表名称
const onChange = list => {
setCheckedList(list);
......@@ -50,6 +51,7 @@ const editor = props => {
description: '建表成功',
});
setIsVisible(false)
setChartName(res.data.tableInfo.Name)
loadTableFields({ tableName: res.data.tableInfo.Name }).then(response => {
if (response.data.root.length) {
let arr = [], newArr = []
......@@ -93,14 +95,39 @@ const editor = props => {
}, [visible]);
const handleOk = () => {
form.resetFields();
callBackSubmit();
console.log();
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
if (chartName != '') {
addFields({
tableName: chartName,
fieldNames: checkedList.join(',')
}).then(res => {
if (res.msg === "Ok") {
notification.success({
message: '提示',
duration: 1,
description: '附加字段添加成功',
});
setIsModalVisible(false)
form.resetFields();
callBackSubmit();
}
else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
}).catch(err => {
console.log('err', err);
})
}
else{
notification.success({
message: '提示',
duration: 1,
description: '表名称没添加',
});
}
}
const handleCancel = () => {
setIsModalVisible(false)
......
......@@ -6,6 +6,7 @@ import {
} from '@/services/platform/bs'
import styles from './index.less'
const CheckboxGroup = Checkbox.Group;
import qs from 'qs';
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, visible, tableList } = props;
......@@ -33,14 +34,17 @@ const AddModal = props => {
const onSubmit = () => {
let fieldNames = [];
(checkedList || []).map(item => {
fieldNames.push({fieldNames:item})
fieldNames.push({ fieldNames: item })
})
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
console.log({ tableName: obj.tableName, alias: obj.tableAlias || '', fieldNames:checkedList });
addTables({ tableName: obj.tableName, alias: obj.tableAlias || '', fieldNames:checkedList }).then(res => {
let params = { tableName: obj.tableName, alias: obj.tableAlias || '', fieldNames: checkedList }
console.log(checkedList,'checkedList');
addTables({ tableName: obj.tableName, alias: obj.tableAlias || '', fieldNames: checkedList.join(',')}).then(res => {
setLoading(false);
if (res.msg === "Ok") {
form.resetFields();
......@@ -55,7 +59,7 @@ const AddModal = props => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
description: res.msg,
});
}
})
......
......@@ -25,4 +25,8 @@ export const loadUnattachedTables = () =>
//7.附加表
export const addTables = (param) =>
get(`${PUBLISH_SERVICE}/CaseManage/AddTables`,param);
\ No newline at end of file
get(`${PUBLISH_SERVICE}/CaseManage/AddTables`,param);
//8.添加表字段
export const addFields = (param) =>
get(`${PUBLISH_SERVICE}/CaseManage/AddFields`,param);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment