|
@@ -2,13 +2,13 @@ import React, { useEffect, useRef, useState } from "react";
|
|
|
import { type ProColumns, type ActionType, type ProFormInstance, ProTable, EditableProTable } from '@ant-design/pro-components';
|
|
|
import type {FormInstance} from 'antd'
|
|
|
import {Upload} from 'antd'
|
|
|
-import { SDPage,SDFormText,SDModalForm,SDTable,SDFormItem,SDButton,SDSubmitButton,EditType, SDAreaTtile, SDOperate, baseFun,SDModal, validateFun, SDLayout, } from "@sundata/ui-frame";
|
|
|
-import type { SupplementTaskDefineModel,SupplementTemplateRelationModel,TemplateDataValidationRuleModel } from '@/services/rwa/product/datasupplementary/supplementtaskmanagement';
|
|
|
-import {getDataList,selectDetailData,getTemplateCheckDataList,getTemplateDataList,deleteInfoData,deleteTemplateListData,deleteTemplateCheckData,
|
|
|
- updateRowData,createRowData,createTemplateListRowData,createTemplateCheckRowData,selectTemplateListDetailData,selectTemplateCheckDetailData
|
|
|
-} from '@/services/rwa/product/datasupplementary/supplementtaskmanagement';
|
|
|
+import { SDPage,SDFormText,SDModalForm,SDTable,SDFormItem,SDButton,SDSubmitButton,EditType, SDAreaTtile, SDOperate, baseFun,SDModal, validateFun, SDLayout, SDFormDict, } from "@sundata/ui-frame";
|
|
|
+import type { SupplementTaskDefineModel,SupplementTemplateRelationModel,TemplateDataValidationRuleModel, } from '@/services/rwa/product/datasupplementary/supplementtaskmanagement';
|
|
|
+import {getDataList,selectDetailData,getTemplateCheckDataList,getTemplateDataList,deleteInfoData,updateRowData,
|
|
|
+ createRowData,createTemplateListRowData,createTemplateCheckRowData} from '@/services/rwa/product/datasupplementary/supplementtaskmanagement';
|
|
|
import { PlusSquareTwoTone, WomanOutlined } from "@ant-design/icons";
|
|
|
import { ProductProps } from "@/sundataImport";
|
|
|
+import { toNumber } from "lodash";
|
|
|
|
|
|
type widowRush = {
|
|
|
onCancel: () => void;
|
|
@@ -21,8 +21,6 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
const [editType, setEditType] = useState<EditType>(prop.editType || 'display');
|
|
|
/** 是否显示详细信息窗口 */
|
|
|
const [detailVisible, setDetailVisible] = useState<boolean>(false);
|
|
|
- const [templateListVisible, setTemplateListVisible] = useState<boolean>(false);
|
|
|
- const [templateCheckVisible, setTemplateCheckVisible] = useState<boolean>(false);
|
|
|
|
|
|
const [currentRow, setCurrentRow] = useState<SupplementTaskDefineModel>();
|
|
|
/** 表格引用对象,刷新表格使用 */
|
|
@@ -30,15 +28,19 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
const formRef = useRef<FormInstance<any>>();
|
|
|
const templateListRef = useRef<FormInstance<any>>();
|
|
|
const templateCheckRef = useRef<FormInstance<any>>();
|
|
|
+ const templateListActionRef = useRef<ActionType>();
|
|
|
+ const templateCheckActionRef = useRef<ActionType>();
|
|
|
|
|
|
const [templateListData, setTemplateListData] = useState<SupplementTemplateRelationModel[]>();
|
|
|
const [templateCheckData, setTemplateCheckData] = useState<TemplateDataValidationRuleModel[]>();
|
|
|
+ // const [resMap, setResMap] = useState<ModelMap>();
|
|
|
|
|
|
// 页面数据
|
|
|
var formDataList = new Array<SupplementTaskDefineModel>;
|
|
|
|
|
|
/** 字段关系序号编辑 */
|
|
|
- var dataIndex = 1;
|
|
|
+ var dataInfoIndex = 1;
|
|
|
+ var dataDetailIndex = 0;
|
|
|
|
|
|
useEffect(() => {
|
|
|
}, []);
|
|
@@ -49,23 +51,11 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
const data = await selectDetailData(formdata);
|
|
|
formRef.current?.setFieldsValue(data);
|
|
|
const dataList = await getTemplateDataList(formdata);
|
|
|
- setTemplateListData(dataList);
|
|
|
+ setTemplateListData(...[dataList]);
|
|
|
const templateList = await getTemplateCheckDataList(formdata);
|
|
|
- setTemplateCheckData(templateList);
|
|
|
+ setTemplateCheckData(...[templateList]);
|
|
|
}
|
|
|
|
|
|
- // 修改
|
|
|
- const selectTemplateRelation =async (formdata :SupplementTemplateRelationModel)=>{
|
|
|
- const data = await selectTemplateListDetailData(formdata);
|
|
|
- templateListRef.current?.setFieldsValue(data);
|
|
|
- }
|
|
|
-
|
|
|
- // 修改
|
|
|
- const selectTemplateCheck = async(formdata :TemplateDataValidationRuleModel)=>{
|
|
|
- const data = await selectTemplateCheckDetailData(formdata);
|
|
|
- templateCheckRef.current?.setFieldsValue(data);
|
|
|
- }
|
|
|
-
|
|
|
// 删除
|
|
|
const deleteData = async(formdata : SupplementTaskDefineModel) => {
|
|
|
baseFun.confirm('请确认是否继续操作?',async() =>{
|
|
@@ -75,54 +65,31 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // 删除
|
|
|
- const deleteListData = async(formdata : SupplementTemplateRelationModel) => {
|
|
|
- baseFun.confirm('请确认是否继续操作?',async() =>{
|
|
|
- await deleteTemplateListData(formdata);
|
|
|
- baseFun.info("删除成功");
|
|
|
- closeAndRefresh();
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 删除
|
|
|
- const deletecheckData = async(formdata : TemplateDataValidationRuleModel) => {
|
|
|
- baseFun.confirm('请确认是否继续操作?',async() =>{
|
|
|
- await deleteTemplateCheckData(formdata);
|
|
|
- baseFun.info("删除成功");
|
|
|
- closeAndRefresh();
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
|
|
|
// 插入或者更新数据
|
|
|
const handleSave = async(data: SupplementTaskDefineModel,) => {
|
|
|
|
|
|
if (editType == 'update' ) {
|
|
|
- await updateRowData(data);
|
|
|
+ await updateRowData(data).then(()=>{
|
|
|
+ if (templateListData && templateCheckData) {
|
|
|
+ createTemplateListRowData(templateListData,data.taskCode);
|
|
|
+ createTemplateCheckRowData(templateCheckData);
|
|
|
+ }
|
|
|
+ });
|
|
|
closeAndRefresh();
|
|
|
} else if (editType == 'create' ) {
|
|
|
- await createRowData(data);
|
|
|
+ await createRowData(data).then(()=>{
|
|
|
+ if (templateListData && templateCheckData) {
|
|
|
+ createTemplateListRowData(templateListData,data.taskCode);
|
|
|
+ createTemplateCheckRowData(templateCheckData);
|
|
|
+ }
|
|
|
+ });
|
|
|
closeAndRefresh();
|
|
|
}
|
|
|
setDetailVisible(false);
|
|
|
}
|
|
|
|
|
|
- // 插入或者更新数据
|
|
|
- const handleTemplateRelationSave = async(data: SupplementTemplateRelationModel) => {
|
|
|
- await createTemplateListRowData(data);
|
|
|
- closeAndRefresh();
|
|
|
- setTemplateListVisible(false);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 插入或者更新数据
|
|
|
- const handleTemplateRuleSave = async(data: TemplateDataValidationRuleModel) => {
|
|
|
- await createTemplateCheckRowData(data);
|
|
|
- closeAndRefresh();
|
|
|
- setTemplateListVisible(false);
|
|
|
- }
|
|
|
|
|
|
//关闭窗口刷新父页面
|
|
|
const closeAndRefresh = ()=>{
|
|
@@ -137,7 +104,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
title: '序号',
|
|
|
dataIndex: 'index',
|
|
|
search: false,
|
|
|
- render: (text, record, index) => { index = index + 1;dataIndex = index; return index},
|
|
|
+ render: (text, record, index) => { index = index + 1;return index},
|
|
|
width:100,
|
|
|
ellipsis:true
|
|
|
},
|
|
@@ -204,6 +171,12 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
hideInTable: false,
|
|
|
search: false,
|
|
|
},
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ dataIndex: 'status',
|
|
|
+ hideInTable: false,
|
|
|
+ search: false,
|
|
|
+ },
|
|
|
{
|
|
|
title: '操作',
|
|
|
dataIndex: 'operate',
|
|
@@ -257,11 +230,12 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
const templateListColumns: ProColumns<SupplementTemplateRelationModel>[] = [
|
|
|
{
|
|
|
title: '序号',
|
|
|
- dataIndex: 'index',
|
|
|
+ dataIndex: 'id',
|
|
|
search: false,
|
|
|
- render: (text, record, index) => { index = index + 1; return index},
|
|
|
+ render: (text, record, index) => { index = index + 1;dataInfoIndex = index; return index},
|
|
|
width:100,
|
|
|
- ellipsis:true
|
|
|
+ ellipsis:true,
|
|
|
+ editable:false
|
|
|
},
|
|
|
{
|
|
|
title: '计算实例号',
|
|
@@ -292,6 +266,10 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
dataIndex: 'tmpCode',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {required:true},]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '补录模板说明',
|
|
@@ -315,27 +293,11 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
icon={<WomanOutlined />}
|
|
|
successMessage=""
|
|
|
onClick={async ()=>{
|
|
|
- //selectData(record);
|
|
|
- selectTemplateRelation(record);
|
|
|
- setTemplateListVisible(true);
|
|
|
- setEditType('update');
|
|
|
+ templateListActionRef.current?.startEditable(record.tmpCode);
|
|
|
} }
|
|
|
>
|
|
|
- 修改
|
|
|
+ 编辑
|
|
|
</SDOperate>,
|
|
|
- <SDOperate
|
|
|
- key="roleCfg"
|
|
|
- icon={<WomanOutlined />}
|
|
|
- successMessage=""
|
|
|
- onClick={
|
|
|
- ()=>{
|
|
|
- deleteListData(record);
|
|
|
- setDetailVisible(true);
|
|
|
- setEditType('update');
|
|
|
- } }
|
|
|
- >
|
|
|
- 删除
|
|
|
- </SDOperate>,
|
|
|
],
|
|
|
},
|
|
|
];
|
|
@@ -345,11 +307,12 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
const templateCheckColumns: ProColumns<TemplateDataValidationRuleModel>[] = [
|
|
|
{
|
|
|
title: '序号',
|
|
|
- dataIndex: 'index',
|
|
|
+ dataIndex: 'id',
|
|
|
search: false,
|
|
|
- render: (text, record, index) => { index = index + 1; return index},
|
|
|
+ render: (text, record, index) => { index = index + 1;dataDetailIndex =index; return index},
|
|
|
width:100,
|
|
|
- ellipsis:true
|
|
|
+ ellipsis:true,
|
|
|
+ editable:false
|
|
|
},
|
|
|
{
|
|
|
title: '计算实例号',
|
|
@@ -416,7 +379,11 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
dataIndex: 'tmpverRowRange',
|
|
|
hideInTable: false,
|
|
|
width:150,
|
|
|
- ellipsis:true
|
|
|
+ ellipsis:true,
|
|
|
+ formItemProps:{
|
|
|
+ rules:[
|
|
|
+ {pattern: RegExp(`[0-9]+\\-[0-9]+|[n|N]`),message:'请输入正确范围'},]
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '列范围',
|
|
@@ -480,27 +447,11 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
successMessage=""
|
|
|
onClick={
|
|
|
async()=>{
|
|
|
- //selectData(record);
|
|
|
- selectTemplateCheck(record);
|
|
|
- setTemplateCheckVisible(true);
|
|
|
- setEditType('update');
|
|
|
- } }
|
|
|
+ templateCheckActionRef.current?.startEditable(record.tmpverificationCode);
|
|
|
+ }}
|
|
|
>
|
|
|
- 修改
|
|
|
+ 编辑
|
|
|
</SDOperate>,
|
|
|
- <SDOperate
|
|
|
- key="roleCfg"
|
|
|
- icon={<WomanOutlined/>}
|
|
|
- successMessage=""
|
|
|
- onClick={
|
|
|
- ()=>{
|
|
|
- deletecheckData(record);
|
|
|
- setDetailVisible(true);
|
|
|
- setEditType('update');
|
|
|
- } }
|
|
|
- >
|
|
|
- 删除
|
|
|
- </SDOperate>,
|
|
|
],
|
|
|
},
|
|
|
];
|
|
@@ -560,112 +511,81 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
>
|
|
|
<SDAreaTtile title='补录任务新增页面'/>
|
|
|
<SDFormText name="taskCode" readonlyCond="update" required={true} label="任务编号"/>
|
|
|
- <SDFormText name="tmpName" label="任务名称"/>
|
|
|
- <SDFormText name="orgCode" label="责任机构"/>
|
|
|
- <SDFormText name="account" label="首选责任人"/>
|
|
|
- <SDFormText name="frequency" label="补录频率"/>
|
|
|
+ <SDFormText name="taskName" label="任务名称"/>
|
|
|
+ <SDFormDict dictKey="" name="orgCode" label="责任机构"/>
|
|
|
+ <SDFormDict dictKey="" name="account" label="首选责任人"/>
|
|
|
+ <SDFormDict dictKey="CALC_TASK_RATE" name="frequency" label="补录频率"/>
|
|
|
<SDFormText name="adjustment" label="天数调整"/>
|
|
|
- <SDFormText name="tmpFileCode" label="所属阶段"/>
|
|
|
+ <SDFormDict dictKey="" name="tmpFileCode" label="所属阶段"/>
|
|
|
<SDLayout>
|
|
|
<SDAreaTtile title='补录模板列表'/>
|
|
|
- <ProTable
|
|
|
- search={false}
|
|
|
- rowKey="index"
|
|
|
- columns={templateListColumns}
|
|
|
- dataSource={templateListData}
|
|
|
- toolBarRender={(_, { selectedRowKeys }) => editType == 'create' || editType == 'update' ? [
|
|
|
- <SDButton
|
|
|
- key="export"
|
|
|
- successMessage=''
|
|
|
- onClick={() => {
|
|
|
- setTemplateListVisible(true);
|
|
|
+ <EditableProTable
|
|
|
+ rowKey="tmpCode"
|
|
|
+ columns={templateListColumns}
|
|
|
+ recordCreatorProps={false}
|
|
|
+ actionRef={templateListActionRef}
|
|
|
+ value={templateListData}
|
|
|
+ editable={{
|
|
|
+ actionRender: (row,config,defaultDoms)=>{
|
|
|
+ return [defaultDoms.save,defaultDoms.delete,defaultDoms.cancel]
|
|
|
+ }
|
|
|
}}
|
|
|
- >
|
|
|
- 新增
|
|
|
- </SDButton>,
|
|
|
- ]:[]}
|
|
|
- />
|
|
|
+ toolBarRender={(_, { selectedRowKeys }) => editType == 'create' || editType == 'update' ? [
|
|
|
+ <SDButton
|
|
|
+ key="export"
|
|
|
+ successMessage=''
|
|
|
+ onClick={() => {
|
|
|
+ templateListActionRef.current?.addEditRecord?.({
|
|
|
+ tmpCode: dataInfoIndex+1,
|
|
|
+ title: 'NEWROW',
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 新增
|
|
|
+ </SDButton>,
|
|
|
+ ]:[]}
|
|
|
+ onChange={ (value: readonly SupplementTemplateRelationModel[]) => {
|
|
|
+ setTemplateListData([...value]);
|
|
|
+ } }
|
|
|
+ />
|
|
|
</SDLayout>
|
|
|
|
|
|
<SDLayout>
|
|
|
<SDAreaTtile title='补录模板校验规则'/>
|
|
|
- <ProTable
|
|
|
- search={false}
|
|
|
- rowKey="index"
|
|
|
- columns={templateCheckColumns}
|
|
|
- dataSource={templateCheckData}
|
|
|
- scroll={{ x: 1500 }}
|
|
|
- toolBarRender={(_, { selectedRowKeys }) => editType == 'create' || editType == 'update' ? [
|
|
|
- <SDButton
|
|
|
- key="export"
|
|
|
- successMessage=''
|
|
|
- onClick={() => {
|
|
|
- setTemplateCheckVisible(true);
|
|
|
+ <EditableProTable
|
|
|
+ rowKey="tmpverificationCode"
|
|
|
+ columns={templateCheckColumns}
|
|
|
+ recordCreatorProps={false}
|
|
|
+ actionRef={templateCheckActionRef}
|
|
|
+ scroll={{ x: 1500 }}
|
|
|
+ value={templateCheckData}
|
|
|
+ editable={{
|
|
|
+ actionRender: (row,config,defaultDoms)=>{
|
|
|
+ return [defaultDoms.save,defaultDoms.delete,defaultDoms.cancel]
|
|
|
+ }
|
|
|
}}
|
|
|
- >
|
|
|
- 新增
|
|
|
- </SDButton>,
|
|
|
- ]:[]}
|
|
|
- />
|
|
|
+ toolBarRender={(_, { selectedRowKeys }) => editType == 'create' || editType == 'update' ? [
|
|
|
+ <SDButton
|
|
|
+ key="export"
|
|
|
+ successMessage=''
|
|
|
+ onClick={() => {
|
|
|
+ templateCheckActionRef.current?.addEditRecord?.({
|
|
|
+ tmpverificationCode: dataDetailIndex+1,
|
|
|
+ title: 'NEWROW',
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 新增
|
|
|
+ </SDButton>,
|
|
|
+ ]:[]}
|
|
|
+ onChange={ (value: readonly TemplateDataValidationRuleModel[]) => {
|
|
|
+ setTemplateCheckData([...value]);
|
|
|
+ } }
|
|
|
+ />
|
|
|
</SDLayout>
|
|
|
</SDModalForm>
|
|
|
)}
|
|
|
|
|
|
- {templateListVisible && (
|
|
|
- <SDModalForm
|
|
|
- visible={templateListVisible}
|
|
|
- onVisibleChange={() => {setTemplateListVisible(false)}}
|
|
|
- formRef={templateListRef}
|
|
|
- footer={[
|
|
|
- <SDSubmitButton editType={editType} formRef={formRef} doSubmit={handleTemplateRelationSave} >保存</SDSubmitButton>,
|
|
|
- <SDButton
|
|
|
- key="closeUpdate"
|
|
|
- successMessage=''
|
|
|
- onClick={() => {
|
|
|
- setTemplateListVisible(false);
|
|
|
- }}>关闭</SDButton>
|
|
|
- ]}
|
|
|
- >
|
|
|
- <SDFormText name="tmpCode" label="补录模板"/>
|
|
|
- <SDFormText name="remark" label="补录模板说明"/>
|
|
|
- <SDFormText name="sqlCode" label="数据初始化逻辑"/>
|
|
|
- <SDFormText name="columnRange" label="字段类型与长度"/>
|
|
|
- <SDFormText name="tmpFileCode" label="数据项说明"/>
|
|
|
- </SDModalForm>
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
- {templateCheckVisible && (
|
|
|
- <SDModalForm
|
|
|
- visible={templateCheckVisible}
|
|
|
- onVisibleChange={() => {setTemplateCheckVisible(false)}}
|
|
|
- formRef={templateCheckRef}
|
|
|
- footer={[
|
|
|
- <SDSubmitButton editType={editType} formRef={formRef} doSubmit={handleTemplateRuleSave} >保存</SDSubmitButton>,
|
|
|
- <SDButton
|
|
|
- key="closeUpdate"
|
|
|
- successMessage=''
|
|
|
- onClick={() => {
|
|
|
- setTemplateCheckVisible(false);
|
|
|
- }}>关闭</SDButton>
|
|
|
- ]}
|
|
|
- >
|
|
|
- <SDFormText name="tmpverificationName" label="规则名称"/>
|
|
|
- <SDFormText name="tmpCode" label="补录模板"/>
|
|
|
- <SDFormText name="tmpverRowColType" label="行列类型"/>
|
|
|
- <SDFormText name="vartimmer" label="模板验证时点"/>
|
|
|
- <SDFormText name="tmpverRowRange" label="行范围"/>
|
|
|
- <SDFormText name="tmpverColumnRange" label="列范围"/>
|
|
|
- <SDFormText name="checkType" label="约束方式"/>
|
|
|
- <SDFormText name="dataType" label="数据类型"/>
|
|
|
- <SDFormText name="sqlCode" label="约束规则SQL"/>
|
|
|
- <SDFormText name="exceedType" label="越界处理方式"/>
|
|
|
- <SDFormText name="errorMsgTmplate" label="提示信息模板"/>
|
|
|
- <SDFormText name="excelFormula" label="约束公式"/>
|
|
|
- </SDModalForm>
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
</SDPage>
|
|
|
|