123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465 |
- /**
- * inspectionrecord.js
- * 巡检点工作记录管理界面
- * emial: yaoqiang@chinausky.com
- * create: 2018-12-08
- */
- Ext.Loader.setConfig({
- enabled: true
- });
- Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');
- Ext.require([
- 'Ext.grid.*',
- 'Ext.data.*',
- 'Ext.ux.RowExpander',
- 'Ext.selection.CheckboxModel'
- ]);
- var company_code;
- var myStore=null;
- var V_LOGINNAME='',V_PASSWORD='';
- var sm = Ext.create('Ext.selection.CheckboxModel');
- Ext.define('InspectionRecord',{
- extend: 'Ext.data.Model',
- fields: [
- {name:'id', type:'string'},
- // {name:'personnel', type:'string'},
- // {name:'route', type:'string'},
- {name:'inspection_time', type:'string'},
- // {name:'point_position', type:'string'},
- {name:'xjzt', type:'string'},
- {name:'qk', type:'string'},
- {name:'equipment_id', type:'string'},
- {name:'xj_name', type:'string'},
- {name:'analysis_content', type:'string'},
- {name:'name', type:'string'},
- {name:'route_name', type:'string'},
- {name:'company_code1', type:'string'},
- ]
- });
- function exportbtn_click(){
- baseUrl = document.getElementById('basePath').value;
- V_LOGINNAME = $("#V_LOGINNAME").val();
- V_PASSWORD = $("#V_PASSWORD").val();
- xj_name = document.getElementById('xj_name').value;
- equipment_id = document.getElementById('equipment_id').value;
- route_name = document.getElementById('route_name').value;
- analysis_content = document.getElementById('analysis_content').value;
- xjzt = document.getElementById('xjzt').value;
- qk = document.getElementById('qk').value;
- name = document.getElementById('name').value;
- inspection_time = document.getElementById('inspection_time').value;
- var fields = '';
- var array = ['id','xj_name','equipment_id','route_name','analysis_content','xjzt','qk','name','inspection_time'];
- var excelname = ['编号','巡检点名称','巡检点对应设备','巡检路线名称','巡检标签','巡检状态','巡检情况说明','巡检人','巡检时间'];
- for(var i=0;i<9;i++){
- if(i>0)
- fields += ',';
- fields += '{id:"'+array[i]+'",title:"'+excelname[i]+'",shown:"'+true+'"}';
- }
- var query = new Object();
- // query.V_LOGINNAME = V_LOGINNAME;
- // query.V_PASSWORD = V_PASSWORD;
- query.xj_name = xj_name;
- query.equipment_id = equipment_id;
- query.route_name = route_name;
- query.analysis_content = analysis_content;
- query.xjzt = xjzt;
- query.qk = qk;
- query.name = name;
- query.inspection_time = inspection_time;
- query.EXPORT_FILE = '巡检点操作记录列表';
- query.fields = '['+fields+']';
- $.ajax({
- type:'POST',
- url: baseUrl+"iot/excel/view/inspectionrecordExcel",
- data: {
- queryJson : Ext.JSON.encode(query)
- },
- success: function(result){
-
- var json = eval('(' + result + ')');
- if(json.action=='dormExport'){
- ConfirmStore = json.RESULT;
-
- var elemIF = document.createElement("iframe");
- elemIF.src = baseUrl+json.filename;
- elemIF.style.display = "none";
- document.body.appendChild(elemIF);
- }
-
- }
- });
-
- }
- Ext.onReady(function(){
- var baseUrl = document.getElementById('basePath').value;
- var theme = document.getElementById('theme').value;
- var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'
- var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'
- // company_code = document.getElementById('company_code').value;
- $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
- $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
- V_LOGINNAME = $("#V_LOGINNAME").val();
- V_PASSWORD = $("#V_PASSWORD").val();
- var countPerPage = 20;
- var maxHeight = 10000;
-
- var chkBoolean = function(flag) {
- if(flag)
- return chkIcon;
- return unchkIcon;
- }
- var queryJson = new Object();
- // queryJson.V_LOGINNAME = V_LOGINNAME;
- // queryJson.V_PASSWORD = V_PASSWORD;
- // queryJson.COMMSTATUS = 'NO';
- if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))
- queryJson.company_code = company_code;
-
-
- myStore = Ext.create('Ext.data.Store', {
- model: 'InspectionRecord',
- pageSize: countPerPage,
- proxy: {
- type: 'ajax',
- actionMethods: {
- create : 'POST',
- read : 'POST', // by default GET
- update : 'POST',
- destroy: 'POST'
- },
- url: baseUrl+'iot/inspectionrecord/getList',
- reader: {
- type: 'json',
- root: 'RESULT',
- totalProperty: 'totalCount'
- },
- extraParams:{
- queryJson:Ext.JSON.encode(queryJson)
- }
- },
- // sorters:[{
- // property:'data_time',
- // direction:'DESC'
- // }],
- remoteSort: true
- });
-
-
- var states1 = Ext.create('Ext.data.Store', {
- fields: ['status', 'name'],
- data : [
- {"status":"全选", "name":"全选"},
- {"status":"正常", "name":"正常"},
- {"status":"异常", "name":"异常"},
- {"status":"故障", "name":"故障"},
- ]
- });
-
- //筛选
- var clear_filter_form = function(){
- Ext.getCmp('ff_name').setValue("");
- Ext.getCmp('ff_xj_name').setValue("");
- Ext.getCmp('ff_equipment_id').setValue("");
- Ext.getCmp('ff_analysis_content').setValue("");
- Ext.getCmp('ff_route_name').setValue("");
- // Ext.getCmp('ff_personnel').setValue("");
- // Ext.getCmp('ff_route').setValue("");
- // Ext.getCmp('ff_point_position').setValue("");
- Ext.getCmp('ff_xjzt').setValue("");
- // Ext.getCmp('ff_qk').setValue("");
- Ext.getCmp('ff_inspection_time').setValue("");
- Ext.getCmp('ff_company_code').setValue("");
- }
-
- var FilterWin = Ext.create('Ext.form.Panel', {
- id: 'InspectionRecordFilterForm',
- labelWidth: 55,
- defaultType: 'textfield',
- bodyPadding: 15,
- items: [{
- fieldLabel:'巡检人',
- id: 'ff_name',
- name:'name',
- maxLength:30,
- maxLengthText:'长度不得超出{0}',
- value : document.getElementById('name').value,
- anchor:'75%'
- },{
- fieldLabel:'巡检点名称',
- id:'ff_xj_name',
- name:'xj_name',
- maxLength: 50,
- maxLengthText:'长度不得超出{0}',
- value : document.getElementById('xj_name').value,
- anchor:'75%'
- },{
- fieldLabel:'巡检点对应的设备',
- id: 'ff_equipment_id',
- name: 'equipment_id',
- maxLength: 250,
- maxLengthText:'长度不得超出{0}',
- value : document.getElementById('equipment_id').value,
- anchor:'95%'
- },{
- fieldLabel:'巡检标签',
- id: 'ff_analysis_content',
- name: 'analysis_content',
- maxLength: 250,
- maxLengthText:'长度不得超出{0}',
- value : document.getElementById('analysis_content').value,
- anchor:'95%'
- },{
- fieldLabel:'巡检路线名称',
- id: 'ff_route_name',
- name: 'route_name',
- maxLength: 250,
- maxLengthText:'长度不得超出{0}',
- value : document.getElementById('route_name').value,
- anchor:'95%'
- },
- // {
- // fieldLabel:'巡检人',
- // id: 'ff_personnel',
- // name:'personnel',
- // maxLength:20,
- // maxLengthText:'长度不得超出{0}',
- // value : document.getElementById('personnel').value,
- // anchor:'75%'
- // },{
- // fieldLabel:'巡检路线',
- // id:'ff_route',
- // name:'route',
- // maxLength: 250,
- // maxLengthText:'长度不得超出{0}',
- // value : document.getElementById('route').value,
- // editable : false
- // },{
- // fieldLabel:'巡检标签',
- // id: 'ff_point_position',
- // name: 'point_position',
- // maxLength: 250,
- // maxLengthText:'长度不得超出{0}',
- // value : document.getElementById('point_position').value,
- // anchor:'95%'
- // },
- // {
- // fieldLabel:'巡检状态',
- // id:'ff_xjzt',
- // name:'xjzt',
- // maxLength: 250,
- // maxLengthText:'长度不得超出{0}',
- // value : document.getElementById('xjzt').value,
- // editable : false
- // }
- {
- fieldLabel:'巡检状态',
- id:'ff_xjzt',
- name:'xjzt',
- xtype:'combo',
- store:states1,
- displayField : 'name',
- valueField : 'status',
- value : "全选",
- editable : false
- },{
- fieldLabel:'巡检时间',
- id:'ff_inspection_time',
- name:'inspection_time',
- maxLength: 250,
- maxLengthText:'长度不得超出{0}',
- value : document.getElementById('inspection_time').value,
- editable : false
- },
- // {
- // fieldLabel:'巡检情况报说明',
- // id:'ff_qk',
- // name:'qk',
- // xtype: 'textareafield',
- // maxLength: 250,
- // maxLengthText:'长度不得超出{0}',
- // value : document.getElementById('qk').value,
- // anchor:'100%',
- // editable : false
- // },
- {
- id:'ff_queryJson',
- name:'queryJson',
- hidden:true
- }],
- buttons: [{
- text: '提交',
- iconCls:'ok_btn',
- handler: function() {
- var form = this.up('form').getForm();
- if (form.isValid()) {
- var query = new Object();
- query.V_LOGINNAME = V_LOGINNAME;
- query.V_PASSWORD = V_PASSWORD;
- if(Ext.getCmp('ff_name').getValue().length>0)
- query.name = Ext.getCmp('ff_name').getValue();
- $("#name").val(query.name);
- if(Ext.getCmp('ff_xj_name').getValue().length>0)
- query.xj_name = Ext.getCmp('ff_xj_name').getValue();
- $("#xj_name").val(query.xj_name);
- if(Ext.getCmp('ff_equipment_id').getValue().length>0)
- query.equipment_id = Ext.getCmp('ff_equipment_id').getValue();
- $("#equipment_id").val(query.equipment_id);
- if(Ext.getCmp('ff_analysis_content').getValue().length>0)
- query.analysis_content = Ext.getCmp('ff_analysis_content').getValue();
- $("#analysis_content").val(query.analysis_content);
- if(Ext.getCmp('ff_route_name').getValue().length>0)
- query.route_name = Ext.getCmp('ff_route_name').getValue();
- $("#route_name").val(query.route_name);
- // if(Ext.getCmp('ff_personnel').getValue().length>0)
- // query.personnel = Ext.getCmp('ff_personnel').getValue();
- // if(Ext.getCmp('ff_route').getValue().length>0)
- // query.route = Ext.getCmp('ff_route').getValue();
- // if(Ext.getCmp('ff_point_position').getValue().length>0)
- // query.point_position = Ext.getCmp('ff_point_position').getValue();
- if(Ext.getCmp('ff_xjzt').getValue().length>0){
- // query.xjzt = Ext.getCmp('ff_xjzt').getValue();
- if(Ext.getCmp('ff_xjzt').getValue()=="正常") {
- query.xjzt = "0";
- $("#xjzt").val(query.xjzt);
- }else if(Ext.getCmp('ff_xjzt').getValue()=="异常") {
- query.xjzt = "1";
- $("#xjzt").val(query.xjzt);
- }else if(Ext.getCmp('ff_xjzt').getValue()=="故障") {
- query.xjzt = "2";
- $("#xjzt").val(query.xjzt);
- }else if(Ext.getCmp('ff_xjzt').getValue()=="全选") {
- // query.xjzt = null;
- }
- }
-
- // if(Ext.getCmp('ff_qk').getValue().length>0)
- // query.qk = Ext.getCmp('ff_qk').getValue();
- if(Ext.getCmp('ff_inspection_time').getValue().length>0)
- query.inspection_time = Ext.getCmp('ff_inspection_time').getValue();
- $("#inspection_time").val(query.inspection_time);
- var jsonstr = Ext.JSON.encode(query);
- myStore.getProxy().extraParams = {
- queryJson : jsonstr
- };
- Ext.getCmp('InspectionRecordListPageToolbar').moveFirst();
- Ext.getCmp('name').setValue(query.name);
- Ext.getCmp('xj_name').setValue(query.xj_name);
- Ext.getCmp('equipment_id').setValue(query.equipment_id);
- Ext.getCmp('analysis_content').setValue(query.analysis_content);
- Ext.getCmp('route_name').setValue(query.route_name);
- // Ext.getCmp('personnel').setValue(query.personnel);
- // Ext.getCmp('route').setValue(query.route);
- // Ext.getCmp('point_position').setValue(query.point_position);
- Ext.getCmp('xjzt').setValue(query.xjzt);
- Ext.getCmp('qk').setValue(query.qk);
- Ext.getCmp('inspection_time').setValue(query.inspection_time);
- // myStore.reload();
- clear_filter_form();
- this.up('window').hide();
- }
- }
- },{
- text: '关闭',
- iconCls: 'cancel_btn',
- handler: function() {
- this.up('window').hide();
- }
- }]
- });
-
-
-
- var filterwin = function() {
- Ext.create('Ext.window.Window',{
- title: '筛选',
- height: 400,
- width: 400,
- layout: 'fit',
- items: FilterWin,
- closeAction: 'hide'
- }).show();
- }
-
-
- Ext.create('Ext.grid.Panel', {
- title: '巡检点工作记录',
- id: 'InspectionRecordListPanel',
- store: myStore,
- selModel: sm,
- columns: [
- //{ header: 'ID', dataIndex: 'UQ_POINT_ID',hidden:true, menuDisabled:true },
- { header: '序号', dataIndex: 'id', width:67, menuDisabled:true },
- { header: '巡检点名称', dataIndex: 'xj_name', width:130,align:'center', menuDisabled:true },
- { header: '巡检点对应设备', dataIndex: 'equipment_id', width:130,align:'center', menuDisabled:true },
- { header: '巡检路线名称', dataIndex: 'route_name', width:250,align:'center', menuDisabled:true },
- { header: '巡检标签', dataIndex: 'analysis_content', width:120,align:'center', menuDisabled:true },
- { header: '巡检状态', dataIndex: 'xjzt', width:120,align:'center', menuDisabled:true },
- { header: '巡检情况说明', dataIndex: 'qk', width:250, menuDisabled:true },
- // { header: '巡检人', dataIndex: 'personnel', width:120,align:'center', menuDisabled:true },
- { header: '巡检人', dataIndex: 'name', width:120,align:'center', menuDisabled:true },
- // { header: '巡检路线', dataIndex: 'route', width:160,align:'center', menuDisabled:true },
- // { header: '巡检标签', dataIndex: 'point_position', width:120,align:'center', menuDisabled:true },
- { header: '巡检时间', dataIndex: 'inspection_time', width:250,align:'center', menuDisabled:true },
- ],
- columnLines: true,
- tbar: [
- {
- xtype: 'button',
- iconCls:'filter_btn',
- text: '筛选',
- listeners: {
- click: filterwin
- }
- },'-',
- {xtype: 'tbfill'},'-',
- {
- xtype: 'button',
- iconCls:'export_btn',
- text: '导出',
- listeners: {
- click: exportbtn_click
- }
- }
- ],
- height: maxHeight,
- width: '100%',
- bbar: new Ext.PagingToolbar({
- store: myStore,
- id:'InspectionRecordListPageToolbar',
- displayInfo: true,
- pageSize: countPerPage,
- prependButtons: true,
- displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
- emptyMsg : "没有记录",
- firstText: '第一页',
- prevText: '前一页',
- nextText: '后一页',
- lastText: '最后一页',
- refreshText: '刷新',
- // doRefresh:function(start){
- // alert(start);
- // relushDataFunction(start); // 调用函数刷新数据
- // this.cursor = start; // 更新页签
- // }
- }),
- frame: true,
- border:false,
- iconCls: 'icon-grid',
- renderTo: Ext.getBody()
- });
- myStore.reload();
- maxHeight = document.documentElement.clientHeight;
- Ext.getCmp('InspectionRecordListPanel').setHeight(maxHeight);
-
- });
|