inspectors.js 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718
  1. /**
  2. * inspectors.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 myStore2 = null;
  21. var V_LOGINNAME = '', V_PASSWORD = '';
  22. var menuidx = '';
  23. var mouseon;
  24. var mouseoff;
  25. var mouseon1;
  26. var mouseoff1;
  27. var menu_click;
  28. var panel1;
  29. var panel2;
  30. var changeon1;
  31. var sm = Ext.create('Ext.selection.CheckboxModel');
  32. var addsm = Ext.create('Ext.selection.CheckboxModel', {
  33. handleMouseDown: Ext.emptyFn,
  34. singleSelect: false
  35. });
  36. var sm1 = Ext.create('Ext.selection.CheckboxModel', {
  37. injectCheckbox: 1,//checkbox位于哪一列,默认值为0
  38. mode: 'single',//multi,simple,single;默认为多选multi
  39. // checkOnly:true,//如果值为true,则只用点击checkbox列才能选中此条记录
  40. allowDeselect: true,//如果值true,并且mode值为单选(single)时,可以通过点击checkbox取消对其的选择
  41. enableKeyNav: false,
  42. listeners: {
  43. deselect: function (model, record, index) {//取消选中时产生的事件
  44. }
  45. }
  46. });
  47. Ext.define('MaintenancePerson', {
  48. extend: 'Ext.data.Model',
  49. fields: [
  50. { name: 'id', type: 'string' },
  51. { name: 'name', type: 'string' },
  52. { name: 'phone', type: 'string' },
  53. { name: 'zn_name', type: 'string' },
  54. { name: 'xh', type: 'int' },
  55. ]
  56. });
  57. Ext.define('MaintenancePerson1', {
  58. extend: 'Ext.data.Model',
  59. fields: [
  60. { name: 'rid', type: 'int' },
  61. { name: 'xh', type: 'int' },
  62. { name: 'name', type: 'string' },
  63. { name: 'tdid', type: 'string' },
  64. { name: 'pd', type: 'int' },
  65. // {name:'zrr', type:'string'},
  66. ]
  67. });
  68. Ext.define('MaintenancePerson2', {
  69. extend: 'Ext.data.Model',
  70. fields: [
  71. { name: 'id', type: 'string' },
  72. { name: 'xh', type: 'int' },
  73. { name: 'team_name', type: 'string' },
  74. { name: 'person_liable_id', type: 'string' },
  75. ]
  76. });
  77. function exportbtn_click() {
  78. baseUrl = document.getElementById('basePath').value;
  79. V_LOGINNAME = $("#V_LOGINNAME").val();
  80. V_PASSWORD = $("#V_PASSWORD").val();
  81. name = document.getElementById('name').value;
  82. zn = document.getElementById('zn').value;
  83. // zn_name = document.getElementById('zn_name').value;
  84. var fields = '';
  85. var array = ['id', 'xh', 'name', 'phone', 'zn_name'];
  86. var excelname = ['ID', '序号', '姓名', '手机号', '职务'];
  87. for (var i = 0; i < 5; i++) {
  88. if (i > 0)
  89. fields += ',';
  90. fields += '{id:"' + array[i] + '",title:"' + excelname[i] + '",shown:"' + true + '"}';
  91. }
  92. var query = new Object();
  93. // query.V_LOGINNAME = V_LOGINNAME;
  94. // query.V_PASSWORD = V_PASSWORD;
  95. query.name = name;
  96. query.zn = zn;
  97. query.EXPORT_FILE = '维保人列表';
  98. query.fields = '[' + fields + ']';
  99. $.ajax({
  100. type: 'POST',
  101. url: baseUrl + "iot/excel/view/XjInspectorsExcel",
  102. data: {
  103. queryJson: Ext.JSON.encode(query)
  104. },
  105. success: function (result) {
  106. var json = eval('(' + result + ')');
  107. if (json.action == 'dormExport') {
  108. ConfirmStore = json.RESULT;
  109. var elemIF = document.createElement("iframe");
  110. elemIF.src = baseUrl + json.filename;
  111. elemIF.style.display = "none";
  112. document.body.appendChild(elemIF);
  113. }
  114. }
  115. });
  116. }
  117. var body_resize = function () {
  118. maxHeight = document.documentElement.clientHeight;
  119. maxHeight -= 34;
  120. maxWidth = document.documentElement.clientWidth;
  121. Ext.getCmp('InspectorsPiebar').setHeight(maxHeight);
  122. Ext.getCmp('InspectorsPiebar').setWidth(maxWidth);
  123. }
  124. var body_resize1 = function () {
  125. maxHeight = document.documentElement.clientHeight;
  126. maxHeight -= 34;
  127. maxWidth = document.documentElement.clientWidth;
  128. Ext.getCmp('InspectorsPiebar2').setHeight(maxHeight);
  129. Ext.getCmp('InspectorsPiebar2').setWidth(maxWidth);
  130. }
  131. Ext.onReady(function () {
  132. var baseUrl = document.getElementById('basePath').value;
  133. var theme = document.getElementById('theme').value;
  134. var chkIcon = '<img src="' + baseUrl + 'res/img/common/check.gif"/>'
  135. var unchkIcon = '<img src="' + baseUrl + 'res/img/common/uncheck.gif"/>'
  136. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  137. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  138. V_LOGINNAME = $("#V_LOGINNAME").val();
  139. V_PASSWORD = $("#V_PASSWORD").val();
  140. var countPerPage = 15;
  141. var maxHeight = 10000;
  142. var chkBoolean = function (flag) {
  143. if (flag)
  144. return chkIcon;
  145. return unchkIcon;
  146. }
  147. var queryJson = new Object();
  148. queryJson.V_LOGINNAME = V_LOGINNAME;
  149. // queryJson.V_PASSWORD = V_PASSWORD;
  150. // queryJson.COMMSTATUS = 'NO';
  151. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  152. queryJson.company_code = company_code;
  153. var clear_append_form1 = function () {
  154. Ext.getCmp('fa_Inspectors_team_name').setValue("");
  155. Ext.getCmp('fa_Inspectors_person_liable_id').setValue("");
  156. Ext.getCmp('InspectorsListPageToolbar2').moveFirst();
  157. }
  158. myStore = Ext.create('Ext.data.Store', {
  159. model: 'MaintenancePerson',
  160. pageSize: countPerPage,
  161. proxy: {
  162. type: 'ajax',
  163. actionMethods: {
  164. create: 'POST',
  165. read: 'POST', // by default GET
  166. update: 'POST',
  167. destroy: 'POST'
  168. },
  169. url: baseUrl + 'iot/inspectorsx/getList',
  170. reader: {
  171. type: 'json',
  172. root: 'RESULT',
  173. totalProperty: 'totalCount'
  174. },
  175. extraParams: {
  176. queryJson: Ext.JSON.encode(queryJson)
  177. }
  178. },
  179. remoteSort: true
  180. });
  181. myStore2 = Ext.create('Ext.data.Store', {
  182. model: 'MaintenancePerson2',
  183. pageSize: countPerPage,
  184. proxy: {
  185. type: 'ajax',
  186. actionMethods: {
  187. create: 'POST',
  188. read: 'POST', // by default GET
  189. update: 'POST',
  190. destroy: 'POST'
  191. },
  192. url: baseUrl + 'iot/planteam/getList1',
  193. reader: {
  194. type: 'json',
  195. root: 'RESULT',
  196. totalProperty: 'totalCount'
  197. },
  198. extraParams: {
  199. queryJson: Ext.JSON.encode(queryJson)
  200. }
  201. },
  202. remoteSort: true
  203. });
  204. var mystore2_fun = function (id) {
  205. if (id == 0) {
  206. myStore2.on('load', function (myStore2, record) {
  207. for (var i = 0; i < record.length; i++) {
  208. var records = record[i];
  209. if (records.get('xh') == 1) {
  210. Ext.getCmp('InspectorsListPanel2').getSelectionModel().select(records, true);
  211. }
  212. };
  213. });
  214. } else {
  215. myStore2.reload();
  216. myStore2.on('load', function (myStore2, record) {
  217. for (var i = 0; i < record.length; i++) {
  218. var records = record[i];
  219. if (records.get('id') == id) {
  220. Ext.getCmp('InspectorsListPanel2').getSelectionModel().select(records, true);
  221. }
  222. };
  223. });
  224. }
  225. }
  226. myStore1 = Ext.create('Ext.data.Store', {
  227. model: 'MaintenancePerson1',
  228. pageSize: countPerPage,
  229. proxy: {
  230. type: 'ajax',
  231. actionMethods: {
  232. create: 'POST',
  233. read: 'POST', // by default GET
  234. update: 'POST',
  235. destroy: 'POST'
  236. },
  237. url: baseUrl + 'iot/inspectorsx/getTeamMembersListxj',
  238. reader: {
  239. type: 'json',
  240. root: 'RESULT',
  241. totalProperty: 'totalCount'
  242. },
  243. extraParams: {
  244. queryJson: Ext.JSON.encode(queryJson)
  245. }
  246. },
  247. remoteSort: true
  248. });
  249. myStore1.on('load', function (myStore1, record) {
  250. for (var i = 0; i < record.length; i++) {
  251. var records = record[i];
  252. if (records.get('pd') == 1) {
  253. Ext.getCmp('InspectorsListPanel3').getSelectionModel().select(records, true);
  254. }
  255. };
  256. });
  257. Ext.define('getJobDutiesStore1', {
  258. extend: 'Ext.data.Model',
  259. fields: [
  260. { name: 'name', type: 'string' },
  261. { name: 'rid', type: 'int' }
  262. ]
  263. });
  264. var getJobDutiesStore1 = Ext.create('Ext.data.Store', {
  265. model: 'getJobDutiesStore1',
  266. proxy: {
  267. type: 'ajax',
  268. actionMethods: {
  269. create: 'POST',
  270. read: 'POST', // by default GET
  271. update: 'POST',
  272. destroy: 'POST'
  273. },
  274. url: baseUrl + 'iot/inspectorsx/getTeamMembersList1xj',
  275. reader: {
  276. type: 'json',
  277. root: 'RESULT',
  278. totalProperty: 'totalCount'
  279. },
  280. extraParams: {
  281. queryJson: Ext.JSON.encode(queryJson)
  282. }
  283. }
  284. });
  285. function public_phone(e) {
  286. if (!(/^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/.test(e))) {
  287. Ext.Msg.alert('提示', '不是完整的11位手机号或者正确的手机号前七位!', function (btn, txt) {
  288. Ext.getCmp('fa_Inspectors_phone').setValue('');
  289. });
  290. return false;
  291. }
  292. }
  293. var AppendForm = Ext.create('Ext.form.Panel', {
  294. id: 'InspectorsAppendForm',
  295. labelWidth: 55,
  296. url: baseUrl + 'iot/inspectorsx/append',
  297. defaultType: 'textfield',
  298. bodyPadding: 15,
  299. items: [{
  300. fieldLabel: '人员姓名',
  301. id: 'fa_Inspectors_name',
  302. name: 'name',
  303. maxLength: 20,
  304. maxLengthText: '长度不得超出{0}',
  305. anchor: '75%',
  306. listeners: {
  307. change: function (o, e) {
  308. if (e.length > 10) {
  309. Ext.Msg.alert('提示', '人员姓名长度不可超过10个字!', function (btn, txt) {
  310. Ext.getCmp('fa_Inspectors_name').setValue('');
  311. });
  312. return false;
  313. }
  314. }
  315. }
  316. }, {
  317. fieldLabel: '电话号码',
  318. id: 'fa_Inspectors_phone',
  319. name: 'phone',
  320. maxLength: 250,
  321. maxLengthText: '长度不得超出{0}',
  322. anchor: '75%',
  323. listeners: {
  324. change: function (o, e) {
  325. if (e.length == 11) {
  326. public_phone(e);
  327. } else {
  328. Ext.getCmp('fa_Inspectors_phone').setValue(e.substring(0, 11));
  329. e.length == 11 ? public_phone(e) : ''
  330. }
  331. }
  332. }
  333. }, {
  334. xtype: 'checkboxgroup',
  335. fieldLabel: '人员职能',
  336. id: "fa_Inspectors_inspectiontime",
  337. columns: 3,
  338. items: [
  339. { boxLabel: '维保', name: 'maintenance', inputValue: "1" },
  340. { boxLabel: '巡检', name: 'inspection', inputValue: "2" },
  341. { boxLabel: '报修', name: 'event_processing', inputValue: "4" }
  342. ]
  343. }, {
  344. id: 'fa_Inspectors_queryJson',
  345. name: 'queryJson',
  346. hidden: true
  347. }],
  348. buttons: [{
  349. text: '提交',
  350. iconCls: 'ok_btn',
  351. handler: function () {
  352. var form = this.up('form').getForm();
  353. if (form.isValid()) {
  354. var InspectiontimeValue = Ext.getCmp('fa_Inspectors_inspectiontime').getChecked();
  355. var Inspectiontime = 0;
  356. Ext.Array.each(InspectiontimeValue, function (item) {
  357. Inspectiontime += parseInt(item.inputValue);
  358. });
  359. var query = new Object();
  360. // query.V_LOGINNAME = V_LOGINNAME;
  361. query.name = Ext.getCmp('fa_Inspectors_name').getValue();
  362. if (query.name == null || query.name == "") {
  363. Ext.Msg.alert('系统提示', '人员姓名不能为空!');
  364. return;
  365. }
  366. query.phone = Ext.getCmp('fa_Inspectors_phone').getValue();
  367. if (query.phone == null || query.phone == "") {
  368. Ext.Msg.alert('系统提示', '电话号码不能为空!');
  369. return;
  370. }else if (query.phone.length < 11){
  371. Ext.Msg.alert('系统提示', '请输入正确的电话号码!');
  372. return;
  373. }
  374. query.zn = Inspectiontime;
  375. if(query.zn == 0){
  376. Ext.Msg.alert('系统提示', '职能至少选择一项!');
  377. return
  378. }
  379. var jsonstr = Ext.JSON.encode(query);
  380. Ext.getCmp('fa_Inspectors_queryJson').setValue(jsonstr);
  381. form.submit({
  382. method: 'post',
  383. success: function (form, action) {
  384. Ext.Msg.alert('操作成功', '已保存', function (btn, txt) {
  385. Ext.getCmp('InspectorsAppendForm').getForm().reset();
  386. Ext.getCmp('InspectorsListPageToolbar').moveFirst();
  387. });
  388. },
  389. failure: function (form, action) {
  390. Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
  391. });
  392. }
  393. });
  394. }
  395. }
  396. }, {
  397. text: '关闭',
  398. iconCls: 'cancel_btn',
  399. handler: function () {
  400. this.up('window').hide();
  401. }
  402. }]
  403. });
  404. var appendwin = function () {
  405. Ext.create('Ext.window.Window', {
  406. title: '新增',
  407. height: 350,
  408. width: 400,
  409. modal: true,
  410. layout: 'fit',
  411. items: AppendForm,
  412. closeAction: 'hide'
  413. }).show();
  414. }
  415. var AppendForm1 = Ext.create('Ext.form.Panel', {
  416. id: 'InspectorsAppendForm1',
  417. labelWidth: 55,
  418. url: baseUrl + 'iot/planteam/append1',
  419. defaultType: 'textfield',
  420. bodyPadding: 15,
  421. items: [{
  422. fieldLabel: '班组名称',
  423. id: 'fa_Inspectors_team_name',
  424. name: 'team_name',
  425. maxLength: 20,
  426. maxLengthText: '长度不得超出{0}',
  427. anchor: '75%'
  428. }, {
  429. fieldLabel: '负责人',
  430. id: 'fa_Inspectors_person_liable_id',
  431. name: 'person_liable_id',
  432. xtype: 'combo',
  433. store: getJobDutiesStore1,
  434. displayField: 'name',
  435. valueField: 'rid',
  436. editable: false,
  437. anchor: '75%'
  438. }, {
  439. id: 'fa_Inspectors_queryJson1',
  440. name: 'queryJson',
  441. hidden: true
  442. }],
  443. buttons: [{
  444. text: '提交',
  445. iconCls: 'ok_btn',
  446. handler: function () {
  447. var form = this.up('form').getForm();
  448. if (form.isValid()) {
  449. var query = new Object();
  450. // query.V_LOGINNAME = $("#V_LOGINNAME").val();
  451. query.team_name = Ext.getCmp('fa_Inspectors_team_name').getValue();
  452. query.person_liable_id = Ext.getCmp('fa_Inspectors_person_liable_id').getValue();
  453. var jsonstr = Ext.JSON.encode(query);
  454. Ext.getCmp('fa_Inspectors_queryJson1').setValue(jsonstr);
  455. form.submit({
  456. method: 'post',
  457. success: function (form, action) {
  458. Ext.Msg.alert('操作成功', '已保存', function (btn, txt) {
  459. clear_append_form1();
  460. });
  461. },
  462. failure: function (form, action) {
  463. Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
  464. clear_append_form1();
  465. });
  466. }
  467. });
  468. }
  469. }
  470. }, {
  471. text: '关闭',
  472. iconCls: 'cancel_btn',
  473. handler: function () {
  474. this.up('window').hide();
  475. }
  476. }]
  477. });
  478. var appendwin1 = function () {
  479. Ext.create('Ext.window.Window', {
  480. title: '新增',
  481. height: 350,
  482. width: 400,
  483. modal: true,
  484. layout: 'fit',
  485. items: AppendForm1,
  486. closeAction: 'hide'
  487. }).show();
  488. }
  489. var clear_modify_form = function () {
  490. Ext.getCmp('fm_inspectors_id').setValue("");
  491. Ext.getCmp('fm_inspectors_queryJson').setValue("");
  492. Ext.getCmp('fm_inspectors_name').setValue("");
  493. Ext.getCmp('fm_inspectors_phone').setValue("");
  494. Ext.getCmp('fm_inspectors_inspectiontime').setValue(false);
  495. Ext.getCmp('InspectorsListPanel').getStore().reload();
  496. }
  497. var ModifyForm = Ext.create('Ext.form.Panel', {
  498. id: 'InspectorsEditForm',
  499. labelWidth: 55,
  500. url: baseUrl + 'iot/inspectorsx/update',
  501. defaultType: 'textfield',
  502. bodyPadding: 15,
  503. items: [{
  504. fieldLabel: '人员姓名',
  505. id: 'fm_inspectors_name',
  506. name: 'name',
  507. maxLength: 20,
  508. maxLengthText: '长度不得超出{0}',
  509. anchor: '75%',
  510. listeners: {
  511. change: function (o, e) {
  512. if (e.length > 10) {
  513. Ext.Msg.alert('提示', '人员姓名长度不可超过10个字!', function (btn, txt) {
  514. Ext.getCmp('fa_Inspectors_name').setValue('');
  515. });
  516. return false;
  517. }
  518. }
  519. }
  520. }, {
  521. fieldLabel: '电话号码',
  522. id: 'fm_inspectors_phone',
  523. name: 'phone',
  524. maxLength: 250,
  525. maxLengthText: '长度不得超出{0}',
  526. anchor: '75%',
  527. listeners: {
  528. change: function (o, e) {
  529. if (e.length == 11) {
  530. public_phone(e);
  531. } else {
  532. Ext.getCmp('fa_Inspectors_phone').setValue(e.substring(0, 11));
  533. e.length == 11 ? public_phone(e) : ''
  534. }
  535. }
  536. }
  537. }, {
  538. xtype: 'checkboxgroup',
  539. fieldLabel: '人员职能',
  540. id: "fm_inspectors_inspectiontime",
  541. columns: 3,
  542. items: [
  543. { boxLabel: '维保', name: 'maintenance', inputValue: "1", id: 'inspectors_maintenance' },
  544. { boxLabel: '巡检', name: 'inspection', inputValue: "2", id: 'inspectors_inspection' },
  545. { boxLabel: '报修', name: 'event_processing', inputValue: "4", id: 'inspectors_event_processing' }
  546. ]
  547. }, {
  548. id: 'fm_inspectors_id',
  549. name: 'id',
  550. hidden: true
  551. }, {
  552. id: 'fm_inspectors_queryJson',
  553. name: 'queryJson',
  554. hidden: true
  555. }],
  556. buttons: [{
  557. text: '修改',
  558. iconCls: 'ok_btn',
  559. handler: function () {
  560. var form = this.up('form').getForm();
  561. if (form.isValid()) {
  562. var InspectiontimeValue = Ext.getCmp('fm_inspectors_inspectiontime').getChecked();
  563. var Inspectiontime = 0;
  564. Ext.Array.each(InspectiontimeValue, function (item) {
  565. Inspectiontime += parseInt(item.inputValue);
  566. });
  567. var query = new Object();
  568. query.id = Ext.getCmp('fm_inspectors_id').getValue();
  569. query.name = Ext.getCmp('fm_inspectors_name').getValue();
  570. if (query.name == null || query.name == "") {
  571. Ext.Msg.alert('系统提示', '人员姓名不能为空!');
  572. return;
  573. }
  574. query.phone = Ext.getCmp('fm_inspectors_phone').getValue();
  575. if (query.phone == null || query.phone == "") {
  576. Ext.Msg.alert('系统提示', '电话号码不能为空!');
  577. return;
  578. }else if (query.phone.length < 11){
  579. Ext.Msg.alert('系统提示', '请输入正确的电话号码!');
  580. return;
  581. }
  582. query.zn = Inspectiontime;
  583. if(query.zn == 0){
  584. Ext.Msg.alert('系统提示', '职能至少选择一项!');
  585. return
  586. }
  587. var jsonstr = Ext.JSON.encode(query);
  588. Ext.getCmp('fm_inspectors_queryJson').setValue(jsonstr);
  589. form.submit({
  590. method: 'post',
  591. success: function (form, action) {
  592. Ext.Msg.alert('操作成功', '已修改', function (btn, txt) {
  593. clear_modify_form();
  594. });
  595. },
  596. failure: function (form, action) {
  597. Ext.Msg.alert('操作失败', action.Msg, function (btn, txt) {
  598. clear_modify_form();
  599. });
  600. }
  601. });
  602. this.up('window').hide();
  603. }
  604. }
  605. }, {
  606. text: '关闭',
  607. iconCls: 'cancel_btn',
  608. handler: function () {
  609. this.up('window').hide();
  610. clear_modify_form();
  611. }
  612. }]
  613. });
  614. var modifywin = function () {
  615. Ext.create('Ext.window.Window', {
  616. title: '修改',
  617. height: 350,
  618. width: 400,
  619. modal: true,
  620. layout: 'fit',
  621. items: ModifyForm,
  622. closeAction: 'hide'
  623. }).show();
  624. }
  625. var chk_sm = function () {
  626. if (sm.getCount() == 1) {
  627. modifywin();
  628. var selected = sm.getSelection();
  629. var fm_inspectiontime = selected[0].raw.zn
  630. if (fm_inspectiontime == '1') {
  631. var domainArr = ['1'];
  632. } else if (fm_inspectiontime == '2') {
  633. var domainArr = ['2'];
  634. } else if (fm_inspectiontime == '3') {
  635. var domainArr = ['1', '2'];
  636. } else if (fm_inspectiontime == '4') {
  637. var domainArr = ['4'];
  638. } else if (fm_inspectiontime == '5') {
  639. var domainArr = ['1', '4'];
  640. } else if (fm_inspectiontime == '6') {
  641. var domainArr = ['2', '4'];
  642. } else if (fm_inspectiontime == '7') {
  643. var domainArr = ['1', '2', '4'];
  644. }
  645. for (var i = 0; i < domainArr.length; i++) {
  646. switch (domainArr[i]) {
  647. case "1":
  648. Ext.getCmp('inspectors_maintenance').setValue(true);
  649. break;
  650. case "2":
  651. Ext.getCmp('inspectors_inspection').setValue(true);
  652. break;
  653. case "4":
  654. Ext.getCmp('inspectors_event_processing').setValue(true);
  655. break;
  656. }
  657. }
  658. Ext.getCmp('fm_inspectors_id').setValue(selected[0].raw.id);
  659. Ext.getCmp('fm_inspectors_name').setValue(selected[0].raw.name);
  660. Ext.getCmp('fm_inspectors_phone').setValue(selected[0].raw.phone);
  661. } else {
  662. Ext.Msg.alert('请先选择', '请先选择一条记录,再点击修改');
  663. }
  664. }
  665. var del_sm = function () {
  666. if (sm.getCount() == 1) {
  667. var selected = sm.getSelection();
  668. var query = new Object();
  669. var list = new Array();
  670. var o = new Object();
  671. o.id = selected[0].raw.id;
  672. list.push(o);
  673. query.ID_LIST = list;
  674. var jsonstr = Ext.JSON.encode(query);
  675. Ext.MessageBox.confirm('删除人员信息', '是否删除' + selected[0].raw.name + ' 维保人员?', function (btn) {
  676. if (btn == 'yes') {
  677. $.ajax({
  678. type: 'POST',
  679. url: baseUrl + "iot/inspectorsx/del",
  680. data: {
  681. queryJson: jsonstr
  682. },
  683. success: function (result) {
  684. var json = eval('(' + result + ')');
  685. if (json.action == 'deleteInspectors') {
  686. if (json.success == true) {
  687. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  688. Ext.getCmp('InspectorsListPanel').getStore().reload();
  689. });
  690. } else {
  691. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  692. Ext.getCmp('InspectorsListPanel').getStore().reload();
  693. });
  694. }
  695. }
  696. }
  697. });
  698. }
  699. }, this);
  700. } else {
  701. if (sm.getCount() > 1) {
  702. var query = new Object();
  703. var list = new Array();
  704. for (var i = 0; i < sm.getCount(); i++) {
  705. var selected = sm.getSelection();
  706. var o = new Object();
  707. o.id = selected[i].raw.id;
  708. list.push(o);
  709. }
  710. query.ID_LIST = list;
  711. var jsonstr = Ext.JSON.encode(query);
  712. Ext.MessageBox.confirm('删除人员信息', '是否删除选中的' + sm.getCount() + ' 个维保人员?', function (btn) {
  713. if (btn == 'yes') {
  714. $.ajax({
  715. type: 'POST',
  716. url: baseUrl + "iot/inspectorsx/del",
  717. data: {
  718. queryJson: jsonstr
  719. },
  720. success: function (result) {
  721. var json = eval('(' + result + ')');
  722. if (json.action == 'deleteInspectors') {
  723. if (json.success == true) {
  724. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  725. Ext.getCmp('InspectorsListPanel').getStore().reload();
  726. });
  727. } else {
  728. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  729. Ext.getCmp('InspectorsListPanel').getStore().reload();
  730. });
  731. }
  732. }
  733. }
  734. });
  735. }
  736. }, this);
  737. } else {
  738. Ext.Msg.alert('请先选择', '至少选择一条记录,再点击删除');
  739. }
  740. }
  741. }
  742. var del_sm1 = function () {
  743. if (sm1.getCount() == 1) {
  744. var selected = sm1.getSelection();
  745. var query = new Object();
  746. var list = new Array();
  747. var o = new Object();
  748. o.id = selected[0].raw.id;
  749. list.push(o);
  750. query.ID_LIST = list;
  751. var jsonstr = Ext.JSON.encode(query);
  752. Ext.MessageBox.confirm('删除班组', '是否删除' + selected[0].raw.name + ' 班组?', function (btn) {
  753. if (btn == 'yes') {
  754. $.ajax({
  755. type: 'POST',
  756. url: baseUrl + "iot/planteam/del",
  757. data: {
  758. queryJson: jsonstr
  759. },
  760. success: function (result) {
  761. var json = eval('(' + result + ')');
  762. if (json.action == 'deletePlanTeam') {
  763. if (json.success == true) {
  764. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  765. Ext.getCmp('InspectorsListPanel2').getStore().reload();
  766. });
  767. } else {
  768. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  769. Ext.getCmp('InspectorsListPanel2').getStore().reload();
  770. });
  771. }
  772. }
  773. }
  774. });
  775. }
  776. }, this);
  777. } else {
  778. if (sm1.getCount() > 1) {
  779. var query = new Object();
  780. var list = new Array();
  781. for (var i = 0; i < sm.getCount(); i++) {
  782. var selected = sm1.getSelection();
  783. var o = new Object();
  784. o.id = selected[i].raw.id;
  785. list.push(o);
  786. }
  787. query.ID_LIST = list;
  788. var jsonstr = Ext.JSON.encode(query);
  789. Ext.MessageBox.confirm('删除班组', '是否删除选中的' + sm1.getCount() + ' 个班组?', function (btn) {
  790. if (btn == 'yes') {
  791. $.ajax({
  792. type: 'POST',
  793. url: baseUrl + "iot/planteam/del",
  794. data: {
  795. queryJson: jsonstr
  796. },
  797. success: function (result) {
  798. var json = eval('(' + result + ')');
  799. if (json.action == 'deletePlanTeam') {
  800. if (json.success == true) {
  801. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  802. Ext.getCmp('InspectorsListPanel2').getStore().reload();
  803. });
  804. } else {
  805. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  806. Ext.getCmp('InspectorsListPanel2').getStore().reload();
  807. });
  808. }
  809. }
  810. }
  811. });
  812. }
  813. }, this);
  814. } else {
  815. Ext.Msg.alert('请先选择', '至少选择一条记录,再点击删除');
  816. }
  817. }
  818. }
  819. var show_page = function () {
  820. var arr = 0;
  821. var r = document.getElementsByName("zhineng");
  822. if (r.length > 1) {
  823. for (var i = 0; i < r.length; i++) {
  824. if (r[i].checked) {
  825. arr += parseInt(r[i].value);
  826. }
  827. }
  828. } else if (r.length == 1) {
  829. arr = parseInt(r[0].value);
  830. } else {
  831. arr = 0;
  832. }
  833. var maintenancePerson_title3_input = document.getElementById('inspectors_title3_input1').value;
  834. var query = new Object();
  835. if (arr > 0) {
  836. query.zn = arr;
  837. $("#zn").val(arr);
  838. }
  839. if (maintenancePerson_title3_input.length > 0) {
  840. query.name = maintenancePerson_title3_input;
  841. $("#name").val(maintenancePerson_title3_input);
  842. }
  843. // query.V_LOGINNAME = V_LOGINNAME;
  844. // query.V_PASSWORD = V_PASSWORD;
  845. var jsonstr = Ext.JSON.encode(query);
  846. myStore.getProxy().extraParams = {
  847. queryJson: jsonstr
  848. };
  849. Ext.getCmp('InspectorsListPageToolbar').moveFirst();
  850. }
  851. var show_page1 = function () {
  852. var maintenancePerson_title21_input = document.getElementById('maintenancePerson_title21_input').value;
  853. var maintenancePerson_title31_input = document.getElementById('maintenancePerson_title31_input1').value;
  854. var query = new Object();
  855. if (maintenancePerson_title21_input.length > 0) {
  856. query.spot_name = maintenancePerson_title21_input;
  857. }
  858. if (maintenancePerson_title31_input.length > 0) {
  859. query.name = maintenancePerson_title31_input;
  860. }
  861. // query.V_LOGINNAME = V_LOGINNAME;
  862. // query.V_PASSWORD = V_PASSWORD;
  863. var jsonstr = Ext.JSON.encode(query);
  864. myStore.getProxy().extraParams = {
  865. queryJson: jsonstr
  866. };
  867. Ext.getCmp('InspectorsListPageToolbar2').moveFirst();
  868. }
  869. var reset1 = function () {
  870. var zn = document.getElementsByName("zhineng");
  871. for (var i = 0; i < zn.length; i++) {
  872. zn[i].checked = true;
  873. }
  874. document.getElementById('inspectors_title3_input1').value = '';
  875. $("#zn").val('');
  876. $("#name").val('');
  877. show_page();
  878. }
  879. var reset11 = function () {
  880. document.getElementById('maintenancePerson_title21_input').value = '';
  881. document.getElementById('maintenancePerson_title31_input1').value = '';
  882. }
  883. mouseon = function (obj) {
  884. var id = obj.id;
  885. $("#" + id).removeClass(id);
  886. $("#" + id).addClass(id + '_on');
  887. }
  888. mouseon1 = function (obj) {
  889. var id = obj.id;
  890. $("#" + id).removeClass(id);
  891. $("#" + id).addClass(id + '_on');
  892. }
  893. mouseoff = function (obj) {
  894. var mid = "inspectors_";
  895. for (var i = 1; i < 7; i++) {
  896. var id = "inspectors_title" + i + "_div";
  897. $("#" + id).removeClass(id + '_on');
  898. $("#" + id).addClass(id);
  899. }
  900. if (menuidx == 'm1') {
  901. mid += 'title1_div';
  902. $("#" + mid).removeClass(mid);
  903. $("#" + mid).addClass(mid + '_on');
  904. }
  905. else if (menuidx == 'm2') {
  906. mid += 'title2_div';
  907. $("#" + mid).removeClass(mid);
  908. $("#" + mid).addClass(mid + '_on');
  909. }
  910. else if (menuidx == 'm3') {
  911. mid += 'title3_div';
  912. $("#" + mid).removeClass(mid);
  913. $("#" + mid).addClass(mid + '_on');
  914. }
  915. else if (menuidx == 'm4') {
  916. mid += 'title4_div';
  917. $("#" + mid).removeClass(mid);
  918. $("#" + mid).addClass(mid + '_on');
  919. }
  920. else if (menuidx == 'm5') {
  921. mid += 'title5_div';
  922. $("#" + mid).removeClass(mid);
  923. $("#" + mid).addClass(mid + '_on');
  924. }
  925. else if (menuidx == 'm6') {
  926. mid += 'title6_div';
  927. $("#" + mid).removeClass(mid);
  928. $("#" + mid).addClass(mid + '_on');
  929. }
  930. }
  931. mouseoff1 = function (obj) {
  932. var mid = "inspectors_";
  933. for (var i = 1; i < 5; i++) {
  934. var id = "inspectors_title" + i + "1_div";
  935. $("#" + id).removeClass(id + '_on');
  936. $("#" + id).addClass(id);
  937. }
  938. if (menuidx == 'm11') {
  939. mid += 'title11_div';
  940. $("#" + mid).removeClass(mid);
  941. $("#" + mid).addClass(mid + '_on');
  942. }
  943. else if (menuidx == 'm21') {
  944. mid += 'title21_div';
  945. $("#" + mid).removeClass(mid);
  946. $("#" + mid).addClass(mid + '_on');
  947. }
  948. else if (menuidx == 'm31') {
  949. mid += 'title31_div';
  950. $("#" + mid).removeClass(mid);
  951. $("#" + mid).addClass(mid + '_on');
  952. }
  953. else if (menuidx == 'm41') {
  954. mid += 'title41_div';
  955. $("#" + mid).removeClass(mid);
  956. $("#" + mid).addClass(mid + '_on');
  957. }
  958. }
  959. menu_click = function (obj) {
  960. var id = obj.id;
  961. if (id == 'inspectors_title1_div') {
  962. menuidx = 'm1';
  963. show_page();
  964. }
  965. else if (id == 'inspectors_title2_div') {
  966. menuidx = 'm2';
  967. reset1();
  968. }
  969. else if (id == 'inspectors_title3_div') {
  970. menuidx = 'm3';
  971. exportbtn_click();
  972. }
  973. else if (id == 'inspectors_title4_div') {
  974. menuidx = 'm4';
  975. del_sm();
  976. }
  977. else if (id == 'inspectors_title5_div') {
  978. menuidx = 'm5';
  979. appendwin();
  980. }
  981. else if (id == 'inspectors_title6_div') {
  982. menuidx = 'm6';
  983. chk_sm();
  984. }
  985. else if (id == 'inspectors_title11_div') {
  986. menuidx = 'm11';
  987. del_sm1();
  988. }
  989. else if (id == 'inspectors_title21_div') {
  990. menuidx = 'm21';
  991. appendwin1();
  992. }
  993. else if (id == 'inspectors_title31_div') {
  994. menuidx = 'm31';
  995. Preservation_panel3();
  996. }
  997. else if (id == 'inspectors_title41_div') {
  998. menuidx = 'm41';
  999. cancel_panel3();
  1000. }
  1001. }
  1002. var Preservation_panel3 = function () {
  1003. var team_name = document.getElementById('inspectors_title211_input').value;
  1004. var person_liable_id = document.getElementById('inspectors_title111_input').value;
  1005. var selected = sm1.getSelection();
  1006. var selected1 = addsm.getSelection();
  1007. var tid = selected1[0].raw.tdid;
  1008. for (var i = 0; i < addsm.getCount(); i++) {
  1009. if (i == 0)
  1010. people_id_list = selected1[i].raw.rid;
  1011. else
  1012. people_id_list += "," + selected1[i].raw.rid;
  1013. }
  1014. var query = new Object();
  1015. query.team_name = team_name;
  1016. query.person_liable_id = person_liable_id;
  1017. query.tid = tid;
  1018. query.people_id_list = people_id_list;
  1019. $.ajax({
  1020. type: 'POST',
  1021. url: baseUrl + "iot/planteam/update",
  1022. data: {
  1023. queryJson: Ext.JSON.encode(query)
  1024. },
  1025. success: function (result) {
  1026. Ext.Msg.alert('操作成功', '已修改', function (btn, txt) {
  1027. mystore2_fun(tid);
  1028. // cancel_panel3();
  1029. });
  1030. },
  1031. failure: function () {
  1032. Ext.Msg.alert('操作失败', function (btn, txt) {
  1033. cancel_panel3();
  1034. });
  1035. }
  1036. });
  1037. }
  1038. var cancel_panel3 = function () {
  1039. var selected = sm1.getSelection();
  1040. var stor1_id = selected[0].raw.id;
  1041. var label1 = selected[0].raw.team_name;
  1042. var label2 = selected[0].raw.person_liable_id;
  1043. var query = new Object();
  1044. query.id = stor1_id;
  1045. // query.V_LOGINNAME = V_LOGINNAME;
  1046. // query.V_PASSWORD = V_PASSWORD;
  1047. var jsonstr = Ext.JSON.encode(query);
  1048. myStore1.getProxy().extraParams = {
  1049. queryJson: jsonstr
  1050. };
  1051. Ext.getCmp('InspectorsListPageToolbar3').moveFirst();
  1052. document.getElementById('inspectors_title211_input').value = label1;
  1053. document.getElementById('inspectors_title111_input').value = label2;
  1054. }
  1055. var childPanel1 = function () {
  1056. var maintenancePersonHtml = document.getElementById('InspectorsHtml');
  1057. var childPanel1_title = document.createElement('div');
  1058. childPanel1_title.setAttribute('class', 'maintenanceperson_title2_div');
  1059. childPanel1_title.innerHTML = '职能';
  1060. maintenancePersonHtml.appendChild(childPanel1_title);
  1061. var childPanel1_input1 = document.createElement('input');
  1062. childPanel1_input1.setAttribute('class', 'input4_class');
  1063. // childPanel1_input1.setAttribute('id','maintenancePerson_title3_input1');
  1064. childPanel1_input1.setAttribute('type', 'checkbox');
  1065. childPanel1_input1.setAttribute('name', 'zhineng');
  1066. childPanel1_input1.setAttribute('value', '1');
  1067. maintenancePersonHtml.appendChild(childPanel1_input1);
  1068. var childPanel1_div = document.createElement('div');
  1069. childPanel1_div.setAttribute('class', 'childPanel1_div');
  1070. childPanel1_div.innerHTML = '维保';
  1071. maintenancePersonHtml.appendChild(childPanel1_div);
  1072. var childPanel1_input2 = document.createElement('input');
  1073. childPanel1_input2.setAttribute('class', 'input2_class');
  1074. // childPanel1_input1.setAttribute('id','maintenancePerson_title3_input1');
  1075. childPanel1_input2.setAttribute('type', 'checkbox');
  1076. childPanel1_input2.setAttribute('name', 'zhineng');
  1077. childPanel1_input2.setAttribute('value', '2');
  1078. maintenancePersonHtml.appendChild(childPanel1_input2);
  1079. var childPanel1_div1 = document.createElement('div');
  1080. childPanel1_div1.setAttribute('class', 'childPanel1_div1');
  1081. childPanel1_div1.innerHTML = '巡检';
  1082. maintenancePersonHtml.appendChild(childPanel1_div1);
  1083. var childPanel1_input3 = document.createElement('input');
  1084. childPanel1_input3.setAttribute('class', 'input3_class')
  1085. // childPanel1_input1.setAttribute('id','maintenancePerson_title3_input1');
  1086. childPanel1_input3.setAttribute('type', 'checkbox');
  1087. childPanel1_input3.setAttribute('name', 'zhineng');
  1088. childPanel1_input3.setAttribute('value', '4');
  1089. maintenancePersonHtml.appendChild(childPanel1_input3);
  1090. var childPanel1_div2 = document.createElement('div');
  1091. childPanel1_div2.setAttribute('class', 'childPanel1_div2');
  1092. childPanel1_div2.innerHTML = '报修';
  1093. maintenancePersonHtml.appendChild(childPanel1_div2);
  1094. var childPanel1_title1 = document.createElement('div');
  1095. childPanel1_title1.setAttribute('class', 'title3_div');
  1096. childPanel1_title1.innerHTML = '姓名';
  1097. maintenancePersonHtml.appendChild(childPanel1_title1);
  1098. var childPanel1_input = document.createElement('input');
  1099. childPanel1_input.setAttribute('class', 'input1_class');
  1100. childPanel1_input.setAttribute('id', 'inspectors_title3_input1');
  1101. childPanel1_input.setAttribute('type', 'text');
  1102. childPanel1_input.setAttribute('value', '');
  1103. maintenancePersonHtml.appendChild(childPanel1_input);
  1104. var childPanel1_title2 = document.createElement('div');
  1105. childPanel1_title2.setAttribute('class', 'inspectors_title1_div');
  1106. childPanel1_title2.setAttribute('id', 'inspectors_title1_div');
  1107. childPanel1_title2.setAttribute('onmouseover', "mouseon(this)");
  1108. childPanel1_title2.setAttribute('onmouseout', "mouseoff(this)");
  1109. childPanel1_title2.setAttribute('onclick', "menu_click(this)");
  1110. maintenancePersonHtml.appendChild(childPanel1_title2);
  1111. var childPanel1_title3 = document.createElement('div');
  1112. childPanel1_title3.setAttribute('class', 'inspectors_title2_div');
  1113. childPanel1_title3.setAttribute('id', 'inspectors_title2_div');
  1114. childPanel1_title3.setAttribute('onmouseover', "mouseon(this)");
  1115. childPanel1_title3.setAttribute('onmouseout', "mouseoff(this)");
  1116. childPanel1_title3.setAttribute('onclick', "menu_click(this)");
  1117. maintenancePersonHtml.appendChild(childPanel1_title3);
  1118. var childPanel1_title4 = document.createElement('div');
  1119. childPanel1_title4.setAttribute('class', 'inspectors_title3_div');
  1120. childPanel1_title4.setAttribute('id', 'inspectors_title3_div');
  1121. childPanel1_title4.setAttribute('onmouseover', "mouseon(this)");
  1122. childPanel1_title4.setAttribute('onmouseout', "mouseoff(this)");
  1123. childPanel1_title4.setAttribute('onclick', "menu_click(this)");
  1124. maintenancePersonHtml.appendChild(childPanel1_title4);
  1125. var childPanel1_title5 = document.createElement('div');
  1126. childPanel1_title5.setAttribute('class', 'inspectors_title4_div');
  1127. childPanel1_title5.setAttribute('id', 'inspectors_title4_div');
  1128. childPanel1_title5.setAttribute('onmouseover', "mouseon(this)");
  1129. childPanel1_title5.setAttribute('onmouseout', "mouseoff(this)");
  1130. childPanel1_title5.setAttribute('onclick', "menu_click(this)");
  1131. maintenancePersonHtml.appendChild(childPanel1_title5);
  1132. var childPanel1_title6 = document.createElement('div');
  1133. childPanel1_title6.setAttribute('class', 'inspectors_title5_div');
  1134. childPanel1_title6.setAttribute('id', 'inspectors_title5_div');
  1135. childPanel1_title6.setAttribute('onmouseover', "mouseon(this)");
  1136. childPanel1_title6.setAttribute('onmouseout', "mouseoff(this)");
  1137. childPanel1_title6.setAttribute('onclick', "menu_click(this)");
  1138. maintenancePersonHtml.appendChild(childPanel1_title6);
  1139. var childPanel1_title7 = document.createElement('div');
  1140. childPanel1_title7.setAttribute('class', 'inspectors_title6_div');
  1141. childPanel1_title7.setAttribute('id', 'inspectors_title6_div');
  1142. childPanel1_title7.setAttribute('onmouseover', "mouseon(this)");
  1143. childPanel1_title7.setAttribute('onmouseout', "mouseoff(this)");
  1144. childPanel1_title7.setAttribute('onclick', "menu_click(this)");
  1145. maintenancePersonHtml.appendChild(childPanel1_title7);
  1146. reset1();
  1147. }
  1148. changeon1 = function (obj) {
  1149. var selected = sm1.getSelection();
  1150. var id = selected[0].raw.id
  1151. var xid = obj.value;
  1152. var query = new Object();
  1153. if (xid.length > 0) {
  1154. query.xid = xid;
  1155. }
  1156. query.id = id;
  1157. // query.V_LOGINNAME = V_LOGINNAME;
  1158. // query.V_PASSWORD = V_PASSWORD;
  1159. var jsonstr = Ext.JSON.encode(query);
  1160. myStore1.getProxy().extraParams = {
  1161. queryJson: jsonstr
  1162. };
  1163. Ext.getCmp('InspectorsListPageToolbar3').moveFirst();
  1164. }
  1165. // var childPanel2 = function() {
  1166. // var maintenancePersonHtml2 = document.getElementById('InspectorsHtml2');
  1167. // var divhiddle = document.createElement('div');
  1168. // divhiddle.id='div26_id_inspectorsPanel3';
  1169. // divhiddle.setAttribute('class','SpringHandleHtml3DivHiddle');
  1170. // maintenancePersonHtml2.appendChild(divhiddle);
  1171. // var childPanel2_title = document.createElement('div');
  1172. // childPanel2_title.setAttribute('class','maintenancePerson_title211_div');
  1173. // childPanel2_title.innerHTML='班组名称';
  1174. // maintenancePersonHtml2.appendChild(childPanel2_title);
  1175. // var childPanel2_input = document.createElement('input');
  1176. // childPanel2_input.setAttribute('class','maintenancePerson_input211_class');
  1177. // childPanel2_input.setAttribute('id','inspectors_title211_input');
  1178. // childPanel2_input.setAttribute('type','text');
  1179. // childPanel2_input.setAttribute('value','');
  1180. // maintenancePersonHtml2.appendChild(childPanel2_input);
  1181. // var childPanel2_title1 = document.createElement('div');
  1182. // childPanel2_title1.setAttribute('class','maintenancePerson_title111_div');
  1183. // childPanel2_title1.innerHTML='负责人';
  1184. // maintenancePersonHtml2.appendChild(childPanel2_title1);
  1185. // var select = document.createElement('select');
  1186. // select.setAttribute('class','maintenancePerson_input111_class');
  1187. // select.setAttribute('onchange',"changeon1(this)");
  1188. // select.setAttribute('id','inspectors_title111_input');
  1189. // maintenancePersonHtml2.appendChild(select);
  1190. // for(var i=0;i<ConfirmStore.length;i++){
  1191. // var option3 = document.createElement('option');
  1192. // option3.innerHTML=ConfirmStore[i].name;
  1193. // option3.setAttribute('value',ConfirmStore[i].rid);
  1194. // select.appendChild(option3);
  1195. // }
  1196. // var childPanel2_title2 = document.createElement('div');
  1197. // childPanel2_title2.setAttribute('class','inspectors_title11_div');
  1198. // childPanel2_title2.setAttribute('id','inspectors_title11_div');
  1199. // childPanel2_title2.setAttribute('onmouseover',"mouseon1(this)");
  1200. // childPanel2_title2.setAttribute('onmouseout',"mouseoff1(this)");
  1201. // childPanel2_title2.setAttribute('onclick',"menu_click(this)");
  1202. // maintenancePersonHtml2.appendChild(childPanel2_title2);
  1203. // var childPanel2_title3 = document.createElement('div');
  1204. // childPanel2_title3.setAttribute('class','inspectors_title21_div');
  1205. // childPanel2_title3.setAttribute('id','inspectors_title21_div');
  1206. // childPanel2_title3.setAttribute('onmouseover',"mouseon1(this)");
  1207. // childPanel2_title3.setAttribute('onmouseout',"mouseoff1(this)");
  1208. // childPanel2_title3.setAttribute('onclick',"menu_click(this)");
  1209. // maintenancePersonHtml2.appendChild(childPanel2_title3);
  1210. // }
  1211. var childPanel2 = function () {
  1212. var maintenancePersonHtml2 = document.getElementById('InspectorsHtml2');
  1213. var divhiddle = document.createElement('div');
  1214. divhiddle.id = 'div26_id_inspectorsPanel3';
  1215. divhiddle.setAttribute('class', 'SpringHandleHtml3DivHiddle');
  1216. maintenancePersonHtml2.appendChild(divhiddle);
  1217. var title = document.createElement('div');
  1218. title.setAttribute('class', 'MaintenancePersonTitle123');
  1219. title.innerHTML = '班组列表';
  1220. maintenancePersonHtml2.appendChild(title);
  1221. var childPanel2_title2 = document.createElement('div');
  1222. childPanel2_title2.setAttribute('class', 'inspectors_title11_div');
  1223. childPanel2_title2.setAttribute('id', 'inspectors_title11_div');
  1224. childPanel2_title2.setAttribute('onmouseover', "mouseon1(this)");
  1225. childPanel2_title2.setAttribute('onmouseout', "mouseoff1(this)");
  1226. childPanel2_title2.setAttribute('onclick', "menu_click(this)");
  1227. maintenancePersonHtml2.appendChild(childPanel2_title2);
  1228. var childPanel2_title3 = document.createElement('div');
  1229. childPanel2_title3.setAttribute('class', 'inspectors_title21_div');
  1230. childPanel2_title3.setAttribute('id', 'inspectors_title21_div');
  1231. childPanel2_title3.setAttribute('onmouseover', "mouseon1(this)");
  1232. childPanel2_title3.setAttribute('onmouseout', "mouseoff1(this)");
  1233. childPanel2_title3.setAttribute('onclick', "menu_click(this)");
  1234. maintenancePersonHtml2.appendChild(childPanel2_title3);
  1235. }
  1236. var childPanel3 = function () {
  1237. var maintenancePersonHtml3 = document.getElementById('InspectorsHtml3');
  1238. var divhiddle = document.createElement('div');
  1239. divhiddle.id = 'div26_id_inspectorsHtml3Panel3';
  1240. divhiddle.setAttribute('class', 'SpringHandleHtml3DivHiddle');
  1241. maintenancePersonHtml3.appendChild(divhiddle);
  1242. var title1 = document.createElement('div');
  1243. title1.setAttribute('class', 'MaintenancePersonTitle123');
  1244. title1.innerHTML = '班组详情';
  1245. maintenancePersonHtml3.appendChild(title1);
  1246. var childPanel2_title = document.createElement('div');
  1247. childPanel2_title.setAttribute('class', 'maintenancePerson_title211_div');
  1248. childPanel2_title.innerHTML = '班组名称';
  1249. maintenancePersonHtml3.appendChild(childPanel2_title);
  1250. var childPanel2_input = document.createElement('input');
  1251. childPanel2_input.setAttribute('class', 'maintenancePerson_input211_class');
  1252. childPanel2_input.setAttribute('id', 'inspectors_title211_input');
  1253. childPanel2_input.setAttribute('type', 'text');
  1254. childPanel2_input.setAttribute('value', '');
  1255. maintenancePersonHtml3.appendChild(childPanel2_input);
  1256. var childPanel2_title1 = document.createElement('div');
  1257. childPanel2_title1.setAttribute('class', 'maintenancePerson_title111_div');
  1258. childPanel2_title1.innerHTML = '负责人';
  1259. maintenancePersonHtml3.appendChild(childPanel2_title1);
  1260. var select = document.createElement('select');
  1261. select.setAttribute('class', 'maintenancePerson_input111_class');
  1262. select.setAttribute('onchange', "changeon1(this)");
  1263. select.setAttribute('id', 'inspectors_title111_input');
  1264. maintenancePersonHtml3.appendChild(select);
  1265. for (var i = 0; i < ConfirmStore.length; i++) {
  1266. var option3 = document.createElement('option');
  1267. option3.innerHTML = ConfirmStore[i].name;
  1268. option3.setAttribute('value', ConfirmStore[i].rid);
  1269. select.appendChild(option3);
  1270. }
  1271. var childPanel2_title2 = document.createElement('div');
  1272. childPanel2_title2.setAttribute('class', 'inspectors_title31_div');
  1273. childPanel2_title2.setAttribute('id', 'inspectors_title31_div');
  1274. childPanel2_title2.setAttribute('onmouseover', "mouseon1(this)");
  1275. childPanel2_title2.setAttribute('onmouseout', "mouseoff1(this)");
  1276. childPanel2_title2.setAttribute('onclick', "menu_click(this)");
  1277. maintenancePersonHtml3.appendChild(childPanel2_title2);
  1278. var childPanel2_title3 = document.createElement('div');
  1279. childPanel2_title3.setAttribute('class', 'inspectors_title41_div');
  1280. childPanel2_title3.setAttribute('id', 'inspectors_title41_div');
  1281. childPanel2_title3.setAttribute('onmouseover', "mouseon1(this)");
  1282. childPanel2_title3.setAttribute('onmouseout', "mouseoff1(this)");
  1283. childPanel2_title3.setAttribute('onclick', "menu_click(this)");
  1284. maintenancePersonHtml3.appendChild(childPanel2_title3);
  1285. }
  1286. var childPanel3_fun = function () {
  1287. var query = new Object();
  1288. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1289. $.ajax({
  1290. type: 'POST',
  1291. url: baseUrl + "iot/inspectorsx/getTeamMembersList1xj",
  1292. data: {
  1293. queryJson: Ext.JSON.encode(query)
  1294. },
  1295. success: function (result) {
  1296. var json = eval('(' + result + ')');
  1297. if (json.action == 'getTeamMembersList1xj') {
  1298. ConfirmStore = json.RESULT;
  1299. childPanel3();
  1300. }
  1301. }
  1302. });
  1303. }
  1304. var childPanel6 = Ext.create('Ext.Panel', {
  1305. height: maxHeight,
  1306. width: '20%',
  1307. html: '<div></div>'
  1308. });
  1309. // var childPanel2_fun =function(){
  1310. // var query = new Object();
  1311. // query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1312. // $.ajax({
  1313. // type:'POST',
  1314. // url: baseUrl+"iot/inspectorsx/getTeamMembersList1xj",
  1315. // data: {
  1316. // queryJson : Ext.JSON.encode(query)
  1317. // },
  1318. // success: function(result){
  1319. // var json = eval('(' + result + ')');
  1320. // if(json.action=='getTeamMembersList1xj'){
  1321. // ConfirmStore = json.RESULT;
  1322. // childPanel2();
  1323. // }
  1324. // }
  1325. // });
  1326. // }
  1327. // var childPanel3 = Ext.create('Ext.Panel', {
  1328. // height:40,
  1329. // width:'100%',
  1330. // html: '<div id="inspectors_title31_div" class="inspectors_title31_div" onmouseover="mouseon1(this);" onmouseout="mouseoff1(this);" onclick="menu_click(this);"></div><div id="inspectors_title41_div" class="inspectors_title41_div" onmouseover="mouseon1(this);" onmouseout="mouseoff1(this);" onclick="menu_click(this);"></div>'
  1331. // });
  1332. var MaintenancePersonPanel = Ext.create('Ext.grid.Panel', {
  1333. header: {
  1334. height: 0,
  1335. border: '0px solid #000000'
  1336. },
  1337. id: 'InspectorsListPanel',
  1338. store: myStore,
  1339. selModel: sm,
  1340. columns: [
  1341. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1342. { header: '职能ID', dataIndex: 'zn', hidden: true, menuDisabled: true },
  1343. { header: '序号', dataIndex: 'xh', width: 39, menuDisabled: true },
  1344. { header: '姓名', dataIndex: 'name', width: 466, align: 'center', menuDisabled: true },
  1345. { header: '手机号', dataIndex: 'phone', width: 466, align: 'center', menuDisabled: true },
  1346. { header: '职务', dataIndex: 'zn_name', width: 466, align: 'center', menuDisabled: true },
  1347. ],
  1348. columnLines: true,
  1349. height: maxHeight,
  1350. width: '100%',
  1351. bbar: new Ext.PagingToolbar({
  1352. store: myStore,
  1353. id: 'InspectorsListPageToolbar',
  1354. displayInfo: true,
  1355. pageSize: countPerPage,
  1356. prependButtons: true,
  1357. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1358. emptyMsg: "没有记录",
  1359. firstText: '第一页',
  1360. prevText: '前一页',
  1361. nextText: '后一页',
  1362. lastText: '最后一页',
  1363. refreshText: '刷新',
  1364. }),
  1365. frame: true,
  1366. border: false,
  1367. iconCls: 'icon-grid'
  1368. });
  1369. var MaintenancePersonPanel2 = Ext.create('Ext.grid.Panel', {
  1370. header: {
  1371. height: 0,
  1372. border: '0px solid #000000'
  1373. },
  1374. bodyStyle: 'background:#121E34;',
  1375. id: 'InspectorsListPanel2',
  1376. store: myStore2,
  1377. region: 'center',
  1378. selModel: sm1,
  1379. columns: [
  1380. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1381. { header: '责任人ID', dataIndex: 'person_liable_id', hidden: true, menuDisabled: true },
  1382. { header: '序号', dataIndex: 'xh', width: 35, menuDisabled: true },
  1383. { header: '班组名称', dataIndex: 'team_name', width: 340, align: 'center', menuDisabled: true },
  1384. ],
  1385. columnLines: true,
  1386. height: maxHeight,
  1387. width: '30%',
  1388. listeners: {
  1389. select: function (dataview, record, index) {//record被选中时产生的事件
  1390. var label = record.get('team_name');
  1391. var label1 = record.get('id');
  1392. var label2 = record.get('person_liable_id');
  1393. var query = new Object();
  1394. if (label1.length > 0) {
  1395. query.id = label1;
  1396. }
  1397. // query.V_LOGINNAME = V_LOGINNAME;
  1398. // query.V_PASSWORD = V_PASSWORD;
  1399. var jsonstr = Ext.JSON.encode(query);
  1400. myStore1.getProxy().extraParams = {
  1401. queryJson: jsonstr
  1402. };
  1403. Ext.getCmp('InspectorsListPageToolbar3').moveFirst();
  1404. document.getElementById('inspectors_title211_input').value = label;
  1405. document.getElementById('inspectors_title111_input').value = label2;
  1406. // Ext.MessageBox.alert("标题触发了"+label);
  1407. }
  1408. // itemdblclick: function () {
  1409. // Ext.MessageBox.alert("标题离开了");
  1410. // }
  1411. },
  1412. bbar: new Ext.PagingToolbar({
  1413. store: myStore2,
  1414. id: 'InspectorsListPageToolbar2',
  1415. // displayInfo: true,
  1416. // pageSize: countPerPage,
  1417. // prependButtons: true,
  1418. // displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
  1419. // emptyMsg : "没有记录",
  1420. // firstText: '第一页',
  1421. // prevText: '前一页',
  1422. // nextText: '后一页',
  1423. // lastText: '最后一页',
  1424. // refreshText: '刷新',
  1425. }),
  1426. // frame: true,
  1427. border: false,
  1428. iconCls: 'icon-grid'
  1429. });
  1430. var MaintenancePersonPanel3 =
  1431. Ext.create('Ext.grid.Panel', {
  1432. header: {
  1433. height: 0,
  1434. border: '0px solid #000000'
  1435. },
  1436. id: 'InspectorsListPanel3',
  1437. store: myStore1,
  1438. region: 'center',
  1439. selModel: addsm,
  1440. columns: [
  1441. { header: 'ID', dataIndex: 'rid', hidden: true, menuDisabled: true },
  1442. { header: '责任人ID', dataIndex: 'person_liable_id', hidden: true, menuDisabled: true },
  1443. { header: '班组ID', dataIndex: 'tdid', hidden: true, menuDisabled: true },
  1444. { header: '默认值', dataIndex: 'pd', hidden: true, menuDisabled: true },
  1445. { header: '序号', dataIndex: 'xh', width: 35, menuDisabled: true },
  1446. { header: '组员', dataIndex: 'name', width: 633, align: 'center', menuDisabled: true },
  1447. // { header: '', dataIndex: 'zrr', width:267,align:'center', menuDisabled:true },
  1448. ],
  1449. columnLines: true,
  1450. height: maxHeight,
  1451. width: '50%',
  1452. listeners: {
  1453. viewready: function () {
  1454. var hd_checker = this.getEl().select('div.x-grid3-hd-checker');
  1455. // if (hd_checker.hasClass('x-grid3-hd-checker')) {
  1456. // hd_checker.removeClass('x-grid3-hd-checker'); // 去掉全选框
  1457. // }
  1458. }
  1459. },
  1460. bbar: new Ext.PagingToolbar({
  1461. store: myStore1,
  1462. id: 'InspectorsListPageToolbar3',
  1463. displayInfo: true,
  1464. pageSize: countPerPage,
  1465. prependButtons: true,
  1466. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1467. emptyMsg: "没有记录",
  1468. firstText: '第一页',
  1469. prevText: '前一页',
  1470. nextText: '后一页',
  1471. lastText: '最后一页',
  1472. refreshText: '刷新',
  1473. }),
  1474. border: false,
  1475. iconCls: 'icon-grid'
  1476. });
  1477. var piebar = Ext.create('Ext.panel.Panel', {
  1478. id: 'InspectorsHtml',
  1479. width: '100%',
  1480. height: 188,
  1481. region: 'north',
  1482. layout: 'form',
  1483. defaults: {
  1484. border: false
  1485. }
  1486. // items: [childPanel1]
  1487. });
  1488. var piebar2 = Ext.create('Ext.panel.Panel', {
  1489. id: 'InspectorsHtml2',
  1490. width: '30%',
  1491. height: 140,
  1492. bodyStyle: 'background:#121E34;',
  1493. region: 'north',
  1494. layout: 'form',
  1495. defaults: {
  1496. border: false
  1497. }
  1498. // items: [childPanel2]
  1499. });
  1500. var piebar3 = Ext.create('Ext.panel.Panel', {
  1501. id: 'InspectorsHtml3',
  1502. width: '50%',
  1503. height: 140,
  1504. region: 'north',
  1505. layout: 'form',
  1506. defaults: {
  1507. border: false
  1508. },
  1509. // items: [childPanel3]
  1510. });
  1511. panel1 = Ext.create('Ext.panel.Panel', {
  1512. width: '100%',
  1513. id: 'InspectorsPiebar',
  1514. layout: 'border',
  1515. items: [
  1516. piebar, MaintenancePersonPanel
  1517. ],
  1518. });
  1519. var piebar4 = Ext.create('Ext.panel.Panel', {
  1520. id: 'InspectorsHtml4',
  1521. width: '30%',
  1522. region: 'west',
  1523. layout: 'border',
  1524. bodyStyle: 'background:#121E34;border-radius:20px;padding:10px;',
  1525. padding: 10,
  1526. items: [
  1527. piebar2, MaintenancePersonPanel2
  1528. ]
  1529. });
  1530. var piebar5 = Ext.create('Ext.panel.Panel', {
  1531. id: 'InspectorsHtml5',
  1532. width: '50%',
  1533. region: 'center',
  1534. layout: 'border',
  1535. bodyStyle: 'padding:10px;',
  1536. padding: 10,
  1537. items: [
  1538. piebar3, MaintenancePersonPanel3
  1539. ]
  1540. });
  1541. var piebar6 = Ext.create('Ext.panel.Panel', {
  1542. id: 'InspectorsHtml6',
  1543. width: '20%',
  1544. region: 'east',
  1545. layout: 'form',
  1546. defaults: {
  1547. border: false
  1548. },
  1549. items: [childPanel6]
  1550. });
  1551. panel2 = Ext.create('Ext.panel.Panel', {
  1552. width: '100%',
  1553. id: 'InspectorsPiebar2',
  1554. layout: 'border',
  1555. items: [
  1556. piebar4, piebar5, piebar6
  1557. ],
  1558. });
  1559. // panel2 = Ext.create('Ext.panel.Panel',{
  1560. // width:'100%',
  1561. // id: 'InspectorsPiebar2',
  1562. // layout:'border',
  1563. // items:[
  1564. // piebar2,MaintenancePersonPanel2,MaintenancePersonPanel3,piebar3
  1565. // ],
  1566. //
  1567. // });
  1568. Ext.create('Ext.tab.Panel', {
  1569. width: '100%',
  1570. id: 'InspectorsTab',
  1571. activeTab: 0,
  1572. items: [
  1573. {
  1574. itemId: 'person',
  1575. title: '人员列表',
  1576. items: [panel1]
  1577. },
  1578. {
  1579. itemId: 'team',
  1580. title: '班组详情',
  1581. items: [panel2]
  1582. }
  1583. ],
  1584. listeners: {
  1585. 'tabchange': function (t, n) {
  1586. var item = n.itemId;
  1587. if (item == 'team') {
  1588. if (document.getElementById('div26_id_inspectorsPanel3') == undefined)
  1589. childPanel2();
  1590. if (document.getElementById('div26_id_inspectorsHtml3Panel3') == undefined)
  1591. childPanel3_fun();
  1592. myStore2.reload();
  1593. }
  1594. }
  1595. },
  1596. renderTo: Ext.getBody()
  1597. });
  1598. myStore.reload();
  1599. mystore2_fun(0);
  1600. childPanel1();
  1601. $(window).resize(function () {
  1602. body_resize();
  1603. body_resize1();
  1604. });
  1605. body_resize1();
  1606. body_resize();
  1607. });