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

Merge remote-tracking branch 'origin/master'

......@@ -166,9 +166,12 @@ export default class AffairPage extends React.Component {
if (event.data === 'returnList') {
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]);
document.getElementById('applyIframeId').height = height;
const iframe = document.getElementById('applyIframeId');
if (iframe) {
iframe.height = height;
}
}
}, false);
......
......@@ -18,10 +18,10 @@ export default class AuditPage extends Component {
componentDidMount() {}
handleButtonSet = () => {
const { addFields, workId } = this.props;
const { addFields, workId, hasBatchAudit } = this.props;
return {
tab1: [
{
hasBatchAudit ? {
type: 'audit',
component: 'RenderComponent',
render: ({ selectRows, getPage }) => {
......@@ -52,8 +52,8 @@ export default class AuditPage extends Component {
</AuditModal>
);
},
},
],
}: false,
].filter(i => i),
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';
import { Link } from 'dva/router';
export default class Index extends React.Component {
static defaultProps = {
hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志
};
constructor(props) {
super(props);
......@@ -112,11 +117,13 @@ export default class Index extends React.Component {
render() {
const { workId, dataBaseId, columns, searchCondition, addFields, allConfigSetInfo, tableInfo } = this.state;
const { hasBatchAudit } = this.props;
if(!workId){
return null;
}
return (
<AuditPage
hasBatchAudit={hasBatchAudit}
workId={workId}
dataBaseId={dataBaseId}
columns={columns}
......
......@@ -3,7 +3,9 @@ import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
export const getHead = (payload, callback) => {
uaaRequest('/DataColumnApi/getHeaderList', payload).then(res => {
if (!res) return;
if (callback) callback(res);
if (callback) {
callback(res);
}
});
};
......
......@@ -20,11 +20,11 @@ import {
} from '@/webPublic/Services';
import { ModalConfirm } from '@/baseComponent/Modal';
const dateRender = val => val && moment(val).format('YYYY-MM-DD HH:mm:ss');
const dateRender = (val) => val && moment(val).format('YYYY-MM-DD HH:mm:ss');
const getValue = obj =>
const getValue = (obj) =>
Object.keys(obj)
.map(key => obj[key])
.map((key) => obj[key])
.join(',');
/**
......@@ -58,7 +58,7 @@ class ListWithAddEditTemplate extends React.Component {
isAdd: false, // 是新增还是编辑
selectedRows: [],
primaryKey: null,
showEdit: false, // 是否显示编辑区域
// showEdit: false, // 是否显示编辑区域
pageData: {
list: [],
pagination: {},
......@@ -71,20 +71,22 @@ class ListWithAddEditTemplate extends React.Component {
// 渲染值
componentDidMount() {
const { objId } = this.props;
fetchTableHeader(objId).then(headerList => {
fetchTableHeader(objId).then((headerList) => {
if (!headerList) return;
this.setState({ headerList });
this.columns = headerList
.filter(i => !i.isHidden)
.filter((i) => !i.isHidden)
.slice(0, 10)
.map(item => ({
.map((item) => ({
title: item.title,
dataIndex: item.name,
render: date.includes(item.type) && dateRender,
}));
const operation = {
title: '操作',
fixed: 'right',
width: 120,
render: (_, record) => {
return (
<Fragment>
......@@ -97,11 +99,11 @@ class ListWithAddEditTemplate extends React.Component {
};
this.columns.push(operation);
const primaryKey = (headerList.find(i => i.isPrimaryKey) || {}).name;
const primaryKey = (headerList.find((i) => i.isPrimaryKey) || {}).name;
this.setState({ primaryKey });
const searchConfig = headerList.filter(i => i.isShowQuery).map(item => {
const searchConfig = headerList.filter((i) => i.isShowQuery).map((item) => {
const sear = getFormArrayConfig([item]);
const { required, placeHolder, ...config } = sear[0];
return config;
......@@ -114,35 +116,35 @@ class ListWithAddEditTemplate extends React.Component {
// 新增按钮事件
add = () => {
const { headerList } = this.state;
const showEdit = headerList.length >= 10;
// const showEdit = headerList.length >= 10;
this.setState({
modalVisible: !showEdit,
modalVisible: true,
formData: {},
isAdd: true,
showEdit,
// showEdit,
});
};
// 修改按钮事件
modify = record => {
modify = (record) => {
const recordTemp = { ...record, update_time: Date.now() };
const { headerList } = this.state;
const showEdit = headerList.length >= 10;
// const showEdit = headerList.length >= 10;
// 把record里明文key改成转换后的key,用于在模板表单中回显
const headerMap = headerList.reduce((acc, header) => ({ ...acc, [header.name]: header }), {});
const formData = Object.keys(recordTemp).reduce(
(acc, key) => ({ ...acc, [headerMap[key].base52]: recordTemp[key] }),
{}
);
const formData = Object.keys(recordTemp).reduce((acc, key) => {
if (!headerMap[key]) return acc;
return { ...acc, [headerMap[key].base52]: recordTemp[key] };
}, {});
this.setState({
formData,
modalVisible: !showEdit,
modalVisible: true,
isAdd: false,
showEdit,
// showEdit,
});
};
delete = record => {
delete = (record) => {
ModalConfirm('确定删除?', {
onOk: () => {
const { objId } = this.props;
......@@ -151,7 +153,7 @@ class ListWithAddEditTemplate extends React.Component {
const Keys = {};
Keys[primaryKey] = record[primaryKey];
deleteTableItem(objId, primaryKey, record[primaryKey]).then(res => {
deleteTableItem(objId, primaryKey, record[primaryKey]).then((res) => {
this.getPage();
});
},
......@@ -172,7 +174,7 @@ class ListWithAddEditTemplate extends React.Component {
const pageNo = pagination.current ? pagination.current : 1;
const pageSize = pagination.pageSize ? pagination.pageSize : 10;
fetchTableData({ dataObjId: objId, query, pageSize, pageNo }).then(res => {
fetchTableData({ dataObjId: objId, query, pageSize, pageNo }).then((res) => {
if (!res.rows) {
console.log('分页接口rows返回null报错');
}
......@@ -194,7 +196,7 @@ class ListWithAddEditTemplate extends React.Component {
({ pageData }) => ({
pageData: { ...pageData, pagination },
}),
this.getPage
this.getPage,
);
};
......@@ -207,7 +209,7 @@ class ListWithAddEditTemplate extends React.Component {
validateFields((err, values) => {
if (err) return;
this.setState({ confirmLoading: true });
addOrEditTableItem({ objId, data: values, isAdd }).then(res => {
addOrEditTableItem({ objId, data: values, isAdd }).then((res) => {
this.setState({ confirmLoading: false });
if (res === true) {
message.success('操作成功');
......@@ -229,13 +231,13 @@ class ListWithAddEditTemplate extends React.Component {
});
};
handleSelectRows = rows => {
handleSelectRows = (rows) => {
this.setState({
selectedRows: rows,
});
};
batchDelete = e => {
batchDelete = (e) => {
const { selectedRows, primaryKey } = this.state;
const { objId } = this.props;
......@@ -243,12 +245,14 @@ class ListWithAddEditTemplate extends React.Component {
ModalConfirm('确定删除?', {
onOk: () => {
deleteTableItem(objId, primaryKey, selectedRows.map(row => row[primaryKey])).then(res => {
deleteTableItem(objId, primaryKey, selectedRows.map((row) => row[primaryKey])).then(
(res) => {
this.setState({
selectedRows: [],
});
this.getPage();
});
},
);
},
});
};
......@@ -295,20 +299,6 @@ class ListWithAddEditTemplate extends React.Component {
};
return (
<>
{showEdit ? (
<Edit
id={objId}
recordId={formData[primaryKey]}
recordKey={primaryKey}
returnThis={() => {
this.setState({
showEdit: false,
});
this.getPage();
}}
/>
) : (
<Fragment>
{searchConfig.length > 0 ? (
<SearchDom
formStateChange={this.formStateChange}
......@@ -332,11 +322,10 @@ class ListWithAddEditTemplate extends React.Component {
selectedRows={selectedRows}
onSelectRow={this.handleSelectRows}
onChange={this.handleStandardTableChange}
scroll={{ x: 1200 }}
scroll={{ x: true }}
/>
</Shell>
</Fragment>
)}
<AddOrEditModal {...addOrEditModalProps} />
</>
);
......
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) {
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: tableId, isAdd, data: values }).then(res => {
if (res) {
ModalInfo('保存成功!');
......
......@@ -571,6 +571,7 @@ export default class ZdyTable extends Component {
<TableCom
formCode={formCode} // 当前表单code
modalInit={modalInit}
formId={formId} // 当前表单Id
i={i} // 当前组件下标
j={j} // 当前行数下班
......@@ -657,6 +658,7 @@ export default class ZdyTable extends Component {
}) : ""}
<IsNewTable
modalInit={modalInit}
items={items}
checkAllHidden={this.checkAllHidden}
isBorder={isBorder}
......
......@@ -8,6 +8,7 @@ import { Row, Col } from 'antd';
export default class isNewTable extends Component {
render() {
const {
items,
checkAllHidden,
isBorder,
......@@ -30,7 +31,8 @@ export default class isNewTable extends Component {
formCode,
formId,
fatherObj,
style
style,
modalInit
} = this.props
if(!isEdit ){ // 展示栏 暂不做处理
return <>
......@@ -51,6 +53,7 @@ export default class isNewTable extends Component {
item.map((ary, j) => {
return !allhidden && ary.hidden ? ""
: <><TableCom
modalInit={modalInit}
formCode={formCode}
formId={formId}
i={i}
......@@ -176,6 +179,7 @@ export default class isNewTable extends Component {
title={
!allhidden && ary.hidden ? ""
:<><TableCom
modalInit={modalInit}
formCode={formCode}
formId={formId}
i={i}
......@@ -208,6 +212,7 @@ export default class isNewTable extends Component {
// textAlign:ary.content&&ary.content.comName === 'Table'?"left":'right'
}}
> <><TableCom
modalInit={modalInit}
formCode={formCode}
formId={formId}
i={i}
......
......@@ -33,6 +33,7 @@ export default class isNewWebTable extends Component {
fatherObj,
style,
max,
modalInit
} = this.props
return (
<div
......@@ -89,6 +90,7 @@ export default class isNewWebTable extends Component {
isEdit={isEdit}
formKey={currentFormKey}
init={init}
modalInit={modalInit}
get={get} // 区分移动端或wen端
json={cell.content}
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 {
}
render() {
let {dates} = this.state
const {format}=this.props
const startTime=dates.length>0?dates[0].valueOf():null
const endTime=dates.length>1?dates[1].valueOf():null
......@@ -72,18 +72,20 @@ export default class MobileDate extends Component {
<div>
<DatePicker
// 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:'取消'}}
value={ !!startTime?new Date(startTime):null}
format={format?format:'YYYY-MM-DD HH:mm:ss'}
onChange={date => this.handelStartChange(date)}
>
<List.Item arrow="horizontal">开始时间</List.Item>
</DatePicker>
<DatePicker
// 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}
locale={{okText:"确定",dismissText:'取消'}}
format={format?format:'YYYY-MM-DD HH:mm:ss'}
onChange={date => this.handelEndChange(date)}
>
<List.Item arrow="horizontal">结束时间</List.Item>
......
......@@ -9,6 +9,7 @@
import React from 'react';
import { Tree, Table, Spin } from 'antd';
import FormList from './formList';
import TreeList from './formList/TreeList'
import { connect } from 'dva';
export default class TableList extends React.Component {
......@@ -40,7 +41,30 @@ export default class TableList extends React.Component {
}
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}
istableCom={true}
showHeader={this.props.showHeader}
......
差异被折叠。
......@@ -32,6 +32,9 @@ import SearchInfo from '../../App/SearchInfo';
import {Base16Encode} from "../../Base16/index";
import baseX from 'base-x'
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 bs16 = baseX(BASE16)
const FormItem = Form.Item;
......@@ -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 => {
//找出主键
let Keys = {};
......@@ -361,27 +382,23 @@ class FormList extends React.Component {
const b = nextProps.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(this.props.objCode=="1"||this.props.objCode==1){
if(JSON.stringify(a)!=JSON.stringify(b)){
const params = {
pageNo: 1,
pageSize: this.props.pageSize||10,
query: JSON.stringify(this.state.formValues),
};
if(nextProps.value.columns!=null&&nextProps.value.columns.length>0){
this.columns=nextProps.value.columns
}
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
......@@ -444,7 +461,27 @@ class FormList extends React.Component {
}
}else if(datas[t].name.indexOf("process_status")>-1){
column.render=(val)=>val?(val==="0"?"审核通过":"审核未通过"):null
}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}}>
<span style={{width:column.width||200,display:"block", wordBreak:"keep-all",whiteSpace:"nowrap", overflow:"hidden", textOverflow:"ellipsis"}}>{val}</span>
</Tooltip>:val
......@@ -770,6 +807,17 @@ class FormList extends React.Component {
</FormItem>
);
} 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 + ''] || []
......@@ -965,7 +1013,7 @@ class FormList extends React.Component {
onClick={this.view.bind(this, record)}>查看详情</a><Divider type="vertical"/></>}
{rights && !rights.includes('edit') ? '' : <><a
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
title="确定删除该数据?"
onConfirm={this.delete.bind(this, record)}
......
......@@ -49,6 +49,7 @@ import TableSelect from '../libs/TableSelect';
import LocationCom from '../libs/LocationCom'
import MobileDate from '../libs/MobileDate';
import ChildForm from '../libs/ChildForm';
import ImgUploadCom from '../libs/ImgUploadCom';
import moment from 'moment';
import router from 'umi/router';
import TableList from '../libs/TableList';
......@@ -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 }) => ({
DataColumn, SqlManageEntity, formList,
loading: loading.models.DataColumn || loading.models.SqlManageEntity || loading.models.formList
......@@ -430,7 +424,7 @@ export default class tableCom extends Component {
componentWillReceiveProps(props) {
const { json, mapData, obj } = props;
if (json == null) {
if (json == null||this.props.safe) {
return;
}
if (!(this.dataFilter.includes(json.comName) || json.comName == "TableSelect") && json.isFormulaOnce) {
......@@ -772,7 +766,7 @@ export default class tableCom extends Component {
}
reqUtil = (base52, json, orgCallback, url, method, params, callback, options = {}) => {
//查缓存
var isChange = false;
var isChange = true;
if (url.indexOf("http") === -1) {
url = config.httpServer + url
}
......@@ -858,7 +852,7 @@ export default class tableCom extends Component {
}
return "norefeshxxxxxxxxxxxxxxxxxxxx"
}
this.setState({ reqUrls }, () => {
this.setState({ }, () => {
for (let i in params) {
if (params[i] == null) {
delete params[i]
......@@ -882,10 +876,10 @@ export default class tableCom extends Component {
method: method,
requestType: "form"
}).then(data => {
this.setState({ res: data }, () => {
const { reqUrls } = this.state
reqUrls[url].data = data
this.setState({ reqUrls })
this.setState({ res: data,reqUrls }, () => {
if (callback) {
if (json.optionType && json.optionType == "func") {
......@@ -1289,7 +1283,7 @@ export default class tableCom extends Component {
}
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)
}
......@@ -1469,16 +1463,7 @@ export default class tableCom extends Component {
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() {
/**
* json为申请表单
......@@ -1931,19 +1916,14 @@ export default class tableCom extends Component {
if (end != null) ivs.push(moment(parseInt(init[end.base52])));
}
if (begin != null && end != null) {
if (!isEdit) {
r:
cm = <span>
{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')}
</span>
} else {
cm = getFieldDecorator(begin.base52 + '_' + end.base52, {
initialValue: ivs,
rules: [{ required: required, message: '请选择起止时间' }],
})(<RangePicker showTime />);
}
} else {
cm = ""
}
......@@ -2106,6 +2086,8 @@ export default class tableCom extends Component {
}
cm = <TableList
get={get}
isTree = {json.isTree}
json={json}
loading={this.props.loading}
showHeader={json.showHeader}
isHiddenPage={json.isHiddenPage}
......@@ -2543,7 +2525,7 @@ export default class tableCom extends Component {
cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs,
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) {
cm = <Form.Item
labelCol={{ span: json.labelSpan }}
......@@ -2558,7 +2540,7 @@ export default class tableCom extends Component {
cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs,
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 = '起止时间';
break;
......@@ -2610,7 +2592,7 @@ export default class tableCom extends Component {
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<DatePicker
disabled={disabled}
showTime
showTime={json.showTime!=null?json.showTime:true}
onOpenChange={get === 'mobile' ? () => { // 取消唤起移动端小键盘
setTimeout(() => {
if (document.querySelector('.ant-calendar-input ')) {
......@@ -2711,15 +2693,9 @@ export default class tableCom extends Component {
break;
case 'ImgUploadCom':
cm = getFieldDecorator("img$" + dataColumn.base52, {
valuePropName: 'fileList[0]',
getValueFromEvent: normFile,
})(<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>);
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
})(<ImgUploadCom json={json} disabled={disabled}/>);
if (get === 'mobile' && json.isLabel && title) {
cm = <Form.Item
labelCol={{ span: json.labelSpan }}
......@@ -2755,6 +2731,8 @@ export default class tableCom extends Component {
initialValue: initValue || {}
})(<TableList
json={json}
isTree = {json.isTree}
isHiddenPage={json.isHiddenPage}
showHeader={json.showHeader}
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论