| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 | var refreshGirdData; // 更新数据var selectedRow;var bootstrap = function ($, learun) {    "use strict";    var page = {        init: function () {            page.initGird();            page.bind();        },        bind: function () {            // 查询            $('#btn_Search').on('click', function () {                var keyword = $('#txt_Keyword').val();                page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), Endcode: $('#Endcode').val()}) });            });            //刷新            $('#lr_refresh').on('click', function () {                location.reload();            });            // 新增            $('#lr_add').on('click', function () {                selectedRow = null;                learun.layerForm({                    id: 'form',                    title: '新增',                    url: top.$.rootUrl + '/WCSManager/WcsPath/Form',                    width: 700,                    height: 300,                    callBack: function (id) {                        return top[id].acceptClick(refreshGirdData);                    }                });            });            // 编辑            $('#lr_edit').on('click', function () {                var keyValue = $('#gridtable').jfGridValue('ID');                selectedRow = $('#gridtable').jfGridGet('rowdata');                if (learun.checkrow(keyValue)) {                    learun.layerForm({                        id: 'form',                        title: '编辑',                        url: top.$.rootUrl + '/WCSManager/WcsPath/Form?keyValue=' + keyValue,                        width: 700,                        height: 400,                        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 + '/WCSManager/WcsPath/DeleteForm', { keyValue: keyValue }, function () {                                refreshGirdData();                            });                        }                    });                }            });        },        //加载表格        initGird: function () {            $('#gridtable').jfGrid({                url: top.$.rootUrl + "/WCSManager/WcsPath/GetPageList",                headData: [                    { label: 'ID', name: 'ID', hidden: true },                    { label: '起始地点', name: 'STARTCODE', index: 'STARTCODE', width: 100, align: 'left' },                    { label: '目标地点', name: 'ENDCODE', index: 'ENDCODE', width: 100, align: 'left' },                    { label: '路径', name: 'PATH', index: 'PATH', width: 100, align: 'left' },                    {                        label: '是否启用', name: 'ENABLED', index: 'ENABLED', width: 100, align: "center"                        , formatter: function (cellvalue) {                            if (cellvalue == true) {                                return '<span class=\"label label-success\"  >是</span>';                            } else {                                return '<span class=\"label  label-default\" >否</span>';                            }                        }                    },                    { label: '更新用户', name: 'UPDATEUSER', index: 'UPDATEUSER', width: 100, align: 'left' },                    { label: '更新时间', name: 'UPDATETIME', index: 'UPDATETIME', width: 100, align: 'left' },                ],                mainId: 'ID',                isPage: true,                reloadSelected: true,                sidx: 'UPDATETIME',            });            page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), Endcode: $('#Endcode').val() }) });        },        search: function (param) {            $('#gridtable').jfGridSet('reload', param);        }    };    // 保存数据后回调刷新    refreshGirdData = function () {        page.search();    }    page.init();}
 |