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

新增路由参数

上级 42d3be70
...@@ -14,6 +14,14 @@ export default class index extends Component { ...@@ -14,6 +14,14 @@ export default class index extends Component {
data, data,
isNewForm isNewForm
} = this.props } = 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 ( return (
<div> <div>
{ {
...@@ -40,6 +48,7 @@ export default class index extends Component { ...@@ -40,6 +48,7 @@ export default class index extends Component {
obj={data.hisTaskForm.formData} obj={data.hisTaskForm.formData}
form={this.props.form} form={this.props.form}
formKey={item.formKey} formKey={item.formKey}
routerState={routerState}
/> />
} }
</> </>
......
...@@ -41,6 +41,13 @@ export default class Index extends Component { ...@@ -41,6 +41,13 @@ export default class Index extends Component {
const { const {
data data
} = this.state } = 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 ( return (
<> <>
{ {
...@@ -48,6 +55,7 @@ export default class Index extends Component { ...@@ -48,6 +55,7 @@ export default class Index extends Component {
get={get} get={get}
postData={data} postData={data}
form={form} form={form}
routerState={routerState}
/> />
} }
</> </>
......
...@@ -358,8 +358,7 @@ export default class ZdyTable extends Component { ...@@ -358,8 +358,7 @@ export default class ZdyTable extends Component {
render() { render() {
let { width, isBorder, sqlData, mapData, defaultBinds, defaultValues, items, init, currentFormKey, isEdit, datas, isReady, formConfig, formCode, formId } = this.state let { width, isBorder, sqlData, mapData, defaultBinds, defaultValues, items, init, currentFormKey, isEdit, datas, isReady, formConfig, formCode, formId } = this.state
let { border, get, obj, index, fatherCode,routerState } = this.props
let { border, get, obj, index, fatherCode } = this.props
let style = {} let style = {}
if (formConfig.style != null) { if (formConfig.style != null) {
try { try {
...@@ -481,6 +480,7 @@ export default class ZdyTable extends Component { ...@@ -481,6 +480,7 @@ export default class ZdyTable extends Component {
form={this.props.form} // antd form控件 form={this.props.form} // antd form控件
sqlData={sqlData} sqlData={sqlData}
defaultValues={defaultValues || {}} // 接口中的默认值 defaultValues={defaultValues || {}} // 接口中的默认值
routerState={routerState} // 兼容表单设计器路由传参
/> />
</td> </td>
} }
...@@ -560,6 +560,7 @@ export default class ZdyTable extends Component { ...@@ -560,6 +560,7 @@ export default class ZdyTable extends Component {
mapData={mapData} mapData={mapData}
json={ary.content} json={ary.content}
uuid={ary.uuid} uuid={ary.uuid}
routerState={routerState} // 兼容表单设计器路由传参
defaultValues={defaultValues || {}} /></> defaultValues={defaultValues || {}} /></>
}) })
} }
......
...@@ -1127,7 +1127,7 @@ export default class tableCom extends Component { ...@@ -1127,7 +1127,7 @@ export default class tableCom extends Component {
}) })
}) })
try { 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 let obj
if(!this.props.isEdit&&this.props.fatherCode){ if(!this.props.isEdit&&this.props.fatherCode){
...@@ -1149,7 +1149,8 @@ export default class tableCom extends Component { ...@@ -1149,7 +1149,8 @@ export default class tableCom extends Component {
md5: md5, md5: md5,
render:this.getRender,base64:getBase64, render:this.getRender,base64:getBase64,
}, },
functionObj functionObj,
this.props.routerState
) )
if (base52) { if (base52) {
......
# 编辑日期
2020-4-20
#依赖资源 #依赖资源
```js ```js
...@@ -87,3 +91,31 @@ import HistoryForm from '@/webPublic/one_stop_public/Entrance/historyForm'; ...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论