Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
70ecf5f9
Commit
70ecf5f9
authored
May 14, 2021
by
shaoan123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据策略下发更改的接口来修改界面
parent
2b25312a
Pipeline
#27707
passed with stages
in 33 minutes 50 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
496 additions
and
62 deletions
+496
-62
AddModal.jsx
...ges/artificial/policiesIssued/strategyConfig/AddModal.jsx
+75
-8
add.jsx
...ormCenter/bsmanager/tablemanager/components/Field/add.jsx
+0
-0
addTable.jsx
...nter/bsmanager/tablemanager/components/Field/addTable.jsx
+173
-0
editor.jsx
...Center/bsmanager/tablemanager/components/Field/editor.jsx
+146
-0
index.jsx
src/pages/platformCenter/bsmanager/tablemanager/index.jsx
+88
-53
bs.jsx
src/services/platform/bs.jsx
+14
-1
No files found.
src/pages/artificial/policiesIssued/strategyConfig/AddModal.jsx
View file @
70ecf5f9
...
...
@@ -25,7 +25,9 @@ const AddModal = props => {
const
[
predictCode
,
setPredictCode
]
=
useState
([]);
//预测编码列表
const
[
deviceList
,
setDeviceList
]
=
useState
([]);
//设备列表
const
[
card
,
setCard
]
=
useState
([]);
//卡片列表值
const
[
dateArr
,
setDateArr
]
=
useState
({
DeviationType
:
''
,
DeviationValue
:
''
,
DurationType
:
''
,
DurationValue
:
''
});
//偏移量,时段时长
const
[
source
,
setSource
]
=
useState
([])
const
[
showTime
,
setShowTime
]
=
useState
(
true
)
const
[
PredictID
,
setPredictID
]
=
useState
()
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
...
...
@@ -40,6 +42,10 @@ const AddModal = props => {
StrategyDes
:
obj
.
StrategyDes
,
StrategyName
:
obj
.
StrategyName
,
StrategyType
:
obj
.
StrategyType
,
DeviationType
:
dateArr
.
DeviationType
,
DeviationValue
:
dateArr
.
DeviationValue
,
DurationType
:
dateArr
.
DurationType
,
DurationValue
:
dateArr
.
DurationValue
,
DetailInfos
:
card
,
CreateTime
:
moment
(
new
Date
()).
format
(
'YYYY-MM-DD HH:mm:ss'
),
PredictID
...
...
@@ -53,7 +59,7 @@ const AddModal = props => {
callBackSubmit
();
prompt
(
'success'
,
`
${
type
===
'add'
?
"增加成功"
:
res
.
errMsg
}
`
)
}
else
{
prompt
(
'fail'
,
`
${
type
===
'add'
?
"增加失败"
:
res
.
errMsg
}
`
)
prompt
(
'fail'
,
res
.
errMsg
)
}
}).
catch
(
e
=>
{
setLoading
(
false
);
...
...
@@ -100,8 +106,13 @@ const AddModal = props => {
form
.
resetFields
();
setCard
([])
setDeviceList
([])
setShowTime
(
true
)
setDateArr
({
DeviationType
:
'秒'
,
DeviationValue
:
''
,
DurationType
:
'秒'
,
DurationValue
:
''
})
}
else
{
let
{
DeviationType
,
DeviationValue
,
DurationType
,
DurationValue
}
=
formObj
formObj
.
StrategyType
===
'时段控制'
?
setShowTime
(
true
)
:
setShowTime
(
false
)
setDateArr
({
DeviationType
,
DeviationValue
,
DurationType
,
DurationValue
})
form
.
setFieldsValue
({
time
:
moment
(
formObj
.
CreateTime
,
"YYYYMMDDHHmmss"
),
...
formObj
});
if
(
formObj
.
DetailInfos
.
length
)
{
let
req1
=
getEquipmentInfo
(
formObj
.
DeviceType
)
...
...
@@ -112,7 +123,6 @@ const AddModal = props => {
respone
[
1
].
getMe
.
length
&&
setPredictCode
(
respone
[
1
].
getMe
)
let
arr
=
[]
formObj
.
DetailInfos
.
map
((
item
,
index
)
=>
{
console
.
log
(
1
);
arr
[
index
]
=
{}
arr
[
index
].
code
=
respone
[
0
].
getMe
.
length
?
respone
[
0
].
getMe
[
0
].
DeviceList
:
[]
arr
[
index
].
predictCode
=
respone
[
1
].
getMe
.
length
?
respone
[
1
].
getMe
:
[]
...
...
@@ -248,10 +258,36 @@ const AddModal = props => {
setCard
(
cardList
)
setDeviceList
(
arr
)
}
const
handleOrgin
=
(
value
,
option
)
=>
{
const
handleOrgin
=
(
value
,
option
)
=>
{
setPredictID
(
option
.
id
)
}
const
changeDeviationValue
=
(
e
)
=>
{
const
newArr
=
{
...
dateArr
}
newArr
.
DeviationValue
=
e
.
target
.
value
setDateArr
(
newArr
)
}
const
changeDeviationType
=
(
value
)
=>
{
const
newArr
=
{
...
dateArr
}
newArr
.
DeviationType
=
value
setDateArr
(
newArr
)
}
const
changeDurationValue
=
(
e
)
=>
{
const
newArr
=
{
...
dateArr
}
newArr
.
DurationValue
=
e
.
target
.
value
setDateArr
(
newArr
)
}
const
changeDurationType
=
(
value
)
=>
{
const
newArr
=
{
...
dateArr
}
newArr
.
DurationType
=
value
setDateArr
(
newArr
)
}
const
hangleTime
=
(
value
)
=>
{
value
===
'时段控制'
?
setShowTime
(
true
)
:
setShowTime
(
false
)
const
newArr
=
{
...
dateArr
}
newArr
.
DurationValue
=
0
newArr
.
DurationType
=
''
setDateArr
(
newArr
)
}
return
(
<
Modal
title=
{
`${type === 'add' ? '策略下发新增' : '编辑'}`
}
...
...
@@ -283,10 +319,9 @@ const AddModal = props => {
name=
"StrategyType"
rules=
{
[{
required
:
true
,
message
:
'请选择策略类型'
}]
}
>
<
Select
>
<
Select
onChange=
{
hangleTime
}
>
<
Select
.
Option
value=
'实时控制'
>
实时控制
</
Select
.
Option
>
<
Select
.
Option
value=
'时段控制'
>
时段控制
</
Select
.
Option
>
</
Select
>
</
Item
>
<
Item
...
...
@@ -294,7 +329,7 @@ const AddModal = props => {
name=
"PredictName"
rules=
{
[{
required
:
true
,
message
:
'请选择数据来源'
}]
}
>
<
Select
onChange=
{
(
value
,
option
)
=>
handleOrgin
(
value
,
option
)
}
>
<
Select
onChange=
{
(
value
,
option
)
=>
handleOrgin
(
value
,
option
)
}
>
{
source
.
length
?
source
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
id=
{
item
.
ID
}
value=
{
item
.
PredictName
}
>
{
item
.
PredictName
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
...
...
@@ -306,6 +341,38 @@ const AddModal = props => {
{
deviceType
.
length
?
deviceType
.
map
((
item
,
index
)
=>
{
return
<
Select
.
Option
key=
{
index
}
value=
{
item
.
DeviceType
}
>
{
item
.
DeviceType
}
</
Select
.
Option
>
})
:
''
}
</
Select
>
</
Item
>
<
Item
label=
"偏移量"
name=
"Cycle"
rules=
{
[{
required
:
true
,
message
:
'请输入偏移量'
}]
}
>
<
div
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
Input
style=
{
{
width
:
'65%'
}
}
placeholder=
"请输入偏移量"
value=
{
dateArr
.
DeviationValue
}
onChange=
{
changeDeviationValue
}
allowClear
/>
<
Select
style=
{
{
marginLeft
:
'2rem'
,
width
:
'28%'
}
}
onChange=
{
changeDeviationType
}
value=
{
dateArr
.
DeviationType
}
>
<
Select
.
Option
value=
'秒'
>
秒
</
Select
.
Option
>
<
Select
.
Option
value=
'分'
>
分
</
Select
.
Option
>
<
Select
.
Option
value=
'时'
>
时
</
Select
.
Option
>
<
Select
.
Option
value=
'日'
>
日
</
Select
.
Option
>
</
Select
>
</
div
>
</
Item
>
{
showTime
?
<
Item
label=
"时段时长"
name=
"Cycle"
rules=
{
[{
required
:
true
,
message
:
'请输入时段时长'
}]
}
>
<
div
>
<
div
className=
{
styles
.
predict
}
></
div
>
<
Input
style=
{
{
width
:
'65%'
}
}
placeholder=
"请输入时段时长"
value=
{
dateArr
.
DurationValue
}
onChange=
{
changeDurationValue
}
allowClear
/>
<
Select
style=
{
{
marginLeft
:
'2rem'
,
width
:
'28%'
}
}
onChange=
{
changeDurationType
}
value=
{
dateArr
.
DurationType
}
>
<
Select
.
Option
value=
'秒'
>
秒
</
Select
.
Option
>
<
Select
.
Option
value=
'分'
>
分
</
Select
.
Option
>
<
Select
.
Option
value=
'时'
>
时
</
Select
.
Option
>
<
Select
.
Option
value=
'日'
>
日
</
Select
.
Option
>
</
Select
>
</
div
>
</
Item
>
:
''
}
<
Item
label=
"描述"
name=
"StrategyDes"
...
...
@@ -372,7 +439,7 @@ const AddModal = props => {
>
<
Select
placeholder=
"请选择预测指标"
style=
{
{
width
:
'98%'
,
marginLeft
:
'0.4rem'
}
}
style=
{
{
width
:
'98%'
,
marginLeft
:
'0.4rem'
}
}
onChange=
{
(
value
,
option
)
=>
handleChangeIndex1
(
value
,
option
)
}
>
{
item
.
predictStr
&&
item
.
predictStr
.
length
?
item
.
predictStr
.
map
((
item
,
zindex
)
=>
{
return
<
Select
.
Option
key=
{
zindex
}
index=
{
index
}
value=
{
item
}
>
{
item
}
</
Select
.
Option
>
})
:
''
}
...
...
src/pages/platformCenter/bsmanager/tablemanager/components/Field/
index
.jsx
→
src/pages/platformCenter/bsmanager/tablemanager/components/Field/
add
.jsx
View file @
70ecf5f9
File moved
src/pages/platformCenter/bsmanager/tablemanager/components/Field/addTable.jsx
0 → 100644
View file @
70ecf5f9
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
Checkbox
,
Divider
,
notification
}
from
'antd'
;
import
{
createTable
,
LoadTableFields
}
from
'@/services/platform/bs'
const
{
Option
}
=
Select
;
const
CheckboxGroup
=
Checkbox
.
Group
;
const
editor
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{
},
type
,
visible
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
isModalVisible
,
setIsModalVisible
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
const
[
checkedList
,
setCheckedList
]
=
useState
([]);
//选中的复选框内容
const
[
plainOptions
,
setPlainOptions
]
=
useState
([
'Apple'
,
'Pear'
,
'Orange'
]);
//复选框所有内容
const
[
indeterminate
,
setIndeterminate
]
=
useState
(
true
);
const
[
isVisible
,
setIsVisible
]
=
useState
(
true
);
const
[
checkAll
,
setCheckAll
]
=
useState
(
false
);
const
onChange
=
list
=>
{
setCheckedList
(
list
);
setIndeterminate
(
!!
list
.
length
&&
list
.
length
<
plainOptions
.
length
);
setCheckAll
(
list
.
length
===
plainOptions
.
length
);
};
const
onCheckAllChange
=
e
=>
{
setCheckedList
(
e
.
target
.
checked
?
plainOptions
:
[]);
setIndeterminate
(
false
);
setCheckAll
(
e
.
target
.
checked
);
};
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
obj
.
tableName
=
obj
.
tableType
.
substr
(
0
,
obj
.
tableType
.
length
-
1
)
+
'_'
+
obj
.
tableName
;
createTable
({
...
obj
}).
then
(
res
=>
{
setLoading
(
false
);
console
.
log
(
'res'
,
res
);
console
.
log
(
'res.msg === "Ok"'
,
res
.
msg
===
"Ok"
);
if
(
res
.
msg
===
"Ok"
)
{
setIsVisible
(
false
)
setIsModalVisible
(
true
)
LoadTableFields
({
tableName
:
res
.
data
.
tableInfo
.
Name
}).
then
(
response
=>
{
console
.
log
(
'response'
,
response
);
})
}
else
{
form
.
resetFields
();
callBackSubmit
();
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
}).
catch
(
err
=>
{
console
.
log
(
'err'
,
err
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增失败'
,
});
setLoading
(
false
);
});
}
});
};
const
handleOk
=
()
=>
{
form
.
resetFields
();
callBackSubmit
();
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增成功'
,
});
}
const
handleCancel
=
()
=>
{
setIsModalVisible
(
false
)
}
const
layout
=
{
layout
:
'horizontal'
,
labelCol
:
{
span
:
4
,
},
wrapperCol
:
{
span
:
16
,
},
};
return
(
<>
<
Modal
title=
{
`${type === 'add' ? '元数据发布' : '编辑'}`
}
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
'150px'
}
}
width=
"700px"
destroyOnClose
maskClosable=
{
false
}
cancelText=
"取消"
okText=
"确认"
visible=
{
isVisible
}
{
...
props
}
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
forceRender=
{
true
}
getContainer=
{
false
}
>
<
Form
form=
{
form
}
{
...
layout
}
>
<
Item
label=
"【特别提示】"
>
<
span
>
此处仅建立基础表和必要字段,额外字段需通过其他方式进行添加,比如使用Navicat工具等。
</
span
>
</
Item
>
<
Item
label=
"建表类型"
name=
"tableType"
rules=
{
[{
required
:
true
,
message
:
'请输入表名'
}]
}
>
<
Select
>
<
Select
.
Option
value=
'事件表'
>
事件表
</
Select
.
Option
>
<
Select
.
Option
value=
'工单表'
>
工单表
</
Select
.
Option
>
<
Select
.
Option
value=
'台账表'
>
台账表
</
Select
.
Option
>
<
Select
.
Option
value=
'设备表'
>
设备表
</
Select
.
Option
>
<
Select
.
Option
value=
'反馈表'
>
反馈表
</
Select
.
Option
>
</
Select
>
</
Item
>
<
Item
label=
"表名"
name=
"tableName"
rules=
{
[{
required
:
true
,
message
:
'请以"模块_表名"的个数输入'
}]
}
>
<
Input
placeholder=
'请以"模块_表名"的个数输入'
allowClear
/>
</
Item
>
<
Item
label=
"别名"
name=
"alias"
rules=
{
[{
required
:
true
,
message
:
'请输入别名,通常用作该表的备注'
}]
}
>
<
Input
placeholder=
"请输入别名,通常用作该表的备注"
allowClear
/>
</
Item
>
<
Item
label=
" "
colon=
{
false
}
>
<
span
>
● 事件表会默认创建如下字段:事件编号、事件状态、事件名称上报站点、处理站点、上报人名称、上报人部分、上报时间、现场图片、现场录音、坐标位置、更新时间、更新状态、是否置顶
</
span
>
</
Item
>
</
Form
>
</
Modal
>
<
Modal
title=
"附加字段"
visible=
{
isModalVisible
}
onOk=
{
handleOk
}
onCancel=
{
handleCancel
}
>
<
Checkbox
indeterminate=
{
indeterminate
}
onChange=
{
onCheckAllChange
}
checked=
{
checkAll
}
>
选择所有
</
Checkbox
>
<
Divider
/>
<
CheckboxGroup
options=
{
plainOptions
}
value=
{
checkedList
}
onChange=
{
onChange
}
/>
</
Modal
>
</>
);
};
export
default
editor
;
src/pages/platformCenter/bsmanager/tablemanager/components/Field/editor.jsx
0 → 100644
View file @
70ecf5f9
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Input
,
Select
,
Radio
,
notification
}
from
'antd'
;
import
{
SetServiceConfig
}
from
'@/services/webConfig/api'
;
const
{
Option
}
=
Select
;
const
AddModal
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{
},
type
,
formObj
,
visible
,
listData
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
const
{
Item
}
=
Form
;
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
SetServiceConfig
({
schemename
:
obj
.
schemename
,
terminalType
:
type
===
'add'
?
'web'
:
'phone'
,
isBaseMap
:
'false'
,
jsonCfg
:
type
===
'add'
?
JSON
.
stringify
({
type
:
'dynamic'
})
:
JSON
.
stringify
({
isDefault
:
false
})
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
msg
===
"Ok"
)
{
form
.
resetFields
();
callBackSubmit
();
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增成功'
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增失败'
,
});
}
})
.
catch
(
err
=>
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'新增失败'
,
});
setLoading
(
false
);
});
}
});
};
const
onFinish
=
value
=>
{
};
useEffect
(()
=>
{
if
(
type
!=
''
)
{
form
.
setFieldsValue
({
...
formObj
});
}
},
[
visible
]);
const
layout
=
{
layout
:
'horizontal'
,
labelCol
:
{
span
:
4
,
},
wrapperCol
:
{
span
:
16
,
},
};
const
handleChange
=
(
value
)
=>
{
form
.
setFieldsValue
({
schemename
:
value
});
}
return
(
<
Modal
title=
{
`${type === 'add' ? '元数据发布' : '编辑'}`
}
bodyStyle=
{
{
width
:
'100%'
,
minHeight
:
'100px'
}
}
style=
{
{
top
:
'150px'
}
}
width=
"700px"
destroyOnClose
maskClosable=
{
false
}
cancelText=
"取消"
okText=
"确认"
{
...
props
}
onOk=
{
()
=>
onSubmit
()
}
confirmLoading=
{
loading
}
forceRender=
{
true
}
getContainer=
{
false
}
>
{
visible
&&
(
<
Form
form=
{
form
}
{
...
layout
}
onFinish=
{
onFinish
}
>
<
Item
label=
"表名"
name=
"tableName"
rules=
{
[{
required
:
true
,
message
:
'请输入表名'
}]
}
>
<
Input
placeholder=
"请输入表名"
allowClear
/>
</
Item
>
<
Item
label=
"别名"
name=
"tableAlias"
rules=
{
[{
required
:
true
,
message
:
'请输入别名'
}]
}
>
<
Input
placeholder=
"请输入别名"
allowClear
/>
</
Item
>
<
Item
label=
"样式"
name=
"tableStyle"
rules=
{
[{
required
:
true
,
message
:
'请输入别名'
}]
}
>
<
Radio
.
Group
>
<
Radio
value=
'大'
>
大(3)
</
Radio
>
<
Radio
value=
'中'
>
中(4)
</
Radio
>
<
Radio
value=
'小'
>
小(4)
</
Radio
>
<
Radio
value=
'较小'
>
较小(6)
</
Radio
>
</
Radio
.
Group
>
</
Item
>
<
Item
label=
"模板"
name=
"officeTmpl"
rules=
{
[{
required
:
true
,
message
:
'请输入别名'
}]
}
>
<
Input
placeholder=
"请输入别名"
allowClear
/>
</
Item
>
<
Item
label=
"接口"
name=
"interfaceText"
rules=
{
[{
required
:
true
,
message
:
'请输入别名'
}]
}
>
<
Input
placeholder=
"请输入别名"
allowClear
/>
</
Item
>
</
Form
>
)
}
</
Modal
>
);
};
export
default
AddModal
;
src/pages/platformCenter/bsmanager/tablemanager/index.jsx
View file @
70ecf5f9
import
React
,
{
useEffect
,
useState
}
from
'react'
import
ReactHtmlParser
from
'react-html-parser'
import
ReactHtmlParser
from
'react-html-parser'
import
{
// Tree,
Table
,
...
...
@@ -8,13 +8,15 @@ import {
Button
,
Select
,
Popconfirm
,
notification
,
Spin
}
from
'antd'
;
import
{
PlusCircleOutlined
}
from
'@ant-design/icons'
;
import
PageContainer
from
'@/components/BasePageContainer'
;
import
{
CM_Table_LoadTable
}
from
'@/services/platform/bs'
import
{
CM_Table_LoadTable
,
removeTable
}
from
'@/services/platform/bs'
import
styles
from
'./index.less'
import
AddModal
from
'./components/Field/index'
import
Editor
from
'./components/Field/editor'
import
AddTablelList
from
'./components/Field/addTable'
const
{
Search
}
=
Input
;
const
{
Option
}
=
Select
;
const
placeholder
=
"请输入表名"
...
...
@@ -25,7 +27,9 @@ const TableManager = () => {
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
formObj
,
setFormObj
]
=
useState
({});
const
[
flag
,
setFlag
]
=
useState
(
0
);
// 弹窗类型
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
true
)
const
[
searchValue
,
setSearchValue
]
=
useState
(
''
)
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
true
)
const
columns
=
[
{
title
:
'名称'
,
...
...
@@ -49,7 +53,7 @@ const TableManager = () => {
key
:
'officeTmpl'
,
render
:
text
=>
{
let
dom
=
ReactHtmlParser
(
text
)
return
(<
div
>
{
dom
}
</
div
>)
return
(<
div
>
{
dom
}
</
div
>)
}
},
{
...
...
@@ -63,7 +67,7 @@ const TableManager = () => {
key
:
'missingFieldCount'
,
render
:
text
=>
{
let
dom
=
ReactHtmlParser
(
text
)
return
(<
div
>
{
dom
}
</
div
>)
return
(<
div
>
{
dom
}
</
div
>)
}
},
{
...
...
@@ -72,7 +76,7 @@ const TableManager = () => {
key
:
'repeatFieldCount'
,
render
:
text
=>
{
let
dom
=
ReactHtmlParser
(
text
)
return
(<
div
>
{
dom
}
</
div
>)
return
(<
div
>
{
dom
}
</
div
>)
}
},
{
...
...
@@ -146,19 +150,34 @@ const TableManager = () => {
const
[
tableData
,
setTableData
]
=
useState
([])
useEffect
((
record
)
=>
{
loadTable
()
},
[])
loadTable
(
searchValue
)
},
[
flag
])
//修改表名
const
changeDesc
=
(
record
)
=>
{
setType
(
'edit'
);
setFormObj
(
record
);
setVisible
(
true
);
setFormObj
(
record
);
}
const
deleteChart
=
(
record
)
=>
{
const
deleteChart
=
(
record
)
=>
{
removeTable
({
tableID
:
record
.
tableID
,
removeFields
:
true
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
||
res
.
msg
===
''
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'删除成功'
,
});
setFlag
(
flag
+
1
)
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
})
}
const
editor
=
(
record
)
=>
{
const
editor
=
(
record
)
=>
{
}
const
onSubmit
=
prop
=>
{
...
...
@@ -166,65 +185,81 @@ const TableManager = () => {
setFlag
(
flag
+
1
)
};
const
AddTable
=
()
=>
{
setType
(
'add'
);
setVisible
(
true
);
}
const
handleChange
=
(
e
)
=>
{
setSearchValue
(
e
.
target
.
value
)
}
const
handleSearch
=
(
text
)
=>
{
loadTable
(
text
)
setSearchValue
(
text
)
}
const
loadTable
=
(
keyword
)
=>
{
const
loadTable
=
(
keyword
)
=>
{
setTreeLoading
(
true
)
CM_Table_LoadTable
({
_version
:
9999
,
filter
:
keyword
filter
:
keyword
}).
then
(
res
=>
{
setTreeLoading
(
false
)
if
(
res
.
success
==
true
)
{
setTableData
(
res
.
root
)
if
(
res
.
msg
===
'Ok'
)
{
setTableData
(
res
.
data
.
root
)
}
}
)
}
return
(
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
PageContainer
>
<
div
className=
{
styles
.
tablemanager_container
}
>
<
div
className=
{
styles
.
operate_bar
}
>
<
div
className=
{
styles
.
fast_search
}
>
<
div
className=
{
styles
.
title
}
>
快速检索
</
div
>
<
Search
allowClear
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
// onChange={handleChange}
enterButton
style=
{
{
width
:
"300px"
}
}
/>
</
div
>
<
PageContainer
>
<
div
className=
{
styles
.
tablemanager_container
}
>
<
div
className=
{
styles
.
operate_bar
}
>
<
div
className=
{
styles
.
fast_search
}
>
<
div
className=
{
styles
.
title
}
>
快速检索
</
div
>
<
Search
allowClear
placeholder=
{
placeholder
}
onSearch=
{
handleSearch
}
onChange=
{
handleChange
}
value=
{
searchValue
}
// onChange={handleChange}
enterButton
style=
{
{
width
:
"300px"
}
}
/>
</
div
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
onClick=
{
AddTable
}
>
建表
</
Button
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
onClick=
{
AddTable
}
>
附加
</
Button
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
onClick=
{
AddTable
}
>
建表
</
Button
>
<
Button
type=
"primary"
style=
{
{
marginLeft
:
"10px"
}
}
onClick=
{
AddTable
}
>
附加
</
Button
>
</
div
>
<
div
className=
{
styles
.
table_container
}
>
<
Table
columns=
{
columns
}
dataSource=
{
tableData
}
pagination=
{
{
pageSize
:
10
}
}
scroll=
{
{
y
:
700
}
}
size=
"small"
rowKey=
{
(
record
,
index
)
=>
`complete${record.tableID}${index}`
}
/>
</
div
>
</
div
>
<
div
className=
{
styles
.
table_container
}
>
<
Table
columns=
{
columns
}
dataSource=
{
tableData
}
pagination=
{
{
pageSize
:
20
}
}
scroll=
{
{
y
:
700
}
}
size=
"small"
rowKey=
{
(
record
,
index
)
=>
`complete${record.tableID}${index}`
}
{
visible
&&
type
==
'edit'
&&
(
<
Editor
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
/>
)
}
{
visible
&&
type
===
'add'
&&
(
<
AddTablelList
type=
{
type
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
/>
</
div
>
</
div
>
<
AddModal
visible=
{
visible
}
onCancel=
{
()
=>
setVisible
(
false
)
}
callBackSubmit=
{
onSubmit
}
type=
{
type
}
formObj=
{
formObj
}
/>
</
PageContainer
>
)
}
</
PageContainer
>
</
Spin
>
)
...
...
src/services/platform/bs.jsx
View file @
70ecf5f9
import
{
get
,
post
,
PUBLISH_SERVICE
,
CITY_SERVICE
}
from
'@/services/index'
;
//1.获取所有已附加的表
export
const
CM_Table_LoadTable
=
param
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/CM_Table_
LoadTable`
,
param
);
get
(
`
${
PUBLISH_SERVICE
}
/CaseManage/
LoadTable`
,
param
);
//2.获取单张表的字段 CM_Table_ReloadFields
export
const
CM_Table_ReloadFields
=
param
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/CM_Table_ReloadFields`
,
param
);
//3.删除表
export
const
removeTable
=
param
=>
get
(
`
${
PUBLISH_SERVICE
}
/CaseManage/RemoveTable`
,
param
);
//3.建立表
export
const
createTable
=
param
=>
get
(
`
${
PUBLISH_SERVICE
}
/CaseManage/CreateTable`
,
param
);
//3.附加字段
export
const
loadTableFields
=
param
=>
get
(
`
${
PUBLISH_SERVICE
}
/CaseManage/LoadTableFields`
,
param
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment