|
@@ -1,6 +1,6 @@
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
import { FlowchartFormWrapper } from '@antv/xflow';
|
|
|
-import { Button, message } from 'antd';
|
|
|
+import { Button, message, Select } from 'antd';
|
|
|
import LuckyExcel from 'luckyexcel';
|
|
|
import {
|
|
|
Position,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
} from '../fields';
|
|
|
import { PREFIX } from '../constants';
|
|
|
import { UnityAction } from '@/utils/utils';
|
|
|
+import { connect } from 'dva';
|
|
|
|
|
|
export interface IConfig {
|
|
|
label?: string;
|
|
@@ -31,6 +32,7 @@ export interface IConfig {
|
|
|
version_name?: string;
|
|
|
data?: any;
|
|
|
excel_info?: any;
|
|
|
+ role_list?:string;
|
|
|
}
|
|
|
|
|
|
const defaultConfig: IConfig = {
|
|
@@ -39,8 +41,9 @@ const defaultConfig: IConfig = {
|
|
|
};
|
|
|
|
|
|
const Component = (props: any) => {
|
|
|
- const { config, plugin = {} } = props;
|
|
|
+ const { config, plugin = {}, roleList } = props;
|
|
|
const { updateNode } = plugin;
|
|
|
+ const [options, setOptions] = useState([])
|
|
|
const [nodeConfig, setNodeConfig] = useState<IConfig>({
|
|
|
...defaultConfig,
|
|
|
...config,
|
|
@@ -113,6 +116,16 @@ const Component = (props: any) => {
|
|
|
}, [config]);
|
|
|
// console.log(nodeConfig, config)
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if(!roleList || roleList.length <= 0) return;
|
|
|
+ let op = []
|
|
|
+ roleList.forEach(item => {
|
|
|
+ op.push({label:item.Name, value:item.ID})
|
|
|
+ })
|
|
|
+ setOptions(op);
|
|
|
+ console.log(op)
|
|
|
+ },[roleList])
|
|
|
+
|
|
|
return (
|
|
|
<div className={`${PREFIX}-panel-body`}>
|
|
|
<div className={`${PREFIX}-panel-group`}>
|
|
@@ -166,6 +179,20 @@ const Component = (props: any) => {
|
|
|
<div>{nodeConfig.excel_info?.file_name}</div>
|
|
|
</>
|
|
|
)}
|
|
|
+ <div className='group'>
|
|
|
+ <label>权限</label>
|
|
|
+ <Select
|
|
|
+ value= {nodeConfig.role_list ? nodeConfig.role_list.split(",").map(item=>Number(item)) : []}
|
|
|
+ mode="multiple"
|
|
|
+ allowClear
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ placeholder="选择权限"
|
|
|
+ onChange={(v: number[]) => {
|
|
|
+ onNodeConfigChange('role_list', v.join(','))
|
|
|
+ }}
|
|
|
+ options={options}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div className={`${PREFIX}-panel-group`}>
|
|
|
<h5>样式</h5>
|
|
@@ -229,10 +256,12 @@ const Component = (props: any) => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-export default function RecthServe(props: any) {
|
|
|
+function RecthServe(props: any) {
|
|
|
return (
|
|
|
<FlowchartFormWrapper {...props}>
|
|
|
{(config, plugin) => <Component {...props} plugin={plugin} config={config} />}
|
|
|
</FlowchartFormWrapper>
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+export default connect(({ flow }) => ({ roleList: flow.roleList }))(RecthServe);
|