/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2020-02-03 14:37 * 描 述:疫情记录 */ var refreshGirdData; var createrID = request('createrID'); 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' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'formDetail', title: '新增', url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/Form', width: 1000, height: 650, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'formDetail', title: '编辑', url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/Form?keyValue=' + keyValue, width: 1000, height: 650, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); $('#lr_view').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'FormView', title: '查看', url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituationCopy/FormView?keyValue=' + keyValue, width: 1000, height: 650, btn: null }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/EpidemicSituation/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); }, // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/PersonnelManagement/EpidemicSituation/GetPageList', 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: "CreateTime", width: 100, align: "left", formatter: function (value, row) { return dateFormat("YYYY-mm-dd", new Date(value)); } }, { 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: "HealthSituation", width: 100, align: "left", //formatterAsync: function (callback, value, row, op, $cell) { // learun.clientdata.getAsync('dataItem', { // key: value, // code: 'EpiHealth', // callback: function (_data) { // callback(_data.text); // } // }); //} 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 || {}; var loginInfo = top.learun.clientdata.get(['userinfo']); if (createrID) { param.Creater = createrID; } else { param.Creater = loginInfo.userId; } $('#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; }