patrolpoint.js 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949
  1. /**
  2. * patrolpoint.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 company_code;
  18. var myStore = null;
  19. var myStore1 = null;
  20. var V_LOGINNAME = '', V_PASSWORD = '';
  21. var menuidx = '';
  22. var mouseon;
  23. var mouseoff;
  24. var menu_click;
  25. var baseUrl = '';
  26. var modifywin1;
  27. var MaintenanceCheckPanel1;
  28. //var MaintenanceCheckPanel2;
  29. var AllSelectedRecords = [];
  30. var AllSelectedRecords1 = [];
  31. var sm1;
  32. var sm2;
  33. var initflag = false;
  34. var initflag1 = false;
  35. var sm = Ext.create('Ext.selection.CheckboxModel');
  36. Ext.define('Maintenance', {
  37. extend: 'Ext.data.Model',
  38. fields: [
  39. { name: 'id', type: 'string' },
  40. { name: 'xh', type: 'int' },
  41. { name: 'spot_name', type: 'string' },
  42. { name: 'company_code', type: 'string' },
  43. { name: 'spot_address', type: 'string' },
  44. { name: 'spot_type', type: 'string' },
  45. { name: 'type_name', type: 'string' },
  46. { name: 'latest_change_time', type: 'string' },
  47. { name: 'building_name', type: 'string' },
  48. { name: 'equipment_code', type: 'string' },
  49. { name: 'remarks', type: 'string' },
  50. { name: 'picture_route', type: 'string' },
  51. ]
  52. });
  53. Ext.define('CheckRecord3', {
  54. extend: 'Ext.data.Model',
  55. fields: [
  56. { name: 'id', type: 'string' },
  57. { name: 'spot_id', type: 'string' },
  58. { name: 'xh', type: 'int' },
  59. { name: 'equipment_code', type: 'string' },
  60. { name: 'device_name', type: 'string' },
  61. { name: 'unitinfo', type: 'string' },
  62. ]
  63. });
  64. Ext.define('patrolpoint1', {
  65. extend: 'Ext.data.Model',
  66. fields: [
  67. { name: 'device_id', type: 'string' },
  68. { name: 'device_name', type: 'string' },
  69. { name: 'xh', type: 'int' },
  70. { name: 'unitinfo', type: 'string' },
  71. ]
  72. });
  73. Ext.define('patrolpoint2', {
  74. extend: 'Ext.data.Model',
  75. fields: [
  76. { name: 'device_id', type: 'string' },
  77. { name: 'device_name', type: 'string' },
  78. { name: 'xh', type: 'int' },
  79. { name: 'unitinfo', type: 'string' },
  80. { name: 'pd', type: 'string' },
  81. ]
  82. });
  83. function checkfilename() {
  84. var subwin = window.frames['file_uploader'].contentWindow;
  85. subwin.setpic();
  86. // add_pic();
  87. }
  88. function checkfilename2() {
  89. var subwin = window.frames['file_uploader2'].contentWindow;
  90. subwin.setpic2();
  91. // add_pic();
  92. }
  93. var add_pic = function () {
  94. Ext.create('Ext.window.Window', {
  95. id: 'patrol_point_pic_win',
  96. title: '图片上传',
  97. height: 200,
  98. width: 300,
  99. layout: 'fit',
  100. modal: true,
  101. buttons: [
  102. {
  103. text: '上传',
  104. handler: function () {
  105. var subwin = window.frames['file_uploader'].contentWindow;
  106. subwin.uploadpic();
  107. Ext.getCmp('patrol_point_pic_win').destroy();
  108. }
  109. }
  110. ,
  111. {
  112. text: '关闭',
  113. handler: function () {
  114. Ext.getCmp('patrol_point_pic_win').destroy();
  115. }
  116. }
  117. ],
  118. closeAction: 'destroy',
  119. html: '<div style="padding:20px;">点击上传按钮提交图片文件</div>'
  120. }).show();
  121. }
  122. function exportbtn_click() {
  123. baseUrl = document.getElementById('basePath').value;
  124. V_LOGINNAME = $("#V_LOGINNAME").val();
  125. V_PASSWORD = $("#V_PASSWORD").val();
  126. spot_name = document.getElementById('spot_name').value;
  127. spot_address = document.getElementById('spot_address').value;
  128. var fields = '';
  129. var array = ['id', 'spot_name', 'building_name', 'spot_address', 'type_name', 'spot_label_analysis', 'remarks', 'latest_change_time'];
  130. var excelname = ['编号', '点位名称', '所属建筑/项目', '点位地址', '设备类型', '点位标签', '点位备注', '最新改动时间'];
  131. for (var i = 0; i < 8; i++) {
  132. if (i > 0)
  133. fields += ',';
  134. fields += '{id:"' + array[i] + '",title:"' + excelname[i] + '",shown:"' + true + '"}';
  135. }
  136. var query = new Object();
  137. query.V_LOGINNAME = V_LOGINNAME;
  138. // query.V_PASSWORD = V_PASSWORD;
  139. query.spot_name = spot_name;
  140. query.spot_address = spot_address;
  141. query.EXPORT_FILE = '巡检点位列表';
  142. query.fields = '[' + fields + ']';
  143. $.ajax({
  144. type: 'POST',
  145. url: baseUrl + "iot/excel/view/XjInspectionPointsExcel1",
  146. data: {
  147. queryJson: Ext.JSON.encode(query)
  148. },
  149. success: function (result) {
  150. var json = eval('(' + result + ')');
  151. if (json.action == 'dormExport') {
  152. ConfirmStore = json.RESULT;
  153. var elemIF = document.createElement("iframe");
  154. elemIF.src = baseUrl + json.filename;
  155. elemIF.style.display = "none";
  156. document.body.appendChild(elemIF);
  157. }
  158. }
  159. });
  160. }
  161. var file_result = function (text) {
  162. Ext.MessageBox.alert('错误信息', text);
  163. var hiddenFrame = document.getElementById('hiddenFrame');
  164. hiddenFrame.innerHTML = '<iframe id="file_uploader" width="0" height="0" frameborder="0" src="test.jsp"></iframe>';
  165. }
  166. var file_result2 = function (text) {
  167. Ext.MessageBox.alert('错误信息', text);
  168. var hiddenFrame2 = document.getElementById('hiddenFrame2');
  169. hiddenFrame2.innerHTML = '<iframe id="file_uploader2" width="0" height="0" frameborder="0" src="test2.jsp"></iframe>';
  170. }
  171. var get_file = function (name) {
  172. // alert("got file: '"+name+"'");
  173. Ext.MessageBox.alert('操作信息', '文件上传成功');
  174. document.getElementById('patrol_add_picture').setAttribute('src', baseUrl + name);
  175. Ext.getCmp('patrol_point_addURL').setValue(name);
  176. var hiddenFrame = document.getElementById('hiddenFrame');
  177. hiddenFrame.innerHTML = '<iframe id="file_uploader" width="0" height="0" frameborder="0" src="test.jsp"></iframe>';
  178. }
  179. var get_file2 = function (name) {
  180. // alert("got file: '"+name+"'");
  181. Ext.MessageBox.alert('操作信息', '文件上传成功');
  182. document.getElementById('patrol_upload_picture').setAttribute('src', baseUrl + name);
  183. Ext.getCmp('patrol_point_uploadURL').setValue(name);
  184. var hiddenFrame2 = document.getElementById('hiddenFrame2');
  185. hiddenFrame2.innerHTML = '<iframe id="file_uploader2" width="0" height="0" frameborder="0" src="test2.jsp"></iframe>';
  186. }
  187. var body_resize = function () {
  188. maxHeight = document.documentElement.clientHeight;
  189. maxWidth = document.documentElement.clientWidth;
  190. Ext.getCmp('PatrolpointPiebar').setHeight(maxHeight);
  191. Ext.getCmp('PatrolpointPiebar').setWidth(maxWidth);
  192. }
  193. Ext.onReady(function () {
  194. baseUrl = document.getElementById('basePath').value;
  195. var theme = document.getElementById('theme').value;
  196. var chkIcon = '<img src="' + baseUrl + 'res/img/common/check.gif"/>'
  197. var unchkIcon = '<img src="' + baseUrl + 'res/img/common/uncheck.gif"/>'
  198. // company_code = document.getElementById('company_code').value;
  199. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  200. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  201. V_LOGINNAME = $("#V_LOGINNAME").val();
  202. V_PASSWORD = $("#V_PASSWORD").val();
  203. var countPerPage = 15;
  204. var maxHeight = 10000;
  205. var chkBoolean = function (flag) {
  206. if (flag)
  207. return chkIcon;
  208. return unchkIcon;
  209. }
  210. var queryJson = new Object();
  211. queryJson.V_LOGINNAME = V_LOGINNAME;
  212. // queryJson.V_PASSWORD = V_PASSWORD;
  213. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  214. queryJson.company_code = company_code;
  215. Ext.define('QrcodeAnalysis2', {
  216. extend: 'Ext.data.Model',
  217. fields: [
  218. { name: 'building_name', type: 'string' },
  219. { name: 'building_id', type: 'string' }
  220. ]
  221. });
  222. var getManufacturerId2 = Ext.create('Ext.data.Store', {
  223. model: 'QrcodeAnalysis2',
  224. proxy: {
  225. type: 'ajax',
  226. actionMethods: {
  227. create: 'POST',
  228. read: 'POST', // by default GET
  229. update: 'POST',
  230. destroy: 'POST'
  231. },
  232. url: baseUrl + 'iot/company/view/getBuildingNameList',
  233. reader: {
  234. type: 'json',
  235. root: 'RESULT',
  236. totalProperty: 'totalCount'
  237. },
  238. extraParams: {
  239. queryJson: Ext.JSON.encode(queryJson)
  240. }
  241. }
  242. });
  243. var clear_append_form = function () {
  244. Ext.getCmp('fa_patrol_spot_name').setValue("");
  245. Ext.getCmp('fa_patrol_company_code').setValue("");
  246. Ext.getCmp('fa_patrol_spot_address').setValue("");
  247. // Ext.getCmp('fa_patrol_equipment_code').setValue("");
  248. Ext.getCmp('fa_patrol_spot_type').setValue(false);
  249. Ext.getCmp('fa_patrol_point_message').setValue("");
  250. // Ext.getCmp('fa_id').setValue("");
  251. Ext.getCmp('PatrolpointListPageToolbar').moveFirst();
  252. }
  253. var deselect_fun = function (record) {
  254. var index = AllSelectedRecords.indexOf(record.get("device_id"));
  255. if (index > -1) {
  256. AllSelectedRecords.splice(index, 1);
  257. return AllSelectedRecords;
  258. }
  259. }
  260. sm1 = Ext.create('Ext.selection.CheckboxModel', {
  261. mode: "MULTI",
  262. listeners: {
  263. deselect: function (me, record, index, opts) {
  264. if (initflag) {
  265. // alert("初始化");
  266. } else {
  267. deselect_fun(record);
  268. }
  269. },
  270. select: function (me, record, index, opts) {
  271. var index = AllSelectedRecords.indexOf(record.get("device_id"));
  272. if (index > -1) {
  273. return AllSelectedRecords;
  274. } else {
  275. AllSelectedRecords.push(record.get("device_id"));
  276. return AllSelectedRecords;
  277. }
  278. }
  279. }
  280. });
  281. var deselect_fun1 = function (record) {
  282. var index = AllSelectedRecords1.indexOf(record.get("device_id"));
  283. if (index > -1) {
  284. AllSelectedRecords1.splice(index, 1);
  285. return AllSelectedRecords1;
  286. }
  287. }
  288. sm2 = Ext.create('Ext.selection.CheckboxModel', {
  289. mode: "MULTI",
  290. listeners: {
  291. deselect: function (me, record, index, opts) {
  292. if (initflag1) {
  293. } else {
  294. deselect_fun1(record);
  295. }
  296. },
  297. select: function (me, record, index, opts) {
  298. var index = AllSelectedRecords1.indexOf(record.get("device_id"));
  299. if (index > -1) {
  300. return AllSelectedRecords1;
  301. } else {
  302. AllSelectedRecords1.push(record.get("device_id"));
  303. return AllSelectedRecords1;
  304. }
  305. }
  306. }
  307. });
  308. myStore = Ext.create('Ext.data.Store', {
  309. model: 'Maintenance',
  310. pageSize: countPerPage,
  311. proxy: {
  312. type: 'ajax',
  313. actionMethods: {
  314. create: 'POST',
  315. read: 'POST', // by default GET
  316. update: 'POST',
  317. destroy: 'POST'
  318. },
  319. url: baseUrl + 'iot/inspectionpoints/getList1',
  320. reader: {
  321. type: 'json',
  322. root: 'RESULT',
  323. totalProperty: 'totalCount'
  324. },
  325. extraParams: {
  326. queryJson: Ext.JSON.encode(queryJson)
  327. }
  328. },
  329. // sorters:[{
  330. // property:'data_time',
  331. // direction:'DESC'
  332. // }],
  333. remoteSort: true
  334. });
  335. myStore1 = Ext.create('Ext.data.Store', {
  336. model: 'CheckRecord3',
  337. pageSize: 10,
  338. proxy: {
  339. type: 'ajax',
  340. url: baseUrl + 'iot/inspectionpoints/getXzsbList',
  341. reader: {
  342. type: 'json',
  343. root: 'RESULT',
  344. totalProperty: 'totalCount'
  345. },
  346. extraParams: {
  347. queryJson: Ext.JSON.encode(queryJson)
  348. }
  349. },
  350. remoteSort: true
  351. });
  352. var myStore2 = Ext.create('Ext.data.Store', {
  353. model: 'patrolpoint1',
  354. pageSize: 5,
  355. listeners: {
  356. beforeload: function (me, store, operation, eOpts) {
  357. initflag = true;
  358. },
  359. load: function (me, records, success, opts) {
  360. if (!success || !records || records.length == 0)
  361. return;
  362. //根据全局的选择,初始化选中的列
  363. var selModel = Ext.getCmp('PatrolCheckListPanel2').getSelectionModel();
  364. Ext.Array.forEach(AllSelectedRecords, function (item) {
  365. for (var i = 0; i < records.length; i++) {
  366. var record = records[i];
  367. if (record.get("device_id") == item) {
  368. selModel.select(record, true, true); //选中record,并且保持现有的选择,不触发选中事件
  369. }
  370. }
  371. });
  372. // sm1.addListener('deselect',deselect_fun);
  373. initflag = false;
  374. }
  375. },
  376. proxy: {
  377. type: 'ajax',
  378. url: baseUrl + 'iot/inspectionpoints/getSbList',
  379. reader: {
  380. type: 'json',
  381. root: 'RESULT',
  382. totalProperty: 'totalCount'
  383. },
  384. extraParams: {
  385. queryJson: Ext.JSON.encode(queryJson)
  386. }
  387. },
  388. remoteSort: true
  389. });
  390. myStore2.on('load', function (myStore2, record) {
  391. for (var i = 0; i < record.length; i++) {
  392. var records = record[i];
  393. if (records.get('pd') == 1) {
  394. Ext.getCmp('PatrolCheckListPanel2').getSelectionModel().select(records, true);
  395. }
  396. };
  397. });
  398. var myStore3 = Ext.create('Ext.data.Store', {
  399. model: 'patrolpoint2',
  400. pageSize: 5,
  401. listeners: {
  402. beforeload: function (me, store, operation, eOpts) {
  403. initflag1 = true;
  404. },
  405. load: function (me, records, success, opts) {
  406. if (!success || !records || records.length == 0)
  407. return;
  408. //根据全局的选择,初始化选中的列
  409. var selModel = Ext.getCmp('PatrolCheckListPanel3').getSelectionModel();
  410. Ext.Array.forEach(AllSelectedRecords1, function (item) {
  411. for (var i = 0; i < records.length; i++) {
  412. var record = records[i];
  413. if (record.get("device_id") == item && record.get('pd') != 1) {
  414. selModel.select(record, true, true); //选中record,并且保持现有的选择,不触发选中事件
  415. }
  416. }
  417. });
  418. initflag1 = false;
  419. }
  420. },
  421. proxy: {
  422. type: 'ajax',
  423. url: baseUrl + 'iot/inspectionpoints/getSbList',
  424. reader: {
  425. type: 'json',
  426. root: 'RESULT',
  427. totalProperty: 'totalCount'
  428. },
  429. extraParams: {
  430. queryJson: Ext.JSON.encode(queryJson)
  431. }
  432. },
  433. remoteSort: true
  434. });
  435. myStore3.on('load', function (myStore3, record) {
  436. for (var i = 0; i < record.length; i++) {
  437. var records = record[i];
  438. var len = AllSelectedRecords1.length;
  439. for (var j = 0; j < len; j++) {
  440. if (AllSelectedRecords1[j] == records.get('device_id')) {
  441. Ext.getCmp('PatrolCheckListPanel3').getSelectionModel().select(records, true);
  442. }
  443. }
  444. };
  445. });
  446. var clear_modify_form = function () {
  447. Ext.getCmp('fm_patrol_spot_name').setValue("");
  448. Ext.getCmp('fm_patrol_company_code').setValue("");
  449. Ext.getCmp('fm_patrol_spot_address').setValue("");
  450. Ext.getCmp('fm_patrol_spot_type').setValue(false);
  451. Ext.getCmp('fm_patrol_point_message').setValue("");
  452. Ext.getCmp('fm_patrol_point_id').setValue("");
  453. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  454. }
  455. var patrolUploadForm = Ext.create('Ext.form.Panel', {
  456. id: 'patrolUploadForm',
  457. labelWidth: 55,
  458. url: baseUrl + 'iot/inspectionpoints/update1',
  459. bodyPadding: 15,
  460. frame: true,
  461. labelAlign: 'left',
  462. region: 'north',
  463. enableDrop: true,
  464. ddGroup: 'treeID',
  465. height: 200,
  466. items: [{
  467. autoHeight: true,
  468. layout: 'column',
  469. border: false,
  470. items: [{
  471. columnWidth: .45,
  472. xtype: 'fieldset',
  473. layout: 'form',
  474. // defaults: {anchor: '95%'},
  475. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  476. items: [
  477. {
  478. xtype: 'textfield',
  479. fieldLabel: '点位名称',
  480. id: 'fm_patrol_spot_name',
  481. name: 'spot_name',
  482. maxLength: 20,
  483. maxLengthText: '长度不得超出{0}',
  484. anchor: '50%'
  485. }, {
  486. fieldLabel: '所属建筑/项目',
  487. id: 'fm_patrol_company_code',
  488. name: 'company_code',
  489. xtype: 'combo',
  490. store: getManufacturerId2,
  491. displayField: 'building_name',
  492. valueField: 'building_id',
  493. editable: false,
  494. anchor: '50%'
  495. }, {
  496. xtype: 'textfield',
  497. fieldLabel: '点位地址',
  498. id: 'fm_patrol_spot_address',
  499. name: 'spot_address',
  500. maxLength: 30,
  501. maxLengthText: '长度不得超出{0}',
  502. anchor: '50%'
  503. }]
  504. }, {
  505. columnWidth: .55,
  506. xtype: 'fieldset',
  507. layout: 'form',
  508. // defaults: {anchor: '95%'},
  509. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  510. items: [
  511. {
  512. xtype: 'textareafield',
  513. grow: true,
  514. height: 60,
  515. id: 'fm_patrol_point_message',
  516. name: 'message',
  517. fieldLabel: '备注',
  518. anchor: '50%'
  519. }, {
  520. xtype: 'checkboxgroup',
  521. fieldLabel: '设备类型',
  522. // defaultType:'radiofield',
  523. columns: 3,
  524. id: "fm_patrol_spot_type",
  525. // defaults:{
  526. // flex:1
  527. // },
  528. // layout:'hbox',
  529. items: [
  530. { boxLabel: '水系统', name: 'fm_patrol_water_type', inputValue: "1", id: 'radio81' },
  531. { boxLabel: '火系统', name: 'fm_patrol_fire_type', inputValue: "2", id: 'radio82' },
  532. { boxLabel: '电气火灾', name: 'fm_patrol_efire_type', inputValue: "3", id: 'radio83' },
  533. { boxLabel: '气体灭火', name: 'fm_patrol_extinguishing_type', inputValue: "4", id: 'radio84' },
  534. { boxLabel: 'RTU', name: 'fm_patrol_rtu_type', inputValue: "5", id: 'radio85' },
  535. { boxLabel: '视频监控', name: 'fm_patrol_view_type', inputValue: "6", id: 'radio86' },
  536. { boxLabel: '其他', name: 'fm_patrol_other_type', inputValue: "7", id: 'radio87' },
  537. ]
  538. }, {
  539. xtype: 'textfield',
  540. id: 'fm_patrol_point_queryJson',
  541. name: 'queryJson',
  542. hidden: true
  543. }, {
  544. xtype: 'textfield',
  545. name: 'uploadURL',
  546. id: 'patrol_point_uploadURL',
  547. hidden: true
  548. }, {
  549. xtype: 'textfield',
  550. id: 'fm_patrol_point_id',
  551. name: 'id',
  552. hidden: true
  553. }
  554. ]
  555. }
  556. ]
  557. }]
  558. });
  559. var patroladdForm = Ext.create('Ext.form.Panel', {
  560. id: 'patroladdForm',
  561. labelWidth: 55,
  562. url: baseUrl + 'iot/inspectionpoints/append1',
  563. bodyPadding: 15,
  564. frame: true,
  565. labelAlign: 'left',
  566. region: 'north',
  567. enableDrop: true,
  568. ddGroup: 'treeID',
  569. height: 200,
  570. items: [{
  571. autoHeight: true,
  572. layout: 'column',
  573. border: false,
  574. items: [{
  575. columnWidth: .45,
  576. xtype: 'fieldset',
  577. layout: 'form',
  578. // defaults: {anchor: '95%'},
  579. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  580. items: [
  581. {
  582. xtype: 'textfield',
  583. fieldLabel: '点位名称',
  584. id: 'fa_patrol_spot_name',
  585. name: 'spot_name',
  586. maxLength: 20,
  587. maxLengthText: '长度不得超出{0}',
  588. anchor: '50%',
  589. listeners: {
  590. change: function (o, e) {
  591. if (e.length > 20) {
  592. Ext.getCmp('fa_patrol_spot_name').setValue(e.substring(0, 20));
  593. }
  594. }
  595. }
  596. }, {
  597. fieldLabel: '所属建筑/项目',
  598. id: 'fa_patrol_company_code',
  599. name: 'company_code',
  600. xtype: 'combo',
  601. store: getManufacturerId2,
  602. displayField: 'building_name',
  603. valueField: 'building_id',
  604. editable: false,
  605. anchor: '50%',
  606. listeners: {
  607. select: function (combo, record, index) {
  608. try {
  609. var label = this.value;
  610. var query = new Object();
  611. query.building_id = label;
  612. query.V_LOGINNAME = V_LOGINNAME;
  613. // query.V_PASSWORD = V_PASSWORD;
  614. var jsonstr = Ext.JSON.encode(query);
  615. myStore2.getProxy().extraParams = {
  616. queryJson: jsonstr
  617. };
  618. Ext.getCmp('PatrolCheckListPageToolbar2').moveFirst();
  619. }
  620. catch (ex) {
  621. Ext.MessageBox.alert("错误", "数据加载失败。");
  622. }
  623. }
  624. }
  625. }, {
  626. xtype: 'textfield',
  627. fieldLabel: '点位地址',
  628. id: 'fa_patrol_spot_address',
  629. name: 'spot_address',
  630. maxLength: 30,
  631. maxLengthText: '长度不得超出{0}',
  632. anchor: '50%',
  633. listeners: {
  634. change: function (o, e) {
  635. if (e.length > 30) {
  636. Ext.getCmp('fa_patrol_spot_address').setValue(e.substring(0, 30));
  637. }
  638. }
  639. }
  640. }]
  641. }, {
  642. columnWidth: .55,
  643. xtype: 'fieldset',
  644. layout: 'form',
  645. // defaults: {anchor: '95%'},
  646. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  647. items: [
  648. {
  649. xtype: 'textareafield',
  650. grow: true,
  651. height: 60,
  652. id: 'fa_patrol_point_message',
  653. name: 'message',
  654. fieldLabel: '备注',
  655. anchor: '50%'
  656. }, {
  657. xtype: 'checkboxgroup',
  658. fieldLabel: '设备类型',
  659. // defaultType:'radiofield',
  660. columns: 3,
  661. id: "fa_patrol_spot_type",
  662. // defaults:{
  663. // flex:1
  664. // },
  665. // layout:'hbox',
  666. items: [
  667. { boxLabel: '水系统', name: 'fa_patrol_water_type', inputValue: "1", id: 'radio88' },
  668. { boxLabel: '火系统', name: 'fa_patrol_fire_type', inputValue: "2", id: 'radio89' },
  669. { boxLabel: '电气火灾', name: 'fa_patrol_efire_type', inputValue: "3", id: 'radio90' },
  670. { boxLabel: '气体灭火', name: 'fa_patrol_extinguishing_type', inputValue: "4", id: 'radio91' },
  671. { boxLabel: 'RTU', name: 'fa_patrol_rtu_type', inputValue: "5", id: 'radio92' },
  672. { boxLabel: '视频监控', name: 'fa_patrol_view_type', inputValue: "6", id: 'radio93' },
  673. { boxLabel: '其他', name: 'fa_patrol_other_type', inputValue: "7", id: 'radio94' },
  674. ]
  675. }, {
  676. xtype: 'textfield',
  677. id: 'fa_patrol_point_queryJson',
  678. name: 'queryJson',
  679. hidden: true
  680. }, {
  681. xtype: 'textfield',
  682. name: 'addURL',
  683. id: 'patrol_point_addURL',
  684. hidden: true
  685. }
  686. ]
  687. }
  688. ]
  689. }]
  690. });
  691. var upload_pic = function () {
  692. Ext.create('Ext.window.Window', {
  693. id: 'patrol_point_pic_win1',
  694. title: '图片上传',
  695. height: 200,
  696. width: 300,
  697. layout: 'fit',
  698. modal: true,
  699. buttons: [
  700. {
  701. text: '关闭',
  702. handler: function () {
  703. Ext.getCmp('patrol_point_pic_win1').destroy();
  704. }
  705. }
  706. ],
  707. closeAction: 'destroy',
  708. html: '<iframe src="test2.jsp" width=300 height=200 frameborder="no"></iframe>'
  709. }).show();
  710. }
  711. var patroladUploadForm = Ext.create('Ext.form.Panel', {
  712. id: 'patroladUploadForm',
  713. layout: 'form',
  714. // title:'设备图片:',
  715. items: [{
  716. layout: 'hbox',
  717. items: [{
  718. xtype: 'box',//或者xtype: 'component',
  719. title: '点位图片',
  720. id: 'patrol_upload_picture',
  721. width: 110,//图片宽度
  722. height: 110,//图片高度
  723. margin: '0 0 30 150',
  724. autoEl: {
  725. tag: 'img',//指定为img标签
  726. src: '../../res/img/common/shangchaun.png',
  727. style: 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:110px;height:110px;text-align:center;'
  728. },
  729. listeners: {
  730. render: function () {
  731. Ext.fly(this.el).on("click", function () {
  732. //                                upload_pic();
  733. checkfilename2();
  734. });
  735. }
  736. }
  737. }
  738. ]
  739. }]
  740. });
  741. var patroladaddForm = Ext.create('Ext.form.Panel', {
  742. id: 'patroladaddForm',
  743. layout: 'form',
  744. // title:'设备图片:',
  745. items: [{
  746. layout: 'hbox',
  747. items: [{
  748. xtype: 'box',//或者xtype: 'component',
  749. title: '点位图片',
  750. id: 'patrol_add_picture',
  751. width: 110,//图片宽度
  752. height: 110,//图片高度
  753. margin: '0 0 30 150',
  754. autoEl: {
  755. tag: 'img',//指定为img标签
  756. src: '../../res/img/common/shangchaun.png',
  757. style: 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);width:110px;height:110px;text-align:center;'
  758. },
  759. listeners: {
  760. render: function () {
  761. Ext.fly(this.el).on("click", function () {
  762. //                                add_pic();
  763. checkfilename();
  764. });
  765. }
  766. }
  767. }
  768. ]
  769. }]
  770. });
  771. var MaintenanceCheckPanel2 = Ext.create('Ext.grid.Panel', {
  772. header: {
  773. height: 0,
  774. border: '0px solid #000000'
  775. },
  776. id: 'PatrolCheckListPanel2',
  777. store: myStore2,
  778. selModel: sm1,
  779. columns: [
  780. { header: '设备编号', dataIndex: 'device_id', hidden: true, menuDisabled: true },
  781. { header: '序号', dataIndex: 'xh', width: 58, align: 'center', menuDisabled: true },
  782. { header: '设备名称', dataIndex: 'device_name', width: 247, align: 'center', menuDisabled: true },
  783. { header: '设备地址', dataIndex: 'unitinfo', width: 246, align: 'center', menuDisabled: true },
  784. {
  785. text: '设备详情',
  786. xtype: 'actioncolumn',
  787. width: 210,
  788. sortable: false,
  789. align: 'center',
  790. menuDisabled: true,
  791. items: [{
  792. icon: '../../res/img/common/tupianbtn.png',
  793. tooltip: '设备详情',
  794. handler: function (grid, rowIndex, colIndex) {
  795. var rec = grid.getStore().getAt(rowIndex);
  796. // alert(rec.get("dwid"));
  797. editMaintenance(rec.get("dwid"));
  798. }
  799. }]
  800. }
  801. ],
  802. columnLines: true,
  803. height: 195,
  804. width: 785,
  805. bbar: new Ext.PagingToolbar({
  806. store: myStore2,
  807. id: 'PatrolCheckListPageToolbar2',
  808. displayInfo: true,
  809. pageSize: 5,
  810. prependButtons: true,
  811. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  812. emptyMsg: "没有记录",
  813. firstText: '第一页',
  814. prevText: '前一页',
  815. nextText: '后一页',
  816. lastText: '最后一页',
  817. refreshText: '刷新',
  818. }),
  819. // frame: true,
  820. border: false,
  821. iconCls: 'icon-grid'
  822. });
  823. var MaintenanceCheckPanel3 = Ext.create('Ext.grid.Panel', {
  824. header: {
  825. height: 0,
  826. border: '0px solid #000000'
  827. },
  828. id: 'PatrolCheckListPanel3',
  829. store: myStore3,
  830. selModel: sm2,
  831. columns: [
  832. { header: '判断', dataIndex: 'pd', hidden: true, menuDisabled: true },
  833. { header: '设备编号', dataIndex: 'device_id', hidden: true, menuDisabled: true },
  834. { header: '序号', dataIndex: 'xh', width: 58, align: 'center', menuDisabled: true },
  835. { header: '设备名称', dataIndex: 'device_name', width: 247, align: 'center', menuDisabled: true },
  836. { header: '设备地址', dataIndex: 'unitinfo', width: 246, align: 'center', menuDisabled: true },
  837. {
  838. text: '设备详情',
  839. xtype: 'actioncolumn',
  840. width: 210,
  841. sortable: false,
  842. align: 'center',
  843. menuDisabled: true,
  844. items: [{
  845. icon: '../../res/img/common/tupianbtn.png',
  846. tooltip: '设备详情',
  847. handler: function (grid, rowIndex, colIndex) {
  848. var rec = grid.getStore().getAt(rowIndex);
  849. // alert(rec.get("dwid"));
  850. editMaintenance(rec.get("dwid"));
  851. }
  852. }]
  853. }
  854. ],
  855. columnLines: true,
  856. height: 195,
  857. width: 785,
  858. bbar: new Ext.PagingToolbar({
  859. store: myStore3,
  860. id: 'PatrolCheckListPageToolbar3',
  861. displayInfo: true,
  862. pageSize: 5,
  863. prependButtons: true,
  864. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  865. emptyMsg: "没有记录",
  866. firstText: '第一页',
  867. prevText: '前一页',
  868. nextText: '后一页',
  869. lastText: '最后一页',
  870. refreshText: '刷新',
  871. }),
  872. // frame: true,
  873. border: false,
  874. iconCls: 'icon-grid'
  875. });
  876. function public_update() {
  877. var patrol_point_uploadURL = Ext.getCmp('patrol_point_uploadURL').getValue();
  878. var fm_patrol_spot_name = Ext.getCmp('fm_patrol_spot_name').getValue();
  879. if (fm_patrol_spot_name == "" || fm_patrol_spot_name == null) {
  880. Ext.Msg.alert('系统提示', '点位名称不能为空!');
  881. return;
  882. }
  883. var fm_patrol_company_code = Ext.getCmp('fm_patrol_company_code').getValue();
  884. if (fm_patrol_company_code == "" || fm_patrol_company_code == null) {
  885. Ext.Msg.alert('系统提示', '请选择所属建筑/项目!');
  886. return;
  887. }
  888. var fm_patrol_spot_address = Ext.getCmp('fm_patrol_spot_address').getValue();
  889. if (fm_patrol_spot_address == "" || fm_patrol_spot_address == null) {
  890. Ext.Msg.alert('系统提示', '点位地址不能为空!');
  891. return;
  892. }
  893. // var fm_patrol_equipment_code=Ext.getCmp('fm_patrol_equipment_code').getValue();
  894. // var fm_patrol_spot_type=patrolUploadForm.form.findField("fm_patrol_spot_type").getGroupValue();
  895. var fm_patrol_spot_type = Ext.getCmp('fm_patrol_spot_type').getChecked();
  896. var spot_type = '';
  897. Ext.Array.each(fm_patrol_spot_type, function (item) {
  898. spot_type += item.inputValue + ',';
  899. });
  900. if (spot_type == null || spot_type == "") {
  901. Ext.Msg.alert('系统提示', '至少选择一项设备类型!');
  902. }
  903. var fm_patrol_point_message = Ext.getCmp('fm_patrol_point_message').getValue();
  904. var fm_patrol_point_id = Ext.getCmp('fm_patrol_point_id').getValue();
  905. var query = new Object();
  906. if (AllSelectedRecords1.length == 1) {
  907. query.equipment_code = AllSelectedRecords1[0];
  908. } else {
  909. if (AllSelectedRecords1.length > 1) {
  910. var spot_id = null;
  911. // var selected = sm1.getSelection( );
  912. for (var i = 0; i < AllSelectedRecords1.length; i++) {
  913. if (i == 0)
  914. spot_id = AllSelectedRecords1[i];
  915. else
  916. spot_id += "," + AllSelectedRecords1[i];
  917. }
  918. query.equipment_code = spot_id;
  919. } else {
  920. Ext.Msg.alert('系统提示', '至少选择一条巡检点位,再点击提交!');
  921. return;
  922. }
  923. }
  924. query.id = fm_patrol_point_id;
  925. query.spot_name = fm_patrol_spot_name;
  926. query.company_code = fm_patrol_company_code;
  927. query.spot_address = fm_patrol_spot_address;
  928. // query.equipment_code = fm_patrol_equipment_code;
  929. query.spot_type = spot_type;
  930. query.remarks = fm_patrol_point_message;
  931. query.picture_route = patrol_point_uploadURL;
  932. query.V_LOGINNAME = V_LOGINNAME;
  933. // query.V_PASSWORD = V_PASSWORD;
  934. var jsonstr = Ext.JSON.encode(query);
  935. Ext.getCmp('fm_patrol_point_queryJson').setValue(jsonstr);
  936. Ext.getCmp('patrolUploadForm').submit({
  937. success: function (form, action) {
  938. // uploadPop.hide();
  939. Ext.getCmp('patrol_upload_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  940. Ext.getCmp('patrolUploadForm').getForm().reset();
  941. Ext.getCmp('patroladUploadForm').getForm().reset();
  942. // uploadPanel.getStore().reload();
  943. Ext.Msg.alert('系统提示', '保存成功!');
  944. clear_modify_form();
  945. },
  946. failure: function (form, action) {
  947. Ext.Msg.alert('系统提示', '保存失败!');
  948. clear_modify_form();
  949. }
  950. });
  951. this.up('window').hide();
  952. }
  953. var patroluploadWin = Ext.create('Ext.window.Window', {
  954. id: 'patroluploadWin',
  955. title: '<div id="patrol_upload_win1">修改巡检点位</div>',
  956. height: 600,
  957. width: 800,
  958. // maximizable: true,
  959. modal: true,
  960. closeAction: 'hide',
  961. items: [
  962. patrolUploadForm, patroladUploadForm, MaintenanceCheckPanel3],
  963. buttons: [
  964. {
  965. text: '保存',
  966. iconCls: 'ok_btn',
  967. handler: function () {
  968. public_update();
  969. }
  970. }, {
  971. text: '取消',
  972. handler: function () {
  973. this.up('window').hide();
  974. Ext.getCmp('patrol_upload_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  975. Ext.getCmp('patrolUploadForm').getForm().reset();
  976. Ext.getCmp('patroladUploadForm').getForm().reset();
  977. Ext.getCmp('PatrolpointListPageToolbar').moveFirst();
  978. }
  979. }]
  980. });
  981. function public_insert() {
  982. var fa_patrol_spot_name = Ext.getCmp('fa_patrol_spot_name').getValue();
  983. if (fa_patrol_spot_name == "" || fa_patrol_spot_name == null) {
  984. Ext.Msg.alert('系统提示', '点位名称不能为空!');
  985. return;
  986. }
  987. var fa_patrol_company_code = Ext.getCmp('fa_patrol_company_code').getValue();
  988. if (fa_patrol_company_code == "" || fa_patrol_company_code == null) {
  989. Ext.Msg.alert('系统提示', '请选择所属建筑/项目!');
  990. return;
  991. }
  992. var fa_patrol_spot_address = Ext.getCmp('fa_patrol_spot_address').getValue();
  993. if (fa_patrol_spot_address == "" || fa_patrol_spot_address == null) {
  994. Ext.Msg.alert('系统提示', '点位地址不能为空!');
  995. return;
  996. }
  997. // var fa_patrol_equipment_code=Ext.getCmp('fa_patrol_equipment_code').getValue();
  998. var fa_patrol_spot_type = Ext.getCmp('fa_patrol_spot_type').getChecked();
  999. var spot_type = '';
  1000. Ext.Array.each(fa_patrol_spot_type, function (item) {
  1001. spot_type += item.inputValue + ',';
  1002. });
  1003. if (spot_type == null || spot_type == "") {
  1004. Ext.Msg.alert('系统提示', '至少选择一项设备类型!');
  1005. }
  1006. // var fa_patrol_spot_type = patroladdForm.getForm().findField("fa_patrol_spot_type").getGroupValue();
  1007. var fa_patrol_point_message = Ext.getCmp('fa_patrol_point_message').getValue();
  1008. var patrol_point_addURL = Ext.getCmp('patrol_point_addURL').getValue();
  1009. if (patrol_point_addURL == "" || patrol_point_addURL == null) {
  1010. Ext.Msg.alert('系统提示', '请上传图标' + fa_patrol_spot_type);
  1011. return;
  1012. }
  1013. var query = new Object();
  1014. query.spot_name = fa_patrol_spot_name;
  1015. query.company_code = fa_patrol_company_code;
  1016. query.spot_address = fa_patrol_spot_address;
  1017. // query.equipment_code = fa_patrol_equipment_code;
  1018. query.spot_type = spot_type;
  1019. query.remarks = fa_patrol_point_message;
  1020. query.picture_route = patrol_point_addURL;
  1021. if (AllSelectedRecords.length == 1) {
  1022. query.equipment_code = AllSelectedRecords[0];
  1023. } else {
  1024. if (AllSelectedRecords.length > 1) {
  1025. var spot_id = null;
  1026. // var selected = sm1.getSelection( );
  1027. for (var i = 0; i < AllSelectedRecords.length; i++) {
  1028. if (i == 0)
  1029. spot_id = AllSelectedRecords[i];
  1030. else
  1031. spot_id += "," + AllSelectedRecords[i];
  1032. }
  1033. query.equipment_code = spot_id;
  1034. } else {
  1035. Ext.Msg.alert('系统提示', '至少选择一条巡检点位,再点击提交!');
  1036. return;
  1037. }
  1038. }
  1039. query.V_LOGINNAME = V_LOGINNAME;
  1040. // query.V_PASSWORD = V_PASSWORD;
  1041. var jsonstr = Ext.JSON.encode(query);
  1042. Ext.getCmp('fa_patrol_point_queryJson').setValue(jsonstr);
  1043. Ext.getCmp('patroladdForm').submit({
  1044. success: function (form, action) {
  1045. // addPop.hide();
  1046. Ext.getCmp('patrol_add_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  1047. Ext.getCmp('patroladdForm').getForm().reset();
  1048. Ext.getCmp('patroladaddForm').getForm().reset();
  1049. // uploadPanel.getStore().reload();
  1050. Ext.Msg.alert('系统提示', '保存成功!');
  1051. clear_append_form();
  1052. },
  1053. failure: function (form, action) {
  1054. Ext.Msg.alert('系统提示', '保存失败!');
  1055. clear_append_form();
  1056. }
  1057. });
  1058. }
  1059. var patroladdWin = Ext.create('Ext.window.Window', {
  1060. id: 'patroladdWin',
  1061. title: '增加巡检点位',
  1062. height: 600,
  1063. width: 800,
  1064. // maximizable: true,
  1065. modal: true,
  1066. closeAction: 'hide',
  1067. items: [
  1068. patroladdForm, patroladaddForm, MaintenanceCheckPanel2
  1069. ],
  1070. buttons: [
  1071. {
  1072. text: '保存',
  1073. handler: function () {
  1074. public_insert();
  1075. }
  1076. }, {
  1077. text: '取消',
  1078. handler: function () {
  1079. this.up('window').hide();
  1080. Ext.getCmp('patrol_add_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  1081. Ext.getCmp('patroladdForm').getForm().reset();
  1082. Ext.getCmp('patroladaddForm').getForm().reset();
  1083. Ext.getCmp('PatrolpointListPageToolbar').moveFirst();
  1084. }
  1085. }]
  1086. });
  1087. var addhtml = function () {
  1088. var adaddFormhtml = document.getElementById('patroladaddForm');
  1089. var title = document.createElement('div');
  1090. title.setAttribute('class', 'Maintenancediv_title');
  1091. title.innerHTML = '点位图片:';
  1092. adaddFormhtml.appendChild(title);
  1093. }
  1094. var uploadhtml = function () {
  1095. var uploadFormhtml = document.getElementById('patroladUploadForm');
  1096. var title = document.createElement('div');
  1097. title.setAttribute('class', 'Maintenancediv_title');
  1098. title.innerHTML = '点位图片:';
  1099. uploadFormhtml.appendChild(title);
  1100. }
  1101. var uploadPop = function () {
  1102. patroluploadWin.show();
  1103. uploadhtml();
  1104. }
  1105. var addPop = function () {
  1106. AllSelectedRecords.length = 0;
  1107. var query = new Object();
  1108. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1109. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1110. var jsonstr = Ext.JSON.encode(query);
  1111. myStore2.getProxy().extraParams = {
  1112. queryJson: jsonstr
  1113. };
  1114. Ext.getCmp('PatrolCheckListPageToolbar2').moveFirst();
  1115. patroladdWin.show();
  1116. addhtml();
  1117. }
  1118. var chk_sm = function () {
  1119. if (sm.getCount() == 1) {
  1120. var selected = sm.getSelection();
  1121. var b = selected[0].raw.equipment_code_list;
  1122. AllSelectedRecords1 = b.split(",");
  1123. getManufacturerId2.reload();
  1124. var div = Ext.getCmp('fm_patrol_company_code');
  1125. var label = selected[0].raw.id
  1126. var query = new Object();
  1127. // if(label.length>0){
  1128. query.dwid = label;
  1129. // }
  1130. query.building_id = selected[0].raw.company_code;
  1131. query.V_LOGINNAME = V_LOGINNAME;
  1132. // query.V_PASSWORD = V_PASSWORD;
  1133. var jsonstr = Ext.JSON.encode(query);
  1134. myStore3.getProxy().extraParams = {
  1135. queryJson: jsonstr
  1136. };
  1137. Ext.getCmp('PatrolCheckListPageToolbar3').moveFirst();
  1138. uploadPop();
  1139. Ext.getCmp('fm_patrol_point_id').setValue(selected[0].raw.id);
  1140. Ext.getCmp('fm_patrol_spot_name').setValue(selected[0].raw.spot_name);
  1141. div.setValue(selected[0].raw.company_code);
  1142. Ext.getCmp('fm_patrol_spot_address').setValue(selected[0].raw.spot_address);
  1143. var a = selected[0].raw.spot_type;
  1144. // if(Number(a) ==1){
  1145. // var radio = Ext.getCmp('radio81');
  1146. // radio.setValue(true);
  1147. // }else if(Number(a)==2){
  1148. // var radio = Ext.getCmp('radio82');
  1149. // radio.setValue(true);
  1150. // }else if(Number(a)==3){
  1151. // var radio = Ext.getCmp('radio83');
  1152. // radio.setValue(true);
  1153. // }else if(Number(a)==4){
  1154. // var radio = Ext.getCmp('radio84');
  1155. // radio.setValue(true);
  1156. // }else if(Number(a)==5){
  1157. // var radio = Ext.getCmp('radio85');
  1158. // radio.setValue(true);
  1159. // }else if(Number(a)==6){
  1160. // var radio = Ext.getCmp('radio86');
  1161. // radio.setValue(true);
  1162. // }else if(Number(a)==7){
  1163. // var radio = Ext.getCmp('radio87');
  1164. // radio.setValue(true);
  1165. // }
  1166. var arr = a.split(",");
  1167. for (var i = 0; i < arr.length; i++) {
  1168. switch (arr[i]) {
  1169. case "1":
  1170. Ext.getCmp('radio81').setValue(true);
  1171. break;
  1172. case "2":
  1173. Ext.getCmp('radio82').setValue(true);
  1174. break;
  1175. case "3":
  1176. Ext.getCmp('radio83').setValue(true);
  1177. break;
  1178. case "4":
  1179. Ext.getCmp('radio84').setValue(true);
  1180. break;
  1181. case "5":
  1182. Ext.getCmp('radio85').setValue(true);
  1183. break;
  1184. case "6":
  1185. Ext.getCmp('radio86').setValue(true);
  1186. break;
  1187. case "7":
  1188. Ext.getCmp('radio87').setValue(true);
  1189. break;
  1190. }
  1191. }
  1192. Ext.getCmp('fm_patrol_point_message').setValue(selected[0].raw.remarks);
  1193. Ext.getCmp('patrol_point_uploadURL').setValue(selected[0].raw.picture_route);
  1194. var formPanel = Ext.getCmp('patroladUploadForm');
  1195. var imageShow_box = formPanel.down('box[id=patrol_upload_picture]');//预览的图片框对象
  1196. var imageShow_box_dom = imageShow_box.getEl().dom;
  1197. imageShow_box_dom.src = baseUrl + (selected[0].raw.picture_route);
  1198. } else {
  1199. Ext.Msg.alert('请先选择', '请先选择一条记录,再点击修改');
  1200. }
  1201. }
  1202. var del_sm = function () {
  1203. if (sm.getCount() == 1) {
  1204. var selected = sm.getSelection();
  1205. var query = new Object();
  1206. var list = new Array();
  1207. var o = new Object();
  1208. o.id = selected[0].raw.id;
  1209. list.push(o);
  1210. query.ID_LIST = list;
  1211. var jsonstr = Ext.JSON.encode(query);
  1212. Ext.MessageBox.confirm('删除巡检点位', '是否删除' + selected[0].raw.spot_name + ' 巡检点位?', function (btn) {
  1213. if (btn == 'yes') {
  1214. $.ajax({
  1215. type: 'POST',
  1216. url: baseUrl + "iot/inspectionpoints/del",
  1217. data: {
  1218. queryJson: jsonstr
  1219. },
  1220. success: function (result) {
  1221. var json = eval('(' + result + ')');
  1222. if (json.action == 'deleteInspectionPoints') {
  1223. if (json.success == true) {
  1224. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  1225. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1226. });
  1227. } else {
  1228. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  1229. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1230. });
  1231. }
  1232. }
  1233. }
  1234. });
  1235. }
  1236. }, this);
  1237. } else {
  1238. if (sm.getCount() > 1) {
  1239. var query = new Object();
  1240. var list = new Array();
  1241. for (var i = 0; i < sm.getCount(); i++) {
  1242. var selected = sm.getSelection();
  1243. var o = new Object();
  1244. o.id = selected[i].raw.id;
  1245. list.push(o);
  1246. }
  1247. query.ID_LIST = list;
  1248. var jsonstr = Ext.JSON.encode(query);
  1249. Ext.MessageBox.confirm('删除巡检点位', '是否删除选中的' + sm.getCount() + ' 个巡检点位?', function (btn) {
  1250. if (btn == 'yes') {
  1251. $.ajax({
  1252. type: 'POST',
  1253. url: baseUrl + "iot/inspectionpoints/del",
  1254. data: {
  1255. queryJson: jsonstr
  1256. },
  1257. success: function (result) {
  1258. var json = eval('(' + result + ')');
  1259. if (json.action == 'deleteInspectionPoints') {
  1260. if (json.success == true) {
  1261. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  1262. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1263. });
  1264. } else {
  1265. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  1266. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1267. });
  1268. }
  1269. }
  1270. }
  1271. });
  1272. }
  1273. }, this);
  1274. } else {
  1275. Ext.Msg.alert('请先选择', '至少选择一条记录,再点击删除');
  1276. }
  1277. }
  1278. }
  1279. var show_page = function () {
  1280. var patrolpoint_title2_input = document.getElementById('patrolpoint_title2_input').value;
  1281. var patrolpoint_title3_input1 = document.getElementById('patrolpoint_title3_input1').value;
  1282. var query = new Object();
  1283. if (patrolpoint_title2_input.length > 0) {
  1284. query.spot_name = patrolpoint_title2_input;
  1285. $("#spot_name").val(patrolpoint_title2_input);
  1286. }
  1287. if (patrolpoint_title3_input1.length > 0) {
  1288. query.spot_address = patrolpoint_title3_input1;
  1289. $("#spot_address").val(patrolpoint_title3_input1);
  1290. }
  1291. query.V_LOGINNAME = V_LOGINNAME;
  1292. // query.V_PASSWORD = V_PASSWORD;
  1293. var jsonstr = Ext.JSON.encode(query);
  1294. myStore.getProxy().extraParams = {
  1295. queryJson: jsonstr
  1296. };
  1297. Ext.getCmp('PatrolpointListPageToolbar').moveFirst();
  1298. }
  1299. var reset1 = function () {
  1300. document.getElementById('patrolpoint_title2_input').value = '';
  1301. document.getElementById('patrolpoint_title3_input1').value = '';
  1302. $("#spot_name").val("");
  1303. $("#spot_address").val("");
  1304. show_page();
  1305. }
  1306. mouseon = function (obj) {
  1307. var id = obj.id;
  1308. $("#" + id).removeClass(id);
  1309. $("#" + id).addClass(id + '_on');
  1310. }
  1311. mouseoff = function (obj) {
  1312. var mid = "patrolpoint_";
  1313. for (var i = 1; i < 7; i++) {
  1314. var id = "patrolpoint_title" + i + "_div";
  1315. $("#" + id).removeClass(id + '_on');
  1316. $("#" + id).addClass(id);
  1317. }
  1318. if (menuidx == 'm1') {
  1319. mid += 'title1_div';
  1320. $("#" + mid).removeClass(mid);
  1321. $("#" + mid).addClass(mid + '_on');
  1322. }
  1323. else if (menuidx == 'm2') {
  1324. mid += 'title2_div';
  1325. $("#" + mid).removeClass(mid);
  1326. $("#" + mid).addClass(mid + '_on');
  1327. }
  1328. else if (menuidx == 'm3') {
  1329. mid += 'title3_div';
  1330. $("#" + mid).removeClass(mid);
  1331. $("#" + mid).addClass(mid + '_on');
  1332. }
  1333. else if (menuidx == 'm4') {
  1334. mid += 'title4_div';
  1335. $("#" + mid).removeClass(mid);
  1336. $("#" + mid).addClass(mid + '_on');
  1337. }
  1338. else if (menuidx == 'm5') {
  1339. mid += 'title5_div';
  1340. $("#" + mid).removeClass(mid);
  1341. $("#" + mid).addClass(mid + '_on');
  1342. }
  1343. else if (menuidx == 'm6') {
  1344. mid += 'title6_div';
  1345. $("#" + mid).removeClass(mid);
  1346. $("#" + mid).addClass(mid + '_on');
  1347. }
  1348. }
  1349. menu_click = function (obj) {
  1350. var id = obj.id;
  1351. if (id == 'patrolpoint_title1_div') {
  1352. menuidx = 'm1';
  1353. show_page();
  1354. }
  1355. else if (id == 'patrolpoint_title2_div') {
  1356. menuidx = 'm2';
  1357. reset1();
  1358. }
  1359. else if (id == 'patrolpoint_title3_div') {
  1360. menuidx = 'm3';
  1361. exportbtn_click();
  1362. }
  1363. else if (id == 'patrolpoint_title4_div') {
  1364. menuidx = 'm4';
  1365. del_sm();
  1366. }
  1367. else if (id == 'patrolpoint_title5_div') {
  1368. menuidx = 'm5';
  1369. addPop();
  1370. }
  1371. else if (id == 'patrolpoint_title6_div') {
  1372. menuidx = 'm6';
  1373. chk_sm();
  1374. }
  1375. }
  1376. var piedarHtml = function () {
  1377. var maintenanceHtml = document.getElementById('patrolpointHtml');
  1378. var title = document.createElement('div');
  1379. title.setAttribute('class', 'MaintenancePersonTitle');
  1380. title.innerHTML = '巡检点位';
  1381. maintenanceHtml.appendChild(title);
  1382. var title2 = document.createElement('div');
  1383. title2.setAttribute('class', 'title2_div');
  1384. title2.innerHTML = '点位名称';
  1385. maintenanceHtml.appendChild(title2);
  1386. var input = document.createElement('input');
  1387. input.setAttribute('class', 'input_class');
  1388. input.setAttribute('id', 'patrolpoint_title2_input');
  1389. input.setAttribute('type', 'text');
  1390. input.setAttribute('value', '');
  1391. maintenanceHtml.appendChild(input);
  1392. var title3 = document.createElement('div');
  1393. title3.setAttribute('class', 'title3_div');
  1394. title3.innerHTML = '点位地址';
  1395. maintenanceHtml.appendChild(title3);
  1396. var input1 = document.createElement('input');
  1397. input1.setAttribute('class', 'input1_class');
  1398. input1.setAttribute('id', 'patrolpoint_title3_input1');
  1399. input1.setAttribute('type', 'text');
  1400. input1.setAttribute('value', '');
  1401. maintenanceHtml.appendChild(input1);
  1402. var title4 = document.createElement('div');
  1403. title4.setAttribute('class', 'patrolpoint_title1_div');
  1404. title4.setAttribute('id', 'patrolpoint_title1_div');
  1405. title4.setAttribute('onmouseover', "mouseon(this)");
  1406. title4.setAttribute('onmouseout', "mouseoff(this)");
  1407. title4.setAttribute('onclick', "menu_click(this)");
  1408. maintenanceHtml.appendChild(title4);
  1409. var title5 = document.createElement('div');
  1410. title5.setAttribute('class', 'patrolpoint_title2_div');
  1411. title5.setAttribute('id', 'patrolpoint_title2_div');
  1412. title5.setAttribute('onmouseover', "mouseon(this)");
  1413. title5.setAttribute('onmouseout', "mouseoff(this)");
  1414. title5.setAttribute('onclick', "menu_click(this)");
  1415. maintenanceHtml.appendChild(title5);
  1416. var title6 = document.createElement('div');
  1417. title6.setAttribute('class', 'patrolpoint_title3_div');
  1418. title6.setAttribute('id', 'patrolpoint_title3_div');
  1419. title6.setAttribute('onmouseover', "mouseon(this)");
  1420. title6.setAttribute('onmouseout', "mouseoff(this)");
  1421. title6.setAttribute('onclick', "menu_click(this)");
  1422. maintenanceHtml.appendChild(title6);
  1423. var title7 = document.createElement('div');
  1424. title7.setAttribute('class', 'patrolpoint_title4_div');
  1425. title7.setAttribute('id', 'patrolpoint_title4_div');
  1426. title7.setAttribute('onmouseover', "mouseon(this)");
  1427. title7.setAttribute('onmouseout', "mouseoff(this)");
  1428. title7.setAttribute('onclick', "menu_click(this)");
  1429. maintenanceHtml.appendChild(title7);
  1430. var title8 = document.createElement('div');
  1431. title8.setAttribute('class', 'patrolpoint_title5_div');
  1432. title8.setAttribute('id', 'patrolpoint_title5_div');
  1433. title8.setAttribute('onmouseover', "mouseon(this)");
  1434. title8.setAttribute('onmouseout', "mouseoff(this)");
  1435. title8.setAttribute('onclick', "menu_click(this)");
  1436. maintenanceHtml.appendChild(title8);
  1437. var title9 = document.createElement('div');
  1438. title9.setAttribute('class', 'patrolpoint_title6_div');
  1439. title9.setAttribute('id', 'patrolpoint_title6_div');
  1440. title9.setAttribute('onmouseover', "mouseon(this)");
  1441. title9.setAttribute('onmouseout', "mouseoff(this)");
  1442. title9.setAttribute('onclick', "menu_click(this)");
  1443. maintenanceHtml.appendChild(title9);
  1444. }
  1445. var saveFile = function (data, filename) {
  1446. var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
  1447. save_link.href = data;
  1448. save_link.download = filename;
  1449. var event = document.createEvent('MouseEvents');
  1450. event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  1451. save_link.dispatchEvent(event);
  1452. }
  1453. var downPng = function (canvas) {
  1454. console.log(canvas);
  1455. var img_data1 = Canvas2Image.saveAsPNG(canvas, true).getAttribute('src');
  1456. saveFile(img_data1, 'richer.png');
  1457. }
  1458. var cutDiv = function () {
  1459. var content = document.getElementById("patrolpoint_div_ceshi");
  1460. html2canvas(content, {
  1461. onrendered: function (canvas) {
  1462. downPng(canvas);
  1463. }
  1464. });
  1465. }
  1466. var maintenancelabel = function () {
  1467. var maintenance_look_label = document.getElementById('patrolpoint_look_label');
  1468. var div3 = document.createElement('div');
  1469. div3.setAttribute('id', 'patrolpoint_div_ceshi');
  1470. maintenance_look_label.appendChild(div3);
  1471. var div7 = document.createElement('div');
  1472. div7.style.width = '100%';
  1473. div7.style.height = '130px';
  1474. div7.style.textAlign = 'center';
  1475. div7.style.verticalAlign = 'middle';
  1476. div7.style.background = '#fff';
  1477. div7.setAttribute('id', 'patrolpoint_div_ceshi7');
  1478. div3.appendChild(div7);
  1479. var span = document.createElement('span');
  1480. span.style.height = '100%';
  1481. span.style.display = 'inline-block';
  1482. span.style.verticalAlign = 'middle';
  1483. div7.appendChild(span);
  1484. var img = document.createElement('img');
  1485. img.width = 110;
  1486. img.height = 100;
  1487. img.style.verticalAlign = 'middle';
  1488. // img.src = "../../tp/57988c26-20fd-4782-ac99-3aec6cb4d7ce.png";
  1489. img.src = baseUrl + ConfirmStore[0].spot_label_route;
  1490. div7.appendChild(img);
  1491. var div8 = document.createElement('div');
  1492. div8.style.width = '100%';
  1493. div8.style.height = '130px';
  1494. div8.style.background = '#0082fe';
  1495. div8.setAttribute('id', 'patrolpoint_div_ceshi8');
  1496. div3.appendChild(div8);
  1497. var div4 = document.createElement('div');
  1498. div4.style.textAlign = 'left';
  1499. div4.style.color = '#000';
  1500. div4.innerHTML = '点位名称:' + ConfirmStore[0].spot_name;
  1501. div8.appendChild(div4);
  1502. var div5 = document.createElement('div');
  1503. div5.style.textAlign = 'left';
  1504. div5.style.color = '#000';
  1505. div5.innerHTML = '点位地址:' + ConfirmStore[0].spot_address;
  1506. div8.appendChild(div5);
  1507. var div6 = document.createElement('div');
  1508. div6.style.textAlign = 'left';
  1509. div6.style.color = '#000';
  1510. div6.innerHTML = '点位编号:' + ConfirmStore[0].spot_label_analysis;
  1511. div8.appendChild(div6);
  1512. }
  1513. var editRow = function (spot_id) {
  1514. var spot_id = spot_id;
  1515. Ext.create('Ext.window.Window', {
  1516. id: 'patrolpoint_data_win',
  1517. height: 300,
  1518. width: 250,
  1519. layout: 'fit',
  1520. modal: true,
  1521. buttons: [
  1522. {
  1523. text: '下载',
  1524. handler: function () {
  1525. cutDiv();
  1526. }
  1527. }, {
  1528. text: '关闭',
  1529. handler: function () {
  1530. Ext.getCmp('patrolpoint_data_win').destroy();
  1531. }
  1532. }
  1533. ],
  1534. closeAction: 'destroy',
  1535. html: '<div id="patrolpoint_look_label"></div>'
  1536. }).show();
  1537. var query = new Object();
  1538. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1539. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1540. query.id = spot_id;
  1541. $.ajax({
  1542. type: 'POST',
  1543. url: baseUrl + "iot/inspectionpoints/getList1",
  1544. data: {
  1545. queryJson: Ext.JSON.encode(query)
  1546. },
  1547. success: function (result) {
  1548. var json = eval('(' + result + ')');
  1549. if (json.action == 'getInspectionPointsList') {
  1550. ConfirmStore = json.RESULT;
  1551. maintenancelabel(ConfirmStore);
  1552. }
  1553. }
  1554. });
  1555. }
  1556. var maintenancedevice = function () {
  1557. var maintenance_look_device = document.getElementById('patrolpoint_look_device');
  1558. var div7 = document.createElement('div');
  1559. div7.style.width = '400px';
  1560. div7.style.height = '400px';
  1561. div7.style.textAlign = 'center';
  1562. div7.style.verticalAlign = 'middle';
  1563. // div7.style.background='#fff';
  1564. div7.setAttribute('id', 'patrolpoint_div_ceshi10');
  1565. maintenance_look_device.appendChild(div7);
  1566. if (ConfirmStore[0].picture_route) {
  1567. var img = document.createElement('img');
  1568. img.width = 400;
  1569. img.height = 400;
  1570. img.src = baseUrl + ConfirmStore[0].picture_route;
  1571. img.setAttribute('class', 'maintenance_look_device_img');
  1572. div7.appendChild(img);
  1573. } else {
  1574. var span = document.createElement('span');
  1575. span.style.height = '100%';
  1576. span.style.display = 'inline-block';
  1577. span.style.verticalAlign = 'middle';
  1578. div7.appendChild(span);
  1579. var img = document.createElement('img');
  1580. img.width = 110;
  1581. img.height = 110;
  1582. img.style.verticalAlign = 'middle';
  1583. img.src = '../../res/img/common/shangchaun.png';
  1584. img.setAttribute('class', 'maintenance_look_device_img');
  1585. img.setAttribute('onclick', "menu_click(this)");
  1586. div7.appendChild(img);
  1587. }
  1588. var div4 = document.createElement('div');
  1589. div4.style.textAlign = 'center';
  1590. div4.innerHTML = ConfirmStore[0].remarks;
  1591. maintenance_look_device.appendChild(div4);
  1592. }
  1593. var editMaintenance = function (spot_id) {
  1594. var spot_id = spot_id;
  1595. Ext.create('Ext.window.Window', {
  1596. id: 'patrolpoint_data_win1',
  1597. height: 500,
  1598. width: 400,
  1599. layout: 'fit',
  1600. modal: true,
  1601. buttons: [
  1602. {
  1603. text: '关闭',
  1604. handler: function () {
  1605. Ext.getCmp('patrolpoint_data_win1').destroy();
  1606. }
  1607. }
  1608. ],
  1609. closeAction: 'destroy',
  1610. html: '<div id="patrolpoint_look_device"></div>'
  1611. }).show();
  1612. var query = new Object();
  1613. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1614. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1615. query.id = spot_id;
  1616. $.ajax({
  1617. type: 'POST',
  1618. url: baseUrl + "iot/inspectionpoints/getList1",
  1619. data: {
  1620. queryJson: Ext.JSON.encode(query)
  1621. },
  1622. success: function (result) {
  1623. var json = eval('(' + result + ')');
  1624. if (json.action == 'getInspectionPointsList') {
  1625. ConfirmStore = json.RESULT;
  1626. maintenancedevice(ConfirmStore);
  1627. }
  1628. }
  1629. });
  1630. }
  1631. var MaintenancePanel = Ext.create('Ext.grid.Panel', {
  1632. header: {
  1633. height: 0,
  1634. border: '0px solid #000000'
  1635. },
  1636. id: 'PatrolpointListPanel',
  1637. store: myStore,
  1638. selModel: sm,
  1639. columns: [
  1640. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1641. { header: 'equipment_code_list', dataIndex: 'equipment_code_list', hidden: true, menuDisabled: true },
  1642. { header: '图片路径', dataIndex: 'picture_route', hidden: true, menuDisabled: true },
  1643. { header: '序号', dataIndex: 'xh', width: 37, menuDisabled: true },
  1644. { header: '点位名称', dataIndex: 'spot_name', width: 300, align: 'center', menuDisabled: true },
  1645. // { header: '所属建筑/项目', dataIndex: 'building_name', width:300,align:'center', menuDisabled:true },
  1646. {
  1647. text: '点位标签',
  1648. xtype: 'actioncolumn',
  1649. width: 150,
  1650. sortable: false,
  1651. align: 'center',
  1652. menuDisabled: true,
  1653. items: [{
  1654. icon: '../../res/img/common/chakanbtn.png',
  1655. tooltip: '点位标签',
  1656. handler: function (grid, rowIndex, colIndex) {
  1657. var rec = grid.getStore().getAt(rowIndex);
  1658. editRow(rec.get("id"));
  1659. }
  1660. }]
  1661. },
  1662. { header: '点位地址', dataIndex: 'spot_address', width: 300, align: 'center', menuDisabled: true },
  1663. {
  1664. text: '对应对象',
  1665. xtype: 'actioncolumn',
  1666. width: 150,
  1667. sortable: false,
  1668. align: 'center',
  1669. menuDisabled: true,
  1670. items: [{
  1671. icon: '../../res/img/common/chakanbtn.png',
  1672. tooltip: '对应对象',
  1673. handler: function (grid, rowIndex, colIndex) {
  1674. var rec = grid.getStore().getAt(rowIndex);
  1675. // $("#checkRecord_id").val(rec.get("id"));
  1676. modifywin(rec.get("id"));
  1677. var label = rec.get("id");
  1678. var query = new Object();
  1679. // alert(label);
  1680. if (label.length > 0) {
  1681. query.id = label;
  1682. }
  1683. query.V_LOGINNAME = V_LOGINNAME;
  1684. // query.V_PASSWORD = V_PASSWORD;
  1685. var jsonstr = Ext.JSON.encode(query);
  1686. myStore1.getProxy().extraParams = {
  1687. queryJson: jsonstr
  1688. };
  1689. myStore1.reload();
  1690. }
  1691. }]
  1692. },
  1693. // { header: '设备类型', dataIndex: 'type_name',width:100, align:'center', menuDisabled:true },
  1694. { header: '最新改动时间', dataIndex: 'latest_change_time', width: 350, align: 'center', menuDisabled: true },
  1695. { header: '备注', dataIndex: 'remarks', hidden: true, menuDisabled: true },
  1696. { header: '类型值', dataIndex: 'spot_type', hidden: true, menuDisabled: true },
  1697. {
  1698. text: '点位详情',
  1699. xtype: 'actioncolumn',
  1700. width: 150,
  1701. sortable: false,
  1702. align: 'center',
  1703. menuDisabled: true,
  1704. items: [{
  1705. icon: '../../res/img/common/tupianbtn.png',
  1706. tooltip: '点位详情',
  1707. handler: function (grid, rowIndex, colIndex) {
  1708. var rec = grid.getStore().getAt(rowIndex);
  1709. editMaintenance(rec.get("id"));
  1710. }
  1711. }]
  1712. }
  1713. ],
  1714. columnLines: true,
  1715. height: maxHeight,
  1716. width: '100%',
  1717. bbar: new Ext.PagingToolbar({
  1718. store: myStore,
  1719. id: 'PatrolpointListPageToolbar',
  1720. displayInfo: true,
  1721. pageSize: countPerPage,
  1722. prependButtons: true,
  1723. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1724. emptyMsg: "没有记录",
  1725. firstText: '第一页',
  1726. prevText: '前一页',
  1727. nextText: '后一页',
  1728. lastText: '最后一页',
  1729. refreshText: '刷新',
  1730. }),
  1731. // frame: true,
  1732. border: false,
  1733. iconCls: 'icon-grid',
  1734. });
  1735. MaintenanceCheckPanel1 = Ext.create('Ext.grid.Panel', {
  1736. header: {
  1737. height: 0,
  1738. border: '0px solid #000000'
  1739. },
  1740. id: 'PatrolCheckListPanel1',
  1741. store: myStore1,
  1742. // selModel: sm1,
  1743. columns: [
  1744. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1745. { header: '点位ID', dataIndex: 'spot_id', hidden: true, menuDisabled: true },
  1746. { header: '设备编号', dataIndex: 'equipment_code', hidden: true, menuDisabled: true },
  1747. { header: '序号', dataIndex: 'xh', width: 48, align: 'center', menuDisabled: true },
  1748. { header: '设备名称', dataIndex: 'device_name', width: 150, align: 'center', menuDisabled: true },
  1749. { header: '设备地址', dataIndex: 'unitinfo', width: 150, align: 'center', menuDisabled: true },
  1750. {
  1751. text: '设备详情',
  1752. xtype: 'actioncolumn',
  1753. width: 150,
  1754. sortable: false,
  1755. align: 'center',
  1756. menuDisabled: true,
  1757. items: [{
  1758. icon: '../../res/img/common/tupianbtn.png',
  1759. tooltip: '设备详情',
  1760. handler: function (grid, rowIndex, colIndex) {
  1761. var rec = grid.getStore().getAt(rowIndex);
  1762. // alert(rec.get("dwid"));
  1763. editMaintenance(rec.get("spot_id"));
  1764. }
  1765. }]
  1766. }
  1767. ],
  1768. columnLines: true,
  1769. height: 380,
  1770. width: 490,
  1771. bbar: new Ext.PagingToolbar({
  1772. store: myStore1,
  1773. id: 'PatrolCheckListPageToolbar1',
  1774. displayInfo: true,
  1775. pageSize: 10,
  1776. prependButtons: true,
  1777. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1778. emptyMsg: "没有记录",
  1779. firstText: '第一页',
  1780. prevText: '前一页',
  1781. nextText: '后一页',
  1782. lastText: '最后一页',
  1783. refreshText: '刷新',
  1784. }),
  1785. // frame: true,
  1786. border: false,
  1787. iconCls: 'icon-grid'
  1788. });
  1789. modifywin1 = Ext.create('Ext.window.Window', {
  1790. title: '<div id="patrol_upload_win">对应对象</div>',
  1791. id: 'patrol_point_modify_win1',
  1792. height: 450,
  1793. width: 510,
  1794. modal: true,
  1795. layout: 'fit',
  1796. items: [MaintenanceCheckPanel1],
  1797. buttons: [
  1798. {
  1799. text: '关闭',
  1800. handler: function () {
  1801. Ext.getCmp('patrol_point_modify_win1').close();
  1802. }
  1803. }
  1804. ],
  1805. closeAction: 'hide'
  1806. })
  1807. var modifywin = function () {
  1808. modifywin1.show();
  1809. }
  1810. var piebar = Ext.create('Ext.panel.Panel', {
  1811. id: 'patrolpointHtml',
  1812. width: '100%',
  1813. height: 188,
  1814. region: 'north',
  1815. layout: 'form',
  1816. defaults: {
  1817. border: false
  1818. }
  1819. });
  1820. new Ext.create('Ext.panel.Panel', {
  1821. width: '100%',
  1822. id: 'PatrolpointPiebar',
  1823. layout: 'border',
  1824. items: [
  1825. piebar, MaintenancePanel
  1826. ],
  1827. renderTo: Ext.getBody()
  1828. });
  1829. myStore.reload();
  1830. $(window).resize(function () {
  1831. body_resize();
  1832. });
  1833. piedarHtml();
  1834. body_resize();
  1835. });