|
@@ -0,0 +1,203 @@
|
|
|
+import { Component, OnInit } from '@angular/core';
|
|
|
+import { NzModalRef, NzMessageService, NzDrawerRef, NzNotificationService } from 'ng-zorro-antd';
|
|
|
+import { _HttpClient } from '@delon/theme';
|
|
|
+import { FbsAbnormalWorkingHours } from 'app/entity/fbs/fbs-abnormal-working-hours';
|
|
|
+import { FbsAbnormalWorkingHoursService } from 'app/services/fbs/fbs-abnormal-working-hours.service';
|
|
|
+import { DatePipe } from '@angular/common';
|
|
|
+import { FbsAbnormalWorkingHoursDescribe } from 'app/entity/fbs/fbs-abnormal-working-hours-describe';
|
|
|
+import { FbsAbnormalWorkingHoursType } from 'app/entity/fbs/fbs-abnormal-working-hours-type';
|
|
|
+
|
|
|
+@Component({
|
|
|
+ selector: 'app-fbs-abnormal-working-hours-update',
|
|
|
+ templateUrl: './update.component.html',
|
|
|
+ styles: [
|
|
|
+ `
|
|
|
+ .base {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0px;
|
|
|
+ width: 100%;
|
|
|
+ border-top: 1px solid rgb(232, 232, 232);
|
|
|
+ padding: 10px 16px;
|
|
|
+ text-align: right;
|
|
|
+ left: 0px;
|
|
|
+ background: #fff;
|
|
|
+ z-index: 99;
|
|
|
+ }
|
|
|
+ `,
|
|
|
+ ],
|
|
|
+})
|
|
|
+export class FbsAbnormalWorkingHoursUpdateComponent implements OnInit {
|
|
|
+ constructor(
|
|
|
+ private drawerRef: NzDrawerRef,
|
|
|
+ private fbsAbnormalWorkingHoursService: FbsAbnormalWorkingHoursService,
|
|
|
+ private nzNotificationService: NzNotificationService,
|
|
|
+ private datePipe: DatePipe,
|
|
|
+ ) {}
|
|
|
+
|
|
|
+ ngOnInit(): void {
|
|
|
+ this.getProperList();
|
|
|
+ this.getById().then(()=>{
|
|
|
+ return this.getDescribeListById()
|
|
|
+ }).then(()=>{
|
|
|
+ return this.getTypeById();
|
|
|
+ }).then(()=>{
|
|
|
+ this.saveLoading=false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ saveLoading = false;
|
|
|
+ fbsAbnormalWorkingHours: FbsAbnormalWorkingHours = {};
|
|
|
+ properList = [];
|
|
|
+
|
|
|
+ * 初始化人员下拉数据集合
|
|
|
+ */
|
|
|
+ getProperList() {
|
|
|
+ this.properList = [{ id: '张三', name: '张三' }];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 人员下拉款选择事件
|
|
|
+ */
|
|
|
+ personnelChange(personnelIdU8){
|
|
|
+
|
|
|
+ this.properList.forEach(element => {
|
|
|
+ if(personnelIdU8===element.id){
|
|
|
+ this.fbsAbnormalWorkingHours.name=element.name;
|
|
|
+ this.fbsAbnormalWorkingHours.personnelNameU8=element.name;
|
|
|
+ this.fbsAbnormalWorkingHours.productionLineName="电器组装";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 根据id查询主表数据
|
|
|
+ */
|
|
|
+ id = '';
|
|
|
+ getById() {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.saveLoading=true;
|
|
|
+ this.fbsAbnormalWorkingHoursService.getById(this.id).then(response => {
|
|
|
+ if(response.success){
|
|
|
+ this.fbsAbnormalWorkingHours=response.result;
|
|
|
+ resolve();
|
|
|
+ }else{
|
|
|
+ this.nzNotificationService.error("查询失败",response.message)
|
|
|
+ this.saveLoading=false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 查询异常工时描述
|
|
|
+ */
|
|
|
+ getDescribeListById(){
|
|
|
+ return new Promise((resolve)=>{
|
|
|
+
|
|
|
+ let fbsAbnormalWorkingHoursDescribe=new FbsAbnormalWorkingHoursDescribe();
|
|
|
+ fbsAbnormalWorkingHoursDescribe.pageSize=1000;
|
|
|
+ fbsAbnormalWorkingHoursDescribe.abnormalWorkingHoursId=this.fbsAbnormalWorkingHours.id;
|
|
|
+
|
|
|
+ this.fbsAbnormalWorkingHoursService.getDescribeList(fbsAbnormalWorkingHoursDescribe).then((response)=>{
|
|
|
+ this.describeList=response.result.records;
|
|
|
+ this.describeSort=this.describeList.length+1;
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 查询异常工时类别
|
|
|
+ */
|
|
|
+ getTypeById(){
|
|
|
+ return new Promise((resolve)=>{
|
|
|
+
|
|
|
+ let fbsAbnormalWorkingHoursType=new FbsAbnormalWorkingHoursType();
|
|
|
+ fbsAbnormalWorkingHoursType.pageSize=1000;
|
|
|
+ fbsAbnormalWorkingHoursType.abnormalWorkingHoursId=this.fbsAbnormalWorkingHours.id;
|
|
|
+
|
|
|
+ this.fbsAbnormalWorkingHoursService.getTypeList(fbsAbnormalWorkingHoursType).then((response)=>{
|
|
|
+ this.typeList=response.result.records;
|
|
|
+ this.typeSort=this.typeList.length+1;
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ describeList = [];
|
|
|
+
|
|
|
+ * 描述增加行按钮
|
|
|
+ */
|
|
|
+ describeSort = 1;
|
|
|
+ describeAddRow() {
|
|
|
+ this.describeList = [
|
|
|
+ ...this.describeList,
|
|
|
+ {
|
|
|
+ describe: '',
|
|
|
+ sort: this.describeSort,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.describeSort++;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 删除行
|
|
|
+ */
|
|
|
+ describeDeleteRow(sort) {
|
|
|
+ this.describeList = this.describeList.filter(d => d.sort !== sort);
|
|
|
+ }
|
|
|
+
|
|
|
+ typeList = [];
|
|
|
+
|
|
|
+ * 异常类型增加行按钮
|
|
|
+ */
|
|
|
+ typeSort = 1;
|
|
|
+ typeAddRow() {
|
|
|
+ this.typeList = [
|
|
|
+ ...this.typeList,
|
|
|
+ {
|
|
|
+ typeName: '',
|
|
|
+ sort: this.typeSort,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.typeSort++;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 删除行
|
|
|
+ */
|
|
|
+ typeDeleteRow(sort) {
|
|
|
+ this.typeList = this.typeList.filter(d => d.sort !== sort);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 保存按钮
|
|
|
+ */
|
|
|
+ save() {
|
|
|
+ this.saveLoading=true;
|
|
|
+
|
|
|
+ this.fbsAbnormalWorkingHours.date = this.datePipe.transform(
|
|
|
+ this.fbsAbnormalWorkingHours.date,
|
|
|
+ 'yyyy-MM-dd HH:mm:ss',
|
|
|
+ );
|
|
|
+ this.fbsAbnormalWorkingHours.fbsAbnormalWorkingHoursDescribeList = this.describeList;
|
|
|
+ this.fbsAbnormalWorkingHours.fbsAbnormalWorkingHoursTypeList = this.typeList;
|
|
|
+ this.fbsAbnormalWorkingHoursService.updateAndChild(this.fbsAbnormalWorkingHours).then(response => {
|
|
|
+ if (response.success) {
|
|
|
+
|
|
|
+ this.nzNotificationService.success('保存成功', '');
|
|
|
+ this.saveLoading = false;
|
|
|
+ this.drawerRef.close(true);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ this.nzNotificationService.error('保存失败',response.message);
|
|
|
+ this.saveLoading = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ close() {
|
|
|
+
|
|
|
+ this.drawerRef.close();
|
|
|
+ }
|
|
|
+}
|