Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
607c7825
提交
607c7825
authored
3月 31, 2020
作者:
徐立
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
http://scjoyedu.eicp.net:9121/front-team/webPublic
上级
4716008b
8e835599
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
262 行删除
+12
-262
index.js
FormInsertDiy/ApplyPage/index.js
+2
-2
index.js
FormInsertDiy/AuditListPage/index.js
+0
-245
index.js
FormInsertDiy/Entrance/index.js
+10
-15
没有找到文件。
FormInsertDiy/ApplyPage/index.js
浏览文件 @
607c7825
import
React
from
'react'
;
import
React
from
'react'
;
import
Entrance
from
'
@/webPublic/one_stop_public
/Entrance'
;
import
Entrance
from
'
..
/Entrance'
;
import
Shell
from
'@/baseComponent/Shell'
;
import
Shell
from
'@/baseComponent/Shell'
;
import
SubmitButton
from
'@/webPublic/one_stop_public/AffairButton/SumbitButton'
;
import
SubmitButton
from
'@/webPublic/one_stop_public/AffairButton/SumbitButton'
;
export
default
function
ApplyPage
({
id
,
form
})
{
export
default
function
ApplyPage
({
id
,
form
})
{
return
(
return
(
<
Shell
styleShell
=
{{
marginTop
:
0
}}
>
<
Shell
styleShell
=
{{
marginTop
:
0
}}
>
<
Entrance
id
=
{
id
}
get
=
"web"
form
=
{
form
}
/
>
<
Entrance
id
=
{
id
}
isCg
=
'false'
get
=
"web"
form
=
{
form
}
/
>
<
div
style
=
{{
padding
:
16
,
textAlign
:
'center'
}}
>
<
div
style
=
{{
padding
:
16
,
textAlign
:
'center'
}}
>
<
SubmitButton
<
SubmitButton
form
=
{
form
}
form
=
{
form
}
...
...
FormInsertDiy/AuditListPage/index.js
deleted
100644 → 0
浏览文件 @
4716008b
import
React
,
{
Fragment
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
Divider
,
message
,
Form
,
Popconfirm
}
from
'antd'
;
import
moment
from
'moment'
;
import
router
from
'umi/router'
;
import
ExportInfo
from
'../Export/index'
;
import
{
text
,
number
,
date
,
getFormArrayConfig
}
from
'../config/index'
;
import
ButtonDiy
from
'@/baseComponent/ButtonDiy'
;
import
Shell
from
'../Shell'
;
import
Edit
from
'../Edit/index'
;
import
ImportUtil
from
'../ImportUtil/ImportUtil'
;
import
SearchDom
from
'@/highOrderComponent/SearchDom'
;
import
StandardTable
from
'@/components/StandardTable'
;
import
{
fetchTableHeader
,
fetchTableData
,
addOrEditTableItem
,
deleteTableItem
,
}
from
'@/webPublic/Services'
;
const
getValue
=
obj
=>
Object
.
keys
(
obj
)
.
map
(
key
=>
obj
[
key
])
.
join
(
','
);
/**
* 展示list数据,
* 根据元数据id显示元数据表格,根据模板id新增或编辑某条数据
*/
class
ListWithAddEditTemplate
extends
React
.
Component
{
static
propTypes
=
{
objId
:
PropTypes
.
string
.
isRequired
,
// 元数据表id
templateCode
:
PropTypes
.
string
.
isRequired
,
// 表单模板id
filters
:
PropTypes
.
object
,
// 请求元数据表格时额外的过滤条件
hasImport
:
PropTypes
.
bool
,
// 是否有导入操作按钮,默认false
hasExport
:
PropTypes
.
bool
,
// 是否有导出按钮,默认false
};
static
defaultProps
=
{
filters
:
{},
hasImport
:
false
,
hasExport
:
false
,
};
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
formData
:
null
,
// 编辑某行数据时表单的数据
headerList
:
[],
// 表头的数据
searchConfig
:
[],
formValues
:
{},
// 搜索区域的数据
isAdd
:
false
,
// 是新增还是编辑
selectedRows
:
[],
primaryKey
:
null
,
showEdit
:
false
,
// 是否显示编辑区域
pageData
:
{
list
:
[],
pagination
:
{},
},
};
this
.
columns
=
[];
}
handleAudit
=
()
=>
{};
// 渲染值
componentDidMount
()
{
const
{
objId
}
=
this
.
props
;
fetchTableHeader
(
objId
).
then
(
datas
=>
{
if
(
!
datas
)
return
;
this
.
setState
({
headerList
:
datas
});
let
i
=
0
;
for
(
let
t
in
datas
)
{
if
(
i
<
10
)
{
let
column
=
{};
column
.
title
=
datas
[
t
].
title
;
column
.
dataIndex
=
datas
[
t
].
name
;
if
(
date
.
includes
(
datas
[
t
].
type
))
{
column
.
render
=
val
=>
val
&&
moment
(
val
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
this
.
columns
.
push
(
column
);
i
++
;
}
if
(
datas
[
t
].
isPrimaryKey
)
{
this
.
setState
({
primaryKey
:
datas
[
t
].
name
,
});
}
}
let
searchConfig
=
[];
for
(
let
item
of
datas
)
{
if
(
item
.
isShowQuery
)
{
let
sear
=
getFormArrayConfig
([
item
]);
if
(
!
Array
.
isArray
(
sear
))
{
return
false
;
}
delete
sear
[
0
].
required
;
delete
sear
[
0
].
placeHolder
;
searchConfig
.
push
(
sear
[
0
]);
}
}
this
.
setState
({
searchConfig
,
});
let
opt
=
{
title
:
'操作'
,
render
:
(
text
,
record
)
=>
{
return
(
<
Fragment
>
<
div
>
<
a
onClick
=
{
this
.
handleAudit
.
bind
(
this
,
record
)}
>
审核
<
/a
>
<
/div
>
<
/Fragment
>
);
},
};
this
.
columns
.
push
(
opt
);
this
.
getPage
();
});
}
changeFormData
=
(
value
,
key
)
=>
{
this
.
setState
(({
formData
})
=>
({
formData
:
{
...
formData
,
[
key
]:
value
}
}));
};
getPage
=
()
=>
{
const
{
objId
,
filters
=
{}
}
=
this
.
props
;
const
{
formValues
,
pageData
:
pagination
}
=
this
.
state
;
const
query
=
{
...
formValues
,
...
filters
};
const
pageNo
=
pagination
.
current
?
pagination
.
current
:
1
;
const
pageSize
=
pagination
.
pageSize
?
pagination
.
pageSize
:
10
;
fetchTableData
({
dataObjId
:
objId
,
query
,
pageSize
,
pageNo
}).
then
(
res
=>
{
if
(
!
res
.
rows
)
{
console
.
log
(
'分页接口rows返回null报错'
);
}
this
.
setState
({
pageData
:
{
list
:
res
.
rows
,
pagination
:
{
current
:
res
.
pageNo
,
pageSize
:
res
.
pageSize
,
total
:
Number
(
res
.
total
),
},
},
});
});
};
handleStandardTableChange
=
(
pagination
,
filtersArg
,
sorter
)
=>
{
const
filters
=
Object
.
keys
(
filtersArg
).
reduce
((
obj
,
key
)
=>
{
const
newObj
=
{
...
obj
};
newObj
[
key
]
=
getValue
(
filtersArg
[
key
]);
return
newObj
;
},
{});
const
params
=
{
pageNo
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
,
...
filters
,
};
if
(
sorter
.
field
)
{
params
.
sorter
=
`
${
sorter
.
field
}
_
${
sorter
.
order
}
`
;
}
this
.
getPage
(
params
);
};
handleModalVisible
=
()
=>
{
this
.
setState
({
modalVisible
:
this
.
state
.
modalVisible
?
false
:
true
,
formData
:
{},
});
};
goBack
=
()
=>
{
router
.
goBack
();
};
formStateChange
=
(
value
,
key
)
=>
{
this
.
setState
(({
formValues
})
=>
({
formValues
:
{
...
formValues
,
[
key
]:
value
}
}));
};
resetFormValues
=
()
=>
{
this
.
setState
({
formValues
:
{},
});
};
render
()
{
const
{
modalVisible
,
selectedRows
,
isAdd
,
objId
,
pageData
,
showEdit
,
formData
,
primaryKey
,
formValues
,
searchConfig
,
}
=
this
.
state
;
const
{
hasExport
,
form
,
hasImport
,
templateCode
}
=
this
.
props
;
const
addOrEditModalProps
=
{
handleAdd
:
this
.
handleAdd
,
handleModalVisible
:
this
.
handleModalVisible
,
content
:
formData
,
form
,
isAdd
,
templateCode
,
modalVisible
,
};
return
(
<
Fragment
>
{
searchConfig
.
length
>
0
?
(
<
SearchDom
formStateChange
=
{
this
.
formStateChange
}
formValues
=
{
formValues
}
getPage
=
{
this
.
getPage
}
resetFormValues
=
{
this
.
resetFormValues
}
config
=
{{
condition
:
searchConfig
,
fromTab
:
true
}}
/
>
)
:
null
}
<
Shell
styleShell
=
{{
marginTop
:
searchConfig
&&
searchConfig
.
length
?
16
:
0
}}
>
<
div
style
=
{{
paddingLeft
:
'10px'
,
marginTop
:
'20px'
}}
>
{
hasImport
&&
<
ImportUtil
objId
=
{
objId
}
/>
}
{
hasExport
&&
<
ExportInfo
objId
=
{
objId
}
/>
}
<
/div
>
<
StandardTable
rowKey
=
"id"
data
=
{
pageData
}
columns
=
{
this
.
columns
}
selectedRows
=
{
selectedRows
}
onSelectRow
=
{
this
.
handleSelectRows
}
onChange
=
{
this
.
handleStandardTableChange
}
scroll
=
{{
x
:
1200
}}
/
>
<
/Shell
>
<
/Fragment
>
);
}
}
export
default
Form
.
create
()(
ListWithAddEditTemplate
);
FormInsertDiy/Entrance/index.js
浏览文件 @
607c7825
/**
* 入口文件
* 传入Id
* 移动端或web端识别值
* form
* 通过ID生成表单
*/
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
connect
}
from
'dva'
;
import
RenderForm
from
'../RenderForm'
;
import
RenderForm
from
'../RenderForm'
;
import
{
fetchTemplateById
}
from
'../../Services'
;
function
Entrance
({
id
,
get
=
'web'
,
form
})
{
function
Entrance
({
id
,
get
=
'web'
,
isCg
,
form
,
dispatch
})
{
const
[
data
,
setData
]
=
useState
(
null
);
const
[
data
,
setData
]
=
useState
(
null
);
useEffect
(()
=>
{
useEffect
(()
=>
{
fetchTemplateById
(
id
).
then
(
res
=>
{
dispatch
({
if
(
res
)
{
type
:
'modileHome/getDetail'
,
payload
:
{
id
},
callback
:
res
=>
{
if
(
res
&&
!
res
.
errMsg
)
{
setData
(
res
);
setData
(
res
);
}
}
},
});
});
},
[]);
},
[]);
console
.
log
(
'data'
,
typeof
data
);
return
data
?
<
RenderForm
get
=
{
get
}
isCg
=
{
isCg
}
postData
=
{
data
}
form
=
{
form
}
/> : null
;
console
.
log
(
'data'
,
data
);
return
data
?
<
RenderForm
get
=
{
get
}
postData
=
{
data
}
form
=
{
form
}
/> : null
;
}
}
export
default
Entrance
export
default
connect
()(
Entrance
);
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论