/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2019-04-26 15:02 * 描 述:学生宿舍管理 */ var refreshGirdData; var acceptClick; var selectedParent = {}; //var ParentID = request('ParentID'); 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); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); //宿舍楼 $('#ApartmentId').lrselect({ allowSearch: true, url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', param: { strWhere: " BuildType='1' " }, value: "id", text: "name", select: function (item) { if (!!item) { //单元 $('#UnitId').lrselectRefresh({ allowSearch: true, url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', param: { strWhere: " BuildType='2' and ApartmentId='" + item.id + "'" }, value: "id", text: "name", select: function (item) { if (!!item) { //楼层 $('#FloorId').lrselectRefresh({ allowSearch: true, url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', param: { strWhere: " BuildType='3' and UnitId='" + item.id + "'" }, value: "id", text: "name" }); } } }); } } }); $('#UnitId').lrselect({ allowSearch: true }); $('#FloorId').lrselect({ allowSearch: true }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClassify', width: 700, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { if (keyValue.indexOf(',') != -1) { learun.alert.warning("只能选择一条记录进行编辑!"); return false; } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClassify?keyValue=' + keyValue, width: 700, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); // 打印 $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetClassifyList', headData: [ { label: "名称", name: "Name", width: 150, align: "left" }, { label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" }, { label: "单元", name: "UnitName", width: 100, align: "left" }, { label: "楼层", name: "FloorName", width: 100, align: "left" }, { label: "类型", name: "BuildType", width: 100, align: "left", formatter: function (value, row) { if (value == '1') return '宿舍楼'; else if (value == '2') return '单元'; else if (value == '3') return '楼层'; else if (value == '4') return '房间'; } }, { label: "位置", name: "Address", width: 100, align: "left" }, { label: "校区", name: "Campus", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', key: value, keyId: 'f_companyid', callback: function (_data) { callback(_data['f_fullname']); } }); } }, { label: "负责人", name: "Functionary", width: 100, align: "left" }, { label: "负责人电话", name: "Phone", width: 100, align: "left" }, { label: "备注", name: "Remark", width: 100, align: "left" }, ], mainId: 'ID', isPage: false, //isMultiselect: true, //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', isTree: true, parentId: 'ParentID', }); page.search(); }, search: function (param) { param = param || {}; //param.SqlParameter = " AND t.BuildType <>'5' "; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { page.search(); }; // 保存数据 acceptClick = function (callBack) { learun.layerClose('indexClassify', ''); if (!!callBack) { callBack(); } }; page.init(); }