Commit 6e6fff31 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

Merge branch 'dev-srm' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform into dev-srm

parents 5b7db388 539f65ac
......@@ -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);
......
......@@ -13,7 +13,7 @@ import { Link } from 'umi';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const defaultColumns = setColumnsByLinks({
detail: '/memberCenter/memberAbility/memberEvaluate/tobeInformed',
detail: '/memberCenter/memberAbility/memberEvaluate/tobeInformed/detail',
});
interface Iprops {};
......
......@@ -7,7 +7,8 @@ import { observer } from 'mobx-react'
import { PublicApi } from '@/services/api';
import { priceFormat } from '@/utils/numberFomat';
import { formatTimeString } from '@/utils'
import { formatTimeString } from '@/utils';
import { toChatRoom } from '@/utils/im';
import { usePurchaseBidStore } from '@/store/purchaseBid';
import StatusBox from '../../../purchaseBid/readyBid/management/components/statusBox';
......@@ -98,7 +99,7 @@ const Detail = () => {
<div className={styles.warp}>
<div className={styles.header}>
<ArrowLeftOutlined className={styles.goBack} onClick={() => history.goBack()} />
<div className={styles.title}>{dataSource?.details}<span>{dataSource?.createMemberName}</span><IMBtn func={() => console.log('ok')} /></div>
<div className={styles.title}>{dataSource?.details}<span>{dataSource?.createMemberName}</span><IMBtn func={() => toChatRoom(dataSource.memberId)} /></div>
</div>
<div className={styles.layout}>
<Row gutter={[8, 8]}>
......
......@@ -5,6 +5,7 @@ import level1 from '@/assets/icons/the_first.png';
import level2 from '@/assets/icons/the_second.png';
import level3 from '@/assets/icons/the_third.png';
import { priceFormat } from '@/utils/numberFomat';
import { toChatRoom } from '@/utils/im';
import IMBtn from '../../../../../components/detail/components/iMBtn';
......@@ -55,7 +56,7 @@ const RankRow: React.FC<RankRowProps> = (props: any) => {
</div>
<div className={styles.rankRowRight}>
{detail.contacts}
<IMBtn func={() => console.log(1)} />
<IMBtn func={() => toChatRoom(detail.memberId)} />
</div>
</div>
)
......@@ -71,7 +72,7 @@ const RankRow: React.FC<RankRowProps> = (props: any) => {
<div>
<div className={styles.rankRowRight}>
{detail.contacts}
<IMBtn func={() => console.log(1)} />
<IMBtn func={() => toChatRoom(detail.memberId)} />
</div>
</div>
</div>
......
import React from 'react';
import { Button, notification, message } from 'antd';
import BASE_CONFIG from '../../config/base.config.json'
import { PublicApi } from '@/services/api';
import { SHOP_TYPE } from '@/constants';
import { getAuth } from '@/utils/auth';
const DOMAIN = {...BASE_CONFIG}.global.siteInfo.siteUrl.replace('www','');//document.domain
const CHATROOM_URL = `http://chatroom${DOMAIN}/chatRoom`;
const COOKIEPREFIX = 'CHATROOM_';
// 主动调起聊天室 mmeberId 为接收人的memberId
export const toChatRoom = (memberId: string = '', shopType: number = 1) => {
const _curUserInfo = getAuth();
if(!memberId){
document.cookie = `${COOKIEPREFIX}userInfo=${JSON.stringify(_curUserInfo)};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${shopType};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
return;
}
PublicApi.getMessageImHistorySession({ memberId: memberId, currMemberId: String(_curUserInfo.memberId) }).then(res => {
if (res.code === 1000) {
const _userId = res.data.data?.[0]?.userList?.[0]?.userId
if (_userId) {
document.cookie = `${COOKIEPREFIX}curMemberId=${memberId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}curUserId=${_userId};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}userInfo=${JSON.stringify(_curUserInfo)};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${shopType};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
} else {
message.error('该会员底下没有客服!');
}
}
})
}
interface NotificationChatRoomProps {
//通知消息
detail: any
}
// 被动从websocket调起聊天室
export const notificationChatRoom = (props: NotificationChatRoomProps) => {
const { detail } = props
const _curUserInfo = getAuth();
const close = () => {
console.log(
'Notification was closed. Either the close button was clicked or duration time elapsed.',
);
};
const key = `open${Date.now()}`;
const btn = (
<Button type="primary" size="small" onClick={() => {
document.cookie = `${COOKIEPREFIX}userInfo=${JSON.stringify(_curUserInfo)};path=/;domain=${DOMAIN}`;
document.cookie = `${COOKIEPREFIX}shopType=${shopType};path=/;domain=${DOMAIN}`;
window.open(CHATROOM_URL);
notification.close(key)
}}>
查看
</Button>
);
notification.open({
message: '你收到一条消息',
description:
'A function will be be called after the notification is closed (automatically after the "duration" time of manually).',
btn,
key,
duration: 10,
onClose: close,
});
}
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