You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/SoftMng/Viewsjs/Home/Index.min.js

214 lines
8.0 KiB
JavaScript

2 years ago
$(document).ready(function () {
//初始化拖动窗口
WinMove();
//获取最新公告
showTopNotice();
//获取公告
getNotice();
getpreWarning();
});
function $childNode(o) {
return window.frames[o];
}
function animationHover(o, e) {
o = $(o), o.hover(function () { o.addClass("animated " + e) },
function () { window.setTimeout(function () { o.removeClass("animated " + e) }, 2e3) });
}
function WinMove() {
var o = "[class*=col]", e = ".ibox-title", i = "[class*=col]";
$(o).sortable({ handle: e, connectWith: i, tolerance: "pointer", forcePlaceholderSize: !0, opacity: .8 });//.disableSelection();
}
var $parentNode = window.parent.document;
if ($(".tooltip-demo").tooltip({
selector: "[data-toggle=tooltip]", container: "body"
}),
$(".modal").appendTo("body"), $("[data-toggle=popover]").popover(), $(".collapse-link").click(function () {
var o = $(this).closest("div.ibox"), e = $(this).find("i"), i = o.find("div.ibox-content");
i.slideToggle(200), e.toggleClass("fa-chevron-up").toggleClass("fa-chevron-down"),
o.toggleClass("").toggleClass("border-bottom"), setTimeout(function () {
o.resize(), o.find("[id^=map-]").resize();
}, 50);
}), $(".close-link").click(function () {
var o = $(this).closest("div.ibox");
o.remove();
}), top === this) {
}
//获取公告
function getNotice() {
var data = _noticeData;
var html = "";
for (var i = 0; i < data.length; i++) {
html += '<li class="success-element" data-id="' + data[i].GID + '" onclick="showNotice(this)">';
html += '<a href="#!" >' + data[i].Title + '</a>';
html += '<div class="agile-detail">';
html += '<i class="fa fa-clock-o mr-2"></i>';
html += CommonJson.GetDate(data[i].CreateTime).format('yyyy-mm-dd hh:ii');
html += '</div></li>'
}
$("#notice").html(html);
}
function showTopNotice()
{
CommonAjax.Post("/SoftMng/Home/GetTopNoticeDetial", null, function (res)
{
if (res.length > 0)
{
layer.open({
type: 1,
1 year ago
title: Zi.GONGGAODETAIL,
2 years ago
skin:"layui-layer-molv",
area: ['80%', '80%'],
content: buildNoticeDetail(res[0]),
1 year ago
btn: [Zi.BUZAITISHI, Zi.CLOSE],
2 years ago
yes: function (index, layero)
{
CommonAjax.Post("/SoftMng/Home/SetNoticeUserRelation", { id: res[0].GID}, function (res)
{
1 year ago
layer.msg(res ? Zi.SHEZHICHENGGONG : Zi.SHEZHISHIBAI);
2 years ago
layer.close(index);
});
}
});
}
});
}
function showNotice(obj) {
CommonAjax.Post("/SoftMng/Home/GetNoticeDetial", { id: $(obj).attr("data-id") }, function (res)
{
layer.open({
type: 1,
1 year ago
title: Zi.GONGGAODETAIL,
2 years ago
area: ['80%', '80%'],
content: buildNoticeDetail(res)
});
});
}
//构造公告详情
function buildNoticeDetail(item) {
return "<h3 style='text-align:center;margin-bottom:0;'>" + item.Title + "</h3><div style='text-align: right;color:#969696'>"
1 year ago
+ "<span class='mr-2'>" + Zi.GONGGAOSHIJIAN+ CommonJson.GetDate(item.CreateTime).format('yyyy-mm-dd hh:ii') + "</span>"
+ "<span class='mr-2'>" + Zi.GONGGAOREN+ item.CreateUser + "</span>"
2 years ago
+ "</div > <div class='ibox-content'>".concat(decodeURIComponent(item.Content)).concat("</div>");
}
//获取预警
function getpreWarning() {
//默认列配置项
var columnsDefault = [{
field: 'BSTYPE',
1 year ago
title: Zi.BSTYPE,
2 years ago
width: 160
}
, {
field: 'BSMSG',
1 year ago
title: Zi.BSMSG,
2 years ago
width: 290
}];
$("#preWarning").bootstrapTable({
url: '/SoftMng/Home/GetTaskList', //请求后台的URL*
method: 'post', //请求方式(*
contentType: "application/x-www-form-urlencoded",
// toolbar: '#toolbar_preWarning', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
//cache: false, //是否使用缓存默认为true所以一般情况下需要设置一下这个属性*
pagination: true, //是否显示分页(*
sortable: true, //是否启用排序
//toolbarAlign:"right",
sortName: "BSTYPE",
sortOrder: "desc", //排序方式
undefinedText: "--",
queryParams: QueryParams, //额外传递参数(*
sidePagination: "server", //分页方式client客户端分页server服务端分页*
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 20, //每页的记录行数(*
//pageList: [10, 20, 50, 100, "All"], //可供选择的每页的行数(*
//search: true, //是否显示表格搜索(客户端搜索)
onlyInfoPagination: false,
//searchText:"",
//searchOnEnterKey: true,
//strictSearch: true,
//showPaginationSwitch:false,
showColumns: false, //是否显示的列控制按钮
showRefresh: false, //是否显示刷新按钮
clickToSelect: false, //是否启用点击选中行
height: 370, //表格高度
uniqueId: "BSTYPE", //每一行的唯一标识,一般为主键列
//showToggle: true, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
maintainSelected: true, //设置为 true 在点击分页按钮或搜索按钮时将记住checkbox的选择项
rowStyle: function (row, index) {
return { classes: "col-point" };
},
//responseHandler: function (res) {//返回前处理对象
// res.rows.forEach(function (item, index) {
// if (item.otherinfo.length > 0) {
// item.MBLNO = item.otherinfo[0].HBLNO == "" ? item.otherinfo[0].MBLNO : item.otherinfo[0].HBLNO;
// item.HBLNO = item.otherinfo[0].HBLNO;
// item.PBLNO = item.otherinfo[0].MBLNO;
// item.MFNO = item.otherinfo[0].MFNO;
// item.FORWARDER = item.otherinfo[0].FORWARDER;
// item.CARRIER = item.otherinfo[0].CARRIER;
// item.ETD = item.otherinfo[0].ETD;
// }
// });
// return res;
//},
formatRecordsPerPage: function () {
return "";
},
/**
* 双击某行
* @param row 点击行的数据
* @param $element tr 元素
* @param field 点击列的 field 名称
*/
onDblClickRow: function (row, $element, field) {
parent.AddTab(row.MODNAME, row.URL, row.MODCNAME);
//layer.open({
// type: 2,
// title: false,
// skin: "layui-layer-molv",
// content: "/MvcShipping/MsOpSeaeEdi/CustomEdit?mfno=" + row.MFNO + "&opstatus=edit",
// area: ["95%", "95%"],
// btn: false
//})
},
//formatSearch: function() {
// return "提问人 | 问题描述";
//},
onLoadSuccess: function (data) {
//$("#toolbar_preWarning > label.btn > .badge").each(function (i) {
// $(this).text(data.allTotal[i]);
//});
},
onLoadError: function (status, res) {
if (status !== 0) layer.msg(res.responseText);
},
columns: columnsDefault
});
}
/**
* 添加 - 额外参数
* @param params 参数
*/
function QueryParams(params) {
var extParams = {
limit: params.limit, //页面大小
startIndex: params.offset
};
return extParams;
}
//$("#toolbar_preWarning").on("click", "label.btn",
// function () {
// setTimeout(function () {
// refreshWarning();
// }, 0);
// });
function refreshWarning() {
$("#preWarning").bootstrapTable('selectPage', 1);
$("#preWarning").bootstrapTable('refresh', { silent: true });
}