提交 ac994ed7 authored 作者: 徐立's avatar 徐立

新增路由参数

上级 42d3be70
......@@ -14,6 +14,14 @@ export default class index extends Component {
data,
isNewForm
} = this.props
let routerState = {
history: this.props?.history,
location: this.props?.location,
match: this.props?.match,
computedMatch: this.props?.computedMatch,
route: this.props?.route
}
return (
<div>
{
......@@ -40,6 +48,7 @@ export default class index extends Component {
obj={data.hisTaskForm.formData}
form={this.props.form}
formKey={item.formKey}
routerState={routerState}
/>
}
</>
......
......@@ -41,6 +41,13 @@ export default class Index extends Component {
const {
data
} = this.state
let routerState = {
history: this.props?.history,
location: this.props?.location,
match: this.props?.match,
computedMatch: this.props?.computedMatch,
route: this.props?.route
}
return (
<>
{
......@@ -48,6 +55,7 @@ export default class Index extends Component {
get={get}
postData={data}
form={form}
routerState={routerState}
/>
}
</>
......
......@@ -358,8 +358,7 @@ export default class ZdyTable extends Component {
render() {
let { width, isBorder, sqlData, mapData, defaultBinds, defaultValues, items, init, currentFormKey, isEdit, datas, isReady, formConfig, formCode, formId } = this.state
let { border, get, obj, index, fatherCode } = this.props
let { border, get, obj, index, fatherCode,routerState } = this.props
let style = {}
if (formConfig.style != null) {
try {
......@@ -481,6 +480,7 @@ export default class ZdyTable extends Component {
form={this.props.form} // antd form控件
sqlData={sqlData}
defaultValues={defaultValues || {}} // 接口中的默认值
routerState={routerState} // 兼容表单设计器路由传参
/>
</td>
}
......@@ -560,6 +560,7 @@ export default class ZdyTable extends Component {
mapData={mapData}
json={ary.content}
uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}} /></>
})
}
......
......@@ -1127,7 +1127,7 @@ export default class tableCom extends Component {
})
})
try {
var fun1 = new Function("obj","init", "defaultValues", "env", "index", "fatherCode", "utils","$", fun);
var fun1 = new Function("obj","init", "defaultValues", "env", "index", "fatherCode", "utils","$","routerState", fun);
let obj
if(!this.props.isEdit&&this.props.fatherCode){
......@@ -1149,7 +1149,8 @@ export default class tableCom extends Component {
md5: md5,
render:this.getRender,base64:getBase64,
},
functionObj
functionObj,
this.props.routerState
)
if (base52) {
......
# 编辑日期
2020-4-20
#依赖资源
```js
......@@ -87,3 +91,31 @@ import HistoryForm from '@/webPublic/one_stop_public/Entrance/historyForm';
## 新增routerState
单个页面配置项如果需要使用**router路由参数**传值,则需要外部传入routerState
以下为示例
```js
let routerState = {
history: this.props?.history,
location: this.props?.location,
match: this.props?.match,
computedMatch: this.props?.computedMatch,
route: this.props?.route
} // 注 可选链运算符不兼容TS
```
```js
<ZdyTable
get="web"
height={config.height}
postData={data}
form={form}
routerState={this.props.router}
/>
```
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论