maintenanceperson.js 54 KB

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