提交 5fbdea9d authored 作者: 钟是志's avatar 钟是志

30429 系统通用功能--数据下钻/打印弹窗--均打开新页面,不要弹窗,太小了

上级 6354e6e4
......@@ -147,6 +147,9 @@ const resBinaryApiList = [
{
api: 'UnifiedAppApi/getDetail',
},
{
api: 'DataColumnApi/getHeaderList',
},
{
api: 'UnifiedServiceApi/getDetail',
},
......
......@@ -24,24 +24,19 @@ const apiUrl = queryOauthActionPath();
* 返回值
* rowSpanData 列合并数据,colSpanData行合并数据
* */
export function getSpanJson({
mergeKey,
data,
eliminateRow = [],
eliminateCol = []
}) {
export function getSpanJson({ mergeKey, data, eliminateRow = [], eliminateCol = [] }) {
const dataList = deepCopy(data);
let rowSpanData, colSpanData = null;
let rowSpanData,
colSpanData = null;
try {
rowSpanData = getRowSpanJson(mergeKey, dataList, eliminateRow);
} catch (err) {
console.table("rowSpanData", err);
console.table('rowSpanData', err);
}
try {
colSpanData = getColSpanJson(mergeKey, dataList, eliminateCol);
} catch (err) {
console.table("colSpanData", err);
console.table('colSpanData', err);
}
return {
rowSpanData,
......@@ -191,7 +186,7 @@ export function getColumns(columns) {
}
return res;
} catch (e) {
console.table("getColumnsData", e);
console.table('getColumnsData', e);
return false;
}
}
......@@ -216,7 +211,6 @@ export function getColumns(columns) {
return maxLevel;
}
//递归当前数据宽度
function getColumnsWidth(data = [], sum = 0) {
for (let item of data) {
......@@ -229,18 +223,12 @@ export function getColumns(columns) {
return sum;
}
let columnsHandle = getColumnsData(columns)
.filter((v, i) => {
let columnsHandle = getColumnsData(columns).filter((v, i) => {
return (v.level < columnsHeight && v.isLast) || v.width > 1;
});
let columnsMerges = [];
columnsHandle.forEach((v, i) => {
let {
isLast,
width,
col,
level
} = v;
let { isLast, width, col, level } = v;
let nowCol = col - 1;
let nowLevel = level - 1;
if (isLast && width === 1) {
......@@ -276,15 +264,11 @@ export function getColumnsSqlKeyRealize({
styles,
fileName = '导出文件',
ext = 'xlsx',
allValues = JSON.stringify({})
allValues = JSON.stringify({}),
}) {
columns = deepCopy(columns);
let {
columnsList,
columnsMerges,
columnsKey
} = getColumns(columns);
let { columnsList, columnsMerges, columnsKey } = getColumns(columns);
let content = {
sheets: [
......@@ -328,7 +312,7 @@ export function getColumnsSqlKeyRealize({
{
content: JSON.stringify(content),
title: fileName,
allValues: allValues
allValues: allValues,
},
`${apiUrl + '/DataObjApi/exportCustom'}`,
);
......@@ -343,7 +327,7 @@ export function getColumnsSqlKeyRealize({
ext,
);
} catch (err) {
console.table("getColumnsSqlKeyRealize", err);
console.table('getColumnsSqlKeyRealize', err);
}
}
......@@ -407,9 +391,8 @@ export function getColumnsDataRealize({
ext,
);
} catch (err) {
console.table("getColumnsDataRealize", err);
console.table('getColumnsDataRealize', err);
}
}
/**
......@@ -440,20 +423,12 @@ export function getColumnsData({
}) {
columns = deepCopy(columns);
data = deepCopy(data);
let {
columnsList,
columnsMerges,
columnsKey,
columnsHeight
} = getColumns(columns);
let {
colSpanData,
rowSpanData
} = getSpanJson({
let { columnsList, columnsMerges, columnsKey, columnsHeight } = getColumns(columns);
let { colSpanData, rowSpanData } = getSpanJson({
mergeKey,
data,
eliminateRow,
eliminateCol
eliminateCol,
});
// 处理数据
let bodyData = [];
......@@ -492,7 +467,7 @@ export function getColumnsData({
});
});
} catch (err) {
console.table("getColumnsDataRealize", err);
console.table('getColumnsDataRealize', err);
}
let content = {
sheets: [
......@@ -529,58 +504,65 @@ export function getColumnsData({
if (styles) {
content.styles = styles;
}
return content
return content;
}
// ant列表组件合并表格 render属性,合并纵向、横向。
export function renderContentAll(value, row, index, key, spanData, cloumnNames = []) {
let colSpan,
rowSpan = null;
try {
colSpan = spanData.colSpanData[key][index];// 横向合并
rowSpan = spanData.rowSpanData[key][index];// 纵向合并
colSpan = spanData.colSpanData[key][index]; // 横向合并
rowSpan = spanData.rowSpanData[key][index]; // 纵向合并
} catch (err) {
console.table("renderContentAll", err);
console.table('renderContentAll', err);
}
const obj = {
children: value,
props: {
rowSpan: rowSpan,
colSpan: colSpan
}
colSpan: colSpan,
},
};
return obj;
}
// ant列表组件合并表格 render属性,合并纵向。 meanwhileKey :key 是本身字段key,value 是同步的字段key
export function renderContentRow(value, row, index, key, spanData, cloumnNames = [], meanwhileKey = {}) {
export function renderContentRow(
value,
row,
index,
key,
spanData,
cloumnNames = [],
meanwhileKey = {},
) {
let colSpan,
rowSpan = null;
try {
if (cloumnNames.indexOf(key) !== -1) {
rowSpan = spanData.rowSpanData[key][index];// 纵向合并
rowSpan = spanData.rowSpanData[key][index]; // 纵向合并
} else {
if (key in meanwhileKey && meanwhileKey[key]) {
let meanwhileKeyValue = meanwhileKey[key];
rowSpan = spanData.rowSpanData[meanwhileKeyValue][index];// 同步字段 的纵向合并
rowSpan = spanData.rowSpanData[meanwhileKeyValue][index]; // 同步字段 的纵向合并
} else {
rowSpan = 1;
}
}
} catch (err) {
console.table("renderContentRow", err);
console.table('renderContentRow', err);
}
const obj = {
children: value,
props: {
rowSpan: rowSpan,
colSpan: 1
}
colSpan: 1,
},
};
return obj;
}
/**
* 表头和数据导出(合并表格)
* templatePath : word文档模板地址
......@@ -625,10 +607,8 @@ export function getWord({
} catch (err) {
console.table(err);
}
}
/**
* 表头和数据导出(合并表格)
* templatePath : word文档模板地址
......@@ -673,10 +653,8 @@ export function getFileAndShow({
} catch (err) {
console.table(err);
}
}
/**
* 表头和数据导出(合并表格)
* templatePath : word文档模板地址
......@@ -697,7 +675,7 @@ export function getListWord({
listConfig = {},
ext = 'zip',
sonExt = 'pdf',
filesKey = []
filesKey = [],
}) {
try {
let content = [];
......@@ -707,10 +685,8 @@ export function getListWord({
for (var ki in filesKey) {
let files_ = v[filesKey[ki]];
try {
files = [...files, ...JSON.parse(files_).files]
} catch (e) {
}
files = [...files, ...JSON.parse(files_).files];
} catch (e) {}
delete paramsObj[filesKey[ki]];
}
content.push({
......@@ -719,10 +695,10 @@ export function getListWord({
...listConfig,
},
allValues: {
...getObjectsKey(allValuesKey, paramsObj)
...getObjectsKey(allValuesKey, paramsObj),
},
title: (paramsObj[sonTitleKey] || "未设置名称") + `.${sonExt}`,
files: JSON.stringify(files)
title: (paramsObj[sonTitleKey] || '未设置名称') + `.${sonExt}`,
files: JSON.stringify(files),
});
});
let getFileData = giveFilePostDataInfoForTrue(
......@@ -747,31 +723,25 @@ export function getListWord({
} catch (err) {
console.table(err);
}
function getObjectsKey(listKey = [], params = {}) {
return (
listKey
.filter((key) => Object.keys(params).indexOf(key))
.reduce(
return listKey.filter((key) => Object.keys(params).indexOf(key)).reduce(
(acc, key) => ({
...acc,
[key]: params[key] === null ? '' : params[key],
}),
{},
)
)
);
}
}
function setObjectKey(data) {
return (
Object.keys(data)
.reduce(
return Object.keys(data).reduce(
(acc, key) => ({
...acc,
['${' + key + '}']: data[key] === null ? '' : data[key],
}),
{},
)
);
}
......@@ -779,17 +749,21 @@ function setObjectKey(data) {
* 修改对象key
* 支持对象、数组对象
* @param {*} obj 数组对象或者对象
* @param {*} setKey {"被修改的key":"修改后的key"}
* @param {*} setKey {'被修改的key":"修改后的key'}
* @returns
*/
export function upObjKey(obj, setKey = {}, defaultValue = "") {
export function upObjKey(obj, setKey = {}, defaultValue = '') {
try {
obj = deepCopy(obj);
setKey = deepCopy(setKey);
let objType = Object.prototype.toString.call(obj);
if (obj && (objType.indexOf("Array") > -1 || objType.indexOf("Object") > -1) && Object.keys(setKey).length > 0) {
if (
obj &&
(objType.indexOf('Array') > -1 || objType.indexOf('Object') > -1) &&
Object.keys(setKey).length > 0
) {
let nowObj = null;
if (objType === "[object Object]" && !Array.isArray(obj) && Object.keys(obj).length > 0) {
if (objType === '[object Object]' && !Array.isArray(obj) && Object.keys(obj).length > 0) {
nowObj = deepCopy(obj);
for (var e in setKey) {
let upKey = setKey[e];
......@@ -797,15 +771,20 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") {
nowObj = {
...nowObj,
...getSetKeyJson({
obj, e, newKey, type, timeFormat, defaultValue
})
obj,
e,
newKey,
type,
timeFormat,
defaultValue,
}),
};
if (e != newKey) {
delete nowObj[e];
}
}
}
if (objType === "[object Array]" && Array.isArray(obj) && obj.length > 0) {
if (objType === '[object Array]' && Array.isArray(obj) && obj.length > 0) {
nowObj = new Array();
obj.forEach((v, i, arr) => {
let newJson = deepCopy(v);
......@@ -815,22 +794,27 @@ export function upObjKey(obj, setKey = {}, defaultValue = "") {
newJson = {
...newJson,
...getSetKeyJson({
obj: v, e, newKey, type, timeFormat, defaultValue
})
obj: v,
e,
newKey,
type,
timeFormat,
defaultValue,
}),
};
if (e != newKey) {
delete newJson[e];
}
}
nowObj.push(newJson);
})
});
}
return nowObj;
} else {
return null;
}
} catch (error) {
console.log("upObjKey", error);
console.log('upObjKey', error);
return undefined;
}
}
......@@ -839,36 +823,35 @@ function getSetKeyValue(value) {
let valeuType = Object.prototype.toString.call(value);
let newName = null;
let extendJson = {
"type": "string"
type: 'string',
};
if (valeuType === "[object String]") {
if (valeuType === '[object String]') {
newName = value;
}
if (valeuType === "[object Object]") {
newName = value["new"];
delete value["new"];
if (valeuType === '[object Object]') {
newName = value['new'];
delete value['new'];
extendJson = {
...extendJson,
...value
...value,
};
}
return {
newKey: newName,
...extendJson
}
...extendJson,
};
}
function getSetKeyJson({
obj, e, newKey, type, timeFormat = "YYYY-MM-DD HH:mm:ss", defaultValue
}) {
function getSetKeyJson({ obj, e, newKey, type, timeFormat = 'YYYY-MM-DD HH:mm:ss', defaultValue }) {
obj = deepCopy(obj);
let value = obj[e];
let newKeyObj = {};
// delete obj[e];
switch (type) {
case "time":
debugger
newKeyObj[newKey] = (timeFormat && value ? moment(value).format(timeFormat) : value) || defaultValue;
case 'time':
debugger;
newKeyObj[newKey] =
(timeFormat && value ? moment(value).format(timeFormat) : value) || defaultValue;
break;
default:
newKeyObj[newKey] = value || defaultValue;
......@@ -876,7 +859,6 @@ function getSetKeyJson({
return newKeyObj;
}
// 下载附件FormdataWrapper
function isObject(value) {
return value === Object(value);
......@@ -896,13 +878,12 @@ function makeArrayKey(key) {
function FormdataWrapper(obj, fd, pre) {
fd = fd || new FormData();
Object.keys(obj)
.forEach(function (prop) {
Object.keys(obj).forEach(function(prop) {
var key = pre ? pre + '[' + prop + ']' : prop;
if (isObject(obj[prop]) && !isArray(obj[prop]) && !isFile(obj[prop])) {
FormdataWrapper(obj[prop], fd, key);
} else if (isArray(obj[prop])) {
obj[prop].forEach(function (value) {
obj[prop].forEach(function(value) {
var arrayKey = makeArrayKey(key);
if (isObject(value) && !isFile(value)) {
FormdataWrapper(value, fd, arrayKey);
......@@ -960,7 +941,6 @@ export async function downloadFile(url, params, fileName = '导出文件', ext =
});
}
export async function downloadFileAndShowModal(url, params, fileName = '导出文件', ext = 'xlsx') {
// console.log("downloadFile",url);
const { transformApi, headersApi } = await getTransformApi(url);
......@@ -991,20 +971,26 @@ export async function downloadFileAndShowModal(url, params, fileName = '导出
https://view.officeapps.live.com/op/view.aspx?src=
https%3A%2F%2Fwww.longchang.gov.cn%2Flcs%2Fgsgg%2F202207%2F3ae45ccac65d40d885f40ec385ae287a%2Ffiles%2F%25E9%259A%2586%25E6%2598%258C%25E5%25B8%2582%25E7%25AC%25AC%25E5%2585%25AB%25E4%25B8%25AD%25E5%25AD%25A6%25E5%258E%2595%25E6%2589%2580%25E6%2594%25B9%25E9%2580%25A0%25E9%25A1%25B9%25E7%259B%25AE%25E5%2585%25AC%25E5%2591%258A.doc&wdOrigin=BROWSELINK
* */
window.open(url);
return;
Modal.info({
title: filename,
width: 1000,
content: <div>
<embed width='100%'
height='568px'
name='plugin'
id='pdfView'
content: (
<div>
<embed
width="100%"
height="568px"
name="plugin"
id="pdfView"
src={url}
type='application/pdf'
internalinstanceid='3'
title={filename} />
</div>,
type="application/pdf"
internalinstanceid="3"
title={filename}
/>
</div>
),
okText: '确定',
onCancel: () => {
window.URL.revokeObjectURL(url);
......
......@@ -1456,6 +1456,7 @@ class FormList extends React.Component {
onSelectRow={this.handleSelectRows}
onChange={this.handleStandardTableChange}
loading={loading}
getCheckboxProps={this.props.getCheckboxProps || undefined}
/>
)}
</div>
......
import React, { } from 'react';
import React from 'react';
import { Button } from 'antd';
import { getModal } from '@/webPublic/one_stop_public/utils/utils';
import styles from './style.less'
const Modal = getModal();
export default class FormModal extends React.Component {
render() {
const showFullScreen = () => {
let dom = document.getElementById('smartFormModal');
dom.requestFullscreen();
console.log(dom);
};
return (
<Modal
bodyStyle={{
......@@ -19,7 +27,14 @@ export default class FormModal extends React.Component {
visible={this.props.visible}
footer={null}
onCancel={this.props.handleCancel}>
{this.props.showFullScreen && (
<Button type={'primary'} onClick={showFullScreen}>
全屏查看
</Button>
)}
<div id={'smartFormModal'} className={styles.fullScreen}>
{this.props.children}
</div>
</Modal>
);
}
......
.fullScreen {
&:-webkit-full-screen {
width: 100%;
height: 100%;
padding: 100px;
background-color: #fff;
}
//&:div[data-page-formkey]{
// overflow: hidden;
//}
}
:global {
// table{
// border-collapse:collapse;
// }
#web_table .ant-form-item {
margin-bottom: 2.5px;
margin-top: 2.5px;
......@@ -290,7 +305,8 @@
min-height: 50px;
}
}
.bigTitle{
.bigTitle {
text-align: center;
font-size: 18px;
margin-bottom: 20px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论