/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:超级管理员
* 日 期:2020-02-03 14:37
* 描 述:疫情记录
*/
var refreshGirdData;
var startTime, endTime;
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.initGird();
page.bind();
},
bind: function () {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
page.search(queryJson);
}, 220, 400);
$('#Type').lrDataItemSelect({ code: 'EUserType' });
$('#Creater').lrDataSourceSelect({ code: 'BaseUser', value: 'f_userid', text: 'f_realname' });
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 查看
$('#lr_view').on('click', function () {
var createrID = $('#gridtable').jfGridValue('Creater');
if (learun.checkrow(createrID)) {
learun.layerFormForPercent({
id: 'form',
title: '查看',
url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/Index?createrID=' + createrID,
width: '80%',
height: '80%',
});
}
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/GetReportPageList',
headData: [
{
label: "填表人员", name: "Creater", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('custmerData', {
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
key: value,
keyId: 'f_userid',
callback: function (_data) {
callback(_data['f_realname']);
}
});
}
},
{
label: "类别", name: "Type", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem', {
key: value,
code: 'EUserType',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{
label: "所在部门", name: "Department", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
console.log(row);
if (row.StudentSource) {
callback(row.StudentSource);
} else {
learun.clientdata.getAsync('custmerData', {
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
key: value,
keyId: 'id',
callback: function (_data) {
callback(_data['name']);
}
});
}
}
},
{
label: "性别", name: "Gender", width: 100, align: "left",
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('dataItem', {
key: value,
code: 'usersex',
callback: function (_data) {
callback(_data.text);
}
});
}
},
{ label: "家庭住址", name: "HomeAddress", width: 100, align: "left" },
{
label: "是否去过疫区", name: "IsGoDangerPlace", width: 100, align: "left",
formatter: function (cellvalue, row) {
console.log(cellvalue)
if (cellvalue) {
return '是';
} else {
return '否';
}
}
},
{
label: "健康状况", name: "HealthSituation", width: 100, align: "left",
formatter: function (cellvalue, row) {
if (cellvalue == 0) {
return '健康';
} else if (cellvalue == 1) {
return '异常';
}
}
},
{
label: "是否外出", name: "IsOut", width: 100, align: "left",
//formatterAsync: function (callback, value, row, op, $cell) {
// learun.clientdata.getAsync('dataItem', {
// key: value,
// code: 'YesOrNoInt',
// callback: function (_data) {
// callback(_data.text);
// }
// });
//}
formatter: function (cellvalue, row) {
if (cellvalue === 0) {
return '否';
} else if (cellvalue === 1) {
return '是';
}
}
},
{
label: "家人异常", name: "HasFamily", width: 100, align: "left",
formatter: function (cellvalue, row) {
if (cellvalue === 0) {
return '否';
} else if (cellvalue === 1) {
return '是';
}
}
},
{
label: "疫区人异常", name: "HasPeople", width: 100, align: "left",
formatter: function (cellvalue, row) {
if (cellvalue === 0) {
return '否';
} else if (cellvalue === 1) {
return '是';
}
}
},
{ label: "联系方式", name: "Mobile", width: 100, align: "left" },
{ label: "当前地址", name: "Objective", width: 100, align: "left" },
],
mainId: 'ID',
isPage: true
});
page.search();
},
search: function (param) {
param = param || {};
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};
refreshGirdData = function () {
page.search();
};
page.init();
}
function dateFormat(fmt, date) {
let ret;
const opt = {
"Y+": date.getFullYear().toString(), // 年
"m+": (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日
"H+": date.getHours().toString(), // 时
"M+": date.getMinutes().toString(), // 分
"S+": date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
}