@{
|
ViewBag.Title = "实验室管理";
|
Layout = "~/Views/Shared/Master.cshtml";
|
}
|
@model sbcLabSystem.Models.Backstage.UserRequestViewModel1
|
<script>
|
|
var viewModel;
|
$(function () {
|
|
viewModel = new myViewModel_User(@Html.Raw(Json.Encode(Model)));
|
ko.applyBindings(viewModel, $(".container")[0]);
|
});
|
function myViewModel_User(data) {
|
var self = this;
|
self.changePage = function (index) {
|
|
location.href = "@Url.Action("LabAdmin", "Backstage")" + "?Page=" + index + "&where=" + $("#where").val() + "&name=" + $('#test option:selected').val();;
|
}
|
self.SelectNo = function (data) {
|
for (var x = 0; x < self.UserRequestInfoList().length; x++) {
|
if (self.UserRequestInfoList()[x].Choice() == true) {
|
self.UserRequestInfoList()[x].Choice(true)
|
}
|
else {
|
self.UserRequestInfoList()[x].Choice(true)
|
}
|
}
|
}
|
self.SelectOff = function (data) {
|
for (var x = 0; x < self.UserRequestInfoList().length; x++) {
|
if (self.UserRequestInfoList()[x].Choice() == false) {
|
self.UserRequestInfoList()[x].Choice(true)
|
}
|
else if (self.UserRequestInfoList()[x].Choice() == true) {
|
self.UserRequestInfoList()[x].Choice(false)
|
}
|
}
|
|
}
|
self.Deletes = function () {
|
var Choices = "";
|
for (var x = 0; x < self.UserRequestInfoList().length; x++) {
|
if (self.UserRequestInfoList()[x].Choice() == true) {
|
Choices = Choices + self.UserRequestInfoList()[x].Id() + ","
|
}
|
}
|
if (Choices != "") {
|
if (confirm("你确定要删除选中的实验室吗?")) {
|
window.location.href = "@Url.Action("DeleteLabs", "Backstage")" + "?LabIds=" + Choices;
|
}
|
else {
|
|
}
|
|
}
|
else {
|
alert("没有选中项 ")
|
}
|
}
|
self.exports = function () {
|
window.location.href = "@Url.Action("LabExcel", "Backstage")";
|
}
|
self.AddTo = function () {
|
window.location.href = "@Url.Action("LabAdminAddLab", "Backstage")";
|
}
|
self.Select = function () {
|
var x = $('#test option:selected').val();
|
location.href = "@Url.Action("LabAdmin", "Backstage")" + "?where=" + $("#where").val() + "&name=" + x;
|
}
|
ko.mapping.fromJS(data, mapping, self);
|
}
|
var mapping = {
|
'UserRequestInfoList': {
|
create: function (options) {
|
return new UserRequestInfoList(options.data);
|
}
|
}
|
}
|
function UserRequestInfoList(data) {
|
var self = this;
|
self.dizhi = data.Province;
|
self.Choice = ko.observable(true);
|
|
self.project = ko.computed(function () {
|
if (self.ProjectId() == 1) {
|
return "项目一";
|
}
|
if (self.ProjectId() == 2) {
|
return "项目二";
|
}
|
if (self.ProjectId() == 3) {
|
return "项目三";
|
}
|
if (self.ProjectId() == 4) {
|
return "项目四 ";
|
}
|
}, self);
|
self.updateTime = ko.computed(function () {
|
return formatDateTime(self.UpdateTime());
|
}, self);
|
self.dateTime = ko.computed(function () {
|
return formatDateTime(self.RequestTime());
|
}, self);
|
self.Detailed = function () {
|
location.href = "@Url.Action("LabAdminAddLab", "Backstage")" + "?LabId=" + self.Id();
|
}
|
self.SendOut = function () {
|
$.ajax({
|
type: "post",
|
url: '@Url.Action("SeveEmile", "Backstage")',
|
dataType: 'json',
|
cache: false,
|
contentType: 'application/json; charset=utf-8',
|
data: JSON.stringify(ko.toJS(self)),
|
success: function (data) {
|
alert(data);
|
},
|
error: function (err) {
|
}
|
});
|
}
|
ko.mapping.fromJS(data, {}, self)
|
}
|
|
</script>
|
|
<div class="container">
|
<div class="row" style="background:#5bc0de;">
|
<div class="col-xs-12">
|
<span>
|
<button type="button" class="btn btn-info btn-sm " data-bind="click:SelectNo">
|
<span class="glyphicon glyphicon-ok">全选</span>
|
</button>
|
<button type="button" class="btn btn-info btn-sm" data-bind="click:SelectOff">
|
<span class="glyphicon glyphicon-remove"></span> 返选
|
</button>
|
<button type="button" class="btn btn-danger btn-sm" data-bind="click:Deletes">
|
<span class="glyphicon glyphicon-trash"></span> 删除
|
</button>
|
|
<button type="button" class="btn btn-success btn-sm" data-bind="click:exports">
|
<span class="glyphicon glyphicon-print"></span> 导出
|
</button>
|
<button type="button" class="btn btn-success btn-sm" data-bind="click:AddTo">
|
<span class="glyphicon glyphicon-plus"></span> 添加
|
</button>
|
</span>
|
<span style="margin-left:100px;">
|
<select id="test" data-bind="value:name">
|
<option value="CompanyName">单位名称</option>
|
<option value="LabCode">实验室代码</option>
|
<option value="LabName">实验室名称</option>
|
|
<option value="Province">省份</option>
|
<option value="LabLoginName">用户名</option>
|
|
<option value="Address">地址</option>
|
</select>
|
<input type="text" id="where" style="color:#ff0000" data-bind="textInput:where" />
|
<button style="" type="button" class="btn btn-info" data-bind="click:Select">
|
<span class="glyphicon glyphicon-search"></span> 查询
|
</button>
|
</span>
|
</div>
|
</div>
|
<div class="row" style="width: 99.8%; overflow: auto;">
|
<div class="table-responsive" style="width: 3000px; overflow: hidden;">
|
<table class="table table-bordered table-responsive table-hover">
|
<thead>
|
<tr>
|
<th>选择</th>
|
<th width="50px;">邮件</th>
|
<th width="50px;">操作</th>
|
<th>修改时间</th>
|
<th width="100px;">实验室编号</th>
|
|
<th>用户名</th>
|
<th>单位名称</th>
|
<th>实验室名称</th>
|
<th>地址</th>
|
<th>省份</th>
|
<th>参加项目</th>
|
<th>申请时间</th>
|
<th>负责人</th>
|
<th>固话</th>
|
<th>传真</th>
|
<th>手机号码</th>
|
<th>邮箱</th>
|
<th>操作人</th>
|
<th>固话</th>
|
<th>传真</th>
|
<th>手机号码</th>
|
<th>邮箱</th>
|
</tr>
|
</thead>
|
<tbody data-bind="foreach:UserRequestInfoList">
|
<tr>
|
<td> <input type="checkbox" data-bind="checked:Choice" /></td>
|
<td>
|
<button type="button" class="btn btn-info btn-xs" data-bind="click:SendOut">
|
发送邮件
|
</button>
|
</td>
|
<td>
|
<button type="button" class="btn btn-info btn-xs" data-bind="click:Detailed">
|
查看
|
</button>
|
</td>
|
<td data-bind="text:updateTime"></td>
|
<td data-bind="text:LabCode"></td>
|
<td data-bind="text:LabLoginName"></td>
|
<td data-bind="text:CompanyName"></td>
|
<td data-bind="text:LabName"></td>
|
<td data-bind="text:Address"></td>
|
<td data-bind="text:Province"></td>
|
<td data-bind="text:project"></td>
|
<td data-bind="text:dateTime"></td>
|
<td data-bind="text:ManagerName"></td>
|
<td data-bind="text:ManagerPhone"></td>
|
<td data-bind="text:ManagerFax"></td>
|
<td data-bind="text:ManagerMobile"></td>
|
<td data-bind="text:ManagerEmail"></td>
|
<td data-bind="text:OperatorName"></td>
|
<td data-bind="text:OperatorPhone"></td>
|
<td data-bind="text:OperatorFax"></td>
|
<td data-bind="text:OperatorMobile"></td>
|
<td data-bind="text:OperatorEmail"></td>
|
</tr>
|
</tbody>
|
</table>
|
</div>
|
</div>
|
<nav>
|
<ul class="pagination" data-bind="foreach:Pages">
|
<li data-bind="if:$data==0" style="background:#ff0000">
|
<a href="javascript:void(0);" aria-label="Previous" data-bind="click: function() { $root.changePage(0) }">
|
<span aria-hidden="true">«</span>
|
</a>
|
</li>
|
<li data-bind="if:$data!=0 && $data!=999,css:{active:$data==$root.CurrentPageIndex()}">
|
<a href="javascript:void(0);" data-bind="text:$data,click: function() { $root.changePage($data) }"></a>
|
</li>
|
<li data-bind="if:$data==999">
|
<a href="javascript:void(0);" aria-label="Next" data-bind="click: function() { $root.changePage(999) }">
|
<span aria-hidden="true">»</span>
|
</a>
|
</li>
|
</ul>
|
</nav>
|
</div>
|
|