patrolpoint.js 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010
  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. var patroluploadWin = Ext.create('Ext.window.Window', {
  877. id: 'patroluploadWin',
  878. title: '<div id="patrol_upload_win1">修改巡检点位</div>',
  879. height: 600,
  880. width: 800,
  881. // maximizable: true,
  882. modal: true,
  883. closeAction: 'hide',
  884. items: [
  885. patrolUploadForm, patroladUploadForm, MaintenanceCheckPanel3],
  886. buttons: [
  887. {
  888. text: '保存',
  889. iconCls: 'ok_btn',
  890. handler: function () {
  891. if (AllSelectedRecords1.length == 1) {
  892. var patrol_point_uploadURL = Ext.getCmp('patrol_point_uploadURL').getValue();
  893. var fm_patrol_spot_name = Ext.getCmp('fm_patrol_spot_name').getValue();
  894. var fm_patrol_company_code = Ext.getCmp('fm_patrol_company_code').getValue();
  895. var fm_patrol_spot_address = Ext.getCmp('fm_patrol_spot_address').getValue();
  896. // var fm_patrol_equipment_code=Ext.getCmp('fm_patrol_equipment_code').getValue();
  897. // var fm_patrol_spot_type=patrolUploadForm.form.findField("fm_patrol_spot_type").getGroupValue();
  898. var fm_patrol_spot_type = Ext.getCmp('fm_patrol_spot_type').getChecked();
  899. var spot_type = '';
  900. Ext.Array.each(fm_patrol_spot_type, function (item) {
  901. spot_type += item.inputValue + ',';
  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. query.equipment_code = AllSelectedRecords1[0];
  907. query.id = fm_patrol_point_id;
  908. query.spot_name = fm_patrol_spot_name;
  909. query.company_code = fm_patrol_company_code;
  910. query.spot_address = fm_patrol_spot_address;
  911. // query.equipment_code = fm_patrol_equipment_code;
  912. query.spot_type = spot_type;
  913. query.remarks = fm_patrol_point_message;
  914. query.picture_route = patrol_point_uploadURL;
  915. query.V_LOGINNAME = V_LOGINNAME;
  916. // query.V_PASSWORD = V_PASSWORD;
  917. var jsonstr = Ext.JSON.encode(query);
  918. Ext.getCmp('fm_patrol_point_queryJson').setValue(jsonstr);
  919. Ext.getCmp('patrolUploadForm').submit({
  920. success: function (form, action) {
  921. // uploadPop.hide();
  922. Ext.getCmp('patrol_upload_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  923. Ext.getCmp('patrolUploadForm').getForm().reset();
  924. Ext.getCmp('patroladUploadForm').getForm().reset();
  925. // uploadPanel.getStore().reload();
  926. Ext.Msg.alert('系统提示', '保存成功!');
  927. clear_modify_form();
  928. },
  929. failure: function (form, action) {
  930. Ext.Msg.alert('系统提示', '保存失败!');
  931. clear_modify_form();
  932. }
  933. });
  934. this.up('window').hide();
  935. } else {
  936. if (AllSelectedRecords1.length > 1) {
  937. var patrol_point_uploadURL = Ext.getCmp('patrol_point_uploadURL').getValue();
  938. var fm_patrol_spot_name = Ext.getCmp('fm_patrol_spot_name').getValue();
  939. var fm_patrol_company_code = Ext.getCmp('fm_patrol_company_code').getValue();
  940. var fm_patrol_spot_address = Ext.getCmp('fm_patrol_spot_address').getValue();
  941. // var fm_patrol_equipment_code=Ext.getCmp('fm_patrol_equipment_code').getValue();
  942. // var fm_patrol_spot_type=patrolUploadForm.form.findField("fm_patrol_spot_type").getGroupValue();
  943. var fm_patrol_spot_type = Ext.getCmp('fm_patrol_spot_type').getChecked();
  944. var spot_type = '';
  945. Ext.Array.each(fm_patrol_spot_type, function (item) {
  946. spot_type += item.inputValue + ',';
  947. });
  948. var fm_patrol_point_message = Ext.getCmp('fm_patrol_point_message').getValue();
  949. var fm_patrol_point_id = Ext.getCmp('fm_patrol_point_id').getValue();
  950. var query = new Object();
  951. var spot_id = null;
  952. // var selected = sm1.getSelection( );
  953. for (var i = 0; i < AllSelectedRecords1.length; i++) {
  954. if (i == 0)
  955. spot_id = AllSelectedRecords1[i];
  956. else
  957. spot_id += "," + AllSelectedRecords1[i];
  958. }
  959. query.id = fm_patrol_point_id;
  960. query.equipment_code = spot_id;
  961. query.spot_name = fm_patrol_spot_name;
  962. query.company_code = fm_patrol_company_code;
  963. query.spot_address = fm_patrol_spot_address;
  964. // query.equipment_code = fm_patrol_equipment_code;
  965. query.spot_type = spot_type;
  966. query.remarks = fm_patrol_point_message;
  967. query.picture_route = patrol_point_uploadURL;
  968. query.V_LOGINNAME = V_LOGINNAME;
  969. // query.V_PASSWORD = V_PASSWORD;
  970. var jsonstr = Ext.JSON.encode(query);
  971. Ext.getCmp('fm_patrol_point_queryJson').setValue(jsonstr);
  972. Ext.getCmp('patrolUploadForm').submit({
  973. success: function (form, action) {
  974. // uploadPop.hide();
  975. Ext.getCmp('patrol_upload_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  976. Ext.getCmp('patrolUploadForm').getForm().reset();
  977. Ext.getCmp('patroladUploadForm').getForm().reset();
  978. // uploadPanel.getStore().reload();
  979. Ext.Msg.alert('系统提示', '保存成功!');
  980. clear_modify_form();
  981. },
  982. failure: function (form, action) {
  983. Ext.Msg.alert('系统提示', '保存失败!');
  984. clear_modify_form();
  985. }
  986. });
  987. this.up('window').hide();
  988. }
  989. }
  990. }
  991. }, {
  992. text: '取消',
  993. handler: function () {
  994. this.up('window').hide();
  995. Ext.getCmp('patrol_upload_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  996. Ext.getCmp('patrolUploadForm').getForm().reset();
  997. Ext.getCmp('patroladUploadForm').getForm().reset();
  998. Ext.getCmp('PatrolpointListPageToolbar').moveFirst();
  999. }
  1000. }]
  1001. });
  1002. var patroladdWin = Ext.create('Ext.window.Window', {
  1003. id: 'patroladdWin',
  1004. title: '增加巡检点位',
  1005. height: 600,
  1006. width: 800,
  1007. // maximizable: true,
  1008. modal: true,
  1009. closeAction: 'hide',
  1010. items: [
  1011. patroladdForm, patroladaddForm, MaintenanceCheckPanel2
  1012. ],
  1013. buttons: [
  1014. {
  1015. text: '保存',
  1016. handler: function () {
  1017. if (AllSelectedRecords.length == 1) {
  1018. var fa_patrol_spot_name = Ext.getCmp('fa_patrol_spot_name').getValue();
  1019. if(fa_patrol_spot_name == "" || fa_patrol_spot_name == null){
  1020. Ext.Msg.alert('系统提示', '点位名称不能为空!');
  1021. return;
  1022. }
  1023. var fa_patrol_company_code = Ext.getCmp('fa_patrol_company_code').getValue();
  1024. if(fa_patrol_company_code == "" || fa_patrol_company_code == null){
  1025. Ext.Msg.alert('系统提示', '请选择所属建筑/项目!');
  1026. return;
  1027. }
  1028. var fa_patrol_spot_address = Ext.getCmp('fa_patrol_spot_address').getValue();
  1029. if(fa_patrol_spot_address == "" || fa_patrol_spot_address == null){
  1030. Ext.Msg.alert('系统提示', '点位地址不能为空!');
  1031. return;
  1032. }
  1033. // var fa_patrol_equipment_code=Ext.getCmp('fa_patrol_equipment_code').getValue();
  1034. var fa_patrol_spot_type = Ext.getCmp('fa_patrol_spot_type').getChecked();
  1035. var spot_type = '';
  1036. Ext.Array.each(fa_patrol_spot_type, function (item) {
  1037. spot_type += item.inputValue + ',';
  1038. });
  1039. // var fa_patrol_spot_type = patroladdForm.getForm().findField("fa_patrol_spot_type").getGroupValue();
  1040. var fa_patrol_point_message = Ext.getCmp('fa_patrol_point_message').getValue();
  1041. var patrol_point_addURL = Ext.getCmp('patrol_point_addURL').getValue();
  1042. if (patrol_point_addURL == "" || patrol_point_addURL == null) {
  1043. Ext.Msg.alert('系统提示', '请上传图标' + fa_patrol_spot_type);
  1044. return;
  1045. }
  1046. var query = new Object();
  1047. query.spot_name = fa_patrol_spot_name;
  1048. query.company_code = fa_patrol_company_code;
  1049. query.spot_address = fa_patrol_spot_address;
  1050. // query.equipment_code = fa_patrol_equipment_code;
  1051. query.spot_type = spot_type;
  1052. query.remarks = fa_patrol_point_message;
  1053. query.picture_route = patrol_point_addURL;
  1054. query.equipment_code = AllSelectedRecords[0];
  1055. query.V_LOGINNAME = V_LOGINNAME;
  1056. // query.V_PASSWORD = V_PASSWORD;
  1057. var jsonstr = Ext.JSON.encode(query);
  1058. Ext.getCmp('fa_patrol_point_queryJson').setValue(jsonstr);
  1059. Ext.getCmp('patroladdForm').submit({
  1060. success: function (form, action) {
  1061. // addPop.hide();
  1062. Ext.getCmp('patrol_add_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  1063. Ext.getCmp('patroladdForm').getForm().reset();
  1064. Ext.getCmp('patroladaddForm').getForm().reset();
  1065. // uploadPanel.getStore().reload();
  1066. Ext.Msg.alert('系统提示', '保存成功!');
  1067. clear_append_form();
  1068. },
  1069. failure: function (form, action) {
  1070. Ext.Msg.alert('系统提示', '保存失败!');
  1071. clear_append_form();
  1072. }
  1073. });
  1074. } else {
  1075. if (AllSelectedRecords.length > 1) {
  1076. var fa_patrol_spot_name = Ext.getCmp('fa_patrol_spot_name').getValue();
  1077. var fa_patrol_company_code = Ext.getCmp('fa_patrol_company_code').getValue();
  1078. var fa_patrol_spot_address = Ext.getCmp('fa_patrol_spot_address').getValue();
  1079. // var fa_patrol_equipment_code=Ext.getCmp('fa_patrol_equipment_code').getValue();
  1080. // var fa_patrol_spot_type = patroladdForm.getForm().findField("fa_patrol_spot_type").getGroupValue();
  1081. var fa_patrol_spot_type = Ext.getCmp('fa_patrol_spot_type').getChecked();
  1082. var spot_type = '';
  1083. Ext.Array.each(fa_patrol_spot_type, function (item) {
  1084. spot_type += item.inputValue + ',';
  1085. });
  1086. var fa_patrol_point_message = Ext.getCmp('fa_patrol_point_message').getValue();
  1087. var patrol_point_addURL = Ext.getCmp('patrol_point_addURL').getValue();
  1088. if (patrol_point_addURL == "" || patrol_point_addURL == null) {
  1089. Ext.Msg.alert('系统提示', '请上传图标' + fa_patrol_spot_type);
  1090. return;
  1091. }
  1092. var query = new Object();
  1093. query.spot_name = fa_patrol_spot_name;
  1094. query.company_code = fa_patrol_company_code;
  1095. query.spot_address = fa_patrol_spot_address;
  1096. // query.equipment_code = fa_patrol_equipment_code;
  1097. query.spot_type = spot_type;
  1098. query.remarks = fa_patrol_point_message;
  1099. query.picture_route = patrol_point_addURL;
  1100. var spot_id = null;
  1101. // var selected = sm1.getSelection( );
  1102. for (var i = 0; i < AllSelectedRecords.length; i++) {
  1103. if (i == 0)
  1104. spot_id = AllSelectedRecords[i];
  1105. else
  1106. spot_id += "," + AllSelectedRecords[i];
  1107. }
  1108. query.equipment_code = spot_id;
  1109. query.V_LOGINNAME = V_LOGINNAME;
  1110. // query.V_PASSWORD = V_PASSWORD;
  1111. var jsonstr = Ext.JSON.encode(query);
  1112. Ext.getCmp('fa_patrol_point_queryJson').setValue(jsonstr);
  1113. Ext.getCmp('patroladdForm').submit({
  1114. // waitTitle: '系统提示',
  1115. // waitMsg: '保存中......',
  1116. success: function (form, action) {
  1117. // addPop.hide();
  1118. Ext.getCmp('patrol_add_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  1119. Ext.getCmp('patroladdForm').getForm().reset();
  1120. Ext.getCmp('patroladaddForm').getForm().reset();
  1121. // uploadPanel.getStore().reload();
  1122. Ext.Msg.alert('系统提示', '保存成功!');
  1123. clear_append_form();
  1124. },
  1125. failure: function (form, action) {
  1126. Ext.Msg.alert('系统提示', '保存失败!');
  1127. clear_append_form();
  1128. }
  1129. });
  1130. }
  1131. }
  1132. }
  1133. }, {
  1134. text: '取消',
  1135. handler: function () {
  1136. this.up('window').hide();
  1137. Ext.getCmp('patrol_add_picture').getEl().dom.src = '../../res/img/common/shangchaun.png';
  1138. Ext.getCmp('patroladdForm').getForm().reset();
  1139. Ext.getCmp('patroladaddForm').getForm().reset();
  1140. Ext.getCmp('PatrolpointListPageToolbar').moveFirst();
  1141. }
  1142. }]
  1143. });
  1144. var addhtml = function () {
  1145. var adaddFormhtml = document.getElementById('patroladaddForm');
  1146. var title = document.createElement('div');
  1147. title.setAttribute('class', 'Maintenancediv_title');
  1148. title.innerHTML = '点位图片:';
  1149. adaddFormhtml.appendChild(title);
  1150. }
  1151. var uploadhtml = function () {
  1152. var uploadFormhtml = document.getElementById('patroladUploadForm');
  1153. var title = document.createElement('div');
  1154. title.setAttribute('class', 'Maintenancediv_title');
  1155. title.innerHTML = '点位图片:';
  1156. uploadFormhtml.appendChild(title);
  1157. }
  1158. var uploadPop = function () {
  1159. patroluploadWin.show();
  1160. uploadhtml();
  1161. }
  1162. var addPop = function () {
  1163. AllSelectedRecords.length = 0;
  1164. var query = new Object();
  1165. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1166. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1167. var jsonstr = Ext.JSON.encode(query);
  1168. myStore2.getProxy().extraParams = {
  1169. queryJson: jsonstr
  1170. };
  1171. Ext.getCmp('PatrolCheckListPageToolbar2').moveFirst();
  1172. patroladdWin.show();
  1173. addhtml();
  1174. }
  1175. var chk_sm = function () {
  1176. if (sm.getCount() == 1) {
  1177. var selected = sm.getSelection();
  1178. var b = selected[0].raw.equipment_code_list;
  1179. AllSelectedRecords1 = b.split(",");
  1180. getManufacturerId2.reload();
  1181. var div = Ext.getCmp('fm_patrol_company_code');
  1182. var label = selected[0].raw.id
  1183. var query = new Object();
  1184. // if(label.length>0){
  1185. query.dwid = label;
  1186. // }
  1187. query.building_id = selected[0].raw.company_code;
  1188. query.V_LOGINNAME = V_LOGINNAME;
  1189. // query.V_PASSWORD = V_PASSWORD;
  1190. var jsonstr = Ext.JSON.encode(query);
  1191. myStore3.getProxy().extraParams = {
  1192. queryJson: jsonstr
  1193. };
  1194. Ext.getCmp('PatrolCheckListPageToolbar3').moveFirst();
  1195. uploadPop();
  1196. Ext.getCmp('fm_patrol_point_id').setValue(selected[0].raw.id);
  1197. Ext.getCmp('fm_patrol_spot_name').setValue(selected[0].raw.spot_name);
  1198. div.setValue(selected[0].raw.company_code);
  1199. Ext.getCmp('fm_patrol_spot_address').setValue(selected[0].raw.spot_address);
  1200. var a = selected[0].raw.spot_type;
  1201. // if(Number(a) ==1){
  1202. // var radio = Ext.getCmp('radio81');
  1203. // radio.setValue(true);
  1204. // }else if(Number(a)==2){
  1205. // var radio = Ext.getCmp('radio82');
  1206. // radio.setValue(true);
  1207. // }else if(Number(a)==3){
  1208. // var radio = Ext.getCmp('radio83');
  1209. // radio.setValue(true);
  1210. // }else if(Number(a)==4){
  1211. // var radio = Ext.getCmp('radio84');
  1212. // radio.setValue(true);
  1213. // }else if(Number(a)==5){
  1214. // var radio = Ext.getCmp('radio85');
  1215. // radio.setValue(true);
  1216. // }else if(Number(a)==6){
  1217. // var radio = Ext.getCmp('radio86');
  1218. // radio.setValue(true);
  1219. // }else if(Number(a)==7){
  1220. // var radio = Ext.getCmp('radio87');
  1221. // radio.setValue(true);
  1222. // }
  1223. var arr = a.split(",");
  1224. for (var i = 0; i < arr.length; i++) {
  1225. switch (arr[i]) {
  1226. case "1":
  1227. Ext.getCmp('radio81').setValue(true);
  1228. break;
  1229. case "2":
  1230. Ext.getCmp('radio82').setValue(true);
  1231. break;
  1232. case "3":
  1233. Ext.getCmp('radio83').setValue(true);
  1234. break;
  1235. case "4":
  1236. Ext.getCmp('radio84').setValue(true);
  1237. break;
  1238. case "5":
  1239. Ext.getCmp('radio85').setValue(true);
  1240. break;
  1241. case "6":
  1242. Ext.getCmp('radio86').setValue(true);
  1243. break;
  1244. case "7":
  1245. Ext.getCmp('radio87').setValue(true);
  1246. break;
  1247. }
  1248. }
  1249. Ext.getCmp('fm_patrol_point_message').setValue(selected[0].raw.remarks);
  1250. Ext.getCmp('patrol_point_uploadURL').setValue(selected[0].raw.picture_route);
  1251. var formPanel = Ext.getCmp('patroladUploadForm');
  1252. var imageShow_box = formPanel.down('box[id=patrol_upload_picture]');//预览的图片框对象
  1253. var imageShow_box_dom = imageShow_box.getEl().dom;
  1254. imageShow_box_dom.src = baseUrl + (selected[0].raw.picture_route);
  1255. } else {
  1256. Ext.Msg.alert('请先选择', '请先选择一条记录,再点击修改');
  1257. }
  1258. }
  1259. var del_sm = function () {
  1260. if (sm.getCount() == 1) {
  1261. var selected = sm.getSelection();
  1262. var query = new Object();
  1263. var list = new Array();
  1264. var o = new Object();
  1265. o.id = selected[0].raw.id;
  1266. list.push(o);
  1267. query.ID_LIST = list;
  1268. var jsonstr = Ext.JSON.encode(query);
  1269. Ext.MessageBox.confirm('删除巡检点位', '是否删除' + selected[0].raw.spot_name + ' 巡检点位?', function (btn) {
  1270. if (btn == 'yes') {
  1271. $.ajax({
  1272. type: 'POST',
  1273. url: baseUrl + "iot/inspectionpoints/del",
  1274. data: {
  1275. queryJson: jsonstr
  1276. },
  1277. success: function (result) {
  1278. var json = eval('(' + result + ')');
  1279. if (json.action == 'deleteInspectionPoints') {
  1280. if (json.success == true) {
  1281. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  1282. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1283. });
  1284. } else {
  1285. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  1286. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1287. });
  1288. }
  1289. }
  1290. }
  1291. });
  1292. }
  1293. }, this);
  1294. } else {
  1295. if (sm.getCount() > 1) {
  1296. var query = new Object();
  1297. var list = new Array();
  1298. for (var i = 0; i < sm.getCount(); i++) {
  1299. var selected = sm.getSelection();
  1300. var o = new Object();
  1301. o.id = selected[i].raw.id;
  1302. list.push(o);
  1303. }
  1304. query.ID_LIST = list;
  1305. var jsonstr = Ext.JSON.encode(query);
  1306. Ext.MessageBox.confirm('删除巡检点位', '是否删除选中的' + sm.getCount() + ' 个巡检点位?', function (btn) {
  1307. if (btn == 'yes') {
  1308. $.ajax({
  1309. type: 'POST',
  1310. url: baseUrl + "iot/inspectionpoints/del",
  1311. data: {
  1312. queryJson: jsonstr
  1313. },
  1314. success: function (result) {
  1315. var json = eval('(' + result + ')');
  1316. if (json.action == 'deleteInspectionPoints') {
  1317. if (json.success == true) {
  1318. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  1319. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1320. });
  1321. } else {
  1322. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  1323. Ext.getCmp('PatrolpointListPanel').getStore().reload();
  1324. });
  1325. }
  1326. }
  1327. }
  1328. });
  1329. }
  1330. }, this);
  1331. } else {
  1332. Ext.Msg.alert('请先选择', '至少选择一条记录,再点击删除');
  1333. }
  1334. }
  1335. }
  1336. var show_page = function () {
  1337. var patrolpoint_title2_input = document.getElementById('patrolpoint_title2_input').value;
  1338. var patrolpoint_title3_input1 = document.getElementById('patrolpoint_title3_input1').value;
  1339. var query = new Object();
  1340. if (patrolpoint_title2_input.length > 0) {
  1341. query.spot_name = patrolpoint_title2_input;
  1342. $("#spot_name").val(patrolpoint_title2_input);
  1343. }
  1344. if (patrolpoint_title3_input1.length > 0) {
  1345. query.spot_address = patrolpoint_title3_input1;
  1346. $("#spot_address").val(patrolpoint_title3_input1);
  1347. }
  1348. query.V_LOGINNAME = V_LOGINNAME;
  1349. // query.V_PASSWORD = V_PASSWORD;
  1350. var jsonstr = Ext.JSON.encode(query);
  1351. myStore.getProxy().extraParams = {
  1352. queryJson: jsonstr
  1353. };
  1354. Ext.getCmp('PatrolpointListPageToolbar').moveFirst();
  1355. }
  1356. var reset1 = function () {
  1357. document.getElementById('patrolpoint_title2_input').value = '';
  1358. document.getElementById('patrolpoint_title3_input1').value = '';
  1359. $("#spot_name").val("");
  1360. $("#spot_address").val("");
  1361. show_page();
  1362. }
  1363. mouseon = function (obj) {
  1364. var id = obj.id;
  1365. $("#" + id).removeClass(id);
  1366. $("#" + id).addClass(id + '_on');
  1367. }
  1368. mouseoff = function (obj) {
  1369. var mid = "patrolpoint_";
  1370. for (var i = 1; i < 7; i++) {
  1371. var id = "patrolpoint_title" + i + "_div";
  1372. $("#" + id).removeClass(id + '_on');
  1373. $("#" + id).addClass(id);
  1374. }
  1375. if (menuidx == 'm1') {
  1376. mid += 'title1_div';
  1377. $("#" + mid).removeClass(mid);
  1378. $("#" + mid).addClass(mid + '_on');
  1379. }
  1380. else if (menuidx == 'm2') {
  1381. mid += 'title2_div';
  1382. $("#" + mid).removeClass(mid);
  1383. $("#" + mid).addClass(mid + '_on');
  1384. }
  1385. else if (menuidx == 'm3') {
  1386. mid += 'title3_div';
  1387. $("#" + mid).removeClass(mid);
  1388. $("#" + mid).addClass(mid + '_on');
  1389. }
  1390. else if (menuidx == 'm4') {
  1391. mid += 'title4_div';
  1392. $("#" + mid).removeClass(mid);
  1393. $("#" + mid).addClass(mid + '_on');
  1394. }
  1395. else if (menuidx == 'm5') {
  1396. mid += 'title5_div';
  1397. $("#" + mid).removeClass(mid);
  1398. $("#" + mid).addClass(mid + '_on');
  1399. }
  1400. else if (menuidx == 'm6') {
  1401. mid += 'title6_div';
  1402. $("#" + mid).removeClass(mid);
  1403. $("#" + mid).addClass(mid + '_on');
  1404. }
  1405. }
  1406. menu_click = function (obj) {
  1407. var id = obj.id;
  1408. if (id == 'patrolpoint_title1_div') {
  1409. menuidx = 'm1';
  1410. show_page();
  1411. }
  1412. else if (id == 'patrolpoint_title2_div') {
  1413. menuidx = 'm2';
  1414. reset1();
  1415. }
  1416. else if (id == 'patrolpoint_title3_div') {
  1417. menuidx = 'm3';
  1418. exportbtn_click();
  1419. }
  1420. else if (id == 'patrolpoint_title4_div') {
  1421. menuidx = 'm4';
  1422. del_sm();
  1423. }
  1424. else if (id == 'patrolpoint_title5_div') {
  1425. menuidx = 'm5';
  1426. addPop();
  1427. }
  1428. else if (id == 'patrolpoint_title6_div') {
  1429. menuidx = 'm6';
  1430. chk_sm();
  1431. }
  1432. }
  1433. var piedarHtml = function () {
  1434. var maintenanceHtml = document.getElementById('patrolpointHtml');
  1435. var title = document.createElement('div');
  1436. title.setAttribute('class', 'MaintenancePersonTitle');
  1437. title.innerHTML = '巡检点位';
  1438. maintenanceHtml.appendChild(title);
  1439. var title2 = document.createElement('div');
  1440. title2.setAttribute('class', 'title2_div');
  1441. title2.innerHTML = '点位名称';
  1442. maintenanceHtml.appendChild(title2);
  1443. var input = document.createElement('input');
  1444. input.setAttribute('class', 'input_class');
  1445. input.setAttribute('id', 'patrolpoint_title2_input');
  1446. input.setAttribute('type', 'text');
  1447. input.setAttribute('value', '');
  1448. maintenanceHtml.appendChild(input);
  1449. var title3 = document.createElement('div');
  1450. title3.setAttribute('class', 'title3_div');
  1451. title3.innerHTML = '点位地址';
  1452. maintenanceHtml.appendChild(title3);
  1453. var input1 = document.createElement('input');
  1454. input1.setAttribute('class', 'input1_class');
  1455. input1.setAttribute('id', 'patrolpoint_title3_input1');
  1456. input1.setAttribute('type', 'text');
  1457. input1.setAttribute('value', '');
  1458. maintenanceHtml.appendChild(input1);
  1459. var title4 = document.createElement('div');
  1460. title4.setAttribute('class', 'patrolpoint_title1_div');
  1461. title4.setAttribute('id', 'patrolpoint_title1_div');
  1462. title4.setAttribute('onmouseover', "mouseon(this)");
  1463. title4.setAttribute('onmouseout', "mouseoff(this)");
  1464. title4.setAttribute('onclick', "menu_click(this)");
  1465. maintenanceHtml.appendChild(title4);
  1466. var title5 = document.createElement('div');
  1467. title5.setAttribute('class', 'patrolpoint_title2_div');
  1468. title5.setAttribute('id', 'patrolpoint_title2_div');
  1469. title5.setAttribute('onmouseover', "mouseon(this)");
  1470. title5.setAttribute('onmouseout', "mouseoff(this)");
  1471. title5.setAttribute('onclick', "menu_click(this)");
  1472. maintenanceHtml.appendChild(title5);
  1473. var title6 = document.createElement('div');
  1474. title6.setAttribute('class', 'patrolpoint_title3_div');
  1475. title6.setAttribute('id', 'patrolpoint_title3_div');
  1476. title6.setAttribute('onmouseover', "mouseon(this)");
  1477. title6.setAttribute('onmouseout', "mouseoff(this)");
  1478. title6.setAttribute('onclick', "menu_click(this)");
  1479. maintenanceHtml.appendChild(title6);
  1480. var title7 = document.createElement('div');
  1481. title7.setAttribute('class', 'patrolpoint_title4_div');
  1482. title7.setAttribute('id', 'patrolpoint_title4_div');
  1483. title7.setAttribute('onmouseover', "mouseon(this)");
  1484. title7.setAttribute('onmouseout', "mouseoff(this)");
  1485. title7.setAttribute('onclick', "menu_click(this)");
  1486. maintenanceHtml.appendChild(title7);
  1487. var title8 = document.createElement('div');
  1488. title8.setAttribute('class', 'patrolpoint_title5_div');
  1489. title8.setAttribute('id', 'patrolpoint_title5_div');
  1490. title8.setAttribute('onmouseover', "mouseon(this)");
  1491. title8.setAttribute('onmouseout', "mouseoff(this)");
  1492. title8.setAttribute('onclick', "menu_click(this)");
  1493. maintenanceHtml.appendChild(title8);
  1494. var title9 = document.createElement('div');
  1495. title9.setAttribute('class', 'patrolpoint_title6_div');
  1496. title9.setAttribute('id', 'patrolpoint_title6_div');
  1497. title9.setAttribute('onmouseover', "mouseon(this)");
  1498. title9.setAttribute('onmouseout', "mouseoff(this)");
  1499. title9.setAttribute('onclick', "menu_click(this)");
  1500. maintenanceHtml.appendChild(title9);
  1501. }
  1502. var saveFile = function (data, filename) {
  1503. var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
  1504. save_link.href = data;
  1505. save_link.download = filename;
  1506. var event = document.createEvent('MouseEvents');
  1507. event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  1508. save_link.dispatchEvent(event);
  1509. }
  1510. var downPng = function (canvas) {
  1511. console.log(canvas);
  1512. var img_data1 = Canvas2Image.saveAsPNG(canvas, true).getAttribute('src');
  1513. saveFile(img_data1, 'richer.png');
  1514. }
  1515. var cutDiv = function () {
  1516. var content = document.getElementById("patrolpoint_div_ceshi");
  1517. html2canvas(content, {
  1518. onrendered: function (canvas) {
  1519. downPng(canvas);
  1520. }
  1521. });
  1522. }
  1523. var maintenancelabel = function () {
  1524. var maintenance_look_label = document.getElementById('patrolpoint_look_label');
  1525. var div3 = document.createElement('div');
  1526. div3.setAttribute('id', 'patrolpoint_div_ceshi');
  1527. maintenance_look_label.appendChild(div3);
  1528. var div7 = document.createElement('div');
  1529. div7.style.width = '100%';
  1530. div7.style.height = '130px';
  1531. div7.style.textAlign = 'center';
  1532. div7.style.verticalAlign = 'middle';
  1533. div7.style.background = '#fff';
  1534. div7.setAttribute('id', 'patrolpoint_div_ceshi7');
  1535. div3.appendChild(div7);
  1536. var span = document.createElement('span');
  1537. span.style.height = '100%';
  1538. span.style.display = 'inline-block';
  1539. span.style.verticalAlign = 'middle';
  1540. div7.appendChild(span);
  1541. var img = document.createElement('img');
  1542. img.width = 110;
  1543. img.height = 100;
  1544. img.style.verticalAlign = 'middle';
  1545. // img.src = "../../tp/57988c26-20fd-4782-ac99-3aec6cb4d7ce.png";
  1546. img.src = baseUrl + ConfirmStore[0].spot_label_route;
  1547. div7.appendChild(img);
  1548. var div8 = document.createElement('div');
  1549. div8.style.width = '100%';
  1550. div8.style.height = '130px';
  1551. div8.style.background = '#0082fe';
  1552. div8.setAttribute('id', 'patrolpoint_div_ceshi8');
  1553. div3.appendChild(div8);
  1554. var div4 = document.createElement('div');
  1555. div4.style.textAlign = 'left';
  1556. div4.style.color = '#000';
  1557. div4.innerHTML = '点位名称:' + ConfirmStore[0].spot_name;
  1558. div8.appendChild(div4);
  1559. var div5 = document.createElement('div');
  1560. div5.style.textAlign = 'left';
  1561. div5.style.color = '#000';
  1562. div5.innerHTML = '点位地址:' + ConfirmStore[0].spot_address;
  1563. div8.appendChild(div5);
  1564. var div6 = document.createElement('div');
  1565. div6.style.textAlign = 'left';
  1566. div6.style.color = '#000';
  1567. div6.innerHTML = '点位编号:' + ConfirmStore[0].spot_label_analysis;
  1568. div8.appendChild(div6);
  1569. }
  1570. var editRow = function (spot_id) {
  1571. var spot_id = spot_id;
  1572. Ext.create('Ext.window.Window', {
  1573. id: 'patrolpoint_data_win',
  1574. height: 300,
  1575. width: 250,
  1576. layout: 'fit',
  1577. modal: true,
  1578. buttons: [
  1579. {
  1580. text: '下载',
  1581. handler: function () {
  1582. cutDiv();
  1583. }
  1584. }, {
  1585. text: '关闭',
  1586. handler: function () {
  1587. Ext.getCmp('patrolpoint_data_win').destroy();
  1588. }
  1589. }
  1590. ],
  1591. closeAction: 'destroy',
  1592. html: '<div id="patrolpoint_look_label"></div>'
  1593. }).show();
  1594. var query = new Object();
  1595. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1596. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1597. query.id = spot_id;
  1598. $.ajax({
  1599. type: 'POST',
  1600. url: baseUrl + "iot/inspectionpoints/getList1",
  1601. data: {
  1602. queryJson: Ext.JSON.encode(query)
  1603. },
  1604. success: function (result) {
  1605. var json = eval('(' + result + ')');
  1606. if (json.action == 'getInspectionPointsList') {
  1607. ConfirmStore = json.RESULT;
  1608. maintenancelabel(ConfirmStore);
  1609. }
  1610. }
  1611. });
  1612. }
  1613. var maintenancedevice = function () {
  1614. var maintenance_look_device = document.getElementById('patrolpoint_look_device');
  1615. var div7 = document.createElement('div');
  1616. div7.style.width = '400px';
  1617. div7.style.height = '400px';
  1618. div7.style.textAlign = 'center';
  1619. div7.style.verticalAlign = 'middle';
  1620. // div7.style.background='#fff';
  1621. div7.setAttribute('id', 'patrolpoint_div_ceshi10');
  1622. maintenance_look_device.appendChild(div7);
  1623. if (ConfirmStore[0].picture_route) {
  1624. var img = document.createElement('img');
  1625. img.width = 400;
  1626. img.height = 400;
  1627. img.src = baseUrl + ConfirmStore[0].picture_route;
  1628. img.setAttribute('class', 'maintenance_look_device_img');
  1629. div7.appendChild(img);
  1630. } else {
  1631. var span = document.createElement('span');
  1632. span.style.height = '100%';
  1633. span.style.display = 'inline-block';
  1634. span.style.verticalAlign = 'middle';
  1635. div7.appendChild(span);
  1636. var img = document.createElement('img');
  1637. img.width = 110;
  1638. img.height = 110;
  1639. img.style.verticalAlign = 'middle';
  1640. img.src = '../../res/img/common/shangchaun.png';
  1641. img.setAttribute('class', 'maintenance_look_device_img');
  1642. img.setAttribute('onclick', "menu_click(this)");
  1643. div7.appendChild(img);
  1644. }
  1645. var div4 = document.createElement('div');
  1646. div4.style.textAlign = 'center';
  1647. div4.innerHTML = ConfirmStore[0].remarks;
  1648. maintenance_look_device.appendChild(div4);
  1649. }
  1650. var editMaintenance = function (spot_id) {
  1651. var spot_id = spot_id;
  1652. Ext.create('Ext.window.Window', {
  1653. id: 'patrolpoint_data_win1',
  1654. height: 500,
  1655. width: 400,
  1656. layout: 'fit',
  1657. modal: true,
  1658. buttons: [
  1659. {
  1660. text: '关闭',
  1661. handler: function () {
  1662. Ext.getCmp('patrolpoint_data_win1').destroy();
  1663. }
  1664. }
  1665. ],
  1666. closeAction: 'destroy',
  1667. html: '<div id="patrolpoint_look_device"></div>'
  1668. }).show();
  1669. var query = new Object();
  1670. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1671. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1672. query.id = spot_id;
  1673. $.ajax({
  1674. type: 'POST',
  1675. url: baseUrl + "iot/inspectionpoints/getList1",
  1676. data: {
  1677. queryJson: Ext.JSON.encode(query)
  1678. },
  1679. success: function (result) {
  1680. var json = eval('(' + result + ')');
  1681. if (json.action == 'getInspectionPointsList') {
  1682. ConfirmStore = json.RESULT;
  1683. maintenancedevice(ConfirmStore);
  1684. }
  1685. }
  1686. });
  1687. }
  1688. var MaintenancePanel = Ext.create('Ext.grid.Panel', {
  1689. header: {
  1690. height: 0,
  1691. border: '0px solid #000000'
  1692. },
  1693. id: 'PatrolpointListPanel',
  1694. store: myStore,
  1695. selModel: sm,
  1696. columns: [
  1697. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1698. { header: 'equipment_code_list', dataIndex: 'equipment_code_list', hidden: true, menuDisabled: true },
  1699. { header: '图片路径', dataIndex: 'picture_route', hidden: true, menuDisabled: true },
  1700. { header: '序号', dataIndex: 'xh', width: 37, menuDisabled: true },
  1701. { header: '点位名称', dataIndex: 'spot_name', width: 300, align: 'center', menuDisabled: true },
  1702. // { header: '所属建筑/项目', dataIndex: 'building_name', width:300,align:'center', menuDisabled:true },
  1703. {
  1704. text: '点位标签',
  1705. xtype: 'actioncolumn',
  1706. width: 150,
  1707. sortable: false,
  1708. align: 'center',
  1709. menuDisabled: true,
  1710. items: [{
  1711. icon: '../../res/img/common/chakanbtn.png',
  1712. tooltip: '点位标签',
  1713. handler: function (grid, rowIndex, colIndex) {
  1714. var rec = grid.getStore().getAt(rowIndex);
  1715. editRow(rec.get("id"));
  1716. }
  1717. }]
  1718. },
  1719. { header: '点位地址', dataIndex: 'spot_address', width: 300, align: 'center', menuDisabled: true },
  1720. {
  1721. text: '对应对象',
  1722. xtype: 'actioncolumn',
  1723. width: 150,
  1724. sortable: false,
  1725. align: 'center',
  1726. menuDisabled: true,
  1727. items: [{
  1728. icon: '../../res/img/common/chakanbtn.png',
  1729. tooltip: '对应对象',
  1730. handler: function (grid, rowIndex, colIndex) {
  1731. var rec = grid.getStore().getAt(rowIndex);
  1732. // $("#checkRecord_id").val(rec.get("id"));
  1733. modifywin(rec.get("id"));
  1734. var label = rec.get("id");
  1735. var query = new Object();
  1736. // alert(label);
  1737. if (label.length > 0) {
  1738. query.id = label;
  1739. }
  1740. query.V_LOGINNAME = V_LOGINNAME;
  1741. // query.V_PASSWORD = V_PASSWORD;
  1742. var jsonstr = Ext.JSON.encode(query);
  1743. myStore1.getProxy().extraParams = {
  1744. queryJson: jsonstr
  1745. };
  1746. myStore1.reload();
  1747. }
  1748. }]
  1749. },
  1750. // { header: '设备类型', dataIndex: 'type_name',width:100, align:'center', menuDisabled:true },
  1751. { header: '最新改动时间', dataIndex: 'latest_change_time', width: 350, align: 'center', menuDisabled: true },
  1752. { header: '备注', dataIndex: 'remarks', hidden: true, menuDisabled: true },
  1753. { header: '类型值', dataIndex: 'spot_type', hidden: true, menuDisabled: true },
  1754. {
  1755. text: '点位详情',
  1756. xtype: 'actioncolumn',
  1757. width: 150,
  1758. sortable: false,
  1759. align: 'center',
  1760. menuDisabled: true,
  1761. items: [{
  1762. icon: '../../res/img/common/tupianbtn.png',
  1763. tooltip: '点位详情',
  1764. handler: function (grid, rowIndex, colIndex) {
  1765. var rec = grid.getStore().getAt(rowIndex);
  1766. editMaintenance(rec.get("id"));
  1767. }
  1768. }]
  1769. }
  1770. ],
  1771. columnLines: true,
  1772. height: maxHeight,
  1773. width: '100%',
  1774. bbar: new Ext.PagingToolbar({
  1775. store: myStore,
  1776. id: 'PatrolpointListPageToolbar',
  1777. displayInfo: true,
  1778. pageSize: countPerPage,
  1779. prependButtons: true,
  1780. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1781. emptyMsg: "没有记录",
  1782. firstText: '第一页',
  1783. prevText: '前一页',
  1784. nextText: '后一页',
  1785. lastText: '最后一页',
  1786. refreshText: '刷新',
  1787. }),
  1788. // frame: true,
  1789. border: false,
  1790. iconCls: 'icon-grid',
  1791. });
  1792. MaintenanceCheckPanel1 = Ext.create('Ext.grid.Panel', {
  1793. header: {
  1794. height: 0,
  1795. border: '0px solid #000000'
  1796. },
  1797. id: 'PatrolCheckListPanel1',
  1798. store: myStore1,
  1799. // selModel: sm1,
  1800. columns: [
  1801. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1802. { header: '点位ID', dataIndex: 'spot_id', hidden: true, menuDisabled: true },
  1803. { header: '设备编号', dataIndex: 'equipment_code', hidden: true, menuDisabled: true },
  1804. { header: '序号', dataIndex: 'xh', width: 48, align: 'center', menuDisabled: true },
  1805. { header: '设备名称', dataIndex: 'device_name', width: 150, align: 'center', menuDisabled: true },
  1806. { header: '设备地址', dataIndex: 'unitinfo', width: 150, align: 'center', menuDisabled: true },
  1807. {
  1808. text: '设备详情',
  1809. xtype: 'actioncolumn',
  1810. width: 150,
  1811. sortable: false,
  1812. align: 'center',
  1813. menuDisabled: true,
  1814. items: [{
  1815. icon: '../../res/img/common/tupianbtn.png',
  1816. tooltip: '设备详情',
  1817. handler: function (grid, rowIndex, colIndex) {
  1818. var rec = grid.getStore().getAt(rowIndex);
  1819. // alert(rec.get("dwid"));
  1820. editMaintenance(rec.get("spot_id"));
  1821. }
  1822. }]
  1823. }
  1824. ],
  1825. columnLines: true,
  1826. height: 380,
  1827. width: 490,
  1828. bbar: new Ext.PagingToolbar({
  1829. store: myStore1,
  1830. id: 'PatrolCheckListPageToolbar1',
  1831. displayInfo: true,
  1832. pageSize: 10,
  1833. prependButtons: true,
  1834. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1835. emptyMsg: "没有记录",
  1836. firstText: '第一页',
  1837. prevText: '前一页',
  1838. nextText: '后一页',
  1839. lastText: '最后一页',
  1840. refreshText: '刷新',
  1841. }),
  1842. // frame: true,
  1843. border: false,
  1844. iconCls: 'icon-grid'
  1845. });
  1846. modifywin1 = Ext.create('Ext.window.Window', {
  1847. title: '<div id="patrol_upload_win">对应对象</div>',
  1848. id: 'patrol_point_modify_win1',
  1849. height: 450,
  1850. width: 510,
  1851. modal: true,
  1852. layout: 'fit',
  1853. items: [MaintenanceCheckPanel1],
  1854. buttons: [
  1855. {
  1856. text: '关闭',
  1857. handler: function () {
  1858. Ext.getCmp('patrol_point_modify_win1').close();
  1859. }
  1860. }
  1861. ],
  1862. closeAction: 'hide'
  1863. })
  1864. var modifywin = function () {
  1865. modifywin1.show();
  1866. }
  1867. var piebar = Ext.create('Ext.panel.Panel', {
  1868. id: 'patrolpointHtml',
  1869. width: '100%',
  1870. height: 188,
  1871. region: 'north',
  1872. layout: 'form',
  1873. defaults: {
  1874. border: false
  1875. }
  1876. });
  1877. new Ext.create('Ext.panel.Panel', {
  1878. width: '100%',
  1879. id: 'PatrolpointPiebar',
  1880. layout: 'border',
  1881. items: [
  1882. piebar, MaintenancePanel
  1883. ],
  1884. renderTo: Ext.getBody()
  1885. });
  1886. myStore.reload();
  1887. $(window).resize(function () {
  1888. body_resize();
  1889. });
  1890. piedarHtml();
  1891. body_resize();
  1892. });