Commit 4ee3800a authored by Bill's avatar Bill

fix: 修改增加考评bug

parent 9d954dd7
......@@ -7,7 +7,15 @@ interface Iprops {
value: UploadFile[],
editable: boolean,
props: {
['x-component-props']: any,
['x-component-props']: {
/**
* ☹
* 这里表现相对奇怪,当这个组件放在了table 下切这个组件是必填的话,会出现两个错误情况,我通过外部传值干掉其中一个
*/
showError?: boolean,
} & {
[key: string]: any
},
},
mutators: {
change: (params: UploadFile[]) => void
......@@ -25,8 +33,11 @@ const toArray = (value: string | UploadFile[]): UploadFile[] => {
}
const FormilyUploadFiles: React.FC<Iprops> = (props: Iprops) => {
const { value, editable, errors } = props;
const { value, editable, errors, } = props;
const componentProps = props.props?.['x-component-props'] || {};
const { showError, ...rest } = componentProps;
const isShowError = typeof showError === 'undefined' ? true : showError;
const fileList = toArray(value);
const onChange = (info: UploadChangeParam) => {
......@@ -54,9 +65,9 @@ const FormilyUploadFiles: React.FC<Iprops> = (props: Iprops) => {
return (
<div>
<UploadFiles fileList={fileList} onChange={onChange} onRemove={onRemove} disable={!editable} {...componentProps} />
<UploadFiles fileList={fileList} onChange={onChange} onRemove={onRemove} disable={!editable} {...rest} />
{
errors.length > 0 && (
isShowError && errors.length > 0 && (
<div>
<p style={{color: '#ff4d4f'}}>{errors.join("")}</p>
</div>
......
......@@ -143,17 +143,13 @@ const EvaluateAdd = (props) => {
<PlusOutlined /> 添加
</div>
)
/**
*
* @tofix 修改subMemberId
*/
const handleRemove = (index: number) => {
const dataSource = formActions.getFieldValue('tabs.tab-2.items') || [];
const target = dataSource[index];
if("id" in target) {
if(target.type !== 0) {
// 表示他不是来自于系统的
const projectDataSource = formActions.getFieldValue('tabs.tab-2.selectProject')
const newProjectKeys = projectDataSource.filter((_item) => _item.subMemberId !== target.id);
const newProjectKeys = projectDataSource.filter((_item) => _item.type !== target.type);
formActions.setFieldValue('tabs.tab-2.selectProject', newProjectKeys);
}
const newSource = [...dataSource];
......@@ -183,6 +179,10 @@ const EvaluateAdd = (props) => {
content: _item.typeDesc,
// id: _item.id,
type: _item.type,
memberName: {
userId: 0,
name: "系统"
}
})) || []
// const withProjectId = new Set(tempData.map((_item) => _item.id));
const dataSource = formActions.getFieldValue('tabs.tab-2.items') || [];
......
......@@ -140,7 +140,7 @@ export const evaluateAddSchema: ISchema = {
type: 'string',
editable: false,
"x-render": (props) => {
const numberIndex = FormPath.transform(props.name, /\d/, $1 => {
const numberIndex = FormPath.transform((props as any).name, /\d/, $1 => {
return `${$1}`
});
return <div style={{marginBottom: '24px'}}>{+numberIndex + 1}</div>
......@@ -200,6 +200,16 @@ export const evaluateAddSchema: ISchema = {
required: true,
message: '请选择考评人',
}
],
'x-linkages': [
{
type: 'value:state',
target: '..[].*(memberName)',
// true 的时候不能填
state: {
editable: '{{$value && $value.userId !== 0}}'
}
},
]
},
sendAppraisal: {
......@@ -208,8 +218,37 @@ export const evaluateAddSchema: ISchema = {
'x-component': 'FormilyCheckbox',
"x-props": {
width: 128
}
},
'x-linkages': [
{
type: 'value:state',
target: '..[].*(grade,reports)',
// true 的时候不能填
state: {
visible: '{{!$value}}'
}
},
{
type: 'value:schema',
// 考评人打分没勾选, 这几项都为必填
target: '..[].*(grade,scoreWeight,templates,reports)',
condition: `{{ !$value }}`,
schema: {
"x-rules": [
{
required: true,
}
]
},
otherwise: {
"x-rules": [
{
required: false,
}
]
}
}
]
},
scoreWeight: {
title: '考评权重',
......@@ -243,7 +282,8 @@ export const evaluateAddSchema: ISchema = {
'x-component-props': {
mode: 'link',
buttonText: '上传',
fileContainerClassName: 'customizeFileContainer'
fileContainerClassName: 'customizeFileContainer',
showError: false,
},
"x-props": {
width: 180,
......@@ -256,7 +296,8 @@ export const evaluateAddSchema: ISchema = {
'x-component-props': {
mode: 'link',
buttonText: '上传',
fileContainerClassName: 'customizeFileContainer'
fileContainerClassName: 'customizeFileContainer',
showError: false,
},
"x-props": {
width: 180,
......
......@@ -14,7 +14,7 @@ import useModal from '../hooks/useModal';
import styles from './detail.less';
import { usePageStatus } from '@/hooks/usePageStatus';
import useInitialValue from '@/pages/handling/common/hooks/useInitialValue';
import { GetMemberAppraisalSummaryGetResponse } from '@/services/MemberV2Api';
import { GetMemberAppraisalWaitGradeGetResponse } from '@/services/MemberV2Api';
import { PublicApi } from '@/services/api';
import { findLastIndexFlowState } from '@/utils';
import FlowRecords from '@/components/FlowRecords';
......@@ -37,7 +37,7 @@ const TobeEvaluateDetail = () => {
const { visible, toggle } = useModal()
const { id } = usePageStatus();
const params = useMemo(() => { return id ? { id: id.toString() } : null }, [id]);
const { loading, initialValue }= useInitialValue<GetMemberAppraisalSummaryGetResponse, { id: string }>(PublicApi.getMemberAppraisalSummaryGet, params)
const { loading, initialValue }= useInitialValue<GetMemberAppraisalWaitGradeGetResponse, { id: string }>(PublicApi.getMemberAppraisalWaitGradeGet, params)
const { anchorHeader, basicInfoList, evaluateResultColumn, auditProcess } = useGetDetailCommon({blackList: ['result'], initialValue: initialValue})
const [hasScoring, setHasScoring] = useState<boolean>(false);
const [submitLoading, setSubmitLoading] = useState<boolean>(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment