123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- /*
- * 描 述:单位管理
- */
- var selectedRow;
- var refreshGirdData;
- var typnum = 1;
- var unitGrpId = '';
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.inittree();
- page.initGird();
- page.bind();
- },
- bind: function () {
- // 查询
- $('#btn_Search').on('click', function () {
- var keyword = $('#txt_Keyword').val();
- page.search({ keyword: keyword });
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 新增
- $('#lr_add').on('click', function () {
- selectedRow = null;
- learun.layerForm({
- id: 'form',
- title: '字典新增',
- url: top.$.rootUrl + '/BaseManager/BaseData/Form?unitGrpId=' + unitGrpId,
- width: 700,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('F_NO');
- selectedRow = $('#gridtable').jfGridGet('rowdata');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '字典编辑',
- url: top.$.rootUrl + '/BaseManager/BaseData/Form?keyValue=' + keyValue,
- width: 700,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('F_NO');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/BaseManager/BaseData/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- $('#lr_import').on('click', function () {
- learun.layerForm({
- id: 'ImportForm',
- title: '导入Excel数据',
- url: top.$.rootUrl + '/Utility/ImportForm?ordertype=' + typnum,
- width: 600,
- height: 400,
- maxmin: true,
- btn: null
- });
- });
- $('#lr_exportnow').on('click', function () {
- learun.layerForm({
- id: "ExcelExportForm",
- title: '导出Excel数据',
- url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + $('#gridtable').attr('id') + '&filename=' + encodeURI(encodeURI("数据字典列表")),
- width: 500,
- height: 380,
- callBack: function (id) {
- return top[id].acceptClick();
- },
- btn: ['导出Excel', '关闭']
- });
- });
- },
- inittree: function () {
- $('#UnitGrpTree').lrtree({
- url: top.$.rootUrl + '/BaseManager/BaseData/GetTree',
- param: { parentId: '0' },
- nodeClick: page.treeNodeClick
- });
- $('#UnitGrpTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
- },
- treeNodeClick: function (item) {
- if (item.parentId == 0) {
- unitGrpId = "";
- } else {
- unitGrpId = item.id;
- }
- $('#titleinfo').text(item.text);
- page.search();
- },
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/BaseManager/BaseData/GetPageList',
- headData: [
- learun.jfFormatter.col_F_NO("字典编号"),
- learun.jfFormatter.col_F_NAME("字典数据"),
- { label: "字典值", name: 'F_VALUE', width: 120, align: "left" },
- { label: "排序号", name: 'F_SORTNUM', width: 120, align: "left" },
- //{ label: "字典父编号", name: 'F_PNO', width: 120, align: "left" },
- //{
- // label: '单位组', name: 'F_UNITGRPNO', width: 150, align: "left"
- // , formatterAsync: function (callback, value, row) {
- // learun.clientdata.getAsync('unitgrp', {
- // key: value,
- // callback: function (item) {
- // callback(item.F_NAME);
- // }
- // });
- // }
- //},
- learun.jfFormatter.col_F_ISSTOP(),
- learun.jfFormatter.col_F_ADDUSERNO(),
- learun.jfFormatter.col_F_ADDTIME(),
- learun.jfFormatter.col_F_EDITUSERNO(),
- learun.jfFormatter.col_F_EDITTIME(),
- learun.jfFormatter.col_F_MEMO()
- ],
- mainId: 'F_NO',
- sidx: 'F_NO',
- reloadSelected: true,
- isPage: true
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- param.unitGrpId = unitGrpId;
- $('#gridtable').jfGridSet('reload', param);
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|