123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- define(function (require) {
- return function (context) {
- var $grid1, $form;
- // 弹框的方式
- var widgets = {
- // 搜索分类检索
- selectTable: {
- url: 'app/whepi/home/selectUptown.js',
- bind: {
- uptownId: 'uptownId',
- uptownName: 'uptownName',
- },
- },
- }
- // 导出
- function exportExcel() {
- var queryForm = $form.formGet();
- $.yvan.download({
- method: 'post',
- url: api('/sweepCode/export?queryProperties=' + queryForm.queryProperties + '&uptownId=' + queryForm.uptownId + '&goStatus=' + queryForm.goStatus + '&dateSta=' + queryForm.dateSta + '&dateEnd=' + queryForm.dateEnd),
- fileName: '进出管理-' + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
- });
- }
- // 输入搜索文本后点击回车按钮查询列表
- function enterQueryGrid1(e) {
- if (e.keyCode === 13) {
- var tmp = $(this).val();
- $form.formSet({queryProperties: tmp});
- queryGrid1();
- }
- }
- // 检索条件查询
- function queryGrid1() {
- var queryUrl = '/sweepCode/selectCode';// 自行替换此参数
- var queryForm = $form.formGet();
- if (!queryForm.dateSta) {
- $form.formSet({dateSta: getFormatDate() + " 00:00:00"});
- queryForm.dateSta = getFormatDate() + " 00:00:00";
- }
- if (!queryForm.dateEnd) {
- $form.formSet({dateEnd: getFormatDate() + " 23:59:59"});
- queryForm.dateEnd = getFormatDate() + " 23:59:59";
- }
- queryForm.roleCode = App.currentRoleCode;
- $grid1.reload({
- mtype: 'POST',
- url: api(queryUrl),
- 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: 250
- },
- {xtype: 'hidden', name: 'uptownId'},
- {
- xtype: 'searchbox',
- label: '小区',
- name: 'uptownName',
- prompt: "小区",
- width: '300px',
- widget: widgets.selectTable,// 弹出框方法
- labelWidth: '70px',
- onChange: function (value) {
- if (!isNotNullOrEmpty(value)) {
- $form.formSet({
- uptownId: ''
- })
- }
- queryGrid1();
- },
- },
- {
- xtype: 'yvselect', label: '通行状态', name: 'goStatus', labelWidth: 'auto', value: '', width: 220,
- data: [
- {id: '1', text: '允许'},
- {id: '-1', text: '禁止'},
- ],
- onChange: function () {
- queryGrid1();
- }
- },
- {
- xtype: 'datetimebox',
- name: 'dateSta',
- label: '进出时间',
- labelWidth: 'auto',
- width: 230,
- onChange: function (data) {
- /* var expDateStart = $form.formGet().nextRepairDate;
- var expDateEnd = $form.formGet().expDateEnd;
- var expDateStart = new Date(expDateStart.replace("-", "/"));
- var expDateEnd = new Date(expDateEnd.replace("-", "/"));
- if (expDateStart > expDateEnd) {
- $.yvan.msg('起止日期必须大于起始日期');
- return;
- }*/
- }
- },
- {
- xtype: 'datetimebox', label: '--', name: 'dateEnd', labelWidth: 'auto', width: 220,
- onChange: function (data) {
- /* var expDateStart = $form.formGet().nextRepairDate;
- var expDateEnd = $form.formGet().expDateEnd;
- var expDateStart = new Date(expDateStart.replace("-", "/"));
- var expDateEnd = new Date(expDateEnd.replace("-", "/"));
- if (expDateStart > expDateEnd) {
- $.yvan.msg('起止日期必须大于起始日期');
- return;
- }*/
- }
- }
- ]]
- };
- var gridToolbarTitle = '出入列表';// 自行替换此参数
- var gridToolbar = {
- xtype: 'toolbar',
- title: gridToolbarTitle,
- items: [
- {
- text: '导出', iconCls: 'fa fa-cloud-upload', onClick: function () {
- exportExcel();
- }
- },
- ]
- };
- 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:
- gridToolbar,
- idField: 'joId',
- autoSizeColumns: true,//序号多 正确显示
- columns:
- [
- [
- {field: 'uptownId', title: '小区id', maxWidth: 200, align: 'left', hidden: true},
- {field: 'uptownName', title: '小区名称', maxWidth: 200, align: 'left',},
- {field: 'ridgepole', title: '楼栋', maxWidth: 200, align: 'left',},
- {field: 'unit', title: '单元', maxWidth: 200,},
- {
- field: 'doorplate',
- title: '房间号', maxWidth: 200,
- },
- {
- field: 'linkman',
- title: '用户名',
- },
- {
- field: 'phone',
- title: '电话',
- },
- {
- field: 'doorName',
- title: '小区大门',
- align: 'left',
- },
- {
- field: 'date',
- title: '进出时间',
- align: 'left',
- },
- {
- field: 'inType',
- title: '记录状态',
- align: 'center',
- formatter:function (value) {
- if(value==1){
- return "进入"
- }else if(value ==2){
- return "外出"
- }
- }
- },
- {
- field: 'goStatus',
- title: '通行状态',
- align: 'center',
- formatter:function (value) {
- if(value==1){
- return "允许"
- }else if(value ==-1){
- return "禁止"
- }
- }
- },
- {
- field: 'errorInfo',
- title: '禁止提示',
- align: 'left',
- },
- ]
- ]
- }
- }
- };
- };
- }
- );
|