123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- var refreshGirdData;
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- // 调用后台查询
- // queryJson 查询条件
- console.log(queryJson);
- page.search({ queryJson: JSON.stringify(queryJson) });
- }, 250);
- // 查询
- $('#btn_Search').on('click', function () {
- var keyword = $('#txt_Keyword').val();
- page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
- });
- // 加载
- $('#DBCode').lrselect({
- url: top.$.rootUrl + "/WCSManager/WcsDatablock/GetSelectDBNameList",
- allowSearch: true
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- $('#lr_generate').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/WCSManager/WcsDeviceInfo/GenerateDeviceForm',
- width: 700,
- height: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 新增
- $('#lr_add').on('click', function () {
- learun.layerForm({
- id: 'form',
- title: '新增',
- url: top.$.rootUrl + '/WCSManager/WcsDeviceInfo/Form',
- width:700,
- height: 630,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('CODE');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑',
- url: top.$.rootUrl + '/WCSManager/WcsDeviceInfo/Form?keyValue=' + keyValue,
- width: 700,
- height: 630,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('CODE');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/WCSManager/WcsDeviceInfo/DeleteForm', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 打印
- $('#lr_print').on('click', function () {
- $('#gridtable').jqprintTable();
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/WCSManager/WcsDeviceInfo/GetPageList',
- headData: [
- { label: "设备编号", name: "CODE", width: 200, align: "left" },
- { label: "设备名称", name: "NAME", width: 300, align: "left" },
- { label: "PLCDB", name: "DBCODE", width: 300, align: "left" },
- { label: "起始位置", name: "POSITION", width: 200, align: "left" },
- { label: "是否可用", name: "Enabled", align: "left" },
- ],
- mainId: 'CODE',
- isPage: true,
- reloadSelected: true,
- sidx: 'CODE',
- });
- page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
- },
- search: function (param) {
- $('#gridtable').jfGridSet('reload', param);
- }
- };
- refreshGirdData = function () {
- $('#gridtable').jfGridSet('reload');
- };
- page.init();
- }
|