unit.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. /**
  2. * Company.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('Unit',{
  19. extend: 'Ext.data.Model',
  20. fields: [
  21. {name:'UQ_UNIT_ID', type:'string'},
  22. {name:'I_ORDER_IDX', type:'int'},
  23. {name:'V_UNIT_CODE', type:'string'},
  24. {name:'UQ_IOTCARD_ID', type:'string'},
  25. {name:'UQ_COMPANY_ID', type:'string'},
  26. {name:'UQ_UNIT_MODEL_ID', type:'string'},
  27. {name:'V_UNIT_NAME', type:'string'},
  28. {name:'V_POSITION', type:'string'},
  29. {name:'UQ_EMPLOYEE_ID', type:'string'},
  30. {name:'E_STATUS', type:'string'},
  31. {name:'V_COMMENT', type:'string'},
  32. {name:'UQ_ADMIN_ID', type:'string'},
  33. {name:'I_VERSION', type:'int'},
  34. {name:'D_INSTALLTIME', type:'string'},
  35. ]
  36. });
  37. Ext.onReady(function(){
  38. var baseUrl = document.getElementById('basePath').value;
  39. var theme = document.getElementById('theme').value;
  40. var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'
  41. var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'
  42. var countPerPage = 20;
  43. var maxHeight = 10000;
  44. var chkBoolean = function(flag) {
  45. if(flag)
  46. return chkIcon;
  47. return unchkIcon;
  48. }
  49. var states1 = Ext.create('Ext.data.Store', {
  50. fields: ['status', 'name'],
  51. data : [
  52. // {"status":-1, "name":"全选"},
  53. {"status":"待开通", "name":"待开通"},
  54. {"status":"已开通", "name":"已开通"},
  55. {"status":"已锁定", "name":"已锁定"},
  56. {"status":"注销", "name":"注销"},
  57. ]
  58. });
  59. var clear_append_form = function (){
  60. Ext.getCmp('fa_V_UNIT_NAME').setValue("");
  61. Ext.getCmp('fa_V_UNIT_CODE').setValue("");
  62. Ext.getCmp('fa_UQ_COMPANY_ID').setValue("");
  63. Ext.getCmp('fa_UQ_UNIT_MODEL_ID').setValue("");
  64. Ext.getCmp('fa_V_POSITION').setValue("");
  65. Ext.getCmp('fa_UQ_EMPLOYEE_ID').setValue("");
  66. Ext.getCmp('fa_UQ_ADMIN_ID').setValue("");
  67. Ext.getCmp('fa_UQ_IOTCARD_ID').setValue("");
  68. Ext.getCmp('fa_V_COMMENT').setValue("");
  69. //Ext.getCmp('fa_E_STATUS').setValue();
  70. Ext.getCmp('UnitListPanel').getStore().reload();
  71. }
  72. var myStore = Ext.create('Ext.data.Store', {
  73. model: 'Unit',
  74. pageSize: countPerPage,
  75. proxy: {
  76. type: 'ajax',
  77. url: baseUrl+'iot/unit/getList',
  78. reader: {
  79. type: 'json',
  80. root: 'RESULT',
  81. totalProperty: 'totalCount'
  82. }
  83. },
  84. remoteSort: true
  85. });
  86. var AppendForm = Ext.create('Ext.form.Panel', {
  87. id: 'unitAppendForm',
  88. labelWidth: 55,
  89. url: baseUrl+'iot/unit/append',
  90. defaultType: 'textfield',
  91. bodyPadding: 15,
  92. items: [{
  93. fieldLabel:'监控单元名称',
  94. id: 'fa_V_UNIT_NAME',
  95. name:'V_UNIT_NAME',
  96. maxLength:20,
  97. maxLengthText:'长度不得超出{0}',
  98. anchor:'75%'
  99. },{
  100. fieldLabel:'监控单元编号',
  101. id: 'fa_V_UNIT_CODE',
  102. name: 'V_UNIT_CODE',
  103. maxLength: 250,
  104. maxLengthText:'长度不得超出{0}',
  105. anchor:'95%'
  106. },{
  107. fieldLabel:'物联网卡ID',
  108. id: 'fa_UQ_IOTCARD_ID',
  109. name: 'UQ_IOTCARD_ID',
  110. maxLength: 250,
  111. maxLengthText:'长度不得超出{0}',
  112. anchor:'95%'
  113. },{
  114. fieldLabel:'单位/部门ID',
  115. id: 'fa_UQ_COMPANY_ID',
  116. name: 'UQ_COMPANY_ID',
  117. maxLength: 250,
  118. maxLengthText:'长度不得超出{0}',
  119. anchor:'95%'
  120. },{
  121. fieldLabel:'监控单元型号ID',
  122. id: 'fa_UQ_UNIT_MODEL_ID',
  123. name: 'UQ_UNIT_MODEL_ID',
  124. maxLength: 250,
  125. maxLengthText:'长度不得超出{0}',
  126. anchor:'95%'
  127. },{
  128. fieldLabel:'监控单元安装位置',
  129. id: 'fa_V_POSITION',
  130. name: 'V_POSITION',
  131. maxLength: 250,
  132. maxLengthText:'长度不得超出{0}',
  133. anchor:'95%'
  134. },{
  135. fieldLabel:'安装人ID',
  136. id: 'fa_UQ_EMPLOYEE_ID',
  137. name: 'UQ_EMPLOYEE_ID',
  138. maxLength: 250,
  139. maxLengthText:'长度不得超出{0}',
  140. anchor:'95%'
  141. },{
  142. fieldLabel:'信息录入人ID',
  143. id: 'fa_UQ_ADMIN_ID',
  144. name:'UQ_ADMIN_ID',
  145. maxLength: 30,
  146. maxLengthText:'长度不得超出{0}',
  147. anchor:'95%'
  148. },{
  149. fieldLabel:'新增说明',
  150. id: 'fa_V_COMMENT',
  151. name:'V_COMMENT',
  152. xtype: 'textareafield',
  153. maxLength: 250,
  154. maxLengthText:'长度不得超出{0}',
  155. anchor:'100%'
  156. },{
  157. id:'fa_queryJson',
  158. name:'queryJson',
  159. hidden:true
  160. }],
  161. buttons: [{
  162. text: '提交',
  163. iconCls:'ok_btn',
  164. handler: function() {
  165. var form = this.up('form').getForm();
  166. if (form.isValid()) {
  167. var query = new Object();
  168. query.V_UNIT_NAME = Ext.getCmp('fa_V_UNIT_NAME').getValue();
  169. query.V_UNIT_CODE = Ext.getCmp('fa_V_UNIT_CODE').getValue();
  170. query.UQ_COMPANY_ID = Ext.getCmp('fa_UQ_COMPANY_ID').getValue();
  171. query.UQ_UNIT_MODEL_ID = Ext.getCmp('fa_UQ_UNIT_MODEL_ID').getValue();
  172. query.V_POSITION = Ext.getCmp('fa_V_POSITION').getValue();
  173. query.UQ_ADMIN_ID = Ext.getCmp('fa_UQ_ADMIN_ID').getValue();
  174. query.UQ_EMPLOYEE_ID = Ext.getCmp('fa_UQ_EMPLOYEE_ID').getValue();
  175. query.UQ_IOTCARD_ID = Ext.getCmp('fa_UQ_IOTCARD_ID').getValue();
  176. query.V_COMMENT = Ext.getCmp('fa_V_COMMENT').getValue();
  177. // query.E_STATUS = Ext.getCmp('fa_E_STATUS').getValue(0);
  178. var jsonstr = Ext.JSON.encode(query);
  179. Ext.getCmp('fa_queryJson').setValue(jsonstr);
  180. form.submit({
  181. method:'post',
  182. success: function(form, action) {
  183. Ext.Msg.alert('操作成功', '新增单位已保存', function(btn,txt){
  184. clear_append_form();
  185. });
  186. },
  187. failure: function(form, action) {
  188. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  189. clear_append_form();
  190. });
  191. }
  192. });
  193. }
  194. }
  195. },{
  196. text: '关闭',
  197. iconCls: 'cancel_btn',
  198. handler: function() {
  199. this.up('window').hide();
  200. }
  201. }]
  202. });
  203. var appendwin = function(){
  204. Ext.create('Ext.window.Window', {
  205. title: '新增监控单元',
  206. height: 450,
  207. width: 400,
  208. layout: 'fit',
  209. items: AppendForm,
  210. closeAction: 'hide'
  211. }).show();
  212. }
  213. //筛选
  214. var states2 = Ext.create('Ext.data.Store', {
  215. fields: ['status', 'name'],
  216. data : [
  217. {"status":10, "name":"全选"},
  218. {"status":0, "name":"待开通"},
  219. {"status":1, "name":"已开通"},
  220. {"status":2, "name":"已锁定"},
  221. {"status":3, "name":"注销"},
  222. ]
  223. });
  224. var clear_filter_form = function(){
  225. Ext.getCmp('ff_V_UNIT_NAME').setValue("");
  226. Ext.getCmp('ff_UQ_UNIT_MODEL_ID').setValue("");
  227. Ext.getCmp('ff_UQ_COMPANY_ID').setValue("");
  228. Ext.getCmp('ff_V_UNIT_CODE').setValue("");
  229. Ext.getCmp('ff_UQ_EMPLOYEE_ID').setValue("");
  230. Ext.getCmp('ff_E_STATUS').setValue("10");
  231. // Ext.getCmp('ff_V_COMMENT').setValue("");
  232. }
  233. //
  234. //
  235. var states = Ext.create('Ext.data.Store', {
  236. fields: ['status', 'name'],
  237. data : [
  238. {"status":-1, "name":"全选"},
  239. {"status":0, "name":"无效"},
  240. {"status":1, "name":"有效"}
  241. ]
  242. });
  243. var FilterWin = Ext.create('Ext.form.Panel', {
  244. id: 'UnitFilterForm',
  245. labelWidth: 55,
  246. defaultType: 'textfield',
  247. bodyPadding: 15,
  248. items: [{
  249. fieldLabel:'监控单元名称',
  250. id: 'ff_V_UNIT_NAME',
  251. name:'V_UNIT_NAME',
  252. maxLength:20,
  253. maxLengthText:'长度不得超出{0}',
  254. value : document.getElementById('unitName').value,
  255. anchor:'75%'
  256. },{
  257. fieldLabel:'当前状态',
  258. id:'ff_E_STATUS',
  259. name:'E_STATUS',
  260. xtype:'combo',
  261. store:states2,
  262. displayField : 'name',
  263. valueField : 'status',
  264. value : document.getElementById('estatus').value,
  265. editable : false
  266. },{
  267. fieldLabel:'监控单元型号ID',
  268. id: 'ff_UQ_UNIT_MODEL_ID',
  269. name: 'UQ_UNIT_MODEL_ID',
  270. maxLength: 250,
  271. maxLengthText:'长度不得超出{0}',
  272. value : document.getElementById('unitModelId').value,
  273. anchor:'95%'
  274. },{
  275. fieldLabel:'单位/部门ID',
  276. id: 'ff_UQ_COMPANY_ID',
  277. name:'UQ_COMPANY_ID',
  278. maxLength: 30,
  279. maxLengthText:'长度不得超出{0}',
  280. value : document.getElementById('companyId').value,
  281. anchor:'95%'
  282. },{
  283. fieldLabel:'监控单元编号',
  284. id: 'ff_V_UNIT_CODE',
  285. name:'UQ_V_UNIT_CODE',
  286. maxLength: 30,
  287. maxLengthText:'长度不得超出{0}',
  288. value : document.getElementById('unitCode').value,
  289. anchor:'95%'
  290. },{
  291. fieldLabel:'安装人ID',
  292. id: 'ff_UQ_EMPLOYEE_ID',
  293. name:'UQ_EMPLOYEE_ID',
  294. maxLength: 30,
  295. maxLengthText:'长度不得超出{0}',
  296. value : document.getElementById('employeeId').value,
  297. anchor:'95%'
  298. },{
  299. id:'ff_queryJson',
  300. name:'queryJson',
  301. hidden:true
  302. }],
  303. buttons: [{
  304. text: '提交',
  305. iconCls:'ok_btn',
  306. handler: function() {
  307. var form = this.up('form').getForm();
  308. if (form.isValid()) {
  309. var query = new Object();
  310. if(Ext.getCmp('ff_V_UNIT_NAME').getValue().length>0)
  311. query.V_UNIT_NAME = Ext.getCmp('ff_V_UNIT_NAME').getValue();
  312. if(Ext.getCmp('ff_UQ_UNIT_MODEL_ID').getValue().length>0)
  313. query.UQ_UNIT_MODEL_ID = Ext.getCmp('ff_UQ_UNIT_MODEL_ID').getValue();
  314. query.E_STATUS = Ext.getCmp('ff_E_STATUS').getValue();
  315. if(Ext.getCmp('ff_UQ_COMPANY_ID').getValue().length>0)
  316. query.UQ_COMPANY_ID = Ext.getCmp('ff_UQ_COMPANY_ID').getValue();
  317. if(Ext.getCmp('ff_V_UNIT_CODE').getValue().length>0)
  318. query.V_UNIT_CODE = Ext.getCmp('ff_V_UNIT_CODE').getValue();
  319. if(Ext.getCmp('ff_UQ_EMPLOYEE_ID').getValue().length>0)
  320. query.UQ_EMPLOYEE_ID = Ext.getCmp('ff_UQ_EMPLOYEE_ID').getValue();
  321. var jsonstr = Ext.JSON.encode(query);
  322. myStore.getProxy().extraParams = {
  323. queryJson : jsonstr
  324. };
  325. Ext.getCmp('UnitListPageToolbar').moveFirst();
  326. Ext.getCmp('unitName').setValue(query.V_UNIT_NAME);
  327. Ext.getCmp('unitModelId').setValue(query.UQ_UNIT_MODEL_ID);
  328. Ext.getCmp('companyId').setValue(query.UQ_COMPANY_ID);
  329. Ext.getCmp('unitCode').setValue(query.UQ_V_UNIT_CODE);
  330. Ext.getCmp('employeeId').setValue(query.UQ_EMPLOYEE_ID);
  331. Ext.getCmp('estatus').setValue(query.E_STATUS);
  332. // myStore.reload();
  333. clear_filter_form();
  334. this.up('window').hide();
  335. }
  336. }
  337. },{
  338. text: '关闭',
  339. iconCls: 'cancel_btn',
  340. handler: function() {
  341. this.up('window').hide();
  342. }
  343. }]
  344. });
  345. var filterwin = function() {
  346. Ext.create('Ext.window.Window',{
  347. title: '筛选',
  348. height: 300,
  349. width: 350,
  350. layout: 'fit',
  351. items: FilterWin,
  352. closeAction: 'hide'
  353. }).show();
  354. }
  355. var clear_modify_form = function (){
  356. //Ext.getCmp('fm_V_UNIT_ID').setValue("");
  357. Ext.getCmp('fm_V_UNIT_NAME').setValue("");
  358. Ext.getCmp('fm_V_UNIT_CODE').setValue("");
  359. Ext.getCmp('fm_UQ_COMPANY_ID').setValue("");
  360. Ext.getCmp('fm_UQ_UNIT_MODEL_ID').setValue("");
  361. Ext.getCmp('fm_V_POSITION').setValue("");
  362. Ext.getCmp('fm_UQ_EMPLOYEE_ID').setValue("");
  363. Ext.getCmp('fm_UQ_ADMIN_ID').setValue("0000-0000-0000");
  364. Ext.getCmp('fm_E_STATUS').setValue(10);
  365. Ext.getCmp('fm_UQ_IOTCARD_ID').setValue("");
  366. Ext.getCmp('fm_V_COMMENT').setValue("");
  367. Ext.getCmp('UnitListPanel').getStore().reload();
  368. }
  369. var ModifyForm = Ext.create('Ext.form.Panel', {
  370. id: 'UnitEditForm',
  371. labelWidth: 55,
  372. url: baseUrl+'iot/unit/update',
  373. defaultType: 'textfield',
  374. bodyPadding: 15,
  375. items: [{
  376. fieldLabel:'监控单元名称',
  377. id: 'fm_V_UNIT_NAME',
  378. name:'V_UNIT_NAME',
  379. maxLength:20,
  380. maxLengthText:'长度不得超出{0}',
  381. anchor:'75%'
  382. },{
  383. fieldLabel:'监控单元编号',
  384. id: 'fm_V_UNIT_CODE',
  385. name: 'V_UNIT_CODE',
  386. maxLength: 250,
  387. maxLengthText:'长度不得超出{0}',
  388. anchor:'95%'
  389. },
  390. {
  391. fieldLabel:'单位/部门ID',
  392. id: 'fm_UQ_COMPANY_ID',
  393. name: 'UQ_COMPANY_ID',
  394. maxLength: 250,
  395. maxLengthText:'长度不得超出{0}',
  396. anchor:'95%'
  397. },{
  398. fieldLabel:'监控单元型号ID',
  399. id: 'fm_UQ_UNIT_MODEL_ID',
  400. name: 'UQ_UNIT_MODEL_ID',
  401. maxLength: 250,
  402. maxLengthText:'长度不得超出{0}',
  403. anchor:'95%'
  404. },{
  405. fieldLabel:'监控单元安装位置',
  406. id: 'fm_V_POSITION',
  407. name: 'V_POSITION',
  408. maxLength: 250,
  409. maxLengthText:'长度不得超出{0}',
  410. anchor:'95%'
  411. },{
  412. fieldLabel:'安装人ID',
  413. id: 'fm_UQ_EMPLOYEE_ID',
  414. name: 'UQ_EMPLOYEE_ID',
  415. maxLength: 250,
  416. maxLengthText:'长度不得超出{0}',
  417. anchor:'95%'
  418. },{
  419. fieldLabel:'录入人ID',
  420. id: 'fm_UQ_ADMIN_ID',
  421. name:'UQ_ADMIN_ID',
  422. maxLength: 250,
  423. value : "0000-0000-0000",
  424. maxLengthText:'长度不得超出{0}',
  425. anchor:'95%'
  426. },{
  427. fieldLabel:'物联网卡ID',
  428. id: 'fm_UQ_IOTCARD_ID',
  429. name: 'UQ_IOTCARD_ID',
  430. maxLength: 250,
  431. maxLengthText:'长度不得超出{0}',
  432. anchor:'95%'
  433. },{
  434. fieldLabel:'当前状态',
  435. id:'fm_E_STATUS',
  436. name:'E_STATUS',
  437. xtype:'combo',
  438. store:states1,
  439. displayField : 'name',
  440. valueField : 'status',
  441. value : 0,
  442. editable : false
  443. },{
  444. fieldLabel:'新增说明',
  445. id: 'fm_V_COMMENT',
  446. name:'V_COMMENT',
  447. xtype: 'textareafield',
  448. maxLength: 250,
  449. maxLengthText:'长度不得超出{0}',
  450. anchor:'100%'
  451. },{
  452. id: 'fm_UQ_UNIT_ID',
  453. name:'UQ_UNIT_ID',
  454. hidden:true
  455. },{
  456. id:'fm_queryJson',
  457. name:'queryJson',
  458. hidden:true
  459. }],
  460. buttons: [{
  461. text: '修改',
  462. iconCls:'ok_btn',
  463. handler: function() {
  464. var form = this.up('form').getForm();
  465. if (form.isValid()) {
  466. var query = new Object();
  467. query.UQ_UNIT_ID = Ext.getCmp('fm_UQ_UNIT_ID').getValue();
  468. query.UQ_IOTCARD_ID = Ext.getCmp('fm_UQ_IOTCARD_ID').getValue();
  469. query.V_COMMENT = Ext.getCmp('fm_V_COMMENT').getValue();
  470. query.V_UNIT_NAME = Ext.getCmp('fm_V_UNIT_NAME').getValue();
  471. query.V_UNIT_CODE = Ext.getCmp('fm_V_UNIT_CODE').getValue();
  472. query.UQ_COMPANY_ID = Ext.getCmp('fm_UQ_COMPANY_ID').getValue();
  473. query.UQ_UNIT_MODEL_ID = Ext.getCmp('fm_UQ_UNIT_MODEL_ID').getValue();
  474. query.V_POSITION = Ext.getCmp('fm_V_POSITION').getValue();
  475. query.UQ_EMPLOYEE_ID = Ext.getCmp('fm_UQ_EMPLOYEE_ID').getValue();
  476. query.UQ_ADMIN_ID = Ext.getCmp('fm_UQ_ADMIN_ID').getValue();
  477. if(Ext.getCmp('fm_E_STATUS').getValue()=="待开通"){
  478. query.E_STATUS=0;
  479. }
  480. if(Ext.getCmp('fm_E_STATUS').getValue()=="已开通"){
  481. query.E_STATUS=1;
  482. }
  483. if(Ext.getCmp('fm_E_STATUS').getValue()=="已锁定"){
  484. query.E_STATUS=2;
  485. }
  486. if(Ext.getCmp('fm_E_STATUS').getValue()=="注销"){
  487. query.E_STATUS=3;
  488. }
  489. var jsonstr = Ext.JSON.encode(query);
  490. Ext.getCmp('fm_queryJson').setValue(jsonstr);
  491. form.submit({
  492. method:'post',
  493. success: function(form, action) {
  494. //Ext.getCmp('adminId').setValue(query.UQ_ADMIN_ID);
  495. Ext.Msg.alert('操作成功', '已修改', function(btn,txt){
  496. clear_modify_form();
  497. });
  498. },
  499. failure: function(form, action) {
  500. Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  501. clear_modify_form();
  502. });
  503. }
  504. });
  505. this.up('window').hide();
  506. }
  507. }
  508. },{
  509. text: '关闭',
  510. iconCls: 'cancel_btn',
  511. handler: function() {
  512. this.up('window').hide();
  513. }
  514. }]
  515. });
  516. var modifywin = function(){
  517. Ext.create('Ext.window.Window', {
  518. title: '修改监控单元',
  519. height: 500,
  520. width: 400,
  521. layout: 'fit',
  522. items: ModifyForm,
  523. closeAction: 'hide'
  524. }).show();
  525. }
  526. var chk_sm = function() {
  527. if(sm.getCount()==1){
  528. modifywin();
  529. var selected = sm.getSelection( );
  530. // var estatus = parseInt(selected[0].raw.E_STATUS);
  531. Ext.getCmp('fm_UQ_IOTCARD_ID').setValue(selected[0].raw.UQ_IOTCARD_ID);
  532. Ext.getCmp('fm_E_STATUS').setValue(selected[0].raw.E_STATUS);
  533. //Ext.getCmp('fm_V_COMMENT').setValue(selected[0].raw.V_COMMENT);
  534. Ext.getCmp('fm_UQ_UNIT_ID').setValue(selected[0].raw.UQ_UNIT_ID);
  535. Ext.getCmp('fm_V_UNIT_NAME').setValue(selected[0].raw.V_UNIT_NAME);
  536. Ext.getCmp('fm_V_UNIT_CODE').setValue(selected[0].raw.V_UNIT_CODE);
  537. Ext.getCmp('fm_V_POSITION').setValue(selected[0].raw.V_POSITION);
  538. Ext.getCmp('fm_UQ_COMPANY_ID').setValue(selected[0].raw.UQ_COMPANY_ID);
  539. Ext.getCmp('fm_UQ_UNIT_MODEL_ID').setValue(selected[0].raw.UQ_UNIT_MODEL_ID);
  540. //Ext.getCmp('fm_UQ_ADMIN_ID').setValue(selected[0].raw.UQ_ADMIN_ID);
  541. Ext.getCmp('fm_UQ_EMPLOYEE_ID').setValue(selected[0].raw.UQ_EMPLOYEE_ID);
  542. }else{
  543. Ext.Msg.alert('请先选择','请先选择一条记录,再点击修改');
  544. }
  545. }
  546. var clear_filter_form1 = function(){
  547. Ext.getCmp('fc_V_COMPANY_NAME').setValue("");
  548. Ext.getCmp('fc_V_COMPANY_ADDRESS_0').setValue("");
  549. Ext.getCmp('fc_E_STATUS').setValue(-1);
  550. Ext.getCmp('fc_UQ_ADMIN_ID').setValue("");
  551. Ext.getCmp('fc_V_COMMENT').setValue("");
  552. // Ext.getCmp('PermissionListPanel').getStore().reload();
  553. }
  554. var deletewin = function() {
  555. if(sm.getCount()>=1){
  556. // var companyname = selected[0].raw.V_COMPANY_NAME;
  557. // window.alert(selected[0].raw);
  558. var query = new Object();
  559. var list = new Array();
  560. for (var i=0;i<sm.getCount();i++)
  561. {
  562. var selected = sm.getSelection( );
  563. var o = new Object();
  564. o.UQ_UNIT_ID = selected[i].raw.UQ_UNIT_ID;
  565. list.push(o);
  566. }
  567. query.UNIT_LIST = list;
  568. var jsonstr= Ext.JSON.encode(query);
  569. Ext.MessageBox.confirm('注销监控单元','是否注销'+sm.getCount()+'个监控单元?',function(btn){
  570. if(btn=='yes'){
  571. Ext.Ajax.request( {
  572. timeout : 3000000,
  573. url: baseUrl+'iot/unit/del',
  574. params : 'queryJson='+ jsonstr,
  575. success: function(resp,opts){
  576. myStore.reload();
  577. }
  578. });
  579. }
  580. },this);
  581. }else{
  582. Ext.Msg.alert('请先选择','请先选择一条记录,再点击删除');
  583. }
  584. }
  585. //导出
  586. // var export_sj = function() {
  587. // Ext.Ajax.request( {
  588. // timeout : 3000000,
  589. // url: baseUrl+'iot/unit/exd',
  590. //// params : 'queryJson='+ jsonstr,
  591. //// success: function(resp,opts){
  592. //// myStore.reload();
  593. //// }
  594. // });
  595. // }
  596. //导出。
  597. Ext.create('Ext.grid.Panel', {
  598. title: '监控单元管理',
  599. id: 'UnitListPanel',
  600. store: myStore,
  601. selModel: sm,
  602. columns: [
  603. //{ header: 'ID', dataIndex: 'UQ_UNIT_ID',hidden:true, menuDisabled:true },
  604. { header: '序号', dataIndex: 'I_ORDER_IDX', width:40, menuDisabled:true },
  605. { header: '监控单元名称', dataIndex: 'V_UNIT_NAME', width:120,align:'center', menuDisabled:true },
  606. { header: '监控单元安装位置', dataIndex: 'V_POSITION', width:160,align:'center', menuDisabled:true },
  607. { header: '监控单元型号ID', dataIndex: 'UQ_UNIT_MODEL_ID', width:120,align:'center', menuDisabled:true },
  608. { header: '单位/部门ID', dataIndex: 'UQ_COMPANY_ID', width:120,align:'center', menuDisabled:true },
  609. { header: '安装人ID', dataIndex: 'UQ_EMPLOYEE_ID', width:100,align:'center', menuDisabled:true },
  610. { header: '监控单元编号', dataIndex: 'V_UNIT_CODE', width:120,align:'center', menuDisabled:true },
  611. { header: '当前状态', dataIndex: 'E_STATUS',width:120, align:'center', menuDisabled:true },
  612. { header: '保存时间', dataIndex: 'D_INSTALLTIME',width:160, align:'center', menuDisabled:true },
  613. { header: '记录版本', dataIndex: 'I_VERSION', width:120, align:'center', menuDisabled:true },
  614. {
  615. xtype : 'actioncolumn',
  616. width:20,
  617. sortable:false,
  618. //这里
  619. align:'center',
  620. menuDisabled:true,
  621. items:[{
  622. icon: '../../res/img/common/forum.gif',
  623. tooltip: '版本记录',
  624. handler: function(grid, rowIndex, colIndex) {
  625. var rec = grid.getStore().getAt(rowIndex);
  626. window.location = 'version.jsp?theme='+theme+'&unitId='+rec.get('UQ_UNIT_ID');
  627. }
  628. }]
  629. }
  630. ],
  631. columnLines: true,
  632. tbar: [
  633. {
  634. xtype: 'button',
  635. iconCls:'filter_btn',
  636. text: '筛选',
  637. listeners: {
  638. click: filterwin
  639. }
  640. },'-',
  641. {xtype: 'tbfill'},'-',
  642. {
  643. xtype: 'button',
  644. iconCls:'append_btn',
  645. text: '新增',
  646. listeners: {
  647. click: appendwin
  648. }
  649. },
  650. {
  651. xtype: 'button',
  652. iconCls:'modify_btn',
  653. text: '修改',
  654. listeners: {
  655. click: chk_sm
  656. }
  657. },
  658. {
  659. xtype: 'button',
  660. iconCls:'delete_btn',
  661. text: '注销',
  662. listeners: {
  663. click: deletewin
  664. }
  665. }
  666. // ,{
  667. // xtype: 'button',
  668. // iconCls:'delete_btn',
  669. // text: '导出',
  670. // listeners: {
  671. // click: export_sj
  672. // }
  673. // }
  674. ],
  675. height: maxHeight,
  676. width: '100%',
  677. bbar: new Ext.PagingToolbar({
  678. store: myStore,
  679. id:'UnitListPageToolbar',
  680. displayInfo: true,
  681. pageSize: countPerPage,
  682. prependButtons: true,
  683. displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  684. emptyMsg : "没有记录",
  685. firstText: '第一页',
  686. prevText: '前一页',
  687. nextText: '后一页',
  688. lastText: '最后一页',
  689. refreshText: '刷新',
  690. // doRefresh:function(start){
  691. // alert(start);
  692. // relushDataFunction(start); // 调用函数刷新数据
  693. // this.cursor = start; // 更新页签
  694. // }
  695. }),
  696. frame: true,
  697. border:false,
  698. iconCls: 'icon-grid',
  699. renderTo: Ext.getBody()
  700. });
  701. myStore.reload();
  702. maxHeight = document.documentElement.clientHeight;
  703. Ext.getCmp('UnitListPanel').setHeight(maxHeight);
  704. });