|
|
|
|
@ -165,22 +165,21 @@ export class AppController {
|
|
|
|
|
|
|
|
|
|
@Post("/visitor")
|
|
|
|
|
async create(@Body() data: CreateVisitor) {
|
|
|
|
|
// if (new Date(data.apply_date).toString() == "Invalid Date") {
|
|
|
|
|
// throw new BadRequestException("apply_date 格式不正确")
|
|
|
|
|
// }
|
|
|
|
|
// if (new Date(data.start_date).toString() == "Invalid Date") {
|
|
|
|
|
// throw new BadRequestException("start_date 格式不正确")
|
|
|
|
|
// }
|
|
|
|
|
// if (new Date(data.end_date).toString() == "Invalid Date") {
|
|
|
|
|
// throw new BadRequestException("end_date 格式不正确")
|
|
|
|
|
// }
|
|
|
|
|
if (new Date(data.apply_date).toString() == "Invalid Date") {
|
|
|
|
|
throw new BadRequestException("apply_date 格式不正确")
|
|
|
|
|
}
|
|
|
|
|
if (new Date(data.start_date).toString() == "Invalid Date") {
|
|
|
|
|
throw new BadRequestException("start_date 格式不正确")
|
|
|
|
|
}
|
|
|
|
|
if (new Date(data.end_date).toString() == "Invalid Date") {
|
|
|
|
|
throw new BadRequestException("end_date 格式不正确")
|
|
|
|
|
}
|
|
|
|
|
return await this.dataSource.transaction(async transactionalEntityManager => {
|
|
|
|
|
|
|
|
|
|
const new_node_visitor = new NodeVisitorEntity();
|
|
|
|
|
new_node_visitor.applicant = data.applicant;
|
|
|
|
|
new_node_visitor.applicant_department = data.applicant_department;
|
|
|
|
|
new_node_visitor.apply_date = data.apply_date;
|
|
|
|
|
// new_node_visitor.apply_date = new Date(data.apply_date).toLocaleDateString();
|
|
|
|
|
new_node_visitor.apply_date = new Date(data.apply_date).toLocaleDateString();
|
|
|
|
|
new_node_visitor.code = data.code;
|
|
|
|
|
new_node_visitor.visitor_type = data.visitor_type;
|
|
|
|
|
new_node_visitor.area = data.area;
|
|
|
|
|
@ -188,10 +187,8 @@ export class AppController {
|
|
|
|
|
new_node_visitor.visitor_number = data.visitor_number;
|
|
|
|
|
new_node_visitor.transport = data.transport;
|
|
|
|
|
new_node_visitor.plate_no = data.plate_no;
|
|
|
|
|
new_node_visitor.start_date = data.start_date;
|
|
|
|
|
new_node_visitor.end_date = data.end_date;
|
|
|
|
|
// new_node_visitor.start_date = new Date(data.start_date).toLocaleDateString();
|
|
|
|
|
// new_node_visitor.end_date = new Date(data.end_date).toLocaleDateString();
|
|
|
|
|
new_node_visitor.start_date = new Date(data.start_date).toLocaleDateString();
|
|
|
|
|
new_node_visitor.end_date = new Date(data.end_date).toLocaleDateString();
|
|
|
|
|
new_node_visitor.visited_staff = data.visited_staff;
|
|
|
|
|
new_node_visitor.visited_deparment = data.visited_deparment;
|
|
|
|
|
new_node_visitor.purpose = data.purpose;
|
|
|
|
|
|