maintenanceperson.js 51 KB

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