<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
#myDiv, #myDiv1 {
display: none;
}
table tr:first-of-type {
background: #808080;
}
</style>
<script src="../javascript/jquery-1.8.0.min.js"></script>
<script src="../javascript/angular.min.js"></script>
<script src="../javascript/dps.js"></script>
</head>
<body ng-controller="myController">
<p>
<input type="button" value="Add" id="add" ng-click="add()"/>
</p>
<table width="100%" align="center">
<tr>
<th>姓名</th>
<th>性别</th>
<th>生日</th>
<th>身份证号</th>
<th>电话</th>
<th>地址</th>
<th>email</th>
<th>QQ</th>
<th></th>
<th></th>
</tr>
<tr style="text-align:center;" ng-repeat="item in items">
<td ng-bind="item.xingming"></td>
<td ng-bind="item.sex"></td>
<td ng-bind="item.birth"></td>
<td ng-bind ="item.sfz"></tdng-bind>
<td ng-bind="item.tel"></td>
<td ng-bind="item.dizhi"></td>
<td ng-bind="item.emial"></td>
<td ng-bind="item.qq"></td>
<td><input type="button" value="Edit" ng-click="edit($index)" /></td>
<td><input type="button" value="Delete" ng-click="delete($index)" /></td>
</tr>
</table>
<div id="myDiv">
<form id="EditForm">
<table width="100%" align="center">
<tr><th>姓名</th><th>性别</th><th>生日</th></tr>
<tr style="text-align:center;">
<td><input type="text" ng-model="item.xingming" /></td>
<td><input type="text" ng-model="item.sex" /></td>
<td><input type="text" ng-model="item.birth"/></td>
</tr>
<tr>
<td colspan="3">
<input type="button" value="submit" id="submit" ng-click="submit()"/>
<input type="button" value="cancel" id="cancel" ng-click="cancel()" />
</td>
</tr>
</table>
</form>
</div>
<div id="myDiv1">
<form id="EditForm1">
<table width="100%" align="center">
<tr><th>姓名</th><th>性别</th><th>生日</th></tr>
<tr style="text-align:center;">
<td><input type="text" id="name" /></td>
<td><input type="text" id="sex" /></td>
<td><input type="text" id="birth" /></td>
</tr>
<tr>
<td colspan="3">
<input type="button" value="submit" id="submit1" ng-click="submit1()" />
</td>
</tr>
</table>
</form>
</div>
<script>
$(function () {
$("table tr:odd").css("background", "#eeeeee");
});
angular.module("myApp", [])
.controller("myController", function ($http, $scope) {
//数据呈现
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
}).success(function (msg) {
$scope.items = msg.rows;
var aa = 0;
var bb = {};
var arra = {};
//更改
$scope.edit = function (index) {
$("#myDiv").show();
$scope.item = msg.rows[index];
aa = index;//获取当前索引值
arra = $.extend(true, {},msg.rows);//实现数组的浅复制
bb = arra[index];//获取当前对象
}
$scope.submit = function () {
delete $scope.item.ui_user_org;
delete $scope.item.ui_user_role;
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$Update", _parameters: $.toJSON([{ t: 90, m: "NLJMS.Models$ui_user", d: $scope.item }]) }
}).success(function () {
$("#myDiv").hide();
})
}
$scope.cancel = function () {
$("#myDiv").hide();
$scope.items[aa] = bb;
//$http({
// method: 'get',
// url: '/Invoke.ashx',
// params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
//}).success(function (msg) {
// $scope.items = msg.rows;
//})
}
//add
$scope.add = function () {
$("#myDiv1").show();
}
$scope.submit1 = function () {
var json = {};
var name = $("#name").val();
var sex = $("#sex").val();
var birth = $("#birth").val();
json.sex = sex;
json.account = name;
json.password = name;
json.password1 = name;
json.xingming = name;
json.sfz = name;
json.tel = name;
json.email = name;
json.qq = name;
json.dizhi = name;
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$Add", _parameters: $.toJSON([{ t: 90, m: "NLJMS.Models$ui_user", d: json }]) }
}).success(function () {
$("#myDiv1").hide();
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
}).success(function (msg) {
$scope.items = msg.rows;
})
})
}
//delete
$scope.delete = function (index) {
var id = msg.rows[index].id;
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$DeleteList", _parameters: $.toJSON([{ t: 16, d: id }]) }
}).success(function () {
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
}).success(function (msg) {
$scope.items = msg.rows;
})
})
}
})
})
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
#myDiv, #myDiv1 {
display: none;
}
table tr:first-of-type {
background: #808080;
}
</style>
<script src="../javascript/jquery-1.8.0.min.js"></script>
<script src="../javascript/angular.min.js"></script>
<script src="../javascript/dps.js"></script>
</head>
<body ng-controller="myController">
<p>
<input type="button" value="Add" id="add" ng-click="add()"/>
</p>
<table width="100%" align="center">
<tr>
<th>姓名</th>
<th>性别</th>
<th>生日</th>
<th>身份证号</th>
<th>电话</th>
<th>地址</th>
<th>email</th>
<th>QQ</th>
<th></th>
<th></th>
</tr>
<tr style="text-align:center;" ng-repeat="item in items">
<td ng-bind="item.xingming"></td>
<td ng-bind="item.sex"></td>
<td ng-bind="item.birth"></td>
<td ng-bind ="item.sfz"></tdng-bind>
<td ng-bind="item.tel"></td>
<td ng-bind="item.dizhi"></td>
<td ng-bind="item.emial"></td>
<td ng-bind="item.qq"></td>
<td><input type="button" value="Edit" ng-click="edit($index)" /></td>
<td><input type="button" value="Delete" ng-click="delete($index)" /></td>
</tr>
</table>
<div id="myDiv">
<form id="EditForm">
<table width="100%" align="center">
<tr><th>姓名</th><th>性别</th><th>生日</th></tr>
<tr style="text-align:center;">
<td><input type="text" ng-model="item.xingming" /></td>
<td><input type="text" ng-model="item.sex" /></td>
<td><input type="text" ng-model="item.birth"/></td>
</tr>
<tr>
<td colspan="3">
<input type="button" value="submit" id="submit" ng-click="submit()"/>
<input type="button" value="cancel" id="cancel" ng-click="cancel()" />
</td>
</tr>
</table>
</form>
</div>
<div id="myDiv1">
<form id="EditForm1">
<table width="100%" align="center">
<tr><th>姓名</th><th>性别</th><th>生日</th></tr>
<tr style="text-align:center;">
<td><input type="text" id="name" /></td>
<td><input type="text" id="sex" /></td>
<td><input type="text" id="birth" /></td>
</tr>
<tr>
<td colspan="3">
<input type="button" value="submit" id="submit1" ng-click="submit1()" />
</td>
</tr>
</table>
</form>
</div>
<script>
$(function () {
$("table tr:odd").css("background", "#eeeeee");
});
angular.module("myApp", [])
.controller("myController", function ($http, $scope) {
//数据呈现
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
}).success(function (msg) {
$scope.items = msg.rows;
var aa = 0;
var bb = {};
var arra = {};
//更改
$scope.edit = function (index) {
$("#myDiv").show();
$scope.item = msg.rows[index];
aa = index;//获取当前索引值
arra = $.extend(true, {},msg.rows);//实现数组的浅复制
bb = arra[index];//获取当前对象
}
$scope.submit = function () {
delete $scope.item.ui_user_org;
delete $scope.item.ui_user_role;
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$Update", _parameters: $.toJSON([{ t: 90, m: "NLJMS.Models$ui_user", d: $scope.item }]) }
}).success(function () {
$("#myDiv").hide();
})
}
$scope.cancel = function () {
$("#myDiv").hide();
$scope.items[aa] = bb;
//$http({
// method: 'get',
// url: '/Invoke.ashx',
// params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
//}).success(function (msg) {
// $scope.items = msg.rows;
//})
}
//add
$scope.add = function () {
$("#myDiv1").show();
}
$scope.submit1 = function () {
var json = {};
var name = $("#name").val();
var sex = $("#sex").val();
var birth = $("#birth").val();
json.sex = sex;
json.account = name;
json.password = name;
json.password1 = name;
json.xingming = name;
json.sfz = name;
json.tel = name;
json.email = name;
json.qq = name;
json.dizhi = name;
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$Add", _parameters: $.toJSON([{ t: 90, m: "NLJMS.Models$ui_user", d: json }]) }
}).success(function () {
$("#myDiv1").hide();
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
}).success(function (msg) {
$scope.items = msg.rows;
})
})
}
//delete
$scope.delete = function (index) {
var id = msg.rows[index].id;
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$DeleteList", _parameters: $.toJSON([{ t: 16, d: id }]) }
}).success(function () {
$http({
method: 'get',
url: '/Invoke.ashx',
params: { m: "NLJMS.BusinessLayer$UserService$PageList", _parameters: $.toJSON([{ t: 16, d: "" }]) }
}).success(function (msg) {
$scope.items = msg.rows;
})
})
}
})
})
</script>
</body>
</html>