提交 4160092a authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

...@@ -166,9 +166,12 @@ export default class AffairPage extends React.Component { ...@@ -166,9 +166,12 @@ export default class AffairPage extends React.Component {
if (event.data === 'returnList') { if (event.data === 'returnList') {
this.returnList(true); this.returnList(true);
} }
if (event.data.indexOf('iframeHeight') > -1) { if (event && event.data && event.data.indexOf && event.data.indexOf('iframeHeight') > -1) {
let height = Number(event.data.split('-')[1]); let height = Number(event.data.split('-')[1]);
document.getElementById('applyIframeId').height = height; const iframe = document.getElementById('applyIframeId');
if (iframe) {
iframe.height = height;
}
} }
}, false); }, false);
......
...@@ -18,10 +18,10 @@ export default class AuditPage extends Component { ...@@ -18,10 +18,10 @@ export default class AuditPage extends Component {
componentDidMount() {} componentDidMount() {}
handleButtonSet = () => { handleButtonSet = () => {
const { addFields, workId } = this.props; const { addFields, workId, hasBatchAudit } = this.props;
return { return {
tab1: [ tab1: [
{ hasBatchAudit ? {
type: 'audit', type: 'audit',
component: 'RenderComponent', component: 'RenderComponent',
render: ({ selectRows, getPage }) => { render: ({ selectRows, getPage }) => {
...@@ -52,8 +52,8 @@ export default class AuditPage extends Component { ...@@ -52,8 +52,8 @@ export default class AuditPage extends Component {
</AuditModal> </AuditModal>
); );
}, },
}, }: false,
], ].filter(i => i),
tab2: [], tab2: [],
}; };
}; };
......
/***
* 批量审核
* 2020年5月7日 09:53:12
* 钟是志
*
* */
import React, {Component} from 'react';
import AuditPage from './index';
export default class BatchAudit extends Component{
constructor(props) {
super(props);
}
render() {
return(
<AuditPage {...this.props}
hasBatchAudit={true}
/>
)
}
}
...@@ -12,6 +12,11 @@ import * as destructionFunc from '../destruction'; ...@@ -12,6 +12,11 @@ import * as destructionFunc from '../destruction';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
export default class Index extends React.Component { export default class Index extends React.Component {
static defaultProps = {
hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志
};
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -112,11 +117,13 @@ export default class Index extends React.Component { ...@@ -112,11 +117,13 @@ export default class Index extends React.Component {
render() { render() {
const { workId, dataBaseId, columns, searchCondition, addFields, allConfigSetInfo, tableInfo } = this.state; const { workId, dataBaseId, columns, searchCondition, addFields, allConfigSetInfo, tableInfo } = this.state;
const { hasBatchAudit } = this.props;
if(!workId){ if(!workId){
return null; return null;
} }
return ( return (
<AuditPage <AuditPage
hasBatchAudit={hasBatchAudit}
workId={workId} workId={workId}
dataBaseId={dataBaseId} dataBaseId={dataBaseId}
columns={columns} columns={columns}
......
...@@ -3,7 +3,9 @@ import { uaaRequest } from '@/webPublic/one_stop_public/utils/request'; ...@@ -3,7 +3,9 @@ import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
export const getHead = (payload, callback) => { export const getHead = (payload, callback) => {
uaaRequest('/DataColumnApi/getHeaderList', payload).then(res => { uaaRequest('/DataColumnApi/getHeaderList', payload).then(res => {
if (!res) return; if (!res) return;
if (callback) callback(res); if (callback) {
callback(res);
}
}); });
}; };
......
import React, { useState, useEffect } from 'react';
import { Form, Button } from 'antd';
import Shell from '@/baseComponent/Shell';
import { ModalInfo } from '@/baseComponent/Modal';
import { addOrEditTableItem, fetchTableData, fetchTableHeader, } from '@/webPublic/Services';
import { preHandle } from '@/webPublic/one_stop_public/utils/myutils';
import { getOneStopConfig } from '@/baseComponent/utils';
import { RenderFormByContent } from '../RenderForm';
// 直接获取的表格数据的字段是明文,找换成base转换后的字段
function getBaseEncodedData(rowData, tableHeader) {
// {name: base52}
const nameBaseMap = tableHeader.reduce((acc, header) => {
return {...acc, [header.name] : header.base52};
}, {});
// 明文字段转换成base后的字段, eg. {process_status: 1} => {JbZWZHoGRsA: 1}
return Object.keys(rowData).reduce((acc, name) => {
const base52 = nameBaseMap[name];
if(!base52) return acc;
return {...acc, [base52]: rowData[name] };
}, {});
}
// 配置页面,配置数据在元数据表格的第一行
// 1. 页面显示通过模板id渲染。
// 2. 页面数据通过元数据表id, 查询和修改。
// templateCode, 页面模板id
// tableId, 元数据列表id
// children, 可以传children,但children不能是数组(不能传属性),children里可以自定义其他组件。
function SingleDataPageInFirstRow(props) {
const { children, form, templateCode: templateCodeFromProps, dataObjId: dataObjIdFromProps, location: {pathname} } = props;
// templateCode 和 dataObjId 可以通过组件属性或者根据路径配置获取
const templateCodeFromPathname = getOneStopConfig(`${pathname}-templateCode`);
const dataObjIdFromPathname = getOneStopConfig(`${pathname}-dataObjId`);
const templateCode = templateCodeFromPathname || templateCodeFromProps;
const dataObjId = dataObjIdFromPathname || dataObjIdFromProps;
if (!templateCode || !dataObjId) {
console.warn("模板code或者元数据表格id为空,templateCode: " + templateCode + ", dataObjId: " + dataObjId);
return null;
}
const [isAdd, setIsAdd] = useState(false);
const [content, setContent] = useState({});
useEffect(
() => {
fetchTableHeader(dataObjId).then(tableHeader => {
if (!tableHeader) return;
fetchTableData({ pageNo: 1, pageSize: 10, isBase: true, dataObjId, query: {} }).then(res => {
const firstRowData = (res && res.rows && res.rows[0]) || {};
setContent(getBaseEncodedData(firstRowData, tableHeader));
setIsAdd(!!(!res || res.errMsg))
});
});
},
[dataObjId]
);
function handleSave() {
const { validateFields } = form;
validateFields((err, values) => {
if (err) return;
// console.log(JSON.stringify(values.JjvkRobXWTE), JSON.stringify(values.JjvkwLqcsyY));
preHandle(values);
// console.log(JSON.stringify(values.JjvkRobXWTE));
addOrEditTableItem({ objId: dataObjId, isAdd, data: values }).then(res => {
if (res) {
ModalInfo('保存成功!');
}
});
});
}
let ClonedChildren;
if (children) {
ClonedChildren = React.cloneElement(React.Children.only(children), {
form,
isAdd,
url: '/DataObjApi/addFormData',
});
}
return (
<Shell styleShell={{ marginTop: 0 }}>
<RenderFormByContent
content={content}
templateCode={templateCode}
form={form}
/>
{ClonedChildren || (
<div style={{ textAlign: 'center', padding: 16 }}>
<Button type="primary" shape="round" ghost onClick={handleSave}>
保存
</Button>
</div>
)}
</Shell>
);
}
export default Form.create()(SingleDataPageInFirstRow);
...@@ -24,7 +24,9 @@ function SingleDataPageTemplate(props) { ...@@ -24,7 +24,9 @@ function SingleDataPageTemplate(props) {
validateFields((err, values) => { validateFields((err, values) => {
if (err) return; if (err) return;
// console.log(JSON.stringify(values.JjvkRobXWTE), JSON.stringify(values.JjvkwLqcsyY));
preHandle(values); preHandle(values);
// console.log(JSON.stringify(values.JjvkRobXWTE));
addOrEditTableItem({ objId: tableId, isAdd, data: values }).then(res => { addOrEditTableItem({ objId: tableId, isAdd, data: values }).then(res => {
if (res) { if (res) {
ModalInfo('保存成功!'); ModalInfo('保存成功!');
......
...@@ -571,6 +571,7 @@ export default class ZdyTable extends Component { ...@@ -571,6 +571,7 @@ export default class ZdyTable extends Component {
<TableCom <TableCom
formCode={formCode} // 当前表单code formCode={formCode} // 当前表单code
modalInit={modalInit}
formId={formId} // 当前表单Id formId={formId} // 当前表单Id
i={i} // 当前组件下标 i={i} // 当前组件下标
j={j} // 当前行数下班 j={j} // 当前行数下班
...@@ -657,6 +658,7 @@ export default class ZdyTable extends Component { ...@@ -657,6 +658,7 @@ export default class ZdyTable extends Component {
}) : ""} }) : ""}
<IsNewTable <IsNewTable
modalInit={modalInit}
items={items} items={items}
checkAllHidden={this.checkAllHidden} checkAllHidden={this.checkAllHidden}
isBorder={isBorder} isBorder={isBorder}
......
...@@ -8,6 +8,7 @@ import { Row, Col } from 'antd'; ...@@ -8,6 +8,7 @@ import { Row, Col } from 'antd';
export default class isNewTable extends Component { export default class isNewTable extends Component {
render() { render() {
const { const {
items, items,
checkAllHidden, checkAllHidden,
isBorder, isBorder,
...@@ -30,7 +31,8 @@ export default class isNewTable extends Component { ...@@ -30,7 +31,8 @@ export default class isNewTable extends Component {
formCode, formCode,
formId, formId,
fatherObj, fatherObj,
style style,
modalInit
} = this.props } = this.props
if(!isEdit ){ // 展示栏 暂不做处理 if(!isEdit ){ // 展示栏 暂不做处理
return <> return <>
...@@ -51,6 +53,7 @@ export default class isNewTable extends Component { ...@@ -51,6 +53,7 @@ export default class isNewTable extends Component {
item.map((ary, j) => { item.map((ary, j) => {
return !allhidden && ary.hidden ? "" return !allhidden && ary.hidden ? ""
: <><TableCom : <><TableCom
modalInit={modalInit}
formCode={formCode} formCode={formCode}
formId={formId} formId={formId}
i={i} i={i}
...@@ -176,6 +179,7 @@ export default class isNewTable extends Component { ...@@ -176,6 +179,7 @@ export default class isNewTable extends Component {
title={ title={
!allhidden && ary.hidden ? "" !allhidden && ary.hidden ? ""
:<><TableCom :<><TableCom
modalInit={modalInit}
formCode={formCode} formCode={formCode}
formId={formId} formId={formId}
i={i} i={i}
...@@ -208,6 +212,7 @@ export default class isNewTable extends Component { ...@@ -208,6 +212,7 @@ export default class isNewTable extends Component {
// textAlign:ary.content&&ary.content.comName === 'Table'?"left":'right' // textAlign:ary.content&&ary.content.comName === 'Table'?"left":'right'
}} }}
> <><TableCom > <><TableCom
modalInit={modalInit}
formCode={formCode} formCode={formCode}
formId={formId} formId={formId}
i={i} i={i}
......
...@@ -33,6 +33,7 @@ export default class isNewWebTable extends Component { ...@@ -33,6 +33,7 @@ export default class isNewWebTable extends Component {
fatherObj, fatherObj,
style, style,
max, max,
modalInit
} = this.props } = this.props
return ( return (
<div <div
...@@ -89,6 +90,7 @@ export default class isNewWebTable extends Component { ...@@ -89,6 +90,7 @@ export default class isNewWebTable extends Component {
isEdit={isEdit} isEdit={isEdit}
formKey={currentFormKey} formKey={currentFormKey}
init={init} init={init}
modalInit={modalInit}
get={get} // 区分移动端或wen端 get={get} // 区分移动端或wen端
json={cell.content} json={cell.content}
obj={obj || {}} // 是否存在默认值 obj={obj || {}} // 是否存在默认值
......
import React from 'react'
import { Upload,message } from 'antd';
import config from '@/config/config'
export default class ImgUploadCom extends React.Component {
constructor(props){
super(props)
const value = props.value
this.state = {
url:value
}
}
triggerChange = (changedValue) => {
// Should provide an event to pass value to Form.
const onChange = this.props.onChange;
if (onChange) {
onChange( changedValue);
}
}
componentWillReceiveProps(nextProps) {
// Should be a controlled component.
if ('value' in nextProps) {
const value = nextProps.value;
this.setState({url:value});
}
}
changeUrl = (info, key) => {
if (info.file.status === 'done') {
message.success(`图片上传成功`);
if (!('value' in this.props)) {
this.setState({url: info.file.response });
}
this.triggerChange(info.file.response);
} else if (info.file.status === 'error') {
message.error(`图片上传失败`);
}
}
changePos=(obj)=>{
if (!('value' in this.props)) {
this.setState({...obj});
}
this.triggerChange({...obj});
}
render() {
const{json,disabled}=this.props
const {url}=this.state
return (
<Upload.Dragger disabled={disabled} accept={"image/*"} url={url} showUploadList={false} name="file" action={config.uploadUrl} onChange={this.changeUrl} multiple={false} style={{ padding: 0 }}>
{url ? <img src={config.httpServer + (url )} style={{ height: json.height, width: json.width }} /> : <div style={{ height: json.height, width: json.width }}>
</div>}
</Upload.Dragger>
);
}
}
\ No newline at end of file
...@@ -64,7 +64,7 @@ export default class MobileDate extends Component { ...@@ -64,7 +64,7 @@ export default class MobileDate extends Component {
} }
render() { render() {
let {dates} = this.state let {dates} = this.state
const {format}=this.props
const startTime=dates.length>0?dates[0].valueOf():null const startTime=dates.length>0?dates[0].valueOf():null
const endTime=dates.length>1?dates[1].valueOf():null const endTime=dates.length>1?dates[1].valueOf():null
...@@ -72,18 +72,20 @@ export default class MobileDate extends Component { ...@@ -72,18 +72,20 @@ export default class MobileDate extends Component {
<div> <div>
<DatePicker <DatePicker
// value={this.state.date} // value={this.state.date}
extra={<span style={{fontSize:14}}>{!!startTime?moment(startTime).format('YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>} extra={<span style={{fontSize:14}}>{!!startTime?moment(startTime).format(format?format:'YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>}
locale={{okText:"确定",dismissText:'取消'}} locale={{okText:"确定",dismissText:'取消'}}
value={ !!startTime?new Date(startTime):null} value={ !!startTime?new Date(startTime):null}
format={format?format:'YYYY-MM-DD HH:mm:ss'}
onChange={date => this.handelStartChange(date)} onChange={date => this.handelStartChange(date)}
> >
<List.Item arrow="horizontal">开始时间</List.Item> <List.Item arrow="horizontal">开始时间</List.Item>
</DatePicker> </DatePicker>
<DatePicker <DatePicker
// value={this.state.date} // value={this.state.date}
extra={<span style={{fontSize:14}}>{!!endTime?moment(endTime).format('YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>} extra={<span style={{fontSize:14}}>{!!endTime?moment(endTime).format(format?format:'YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>}
value={!!endTime?new Date(endTime):null} value={!!endTime?new Date(endTime):null}
locale={{okText:"确定",dismissText:'取消'}} locale={{okText:"确定",dismissText:'取消'}}
format={format?format:'YYYY-MM-DD HH:mm:ss'}
onChange={date => this.handelEndChange(date)} onChange={date => this.handelEndChange(date)}
> >
<List.Item arrow="horizontal">结束时间</List.Item> <List.Item arrow="horizontal">结束时间</List.Item>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import React from 'react'; import React from 'react';
import { Tree, Table, Spin } from 'antd'; import { Tree, Table, Spin } from 'antd';
import FormList from './formList'; import FormList from './formList';
import TreeList from './formList/TreeList'
import { connect } from 'dva'; import { connect } from 'dva';
export default class TableList extends React.Component { export default class TableList extends React.Component {
...@@ -40,7 +41,30 @@ export default class TableList extends React.Component { ...@@ -40,7 +41,30 @@ export default class TableList extends React.Component {
} }
render() { render() {
return <FormList const {isTree} = this.props
return isTree?
<TreeList
onSelectRow={this.props.value.onSelectRow}
istableCom={true}
showHeader={this.props.showHeader}
get={this.props.get}
isHiddenPage={
this.props.isHiddenPage!=null?
this.props.isHiddenPage
:false}
loading={this.props.loading}
pageSize={this.props.pageSize||10}
value={this.state}
notShowBack={true}
rights={this.props.rights || []}
objCode={this.props.objCode}
isFormCom={true}
sql={this.props.sql}/>:
<FormList
onSelectRow={this.props.value.onSelectRow} onSelectRow={this.props.value.onSelectRow}
istableCom={true} istableCom={true}
showHeader={this.props.showHeader} showHeader={this.props.showHeader}
......
差异被折叠。
...@@ -32,6 +32,9 @@ import SearchInfo from '../../App/SearchInfo'; ...@@ -32,6 +32,9 @@ import SearchInfo from '../../App/SearchInfo';
import {Base16Encode} from "../../Base16/index"; import {Base16Encode} from "../../Base16/index";
import baseX from 'base-x' import baseX from 'base-x'
import {isEmpty} from 'lodash' import {isEmpty} from 'lodash'
import FilePreview from "@/webPublic/one_stop_public/filePreview";
import {queryApiActionPath} from "@/webPublic/one_stop_public/utils/queryConfig";
import UploadCom from "@/components/libs/UploadCom";
const BASE16 = '0123456789abcdef' const BASE16 = '0123456789abcdef'
const bs16 = baseX(BASE16) const bs16 = baseX(BASE16)
const FormItem = Form.Item; const FormItem = Form.Item;
...@@ -232,6 +235,24 @@ class FormList extends React.Component { ...@@ -232,6 +235,24 @@ class FormList extends React.Component {
// } // }
}; };
isJSON = (str) => {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
console.log('error:' + str + '!!!' + e);
return false;
}
}
console.log('这不是个字符串')
}
delete = record => { delete = record => {
//找出主键 //找出主键
let Keys = {}; let Keys = {};
...@@ -361,29 +382,25 @@ class FormList extends React.Component { ...@@ -361,29 +382,25 @@ class FormList extends React.Component {
const b = nextProps.value||{} const b = nextProps.value||{}
const a = this.props.value||{} const a = this.props.value||{}
if(JSON.stringify(a)!=JSON.stringify(b)){
const params = {
pageNo: 1,
pageSize: this.props.pageSize||10,
query: JSON.stringify(this.state.formValues),
};
this.custom=Base16Encode(JSON.stringify(b))
if(this.state.objId)this.getPage(params)
} if(JSON.stringify(a)!=JSON.stringify(b)){
if(this.props.objCode=="1"||this.props.objCode==1){ const params = {
const params = { pageNo: 1,
pageNo: 1, pageSize: this.props.pageSize||10,
pageSize: this.props.pageSize||10, query: JSON.stringify(this.state.formValues),
query: JSON.stringify(this.state.formValues), };
}; if(nextProps.value.columns!=null&&nextProps.value.columns.length>0){
this.columns=nextProps.value.columns this.columns=nextProps.value.columns
if( nextProps.value.getPage){ }
this.getPage(params,null,nextProps.value.getPage);
} this.custom=Base16Encode(JSON.stringify(b))
} if( nextProps.value.getPage){
this.getPage(params,null,nextProps.value.getPage);
}else{
if(this.state.objId)this.getPage(params)
}
}
const x=nextProps.selects const x=nextProps.selects
const y = this.props.selects const y = this.props.selects
if(JSON.stringify(x)!=JSON.stringify(y)){ if(JSON.stringify(x)!=JSON.stringify(y)){
...@@ -444,7 +461,27 @@ class FormList extends React.Component { ...@@ -444,7 +461,27 @@ class FormList extends React.Component {
} }
}else if(datas[t].name.indexOf("process_status")>-1){ }else if(datas[t].name.indexOf("process_status")>-1){
column.render=(val)=>val?(val==="0"?"审核通过":"审核未通过"):null column.render=(val)=>val?(val==="0"?"审核通过":"审核未通过"):null
}else { }else if(datas[t].extendTypeId&&datas[t].extendTypeId.indexOf("file")>-1){ //特殊处理附件
column.render =( val) =>{
if(this.isJSON(val)){
val = JSON.parse(val);
let files = val.files;
let xx =( <ul>
{files.map((f, index2) => {
return <li key={index2}><FilePreview
path={queryApiActionPath() + f.path}
pathName={f.name}
/></li>
}
)}
</ul>
)
return xx;
}else {
return val;
}
}
}else{
column.render=(val)=>val&&val.length>100? <Tooltip title={val} overlayStyle={{width:1000}}> column.render=(val)=>val&&val.length>100? <Tooltip title={val} overlayStyle={{width:1000}}>
<span style={{width:column.width||200,display:"block", wordBreak:"keep-all",whiteSpace:"nowrap", overflow:"hidden", textOverflow:"ellipsis"}}>{val}</span> <span style={{width:column.width||200,display:"block", wordBreak:"keep-all",whiteSpace:"nowrap", overflow:"hidden", textOverflow:"ellipsis"}}>{val}</span>
</Tooltip>:val </Tooltip>:val
...@@ -770,7 +807,18 @@ class FormList extends React.Component { ...@@ -770,7 +807,18 @@ class FormList extends React.Component {
</FormItem> </FormItem>
); );
} else if(isQuery&&item.isGroupQuery!=null&&item.isGroupQuery){ //如果是查询 并且是组合查询 } else if(item.extendTypeId&&item.extendTypeId.indexOf("file")>-1){
//特殊处理附件 如果是查询就 跳过
if(isQuery) return ;
return (
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : (formData[item.name]&&this.isJSON(formData[item.name])?JSON.parse(formData[item.name]):null),
rules: [{ required: !item.isNull }],
})(<UploadCom />)}
</FormItem>
);
} else if(isQuery&&item.isGroupQuery!=null&&item.isGroupQuery){ //如果是查询 并且是组合查询
const ops = groups[item.id + ''] || [] const ops = groups[item.id + ''] || []
return ( return (
...@@ -965,7 +1013,7 @@ class FormList extends React.Component { ...@@ -965,7 +1013,7 @@ class FormList extends React.Component {
onClick={this.view.bind(this, record)}>查看详情</a><Divider type="vertical"/></>} onClick={this.view.bind(this, record)}>查看详情</a><Divider type="vertical"/></>}
{rights && !rights.includes('edit') ? '' : <><a {rights && !rights.includes('edit') ? '' : <><a
onClick={this.modify.bind(this, record)}>编辑</a><Divider type="vertical"/></>} onClick={this.modify.bind(this, record)}>编辑</a><Divider type="vertical"/></>}
{rignt&&rights.includes("viewProcess")&&record.process_biz_key?<><a onClick={this.viewProcess.bind(this, record)}>查看流程详情</a><Divider type="vertical"/></>:''} {rights&&rights.includes("viewProcess")&&record.process_biz_key?<><a onClick={this.viewProcess.bind(this, record)}>查看流程详情</a><Divider type="vertical"/></>:''}
{rights && !rights.includes('delete') ? '' : <> <Popconfirm {rights && !rights.includes('delete') ? '' : <> <Popconfirm
title="确定删除该数据?" title="确定删除该数据?"
onConfirm={this.delete.bind(this, record)} onConfirm={this.delete.bind(this, record)}
......
...@@ -49,6 +49,7 @@ import TableSelect from '../libs/TableSelect'; ...@@ -49,6 +49,7 @@ import TableSelect from '../libs/TableSelect';
import LocationCom from '../libs/LocationCom' import LocationCom from '../libs/LocationCom'
import MobileDate from '../libs/MobileDate'; import MobileDate from '../libs/MobileDate';
import ChildForm from '../libs/ChildForm'; import ChildForm from '../libs/ChildForm';
import ImgUploadCom from '../libs/ImgUploadCom';
import moment from 'moment'; import moment from 'moment';
import router from 'umi/router'; import router from 'umi/router';
import TableList from '../libs/TableList'; import TableList from '../libs/TableList';
...@@ -115,13 +116,6 @@ const errorHandler = error => { ...@@ -115,13 +116,6 @@ const errorHandler = error => {
} }
}; };
let oldProps = {}
const normFile = (e) => {
if (Array.isArray(e)) {
return e;
}
return e && e.fileList[0];
}
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({ @connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
DataColumn, SqlManageEntity, formList, DataColumn, SqlManageEntity, formList,
loading: loading.models.DataColumn || loading.models.SqlManageEntity || loading.models.formList loading: loading.models.DataColumn || loading.models.SqlManageEntity || loading.models.formList
...@@ -430,7 +424,7 @@ export default class tableCom extends Component { ...@@ -430,7 +424,7 @@ export default class tableCom extends Component {
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
const { json, mapData, obj } = props; const { json, mapData, obj } = props;
if (json == null) { if (json == null||this.props.safe) {
return; return;
} }
if (!(this.dataFilter.includes(json.comName) || json.comName == "TableSelect") && json.isFormulaOnce) { if (!(this.dataFilter.includes(json.comName) || json.comName == "TableSelect") && json.isFormulaOnce) {
...@@ -772,11 +766,11 @@ export default class tableCom extends Component { ...@@ -772,11 +766,11 @@ export default class tableCom extends Component {
} }
reqUtil = (base52, json, orgCallback, url, method, params, callback, options = {}) => { reqUtil = (base52, json, orgCallback, url, method, params, callback, options = {}) => {
//查缓存 //查缓存
var isChange = false; var isChange = true;
if (url.indexOf("http") === -1) { if (url.indexOf("http") === -1) {
url = config.httpServer + url url = config.httpServer + url
} }
const { reqUrls } = this.state const { reqUrls } = this.state
if (reqUrls[url] != null) { if (reqUrls[url] != null) {
const ps = reqUrls[url].params const ps = reqUrls[url].params
...@@ -858,7 +852,7 @@ export default class tableCom extends Component { ...@@ -858,7 +852,7 @@ export default class tableCom extends Component {
} }
return "norefeshxxxxxxxxxxxxxxxxxxxx" return "norefeshxxxxxxxxxxxxxxxxxxxx"
} }
this.setState({ reqUrls }, () => { this.setState({ }, () => {
for (let i in params) { for (let i in params) {
if (params[i] == null) { if (params[i] == null) {
delete params[i] delete params[i]
...@@ -882,10 +876,10 @@ export default class tableCom extends Component { ...@@ -882,10 +876,10 @@ export default class tableCom extends Component {
method: method, method: method,
requestType: "form" requestType: "form"
}).then(data => { }).then(data => {
this.setState({ res: data }, () => { const { reqUrls } = this.state
const { reqUrls } = this.state reqUrls[url].data = data
reqUrls[url].data = data this.setState({ res: data,reqUrls }, () => {
this.setState({ reqUrls })
if (callback) { if (callback) {
if (json.optionType && json.optionType == "func") { if (json.optionType && json.optionType == "func") {
...@@ -1287,9 +1281,9 @@ export default class tableCom extends Component { ...@@ -1287,9 +1281,9 @@ export default class tableCom extends Component {
} }
} }
this.getData(json, dataColumn, obj) this.getData(json, dataColumn, obj)
if (json.formula != null && json.formula != "") { if (json.formula != null && json.formula != ""&&!this.props.safe) {
this.getFunctionValue(json.formula, dataColumn, json) this.getFunctionValue(json.formula, dataColumn, json)
} }
...@@ -1469,16 +1463,7 @@ export default class tableCom extends Component { ...@@ -1469,16 +1463,7 @@ export default class tableCom extends Component {
return dataColumn; return dataColumn;
}; };
changeUrl = (info, key) => {
if (info.file.status === 'done') {
message.success(`图片上传成功`);
this.setState({ url: info.file.response })
} else if (info.file.status === 'error') {
message.error(`图片上传失败`);
}
}
render() { render() {
/** /**
* json为申请表单 * json为申请表单
...@@ -1931,19 +1916,14 @@ export default class tableCom extends Component { ...@@ -1931,19 +1916,14 @@ export default class tableCom extends Component {
if (end != null) ivs.push(moment(parseInt(init[end.base52]))); if (end != null) ivs.push(moment(parseInt(init[end.base52])));
} }
if (begin != null && end != null) { if (begin != null && end != null) {
if (!isEdit) {
r:
cm = <span> 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> </span>
} else {
cm = getFieldDecorator(begin.base52 + '_' + end.base52, {
initialValue: ivs,
rules: [{ required: required, message: '请选择起止时间' }],
})(<RangePicker showTime />);
}
} else { } else {
cm = "" cm = ""
} }
...@@ -2106,6 +2086,8 @@ export default class tableCom extends Component { ...@@ -2106,6 +2086,8 @@ export default class tableCom extends Component {
} }
cm = <TableList cm = <TableList
get={get} get={get}
isTree = {json.isTree}
json={json}
loading={this.props.loading} loading={this.props.loading}
showHeader={json.showHeader} showHeader={json.showHeader}
isHiddenPage={json.isHiddenPage} isHiddenPage={json.isHiddenPage}
...@@ -2543,7 +2525,7 @@ export default class tableCom extends Component { ...@@ -2543,7 +2525,7 @@ export default class tableCom extends Component {
cm = getFieldDecorator(begin.base52 + '$' + end.base52, { cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs, initialValue: ivs,
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }], rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<MobileDate disabled={disabled} />); })(<MobileDate disabled={disabled} formate={json.format}/>);
if (json.isLabel && title) { if (json.isLabel && title) {
cm = <Form.Item cm = <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{ span: json.labelSpan }}
...@@ -2558,7 +2540,7 @@ export default class tableCom extends Component { ...@@ -2558,7 +2540,7 @@ export default class tableCom extends Component {
cm = getFieldDecorator(begin.base52 + '$' + end.base52, { cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs, initialValue: ivs,
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }], rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<RangePicker showTime disabled={disabled} />); })(<RangePicker showTime={json.showTime!=null?json.showTime:true} format={json.format?json.format:"YYYY-MM-DD HH:mm:ss"} disabled={disabled} />);
} }
if (json.label == null) title = '起止时间'; if (json.label == null) title = '起止时间';
break; break;
...@@ -2610,7 +2592,7 @@ export default class tableCom extends Component { ...@@ -2610,7 +2592,7 @@ export default class tableCom extends Component {
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }], rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<DatePicker })(<DatePicker
disabled={disabled} disabled={disabled}
showTime showTime={json.showTime!=null?json.showTime:true}
onOpenChange={get === 'mobile' ? () => { // 取消唤起移动端小键盘 onOpenChange={get === 'mobile' ? () => { // 取消唤起移动端小键盘
setTimeout(() => { setTimeout(() => {
if (document.querySelector('.ant-calendar-input ')) { if (document.querySelector('.ant-calendar-input ')) {
...@@ -2711,15 +2693,9 @@ export default class tableCom extends Component { ...@@ -2711,15 +2693,9 @@ export default class tableCom extends Component {
break; break;
case 'ImgUploadCom': case 'ImgUploadCom':
cm = getFieldDecorator("img$" + dataColumn.base52, { cm = getFieldDecorator(dataColumn.base52, {
valuePropName: 'fileList[0]', initialValue: initValue,
getValueFromEvent: normFile, })(<ImgUploadCom json={json} disabled={disabled}/>);
})(<Upload.Dragger disabled={disabled} accept={"image/*"} url={this.state.url || initValue} showUploadList={false} name="file" action={config.uploadUrl} onChange={info => this.changeUrl(info, dataColumn.base52)} multiple={false} style={{ padding: 0 }}>
{this.state.url || initValue ? <img src={config.httpServer + (this.state.url || initValue)} style={{ height: json.height, width: json.width }} /> : <div style={{ height: json.height, width: json.width }}>
</div>}
</Upload.Dragger>);
if (get === 'mobile' && json.isLabel && title) { if (get === 'mobile' && json.isLabel && title) {
cm = <Form.Item cm = <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{ span: json.labelSpan }}
...@@ -2755,6 +2731,8 @@ export default class tableCom extends Component { ...@@ -2755,6 +2731,8 @@ export default class tableCom extends Component {
initialValue: initValue || {} initialValue: initValue || {}
})(<TableList })(<TableList
json={json}
isTree = {json.isTree}
isHiddenPage={json.isHiddenPage} isHiddenPage={json.isHiddenPage}
showHeader={json.showHeader} showHeader={json.showHeader}
loading={this.props.loading} loading={this.props.loading}
......
import React, { Fragment, Component } from 'react';
import styles from './index.less';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import Shell from '@/baseComponent/Shell';
import { ModalConfirm } from '@/baseComponent/Modal';
export default class FormatSetting extends Component {
dragEventList = () => {
const { formatSettingObject, updateFormatSettingObject } = this.props;
let draggedRef = null;
document.addEventListener('dragstart', function(event) {
// 保存拖动元素的引用(ref.)
draggedRef = event.target;
// 使其半透明
event.target.style.opacity = 0.5;
}, false);
document.addEventListener('dragend', function(event) {
// 重置透明度
event.target.style.opacity = '';
}, false);
/* 放下目标节点时触发事件 */
document.addEventListener('dragover', function(event) {
// 阻止默认动作
event.preventDefault();
}, false);
document.addEventListener('drop', function(event) {
// 阻止默认动作(如打开一些元素的链接)
event.preventDefault();
// 将拖动的元素到所选择的放置目标节点中
if (event.target.id === 'dropZone') {
const left = event.offsetX;
if (left > (event.target.width - draggedRef.offsetWidth - 10)) {
console.log('拖拽到了图片区域外部,不能进行拖拽');
return false;
}
const top = event.offsetY;
updateFormatSettingObject(draggedRef.id, left, top);
draggedRef.style.left = left; // `${left}px`;
draggedRef.style.top = top; // `${top}px`;
}
}, false);
};
componentDidMount() {
this.dragEventList();
}
initConfig = () => {
ModalConfirm('您确定初始化打印录取通知书格式吗?',{
onOk: ()=>{
this.props.initConfig();
},
});
};
render() {
const { bgImage, formatSettingObject, saveConfig } = this.props;
const configInfo = Object.keys(formatSettingObject);
return <Fragment>
<Shell styleShell={{marginTop: '0',marginBottom: '20px'}}>
<div style={{ height: '54px', padding: '12px 0 12px 12px' }}>
<ButtonDiy name="保存"
className="primary"
handleClick={saveConfig}
/>
<ButtonDiy name={'初始化格式'}
handleClick={this.initConfig}
/>
</div>
</Shell>
<div className={styles.outSideDiv}>
<div>
<img src={bgImage}
id={'dropZone'}
draggable={false}
className={styles.bgimage}
alt={'背景图'}
/>
{configInfo.map((x) => {
return (
<div draggable={true}
className={styles.inSideItem}
key={x}
id={x}
style={formatSettingObject[x].style}
>
{formatSettingObject[x].title}
</div>
);
})}
</div>
</div>
</Fragment>
;
}
}
/***
* formatSettingObject: {
* content_set: {
* font: "宋体"
isNeedConfig: true
key: "JjqCiRYamxs"
name: "content_set"
size: "12"
style: {top: 300, left: 50}
title: "--详细内容--"
* }
* }
*
* */
.outSideDiv{
position: relative;
text-align: left;
width: 100%;
.bgimage{
height: auto;
overflow: auto;
z-index: 1;
}
.inSideItem{
position: absolute;
cursor: move;
z-index: 10;
color: #000;
padding-left: 10px;
padding-right: 10px;
font-size: 14px;
line-height: 28px;
border: 1px solid gray;
background-color: #CCC;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论