提交 5bfb05b3 authored 作者: 徐立's avatar 徐立

解决冲突

...@@ -88,7 +88,6 @@ export default class List extends Component { ...@@ -88,7 +88,6 @@ export default class List extends Component {
list: [], list: [],
loading: true, loading: true,
}); });
search.getPageService({ ...data, appId: workId }).then((response) => { search.getPageService({ ...data, appId: workId }).then((response) => {
this.setState({ this.setState({
loading: false, loading: false,
......
...@@ -24,12 +24,12 @@ export default class AffairPage extends React.Component { ...@@ -24,12 +24,12 @@ export default class AffairPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname; let pathname = this.props.location.pathname;
const { dataBaseId, workId } = this.props;
this.state = { this.state = {
showIframe: false, showIframe: false,
columns: [], columns: [],
pathname, pathname,
workId: '', workId: workId || '',
searchCondition: [], searchCondition: [],
dataBaseId: '', dataBaseId: '',
addFields: [], // 新增时填写的字段。 addFields: [], // 新增时填写的字段。
...@@ -138,14 +138,25 @@ export default class AffairPage extends React.Component { ...@@ -138,14 +138,25 @@ export default class AffairPage extends React.Component {
return false; return false;
} }
const { pathname } = this.state; const { pathname } = this.state;
service.getId(pathname).then((x)=>{ const { dataBaseId, workId } = this.props;
this.setState({ if(dataBaseId || workId){
workId: x.workId, this.setState({
dataBaseId: x.dataBaseId, workId,
},()=>{ dataBaseId,
this.getColumns(); },()=>{
}) this.getColumns();
}); });
}else{
service.getId(pathname).then((x)=>{
this.setState({
workId: x.workId,
dataBaseId: x.dataBaseId,
},()=>{
this.getColumns();
})
});
}
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event.data === 'returnList') { if (event.data === 'returnList') {
...@@ -178,6 +189,7 @@ export default class AffairPage extends React.Component { ...@@ -178,6 +189,7 @@ export default class AffairPage extends React.Component {
const { workId, dataBaseId, addFields, showIframe, renderIframe } = this.state; const { workId, dataBaseId, addFields, showIframe, renderIframe } = this.state;
const url = config.onestopPC.split('/#/'); const url = config.onestopPC.split('/#/');
let iframeUrl = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`; let iframeUrl = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
console.log(iframeUrl);
// iframeUrl = `http://localhost:8000/onestop/IFrameForApply?id=${workId}&token=${getToken()}`; // iframeUrl = `http://localhost:8000/onestop/IFrameForApply?id=${workId}&token=${getToken()}`;
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
......
...@@ -15,15 +15,16 @@ import { Link } from 'dva/router'; ...@@ -15,15 +15,16 @@ import { Link } from 'dva/router';
export default class Index extends React.Component { export default class Index extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname; let pathname = this.props.location.pathname;
this.state = { this.state = {
columns: [], columns: [],
dataList: [], dataList: [],
headerInfo: [], headerInfo: [],
workId: '', workId: this.props.workId || '',
searchCondition: [], searchCondition: [],
pathname, pathname,
dataBaseId: '', dataBaseId: this.props.dataBaseId || '',
addCondition: [], addCondition: [],
addFields: [], // 新增时填写的字段。 addFields: [], // 新增时填写的字段。
tableInfo: {}, // 表格配置属性 tableInfo: {}, // 表格配置属性
...@@ -94,14 +95,20 @@ export default class Index extends React.Component { ...@@ -94,14 +95,20 @@ export default class Index extends React.Component {
componentDidMount() { componentDidMount() {
const { pathname } = this.state; const { pathname } = this.state;
service.getId(pathname).then((x)=>{ const { workId } = this.state;
this.setState({ if(workId){
workId: x.workId, this.getColumn();
dataBaseId: x.dataBaseId, }else{
},()=>{ service.getId(pathname).then((x)=>{
this.getColumn(); this.setState({
}) workId: x.workId,
}); dataBaseId: x.dataBaseId,
},()=>{
this.getColumn();
})
});
}
} }
render() { render() {
......
import { text, number, date, format, taskNode } from '../config/index'; import { text, number, date, format, taskNode } from '../config/index';
import { isJSON } from '@/baseComponent/utils'; import { isJSON } from '@/baseComponent/utils';
import { translateAddFields } from '../config/index'; import { translateAddFields } from '../config/index';
import ColumnsRender from '@/highOrderComponent/ColumnsRender'; import config from '@/config/config';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import moment from 'moment'; import moment from 'moment';
import React from 'react'; import React from 'react';
...@@ -314,7 +314,12 @@ export function handleColumns(columns){ ...@@ -314,7 +314,12 @@ export function handleColumns(columns){
if (item.dataType) { if (item.dataType) {
if (text.indexOf(item.dataType) > -1) { // 文本类型字段 if (text.indexOf(item.dataType) > -1) { // 文本类型字段
item.render = (text) => { item.render = (text) => {
if (typeof text === 'string' && text.length > 20) { if(item.extendType === 'file' && typeof text === 'string'){
let url = text.includes('http') ? text : config.sqlFormsServer + text;
console.log(url);
return <a href={url} target={'_blank'}>点击查看</a>;
}
else if (typeof text === 'string' && text.length > 20) {
const oldTitle = text; const oldTitle = text;
const newTitle = text.slice(0, 7) + '...'; const newTitle = text.slice(0, 7) + '...';
return ( return (
...@@ -322,8 +327,14 @@ export function handleColumns(columns){ ...@@ -322,8 +327,14 @@ export function handleColumns(columns){
<span key={text}>{newTitle}</span> <span key={text}>{newTitle}</span>
</Tooltip> </Tooltip>
); );
} else if (typeof text === 'object' && Array.isArray(text.files) && text.files.length) { } else if (item.extendType === 'file' &&
return <a href={text.files[0].path} target={'_blank'}>点击查看</a>; typeof text === 'object' && Array.isArray(text.files) && text.files.length) {
let url = text.files[0].path.includes('http') ?
text.files[0].path :
config.sqlFormsServer + text.files[0].path;
return <a href={url} target={'_blank'}>
点击查看
</a>;
} else { } else {
return text; return text;
} }
......
import React from 'react' import React from 'react'
import { Button, Row, Col, message } from 'antd'; import { Button, Row, Col, message } from 'antd';
import ZdyTable from '../Table' import ZdyTable from '../Table'
import UUID from 'react-native-uuid'; import UUID from 'react-native-uuid';
import { Card, WingBlank} from 'antd-mobile'; import { Card, WingBlank } from 'antd-mobile';
export default class ChildForm extends React.Component { export default class ChildForm extends React.Component {
...@@ -142,11 +142,37 @@ export default class ChildForm extends React.Component { ...@@ -142,11 +142,37 @@ export default class ChildForm extends React.Component {
span={span} span={span}
> >
<ZdyTable formConfig={datas} key={r} fatherCode={base52} isEdit={isEdit} index={r} obj={objs[r]} fatherObj={this.props.fatherObj} init={objs} isChild={true} get="web" form={form} mapData={mapData} sqlData={sqlData} {...datas} defaultValues={defaultValues} /> <ZdyTable
formConfig={datas}
key={r}
fatherCode={base52}
isEdit={isEdit}
index={r}
obj={objs[r]}
fatherObj={this.props.fatherObj}
init={objs} isChild={true}
get="web"
form={form}
mapData={mapData}
sqlData={sqlData}
{...datas}
defaultValues={defaultValues} />
{rights.includes("delete") && isEdit ? <Button size="small" {rights.includes("delete") && isEdit ? <Button size="small"
style={{ position: "absolute", right: 10, top: '50%',transform:'translateY(-50%)' }} style={{
type='danger' onClick={this.delete.bind(this, r)}>{deleteName || "删除"}</Button> : ""} position: "absolute",
left: ' 95%',
top: '10px',
transform: 'translateY(-50%)',
borderRadius: '50%',
height: '13px',
width: '13px',
padding: 0,
lineHeight: '10px'
}}
type='danger'
onClick={this.delete.bind(this, r)}>{deleteName || "-"}
</Button> : ""}
</Col> </Col>
......
...@@ -14,18 +14,13 @@ export default class TableSelect extends React.Component { ...@@ -14,18 +14,13 @@ export default class TableSelect extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
const value = props.value || {}; const value = props.value || {};
this.state = { this.state = {
selects: value.selects||{}, selects: value.selects || {},
visiable: value.visiable , visiable: value.visiable,
isAll:value.isAll!=null?value.isAll:false, isAll: value.isAll != null ? value.isAll : false,
querys: value.querys||[], querys: value.querys || [],
sql: value.sql, sql: value.sql,
} }
} }
...@@ -33,6 +28,7 @@ export default class TableSelect extends React.Component { ...@@ -33,6 +28,7 @@ export default class TableSelect extends React.Component {
// Should provide an event to pass value to Form. // Should provide an event to pass value to Form.
const onChange = this.props.onChange; const onChange = this.props.onChange;
if (onChange) { if (onChange) {
console.log("changedValue", changedValue)
onChange(Object.assign({}, this.state, changedValue)); onChange(Object.assign({}, this.state, changedValue));
} }
} }
...@@ -40,50 +36,50 @@ export default class TableSelect extends React.Component { ...@@ -40,50 +36,50 @@ export default class TableSelect extends React.Component {
// Should be a controlled component. // Should be a controlled component.
if ('value' in nextProps) { if ('value' in nextProps) {
const value = nextProps.value; const value = nextProps.value;
if(value!=null&& value instanceof Object){ if (value != null && value instanceof Object) {
this.setState(value); this.setState(value);
} }
// //
} }
} }
remove = (rowKey) => { remove = (rowKey) => {
console.log(rowKey)
const { selects } = this.state const { selects } = this.state
delete selects[rowKey] delete selects[rowKey]
console.log(selects)
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({ selects }); this.setState({ selects });
} }
this.triggerChange({ selects}); this.triggerChange({ selects });
} }
select = (obj) => { select = (obj) => {
var { selects} = this.state var { selects } = this.state
const { json: { isMultiple ,optionType} } = this.props const { json: { isMultiple, optionType } } = this.props
let valueName = this.props.json.valueName let valueName = this.props.json.valueName
if(optionType == "reference" &&this.props.dataColumn.referenceObjId){ if (optionType == "reference" && this.props.dataColumn.referenceObjId) {
valueName=this.props.dataColumn.referenceCodeName valueName = this.props.dataColumn.referenceCodeName
} }
const kk = obj[valueName] const kk = obj[valueName]
if (kk == null) { if (kk == null) {
message.error("指定的取值字段不存在或者值为空") message.error("指定的取值字段不存在或者值为空")
return return
} }
if (!isMultiple) { if (!isMultiple) {
selects = { [kk]: {...obj,selectKey:kk} } selects = { [kk]: { ...obj, selectKey: kk } }
} else { } else {
selects[kk] = obj; selects[kk] = obj;
selects[kk].selectKey=kk selects[kk].selectKey = kk
} }
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({ selects }); this.setState({ selects });
} }
this.triggerChange({ selects}); this.triggerChange({ selects });
...@@ -96,37 +92,35 @@ export default class TableSelect extends React.Component { ...@@ -96,37 +92,35 @@ export default class TableSelect extends React.Component {
values.splice(i, 1) values.splice(i, 1)
labels.splice(i, 1) labels.splice(i, 1)
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({ values, labels}); this.setState({ values, labels });
} }
this.triggerChange({ values, labels }); this.triggerChange({ values, labels });
} }
open = () => { open = () => {
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({ visiable: true}); this.setState({ visiable: true });
} }
this.triggerChange({ visiable: true }); this.triggerChange({ visiable: true });
} }
closeModal = () => { closeModal = () => {
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({ visiable: false}); this.setState({ visiable: false });
} }
this.triggerChange({ visiable: false }); this.triggerChange({ visiable: false });
} }
render() { render() {
const { json: { isMultiple, sql, optionType, showTable }, dataColumn: { referenceObjId }, sqlModel, columns, dataSource } = this.props
const { json: { isMultiple, sql, optionType, showTable }, dataColumn: { referenceObjId }, sqlModel, columns,dataSource } = this.props let { valueName, labelName } = this.props.json
let { valueName, labelName} =this.props.json if (optionType == "reference" && referenceObjId) {
valueName = this.props.dataColumn.referenceCodeName
if(optionType == "reference" &&referenceObjId){ labelName = this.props.dataColumn.referenceNameName
valueName=this.props.dataColumn.referenceCodeName
labelName=this.props.dataColumn.referenceNameName
} }
...@@ -134,45 +128,44 @@ export default class TableSelect extends React.Component { ...@@ -134,45 +128,44 @@ export default class TableSelect extends React.Component {
if (valueName == null || valueName == "") { if (valueName == null || valueName == "") {
return <>请指定取值的列名</> return <>请指定取值的列名</>
} }
const { selects, visiable, labels} = this.state const { selects, visiable, labels } = this.state
const keys=[] const keys = []
for(let i in selects){ for (let i in selects) {
keys.push(selects[i][valueName]) keys.push(selects[i][valueName])
} }
const columns2=[...columns,{ const columns2 = [...columns, {
title:"操作", title: "操作",
render:(val,record)=><a onClick={this.remove.bind(this,record.selectKey)}>移除</a> render: (val, record) => <a onClick={this.remove.bind(this, record.selectKey)}>移除</a>
}] }]
const columns3=[...columns,{ const columns3 = [...columns, {
title:"操作", title: "操作",
render: (val, record) =>
render:(val,record)=> keys.includes(record[valueName]) ? <span>已选择</span> : <a onClick={this.select.bind(this, record)}>选择</a>
keys.includes(record[valueName])?<span>已选择</span>:<a onClick={this.select.bind(this,record)}>选择</a>
}] }]
const custom={ const custom = {
isAll:this.state.isAll, isAll: this.state.isAll,
querys: this.state.querys, querys: this.state.querys,
sql: this.state.sql, sql: this.state.sql,
} }
console.log(columns3) // console.log(columns3)
let allWidth = 0 let allWidth = 0
if(columns3) { if (columns3) {
columns3.map((item,index) => { columns3.map((item, index) => {
if(index === columns3.length-1){ if (index === columns3.length - 1) {
item.fixed = 'right' item.fixed = 'right'
item.width = 50 item.width = 50
allWidth += 50 allWidth += 50
return item return item
} }
if(index === columns3.length-2){ if (index === columns3.length - 2) {
allWidth += 150 allWidth += 150
} else { } else {
if(item.width){ if (item.width) {
allWidth += item.width allWidth += item.width
} else { } else {
item.width = 180 item.width = 180
...@@ -182,23 +175,20 @@ export default class TableSelect extends React.Component { ...@@ -182,23 +175,20 @@ export default class TableSelect extends React.Component {
return item return item
}) })
} }
console.log(selects, Object.keys(selects).length)
return ( return (
<div> <div>
{Object.keys(selects).length > 0 ?
{Object.keys(selects).length > 0 ? showTable ? <Table rowKey={valueName} size="small" dataSource={Object.values(selects)} columns={columns2} pagination={false} /> : showTable ? <Table rowKey={valueName} size="small" dataSource={Object.values(selects)} columns={columns2} pagination={false} /> :
Object.keys(selects).map((k) => <Tag key={k} closable onClose={this.remove.bind(this, k)}>{selects[k][labelName]}</Tag>)
Object.keys(selects).map((k) => <Tag key={k} closable onClose={this.remove.bind(this, k)}>{selects[k][labelName]}</Tag>)
: "" : ""
} }
<Button type="primary" onClick={this.open}>选择</Button> <Button type="primary" onClick={this.open}>选择</Button>
<Modal <Modal
width="1200px" width="60%"
maskClosable={false} maskClosable={false}
title={`请选择`} title={`请选择`}
visible={visiable} visible={visiable}
onOk={this.closeModal} onOk={this.closeModal}
...@@ -206,9 +196,10 @@ export default class TableSelect extends React.Component { ...@@ -206,9 +196,10 @@ export default class TableSelect extends React.Component {
> >
{optionType == "reference" ? referenceObjId ? {optionType == "reference" ? referenceObjId ?
<FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={referenceObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} /> : "未关联数据对象" <FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={referenceObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} />
: "未关联数据对象"
: sqlModel.dataObjId ? : sqlModel.dataObjId ?
<FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={sqlModel.dataObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} /> <FormList rights={this.props.rights || []} notShowBack={true} value={custom} objId={sqlModel.dataObjId} isFormCom={true} isSelect={true} selects={keys} valueName={valueName} callback={this.select} sql={sql} />
: <Table rowKey={valueName} size="small" dataSource={dataSource.list} columns={columns3} scroll={{ x: allWidth }} />} : <Table rowKey={valueName} size="small" dataSource={dataSource.list} columns={columns3} scroll={{ x: allWidth }} />}
</Modal> </Modal>
</div> </div>
......
...@@ -731,7 +731,7 @@ class FormList extends React.Component { ...@@ -731,7 +731,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{ required: !item.isNull }],
})(<Input readOnly={!isAdd} placeholder="请输入"/>)} })(<Input style={{ width: '70%' }} readOnly={!isAdd} placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} }
...@@ -771,7 +771,7 @@ class FormList extends React.Component { ...@@ -771,7 +771,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{ required: !item.isNull }],
})(<Input placeholder="请输入"/>)} })(<Input style={{ width: '70%' }} placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} else if (number.indexOf(item.type) > -1) { } else if (number.indexOf(item.type) > -1) {
...@@ -818,7 +818,7 @@ class FormList extends React.Component { ...@@ -818,7 +818,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{ required: !item.isNull }],
})(<Input placeholder="请输入"/>)} })(<Input style={{ width: '70%' }} placeholder="请输入"/>)}
</FormItem> </FormItem>
); );
} }
...@@ -832,11 +832,12 @@ class FormList extends React.Component { ...@@ -832,11 +832,12 @@ class FormList extends React.Component {
if (querys.length == 0) { if (querys.length == 0) {
return ''; return '';
} }
return ( return (
<Form layout="inline"> <Form layout="inline">
<Row > <Row >
{querys.map((item) => {querys.map((item) =>
<Col span={8} key={item.id}> <Col style={{height:58}} span={8} key={item.id}>
{this.getItem(true,form, { {this.getItem(true,form, {
...item, ...item,
isNull: true isNull: true
......
...@@ -8,7 +8,7 @@ import LoginWithQrCode from './LoginWithQrCode'; ...@@ -8,7 +8,7 @@ import LoginWithQrCode from './LoginWithQrCode';
* wxSocketGateWay: websocket链接地址 'ws://scjoyedu.eicp.net:51337/wswx/test106/socket/' * wxSocketGateWay: websocket链接地址 'ws://scjoyedu.eicp.net:51337/wswx/test106/socket/'
* mockServer: 获取sessionId 接口前缀 'http://scjoyedu.eicp.net:51337/test106', * mockServer: 获取sessionId 接口前缀 'http://scjoyedu.eicp.net:51337/test106',
* */ * */
export default function LoginByQrCode({ url, LoginType, wxSocketGateWay, mockServer }) { export default function LoginByQrCode({ hintStyle, url, LoginType, wxSocketGateWay, mockServer }) {
return ( return (
<div> <div>
<div style={{ backgroundColor: 'white', width: 288, padding: 10, margin: 'auto' }}> <div style={{ backgroundColor: 'white', width: 288, padding: 10, margin: 'auto' }}>
...@@ -19,7 +19,7 @@ export default function LoginByQrCode({ url, LoginType, wxSocketGateWay, mockSer ...@@ -19,7 +19,7 @@ export default function LoginByQrCode({ url, LoginType, wxSocketGateWay, mockSer
wxSocketGateWay={wxSocketGateWay} wxSocketGateWay={wxSocketGateWay}
/> />
</div> </div>
<div style={{ marginTop: 20, color: 'white' }}> <div style={{ marginTop: 20, color: 'white', ...hintStyle, }}>
请使用 请使用
<span style={{ color: 'red' }}>微信扫一扫</span> <span style={{ color: 'red' }}>微信扫一扫</span>
扫码登录 扫码登录
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论