groupManageOption.js 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. Ext.Loader.setConfig({
  2. enabled: true
  3. });
  4. Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');
  5. Ext.require([
  6. 'Ext.grid.*',
  7. 'Ext.data.*',
  8. 'Ext.ux.RowExpander',
  9. 'Ext.selection.CheckboxModel'
  10. ]);
  11. var StatusStore;
  12. var baseUrl;
  13. var centerLng;
  14. var centerLat;
  15. var company_code;
  16. var theme;
  17. var ConfirmStore
  18. var pieWidth;
  19. var showAlarm = null;
  20. var pieMask;
  21. var V_LOGINNAME = '', V_PASSWORD = '';
  22. var maxHeight = 10000;
  23. var maxWidth = 10000;
  24. var companyName = null;
  25. var sm = Ext.create('Ext.selection.CheckboxModel');
  26. Ext.define('groupManageOption', {
  27. extend: 'Ext.data.Model',
  28. fields: [
  29. {name: 'id', type: 'int'},
  30. {name: 'groupName', type: 'string'},
  31. {name: 'groupAddr', type: 'string'},
  32. {name: 'mainNumber', type: 'int'},
  33. {name: 'detectorNumbers', type: 'int'},
  34. {name: 'peopleNumber', type: 'int'},
  35. {name: 'companyCode', type: 'string'},
  36. {name: 'time', type: 'string'},
  37. {name: 'status', type: 'int'},
  38. ]
  39. });
  40. var getCurrentData = function () {
  41. var query = {};
  42. query.V_LOGINNAME = V_LOGINNAME;
  43. query.V_PASSWORD = V_PASSWORD;
  44. query.dwtype = '7';
  45. query.COMMSTATUS = 'NO';
  46. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  47. query.company_code = company_code;
  48. // pieMask.show();
  49. $.ajax({
  50. type: 'POST',
  51. url: baseUrl + "iot/alarm/view/getConfirmStatusByDays",
  52. data: {
  53. queryJson: Ext.JSON.encode(query)
  54. },
  55. success: function (result) {
  56. var json = eval('(' + result + ')');
  57. if (json.action == 'getConfirmStatusByDays') {
  58. if (json.check == 'true') {
  59. ConfirmStore = json.RESULT;
  60. if (json.company_name != null)
  61. companyName = json.company_name;
  62. else
  63. companyName = null;
  64. } else {
  65. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function () {
  66. window.parent.frames.return_login();
  67. });
  68. }
  69. }
  70. }
  71. });
  72. }
  73. var body_resize = function () {
  74. maxHeight = document.documentElement.clientHeight;
  75. maxWidth = document.documentElement.clientWidth;
  76. Ext.getCmp('ManageOptionPanel').setHeight(maxHeight);
  77. Ext.getCmp('ManageOptionPanel').setWidth(maxWidth);
  78. }
  79. Ext.define('CompanyComboStore', {
  80. extend: 'Ext.data.Model',
  81. fields: [
  82. {name: 'owner_name', type: 'string'},
  83. {name: 'owner_id', type: 'string'}
  84. ]
  85. });
  86. Ext.define('DeviceTypeStore', {
  87. extend: 'Ext.data.Model',
  88. fields: [
  89. {name: 'deviceTypeName', type: 'string'},
  90. {name: 'deviceType', type: 'int'}
  91. ]
  92. });
  93. var addradiogroup = new Ext.create('Ext.form.RadioGroup', {
  94. fieldLabel: '合同状态',
  95. id: 'addstatus',
  96. width: 300,
  97. items: [{
  98. name: 'stationType',
  99. inputValue: '1',
  100. boxLabel: '启用',
  101. }, {
  102. name: 'stationType',
  103. inputValue: '0',
  104. boxLabel: '未启用',
  105. //checked:
  106. }]
  107. });
  108. var up_group_radiogroup = new Ext.create('Ext.form.RadioGroup', {
  109. fieldLabel: '群组启用状态',
  110. id: 'upstatus',
  111. width: 300,
  112. items: [{
  113. name: 'stationType',
  114. inputValue: '1',
  115. boxLabel: '启用',
  116. }, {
  117. name: 'stationType',
  118. inputValue: '0',
  119. boxLabel: '未启用',
  120. //checked:
  121. }]
  122. });
  123. Ext.onReady(function () {
  124. baseUrl = document.getElementById('basePath').value;
  125. theme = document.getElementById('theme').value;
  126. company_code = document.getElementById('company_code').value;
  127. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  128. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  129. V_LOGINNAME = $("#V_LOGINNAME").val();
  130. V_PASSWORD = $("#V_PASSWORD").val();
  131. var currentWidth = document.documentElement.clientWidth;
  132. pieWidth = currentWidth / 7;
  133. var chkIcon = '<img src="' + baseUrl + 'res/img/common/check.gif"/>'
  134. var unchkIcon = '<img src="' + baseUrl + 'res/img/common/uncheck.gif"/>'
  135. var countPerPage = 30;
  136. var queryJson = {};
  137. queryJson.V_LOGINNAME = V_LOGINNAME;
  138. queryJson.V_PASSWORD = V_PASSWORD;
  139. queryJson.COMMSTATUS = 'NO';
  140. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  141. queryJson.company_code = company_code;
  142. var myStore = Ext.create('Ext.data.Store', {
  143. model: 'groupManageOption',
  144. pageSize: countPerPage,
  145. proxy: {
  146. type: 'ajax',
  147. actionMethods: {
  148. create: 'POST',
  149. read: 'POST', // by default GET
  150. update: 'POST',
  151. destroy: 'POST'
  152. },
  153. url: baseUrl + 'group/queryGroup',
  154. reader: {
  155. type: 'json',
  156. root: 'RESULT',
  157. totalProperty: 'totalCount'
  158. },
  159. extraParams: {
  160. queryJson: Ext.JSON.encode(queryJson)
  161. }
  162. },
  163. sorters: [{
  164. property: 'time',
  165. direction: 'DESC'
  166. }],
  167. remoteSort: true
  168. });
  169. myStore.on("load", function (myStore) {
  170. getCurrentData();
  171. //do something
  172. });
  173. var CompanyStory = Ext.create('Ext.data.Store', {
  174. model: 'CompanyComboStore',
  175. proxy: {
  176. type: 'ajax',
  177. actionMethods: {
  178. create: 'POST',
  179. read: 'POST', // by default GET
  180. update: 'POST',
  181. destroy: 'POST'
  182. },
  183. url: baseUrl + 'iot/company/view/getNameList',
  184. //url: baseUrl+'iot/company/view/getNameList',
  185. reader: {
  186. type: 'json',
  187. root: 'RESULT',
  188. totalProperty: 'totalCount'
  189. },
  190. extraParams: {
  191. queryJson: Ext.JSON.encode(queryJson)
  192. }
  193. },
  194. sorters: [{
  195. property: 'time',
  196. direction: 'DESC'
  197. }],
  198. remoteSort: true
  199. });
  200. var Group_deviceType = Ext.create('Ext.data.Store', {
  201. model: 'DeviceTypeStore',
  202. proxy: {
  203. type: 'ajax',
  204. actionMethods: {
  205. create: 'POST',
  206. read: 'POST', // by default GET
  207. update: 'POST',
  208. destroy: 'POST'
  209. },
  210. url: baseUrl + 'group/queryDevice',
  211. //url: baseUrl+'iot/company/view/getNameList',
  212. reader: {
  213. type: 'json',
  214. root: 'RESULT',
  215. totalProperty: 'totalCount'
  216. },
  217. extraParams: {
  218. queryJson: Ext.JSON.encode(queryJson)
  219. }
  220. },
  221. sorters: [{
  222. property: 'time',
  223. direction: 'DESC'
  224. }],
  225. remoteSort: true
  226. });
  227. var childStore = new Ext.data.Store({
  228. proxy: new Ext.data.HttpProxy({
  229. //这里是参数可以顺便写,这个数据源是在第一个下拉框select的时候load的
  230. url: baseUrl + 'group/queryDevicePoint'
  231. }),
  232. reader: new Ext.data.JsonReader({
  233. root: 'RESULT'
  234. }, [
  235. {name: 'id', mapping: 'id'},
  236. {name: 'mc', mapping: 'name'}
  237. ])
  238. });
  239. myStore.on("load", function (myStore) {
  240. getCurrentData();
  241. //do something
  242. });
  243. var patroladaddForm = Ext.create('Ext.form.Panel', {
  244. id: 'patroladaddForm',
  245. layout: 'form',
  246. // title:'设备图片:',
  247. items: [{
  248. layout: 'hbox',
  249. items: [{
  250. xtype: 'box',//或者xtype: 'component',
  251. title: '点位图片',
  252. id: 'patrol_add_picture',
  253. width: 110,//图片宽度
  254. height: 110,//图片高度
  255. margin: '0 0 30 150',
  256. autoEl: {
  257. tag: 'img',//指定为img标签
  258. src: '../../res/img/common/shangchaun.png',
  259. style: 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:110px;height:110px;text-align:center;'
  260. },
  261. listeners: {
  262. render: function () {
  263. Ext.fly(this.el).on("click", function () {
  264. //                                add_pic();
  265. checkfilename();
  266. });
  267. }
  268. }
  269. }
  270. ]
  271. }]
  272. });
  273. //新增弹框
  274. var addGroupWin = function () {
  275. Ext.create('Ext.window.Window', {
  276. title: '新增群组',
  277. height: 500,
  278. width: 430,
  279. layout: 'fit',
  280. items: addGroupInfoForm,
  281. closable: false,
  282. modal: true,
  283. closeAction: 'hide'
  284. }).show();
  285. }
  286. //*************************************修改弹框详情*************************
  287. var Group_InfoForm = Ext.create('Ext.form.Panel', {
  288. labelWidth: 55,
  289. layout: "column",
  290. url: baseUrl + 'group/updataGroup',
  291. defaultType: 'textfield',
  292. fileUpload: true,
  293. bodyPadding: 15,
  294. items: [
  295. {
  296. fieldLabel: 'id',
  297. id: 'up_g_id',
  298. name: 'id',
  299. displayField: 'id',
  300. valueField: 'id',
  301. allowBlank: true,
  302. blankText: "不能为空",
  303. editable: false,
  304. width: 250,
  305. hidden: true
  306. }, {
  307. fieldLabel: 'up_company',
  308. id: 'up_company',
  309. name: 'up_company',
  310. displayField: 'up_company',
  311. valueField: 'up_company',
  312. allowBlank: true,
  313. blankText: "不能为空",
  314. editable: false,
  315. width: 250,
  316. hidden: true
  317. }, {
  318. fieldLabel: 'time',
  319. id: 'up_time',
  320. name: 'up_time',
  321. displayField: 'up_time',
  322. valueField: 'up_time',
  323. allowBlank: true,
  324. blankText: "不能为空",
  325. editable: false,
  326. width: 250,
  327. hidden: true
  328. },
  329. {
  330. xtype: 'combo',
  331. fieldLabel: '单位名称',
  332. id: 'up_companyCode',
  333. name: 'company',
  334. displayField: 'owner_name',
  335. valueField: 'owner_id',
  336. allowBlank: true,
  337. blankText: "不能为空",
  338. editable: false,
  339. width: 250,
  340. store: CompanyStory
  341. }, {
  342. fieldLabel: '群组名称',
  343. allowBlank: true,
  344. blankText: "不能为空",
  345. id: 'up_maintenance_company',
  346. name: 'maintenance_company',
  347. hidden: false
  348. },
  349. {
  350. fieldLabel: '群组地址',
  351. allowBlank: true,
  352. blankText: "不能为空",
  353. id: 'up_salesman',
  354. name: 'salesman',
  355. maxLength: 120,
  356. anchor: '65%'
  357. }, {
  358. fieldLabel: '主机数量',
  359. id: 'up_salesman_phone',
  360. name: 'salesman_phone',
  361. maxLength: 120,
  362. anchor: '65%'
  363. }, {
  364. fieldLabel: '探测器数量',
  365. id: 'up_customer',
  366. allowBlank: true,
  367. blankText: "不能为空",
  368. name: 'customer',
  369. maxLength: 50,
  370. anchor: '15%'
  371. }, {
  372. fieldLabel: '人员数量',
  373. id: 'up_customer_phone',
  374. allowBlank: true,
  375. blankText: "不能为空",
  376. name: 'customer_phone',
  377. maxLength: 50,
  378. anchor: '15%'
  379. }, up_group_radiogroup,
  380. {
  381. id: 'up_c_queryJson',
  382. name: 'queryJson',
  383. hidden: true
  384. }],
  385. buttons: [ /*{
  386. text: '点击查看文件',
  387. iconCls: 'cancel_btn',
  388. handler: function () {
  389. // alert(fileUrl);
  390. var l= Ext.getCmp('up_url').getValue();
  391. window.open(l)
  392. }
  393. }*/, {
  394. text: '提交',
  395. // id: 'addconfirmBtn',
  396. iconCls: 'ok_btn',
  397. handler: function () {
  398. var form = this.up('form').getForm();
  399. if (form.isValid()) {
  400. var queryJson = {};
  401. queryJson.V_LOGINNAME = V_LOGINNAME;
  402. queryJson.V_PASSWORD = V_PASSWORD;
  403. queryJson.companyCode = Ext.getCmp('up_companyCode').getValue();
  404. queryJson.id = Ext.getCmp('up_g_id').getValue();
  405. queryJson.salesman = Ext.getCmp('up_salesman').getValue();
  406. queryJson.maintenanceCompany = Ext.getCmp('up_maintenance_company').getValue();
  407. queryJson.customerPhone = Ext.getCmp('up_customer_phone').getValue();
  408. queryJson.customer = Ext.getCmp('up_customer').getValue();
  409. queryJson.salesmanPhone = Ext.getCmp('up_salesman_phone').getValue();
  410. queryJson.startTime = Ext.getCmp('up_start_time').getValue();
  411. queryJson.status = Ext.getCmp('upstatus').getChecked()[0].boxLabel == '启用' ? 1 : 0;
  412. queryJson.endTime = Ext.getCmp('up_end_time').getValue();
  413. queryJson.time = Ext.getCmp('up_time').getValue();
  414. queryJson.url = Ext.getCmp('up_url').getValue();
  415. queryJson.company = Ext.getCmp('up_company').getValue();
  416. // queryJson.url = fileUrl;
  417. // alert(fileUrl);
  418. var jsonstr = Ext.JSON.encode(queryJson);
  419. Ext.getCmp('up_c_queryJson').setValue(jsonstr);
  420. form.submit({
  421. method: 'post',
  422. success: function (form, action) {
  423. Ext.Msg.alert('操作成功', '已确认1条记录', function (btn, txt) {
  424. clear_add_form();
  425. myStore.reload();
  426. // getCurrentData();
  427. });
  428. },
  429. failure: function (form, action) {
  430. Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
  431. // clear_add_form();
  432. myStore.reload();
  433. //
  434. });
  435. }
  436. });
  437. this.up('window').close();
  438. }
  439. }
  440. },
  441. {
  442. text: '关闭',
  443. iconCls: 'cancel_btn',
  444. handler: function () {
  445. this.up('window').close();
  446. }
  447. }]
  448. });
  449. //********************end**************************
  450. var GroupInfoWin = Ext.create('Ext.window.Window', {
  451. id: 'GFileInfoWin',
  452. title: '群组详情: <span id="VInfoWin_Title"></span>',
  453. width: 468,
  454. height: 500,
  455. layout: 'fit',
  456. closable: true,
  457. modal: true,
  458. closeAction: 'hide',
  459. items: Group_InfoForm
  460. });
  461. var ClztStory = Ext.create('Ext.data.Store', {
  462. fields: ['status', 'name'],
  463. data: [
  464. {'status': '0', 'name': '未启用'},
  465. {'status': '1', 'name': '启用'}
  466. ]
  467. });
  468. var showGroupInfoWin = function (record) {
  469. GroupInfoWin.show();
  470. $("#VInfoWin_Title").html(record.get('data'));
  471. var data = record.raw;
  472. console.log(data);
  473. Ext.getCmp('up_companyCode').setValue(data.companyCode);
  474. Ext.getCmp('up_id').setValue(data.id);
  475. Ext.getCmp('up_customer').setValue(data.customer);
  476. // Ext.getCmp('customer').setValue(data.get('customer'));
  477. Ext.getCmp('up_customer_phone').setValue(data.customerPhone);
  478. Ext.getCmp('up_end_time').setValue(data.endTime);
  479. Ext.getCmp('up_maintenance_company').setValue(data.maintenanceCompany);
  480. Ext.getCmp('up_salesman').setValue(data.salesman);
  481. Ext.getCmp('up_salesman_phone').setValue(data.salesmanPhone);
  482. Ext.getCmp('up_start_time').setValue(data.startTime);
  483. Ext.getCmp('up_url').setValue(data.url);
  484. Ext.getCmp('up_company').setValue(data.company);
  485. Ext.getCmp('up_time').setValue(data.time);
  486. if (data.status == 1) {
  487. // checked:true
  488. Ext.getCmp('upstatus').items.get(0).setValue(true);
  489. } else {
  490. Ext.getCmp('upstatus').items.get(1).setValue(true);
  491. }
  492. }
  493. var FilterForm = Ext.create('Ext.form.Panel', {
  494. id: 'VFireOptionFilterForm',
  495. labelWidth: 55,
  496. defaultType: 'textfield',
  497. bodyPadding: 15,
  498. items: [{
  499. xtype: 'combo',
  500. fieldLabel: '单位名称',
  501. id: 'ff_company_code',
  502. name: 'ff_company_code',
  503. displayField: 'owner_name',
  504. valueField: 'owner_id',
  505. editable: false,
  506. width: 330,
  507. store: CompanyStory
  508. },
  509. {
  510. xtype: 'combo',
  511. fieldLabel: '启用状态',
  512. id: 'ff_qyzt',
  513. name: 'ff_qyzt',
  514. displayField: 'name',
  515. valueField: 'status',
  516. editable: false,
  517. width: 330,
  518. store: ClztStory
  519. }, {
  520. xtype: 'datefield',
  521. fieldLabel: "开始日期",
  522. format: "Y-m-d",
  523. id: 'filter_start_time',
  524. name: "start_data",
  525. //editable:true,//只读约束
  526. // width: 330,
  527. anchor: '80%'
  528. }
  529. , {
  530. xtype: 'datefield',
  531. fieldLabel: "结束日期",
  532. minValue: data,
  533. // '07/07/2017',
  534. minText: "当前日期选择应大于当天日期",
  535. format: "Y-m-d",
  536. // columnWidth:0.5,
  537. id: 'filter_end_time',
  538. name: "end_data",
  539. // editable:true,//只读约束
  540. anchor: '80%'
  541. }
  542. ],
  543. buttons: [{
  544. text: '筛选',
  545. iconCls: 'ok_btn',
  546. handler: function () {
  547. var form = this.up('form').getForm();
  548. if (form.isValid()) {
  549. var query = {};
  550. // var tmp = Ext.getCmp('ff_company_code');
  551. if (Ext.getCmp('ff_company_code').getValue()) {
  552. query.company_code = Ext.getCmp('ff_company_code').getValue();
  553. $("#company_code").val(query.company_code);
  554. company_code = query.company_code;
  555. $("#FirePiePanel_title_string").html(Ext.getCmp('ff_company_code').getRawValue() + '.维保合同列表');
  556. } else {
  557. $("#company_code").val('');
  558. $("#FirePiePanel_title_string").html('维保合同列表');
  559. company_code = null;
  560. }
  561. if (Ext.getCmp('ff_qyzt').getValue()) {
  562. query.status = Ext.getCmp('ff_qyzt').getValue();
  563. $("#status").val(query.status);
  564. } else {
  565. $("#status").val('');
  566. }
  567. query.status = Ext.getCmp('ff_qyzt').getValue() == null ? "" : Ext.getCmp('ff_qyzt').getValue();
  568. query.time_start = Ext.getCmp('filter_start_time').getValue() == null ? "" : Ext.getCmp('filter_start_time').getValue();
  569. query.time_end = Ext.getCmp('filter_end_time').getValue() == null ? "" : Ext.getCmp('filter_end_time').getValue();
  570. query.V_LOGINNAME = V_LOGINNAME;
  571. query.V_PASSWORD = V_PASSWORD;
  572. query.COMMSTATUS = 'NO';
  573. var jsonstr = Ext.JSON.encode(query);
  574. myStore.getProxy().extraParams = {
  575. queryJson: jsonstr
  576. };
  577. Ext.getCmp('groupListPageToolbar').moveFirst();
  578. Ext.getCmp('ff_company_code').setValue('');
  579. Ext.getCmp('ff_qyzt').setValue('');
  580. Ext.getCmp('contractManageFilterWin').hide();
  581. // getCurrentData();
  582. }
  583. }
  584. }, {
  585. text: '关闭',
  586. iconCls: 'cancel_btn',
  587. handler: function () {
  588. Ext.getCmp('contractManageFilterWin').hide();
  589. }
  590. }]
  591. });
  592. var filterwin = function () {
  593. Ext.create('Ext.window.Window', {
  594. id: 'contractManageFilterWin',
  595. title: '合同筛选',
  596. height: 210,
  597. width: 400,
  598. layout: 'fit',
  599. items: FilterForm,
  600. closable: false,
  601. modal: true,
  602. closeAction: 'hide'
  603. }).show();
  604. CompanyStory.reload();
  605. }
  606. Ext.grid.PageRowNumberer = Ext.extend(Ext.grid.RowNumberer, {
  607. width: 50,
  608. text: '序号',
  609. renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
  610. if (store.lastOptions.params != null) {
  611. var pageindex = store.lastOptions.params.start;
  612. return pageindex + rowIndex + 1;
  613. } else {
  614. return rowIndex + 1;
  615. }
  616. }
  617. });
  618. //=====================页面数据展示====================
  619. var contractOptionPanel = Ext.create('Ext.grid.Panel', {
  620. header: {
  621. height: 0,
  622. border: '0px solid #000000'
  623. },
  624. titleCollapse: true,
  625. id: 'contractManageOptionPanel',
  626. region: 'center',
  627. store: myStore,
  628. enableColumnResize: true,
  629. columns: [
  630. new Ext.grid.PageRowNumberer(),
  631. {header: 'id', dataIndex: 'id', hidden: true, menuDisabled: true},
  632. {header: '群组名称', dataIndex: 'groupName', width: '20%', menuDisabled: true, align: 'center'},
  633. {header: '群组地址', dataIndex: 'groupAddr', width: '20%', menuDisabled: true, align: 'center'},
  634. {header: '主机数量', dataIndex: 'mainNumber', width: '20%', menuDisabled: true, align: 'center'},
  635. {header: '探测器数量', dataIndex: 'detectorNumbers', width: '20%', menuDisabled: true, align: 'center'},
  636. {header: '人员数量', dataIndex: 'peopleNumber', width: '20%', menuDisabled: true, align: 'center'},
  637. {header: '单位名称', dataIndex: 'companyCode', width: '20%', menuDisabled: true, align: 'center', hidden: true},
  638. ],
  639. columnLines: true,
  640. height: maxHeight,
  641. width: '100%',
  642. tbar: new Ext.create('Ext.toolbar.Toolbar', {
  643. items: [{
  644. html: '<span id="FirePiePanel_title_string" style="color:#ffffff;background-color:rgba(0,0,0,0)">群组详情</span>'
  645. }, '->', {
  646. xtype: 'button',
  647. iconCls: 'back_btn',
  648. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">返回</span>',
  649. listeners: {
  650. click: function () {
  651. location.href = baseUrl + 'view/frontpage/map.jsp?&theme=' + theme + '&company_code=' + company_code;
  652. }
  653. }
  654. }, '-', {
  655. xtype: 'button',
  656. iconCls: 'filter_btn',
  657. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">筛选</span>',
  658. listeners: {
  659. click: filterwin
  660. }
  661. }, '-',
  662. {
  663. xtype: 'button',
  664. iconCls: 'append_btn',
  665. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">新增</span>',
  666. listeners: {
  667. click: addGroupWin
  668. }
  669. }]
  670. }),
  671. bbar: new Ext.PagingToolbar({
  672. store: myStore,
  673. id: 'groupListPageToolbar',
  674. displayInfo: true,
  675. pageSize: countPerPage,
  676. prependButtons: true,
  677. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  678. emptyMsg: "没有记录",
  679. firstText: '第一页',
  680. prevText: '前一页',
  681. nextText: '后一页',
  682. lastText: '最后一页',
  683. refreshText: '刷新'
  684. }),
  685. frame: true,
  686. border: false,
  687. iconCls: 'icon-grid',
  688. listeners: {
  689. 'celldblclick': function (grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
  690. // console.log(record.raw.time);
  691. showGroupInfoWin(record);
  692. }
  693. }
  694. });
  695. //******************************************************************
  696. /**
  697. * 省选择
  698. */
  699. /*
  700. {name: 'owner_name', type: 'string'},
  701. {name: 'owner_id', type: 'string'}
  702. */
  703. Ext.define('App.util.ProviceCombox', {
  704. alias : 'widget.proviceCombox',
  705. extend : 'Ext.form.field.ComboBox',
  706. width: 320,
  707. bodyPadding: 1,
  708. fieldLabel : "所属省",
  709. queryMode : 'local',
  710. lazyInit : true,
  711. editable : false,
  712. triggerAction : 'all',
  713. layout: 'anchor',
  714. store : Ext.create('Ext.data.Store', {
  715. fields : [ "owner_name", "owner_id" ],
  716. autoLoad : true,
  717. proxy : {
  718. type : 'ajax',
  719. url :baseUrl + 'iot/company/view/getNameList',
  720. reader : {
  721. type : 'json',
  722. root : 'RESULT'
  723. }
  724. },
  725. }),
  726. allowBlank : false,
  727. emptyText : '------请选择单位------',
  728. displayField : 'owner_name',
  729. valueField : 'owner_id',
  730. name:"ownerName"
  731. });
  732. /**
  733. * 根据父ID加载市
  734. * @param com 容器
  735. * @param fatherId 加载的父ID
  736. */
  737. App.util.ProviceCombox.loadCity=function(com,fatherId){
  738. var cityCombox = com.queryById("cityCombox");
  739. var countyCombox = com.queryById("countyCombox");
  740. countyCombox.clearValue();
  741. cityCombox.clearValue();
  742. if (fatherId) {
  743. cityCombox.getStore().load({
  744. params: {
  745. "proviceId": fatherId
  746. }
  747. });
  748. }
  749. }
  750. /******调用方式*******/
  751. // {xtype:"proviceCombox",
  752. // listeners : {
  753. // "select" : function(fatherType, record, index) {
  754. // var provinceId = fatherType.getValue();
  755. // var win = Ext.ComponentQuery.query("personalAdd")[0];
  756. // var cityCombox = win.down("cityCombox");
  757. // var countyCombox = win.down("countyCombox");
  758. // countyCombox.clearValue();
  759. // cityCombox.clearValue();
  760. // if (provinceId) {
  761. // cityCombox.getStore().load({
  762. // params : {
  763. // "provinceId" : provinceId
  764. // }
  765. // });
  766. // }
  767. //
  768. // }
  769. // }
  770. // },{
  771. // xtype:"cityCombox",
  772. // listeners : {
  773. // "select" : function(fatherType, record, index) {
  774. // var cityId = fatherType.getValue();
  775. // var win = Ext.ComponentQuery.query("personalAdd")[0];
  776. // var cityCombox = win.down("countyCombox");
  777. // var countyCombox = win.down("countyCombox");
  778. // countyCombox.clearValue();
  779. // if (cityId) {
  780. // countyCombox.getStore().load({
  781. // params : {
  782. // "cityId" : cityId
  783. // }
  784. // });
  785. // }
  786. //
  787. // }
  788. // }
  789. // },{
  790. // xtype:"countyCombox"
  791. //
  792. // },
  793. /**
  794. * 市选择
  795. */
  796. Ext.define('App.util.CityCombox', {
  797. alias : 'widget.cityCombox',
  798. extend : 'Ext.form.field.ComboBox',
  799. width: 320,
  800. bodyPadding: 1,
  801. fieldLabel : "设备类型",
  802. layout: 'anchor',
  803. queryMode : 'local',
  804. lazyInit : true,
  805. editable : false,
  806. triggerAction : 'all',
  807. store : Ext.create('Ext.data.Store', {
  808. fields : [ "deviceTypeName", "deviceType" ],
  809. //autoLoad : true,
  810. proxy : {
  811. type : 'ajax',
  812. url : baseUrl + 'group/queryDevice',
  813. reader : {
  814. type : 'json',
  815. root : 'RESULT'
  816. }
  817. },
  818. }),
  819. allowBlank : false,
  820. emptyText : '----请选类型-----',
  821. displayField : 'deviceTypeName',
  822. valueField : 'deviceType',
  823. name:"deviceType"
  824. });
  825. Ext.define('App.util.CountyCombox', {
  826. alias : 'widget.countyCombox',
  827. extend : 'Ext.form.field.ComboBox',
  828. width: 320,
  829. bodyPadding: 1,
  830. fieldLabel : "区/县",
  831. layout: 'anchor',
  832. queryMode : 'local',
  833. lazyInit : true,
  834. editable : false,
  835. triggerAction : 'all',
  836. store : Ext.create('Ext.data.Store', {
  837. fields : [ "countyId", "countyName" ],
  838. //autoLoad : true,
  839. proxy : {
  840. type : 'ajax',
  841. url : baseUrl + 'iot/company/view/getNameList',
  842. reader : {
  843. type : 'json',
  844. root : 'data'
  845. }
  846. },
  847. }),
  848. allowBlank : false,
  849. emptyText : '-----请选择区/县-----',
  850. displayField : 'countyName',
  851. valueField : 'countyId',
  852. name:"countyId"
  853. });
  854. /**
  855. * 根据父ID加载县
  856. * @param com 容器
  857. * @param fatherId 加载的父ID
  858. */
  859. App.util.CountyCombox.loadCounty=function (com,fatherId) {
  860. var countyCombox = com.queryById("countyCombox");
  861. countyCombox.clearValue();
  862. if (fatherId) {
  863. countyCombox.getStore().load({
  864. params: {
  865. "cityId": fatherId
  866. }
  867. });
  868. }
  869. }
  870. //******************************************************************
  871. function checkfilename() {
  872. var subwin = window.frames['file_uploader'].contentWindow;
  873. subwin.setpic();
  874. }
  875. var data = Ext.Date.format(new Date(), 'm/d/Y');
  876. //TODO 新增弹窗
  877. var addGroupInfoForm = Ext.create('Ext.form.Panel', {
  878. labelWidth: 55,
  879. layout: "column",
  880. url: baseUrl + 'group/addGroup',
  881. defaultType: 'textfield',
  882. fileUpload: true,
  883. bodyPadding: 15,
  884. items: [
  885. /******调用方式*******/
  886. {xtype:"proviceCombox",itemId:"proviceCombox",
  887. listeners : {
  888. "select" : function(fatherType, record, index) {
  889. var provinceId = fatherType.getValue();
  890. // var fatherId = form.queryById("proviceCombox").getValue();
  891. var win = Ext.ComponentQuery.query("proviceCombox")[0];
  892. var cityCombox = win.down("cityCombox");
  893. var countyCombox = win.down("countyCombox");
  894. countyCombox.clearValue();
  895. cityCombox.clearValue();
  896. if (provinceId) {
  897. cityCombox.getStore().load({
  898. params : {
  899. "provinceId" : provinceId
  900. }
  901. });
  902. }
  903. }
  904. }
  905. },{
  906. xtype:"cityCombox",itemId:"cityCombox",
  907. listeners : {
  908. "select" : function(fatherType, record, index) {
  909. var cityId = fatherType.getValue();
  910. var win = Ext.ComponentQuery.query("personalAdd")[0];
  911. var cityCombox = win.down("countyCombox");
  912. var countyCombox = win.down("countyCombox");
  913. countyCombox.clearValue();
  914. if (cityId) {
  915. countyCombox.getStore().load({
  916. params : {
  917. "cityId" : cityId
  918. }
  919. });
  920. }
  921. }
  922. }
  923. },{
  924. xtype:"countyCombox",itemId:"countyCombox",
  925. },
  926. /*{
  927. xtype: 'combo',
  928. fieldLabel: '单位名称',
  929. id: 'addc_companyCode',
  930. name: 'company',
  931. displayField: 'owner_name',
  932. valueField: 'owner_id',
  933. emptyText: '请选择单位',
  934. forceSelection:true,
  935. allowBlank: true,
  936. triggerAction:'all',
  937. blankText: "不能为空",
  938. editable: false,
  939. width: 350,
  940. store: CompanyStory,
  941. listeners: {
  942. select: function (combo, record, index) {
  943. Group_deviceType.proxy = new Ext.data.HttpProxy({url: baseUrl + 'group/queryDevice?queryJson=' + combo.value});
  944. Group_deviceType.load();
  945. }
  946. }
  947. }, {
  948. forceSelection: true,//必须选择一项
  949. mode: 'local',
  950. xtype: 'combo',
  951. fieldLabel: '设备类型',
  952. id: 'add_G_deviceType',
  953. name: 'devicetype',
  954. displayField: 'deviceTypeName',
  955. valueField: 'deviceType',
  956. allowBlank: true,
  957. emptyText: '请选择类型设备类型',
  958. blankText: "不能为空",
  959. editable: false,
  960. triggerAction: 'all',
  961. width: 350,
  962. store: Group_deviceType,
  963. /!*listeners: {
  964. select: function (combo, record, index) {
  965. // childStore.proxy = new Ext.data.HttpProxy({url: 'group/queryDevicePoint?queryJson=' + combo.value});
  966. childStore.load();
  967. }
  968. }*!/
  969. }, /!*{
  970. xtype: 'combo',
  971. store: childStore,
  972. valueField: "id",
  973. displayField: "mc",
  974. //数据是在本地
  975. mode: 'local',
  976. forceSelection: true,//必须选择一项
  977. emptyText: '请选择子分类...',//默认值
  978. hiddenName: 'interviewsDetail.child_category',//hiddenName才是提交到后台的input的name
  979. editable: false,//不允许输入
  980. triggerAction: 'all',//因为这个下拉是只能选择的,所以一定要设置属性triggerAction为all,不然当你选择了某个选项后,你的下拉将只会出现匹配选项值文本的选择项,其它选择项是不会再显示了,这样你就不能更改其它选项了。
  981. //allowBlank:false,//该选项值不能为空
  982. fieldLabel: '选择',
  983. id: 'child_id',
  984. name: 'child',
  985. width: 350
  986. },*!/ {
  987. fieldLabel: '维保单位',
  988. allowBlank: true,
  989. blankText: "不能为空",
  990. id: 'addmaintenance_company',
  991. name: 'maintenance_company',
  992. maxLength: 120,
  993. anchor: '65%'
  994. },
  995. {
  996. xtype: 'datefield',
  997. fieldLabel: "开始日期",
  998. format: "Y-m-d",
  999. id: 'addstart_time',
  1000. name: "start_data",
  1001. editable: false,//只读约束
  1002. // width: 330,
  1003. anchor: '80%'
  1004. }
  1005. , {
  1006. xtype: 'datefield',
  1007. fieldLabel: "结束日期",
  1008. minValue: data,
  1009. // '07/07/2017',
  1010. minText: "当前日期选择应大于当天日期",
  1011. format: "Y-m-d",
  1012. // columnWidth:0.5,
  1013. id: 'addend_time',
  1014. name: "end_data",
  1015. editable: false,//只读约束
  1016. anchor: '80%'
  1017. }, {
  1018. fieldLabel: '销售人员',
  1019. allowBlank: true,
  1020. blankText: "不能为空",
  1021. id: 'addsalesman',
  1022. name: 'salesman',
  1023. maxLength: 120,
  1024. anchor: '65%'
  1025. }, addradiogroup, {
  1026. fieldLabel: '销售人员电话',
  1027. id: 'addsalesman_phone',
  1028. name: 'salesman_phone',
  1029. maxLength: 120,
  1030. anchor: '65%'
  1031. }, {
  1032. fieldLabel: '客户联系人',
  1033. id: 'addcustomer',
  1034. allowBlank: true,
  1035. blankText: "不能为空",
  1036. name: 'customer',
  1037. maxLength: 50,
  1038. anchor: '15%'
  1039. }, {
  1040. fieldLabel: '客户电话',
  1041. id: 'addcustomer_phone',
  1042. allowBlank: true,
  1043. blankText: "不能为空",
  1044. name: 'customer_phone',
  1045. maxLength: 50,
  1046. anchor: '15%'
  1047. },/!*uploadfield,*!/
  1048. {
  1049. id: 'addc_queryJson',
  1050. name: 'queryJson',
  1051. hidden: true
  1052. }*/],
  1053. buttons: [{
  1054. text: '提交',
  1055. // id: 'addconfirmBtn',
  1056. iconCls: 'ok_btn',
  1057. handler: function () {
  1058. var form = this.up('form').getForm();
  1059. if (form.isValid()) {
  1060. var queryJson = {};
  1061. queryJson.V_LOGINNAME = V_LOGINNAME;
  1062. queryJson.V_PASSWORD = V_PASSWORD;
  1063. queryJson.companyCode = Ext.getCmp('addc_companyCode').getValue();
  1064. queryJson.salesman = Ext.getCmp('addsalesman').getValue();
  1065. queryJson.maintenanceCompany = Ext.getCmp('addmaintenance_company').getValue();
  1066. queryJson.customerPhone = Ext.getCmp('addcustomer_phone').getValue();
  1067. queryJson.customer = Ext.getCmp('addcustomer').getValue();
  1068. queryJson.salesmanPhone = Ext.getCmp('addsalesman_phone').getValue();
  1069. // queryJson.maintenanceCompany = Ext.getCmp('addsalesman_phone').getValue();
  1070. queryJson.startTime = Ext.getCmp('addstart_time').getValue();
  1071. queryJson.status = Ext.getCmp('addstatus').getChecked()[0].boxLabel == '启用' ? 1 : 0;
  1072. queryJson.endTime = Ext.getCmp('addend_time').getValue();
  1073. queryJson.url = fileUrl;
  1074. var jsonstr = Ext.JSON.encode(queryJson);
  1075. Ext.getCmp('addc_queryJson').setValue(jsonstr);
  1076. form.submit({
  1077. method: 'post',
  1078. success: function (form, action) {
  1079. Ext.Msg.alert('操作成功', '已确认1条记录', function (btn, txt) {
  1080. // clear_add_form();
  1081. myStore.reload();
  1082. // getCurrentData();
  1083. });
  1084. },
  1085. failure: function (form, action) {
  1086. Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
  1087. // clear_add_form();
  1088. myStore.reload();
  1089. //
  1090. });
  1091. }
  1092. });
  1093. this.up('window').close();
  1094. }
  1095. }
  1096. },
  1097. {
  1098. text: '点击上传文件',
  1099. iconCls: 'cancel_btn',
  1100. handler: function () {
  1101. var dxjgdm_sel = 100;
  1102. var dxjglx_sel = 100;
  1103. var form = new Ext.form.FormPanel({
  1104. baseCls: 'x-plain',
  1105. labelWidth: 150,
  1106. fileUpload: true,
  1107. defaultType: 'textfield',
  1108. items: [{
  1109. xtype: 'textfield',
  1110. fieldLabel: '请选择要导入的文件',
  1111. name: 'file',
  1112. id: 'userfile',
  1113. inputType: 'file',
  1114. blankText: 'File can\'t not empty.',
  1115. anchor: '100%' // anchor width by percentage
  1116. }]
  1117. });
  1118. var win = new Ext.Window({
  1119. title: '文件导入',
  1120. width: 400,
  1121. height: 150,
  1122. minWidth: 300,
  1123. minHeight: 100,
  1124. layout: 'fit',
  1125. plain: true,
  1126. bodyStyle: 'padding:5px;',
  1127. buttonAlign: 'center',
  1128. items: form,
  1129. buttons: [{
  1130. text: '导入',
  1131. handler: function () {
  1132. if (form.form.isValid()) {
  1133. if (Ext.getCmp('userfile').getValue() == '') {
  1134. Ext.Msg.alert('错误', '请选择你的文件');
  1135. return;
  1136. }
  1137. Ext.MessageBox.show({
  1138. title: '请等待',
  1139. msg: '文件正在导入...',
  1140. progressText: '',
  1141. width: 300,
  1142. progress: true,
  1143. closable: true,
  1144. animEl: 'loding'
  1145. });
  1146. form.getForm().submit({
  1147. url: baseUrl + 'contract/contractFileUpload',
  1148. method: 'POST',
  1149. success: function (form, action) {
  1150. Ext.Msg.alert("系统提示", "文件上传成功!");
  1151. fileUrl = action.result.url
  1152. // console.log(form);
  1153. win.close();
  1154. },
  1155. failure: function () {
  1156. Ext.Msg.alert("系统提示", "文件上传失败!(上传文件类型不对或文件过大)");
  1157. }
  1158. })
  1159. } else {
  1160. Ext.Msg.alert("系统提示", "请选择文件后再上传!");
  1161. }
  1162. }
  1163. }, {
  1164. text: '关闭',
  1165. handler: function () {
  1166. win.close();
  1167. }
  1168. }]
  1169. });
  1170. win.show();
  1171. }
  1172. },
  1173. {
  1174. text: '关闭',
  1175. iconCls: 'cancel_btn',
  1176. handler: function () {
  1177. this.up('window').close();
  1178. }
  1179. }]
  1180. });
  1181. new Ext.create('Ext.panel.Panel', {
  1182. width: '100%',
  1183. id: 'ManageOptionPanel',
  1184. layout: 'border',
  1185. items:
  1186. contractOptionPanel,
  1187. renderTo: Ext.getBody()
  1188. });
  1189. myStore.reload();
  1190. // getCurrentData();
  1191. $(window).resize(function () {
  1192. body_resize();
  1193. });
  1194. body_resize();
  1195. });