define(function (require) {
return function (context) {
var $grid1, $form;
// 输入搜索文本后点击回车按钮查询列表
function enterQueryGrid1(e) {
if (e.keyCode === 13) {
var tmp = $(this).val();
$form.formSet({queryProperties: tmp});
queryGrid1();
}
}
// 检索条件查询
function queryGrid1() {
var queryForm = $form.formGet();
$grid1.reload({
mtype: 'POST',
url: api('/qrImg/scanQrImg'),
queryParams: queryForm
}, true);
}
// 搜索按钮
var queryToolbarTitle = '进出门二维码';// 自行替换此参数
var queryToolbar = {
xtype: 'toolbar', title: queryToolbarTitle, items: [
{
text: '查询', iconCls: 'fa fa-search', onClick: function () {
queryGrid1();
}
}, {
text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
$form.formClear();
queryGrid1();
}
}, {
text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
App.closeMe(this);
}
}
]
};
var queryForm = {
onRender: function () {
$form = $(this);
},
xtype: 'form',
items: [[
{
xtype: 'textbox',
label: '检索条件',
name: 'queryProperties',
prompt: "小区名称",
labelWidth: 'auto',
events: {keydown: enterQueryGrid1}, width: 350
},
]]
};
return {
north: {
height: 88,
/* split: true,
border: false,*///底框是否可变动
items: [
queryToolbar,
queryForm
]
},
center: {
height: '60%',
split: true,
items:
{
onRender: function () {
$grid1 = $(this);
queryGrid1()
},
xtype: 'grid',
toolbar: {
xtype: 'toolbar',
title: '小区大门详情',
items: [
{
text: '添加大门', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () {
$.yvan.showDialog(this,
require('/app/whepi/scan/addDoor.js')({
isEdit: false,
confirm: function () {
queryGrid1();
}
})
);
}
},
// {
// text: '编辑大门', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () {
// var row = $grid1.rowData();
// if (!row) {
// $.yvan.msg('请先选择一行数据');
// return;
// }
// $.yvan.showDialog(this,
// require('/app/whepi/scan/addDoor.js')({
// confirm: function () {
// queryGrid1();
// },
// isEdit: true,
// doorId: row.doorId
// })
// );
// }
// }
]
},
idField: 'doorId',
autoSizeColumns: true,
columns:
[
[
{field: 'doorId', title: '大门ID', hidden: true},
{field: 'uptownName', title: '小区', maxWidth: 200, align: 'left',},
{field: 'doorName', title: '小区大门', maxWidth: 200, align: 'left',},
{
field: 'outImg', title: '外出二维码', minWidth: 300, maxWidth: 400,
formatter: function (value) {
return "
";
},
},
{field: 'inImg', title: '进入二维码', minWidth: 300, maxWidth: 400,
formatter: function (value) {
return "
";
},},
{field: 'timeUpdate', title: '修改时间', maxWidth: 200, formatter: $.fn.fmatter.ts},
]
]
}
}
};
};
}
);