patrolplan.js 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375
  1. /**
  2. * patrolplan.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. //var sm1 = Ext.create('Ext.selection.CheckboxModel');
  19. var menuidx = '';
  20. var mouseon;
  21. var mouseoff;
  22. var menu_click;
  23. var AllSelectedRecords = [];
  24. var sm1;
  25. var initflag = false;
  26. Ext.define('MaintenancePlan', {
  27. extend: 'Ext.data.Model',
  28. fields: [
  29. { name: 'id', type: 'string' },
  30. { name: 'xh', type: 'int' },
  31. { name: 'plan_name', type: 'string' },
  32. { name: 'cycle', type: 'string' },
  33. { name: 'cycle_name', type: 'string' },
  34. { name: 'zxsj', type: 'string' },
  35. { name: 'team_id', type: 'string' },
  36. { name: 'team_name', type: 'string' },
  37. { name: 'name', type: 'string' },
  38. { name: 'company_code', type: 'string' },
  39. { name: 'start_date', type: 'string' },
  40. { name: 'end_date', type: 'string' },
  41. { name: 'start_inspect_time', type: 'string' },
  42. { name: 'end_inspect_time', type: 'string' },
  43. ]
  44. });
  45. Ext.define('MaintenancePlan1', {
  46. extend: 'Ext.data.Model',
  47. fields: [
  48. { name: 'id', type: 'string' },
  49. { name: 'spot_name', type: 'string' },
  50. { name: 'spot_address', type: 'string' },
  51. { name: 'pd', type: 'string' },
  52. ]
  53. });
  54. function public_emptyInput() {
  55. Ext.getCmp('fa_patrolplan_name').setValue("");
  56. Ext.getCmp('fa_patrol_team_id').setValue("");
  57. // Ext.getCmp('fa_cycle').setValue("");
  58. Ext.getCmp('fa_patrol_start_date').setValue("");
  59. Ext.getCmp('fa_patrol_end_date').setValue("");
  60. Ext.getCmp('fa_patrol_start_time').setValue("");
  61. Ext.getCmp('fa_patrol_end_time').setValue("");
  62. Ext.getCmp('fa_patrol_company_code').setValue("");
  63. // Ext.getCmp('fa_spot_id').setValue("");
  64. }
  65. function exportbtn_click() {
  66. baseUrl = document.getElementById('basePath').value;
  67. V_LOGINNAME = $("#V_LOGINNAME").val();
  68. plan_name = document.getElementById('plan_name').value;
  69. person_liable_id = document.getElementById('person_liable_id').value;
  70. var fields = '';
  71. var array = ['xh', 'plan_name', 'cycle_name', 'zxsj', 'team_name', 'name'];
  72. var name = ['序号', '任务名称', '周期', '执行日期', '执行团队', '责任人'];
  73. for (var i = 0; i < 6; i++) {
  74. if (i > 0)
  75. fields += ',';
  76. fields += '{id:"' + array[i] + '",title:"' + name[i] + '",shown:"' + true + '"}';
  77. }
  78. var query = new Object();
  79. // query.V_LOGINNAME = V_LOGINNAME;
  80. query.plan_name = plan_name;
  81. query.person_liable_id = person_liable_id;
  82. query.EXPORT_FILE = '巡检计划列表';
  83. query.fields = '[' + fields + ']';
  84. $.ajax({
  85. type: 'POST',
  86. url: baseUrl + "iot/excel/view/XjPlanMasterExcel1",
  87. data: {
  88. queryJson: Ext.JSON.encode(query)
  89. },
  90. success: function (result) {
  91. var json = eval('(' + result + ')');
  92. if (json.action == 'dormExport') {
  93. ConfirmStore = json.RESULT;
  94. var elemIF = document.createElement("iframe");
  95. elemIF.src = baseUrl + json.filename;
  96. elemIF.style.display = "none";
  97. document.body.appendChild(elemIF);
  98. }
  99. }
  100. });
  101. }
  102. var body_resize = function () {
  103. maxHeight = document.documentElement.clientHeight;
  104. maxWidth = document.documentElement.clientWidth;
  105. Ext.getCmp('PatrolPlanPiebar').setHeight(maxHeight);
  106. Ext.getCmp('PatrolPlanPiebar').setWidth(maxWidth);
  107. }
  108. Ext.onReady(function () {
  109. var baseUrl = document.getElementById('basePath').value;
  110. var theme = document.getElementById('theme').value;
  111. company_code = document.getElementById('company_code').value;
  112. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  113. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  114. var V_LOGINNAME = $("#V_LOGINNAME").val();
  115. var V_PASSWORD = $("#V_PASSWORD").val();
  116. var chkIcon = '<img src="' + baseUrl + 'res/img/common/check.gif"/>'
  117. var unchkIcon = '<img src="' + baseUrl + 'res/img/common/uncheck.gif"/>'
  118. var countPerPage = 15;
  119. var maxHeight = 10000;
  120. var chkBoolean = function (flag) {
  121. if (flag)
  122. return chkIcon;
  123. return unchkIcon;
  124. }
  125. var states1 = Ext.create('Ext.data.Store', {
  126. fields: ['status', 'name'],
  127. data: [
  128. // {"status":-1, "name":"全选"},
  129. { "status": "待开通", "name": "待开通" },
  130. { "status": "已开通", "name": "已开通" },
  131. { "status": "已锁定", "name": "已锁定" },
  132. { "status": "注销", "name": "注销" },
  133. ]
  134. });
  135. var deselect_fun = function (record) {
  136. var index = AllSelectedRecords.indexOf(record.get("id"));
  137. if (index > -1) {
  138. AllSelectedRecords.splice(index, 1);
  139. return AllSelectedRecords;
  140. }
  141. }
  142. sm1 = Ext.create('Ext.selection.CheckboxModel', {
  143. mode: "MULTI",
  144. listeners: {
  145. deselect: function (me, record, index, opts) {
  146. if (initflag) {
  147. // alert("初始化");
  148. } else {
  149. deselect_fun(record);
  150. }
  151. },
  152. select: function (me, record, index, opts) {
  153. var index = AllSelectedRecords.indexOf(record.get("id"));
  154. if (index > -1) {
  155. return AllSelectedRecords;
  156. } else {
  157. AllSelectedRecords.push(record.get("id"));
  158. return AllSelectedRecords;
  159. }
  160. }
  161. }
  162. });
  163. var clear_append_form = function () {
  164. public_emptyInput();
  165. AllSelectedRecords = [];
  166. Ext.getCmp('PatrolPlanListPageToolbar').getStore().reload();
  167. }
  168. var queryJson = new Object();
  169. queryJson.V_LOGINNAME = V_LOGINNAME;
  170. // queryJson.V_PASSWORD = V_PASSWORD;
  171. queryJson.COMMSTATUS = 'NO';
  172. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  173. queryJson.company_code = company_code;
  174. var myStore = Ext.create('Ext.data.Store', {
  175. model: 'MaintenancePlan',
  176. pageSize: countPerPage,
  177. proxy: {
  178. type: 'ajax',
  179. url: baseUrl + 'iot/planmaster/getList1',
  180. reader: {
  181. type: 'json',
  182. root: 'RESULT',
  183. totalProperty: 'totalCount'
  184. },
  185. extraParams: {
  186. queryJson: Ext.JSON.encode(queryJson)
  187. }
  188. },
  189. remoteSort: true
  190. });
  191. var myStore1 = Ext.create('Ext.data.Store', {
  192. model: 'MaintenancePlan1',
  193. pageSize: 5,
  194. listeners: {
  195. beforeload: function (me, store, operation, eOpts) {
  196. // Ext.apply(myStore1.proxy.extraParams, me.getQueryParameters());
  197. // sm1.removeListener('deselect',deselect_fun);
  198. initflag = true;
  199. },
  200. load: function (me, records, success, opts) {
  201. if (!success || !records || records.length == 0)
  202. return;
  203. //根据全局的选择,初始化选中的列
  204. var selModel = Ext.getCmp('PatrolPlanListPanel1').getSelectionModel();
  205. Ext.Array.forEach(AllSelectedRecords, function (item) {
  206. for (var i = 0; i < records.length; i++) {
  207. var record = records[i];
  208. if (record.get("id") == item && record.get('pd') != 1) {
  209. // alert(record.get("id")+" - "+this.get("id")+"("+this.data.id+")");
  210. selModel.select(record, true, true); //选中record,并且保持现有的选择,不触发选中事件
  211. }
  212. }
  213. });
  214. // sm1.addListener('deselect',deselect_fun);
  215. initflag = false;
  216. }
  217. },
  218. proxy: {
  219. type: 'ajax',
  220. url: baseUrl + 'iot/inspectionpoints/getList1',
  221. reader: {
  222. type: 'json',
  223. root: 'RESULT',
  224. totalProperty: 'totalCount'
  225. },
  226. extraParams: {
  227. queryJson: Ext.JSON.encode(queryJson)
  228. }
  229. },
  230. remoteSort: true
  231. });
  232. myStore1.on('load', function (myStore1, record) {
  233. for (var i = 0; i < record.length; i++) {
  234. var records = record[i];
  235. if (records.get('pd') == 1) {
  236. Ext.getCmp('PatrolPlanListPanel1').getSelectionModel().select(records, true);
  237. }
  238. };
  239. });
  240. Ext.define('CompanyComboStore', {
  241. extend: 'Ext.data.Model',
  242. fields: [
  243. { name: 'building_name', type: 'string' },
  244. { name: 'building_id', type: 'string' }
  245. ]
  246. });
  247. Ext.define('teamStore', {
  248. extend: 'Ext.data.Model',
  249. fields: [
  250. { name: 'team_name', type: 'string' },
  251. { name: 'id', type: 'string' }
  252. ]
  253. });
  254. var CompanyStory = Ext.create('Ext.data.Store', {
  255. model: 'CompanyComboStore',
  256. proxy: {
  257. type: 'ajax',
  258. actionMethods: {
  259. create: 'POST',
  260. read: 'POST', // by default GET
  261. update: 'POST',
  262. destroy: 'POST'
  263. },
  264. url: baseUrl + 'iot/company/view/getBuildingNameList',
  265. reader: {
  266. type: 'json',
  267. root: 'RESULT',
  268. totalProperty: 'totalCount'
  269. },
  270. extraParams: {
  271. queryJson: Ext.JSON.encode(queryJson)
  272. }
  273. }
  274. });
  275. var teamStory = Ext.create('Ext.data.Store', {
  276. model: 'teamStore',
  277. proxy: {
  278. type: 'ajax',
  279. actionMethods: {
  280. create: 'POST',
  281. read: 'POST', // by default GET
  282. update: 'POST',
  283. destroy: 'POST'
  284. },
  285. url: baseUrl + 'iot/planteam/getList1',
  286. reader: {
  287. type: 'json',
  288. root: 'RESULT',
  289. totalProperty: 'totalCount'
  290. },
  291. extraParams: {
  292. queryJson: Ext.JSON.encode(queryJson)
  293. }
  294. }
  295. });
  296. var data = Ext.Date.format(new Date(), 'm/d/Y');
  297. var AppendForm = Ext.create('Ext.form.Panel', {
  298. id: 'PatrolPlanAppendForm',
  299. labelWidth: 55,
  300. url: baseUrl + 'iot/planmaster/append1',
  301. bodyPadding: 15,
  302. frame: true,
  303. labelAlign: 'left',
  304. region: 'north',
  305. enableDrop: true,
  306. ddGroup: 'treeID',
  307. height: 200,
  308. items: [{
  309. autoHeight: true,
  310. layout: 'column',
  311. border: false,
  312. items: [{
  313. columnWidth: .50,
  314. xtype: 'fieldset',
  315. layout: 'form',
  316. // defaults: {anchor: '95%'},
  317. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  318. items: [
  319. {
  320. xtype: 'textfield',
  321. fieldLabel: '任务名称',
  322. id: 'fa_patrolplan_name',
  323. name: 'plan_name',
  324. editable: false,
  325. width: 283,
  326. listeners: {
  327. change: function (o, e) {
  328. if (e.length >= 20) {
  329. return Ext.getCmp('fa_patrolplan_name').setValue(e.substring(0, 20));
  330. }
  331. }
  332. }
  333. // store:InspectorsStory
  334. }, {
  335. xtype: 'combo',
  336. fieldLabel: '建筑/项目',
  337. id: 'fa_patrol_company_code',
  338. name: 'company_code',
  339. displayField: 'building_name',
  340. valueField: 'building_id',
  341. editable: false,
  342. width: 283,
  343. store: CompanyStory,
  344. listeners: {
  345. select: function (combo, record, index) {
  346. try {
  347. var label = this.value;
  348. var query = new Object();
  349. query.company_code = label;
  350. query.V_LOGINNAME = V_LOGINNAME;
  351. // query.V_PASSWORD = V_PASSWORD;
  352. var jsonstr = Ext.JSON.encode(query);
  353. myStore1.getProxy().extraParams = {
  354. queryJson: jsonstr
  355. };
  356. Ext.getCmp('PatrolPlanListPageToolbar1').moveFirst();
  357. }
  358. catch (ex) {
  359. Ext.MessageBox.alert("错误", "数据加载失败。");
  360. }
  361. }
  362. }
  363. }, {
  364. xtype: 'timefield',
  365. fieldLabel: '巡检开始时间',
  366. id: 'fa_patrol_start_time',
  367. name: "start_time",
  368. minValue: '00:00',
  369. maxValue: '24:00',
  370. editable: false,//只读约束
  371. minText: '时间要大于{0}',
  372. maxText: '时间要小于{0}',
  373. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  374. increment: 30,//跨度,默认是15分钟
  375. invalidText: '时间格式错误',
  376. anchor: '40%'
  377. }, {
  378. xtype: 'timefield',
  379. fieldLabel: '巡检结束时间',
  380. id: 'fa_patrol_end_time',
  381. name: "end_time",
  382. minValue: '00:00',
  383. maxValue: '24:00',
  384. editable: false,//只读约束
  385. minText: '时间要大于{0}',
  386. maxText: '时间要小于{0}',
  387. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  388. increment: 30,//跨度,默认是15分钟
  389. invalidText: '时间格式错误',
  390. anchor: '80%'
  391. }, {
  392. xtype: 'combo',
  393. fieldLabel: '执行团队',
  394. id: 'fa_patrol_team_id',
  395. name: 'team_id',
  396. displayField: 'team_name',
  397. valueField: 'id',
  398. editable: false,
  399. width: 100,
  400. store: teamStory
  401. }
  402. ]
  403. }, {
  404. columnWidth: .50,
  405. xtype: 'fieldset',
  406. layout: 'form',
  407. // defaults: {anchor: '95%'},
  408. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  409. items: [
  410. {
  411. xtype: 'checkboxgroup',
  412. fieldLabel: '周期',
  413. id: "fa_patrol_cycle",
  414. listeners: {
  415. change: function (gp, nv, ov, eOpts) {
  416. var i = 0;
  417. if (nv.all && !ov.all) {
  418. // return gp.eachBox(function(box,idx){
  419. // box.setRawValue(true);
  420. // });
  421. Ext.getCmp('fa_all_checkbox').setValue(true);
  422. Ext.getCmp('fa_monday_checkbox').setValue(true);
  423. Ext.getCmp('fa_tuesday_checkbox').setValue(true);
  424. Ext.getCmp('fa_wednesday_checkbox').setValue(true);
  425. Ext.getCmp('fa_thursday_checkbox').setValue(true);
  426. Ext.getCmp('fa_friday_checkbox').setValue(true);
  427. Ext.getCmp('fa_saturday_checkbox').setValue(true);
  428. Ext.getCmp('fa_sunday_checkbox').setValue(true);
  429. return true;
  430. }
  431. if (ov.all && !nv.all && nv.monday && nv.tuesday && nv.wednesday && nv.thursday && nv.friday && nv.saturday && nv.sunday) {
  432. // return gp.eachBox(function(box,idx){
  433. // box.setRawValue(false);
  434. // });
  435. Ext.getCmp('fa_all_checkbox').setValue(false);
  436. Ext.getCmp('fa_monday_checkbox').setValue(false);
  437. Ext.getCmp('fa_tuesday_checkbox').setValue(false);
  438. Ext.getCmp('fa_wednesday_checkbox').setValue(false);
  439. Ext.getCmp('fa_thursday_checkbox').setValue(false);
  440. Ext.getCmp('fa_friday_checkbox').setValue(false);
  441. Ext.getCmp('fa_saturday_checkbox').setValue(false);
  442. Ext.getCmp('fa_sunday_checkbox').setValue(false);
  443. return true;
  444. }
  445. if (nv.monday && nv.tuesday && nv.wednesday && nv.thursday && nv.friday && nv.saturday && nv.sunday) {
  446. Ext.getCmp('fa_all_checkbox').setValue(true);
  447. return true;
  448. } else {
  449. Ext.getCmp('fa_all_checkbox').setValue(false);
  450. return true;
  451. }
  452. }
  453. },
  454. columns: 3,
  455. items: [
  456. { boxLabel: '全选', name: 'all', inputValue: "0", id: "fa_all_checkbox" },
  457. { boxLabel: '周一', name: 'monday', inputValue: "1", id: "fa_monday_checkbox" },
  458. { boxLabel: '周二', name: 'tuesday', inputValue: "2", id: "fa_tuesday_checkbox" },
  459. { boxLabel: '周三', name: 'wednesday', inputValue: "3", id: "fa_wednesday_checkbox" },
  460. { boxLabel: '周四', name: 'thursday', inputValue: "4", id: "fa_thursday_checkbox" },
  461. { boxLabel: '周五', name: 'friday', inputValue: "5", id: "fa_friday_checkbox" },
  462. { boxLabel: '周六', name: 'saturday', inputValue: "6", id: "fa_saturday_checkbox" },
  463. { boxLabel: '周日', name: 'sunday', inputValue: "7", id: "fa_sunday_checkbox" }
  464. ]
  465. }, {
  466. xtype: 'datefield',
  467. fieldLabel: "执行开始日期",
  468. minValue: data,
  469. minText: "当前日期选择应大于当天日期",
  470. format: "Y-m-d",
  471. id: 'fa_patrol_start_date',
  472. name: "start_date",
  473. editable: false,//只读约束
  474. anchor: '80%'
  475. }, {
  476. xtype: 'datefield',
  477. fieldLabel: "执行结束日期",
  478. minValue: data,
  479. // '07/07/2017',
  480. minText: "当前日期选择应大于当天日期",
  481. format: "Y-m-d",
  482. id: 'fa_patrol_end_date',
  483. name: "end_date",
  484. editable: false,//只读约束
  485. anchor: '80%'
  486. }, {
  487. id: 'fa_patrol_queryJson',
  488. name: 'queryJson',
  489. hidden: true
  490. }
  491. ]
  492. }
  493. ]
  494. }]
  495. });
  496. function addtijiao() {
  497. var query = new Object();
  498. var spot_id = null;
  499. var InspectiontimeValue = Ext.getCmp('fa_patrol_cycle').getChecked();
  500. var fa_cycle = '';
  501. Ext.Array.each(InspectiontimeValue, function (item) {
  502. fa_cycle += item.inputValue + ',';
  503. });
  504. var V_LOGINNAME = $("#V_LOGINNAME").val();
  505. var V_PASSWORD = $("#V_PASSWORD").val();
  506. query.plan_name = Ext.getCmp('fa_patrolplan_name').getValue();
  507. if (query.plan_name == '') {
  508. Ext.Msg.alert('提示', '任务名称不能为空!', function (btn, txt) {
  509. })
  510. return;
  511. }
  512. var start_time = Ext.getCmp('fa_patrol_start_time').getValue();
  513. if (start_time == '' || start_time == null) {
  514. Ext.Msg.alert('提示', '请选择巡检开始时间!', function (btn, txt) {
  515. })
  516. return;
  517. } else {
  518. var start_time1 = ((start_time.getHours() < 10) ? ('0' + start_time.getHours()) : start_time.getHours()) + ':' + ((start_time.getMinutes() < 10) ? ('0' + start_time.getMinutes()) : start_time.getMinutes());
  519. }
  520. var end_time = Ext.getCmp('fa_patrol_end_time').getValue();
  521. if (end_time == '' || end_time == null) {
  522. Ext.Msg.alert('提示', '请选择巡检结束时间!', function (btn, txt) {
  523. })
  524. return;
  525. } else {
  526. var end_time1 = ((end_time.getHours() < 10) ? ('0' + end_time.getHours()) : end_time.getHours()) + ':' + ((end_time.getMinutes() < 10) ? ('0' + end_time.getMinutes()) : end_time.getMinutes());
  527. }
  528. query.team_id = Ext.getCmp('fa_patrol_team_id').getValue();
  529. if (query.team_id == '' || query.team_id == null) {
  530. Ext.Msg.alert('提示', '请选择执行团队!', function (btn, txt) {
  531. })
  532. return;
  533. }
  534. // Ext.MessageBox.alert('提示', '您的兴趣是' + V_LOGINNAME);
  535. // var selected = sm1.getSelection( );
  536. // query.spot_id = selected[0].raw.id;
  537. // var selected = sm1.getSelection( );
  538. // alert(sm1.getCount());
  539. if (AllSelectedRecords.length == 1) {
  540. query.spot_id = AllSelectedRecords[0];
  541. } else {
  542. if (AllSelectedRecords.length > 1) {
  543. for (var i = 0; i < AllSelectedRecords.length; i++) {
  544. if (i == 0)
  545. spot_id = AllSelectedRecords[i];
  546. else
  547. spot_id += "," + AllSelectedRecords[i];
  548. }
  549. query.spot_id = spot_id;
  550. } else {
  551. Ext.Msg.alert('请先选择', '至少选择一条巡检点位,再点击提交');
  552. return;
  553. }
  554. }
  555. query.company_code = Ext.getCmp('fa_patrol_company_code').getValue();//建筑/项目
  556. query.cycle = fa_cycle;
  557. query.start_inspect_time = start_time1;
  558. query.end_inspect_time = end_time1;
  559. query.start_date = Ext.util.Format.date(Ext.getCmp('fa_patrol_start_date').getValue(), 'Y-m-d');
  560. if (query.start_date == '') {
  561. Ext.Msg.alert('提示', '请选择执行开始日期!', function (btn, txt) {
  562. })
  563. return;
  564. }
  565. query.end_date = Ext.util.Format.date(Ext.getCmp('fa_patrol_end_date').getValue(), 'Y-m-d');
  566. if (query.end_date == '') {
  567. Ext.Msg.alert('提示', '请选择执行结束日期!', function (btn, txt) {
  568. })
  569. return;
  570. }
  571. // query.ID_LIST = list;
  572. // query.V_LOGINNAME = V_LOGINNAME;
  573. var jsonstr = Ext.JSON.encode(query);
  574. Ext.Ajax.request({
  575. timeout: 3000000,
  576. url: baseUrl + 'iot/planmaster/append1',
  577. params: 'queryJson=' + jsonstr,
  578. success: function (resp, opts) {
  579. Ext.Msg.alert('操作成功', '计划已添加', function (btn, txt) {
  580. // myStore.reload();
  581. clear_append_form();
  582. });
  583. }
  584. });
  585. }
  586. var appendwin = function () {
  587. AllSelectedRecords.length = 0;
  588. var query = new Object();
  589. query.V_LOGINNAME = V_LOGINNAME;
  590. // query.V_PASSWORD=V_PASSWORD;
  591. var jsonstr = Ext.JSON.encode(query);
  592. myStore1.getProxy().extraParams = {
  593. queryJson: jsonstr
  594. };
  595. Ext.getCmp('PatrolPlanListPageToolbar1').moveFirst();
  596. Ext.create('Ext.window.Window', {
  597. title: '新增巡检计划',
  598. height: 600,
  599. width: 800,
  600. modal: true,
  601. layout: 'border',
  602. items: [AppendForm, PatrolPlanTab],
  603. closeAction: 'hide',
  604. buttons: [{
  605. text: '提交',
  606. iconCls: 'ok_btn',
  607. handler: function () {
  608. addtijiao();
  609. }
  610. }, {
  611. text: '关闭',
  612. iconCls: 'cancel_btn',
  613. handler: function () {
  614. this.up('window').hide();
  615. public_emptyInput();
  616. }
  617. }]
  618. }).show();
  619. Ext.getCmp('fa_all_checkbox').setValue(true);
  620. Ext.getCmp('fa_monday_checkbox').setValue(true);
  621. Ext.getCmp('fa_tuesday_checkbox').setValue(true);
  622. Ext.getCmp('fa_wednesday_checkbox').setValue(true);
  623. Ext.getCmp('fa_thursday_checkbox').setValue(true);
  624. Ext.getCmp('fa_friday_checkbox').setValue(true);
  625. Ext.getCmp('fa_saturday_checkbox').setValue(true);
  626. Ext.getCmp('fa_sunday_checkbox').setValue(true);
  627. }
  628. var del_sm = function () {
  629. if (sm.getCount() == 1) {
  630. var selected = sm.getSelection();
  631. var query = new Object();
  632. var list = new Array();
  633. var o = new Object();
  634. o.id = selected[0].raw.id;
  635. list.push(o);
  636. query.ID_LIST = list;
  637. var jsonstr = Ext.JSON.encode(query);
  638. Ext.MessageBox.confirm('删除任务信息', '是否删除' + selected[0].raw.name + ' 巡检任务?', function (btn) {
  639. public_delete(btn, jsonstr);
  640. }, this);
  641. } else {
  642. if (sm.getCount() > 1) {
  643. var query = new Object();
  644. var list = new Array();
  645. for (var i = 0; i < sm.getCount(); i++) {
  646. var selected = sm.getSelection();
  647. var o = new Object();
  648. o.id = selected[i].raw.id;
  649. list.push(o);
  650. }
  651. query.ID_LIST = list;
  652. var jsonstr = Ext.JSON.encode(query);
  653. Ext.MessageBox.confirm('删除任务信息', '是否删除选中的' + sm.getCount() + ' 个巡检任务?', function (btn) {
  654. public_delete(btn, jsonstr);
  655. }, this);
  656. } else {
  657. Ext.Msg.alert('请先选择', '至少选择一条记录,再点击删除');
  658. }
  659. }
  660. }
  661. function public_delete(btn, jsonstr) {
  662. if (btn == 'yes') {
  663. $.ajax({
  664. type: 'POST',
  665. url: baseUrl + "iot/planmaster/del",
  666. data: {
  667. queryJson: jsonstr
  668. },
  669. success: function (result) {
  670. var json = eval('(' + result + ')');
  671. if (json.action == 'deletePlanMaster') {
  672. if (json.success == true) {
  673. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  674. Ext.getCmp('PatrolPlanListPanel').getStore().reload();
  675. });
  676. } else {
  677. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  678. Ext.getCmp('PatrolPlanListPanel').getStore().reload();
  679. });
  680. }
  681. }
  682. }
  683. });
  684. }
  685. }
  686. var clear_modify_form = function () {
  687. Ext.getCmp('fm_patrol_id').setValue("");
  688. Ext.getCmp('fm_patrol_plan_name').setValue("");
  689. Ext.getCmp('fm_patrol_team_id').setValue("");
  690. // Ext.getCmp('fm_cycle').setValue("");
  691. Ext.getCmp('fm_patrol_start_date').setValue("");
  692. Ext.getCmp('fm_patrol_end_date').setValue("");
  693. Ext.getCmp('fm_patrol_start_time').setValue("");
  694. Ext.getCmp('fm_patrol_end_time').setValue("");
  695. Ext.getCmp('fm_patrol_company_code').setValue("");
  696. Ext.getCmp('fm_patrol_cycle').setValue(false);
  697. AllSelectedRecords = [];
  698. // Ext.getCmp('fm_spot_id').setValue("");
  699. Ext.getCmp('PatrolPlanListPageToolbar').getStore().reload();
  700. }
  701. $('#patrolPlan_title2_input').change(function () {
  702. var text = Ext.getCmp('fm_patrol_start_date').getValue();
  703. if (text.length >= 20) {
  704. return Ext.getCmp('fa_patrolplan_name').setValue(text.substring(0, 20));
  705. }
  706. })
  707. var show_page = function () {
  708. var maintenancePlan_title2_input = document.getElementById('patrolPlan_title2_input').value;
  709. var maintenancePlan_title3_input1 = document.getElementById('patrolPlan_title3_input1').value;
  710. var query = new Object();
  711. if (maintenancePlan_title2_input.length > 0) {
  712. query.plan_name = maintenancePlan_title2_input;
  713. $("#plan_name").val(maintenancePlan_title2_input);
  714. }
  715. if (maintenancePlan_title3_input1.length > 0) {
  716. query.person_liable_id = maintenancePlan_title3_input1;
  717. $("#person_liable_id").val(maintenancePlan_title3_input1);
  718. }
  719. // query.V_LOGINNAME = V_LOGINNAME;
  720. // query.V_PASSWORD = V_PASSWORD;
  721. var jsonstr = Ext.JSON.encode(query);
  722. myStore.getProxy().extraParams = {
  723. queryJson: jsonstr
  724. };
  725. Ext.getCmp('PatrolPlanListPageToolbar').moveFirst();
  726. }
  727. var reset1 = function () {
  728. document.getElementById('patrolPlan_title2_input').value = '';
  729. document.getElementById('patrolPlan_title3_input1').value = '0';
  730. $("#plan_name").val('');
  731. $("#person_liable_id").val('');
  732. show_page();
  733. }
  734. mouseon = function (obj) {
  735. var id = obj.id;
  736. $("#" + id).removeClass(id);
  737. $("#" + id).addClass(id + '_on');
  738. }
  739. mouseoff = function (obj) {
  740. var mid = "patrolPlan_";
  741. for (var i = 1; i < 7; i++) {
  742. var id = "patrolPlan_title" + i + "_div";
  743. $("#" + id).removeClass(id + '_on');
  744. $("#" + id).addClass(id);
  745. }
  746. if (menuidx == 'm1') {
  747. mid += 'title1_div';
  748. $("#" + mid).removeClass(mid);
  749. $("#" + mid).addClass(mid + '_on');
  750. }
  751. else if (menuidx == 'm2') {
  752. mid += 'title2_div';
  753. $("#" + mid).removeClass(mid);
  754. $("#" + mid).addClass(mid + '_on');
  755. }
  756. else if (menuidx == 'm3') {
  757. mid += 'title3_div';
  758. $("#" + mid).removeClass(mid);
  759. $("#" + mid).addClass(mid + '_on');
  760. }
  761. else if (menuidx == 'm4') {
  762. mid += 'title4_div';
  763. $("#" + mid).removeClass(mid);
  764. $("#" + mid).addClass(mid + '_on');
  765. }
  766. else if (menuidx == 'm5') {
  767. mid += 'title5_div';
  768. $("#" + mid).removeClass(mid);
  769. $("#" + mid).addClass(mid + '_on');
  770. }
  771. else if (menuidx == 'm6') {
  772. mid += 'title6_div';
  773. $("#" + mid).removeClass(mid);
  774. $("#" + mid).addClass(mid + '_on');
  775. }
  776. }
  777. menu_click = function (obj) {
  778. var id = obj.id;
  779. if (id == 'patrolPlan_title1_div') {
  780. menuidx = 'm1';
  781. show_page();
  782. }
  783. else if (id == 'patrolPlan_title2_div') {
  784. menuidx = 'm2';
  785. reset1();
  786. }
  787. else if (id == 'patrolPlan_title3_div') {
  788. menuidx = 'm3';
  789. exportbtn_click();
  790. }
  791. else if (id == 'patrolPlan_title4_div') {
  792. menuidx = 'm4';
  793. del_sm();
  794. }
  795. else if (id == 'patrolPlan_title5_div') {
  796. menuidx = 'm5';
  797. appendwin();
  798. }
  799. else if (id == 'patrolPlan_title6_div') {
  800. menuidx = 'm6';
  801. chk_sm();
  802. }
  803. }
  804. var piedarHtml = function () {
  805. var maintenancePlanHtml = document.getElementById('patrolPlanHtml');
  806. var divhiddle = document.createElement('div');
  807. divhiddle.id = 'div26_id_patrolPlanPanel3';
  808. divhiddle.setAttribute('class', 'SpringHandleHtml3DivHiddle');
  809. maintenancePlanHtml.appendChild(divhiddle);
  810. var title = document.createElement('div');
  811. title.setAttribute('class', 'MaintenancePersonTitle');
  812. title.innerHTML = '巡检计划';
  813. maintenancePlanHtml.appendChild(title);
  814. var title2 = document.createElement('div');
  815. title2.setAttribute('class', 'title2_div');
  816. title2.innerHTML = '任务名称';
  817. maintenancePlanHtml.appendChild(title2);
  818. var input = document.createElement('input');
  819. input.setAttribute('class', 'input_class');
  820. input.setAttribute('id', 'patrolPlan_title2_input');
  821. input.setAttribute('type', 'text');
  822. input.setAttribute('value', '');
  823. maintenancePlanHtml.appendChild(input);
  824. var title3 = document.createElement('div');
  825. title3.setAttribute('class', 'title3_div');
  826. title3.innerHTML = '责任人';
  827. maintenancePlanHtml.appendChild(title3);
  828. // var input1 = document.createElement('input');
  829. // input1.setAttribute('class','input1_class');
  830. // input1.setAttribute('id','maintenancePlan_title3_input1');
  831. // input1.setAttribute('type','text');
  832. // input1.setAttribute('value','');
  833. // maintenancePlanHtml.appendChild(input1);
  834. var select = document.createElement('select');
  835. select.setAttribute('class', 'input1_class');
  836. select.setAttribute('id', 'patrolPlan_title3_input1');
  837. maintenancePlanHtml.appendChild(select);
  838. var option2 = document.createElement('option');
  839. option2.innerHTML = '所有人';
  840. option2.setAttribute('value', '0');
  841. select.appendChild(option2);
  842. for (var i = 0; i < ConfirmStore.length; i++) {
  843. var option3 = document.createElement('option');
  844. option3.innerHTML = ConfirmStore[i].name;
  845. option3.setAttribute('value', ConfirmStore[i].person_liable_id);
  846. select.appendChild(option3);
  847. }
  848. for (let i = 1; i <= 6; i++) {
  849. var title = document.createElement('div');
  850. title.setAttribute('class', `patrolPlan_title${i}_div`);
  851. title.setAttribute('id', `patrolPlan_title${i}_div`);
  852. title.setAttribute('onmouseover', "mouseon(this)");
  853. title.setAttribute('onmouseout', "mouseoff(this)");
  854. title.setAttribute('onclick', "menu_click(this)");
  855. maintenancePlanHtml.appendChild(title);
  856. }
  857. }
  858. var piedarHtml_fun = function () {
  859. var query = new Object();
  860. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  861. $.ajax({
  862. type: 'POST',
  863. url: baseUrl + "iot/planteam/getzrrList1",
  864. data: {
  865. queryJson: Ext.JSON.encode(query)
  866. },
  867. success: function (result) {
  868. var json = eval('(' + result + ')');
  869. if (json.action == 'getPlanTeamList') {
  870. ConfirmStore = json.RESULT;
  871. if (document.getElementById('div26_id_patrolPlanPanel3') == undefined)
  872. piedarHtml();
  873. }
  874. }
  875. });
  876. }
  877. var ModifyForm = Ext.create('Ext.form.Panel', {
  878. id: 'PatrolPlanEditForm',
  879. labelWidth: 55,
  880. url: baseUrl + 'iot/planmaster/update',
  881. bodyPadding: 15,
  882. frame: true,
  883. labelAlign: 'left',
  884. region: 'north',
  885. enableDrop: true,
  886. ddGroup: 'treeID',
  887. height: 200,
  888. items: [{
  889. autoHeight: true,
  890. layout: 'column',
  891. border: false,
  892. items: [{
  893. columnWidth: .50,
  894. xtype: 'fieldset',
  895. layout: 'form',
  896. // defaults: {anchor: '95%'},
  897. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  898. items: [
  899. {
  900. xtype: 'textfield',
  901. fieldLabel: '任务名称',
  902. id: 'fm_patrol_plan_name',
  903. name: 'plan_name',
  904. editable: false,
  905. width: 230,
  906. readOnly: 'true'
  907. }, {
  908. xtype: 'combo',
  909. fieldLabel: '建筑/项目',
  910. id: 'fm_patrol_company_code',
  911. name: 'company_code',
  912. displayField: 'building_name',
  913. valueField: 'building_id',
  914. editable: false,
  915. width: 283,
  916. store: CompanyStory,
  917. readOnly: 'true'
  918. }, {
  919. xtype: 'timefield',
  920. fieldLabel: '巡检开始时间',
  921. id: 'fm_patrol_start_time',
  922. name: "start_time",
  923. minValue: '00:00',
  924. maxValue: '24:00',
  925. minText: '时间要大于{0}',
  926. maxText: '时间要小于{0}',
  927. editable: false,
  928. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  929. increment: 30,//跨度,默认是15分钟
  930. invalidText: '时间格式错误',
  931. anchor: '40%'
  932. }, {
  933. xtype: 'timefield',
  934. fieldLabel: '巡检结束时间',
  935. id: 'fm_patrol_end_time',
  936. name: "end_time",
  937. minValue: '00:00',
  938. maxValue: '24:00',
  939. minText: '时间要大于{0}',
  940. maxText: '时间要小于{0}',
  941. editable: false,
  942. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  943. increment: 30,//跨度,默认是15分钟
  944. invalidText: '时间格式错误',
  945. anchor: '80%'
  946. }, {
  947. xtype: 'combo',
  948. fieldLabel: '执行团队',
  949. id: 'fm_patrol_team_id',
  950. name: 'team_id',
  951. displayField: 'team_name',
  952. valueField: 'id',
  953. editable: false,
  954. width: 100,
  955. store: teamStory
  956. }
  957. ]
  958. }, {
  959. columnWidth: .50,
  960. xtype: 'fieldset',
  961. layout: 'form',
  962. // defaults: {anchor: '95%'},
  963. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  964. items: [
  965. {
  966. xtype: 'checkboxgroup',
  967. fieldLabel: '周期',
  968. id: "fm_patrol_cycle",
  969. columns: 3,
  970. items: [
  971. { boxLabel: '周一', name: 'monday', inputValue: "1", id: "fm_monday" },
  972. { boxLabel: '周二', name: 'tuesday', inputValue: "2", id: "fm_tuesday" },
  973. { boxLabel: '周三', name: 'wednesday', inputValue: "3", id: "fm_wednesday" },
  974. { boxLabel: '周四', name: 'thursday', inputValue: "4", id: "fm_thursday" },
  975. { boxLabel: '周五', name: 'friday', inputValue: "5", id: "fm_friday" },
  976. { boxLabel: '周六', name: 'saturday', inputValue: "6", id: "fm_saturday" },
  977. { boxLabel: '周日', name: 'sunday', inputValue: "7", id: "fm_sunday" }
  978. ]
  979. }, {
  980. xtype: 'datefield',
  981. fieldLabel: "执行开始日期",
  982. minValue: '07/07/2017',
  983. minText: "当前日期选择应大于2017-07-07",
  984. format: "Y-m-d",
  985. columnWidth: 0.5,
  986. id: 'fm_patrol_start_date',
  987. name: "start_data",
  988. editable: false,//只读约束
  989. anchor: '80%',
  990. readOnly: 'true'
  991. }, {
  992. xtype: 'datefield',
  993. fieldLabel: "执行结束日期",
  994. minValue: '07/07/2017',
  995. minText: "当前日期选择应大于之前日期",
  996. format: "Y-m-d",
  997. columnWidth: 0.5,
  998. id: 'fm_patrol_end_date',
  999. name: "end_date",
  1000. editable: false,//只读约束
  1001. anchor: '80%'
  1002. }, {
  1003. xtype: 'textfield',
  1004. id: 'fm_patrol_id',
  1005. name: 'id',
  1006. hidden: true
  1007. }, {
  1008. id: 'fm_patrol_queryJson',
  1009. name: 'queryJson',
  1010. hidden: true
  1011. }
  1012. ]
  1013. }
  1014. ]
  1015. }]
  1016. });
  1017. var modifywin = function () {
  1018. Ext.create('Ext.window.Window', {
  1019. title: '修改',
  1020. height: 600,
  1021. width: 800,
  1022. modal: true,
  1023. layout: 'border',
  1024. items: [ModifyForm, PatrolPlanTab],
  1025. closeAction: 'hide',
  1026. buttons: [{
  1027. text: '修改',
  1028. iconCls: 'ok_btn',
  1029. handler: function () {
  1030. addtijiao();
  1031. }
  1032. }, {
  1033. text: '关闭',
  1034. iconCls: 'cancel_btn',
  1035. handler: function () {
  1036. this.up('window').hide();
  1037. clear_modify_form();
  1038. }
  1039. }]
  1040. }).show();
  1041. }
  1042. var chk_sm = function () {
  1043. if (sm.getCount() == 1) {
  1044. AllSelectedRecords = [];
  1045. modifywin();
  1046. teamStory.reload();
  1047. CompanyStory.reload();
  1048. var selected = sm.getSelection();
  1049. var label = selected[0].raw.id
  1050. // alert("主表ID"+label);
  1051. var query = new Object();
  1052. // if(label.length>0){
  1053. query.dwid = label;
  1054. // }
  1055. // alert("主表ID1"+query.dwid);
  1056. query.V_LOGINNAME = V_LOGINNAME;
  1057. // query.V_PASSWORD = V_PASSWORD;
  1058. var jsonstr = Ext.JSON.encode(query);
  1059. myStore1.getProxy().extraParams = {
  1060. queryJson: jsonstr
  1061. };
  1062. Ext.getCmp('PatrolPlanListPageToolbar1').moveFirst();
  1063. Ext.getCmp('fm_patrol_plan_name').setValue(selected[0].raw.plan_name);
  1064. Ext.getCmp('fm_patrol_team_id').setValue(selected[0].raw.team_id);
  1065. // Ext.getCmp('fm_cycle').setValue(selected[0].raw.cycle);
  1066. var a = selected[0].raw.cycle;
  1067. var arr = a.split(",");
  1068. for (var i = 0; i < arr.length; i++) {
  1069. switch (arr[i]) {
  1070. case "1":
  1071. Ext.getCmp('fm_monday').setValue(true);
  1072. break;
  1073. case "2":
  1074. Ext.getCmp('fm_tuesday').setValue(true);
  1075. break;
  1076. case "3":
  1077. Ext.getCmp('fm_wednesday').setValue(true);
  1078. break;
  1079. case "4":
  1080. Ext.getCmp('fm_thursday').setValue(true);
  1081. break;
  1082. case "5":
  1083. Ext.getCmp('fm_friday').setValue(true);
  1084. break;
  1085. case "6":
  1086. Ext.getCmp('fm_saturday').setValue(true);
  1087. break;
  1088. case "7":
  1089. Ext.getCmp('fm_sunday').setValue(true);
  1090. break;
  1091. }
  1092. }
  1093. Ext.getCmp('fm_patrol_start_time').setValue(selected[0].raw.start_inspect_time);
  1094. Ext.getCmp('fm_patrol_end_time').setValue(selected[0].raw.end_inspect_time);
  1095. Ext.getCmp('fm_patrol_start_date').setValue(selected[0].raw.start_date);
  1096. Ext.getCmp('fm_patrol_end_date').setValue(selected[0].raw.end_date);
  1097. Ext.getCmp('fm_patrol_end_date').setMinValue(selected[0].raw.end_date);
  1098. Ext.getCmp('fm_patrol_company_code').setValue(selected[0].raw.company_code);
  1099. var b = selected[0].raw.id;
  1100. // Ext.get('fm_id').set({ value: b });
  1101. Ext.getCmp('fm_patrol_id').setValue(b);
  1102. } else {
  1103. Ext.Msg.alert('请先选择', '请先选择一条记录,再点击修改');
  1104. }
  1105. }
  1106. var maintenancedevice = function () {
  1107. var maintenance_look_device = document.getElementById('patrolplan_look_device');
  1108. var img = document.createElement('img');
  1109. img.width = 400;
  1110. img.height = 400;
  1111. img.src = baseUrl + ConfirmStore[0].picture_route;
  1112. img.setAttribute('class', 'maintenance_look_device_img');
  1113. maintenance_look_device.appendChild(img);
  1114. var div4 = document.createElement('div');
  1115. div4.style.textAlign = 'center';
  1116. div4.innerHTML = ConfirmStore[0].remarks;
  1117. maintenance_look_device.appendChild(div4);
  1118. }
  1119. var editMaintenance = function (spot_id) {
  1120. var spot_id = spot_id;
  1121. Ext.create('Ext.window.Window', {
  1122. id: 'patrolplan_data_win1',
  1123. height: 500,
  1124. width: 400,
  1125. layout: 'fit',
  1126. modal: true,
  1127. buttons: [
  1128. {
  1129. text: '关闭',
  1130. handler: function () {
  1131. Ext.getCmp('patrolplan_data_win1').destroy();
  1132. }
  1133. }
  1134. ],
  1135. closeAction: 'destroy',
  1136. html: '<div id="patrolplan_look_device"></div>'
  1137. }).show();
  1138. var query = new Object();
  1139. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1140. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1141. query.id = spot_id;
  1142. $.ajax({
  1143. type: 'POST',
  1144. url: baseUrl + "iot/inspectionpoints/getList",
  1145. data: {
  1146. queryJson: Ext.JSON.encode(query)
  1147. },
  1148. success: function (result) {
  1149. var json = eval('(' + result + ')');
  1150. if (json.action == 'getInspectionPointsList') {
  1151. ConfirmStore = json.RESULT;
  1152. maintenancedevice(ConfirmStore);
  1153. }
  1154. }
  1155. });
  1156. }
  1157. var MaintenancePlanPanel1 = Ext.create('Ext.grid.Panel', {
  1158. header: {
  1159. height: 0,
  1160. border: '0px solid #000000'
  1161. },
  1162. id: 'PatrolPlanListPanel1',
  1163. store: myStore1,
  1164. selModel: sm1,
  1165. columns: [
  1166. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1167. { header: '序号', dataIndex: 'xh', hidden: true, menuDisabled: true },
  1168. { header: '点位名称', dataIndex: 'spot_name', width: 260, align: 'center', menuDisabled: true },
  1169. { header: '点位地址', dataIndex: 'spot_address', width: 260, align: 'center', menuDisabled: true },
  1170. // { header: '巡检日期', dataIndex: 'planned_date', width:236,align:'center', menuDisabled:true },
  1171. {
  1172. text: '点位详情',
  1173. xtype: 'actioncolumn',
  1174. width: 236,
  1175. sortable: false,
  1176. align: 'center',
  1177. menuDisabled: true,
  1178. items: [{
  1179. icon: '../../res/img/common/tupianbtn.png',
  1180. tooltip: '点位详情',
  1181. handler: function (grid, rowIndex, colIndex) {
  1182. var rec = grid.getStore().getAt(rowIndex);
  1183. editMaintenance(rec.get("id"));
  1184. }
  1185. }]
  1186. }
  1187. ],
  1188. columnLines: true,
  1189. height: 300,
  1190. width: 780,
  1191. bbar: new Ext.PagingToolbar({
  1192. store: myStore1,
  1193. id: 'PatrolPlanListPageToolbar1',
  1194. displayInfo: true,
  1195. pageSize: 5,
  1196. prependButtons: true,
  1197. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1198. emptyMsg: "没有记录",
  1199. firstText: '第一页',
  1200. prevText: '前一页',
  1201. nextText: '后一页',
  1202. lastText: '最后一页',
  1203. refreshText: '刷新',
  1204. }),
  1205. // frame: true,
  1206. border: false,
  1207. iconCls: 'icon-grid'
  1208. // renderTo: Ext.getBody()
  1209. });
  1210. var MaintenancePlanPanel = Ext.create('Ext.grid.Panel', {
  1211. header: {
  1212. height: 0,
  1213. border: '0px solid #000000'
  1214. },
  1215. id: 'PatrolPlanListPanel',
  1216. store: myStore,
  1217. selModel: sm,
  1218. columns: [
  1219. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1220. { header: '团队ID', dataIndex: 'team_id', hidden: true, menuDisabled: true },
  1221. { header: '周期值', dataIndex: 'cycle', hidden: true, menuDisabled: true },
  1222. { header: '建筑编号', dataIndex: 'company_code', hidden: true, menuDisabled: true },
  1223. { header: '开始日期', dataIndex: 'start_date', hidden: true, menuDisabled: true },
  1224. { header: '结束日期', dataIndex: 'end_date', hidden: true, menuDisabled: true },
  1225. { header: '开始时间', dataIndex: 'start_inspect_time', hidden: true, menuDisabled: true },
  1226. { header: '结束时间', dataIndex: 'end_inspect_time', hidden: true, menuDisabled: true },
  1227. { header: '序号', dataIndex: 'xh', width: 77, menuDisabled: true },
  1228. { header: '任务名称', dataIndex: 'plan_name', width: 250, align: 'center', menuDisabled: true },
  1229. { header: '周期', dataIndex: 'cycle_name', width: 300, align: 'center', menuDisabled: true },
  1230. { header: '执行日期', dataIndex: 'zxsj', width: 250, align: 'center', menuDisabled: true },
  1231. { header: '执行团队', dataIndex: 'team_name', width: 280, align: 'center', menuDisabled: true },
  1232. { header: '责任人', dataIndex: 'name', width: 280, align: 'center', menuDisabled: true },
  1233. ],
  1234. columnLines: true,
  1235. height: maxHeight,
  1236. width: '100%',
  1237. bbar: new Ext.PagingToolbar({
  1238. store: myStore,
  1239. id: 'PatrolPlanListPageToolbar',
  1240. displayInfo: true,
  1241. pageSize: countPerPage,
  1242. prependButtons: true,
  1243. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1244. emptyMsg: "没有记录",
  1245. firstText: '第一页',
  1246. prevText: '前一页',
  1247. nextText: '后一页',
  1248. lastText: '最后一页',
  1249. refreshText: '刷新',
  1250. }),
  1251. // frame: true,
  1252. border: false,
  1253. iconCls: 'icon-grid'
  1254. // renderTo: Ext.getBody()
  1255. });
  1256. var piebar = Ext.create('Ext.panel.Panel', {
  1257. id: 'patrolPlanHtml',
  1258. width: '100%',
  1259. height: 188,
  1260. region: 'north',
  1261. layout: 'form',
  1262. defaults: {
  1263. border: false
  1264. }
  1265. // items: [childPanel1]
  1266. });
  1267. var PatrolPlanTab = Ext.create('Ext.tab.Panel', {
  1268. id: 'PatrolPlanTab',
  1269. activeTab: 0,
  1270. items: [
  1271. {
  1272. title: '巡检点位',
  1273. items: [MaintenancePlanPanel1]
  1274. }
  1275. ]
  1276. });
  1277. new Ext.create('Ext.panel.Panel', {
  1278. width: '100%',
  1279. id: 'PatrolPlanPiebar',
  1280. layout: 'border',
  1281. items: [
  1282. piebar, MaintenancePlanPanel
  1283. ],
  1284. renderTo: Ext.getBody()
  1285. });
  1286. myStore.reload();
  1287. myStore.addListener('load', function (store, record, opts) {
  1288. piedarHtml_fun();
  1289. });
  1290. $(window).resize(function () {
  1291. body_resize();
  1292. });
  1293. body_resize();
  1294. });