maintenanceplan.js 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425
  1. /**
  2. * maintenanceplan.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 sm = Ext.create('Ext.selection.CheckboxModel');
  18. //var sm1 = Ext.create('Ext.selection.CheckboxModel');
  19. var menuidx = '';
  20. var mouseon;
  21. var mouseoff;
  22. var menu_click;
  23. var AllSelectedRecords = [];
  24. var sm1;
  25. var initflag = false;
  26. Ext.define('MaintenancePlan', {
  27. extend: 'Ext.data.Model',
  28. fields: [
  29. { name: 'id', type: 'string' },
  30. { name: 'xh', type: 'int' },
  31. { name: 'plan_name', type: 'string' },
  32. { name: 'cycle', type: 'string' },
  33. { name: 'cycle_name', type: 'string' },
  34. { name: 'zxsj', type: 'string' },
  35. { name: 'team_id', type: 'string' },
  36. { name: 'team_name', type: 'string' },
  37. { name: 'name', type: 'string' },
  38. { name: 'company_code', type: 'string' },
  39. { name: 'start_date', type: 'string' },
  40. { name: 'end_date', type: 'string' },
  41. { name: 'start_inspect_time', type: 'string' },
  42. { name: 'end_inspect_time', type: 'string' },
  43. ]
  44. });
  45. Ext.define('MaintenancePlan1', {
  46. extend: 'Ext.data.Model',
  47. fields: [
  48. { name: 'id', type: 'string' },
  49. { name: 'spot_name', type: 'string' },
  50. { name: 'spot_address', type: 'string' },
  51. { name: 'pd', type: 'string' },
  52. ]
  53. });
  54. function exportbtn_click() {
  55. baseUrl = document.getElementById('basePath').value;
  56. V_LOGINNAME = $("#V_LOGINNAME").val();
  57. plan_name = document.getElementById('plan_name').value;
  58. person_liable_id = document.getElementById('person_liable_id').value;
  59. var fields = '';
  60. var array = ['xh', 'plan_name', 'cycle_name', 'zxsj', 'team_name', 'name'];
  61. var name = ['序号', '任务名称', '周期', '执行日期', '执行团队', '责任人'];
  62. for (var i = 0; i < 6; i++) {
  63. if (i > 0)
  64. fields += ',';
  65. fields += '{id:"' + array[i] + '",title:"' + name[i] + '",shown:"' + true + '"}';
  66. }
  67. var query = new Object();
  68. // query.V_LOGINNAME = V_LOGINNAME;
  69. // query.plan_name = plan_name;
  70. query.person_liable_id = person_liable_id;
  71. query.EXPORT_FILE = '维保计划列表';
  72. query.fields = '[' + fields + ']';
  73. $.ajax({
  74. type: 'POST',
  75. url: baseUrl + "iot/excel/view/XjPlanMasterExcel",
  76. data: {
  77. queryJson: Ext.JSON.encode(query)
  78. },
  79. success: function (result) {
  80. var json = eval('(' + result + ')');
  81. if (json.action == 'dormExport') {
  82. ConfirmStore = json.RESULT;
  83. var elemIF = document.createElement("iframe");
  84. elemIF.src = baseUrl + json.filename;
  85. elemIF.style.display = "none";
  86. document.body.appendChild(elemIF);
  87. }
  88. }
  89. });
  90. }
  91. var body_resize = function () {
  92. maxHeight = document.documentElement.clientHeight;
  93. maxWidth = document.documentElement.clientWidth;
  94. Ext.getCmp('MaintenancePlanPiebar').setHeight(maxHeight);
  95. Ext.getCmp('MaintenancePlanPiebar').setWidth(maxWidth);
  96. }
  97. Ext.onReady(function () {
  98. var baseUrl = document.getElementById('basePath').value;
  99. var theme = document.getElementById('theme').value;
  100. company_code = document.getElementById('company_code').value;
  101. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  102. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  103. var V_LOGINNAME = $("#V_LOGINNAME").val();
  104. var V_PASSWORD = $("#V_PASSWORD").val();
  105. var chkIcon = '<img src="' + baseUrl + 'res/img/common/check.gif"/>'
  106. var unchkIcon = '<img src="' + baseUrl + 'res/img/common/uncheck.gif"/>'
  107. var countPerPage = 15;
  108. var maxHeight = 10000;
  109. var chkBoolean = function (flag) {
  110. if (flag)
  111. return chkIcon;
  112. return unchkIcon;
  113. }
  114. var states1 = Ext.create('Ext.data.Store', {
  115. fields: ['status', 'name'],
  116. data: [
  117. // {"status":-1, "name":"全选"},
  118. { "status": "待开通", "name": "待开通" },
  119. { "status": "已开通", "name": "已开通" },
  120. { "status": "已锁定", "name": "已锁定" },
  121. { "status": "注销", "name": "注销" },
  122. ]
  123. });
  124. var deselect_fun = function (record) {
  125. var index = AllSelectedRecords.indexOf(record.get("id"));
  126. if (index > -1) {
  127. AllSelectedRecords.splice(index, 1);
  128. return AllSelectedRecords;
  129. }
  130. }
  131. sm1 = Ext.create('Ext.selection.CheckboxModel', {
  132. mode: "MULTI",
  133. listeners: {
  134. deselect: function (me, record, index, opts) {
  135. if (initflag) {
  136. // alert("初始化");
  137. } else {
  138. deselect_fun(record);
  139. }
  140. },
  141. select: function (me, record, index, opts) {
  142. var index = AllSelectedRecords.indexOf(record.get("id"));
  143. if (index > -1) {
  144. return AllSelectedRecords;
  145. } else {
  146. AllSelectedRecords.push(record.get("id"));
  147. return AllSelectedRecords;
  148. }
  149. }
  150. }
  151. });
  152. var clear_append_form = function () {
  153. Ext.getCmp('fa_plan_name').setValue("");
  154. Ext.getCmp('fa_team_id').setValue("");
  155. // Ext.getCmp('fa_cycle').setValue("");
  156. Ext.getCmp('fa_start_date').setValue("");
  157. Ext.getCmp('fa_end_date').setValue("");
  158. Ext.getCmp('fa_start_time').setValue("");
  159. Ext.getCmp('fa_end_time').setValue("");
  160. Ext.getCmp('fa_company_code').setValue("");
  161. // Ext.getCmp('fa_spot_id').setValue("");
  162. AllSelectedRecords = [];
  163. Ext.getCmp('MaintenancePlanListPageToolbar').getStore().reload();
  164. }
  165. var queryJson = new Object();
  166. queryJson.V_LOGINNAME = V_LOGINNAME;
  167. // queryJson.V_PASSWORD = V_PASSWORD;
  168. queryJson.COMMSTATUS = 'NO';
  169. if ((company_code != null) && (company_code != 'null') && (company_code.length > 0))
  170. queryJson.company_code = company_code;
  171. var myStore = Ext.create('Ext.data.Store', {
  172. model: 'MaintenancePlan',
  173. pageSize: countPerPage,
  174. proxy: {
  175. type: 'ajax',
  176. url: baseUrl + 'iot/planmaster/getList',
  177. reader: {
  178. type: 'json',
  179. root: 'RESULT',
  180. totalProperty: 'totalCount'
  181. },
  182. extraParams: {
  183. queryJson: Ext.JSON.encode(queryJson)
  184. }
  185. },
  186. remoteSort: true
  187. });
  188. var myStore1 = Ext.create('Ext.data.Store', {
  189. model: 'MaintenancePlan1',
  190. pageSize: 5,
  191. listeners: {
  192. beforeload: function (me, store, operation, eOpts) {
  193. initflag = true;
  194. },
  195. load: function (me, records, success, opts) {
  196. if (!success || !records || records.length == 0)
  197. return;
  198. //根据全局的选择,初始化选中的列
  199. var selModel = Ext.getCmp('MaintenancePlanListPanel1').getSelectionModel();
  200. Ext.Array.forEach(AllSelectedRecords, function (item) {
  201. for (var i = 0; i < records.length; i++) {
  202. var record = records[i];
  203. if (record.get("id") == item && record.get('pd') != 1) {
  204. // alert(record.get("id")+" - "+this.get("id")+"("+this.data.id+")");
  205. selModel.select(record, true, true); //选中record,并且保持现有的选择,不触发选中事件
  206. }
  207. }
  208. });
  209. // sm1.addListener('deselect',deselect_fun);
  210. initflag = false;
  211. }
  212. },
  213. proxy: {
  214. type: 'ajax',
  215. url: baseUrl + 'iot/inspectionpoints/getList',
  216. reader: {
  217. type: 'json',
  218. root: 'RESULT',
  219. totalProperty: 'totalCount'
  220. },
  221. extraParams: {
  222. queryJson: Ext.JSON.encode(queryJson)
  223. }
  224. },
  225. remoteSort: true
  226. });
  227. myStore1.on('load', function (myStore1, record) {
  228. for (var i = 0; i < record.length; i++) {
  229. var records = record[i];
  230. if (records.get('pd') == 1) {
  231. Ext.getCmp('MaintenancePlanListPanel1').getSelectionModel().select(records, true);
  232. }
  233. };
  234. });
  235. Ext.define('CompanyComboStore', {
  236. extend: 'Ext.data.Model',
  237. fields: [
  238. { name: 'building_name', type: 'string' },
  239. { name: 'building_id', type: 'string' }
  240. ]
  241. });
  242. Ext.define('teamStore', {
  243. extend: 'Ext.data.Model',
  244. fields: [
  245. { name: 'team_name', type: 'string' },
  246. { name: 'id', type: 'string' }
  247. ]
  248. });
  249. var CompanyStory = Ext.create('Ext.data.Store', {
  250. model: 'CompanyComboStore',
  251. proxy: {
  252. type: 'ajax',
  253. actionMethods: {
  254. create: 'POST',
  255. read: 'POST', // by default GET
  256. update: 'POST',
  257. destroy: 'POST'
  258. },
  259. url: baseUrl + 'iot/company/view/getBuildingNameList',
  260. reader: {
  261. type: 'json',
  262. root: 'RESULT',
  263. totalProperty: 'totalCount'
  264. },
  265. extraParams: {
  266. queryJson: Ext.JSON.encode(queryJson)
  267. }
  268. }
  269. });
  270. var teamStory = Ext.create('Ext.data.Store', {
  271. model: 'teamStore',
  272. proxy: {
  273. type: 'ajax',
  274. actionMethods: {
  275. create: 'POST',
  276. read: 'POST', // by default GET
  277. update: 'POST',
  278. destroy: 'POST'
  279. },
  280. url: baseUrl + 'iot/planteam/getList',
  281. reader: {
  282. type: 'json',
  283. root: 'RESULT',
  284. totalProperty: 'totalCount'
  285. },
  286. extraParams: {
  287. queryJson: Ext.JSON.encode(queryJson)
  288. }
  289. }
  290. });
  291. var data = Ext.Date.format(new Date(), 'm/d/Y');
  292. var AppendForm = Ext.create('Ext.form.Panel', {
  293. id: 'MaintenancePlanAppendForm',
  294. labelWidth: 55,
  295. url: baseUrl + 'iot/planmaster/append',
  296. bodyPadding: 15,
  297. frame: true,
  298. labelAlign: 'left',
  299. region: 'north',
  300. enableDrop: true,
  301. ddGroup: 'treeID',
  302. height: 200,
  303. items: [{
  304. autoHeight: true,
  305. layout: 'column',
  306. border: false,
  307. items: [{
  308. columnWidth: .50,
  309. xtype: 'fieldset',
  310. layout: 'form',
  311. // defaults: {anchor: '95%'},
  312. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  313. items: [
  314. {
  315. xtype: 'textfield',
  316. fieldLabel: '任务名称',
  317. id: 'fa_plan_name',
  318. name: 'plan_name',
  319. editable: false,
  320. width: 283,
  321. // store:InspectorsStory
  322. }, {
  323. xtype: 'combo',
  324. fieldLabel: '建筑/项目',
  325. id: 'fa_company_code',
  326. name: 'company_code',
  327. displayField: 'building_name',
  328. valueField: 'building_id',
  329. editable: false,
  330. width: 283,
  331. store: CompanyStory,
  332. listeners: {
  333. select: function (combo, record, index) {
  334. try {
  335. var label = this.value;
  336. var query = new Object();
  337. query.company_code = label;
  338. query.V_LOGINNAME = V_LOGINNAME;
  339. // query.V_PASSWORD = V_PASSWORD;
  340. var jsonstr = Ext.JSON.encode(query);
  341. myStore1.getProxy().extraParams = {
  342. queryJson: jsonstr
  343. };
  344. Ext.getCmp('MaintenancePlanListPageToolbar1').moveFirst();
  345. }
  346. catch (ex) {
  347. Ext.MessageBox.alert("错误", "数据加载失败。");
  348. }
  349. }
  350. }
  351. }, {
  352. xtype: 'timefield',
  353. fieldLabel: '维保开始时间',
  354. id: 'fa_start_time',
  355. name: "start_time",
  356. minValue: '00:00',
  357. maxValue: '24:00',
  358. minText: '时间要大于{0}',
  359. maxText: '时间要小于{0}',
  360. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  361. increment: 30,//跨度,默认是15分钟
  362. invalidText: '时间格式错误',
  363. anchor: '40%'
  364. }, {
  365. xtype: 'timefield',
  366. fieldLabel: '维保结束时间',
  367. id: 'fa_end_time',
  368. name: "end_time",
  369. minValue: '00:00',
  370. maxValue: '24:00',
  371. minText: '时间要大于{0}',
  372. maxText: '时间要小于{0}',
  373. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  374. increment: 30,//跨度,默认是15分钟
  375. invalidText: '时间格式错误',
  376. anchor: '80%'
  377. }
  378. ]
  379. }, {
  380. columnWidth: .50,
  381. xtype: 'fieldset',
  382. layout: 'form',
  383. // defaults: {anchor: '95%'},
  384. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  385. items: [
  386. {
  387. xtype: 'combo',
  388. fieldLabel: '执行团队',
  389. id: 'fa_team_id',
  390. name: 'team_id',
  391. displayField: 'team_name',
  392. valueField: 'id',
  393. editable: false,
  394. width: 100,
  395. store: teamStory
  396. }, {
  397. xtype: 'fieldcontainer',
  398. fieldLabel: '周期',
  399. defaultType: 'radiofield',
  400. columns: 2,
  401. id: "fa_cycle",
  402. defaults: {
  403. flex: 1
  404. },
  405. layout: 'hbox',
  406. items: [
  407. { boxLabel: '每日', name: 'fa_cycle', inputValue: "0", id: 'radio1' },
  408. { boxLabel: '每周', name: 'fa_cycle', inputValue: "1", id: 'radio2' },
  409. { boxLabel: '每月', name: 'fa_cycle', inputValue: "2", id: 'radio3' }
  410. ]
  411. }, {
  412. xtype: 'datefield',
  413. fieldLabel: "执行开始日期",
  414. minValue: data,
  415. // '07/07/2017',
  416. minText: "当前日期选择应大于当天日期",
  417. format: "Y-m-d",
  418. columnWidth: 0.5,
  419. id: 'fa_start_date',
  420. name: "start_date",
  421. editable: false,//只读约束
  422. anchor: '80%'
  423. }, {
  424. xtype: 'datefield',
  425. fieldLabel: "执行结束日期",
  426. minValue: data,
  427. // '07/07/2017',
  428. minText: "当前日期选择应大于当天日期",
  429. format: "Y-m-d",
  430. columnWidth: 0.5,
  431. id: 'fa_end_date',
  432. name: "end_date",
  433. editable: false,//只读约束
  434. anchor: '80%'
  435. }, {
  436. id: 'fa_queryJson',
  437. name: 'queryJson',
  438. hidden: true
  439. }
  440. ]
  441. }
  442. ]
  443. }]
  444. });
  445. function public_insert() {
  446. var query = new Object();
  447. var spot_id = null;
  448. query.plan_name = Ext.getCmp('fa_plan_name').getValue();
  449. if (query.plan_name == null || query.plan_name == "") {
  450. Ext.Msg.alert('系统提示', '任务名称不能为空!', function (btn, txt) {
  451. Ext.getCmp('fa_plan_name').setValue("");
  452. });
  453. return;
  454. }
  455. query.company_code = Ext.getCmp('fa_company_code').getValue();
  456. if (query.company_code == null || query.company_code == "") {
  457. Ext.Msg.alert('系统提示', '请选择建筑/项目!', function (btn, txt) {
  458. Ext.getCmp('fa_company_code').setValue("");
  459. });
  460. return;
  461. }
  462. var start_time = Ext.getCmp('fa_start_time').getValue();
  463. if (start_time == null || start_time == "") {
  464. Ext.Msg.alert('系统提示', '请选择维保开始时间!', function (btn, txt) {
  465. Ext.getCmp('fa_start_time').setValue("");
  466. });
  467. return;
  468. } else {
  469. var start_time1 = ((start_time.getHours() < 10) ? ('0' + start_time.getHours()) : start_time.getHours()) + ':' + ((start_time.getMinutes() < 10) ? ('0' + start_time.getMinutes()) : start_time.getMinutes());
  470. }
  471. var end_time = Ext.getCmp('fa_end_time').getValue();
  472. if (end_time == null || end_time == "") {
  473. Ext.Msg.alert('系统提示', '请选择维保结束时间!', function (btn, txt) {
  474. Ext.getCmp('fa_end_time').setValue("");
  475. });
  476. return;
  477. } else {
  478. var end_time1 = ((end_time.getHours() < 10) ? ('0' + end_time.getHours()) : end_time.getHours()) + ':' + ((end_time.getMinutes() < 10) ? ('0' + end_time.getMinutes()) : end_time.getMinutes());
  479. }
  480. query.team_id = Ext.getCmp('fa_team_id').getValue();
  481. if (query.team_id == null || query.team_id == "") {
  482. Ext.Msg.alert('系统提示', '请选择执行团队!', function (btn, txt) {
  483. Ext.getCmp('fa_company_code').setValue("");
  484. });
  485. return;
  486. }
  487. query.start_date = Ext.util.Format.date(Ext.getCmp('fa_start_date').getValue(), 'Y-m-d');
  488. if (query.start_date == null || query.start_date == "") {
  489. Ext.Msg.alert('系统提示', '请选择执行开始日期!', function (btn, txt) {
  490. Ext.getCmp('fa_start_date').setValue("");
  491. });
  492. return;
  493. }
  494. query.end_date = Ext.util.Format.date(Ext.getCmp('fa_end_date').getValue(), 'Y-m-d');
  495. if (query.end_date == null || query.end_date == "") {
  496. Ext.Msg.alert('系统提示', '请选择执行结束日期!', function (btn, txt) {
  497. Ext.getCmp('fa_end_date').setValue("");
  498. });
  499. return;
  500. }
  501. var fa_cycle = AppendForm.getForm().findField("fa_cycle").getGroupValue();
  502. var V_LOGINNAME = $("#V_LOGINNAME").val();
  503. var V_PASSWORD = $("#V_PASSWORD").val();
  504. if (AllSelectedRecords.length == 1) {
  505. query.spot_id = AllSelectedRecords[0];
  506. } else {
  507. if (AllSelectedRecords.length > 1) {
  508. for (var i = 0; i < AllSelectedRecords.length; i++) {
  509. if (i == 0)
  510. spot_id = AllSelectedRecords[i];
  511. else
  512. spot_id += "," + AllSelectedRecords[i];
  513. }
  514. // alert("测试4-"+spot_id);
  515. query.spot_id = spot_id;
  516. } else {
  517. Ext.Msg.alert('请先选择', '至少选择一条维保点位,再点击提交');
  518. return;
  519. }
  520. }
  521. query.cycle = fa_cycle;
  522. query.start_inspect_time = start_time1;
  523. query.end_inspect_time = end_time1;
  524. // query.V_LOGINNAME = V_LOGINNAME;
  525. var jsonstr = Ext.JSON.encode(query);
  526. Ext.Ajax.request({
  527. // timeout : 3000000,
  528. url: baseUrl + 'iot/planmaster/append',
  529. params: 'queryJson=' + jsonstr,
  530. success: function (resp, opts) {
  531. Ext.Msg.alert('操作成功', '计划已添加', function (btn, txt) {
  532. // myStore.reload();
  533. clear_append_form();
  534. });
  535. }
  536. });
  537. }
  538. var appendwin = function () {
  539. AllSelectedRecords = [];
  540. var query = new Object();
  541. query.V_LOGINNAME = V_LOGINNAME;
  542. // query.V_PASSWORD=V_PASSWORD;
  543. var jsonstr = Ext.JSON.encode(query);
  544. myStore1.getProxy().extraParams = {
  545. queryJson: jsonstr
  546. };
  547. Ext.getCmp('MaintenancePlanListPageToolbar1').moveFirst();
  548. Ext.create('Ext.window.Window', {
  549. title: '新增维保计划',
  550. height: 600,
  551. width: 800,
  552. modal: true,
  553. layout: 'border',
  554. items: [AppendForm, MaintenancePlanTab],
  555. closeAction: 'hide',
  556. buttons: [{
  557. text: '提交',
  558. iconCls: 'ok_btn',
  559. handler: function () {
  560. public_insert();
  561. }
  562. }, {
  563. text: '关闭',
  564. iconCls: 'cancel_btn',
  565. handler: function () {
  566. this.up('window').hide();
  567. }
  568. }]
  569. }).show();
  570. }
  571. var del_sm = function () {
  572. if (sm.getCount() == 1) {
  573. var selected = sm.getSelection();
  574. var query = new Object();
  575. var list = new Array();
  576. var o = new Object();
  577. o.id = selected[0].raw.id;
  578. list.push(o);
  579. query.ID_LIST = list;
  580. var jsonstr = Ext.JSON.encode(query);
  581. Ext.MessageBox.confirm('删除任务信息', '是否删除' + selected[0].raw.plan_name + ' 维保任务?', function (btn) {
  582. if (btn == 'yes') {
  583. $.ajax({
  584. type: 'POST',
  585. url: baseUrl + "iot/planmaster/del",
  586. data: {
  587. queryJson: jsonstr
  588. },
  589. success: function (result) {
  590. var json = eval('(' + result + ')');
  591. if (json.action == 'deletePlanMaster') {
  592. if (json.success == true) {
  593. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  594. Ext.getCmp('MaintenancePlanListPanel').getStore().reload();
  595. });
  596. } else {
  597. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  598. Ext.getCmp('MaintenancePlanListPanel').getStore().reload();
  599. });
  600. }
  601. }
  602. }
  603. });
  604. }
  605. }, this);
  606. } else {
  607. if (sm.getCount() > 1) {
  608. var query = new Object();
  609. var list = new Array();
  610. for (var i = 0; i < sm.getCount(); i++) {
  611. var selected = sm.getSelection();
  612. var o = new Object();
  613. o.id = selected[i].raw.id;
  614. list.push(o);
  615. }
  616. query.ID_LIST = list;
  617. var jsonstr = Ext.JSON.encode(query);
  618. Ext.MessageBox.confirm('删除任务信息', '是否删除选中的' + sm.getCount() + ' 个维保任务?', function (btn) {
  619. if (btn == 'yes') {
  620. $.ajax({
  621. type: 'POST',
  622. url: baseUrl + "iot/planmaster/del",
  623. data: {
  624. queryJson: jsonstr
  625. },
  626. success: function (result) {
  627. var json = eval('(' + result + ')');
  628. if (json.action == 'deletePlanMaster') {
  629. if (json.success == true) {
  630. Ext.Msg.alert('操作成功', json.MSG, function (btn, txt) {
  631. Ext.getCmp('MaintenancePlanListPanel').getStore().reload();
  632. });
  633. } else {
  634. Ext.Msg.alert('操作失败', json.MSG, function (btn, txt) {
  635. Ext.getCmp('MaintenancePlanListPanel').getStore().reload();
  636. });
  637. }
  638. }
  639. }
  640. });
  641. }
  642. }, this);
  643. } else {
  644. Ext.Msg.alert('请先选择', '至少选择一条记录,再点击删除');
  645. }
  646. }
  647. }
  648. var clear_modify_form = function () {
  649. Ext.getCmp('fm_id').setValue("");
  650. Ext.getCmp('fm_plan_name').setValue("");
  651. Ext.getCmp('fm_team_id').setValue("");
  652. // Ext.getCmp('fm_cycle').setValue("");
  653. Ext.getCmp('fm_start_date').setValue("");
  654. Ext.getCmp('fm_end_date').setValue("");
  655. Ext.getCmp('fm_start_time').setValue("");
  656. Ext.getCmp('fm_end_time').setValue("");
  657. Ext.getCmp('fm_company_code').setValue("");
  658. AllSelectedRecords = [];
  659. // Ext.getCmp('fm_spot_id').setValue("");
  660. Ext.getCmp('MaintenancePlanListPageToolbar').getStore().reload();
  661. }
  662. var show_page = function () {
  663. var maintenancePlan_title2_input = document.getElementById('maintenancePlan_title2_input').value;
  664. var maintenancePlan_title3_input1 = document.getElementById('maintenancePlan_title3_input1').value;
  665. var query = new Object();
  666. if (maintenancePlan_title2_input.length > 0) {
  667. query.plan_name = maintenancePlan_title2_input;
  668. $("#plan_name").val(maintenancePlan_title2_input);
  669. }
  670. if (maintenancePlan_title3_input1.length > 0) {
  671. query.person_liable_id = maintenancePlan_title3_input1;
  672. $("#person_liable_id").val(maintenancePlan_title3_input1);
  673. }
  674. // query.V_LOGINNAME = V_LOGINNAME;
  675. // query.V_PASSWORD = V_PASSWORD;
  676. var jsonstr = Ext.JSON.encode(query);
  677. myStore.getProxy().extraParams = {
  678. queryJson: jsonstr
  679. };
  680. Ext.getCmp('MaintenancePlanListPageToolbar').moveFirst();
  681. }
  682. var reset1 = function () {
  683. document.getElementById('maintenancePlan_title2_input').value = '';
  684. document.getElementById('maintenancePlan_title3_input1').value = '0';
  685. $("#plan_name").val('');
  686. $("#person_liable_id").val('');
  687. show_page();
  688. }
  689. mouseon = function (obj) {
  690. var id = obj.id;
  691. $("#" + id).removeClass(id);
  692. $("#" + id).addClass(id + '_on');
  693. }
  694. mouseoff = function (obj) {
  695. var mid = "maintenancePlan_";
  696. for (var i = 1; i < 7; i++) {
  697. var id = "maintenancePlan_title" + i + "_div";
  698. $("#" + id).removeClass(id + '_on');
  699. $("#" + id).addClass(id);
  700. }
  701. if (menuidx == 'm1') {
  702. mid += 'title1_div';
  703. $("#" + mid).removeClass(mid);
  704. $("#" + mid).addClass(mid + '_on');
  705. }
  706. else if (menuidx == 'm2') {
  707. mid += 'title2_div';
  708. $("#" + mid).removeClass(mid);
  709. $("#" + mid).addClass(mid + '_on');
  710. }
  711. else if (menuidx == 'm3') {
  712. mid += 'title3_div';
  713. $("#" + mid).removeClass(mid);
  714. $("#" + mid).addClass(mid + '_on');
  715. }
  716. else if (menuidx == 'm4') {
  717. mid += 'title4_div';
  718. $("#" + mid).removeClass(mid);
  719. $("#" + mid).addClass(mid + '_on');
  720. }
  721. else if (menuidx == 'm5') {
  722. mid += 'title5_div';
  723. $("#" + mid).removeClass(mid);
  724. $("#" + mid).addClass(mid + '_on');
  725. }
  726. else if (menuidx == 'm6') {
  727. mid += 'title6_div';
  728. $("#" + mid).removeClass(mid);
  729. $("#" + mid).addClass(mid + '_on');
  730. }
  731. }
  732. menu_click = function (obj) {
  733. var id = obj.id;
  734. if (id == 'maintenancePlan_title1_div') {
  735. menuidx = 'm1';
  736. show_page();
  737. }
  738. else if (id == 'maintenancePlan_title2_div') {
  739. menuidx = 'm2';
  740. reset1();
  741. }
  742. else if (id == 'maintenancePlan_title3_div') {
  743. menuidx = 'm3';
  744. exportbtn_click();
  745. }
  746. else if (id == 'maintenancePlan_title4_div') {
  747. menuidx = 'm4';
  748. del_sm();
  749. }
  750. else if (id == 'maintenancePlan_title5_div') {
  751. menuidx = 'm5';
  752. appendwin();
  753. }
  754. else if (id == 'maintenancePlan_title6_div') {
  755. menuidx = 'm6';
  756. chk_sm();
  757. }
  758. }
  759. // var childPanel1 = Ext.create('Ext.Panel', {
  760. // height:188,
  761. // width:'100%',
  762. // html: '<div class="MaintenancePersonTitle">维保计划</div><div class="title2_div">任务名称</div><input type="text" class="input_class" id="maintenancePlan_title2_input" value=""><div class="title3_div">责任人</div><input type="text" class="input1_class" id="maintenancePlan_title3_input1" value=""><div id="maintenancePlan_title1_div" class="maintenancePlan_title1_div" onmouseover="mouseon(this);" onmouseout="mouseoff(this);" onclick="menu_click(this);"></div><div id="maintenancePlan_title2_div" class="maintenancePlan_title2_div" onmouseover="mouseon(this);" onmouseout="mouseoff(this);" onclick="menu_click(this);"></div><div id="maintenancePlan_title3_div" class="maintenancePlan_title3_div" onmouseover="mouseon(this);" onmouseout="mouseoff(this);" onclick="menu_click(this);"></div><div id="maintenancePlan_title4_div" class="maintenancePlan_title4_div" onmouseover="mouseon(this);" onmouseout="mouseoff(this);" onclick="menu_click(this);"></div><div id="maintenancePlan_title5_div" class="maintenancePlan_title5_div" onmouseover="mouseon(this);" onmouseout="mouseoff(this);" onclick="menu_click(this);"></div><div id="maintenancePlan_title6_div" class="maintenancePlan_title6_div" onmouseover="mouseon(this);" onmouseout="mouseoff(this);" onclick="menu_click(this);"></div>'
  763. // });
  764. var piedarHtml = function () {
  765. var maintenancePlanHtml = document.getElementById('maintenancePlanHtml');
  766. var divhiddle = document.createElement('div');
  767. divhiddle.id = 'div26_id_maintenancePlanPanel3';
  768. divhiddle.setAttribute('class', 'SpringHandleHtml3DivHiddle');
  769. maintenancePlanHtml.appendChild(divhiddle);
  770. var title = document.createElement('div');
  771. title.setAttribute('class', 'MaintenancePersonTitle');
  772. title.innerHTML = '维保计划';
  773. maintenancePlanHtml.appendChild(title);
  774. var title2 = document.createElement('div');
  775. title2.setAttribute('class', 'title2_div');
  776. title2.innerHTML = '任务名称';
  777. maintenancePlanHtml.appendChild(title2);
  778. var input = document.createElement('input');
  779. input.setAttribute('class', 'input_class');
  780. input.setAttribute('id', 'maintenancePlan_title2_input');
  781. input.setAttribute('type', 'text');
  782. input.setAttribute('value', '');
  783. maintenancePlanHtml.appendChild(input);
  784. var title3 = document.createElement('div');
  785. title3.setAttribute('class', 'title3_div');
  786. title3.innerHTML = '责任人';
  787. maintenancePlanHtml.appendChild(title3);
  788. var select = document.createElement('select');
  789. select.setAttribute('class', 'input1_class');
  790. select.setAttribute('id', 'maintenancePlan_title3_input1');
  791. maintenancePlanHtml.appendChild(select);
  792. var option2 = document.createElement('option');
  793. option2.innerHTML = '所有人';
  794. option2.setAttribute('value', '0');
  795. select.appendChild(option2);
  796. for (var i = 0; i < ConfirmStore.length; i++) {
  797. var option3 = document.createElement('option');
  798. option3.innerHTML = ConfirmStore[i].name;
  799. option3.setAttribute('value', ConfirmStore[i].person_liable_id);
  800. select.appendChild(option3);
  801. }
  802. var title4 = document.createElement('div');
  803. title4.setAttribute('class', 'maintenance_title1_div');
  804. title4.setAttribute('id', 'maintenancePlan_title1_div');
  805. title4.setAttribute('onmouseover', "mouseon(this)");
  806. title4.setAttribute('onmouseout', "mouseoff(this)");
  807. title4.setAttribute('onclick', "menu_click(this)");
  808. maintenancePlanHtml.appendChild(title4);
  809. var title5 = document.createElement('div');
  810. title5.setAttribute('class', 'maintenance_title2_div');
  811. title5.setAttribute('id', 'maintenancePlan_title2_div');
  812. title5.setAttribute('onmouseover', "mouseon(this)");
  813. title5.setAttribute('onmouseout', "mouseoff(this)");
  814. title5.setAttribute('onclick', "menu_click(this)");
  815. maintenancePlanHtml.appendChild(title5);
  816. var title6 = document.createElement('div');
  817. title6.setAttribute('class', 'maintenance_title3_div');
  818. title6.setAttribute('id', 'maintenancePlan_title3_div');
  819. title6.setAttribute('onmouseover', "mouseon(this)");
  820. title6.setAttribute('onmouseout', "mouseoff(this)");
  821. title6.setAttribute('onclick', "menu_click(this)");
  822. maintenancePlanHtml.appendChild(title6);
  823. var title7 = document.createElement('div');
  824. title7.setAttribute('class', 'maintenance_title4_div');
  825. title7.setAttribute('id', 'maintenancePlan_title4_div');
  826. title7.setAttribute('onmouseover', "mouseon(this)");
  827. title7.setAttribute('onmouseout', "mouseoff(this)");
  828. title7.setAttribute('onclick', "menu_click(this)");
  829. maintenancePlanHtml.appendChild(title7);
  830. var title8 = document.createElement('div');
  831. title8.setAttribute('class', 'maintenance_title5_div');
  832. title8.setAttribute('id', 'maintenancePlan_title5_div');
  833. title8.setAttribute('onmouseover', "mouseon(this)");
  834. title8.setAttribute('onmouseout', "mouseoff(this)");
  835. title8.setAttribute('onclick', "menu_click(this)");
  836. maintenancePlanHtml.appendChild(title8);
  837. var title9 = document.createElement('div');
  838. title9.setAttribute('class', 'maintenance_title6_div');
  839. title9.setAttribute('id', 'maintenancePlan_title6_div');
  840. title9.setAttribute('onmouseover', "mouseon(this)");
  841. title9.setAttribute('onmouseout', "mouseoff(this)");
  842. title9.setAttribute('onclick', "menu_click(this)");
  843. maintenancePlanHtml.appendChild(title9);
  844. }
  845. var piedarHtml_fun = function () {
  846. var query = new Object();
  847. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  848. $.ajax({
  849. type: 'POST',
  850. url: baseUrl + "iot/planteam/getzrrList",
  851. data: {
  852. queryJson: Ext.JSON.encode(query)
  853. },
  854. success: function (result) {
  855. var json = eval('(' + result + ')');
  856. if (json.action == 'getPlanTeamList') {
  857. ConfirmStore = json.RESULT;
  858. if (document.getElementById('div26_id_maintenancePlanPanel3') == undefined)
  859. piedarHtml();
  860. }
  861. }
  862. });
  863. }
  864. var ModifyForm = Ext.create('Ext.form.Panel', {
  865. id: 'MaintenancePlanEditForm',
  866. labelWidth: 55,
  867. url: baseUrl + 'iot/planmaster/update',
  868. bodyPadding: 15,
  869. frame: true,
  870. labelAlign: 'left',
  871. region: 'north',
  872. enableDrop: true,
  873. ddGroup: 'treeID',
  874. height: 200,
  875. items: [{
  876. autoHeight: true,
  877. layout: 'column',
  878. border: false,
  879. items: [{
  880. columnWidth: .50,
  881. xtype: 'fieldset',
  882. layout: 'form',
  883. // defaults: {anchor: '95%'},
  884. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  885. items: [
  886. {
  887. xtype: 'textfield',
  888. fieldLabel: '任务名称',
  889. id: 'fm_plan_name',
  890. name: 'plan_name',
  891. editable: false,
  892. width: 283,
  893. readOnly: 'true'
  894. // store:InspectorsStory
  895. }, {
  896. xtype: 'combo',
  897. fieldLabel: '建筑/项目',
  898. id: 'fm_company_code',
  899. name: 'company_code',
  900. displayField: 'building_name',
  901. valueField: 'building_id',
  902. editable: false,
  903. width: 283,
  904. store: CompanyStory,
  905. readOnly: 'true'
  906. }, {
  907. xtype: 'timefield',
  908. fieldLabel: '维保开始时间',
  909. id: 'fm_start_time',
  910. name: "start_time",
  911. minValue: '00:00',
  912. maxValue: '24:00',
  913. minText: '时间要大于{0}',
  914. maxText: '时间要小于{0}',
  915. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  916. increment: 30,//跨度,默认是15分钟
  917. invalidText: '时间格式错误',
  918. anchor: '40%'
  919. }, {
  920. xtype: 'timefield',
  921. fieldLabel: '维保结束时间',
  922. id: 'fm_end_time',
  923. name: "end_time",
  924. minValue: '00:00',
  925. maxValue: '24:00',
  926. minText: '时间要大于{0}',
  927. maxText: '时间要小于{0}',
  928. format: 'G:i',//时间格式G(24小时进制)、i、s(时分秒,g是12小时进制)
  929. increment: 30,//跨度,默认是15分钟
  930. invalidText: '时间格式错误',
  931. anchor: '80%'
  932. }
  933. ]
  934. }, {
  935. columnWidth: .50,
  936. xtype: 'fieldset',
  937. layout: 'form',
  938. // defaults: {anchor: '95%'},
  939. style: 'margin-left: 5px;padding-left: 5px;border:0px solid #B5B8C8!important;',
  940. items: [
  941. {
  942. xtype: 'combo',
  943. fieldLabel: '执行团队',
  944. id: 'fm_team_id',
  945. name: 'team_id',
  946. displayField: 'team_name',
  947. valueField: 'id',
  948. editable: false,
  949. width: 100,
  950. store: teamStory
  951. }, {
  952. xtype: 'fieldcontainer',
  953. fieldLabel: '周期',
  954. defaultType: 'radiofield',
  955. columns: 2,
  956. id: "fm_cycle",
  957. defaults: {
  958. flex: 1
  959. },
  960. layout: 'hbox',
  961. items: [
  962. { boxLabel: '每日', name: 'fm_cycle', inputValue: "0", id: 'radio4' },
  963. { boxLabel: '每周', name: 'fm_cycle', inputValue: "1", id: 'radio5' },
  964. { boxLabel: '每月', name: 'fm_cycle', inputValue: "2", id: 'radio6' }
  965. ]
  966. }, {
  967. xtype: 'datefield',
  968. fieldLabel: "执行开始日期",
  969. minValue: '07/07/2017',
  970. minText: "当前日期选择应大于当天日期",
  971. format: "Y-m-d",
  972. columnWidth: 0.5,
  973. id: 'fm_start_date',
  974. name: "start_data",
  975. editable: false,//只读约束
  976. anchor: '80%',
  977. readOnly: 'true'
  978. }, {
  979. xtype: 'datefield',
  980. fieldLabel: "执行结束日期",
  981. minValue: '07/07/2017',
  982. // '07/07/2017',
  983. minText: "当前日期选择应大于当天日期",
  984. format: "Y-m-d",
  985. columnWidth: 0.5,
  986. id: 'fm_end_date',
  987. name: "end_date",
  988. editable: false,//只读约束
  989. anchor: '80%'
  990. }, {
  991. xtype: 'textfield',
  992. id: 'fm_id',
  993. name: 'id',
  994. hidden: true
  995. }, {
  996. id: 'fm_queryJson',
  997. name: 'queryJson',
  998. hidden: true
  999. }
  1000. ]
  1001. }
  1002. ]
  1003. }]
  1004. });
  1005. function public_update() {
  1006. var fm_cycle = ModifyForm.getForm().findField("fm_cycle").getGroupValue();
  1007. var V_LOGINNAME = $("#V_LOGINNAME").val();
  1008. var V_PASSWORD = $("#V_PASSWORD").val();
  1009. var start_time = Ext.getCmp('fm_start_time').getValue();
  1010. if (start_time == null || start_time == "") {
  1011. Ext.Msg.alert('系统提示', '请选择维保开始时间!', function (btn, txt) {
  1012. Ext.getCmp('fa_start_time').setValue("");
  1013. });
  1014. return;
  1015. } else {
  1016. var start_time1 = ((start_time.getHours() < 10) ? ('0' + start_time.getHours()) : start_time.getHours()) + ':' + ((start_time.getMinutes() < 10) ? ('0' + start_time.getMinutes()) : start_time.getMinutes());
  1017. }
  1018. var end_time = Ext.getCmp('fm_end_time').getValue();
  1019. if (end_time == null || end_time == "") {
  1020. Ext.Msg.alert('系统提示', '请选择维保结束时间!', function (btn, txt) {
  1021. Ext.getCmp('fa_end_time').setValue("");
  1022. });
  1023. return;
  1024. } else {
  1025. var end_time1 = ((end_time.getHours() < 10) ? ('0' + end_time.getHours()) : end_time.getHours()) + ':' + ((end_time.getMinutes() < 10) ? ('0' + end_time.getMinutes()) : end_time.getMinutes());
  1026. }
  1027. // Ext.MessageBox.alert('提示', '您的兴趣是' + V_LOGINNAME);
  1028. var query = new Object();
  1029. var spot_id = null;
  1030. if (AllSelectedRecords.length == 1) {
  1031. query.spot_id = AllSelectedRecords[0];
  1032. } else {
  1033. if (AllSelectedRecords.length > 1) {
  1034. for (var i = 0; i < AllSelectedRecords.length; i++) {
  1035. if (i == 0)
  1036. spot_id = AllSelectedRecords[i];
  1037. else
  1038. spot_id += "," + AllSelectedRecords[i];
  1039. }
  1040. query.spot_id = spot_id;
  1041. } else {
  1042. Ext.Msg.alert('系统提示', '至少选择一条维保点位,再点击提交!');
  1043. return;
  1044. }
  1045. }
  1046. query.id = Ext.getCmp('fm_id').getValue();
  1047. query.plan_name = Ext.getCmp('fm_plan_name').getValue();
  1048. query.team_id = Ext.getCmp('fm_team_id').getValue();
  1049. query.company_code = Ext.getCmp('fm_company_code').getValue();
  1050. query.cycle = fm_cycle;
  1051. query.start_inspect_time = start_time1;
  1052. query.end_inspect_time = end_time1;
  1053. query.start_date = Ext.util.Format.date(Ext.getCmp('fm_start_date').getValue(), 'Y-m-d');
  1054. query.end_date = Ext.util.Format.date(Ext.getCmp('fm_end_date').getValue(), 'Y-m-d');
  1055. // query.V_LOGINNAME = V_LOGINNAME;
  1056. var jsonstr = Ext.JSON.encode(query);
  1057. // Ext.getCmp('MaintenancePlanEditForm').submit({
  1058. // method:'post',
  1059. // success: function(form, action) {
  1060. // Ext.Msg.alert('操作成功', '计划已修改', function(btn,txt){
  1061. // clear_modify_form();
  1062. // });
  1063. // },
  1064. // failure: function(form, action) {
  1065. // Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
  1066. // clear_modify_form();
  1067. // });
  1068. // }
  1069. // });
  1070. Ext.Ajax.request({
  1071. // timeout : 3000000,
  1072. url: baseUrl + 'iot/planmaster/update',
  1073. params: 'queryJson=' + jsonstr,
  1074. success: function (resp, opts) {
  1075. Ext.Msg.alert('操作成功', '计划已修改', function (btn, txt) {
  1076. // myStore.reload();
  1077. clear_modify_form();
  1078. });
  1079. }
  1080. });
  1081. this.up('window').hide();
  1082. }
  1083. var modifywin = function () {
  1084. Ext.create('Ext.window.Window', {
  1085. title: '修改',
  1086. height: 600,
  1087. width: 800,
  1088. modal: true,
  1089. layout: 'border',
  1090. items: [ModifyForm, MaintenancePlanTab],
  1091. closeAction: 'hide',
  1092. buttons: [{
  1093. text: '修改',
  1094. iconCls: 'ok_btn',
  1095. handler: function () {
  1096. public_update();
  1097. }
  1098. }, {
  1099. text: '关闭',
  1100. iconCls: 'cancel_btn',
  1101. handler: function () {
  1102. this.up('window').hide();
  1103. }
  1104. }]
  1105. }).show();
  1106. }
  1107. var chk_sm = function () {
  1108. if (sm.getCount() == 1) {
  1109. AllSelectedRecords = [];
  1110. modifywin();
  1111. teamStory.reload();
  1112. CompanyStory.reload();
  1113. var selected = sm.getSelection();
  1114. var label = selected[0].raw.id
  1115. // alert("主表ID"+label);
  1116. var query = new Object();
  1117. // if(label.length>0){
  1118. query.dwid = label;
  1119. // }
  1120. // alert("主表ID1"+query.dwid);
  1121. query.V_LOGINNAME = V_LOGINNAME;
  1122. // query.V_PASSWORD = V_PASSWORD;
  1123. var jsonstr = Ext.JSON.encode(query);
  1124. myStore1.getProxy().extraParams = {
  1125. queryJson: jsonstr
  1126. };
  1127. Ext.getCmp('MaintenancePlanListPageToolbar1').moveFirst();
  1128. Ext.getCmp('fm_plan_name').setValue(selected[0].raw.plan_name);
  1129. Ext.getCmp('fm_team_id').setValue(selected[0].raw.team_id);
  1130. // Ext.getCmp('fm_cycle').setValue(selected[0].raw.cycle);
  1131. var a = selected[0].raw.cycle;
  1132. if (Number(a) == 0) {
  1133. var radio = Ext.getCmp('radio4');
  1134. radio.setValue(true);
  1135. } else if (Number(a) == 1) {
  1136. var radio = Ext.getCmp('radio5');
  1137. radio.setValue(true);
  1138. } else if (Number(a) == 2) {
  1139. var radio = Ext.getCmp('radio6');
  1140. radio.setValue(true);
  1141. }
  1142. Ext.getCmp('fm_start_time').setValue(selected[0].raw.start_inspect_time);
  1143. Ext.getCmp('fm_end_time').setValue(selected[0].raw.end_inspect_time);
  1144. Ext.getCmp('fm_start_date').setValue(selected[0].raw.start_date);
  1145. Ext.getCmp('fm_end_date').setValue(selected[0].raw.end_date);
  1146. Ext.getCmp('fm_end_date').setMinValue(selected[0].raw.end_date);
  1147. Ext.getCmp('fm_company_code').setValue(selected[0].raw.company_code);
  1148. var b = selected[0].raw.id;
  1149. // Ext.get('fm_id').set({ value: b });
  1150. Ext.getCmp('fm_id').setValue(b);
  1151. } else {
  1152. Ext.Msg.alert('请先选择', '请先选择一条记录,再点击修改');
  1153. }
  1154. }
  1155. var maintenancedevice = function () {
  1156. var maintenance_look_device = document.getElementById('maintenanceplan_look_device');
  1157. var img = document.createElement('img');
  1158. img.width = 400;
  1159. img.height = 400;
  1160. img.src = baseUrl + ConfirmStore[0].picture_route;
  1161. img.setAttribute('class', 'maintenance_look_device_img');
  1162. maintenance_look_device.appendChild(img);
  1163. var div4 = document.createElement('div');
  1164. div4.style.textAlign = 'center';
  1165. div4.innerHTML = ConfirmStore[0].remarks;
  1166. maintenance_look_device.appendChild(div4);
  1167. }
  1168. var editMaintenance = function (spot_id) {
  1169. var spot_id = spot_id;
  1170. Ext.create('Ext.window.Window', {
  1171. id: 'maintenanceplan_data_win1',
  1172. height: 500,
  1173. width: 400,
  1174. layout: 'fit',
  1175. modal: true,
  1176. buttons: [
  1177. {
  1178. text: '关闭',
  1179. handler: function () {
  1180. Ext.getCmp('maintenanceplan_data_win1').destroy();
  1181. }
  1182. }
  1183. ],
  1184. closeAction: 'destroy',
  1185. html: '<div id="maintenanceplan_look_device"></div>'
  1186. }).show();
  1187. var query = new Object();
  1188. query.V_LOGINNAME = $("#V_LOGINNAME").val();
  1189. // query.V_PASSWORD = $("#V_PASSWORD").val();
  1190. query.id = spot_id;
  1191. $.ajax({
  1192. type: 'POST',
  1193. url: baseUrl + "iot/inspectionpoints/getList",
  1194. data: {
  1195. queryJson: Ext.JSON.encode(query)
  1196. },
  1197. success: function (result) {
  1198. var json = eval('(' + result + ')');
  1199. if (json.action == 'getInspectionPointsList') {
  1200. ConfirmStore = json.RESULT;
  1201. maintenancedevice(ConfirmStore);
  1202. }
  1203. }
  1204. });
  1205. }
  1206. var MaintenancePlanPanel1 = Ext.create('Ext.grid.Panel', {
  1207. header: {
  1208. height: 0,
  1209. border: '0px solid #000000'
  1210. },
  1211. id: 'MaintenancePlanListPanel1',
  1212. store: myStore1,
  1213. selModel: sm1,
  1214. columns: [
  1215. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1216. { header: '序号', dataIndex: 'xh', hidden: true, menuDisabled: true },
  1217. { header: '点位名称', dataIndex: 'spot_name', width: 260, align: 'center', menuDisabled: true },
  1218. { header: '点位地址', dataIndex: 'spot_address', width: 260, align: 'center', menuDisabled: true },
  1219. // { header: '维保日期', dataIndex: 'planned_date', width:236,align:'center', menuDisabled:true },
  1220. {
  1221. text: '点位详情',
  1222. xtype: 'actioncolumn',
  1223. width: 236,
  1224. sortable: false,
  1225. align: 'center',
  1226. menuDisabled: true,
  1227. items: [{
  1228. icon: '../../res/img/common/tupianbtn.png',
  1229. tooltip: '点位详情',
  1230. handler: function (grid, rowIndex, colIndex) {
  1231. var rec = grid.getStore().getAt(rowIndex);
  1232. editMaintenance(rec.get("id"));
  1233. }
  1234. }]
  1235. }
  1236. ],
  1237. columnLines: true,
  1238. height: 300,
  1239. width: 780,
  1240. bbar: new Ext.PagingToolbar({
  1241. store: myStore1,
  1242. id: 'MaintenancePlanListPageToolbar1',
  1243. displayInfo: true,
  1244. pageSize: 5,
  1245. prependButtons: true,
  1246. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1247. emptyMsg: "没有记录",
  1248. firstText: '第一页',
  1249. prevText: '前一页',
  1250. nextText: '后一页',
  1251. lastText: '最后一页',
  1252. refreshText: '刷新',
  1253. }),
  1254. // frame: true,
  1255. border: false,
  1256. iconCls: 'icon-grid'
  1257. // renderTo: Ext.getBody()
  1258. });
  1259. var MaintenancePlanPanel = Ext.create('Ext.grid.Panel', {
  1260. header: {
  1261. height: 0,
  1262. border: '0px solid #000000'
  1263. },
  1264. id: 'MaintenancePlanListPanel',
  1265. store: myStore,
  1266. selModel: sm,
  1267. columns: [
  1268. { header: 'ID', dataIndex: 'id', hidden: true, menuDisabled: true },
  1269. { header: '团队ID', dataIndex: 'team_id', hidden: true, menuDisabled: true },
  1270. { header: '周期值', dataIndex: 'cycle', hidden: true, menuDisabled: true },
  1271. { header: '建筑编号', dataIndex: 'company_code', hidden: true, menuDisabled: true },
  1272. { header: '开始日期', dataIndex: 'start_date', hidden: true, menuDisabled: true },
  1273. { header: '结束日期', dataIndex: 'end_date', hidden: true, menuDisabled: true },
  1274. { header: '开始时间', dataIndex: 'start_inspect_time', hidden: true, menuDisabled: true },
  1275. { header: '结束时间', dataIndex: 'end_inspect_time', hidden: true, menuDisabled: true },
  1276. { header: '序号', dataIndex: 'xh', width: 77, menuDisabled: true },
  1277. { header: '任务名称', dataIndex: 'plan_name', width: 250, align: 'center', menuDisabled: true },
  1278. { header: '周期', dataIndex: 'cycle_name', width: 300, align: 'center', menuDisabled: true },
  1279. { header: '执行日期', dataIndex: 'zxsj', width: 250, align: 'center', menuDisabled: true },
  1280. { header: '执行团队', dataIndex: 'team_name', width: 280, align: 'center', menuDisabled: true },
  1281. { header: '责任人', dataIndex: 'name', width: 280, align: 'center', menuDisabled: true },
  1282. ],
  1283. columnLines: true,
  1284. height: maxHeight,
  1285. width: '100%',
  1286. bbar: new Ext.PagingToolbar({
  1287. store: myStore,
  1288. id: 'MaintenancePlanListPageToolbar',
  1289. displayInfo: true,
  1290. pageSize: countPerPage,
  1291. prependButtons: true,
  1292. displayMsg: '显示第 {0}条到 {1}条记录,总共 {2}条',
  1293. emptyMsg: "没有记录",
  1294. firstText: '第一页',
  1295. prevText: '前一页',
  1296. nextText: '后一页',
  1297. lastText: '最后一页',
  1298. refreshText: '刷新',
  1299. }),
  1300. // frame: true,
  1301. border: false,
  1302. iconCls: 'icon-grid'
  1303. // renderTo: Ext.getBody()
  1304. });
  1305. var piebar = Ext.create('Ext.panel.Panel', {
  1306. id: 'maintenancePlanHtml',
  1307. width: '100%',
  1308. height: 188,
  1309. region: 'north',
  1310. layout: 'form',
  1311. defaults: {
  1312. border: false
  1313. }
  1314. // items: [childPanel1]
  1315. });
  1316. var MaintenancePlanTab = Ext.create('Ext.tab.Panel', {
  1317. id: 'MaintenancePlanTab',
  1318. activeTab: 0,
  1319. items: [
  1320. {
  1321. title: '维保点位',
  1322. items: [MaintenancePlanPanel1]
  1323. }
  1324. ]
  1325. });
  1326. new Ext.create('Ext.panel.Panel', {
  1327. width: '100%',
  1328. id: 'MaintenancePlanPiebar',
  1329. layout: 'border',
  1330. items: [
  1331. piebar, MaintenancePlanPanel
  1332. ],
  1333. renderTo: Ext.getBody()
  1334. });
  1335. myStore.reload();
  1336. myStore.addListener('load', function (store, record, opts) {
  1337. piedarHtml_fun();
  1338. });
  1339. $(window).resize(function () {
  1340. body_resize();
  1341. });
  1342. body_resize();
  1343. });