aldehyde 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/controls/counting-tag/index.d.ts +18 -0
- package/lib/controls/counting-tag/index.d.ts.map +1 -0
- package/lib/controls/counting-tag/index.js +31 -0
- package/lib/controls/counting-tag/index.js.map +1 -0
- package/lib/controls/entity-select/entity-select.js +2 -2
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/controls/entity-select/popover-entity-select.d.ts +3 -3
- package/lib/controls/entity-select/popover-entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/popover-entity-select.js +4 -4
- package/lib/controls/entity-select/popover-entity-select.js.map +1 -1
- package/lib/controls/entry-control.d.ts +1 -0
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +23 -6
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/view-control.d.ts.map +1 -1
- package/lib/controls/view-control.js +1 -0
- package/lib/controls/view-control.js.map +1 -1
- package/lib/detail/edit/dtmpl-edit.js +2 -2
- package/lib/detail/edit/dtmpl-edit.js.map +1 -1
- package/lib/detail/edit/row-editor.d.ts +2 -0
- package/lib/detail/edit/row-editor.d.ts.map +1 -1
- package/lib/detail/edit/row-editor.js +4 -3
- package/lib/detail/edit/row-editor.js.map +1 -1
- package/lib/form/criteria-form.d.ts +1 -0
- package/lib/form/criteria-form.d.ts.map +1 -1
- package/lib/form/criteria-form.js +1 -1
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/dtmpl-form.js +5 -6
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/form/form-Item-group.d.ts +1 -0
- package/lib/form/form-Item-group.d.ts.map +1 -1
- package/lib/form/form-Item-group.js +3 -3
- package/lib/form/form-Item-group.js.map +1 -1
- package/lib/table/modal-select-table.d.ts +1 -0
- package/lib/table/modal-select-table.d.ts.map +1 -1
- package/lib/table/modal-select-table.js +2 -2
- package/lib/table/modal-select-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +1 -0
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +20 -52
- package/lib/table/relation-table.js.map +1 -1
- package/lib/table/select-table.d.ts +1 -0
- package/lib/table/select-table.d.ts.map +1 -1
- package/lib/table/select-table.js +2 -1
- package/lib/table/select-table.js.map +1 -1
- package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
- package/lib/tmpl/control-type-supportor.js +1 -0
- package/lib/tmpl/control-type-supportor.js.map +1 -1
- package/lib/tmpl/interface.d.ts +2 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/counting-tag/index.tsx +45 -0
- package/src/aldehyde/controls/entity-select/entity-select.tsx +2 -2
- package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +5 -5
- package/src/aldehyde/controls/entry-control.tsx +14 -6
- package/src/aldehyde/controls/view-control.tsx +1 -0
- package/src/aldehyde/detail/edit/dtmpl-edit.tsx +2 -2
- package/src/aldehyde/detail/edit/row-editor.tsx +5 -2
- package/src/aldehyde/form/criteria-form.tsx +3 -1
- package/src/aldehyde/form/dtmpl-form.tsx +4 -4
- package/src/aldehyde/form/form-Item-group.tsx +4 -3
- package/src/aldehyde/table/modal-select-table.tsx +3 -2
- package/src/aldehyde/table/relation-table.tsx +25 -54
- package/src/aldehyde/table/select-table.tsx +3 -1
- package/src/aldehyde/tmpl/control-type-supportor.tsx +1 -0
- package/src/aldehyde/tmpl/interface.tsx +2 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Tag,Input} from "antd";
|
|
3
|
+
import {VEControlProps} from "../../tmpl/interface";
|
|
4
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
5
|
+
import Units from "../../units";
|
|
6
|
+
|
|
7
|
+
interface CountingTagProps extends VEControlProps {
|
|
8
|
+
count:number,
|
|
9
|
+
}
|
|
10
|
+
interface CountingTagState {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default class CountingTag extends React.PureComponent<CountingTagProps, CountingTagState>{
|
|
14
|
+
|
|
15
|
+
componentDidMount() {
|
|
16
|
+
const {count,onChange,min}=this.props;
|
|
17
|
+
// this.onChange();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
componentDidUpdate(preProps) {
|
|
21
|
+
const {count,onChange,min}=this.props;
|
|
22
|
+
if((this.props.count || this.props.count==0) && preProps.count!=this.props.count){
|
|
23
|
+
this.onChange()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
onChange=()=>{
|
|
28
|
+
const {count,onChange,min}=this.props;
|
|
29
|
+
console.log('关系 this.props 修改', this.props);
|
|
30
|
+
onChange((count || count==0 ) && count>=Number(min) ? 1:null);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static defaultProps={
|
|
34
|
+
min:0
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render(){
|
|
38
|
+
|
|
39
|
+
const {count,min,value}=this.props;
|
|
40
|
+
console.log('关系 this.props', value);
|
|
41
|
+
return <></>
|
|
42
|
+
// return <Tag style={{marginBottom: 10}} color="blue">{count?count:0}</Tag>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
@@ -108,7 +108,7 @@ export default class EntitySelect extends React.PureComponent<InnerEntitySelectP
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
fetchOptions = async (searchText) => {
|
|
111
|
-
const { fieldConfig} = this.props;
|
|
111
|
+
const { fieldConfig,mainCode} = this.props;
|
|
112
112
|
|
|
113
113
|
this.setState({
|
|
114
114
|
loading: true,
|
|
@@ -146,7 +146,7 @@ export default class EntitySelect extends React.PureComponent<InnerEntitySelectP
|
|
|
146
146
|
//构建过滤条件
|
|
147
147
|
let criteriaData = {};
|
|
148
148
|
criteriaData[formItemName] = searchText;
|
|
149
|
-
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey( fieldConfig.id, {...criteriaData, ...pageInfo});
|
|
149
|
+
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey( fieldConfig.id, {...criteriaData, ...pageInfo,mainCode});
|
|
150
150
|
let sourceData = await this.loadData(queryKey.key, pageInfo, titleId);
|
|
151
151
|
|
|
152
152
|
optionCache = {
|
|
@@ -5,16 +5,16 @@ import {SearchOutlined} from '@ant-design/icons';
|
|
|
5
5
|
import SelectTable from '../../table/select-table'
|
|
6
6
|
import './index.css'
|
|
7
7
|
|
|
8
|
-
interface
|
|
8
|
+
interface PopoverEntitySelectProps extends EControlProps {
|
|
9
9
|
maxSelected?: number,
|
|
10
10
|
onEntityClick?: (code: string) => void,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
interface
|
|
13
|
+
interface PopoverEntitySelectState {
|
|
14
14
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export default class
|
|
17
|
+
export default class PopoverEntitySelect extends React.PureComponent<PopoverEntitySelectProps, PopoverEntitySelectState> {
|
|
18
18
|
|
|
19
19
|
static defaultProps = {
|
|
20
20
|
maxSelected: 100,
|
|
@@ -53,7 +53,7 @@ export default class EntitySelect extends React.PureComponent<EntitySelectProps,
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
render() {
|
|
56
|
-
const {id,value, itemType, fieldConfig, onChange, style, maxSelected, onEntityClick} = this.props;
|
|
56
|
+
const {id,value, itemType, fieldConfig, onChange, style, maxSelected, onEntityClick,mainCode} = this.props;
|
|
57
57
|
const {} = this.state;
|
|
58
58
|
let selectedRows: SelectedRow[] = [];
|
|
59
59
|
let relationOptions = []
|
|
@@ -99,7 +99,7 @@ export default class EntitySelect extends React.PureComponent<EntitySelectProps,
|
|
|
99
99
|
borderRadius: '6px',
|
|
100
100
|
borderWidth: '0px',
|
|
101
101
|
borderColor: '#8c8c8c'
|
|
102
|
-
}}><SelectTable maxSelectedRows={maxSelected} selectedRows={selectedRows} sourceId={fieldConfig.id}
|
|
102
|
+
}}><SelectTable mainCode={mainCode} maxSelectedRows={maxSelected} selectedRows={selectedRows} sourceId={fieldConfig.id}
|
|
103
103
|
onChange={this.onSelect}></SelectTable></div>}
|
|
104
104
|
trigger="click">
|
|
105
105
|
<Select id={id} style={{...style}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {FieldConfig, ViewOrEdit} from "../tmpl/interface";
|
|
3
|
-
import {Alert, Input, Select, Spin, Checkbox,Radio} from "antd";
|
|
3
|
+
import {Alert, Input, Select, Spin, Checkbox,Radio,Switch} from "antd";
|
|
4
4
|
import Rfield from "./rfield";
|
|
5
5
|
import ControlTypeSupportor from "../tmpl/control-type-supportor";
|
|
6
6
|
import DatePicker from './date-picker';
|
|
@@ -40,6 +40,7 @@ const HtmlEditor = loadable(() =>
|
|
|
40
40
|
const {TextArea} = Input;
|
|
41
41
|
|
|
42
42
|
interface EntryControlProps {
|
|
43
|
+
mainCode?:string,
|
|
43
44
|
value?: any;
|
|
44
45
|
fieldConfig: FieldConfig;
|
|
45
46
|
onChange?: any;
|
|
@@ -59,7 +60,7 @@ function getOptions(mstrucId) {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
|
|
62
|
-
function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChange: any, width: any) {
|
|
63
|
+
function renderControl(id:any,mainCode:string,fieldConfig: FieldConfig, fieldValue: any, onChange: any, width: any) {
|
|
63
64
|
|
|
64
65
|
let itemType = ControlTypeSupportor.getControlType(fieldConfig, fieldValue);
|
|
65
66
|
|
|
@@ -75,11 +76,11 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
75
76
|
let max=(fieldConfigM || fieldConfigM=='0' ) ? Units.configParamTrans(fieldConfigM) : undefined;;
|
|
76
77
|
|
|
77
78
|
let controlProps = {
|
|
78
|
-
id, fieldConfig,min,max, itemType, viewOrEdit, onChange, disabled, value: fieldValue, style: {minWidth: 220, width: '100%'}
|
|
79
|
+
id, mainCode,fieldConfig,min,max, itemType, viewOrEdit, onChange, disabled, value: fieldValue, style: {minWidth: 220, width: '100%'}
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
let antdControlProps = {
|
|
82
|
-
id, placeholder, disabled, value: fieldValue, onChange, style: {minWidth: 220, width: '100%'}
|
|
83
|
+
id, mainCode,placeholder, disabled, value: fieldValue, onChange, style: {minWidth: 220, width: '100%'}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
const unSupportControl = <Input
|
|
@@ -155,6 +156,13 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
155
156
|
case "radio":
|
|
156
157
|
entryControl = <RadioGroup {...antdControlProps} options={getOptions(fieldConfig.mstrucId)} value={typeof (fieldValue) == 'string' ? fieldValue.split(',')[0] : fieldValue} />
|
|
157
158
|
break;
|
|
159
|
+
case "yes-no-switch":
|
|
160
|
+
const {value,onChange,style,...other}=antdControlProps
|
|
161
|
+
entryControl =<Switch style={{width:'60px'}} checkedChildren="是" unCheckedChildren="否" checked={value=='是'?true:false} onChange={(checked)=>{
|
|
162
|
+
onChange(checked?'是':'否');
|
|
163
|
+
}
|
|
164
|
+
} {...other} />
|
|
165
|
+
break;
|
|
158
166
|
case 'date-YY':
|
|
159
167
|
case 'daterange-YY':
|
|
160
168
|
case 'date-M1':
|
|
@@ -250,8 +258,8 @@ function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChang
|
|
|
250
258
|
}
|
|
251
259
|
|
|
252
260
|
const EntryControl: React.FC<EntryControlProps> = (props) => {
|
|
253
|
-
const {fieldConfig, value, onChange,id} = props;
|
|
254
|
-
return renderControl(id,fieldConfig, value, onChange, null);
|
|
261
|
+
const {fieldConfig, value, onChange,id,mainCode} = props;
|
|
262
|
+
return renderControl(id,mainCode,fieldConfig, value, onChange, null);
|
|
255
263
|
}
|
|
256
264
|
|
|
257
265
|
export default EntryControl;
|
|
@@ -187,7 +187,7 @@ export default class DtmplEdit extends React.PureComponent<DtmplEditProps, Dtmpl
|
|
|
187
187
|
render() {
|
|
188
188
|
const {dtmplConfig, showPostResult,loading,id,serial,dtmplData} = this.state;
|
|
189
189
|
console.log(" dtmpl edit serial:",serial);
|
|
190
|
-
const { sourceId, showRightNav, code,addOrUpdate,maxColsOnRow} = this.props;
|
|
190
|
+
const { sourceId, showRightNav, code,addOrUpdate,maxColsOnRow,mainCode} = this.props;
|
|
191
191
|
//const {title} = dtmplConfig;
|
|
192
192
|
if (!dtmplConfig) {
|
|
193
193
|
return <Card loading={loading}>
|
|
@@ -195,7 +195,7 @@ export default class DtmplEdit extends React.PureComponent<DtmplEditProps, Dtmpl
|
|
|
195
195
|
}
|
|
196
196
|
return (
|
|
197
197
|
<div className={`detailPage ${showRightNav ? 'showRightNav' : 'noRightNav'}`} onClick={this.onClickBody}>
|
|
198
|
-
<DtmplForm parentId={id} dtmplConfig={dtmplConfig} formRef={this.formRef} sourceId={sourceId}
|
|
198
|
+
<DtmplForm mainCode={mainCode} parentId={id} dtmplConfig={dtmplConfig} formRef={this.formRef} sourceId={sourceId}
|
|
199
199
|
onFinish={this.onFinish} maxColsOnRow={maxColsOnRow}
|
|
200
200
|
showConfirm={true} dtmplData={dtmplData} onValuesChange={this.onValuesChange}></DtmplForm>
|
|
201
201
|
{showRightNav ?
|
|
@@ -11,6 +11,7 @@ interface RowEditorProps {
|
|
|
11
11
|
dtmplData?: DtmplData;
|
|
12
12
|
onOk:(value: DtmplData) => void,
|
|
13
13
|
buttonStyle?:object,
|
|
14
|
+
disabled?:boolean
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
interface RowEditorState {
|
|
@@ -20,7 +21,8 @@ interface RowEditorState {
|
|
|
20
21
|
export default class RowEditor extends React.PureComponent<RowEditorProps, RowEditorState> {
|
|
21
22
|
formRef = React.createRef<FormInstance>();
|
|
22
23
|
static defaultProps = {
|
|
23
|
-
buttonIcon:undefined
|
|
24
|
+
buttonIcon:undefined,
|
|
25
|
+
disabled:false,
|
|
24
26
|
}
|
|
25
27
|
state = {
|
|
26
28
|
popoverVisible: false,
|
|
@@ -50,7 +52,7 @@ export default class RowEditor extends React.PureComponent<RowEditorProps, RowEd
|
|
|
50
52
|
|
|
51
53
|
render() {
|
|
52
54
|
const {popoverVisible}=this.state;
|
|
53
|
-
const {buttonIcon, buttonTitle, tooltipTitle, fieldGroupConfig, dtmplData,buttonStyle} = this.props;
|
|
55
|
+
const { disabled, buttonIcon, buttonTitle, tooltipTitle, fieldGroupConfig, dtmplData,buttonStyle} = this.props;
|
|
54
56
|
return <Popover destroyTooltipOnHide={true} placement="leftBottom" visible={popoverVisible}
|
|
55
57
|
content={<RowEditCard fieldGroupConfig={fieldGroupConfig} dtmplData={dtmplData}
|
|
56
58
|
onCancel={()=>{
|
|
@@ -58,6 +60,7 @@ export default class RowEditor extends React.PureComponent<RowEditorProps, RowEd
|
|
|
58
60
|
} onOk={this.onOk}></RowEditCard>} trigger="click">
|
|
59
61
|
<Tooltip placement="left" title={tooltipTitle}>
|
|
60
62
|
<Button
|
|
63
|
+
disabled={disabled}
|
|
61
64
|
style={buttonStyle}
|
|
62
65
|
type='primary'
|
|
63
66
|
icon={buttonIcon}
|
|
@@ -21,6 +21,7 @@ export interface CriteriaFormProps {
|
|
|
21
21
|
hiddenCriteriaIds?: string[];
|
|
22
22
|
visible?: boolean;
|
|
23
23
|
loading: boolean;
|
|
24
|
+
mainCode?:string;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
@@ -151,6 +152,7 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
const renderCriteria = (criterias: CriteriaConfig[]) => {
|
|
155
|
+
|
|
154
156
|
if (!criterias) {
|
|
155
157
|
return;
|
|
156
158
|
}
|
|
@@ -171,7 +173,7 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
|
171
173
|
rules={item.required ? [{
|
|
172
174
|
required: true, message: `请选择${item.title}`,
|
|
173
175
|
}] : undefined}>
|
|
174
|
-
<EntryControl value={fieldValue} fieldConfig={item} />
|
|
176
|
+
<EntryControl mainCode={props.mainCode} value={fieldValue} fieldConfig={item} />
|
|
175
177
|
</FormItem>
|
|
176
178
|
}
|
|
177
179
|
})
|
|
@@ -26,7 +26,6 @@ interface DtmplFormStat {
|
|
|
26
26
|
// changedGroupData:Map<number,DtmplData[]>
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const confirm = Modal.confirm;
|
|
30
29
|
|
|
31
30
|
export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormStat> {
|
|
32
31
|
fuseMode: boolean = false;
|
|
@@ -178,7 +177,7 @@ export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormS
|
|
|
178
177
|
|
|
179
178
|
fieldGroupList = () => {
|
|
180
179
|
|
|
181
|
-
const {dtmplConfig,parentId,maxColsOnRow} = this.props;
|
|
180
|
+
const {dtmplConfig,parentId,maxColsOnRow,mainCode} = this.props;
|
|
182
181
|
const {dtmplData, loading} = this.state;
|
|
183
182
|
|
|
184
183
|
let groups: FieldGroupConfig[];
|
|
@@ -193,7 +192,7 @@ export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormS
|
|
|
193
192
|
if (dtmplData) {
|
|
194
193
|
data = dtmplData.arrayMap[item.id];
|
|
195
194
|
}
|
|
196
|
-
return <RelationTable loading={loading} parentId={parentId} key={item.id} fieldGroupConfig={item} value={data}
|
|
195
|
+
return <RelationTable mainCode={mainCode} loading={loading} parentId={parentId} key={item.id} fieldGroupConfig={item} value={data}
|
|
197
196
|
viewOrEdit={"edit"} onChange={this.onGroupChange}/>
|
|
198
197
|
}
|
|
199
198
|
} else {//字段组
|
|
@@ -204,8 +203,9 @@ export default class Form extends React.PureComponent<DtmplFormProps, DtmplFormS
|
|
|
204
203
|
className="hoverable"
|
|
205
204
|
headStyle={{background: "#f2f4f5"}}
|
|
206
205
|
loading={loading}
|
|
206
|
+
bodyStyle={{padding:'6px'}}
|
|
207
207
|
>
|
|
208
|
-
<FormItemGroup maxColsOnRow={maxColsOnRow} fields={item?item.fields:undefined} valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
208
|
+
<FormItemGroup mainCode={mainCode} maxColsOnRow={maxColsOnRow} fields={item?item.fields:undefined} valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
209
209
|
></FormItemGroup>
|
|
210
210
|
</CollapseCard>
|
|
211
211
|
}
|
|
@@ -15,6 +15,7 @@ export interface FieldGroupProps {
|
|
|
15
15
|
valueMap: object,
|
|
16
16
|
width?: number,
|
|
17
17
|
maxColsOnRow?:number,
|
|
18
|
+
mainCode?:string,
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
interface FieldGroupState {
|
|
@@ -36,7 +37,7 @@ export default class FormItemGroup extends React.PureComponent<FieldGroupProps,
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
initFormList = () => {
|
|
39
|
-
const {fields, valueMap,nameAttr,maxColsOnRow} = this.props
|
|
40
|
+
const {fields, valueMap,nameAttr,maxColsOnRow,mainCode} = this.props
|
|
40
41
|
const formItemList = [];
|
|
41
42
|
|
|
42
43
|
if ( fields && fields.length > 0) {
|
|
@@ -54,7 +55,7 @@ export default class FormItemGroup extends React.PureComponent<FieldGroupProps,
|
|
|
54
55
|
formItem= <FormItem hidden={true}
|
|
55
56
|
initialValue={fieldValue}
|
|
56
57
|
name={item[nameAttr]} key={item.id}>
|
|
57
|
-
<EntryControl value={fieldValue} fieldConfig={item} />
|
|
58
|
+
<EntryControl mainCode={mainCode} value={fieldValue} fieldConfig={item} />
|
|
58
59
|
</FormItem>
|
|
59
60
|
}else{
|
|
60
61
|
formItem = <FormItem label={item.title} name={item[nameAttr]} key={item.id}
|
|
@@ -66,7 +67,7 @@ export default class FormItemGroup extends React.PureComponent<FieldGroupProps,
|
|
|
66
67
|
rules={item.required ? [{
|
|
67
68
|
required: true, message: `请选择${title}`,
|
|
68
69
|
}] : undefined}>
|
|
69
|
-
<EntryControl value={fieldValue} fieldConfig={item} />
|
|
70
|
+
<EntryControl mainCode={mainCode} value={fieldValue} fieldConfig={item} />
|
|
70
71
|
</FormItem>
|
|
71
72
|
}
|
|
72
73
|
formItemList.push(formItem);
|
|
@@ -15,6 +15,7 @@ interface ModelSelectTableProps {
|
|
|
15
15
|
maxSelectedRows: number,
|
|
16
16
|
visible: boolean,
|
|
17
17
|
sourceId: string,
|
|
18
|
+
mainCode:string,
|
|
18
19
|
exceptCodes?: string[],
|
|
19
20
|
onCancel: () => void,
|
|
20
21
|
onOK: (selectedRows: SelectedRow[]) => void,
|
|
@@ -53,10 +54,10 @@ class ModelSelectTable extends React.PureComponent<ModelSelectTableProps, ModelS
|
|
|
53
54
|
pageSize: defaultPageSize ? defaultPageSize : 10,
|
|
54
55
|
virtualEndPageNo: undefined,
|
|
55
56
|
}
|
|
56
|
-
const {sourceId, exceptCodes} = this.props;
|
|
57
|
+
const {sourceId, exceptCodes,mainCode} = this.props;
|
|
57
58
|
/** 构建 dataSource **/
|
|
58
59
|
//构建过滤条件
|
|
59
|
-
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey(sourceId, {exceptCodes, ...criteriaData, ...pageInfo});
|
|
60
|
+
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey(sourceId, {exceptCodes, ...criteriaData, ...pageInfo,mainCode});
|
|
60
61
|
this.setState({
|
|
61
62
|
queryKey,
|
|
62
63
|
criteriaData,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {Button, Input, message, Table, Tooltip} from 'antd';
|
|
2
|
+
import {Button, Input, message, Table, Tooltip,Space,Tag,Row,Col,Form} from 'antd';
|
|
3
3
|
import {
|
|
4
4
|
AlignLeftOutlined,
|
|
5
5
|
DeleteOutlined,
|
|
@@ -20,8 +20,11 @@ import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
|
20
20
|
import CollapseCard from '../controls/collapse-card'
|
|
21
21
|
import RowEditor from '../detail/edit/row-editor'
|
|
22
22
|
import Action from "../controls/action";
|
|
23
|
-
|
|
23
|
+
import EntryControl from "../controls/entry-control";
|
|
24
|
+
import CountingTag from "../controls/counting-tag";
|
|
25
|
+
const FormItem = Form.Item
|
|
24
26
|
interface RelationTableProps {
|
|
27
|
+
mainCode?:string,
|
|
25
28
|
parentId: string,
|
|
26
29
|
loading: boolean,
|
|
27
30
|
viewOrEdit: ViewOrEdit,
|
|
@@ -196,17 +199,7 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
196
199
|
}) : ""}
|
|
197
200
|
{/*行编辑*/}
|
|
198
201
|
{rowEdit ?
|
|
199
|
-
|
|
200
|
-
// <Tooltip placement="left" title="编辑当前行">
|
|
201
|
-
// <Button
|
|
202
|
-
// type='primary'
|
|
203
|
-
// icon={<EditOutlined/>}
|
|
204
|
-
// size="small"
|
|
205
|
-
// // onClick={() => {
|
|
206
|
-
// // this.showRowEditModel(record.code)
|
|
207
|
-
// // }}
|
|
208
|
-
// ></Button> </Tooltip></Popover>
|
|
209
|
-
<RowEditor buttonIcon={<EditOutlined/>} dtmplData={this.getRowEditData(record.code)}
|
|
202
|
+
<RowEditor buttonIcon={<EditOutlined/>} dtmplData={this.getRowEditData(record.code)}
|
|
210
203
|
fieldGroupConfig={fieldGroupConfig}
|
|
211
204
|
onOk={this.handleRowEdit}
|
|
212
205
|
tooltipTitle={"编辑当前行"}></RowEditor> : ""}
|
|
@@ -337,8 +330,6 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
337
330
|
codes.push(row.code);
|
|
338
331
|
}
|
|
339
332
|
await this.add(codes);
|
|
340
|
-
|
|
341
|
-
|
|
342
333
|
}
|
|
343
334
|
|
|
344
335
|
add = async (codes: string[]) => {
|
|
@@ -367,27 +358,6 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
367
358
|
})
|
|
368
359
|
}
|
|
369
360
|
|
|
370
|
-
// edit = async (code: string) => {
|
|
371
|
-
//
|
|
372
|
-
// }
|
|
373
|
-
|
|
374
|
-
// showRowEditModel = (code?: string) => {
|
|
375
|
-
// const {value} = this.props;
|
|
376
|
-
// let selectedDtmplData = undefined;
|
|
377
|
-
// if (code) {
|
|
378
|
-
// for (let dtmplData of value) {
|
|
379
|
-
// if (code == dtmplData.code) {
|
|
380
|
-
// selectedDtmplData = dtmplData;
|
|
381
|
-
// break;
|
|
382
|
-
// }
|
|
383
|
-
// }
|
|
384
|
-
// }
|
|
385
|
-
// this.setState({
|
|
386
|
-
// showRowEdit: true,
|
|
387
|
-
// selectedDtmplData,
|
|
388
|
-
// })
|
|
389
|
-
// }
|
|
390
|
-
|
|
391
361
|
getRowEditData = (code?: string) => {
|
|
392
362
|
const {value} = this.props;
|
|
393
363
|
let data = undefined;
|
|
@@ -483,20 +453,11 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
483
453
|
const buttonDisabled: boolean = fieldGroupConfig.max ? fieldGroupConfig.max <= (value ? value.length : 0) : false;
|
|
484
454
|
|
|
485
455
|
if (viewOrEdit == 'edit') {
|
|
486
|
-
return
|
|
456
|
+
return <Row>
|
|
457
|
+
<Col span={20}>
|
|
458
|
+
<Space>
|
|
487
459
|
{buttons.includes('rowAdd') ?
|
|
488
|
-
|
|
489
|
-
// // <Button
|
|
490
|
-
// // disabled={buttonDisabled}
|
|
491
|
-
// // type='primary'
|
|
492
|
-
// // icon={<PlusOutlined/>}
|
|
493
|
-
// // size="small"
|
|
494
|
-
// // // onClick={() => {
|
|
495
|
-
// // // this.showRowEditModel()
|
|
496
|
-
// // // }}
|
|
497
|
-
// // style={{marginBottom: 10, marginRight: 10}}
|
|
498
|
-
// // >新建一行</Button></Popover>
|
|
499
|
-
<RowEditor buttonStyle={{marginBottom: 10, marginRight: 10}} buttonTitle={"新建一行"}
|
|
460
|
+
<RowEditor disabled={buttonDisabled} buttonStyle={{marginBottom: 10}} buttonTitle={"新建一行"}
|
|
500
461
|
fieldGroupConfig={fieldGroupConfig}
|
|
501
462
|
onOk={this.handleRowEdit}
|
|
502
463
|
></RowEditor>
|
|
@@ -508,7 +469,7 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
508
469
|
icon={<PlusSquareOutlined/>}
|
|
509
470
|
size="small"
|
|
510
471
|
onClick={this.showAddDtmplModel}
|
|
511
|
-
style={{marginBottom: 10
|
|
472
|
+
style={{marginBottom: 10}}
|
|
512
473
|
>新增</Button> : ""}
|
|
513
474
|
{buttons.includes('selectAdd') ?
|
|
514
475
|
<Button
|
|
@@ -517,9 +478,18 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
517
478
|
icon={<SnippetsOutlined/>}
|
|
518
479
|
size="small"
|
|
519
480
|
onClick={this.showSelect}
|
|
520
|
-
style={{marginBottom: 10
|
|
481
|
+
style={{marginBottom: 10}}
|
|
521
482
|
>选择</Button> : ""}
|
|
522
|
-
|
|
483
|
+
<FormItem name={'$virtual'+fieldGroupConfig.id}
|
|
484
|
+
style={{ margin: 0}}
|
|
485
|
+
rules={fieldGroupConfig.min? [{
|
|
486
|
+
required: true, message: `请选择或添加${fieldGroupConfig.title}`,
|
|
487
|
+
}] :null}>
|
|
488
|
+
<CountingTag min={fieldGroupConfig.min+""} style={{marginBottom: 10}} count={value?value.length:0}></CountingTag>
|
|
489
|
+
</FormItem>
|
|
490
|
+
</Space>
|
|
491
|
+
</Col>
|
|
492
|
+
</Row>
|
|
523
493
|
} else {
|
|
524
494
|
return "";
|
|
525
495
|
}
|
|
@@ -533,7 +503,7 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
533
503
|
|
|
534
504
|
render() {
|
|
535
505
|
|
|
536
|
-
const {fieldGroupConfig, value, parentId, loading, initCollapse} = this.props;
|
|
506
|
+
const {fieldGroupConfig, value, parentId, loading, initCollapse,mainCode} = this.props;
|
|
537
507
|
const {pageSize,selectedCode, showDtmplView, showSelectTable, showDtmplEdit, tableLoading, showRowEdit, selectedDtmplData} = this.state;
|
|
538
508
|
|
|
539
509
|
const {buttons} = fieldGroupConfig;
|
|
@@ -564,6 +534,7 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
564
534
|
className={`hoverable`}
|
|
565
535
|
headStyle={{background: "#f2f4f5"}}
|
|
566
536
|
loading={loading}
|
|
537
|
+
bodyStyle={{padding:'6px'}}
|
|
567
538
|
extra={<Input.Search onSearch={this.searchValue} allowClear placeholder="关键字搜索"/>
|
|
568
539
|
}
|
|
569
540
|
>
|
|
@@ -598,7 +569,7 @@ class RelationTable extends React.PureComponent<RelationTableProps, RelationTabl
|
|
|
598
569
|
<ModelSelectTable maxSelectedRows={fieldGroupConfig.max} visible={showSelectTable}
|
|
599
570
|
onOK={this.select} onCancel={() => {
|
|
600
571
|
this.setState({showSelectTable: false})
|
|
601
|
-
}} exceptCodes={exceptCodes}
|
|
572
|
+
}} exceptCodes={exceptCodes} mainCode={mainCode}
|
|
602
573
|
sourceId={fieldGroupConfig.id}></ModelSelectTable> : ""}
|
|
603
574
|
|
|
604
575
|
</>
|
|
@@ -10,6 +10,7 @@ import CriteriaForm from "../form/criteria-form";
|
|
|
10
10
|
import ViewControl from "../controls/view-control";
|
|
11
11
|
|
|
12
12
|
interface SelectTableProps {
|
|
13
|
+
mainCode?:string,
|
|
13
14
|
maxSelectedRows?: number,
|
|
14
15
|
sourceId: string,
|
|
15
16
|
selectedRows: SelectedRow[];
|
|
@@ -45,6 +46,7 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
45
46
|
this.setState({
|
|
46
47
|
loading: true,
|
|
47
48
|
})
|
|
49
|
+
const {mainCode}=this.props;
|
|
48
50
|
const {defaultPageSize} = selectConfig;
|
|
49
51
|
let pageInfo = {
|
|
50
52
|
pageNo: 1,
|
|
@@ -54,7 +56,7 @@ class SelectTable extends React.PureComponent<SelectTableProps, SelectTableStat>
|
|
|
54
56
|
const {sourceId} = this.props;
|
|
55
57
|
/** 构建 dataSource **/
|
|
56
58
|
//构建过滤条件
|
|
57
|
-
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey(sourceId, {...criteriaData, ...pageInfo});
|
|
59
|
+
let queryKey: QueryKey = await HcserviceV3.requestLtmplQueryKey(sourceId, {...criteriaData, ...pageInfo,mainCode});
|
|
58
60
|
this.setState({
|
|
59
61
|
queryKey,
|
|
60
62
|
criteriaData,
|
|
@@ -36,6 +36,7 @@ SupportInputTypes.add('select');
|
|
|
36
36
|
SupportInputTypes.add('multiselect');
|
|
37
37
|
SupportInputTypes.add('checkbox');
|
|
38
38
|
SupportInputTypes.add('radio');
|
|
39
|
+
SupportInputTypes.add('yes-no-switch');
|
|
39
40
|
SupportInputTypes.add('caselect');
|
|
40
41
|
SupportInputTypes.add('relation');
|
|
41
42
|
SupportInputTypes.add('file');
|
|
@@ -249,10 +249,11 @@ export interface VControlProps extends ControlBaseProps {
|
|
|
249
249
|
export interface ControlBaseProps {
|
|
250
250
|
id?:any;
|
|
251
251
|
value?: any;
|
|
252
|
-
fieldConfig
|
|
252
|
+
fieldConfig?: FieldConfig;
|
|
253
253
|
itemType?: string;
|
|
254
254
|
style?: object;
|
|
255
255
|
disabled?: boolean;
|
|
256
|
+
mainCode?:string;
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
export interface SelectedRow {
|