提交 65f44527 authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

import React from 'react';
import Entrance from '@/webPublic/one_stop_public/Entrance';
import Shell from '@/baseComponent/Shell';
import SubmitButton from '@/webPublic/one_stop_public/AffairButton/SumbitButton';
export default function ApplyPage({ id, form }) {
return (
<Shell styleShell={{ marginTop: 0 }}>
<Entrance id={id} get="web" form={form} />
<div style={{ padding: 16, textAlign: 'center' }}>
<SubmitButton
form={form}
appId={id}
text="提交"
openDraftButton
DraftButtonText="暂存"
/>
</div>
</Shell>
);
}
...@@ -18,6 +18,7 @@ import { ...@@ -18,6 +18,7 @@ import {
addOrEditTableItem, addOrEditTableItem,
deleteTableItem, deleteTableItem,
} from '@/webPublic/Services'; } from '@/webPublic/Services';
import { ModalConfirm } from '@/baseComponent/Modal';
const getValue = obj => const getValue = obj =>
Object.keys(obj) Object.keys(obj)
...@@ -111,14 +112,7 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -111,14 +112,7 @@ class ListWithAddEditTemplate extends React.Component {
<div> <div>
<a onClick={this.modify.bind(this, record)}>编辑</a> <a onClick={this.modify.bind(this, record)}>编辑</a>
<Divider type="vertical" /> <Divider type="vertical" />
<Popconfirm <a onClick={this.delete.bind(this, record)}>删除</a>
title="确定删除该数据?"
onConfirm={this.delete.bind(this, record)}
okText="确定"
cancelText="取消"
>
<a>删除</a>
</Popconfirm>
</div> </div>
</Fragment> </Fragment>
); );
...@@ -161,13 +155,18 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -161,13 +155,18 @@ class ListWithAddEditTemplate extends React.Component {
}; };
delete = record => { delete = record => {
const { objId } = this.props; ModalConfirm('确定删除?', {
// 找出主键 onOk: () => {
const { primaryKey } = this.state; const { objId } = this.props;
const Keys = {}; // 找出主键
Keys[primaryKey] = record[primaryKey]; const { primaryKey } = this.state;
deleteTableItem(objId, primaryKey, record[primaryKey]).then(res => { const Keys = {};
this.getPage();
Keys[primaryKey] = record[primaryKey];
deleteTableItem(objId, primaryKey, record[primaryKey]).then(res => {
this.getPage();
});
},
}); });
}; };
...@@ -253,15 +252,20 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -253,15 +252,20 @@ class ListWithAddEditTemplate extends React.Component {
}; };
batchDelete = e => { batchDelete = e => {
const { selectedRows, objId, primaryKey } = this.state; const { selectedRows, primaryKey } = this.state;
const { objId } = this.props;
if (!selectedRows) return; if (!selectedRows) return;
deleteTableItem(objId, primaryKey, selectedRows.map(row => row[primaryKey])).then(res => { ModalConfirm('确定删除?', {
this.setState({ onOk: () => {
selectedRows: [], deleteTableItem(objId, primaryKey, selectedRows.map(row => row[primaryKey])).then(res => {
}); this.setState({
this.getPage(); selectedRows: [],
});
this.getPage();
});
},
}); });
}; };
...@@ -328,7 +332,7 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -328,7 +332,7 @@ class ListWithAddEditTemplate extends React.Component {
config={{ condition: searchConfig, fromTab: true }} config={{ condition: searchConfig, fromTab: true }}
/> />
) : null} ) : null}
<Shell styleShell={{marginTop: searchConfig && searchConfig.length ? 16 : 0 }}> <Shell styleShell={{ marginTop: searchConfig && searchConfig.length ? 16 : 0 }}>
<div style={{ paddingLeft: '10px', marginTop: '20px' }}> <div style={{ paddingLeft: '10px', marginTop: '20px' }}>
<ButtonDiy icon="plus" className="primaryBlue" handleClick={this.add} name="新建" /> <ButtonDiy icon="plus" className="primaryBlue" handleClick={this.add} name="新建" />
{hasImport && <ImportUtil objId={objId} />} {hasImport && <ImportUtil objId={objId} />}
...@@ -342,7 +346,7 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -342,7 +346,7 @@ class ListWithAddEditTemplate extends React.Component {
selectedRows={selectedRows} selectedRows={selectedRows}
onSelectRow={this.handleSelectRows} onSelectRow={this.handleSelectRows}
onChange={this.handleStandardTableChange} onChange={this.handleStandardTableChange}
scroll={{x: 1200}} scroll={{ x: 1200 }}
/> />
</Shell> </Shell>
</Fragment> </Fragment>
......
...@@ -55,7 +55,7 @@ export const fetchTableHeader = objId => ...@@ -55,7 +55,7 @@ export const fetchTableHeader = objId =>
* @param {String} value 主键对应的值,删除多条数据时传数组 * @param {String} value 主键对应的值,删除多条数据时传数组
*/ */
export const deleteTableItem = (objId, primaryKey, value) => { export const deleteTableItem = (objId, primaryKey, value) => {
const copyValue = Array.isArray[value] ? value.join(',') : value; const copyValue = Array.isArray(value) ? value.join(',') : value;
return uaaRequest('/DataObjApi/deleteFormData', { return uaaRequest('/DataObjApi/deleteFormData', {
objId, objId,
keys: JSON.stringify({ [primaryKey]: copyValue }), keys: JSON.stringify({ [primaryKey]: copyValue }),
......
...@@ -86,7 +86,7 @@ export default class idnex extends Component { ...@@ -86,7 +86,7 @@ export default class idnex extends Component {
}) })
} }
handleDraft = () => { handleDraft = () => {
let {dispatch, id, radioValue} = this.props; let {dispatch, id, radioValue,draftCallback} = this.props;
this.setState({ this.setState({
isLoading:true isLoading:true
},() => { },() => {
...@@ -105,6 +105,9 @@ export default class idnex extends Component { ...@@ -105,6 +105,9 @@ export default class idnex extends Component {
this.setState({ // 存在草稿后保存草稿Id 后续修改在这草稿Id上处理 this.setState({ // 存在草稿后保存草稿Id 后续修改在这草稿Id上处理
draftId: val.id draftId: val.id
}) })
if(this.props?.draftCallback){
this.props.draftCallback(val)
}
openToast('success', '保存成功', '草稿保存成功'); openToast('success', '保存成功', '草稿保存成功');
} else { } else {
openToast('error', '保存失败', '请尝试'); openToast('error', '保存失败', '请尝试');
......
...@@ -16,6 +16,8 @@ import SumbitButton from '@/webPublic/one_stop_public/AffairButton/SumbitButton' ...@@ -16,6 +16,8 @@ import SumbitButton from '@/webPublic/one_stop_public/AffairButton/SumbitButton'
draftId = {'草稿Id'} // 可不传 不传为发起全新 传后修改草稿 draftId = {'草稿Id'} // 可不传 不传为发起全新 传后修改草稿
openDraftButton = {true} // 开启保存草稿按钮 openDraftButton = {true} // 开启保存草稿按钮
DraftButtonText = '草稿按钮文本' // 草稿按钮内置文本 DraftButtonText = '草稿按钮文本' // 草稿按钮内置文本
callback = '提交按钮回调函数' // 提交按钮回调函数
draftCallback = {'草稿按钮回调函数'} // 草稿按钮回调函数
/> />
``` ```
......
...@@ -131,20 +131,12 @@ export default class index extends Component { ...@@ -131,20 +131,12 @@ export default class index extends Component {
*/ */
getListData = (List) => { getListData = (List) => {
const { checkedFuc } = this.state const { checkedFuc } = this.state
switch (List.length) { let ary = []
case 1: List.map(item => {
return checkedFuc(List[0].value) ary.push(item.value)
case 2: return item
return checkedFuc(List[0].value,List[1].value) })
case 3: return checkedFuc(...ary)
return checkedFuc(List[0].value,List[1].value,List[2].value)
case 4:
return checkedFuc(List[0].value,List[1].value,List[2].value,List[3].value)
case 5:
return checkedFuc(List[0].value,List[1].value,List[2].value,List[3].value,List[4].value)
case 6:
return checkedFuc(List[0].value,List[1].value,List[2].value,List[3].value,List[4].value,List[5].value)
}
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
const { isPicth } = nextProps const { isPicth } = nextProps
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* web端文件预览功能 * web端文件预览功能
*/ */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Modal,Icon,Tooltip } from 'antd'; import { Modal,Icon,Tooltip,Popconfirm } from 'antd';
// import FileViewer from 'react-file-viewer'; // import FileViewer from 'react-file-viewer';
export default class index extends Component { export default class index extends Component {
constructor(props){ constructor(props){
...@@ -28,6 +28,13 @@ export default class index extends Component { ...@@ -28,6 +28,13 @@ export default class index extends Component {
visible: false, visible: false,
}); });
}; };
download = () => {
let {
path,
pathName
} = this.props
window.open(path,'_blank')
}
render() { render() {
let { let {
path, path,
...@@ -38,18 +45,18 @@ export default class index extends Component { ...@@ -38,18 +45,18 @@ export default class index extends Component {
} = this.state } = this.state
let isShow = pathName?.indexOf('.pdf') !== -1 let isShow = pathName?.indexOf('.pdf') !== -1
// || pathName?.indexOf('.doc') !== -1 // || pathName?.indexOf('.doc') !== -1
|| pathName?.indexOf('.xls') !== -1
|| pathName?.indexOf('.mp3') !== -1 || pathName?.indexOf('.mp3') !== -1
|| pathName?.indexOf('.mp4') !== -1 || pathName?.indexOf('.mp4') !== -1
|| pathName?.indexOf('.csv') !== -1 || pathName?.indexOf('.csv') !== -1
|| pathName?.indexOf('.png') !== -1
|| pathName?.indexOf('.jpeg') !== -1
|| pathName?.indexOf('.gif') !== -1
|| pathName?.indexOf('.bmp') !== -1
let type; let type;
if(pathName?.indexOf('.pdf') !== -1){ if(pathName?.indexOf('.pdf') !== -1){
isShow = true isShow = true
type = 'pdf' type = 'pdf'
} else if(pathName?.indexOf('.xlsx') !== -1){ } else if(pathName?.indexOf('.mp3') !== -1){
isShow = true
type = 'xlsx'
} else if(pathName?.indexOf('.mp3') !== -1){
isShow = true isShow = true
type = 'mp3' type = 'mp3'
} else if(pathName?.indexOf('.mp4') !== -1){ } else if(pathName?.indexOf('.mp4') !== -1){
...@@ -58,38 +65,52 @@ export default class index extends Component { ...@@ -58,38 +65,52 @@ export default class index extends Component {
} else if(pathName?.indexOf('.csv') !== -1){ } else if(pathName?.indexOf('.csv') !== -1){
isShow = true isShow = true
type = 'csv' type = 'csv'
} else if(pathName?.indexOf('.png') !== -1){
isShow = true
type = 'png'
} else if(pathName?.indexOf('.gif') !== -1){
isShow = true
type = 'gif'
} else if(pathName?.indexOf('.bmp') !== -1){
isShow = true
type = 'bmp'
} else { } else {
isShow = false isShow = false
} }
return ( return (
<span> <>
<a {
target="_blank" isShow?
href={path}> <Popconfirm
{pathName} title="该附件支持预览,是否预览?"
</a> onConfirm={this.download}
{ onCancel={this.showModal}
isShow? okText="下载"
<Tooltip cancelText="预览"
title={`预览${pathName}`} >
> <a
<Icon target="_blank"
onClick={this.showModal} href={path}>
style={{marginLeft:'12px'}} {pathName}
type="security-scan" /> </a>
</Tooltip> </Popconfirm>
:null : <a
} target="_blank"
href={path}>
{pathName}
</a>
}
<Modal <Modal
title={pathName} title={pathName}
visible={visible} visible={visible}
width={1200} width={1200}
destroyOnClose
onOk={this.handleOk} onOk={this.handleOk}
onCancel={this.handleCancel} onCancel={this.handleCancel}
> >
{ {
type === 'pdf'||type==='ppt'? type === 'pdf'?
<iframe <iframe
style={{ style={{
width:'100%', width:'100%',
...@@ -113,7 +134,7 @@ export default class index extends Component { ...@@ -113,7 +134,7 @@ export default class index extends Component {
} }
</Modal> </Modal>
</span> </>
) )
} }
} }
...@@ -1766,6 +1766,12 @@ export default class tableCom extends Component { ...@@ -1766,6 +1766,12 @@ export default class tableCom extends Component {
if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) { if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
return <img key={index2} style={{ width: 100, height: 100 }} src={queryApiActionPath() + f.filePath} /> return <img key={index2} style={{ width: 100, height: 100 }} src={queryApiActionPath() + f.filePath} />
} }
// if(get === 'web'){
// return <li key={index2}><FilePreview
// path={queryApiActionPath() + f.path}
// pathName={f.name}
// /></li>
// }
return <li key={index2}><a target="_blank" key={f.filePath} href={queryApiActionPath() + f.filePath}> return <li key={index2}><a target="_blank" key={f.filePath} href={queryApiActionPath() + f.filePath}>
{f.fileName} {f.fileName}
</a></li> </a></li>
......
...@@ -20,6 +20,7 @@ react-native-uuid ...@@ -20,6 +20,7 @@ react-native-uuid
path-to-regexp path-to-regexp
prop-types prop-types
react-signature-canvas react-signature-canvas
react-file-viewer
``` ```
##抽离注意 ##抽离注意
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论