提交 1ba7dffb authored 作者: 钟是志's avatar 钟是志

签名组件优化

上级 53d70e31
......@@ -78,9 +78,13 @@ import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUp
import SwitchWeb from '@/webPublic/one_stop_public/tableCompon/Split_Index/SwitchWeb';
import CronEditorDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/CronEditorDiy/index';
import ButtonDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/ButtonDiy';
import giveVarcharRules from '@/webPublic/one_stop_public/tableCompon/Split_Index/giveVarcharLength';
import giveVarcharRules
from '@/webPublic/one_stop_public/tableCompon/Split_Index/giveVarcharLength';
const { MonthPicker, WeekPicker } = DatePicker;
const {
MonthPicker,
WeekPicker
} = DatePicker;
/**
* 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选
*/
......@@ -101,7 +105,12 @@ const giveRender = (column = {}) => {
return column;
};
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
@connect(({
DataColumn,
SqlManageEntity,
formList,
loading
}) => ({
DataColumn,
SqlManageEntity,
formList,
......@@ -207,7 +216,12 @@ export default class TableCom extends Component {
};
getColumnSearchProps = (dataIndex, title) => ({
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
filterDropdown: ({
setSelectedKeys,
selectedKeys,
confirm,
clearFilters
}) => (
<div style={{ padding: 8 }}>
<Input
ref={node => {
......@@ -246,7 +260,7 @@ export default class TableCom extends Component {
</Button>
</div>
),
filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />,
filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }}/>,
onFilter: (value, record) =>
record[dataIndex]
? record[dataIndex]
......@@ -294,7 +308,11 @@ export default class TableCom extends Component {
};
componentWillReceiveProps(props) {
const { json, mapData, obj } = props;
const {
json,
mapData,
obj
} = props;
if (json == null || this.props.safe) {
return;
}
......@@ -407,7 +425,10 @@ export default class TableCom extends Component {
dataFilter = ['Select', 'Radio', 'Checkbox', 'Cascader'];
getData = (json, dataColumn, obj, init) => {
const { formKey, uuid } = this.props;
const {
formKey,
uuid
} = this.props;
let jsonStatic = json;
json = {
...jsonStatic,
......@@ -418,7 +439,10 @@ export default class TableCom extends Component {
allValues = JSON.stringify(allValues);
if (json.comName === 'TableSelect') {
const { dispatch } = this.props;
const { sqlKey, optionType } = json;
const {
sqlKey,
optionType
} = json;
if (optionType === 'sql') {
dispatch({
type: 'SqlManageEntity/find',
......@@ -440,7 +464,8 @@ export default class TableCom extends Component {
if (
['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)
) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
column.render = val => moment(val)
.format('YYYY-MM-DD HH:mm:ss');
}
column = giveRender(column);
......@@ -477,7 +502,8 @@ export default class TableCom extends Component {
break;
}
column.render = val => moment(parseInt(val)).format(ff);
column.render = val => moment(parseInt(val))
.format(ff);
}
if (cll[k].isQuery) {
column = {
......@@ -523,7 +549,8 @@ export default class TableCom extends Component {
column.title = datas[i].title;
column.dataIndex = datas[i].name;
if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) {
column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
column.render = val => moment(val)
.format('YYYY-MM-DD HH:mm:ss');
}
column = giveRender(column);
columns.push(column);
......@@ -762,7 +789,8 @@ export default class TableCom extends Component {
delete params[i];
}
}
noPrefixRequest(url, params).then(data => {
noPrefixRequest(url, params)
.then(data => {
// if (!data || !Array.isArray(data)) {
// data = [];
// }
......@@ -964,7 +992,8 @@ export default class TableCom extends Component {
if (getToken() != null) {
pp.token = getToken();
}
uaaRequest(url, pp).then(data => {
uaaRequest(url, pp)
.then(data => {
const { sqlKeys } = this.state;
sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys });
......@@ -1169,7 +1198,12 @@ export default class TableCom extends Component {
};
componentDidMount() {
const { json, mapData, obj, init } = this.props;
const {
json,
mapData,
obj,
init
} = this.props;
if (json == null) {
return;
}
......@@ -1214,7 +1248,13 @@ export default class TableCom extends Component {
}
fetchData3 = (obj, dataColumn, init, json, allValues) => {
const { sqlKey, labelName, valueName, isMeta, filterSql } = json;
const {
sqlKey,
labelName,
valueName,
isMeta,
filterSql
} = json;
if (isMeta) {
// 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues
// 解决禅道bug 28017
......@@ -1454,7 +1494,10 @@ export default class TableCom extends Component {
}
};
getColumn = key => {
let { mapData, json } = this.props;
let {
mapData,
json
} = this.props;
const columnIds = json?.columnIds;
......@@ -1510,8 +1553,20 @@ export default class TableCom extends Component {
// console.log(formKey, json);
// }
const { options, labels, selectDis, modalCode, modalTitle, modalInit, modalProps } = this.state;
const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form;
const {
options,
labels,
selectDis,
modalCode,
modalTitle,
modalInit,
modalProps
} = this.state;
const {
getFieldDecorator,
getFieldError,
getFieldProps
} = this.props.form;
const disabled = json != null ? json.disabled : false;
const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0;
if (json?.label === '账号') {
......@@ -1534,7 +1589,7 @@ export default class TableCom extends Component {
) {
return <></>;
}
return <QRCode {...this.state.option} key={uuid} />;
return <QRCode {...this.state.option} key={uuid}/>;
}
if (json.comName == 'Echart') {
return (
......@@ -1550,7 +1605,7 @@ export default class TableCom extends Component {
);
}
if (json.comName == 'Graph') {
return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []} />;
return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []}/>;
}
if (json.comName == 'PartForm') {
......@@ -1565,7 +1620,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uuid, {
initialValue: fk,
})(<Input type="hidden" />)}{' '}
})(<Input type="hidden"/>)}{' '}
<ZdyTable
taskId={this.props.taskId}
importExcel={this.props.importExcel}
......@@ -1641,7 +1696,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: obj[uuid] || json.initialValue,
})(<Input type="hidden" />)}
})(<Input type="hidden"/>)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1658,7 +1713,7 @@ export default class TableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue,
})(<Input type="hidden" />)}
})(<Input type="hidden"/>)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1707,7 +1762,7 @@ export default class TableCom extends Component {
cm = (
<span style={{ paddingRight: get === 'mobile' ? 8 : '' }}>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
break;
......@@ -1715,7 +1770,7 @@ export default class TableCom extends Component {
cm = (
<span>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
......@@ -1733,7 +1788,7 @@ export default class TableCom extends Component {
cm = (
<span style={{ paddingRight: get == 'mobile' ? 8 : '' }}>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
......@@ -1742,7 +1797,7 @@ export default class TableCom extends Component {
cm = (
<span>
{value}
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</span>
);
......@@ -1750,8 +1805,9 @@ export default class TableCom extends Component {
case 'DatePicker':
cm = value ? (
<span>
{moment(parseInt(value)).format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br /> : ''}
{moment(parseInt(value))
.format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br/> : ''}
</span>
) : (
''
......@@ -1773,7 +1829,7 @@ export default class TableCom extends Component {
);
})}
</ul>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
......@@ -1793,7 +1849,7 @@ export default class TableCom extends Component {
);
})}
</ul>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
......@@ -1818,7 +1874,7 @@ export default class TableCom extends Component {
height: json.height,
}}
/>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
}
......@@ -1844,7 +1900,7 @@ export default class TableCom extends Component {
height: json.height,
}}
/>
{get === 'mobile' ? <br /> : ''}
{get === 'mobile' ? <br/> : ''}
</>
);
}
......@@ -1879,7 +1935,7 @@ export default class TableCom extends Component {
</MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -1892,7 +1948,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -1986,7 +2042,7 @@ export default class TableCom extends Component {
</Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -1999,7 +2055,7 @@ export default class TableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type="hidden" />)}
})(<Input type="hidden"/>)}
</>
);
}
......@@ -2078,7 +2134,7 @@ export default class TableCom extends Component {
case 'WangEditor':
let textV = obj[dataColumn.base52];
if (!textV || textV === 'null') {
return <div />;
return <div/>;
}
cm = (
<div
......@@ -2214,11 +2270,13 @@ ${obj[dataColumn.base52]}
} else {
cm = (
<span>
{moment(parseInt(obj[begin.base52])).format(
{moment(parseInt(obj[begin.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{' '}
{moment(parseInt(obj[end.base52])).format(
{moment(parseInt(obj[end.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
......@@ -2234,14 +2292,16 @@ ${obj[dataColumn.base52]}
if (vTime && typeof vTime === 'string' && vTime.indexOf('-') <= -1) {
cm = (
<span>
{moment(parseInt(vTime)).format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}
{moment(parseInt(vTime))
.format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}
</span>
);
} else {
cm = (
<span>
{vTime
? moment(+new Date(vTime)).format(
? moment(+new Date(vTime))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)
: ''}
......@@ -2466,11 +2526,15 @@ ${obj[dataColumn.base52]}
cm = '';
} else {
console.log(obj[dataColumn.base52], '签名组件获取的值');
const filePath = queryFileUrl(obj[dataColumn.base52]);
if (!filePath) {
cm = '';
} else {
cm = (
<img
data-cell-component={'Signature'}
data-cell-base52={dataColumn.base52}
src={queryFileUrl(obj[dataColumn.base52])}
src={filePath}
style={{
marginLeft: 5,
width:
......@@ -2483,6 +2547,8 @@ ${obj[dataColumn.base52]}
);
}
}
break;
case 'ChildForm':
const xxxxx = obj[dataColumn.base52];
......@@ -2686,7 +2752,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + title,
},
],
})(<SwitchWeb json={json} disabled={disabled} />);
})(<SwitchWeb json={json} disabled={disabled}/>);
break;
case 'TextArea':
......@@ -2765,7 +2831,10 @@ ${obj[dataColumn.base52]}
otherProps = {};
}
}
const { disabledInputStyle = {}, addonAfter } = otherProps;
const {
disabledInputStyle = {},
addonAfter
} = otherProps;
let inputStyle = {
width: json.width,
};
......@@ -2815,7 +2884,7 @@ ${obj[dataColumn.base52]}
case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<Input type="hidden" />);
})(<Input type="hidden"/>);
break;
case 'InputNumber':
if (json?.otherProps) {
......@@ -2884,7 +2953,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<Radio.Group options={options} disabled={disabled} />);
})(<Radio.Group options={options} disabled={disabled}/>);
if (get == 'mobile') {
cm = <div>{cm}</div>;
if (
......@@ -2924,7 +2993,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<Checkbox.Group options={options} disabled={disabled} />)}
})(<Checkbox.Group options={options} disabled={disabled}/>)}
</Flex>
);
......@@ -3022,7 +3091,8 @@ ${obj[dataColumn.base52]}
}}
filterOption={(input, option) =>
option
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
? option.props.children.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
: false
}
{...otherProps}
......@@ -3079,7 +3149,8 @@ ${obj[dataColumn.base52]}
}
const filterF = function filter(inputValue, path) {
return path.some(
option => option?.label?.toLowerCase()?.indexOf(inputValue.toLowerCase()) > -1,
option => option?.label?.toLowerCase()
?.indexOf(inputValue.toLowerCase()) > -1,
);
};
// if(this.props.uuid === 'id_32691685234912400529714267d34dc585a2'){
......@@ -3133,7 +3204,7 @@ ${obj[dataColumn.base52]}
message: '请选择' + dataColumn.title,
},
],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
})(<MobileCascader options={options} label={title} disabled={disabled} json={json}/>);
}
if (
......@@ -3229,11 +3300,13 @@ ${obj[dataColumn.base52]}
if (!isEdit) {
cm = (
<span>
{moment(parseInt(obj[begin.base52])).format(
{moment(parseInt(obj[begin.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{' '}
{moment(parseInt(obj[end.base52])).format(
{moment(parseInt(obj[end.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
......@@ -3291,7 +3364,7 @@ ${obj[dataColumn.base52]}
message: '请选择起止时间',
},
],
})(<RangePickerDiy json={json} disabled={disabled} />);
})(<RangePickerDiy json={json} disabled={disabled}/>);
}
if (json.label == null) title = '起止时间';
break;
......@@ -3347,7 +3420,8 @@ ${obj[dataColumn.base52]}
}
});
}
: () => {}
: () => {
}
}
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
{...otherProps}
......@@ -3478,7 +3552,7 @@ ${obj[dataColumn.base52]}
message: '请输入',
},
],
})(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid} />);
})(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid}/>);
break;
case 'RichText':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3492,7 +3566,7 @@ ${obj[dataColumn.base52]}
message: '请输入',
},
],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3523,7 +3597,7 @@ ${obj[dataColumn.base52]}
message: '请输入' + title,
},
],
})(<CronEditorDiy />);
})(<CronEditorDiy/>);
break;
case 'LocationCom':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3539,7 +3613,8 @@ ${obj[dataColumn.base52]}
let errors = [];
console.log(valueThis);
if (
(!valueThis || !JSON.stringify(valueThis).includes('address')) &&
(!valueThis || !JSON.stringify(valueThis)
.includes('address')) &&
required
) {
errors.push(new Error('请获取定位信息', rule.field));
......@@ -3638,7 +3713,7 @@ ${obj[dataColumn.base52]}
message: '请上传图片',
},
],
})(<ImgUploadCom json={json} disabled={disabled} />);
})(<ImgUploadCom json={json} disabled={disabled}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3669,7 +3744,7 @@ ${obj[dataColumn.base52]}
message: '请上传视频',
},
],
})(<VideoUploadCom json={json} disabled={disabled} />);
})(<VideoUploadCom json={json} disabled={disabled}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3700,7 +3775,7 @@ ${obj[dataColumn.base52]}
message: '请进行签名',
},
],
})(<Signature width={json.width} height={json.height} get={get} />);
})(<Signature width={json.width} height={json.height} get={get}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3920,7 +3995,7 @@ ${obj[dataColumn.base52]}
label={title}
data-cell-component-name={json.comName || 'no_com'}
>
<ShowComName json={json} />
<ShowComName json={json}/>
{cm}
</Form.Item>
</>
......@@ -4015,12 +4090,12 @@ ${obj[dataColumn.base52]}
wrapperCol={{ span: json.wrapperSpan }}
label={title}
>
<ShowComName json={json} />
<ShowComName json={json}/>
{cm}
</Form.Item>
) : (
<Form.Item>
<ShowComName json={json} />
<ShowComName json={json}/>
{cm}
</Form.Item>
)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论