|
@@ -5,12 +5,13 @@ import {Upload} from 'antd'
|
|
|
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,isNotExist,
|
|
|
- createRowData,createTemplateListRowData,createTemplateCheckRowData} from '@/services/rwa/product/datasupplementary/supplementtaskmanagement';
|
|
|
+ createRowData,createTemplateListRowData,createTemplateCheckRowData,selectDict,selectDictDefine,getNextId} from '@/services/rwa/product/datasupplementary/supplementtaskmanagement';
|
|
|
import { PlusSquareTwoTone, WomanOutlined } from "@ant-design/icons";
|
|
|
import { ProductProps } from "@/sundataImport";
|
|
|
import { toNumber } from "lodash";
|
|
|
import { useModel } from '@umijs/max';
|
|
|
import { countChineseChars } from "@/services/rwa/product/rwacheckutils";
|
|
|
+import { DictTree } from "@sundata/ui-frame/es/types";
|
|
|
|
|
|
type widowRush = {
|
|
|
onCancel: () => void;
|
|
@@ -37,20 +38,27 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
|
|
|
const [templateListData, setTemplateListData] = useState<SupplementTemplateRelationModel[]>();
|
|
|
const [templateCheckData, setTemplateCheckData] = useState<TemplateDataValidationRuleModel[]>();
|
|
|
- // const [resMap, setResMap] = useState<ModelMap>();
|
|
|
-
|
|
|
// 页面数据
|
|
|
- var formDataList = new Array<SupplementTaskDefineModel>;
|
|
|
+ var formDataList = new Array<TemplateDataValidationRuleModel>;
|
|
|
+
|
|
|
+ const [dictionArray1,setDictionArray1] = useState<any[]>();
|
|
|
+ const [dictionArray2,setDictionArray2] = useState<any[]>();
|
|
|
+
|
|
|
+ // 字典
|
|
|
const { fetchDict } = useModel('dict');
|
|
|
|
|
|
/** 字段关系序号编辑 */
|
|
|
- var dataInfoIndex = 1;
|
|
|
- var dataDetailIndex = 0;
|
|
|
+ var dataInfoIndex = 0;
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ selectDict().then((data)=>{
|
|
|
+ setDictionArray1(data);
|
|
|
+ });
|
|
|
+ selectDictDefine().then((data)=>{
|
|
|
+ setDictionArray2(data);
|
|
|
+ });
|
|
|
}, []);
|
|
|
|
|
|
-
|
|
|
// 修改查询查询
|
|
|
const selectData = async (formdata : SupplementTaskDefineModel) => {
|
|
|
const data = await selectDetailData(formdata);
|
|
@@ -74,7 +82,6 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
|
|
|
// 插入或者更新数据
|
|
|
const handleSave = async(data: SupplementTaskDefineModel,) => {
|
|
|
-
|
|
|
if (editType == 'update' ) {
|
|
|
const updateRes = await updateRowData(data);
|
|
|
if (updateRes == true) {
|
|
@@ -251,7 +258,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
title: '序号',
|
|
|
dataIndex: 'id',
|
|
|
search: false,
|
|
|
- render: (text, record, index) => { index = index + 1;dataInfoIndex = index; return index},
|
|
|
+ render: (text, record, index) => { index = index + 1; return index},
|
|
|
width:100,
|
|
|
ellipsis:true,
|
|
|
editable:false
|
|
@@ -282,12 +289,24 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
},
|
|
|
{
|
|
|
title: '补录模板',
|
|
|
- dataIndex: 'tmpCode',
|
|
|
+ dataIndex: 'tmpCodeOfDefine',
|
|
|
search: false,
|
|
|
hideInTable: false,
|
|
|
+ valueType:'treeSelect',
|
|
|
formItemProps:{
|
|
|
rules:[
|
|
|
- {required:true},]
|
|
|
+ {required:true},
|
|
|
+ {validator:(rules,value,callback)=>{
|
|
|
+ if (templateListData?.find(item => value === item?.tmpCodeOfDefine)) {
|
|
|
+ callback('补录模板列表不可出现重复模板');
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ }},
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ fieldProps: {
|
|
|
+ options: dictionArray2,
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -329,7 +348,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
icon={<WomanOutlined />}
|
|
|
successMessage=""
|
|
|
onClick={async ()=>{
|
|
|
- templateListActionRef.current?.startEditable(record.tmpCode);
|
|
|
+ templateListActionRef.current?.startEditable(record.tmpCodeOfDefine);
|
|
|
} }
|
|
|
>
|
|
|
编辑
|
|
@@ -345,7 +364,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
title: '序号',
|
|
|
dataIndex: 'id',
|
|
|
search: false,
|
|
|
- render: (text, record, index) => { index = index + 1;dataDetailIndex =index; return index},
|
|
|
+ render: (text, record, index) => { index = index + 1;return index},
|
|
|
width:100,
|
|
|
ellipsis:true,
|
|
|
editable:false
|
|
@@ -382,6 +401,15 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
width:150,
|
|
|
ellipsis:true
|
|
|
},
|
|
|
+ {
|
|
|
+ title: '规则编号',
|
|
|
+ dataIndex: 'tmpverificationCode',
|
|
|
+ search: false,
|
|
|
+ width:100,
|
|
|
+ ellipsis:true,
|
|
|
+ hideInTable:true,
|
|
|
+ editable:false
|
|
|
+ },
|
|
|
{
|
|
|
title: '规则名称',
|
|
|
dataIndex: 'tmpverificationName',
|
|
@@ -408,9 +436,13 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
hideInTable: false,
|
|
|
width:150,
|
|
|
ellipsis:true,
|
|
|
+ valueType:'treeSelect',
|
|
|
formItemProps:{
|
|
|
rules:[
|
|
|
{required:true},]
|
|
|
+ },
|
|
|
+ fieldProps: {
|
|
|
+ options: dictionArray1,
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -563,8 +595,6 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
rowKey="customerName"
|
|
|
request={async (formdata:SupplementTaskDefineModel) =>{
|
|
|
const formDatas = await getDataList(formdata);
|
|
|
- // 解构数组(导出用)
|
|
|
- formDataList=[...formDatas];
|
|
|
return {data: formDatas}
|
|
|
} }
|
|
|
columns={columns}
|
|
@@ -626,7 +656,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
callback();
|
|
|
}
|
|
|
}}]} label="任务名称"/>
|
|
|
- <SDFormDict dictKey="" name="orgCode" label="责任机构"/>
|
|
|
+ <SDFormDict dictKey="org" name="orgCode" label="责任机构"/>
|
|
|
<SDFormDict dictKey="" name="account" label="首选责任人"/>
|
|
|
<SDFormDict dictKey="CALC_TASK_RATE" name="frequency" label="补录频率"/>
|
|
|
<SDFormText name="adjustment" label="天数调整"/>
|
|
@@ -634,7 +664,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
<SDLayout>
|
|
|
<SDAreaTtile title='补录模板列表'/>
|
|
|
<EditableProTable
|
|
|
- rowKey="tmpCode"
|
|
|
+ rowKey="tmpCodeOfDefine"
|
|
|
columns={templateListColumns}
|
|
|
recordCreatorProps={false}
|
|
|
actionRef={templateListActionRef}
|
|
@@ -642,7 +672,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
editable={{
|
|
|
actionRender: (row,config,defaultDoms)=>{
|
|
|
return [defaultDoms.save,defaultDoms.delete,defaultDoms.cancel]
|
|
|
- }
|
|
|
+ },
|
|
|
}}
|
|
|
toolBarRender={(_, { selectedRowKeys }) => editType == 'create' || editType == 'update' ? [
|
|
|
<SDButton
|
|
@@ -650,7 +680,7 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
successMessage=''
|
|
|
onClick={() => {
|
|
|
templateListActionRef.current?.addEditRecord?.({
|
|
|
- tmpCode: dataInfoIndex+1,
|
|
|
+ tmpCodeOfDefine: dataInfoIndex+1,
|
|
|
title: 'NEWROW',
|
|
|
});
|
|
|
}}
|
|
@@ -660,7 +690,23 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
]:[]}
|
|
|
onChange={ (value: readonly SupplementTemplateRelationModel[]) => {
|
|
|
setTemplateListData([...value]);
|
|
|
- } }
|
|
|
+ // 判断array2中是否包含array1中的对象,并返回该对象的数组形式
|
|
|
+ let foundObject = templateCheckData?.filter(obj1 => value?.find(obj2 =>
|
|
|
+ obj2.tmpCodeOfDefine === obj1.tmpCode));
|
|
|
+ if (foundObject) {
|
|
|
+ setTemplateCheckData([...foundObject]);
|
|
|
+ }
|
|
|
+ // 补录模板内新增一条数据(模板是新的)补录模板校验规则的补录模板下拉列表应实时更新
|
|
|
+ // 先将补录模板校验规则的补录模板下拉列表清空
|
|
|
+ dictionArray1?.splice(0,dictionArray1.length);
|
|
|
+ // 遍历补录模板列表。将新出现的模板用temcode在dictionArray2下拉列表的数组中找到相应对象并压进dictionArray1里
|
|
|
+ value?.forEach((item)=>{
|
|
|
+ const obj = dictionArray2?.find(e => e.value === item.tmpCodeOfDefine);
|
|
|
+ if (!dictionArray1?.includes(obj)){
|
|
|
+ dictionArray1?.push(obj);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }}
|
|
|
/>
|
|
|
</SDLayout>
|
|
|
|
|
@@ -695,9 +741,10 @@ const supplementtaskmanagement : React.FC<widowRush> = (prop:widowRush) => {
|
|
|
<SDButton
|
|
|
key="export"
|
|
|
successMessage=''
|
|
|
- onClick={() => {
|
|
|
+ onClick={ async () => {
|
|
|
+ let nextId = await getNextId();
|
|
|
templateCheckActionRef.current?.addEditRecord?.({
|
|
|
- tmpverificationCode: dataDetailIndex+1,
|
|
|
+ tmpverificationCode: nextId,
|
|
|
title: 'NEWROW',
|
|
|
});
|
|
|
}}
|