编辑详审细则
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useMemo, useRef, useState, } from 'react';
|
||||
import { Button, Radio, Input, Modal, Form, Row, Col, Select, Collapse, Checkbox, message, Spin, Popconfirm } from 'antd';
|
||||
import { Button, Radio, Input, Modal, Form, Row, Col, Select, Collapse, Checkbox, message, Spin, Popconfirm, InputNumber } from 'antd';
|
||||
import ProTable, { EditableProTable, ProColumns } from '@ant-design/pro-table';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, CloseOutlined, ExclamationCircleOutlined, } from '@ant-design/icons';
|
||||
import styles from './detailedStyles.less';
|
||||
@ -683,6 +683,73 @@ const DetailedMain: React.FC<detailType> = (props) => {
|
||||
</Select>
|
||||
</FormItem></Col>
|
||||
</Row>
|
||||
<Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.type !== currentValues.type}>
|
||||
{({ getFieldValue }) => {
|
||||
const selectedType = getFieldValue('type');
|
||||
return (
|
||||
selectedType !== '报价' && (
|
||||
<Row>
|
||||
<Col span={24}><FormItem
|
||||
name="calculationMethod"
|
||||
label="计算方式"
|
||||
// initialValue="请选择"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择计算方式'
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Select style={{ width: "80%" }} placeholder="请选择计算方式">
|
||||
<Option value="1" key="1">打分专家平均分</Option>
|
||||
<Option value="2" key="2">去掉最高最低分的平均分</Option>
|
||||
</Select>
|
||||
</FormItem></Col>
|
||||
</Row>
|
||||
)
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
<Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.calculationMethod !== currentValues.calculationMethod}>
|
||||
{({ getFieldValue }) => {
|
||||
const calculationMethod = getFieldValue('calculationMethod');
|
||||
return (
|
||||
calculationMethod === '2' && (
|
||||
<>
|
||||
<Row>
|
||||
<Col span={24}>
|
||||
<FormItem
|
||||
name="removeMaxQuantity"
|
||||
label="去掉最高数量"
|
||||
rules={[
|
||||
{ required: true, message: '请输入要去掉的最高数量' },
|
||||
{ type: 'number', min: 0, message: '请输入非负数' }
|
||||
]}
|
||||
>
|
||||
<InputNumber style={{ width: "80%" }} placeholder="请输入要去掉的最高数量" />
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<Col span={24}>
|
||||
<FormItem
|
||||
name="removeMinQuantity"
|
||||
label="去掉最低数量"
|
||||
rules={[
|
||||
{ required: true, message: '请输入要去掉的最低数量' },
|
||||
{ type: 'number', min: 0, message: '请输入非负数' }
|
||||
]}
|
||||
>
|
||||
<InputNumber style={{ width: "80%" }} placeholder="请输入要去掉的最低数量" />
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
{
|
||||
radioWeight == 1 &&
|
||||
<Row>
|
||||
@ -761,8 +828,27 @@ const DetailedMain: React.FC<detailType> = (props) => {
|
||||
</Collapse>
|
||||
)
|
||||
};
|
||||
const renderCategoryTitle = (subData: any) => {
|
||||
const baseText = radioWeight === 1
|
||||
? `所占权重:${subData.weights}% ; `
|
||||
: '';
|
||||
|
||||
let calcText = '';
|
||||
if (subData.calculationMethod === '1') {
|
||||
calcText = '计算方式:打分专家平均分; ';
|
||||
} else if (subData.calculationMethod === '2') {
|
||||
calcText = `计算方式:去掉最高最低分的平均分,去掉最高数量:${subData.removeMaxQuantity}人,去掉最低数量:${subData.removeMinQuantity}人; `;
|
||||
}
|
||||
|
||||
const scoreText = radioWeight === 1
|
||||
? `本表格内所有评分项计算后所得最高分:${(subData.weights * subCountScore(subData)) / 100} 分)`
|
||||
: `本表格内所有评分项计算后所得最高分:${subCountScore(subData)} 分)`;
|
||||
|
||||
return `${subData.name}(${baseText}${calcText}${scoreText}`;
|
||||
};
|
||||
//返回子类表格
|
||||
function returnTable(subData: any, mapindex: number, isBaojia?: boolean) {
|
||||
console.log("subData", subData);
|
||||
const confirm = async () => {
|
||||
const categoryName = subData.categoryName;
|
||||
setSpin(true);
|
||||
@ -773,7 +859,7 @@ const DetailedMain: React.FC<detailType> = (props) => {
|
||||
await queryDetData();
|
||||
}
|
||||
} else {
|
||||
categoryName == '商务' && setData1(data1.filter((item: any) => item.key != subData.key));
|
||||
categoryName == '商务' && setData1(data1.filter((item: any) => { console.log("商务item", item); item.key != subData.key }));
|
||||
categoryName == '技术' && setData2(data2.filter((item: any) => item.key != subData.key));
|
||||
categoryName == '服务' && setData3(data3.filter((item: any) => item.key != subData.key));
|
||||
categoryName == '报价' && setData4(data4.filter((item: any) => item.key != subData.key));
|
||||
@ -806,11 +892,12 @@ const DetailedMain: React.FC<detailType> = (props) => {
|
||||
<div className='xsy-config-table' id={`${subData.name}${subData.key}`} key={`${subData.name}${subData.key}div`}>
|
||||
<div style={{ height: '42px', lineHeight: '42px' }}>
|
||||
<h3 className='scd-title' style={{ float: 'left' }}>
|
||||
{
|
||||
{renderCategoryTitle(subData)}
|
||||
{/* {
|
||||
radioWeight == 1 ?
|
||||
subData.name + `( 所占权重:${subData.weights}% , 本表格内所有评分项计算后所得最高分:${(subData.weights * subCountScore(subData)) / 100} 分)`
|
||||
: subData.name + `( 本表格内所有评分项计算后所得最高分:${subCountScore(subData)} 分)`
|
||||
}
|
||||
} */}
|
||||
</h3>
|
||||
{
|
||||
!dis &&
|
||||
@ -825,7 +912,14 @@ const DetailedMain: React.FC<detailType> = (props) => {
|
||||
isUpdateCateSet(true);
|
||||
updataSet(subData);
|
||||
onRowCateNameSet(subData.categoryName);
|
||||
formModal.setFieldsValue({ name: subData.name, type: subData.categoryName, weights: subData.weights });
|
||||
formModal.setFieldsValue({
|
||||
name: subData.name,
|
||||
type: subData.categoryName,
|
||||
weights: subData.weights,
|
||||
calculationMethod: subData.calculationMethod,
|
||||
removeMaxQuantity: subData.removeMaxQuantity,
|
||||
removeMinQuantity: subData.removeMinQuantity,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<EditOutlined />{`修改`}
|
||||
@ -1130,13 +1224,17 @@ const DetailedMain: React.FC<detailType> = (props) => {
|
||||
}
|
||||
//新增、修改类别
|
||||
const typeControl = async (values: any) => {
|
||||
const { name, type, weights } = values;
|
||||
console.log("values", values)
|
||||
const { name, type, weights, calculationMethod, removeMaxQuantity, removeMinQuantity } = values;
|
||||
let tableId = Date.now();
|
||||
let subCate = {
|
||||
categoryName: type,//大类别名称
|
||||
weights: weights == undefined ? 100 : weights,
|
||||
name: name,//字类名
|
||||
tableId: tableId,
|
||||
calculationMethod: calculationMethod,
|
||||
removeMaxQuantity: removeMaxQuantity,
|
||||
removeMinQuantity: removeMinQuantity,
|
||||
key: 0,
|
||||
detailList: [{//初始值---新增用
|
||||
key: 0,
|
||||
@ -1191,6 +1289,9 @@ const DetailedMain: React.FC<detailType> = (props) => {
|
||||
upData.name = name;
|
||||
upData.categoryName = type;
|
||||
upData.weights = weights == undefined ? 100 : weights;
|
||||
upData.calculationMethod = calculationMethod;
|
||||
upData.removeMaxQuantity = removeMaxQuantity;
|
||||
upData.removeMinQuantity = removeMinQuantity;
|
||||
//删原数据
|
||||
if (oldCategoryName == '商务') {
|
||||
if (oldCategoryName != type) {
|
||||
|
Reference in New Issue
Block a user