import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import { is, fromJS } from 'immutable'
|
import { DndProvider } from 'react-dnd'
|
import HTML5Backend from 'react-dnd-html5-backend'
|
import { Button, Card, Modal, Collapse, notification, Select, List, Icon } from 'antd'
|
import DragElement from './dragelement'
|
import SourceElement from './dragelement/source'
|
import Api from '@/api'
|
// import SearchForm from './searchform'
|
// import ActionForm from './actionform'
|
// import ColumnForm from './columnform'
|
import SettingForm from './settingform'
|
// import EditCard from './editcard'
|
import MenuForm from './menuform'
|
import zhCN from '@/locales/zh-CN/comtable.js'
|
import enUS from '@/locales/en-US/comtable.js'
|
import Utils from '@/utils/utils.js'
|
import Source from './source'
|
import './index.scss'
|
|
const { Panel } = Collapse
|
const { Option } = Select
|
const { confirm } = Modal
|
const CommonDict = (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS
|
|
class ComTableConfig extends Component {
|
static propTpyes = {
|
menu: PropTypes.any,
|
editAction: PropTypes.object,
|
handleConfig: PropTypes.func
|
}
|
|
state = {
|
operaType: '', // 操作类型,新建或编辑
|
dict: CommonDict, // 字典
|
config: null, // 页面配置
|
visible: false, // 搜索条件、按钮、显示列,模态框显示控制
|
tableVisible: false, // 数据表字段模态框
|
addType: '', // 添加类型-搜索条件或显示列
|
tableColumns: [], // 表格显示列
|
fields: null, // 搜索条件及显示列,可选字段
|
modalformlist: null, // 基本信息表单字段
|
formlist: null, // 搜索条件、按钮、显示列表单字段
|
formtemp: '', // 表单类型,显示列、按钮、搜索条件
|
card: null, // 编辑元素
|
searchloading: false, // 搜索条件加载中
|
actionloading: false, // 按钮加载中
|
columnsloading: false, // 显示列加载中
|
menuloading: false, // 菜单保存中
|
settingVisible: false, // 全局配置模态框
|
closeVisible: false, // 关闭模态框
|
tables: [], // 可用表名
|
selectedTables: [], // 已选表名
|
originMenu: null // 原始菜单
|
}
|
|
UNSAFE_componentWillMount () {
|
const {menu, editAction} = this.props
|
|
let _config = JSON.parse(JSON.stringify((Source.baseConfig)))
|
|
this.setState({
|
config: _config,
|
selectedTables: _config.tables || [],
|
modalformlist: [
|
{
|
type: 'text',
|
key: 'supMenu',
|
label: this.state.dict['header.menu.supMenu'],
|
initVal: menu.MenuName,
|
required: true,
|
readonly: true,
|
},
|
{
|
type: 'text',
|
key: 'btnName',
|
label: '按钮名称',
|
initVal: editAction.label,
|
required: true,
|
readonly: true
|
},
|
{
|
type: 'text',
|
key: 'menuNo',
|
label: this.state.dict['header.menu.menuNo'],
|
initVal: menu.MenuNo,
|
required: true,
|
readonly: true
|
},
|
{
|
type: 'text',
|
key: 'opentype',
|
label: this.state.dict['header.menu.openType'],
|
initVal: '弹窗(表单)',
|
required: true,
|
readonly: true
|
}
|
]
|
})
|
}
|
|
componentDidMount () {
|
let _text = 'select TbName ,Remark from sDataDictionary where IsKey!=\'\' and Deleted =0'
|
_text = Utils.formatOptions(_text)
|
|
Api.getSystemConfig({func: 'sPC_Get_SelectedList', LText: _text, obj_name: 'data', arr_field: 'TbName,Remark'}).then(res => {
|
if (res.status) {
|
this.setState({
|
tables: res.data
|
})
|
} else {
|
notification.warning({
|
top: 92,
|
message: res.message,
|
duration: 10
|
})
|
}
|
})
|
|
let deffers = this.state.selectedTables.map(item => {
|
return new Promise(resolve => {
|
Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: item.TbName}).then(res => {
|
res.TBName = item.TbName
|
resolve(res)
|
})
|
})
|
})
|
Promise.all(deffers).then(response => {
|
let _columns = []
|
response.forEach(res => {
|
if (res.status) {
|
let tabmsg = {
|
tableName: res.TBName,
|
columns: res.FDName.map(item => {
|
let _type = item.FieldType.toLowerCase()
|
let _decimal = 0
|
if (/^nvarchar/.test(_type)) {
|
_type = 'text'
|
} else if (/^int/.test(_type)) {
|
_type = 'number'
|
} else if (/^decimal/.test(_type)) {
|
_decimal = _type.split(',')[1]
|
_decimal = parseInt(_decimal)
|
if (_decimal > 4) {
|
_decimal = 4
|
}
|
_type = 'number'
|
} else if (/^decimal/.test(_type)) {
|
_decimal = _type.split(',')[1]
|
_decimal = parseInt(_decimal)
|
if (_decimal > 4) {
|
_decimal = 4
|
}
|
_type = 'number'
|
} else if (/^datetime/.test(_type)) {
|
_type = 'datetime'
|
} else if (/^date/.test(_type)) {
|
_type = 'date'
|
} else {
|
_type = 'text'
|
}
|
|
return {
|
field: item.FieldName,
|
label: item.FieldDec,
|
type: _type,
|
decimal: _decimal
|
}
|
})
|
}
|
_columns.push(tabmsg)
|
} else {
|
notification.warning({
|
top: 92,
|
message: res.message,
|
duration: 10
|
})
|
}
|
})
|
|
this.setState({
|
tableColumns: _columns
|
})
|
})
|
}
|
|
handleList = (listObj) => {
|
let config = this.state.config
|
if (this.state.operaType === 'add') {
|
let key = Object.keys(listObj)[0]
|
let newlength = listObj[key].length
|
if (newlength > config[key].length) {
|
listObj[key] = listObj[key].filter(item => !item.origin)
|
}
|
if (newlength > listObj[key].length) {
|
this.setState({
|
[key + 'loading']: true,
|
config: {...config, ...listObj}
|
})
|
setTimeout(() => {
|
this.setState({
|
[key + 'loading']: false
|
})
|
}, 100)
|
} else {
|
this.setState({config: {...config, ...listObj}})
|
}
|
} else {
|
this.setState({config: {...config, ...listObj}})
|
}
|
}
|
|
handleSearch = (card) => {
|
this.setState({
|
visible: true,
|
formtemp: 'search',
|
card: card,
|
formlist: [
|
{
|
type: 'text',
|
key: 'label',
|
label: this.state.dict['header.form.name'],
|
initVal: card.label,
|
required: true,
|
readonly: false
|
},
|
{
|
type: 'text',
|
key: 'field',
|
label: this.state.dict['header.form.field'],
|
initVal: card.field,
|
required: true,
|
readonly: false
|
},
|
{
|
type: 'text',
|
key: 'initval',
|
label: this.state.dict['header.form.initval'],
|
initVal: card.initval,
|
required: false
|
},
|
{
|
type: 'select',
|
key: 'type',
|
label: this.state.dict['header.form.type'],
|
initVal: card.type,
|
required: true,
|
options: [{
|
MenuID: 'text',
|
text: this.state.dict['header.form.text']
|
}, {
|
MenuID: 'select',
|
text: this.state.dict['header.form.select']
|
}, {
|
MenuID: 'link',
|
text: this.state.dict['header.form.link']
|
}, {
|
MenuID: 'date',
|
text: this.state.dict['header.form.dateday']
|
}, {
|
MenuID: 'datetime',
|
text: this.state.dict['header.form.datetime']
|
}]
|
},
|
{
|
type: 'radio',
|
key: 'resourceType',
|
label: this.state.dict['header.form.resourceType'],
|
initVal: card.resourceType || '0',
|
required: true,
|
options: [{
|
MenuID: '0',
|
text: this.state.dict['header.form.custom']
|
}, {
|
MenuID: '1',
|
text: this.state.dict['header.form.datasource']
|
}]
|
},
|
{
|
type: 'radio',
|
key: 'setAll',
|
label: this.state.dict['header.form.setAll'],
|
initVal: card.setAll || 'false',
|
options: [{
|
MenuID: 'true',
|
text: this.state.dict['header.form.true']
|
}, {
|
MenuID: 'false',
|
text: this.state.dict['header.form.false']
|
}]
|
},
|
{
|
type: 'textarea',
|
key: 'dataSource',
|
label: this.state.dict['header.form.datasource'],
|
initVal: card.dataSource || '',
|
required: true,
|
readonly: false
|
},
|
{
|
type: 'options',
|
key: 'options',
|
label: '',
|
initVal: card.options || [],
|
required: true,
|
readonly: false
|
},
|
{
|
type: 'text',
|
key: 'linkField',
|
label: this.state.dict['header.form.linkField'],
|
initVal: card.linkField || '',
|
required: true,
|
readonly: false
|
},
|
{
|
type: 'text',
|
key: 'valueField',
|
label: this.state.dict['header.form.valueField'],
|
initVal: card.valueField || '',
|
required: true,
|
readonly: false
|
},
|
{
|
type: 'text',
|
key: 'valueText',
|
label: this.state.dict['header.form.valueText'],
|
initVal: card.valueText || '',
|
required: true,
|
readonly: false
|
},
|
{
|
type: 'text',
|
key: 'orderBy',
|
label: this.state.dict['header.form.orderBy'],
|
initVal: card.orderBy || '',
|
required: false,
|
readonly: false
|
},
|
{
|
type: 'select',
|
key: 'orderType',
|
label: this.state.dict['header.form.orderType'],
|
initVal: card.orderType || 'asc',
|
options: [{
|
MenuID: 'asc',
|
text: this.state.dict['header.form.asc']
|
}, {
|
MenuID: 'desc',
|
text: this.state.dict['header.form.desc']
|
}]
|
},
|
{
|
type: 'select',
|
key: 'display',
|
label: this.state.dict['header.form.display'],
|
initVal: card.display || 'dropdown',
|
required: true,
|
options: [{
|
MenuID: 'dropdown',
|
text: this.state.dict['header.form.dropdown']
|
}, {
|
MenuID: 'button',
|
text: this.state.dict['header.form.button']
|
}]
|
}
|
]
|
})
|
}
|
|
handleSubmit = () => {
|
this.formRef.handleConfirm().then(res => {
|
let _config = this.state.config
|
|
if (this.state.operaType === 'add') {
|
_config[res.type] = _config[res.type].map(item => {
|
if (item.uuid === res.values.uuid) {
|
return res.values
|
} else {
|
return item
|
}
|
})
|
_config[res.type] = _config[res.type].filter(item => !item.origin)
|
} else {
|
_config[res.type] = _config[res.type].map(item => {
|
if (item.uuid === res.values.uuid) {
|
return res.values
|
} else {
|
return item
|
}
|
})
|
}
|
|
this.setState({
|
config: _config,
|
[res.type + 'loading']: true,
|
visible: false
|
})
|
this.resetFrom()
|
})
|
}
|
|
deleteElement = () => {
|
let _config = this.state.config
|
_config[this.state.formtemp] = _config[this.state.formtemp].filter(item => {
|
if (item.uuid === this.state.card.uuid) {
|
return false
|
} else {
|
return true
|
}
|
})
|
this.setState({
|
config: _config,
|
[this.state.formtemp + 'loading']: true,
|
visible: false
|
})
|
this.resetFrom()
|
}
|
|
handleCancel = () => {
|
this.setState({
|
visible: false
|
})
|
this.resetFrom()
|
}
|
|
resetFrom = () => {
|
setTimeout(() => {
|
this.setState({
|
// formtemp: '',
|
searchloading: false,
|
actionloading: false,
|
columnsloading: false
|
// formlist: null
|
})
|
}, 10)
|
}
|
|
changeTemplate = () => {
|
this.props.handleConfig('template')
|
}
|
|
submitConfig = () => {
|
const { menu } = this.props
|
const { config, originMenu } = this.state
|
this.menuformRef.handleConfirm().then(res => {
|
if (config.search[0] && config.search[0].origin) {
|
notification.warning({
|
top: 92,
|
message: '请设置搜索条件',
|
duration: 10
|
})
|
return
|
}
|
if (config.action[0] && config.action[0].origin) {
|
notification.warning({
|
top: 92,
|
message: '请设置按钮',
|
duration: 10
|
})
|
return
|
}
|
if (config.columns[0] && config.columns[0].origin) {
|
notification.warning({
|
top: 92,
|
message: '请设置显示列',
|
duration: 10
|
})
|
return
|
}
|
|
let _LongParam = ''
|
let _config = {...config, tables: this.state.selectedTables}
|
let _pageParam = {...menu.PageParam, OpenType: res.opentype}
|
|
try {
|
_LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
|
} catch (e) {
|
notification.warning({
|
top: 92,
|
message: '编译错误',
|
duration: 10
|
})
|
return
|
}
|
|
if (this.state.operaType === 'add') {
|
let param = {
|
func: 'sPC_TrdMenu_Add',
|
ParentID: res.parentId,
|
MenuID: menu.MenuID,
|
MenuNo: res.menuNo,
|
Template: menu.PageParam.Template || '',
|
MenuName: res.menuName,
|
PageParam: JSON.stringify(_pageParam),
|
LongParam: _LongParam
|
}
|
this.setState({
|
menuloading: true
|
})
|
|
Api.getSystemConfig(param).then(response => {
|
if (response.status) {
|
this.setState({
|
menuloading: false,
|
operaType: 'edit',
|
originMenu: {
|
...originMenu,
|
LongParam: _config,
|
PageParam: _pageParam,
|
MenuName: res.menuName,
|
MenuNo: res.menuNo,
|
ParentID: res.parentId
|
}
|
})
|
notification.success({
|
top: 92,
|
message: '保存成功',
|
duration: 10
|
})
|
} else {
|
this.setState({
|
menuloading: false
|
})
|
notification.warning({
|
top: 92,
|
message: response.message,
|
duration: 10
|
})
|
}
|
})
|
} else {
|
let param = {
|
func: 'sPC_TrdMenu_Upt',
|
ParentID: res.parentId,
|
MenuID: menu.MenuID,
|
MenuNo: res.menuNo,
|
Template: menu.PageParam.Template || '',
|
MenuName: res.menuName,
|
PageParam: JSON.stringify(_pageParam),
|
LongParam: _LongParam
|
}
|
this.setState({
|
menuloading: true
|
})
|
|
Api.getSystemConfig(param).then(response => {
|
if (response.status) {
|
notification.success({
|
top: 92,
|
message: '保存成功',
|
duration: 10
|
})
|
if (this.state.closeVisible) {
|
this.props.handleConfig('')
|
} else {
|
this.setState({
|
menuloading: false,
|
originMenu: {
|
...originMenu,
|
LongParam: _config,
|
PageParam: _pageParam,
|
MenuName: res.menuName,
|
MenuNo: res.menuNo,
|
ParentID: res.parentId
|
}
|
})
|
}
|
} else {
|
this.setState({
|
menuloading: false
|
})
|
notification.warning({
|
top: 92,
|
message: response.message,
|
duration: 10
|
})
|
}
|
})
|
}
|
}, () => {
|
notification.warning({
|
top: 92,
|
message: this.state.dict['header.menu.basemsg'],
|
duration: 10
|
})
|
})
|
}
|
|
cancelConfig = () => {
|
const { menu } = this.props
|
const { config, originMenu } = this.state
|
let _this = this
|
|
if (this.state.operaType === 'add') {
|
confirm({
|
content: '菜单尚未提交,确定放弃保存吗?',
|
okText: this.state.dict['header.confirm'],
|
cancelText: this.state.dict['header.cancel'],
|
onOk() {
|
_this.props.handleConfig('')
|
},
|
onCancel() {}
|
})
|
} else {
|
this.menuformRef.handleConfirm().then(res => {
|
let _config = {...config, tables: this.state.selectedTables}
|
let _pageParam = {...menu.PageParam, OpenType: res.opentype}
|
let _originMenu = {
|
...originMenu,
|
LongParam: _config,
|
PageParam: _pageParam,
|
MenuName: res.menuName,
|
MenuNo: res.menuNo,
|
ParentID: res.parentId
|
}
|
|
if (!is(fromJS(originMenu), fromJS(_originMenu))) {
|
this.setState({
|
closeVisible: true
|
})
|
} else {
|
this.props.handleConfig('')
|
}
|
}, () => {
|
this.setState({
|
closeVisible: true
|
})
|
})
|
}
|
}
|
|
queryField = (type) => {
|
const {selectedTables, tableColumns, config} = this.state
|
if (selectedTables.length === 0) {
|
notification.warning({
|
top: 92,
|
message: '请选择表名!',
|
duration: 10
|
})
|
return
|
}
|
|
let columns = new Map()
|
tableColumns.forEach(table => {
|
table.columns.forEach(column => {
|
columns.set(column.field, column)
|
})
|
})
|
|
if (type === 'search') {
|
config.search.forEach(item => {
|
if (columns.has(item.field)) {
|
columns.set(item.field, {...item, selected: true, type: item.type})
|
}
|
})
|
} else if (type === 'columns') {
|
config.columns.forEach(item => {
|
if (columns.has(item.field)) {
|
columns.set(item.field, {...item, selected: true, type: item.type})
|
}
|
})
|
}
|
|
this.setState({
|
addType: type,
|
tableVisible: true,
|
fields: [...columns.values()]
|
})
|
}
|
|
addFieldSubmit = () => {
|
if (!this.state.fields || this.state.fields.length === 0) {
|
this.setState({
|
tableVisible: false,
|
addType: ''
|
})
|
}
|
|
const {addType, config} = this.state
|
|
let cards = this.refs.searchcard.getSelectedCard()
|
let columns = new Map()
|
cards.forEach(card => {
|
columns.set(card.field, card)
|
})
|
|
let items = []
|
if (addType === 'search') {
|
config.search.forEach(item => {
|
if (columns.has(item.field)) {
|
let cell = columns.get(item.field)
|
|
if (cell.selected) {
|
items.push(item)
|
}
|
columns.delete(item.field)
|
} else if (!item.origin) {
|
items.push(item)
|
}
|
})
|
|
let _columns = [...columns.values()]
|
let indexes = items.map(card => {return card.id})
|
let id = Math.max(...indexes, 0)
|
|
_columns.forEach(item => {
|
if (item.selected) {
|
let newcard = {
|
id: id,
|
uuid: Utils.getuuid(),
|
label: item.label,
|
field: item.field,
|
initval: '',
|
type: item.type,
|
resourceType: '0',
|
setAll: 'false',
|
options: [],
|
dataSource: '',
|
linkField: '',
|
valueField: '',
|
valueText: '',
|
orderBy: '',
|
orderType: 'asc',
|
display: 'dropdown'
|
}
|
|
items.push(newcard)
|
id++
|
}
|
})
|
} else {
|
config.columns.forEach(item => {
|
if (columns.has(item.field)) {
|
let cell = columns.get(item.field)
|
|
if (cell.selected) {
|
items.push(item)
|
}
|
columns.delete(item.field)
|
} else if (!item.origin) {
|
items.push(item)
|
}
|
})
|
|
let _columns = [...columns.values()]
|
let indexes = items.map(card => {return card.id})
|
let id = Math.max(...indexes, 0)
|
|
_columns.forEach(item => {
|
if (item.selected) {
|
let newcard = {
|
id: id,
|
uuid: Utils.getuuid(),
|
Align: 'left',
|
label: item.label,
|
field: item.field,
|
Hide: 'false',
|
IsSort: 'true',
|
type: 'text',
|
Width: 120
|
}
|
|
items.push(newcard)
|
id++
|
}
|
})
|
}
|
|
this.setState({
|
tableVisible: false,
|
[addType + 'loading']: true,
|
addType: '',
|
config: {...config, [addType]: items}
|
})
|
setTimeout(() => {
|
this.setState({
|
[addType + 'loading']: false
|
})
|
}, 100)
|
}
|
|
cancelFieldSubmit = () => {
|
this.setState({
|
tableVisible: false,
|
addType: ''
|
})
|
}
|
|
onTableChange = (value) => {
|
const {tables, selectedTables, tableColumns} = this.state
|
|
let _table = tables.filter(item => item.TbName === value)[0]
|
let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0]
|
if (!isSelected) {
|
this.setState({
|
selectedTables: [...selectedTables, _table]
|
})
|
Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => {
|
if (res.status) {
|
let tabmsg = {
|
tableName: _table.name,
|
columns: res.FDName.map(item => {
|
let _type = item.FieldType.toLowerCase()
|
let _decimal = 0
|
if (/^nvarchar/.test(_type)) {
|
_type = 'text'
|
} else if (/^int/.test(_type)) {
|
_type = 'number'
|
} else if (/^decimal/.test(_type)) {
|
_decimal = _type.split(',')[1]
|
_decimal = parseInt(_decimal)
|
if (_decimal > 4) {
|
_decimal = 4
|
}
|
_type = 'number'
|
} else if (/^decimal/.test(_type)) {
|
_decimal = _type.split(',')[1]
|
_decimal = parseInt(_decimal)
|
if (_decimal > 4) {
|
_decimal = 4
|
}
|
_type = 'number'
|
} else if (/^datetime/.test(_type)) {
|
_type = 'datetime'
|
} else if (/^date/.test(_type)) {
|
_type = 'date'
|
} else {
|
_type = 'text'
|
}
|
|
return {
|
field: item.FieldName,
|
label: item.FieldDec,
|
type: _type,
|
decimal: _decimal
|
}
|
})
|
}
|
this.setState({
|
tableColumns: [...tableColumns, tabmsg]
|
})
|
} else {
|
notification.warning({
|
top: 92,
|
message: res.message,
|
duration: 10
|
})
|
}
|
})
|
}
|
}
|
|
deleteTable = (table) => {
|
const {selectedTables, tableColumns} = this.state
|
|
this.setState({
|
selectedTables: selectedTables.filter(item => item.name !== table.name),
|
tableColumns: tableColumns.filter(item => item.tableName !== table.name)
|
})
|
}
|
|
changeSetting = () => {
|
this.setState({
|
settingVisible: true
|
})
|
}
|
|
settingSave = () => {
|
const {config} = this.state
|
this.settingRef.handleConfirm().then(res => {
|
this.setState({
|
config: {...config, setting: res},
|
settingVisible: false
|
})
|
})
|
}
|
|
cancelSetting = () => {
|
this.setState({
|
settingVisible: false
|
})
|
}
|
|
render () {
|
return (
|
<div className="modal-form-board">
|
<DndProvider backend={HTML5Backend}>
|
<div className="tools">
|
<Collapse accordion defaultActiveKey="0" bordered={false}>
|
<Panel header="基本信息" key="0" id="modal-basedata">
|
<MenuForm
|
dict={this.state.dict}
|
formlist={this.state.modalformlist}
|
wrappedComponentRef={(inst) => this.menuformRef = inst}
|
/>
|
<div className="ant-col ant-form-item-label">
|
<label title="添加表名">添加表名</label>
|
</div>
|
<Select
|
showSearch
|
className="tables"
|
style={{ width: '100%' }}
|
optionFilterProp="children"
|
value={'请选择表名'}
|
onChange={this.onTableChange}
|
showArrow={false}
|
getPopupContainer={() => document.getElementById('modal-basedata')}
|
filterOption={(input, option) => {
|
return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
}}
|
>
|
{this.state.tables.map((table, index) => (
|
<Option key={index} value={table.TbName}>{table.Remark}</Option>
|
))}
|
</Select>
|
{this.state.selectedTables.length > 0 && <List
|
size="small"
|
bordered
|
dataSource={this.state.selectedTables}
|
renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}>
|
{item.Remark + ' (' + item.TbName + ')'}
|
<Icon type="close" onClick={() => this.deleteTable(item)}/>
|
<div className="bottom-mask"></div>
|
</List.Item>}
|
/>}
|
</Panel>
|
<Panel header="表单" key="1">
|
<div className="search-element">
|
{Source.searchItems.map((item, index) => {
|
return (<SourceElement key={index} content={item}/>)
|
})}
|
</div>
|
<Button type="primary" block onClick={() => this.queryField('search')}>添加表单</Button>
|
</Panel>
|
</Collapse>
|
</div>
|
<div className="setting">
|
<Card title="表单配置" bordered={false} extra={
|
<div>
|
<Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button>
|
<Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button>
|
</div>
|
} style={{ width: '100%' }}>
|
<Icon type="setting" onClick={this.changeSetting} />
|
<div className="search-list">
|
{<DragElement
|
list={this.state.config.search}
|
type="search"
|
placeholder={this.state.dict['header.form.search.placeholder']}
|
handleList={this.handleList}
|
handleMenu={this.handleSearch}
|
/>}
|
</div>
|
</Card>
|
</div>
|
</DndProvider>
|
{/* <Modal
|
title={this.state.dict['header.edit']}
|
visible={this.state.visible}
|
width={700}
|
onCancel={this.handleCancel}
|
footer={[
|
<Button key="delete" type="danger" onClick={this.deleteElement}>{this.state.dict['header.delete']}</Button>,
|
<Button key="cancel" onClick={this.handleCancel}>{this.state.dict['header.cancel']}</Button>,
|
<Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button>
|
]}
|
destroyOnClose
|
>
|
{this.state.formtemp === 'search' && <SearchForm
|
dict={this.state.dict}
|
formlist={this.state.formlist}
|
card={this.state.card}
|
wrappedComponentRef={(inst) => this.formRef = inst}
|
/>}
|
</Modal>
|
<Modal
|
title={this.state.dict['header.edit']}
|
visible={this.state.tableVisible}
|
width={'65vw'}
|
style={{minWidth: '900px', maxWidth: '1200px'}}
|
onOk={this.addFieldSubmit}
|
onCancel={this.cancelFieldSubmit}
|
destroyOnClose
|
>
|
{this.state.addType === 'search' && this.state.fields.length > 0 &&
|
<EditCard data={this.state.fields} ref="searchcard" type="search" />
|
}
|
{this.state.addType === 'columns' && this.state.fields.length > 0 &&
|
<EditCard data={this.state.fields} ref="searchcard" type="columns" />
|
}
|
{(!this.state.fields || this.state.fields.length === 0) &&
|
<Empty />
|
}
|
</Modal> */}
|
<Modal
|
title={this.state.dict['header.edit']}
|
visible={this.state.settingVisible}
|
width={700}
|
onOk={this.settingSave}
|
onCancel={this.cancelSetting}
|
destroyOnClose
|
>
|
<SettingForm
|
data={this.state.config.setting}
|
dict={this.state.dict}
|
wrappedComponentRef={(inst) => this.settingRef = inst}
|
/>
|
</Modal>
|
<Modal
|
bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}}
|
closable={false}
|
visible={this.state.closeVisible}
|
onCancel={() => { this.setState({closeVisible: false}) }}
|
footer={[
|
<Button key="save" className="mk-btn mk-green" onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>,
|
<Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>,
|
<Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button>
|
]}
|
destroyOnClose
|
>
|
菜单配置已修改,是否保存配置信息?
|
</Modal>
|
</div>
|
)
|
}
|
}
|
|
export default ComTableConfig
|