|
@ -0,0 +1,209 @@
|
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
|
|
|
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
|
|
|
<script>
|
|
|
(function ($, win) {
|
|
|
$(function () {
|
|
|
/* ************************** 变量定义 ******************************** */
|
|
|
// 通用工具类库
|
|
|
var Util = $.Util;
|
|
|
var retrieve = null;
|
|
|
var master = null;
|
|
|
var isFirstPage = false;
|
|
|
/* *************************** 函数定义 ******************************* */
|
|
|
function pageInit() {
|
|
|
retrieve.init();
|
|
|
master.init();
|
|
|
}
|
|
|
|
|
|
function reloadGrid(params) {
|
|
|
if (isFirstPage) {
|
|
|
this.grid.options.newPage = 1;
|
|
|
}
|
|
|
this.grid.setOptions({parms: params});
|
|
|
this.grid.loadData(true);
|
|
|
}
|
|
|
|
|
|
/* *************************** 模块初始化 ***************************** */
|
|
|
|
|
|
retrieve = {
|
|
|
$element: $('.m-retrieve-area'),
|
|
|
$searchBtn: $('#btn_search'),
|
|
|
$addBtn: $('#btn_add'),
|
|
|
|
|
|
$manufacturerName: $("#inp_manufacturer_name"),//设备厂商名称
|
|
|
$manufacturerCode: $("#inp_manufacturer_code"),
|
|
|
$address: $("#inp_address"),
|
|
|
init: function () {
|
|
|
this.$element.show();
|
|
|
this.$element.attrScan();
|
|
|
window.form = this.$element;
|
|
|
this.$manufacturerName.ligerTextBox({width: 200});
|
|
|
this.$manufacturerCode.ligerTextBox({width: 200});
|
|
|
this.$address.ligerTextBox({width: 150});
|
|
|
this.bindEvents();
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var self = this;
|
|
|
self.$searchBtn.click(function () {
|
|
|
master.grid.options.newPage = 1;
|
|
|
master.reloadGrid();
|
|
|
});
|
|
|
self.$addBtn.click(function () {
|
|
|
$.publish("manufacturer:info:create", [0]);
|
|
|
});
|
|
|
|
|
|
//导出
|
|
|
//生成Excel表
|
|
|
/*self.$exportBtn.click(function () {
|
|
|
//定义一个form表单
|
|
|
var myform = $("<form></form>");
|
|
|
myform.attr('method','post')
|
|
|
myform.attr('action',ctx + '/admin/device/toExcel');
|
|
|
|
|
|
//设备名称
|
|
|
var deviceName = $("<input type='hidden' name='deviceName' />")
|
|
|
deviceName.attr('value',$("#inp_device_name").val());
|
|
|
|
|
|
//设备编号
|
|
|
var deviceCode = $("<input type='hidden' name='deviceCode' />")
|
|
|
deviceCode.attr('value',$("#inp_device_code").val());
|
|
|
|
|
|
//社区名称
|
|
|
var orgName = $("<input type='hidden' name='orgName' />")
|
|
|
orgName.attr('value',$("#inp_org_name").val());
|
|
|
|
|
|
//联系人
|
|
|
var linkman = $("<input type='hidden' name='linkman' />")
|
|
|
linkman.attr('value',$("#inp_linkman").val());
|
|
|
|
|
|
myform.append(deviceName);
|
|
|
myform.append(deviceCode);
|
|
|
myform.append(orgName);
|
|
|
myform.append(linkman);
|
|
|
myform.appendTo('body').submit(); //must add this line for higher html spec
|
|
|
})*/
|
|
|
}
|
|
|
};
|
|
|
master = {
|
|
|
deviceManufacturerInfoDialog: null,
|
|
|
grid: null,
|
|
|
init: function () {
|
|
|
this.grid = $("#div_manufacturer_list").ligerGrid($.LigerGridEx.config({
|
|
|
url: ctx + '/admin/manufacturer/list',
|
|
|
parms: {},
|
|
|
ajaxHeader: ajaxHeaderName,
|
|
|
ajaxHeaderValue: ajaxHeaderValue,
|
|
|
columns: [
|
|
|
{display: 'id', name: 'id', hide: true},
|
|
|
{display: '厂商标识', name: 'code', width: '10%', align: "left"},
|
|
|
{display: '厂商代码', name: 'manufacturerCode', width: '10%', align: "left"},
|
|
|
{display: '厂商名称', name: 'manufacturerName', width: '10%', align: "left"},
|
|
|
{display: '厂家地址', name: 'address', width: '10%', align: "left"},
|
|
|
{display: '法人代表', name: 'representative', width: '10%', align: "left"},
|
|
|
{
|
|
|
display: '是否有效', name: 'del', width: '10%', align: "left",
|
|
|
render: function (row) {
|
|
|
if (row.del == 0) {
|
|
|
return "有效"
|
|
|
}
|
|
|
if (row.del == 1) {
|
|
|
return "无效"
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{display: '创建时间', name: 'czrq', width: '10%', align: "left"},
|
|
|
{
|
|
|
display: '操作', name: 'operator', width: '10%', align: "center", isSort: false,
|
|
|
render: function (row) {
|
|
|
var html = '';
|
|
|
<sec:authorize url="/admin/manufacturer/update">
|
|
|
html += '<a style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "manufacturer:info:edit", row.id) + '">编辑</a>';
|
|
|
</sec:authorize>
|
|
|
<sec:authorize url="/admin/manufacturer/delete">
|
|
|
html += '<a style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "manufacturer:info:del", row.id) + '">删除</a>';
|
|
|
</sec:authorize>
|
|
|
<%--<sec:authorize url="/admin/manufacturer/create">
|
|
|
html += '<a style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "manufacturer:info:create", row.id) + '">新增</a>';
|
|
|
</sec:authorize>--%>
|
|
|
return html;
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
}));
|
|
|
// 自适应宽度
|
|
|
this.grid.adjustToWidth();
|
|
|
this.bindEvents();
|
|
|
},
|
|
|
reloadGrid: function (msg) {
|
|
|
retrieve.$element.attrScan();
|
|
|
var values = retrieve.$element.Fields.getValues();
|
|
|
reloadGrid.call(this, values);
|
|
|
},
|
|
|
delRecord: function (id, code) {
|
|
|
var self = this;
|
|
|
$.ajax({
|
|
|
url: ctx + "/admin/manufacturer/delete",
|
|
|
data: {"id": id},
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
|
success: function (result) {
|
|
|
if (result.status == '200') {
|
|
|
window.reloadMasterGrid(result.msg);
|
|
|
} else {
|
|
|
$.Notice.error(result.msg);
|
|
|
}
|
|
|
},
|
|
|
error: function (data) {
|
|
|
$.Notice.error("系统异常,请联系管理员!");
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
bindEvents: function () {
|
|
|
var self = this;
|
|
|
$.subscribe('manufacturer:info:edit', function (event, id) {
|
|
|
var title = '编辑信息';
|
|
|
self.deviceManufacturerInfoDialog = $.ligerDialog.open({
|
|
|
height: 600,
|
|
|
width: 560,
|
|
|
urlParms: {"id": id, "type": "edit"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/manufacturer/infoInit'
|
|
|
})
|
|
|
});
|
|
|
|
|
|
$.subscribe('manufacturer:info:create', function (event, id) {
|
|
|
var title = '新增设备厂商';
|
|
|
self.deviceManufacturerInfoDialog = $.ligerDialog.open({
|
|
|
height: 600,
|
|
|
width: 560,
|
|
|
urlParms: {"id": id, "type": "create"},
|
|
|
title: title,
|
|
|
url: ctx + '/admin/manufacturer/infoInit'
|
|
|
})
|
|
|
});
|
|
|
|
|
|
$.subscribe('manufacturer:info:del', function (event, id, code) {
|
|
|
$.ligerDialog.confirm('确认删除该行信息?<br>如果是请点击确认按钮,否则请点击取消。', function (yes) {
|
|
|
if (yes) {
|
|
|
self.delRecord(id, code);
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
};
|
|
|
/* ************************* Dialog页面回调接口 ************************** */
|
|
|
win.reloadMasterGrid = function (msg) {
|
|
|
if (isNoEmpty(msg)) {
|
|
|
$.Notice.success(msg);
|
|
|
}
|
|
|
master.reloadGrid(msg);
|
|
|
};
|
|
|
win.closeDeviceManufacturerInfoDialog = function () {
|
|
|
master.deviceManufacturerInfoDialog.close();
|
|
|
};
|
|
|
/* *************************** 页面初始化 **************************** */
|
|
|
pageInit();
|
|
|
});
|
|
|
})(jQuery, window);
|
|
|
|
|
|
</script>
|