|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606 |
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-04-26 15:02
- * 描 述:学生宿舍管理
- */
- var refreshGirdData;
- var selectedParent = {};
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.initTree();
- page.initGird();
- page.search({ ParentID: '' });
- page.bind();
-
- },
- bind: function () {
-
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- page.search(queryJson);
- }, 420, 400);
- //宿舍楼
- $('#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 });
-
- $('#Sex').lrDataItemSelect({ code: 'usersex' });
- //.lrRadioCheckbox({
- // type: 'radio',
- // code: 'usersex',
- //});
-
- $('#Class').lrselect({
- value: "classno",
- text: "classname"
- });
-
- $('#Dept').lrselect({
- value: "deptno",
- text: "deptname",
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo',
- select: function (item) {
- if (item) {
- $('#Major').lrselectRefresh({
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
- param: { code: "CdMajorInfo", strWhere: "DeptNo='" + item.deptno + "'" }
- });
- }
- else {
- $('#Major').lrselectRefresh({
- url: "",
- data: []
- });
- }
- $('#Class').lrselectRefresh({
- url: "",
- data: []
- });
- }
- });
- $('#Major').lrselect({
- value: "majorno",
- text: "majorname",
- select: function (item) {
- if (item) {
- $('#Class').lrselectRefresh({
- url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
- param: { code: "bjsj", strWhere: "DeptNo='" + item.deptno + "' and majorno='" + item.majorno + "'" }
- });
- }
-
- }
- });
-
-
- $('#Major').on("click",
- function () {
- var data = $('#Dept').lrselectGet();
- if (!data) {
- learun.alert.error('请先选择系');
- }
- });
- $('#Class').on("click",
- function () {
- var data1 = $('#Dept').lrselectGet();
- var data2 = $('#Major').lrselectGet();
- if (!data1 || !data2) {
- learun.alert.error('请先选择系和专业');
- }
- });
-
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- if (selectedParent.BuildType != '3') {
- return learun.alert.warning("请选择楼层!");
- }
- var url = "";
- if (selectedParent.ID != null) {
- url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?ParentID=' + selectedParent.ID + '&ParentName=' + selectedParent.Name;
- } else {
- return learun.alert.warning("请选择上级!");
- //url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form';
- }
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: url,
- width: 900,
- height: 550,
- 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/Form?keyValue=' + keyValue,
- width: 900,
- height: 550,
- 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_dormitoryAdd").on("click", function () {
- var keyvalue1 = $("#gridtable").jfGridValue("ID");
- //console.log(selectedParent.ChildType);
- if (selectedParent.BuildType == "1") {
- var keyValue = selectedParent.ID;
- learun.layerForm({
- id: 'form',
- title: '批量添加宿舍',
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/DormitoryAdd?keyValue=' + keyValue,
- width: 600,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
-
-
- }
- else {
- learun.alert.warning("请选择楼");
-
- }
-
- });
- // 打印
- $('#lr_print').on('click', function () {
- $('#gridtable').jqprintTable();
- });
- //刷新左侧的树
- $("#tree_refresh").on("click", function () {
- page.initTree();
-
- });
- //自动分配宿舍
- $("#lr_allocation").on("click", function () {
- learun.layerForm({
- id: 'form',
- title: '自动分配宿舍',
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/Allocation',
- width: 400,
- height: 250,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
-
- });
- // 同步宿舍信息
- $('#lr_syncdata').on('click', function () {
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认同步!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SyncData', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
-
-
- //床位管理
- $("#lr_bedManage").on("click", function () {
- var keyValue = $('#gridtable').jfGridValue('ID');
- if (learun.checkrow(keyValue)) {
- if (keyValue.indexOf(',') != -1) {
- learun.alert.warning("只能选择一条记录!");
- return false;
- }
- learun.layerForm({
- id: 'indexBed',
- title: '床位管理',
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexBed?ParentID=' + keyValue,
- width: 700,
- height: 500,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
-
-
- });
-
- //分类管理
- $("#lr_Classify").on("click", function () {
- learun.layerForm({
- id: 'indexClassify',
- title: '分类管理',
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexClassify',
- width: 1200,
- height: 780,
- //btn:null,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
-
-
- //导入
- $("#lr_importBed").on("click", function () {
- learun.layerForm({
- id: 'indexImport',
- title: "导入宿舍信息",
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexImport',
- width: 600,
- height: 400,
- maxmin: true,
- btn: null,
- end: function () {
- refreshGirdData();
- }
- });
- });
-
- },
- //初始化左侧树
- initTree: function () {
- // 初始化左侧树形数据
- $('#dataTree').lrtree({
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetTree',
- nodeClick: function (item) {
- selectedParent.ID = item.value;
- selectedParent.Name = item.text;
- selectedParent.BuildType = item.title;
- if (item.parent) {
- if (!item.parent.parentId) {
- selectedParent.ChildType = "2";
- } else {
- selectedParent.ChildType = "0";
- }
- }
- else {
- selectedParent.ChildType = "1";
- }
- if (item.text.indexOf("室") > -1) {
- selectedParent.ChildType = "5";
- }
- var param = {};
-
- if (item.title == '1')
- param.ApartmentId = item.value;
- else if (item.title == '2')
- param.UnitId = item.value;
- else if (item.title == '3')
- param.FloorId = item.value;
-
- //page.initGird();
- //page.search({ ParentID: item.value });
- page.search(param);
- }
- });
- },
- // 初始化列表
- initGird: function () {
- //宿舍数据
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
- headData: [
- { label: "名称", name: "Name", width: 100, 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: "StudentID", width: 100, align: "left",
- // formatterAsync: function (callback, value, row, op, $cell) {
-
- // learun.clientdata.getAsync('custmerData', {
- // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic',
- // key: value,
- // keyId: 'stuid',
- // callback: function (_data) {
- // callback(_data['stuname']);
- // }
- // });
- // }
- //},
- { 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: "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: "Class", 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: "RoomType", width: 100, align: "left",
- formatter: function (value, row) {
- if (value) {
- return value + '人寝';
- } else {
- return '';
- }
- }
- },
- { label: "入住人数", name: "CheckInStu", width: 100, align: "left" },
- {
- label: "性别", name: "Sex", width: 100, align: "left",
- formatter: function (value, row) {
- if (value == '0')
- return '女';
- else if (value == '1')
- return '男';
- else
- return '';
- }
- },
- { label: "负责人", name: "Functionary", width: 100, align: "left" },
- { label: "负责人电话", name: "Phone", width: 100, align: "left" },
- { label: "备注", name: "Remark", width: 100, align: "left" },
- ],
- mainId: 'ID',
- isPage: true,
- isMultiselect: true,
- sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ',
- //sord: 'ASC',
- isSubGrid: true, // 是否有子表
- //床位信息
- subGridExpanded: function (subContentId, rowItem) {
- $('#' + subContentId).jfGrid({
- url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + rowItem.ID,
- headData: [
- { label: "名称", name: "Name", width: 100, align: "left" },
- {
- label: "学生", name: "StudentID", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic',
- key: value,
- keyId: 'stuno',
- callback: function (_data) {
- callback(_data['stuname']);
- }
- });
- }
- },
- ],
- mainId: 'ID',
- isPage: false,
- sidx: ' CAST(REPLACE(Name,\'床\',\'\') as int)'
- //sord: 'ASC',
- });
- //var param;
- //param = param || {};
- //param.ParentID = rowItem.Id;
- $('#' + subContentId).jfGridSet('reload');
- },
- subGridHeight: 250,
- });
- //$("#gridtable").empty();
- //$("#gridtable")[0].dfop = undefined;
- //if (selectedParent.BuildType == undefined || selectedParent.BuildType === "3") {
-
- //} else {
- // //lrAuthorizeJfGridLei
- // $('#gridtable').jfGrid({
- // url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList',
- // headData: [
- // { label: "名称", name: "Name", width: 100, 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: "StudentID", width: 100, align: "left",
- // // formatterAsync: function (callback, value, row, op, $cell) {
-
- // // learun.clientdata.getAsync('custmerData', {
- // // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic',
- // // key: value,
- // // keyId: 'stuid',
- // // callback: function (_data) {
- // // callback(_data['stuname']);
- // // }
- // // });
- // // }
- // //},
- // { 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: "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: 'id',
- // // callback: function (_data) {
- // // callback(_data['majorname']);
- // // }
- // // });
- // // }
- // //},
- // //{ label: "班级", name: "Class", width: 100, align: "left" },
- // //{
- // // label: "性别", name: "Sex", 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: "Functionary", width: 100, align: "left" },
- // { label: "负责人电话", name: "Phone", width: 100, align: "left" },
- // { label: "备注", name: "Remark", width: 100, align: "left" },
- // ],
- // mainId: 'ID',
- // isPage: true,
- // //isMultiselect: true
- // //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ',
- // //sord: 'ASC',
- // });
- //}
-
-
- },
- search: function (param) {
- param = param || {};
- param.SqlParameter = " AND t.BuildType ='4' ";
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- //page.initTree();
- if (!!selectedParent.ID) {
- //var param = { ParentID: selectedParent.ID };
- //$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- page.initTree();
- page.search({ ParentID: selectedParent.ID });
- } else {
- page.initTree();
- page.search();
- }
- };
- page.init();
- }
|