提交 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,14 +155,19 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -161,14 +155,19 @@ class ListWithAddEditTemplate extends React.Component {
}; };
delete = record => { delete = record => {
ModalConfirm('确定删除?', {
onOk: () => {
const { objId } = this.props; const { objId } = this.props;
// 找出主键 // 找出主键
const { primaryKey } = this.state; const { primaryKey } = this.state;
const Keys = {}; const Keys = {};
Keys[primaryKey] = record[primaryKey]; Keys[primaryKey] = record[primaryKey];
deleteTableItem(objId, primaryKey, record[primaryKey]).then(res => { deleteTableItem(objId, primaryKey, record[primaryKey]).then(res => {
this.getPage(); this.getPage();
}); });
},
});
}; };
changeFormData = (value, key) => { changeFormData = (value, key) => {
...@@ -253,16 +252,21 @@ class ListWithAddEditTemplate extends React.Component { ...@@ -253,16 +252,21 @@ 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;
ModalConfirm('确定删除?', {
onOk: () => {
deleteTableItem(objId, primaryKey, selectedRows.map(row => row[primaryKey])).then(res => { deleteTableItem(objId, primaryKey, selectedRows.map(row => row[primaryKey])).then(res => {
this.setState({ this.setState({
selectedRows: [], selectedRows: [],
}); });
this.getPage(); this.getPage();
}); });
},
});
}; };
goBack = () => { goBack = () => {
...@@ -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,17 +45,17 @@ export default class index extends Component { ...@@ -38,17 +45,17 @@ 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){
isShow = true
type = 'xlsx'
} else if(pathName?.indexOf('.mp3') !== -1){ } else if(pathName?.indexOf('.mp3') !== -1){
isShow = true isShow = true
type = 'mp3' type = 'mp3'
...@@ -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> <>
{
isShow?
<Popconfirm
title="该附件支持预览,是否预览?"
onConfirm={this.download}
onCancel={this.showModal}
okText="下载"
cancelText="预览"
>
<a <a
target="_blank" target="_blank"
href={path}> href={path}>
{pathName} {pathName}
</a> </a>
{ </Popconfirm>
isShow? : <a
<Tooltip target="_blank"
title={`预览${pathName}`} href={path}>
> {pathName}
<Icon </a>
onClick={this.showModal}
style={{marginLeft:'12px'}}
type="security-scan" />
</Tooltip>
:null
} }
<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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论