如何在按钮单击时将行数据从一个表移动到另一个表

问题描述 投票:0回答:1

我有一个网格,在网格中,我有一个名为'Accept Case'的按钮,所以当我点击这个按钮时,该行应移动到另一个名为'My Cases'的组件,并应该从当前组件中删除。

这是我的'worklist.component.ts'

@Component({
    selector: 'workList',
    template: require('./WorkList.html'),
    providers: [HTTP_PROVIDERS,FileUploadService],
    directives: [ DataTableDirectives,HeaderComponent, SideMenuComponent, FooterComponent],
    pipes: [DatePipe, WorkListFilterPipe]
})
export class WorkListComponent {
    isActive: boolean = false;
    searchtxt:any;
    private data;
show:boolean =false;
    base64string: any;
    Data64ArrayBuffer: any;
    constructor(public fileUploadService:FileUploadService,authService: AuthService, private http: Http, public _authService: AuthService,public _IntegrationService: IntegrationService, private router: Router) {

        var data = authService.GetuserType();
        console.log(data);
   
        if (data==='admin' || data==='Admin')
        {
            this.show=true;this.getWorkList();
        }else
        {
            this.show=false;this.getWorkListReported();
        }
 


    }
    ngOnInit() {

         if (!this._authService.isUserLoggedIn()) {
             this.router.navigate(['',  'Login', { ret: 'Physicianapproval' }]);
         }

    }

    getWorkList() {
        
        this._IntegrationService
          .GetAllWorkList()
          .subscribe(
            (data: clsWorkList[]) => {
              setTimeout(() => {
                this.data = data;
              }, 1000);
            },
            error => {}
          );
      }
      getWorkListReported() {
        
        this._IntegrationService
          .getAllWorkListReported()
          .subscribe(
            (data: clsWorkList[]) => {
              setTimeout(() => {
                this.data = data;
              }, 1000);
            },
            error => {}
          );
      }

    clickme(element,text,accesionid){
element.textContent=text;
element.disabled=true;

这是我的worklist.html

 <header></header>
    <div class="page-content page-thin">
        <div class="row" style="background-color:white; height:700px">

            <div class="col-md-12">
                <div>
                    <div class="box" style="margin: 0px 6px 0px 9px;">
                        <div class="box-header b-b">
                            
 <h2 ><strong>Cases Queue</strong> </h2>
                        </div>
                        <div class="form-group col-md-push-9 col-md-3">

                            <input type="text" class="form-control" placeholder="Search" value="" name="Search" #listFilter (keyup)="0">

                        </div>
                        <style>
                            #tblworklist .text-nowrap {
                                white-space: normal;
                            }
                        </style>
                        <div class="row m-b-2">
                            <table id="tblworklist" class=" table-striped" style="width:100%" [mfData]="data" #mf="mfDataTable" [mfRowsOnPage]="25">
                                <thead>
                                    <tr>
                                        <th style="width:5%">
                                        Action
                                        </th>

                                        <th style="width: 5%">
                                            <mfDefaultSorter by="accessionNo">Accession Number</mfDefaultSorter>
                                        </th>
                                        <th style="width: 5%">
                                            <mfDefaultSorter by="caseNo">Case Number</mfDefaultSorter>
                                        </th>
                                        <th style="width: 10%">
                                            <mfDefaultSorter by="ordPhy">Ordering Physician</mfDefaultSorter>
                                        </th>
                                        <th style="width: 10%">
                                            <mfDefaultSorter by="name">Patient Last Name</mfDefaultSorter>
                                        </th>
                                        <th style="width: 10%">
                                            <mfDefaultSorter by="lastname">Patient First Name</mfDefaultSorter>
                                        </th>
                                        <th style="width: 5%">
                                            <mfDefaultSorter by="DOB">DOB</mfDefaultSorter>
                                        </th>
                                        <th style="width: 5%">
                                            <mfDefaultSorter by="orderDate">Ordered Date</mfDefaultSorter>
                                        </th>
                                        <th style="width: 5%">
                                            <mfDefaultSorter by="testsOrdered">Tests Ordered</mfDefaultSorter>
                                        </th>
                                        <th style="width: 8%">
                                            <mfDefaultSorter by="reportDate">Reported Date</mfDefaultSorter>
                                        </th>
                                        <th style="width: 10%">
                                            <mfDefaultSorter by="step">Step</mfDefaultSorter>
                                        </th>
                                        <th style="width: 5%">
                                            <mfDefaultSorter by="testsOrdered">Case Status</mfDefaultSorter>
                                        </th>


                                        <th style="width: 5%">Download Report</th>
                                    </tr>
                                </thead>

                                <tbody>
                                    <tr *ngFor="let item of mf.data | worklistFillter:listFilter.value">
                                        <td style="text-align: center;">
                                            <button (click)="clickme($event.target,'Accepted',item.accessionNo)">Accept Case</button>
                                        </td>
                                        <td><a  class="btn-sm primary" [routerLink]="['/AccessionRegister']">{{item.accessionNo}}</a></td>
                                        <td>
                                            <a *ngIf="item.step == 'Review & Approve' " style="cursor: pointer;" [routerLink]="['/ViewReport']">{{item.caseNo}}</a>
                                         </td>

                                        <td>{{item.ordPhy}}</td>

                                        <td>{{item.name}}</td>
                                        <td>{{item.lastname}}</td>
                                        <td>{{item.DOB}}</td>
                                        <td>{{item.orderDate}}</td>
                                        <td>{{item.testsOrdered}}</td>
                                        <td>{{item.reportDate}}</td>
                                        <td>{{item.step}}</td>
                                        <td style="text-align: center;">
                                            

                                            <a  style="color: green;font-size: x-large;    cursor: pointer;" [routerLink]="['/CaseStatus']"><i class='icon-rounded-mailbox'></i></a>

                                        </td>
                                        <td style="text-align: center;">
                                            <a *ngIf="item.step == 'Review & Approve'" style="color: green;font-size: x-large;    cursor: pointer;" (click)="download()"><i class='fa fa-download'></i></a>
                                        </td>
                                    </tr>
                                </tbody>
                                <tfoot>
                                    <tr>
                                        <td colspan="4">
                                            <mfBootstrapPaginator [rowsOnPageSet]="[25,50,100]"></mfBootstrapPaginator>
                                        </td>
                                    </tr>
                                </tfoot>
                            </table>


                        </div>
                    </div>
                </div>

            </div>
        </div>

当我点击“接受”按钮时,该行应显示在“我的案例”页面上,但不显示在那里。我对棱角分明是全新的。任何帮助,将不胜感激。

sql-server angular2-template angular2-forms
1个回答
0
投票

当我点击“接受”按钮时,该行应显示在“我的案例”页面上,但不显示在那里。我对棱角分明是全新的。任何帮助,将不胜感激。

我太新了角。但我知道SQL查询。从我的理解,我写这个,

-- Keyword 'OUTPUT Clause'
create table #cases (i int identity(1,1), cases varchar(10))
create table #mycase (i int identity(1,1), Uid int, CaseId int)


insert #cases (cases) values ('case 1'),('case 2'),('case 3'),('case 4'),('case 5')

declare @caseId int = 4 ----- get from front end.
, @uid int = 10 ----- who clicks button.

delete from #cases
output @uid,deleted.i
into #mycase (Uid, CaseId)
where i = @caseId

select * from #cases -- 4 th case is removed.
select * from #mycase -- 4 th case is added in his case table

如果查询需要更新,请将我还原。

© www.soinside.com 2019 - 2024. All rights reserved.