code submit

mail@pastecode.io avatar
unknown
typescript
16 days ago
1.2 kB
2
Indexable
Never
 await this.submitFormData({
        code: 'REJECT',
        name: this.translate.instant('Từ chối duyệt')
      });

 await this.submitFormData({
        code: 'NEXT',
        name: this.translate.instant('Phê duyệt')
      });


 submitFormData = async (route, cloudToken?) => {
    const submitData = {
      comment: this.reason || this.currentFormData.comment || '',
      action: {
        code: route.code,
        name: route.name
      },
      cloudToken,
    };
    const taskId = (this.formData && this.formData.id) ? this.formData.id : null;
    try {
      if (this.reason) {
        const requestBody = {
          entityId: this.ecmNode.id,
          entityType: 'ecm_node',
          content: this.reason,
          mentionIdList: []
        };
        await this.commentService.addComment(requestBody);
        this.reason = '';
      }
      await this.taskService.completeTask(taskId, submitData);
      this.notifySuccess(this.translate.instant('Xử lý thành công'));
    } catch (error) {
      console.log('submit error: ', error);
      this.notifyError(this.translate.instant('Xử lý không được, vui lòng thử lại'));
      throw error;
    }
  }
Leave a Comment