1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import { Component, OnInit, Output, Input } from '@angular/core';
- import { EventEmitter } from '@angular/core';
- import { NzMessageService } from 'ng-zorro-antd';
- import { addDays, startOfMinute, format } from 'date-fns';
- @Component({
- selector: 'app-edit-inspect-info',
- templateUrl: './edit-inspect-info.component.html',
- styleUrls: ['./edit-inspect-info.component.less']
- })
- export class EditInspectInfoComponent implements OnInit {
- @Input() date:any;
- @Input() execDeptId:any;
- @Input() remarkText:any;
- @Input() execDeptList:any[] = [];
- @Output() submitFormHand = new EventEmitter();
- @Output() cancelFlagHand = new EventEmitter();
- yyDate = null; //预约日期-患者其他服务
- yyTime = null; //预约时间-患者其他服务
- deptId = null;
- remark = '';
- deptList:any[] = [];
- isLoading:boolean = false;
- constructor(
- private message: NzMessageService,
- ) { }
- ngOnInit() {
- if(this.date){
- this.yyDate = new Date(this.date);
- this.yyTime = new Date(this.date);
- }
- if(this.execDeptList){
- this.deptList = this.execDeptList;
- }
- console.log('this.remarkText:', this.remarkText)
- if(this.remarkText){
- this.remark = this.remarkText;
- }
- if(this.execDeptId){
- let flag = this.deptList.some(v => v.id == this.execDeptId);
- if(flag){
- this.deptId = this.execDeptId;
- }
- }
- }
- // 下一日(患者其他服务)
- nextDay() {
- this.yyDate = addDays(this.yyDate, 1);
- }
- // 隐藏模态框
- hideModal() {
- this.cancelFlagHand.emit(false)
- }
- // 表单提交
- submitForm(): void {
- if(!this.deptId) {
- this.message.warning('请选择检查科室!');
- return;
- }
- if(!this.yyDate || !this.yyTime) {
- this.message.warning('请选择完整预约时间!');
- return;
- }
- this.submitFormHand.emit({
- deptId: this.deptId,
- remark: this.remark,
- date: format(this.yyDate, 'yyyy-MM-dd') + ' ' + format(startOfMinute(this.yyTime), 'HH:mm:ss'),
- });
- }
- }
|