提交 118fa6c0 authored 作者: 钟是志's avatar 钟是志

定位组件修改

上级 f977297f
......@@ -13,130 +13,114 @@ import { getPopconfirm } from '@/webPublic/one_stop_public/utils/utils';
const Popconfirm = getPopconfirm();
export default class location extends Component {
constructor(props) {
super(props);
this.state = {
locationMsg: {},
btn: true,
style: { display: 'none' },
};
}
// 该方法在首次渲染之前调用(数据初始化)
componentWillMount() {}
//已经生成对应的dom结构
componentDidMount = () => {};
//在组件从 DOM 中移除的时候立刻被调用。
componentWillUnmount = () => {};
getLocationMsg = (locationMsg) => {
console.log(locationMsg);
//如果不为空的话显示提示
this.setState({ loading: true }, () => {
if (Object.keys(locationMsg).length !== 0) {
this.setState({
locationMsg: locationMsg,
loading: false,
style: { display: 'block' },
btn: false,
});
} else {
this.setState({
loading: false,
});
}
});
};
submitLocation = () => {
const { showLocation } = this.props;
if (!showLocation) return;
if (isEmpty(this.state.locationMsg) && window.lat && window.lng) {
let obj = {
lat: window.lat,
lng: window.lng,
};
this.props.onChange(obj);
if (this.props.get === 'web') {
openToast('success', '成功', '已添加定位地址');
} else {
successToast('已添加定位地址');
}
} else if (!isEmpty(this.state.locationMsg)) {
this.props.onChange(this.state.locationMsg);
if (this.props.get === 'web') {
openToast('success', '成功', '已添加定位地址');
} else {
successToast('已添加定位地址');
}
} else {
if (this.props.get === 'web') {
openToast('error', '错误', '定位失败,请稍后重试');
} else {
successToast('定位失败,请稍后重试');
}
}
};
// 点击确定提交定位
confirm = (e) => {
console.log(e);
if (this.state.btn) {
if (this.props.get === 'web') {
openToast('error', '错误', '正在定位,请稍后重试');
} else {
failToast('正在定位,请稍后重试');
}
return;
}
this.submitLocation();
};
render() {
let { locationMsg, btn } = this.state;
let { lat, lng, address, params, json, showLocation } = this.props;
constructor(props) {
super(props);
this.state = {
locationMsg: {},
btn: true,
style: { display: 'none' },
};
}
// 该方法在首次渲染之前调用(数据初始化)
componentWillMount() {}
//已经生成对应的dom结构
componentDidMount = () => {};
//在组件从 DOM 中移除的时候立刻被调用。
componentWillUnmount = () => {};
getLocationMsg = locationMsg => {
console.log(locationMsg);
//如果不为空的话显示提示
this.setState({ loading: true }, () => {
if (Object.keys(locationMsg).length !== 0) {
this.setState({
locationMsg: locationMsg,
loading: false,
style: { display: 'block' },
btn: false,
});
} else {
this.setState({
loading: false,
});
}
});
};
submitLocation = () => {
const { showLocation } = this.props;
if (!showLocation) return;
if (isEmpty(this.state.locationMsg) && window.lat && window.lng) {
let obj = {
lat: window.lat,
lng: window.lng,
};
this.props.onChange(obj);
if (this.props.get === 'web') {
openToast('success', '成功', '已添加定位地址');
} else {
successToast('已添加定位地址');
}
} else if (!isEmpty(this.state.locationMsg)) {
this.props.onChange(this.state.locationMsg);
if (this.props.get === 'web') {
openToast('success', '成功', '已添加定位地址');
} else {
successToast('已添加定位地址');
}
} else {
if (this.props.get === 'web') {
openToast('error', '错误', '定位失败,请稍后重试');
} else {
successToast('定位失败,请稍后重试');
}
}
};
// 点击确定提交定位
confirm = e => {
console.log(e);
if (this.state.btn) {
if (this.props.get === 'web') {
openToast('error', '错误', '正在定位,请稍后重试');
} else {
failToast('正在定位,请稍后重试');
}
return;
}
this.submitLocation();
};
render() {
let { locationMsg, btn } = this.state;
let { lat, lng, address, params, json, showLocation } = this.props;
return (
<div style={{ display: 'flex' }}>
<Location
lat={lat}
json={json}
lng={lng}
getLocationMsg={this.getLocationMsg.bind(this)}
showMap={this.props.showMap}
params={params}
/>
<div style={{ display: showLocation ? 'block' : 'none' }}>
{' '}
<Popconfirm
title={btn ? '正在定位中' : locationMsg.address}
onConfirm={this.confirm}
okText="提交"
cancelText="取消">
<Button
disabled={btn}
style={{ margin: 'auto', width: this.props.width }}
loading={this.state.loading}
className={styles.btn}
type="primary">
{this.props.btnName}
</Button>
</Popconfirm>
</div>
</div>
);
// return (
// <div style={{ paddingBottom: 49, paddingTop: 44 }}>
// <Nav name="签到" link/>
// <div id="EditAddress" className={styles.EditAddress}>
// <Location getLocationMsg={this.getLocationMsg.bind(this)}/>
// <Button onClick={this.submitLocation} className={styles.btn} type='primary'>签到</Button>
// <div style={this.state.style} className={styles.div}>
// <p><i>经纬度:</i><span>{this.state.locationMsg.lng},{this.state.locationMsg.lat}</span></p>
// <p><i>详细地址:</i><span>{this.state.locationMsg.address}</span></p>
// <p><i>最近的路口:</i><span>{this.state.locationMsg.nearestJunction}</span></p>
// <p><i>最近的路:</i><span>{this.state.locationMsg.nearestRoad}</span></p>
// <p><i>最近的POI:</i><span>{this.state.locationMsg.nearestPOI}</span></p>
// <Button onClick={this.submitLocation} className={styles.btn} type='primary'>签到</Button>
// </div>
// </div>
// </div>
// )
}
return (
<div style={{ display: 'flex' }}>
<Location
lat={lat}
json={json}
lng={lng}
getLocationMsg={this.getLocationMsg.bind(this)}
showMap={this.props.showMap}
params={params}
/>
<div style={{ display: showLocation ? 'block' : 'none' }}>
{' '}
<Popconfirm
title={btn ? '正在定位中' : locationMsg.address}
onConfirm={this.confirm}
okText="提交"
cancelText="取消"
>
<Button
disabled={btn}
style={{ margin: 'auto', width: this.props.width }}
loading={this.state.loading}
className={styles.btn}
type="primary"
>
{this.props.btnName}
</Button>
</Popconfirm>
</div>
</div>
);
}
}
......@@ -81,12 +81,7 @@ const giveRender = (column = {}) => {
return column;
};
@connect(({
DataColumn,
SqlManageEntity,
formList,
loading,
}) => ({
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
DataColumn,
SqlManageEntity,
formList,
......@@ -191,12 +186,7 @@ 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 => {
......@@ -213,11 +203,11 @@ export default class tableCom extends Component {
}}
/>
<Button
type='primary'
type="primary"
onClick={() => this.handleSearch(selectedKeys, confirm)}
icon='search'
icon="search"
loading={this.props.loading}
size='small'
size="small"
style={{
width: 90,
marginRight: 8,
......@@ -228,20 +218,20 @@ export default class tableCom extends Component {
<Button
loading={this.props.loading}
onClick={() => this.handleReset(clearFilters)}
size='small'
size="small"
style={{ width: 90 }}
>
重置
</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]
.toString()
.toLowerCase()
.includes(value.toLowerCase())
.toString()
.toLowerCase()
.includes(value.toLowerCase())
: '',
onFilterDropdownVisibleChange: visible => {
if (visible) {
......@@ -283,11 +273,7 @@ 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;
}
......@@ -345,7 +331,7 @@ export default class tableCom extends Component {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props
.i + 1}行,第${this.props.j +
1}列:存在循环风险,1秒内执行超过10次,现已停止执行,请检查,`,
1}列:存在循环风险,1秒内执行超过10次,现已停止执行,请检查,`,
);
return;
......@@ -367,9 +353,9 @@ export default class tableCom extends Component {
this.props.fatherCode != null
? bindObj
? {
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
: bindObj;
if (this.props.fatherCode == null && dataColumn == null) {
......@@ -405,10 +391,7 @@ 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',
......@@ -430,8 +413,7 @@ 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);
......@@ -468,8 +450,7 @@ 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 = {
......@@ -516,8 +497,7 @@ 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);
......@@ -656,7 +636,7 @@ export default class tableCom extends Component {
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i +
1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
......@@ -750,7 +730,7 @@ export default class tableCom extends Component {
} catch (e) {
console.log(
`页面${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j +
1}列:公式配置有误,回调函数内部错误,`,
1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
......@@ -784,79 +764,78 @@ export default class tableCom extends Component {
data: requestParams,
method: method,
requestType: 'form',
})
.then(data => {
// if (!data || !Array.isArray(data)) {
// data = [];
// }
const { reqUrls } = this.state;
if (reqUrls && reqUrls[url]) {
reqUrls[url].data = data;
}
this.setState(
{
res: data,
reqUrls,
},
() => {
if (callback) {
if (json.optionType && json.optionType == 'func') {
const res = callback(data);
if (res != null && !(typeof res === 'function')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}).then(data => {
// if (!data || !Array.isArray(data)) {
// data = [];
// }
const { reqUrls } = this.state;
if (reqUrls && reqUrls[url]) {
reqUrls[url].data = data;
}
this.setState(
{
res: data,
reqUrls,
},
() => {
if (callback) {
if (json.optionType && json.optionType == 'func') {
const res = callback(data);
if (res != null && !(typeof res === 'function')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
try {
const x = callback(data);
if (x != null) {
this.setState({ option: x });
}
} else if (['Echart', 'QRCode', 'Graph'].includes(json.comName)) {
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else {
if (base52) {
try {
const x = callback(data);
if (x != null) {
this.setState({ option: x });
}
// console.log(x, '757');
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
`页面${this.props.currentFormTitle} ${this.props.formKey} ${
json.comName
}${this.props.i + 1}行,第${this.props.j +
1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else {
if (base52) {
try {
const x = callback(data);
// console.log(x, '757');
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${
json.comName
}${this.props.i + 1}行,第${this.props.j +
1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
}
}
}
},
);
});
}
},
);
});
return 'norefeshxxxxxxxxxxxxxxxxxxxx';
};
......@@ -976,50 +955,62 @@ export default class tableCom extends Component {
if (getToken() != null) {
pp.token = getToken();
}
uaaRequest(url, pp)
.then(data => {
const { sqlKeys } = this.state;
sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys });
if (data == null) {
return;
}
uaaRequest(url, pp).then(data => {
const { sqlKeys } = this.state;
sqlKeys[sqlKey].data = data;
this.setState({ sqlKeys });
if (data == null) {
return;
}
if (callback) {
if (json.optionType && json.optionType === 'func') {
const res = callback(data);
if (callback) {
if (json.optionType && json.optionType === 'func') {
const res = callback(data);
if (res != null && !(typeof res === 'function')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
if (res != null && !(typeof res === 'function')) {
this.setState(
{
options: res,
selectDis: false,
},
() => {
if (orgCallback) orgCallback();
},
);
}
} else if (json.comName == 'Button') {
try {
callback(data);
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else if (
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
try {
const x = callback(data);
if (x != null) {
this.setState({ option: x });
}
} else if (
json.comName == 'Echart' ||
json.comName == 'QRCode' ||
json.comName == 'Graph'
) {
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
} else {
if (base52) {
try {
const x = callback(data);
if (x != null) {
this.setState({ option: x });
}
// console.log(x, 938);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
......@@ -1027,23 +1018,10 @@ export default class tableCom extends Component {
e,
);
}
} else {
if (base52) {
try {
const x = callback(data);
// console.log(x, 938);
if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
e,
);
}
}
}
}
});
}
});
});
return 'norefeshxxxxxxxxxxxxxxxxxxxx';
......@@ -1173,19 +1151,14 @@ export default class tableCom extends Component {
} catch (e) {
console.log(
`页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i +
1}行,第${this.props.j + 1}列:公式配置有误,暂存失败,`,
1}行,第${this.props.j + 1}列:公式配置有误,暂存失败,`,
e,
);
}
};
componentDidMount() {
const {
json,
mapData,
obj,
init,
} = this.props;
const { json, mapData, obj, init } = this.props;
if (json == null) {
return;
}
......@@ -1206,9 +1179,9 @@ export default class tableCom extends Component {
this.props.fatherCode != null
? bindObj
? {
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
: bindObj;
if (this.props.fatherCode == null && dataColumn == null) {
......@@ -1433,10 +1406,7 @@ export default class tableCom extends Component {
}
};
getColumn = key => {
let {
mapData,
json,
} = this.props;
let { mapData, json } = this.props;
const columnIds = json.columnIds;
......@@ -1479,20 +1449,8 @@ export default class tableCom extends Component {
getCellValue,
} = this.props;
// console.log(this.props.datas);
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 === '账号') {
......@@ -1546,7 +1504,7 @@ export default class tableCom extends Component {
<>
{this.props.form.getFieldDecorator(this.props.uuid, {
initialValue: fk,
})(<Input type='hidden' />)}{' '}
})(<Input type="hidden" />)}{' '}
<ZdyTable
taskId={this.props.taskId}
importExcel={this.props.importExcel}
......@@ -1622,7 +1580,7 @@ export default class tableCom extends Component {
<>
{this.props.form.getFieldDecorator(uid, {
initialValue: obj[this.props.uuid] || json.initialValue,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
<span
style={{
fontWeight: get === 'mobile' ? 'bold' : '',
......@@ -1639,7 +1597,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' : '',
......@@ -1732,8 +1690,7 @@ export default class tableCom extends Component {
case 'DatePicker':
cm = value ? (
<span>
{moment(parseInt(value))
.format('YYYY-MM-DD HH:mm:ss')}
{moment(parseInt(value)).format('YYYY-MM-DD HH:mm:ss')}
{get === 'mobile' ? <br /> : ''}
</span>
) : (
......@@ -1749,7 +1706,7 @@ export default class tableCom extends Component {
{filesX.map((f, index2) => {
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
......@@ -1769,7 +1726,7 @@ export default class tableCom extends Component {
{files.map((f, index2) => {
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
......@@ -1862,7 +1819,7 @@ export default class tableCom extends Component {
</MobileItem>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -1875,7 +1832,7 @@ export default class tableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -1969,7 +1926,7 @@ export default class tableCom extends Component {
</Form.Item>
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -1982,7 +1939,7 @@ export default class tableCom extends Component {
{cm}
{this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
initialValue: value,
})(<Input type='hidden' />)}
})(<Input type="hidden" />)}
</>
);
}
......@@ -1998,9 +1955,9 @@ export default class tableCom extends Component {
this.props.fatherCode != null
? bindObj
? {
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
...bindObj,
base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
}
: { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
: bindObj;
......@@ -2132,18 +2089,18 @@ export default class tableCom extends Component {
<span>
{labels != null
? labels.map((r, i) =>
i == 0 ? (
typeof r == 'string' ? (
<span>{r}</span>
i == 0 ? (
typeof r == 'string' ? (
<span>{r}</span>
) : (
Object.values(r)
)
) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span>
) : (
Object.values(r)
)
) : typeof r == 'string' ? (
<span style={{ marginLeft: 12 }}>{r}</span>
) : (
',' + Object.values(r)
),
)
',' + Object.values(r)
),
)
: ''}
</span>
);
......@@ -2166,7 +2123,7 @@ export default class tableCom extends Component {
<Table
get={get}
columns={this.state.columns}
size='small'
size="small"
dataSource={ds}
pagination={false}
/>
......@@ -2199,15 +2156,13 @@ export default class tableCom extends Component {
} else {
cm = (
<span>
{moment(parseInt(obj[begin.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{' '}
{moment(parseInt(obj[end.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
{moment(parseInt(obj[end.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
);
}
......@@ -2220,18 +2175,16 @@ export default class tableCom extends Component {
if (obj[dataColumn.base52] && obj[dataColumn.base52].indexOf('-') === -1) {
cm = (
<span>
{moment(parseInt(obj[dataColumn.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
{moment(parseInt(obj[dataColumn.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
);
} else {
cm = (
<span>
{obj[dataColumn.base52]
? moment(+new Date(obj[dataColumn.base52]))
.format(
? moment(+new Date(obj[dataColumn.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)
: ''}
......@@ -2276,18 +2229,18 @@ export default class tableCom extends Component {
cm = (
<ul className={styles.imageUl}>
{Array.isArray(files) &&
files.map((f, index2) => {
return (
<li key={f.path}>
<PictureSignature
json={json}
disabled={true} // 只读模式
basicUrl={queryApiActionPath()}
fileInfo={f}
/>
</li>
);
})}
files.map((f, index2) => {
return (
<li key={f.path}>
<PictureSignature
json={json}
disabled={true} // 只读模式
basicUrl={queryApiActionPath()}
fileInfo={f}
/>
</li>
);
})}
</ul>
);
}
......@@ -2339,7 +2292,7 @@ export default class tableCom extends Component {
}
return (
<li key={index2}>
<a target='_blank' key={f.path} href={queryApiActionPath() + f.path}>
<a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
{f.name}
</a>
</li>
......@@ -2352,39 +2305,39 @@ export default class tableCom extends Component {
cm = (
<ul className={styles.imageUl}>
{Array.isArray(files) &&
files.map((f, index2) => {
// if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
// return (
// <img
// key={index2}
// style={{ width: 100, height: 100 }}
// src={queryApiActionPath() + f.filePath}
// />
// );
// }
if (get === 'web' || !this.props.isPrint) {
files.map((f, index2) => {
// if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
// return (
// <img
// key={index2}
// style={{ width: 100, height: 100 }}
// src={queryApiActionPath() + f.filePath}
// />
// );
// }
if (get === 'web' || !this.props.isPrint) {
return (
<li key={index2}>
<FilePreview
path={queryApiActionPath() + f.path}
pathName={f.name}
type={'UploadCom'}
/>
</li>
);
}
return (
<li key={index2}>
<FilePreview
path={queryApiActionPath() + f.path}
pathName={f.name}
type={'UploadCom'}
/>
<a
target="_blank"
key={f.filePath}
href={queryApiActionPath() + f.filePath}
>
{f.fileName}
</a>
</li>
);
}
return (
<li key={index2}>
<a
target='_blank'
key={f.filePath}
href={queryApiActionPath() + f.filePath}
>
{f.fileName}
</a>
</li>
);
})}
})}
</ul>
);
}
......@@ -2536,12 +2489,24 @@ export default class tableCom extends Component {
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <Button loading={this.props.loading} type='primary' {...ev} />;
cm = <Button loading={this.props.loading} type="primary" {...ev} />;
}
}
break;
case 'LocationCom':
// cm = '';
// break;
// console.log(obj, obj[dataColumn.base52], json);
let v = obj[dataColumn.base52];
if (typeof v !== 'object') {
console.log('定位组件未获取到对象', '进行了数据转换', v, typeof v, isJSON(v));
if (isJSON(v)) {
v = JSON.parse(v);
} else {
v = {};
}
}
cm = (
<span>
<LocationCom
......@@ -2551,7 +2516,7 @@ export default class tableCom extends Component {
width={json.width}
json={json}
showMap={json.showMap}
value={obj[dataColumn.base52]}
value={v}
/>
</span>
);
......@@ -2618,7 +2583,7 @@ export default class tableCom extends Component {
if (json.isLink) {
cm = <a {...ev} />;
} else {
cm = <Button loading={this.props.loading} type='primary' {...ev} />;
cm = <Button loading={this.props.loading} type="primary" {...ev} />;
}
}
......@@ -2639,11 +2604,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + title,
},
],
{
required: required,
message: '请选择' + title,
},
],
})}
disabled={disabled}
onClick={checked => {
......@@ -2675,11 +2640,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + title,
},
],
{
required: required,
message: '请选择' + title,
},
],
})(
<Switch
disabled={disabled}
......@@ -2706,11 +2671,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<TextArea
autoSize={{ minRows: 4 }}
......@@ -2745,11 +2710,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<TextArea
autoSize={{ minRows: 4 }}
......@@ -2768,11 +2733,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<Input
disabled={disabled}
......@@ -2803,7 +2768,7 @@ export default class tableCom extends Component {
case 'InputHidden':
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<Input type='hidden' />);
})(<Input type="hidden" />);
break;
case 'InputNumber':
cm = getFieldDecorator(dataColumn.base52, {
......@@ -2812,11 +2777,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(
<InputNumber
disabled={disabled}
......@@ -2858,11 +2823,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<Radio.Group options={options} disabled={disabled} />);
if (get == 'mobile') {
cm = <div>{cm}</div>;
......@@ -2891,18 +2856,18 @@ export default class tableCom extends Component {
case 'Checkbox':
if (get === 'mobile') {
cm = (
<Flex direction='column' align='start'>
<Flex direction="column" align="start">
{getFieldDecorator(dataColumn.base52, {
initialValue: initValue, // 默认值
rules:
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<Checkbox.Group options={options} disabled={disabled} />)}
</Flex>
);
......@@ -2933,11 +2898,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(
<Checkbox.Group
options={options}
......@@ -2962,11 +2927,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(
<Select
allowClear
......@@ -2974,45 +2939,44 @@ export default class tableCom extends Component {
disabled={selectDis || disabled}
placeholder={json.placeholder}
style={{ width: json.width }}
optionFilterProp='children'
optionFilterProp="children"
getPopupContainer={
this.props.isDynamic && document.querySelector('#dynamic_div')
? () => {
return document.querySelector('#dynamic_div');
}
return document.querySelector('#dynamic_div');
}
: ''
}
onFocus={() => {
get === 'mobile' // 移动端取消输入键盘弹出
? setTimeout(() => {
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
ary.map(item => {
item.setAttribute('readonly', 'readonly');
// setTimeout(() => {
// ary.map(arr => {
// arr.removeAttribute('readonly');
// })
// });
});
}
})
if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
ary.map(item => {
item.setAttribute('readonly', 'readonly');
// setTimeout(() => {
// ary.map(arr => {
// arr.removeAttribute('readonly');
// })
// });
});
}
})
: null;
}}
filterOption={(input, option) =>
option
? option.props.children.toLowerCase()
.indexOf(input.toLowerCase()) >= 0
? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
: false
}
{...otherProps}
>
{options && options instanceof Array
? options.map(r => (
<Option key={r.value} value={r.value}>
{r.label}
</Option>
))
<Option key={r.value} value={r.value}>
{r.label}
</Option>
))
: ''}
</Select>,
);
......@@ -3051,8 +3015,7 @@ export default class tableCom extends Component {
}
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,
);
};
cm = getFieldDecorator(dataColumn.base52, {
......@@ -3061,11 +3024,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(
<Cascader // 这里的options 获取方式存在bug 公式会重复调用
options={options}
......@@ -3075,8 +3038,8 @@ export default class tableCom extends Component {
getPopupContainer={
this.props.isDynamic && document.querySelector('#dynamic_div')
? () => {
return document.querySelector('#dynamic_div');
}
return document.querySelector('#dynamic_div');
}
: ''
}
placeholder={json.placeholder}
......@@ -3092,11 +3055,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择' + dataColumn.title,
},
],
{
required: required,
message: '请选择' + dataColumn.title,
},
],
})(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
}
......@@ -3129,22 +3092,22 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
validator: (rule, value, callback) => {
let errors = [];
if (
(Object.keys(value).length == 0 ||
Object.keys(value.selects).length == 0) &&
required != null &&
required
) {
errors.push(new Error('请选择至少一个', rule.field));
}
callback(errors);
{
validator: (rule, value, callback) => {
let errors = [];
if (
(Object.keys(value).length == 0 ||
Object.keys(value.selects).length == 0) &&
required != null &&
required
) {
errors.push(new Error('请选择至少一个', rule.field));
}
callback(errors);
},
required: required,
},
required: required,
},
],
],
})(
<TableSelect
get={get}
......@@ -3201,15 +3164,13 @@ export default class tableCom extends Component {
if (!isEdit) {
cm = (
<span>
{moment(parseInt(obj[begin.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{moment(parseInt(obj[begin.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}{' '}
{' '}
{moment(parseInt(obj[end.base52]))
.format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
{moment(parseInt(obj[end.base52])).format(
json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
)}
</span>
);
} else {
......@@ -3220,11 +3181,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择起止时间',
},
],
{
required: required,
message: '请选择起止时间',
},
],
})(<MobileDate disabled={disabled} formate={json.format} required={required} />);
if (
((json.isMobileLabel != null && json.isMobileLabel) ||
......@@ -3252,11 +3213,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择起止时间',
},
],
{
required: required,
message: '请选择起止时间',
},
],
})(
<RangePicker
showTime={json.showTime != null ? json.showTime : true}
......@@ -3282,11 +3243,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请选择起止时间',
},
],
{
required: required,
message: '请选择起止时间',
},
],
})(
<DatePicker
disabled={disabled}
......@@ -3297,22 +3258,21 @@ export default class tableCom extends Component {
onOpenChange={
get === 'mobile'
? () => {
// 取消唤起移动端小键盘
setTimeout(() => {
if (document.querySelector('.ant-calendar-input ')) {
document
.querySelector('.ant-calendar-input ')
.setAttribute('readonly', 'readonly');
setTimeout(() => {
// 取消唤起移动端小键盘
setTimeout(() => {
if (document.querySelector('.ant-calendar-input ')) {
document
.querySelector('.ant-calendar-input ')
.removeAttribute('readonly');
});
}
});
}
: () => {
}
.setAttribute('readonly', 'readonly');
setTimeout(() => {
document
.querySelector('.ant-calendar-input ')
.removeAttribute('readonly');
});
}
});
}
: () => {}
}
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
/>,
......@@ -3348,11 +3308,11 @@ export default class tableCom extends Component {
json?.vlds && json?.vlds.length > 0
? json.vlds
: [
{
required,
message: '请进行签章',
},
],
{
required,
message: '请进行签章',
},
],
})(
<SignArray // 签章组件 编辑模式
json={json}
......@@ -3437,11 +3397,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入',
},
],
{
required: required,
message: '请输入',
},
],
})(
<WangEditor
json={json}
......@@ -3458,11 +3418,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入',
},
],
{
required: required,
message: '请输入',
},
],
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
if (
get === 'mobile' &&
......@@ -3490,11 +3450,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请输入' + title,
},
],
{
required: required,
message: '请输入' + title,
},
],
})(<CronEditor style={{ width: 600 }} />);
break;
case 'LocationCom':
......@@ -3504,11 +3464,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请进行定位',
},
],
{
required: required,
message: '请进行定位',
},
],
})(
<LocationCom
get={get}
......@@ -3594,11 +3554,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请上传图片',
},
],
{
required: required,
message: '请上传图片',
},
],
})(<ImgUploadCom json={json} disabled={disabled} />);
if (
get === 'mobile' &&
......@@ -3625,11 +3585,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请上传视频',
},
],
{
required: required,
message: '请上传视频',
},
],
})(<VideoUploadCom json={json} disabled={disabled} />);
if (
get === 'mobile' &&
......@@ -3656,11 +3616,11 @@ export default class tableCom extends Component {
json.vlds && json.vlds.length > 0
? json.vlds
: [
{
required: required,
message: '请进行签名',
},
],
{
required: required,
message: '请进行签名',
},
],
})(
<Signature
width={
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论