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