2017-07-26 65 views
0
  • 我是新的角2和typescript。
  • 我在我的代码中面对下面的错误。
  • 我搜索了错误,他们要求包括进口报表。
  • 但仍然错误不会发生。
  • 你能告诉我如何解决它。
  • 下面提供代码和错误。
  • 我思念的东西
  • 我尝试了所有可能的解决方案
///<reference path="../../../assets/js/jquery/jquery.d.ts" /> 
import {NgModule, CUSTOM_ELEMENTS_SCHEMA,Component, ElementRef, Inject, OnInit, ViewChild} from '@angular/core'; 
import {Http,HttpModule, Response,Headers, RequestOptions } from '@angular/http'; 
import {KendoGridComponent} from '../grid/grid.component'; 
//import { TranslateService } from '../../translate/translate.service'; 
import { SPORTSService } from '../../services/sports.service'; 
import {jumpService} from '../jump/jumpService'; 


import { FormsModule } from '@angular/forms'; 
import {Observable} from 'rxjs/Rx'; 
declare let $:any; 



@Component({ 
    selector: 'PaperDocuments', 
    template: `<div id="windowcontainer"></div>` 
}) 


export class PaperDocuments { 

    @ViewChild(KendoGridComponent) private gridmobile: KendoGridComponent; 
    private dataSourceVal; 
    private MainGrid; 
    private grid; 
    private isVisible = false; 
    public toggleCollapse : string; 
    private kPopUpWindowViewHistory; 
    private fileName; 
    private scrollClicked; 
    private dynamicnetwks; 

     /*Localization*/ 
    public show: string; 
    public all: string; 
    public entries: string; 
    public cancelBtn: string; 
    public okBtn: string; 
    public attachBtn:string; 
    public elfBtn: string; 
    public browseBtn:string; 
    public dragDrop: string; 
    public clearBtn:string; 
    public attachmentType:string; 
    public fileSelect:string; 


    private Type = ["PRM", "STR","FRT", "Urban Legends"]; 
    private isDone: boolean = true 
    private filesToUpload: Array<File>; 
    private files = []; 
    private url = "http://localhost:3002/upload"; 
    private dialogCommand; 
    public encodeBase64:any; 
    public isContractLocked=false; 
    private loggedUserName; 
    private documentType=''; 
    public elfDocIDTemp; 
    public openFlag = false; 
    private selectedoptions; 
    //private fileSelected = false; 

    private mobilecommand = { 
     edit: { 
      createAt: "bottom" 
     }, 
     group: true, 
     reorder: true, 
     resize: true, 
     sort: true, 
     autoBind: false, 
     filter: { 
      mode: "menu" 
     }, 
     pager: { 
      messages: { 
      display: "Showing {0} to {1} of {2} entries" 
      } 
     }, 
     model: {}, 
     columns: [], 
     pagesize: 50, 
     getComponentUrl: "jumps/v1/jumps/35355?includes=payments", 
     postComponentUrl: "jumps/v1/jumps/35355?includes=payments", 
     excelfileUidName: "ViewPaymentExport", 
     isLevels: false, 
     excelFileName: { 
      fileName: "ViewPaymentExport", 
      allPages: true 
     }, 
     contextMenuId: "context-menuAllocation", 
     navigate: false, 
     data: "", 
     mandatoryFields: [], 
     disableFreeze: true, 
     searchFields: [], 
     defaultSort: [] 
    }; 

    constructor(public sportsService : SPORTSService){ 

    } 

    ngOnInit() { 

     this.documentType='Contract'; 
     this.privilegeSettings(); 

     let that=this; 


     this.jumpservice.reloadDocumentEventReceived.subscribe(documents=>{ 
       that.documentType="Contract"; 
       $('.addELFDocumentForm').hide(); 
       that.isDone = true; 
       that.dragDrop= that.clearBtn; 
       $("#attachDocumentBrowseBtn").val(''); 
       if(documents.isReLoad){ 
        this.mobilecommand.getComponentUrl='jumps/v1/jumps/'+documents.data+'?includes=documents';// 
        that.gridmobile.getServiceCall(documents.data); 

       }else{ 
       that.rowDotMenuClick({"selectedMenuItem":"setData","type":"normalService","data":documents.data}); 
       }    
     }); 


     this.mobilecommand.model={ 
       id: "documentId", 
       fields: { 
        contextRow:{editable:false,filterable:true}, 
        docId:{editable:true,filterable:false,sortable:false}, 
        documentName: { editable: false, nullable: true }, 
        //elfDocID: { editable: false, nullable: true }, 
        elfDocID: { 
        validation: { 
         required: true, 
         digits:true               
        }                    
       }, 
        url: { editable: false, nullable: true }, 
        documentType: { editable: false, nullable: true }, 
        date: { editable: false, nullable: true } 
       } 
     }; 

     this.mobilecommand.columns=[ 
           { 
            field: "contextRow", width: 25, title:" ", 
            template:""/*'<span class="contextMenuRow" id="contextMenuRowid"></span>'*//*"<span class='fa fa-file docIcon' id='dcms'></span>"*/ 
           }, 
           { 
            field: "docId", width: 25, title:" ",sortable:false, 
            /*template:"<span class='documentIcon displayInlineBlock'></span>"/*,*/ 

            template: function name(model) { 
             return that.ImageType(model); 
            }, 
            editor:function (container,model){ 
             that.docTemplateEditor(container,model,that); 
            } 
           } 
          ]; 

    } 

    privilegeSettings():void{ 
     let userPrivilege = this.sportsservice.getUserPrivilege({"parent":"Contract Management","child":"Documents"}) 
     if(userPrivilege == "Full"){ 
      this.isContractLocked = false; 
     }else{ 
      this.isContractLocked = true; 
     } 
    } 

    running(values):void{ 
     let that = this; 
     $("#windowcontainer").append(`<div class="allocationViewHistoryPopUpBox"> 

      <div id="viewHistoryPopUpWindow" class="mobilepobUpBox"> 
       <div class="row mobilePopUpHeader"> 
        <div class="mobilePopUpHeaderTitleBox"> 
         <h4 class="">Documents</h4> 
        </div> 
        <div class="mobilePopUpHeaderActionsBox"> 
         <button class="clearBtn triggerKPopUpClickViewHistory" type="button" id="closePopup">CLOSE</button> 
        </div> 
       </div> 
       <div class="clearFloat"></div> 

       <div class="row mobilePopUpGridCollection padBottom0Imp"> 
        <div id="popup-loading"></div> 
        <div class="col-xs-12 pad0Imp borderHistoryGridTop"> 
         <div id="viewHistoryPopUpGrid" class="kGridStaticFilter"></div> 
        </div> 
        <div class="clearFloat"></div> 
       </div> 
       <div class="clearFloat"></div> 

       <label class="commonLink cursorPointer vAlignTop lineHeightInputs" (click)="browseButton()" id="forAttachDocumentBrowseBtn" [class.disabled]="isContractLocked">BROWSE{{browseBtn}}</label> 
      </div> 





      </div>`); 

     let viewHistoryPopUpGrid =[]; 

     that.dataSourceVal = new mobile.data.DataSource({ 
      transport: { 
       read: function(e) { 
        e.success(viewHistoryPopUpGrid); 
       } 
      }, 
      sort: true, 
      group: [{field: values.group}] 
      //ignoreCase: false //<--ignore the casing will stop applying .toLowerCase() 
     // filter: "gte" //<-- filter operator compliant with `number` type 
     }); 

     that.MainGrid = { 
      dataSource: that.dataSourceVal, 
      reorderable:true, 
      sortable: true, 
      filterable: {mode:"row, menu"}, 
      dataBound:function(e){ 
       let gridDataSource = e.sender.dataSource; 
       console.log('history',e) 
        if (gridDataSource.group().length > 0) { 
         $("#collapseBtn123").removeClass('actionDisabled') 
        }else{ 
         that.toggleCollapse="COLLAPSE ALL"; 
         $('#collapseBtn123').text(that.toggleCollapse); 
         $("#collapseBtn123").addClass('actionDisabled') 
        } 
       }, 
      groupable:true, 
      editable: false, 
      columns: values.columns, 
      pageable:{messages: {display: "Showing {0} to {1} of {2} entries"}}, 
      pageSize:50, 
     }; 

     that.kPopUpWindowViewHistory = $("#viewHistoryPopUpWindow"); 

     // $("#closePopup").click(function(){ 
     // that.closePopup(); 
     // console.log("click"); 
     // }); 

     // $("#collapseBtn123").click(function(){ 
     // that.collapseBtn(); 
     // }); 

     that.kPopUpWindowViewHistory.mobileWindow({ 
         width: "80%", 
         title: false, 
         visible: true, 
         resizable: false, 
         actions: false, 
         draggable: false, 
         modal: true, 
         ignoreCase: false, //<--ignore the casing will stop applying .toLowerCase() 
         filter: "gte", //<-- filter operator compliant with `number` type 
         open:function(e) { 
          let windowHeight = $(window).outerHeight(); 
          //let popupHeight = $('.k-widget.k-window').outerHeight(); 
          let popupHeight = 500; 
          console.log(windowHeight, popupHeight); 
          if(popupHeight < windowHeight) { 
           $("html, body").css("overflow", "hidden"); 
          } else { 

          } 
         }, 

         close: function(e) { 
          $("html, body").css("overflow", ""); that.isVisible=false; 
         }, 

         deactivate: function() { 
          this.destroy(); 
          console.log("deactivate Call");        
         } 

         // closePopup: function() { 
        //  this.kPopUpWindowViewHistory.data("mobileWindow").close(); 
         // } 

     }); 

     that.kPopUpWindowViewHistory.data("mobileWindow").center();   
     that.kPopUpWindowViewHistory.data("mobileWindow").open(); 

     $(".k-window").css("top", "15%"); 

     // closePopup(): void { 
     //  //this.isVisible = false; 
     //  this.kPopUpWindowViewHistory.data("mobileWindow").close(); 
     // } 


    } 

} 




-MacBook-Pro:webapp Raj$ npm start 

> [email protected] start /Users/Raj/Desktop/nbc/webcomponent/src/main/webapp 
> tsc && concurrently "npm run tsc:w" "npm run lite" 

app/components/skys/sky-documents.ts(129,8): error TS2339: Property 'jumpservice' does not exist on type 'PaperDocuments'. 
app/components/skys/sky-documents.ts(140,10): error TS2339: Property 'rowDotMenuClick' does not exist on type 'PaperDocuments'. 
app/components/skys/sky-documents.ts(200,23): error TS2339: Property 'ImageType' does not exist on type 'PaperDocuments'. 
app/components/skys/sky-documents.ts(203,16): error TS2339: Property 'docTemplateEditor' does not exist on type 'PaperDocuments'. 
app/components/skys/sky-documents.ts(211,28): error TS2339: Property 'sportsservice' does not exist on type 'PaperDocuments'. 
npm ERR! code ELIFECYCLE 
npm ERR! errno 2 
npm ERR! [email protected] start: `tsc && concurrently "npm run tsc:w" "npm run lite" ` 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the [email protected] start script. 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /Users/Raj/.npm/_logs/2017-07-26T03_44_36_683Z-debug.log 

回答

0

你需要注入jumpservice到你的构造

constructor(public sportsService : SPORTSService, private _jumpService : jumpService){ 
} 

,并把它作为,

this._jumpService

+0

但还是同样的错误:( –

+0

你需要检查whehter你已经宣布他们的其他变量相同的方式。也做一个干净的,并重新启动应用程序 – Sajeetharan

+0

嗨...你能告诉我哪些变量? –

相关问题