/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 * 创建人:超级管理员 * 日 期:2022-01-24 12:19 * 描 述:教材信息管理 */ var refreshGirdData; 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); //$('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); $('#TextBookType').lrDataItemSelect({ code: 'TextBookType' }); $('#TextBookNature').lrDataItemSelect({ code: 'TextBookNature' }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/Form', width: 800, height: 500, 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; } var IsValid = $('#gridtable').jfGridValue('IsValid'); if (IsValid == "true") { learun.alert.warning("选中记录中包含已启用项目,已启用项不可编辑!"); return; } learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/Form?keyValue=' + keyValue, width: 800, height: 500, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { var IsValid = $('#gridtable').jfGridValue('IsValid'); if (IsValid.indexOf('true') != -1) { learun.alert.warning("选中记录中包含已启用项目,已启用项不能删除!"); return; } learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); // 打印 $('#lr_print').on('click', function () { $('#gridtable').jqprintTable(); }); //启用 $('#lr_enabled').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { var IsValid = $('#gridtable').jfGridValue('IsValid'); if (IsValid.indexOf('true') != -1) { learun.alert.warning("选中记录中包含已启用项!"); return; } learun.layerConfirm('是否确认启用选中项?', function (res) { if (res) { learun.postForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/EnableEntity', { keyValue: keyValue, IsValid: '1' }, function () { refreshGirdData(); }); } }); } }); //禁用 $('#lr_disabled').on('click', function () { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { var IsValid = $('#gridtable').jfGridValue('IsValid'); if (IsValid.indexOf('false') != -1) { learun.alert.warning("选中记录中包含已启用项!"); return; } learun.layerConfirm('是否确认禁用选中项?', function (res) { if (res) { learun.postForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/DisableEntity', { keyValue: keyValue, IsValid: '0' }, function () { refreshGirdData(); }); } }); } }); }, // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/GetPageList', headData: [ { label: "教材号", name: "TextBookNo", width: 150, align: "left" }, { label: "教材名称", name: "TextBookName", width: 150, align: "left" }, { label: "出版号", name: "PublishNo", width: 100, align: "left" }, { 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: "FirstAuthor", width: 100, align: "left" }, { label: "其他作者", name: "OtherAuthor", width: 100, align: "left" }, { label: "出版日期", name: "Pubdate", width: 80, align: "left", formatter: function (value) { return learun.formatDate(value, 'yyyy-MM-dd'); } }, { label: "出版社", name: "Publisher", width: 100, align: "left" }, { label: "教材类型", name: "TextBookType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { key: value, code: 'TextBookType', callback: function (_data) { callback(_data.text); } }); } }, { label: "教材性质", name: "TextBookNature", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('dataItem', { key: value, code: 'TextBookNature', callback: function (_data) { callback(_data.text); } }); } }, { label: "价格", name: "Price", width: 60, align: "left" }, { label: "版次", name: "Edition", width: 100, align: "left" }, { label: "印次", name: "Impression", width: 100, align: "left" }, { label: "是否有练习册", name: "IsWorkBook", width: 100, align: "left", formatter: function (cellvalue) { return cellvalue == true ? "" : ""; } }, { label: "是否有教参教辅", name: "IsTeachConsult", width: 100, align: "left", formatter: function (cellvalue) { return cellvalue == true ? "" : ""; } }, { label: "内容简介", name: "Description", width: 100, align: "left" }, { label: "录入用户", name: "CreateUserID", 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: "Createdate", width: 100, align: "left" }, { label: "修改用户", name: "UpdateUserID", 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: "Updatetime", width: 100, align: "left" }, { label: "是否有效", name: "IsValid", width: 80, align: "center", formatter: function (cellvalue) { return cellvalue == true ? "" : ""; } } ], mainId: 'ID', isPage: true, isMultiselect: true, sidx: 'Createdate asc' }); page.search(); }, search: function (param) { param = param || {}; param.SqlParameter = " and Isdel = '0' "; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { $('#gridtable').jfGridSet('reload'); }; page.init(); }