重写删除表格行的方法
This commit is contained in:
		
							parent
							
								
									57554f1ae3
								
							
						
					
					
						commit
						078aaa0188
					
				@ -15,11 +15,11 @@
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
            <tr v-for="r in rows">
 | 
			
		||||
            <tr v-for="(r,i) in rows">
 | 
			
		||||
                <td>{{r.Id}}</td>
 | 
			
		||||
                <td>{{r.Name}}</td>
 | 
			
		||||
                <td>{{r.Description}}</td>
 | 
			
		||||
                <td><input type="button" value="删除" v-on:click="remove(r.Id)" /></td>
 | 
			
		||||
                <td><input type="button" value="删除" v-on:click="remove(r.Id,i)" /></td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
@ -51,18 +51,10 @@
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            remove(id) {
 | 
			
		||||
            remove(id, i) {
 | 
			
		||||
                var url = myJs.url.app.RemoveApp;
 | 
			
		||||
                myJs.post(url, { id: id }, function (d) {
 | 
			
		||||
                    var nArr = [];
 | 
			
		||||
                    $.each(mydata.app_index.rows, function () {
 | 
			
		||||
                        if (this.Id != id) {
 | 
			
		||||
                            nArr.push(this);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                    mydata.app_index.rows = nArr;
 | 
			
		||||
                }, function (s, i, m) {
 | 
			
		||||
                    myJs.msg(m);
 | 
			
		||||
                    mydata.app_index.rows.splice(i, 1);
 | 
			
		||||
                });
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
@ -18,12 +18,12 @@
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
            <tr v-for="u in users">
 | 
			
		||||
            <tr v-for="(u,index) in users">
 | 
			
		||||
                <td>{{u.Id}}</td>
 | 
			
		||||
                <td>{{u.UserName}}</td>
 | 
			
		||||
                <td>{{u.Name}}</td>
 | 
			
		||||
                <td>{{u.Status}}</td>
 | 
			
		||||
                <td><input type="button" value="删除" v-on:click="removeUser(u.Id)" /></td>
 | 
			
		||||
                <td><input type="button" value="删除" v-on:click="removeUser(u.Id,index)" /></td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
@ -65,15 +65,9 @@
 | 
			
		||||
                    userIndex.tableShow = true;
 | 
			
		||||
                });
 | 
			
		||||
            },
 | 
			
		||||
            removeUser(id) {
 | 
			
		||||
            removeUser(id, index) {
 | 
			
		||||
                myJs.post(myJs.url.user.RemoveUser, { adminTicket: this.ticket, id: id }, function (d) {
 | 
			
		||||
                    var nArr = [];
 | 
			
		||||
                    $.each(userIndex.users, function () {
 | 
			
		||||
                        if (this.Id != id) {
 | 
			
		||||
                            nArr.push(this);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                    userIndex.users = nArr;
 | 
			
		||||
                    userIndex.users.splice(index, 1);
 | 
			
		||||
                });
 | 
			
		||||
            },
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user