|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-05-05 15:44
- * 描 述:宿舍卫生管理
- */
- var refreshGirdData;
- var selectedParent = {};
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 初始化左侧树形数据
- $('#dataTree').lrtree({
- url: top.$.rootUrl + '/LogisticsManagement/Sanitation/GetTree',
- nodeClick: function (item) {
- selectedParent.ID = item.value;
- selectedParent.hasChildren = item.hasChildren;
- selectedParent.textName = item.text;
- page.search({ RoomID: item.value });
- }
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- if (selectedParent.hasChildren || selectedParent.textName.indexOf("室") == -1) {
- learun.alert.warning('请选择宿舍评分');
- return;
- }
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/LogisticsManagement/Sanitation/Form?roomID=' + selectedParent.ID,
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('zbid');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/LogisticsManagement/Sanitation/Form?keyValue=' + keyValue,
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('zbid');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Sanitation/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 打印
- $('#lr_print').on('click', function () {
- $('#gridtable').jqprintTable();
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').lrAuthorizeJfGrid({
- url: top.$.rootUrl + '/LogisticsManagement/Sanitation/GetPageList',
- headData: [
- {
- label: "类型", name: "AType", width: 80, align: "left",
- formatter: function (cellvalue) {
- if (cellvalue == 0) {
- return "卫生";
- } else {
- return "纪律";
- }
- }
- },
- {
- label: "院系", name: "dept", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
- key: value,
- keyId: 'deptno',
- callback: function (_data) {
- callback(_data['deptname']);
- }
- });
- }
- },
- {
- label: "专业", name: "major", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
- key: value,
- keyId: 'majorno',
- callback: function (_data) {
- callback(_data['majorname']);
- }
- });
- }
- },
- {
- label: "班级", name: "classno", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
- key: value,
- keyId: 'classno',
- callback: function (_data) {
- callback(_data['classname']);
- }
- });
- }
- },
- {
- label: "宿舍楼", name: "ApartmentId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Acc_DormitoryData',
- key: value,
- keyId: 'id',
- callback: function (_data) {
- callback(_data['name']);
- }
- });
- }
- },
- {
- label: "评价", name: "Grade", width: 100, align: "left",
- formatter: function (cellvalue) {
- if (cellvalue == 0) {
- return "5-优";
- } else if (cellvalue == 1) {
- return "3-良";
- } else if (cellvalue == 2) {
- return "1-中";
- } else if (cellvalue == 3) {
- return "0-差";
- }
- }
- },
- {
- label: "班主任", name: "empnoone", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata',
- key: value,
- keyId: 'f_encode',
- callback: function (_data) {
- callback(_data['f_realname']);
- }
- });
- }
- },
- { label: "电话", name: "mobileone", width: 100, align: "left" },
- {
- label: "辅导员", name: "empnotwo", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata',
- key: value,
- keyId: 'f_encode',
- callback: function (_data) {
- callback(_data['f_realname']);
- }
- });
- }
- },
- { label: "电话", name: "mobiletwo", width: 100, align: "left" },
- { label: "考核人", name: "GradedUser", width: 100, align: "left" },
- {
- label: "时间", name: "GradedTime", width: 100, align: "left",
- formatter: function (cellvalue) {
- return learun.formatDate(cellvalue, 'yyyy-MM-dd');
- }
- },
- { label: "备注", name: "demo", width: 100, align: "left" },
- ],
- mainId: 'GradedTime',
- sidx: 'GradedTime desc',
- isPage: true
- });
- //page.search();
- },
- search: function (param) {
- param = param || {};
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search({ RoomID: selectedParent.ID });
- };
- page.init();
- }
|