|
@@ -6,6 +6,7 @@ import { isArray, result } from 'lodash';
|
|
import { useForm } from 'rc-field-form';
|
|
import { useForm } from 'rc-field-form';
|
|
import { async } from '@antv/x6/lib/registry/marker/async';
|
|
import { async } from '@antv/x6/lib/registry/marker/async';
|
|
import AuditDetailed from './AuditDetailed';
|
|
import AuditDetailed from './AuditDetailed';
|
|
|
|
+import AuditFlow from './AuditFlow';
|
|
import { queryDingSchema } from '@/services/boom';
|
|
import { queryDingSchema } from '@/services/boom';
|
|
import { Form as Form3x } from '@ant-design/compatible';
|
|
import { Form as Form3x } from '@ant-design/compatible';
|
|
|
|
|
|
@@ -21,119 +22,8 @@ function CommitAuditModal(props) {
|
|
const [length, setLength] = useState(1);
|
|
const [length, setLength] = useState(1);
|
|
const [formData, setFromData] = useState({});
|
|
const [formData, setFromData] = useState({});
|
|
const [auditList, setAuditList] = useState([]); //用于创建Tabs表单
|
|
const [auditList, setAuditList] = useState([]); //用于创建Tabs表单
|
|
|
|
+ const [formComponentValues, setFormComponentValues] = useState({}); //用于创建Tabs表单
|
|
const [form] = Form.useForm();
|
|
const [form] = Form.useForm();
|
|
- const formDataRef = useRef([]);
|
|
|
|
-
|
|
|
|
- const res = {
|
|
|
|
- result: {
|
|
|
|
- creatorUserId: '1649060463062661',
|
|
|
|
- gmtModified: '2022-08-10T15:24Z',
|
|
|
|
- formUuid: 'FORM-50442153-A9E8-4247-903C-AAF68B4C6219',
|
|
|
|
- bizType: '',
|
|
|
|
- ownerIdType: 'orgId',
|
|
|
|
- formCode: 'PROC-F2AD61A8-25CF-47AB-96EA-E0D0850BBE35',
|
|
|
|
- memo: '',
|
|
|
|
- engineType: 0,
|
|
|
|
- ownerId: '8642326',
|
|
|
|
- gmtCreate: '2022-08-09T11:53Z',
|
|
|
|
- schemaContent: {
|
|
|
|
- icon: 'promotion',
|
|
|
|
- title: '测试2',
|
|
|
|
- items: [
|
|
|
|
- {
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- componentName: 'NumberField',
|
|
|
|
- props: {
|
|
|
|
- id: 'NumberField_S1TT9HEIZGG0',
|
|
|
|
- label: '数字输入框',
|
|
|
|
- required: false,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- componentName: 'DDSelectField',
|
|
|
|
- props: {
|
|
|
|
- id: 'DDSelectField_1UAHP7C7C3NK0',
|
|
|
|
- label: '单选框',
|
|
|
|
- required: false,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- componentName: 'PhoneField',
|
|
|
|
- props: {
|
|
|
|
- id: 'PhoneField_SEIS8H2KAQO0',
|
|
|
|
- label: '电话',
|
|
|
|
- required: false,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- componentName: 'TableField',
|
|
|
|
- props: {
|
|
|
|
- staffStatusEnabled: false,
|
|
|
|
- holidayOptions: [],
|
|
|
|
- id: 'TableField_1NFDDN09KZQ80',
|
|
|
|
- label: '表格',
|
|
|
|
- push: {},
|
|
|
|
- actionName: '添加',
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- componentName: 'DepartmentField',
|
|
|
|
- props: {
|
|
|
|
- staffStatusEnabled: false,
|
|
|
|
- holidayOptions: [],
|
|
|
|
- id: 'DepartmentField_23VD81FG2G5C0',
|
|
|
|
- label: '部门',
|
|
|
|
- placeholder: '请选择',
|
|
|
|
- required: false,
|
|
|
|
- push: {},
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- componentName: 'DDAttachment',
|
|
|
|
- props: {
|
|
|
|
- staffStatusEnabled: false,
|
|
|
|
- holidayOptions: [],
|
|
|
|
- id: 'DDAttachment_YP8901BICJ4',
|
|
|
|
- label: '附件',
|
|
|
|
- required: false,
|
|
|
|
- push: {},
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- componentName: 'TextareaField',
|
|
|
|
- props: {
|
|
|
|
- staffStatusEnabled: false,
|
|
|
|
- holidayOptions: [],
|
|
|
|
- id: '请假事由',
|
|
|
|
- label: '请假事由',
|
|
|
|
- placeholder: '请输入请假事由',
|
|
|
|
- required: false,
|
|
|
|
- push: {},
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- componentName: 'DDPhotoField',
|
|
|
|
- props: {
|
|
|
|
- staffStatusEnabled: false,
|
|
|
|
- holidayOptions: [],
|
|
|
|
- id: '图片',
|
|
|
|
- label: '上传病假单(如病假)',
|
|
|
|
- push: {},
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- appUuid: 'ding0cdce2d5dbf986d9',
|
|
|
|
- appType: 0,
|
|
|
|
- visibleRange: 'PRIVATE',
|
|
|
|
- listOrder: 1084,
|
|
|
|
- name: '测试2',
|
|
|
|
- status: 'PUBLISHED',
|
|
|
|
- procType: '',
|
|
|
|
- },
|
|
|
|
- };
|
|
|
|
- const [schemaContent, setSchemaContent] = useState(res.result.schemaContent);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (!visible) return;
|
|
if (!visible) return;
|
|
@@ -256,46 +146,40 @@ function CommitAuditModal(props) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
console.log(addAuditList);
|
|
console.log(addAuditList);
|
|
- setAuditList(
|
|
|
|
- addAuditList.map((item, index) => {
|
|
|
|
- let FormComponents = Form3x.create({
|
|
|
|
- onValuesChange: (props, changedValues, allValues) => {
|
|
|
|
- const { items } = props;
|
|
|
|
- console.log(props, allValues);
|
|
|
|
- let formData = formDataRef.current;
|
|
|
|
- formData[item.formCode] = items
|
|
|
|
- .map(item => {
|
|
|
|
- const itemProps = item.props;
|
|
|
|
- if (!itemProps.label) return;
|
|
|
|
- let val = allValues[itemProps.id];
|
|
|
|
- if (val instanceof Object) {
|
|
|
|
- return {
|
|
|
|
- name: itemProps.label,
|
|
|
|
- id: itemProps.id,
|
|
|
|
- ...val,
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
|
|
+ addAuditList.forEach((item, index) => {
|
|
|
|
+ let Components = Form3x.create({
|
|
|
|
+ onValuesChange: (props, changedValues, allValues) => {
|
|
|
|
+ const { items } = props;
|
|
|
|
+ console.log(props, allValues);
|
|
|
|
+ formComponentValues[item.formCode] = items
|
|
|
|
+ .map(item => {
|
|
|
|
+ const itemProps = item.props;
|
|
|
|
+ if (!itemProps.label) return;
|
|
|
|
+ let val = allValues[itemProps.id];
|
|
|
|
+ if (val instanceof Object) {
|
|
return {
|
|
return {
|
|
name: itemProps.label,
|
|
name: itemProps.label,
|
|
- // id: itemProps.id,
|
|
|
|
- value: allValues[itemProps.id],
|
|
|
|
|
|
+ id: itemProps.id,
|
|
|
|
+ ...val,
|
|
};
|
|
};
|
|
- })
|
|
|
|
- .filter(item => item);
|
|
|
|
- console.log(formData);
|
|
|
|
- },
|
|
|
|
- })(AuditDetailed);
|
|
|
|
-
|
|
|
|
- return {
|
|
|
|
- ...item,
|
|
|
|
- FormComponents: <FormComponents items={item.schemaContent.items} />,
|
|
|
|
- };
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ name: itemProps.label,
|
|
|
|
+ // id: itemProps.id,
|
|
|
|
+ value: allValues[itemProps.id] || '',
|
|
|
|
+ };
|
|
|
|
+ })
|
|
|
|
+ .filter(item => item);
|
|
|
|
+ setFormComponentValues({ ...formComponentValues });
|
|
|
|
+ },
|
|
|
|
+ })(AuditDetailed);
|
|
|
|
+ item.FormComponents = <Components items={item.schemaContent.items} />;
|
|
|
|
+ });
|
|
|
|
+ setAuditList(addAuditList);
|
|
};
|
|
};
|
|
|
|
|
|
const getFromData = idList => {
|
|
const getFromData = idList => {
|
|
- const data = formDataRef.current;
|
|
|
|
|
|
+ const data = formComponentValues;
|
|
const result = [];
|
|
const result = [];
|
|
//获取流转节点的层级关系
|
|
//获取流转节点的层级关系
|
|
let len = 0;
|
|
let len = 0;
|
|
@@ -333,7 +217,7 @@ function CommitAuditModal(props) {
|
|
};
|
|
};
|
|
const onFinish = async () => {
|
|
const onFinish = async () => {
|
|
var fieldsValue = await form.validateFields();
|
|
var fieldsValue = await form.validateFields();
|
|
- console.log(formDataRef.current);
|
|
|
|
|
|
+ console.log(formComponentValues);
|
|
let hasFlowId = true; //是否都绑定审批节点
|
|
let hasFlowId = true; //是否都绑定审批节点
|
|
const getFlowPath = node => {
|
|
const getFlowPath = node => {
|
|
//[134, 135]
|
|
//[134, 135]
|
|
@@ -476,6 +360,10 @@ function CommitAuditModal(props) {
|
|
// </TabPane>
|
|
// </TabPane>
|
|
<TabPane tab={item.name} key={`${idx}_${item.title}`}>
|
|
<TabPane tab={item.name} key={`${idx}_${item.title}`}>
|
|
{item.FormComponents}
|
|
{item.FormComponents}
|
|
|
|
+ <AuditFlow
|
|
|
|
+ processCode={item.formCode}
|
|
|
|
+ formComponentValues={formComponentValues[item.formCode]}
|
|
|
|
+ />
|
|
</TabPane>
|
|
</TabPane>
|
|
))}
|
|
))}
|
|
</Tabs>
|
|
</Tabs>
|