更新版本库
This commit is contained in:
228
src/pages/Evaluation/BidAbnormal/index.tsx
Normal file
228
src/pages/Evaluation/BidAbnormal/index.tsx
Normal file
@ -0,0 +1,228 @@
|
||||
import React, { useState, useRef } from 'react';
|
||||
import { Space, Button, message, Modal, Form, Input } from 'antd';
|
||||
import '@/assets/ld_style.less';
|
||||
import ProTable from '@ant-design/pro-table';
|
||||
import { getQuestion, addQuestion, dellQuestion, changeQuestion, changeResult } from './service';
|
||||
import { getRoomId } from '@/utils/session';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
const Index: React.FC<{}> = () => {
|
||||
const actionRef = useRef<any>();
|
||||
const [delVisible, setDelVisible] = useState<boolean>(false); // 删除
|
||||
const [addVisible, setAddVisible] = useState<boolean>(false); // 新增
|
||||
const [addForm] = Form.useForm(); // 新增表单
|
||||
const [delId, setDelId] = useState<any>(); // 删除id
|
||||
const [changeId, setChangeId] = useState<any>(); // 修改id
|
||||
const [title, setTitle] = useState<any>(); // 新增修改弹窗标题
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '序号',
|
||||
render: (text: any, record: any, index: any) => `${index + 1}`
|
||||
},
|
||||
{
|
||||
title: '异常情况',
|
||||
dataIndex: 'question',
|
||||
},
|
||||
{
|
||||
title: '原因',
|
||||
dataIndex: 'reason',
|
||||
},
|
||||
{
|
||||
title: '处理措施',
|
||||
dataIndex: 'treatmentMeasure',
|
||||
},
|
||||
{
|
||||
title: '处理结果',
|
||||
dataIndex: 'processResult',
|
||||
},
|
||||
{
|
||||
title: '记录人',
|
||||
dataIndex: 'recorder',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remarks',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 100,
|
||||
render: (text: any, record: any) => (
|
||||
<Space>
|
||||
<Button type="link" danger onClick={() => openVisible(2, record.id)}>修改</Button>
|
||||
<Button type="link" danger onClick={() => delQuestion(record)} >删除</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const openVisible = (val: any, id: any) => { // 新增&修改
|
||||
setAddVisible(true)
|
||||
if (val == 1) { // 新增
|
||||
setTitle('新增异常')
|
||||
setChangeId('')
|
||||
} else { // 修改
|
||||
setTitle('修改异常')
|
||||
changeQuestion(id).then((res) => {
|
||||
if (res.code == 200) {
|
||||
addForm.setFieldsValue({
|
||||
processResult: res.data.processResult,
|
||||
question: res.data.question,
|
||||
reason: res.data.reason,
|
||||
recorder: res.data.recorder,
|
||||
remarks: res.data.remarks,
|
||||
treatmentMeasure: res.data.treatmentMeasure
|
||||
})
|
||||
setChangeId(res.data.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const resetVal = () => { // 表单重置
|
||||
addForm.resetFields()
|
||||
}
|
||||
|
||||
const saveForm = () => { // 保存新增表单
|
||||
let date = {
|
||||
assessRoomId: getRoomId(),
|
||||
processResult: addForm.getFieldsValue().processResult,
|
||||
question: addForm.getFieldsValue().question,
|
||||
reason: addForm.getFieldsValue().reason,
|
||||
recorder: addForm.getFieldsValue().recorder,
|
||||
remarks: addForm.getFieldsValue().remarks,
|
||||
treatmentMeasure: addForm.getFieldsValue().treatmentMeasure,
|
||||
}
|
||||
addQuestion({ ...date }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
message.success('新增成功!')
|
||||
setAddVisible(false)
|
||||
actionRef.current.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const changeForm = () => { // 保存修改表单
|
||||
let date = {
|
||||
id: changeId,
|
||||
assessRoomId: getRoomId(),
|
||||
processResult: addForm.getFieldsValue().processResult,
|
||||
question: addForm.getFieldsValue().question,
|
||||
reason: addForm.getFieldsValue().reason,
|
||||
recorder: addForm.getFieldsValue().recorder,
|
||||
remarks: addForm.getFieldsValue().remarks,
|
||||
treatmentMeasure: addForm.getFieldsValue().treatmentMeasure,
|
||||
}
|
||||
changeResult({ ...date }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
message.success('修改成功!')
|
||||
setAddVisible(false)
|
||||
actionRef.current.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const delQuestion = (val: any) => { // 删除
|
||||
setDelId(val.id)
|
||||
setDelVisible(true)
|
||||
}
|
||||
|
||||
const subDel = () => { // 确定删除
|
||||
dellQuestion(delId).then((res) => {
|
||||
if (res.code == 200) {
|
||||
message.success('删除成功!')
|
||||
setDelVisible(false)
|
||||
actionRef.current.reload()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="bidContent">
|
||||
<div className="borderB">
|
||||
<span>异常情况记录表</span>
|
||||
<div className="block">
|
||||
<Space>
|
||||
<Button type="primary" onClick={() => openVisible(1, '')}>新增</Button>
|
||||
<Button type="primary">打印</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
<ProTable
|
||||
actionRef={actionRef}
|
||||
columns={columns}
|
||||
params={{
|
||||
assessRoomId: getRoomId()
|
||||
}}
|
||||
request={async (params) =>
|
||||
await getQuestion(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
let data = res.data;
|
||||
return Promise.resolve({
|
||||
data: data.records,
|
||||
success: res.success,
|
||||
total: res.data.total,
|
||||
current: res.data.current,
|
||||
});
|
||||
}
|
||||
return Promise.resolve({
|
||||
data: [],
|
||||
success: false,
|
||||
total: 0,
|
||||
current: 1,
|
||||
});
|
||||
})
|
||||
}
|
||||
pagination={{ defaultPageSize: 10 }}//默认显示条数
|
||||
toolBarRender={false}
|
||||
search={false}
|
||||
bordered
|
||||
/>
|
||||
</div>
|
||||
<Modal // 新增
|
||||
title={title}
|
||||
width={800}
|
||||
visible={addVisible}
|
||||
onCancel={() => setAddVisible(false)}
|
||||
footer={[
|
||||
changeId ? <Button type="primary" onClick={changeForm}>保存</Button> : <Button type="primary" onClick={saveForm}>保存</Button>,
|
||||
<Button type="primary" onClick={resetVal}>重置</Button>,
|
||||
<Button onClick={() => setAddVisible(false)} >取消</Button>
|
||||
]}
|
||||
>
|
||||
<Form className="addForm" form={addForm}>
|
||||
<Form.Item className="w50" label="异常情况" name="question" rules={[{ required: true, message: '请填写异常情况!' }]}>
|
||||
<TextArea rows={2} />
|
||||
</Form.Item>
|
||||
<Form.Item className="w50" label="原因" name="reason">
|
||||
<TextArea rows={2} />
|
||||
</Form.Item>
|
||||
<Form.Item className="w50" label="处理措施" name="treatmentMeasure">
|
||||
<TextArea rows={2} />
|
||||
</Form.Item>
|
||||
<Form.Item className="w50" label="处理结果" name="processResult">
|
||||
<TextArea rows={2} />
|
||||
</Form.Item>
|
||||
<Form.Item className="label" label="记录人" name="recorder">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item className="label" label="备注(100个字符,50汉字之内)" name="remarks">
|
||||
<TextArea rows={2} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
<Modal // 删除
|
||||
width={300}
|
||||
centered
|
||||
visible={delVisible}
|
||||
onCancel={() => setDelVisible(false)}
|
||||
onOk={subDel}
|
||||
>
|
||||
确定删除吗?
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Index;
|
66
src/pages/Evaluation/BidAbnormal/service.ts
Normal file
66
src/pages/Evaluation/BidAbnormal/service.ts
Normal file
@ -0,0 +1,66 @@
|
||||
import request from "@/utils/request";
|
||||
/*
|
||||
* @Author: liqiang
|
||||
* @Date: 2020-12-16 16:14:58
|
||||
* @LastEditTime: 2020-12-22 14:53:52
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: \ebtp-cloud-frontend\src\pages\BidPreliminaryManager\components\service.ts
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取评标异常列表
|
||||
* @param param
|
||||
*/
|
||||
export async function getQuestion(param: any) {
|
||||
return request('/api/biz-service-ebtp-rsms/v1/bid/eval/question/page', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...param,
|
||||
pageNo: param.current,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评标异常
|
||||
* @param param
|
||||
*/
|
||||
export async function addQuestion(data: any) {
|
||||
return request('/api/biz-service-ebtp-rsms/v1/bid/eval/question', {
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评标异常
|
||||
* @param param
|
||||
*/
|
||||
export async function changeResult(data: any) {
|
||||
return request('/api/biz-service-ebtp-rsms/v1/bid/eval/question', {
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评标异常
|
||||
* @param param
|
||||
*/
|
||||
export async function dellQuestion(id: any) {
|
||||
return request('/api/biz-service-ebtp-rsms/v1/bid/eval/question/'+id, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评标异常
|
||||
* @param param
|
||||
*/
|
||||
export async function changeQuestion(id: any) {
|
||||
return request('/api/biz-service-ebtp-rsms/v1/bid/eval/question/'+id, {
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user