index.js
2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* eslint-disable */
import React, { useState } from "react";
import { Modal, Space, Button } from "antd";
import * as commonUtils from "@/utils/utils";
import CommonViewTable from "@/components/Common/CommonViewTable";
import styles from "./index.less";
const InputMultiModalComponent = props => {
const { visible, title, value = '', record = {}, sName, showConfig } = props;
const [viewRow, setViewRow] = useState({
sId: commonUtils.createSid(),
sMemo: value.replace(/;/g, ",")
});
const viewConfigs = [
{
sId: showConfig.sId + "1",
sName: "sMemo",
showName: "内容",
sControlName: "",
iRowValue: 6,
iColValue: 24
},
{
...showConfig,
sName: "sSelect",
showName: "下拉选择",
bCanInput: true,
iColValue: 24
}
];
const config = {
gdsconfigformslave: viewConfigs
};
const viewProps = {
...props,
viewConfigs,
tableConfig: config,
iColValueView: 24,
viewRow,
tableName: sName,
onDataChange: (...args) => {
const sFieldName = args[1];
const value = args[2];
if (sFieldName === "sMemo") {
setViewRow(pre => ({ ...pre, ...value }));
} else {
const { sSelect } = value;
setViewRow(pre => {
const { sMemo = "" } = pre;
const arr = sMemo.split(";").filter(item => item && item.trim());
if (!arr.includes(sSelect)) {
arr.push(sSelect);
}
return { ...pre, sMemo: arr.join(";") };
});
}
}
};
const onOk = () => {
props.handleSelectOptionEvent(viewRow.sMemo);
props.onCancel();
};
return (
<Modal
width={600}
className="mesCommonModal"
maskClosable={false}
title={title}
open={visible}
onCancel={props.onCancel}
footer={
<Space>
<Button size="large" onClick={() => props.onCancel()}>
取消
</Button>
<Button type="primary" size="large" onClick={onOk}>
确定
</Button>
</Space>
}
>
<div className={styles.inputMulti} key={123}>
<CommonViewTable {...viewProps} />
</div>
</Modal>
);
};
export default InputMultiModalComponent;