|
@@ -7,6 +7,12 @@ import ProForm, {
|
|
ProFormDateRangePicker,
|
|
ProFormDateRangePicker,
|
|
ProFormSelect,
|
|
ProFormSelect,
|
|
} from '@ant-design/pro-form';
|
|
} from '@ant-design/pro-form';
|
|
|
|
+import {
|
|
|
|
+ addSupPermission
|
|
|
|
+} from '../services/API';
|
|
|
|
+import {
|
|
|
|
+ urlType
|
|
|
|
+} from '@/utils/dataDic';
|
|
|
|
|
|
class NewPermission extends Component{
|
|
class NewPermission extends Component{
|
|
constructor(props) {
|
|
constructor(props) {
|
|
@@ -24,14 +30,38 @@ class NewPermission extends Component{
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- newPermission=()=>{
|
|
|
|
-
|
|
|
|
|
|
+ newPermission= async(values) => {
|
|
|
|
+ if(this.props.userDetaile){
|
|
|
|
+ if (!this.state.auto) {
|
|
|
|
+ message.warning('请输入上级模块')
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const msg = await addSupPermission(values);
|
|
|
|
+ if(msg.error.length === 0){
|
|
|
|
+ message.success('新增成功')
|
|
|
|
+ return true;
|
|
|
|
+ }else {
|
|
|
|
+ message.warning(msg.error[0].message);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ // {
|
|
|
|
+ // id: this.state.ids,
|
|
|
|
+ // name: this.state.name, //接口名称
|
|
|
|
+ // url: this.state.url, //接口路径
|
|
|
|
+ // type: this.state.urlType || "0",
|
|
|
|
+ // superId: this.state.auto, //接口上级模板功能
|
|
|
|
+ // showOrder: this.state.showOrder,
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
render() {
|
|
render() {
|
|
return (
|
|
return (
|
|
<ModalForm
|
|
<ModalForm
|
|
title="新建权限"
|
|
title="新建权限"
|
|
|
|
+ initialValues={{
|
|
|
|
+ type: 0
|
|
|
|
+ }}
|
|
trigger={
|
|
trigger={
|
|
<Button
|
|
<Button
|
|
type="primary"
|
|
type="primary"
|
|
@@ -45,10 +75,7 @@ class NewPermission extends Component{
|
|
onCancel: () => this.setState({ showDesc: true }),
|
|
onCancel: () => this.setState({ showDesc: true }),
|
|
}}
|
|
}}
|
|
onFinish={async (values) => {
|
|
onFinish={async (values) => {
|
|
- await waitTime(2000);
|
|
|
|
- console.log(values);
|
|
|
|
- message.success('提交成功');
|
|
|
|
- return true;
|
|
|
|
|
|
+ this.newPermission(values);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
<ProForm.Group>
|
|
<ProForm.Group>
|
|
@@ -64,20 +91,22 @@ class NewPermission extends Component{
|
|
<ProFormText
|
|
<ProFormText
|
|
required
|
|
required
|
|
width="xl"
|
|
width="xl"
|
|
- name="name"
|
|
|
|
|
|
+ name="url"
|
|
label="接口路径:"
|
|
label="接口路径:"
|
|
placeholder="请输入接口路径"
|
|
placeholder="请输入接口路径"
|
|
/>
|
|
/>
|
|
</ProForm.Group>
|
|
</ProForm.Group>
|
|
<ProForm.Group>
|
|
<ProForm.Group>
|
|
- <ProFormText
|
|
|
|
|
|
+ <ProFormSelect
|
|
|
|
+ required
|
|
width="xl"
|
|
width="xl"
|
|
- name="name"
|
|
|
|
|
|
+ name="type"
|
|
label="接口类型:"
|
|
label="接口类型:"
|
|
placeholder="请选择接口类型"
|
|
placeholder="请选择接口类型"
|
|
disabled
|
|
disabled
|
|
|
|
+ request={async () => urlType}
|
|
/>
|
|
/>
|
|
- </ProForm.Group>
|
|
|
|
|
|
+ </ProForm.Group>
|
|
</ModalForm>
|
|
</ModalForm>
|
|
);
|
|
);
|
|
}
|
|
}
|