|
@@ -4,7 +4,7 @@ import type {FormInstance} from 'antd'
|
|
|
import {Table, Upload} from 'antd'
|
|
|
import { SDPage,SDFormText,SDModalForm,SDTable,SDFormItem,SDButton,SDSubmitButton,EditType, SDAreaTtile, SDOperate, baseFun,SDModal, validateFun, SDEditableTable, SDFormDict, SDLayout, SDFormAttach, } from "@sundata/ui-frame";
|
|
|
import type { ReportDefinitionModel,ReportCalculationModel } from "@/services/rwa/product/report_form_config_reportcreater/reportfillingconfig";
|
|
|
-import {getDataList,createReportData,updateReportData,deleteReportData,selectReportData,updateCalcReportData,isNotExist,
|
|
|
+import {getDataList,createReportData,updateReportData,deleteReportData,selectReportData,updateCalcReportData,isNotExist,selectCalcProcessType,
|
|
|
analyseReportFile,createCalcReportData,selectCalcReportData} from "@/services/rwa/product/report_form_config_reportcreater/reportfillingconfig";
|
|
|
import { PlusSquareTwoTone, WomanOutlined } from "@ant-design/icons";
|
|
|
import { ProductProps } from "@/sundataImport";
|
|
@@ -25,6 +25,9 @@ const reportfillingconfig : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
/** 是否显示详细信息窗口 */
|
|
|
const [detailVisible, setDetailVisible] = useState<boolean>(false);
|
|
|
|
|
|
+ /** 点保存时校验是否解析文件 */
|
|
|
+ const [analysis, setAnalysis] = useState<boolean>(false);
|
|
|
+
|
|
|
const [currentRow, setCurrentRow] = useState<ReportDefinitionModel>();
|
|
|
/** 表格引用对象,刷新表格使用 */
|
|
|
const actionRef = useRef<ActionType>();
|
|
@@ -50,17 +53,30 @@ const reportfillingconfig : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
/** 需要被覆盖数据的序号 */
|
|
|
const [coverId, setCoverId] = useState<string>('');
|
|
|
|
|
|
+ /** 初始化字典(计算过程类型)显示用 */
|
|
|
+ const [dictionArray,setDictionArray] = useState<any[]>();
|
|
|
+ /** 初始化字典(计算过程类型) */
|
|
|
+ const [dictionAllArray,setDictionAllArray] = useState<any[]>();
|
|
|
+ /** 固定行列报表下的字典(计算过程类型) */
|
|
|
+ var fixedDictionArray = new Array<any>;
|
|
|
+ /** 动态行列报表下的字典(计算过程类型) */
|
|
|
+ var dynamicDictionArray = new Array<any>;
|
|
|
+
|
|
|
/** 序号值 */
|
|
|
var reptId = 0;
|
|
|
|
|
|
// 页面数据
|
|
|
var formDataList = new Array<ReportDefinitionModel>;
|
|
|
+
|
|
|
/**上传文件 */
|
|
|
const [fileData, setFileData] = useState<File>();
|
|
|
// 导入窗口显示
|
|
|
const [importVisible, setImportVisible] = useState<boolean>(false);
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ selectCalcProcessType().then((data)=>{
|
|
|
+ setDictionArray(data);
|
|
|
+ });
|
|
|
}, []);
|
|
|
|
|
|
// 修改查询查询
|
|
@@ -78,6 +94,18 @@ const reportfillingconfig : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**上传属性 */
|
|
|
+ const fileProps = {
|
|
|
+ onRemove: () => {
|
|
|
+ setFileData(undefined);
|
|
|
+ },
|
|
|
+ beforeUpload(info: any) {
|
|
|
+ setFileData(info);
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
// 删除
|
|
|
const delRows =async(record:any)=>{
|
|
|
baseFun.confirm('确认删除?',async() =>{
|
|
@@ -95,6 +123,11 @@ const reportfillingconfig : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
|
|
|
// 插入或者更新数据
|
|
|
const handleSave = async(data: ReportDefinitionModel) => {
|
|
|
+
|
|
|
+ if (analysis == false) {
|
|
|
+ baseFun.error('没有解析文件');
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
if (editType == 'update' ) {
|
|
|
let keys ='';
|
|
@@ -232,101 +265,169 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
dataIndex: 'calcindex',
|
|
|
search: false,
|
|
|
hideInTable: true,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true
|
|
|
},
|
|
|
{
|
|
|
title: '起始数据日期',
|
|
|
dataIndex: 'startDate',
|
|
|
search: false,
|
|
|
hideInTable: true,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true
|
|
|
},
|
|
|
{
|
|
|
title: '截止数据日期',
|
|
|
dataIndex: 'endDate',
|
|
|
search: false,
|
|
|
hideInTable: true,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true
|
|
|
},
|
|
|
{
|
|
|
title: '序号',
|
|
|
dataIndex: 'id',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
- editable:false
|
|
|
+ editable:false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true
|
|
|
},
|
|
|
{
|
|
|
title: '所在sheet页位置',
|
|
|
dataIndex: 'reportUnitSheet',
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '所在行位置',
|
|
|
dataIndex: 'reportUnitRow',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '所在列位置',
|
|
|
dataIndex: 'reportUnitCell',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '单元格样式类型',
|
|
|
dataIndex: 'unitStyleType',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
valueType: 'treeSelect',
|
|
|
- request: () => fetchDict('customerTypeCd'),
|
|
|
- fieldProps: {
|
|
|
- treeDefaultExpandAll: true,
|
|
|
- treeCheckable:true,
|
|
|
- },
|
|
|
+ request: () => fetchDict('CELL_STYLE_TYPE'),
|
|
|
+ fieldProps: {
|
|
|
+ treeDefaultExpandAll: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: '单元格数据类型',
|
|
|
dataIndex: 'unitDataType',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
valueType: 'treeSelect',
|
|
|
- request: () => fetchDict('customerTypeCd'),
|
|
|
- fieldProps: {
|
|
|
- treeDefaultExpandAll: true,
|
|
|
- treeCheckable:true,
|
|
|
- },
|
|
|
+ request: () => fetchDict('CELL_DATA_TYPE'),
|
|
|
+ fieldProps: {
|
|
|
+ treeDefaultExpandAll: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: '计算过程类型',
|
|
|
dataIndex: 'unitCalcType',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
+ valueType: 'treeSelect',
|
|
|
+ // request: () => fetchDict('CALC_PROCESS_TYPE'),
|
|
|
+ fieldProps: {
|
|
|
+ options: dictionArray,
|
|
|
+ treeDefaultExpandAll: true,
|
|
|
+ },
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: '计算对象名称',
|
|
|
dataIndex: 'unitCalcObjectName',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {max:100},
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '计算对象配置',
|
|
|
dataIndex: 'unitCalcInfo',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '是否包含下钻功能',
|
|
|
dataIndex: 'isHasurl',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
valueType: 'treeSelect',
|
|
|
- request: () => fetchDict('YESORNO'),
|
|
|
- fieldProps: {
|
|
|
- treeDefaultExpandAll: true,
|
|
|
- },
|
|
|
+ request: () => fetchDict('YESORNO'),
|
|
|
+ fieldProps: {
|
|
|
+ treeDefaultExpandAll: true,
|
|
|
+ },
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
{
|
|
|
title: '操作',
|
|
|
dataIndex: 'operate',
|
|
|
valueType: 'option',
|
|
|
+ width:150,
|
|
|
+ ellipsis:true,
|
|
|
render: (_, record) => [
|
|
|
<SDOperate
|
|
|
key="roleCfg"
|
|
@@ -344,9 +445,6 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
|
|
|
];
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
// 需计算的单元详情页面展示元素
|
|
|
const reportCalculateOtherColumns: ProColumns<ReportCalculationModel>[] = [
|
|
|
{
|
|
@@ -360,35 +458,55 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
title: '所在sheet页位置',
|
|
|
dataIndex: 'reportUnitSheet',
|
|
|
hideInTable: false,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '所在行位置',
|
|
|
dataIndex: 'reportUnitRow',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '所在列位置',
|
|
|
dataIndex: 'reportUnitCell',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
- title: '单元格样式类型',
|
|
|
+ title: '单元格样式类型',
|
|
|
dataIndex: 'unitStyleType',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
valueType: 'treeSelect',
|
|
|
- request: () => fetchDict('YESORNO'),
|
|
|
- fieldProps: {
|
|
|
- treeDefaultExpandAll: true,
|
|
|
- },
|
|
|
+ request: () => fetchDict('YESORNO'),
|
|
|
+ fieldProps: {
|
|
|
+ treeDefaultExpandAll: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- title: 'Excel公式',
|
|
|
+ title: 'Excel公式',
|
|
|
dataIndex: 'excelFormula',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true}
|
|
|
+ ]
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
{
|
|
@@ -401,9 +519,9 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
icon={<WomanOutlined />}
|
|
|
successMessage=""
|
|
|
onClick={
|
|
|
- ()=>{
|
|
|
+ ()=>{
|
|
|
calculateActionRef.current?.startEditable(record.id);
|
|
|
- } }
|
|
|
+ }}
|
|
|
>
|
|
|
编辑
|
|
|
</SDOperate>,
|
|
@@ -414,18 +532,14 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
|
|
|
function setIntoRestId() {
|
|
|
|
|
|
-
|
|
|
let fillId ='0';
|
|
|
- let calcId ='0';
|
|
|
-
|
|
|
+ let calcId ='0';
|
|
|
if (fillInFormData.length>=1) {
|
|
|
fillId = fillInFormData[fillInFormData.length-1].id;
|
|
|
}
|
|
|
-
|
|
|
if (calculateFormData.length >=1) {
|
|
|
calcId = calculateFormData[calculateFormData.length-1].id;
|
|
|
}
|
|
|
-
|
|
|
if (toNumber(fillId) > toNumber(calcId)) {
|
|
|
reptId=toNumber(fillId);
|
|
|
} else {
|
|
@@ -434,12 +548,18 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
}
|
|
|
|
|
|
const handanalyseReportFile = async (record:any,) => {
|
|
|
+
|
|
|
+ if (!fileData) {
|
|
|
+ baseFun.warning('请先上传模板文件后,在进行模板文件的解析');
|
|
|
+ return;
|
|
|
+ }
|
|
|
const data = await analyseReportFile(record,"reportuploadconfig");
|
|
|
setFillInFormData(data.FillIn);
|
|
|
setCalculateFormData(data.Calc);
|
|
|
setFillInFormDataBk(data.FillIn);
|
|
|
setCalculateFormDataBk(data.Calc);
|
|
|
setIntoRestId();
|
|
|
+ setAnalysis(true);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -448,7 +568,7 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
<SDPage>
|
|
|
<SDTable
|
|
|
title="查询表格"
|
|
|
- rowKey="customerName"
|
|
|
+ rowKey="reportNo"
|
|
|
request={async (formdata:ReportDefinitionModel) =>{
|
|
|
const formDatas = await getDataList(formdata);
|
|
|
// 解构数组(导出用)
|
|
@@ -470,8 +590,6 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
新增
|
|
|
</SDButton>,
|
|
|
]}
|
|
|
- actionRef={actionRef}
|
|
|
- formRef={formRef}
|
|
|
setDetailVisible={() => {setDetailVisible(true)}}
|
|
|
setEditType={setEditType}
|
|
|
setCurrentRow={setCurrentRow}
|
|
@@ -482,35 +600,56 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
|
|
|
{detailVisible && (
|
|
|
<SDModalForm
|
|
|
- title={'详细信息'}
|
|
|
- editType={editType}
|
|
|
- params={currentRow}
|
|
|
- visible={detailVisible}
|
|
|
- onVisibleChange={() => {setDetailVisible(false)}}
|
|
|
- footer={[
|
|
|
- <SDSubmitButton editType={editType} formRef={formRef} doSubmit={handleSave} >保存</SDSubmitButton>,
|
|
|
- <SDButton
|
|
|
- key="closeUpdate"
|
|
|
- successMessage=''
|
|
|
- onClick={() => {
|
|
|
- setDetailVisible(false);
|
|
|
- }}>关闭</SDButton>
|
|
|
- ]}
|
|
|
- tableRef={actionRef}
|
|
|
- formRef={formRef}
|
|
|
- onValuesChange={(changeValues)=>{
|
|
|
- if (changeValues.reportNo == '') {
|
|
|
- setBusiPk('');
|
|
|
- setFillInFormData([]);
|
|
|
- setCalculateFormData([]);
|
|
|
- }
|
|
|
- }}
|
|
|
- initialValues={
|
|
|
- {
|
|
|
- reportNo:busiPk
|
|
|
- }
|
|
|
- }
|
|
|
- >
|
|
|
+ title={'详细信息'}
|
|
|
+ editType={editType}
|
|
|
+ params={currentRow}
|
|
|
+ visible={detailVisible}
|
|
|
+ onVisibleChange={() => { setDetailVisible(false); } }
|
|
|
+ initialValues={{
|
|
|
+ reportNo: busiPk
|
|
|
+ }}
|
|
|
+ onValuesChange={async (changeValues) => {
|
|
|
+ if (changeValues.reportNo == '') {
|
|
|
+ setBusiPk('');
|
|
|
+ setFillInFormData([]);
|
|
|
+ setCalculateFormData([]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (changeValues.reportType) {
|
|
|
+ const data = await selectCalcProcessType();
|
|
|
+ data?.forEach((item)=>{
|
|
|
+ if(item.value== '01' || item.value== '02' || item.value== '03' || item.value== '06') {
|
|
|
+ fixedDictionArray?.push(item);
|
|
|
+ } else {
|
|
|
+ dynamicDictionArray?.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (changeValues.reportType == "01") {
|
|
|
+ dictionArray?.splice(0,dictionArray.length);
|
|
|
+ if (fixedDictionArray) {
|
|
|
+ setDictionArray([...fixedDictionArray]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ dictionArray?.splice(0,dictionArray.length);
|
|
|
+ if (dynamicDictionArray) {
|
|
|
+ setDictionArray([...dynamicDictionArray]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } }
|
|
|
+ footer={[
|
|
|
+ <SDSubmitButton editType={editType} formRef={formRef} doSubmit={handleSave}>保存</SDSubmitButton>,
|
|
|
+ <SDButton
|
|
|
+ key="closeUpdate"
|
|
|
+ successMessage=''
|
|
|
+ onClick={() => {
|
|
|
+ setDetailVisible(false);
|
|
|
+ } }>关闭</SDButton>
|
|
|
+ ]}
|
|
|
+ tableRef={actionRef}
|
|
|
+ formRef={formRef}
|
|
|
+ >
|
|
|
<SDAreaTtile title='报表信息'/>
|
|
|
<SDFormText name="reportNo" readonlyCond="update"
|
|
|
bgValidater={(reportNo: string) => isNotExist({
|
|
@@ -529,10 +668,10 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
callback();
|
|
|
}
|
|
|
}}]} label="报表名称"/>
|
|
|
- <SDFormDict dictKey='' name="reportType" label="报表类型" />
|
|
|
- <SDFormDict dictKey='' name="reportOrgcode" label="所属机构"/>
|
|
|
- <SDFormAttach name={"reportFile"} label="模板文件" funcType={"reportuploadconfig"} filetype="" maxFileNum={1} busiPkId={busiPk}/>
|
|
|
-
|
|
|
+ <SDFormDict dictKey='REPORT_TYPE' name="reportType" label="报表类型" />
|
|
|
+ <SDFormDict dictKey='org' name="reportOrgcode" label="所属机构"/>
|
|
|
+ <SDFormAttach name={"reportFile"} label="模板文件" {...fileProps}
|
|
|
+ funcType={"reportuploadconfig"} filetype="" maxFileNum={1} busiPkId={busiPk}/>
|
|
|
<SDFormText name="reportVersion" label="报表版本号"/>
|
|
|
<SDLayout footer={
|
|
|
[
|
|
@@ -541,17 +680,19 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
} >解析模板文件</SDSubmitButton>
|
|
|
]
|
|
|
}/>
|
|
|
+ <SDLayout>
|
|
|
<SDAreaTtile title='需填报的单元详情'/>
|
|
|
<EditableProTable
|
|
|
rowKey="id"
|
|
|
columns={reportCalculateColumns}
|
|
|
recordCreatorProps={false}
|
|
|
+ scroll={{ x: 1500 }}
|
|
|
actionRef={fillInActionRef}
|
|
|
value={fillInFormData}
|
|
|
editable={{
|
|
|
actionRender: (row,config,defaultDoms)=>{
|
|
|
return [defaultDoms.save,defaultDoms.cancel]
|
|
|
- }
|
|
|
+ },
|
|
|
}}
|
|
|
rowSelection={{
|
|
|
type:'radio',
|
|
@@ -599,7 +740,7 @@ const analyseFile = async (data: ReportDefinitionModel) => {
|
|
|
setFillInFormData([...value]);
|
|
|
} }
|
|
|
/>
|
|
|
-
|
|
|
+ </SDLayout>
|
|
|
<SDAreaTtile title='需计算的单元详情'/>
|
|
|
<EditableProTable
|
|
|
rowKey="id"
|