/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2020-08-11 16:55 * 描 述:物品损坏管理 */ var selectedRow; var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; var startTime; var endTime; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 220, 400); // 时间搜索框 $('#datesearch').lrdate({ dfdata: [ { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } ], // 月 mShow: false, premShow: false, // 季度 jShow: false, prejShow: false, // 年 ysShow: false, yxShow: false, preyShow: false, yShow: false, // 默认 dfvalue: '1', selectfn: function (begin, end) { startTime = begin; endTime = end; page.search(); } }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); //$('#DeptNo').lrselect({ // allowSearch: true, // value: "deptno", // text: "deptname", // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo', // select: function (item) { // if (item) { // $('#MajorNo').lrselectRefresh({ // allowSearch: true, // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', // param: { strWhere: "DeptNo='" + item.deptno + "' AND CheckMark=1" } // }); // } else { // $('#MajorNo').lrselectRefresh({ // allowSearch: true, // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', // param: { strWhere: "1=1 AND CheckMark=1" } // }); // } // } //}); //$('#MajorNo').lrselect({ // allowSearch: true, // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo', // value: "majorno", // text: "majorname", // param: { strWhere: "1=1 AND CheckMark=1" }, // select: function (item) { // if (item) { // $('#ClassNo').lrselectRefresh({ // allowSearch: true, // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', // param: { strWhere: "majorno='" + item.majorno + "' AND CheckMark=1" } // }); // } else { // $('#ClassNo').lrselectRefresh({ // allowSearch: true, // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', // param: { strWhere: "1=1 AND CheckMark=1" } // }); // } // } //}); //$('#ClassNo').lrselect({ // allowSearch: true, // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=bjsj', // param: { strWhere: "1=1 AND CheckMark=1" }, // value: "classno", // text: "classname" //}); // 新增 $('#lr_add').on('click', function () { selectedRow = null; learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/LogisticsManagement/Acc_GoodsDemage/Form', width: 800, height: 600, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { selectedRow = null; var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/LogisticsManagement/Acc_GoodsDemage/Form?keyValue=' + keyValue, width: 800, height: 600, 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/Acc_GoodsDemage/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); // 快速新增 $('#lr_addQuickly').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { selectedRow = $('#gridtable').jfGridGet('rowdata'); //console.log(selectedRow); learun.layerForm({ id: 'form', title: '快速新增', url: top.$.rootUrl + '/LogisticsManagement/Acc_GoodsDemage/Form', width: 800, height: 600, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 打印 $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LogisticsManagement/Acc_GoodsDemage/GetPageList', headData: [ //{ // label: "专业部", name: "DeptNo", 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: "MajorNo", 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: "Dormitory", 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: "Unit", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Acc_UnitData', key: value, keyId: 'id', callback: function (_data) { callback(_data['name']); } }); } }, { label: "楼层", name: "Floor", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Acc_FloorData', key: value, keyId: 'id', callback: function (_data) { callback(_data['name']); } }); } }, { label: "寝室号", name: "RId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Acc_RoomData', key: value, keyId: 'id', callback: function (_data) { callback(_data['name']); } }); } }, { label: "姓名", name: "F_CreateAccount", 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_account', callback: function (_data) { callback(_data['f_realname']); } }); } }, { label: "损坏描述", name: "DamageDescribe", width: 250, align: "left" }, { label: "日期", name: "F_CreateDate", width: 100, align: "left" }, ], mainId: 'ID', isPage: true }); page.search(); }, search: function (param) { param = param || {}; param.StartTime = startTime; param.EndTime = endTime; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { page.search(); }; page.init(); }