oa

分页:

var GetData = function () {
TaskAuditsService.SearchSellList($scope.paginationConf.currentPage,
$scope.paginationConf.itemsPerPage, 3).success(function (data) {
$scope.paginationConf.totalItems = data.total;
$scope.userList = data.list;
});
}
$scope.$watch('paginationConf.currentPage + paginationConf.itemsPerPage', GetData);    监视分页变化,然后改变数据

/// <summary>
/// 状态
/// </summary>
public virtual int STATE { get; set; }

页面注释,方便查看

public virtual Nullable<DateTime> PLANTIME { get; set; }  时间格式,不为空

 $scope.searchfield = 'TASKNAME';//构造下拉框的默认值

//window刷新
$scope.reloadRoute = function () {
$window.location.reload();
};

模糊查询

$scope.buttonSearch = function () {
var where = '';
if ($scope.searchValue != null && $scope.searchValue != '' && $scope.searchValue != undefined) {
where += $scope.searchfield + '|string|' + $scope.searchValue + '|like,';
}
if (where.length > 0)
where = where.substr(0, where.length - 1);
$scope.extraParams.swhere = where;

$scope.parentTableParams.reload();
}

//查看数据的模态框
$scope.OpenSelect = function (form) {
$scope.form = {};
var modalInstance = $uibModal.open({
templateUrl: '/mySelect.html',
controller: function ($scope, $uibModalInstance) {
$scope.form = form;
console.log($scope.form);
$scope.ok = function () {
$uibModalInstance.close('closed');

}
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
}

},
size: 'lg'
//resolve: {//这是一个入参,这个很重要,它可以把主控制器中的参数传到模态框控制器中
// form_select: function () {//items是一个回调函数
// return form_select;//这个值会被模态框的控制器获取到
//}
});
}

单选框绑定值:

<li>
是否通过:
<input type="radio" name="AUDITSTATE" id="state" ng-value="0" ng-model="form_detail.AUDITSTATE" ng-click="ClicksYes()" ng-checked=0 />是
<input type="radio" name="AUDITSTATE" id="state" ng-value="1" ng-model="form_detail.AUDITSTATE" ng-click="ClicksNo()" />否
</li>

//controller的函数 ,模态框 保存审核表
$scope.open = function (form) {
var modalInstance = $uibModal.open({
templateUrl: '/myModalContent.html',
controller: function ($scope, $uibModalInstance) {
//隐藏文本框
$scope.ClicksYes = function () {
document.getElementById("reason").style.display = "none";
};
//显示文本框
$scope.ClicksNo = function () {
document.getElementById("reason").style.display = "block";

};
$scope.ok = function () {
TaskAuditsService.PostSellSave(form, $scope.form_detail);
$scope.form_detail = {};
alert("审核成功");
$uibModalInstance.close('closed');
load();
}
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
}

},
size: 'lg'

});

}

表单验证:

<li>
&nbsp;审核人:
&nbsp;<input ng-model="form_detail.AUDITER" id="AUDITER" name="AUDITER" type="text" ng-maxlength=8 required />
<span style="color:red" ng-show="myForm.AUDITER.$dirty && myForm.AUDITER.$invalid">
<span ng-show="myForm.AUDITER.$error.required">不能为空</span>
</span>
</li>

文本框:

<li style="display:none" id="reason">
退回原因:
<textarea rows="1" cols="30" ng-model="form_detail.RETURNREASON">
我是一个文本框。
</textarea>
</li>

字段排序:

<td data-title="'名称'" ng-bind="parent.TASKNAME" sortable="'TASKNAME'"></td>

选择性的出现按钮:

<td data-title="'审核状态'" ng-if="parent.Audits[0].AUDITSTATE!=0 && parent.Audits[0].AUDITSTATE!=1" style="color:red">未审核</td>
<td data-title="'审核状态'" ng-if="parent.Audits[0].AUDITSTATE==0" style="color: #27c24c">已通过</td>
<td data-title="'审核状态'" ng-if="parent.Audits[0].AUDITSTATE==1" style="color: blue">未通过</td>

修改的时候绑定值,只需要ng-model,既可以显示值又可以绑定值保存

swhere多条件查询

swhere = swhere != null ? swhere.TrimEnd(',') + ",STATE|int|0|=,STATEVALUE|int|3|=" : "STATE|int|0|=,STATEVALUE|int|3|=";

原文地址:https://www.cnblogs.com/0280-hnn/p/7406256.html