point.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /**
  2. * Point.js
  3. * 点位管理界面
  4. * emial: yaoqiang@chinausky.com
  5. * create: 2018-12-08
  6. */
  7. Ext.Loader.setConfig({
  8. enabled: true
  9. });
  10. Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');
  11. Ext.require([
  12. 'Ext.grid.*',
  13. 'Ext.data.*',
  14. 'Ext.ux.RowExpander',
  15. 'Ext.selection.CheckboxModel'
  16. ]);
  17. var sm = Ext.create('Ext.selection.CheckboxModel');
  18. Ext.define('Point',{
  19. extend: 'Ext.data.Model',
  20. fields: [
  21. //{name:'I_POINTVER_ID', type:'int'},
  22. {name:'UQ_POINT_ID', type:'string'},
  23. {name:'I_ORDER_IDX', type:'int'},
  24. {name:'V_POINT_ADDRESS', type:'string'},
  25. {name:'I_FLOOR', type:'int'},
  26. {name:'F_HEIGHT', type:'string'},
  27. //{name:'V_COMMENT', type:'string'},
  28. //{name:'UQ_ADMIN_ID', type:'string'},
  29. {name:'I_VERSION', type:'int'},
  30. {name:'D_STORETIME', type:'string'},
  31. ]
  32. });
  33. Ext.onReady(function(){
  34. var baseUrl = document.getElementById('basePath').value;
  35. var theme = document.getElementById('theme').value;
  36. var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'
  37. var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'
  38. var countPerPage = 20;
  39. var maxHeight = 10000;
  40. var chkBoolean = function(flag) {
  41. if(flag)
  42. return chkIcon;
  43. return unchkIcon;
  44. }
  45. var states1 = Ext.create('Ext.data.Store', {
  46. fields: ['status', 'name'],
  47. data : [
  48. // {"status":-1, "name":"全选"},
  49. {"status":"待开通", "name":"待开通"},
  50. {"status":"已开通", "name":"已开通"},
  51. {"status":"已锁定", "name":"已锁定"},
  52. {"status":"注销", "name":"注销"},
  53. ]
  54. });
  55. var clear_append_form = function (){
  56. Ext.getCmp('fa_V_POINT_ADDRESS').setValue("");
  57. Ext.getCmp('fa_I_FLOOR').setValue("");
  58. Ext.getCmp('fa_F_HEIGHT').setValue("");
  59. Ext.getCmp('fa_UQ_ADMIN_ID').setValue("");
  60. Ext.getCmp('fa_V_COMMENT').setValue("");
  61. Ext.getCmp('PointListPanel').getStore().reload();
  62. }
  63. var myStore = Ext.create('Ext.data.Store', {
  64. model: 'Point',
  65. pageSize: countPerPage,
  66. proxy: {
  67. type: 'ajax',
  68. url: baseUrl+'iot/point/getList',
  69. reader: {
  70. type: 'json',
  71. root: 'RESULT',
  72. totalProperty: 'totalCount'
  73. }
  74. },
  75. remoteSort: true
  76. });
  77. var AppendForm = Ext.create('Ext.form.Panel', {
  78. id: 'pointAppendForm',
  79. labelWidth: 55,
  80. url: baseUrl+'iot/point/append',
  81. defaultType: 'textfield',
  82. bodyPadding: 15,
  83. items: [{
  84. fieldLabel:'点位地址',
  85. id: 'fa_V_POINT_ADDRESS',
  86. name:'V_POINT_ADDRESS',
  87. maxLength:20,
  88. maxLengthText:'长度不得超出{0}',
  89. anchor:'75%'
  90. },{
  91. fieldLabel:'楼层',
  92. id: 'fa_I_FLOOR',
  93. name: 'I_FLOOR',
  94. maxLength: 250,
  95. maxLengthText:'长度不得超出{0}',
  96. anchor:'95%'
  97. },{
  98. fieldLabel:'点位部署垂直高度',
  99. id: 'fa_F_HEIGHT',
  100. name: 'F_HEIGHT',
  101. maxLength: 250,
  102. maxLengthText:'长度不得超出{0}',
  103. anchor:'95%'
  104. },{
  105. fieldLabel:'信息录入人ID',
  106. id: 'fa_UQ_ADMIN_ID',
  107. name:'UQ_ADMIN_ID',
  108. maxLength: 30,
  109. maxLengthText:'长度不得超出{0}',
  110. anchor:'95%'
  111. },{
  112. fieldLabel:'新增说明',
  113. id: 'fa_V_COMMENT',
  114. name:'V_COMMENT',
  115. xtype: 'textareafield',
  116. maxLength: 250,
  117. maxLengthText:'长度不得超出{0}',
  118. anchor:'100%'
  119. },{
  120. id:'fa_queryJson',
  121. name:'queryJson',
  122. hidden:true
  123. }],
  124. buttons: [{
  125. text: '提交',
  126. iconCls:'ok_btn',
  127. handler: function() {
  128. var form = this.up('form').getForm();
  129. if (form.isValid()) {
  130. var query = new Object();
  131. query.V_POINT_ADDRESS = Ext.getCmp('fa_V_POINT_ADDRESS').getValue();
  132. query.I_FLOOR = Ext.getCmp('fa_I_FLOOR').getValue();
  133. query.F_HEIGHT = Ext.getCmp('fa_F_HEIGHT').getValue();
  134. query.UQ_ADMIN_ID = Ext.getCmp('fa_UQ_ADMIN_ID').getValue();
  135. query.V_COMMENT = Ext.getCmp('fa_V_COMMENT').getValue();
  136. var jsonstr = Ext.JSON.encode(query);
  137. Ext.getCmp('fa_queryJson').setValue(jsonstr);
  138. form.submit({
  139. method:'post',
  140. success: function(form, action) {
  141. Ext.Msg.alert('操作成功', '新增点位地址已保存', function(btn,txt){
  142. clear_append_form();
  143. });
  144. },
  145. failure: function(form, action) {
  146. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  147. clear_append_form();
  148. });
  149. }
  150. });
  151. }
  152. }
  153. },{
  154. text: '关闭',
  155. iconCls: 'cancel_btn',
  156. handler: function() {
  157. this.up('window').hide();
  158. }
  159. }]
  160. });
  161. var appendwin = function(){
  162. Ext.create('Ext.window.Window', {
  163. title: '新增',
  164. height: 350,
  165. width: 400,
  166. layout: 'fit',
  167. items: AppendForm,
  168. closeAction: 'hide'
  169. }).show();
  170. }
  171. //筛选
  172. var states2 = Ext.create('Ext.data.Store', {
  173. fields: ['status', 'name'],
  174. data : [
  175. {"status":10, "name":"全选"},
  176. {"status":0, "name":"待开通"},
  177. {"status":1, "name":"已开通"},
  178. {"status":2, "name":"已锁定"},
  179. {"status":3, "name":"注销"},
  180. ]
  181. });
  182. var clear_filter_form = function(){
  183. Ext.getCmp('ff_V_POINT_ADDRESS').setValue("");
  184. Ext.getCmp('ff_I_FLOOR').setValue("");
  185. Ext.getCmp('ff_F_HEIGHT').setValue("");
  186. Ext.getCmp('ff_UQ_ADMIN_ID').setValue("");
  187. Ext.getCmp('ff_V_COMMENT').setValue("");
  188. }
  189. var states = Ext.create('Ext.data.Store', {
  190. fields: ['status', 'name'],
  191. data : [
  192. {"status":-1, "name":"全选"},
  193. {"status":0, "name":"无效"},
  194. {"status":1, "name":"有效"}
  195. ]
  196. });
  197. var FilterWin = Ext.create('Ext.form.Panel', {
  198. id: 'PointFilterForm',
  199. labelWidth: 55,
  200. defaultType: 'textfield',
  201. bodyPadding: 15,
  202. items: [{
  203. fieldLabel:'点位地址',
  204. id: 'ff_V_POINT_ADDRESS',
  205. name:'V_POINT_ADDRESS',
  206. maxLength:20,
  207. maxLengthText:'长度不得超出{0}',
  208. value : document.getElementById('vPointAddress').value,
  209. anchor:'75%'
  210. },{
  211. fieldLabel:'楼层',
  212. id:'ff_I_FLOOR',
  213. name:'I_FLOOR',
  214. maxLength: 250,
  215. maxLengthText:'长度不得超出{0}',
  216. value : document.getElementById('iFloor').value,
  217. editable : false
  218. },
  219. // {
  220. // fieldLabel:'点位部署垂直高度',
  221. // id: 'ff_F_HEIGHT',
  222. // name: 'F_HEIGHT',
  223. // maxLength: 250,
  224. // maxLengthText:'长度不得超出{0}',
  225. // value : document.getElementById('fHelght').value,
  226. // anchor:'95%'
  227. // },
  228. {
  229. id:'ff_queryJson',
  230. name:'queryJson',
  231. hidden:true
  232. }],
  233. buttons: [{
  234. text: '提交',
  235. iconCls:'ok_btn',
  236. handler: function() {
  237. var form = this.up('form').getForm();
  238. if (form.isValid()) {
  239. var query = new Object();
  240. if(Ext.getCmp('ff_V_POINT_ADDRESS').getValue().length>0)
  241. query.V_POINT_ADDRESS = Ext.getCmp('ff_V_POINT_ADDRESS').getValue();
  242. if(Ext.getCmp('ff_I_FLOOR').getValue().length>0)
  243. query.I_FLOOR = Ext.getCmp('ff_I_FLOOR').getValue();
  244. // if(Ext.getCmp('ff_F_HEIGHT').getValue().length>0)
  245. // query.F_HEIGHT = Ext.getCmp('ff_F_HEIGHT').getValue();
  246. var jsonstr = Ext.JSON.encode(query);
  247. myStore.getProxy().extraParams = {
  248. queryJson : jsonstr
  249. };
  250. Ext.getCmp('PointListPageToolbar').moveFirst();
  251. Ext.getCmp('vPointAddress').setValue(query.V_POINT_ADDRESS);
  252. Ext.getCmp('iFloor').setValue(query.I_FLOOR);
  253. //Ext.getCmp('fHelght').setValue(query.F_HEIGHT);
  254. // myStore.reload();
  255. clear_filter_form();
  256. this.up('window').hide();
  257. }
  258. }
  259. },{
  260. text: '关闭',
  261. iconCls: 'cancel_btn',
  262. handler: function() {
  263. this.up('window').hide();
  264. }
  265. }]
  266. });
  267. var filterwin = function() {
  268. Ext.create('Ext.window.Window',{
  269. title: '筛选',
  270. height: 300,
  271. width: 350,
  272. layout: 'fit',
  273. items: FilterWin,
  274. closeAction: 'hide'
  275. }).show();
  276. }
  277. var clear_modify_form = function (){
  278. Ext.getCmp('fm_V_POINT_ADDRESS').setValue("");
  279. Ext.getCmp('fm_I_FLOOR').setValue("");
  280. Ext.getCmp('fm_F_HEIGHT').setValue("");
  281. Ext.getCmp('fm_UQ_ADMIN_ID').setValue("");
  282. Ext.getCmp('fm_V_COMMENT').setValue("");
  283. Ext.getCmp('PointListPanel').getStore().reload();
  284. }
  285. var ModifyForm = Ext.create('Ext.form.Panel', {
  286. id: 'PointEditForm',
  287. labelWidth: 55,
  288. url: baseUrl+'iot/point/update',
  289. defaultType: 'textfield',
  290. bodyPadding: 15,
  291. items: [{
  292. fieldLabel:'点位地址',
  293. id: 'fm_V_POINT_ADDRESS',
  294. name:'V_POINT_ADDRESS',
  295. maxLength:20,
  296. maxLengthText:'长度不得超出{0}',
  297. anchor:'75%'
  298. },{
  299. fieldLabel:'楼层',
  300. id: 'fm_I_FLOOR',
  301. name: 'I_FLOOR',
  302. maxLength: 250,
  303. maxLengthText:'长度不得超出{0}',
  304. anchor:'95%'
  305. },{
  306. fieldLabel:'点位部署垂直高度',
  307. id: 'fm_F_HEIGHT',
  308. name: 'F_HEIGHT',
  309. maxLength: 250,
  310. maxLengthText:'长度不得超出{0}',
  311. anchor:'95%'
  312. },{
  313. fieldLabel:'信息录入人ID',
  314. id: 'fm_UQ_ADMIN_ID',
  315. name:'UQ_ADMIN_ID',
  316. maxLength: 30,
  317. value:"0000-0000-0000",
  318. maxLengthText:'长度不得超出{0}',
  319. anchor:'95%'
  320. },{
  321. fieldLabel:'修改说明',
  322. id: 'fm_V_COMMENT',
  323. name:'V_COMMENT',
  324. xtype: 'textareafield',
  325. maxLength: 250,
  326. maxLengthText:'长度不得超出{0}',
  327. anchor:'100%'
  328. },{
  329. id: 'fm_UQ_POINT_ID',
  330. name:'UQ_POINT_ID',
  331. hidden:true
  332. },{
  333. id:'fm_queryJson',
  334. name:'queryJson',
  335. hidden:true
  336. }],
  337. buttons: [{
  338. text: '修改',
  339. iconCls:'ok_btn',
  340. handler: function() {
  341. var form = this.up('form').getForm();
  342. if (form.isValid()) {
  343. var query = new Object();
  344. query.UQ_POINT_ID = Ext.getCmp('fm_UQ_POINT_ID').getValue();
  345. query.V_POINT_ADDRESS = Ext.getCmp('fm_V_POINT_ADDRESS').getValue();
  346. query.I_FLOOR = Ext.getCmp('fm_I_FLOOR').getValue();
  347. query.F_HEIGHT = Ext.getCmp('fm_F_HEIGHT').getValue();
  348. query.UQ_ADMIN_ID = Ext.getCmp('fm_UQ_ADMIN_ID').getValue();
  349. query.V_COMMENT = Ext.getCmp('fm_V_COMMENT').getValue();
  350. var jsonstr = Ext.JSON.encode(query);
  351. Ext.getCmp('fm_queryJson').setValue(jsonstr);
  352. form.submit({
  353. method:'post',
  354. success: function(form, action) {
  355. Ext.Msg.alert('操作成功', '已修改', function(btn,txt){
  356. clear_modify_form();
  357. });
  358. },
  359. failure: function(form, action) {
  360. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  361. clear_modify_form();
  362. });
  363. }
  364. });
  365. this.up('window').hide();
  366. }
  367. }
  368. },{
  369. text: '关闭',
  370. iconCls: 'cancel_btn',
  371. handler: function() {
  372. this.up('window').hide();
  373. }
  374. }]
  375. });
  376. var modifywin = function(){
  377. Ext.create('Ext.window.Window', {
  378. title: '修改',
  379. height: 350,
  380. width: 400,
  381. layout: 'fit',
  382. items: ModifyForm,
  383. closeAction: 'hide'
  384. }).show();
  385. }
  386. var chk_sm = function() {
  387. if(sm.getCount()==1){
  388. modifywin();
  389. var selected = sm.getSelection( );
  390. Ext.getCmp('fm_UQ_POINT_ID').setValue(selected[0].raw.UQ_POINT_ID);
  391. Ext.getCmp('fm_V_POINT_ADDRESS').setValue(selected[0].raw.V_POINT_ADDRESS);
  392. Ext.getCmp('fm_I_FLOOR').setValue(selected[0].raw.I_FLOOR);
  393. Ext.getCmp('fm_F_HEIGHT').setValue(selected[0].raw.F_HEIGHT);
  394. }else{
  395. Ext.Msg.alert('请先选择','请先选择一条记录,再点击修改');
  396. }
  397. }
  398. //
  399. // var deletewin = function() {
  400. // window.alert("无此功能");
  401. //
  402. // }
  403. Ext.create('Ext.grid.Panel', {
  404. title: '点位地址管理',
  405. id: 'PointListPanel',
  406. store: myStore,
  407. selModel: sm,
  408. columns: [
  409. //{ header: 'ID', dataIndex: 'UQ_POINT_ID',hidden:true, menuDisabled:true },
  410. { header: '序号', dataIndex: 'I_ORDER_IDX', width:40, menuDisabled:true },
  411. { header: '点位地址', dataIndex: 'V_POINT_ADDRESS', width:120,align:'center', menuDisabled:true },
  412. { header: '楼层', dataIndex: 'I_FLOOR', width:160,align:'center', menuDisabled:true },
  413. { header: '点位部署垂直高度', dataIndex: 'F_HEIGHT', width:120,align:'center', menuDisabled:true },
  414. { header: '保存时间', dataIndex: 'D_STORETIME',width:160, align:'center', menuDisabled:true },
  415. { header: '记录版本', dataIndex: 'I_VERSION', width:120, align:'center', menuDisabled:true },
  416. {
  417. xtype : 'actioncolumn',
  418. width:20,
  419. sortable:false,
  420. //这里
  421. align:'center',
  422. menuDisabled:true,
  423. items:[{
  424. icon: '../../res/img/common/forum.gif',
  425. tooltip: '版本记录',
  426. handler: function(grid, rowIndex, colIndex) {
  427. var rec = grid.getStore().getAt(rowIndex);
  428. window.location = 'version.jsp?theme='+theme+'&pointId='+rec.get('UQ_POINT_ID');
  429. }
  430. }]
  431. }
  432. ],
  433. columnLines: true,
  434. tbar: [
  435. {
  436. xtype: 'button',
  437. iconCls:'filter_btn',
  438. text: '筛选',
  439. listeners: {
  440. click: filterwin
  441. }
  442. },'-',
  443. {xtype: 'tbfill'},'-',
  444. {
  445. xtype: 'button',
  446. iconCls:'append_btn',
  447. text: '新增',
  448. listeners: {
  449. click: appendwin
  450. }
  451. },
  452. {
  453. xtype: 'button',
  454. iconCls:'modify_btn',
  455. text: '修改',
  456. listeners: {
  457. click: chk_sm
  458. }
  459. },
  460. // {
  461. // xtype: 'button',
  462. // iconCls:'delete_btn',
  463. // text: '注销',
  464. // listeners: {
  465. // click: deletewin
  466. // }
  467. // }
  468. // ,{
  469. // xtype: 'button',
  470. // iconCls:'delete_btn',
  471. // text: '导出',
  472. // listeners: {
  473. // click: export_sj
  474. // }
  475. // }
  476. ],
  477. height: maxHeight,
  478. width: '100%',
  479. bbar: new Ext.PagingToolbar({
  480. store: myStore,
  481. id:'PointListPageToolbar',
  482. displayInfo: true,
  483. pageSize: countPerPage,
  484. prependButtons: true,
  485. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  486. emptyMsg : "没有记录",
  487. firstText: '第一页',
  488. prevText: '前一页',
  489. nextText: '后一页',
  490. lastText: '最后一页',
  491. refreshText: '刷新',
  492. // doRefresh:function(start){
  493. // alert(start);
  494. // relushDataFunction(start); // 调用函数刷新数据
  495. // this.cursor = start; // 更新页签
  496. // }
  497. }),
  498. frame: true,
  499. border:false,
  500. iconCls: 'icon-grid',
  501. renderTo: Ext.getBody()
  502. });
  503. myStore.reload();
  504. maxHeight = document.documentElement.clientHeight;
  505. Ext.getCmp('PointListPanel').setHeight(maxHeight);
  506. });