/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2019-04-10 15:12 * 描 述:资产报修 */ var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; var startTime; var endTime; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { // 时间搜索框 $('#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(); } }); $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 220, 400); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/Form', width: 600, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('RId'); if (learun.checkrow(keyValue)) { var RStatus = $('#gridtable').jfGridValue('RStatus'); if (RStatus == 1) { learun.alert.warning("已提交!"); return false; } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/Form?keyValue=' + keyValue, width: 600, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('RId'); if (learun.checkrow(keyValue)) { var RStatus = $('#gridtable').jfGridValue('RStatus'); if (RStatus == 1) { learun.alert.warning("已提交!"); return false; } learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); //  提交 $('#lr_submit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('RId'); if (learun.checkrow(keyValue)) { var RStatus = $('#gridtable').jfGridValue('RStatus'); if (RStatus == 1) { learun.alert.warning("已提交!"); return false; } learun.layerConfirm('是否确认提交该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoSubmit', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); //  查看 $('#lr_view').on('click', function () { var keyValue = $('#gridtable').jfGridValue('RId'); if (learun.checkrow(keyValue)) { var RStatus = $('#gridtable').jfGridValue('RStatus'); if (RStatus == 1) { learun.alert.warning("已提交!"); return false; } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/FormView?keyValue=' + keyValue, width: 600, height: 400, btn: null, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); //  开始维修 $('#lr_start').on('click', function () { var keyValue = $('#gridtable').jfGridValue('RId'); if (learun.checkrow(keyValue)) { var RStatus = $('#gridtable').jfGridValue('RStatus'); if (RStatus != 1) { learun.alert.warning("未提交!"); return false; } learun.layerConfirm('是否确认开始维修该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoStart', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); //  维修完成 $('#lr_end').on('click', function () { var keyValue = $('#gridtable').jfGridValue('RId'); if (learun.checkrow(keyValue)) { var RStatus = $('#gridtable').jfGridValue('RStatus'); if (RStatus != 1) { learun.alert.warning("未提交!"); return false; } learun.layerConfirm('是否确认维修完成该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoEnd', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); //  确认维修 $('#lr_confirm').on('click', function () { var keyValue = $('#gridtable').jfGridValue('RId'); if (learun.checkrow(keyValue)) { var RStatus = $('#gridtable').jfGridValue('RStatus'); if (RStatus != 1) { learun.alert.warning("未提交!"); return false; } learun.layerConfirm('是否确认维修该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoConfirm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); }, // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/GetPageList', headData: [ { label: "报修申请单号", name: "RCode", width: 200, align: "left" }, { label: "报修总量", name: "RPrice", width: 100, align: "left" }, { label: "报修时间", name: "RCreateTime", width: 100, align: "left" }, { label: "报修人", name: "RCreateUserId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('user', { key: value, callback: function (_data) { callback(_data.name); } }); } }, { label: "开始维修时间", name: "RStartTime", width: 100, align: "left" }, { label: "维修人", name: "RRepairUserId", width: 100, align: "left" }, { label: "维修完成时间", name: "REndTime", width: 100, align: "left" }, { label: "维修确认时间", name: "RConfirmTime", width: 100, align: "left" }, { label: "审核状态", name: "RStatus", width: 100, align: "left", formatter: function (cellvalue) { return cellvalue == 1 ? "已提交" : "未提交"; } }, { label: "报修备注", name: "RReason", width: 100, align: "left" }, ], mainId: 'RId', isPage: true }); }, search: function (param) { param = param || {}; param.StartTime = startTime; param.EndTime = endTime; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { page.search(); }; page.init(); }