contractManageOption.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  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('contractManageOption', {
  27. extend: 'Ext.data.Model',
  28. fields: [
  29. {name: 'id', type: 'int'},
  30. {name: 'company', type: 'string'},
  31. {name: 'maintenanceCompany', type: 'string'},
  32. {name: 'startTime', type: 'string'},
  33. {name: 'salesman', type: 'string'},
  34. {name: 'endTime', type: 'string'},
  35. {name: 'salesmanPhone', type: 'string'},
  36. {name: 'customer', type: 'string'},
  37. {name: 'customerPhone', type: 'string'},
  38. {name: 'status', type: 'string'},
  39. {name: 'url', type: 'string'},
  40. {name: 'companyCode', type: 'string'}
  41. ]
  42. });
  43. var getCurrentData = function () {
  44. var query = new Object();
  45. query.V_LOGINNAME = V_LOGINNAME;
  46. query.V_PASSWORD = V_PASSWORD;
  47. query.dwtype = '7';
  48. query.COMMSTATUS = 'NO';
  49. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  50. query.company_code = company_code;
  51. // pieMask.show();
  52. $.ajax({
  53. type: 'POST',
  54. url: baseUrl + "iot/alarm/view/getConfirmStatusByDays",
  55. data: {
  56. queryJson: Ext.JSON.encode(query)
  57. },
  58. success: function (result) {
  59. var json = eval('(' + result + ')');
  60. if (json.action == 'getConfirmStatusByDays') {
  61. if (json.check == 'true') {
  62. ConfirmStore = json.RESULT;
  63. if (json.company_name != null)
  64. companyName = json.company_name;
  65. else
  66. companyName = null;
  67. } else {
  68. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function () {
  69. window.parent.frames.return_login();
  70. });
  71. }
  72. }
  73. // pieMask.hide();
  74. }
  75. });
  76. }
  77. var body_resize = function () {
  78. maxHeight = document.documentElement.clientHeight;
  79. maxWidth = document.documentElement.clientWidth;
  80. Ext.getCmp('ManageOptionPanel').setHeight(maxHeight);
  81. Ext.getCmp('ManageOptionPanel').setWidth(maxWidth);
  82. }
  83. Ext.define('CompanyComboStore', {
  84. extend: 'Ext.data.Model',
  85. fields: [
  86. // {name:'company', type:'string'},
  87. // {name:'companyCode',type:'string'}
  88. {name: 'owner_name', type: 'string'},
  89. {name: 'owner_id', type: 'string'}
  90. ]
  91. });
  92. var addradiogroup = new Ext.create('Ext.form.RadioGroup', {
  93. fieldLabel: '合同状态',
  94. id: 'addstatus',
  95. width: 300,
  96. items: [{
  97. name: 'stationType',
  98. inputValue: '1',
  99. boxLabel: '启用',
  100. }, {
  101. name: 'stationType',
  102. inputValue: '0',
  103. boxLabel: '未启用',
  104. //checked:
  105. }]
  106. });
  107. var upradiogroup = new Ext.create('Ext.form.RadioGroup', {
  108. fieldLabel: '合同状态',
  109. id: 'upstatus',
  110. width: 300,
  111. items: [{
  112. name: 'stationType',
  113. inputValue: '1',
  114. boxLabel: '启用',
  115. }, {
  116. name: 'stationType',
  117. inputValue: '0',
  118. boxLabel: '未启用',
  119. //checked:
  120. }]
  121. });
  122. Ext.onReady(function () {
  123. baseUrl = document.getElementById('basePath').value;
  124. theme = document.getElementById('theme').value;
  125. company_code = document.getElementById('company_code').value;
  126. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  127. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  128. V_LOGINNAME = $("#V_LOGINNAME").val();
  129. V_PASSWORD = $("#V_PASSWORD").val();
  130. var currentWidth = document.documentElement.clientWidth;
  131. pieWidth = currentWidth / 7;
  132. var chkIcon = '<img src="' + baseUrl + 'res/img/common/check.gif"/>'
  133. var unchkIcon = '<img src="' + baseUrl + 'res/img/common/uncheck.gif"/>'
  134. var countPerPage = 30;
  135. var queryJson = new Object();
  136. queryJson.V_LOGINNAME = V_LOGINNAME;
  137. queryJson.V_PASSWORD = V_PASSWORD;
  138. queryJson.COMMSTATUS = 'NO';
  139. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  140. queryJson.company_code = company_code;
  141. var myStore = Ext.create('Ext.data.Store', {
  142. model: 'contractManageOption',
  143. pageSize: countPerPage,
  144. proxy: {
  145. type: 'ajax',
  146. actionMethods: {
  147. create: 'POST',
  148. read: 'POST', // by default GET
  149. update: 'POST',
  150. destroy: 'POST'
  151. },
  152. url: baseUrl + 'contract/queryContract',
  153. reader: {
  154. type: 'json',
  155. root: 'RESULT',
  156. totalProperty: 'totalCount'
  157. },
  158. extraParams: {
  159. queryJson: Ext.JSON.encode(queryJson)
  160. }
  161. },
  162. sorters: [{
  163. property: 'time',
  164. direction: 'DESC'
  165. }],
  166. remoteSort: true
  167. });
  168. myStore.on("load", function (myStore) {
  169. getCurrentData();
  170. //do something
  171. });
  172. var CompanyStory = Ext.create('Ext.data.Store', {
  173. model: 'CompanyComboStore',
  174. proxy: {
  175. type: 'ajax',
  176. actionMethods: {
  177. create: 'POST',
  178. read: 'POST', // by default GET
  179. update: 'POST',
  180. destroy: 'POST'
  181. },
  182. url: baseUrl + 'iot/company/view/getNameList',
  183. //url: baseUrl+'iot/company/view/getNameList',
  184. reader: {
  185. type: 'json',
  186. root: 'RESULT',
  187. totalProperty: 'totalCount'
  188. },
  189. extraParams: {
  190. queryJson: Ext.JSON.encode(queryJson)
  191. }
  192. },
  193. sorters: [{
  194. property: 'time',
  195. direction: 'DESC'
  196. }],
  197. remoteSort: true
  198. });
  199. myStore.on("load", function (myStore) {
  200. getCurrentData();
  201. //do something
  202. });
  203. var patroladaddForm = Ext.create('Ext.form.Panel', {
  204. id: 'patroladaddForm',
  205. layout: 'form',
  206. // title:'设备图片:',
  207. items:[{
  208. layout: 'hbox',
  209. items: [{
  210. xtype: 'box',//或者xtype: 'component',
  211. title:'点位图片',
  212. id: 'patrol_add_picture',
  213. width: 110,//图片宽度
  214. height: 110,//图片高度
  215. margin:'0 0 30 150',
  216. autoEl: {
  217. tag: 'img',//指定为img标签
  218. src: '../../res/img/common/shangchaun.png',
  219. style : 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:110px;height:110px;text-align:center;'
  220. },
  221. listeners : {
  222. render : function() {
  223. Ext.fly(this.el).on("click",function() {
  224. //                                add_pic();
  225. checkfilename();
  226. });}}
  227. }
  228. ]}]
  229. });
  230. //新增弹框
  231. var addContractwin = function () {
  232. Ext.create('Ext.window.Window', {
  233. title: '新增维保合同',
  234. height: 500,
  235. width: 430,
  236. layout: 'fit',
  237. items: addContracInfoForm,
  238. closable: false,
  239. modal: true,
  240. closeAction: 'hide'
  241. }).show();
  242. }
  243. //*************************************修改弹框详情*************************
  244. var Contract_InfoForm = Ext.create('Ext.form.Panel', {
  245. // id: 'addContracInfoForm',
  246. labelWidth: 55,
  247. layout: "column",
  248. url: baseUrl + 'contract/updataContract',
  249. defaultType: 'textfield',
  250. fileUpload: true,
  251. bodyPadding: 15,
  252. items: [
  253. {
  254. fieldLabel: 'id',
  255. id: 'up_id',
  256. name: 'id',
  257. displayField: 'id',
  258. valueField: 'id',
  259. allowBlank: true,
  260. blankText: "不能为空",
  261. editable: false,
  262. width: 250,
  263. hidden: true
  264. },{
  265. fieldLabel: 'up_company',
  266. id: 'up_company',
  267. name: 'up_company',
  268. displayField: 'up_company',
  269. valueField: 'up_company',
  270. allowBlank: true,
  271. blankText: "不能为空",
  272. editable: false,
  273. width: 250,
  274. hidden: true
  275. },{
  276. fieldLabel: 'time',
  277. id: 'up_time',
  278. name: 'up_time',
  279. displayField: 'up_time',
  280. valueField: 'up_time',
  281. allowBlank: true,
  282. blankText: "不能为空",
  283. editable: false,
  284. width: 250,
  285. hidden: true
  286. },
  287. {
  288. xtype: 'combo',
  289. fieldLabel: '单位名称',
  290. id: 'up_companyCode',
  291. name: 'company',
  292. displayField: 'owner_name',
  293. valueField: 'owner_id',
  294. allowBlank: true,
  295. blankText: "不能为空",
  296. editable: false,
  297. width: 250,
  298. store: CompanyStory
  299. }, {
  300. fieldLabel: '维保单位',
  301. allowBlank: true,
  302. blankText: "不能为空",
  303. id: 'up_maintenance_company',
  304. name: 'maintenance_company',
  305. hidden: false
  306. },
  307. {
  308. xtype:'datefield',
  309. fieldLabel:"开始日期",
  310. format:"Y-m-d",
  311. id: 'up_start_time',
  312. name:"start_data",
  313. //editable:true,//只读约束
  314. // width: 330,
  315. anchor:'80%'
  316. }
  317. ,{
  318. xtype:'datefield',
  319. fieldLabel:"结束日期",
  320. minValue:data,
  321. // '07/07/2017',
  322. minText:"当前日期选择应大于当天日期",
  323. format:"Y-m-d",
  324. // columnWidth:0.5,
  325. id: 'up_end_time',
  326. name:"end_data",
  327. // editable:true,//只读约束
  328. anchor:'80%'
  329. }, {
  330. fieldLabel: '销售人员',
  331. allowBlank: true,
  332. blankText: "不能为空",
  333. id: 'up_salesman',
  334. name: 'salesman',
  335. maxLength: 120,
  336. anchor: '65%'
  337. }, {
  338. fieldLabel: '销售人员电话',
  339. id: 'up_salesman_phone',
  340. name: 'salesman_phone',
  341. maxLength: 120,
  342. anchor: '65%'
  343. }, {
  344. fieldLabel: '客户联系人',
  345. id: 'up_customer',
  346. allowBlank: true,
  347. blankText: "不能为空",
  348. name: 'customer',
  349. maxLength: 50,
  350. anchor: '15%'
  351. }, {
  352. fieldLabel: '客户电话',
  353. id: 'up_customer_phone',
  354. allowBlank: true,
  355. blankText: "不能为空",
  356. name: 'customer_phone',
  357. maxLength: 50,
  358. anchor: '15%'
  359. },upradiogroup,
  360. {
  361. fieldLabel: '文件查看',
  362. id: 'up_url',
  363. allowBlank: true,
  364. blankText: "不能为空",
  365. name: 'customer_phone',
  366. maxLength: 50,
  367. anchor: '15%',
  368. hidden: true
  369. },
  370. {
  371. id: 'up_c_queryJson',
  372. name: 'queryJson',
  373. hidden: true
  374. }],
  375. buttons: [ {
  376. text: '点击查看文件',
  377. iconCls: 'cancel_btn',
  378. handler: function () {
  379. // alert(fileUrl);
  380. var l= Ext.getCmp('up_url').getValue();
  381. window.open(l)
  382. }
  383. },{
  384. text: '提交',
  385. // id: 'addconfirmBtn',
  386. iconCls: 'ok_btn',
  387. handler: function () {
  388. var form = this.up('form').getForm();
  389. if (form.isValid()) {
  390. var queryJson = new Object();
  391. queryJson.V_LOGINNAME = V_LOGINNAME;
  392. queryJson.V_PASSWORD = V_PASSWORD;
  393. queryJson.companyCode = Ext.getCmp('up_companyCode').getValue();
  394. queryJson.id = Ext.getCmp('up_id').getValue();
  395. queryJson.salesman = Ext.getCmp('up_salesman').getValue();
  396. queryJson.maintenanceCompany = Ext.getCmp('up_maintenance_company').getValue();
  397. queryJson.customerPhone = Ext.getCmp('up_customer_phone').getValue();
  398. queryJson.customer = Ext.getCmp('up_customer').getValue();
  399. queryJson.salesmanPhone = Ext.getCmp('up_salesman_phone').getValue();
  400. queryJson.startTime = Ext.getCmp('up_start_time').getValue();
  401. queryJson.status = Ext.getCmp('upstatus').getChecked()[0].boxLabel == '启用' ? 1 : 0;
  402. queryJson.endTime = Ext.getCmp('up_end_time').getValue();
  403. queryJson.time = Ext.getCmp('up_time').getValue();
  404. queryJson.url = Ext.getCmp('up_url').getValue();
  405. queryJson.company = Ext.getCmp('up_company').getValue();
  406. // queryJson.url = fileUrl;
  407. // alert(fileUrl);
  408. var jsonstr = Ext.JSON.encode(queryJson);
  409. Ext.getCmp('up_c_queryJson').setValue(jsonstr);
  410. form.submit({
  411. method: 'post',
  412. success: function (form, action) {
  413. Ext.Msg.alert('操作成功', '已确认1条记录', function (btn, txt) {
  414. clear_contract_add_form();
  415. myStore.reload();
  416. // getCurrentData();
  417. });
  418. },
  419. failure: function (form, action) {
  420. Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
  421. clear_contract_add_form();
  422. myStore.reload();
  423. //
  424. });
  425. }
  426. });
  427. this.up('window').close();
  428. }
  429. }
  430. },
  431. {
  432. text: '关闭',
  433. iconCls: 'cancel_btn',
  434. handler: function () {
  435. this.up('window').close();
  436. }
  437. }]
  438. });
  439. var clear_contract_add_form = function () {
  440. Ext.getCmp('addsalesman').setValue('');
  441. // Ext.getCmp('addcompany').setValue('');
  442. Ext.getCmp('addc_companyCode').setValue('');
  443. Ext.getCmp('addmaintenance_company').setValue('');
  444. Ext.getCmp('addcustomer_phone').setValue('');
  445. Ext.getCmp('addcustomer').setValue('');
  446. Ext.getCmp('addsalesman_phone').setValue('');
  447. Ext.getCmp('addstart_time').setValue('');
  448. Ext.getCmp('addstatus').setValue('');
  449. Ext.getCmp('addend_time').setValue('');
  450. }
  451. //********************end**************************
  452. var ContractInfoWin = Ext.create('Ext.window.Window', {
  453. id: 'VFileInfoWin',
  454. title: '维保合同详情: <span id="VInfoWin_Title"></span>',
  455. width: 468,
  456. height: 500,
  457. layout: 'fit',
  458. closable: true,
  459. modal: true,
  460. closeAction: 'hide',
  461. items: Contract_InfoForm
  462. });
  463. var ClztStory = Ext.create('Ext.data.Store', {
  464. fields: ['status', 'name'],
  465. data: [
  466. {'status': '0', 'name': '未启用'},
  467. {'status': '1', 'name': '启用'}
  468. ]
  469. });
  470. var showContractInfoWin = function (record) {
  471. ContractInfoWin.show();
  472. $("#VInfoWin_Title").html(record.get('data'));
  473. var data= record.raw;
  474. console.log(data);
  475. Ext.getCmp('up_companyCode').setValue(data.company);
  476. Ext.getCmp('up_id').setValue(data.id);
  477. Ext.getCmp('up_customer').setValue(data.customer);
  478. // Ext.getCmp('customer').setValue(data.get('customer'));
  479. Ext.getCmp('up_customer_phone').setValue(data.customerPhone);
  480. Ext.getCmp('up_end_time').setValue(data.endTime);
  481. Ext.getCmp('up_maintenance_company').setValue(data.maintenanceCompany);
  482. Ext.getCmp('up_salesman').setValue(data.salesman);
  483. Ext.getCmp('up_salesman_phone').setValue(data.salesmanPhone);
  484. Ext.getCmp('up_start_time').setValue(data.startTime);
  485. Ext.getCmp('up_url').setValue(data.url);
  486. Ext.getCmp('up_company').setValue(data.company);
  487. Ext.getCmp('up_time').setValue(data.time);
  488. if (data.status == 1) {
  489. // checked:true
  490. Ext.getCmp('upstatus').items.get(0).setValue(true);
  491. } else {
  492. Ext.getCmp('upstatus').items.get(1).setValue(true);
  493. }
  494. }
  495. var FilterForm = Ext.create('Ext.form.Panel', {
  496. id: 'VFireOptionFilterForm',
  497. labelWidth: 55,
  498. defaultType: 'textfield',
  499. bodyPadding: 15,
  500. items: [{
  501. xtype: 'combo',
  502. fieldLabel: '单位名称',
  503. id: 'ff_company_code',
  504. name: 'ff_company_code',
  505. displayField: 'owner_name',
  506. valueField: 'owner_id',
  507. editable: false,
  508. width: 330,
  509. store: CompanyStory
  510. },
  511. {
  512. xtype: 'combo',
  513. fieldLabel: '启用状态',
  514. id: 'ff_qyzt',
  515. name: 'ff_qyzt',
  516. displayField: 'name',
  517. valueField: 'status',
  518. editable: false,
  519. width: 330,
  520. store: ClztStory
  521. },{
  522. xtype:'datefield',
  523. fieldLabel:"开始日期",
  524. format:"Y-m-d",
  525. id: 'filter_start_time',
  526. name:"start_data",
  527. //editable:true,//只读约束
  528. // width: 330,
  529. anchor:'80%'
  530. }
  531. ,{
  532. xtype:'datefield',
  533. fieldLabel:"结束日期",
  534. minValue:data,
  535. // '07/07/2017',
  536. minText:"当前日期选择应大于当天日期",
  537. format:"Y-m-d",
  538. // columnWidth:0.5,
  539. id: 'filter_end_time',
  540. name:"end_data",
  541. // editable:true,//只读约束
  542. anchor:'80%'
  543. }
  544. ],
  545. buttons: [{
  546. text: '筛选',
  547. iconCls: 'ok_btn',
  548. handler: function () {
  549. var form = this.up('form').getForm();
  550. if (form.isValid()) {
  551. var query = new Object();
  552. // var tmp = Ext.getCmp('ff_company_code');
  553. if (Ext.getCmp('ff_company_code').getValue()) {
  554. query.company_code = Ext.getCmp('ff_company_code').getValue();
  555. $("#company_code").val(query.company_code);
  556. company_code = query.company_code;
  557. $("#FirePiePanel_title_string").html(Ext.getCmp('ff_company_code').getRawValue() + '.维保合同列表');
  558. } else {
  559. $("#company_code").val('');
  560. $("#FirePiePanel_title_string").html('维保合同列表');
  561. company_code = null;
  562. }
  563. if (Ext.getCmp('ff_qyzt').getValue()) {
  564. query.status = Ext.getCmp('ff_qyzt').getValue();
  565. $("#status").val(query.status);
  566. } else {
  567. $("#status").val('');
  568. }
  569. query.status = Ext.getCmp('ff_qyzt').getValue() == null ? "" : Ext.getCmp('ff_qyzt').getValue();
  570. query.time_start = Ext.getCmp('filter_start_time').getValue() == null ? "" : Ext.getCmp('filter_start_time').getValue();
  571. query.time_end = Ext.getCmp('filter_end_time').getValue() == null ? "" : Ext.getCmp('filter_end_time').getValue();
  572. query.V_LOGINNAME = V_LOGINNAME;
  573. query.V_PASSWORD = V_PASSWORD;
  574. query.COMMSTATUS = 'NO';
  575. var jsonstr = Ext.JSON.encode(query);
  576. myStore.getProxy().extraParams = {
  577. queryJson: jsonstr
  578. };
  579. Ext.getCmp('FireStationListPageToolbar').moveFirst();
  580. Ext.getCmp('ff_company_code').setValue('');
  581. Ext.getCmp('ff_qyzt').setValue('');
  582. Ext.getCmp('contractManageFilterWin').hide();
  583. // getCurrentData();
  584. }
  585. }
  586. }, {
  587. text: '关闭',
  588. iconCls: 'cancel_btn',
  589. handler: function () {
  590. Ext.getCmp('contractManageFilterWin').hide();
  591. }
  592. }]
  593. });
  594. var filterwin = function () {
  595. Ext.create('Ext.window.Window', {
  596. id: 'contractManageFilterWin',
  597. title: '合同筛选',
  598. height: 210,
  599. width: 400,
  600. layout: 'fit',
  601. items: FilterForm,
  602. closable: false,
  603. modal: true,
  604. closeAction: 'hide'
  605. }).show();
  606. CompanyStory.reload();
  607. }
  608. Ext.grid.PageRowNumberer = Ext.extend(Ext.grid.RowNumberer, {
  609. width: 50,
  610. text: '序号',
  611. renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
  612. if (store.lastOptions.params != null) {
  613. var pageindex = store.lastOptions.params.start;
  614. return pageindex + rowIndex + 1;
  615. } else {
  616. return rowIndex + 1;
  617. }
  618. }
  619. });
  620. var contractOptionPanel = Ext.create('Ext.grid.Panel', {
  621. header: {
  622. height: 0,
  623. border: '0px solid #000000'
  624. },
  625. titleCollapse: true,
  626. id: 'contractManageOptionPanel',
  627. region: 'center',
  628. store: myStore,
  629. enableColumnResize: true,
  630. columns: [
  631. new Ext.grid.PageRowNumberer(),
  632. {header: 'id', dataIndex: 'id', hidden: true, menuDisabled: true},
  633. {header: '单位名称', dataIndex: 'company', width: '18%', menuDisabled: true, align: 'center'},
  634. {header: '维保单位', dataIndex: 'maintenanceCompany', width: '10%', menuDisabled: true, align: 'center'},
  635. {header: '维保开始时间', dataIndex: 'startTime', width: '10%', menuDisabled: true, align: 'center'},
  636. {header: '维保结束时间', dataIndex: 'endTime', width: '10%', menuDisabled: true, align: 'center'},
  637. {header: '销售', dataIndex: 'salesman', width: '10%', menuDisabled: true, align: 'center'},
  638. {header: '销售电话', dataIndex: 'salesmanPhone', width: '10%', menuDisabled: true, align: 'center'},
  639. {header: '客户单位', dataIndex: 'customer', width: '15%', menuDisabled: true, align: 'center'},
  640. {header: '客户电话', dataIndex: 'customerPhone', width: '15%', menuDisabled: true, align: 'center'},
  641. {header: '合同状态', dataIndex: 'status', width: '10%', menuDisabled: true, align: 'center',hidden: true},
  642. {header: 'url', dataIndex: 'url', width: '10%', menuDisabled: true, align: 'center', hidden: true,hidden: true},
  643. {header: '单位编号', dataIndex: 'companyCode', width: '10%', menuDisabled: true, align: 'center', hidden: true},
  644. ],
  645. columnLines: true,
  646. height: maxHeight,
  647. width: '100%',
  648. tbar: new Ext.create('Ext.toolbar.Toolbar', {
  649. items: [{
  650. html: '<span id="FirePiePanel_title_string" style="color:#ffffff;background-color:rgba(0,0,0,0)">维保合同数据列表</span>'
  651. }, '->', {
  652. xtype: 'button',
  653. iconCls: 'back_btn',
  654. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">返回</span>',
  655. listeners: {
  656. click: function () {
  657. location.href = baseUrl + 'view/frontpage/map.jsp?&theme=' + theme + '&company_code=' + company_code;
  658. }
  659. }
  660. }, '-',{
  661. xtype: 'button',
  662. iconCls: 'filter_btn',
  663. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">筛选</span>',
  664. listeners: {
  665. click: filterwin
  666. }
  667. }, '-',
  668. {
  669. xtype: 'button',
  670. iconCls: 'append_btn',
  671. text: '<span style="color:#ffffff;background-color:rgba(0,0,0,0)">新增</span>',
  672. listeners: {
  673. click: addContractwin
  674. }
  675. }]
  676. }),
  677. bbar: new Ext.PagingToolbar({
  678. store: myStore,
  679. id: 'FireStationListPageToolbar',
  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. }),
  691. frame: true,
  692. border: false,
  693. iconCls: 'icon-grid',
  694. listeners: {
  695. 'celldblclick': function (grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
  696. // console.log(record.raw.time);
  697. showContractInfoWin(record);
  698. }
  699. }
  700. });
  701. function checkfilename(){
  702. var subwin = window.frames['file_uploader'].contentWindow;
  703. subwin.setpic();
  704. }
  705. var data =Ext.Date.format(new Date(), 'm/d/Y');
  706. var addContracInfoForm = Ext.create('Ext.form.Panel', {
  707. // id: 'addContracInfoForm',
  708. labelWidth: 55,
  709. layout: "column",
  710. url: baseUrl + 'contract/saveContract',
  711. defaultType: 'textfield',
  712. fileUpload: true,
  713. bodyPadding: 15,
  714. items: [ {
  715. xtype: 'combo',
  716. fieldLabel: '单位名称',
  717. id: 'addc_companyCode',
  718. name: 'company',
  719. displayField: 'owner_name',
  720. valueField: 'owner_id',
  721. allowBlank: true,
  722. blankText: "不能为空",
  723. editable: false,
  724. width: 250,
  725. store: CompanyStory
  726. }, {
  727. fieldLabel: '维保单位',
  728. allowBlank: true,
  729. blankText: "不能为空",
  730. id: 'addmaintenance_company',
  731. name: 'maintenance_company',
  732. maxLength: 120,
  733. anchor: '65%'
  734. },
  735. {
  736. xtype:'datefield',
  737. fieldLabel:"开始日期",
  738. format:"Y-m-d",
  739. id: 'addstart_time',
  740. name:"start_data",
  741. editable:false,//只读约束
  742. // width: 330,
  743. anchor:'80%'
  744. }
  745. ,{
  746. xtype:'datefield',
  747. fieldLabel:"结束日期",
  748. minValue:data,
  749. // '07/07/2017',
  750. minText:"当前日期选择应大于当天日期",
  751. format:"Y-m-d",
  752. // columnWidth:0.5,
  753. id: 'addend_time',
  754. name:"end_data",
  755. editable:false,//只读约束
  756. anchor:'80%'
  757. }, {
  758. fieldLabel: '销售人员',
  759. allowBlank: true,
  760. blankText: "不能为空",
  761. id: 'addsalesman',
  762. name: 'salesman',
  763. maxLength: 120,
  764. anchor: '65%'
  765. }, addradiogroup, {
  766. fieldLabel: '销售人员电话',
  767. id: 'addsalesman_phone',
  768. name: 'salesman_phone',
  769. maxLength: 120,
  770. anchor: '65%'
  771. }, {
  772. fieldLabel: '客户联系人',
  773. id: 'addcustomer',
  774. allowBlank: true,
  775. blankText: "不能为空",
  776. name: 'customer',
  777. maxLength: 50,
  778. anchor: '15%'
  779. }, {
  780. fieldLabel: '客户电话',
  781. id: 'addcustomer_phone',
  782. allowBlank: true,
  783. blankText: "不能为空",
  784. name: 'customer_phone',
  785. maxLength: 50,
  786. anchor: '15%'
  787. },/*uploadfield,*/
  788. {
  789. id: 'addc_queryJson',
  790. name: 'queryJson',
  791. hidden: true
  792. }],
  793. buttons: [{
  794. text: '提交',
  795. // id: 'addconfirmBtn',
  796. iconCls: 'ok_btn',
  797. handler: function () {
  798. var form = this.up('form').getForm();
  799. if (form.isValid()) {
  800. var queryJson = new Object();
  801. queryJson.V_LOGINNAME = V_LOGINNAME;
  802. queryJson.V_PASSWORD = V_PASSWORD;
  803. queryJson.companyCode = Ext.getCmp('addc_companyCode').getValue();
  804. queryJson.salesman = Ext.getCmp('addsalesman').getValue();
  805. queryJson.maintenanceCompany = Ext.getCmp('addmaintenance_company').getValue();
  806. queryJson.customerPhone = Ext.getCmp('addcustomer_phone').getValue();
  807. queryJson.customer = Ext.getCmp('addcustomer').getValue();
  808. queryJson.salesmanPhone = Ext.getCmp('addsalesman_phone').getValue();
  809. // queryJson.maintenanceCompany = Ext.getCmp('addsalesman_phone').getValue();
  810. queryJson.startTime = Ext.getCmp('addstart_time').getValue();
  811. queryJson.status = Ext.getCmp('addstatus').getChecked()[0].boxLabel == '启用' ? 1 : 0;
  812. queryJson.endTime = Ext.getCmp('addend_time').getValue();
  813. queryJson.url = fileUrl;
  814. var jsonstr = Ext.JSON.encode(queryJson);
  815. Ext.getCmp('addc_queryJson').setValue(jsonstr);
  816. form.submit({
  817. method: 'post',
  818. success: function (form, action) {
  819. Ext.Msg.alert('操作成功', '已确认1条记录', function (btn, txt) {
  820. clear_contract_add_form();
  821. myStore.reload();
  822. // getCurrentData();
  823. });
  824. },
  825. failure: function (form, action) {
  826. Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
  827. clear_contract_add_form();
  828. myStore.reload();
  829. //
  830. });
  831. }
  832. });
  833. this.up('window').close();
  834. }
  835. }
  836. },
  837. {
  838. text: '点击上传文件',
  839. iconCls: 'cancel_btn',
  840. handler: function () {
  841. var dxjgdm_sel = 100;
  842. var dxjglx_sel = 100;
  843. var form = new Ext.form.FormPanel({
  844. baseCls : 'x-plain',
  845. labelWidth : 150,
  846. fileUpload : true,
  847. defaultType : 'textfield',
  848. items : [{
  849. xtype : 'textfield',
  850. fieldLabel : '请选择要导入的文件',
  851. name : 'file',
  852. id : 'userfile',
  853. inputType : 'file',
  854. blankText : 'File can\'t not empty.',
  855. anchor : '100%' // anchor width by percentage
  856. }]
  857. });
  858. var win = new Ext.Window({
  859. title : '文件导入',
  860. width : 400,
  861. height : 150,
  862. minWidth : 300,
  863. minHeight : 100,
  864. layout : 'fit',
  865. plain : true,
  866. bodyStyle : 'padding:5px;',
  867. buttonAlign : 'center',
  868. items : form,
  869. buttons : [{
  870. text : '导入',
  871. handler : function() {
  872. if (form.form.isValid()) {
  873. if(Ext.getCmp('userfile').getValue() == ''){
  874. Ext.Msg.alert('错误','请选择你的文件');
  875. return;
  876. }
  877. Ext.MessageBox.show({
  878. title : '请等待',
  879. msg : '文件正在导入...',
  880. progressText : '',
  881. width : 300,
  882. progress : true,
  883. closable : true,
  884. animEl : 'loding'
  885. });
  886. form.getForm().submit({
  887. url : baseUrl +'contract/contractFileUpload',
  888. method : 'POST',
  889. success : function(form, action) {
  890. Ext.Msg.alert("系统提示", "文件上传成功!");
  891. fileUrl = action.result.url
  892. // console.log(form);
  893. win.close();
  894. },
  895. failure : function() {
  896. Ext.Msg.alert("系统提示", "文件上传失败!(上传文件类型不对或文件过大)");
  897. }
  898. })
  899. }else{
  900. Ext.Msg.alert("系统提示","请选择文件后再上传!");
  901. }
  902. }
  903. }, {
  904. text : '关闭',
  905. handler : function() {
  906. win.close();
  907. }
  908. }]
  909. });
  910. win.show();
  911. }
  912. },
  913. {
  914. text: '关闭',
  915. iconCls: 'cancel_btn',
  916. handler: function () {
  917. this.up('window').close();
  918. }
  919. }]
  920. });
  921. new Ext.create('Ext.panel.Panel', {
  922. width: '100%',
  923. id: 'ManageOptionPanel',
  924. layout: 'border',
  925. items:
  926. contractOptionPanel,
  927. renderTo: Ext.getBody()
  928. });
  929. myStore.reload();
  930. // getCurrentData();
  931. $(window).resize(function () {
  932. body_resize();
  933. });
  934. body_resize();
  935. });