maintenanceperson.js 51 KB

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