schedulingCtrl.js 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128
  1. 'use strict';
  2. app.config(['calendarConfigProvider', function(calendarConfigProvider) {
  3. calendarConfigProvider.setDateFormatter('moment'); // use moment to format dates
  4. calendarConfigProvider.setTitleFormats({
  5. day: 'dddd MMMM DD, YYYY',
  6. week: '{year}年{week}周',
  7. month: 'MMMM YYYY',
  8. year: 'YYYY'
  9. //day: 'ddd D MMM' //this will configure the day view title to be shorter
  10. });
  11. calendarConfigProvider.setI18nStrings({
  12. eventsLabel: '描述', //This will set the events label on the day view
  13. timeLabel: '时间', //This will set the time label on the time view
  14. weekNumber: '{week}周'
  15. });
  16. }]);
  17. /**
  18. * Controller of the angularBootstrapCalendarApp
  19. */
  20. app.controller('schedulingCtrl', ["$scope", "i18nService", "$rootScope", "$log", "$state", "$timeout", "$interval", "SweetAlert", 'FileUploader', "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_domain", "api_bpm_data", "$aside", "moment", function($scope, i18nService, $rootScope, $log, $state, $timeout, $interval, SweetAlert, FileUploader, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_domain, api_bpm_data, $aside, moment) {
  21. var loginUser = $rootScope.user;
  22. $scope.langs = i18nService.getAllLangs();
  23. $scope.lang = 'zh-cn';
  24. i18nService.setCurrentLang($scope.lang);
  25. $scope.allright = false;
  26. $scope.someright = true;
  27. for (var obj in $rootScope.user.role) {
  28. if ($rootScope.user.role[obj].rolecode == 'schedule manager') {
  29. $scope.allright = true;
  30. $scope.someright = false;
  31. }
  32. }
  33. var pdKey = $state.current.pdKey;
  34. $scope.gridOptions = {};
  35. $scope.gridOptions.data = 'myData';
  36. $scope.gridOptions.enableColumnResizing = true;
  37. $scope.gridOptions.enableFiltering = false;
  38. $scope.gridOptions.enableGridMenu = true;
  39. $scope.gridOptions.enableRowSelection = true;
  40. $scope.gridOptions.showGridFooter = true;
  41. $scope.gridOptions.showColumnFooter = true;
  42. $scope.gridOptions.fastWatch = true;
  43. // $scope.gridOptions.useExternalFiltering=true;
  44. $scope.gridOptions.useExternalPagination = true;
  45. $scope.gridOptions.paginationPageSizes = [10];
  46. $scope.gridOptions.paginationPageSize = 10;
  47. $scope.gridOptions.multiSelect = false;
  48. //$scope.gridOptions.rowTemplate = "<div ng-dblclick=\"grid.appScope.pdList.onDblClick(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
  49. //
  50. $scope.gridOptions.rowIdentity = function(row) {
  51. return row.id;
  52. };
  53. $scope.gridOptions.getRowIdentity = function(row) {
  54. return row.id;
  55. };
  56. $scope.gridOptions.columnDefs = [{
  57. name: 'sourceWatch.watchTime',
  58. displayName: '换班时间',
  59. width: 120,
  60. enableFiltering: false
  61. }, {
  62. name: 'initUser.name',
  63. displayName: '申请人',
  64. width: 140,
  65. enableFiltering: false
  66. }, {
  67. name: 'sourceWatch.scheduleClass.name',
  68. displayName: '换班班次',
  69. width: 100,
  70. enableFiltering: false
  71. }, {
  72. name: 'endWatch.watchTime',
  73. displayName: '对换时间',
  74. width: 120,
  75. enableFiltering: false
  76. }, {
  77. name: 'endWatch.user.name',
  78. displayName: '对换人员',
  79. width: 120,
  80. enableFiltering: false
  81. }, {
  82. name: 'endWatch.scheduleClass.name',
  83. displayName: '对换班次',
  84. width: 140,
  85. enableFiltering: false
  86. }, {
  87. name: 'stage.name',
  88. displayName: '状态',
  89. width: 120,
  90. enableFiltering: false
  91. }, {
  92. name: '操作',
  93. cellTemplate: '<schedulingoperator item="row.entity" colobject="col">',
  94. width: 100,
  95. enableFiltering: false
  96. }];
  97. // $scope.gridOptions.importerDataAddCallback = function( grid, newObjects ) {
  98. // $scope.myData = $scope.myData.concat( newObjects );
  99. // console.log($scope);
  100. // };
  101. $scope.refresh = function(style, filterData) {
  102. var filtersData = {
  103. "assignee": $rootScope.user.id,
  104. // "candidateGroups": $rootScope.user.group[0].id,
  105. idx: 0,
  106. sum: 10
  107. };
  108. $scope.gridOptions.refresh();
  109. $scope.refreshData('expand-right', filtersData);
  110. };
  111. $scope.gridOptions.onRegisterApi = function(gridApi) {
  112. $scope.gridApi = gridApi;
  113. gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
  114. // console.log(newPage);
  115. // console.log(pageSize);
  116. $rootScope['idx'] = newPage;
  117. $scope.refreshData('expand-right', {
  118. "assignee": $rootScope.user.id,
  119. // "candidateGroups":$rootScope.user.group[0].id,
  120. "idx": newPage - 1,
  121. "sum": pageSize
  122. });
  123. });
  124. // gridApi.core.on.filterChanged($scope, function() {
  125. // var grid = this.grid;
  126. // var filtersData = {
  127. // "assignee":$rootScope.user.id,
  128. // "candidateGroups":$rootScope.user.group[0].id,
  129. // "idx":0,
  130. // "sum":10
  131. // };
  132. // angular.forEach(grid.columns,function(item){
  133. // if(item.enableFiltering){
  134. // if(angular.isDefined(item.filters[0].term)&&item.filters[0].term!=''){
  135. // // console.log('item.filters[0]='+JSON.stringify(item.filters[0]));
  136. // if(angular.isUndefined(filtersData['scheduling'])){
  137. // filtersData['scheduling']={};
  138. // }
  139. // filtersData['scheduling'][item.field]=item.filters[0].term;
  140. // }
  141. // }
  142. // });
  143. // $scope.refreshData('expand-right', filtersData);
  144. // });
  145. // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
  146. // //$scope.selected.item = data.entity;
  147. // console.log(data);
  148. // });
  149. };
  150. // $scope.gridOptions.appScopeProvider = {
  151. // onDblClick : function(row) {
  152. // $state.go('app.form.detail',{data:row, formKey:'changeDetail', pdKey:'change'});
  153. // //var url = '//google.com';
  154. // //$window.open(url, "_blank", "height=600,width=800,toolbar=no,location=no,menubar=no,titlebar=no");
  155. // }
  156. // };
  157. $scope.selectRowFunction = function(data) {
  158. console.log(data);
  159. // $state.go('app.process.modeler',{modelId:data.id});
  160. $state.go('app.scheduling.editor', {
  161. taskId: data.taskId,
  162. processInstanceId: data.processInstanceId
  163. });
  164. };
  165. $scope.onDblClick = function(data) {
  166. //console.log(row.entity);
  167. $state.go('app.detail', { formKey: 'schedulingDetail', pdKey: 'schedule', dataId: data.id, taskId: data.taskId, processInstanceId: data.processInstanceId });
  168. };
  169. // this.onDblClick = function(row) {
  170. // //console.log(row.entity);
  171. // $state.go('app.detail', {
  172. // formKey: 'schedulingDetail',
  173. // pdKey: 'scheduling',
  174. // dataId: row.entity.id
  175. // });
  176. // };
  177. /*
  178. appScopeProvider: {
  179. onDblClick : function(row) {
  180. var url = '//google.com';
  181. $window.open(url, "_blank", "height=600,width=800,toolbar=no,location=no,menubar=no,titlebar=no");
  182. }
  183. },
  184. rowTemplate: "<div ng-dblclick=\"grid.appScope.onDblClick(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" ui-grid-cell ></div>"
  185. */
  186. this.removeRowFunction = function(data) {
  187. //TODO $translate('key')
  188. SweetAlert.swal({
  189. title: "确认删除?",
  190. text: "删除以后,你将不能恢复该数据!",
  191. type: "warning",
  192. cancelButtonText: "取消",
  193. showCancelButton: true,
  194. confirmButtonColor: "#DD6B55",
  195. confirmButtonText: "确认删除!"
  196. }, function(isConfirm) {
  197. if (isConfirm) {
  198. // api_bpm_domain.removemodel(data.id).then(function(response){
  199. // if(response){
  200. // $scope.refreshData();
  201. // SweetAlert.swal({
  202. // title: "删除成功!",
  203. // confirmButtonColor: "#007AFF"
  204. // });
  205. // }
  206. // });
  207. } else {
  208. }
  209. });
  210. }
  211. //$scope.callsPending = 0;
  212. //var i = 0;
  213. var defaultFilterData = {
  214. "assignee": $rootScope.user.id,
  215. // "candidateGroups":$rootScope.user.group[0].id,
  216. "idx": 0,
  217. "sum": 10
  218. };
  219. if (angular.isDefined($rootScope.search) && angular.isDefined($rootScope.search.scheduling)) {
  220. defaultFilterData['searchType'] = $rootScope.search.scheduling;
  221. $scope.searchTypes = $rootScope.search.scheduling;
  222. }
  223. if ($rootScope['cmdbs'] != 'scheduling') { $rootScope.idx = 1 }
  224. if (angular.isDefined($rootScope.idx) && $rootScope.cmdbs != "false") {
  225. $rootScope['cmdbs'] = 'scheduling';
  226. defaultFilterData.idx = $rootScope.idx - 1;
  227. } else { $rootScope.cmdbs = ""; }
  228. $scope.ldloading = {};
  229. $scope.refreshData = function(style, filterData) {
  230. $scope.ldloading[style.replace('-', '_')] = true;
  231. if (angular.isUndefined(filterData)) {
  232. defaultFilterData.idx = $rootScope.idx - 1;
  233. filterData = defaultFilterData;
  234. }
  235. if (angular.isDefined($scope.searchTypes)) {
  236. $rootScope['search'] = {};
  237. filterData['searchType'] = $scope.searchTypes;
  238. $rootScope['search']['scheduling'] = $scope.searchTypes;
  239. }
  240. $scope.myData = [];
  241. //var start = new Date();
  242. //var sec = $interval(function () {
  243. //$scope.callsPending++;
  244. api_bpm_domain.fetchtask(pdKey, filterData).then(function(data) {
  245. $scope.callsPending--;
  246. // console.log('filterData='+JSON.stringify(filterData));
  247. var myData = Restangular.stripRestangular(data);
  248. $scope.gridOptions.totalItems = myData.resultCount;
  249. $scope.myData = myData.data;
  250. $scope.ldloading[style.replace('-', '_')] = false;
  251. }, function() {
  252. $scope.ldloading[style.replace('-', '_')] = false;
  253. });
  254. };
  255. $scope.refreshData('expand-right', defaultFilterData);
  256. }]);
  257. app.controller('SchedulingOperCtrl', ['$rootScope', '$http', '$scope', function($rootScope, $http, $scope, $event) {
  258. if ($scope.item.handlerUser != null) {
  259. if ($rootScope.user.id == $scope.item.handlerUser.id) {
  260. $scope.item.chaozuoPower = true;
  261. }
  262. }
  263. $scope.look = function() {
  264. $scope.colobject.grid.appScope.onDblClick($scope.item);
  265. }
  266. $scope.edit = function() {
  267. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  268. // console.log('$scope.item='+JSON.stringify($scope.item));
  269. $scope.doEdit($scope.item.id);
  270. }
  271. }]);
  272. app.directive('schedulingoperator', function() {
  273. return {
  274. restrict: 'E',
  275. scope: {
  276. item: '=',
  277. colobject: '='
  278. },
  279. controller: 'SchedulingOperCtrl',
  280. template: '<div class="links cl-effect-1">' +
  281. '<a ng-click="look()" tooltip="查看" tooltip-placement="left"><i class="ti-eye"></i></a>' +
  282. '<a ng-click="edit()" ng-show="{{item.chaozuoPower}}" tooltip="编辑" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>' +
  283. '</div>'
  284. };
  285. });
  286. app.controller('myCalendarCtrl', ["$rootScope", "$scope", "$aside", "calendarConfig", "moment", "SweetAlert", "Restangular", "api_bpm_schedule", "api_user_data", function($rootScope, $scope, $aside, calendarConfig, moment, SweetAlert, Restangular, api_bpm_schedule, api_user_data) {
  287. var loginUser = $rootScope.user;
  288. //console.log(loginUser);
  289. calendarConfig.dateFormatter = 'moment';
  290. calendarConfig.i18nStrings.eventsLabel = '排班描述';
  291. calendarConfig.i18nStrings.timeLabel = '时间';
  292. calendarConfig.i18nStrings.weekNumber = '{week}周';
  293. calendarConfig.allDateFormats = {
  294. angular: {
  295. date: {
  296. hour: 'ha',
  297. day: 'd MMM',
  298. month: 'MMMM',
  299. weekDay: 'EEEE',
  300. time: 'HH:mm',
  301. datetime: 'MMM d, h:mm a'
  302. },
  303. title: {
  304. day: 'yyyy MMMM EEEE d',
  305. week: '{year}年第{week}周',
  306. month: 'yyyy MMMM',
  307. year: 'yyyy'
  308. }
  309. },
  310. moment: {
  311. date: {
  312. hour: 'ha',
  313. day: 'MMMDD日',
  314. month: 'MMMM',
  315. weekDay: 'dddd',
  316. time: 'HH:mm',
  317. datetime: 'MMM D, h:mm a'
  318. },
  319. title: {
  320. day: 'YYYY年MMMMDD日, dddd ',
  321. week: '{year}年第{week}周',
  322. month: 'YYYY年MMMM',
  323. year: 'YYYY'
  324. }
  325. }
  326. };
  327. moment.locale('zh_cn', {
  328. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  329. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  330. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  331. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  332. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  333. longDateFormat: {
  334. LT: 'Ah点mm分',
  335. LTS: 'Ah点m分s秒',
  336. L: 'YYYY-MM-DD',
  337. LL: 'YYYY年MMMD日',
  338. LLL: 'YYYY年MMMD日Ah点mm分',
  339. LLLL: 'YYYY年MMMD日ddddAh点mm分',
  340. l: 'YYYY-MM-DD',
  341. ll: 'YYYY年MMMD日',
  342. lll: 'YYYY年MMMD日Ah点mm分',
  343. llll: 'YYYY年MMMD日ddddAh点mm分'
  344. },
  345. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  346. meridiemHour: function(hour, meridiem) {
  347. if (hour === 12) {
  348. hour = 0;
  349. }
  350. if (meridiem === '凌晨' || meridiem === '早上' ||
  351. meridiem === '上午') {
  352. return hour;
  353. } else if (meridiem === '下午' || meridiem === '晚上') {
  354. return hour + 12;
  355. } else {
  356. // '中午'
  357. return hour >= 11 ? hour : hour + 12;
  358. }
  359. },
  360. meridiem: function(hour, minute, isLower) {
  361. var hm = hour * 100 + minute;
  362. if (hm < 600) {
  363. return '凌晨';
  364. } else if (hm < 900) {
  365. return '早上';
  366. } else if (hm < 1130) {
  367. return '上午';
  368. } else if (hm < 1230) {
  369. return '中午';
  370. } else if (hm < 1800) {
  371. return '下午';
  372. } else {
  373. return '晚上';
  374. }
  375. },
  376. calendar: {
  377. sameDay: function() {
  378. return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
  379. },
  380. nextDay: function() {
  381. return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
  382. },
  383. lastDay: function() {
  384. return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
  385. },
  386. nextWeek: function() {
  387. var startOfWeek, prefix;
  388. startOfWeek = moment().startOf('week');
  389. prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
  390. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  391. },
  392. lastWeek: function() {
  393. var startOfWeek, prefix;
  394. startOfWeek = moment().startOf('week');
  395. prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
  396. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  397. },
  398. sameElse: 'LL'
  399. },
  400. ordinalParse: /\d{1,2}(日|月|周)/,
  401. ordinal: function(number, period) {
  402. switch (period) {
  403. case 'd':
  404. case 'D':
  405. case 'DDD':
  406. return number + '日';
  407. case 'M':
  408. return number + '月';
  409. case 'w':
  410. case 'W':
  411. return number + '周';
  412. default:
  413. return number;
  414. }
  415. },
  416. relativeTime: {
  417. future: '%s内',
  418. past: '%s前',
  419. s: '几秒',
  420. m: '1 分钟',
  421. mm: '%d 分钟',
  422. h: '1 小时',
  423. hh: '%d 小时',
  424. d: '1 天',
  425. dd: '%d 天',
  426. M: '1 个月',
  427. MM: '%d 个月',
  428. y: '1 年',
  429. yy: '%d 年'
  430. },
  431. week: {
  432. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  433. dow: 1, // Monday is the first day of the week.
  434. doy: 4 // The week that contains Jan 4th is the first week of the year.
  435. }
  436. });
  437. //console.log(window.moment().weekdays);
  438. var date = new Date();
  439. var d = date.getDate();
  440. var m = date.getMonth();
  441. var y = date.getFullYear();
  442. console.log(loginUser);
  443. var filterData = {
  444. "userId": loginUser.id,
  445. "startTime": moment(new Date(y, m, 1, 0, 0)).format('YYYY-MM-DD HH:mm:ss'),
  446. "endTime": moment(new Date(y, m + 1, 1, 0, 0)).format('YYYY-MM-DD HH:mm:ss')
  447. };
  448. var load = $scope.load = function(filterData) {
  449. api_bpm_schedule.fetchSchedule(filterData.userId, filterData.startTime, filterData.endTime).then(function(response) {
  450. if (response.status == 200) {
  451. $scope.events = [];
  452. console.log(response.list);
  453. var myData = response.list;
  454. angular.forEach(myData, function(item) {
  455. var eventTemp = {};
  456. eventTemp.title = item.name;
  457. eventTemp.type = item.scheduleClass.code;
  458. eventTemp.startsAt = moment(item['scheduleOrderDTO'].startTime).toDate();
  459. eventTemp.endsAtTime = moment(item['scheduleOrderDTO'].endTime).toDate();
  460. eventTemp.startTime = item['scheduleOrderDTO'].startTime;
  461. eventTemp.endTime = item['scheduleOrderDTO'].endTime;
  462. //eventTemp.ends_at = moment(item.endTime).toDate();
  463. eventTemp.id = item.id;
  464. eventTemp.deletable = false;
  465. eventTemp.user = item.user;
  466. $scope.events.push(eventTemp);
  467. })
  468. }
  469. });
  470. }
  471. // var load = $scope.load = function(filterData){
  472. // api_bpm_schedule.fetchSchedule(filterData.userId, filterData.startTime, filterData.endTime).then(function(response){
  473. // console.log("response="+JSON.stringify(response));
  474. // if(response.status==200){
  475. // $scope.events = [];
  476. // console.log(response.list);
  477. // var myData = response.list;
  478. // angular.forEach(myData,function(item){
  479. // var eventTemp = {};
  480. // eventTemp.title = item.description;
  481. // eventTemp.type = item.scheduleClass.code;
  482. // eventTemp.startsAt = moment(item.startTime).toDate();
  483. // eventTemp.endsAtTime = moment(item.endTime).toDate();
  484. // eventTemp.startTime = item.startTime;
  485. // eventTemp.endTime = item.endTime;
  486. // //eventTemp.ends_at = moment(item.endTime).toDate();
  487. // eventTemp.id = item.id;
  488. // eventTemp.deletable = false;
  489. // eventTemp.users = item.users;
  490. // $scope.events.push(eventTemp);
  491. // // console.log("eventTemp="+JSON.stringify(eventTemp));
  492. // })
  493. // }
  494. // });
  495. // }
  496. $scope.scheduleClass = {};
  497. var convertEvent = function(scheduleorder) {
  498. var eventTemp = {};
  499. eventTemp.title = scheduleorder.name;
  500. eventTemp.type = scheduleorder.scheduleClass.code;
  501. eventTemp.startsAt = moment(scheduleorder.startTime).toDate();
  502. //eventTemp.ends_at = moment(scheduleorder.endTime).toDate();
  503. eventTemp.id = scheduleorder.id;
  504. eventTemp.user = scheduleorder.user;
  505. eventTemp.deletable = false;
  506. return eventTemp;
  507. }
  508. // var convertEvent = function(scheduleorder){
  509. // var eventTemp = {};
  510. // eventTemp.title = scheduleorder.description;
  511. // eventTemp.type = scheduleorder.scheduleClass.code;
  512. // eventTemp.starts_at = moment(scheduleorder.scheduleClass.startTime).toDate();
  513. // eventTemp.ends_at = moment(scheduleorder.scheduleClass.endTime).toDate();
  514. // eventTemp.id = scheduleorder.id;
  515. // eventTemp.users = scheduleorder.users;
  516. // eventTemp.deletable = false;
  517. // return eventTemp;
  518. // }
  519. // function getdatas() {
  520. api_bpm_schedule.getScheduleClass().then(function(response) {
  521. if (response.status == 200) {
  522. var scheduleClassList = response.list;
  523. angular.forEach(scheduleClassList, function(item) {
  524. item.startsAt = moment(item.startTime).format('HH:mm:ss');
  525. item.endsAt = moment(item.endTime).format('HH:mm:ss');
  526. // console.log("item.startsAt="+JSON.stringify(item.startsAt))
  527. // console.log("item.endsAt="+JSON.stringify(item.endsAt))
  528. $scope.scheduleClass[item['code']] = item;
  529. })
  530. }
  531. })
  532. // }
  533. function getalldata() {
  534. api_bpm_schedule.fetchList(filterData.startTime, filterData.endTime).then(function(response) {
  535. if (response.status == 200) {
  536. $scope.events = [];
  537. console.log(response.list);
  538. var myData = response.list;
  539. angular.forEach(myData, function(item) {
  540. var eventTemp = {};
  541. eventTemp.title = item.name;
  542. eventTemp.type = item.scheduleClass.code;
  543. eventTemp.startsAt = moment(item.startTime).toDate();
  544. eventTemp.endsAtTime = moment(item.endTime).toDate();
  545. eventTemp.startTime = item.startTime;
  546. eventTemp.endTime = item.endTime;
  547. //eventTemp.ends_at = moment(item.endTime).toDate();
  548. eventTemp.id = item.id;
  549. eventTemp.users = item.users;
  550. // {
  551. // title: '白班',
  552. // type: 'job',
  553. // starts_at: new Date(y, m, 5, 19, 0),
  554. // ends_at: new Date(y, m, 5, 22, 30)
  555. // },
  556. $scope.events.push(eventTemp);
  557. })
  558. }
  559. });
  560. }
  561. $scope.odr = 1;
  562. $scope.order = function(odr) {
  563. if (odr == 1) {
  564. $scope.odr = 1;
  565. $scope.load(filterData);
  566. } else if (odr == 2) {
  567. $scope.odr = 2;
  568. getalldata();
  569. }
  570. }
  571. $scope.events = [];
  572. $scope.calendarView = 'month';
  573. //$scope.calendarDay = new Date();
  574. $scope.calendarDate = moment().startOf('month').toDate();
  575. $scope.timeLabel = "时间";
  576. $scope.eventLabel = "描述";
  577. function showModal(action, event) {
  578. // console.log("action="+JSON.stringify(action))
  579. var modalInstance = $aside.open({
  580. templateUrl: 'scheduleEvent.html',
  581. placement: 'right',
  582. size: 'sm',
  583. backdrop: true,
  584. controller: function($scope, $modalInstance, scheduleClass, APIService, MementFormat) {
  585. $scope.$modalInstance = $modalInstance;
  586. $scope.action = action;
  587. $scope.event = event;
  588. $scope.scheduleClassic = scheduleClass;
  589. $scope.$watch('event.type', function(newvalue, oldvalue) {
  590. // if(oldvalue == newvalue) return;
  591. // if(scheduleClass[newvalue]){
  592. var sm = MementFormat(scheduleClass[newvalue].startTime);
  593. var em = MementFormat(scheduleClass[newvalue].endTime);
  594. console.log("sm=" + JSON.stringify(sm))
  595. event.starts_at = MementFormat(event.startTime).startOf('day').add(sm.hour(), 'hour').add(sm.minute(), 'minute').add(sm.second(), 'second').toDate();
  596. console.log("event.starts_at=" + JSON.stringify(event.starts_at))
  597. if (sm.hour() > em.hour()) {
  598. event.ends_at = MementFormat(event.startTime).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  599. console.log("event.ends_at=" + JSON.stringify(event.starts_at))
  600. } else {
  601. event.ends_at = MementFormat(event.startTime).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  602. console.log("event.ends_at=" + JSON.stringify(event.ends_at))
  603. }
  604. // }
  605. });
  606. // $scope.ok = function (event) {
  607. // console.log("event="+JSON.stringify(event))
  608. // event.action = action;
  609. // $modalInstance.close(event);
  610. // };
  611. $scope.cancel = function(event) {
  612. $modalInstance.dismiss();
  613. };
  614. var acUserSelect = $scope.refreshUser = function(key) {
  615. //for test
  616. // $scope.users=[{"id":1,"phone":"13971293737","orgId":1,"name":"李静","role":[{"id":1,"rolecode":"admin","role":"主行管理员","flag":0}],"gender":"女","dept":{"id":3,"dept":"运行监控科"},"flag":0,"email":"","account":"005292","nickname":"lijing","group":[{"id":3,"groupName":"运行监控科"}]},{"id":2,"phone":"15807199490","orgId":1,"name":"李进","role":[{"id":1,"rolecode":"admin","role":"主行管理员","flag":0},{"id":7,"rolecode":"change manager","role":"变更流程经理","flag":1},{"id":8,"rolecode":"change coordinator","role":"协调员","flag":0},{"id":9,"rolecode":"configure manager","role":"配置管理员","flag":0},{"id":10,"rolecode":"release manager","role":"发布经理","flag":0}],"gender":"男","dept":{"id":3,"dept":"运行监控科"},"flag":0,"email":"","account":"005298","nickname":"lijin","group":[{"id":3,"groupName":"运行监控科"}]},{"id":3,"phone":"13507195958","orgId":1,"name":"杨代华","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"男","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005241","group":[{"id":9,"groupName":"管理层"}]},{"id":4,"phone":"18717107255","orgId":1,"name":"朱红艳","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"女","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005242","group":[{"id":9,"groupName":"管理层"}]},{"id":5,"phone":"13667282828","orgId":1,"name":"李喆","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"男","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005243","group":[{"id":9,"groupName":"管理层"}]}];
  617. // return;
  618. var data = { "idx": "0", "sum": "5" };
  619. if (key) {
  620. data['user'] = {
  621. 'name': key
  622. };
  623. }
  624. APIService.fetchDataList('user', data).then(function(response) {
  625. if (response) {
  626. if (response.status = 200) {
  627. $scope.users = response.list;
  628. console.log($scope.users);
  629. }
  630. }
  631. })
  632. };
  633. if (angular.isDefined(event.users) && event.users.length > 0) {
  634. }
  635. $scope.users = [event.user];
  636. acUserSelect();
  637. },
  638. resolve: {
  639. scheduleClass: function() {
  640. return $scope.scheduleClass;
  641. },
  642. APIService: function() {
  643. return api_user_data;
  644. },
  645. MementFormat: function() {
  646. return moment;
  647. }
  648. }
  649. });
  650. modalInstance.result.then(function(selectedEvent) {
  651. if (selectedEvent.action == 'Clicked') {
  652. // var data = {
  653. // "scheduleorder":{
  654. // "id":selectedEvent.id,
  655. // "description":selectedEvent.title,
  656. // "startTime":moment(selectedEvent.starts_at).format('YYYY-MM-DD HH:mm:ss'),
  657. // "endTime":moment(selectedEvent.ends_at).format('YYYY-MM-DD HH:mm:ss'),
  658. // "users":selectedEvent.users,
  659. // "scheduleClass":{"id":$scope.scheduleClass[selectedEvent.type].id}
  660. // }
  661. // };
  662. // api_bpm_schedule.update(data).then(function(response){
  663. // if(response.status==200){
  664. // SweetAlert.swal({
  665. // title: "操作成功!",
  666. // text: "排班更新成功!",
  667. // type: "succes"
  668. // });
  669. // angular.forEach($scope.events,function(item){
  670. // if(item.id==selectedEvent.id){
  671. // item = selectedEvent;
  672. // }
  673. // })
  674. // }else{
  675. // SweetAlert.swal({
  676. // title: "操作失败",
  677. // text: "排班更新失败,请稍后重试!",
  678. // type: "error"
  679. // })
  680. // }
  681. // })
  682. } else {
  683. //
  684. }
  685. });
  686. }
  687. $scope.moment = function(string) {
  688. return moment(string);
  689. }
  690. $scope.eventClicked = function(event) {
  691. // console.log("event="+JSON.stringify(event))
  692. showModal('Clicked', event);
  693. };
  694. $scope.eventEdited = function(event) {
  695. showModal('Edited', event);
  696. };
  697. var updateView = function(newvalue, oldvalue) {
  698. if (oldvalue == newvalue) return;
  699. var timeStart, timeEnd, timeStartSpan, timeEndSpan;
  700. if ($scope.calendarView == "year") {
  701. } else if ($scope.calendarView == "month") {
  702. timeStart = moment(newvalue).startOf('month');
  703. timeEnd = moment(newvalue).endOf('month');
  704. } else if ($scope.calendarView == "week") {
  705. timeStart = moment(newvalue).startOf('week');
  706. timeEnd = moment(newvalue).endOf('week');
  707. } else if ($scope.calendarView == "Day") {
  708. timeStart = moment(newvalue).startOf('day');
  709. timeEnd = moment(newvalue).endOf('day');
  710. }
  711. timeStartSpan = timeStart.format('YYYY-MM-DD HH:mm:ss');
  712. timeEndSpan = timeEnd.format('YYYY-MM-DD HH:mm:ss');
  713. filterData["startTime"] = timeStartSpan;
  714. filterData["endTime"] = timeEndSpan;
  715. $scope.order($scope.odr);
  716. }
  717. $scope.$watch('calendarDate', updateView)
  718. $scope.next = function() {
  719. $scope.calendarControl.next();
  720. }
  721. $scope.prev = function() {
  722. $scope.calendarControl.prev();
  723. }
  724. $scope.setCalendarToToday = function() {
  725. $scope.calendarDay = new Date();
  726. };
  727. $scope.toggle = function($event, field, event) {
  728. $event.preventDefault();
  729. $event.stopPropagation();
  730. event[field] = !event[field];
  731. };
  732. $scope.load(filterData);
  733. }]);
  734. app.controller('adminCalendarCtrl', ["$rootScope", "$scope", "$aside", "calendarConfig", "moment", "SweetAlert", 'FileUploader', "Restangular", "api_bpm_schedule", "api_user_data", "api_bpm_data", function($rootScope, $scope, $aside, calendarConfig, moment, SweetAlert, FileUploader, Restangular, api_bpm_schedule, api_user_data, api_bpm_data) {
  735. var loginUser = $rootScope.user;
  736. var date = new Date();
  737. var d = date.getDate();
  738. var m = date.getMonth();
  739. var y = date.getFullYear();
  740. // console.log(week);
  741. calendarConfig.dateFormatter = 'moment';
  742. calendarConfig.i18nStrings.eventsLabel = '排班描述';
  743. calendarConfig.i18nStrings.timeLabel = '时间';
  744. calendarConfig.i18nStrings.weekNumber = '{week}周';
  745. calendarConfig.allDateFormats = {
  746. angular: {
  747. date: {
  748. hour: 'ha',
  749. day: 'd MMM',
  750. month: 'MMMM',
  751. weekDay: 'EEEE',
  752. time: 'HH:mm',
  753. datetime: 'MMM d, h:mm a'
  754. },
  755. title: {
  756. day: 'yyyy MMMM EEEE d',
  757. week: '{year}年第{week}周',
  758. month: 'yyyy MMMM',
  759. year: 'yyyy'
  760. }
  761. },
  762. moment: {
  763. date: {
  764. hour: 'ha',
  765. day: 'MMMDD日',
  766. month: 'MMMM',
  767. weekDay: 'dddd',
  768. time: 'HH:mm',
  769. datetime: 'MMM D, h:mm a'
  770. },
  771. title: {
  772. day: 'YYYY年MMMMDD日, dddd ',
  773. week: '{year}年第{week}周',
  774. month: 'YYYY年MMMM',
  775. year: 'YYYY'
  776. }
  777. }
  778. };
  779. moment.locale('zh_cn', {
  780. months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  781. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  782. weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  783. weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  784. weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
  785. longDateFormat: {
  786. LT: 'Ah点mm分',
  787. LTS: 'Ah点m分s秒',
  788. L: 'YYYY-MM-DD',
  789. LL: 'YYYY年MMMD日',
  790. LLL: 'YYYY年MMMD日Ah点mm分',
  791. LLLL: 'YYYY年MMMD日ddddAh点mm分',
  792. l: 'YYYY-MM-DD',
  793. ll: 'YYYY年MMMD日',
  794. lll: 'YYYY年MMMD日Ah点mm分',
  795. llll: 'YYYY年MMMD日ddddAh点mm分'
  796. },
  797. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  798. meridiemHour: function(hour, meridiem) {
  799. if (hour === 12) {
  800. hour = 0;
  801. }
  802. if (meridiem === '凌晨' || meridiem === '早上' ||
  803. meridiem === '上午') {
  804. return hour;
  805. } else if (meridiem === '下午' || meridiem === '晚上') {
  806. return hour + 12;
  807. } else {
  808. // '中午'
  809. return hour >= 11 ? hour : hour + 12;
  810. }
  811. },
  812. meridiem: function(hour, minute, isLower) {
  813. var hm = hour * 100 + minute;
  814. if (hm < 600) {
  815. return '凌晨';
  816. } else if (hm < 900) {
  817. return '早上';
  818. } else if (hm < 1130) {
  819. return '上午';
  820. } else if (hm < 1230) {
  821. return '中午';
  822. } else if (hm < 1800) {
  823. return '下午';
  824. } else {
  825. return '晚上';
  826. }
  827. },
  828. calendar: {
  829. sameDay: function() {
  830. return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
  831. },
  832. nextDay: function() {
  833. return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
  834. },
  835. lastDay: function() {
  836. return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
  837. },
  838. nextWeek: function() {
  839. var startOfWeek, prefix;
  840. startOfWeek = moment().startOf('week');
  841. prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
  842. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  843. },
  844. lastWeek: function() {
  845. var startOfWeek, prefix;
  846. startOfWeek = moment().startOf('week');
  847. prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
  848. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  849. },
  850. sameElse: 'LL'
  851. },
  852. ordinalParse: /\d{1,2}(日|月|周)/,
  853. ordinal: function(number, period) {
  854. switch (period) {
  855. case 'd':
  856. case 'D':
  857. case 'DDD':
  858. return number + '日';
  859. case 'M':
  860. return number + '月';
  861. case 'w':
  862. case 'W':
  863. return number + '周';
  864. default:
  865. return number;
  866. }
  867. },
  868. relativeTime: {
  869. future: '%s内',
  870. past: '%s前',
  871. s: '几秒',
  872. m: '1 分钟',
  873. mm: '%d 分钟',
  874. h: '1 小时',
  875. hh: '%d 小时',
  876. d: '1 天',
  877. dd: '%d 天',
  878. M: '1 个月',
  879. MM: '%d 个月',
  880. y: '1 年',
  881. yy: '%d 年'
  882. },
  883. week: {
  884. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  885. dow: 1, // Monday is the first day of the week.
  886. doy: 4 // The week that contains Jan 4th is the first week of the year.
  887. }
  888. });
  889. var importUploader = $scope.importUploader = new FileUploader({
  890. url: api_bpm_data.impFileData().getRequestedUrl()
  891. });
  892. // importUploader.filters.push({
  893. // name: 'customFilter',
  894. // fn: function(item /*{File|FileLikeObject}*/ , options) {
  895. // var type = item.name.slice(item.name.lastIndexOf('.') + 1);
  896. // //var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
  897. // return (type == 'xlsx');
  898. // }
  899. // });
  900. importUploader.onWhenAddingFileFailed = function(item /*{File|FileLikeObject}*/ , filter, options) {
  901. console.info('onWhenAddingFileFailed', item, filter, options);
  902. };
  903. importUploader.onAfterAddingFile = function(fileItem) {
  904. console.info('onAfterAddingFile', fileItem);
  905. };
  906. importUploader.onAfterAddingAll = function(addedFileItems) {
  907. console.info('onAfterAddingAll', addedFileItems);
  908. };
  909. importUploader.onProgressItem = function(fileItem, progress) {
  910. console.info('onProgressItem', fileItem, progress);
  911. };
  912. importUploader.onProgressAll = function(progress) {
  913. console.info('onProgressAll', progress);
  914. };
  915. importUploader.onSuccessItem = function(fileItem, response, status, headers) {
  916. $scope.ldloading.expand_right = false;
  917. SweetAlert.swal({
  918. title: "导入成功!",
  919. confirmButtonColor: "#007AFF",
  920. type: "success"
  921. }, function() {
  922. $scope.scheduleClass = {};
  923. $scope.calendarView = 'month';
  924. $scope.calendarDate = moment().startOf('month').toDate();
  925. $scope.calendarTitle;
  926. $scope.externalEvents = [];
  927. api_bpm_schedule.getScheduleClass().then(function(response) {
  928. if (response.status == 200) {
  929. var scheduleClassList = response.list;
  930. angular.forEach(scheduleClassList, function(item) {
  931. item.startsAt = moment(item.startTime).format('HH:mm:ss');
  932. item.endsAt = moment(item.endTime).format('HH:mm:ss');
  933. $scope.scheduleClass[item['code']] = item;
  934. var templateEvent = {
  935. title: item['name'],
  936. type: item['code'],
  937. startTime: item.startsAt,
  938. //starts_at:
  939. endTime: item.endsAt,
  940. //ends_at:
  941. draggable: true,
  942. deleteFlag: item.deleteFlag
  943. };
  944. if (!templateEvent.deleteFlag) {
  945. $scope.externalEvents.push(templateEvent);
  946. }
  947. })
  948. }
  949. })
  950. });
  951. console.info('onSuccessItem', fileItem, response, status, headers);
  952. };
  953. importUploader.onErrorItem = function(fileItem, response, status, headers) {
  954. console.info('onErrorItem', fileItem, response, status, headers);
  955. SweetAlert.swal({
  956. title: "系统错误!",
  957. text: "系统错误,请稍候重试!",
  958. type: "error"
  959. });
  960. };
  961. importUploader.onCancelItem = function(fileItem, response, status, headers) {
  962. console.info('onCancelItem', fileItem, response, status, headers);
  963. };
  964. importUploader.onCompleteItem = function(fileItem, response, status, headers) {
  965. console.info('onCompleteItem', fileItem, response, status, headers);
  966. };
  967. importUploader.onCompleteAll = function() {
  968. console.info('onCompleteAll');
  969. };
  970. $scope.ldloading = {};
  971. $scope.import = function() {
  972. $scope.ldloading.expand_right = true;
  973. importUploader.onBeforeUploadItem = function(item) {
  974. console.info('onBeforeUploadItem', item);
  975. };
  976. importUploader.uploadAll();
  977. }
  978. var filterData = {
  979. //"userId": loginUser.id,
  980. "startTime": moment(new Date(y, m, 1, 0, 0)).format('YYYY-MM-DD HH:mm:ss'),
  981. "endTime": moment(new Date(y, m + 1, 1, 0, 0)).format('YYYY-MM-DD HH:mm:ss')
  982. };
  983. var load = $scope.load = function(filterData) {
  984. api_bpm_schedule.fetchList(filterData.startTime, filterData.endTime, filterData.userId).then(function(response) {
  985. if (response.status == 200) {
  986. $scope.events = [];
  987. console.log(response.list);
  988. var myData = response.list;
  989. angular.forEach(myData, function(item) {
  990. var eventTemp = {};
  991. eventTemp.title = item.name;
  992. eventTemp.type = item.scheduleClass.code;
  993. eventTemp.startsAt = moment(item.startTime).toDate();
  994. eventTemp.endsAtTime = moment(item.endTime).toDate();
  995. eventTemp.startTime = item.startTime;
  996. eventTemp.endTime = item.endTime;
  997. //eventTemp.ends_at = moment(item.endTime).toDate();
  998. eventTemp.id = item.id;
  999. eventTemp.users = item.users;
  1000. // {
  1001. // title: '白班',
  1002. // type: 'job',
  1003. // starts_at: new Date(y, m, 5, 19, 0),
  1004. // ends_at: new Date(y, m, 5, 22, 30)
  1005. // },
  1006. $scope.events.push(eventTemp);
  1007. })
  1008. }
  1009. });
  1010. }
  1011. $scope.scheduleClass = {};
  1012. $scope.calendarView = 'month';
  1013. $scope.calendarDate = moment().startOf('month').toDate();
  1014. $scope.calendarTitle;
  1015. $scope.externalEvents = [];
  1016. api_bpm_schedule.getScheduleClass().then(function(response) {
  1017. if (response.status == 200) {
  1018. var scheduleClassList = response.list;
  1019. console.log(scheduleClassList)
  1020. angular.forEach(scheduleClassList, function(item) {
  1021. item.startsAt = moment(item.startTime).format('HH:mm:ss');
  1022. item.endsAt = moment(item.endTime).format('HH:mm:ss');
  1023. $scope.scheduleClass[item['code']] = item;
  1024. var templateEvent = {
  1025. title: item['name'],
  1026. type: item['code'],
  1027. startTime: item.startsAt,
  1028. //starts_at:
  1029. endTime: item.endsAt,
  1030. person: item.person,
  1031. //ends_at:
  1032. deleteFlag: item.deleteFlag
  1033. };
  1034. if (!templateEvent.deleteFlag) {
  1035. $scope.externalEvents.push(templateEvent);
  1036. }
  1037. })
  1038. }
  1039. })
  1040. $scope.typeTransfer = function(type) {
  1041. return $scope.scheduleClass[type].name;
  1042. }
  1043. $scope.events = [];
  1044. var acUserSelect = $scope.refreshUser = function(key) {
  1045. //for test
  1046. // $scope.users=[{"id":1,"phone":"13971293737","orgId":1,"name":"李静","role":[{"id":1,"rolecode":"admin","role":"主行管理员","flag":0}],"gender":"女","dept":{"id":3,"dept":"运行监控科"},"flag":0,"email":"","account":"005292","nickname":"lijing","group":[{"id":3,"groupName":"运行监控科"}]},{"id":2,"phone":"15807199490","orgId":1,"name":"李进","role":[{"id":1,"rolecode":"admin","role":"主行管理员","flag":0},{"id":7,"rolecode":"change manager","role":"变更流程经理","flag":1},{"id":8,"rolecode":"change coordinator","role":"协调员","flag":0},{"id":9,"rolecode":"configure manager","role":"配置管理员","flag":0},{"id":10,"rolecode":"release manager","role":"发布经理","flag":0}],"gender":"男","dept":{"id":3,"dept":"运行监控科"},"flag":0,"email":"","account":"005298","nickname":"lijin","group":[{"id":3,"groupName":"运行监控科"}]},{"id":3,"phone":"13507195958","orgId":1,"name":"杨代华","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"男","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005241","group":[{"id":9,"groupName":"管理层"}]},{"id":4,"phone":"18717107255","orgId":1,"name":"朱红艳","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"女","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005242","group":[{"id":9,"groupName":"管理层"}]},{"id":5,"phone":"13667282828","orgId":1,"name":"李喆","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"男","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005243","group":[{"id":9,"groupName":"管理层"}]}];
  1047. // return;
  1048. var data = { "idx": "0", "sum": "7", "user": { "roledata": { "rolecode": "watch" } } };
  1049. console.log(data);
  1050. if (key) {
  1051. data.user['name'] = key
  1052. }
  1053. console.log(data);
  1054. api_user_data.fetchDataList('user', data).then(function(response) {
  1055. if (response) {
  1056. if (response.status = 200) {
  1057. $scope.users = response.list;
  1058. console.log($scope.users);
  1059. }
  1060. }
  1061. })
  1062. };
  1063. $scope.users = [];
  1064. acUserSelect();
  1065. $scope.calendarView = 'month';
  1066. $scope.calendarDay = new Date();
  1067. $scope.timeLabel = "时间";
  1068. $scope.eventLabel = "描述";
  1069. var judegeEventByLimit = function(event, compareDay) {
  1070. var ret = true;
  1071. angular.forEach($scope.events, function(item) {
  1072. var day = moment(item.startsAt).startOf('day').format('YYYY-MM-DD');
  1073. if (day == compareDay) {
  1074. if (item.type == event.type) {
  1075. ret = false;
  1076. }
  1077. }
  1078. });
  1079. return ret;
  1080. }
  1081. $scope.eventDropped = function(event, start, end) {
  1082. //console.log("new eventDropped")
  1083. var externalIndex = $scope.externalEvents.indexOf(event);
  1084. if (externalIndex > -1) {
  1085. if (angular.isDefined(event.users) && event.users != null && event.users.length <= event.person) {
  1086. var compareDay = moment(start).startOf('day').format('YYYY-MM-DD');
  1087. if (!judegeEventByLimit(event, compareDay)) {
  1088. SweetAlert.swal({
  1089. title: "操作失败",
  1090. text: "当天" + event.title + "已存在, 请纠正后重试!",
  1091. type: "error"
  1092. });
  1093. return;
  1094. }
  1095. //$scope.externalEvents.splice(externalIndex, 1);
  1096. var bm = moment(moment(start).startOf('day').format('YYYY-MM-DD') + ' ' + event.startTime);
  1097. var em = moment(moment(start).startOf('day').format('YYYY-MM-DD') + ' ' + event.endTime);
  1098. event.startsAt = bm.toDate();
  1099. //console.log(JSON.stringify(event) + "start" + start + " end" + end);
  1100. var endTime = '';
  1101. var startTime = '';
  1102. if (bm.hour() > em.hour()) {
  1103. endTime = (moment(start).startOf('day').add('day', 1).format('YYYY-MM-DD') + ' ' + event.endTime);
  1104. } else {
  1105. endTime = (moment(start).startOf('day').format('YYYY-MM-DD') + ' ' + event.endTime);
  1106. }
  1107. startTime = (moment(start).startOf('day').format('YYYY-MM-DD') + ' ' + event.startTime);
  1108. var data = {
  1109. "scheduleorder": {
  1110. "description": event.title,
  1111. "startTime": startTime,
  1112. "endTime": endTime,
  1113. "users": event.users,
  1114. "scheduleClass": { "id": $scope.scheduleClass[event.type].id }
  1115. }
  1116. };
  1117. //event.endTime = "";
  1118. // event.startTime = "";
  1119. api_bpm_schedule.add(data).then(function(response) {
  1120. if (response.status == 200 || response.status == 400) {
  1121. SweetAlert.swal({
  1122. title: "操作成功!",
  1123. text: "新建排班成功!",
  1124. type: "succes"
  1125. });
  1126. var myData = response.data;
  1127. event.id = myData.id;
  1128. console.log(JSON.stringify(event));
  1129. $scope.events.push({ 'id': event.id, 'title': event.title, 'startTime': startTime, 'endTime': endTime, 'users': event.users, 'type': event.type, 'startsAt': event.startsAt, 'draggable': event.draggable });
  1130. } else {
  1131. SweetAlert.swal({
  1132. title: "操作失败",
  1133. text: "新建排班失败,请稍后重试!",
  1134. type: "error"
  1135. })
  1136. }
  1137. })
  1138. } else {
  1139. SweetAlert.swal({
  1140. title: "操作失败",
  1141. text: "请选择" + event.person + "位值班人",
  1142. type: "error"
  1143. });
  1144. }
  1145. }
  1146. };
  1147. function showModal(action, event) {
  1148. var modalInstance = $aside.open({
  1149. templateUrl: 'calendarEvent.html',
  1150. placement: 'right',
  1151. size: 'sm',
  1152. backdrop: true,
  1153. controller: function($scope, $modalInstance, scheduleClass, APIService, MementFormat, Alert, EventsData) {
  1154. $scope.$modalInstance = $modalInstance;
  1155. $scope.action = action;
  1156. event.startsAt = moment(event.startsAt).format('YYYY-MM-DD HH:mm:ss');
  1157. event.endsAtTime = moment(event.startsAt).format('YYYY-MM-DD HH:mm:ss');
  1158. $scope.event = event;
  1159. console.log(event);
  1160. $scope.scheduleClassic = scheduleClass;
  1161. $scope.currentDate = MementFormat().toDate();
  1162. $scope.$watch('event.type', function(newvalue, oldvalue) {
  1163. if (oldvalue == newvalue) return;
  1164. if (scheduleClass[newvalue]) {
  1165. var sm = MementFormat(scheduleClass[newvalue].startTime);
  1166. var em = MementFormat(scheduleClass[newvalue].endTime);
  1167. event.startsAt = MementFormat(event.startTime).startOf('day').add(sm.hour(), 'hour').add(sm.minute(), 'minute').add(sm.second(), 'second').toDate();
  1168. event.startTime = MementFormat(event.startTime).startOf('day').add(sm.hour(), 'hour').add(sm.minute(), 'minute').add(sm.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1169. event.title = scheduleClass[newvalue].name;
  1170. if (sm.hour() > em.hour()) {
  1171. event.endTime = MementFormat(event.startTime).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1172. event.endsAtTime = MementFormat(event.startTime).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1173. } else {
  1174. event.endTime = MementFormat(event.startTime).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1175. event.endsAtTime = MementFormat(event.startTime).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1176. }
  1177. }
  1178. });
  1179. $scope.$watch('event.startsAt', function(newvalue, oldvalue) {
  1180. if (oldvalue == newvalue) return;
  1181. if (MementFormat(oldvalue).format('YYYY-MM-DD HH:mm:ss') == MementFormat(newvalue).format('YYYY-MM-DD HH:mm:ss')) return;
  1182. if (scheduleClass[event.type]) {
  1183. var sm = MementFormat(scheduleClass[event.type].startTime);
  1184. var em = MementFormat(scheduleClass[event.type].endTime);
  1185. //event.starts_at = MementFormat(event.starts_at).startOf('day').add(sm.hour(),'hour').add(sm.minute(),'minute').add(sm.second(),'second').toDate();
  1186. if (sm.hour() > em.hour()) {
  1187. event.endTime = MementFormat(event.startsAt).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1188. event.endsAtTime = MementFormat(event.startsAt).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1189. } else {
  1190. event.endTime = MementFormat(event.startsAt).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1191. event.endsAtTime = MementFormat(event.startsAt).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1192. }
  1193. }
  1194. });
  1195. $scope.setEndOpen = function() {
  1196. if (scheduleClass[event.type]) {
  1197. var sm = MementFormat(scheduleClass[event.type].startTime);
  1198. var em = MementFormat(scheduleClass[event.type].endTime);
  1199. event.startsAt = MementFormat(event.startTime).startOf('day').add(sm.hour(), 'hour').add(sm.minute(), 'minute').add(sm.second(), 'second').toDate();
  1200. if (sm.hour() > em.hour()) {
  1201. event.endTime = MementFormat(event.startTime).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1202. event.endsAtTime = MementFormat(event.startTime).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1203. } else {
  1204. event.endTime = MementFormat(event.startTime).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1205. event.endsAtTime = MementFormat(event.startTime).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1206. }
  1207. }
  1208. }
  1209. //同一天只能排出一个白班一个夜班
  1210. function judegeEventByLimit(event) {
  1211. var ret = true;
  1212. var compareDay = moment(event.startsAt).startOf('day').format('YYYY-MM-DD');
  1213. angular.forEach(EventsData, function(item) {
  1214. var day = moment(item.startsAt).startOf('day').format('YYYY-MM-DD');
  1215. if (day == compareDay) {
  1216. if (angular.isDefined(event.id)) {
  1217. if (item.type == event.type && event.id != item.id) ret = false;
  1218. } else {
  1219. if (item.type == event.type) ret = false;
  1220. }
  1221. }
  1222. });
  1223. return ret;
  1224. }
  1225. $scope.ok = function(event) {
  1226. // console.log("event="+JSON.stringify(event));
  1227. if (angular.isDefined(event.users) && event.users != null && event.users.length == 2) {
  1228. if (judegeEventByLimit(event)) {
  1229. event.action = action;
  1230. $modalInstance.close(event);
  1231. } else {
  1232. Alert.swal({
  1233. title: "操作失败",
  1234. text: "同一天只能排出一个白班一个夜班, 请纠正后重试!",
  1235. type: "error"
  1236. })
  1237. }
  1238. } else {
  1239. Alert.swal({
  1240. title: "操作失败",
  1241. text: "请填写值班人",
  1242. type: "error"
  1243. })
  1244. }
  1245. };
  1246. $scope.deleteEvent = function(event) {
  1247. event.action = "Deleted";
  1248. $modalInstance.close(event);
  1249. };
  1250. $scope.refreshModalUser = function(key) {
  1251. //for test
  1252. // $scope.users=[{"id":1,"phone":"13971293737","orgId":1,"name":"李静","role":[{"id":1,"rolecode":"admin","role":"主行管理员","flag":0}],"gender":"女","dept":{"id":3,"dept":"运行监控科"},"flag":0,"email":"","account":"005292","nickname":"lijing","group":[{"id":3,"groupName":"运行监控科"}]},{"id":2,"phone":"15807199490","orgId":1,"name":"李进","role":[{"id":1,"rolecode":"admin","role":"主行管理员","flag":0},{"id":7,"rolecode":"change manager","role":"变更流程经理","flag":1},{"id":8,"rolecode":"change coordinator","role":"协调员","flag":0},{"id":9,"rolecode":"configure manager","role":"配置管理员","flag":0},{"id":10,"rolecode":"release manager","role":"发布经理","flag":0}],"gender":"男","dept":{"id":3,"dept":"运行监控科"},"flag":0,"email":"","account":"005298","nickname":"lijin","group":[{"id":3,"groupName":"运行监控科"}]},{"id":3,"phone":"13507195958","orgId":1,"name":"杨代华","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"男","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005241","group":[{"id":9,"groupName":"管理层"}]},{"id":4,"phone":"18717107255","orgId":1,"name":"朱红艳","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"女","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005242","group":[{"id":9,"groupName":"管理层"}]},{"id":5,"phone":"13667282828","orgId":1,"name":"李喆","role":[{"id":2,"rolecode":"user","role":"主行员工","flag":1}],"gender":"男","dept":{"id":9,"dept":"管理层"},"flag":0,"email":"","account":"005243","group":[{"id":9,"groupName":"管理层"}]}];
  1253. // return;
  1254. var data = { "idx": "0", "sum": "7", "user": { "roledata": { "rolecode": "watch" } } };
  1255. if (key) {
  1256. data.user['name'] = key
  1257. }
  1258. console.log(data);
  1259. APIService.fetchDataList('user', data).then(function(response) {
  1260. if (response) {
  1261. console.log("response=" + JSON.stringify(response))
  1262. if (response.status = 200) {
  1263. $scope.modalusers = response.list;
  1264. console.log($scope.users);
  1265. }
  1266. }
  1267. })
  1268. };
  1269. $scope.users = [];
  1270. $scope.refreshModalUser();
  1271. },
  1272. resolve: {
  1273. scheduleClass: function() {
  1274. return $scope.scheduleClass;
  1275. },
  1276. APIService: function() {
  1277. return api_user_data;
  1278. },
  1279. MementFormat: function() {
  1280. return moment;
  1281. },
  1282. Alert: function() {
  1283. return SweetAlert;
  1284. },
  1285. EventsData: function() {
  1286. return $scope.events;
  1287. }
  1288. }
  1289. });
  1290. modalInstance.result.then(function(selectedEvent) {
  1291. if (selectedEvent.action == 'Edited') {
  1292. //new
  1293. var data = {
  1294. "scheduleorder": {
  1295. "description": selectedEvent.title,
  1296. "startTime": selectedEvent.startTime,
  1297. "endTime": selectedEvent.endTime,
  1298. "users": selectedEvent.users,
  1299. "scheduleClass": { "id": $scope.scheduleClass[selectedEvent.type].id }
  1300. }
  1301. };
  1302. api_bpm_schedule.add(data).then(function(response) {
  1303. if (response.status == 200) {
  1304. SweetAlert.swal({
  1305. title: "操作成功!",
  1306. text: "新建排班成功!",
  1307. type: "succes"
  1308. });
  1309. $scope.events.push(convertEvent(response.data));
  1310. // angular.forEach($scope.events,function(item){
  1311. // if(item.id==selectedEvent.id){
  1312. // item = selectedEvent;
  1313. // }
  1314. // })
  1315. } else {
  1316. SweetAlert.swal({
  1317. title: "操作失败",
  1318. text: "新建排班失败,请稍后重试!",
  1319. type: "error"
  1320. })
  1321. }
  1322. })
  1323. } else if (selectedEvent.action == 'Clicked') {
  1324. var data = {
  1325. "scheduleorder": {
  1326. "id": selectedEvent.id,
  1327. "description": selectedEvent.title,
  1328. "startTime": selectedEvent.startTime,
  1329. "endTime": selectedEvent.endTime,
  1330. "users": selectedEvent.users,
  1331. "scheduleClass": { "id": $scope.scheduleClass[selectedEvent.type].id }
  1332. }
  1333. };
  1334. api_bpm_schedule.update(data).then(function(response) {
  1335. if (response.status == 200 || response.status == 400) {
  1336. SweetAlert.swal({
  1337. title: "操作成功!",
  1338. text: "排班更新成功!",
  1339. type: "succes"
  1340. });
  1341. angular.forEach($scope.events, function(item) {
  1342. if (item.id == selectedEvent.id) {
  1343. item = selectedEvent;
  1344. }
  1345. })
  1346. } else {
  1347. SweetAlert.swal({
  1348. title: "操作失败",
  1349. text: "排班更新失败,请稍后重试!",
  1350. type: "error"
  1351. })
  1352. }
  1353. })
  1354. } else {
  1355. $scope.eventDeleted(selectedEvent);
  1356. }
  1357. });
  1358. }
  1359. $scope.moment = function(string) {
  1360. return moment(string);
  1361. }
  1362. $scope.eventClicked = function(event) {
  1363. showModal('Clicked', event);
  1364. };
  1365. $scope.addEvent = function() {
  1366. var sm = moment($scope.scheduleClass['job'].startTime);
  1367. var em = moment($scope.scheduleClass['job'].endTime);
  1368. var newevent = {
  1369. title: $scope.scheduleClass['job'].name,
  1370. type: $scope.scheduleClass['job'].code,
  1371. user: loginUser
  1372. };
  1373. newevent.startsAt = moment($scope.calendarDay).startOf('day').add(sm.hour(), 'hour').add(sm.minute(), 'minute').add(sm.second(), 'second').toDate();
  1374. newevent.startTime = moment($scope.calendarDay).startOf('day').add(sm.hour(), 'hour').add(sm.minute(), 'minute').add(sm.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1375. if (sm.hour() > em.hour()) {
  1376. newevent.endTime = moment($scope.calendarDay).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1377. newevent.endsAtTime = moment($scope.calendarDay).startOf('day').add(1, 'day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1378. //newevent.ends_at = moment($scope.calendarDay).startOf('day').add(1, 'day').add(em.hour(),'hour').add(em.minute(),'minute').add(em.second(),'second').toDate();
  1379. } else {
  1380. newevent.endTime = moment($scope.calendarDay).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').format('YYYY-MM-DD HH:mm:ss');
  1381. newevent.endsAtTime = moment($scope.calendarDay).startOf('day').add(em.hour(), 'hour').add(em.minute(), 'minute').add(em.second(), 'second').toDate();
  1382. //newevent.ends_at = moment($scope.calendarDay).startOf('day').add(em.hour(),'hour').add(em.minute(),'minute').add(em.second(),'second').toDate();
  1383. }
  1384. $scope.eventEdited(newevent);
  1385. };
  1386. $scope.eventEdited = function(event) {
  1387. showModal('Edited', event);
  1388. };
  1389. $scope.eventDeleted = function(event) {
  1390. SweetAlert.swal({
  1391. title: "确认删除?",
  1392. text: "删除的数据不可恢复,请确认继续操作!",
  1393. type: "warning",
  1394. showCancelButton: true,
  1395. confirmButtonColor: "#DD6B55",
  1396. confirmButtonText: "继续删除",
  1397. cancelButtonText: "取消操作",
  1398. closeOnConfirm: false,
  1399. closeOnCancel: false
  1400. }, function(isConfirm) {
  1401. if (isConfirm) {
  1402. api_bpm_schedule.remove([event.id]).then(function(response) {
  1403. if (response.status == 200) {
  1404. $scope.events.splice(event.$id, 1);
  1405. SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
  1406. } else {
  1407. SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
  1408. }
  1409. });
  1410. } else {
  1411. SweetAlert.swal("操作取消", "数据安全", "error");
  1412. }
  1413. });
  1414. };
  1415. //$scope.timeStart;
  1416. //$scope.timeEnd;
  1417. var updateView = function(newvalue, oldvalue) {
  1418. if (oldvalue == newvalue) return;
  1419. if (moment(oldvalue).format('YYYY-MM-DD HH:mm:ss') == moment(newvalue).format('YYYY-MM-DD HH:mm:ss')) return;
  1420. var timeStart, timeEnd, timeStartSpan, timeEndSpan;
  1421. if ($scope.calendarView == "year") {
  1422. } else if ($scope.calendarView == "month") {
  1423. timeStart = moment(newvalue).startOf('month');
  1424. timeEnd = moment(newvalue).endOf('month');
  1425. } else if ($scope.calendarView == "week") {
  1426. timeStart = moment(newvalue).startOf('week');
  1427. timeEnd = moment(newvalue).endOf('week');
  1428. } else if ($scope.calendarView == "Day") {
  1429. timeStart = moment(newvalue).startOf('day');
  1430. timeEnd = moment(newvalue).endOf('day');
  1431. }
  1432. timeStartSpan = timeStart.format('YYYY-MM-DD HH:mm:ss');
  1433. timeEndSpan = timeEnd.format('YYYY-MM-DD HH:mm:ss');
  1434. filterData["startTime"] = timeStartSpan;
  1435. filterData["endTime"] = timeEndSpan;
  1436. load(filterData);
  1437. }
  1438. $scope.$watch('calendarDate', updateView)
  1439. $scope.next = function() {
  1440. $scope.calendarControl.next();
  1441. }
  1442. $scope.prev = function() {
  1443. $scope.calendarControl.prev();
  1444. }
  1445. $scope.setCalendarToToday = function() {
  1446. $scope.calendarDay = new Date();
  1447. };
  1448. $scope.toggle = function($event, field, event) {
  1449. $event.preventDefault();
  1450. $event.stopPropagation();
  1451. event[field] = !event[field];
  1452. };
  1453. $scope.load(filterData);
  1454. }]);
  1455. // "$rootScope","$scope", "$state", "$timeout", "$interval", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_schedule", "$aside", "moment"
  1456. app.controller('shiftScheduleCtrl', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "moment", "SweetAlert", "Restangular", "api_bpm_schedule", "api_user_data", function($rootScope, $scope, $state, $timeout, $interval, moment, SweetAlert, Restangular, api_bpm_schedule, api_user_data) {
  1457. var loginUser = $rootScope.user;
  1458. $scope.shiftes = [];
  1459. var load = function() {
  1460. $scope.shiftes = [];
  1461. api_bpm_schedule.queryHandleoutSwitch(loginUser.id).then(function(response) {
  1462. if (response) {
  1463. var myData = Restangular.stripRestangular(response);
  1464. angular.forEach(myData.list, function(item) {
  1465. $scope.shiftes.push(item);
  1466. })
  1467. }
  1468. })
  1469. }
  1470. $scope.getShiftType = function(shift) {
  1471. var ret = "error";
  1472. if (shift.scheduleOrderDTO.status.id == 2) {
  1473. ret = "import";
  1474. }
  1475. if (shift.scheduleOrderDTO.status.id == 4) {
  1476. ret = "upload";
  1477. }
  1478. return ret;
  1479. }
  1480. // var getShift = function(){
  1481. // angular.forEach($scope.shiftes, function(item){
  1482. // if(item.user.id==loginUser.id){
  1483. // return item;
  1484. // }
  1485. // })
  1486. // }
  1487. var getShift = function() {
  1488. var ret = null;
  1489. angular.forEach($scope.shiftes, function(item) {
  1490. if (item.user.id == loginUser.id && (item.status.id == 1 || item.status.id == 2) && ret == null) {
  1491. ret = item;
  1492. }
  1493. })
  1494. return ret;
  1495. }
  1496. $scope.getHandle = function() {
  1497. var ret = "error";
  1498. var shift;
  1499. var index = 0;
  1500. //angular.forEach($scope.shiftes, function(item){
  1501. for (var index1 in $scope.shiftes) {
  1502. //shift = item;
  1503. var item = $scope.shiftes[index1];
  1504. //console.log(item.user.id +"==" +loginUser.id + "shift.status.id"+shift.status.id + " " + shift.scheduleOrderDTO.status.id );
  1505. if (item.user.id == loginUser.id) {
  1506. shift = item;
  1507. //console.log(shift.status.id);
  1508. if (shift.status.id == 1) {
  1509. //console.log("shift.scheduleOrderDTO.status.id="+shift.scheduleOrderDTO.status.id);
  1510. if (shift.scheduleOrderDTO.status.id == 2) {
  1511. ret = "import";
  1512. }
  1513. } else if (shift.status.id == 2) {
  1514. if (shift.scheduleOrderDTO.status.id == 4) {
  1515. ret = "upload";
  1516. break;
  1517. //return;
  1518. }
  1519. }
  1520. //return ret;
  1521. }
  1522. if (item.status.id == 5) {
  1523. index++;
  1524. }
  1525. //});
  1526. }
  1527. //console.log(index)
  1528. if (ret == 'import' && index != 2) {
  1529. ret = 'uploadDes';
  1530. }
  1531. console.log(ret);
  1532. return ret;
  1533. }
  1534. $scope.importShift = function() {
  1535. var shift = getShift();
  1536. var data = {};
  1537. if (shift.status.id == 1) {
  1538. data.status = {};
  1539. data.status.id = 4;
  1540. }
  1541. data.id = shift.id;
  1542. api_bpm_schedule.handleSchedule(data).then(function(response) {
  1543. if (response) {
  1544. var myData = Restangular.stripRestangular(response);
  1545. if (response.status == 200) {
  1546. SweetAlert.swal("接班成功!", "接班成功!", "success");
  1547. load();
  1548. } else {
  1549. SweetAlert.swal("接班失败!", "接班失败,请稍候重试", "error");
  1550. }
  1551. }
  1552. })
  1553. }
  1554. $scope.uploadShift = function() {
  1555. var shift = getShift();
  1556. var data = {};
  1557. if (shift.status.id == 2) {
  1558. data.status = {};
  1559. data.status.id = 5;
  1560. }
  1561. data.id = shift.id;
  1562. api_bpm_schedule.handleSchedule(data).then(function(response) {
  1563. if (response) {
  1564. var myData = Restangular.stripRestangular(response);
  1565. if (response.status == 200) {
  1566. SweetAlert.swal("交班成功!", "交班成功!", "success");
  1567. load();
  1568. } else {
  1569. SweetAlert.swal("交班失败!", "交班失败,请稍候重试", "error");
  1570. }
  1571. }
  1572. })
  1573. }
  1574. load();
  1575. // api_bpm_schedule.queryRecieveSwitch(loginUser.id).then(function(response){
  1576. // if(response){
  1577. // var myData = Restangular.stripRestangular(response);
  1578. // angular.forEach(myData.list, function(item){
  1579. // $scope.shiftes.push(item);
  1580. // })
  1581. // }
  1582. // })
  1583. }]);
  1584. app.controller('shiftRecordCtrl', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_schedule", "$aside", "moment", function($rootScope, $scope, $state, $timeout, $interval, SweetAlert, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_schedule, $aside, moment) {
  1585. $scope.langs = i18nService.getAllLangs();
  1586. $scope.lang = 'zh-cn';
  1587. i18nService.setCurrentLang($scope.lang);
  1588. $scope.gridOptions = {};
  1589. $scope.gridOptions.data = 'myData';
  1590. $scope.gridOptions.enableColumnResizing = true;
  1591. $scope.gridOptions.enableFiltering = false;
  1592. $scope.gridOptions.enableGridMenu = true;
  1593. $scope.gridOptions.enableRowSelection = true;
  1594. $scope.gridOptions.showGridFooter = true;
  1595. $scope.gridOptions.showColumnFooter = false;
  1596. $scope.gridOptions.fastWatch = true;
  1597. $scope.gridOptions.useExternalFiltering = true;
  1598. $scope.gridOptions.useExternalPagination = true;
  1599. $scope.gridOptions.paginationPageSizes = [10];
  1600. $scope.gridOptions.paginationPageSize = 10;
  1601. $scope.gridOptions.multiSelect = false;
  1602. //$scope.gridOptions.rowTemplate = "<div ng-dblclick=\"grid.appScope.pdList.onDblClick(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
  1603. //
  1604. $scope.gridOptions.rowIdentity = function(row) {
  1605. return row.id;
  1606. };
  1607. $scope.gridOptions.getRowIdentity = function(row) {
  1608. return row.id;
  1609. };
  1610. $scope.gridOptions.columnDefs = [{
  1611. name: 'orderTime',
  1612. displayName: '日期',
  1613. width: 100
  1614. }, {
  1615. name: 'scheduleClass.name',
  1616. displayName: '班次',
  1617. width: 80,
  1618. enableFiltering: false
  1619. },
  1620. {
  1621. name: 'scheduleWatchList[2].user.name',
  1622. displayName: '第一交班人',
  1623. width: 100,
  1624. enableFiltering: false
  1625. },
  1626. {
  1627. name: 'scheduleWatchList[2].shiftTime',
  1628. displayName: '交班时间',
  1629. width: 180,
  1630. enableFiltering: false
  1631. },
  1632. {
  1633. name: 'scheduleWatchList[3].user.name',
  1634. displayName: '第二交班人',
  1635. width: 100,
  1636. enableFiltering: false
  1637. },
  1638. {
  1639. name: 'scheduleWatchList[3].shiftTime',
  1640. displayName: '交班时间',
  1641. width: 180,
  1642. enableFiltering: false
  1643. },
  1644. {
  1645. name: 'scheduleWatchList[0].user.name',
  1646. displayName: '第一接班人',
  1647. width: 100,
  1648. enableFiltering: false
  1649. },
  1650. {
  1651. name: 'scheduleWatchList[0].succeedTime',
  1652. displayName: '接班时间',
  1653. width: 180,
  1654. enableFiltering: false
  1655. },
  1656. {
  1657. name: 'scheduleWatchList[1].user.name',
  1658. displayName: '第二接班人',
  1659. width: 100,
  1660. enableFiltering: false
  1661. },
  1662. {
  1663. name: 'scheduleWatchList[1].succeedTime',
  1664. displayName: '接班时间',
  1665. width: 180,
  1666. enableFiltering: false
  1667. },
  1668. {
  1669. name: 'status.name',
  1670. displayName: '状态',
  1671. width: 100,
  1672. enableFiltering: false
  1673. }
  1674. ];
  1675. $scope.gridOptions.onRegisterApi = function(gridApi) {
  1676. $scope.gridApi = gridApi;
  1677. gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
  1678. console.log(newPage);
  1679. console.log(pageSize);
  1680. $scope.refreshData('expand-right', {
  1681. "idx": newPage - 1,
  1682. "sum": pageSize
  1683. });
  1684. });
  1685. gridApi.selection.on.rowSelectionChanged($scope, function(data) {
  1686. //$scope.selected.item = data.entity;
  1687. console.log(data);
  1688. });
  1689. // gridApi.core.on.filterChanged($scope, function() {
  1690. // var grid = this.grid;
  1691. // var filtersData = {
  1692. // idx:0,
  1693. // sum:10
  1694. // };
  1695. // angular.forEach(grid.columns,function(item){
  1696. // if(item.enableFiltering){
  1697. // if(angular.isDefined(item.filters[0].term)&&item.filters[0].term!=''){
  1698. // // console.log('item.filters[0]='+JSON.stringify(item.filters[0]));
  1699. // if(angular.isUndefined(filtersData['scheduling'])){
  1700. // filtersData['scheduling']={};
  1701. // }
  1702. // filtersData['scheduling'][item.field]=item.filters[0].term;
  1703. // }
  1704. // }
  1705. // });
  1706. // $scope.memoryfilterData = filtersData;
  1707. // $scope.refreshData('expand-right', filtersData);
  1708. // });
  1709. };
  1710. this.selectRowFunction = function(data) {
  1711. console.log(data);
  1712. // $state.go('app.process.modeler',{modelId:data.id});
  1713. $state.go('app.scheduling.editor', {
  1714. taskId: data.taskId,
  1715. processInstanceId: data.processInstanceId
  1716. });
  1717. };
  1718. $scope.search = function(start, end) {
  1719. var filtersData = {
  1720. "scheduleorder": { "type": "4" },
  1721. idx: 0,
  1722. sum: 10
  1723. };
  1724. if (angular.isDefined(start) || angular.isDefined(end)) {
  1725. filtersData.scheduleorder['startTime'] = moment(start).format('YYYY-MM-DD HH:mm:ss');
  1726. // filtersData.scheduleorder['endTime']=moment(end).format('YYYY-MM-DD HH:mm:ss');
  1727. var timedata = new Date(end).getTime() + 86400000;
  1728. var d = new Date(timedata)
  1729. filtersData.scheduleorder['endTime'] = moment(d).format('YYYY-MM-DD HH:mm:ss');
  1730. console.log(timedata)
  1731. }
  1732. $scope.memoryfilterData = filtersData;
  1733. $scope.refresh('expand-right', filtersData);
  1734. }
  1735. $scope.ldloading = false;
  1736. $scope.export = function(start, end) {
  1737. $scope.ldloading.expand_right = true;
  1738. var filtersData = {
  1739. scheduleorder: { "type": "4" },
  1740. idx: 0,
  1741. sum: 1000
  1742. };
  1743. if (angular.isDefined(start) || angular.isDefined(end)) {
  1744. filtersData.scheduleorder['startTime'] = moment(start).format('YYYY-MM-DD HH:mm:ss');
  1745. var timedata = new Date(end).getTime() + 86400000;
  1746. var d = new Date(timedata)
  1747. filtersData.scheduleorder['endTime'] = moment(d).format('YYYY-MM-DD HH:mm:ss');
  1748. }
  1749. // if(angular.isDefined($scope.ciclassify)&&$scope.ciclassify!=null){
  1750. // if(angular.isUndefined($scope.ciclassify.children)||$scope.ciclassify.children.length==0){
  1751. api_bpm_schedule.query(filtersData).then(function(data) {
  1752. var dataList = Restangular.stripRestangular(data).list;
  1753. // if(dataList&&(dataList.list.length>=1)){
  1754. var headers = [];
  1755. var fieldHeaders = [];
  1756. var exportdata = [];
  1757. var fields = [];
  1758. var rowData = [];
  1759. var rowdata = [];
  1760. if ($scope.gridOptions.columnDefs.length > 0) {
  1761. angular.forEach($scope.gridOptions.columnDefs, function(prop) {
  1762. headers.push(prop.displayName);
  1763. // angular.forEach(prop.form.fields, function(field, index){
  1764. // fieldHeaders.push(field.templateOptions.label);
  1765. // fields.push(field.key);
  1766. // if(index!=0){
  1767. // headers.push("");
  1768. // }
  1769. // });
  1770. })
  1771. }
  1772. var rowLine = [];
  1773. var dataline = [];
  1774. for (var i = 0; i < dataList.length; i++) {
  1775. if (angular.isUndefined(dataList[i].scheduleWatchList[0])) { dataList[i].scheduleWatchList[0] = {} }
  1776. if (angular.isUndefined(dataList[i].scheduleWatchList[1])) { dataList[i].scheduleWatchList[1] = {} }
  1777. if (angular.isUndefined(dataList[i].scheduleWatchList[2])) { dataList[i].scheduleWatchList[2] = {} }
  1778. if (angular.isUndefined(dataList[i].scheduleWatchList[3])) { dataList[i].scheduleWatchList[3] = {} }
  1779. if (angular.isUndefined(dataList[i].scheduleWatchList[2].user)) { dataList[i].scheduleWatchList[2].user = "" }
  1780. if (angular.isUndefined(dataList[i].scheduleWatchList[2].shiftTime)) { dataList[i].scheduleWatchList[2].shiftTime = "" }
  1781. if (angular.isUndefined(dataList[i].scheduleWatchList[1].user)) { dataList[i].scheduleWatchList[1].user = "" }
  1782. if (angular.isUndefined(dataList[i].scheduleWatchList[1].succeedTime)) { dataList[i].scheduleWatchList[1].succeedTime = "" }
  1783. if (angular.isUndefined(dataList[i].scheduleWatchList[0].user)) { dataList[i].scheduleWatchList[0].user = "" }
  1784. if (angular.isUndefined(dataList[i].scheduleWatchList[0].succeedTime)) { dataList[i].scheduleWatchList[0].succeedTime = "" }
  1785. if (angular.isUndefined(dataList[i].scheduleWatchList[3].user)) { dataList[i].scheduleWatchList[3].user = "" }
  1786. if (angular.isUndefined(dataList[i].scheduleWatchList[3].shiftTime)) { dataList[i].scheduleWatchList[3].shiftTime = "" }
  1787. exportdata = {
  1788. orderTime: dataList[i].orderTime,
  1789. scheduleClass: dataList[i].scheduleClass.name,
  1790. username2: dataList[i].scheduleWatchList[2].user.name,
  1791. shiftTime2: dataList[i].scheduleWatchList[2].shiftTime,
  1792. username3: dataList[i].scheduleWatchList[3].user.name,
  1793. succeedTime3: dataList[i].scheduleWatchList[3].succeedTime,
  1794. username0: dataList[i].scheduleWatchList[0].user.name,
  1795. succeedTime0: dataList[i].scheduleWatchList[0].succeedTime,
  1796. username1: dataList[i].scheduleWatchList[1].user.name,
  1797. shiftTime1: dataList[i].scheduleWatchList[1].shiftTime,
  1798. status: dataList[i].status.name
  1799. }
  1800. // dataline.push([exportdata]);
  1801. var rowLine = [];
  1802. angular.forEach(exportdata, function(keyfield) {
  1803. // angular.forEach(data,function(keyfield){
  1804. // if(data[keyfield]){
  1805. rowLine.push(keyfield);
  1806. // }else{
  1807. // rowLine.push("");
  1808. // }
  1809. // })
  1810. // rowData.push(rowLine);
  1811. })
  1812. rowData.push(rowLine);
  1813. rowdata = rowData;
  1814. }
  1815. var csvdata = headers.join(',') + '\r\n';
  1816. // csvdata = csvdata + fieldHeaders.join(',') + '\r\n';
  1817. // csvdata = csvdata + fields.join(',') + '\r\n';
  1818. angular.forEach(rowData, function(line) {
  1819. csvdata = csvdata + line.join(',') + '\r\n';
  1820. })
  1821. csvdata = "\ufeff" + csvdata;
  1822. var file = new Blob([csvdata], {
  1823. type: 'application/csv;charset=utf-8'
  1824. });
  1825. // var filename = $scope.ciclassify.label;
  1826. var fileURL = URL.createObjectURL(file);
  1827. var a = document.createElement('a');
  1828. a.href = fileURL;
  1829. a.target = '_blank';
  1830. a.download = "交接班记录" + '.csv';
  1831. document.body.appendChild(a);
  1832. a.click();
  1833. // }
  1834. $scope.ldloading.expand_right = false;
  1835. // },function(){
  1836. // $scope.ldloading.expand_right = false;
  1837. })
  1838. // }else{
  1839. // SweetAlert.swal({
  1840. // title: "参数不合法!",
  1841. // text: "参数不合法,请选择没有子类的配置项导出!",
  1842. // type: "error"
  1843. // });
  1844. // }
  1845. // }else{
  1846. // SweetAlert.swal({
  1847. // title: "参数不合法!",
  1848. // text: "参数不合法,请选择需要导出的配置项分类!",
  1849. // type: "error"
  1850. // });
  1851. // }
  1852. }
  1853. $scope.today = function() {
  1854. $scope.dt = new Date();
  1855. };
  1856. $scope.today();
  1857. $scope.clear = function() {
  1858. $scope.dt = null;
  1859. };
  1860. // Disable weekend selection
  1861. $scope.disabled = function(date, mode) {
  1862. return (mode === 'day' && (date.getDay() === 0 || date.getDay() === 6));
  1863. };
  1864. // $scope.toggleMin = function () {
  1865. // $scope.minDate = $scope.minDate ? null : new Date();
  1866. // };
  1867. // $scope.toggleMin();
  1868. $scope.open = function($event) {
  1869. $event.preventDefault();
  1870. $event.stopPropagation();
  1871. $scope.opened = !$scope.opened;
  1872. };
  1873. $scope.endOpen = function($event) {
  1874. $event.preventDefault();
  1875. $event.stopPropagation();
  1876. $scope.startOpened = false;
  1877. $scope.endOpened = !$scope.endOpened;
  1878. };
  1879. $scope.startOpen = function($event) {
  1880. $event.preventDefault();
  1881. $event.stopPropagation();
  1882. $scope.endOpened = false;
  1883. $scope.startOpened = !$scope.startOpened;
  1884. };
  1885. $scope.dateOptions = {
  1886. formatYear: 'yy',
  1887. startingDay: 1
  1888. };
  1889. $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
  1890. $scope.format = $scope.formats[1];
  1891. $scope.hstep = 1;
  1892. $scope.mstep = 15;
  1893. // Time Picker
  1894. $scope.options = {
  1895. hstep: [1, 2, 3],
  1896. mstep: [1, 5, 10, 15, 25, 30]
  1897. };
  1898. $scope.ismeridian = true;
  1899. $scope.toggleMode = function() {
  1900. $scope.ismeridian = !$scope.ismeridian;
  1901. };
  1902. $scope.update = function() {
  1903. var d = new Date();
  1904. d.setHours(14);
  1905. d.setMinutes(0);
  1906. $scope.dt = d;
  1907. };
  1908. $scope.changed = function() {
  1909. $log.log('Time changed to: ' + $scope.dt);
  1910. };
  1911. $scope.clear = function() {
  1912. $scope.dt = null;
  1913. };
  1914. var defaultFilterData = {
  1915. "idx": 0,
  1916. "sum": 10
  1917. };
  1918. $scope.ldloading = {};
  1919. $scope.refreshData = function(style, filterData) {
  1920. // $scope.ldloading[style.replace('-', '_')] = true;
  1921. if (angular.isUndefined(filterData)) {
  1922. filterData = defaultFilterData;
  1923. }
  1924. if (angular.isDefined($scope.searchTypes)) {
  1925. filterData['searchType'] = $scope.searchTypes;
  1926. }
  1927. $scope.myData = [];
  1928. api_bpm_schedule.querySwitch(filterData).then(function(data) {
  1929. var myData = Restangular.stripRestangular(data);
  1930. $scope.gridOptions.totalItems = myData.totalNum;
  1931. $scope.myData = myData.list;
  1932. // $scope.ldloading[style.replace('-', '_')] = false;
  1933. }, function() {
  1934. // $scope.ldloading[style.replace('-', '_')] = false;
  1935. });
  1936. };
  1937. $scope.refreshData('expand-right', defaultFilterData);
  1938. $scope.refresh = function(style, filterData) {
  1939. // $scope.ldloading[style.replace('-', '_')] = true;
  1940. if (angular.isUndefined(filterData)) {
  1941. filterData = defaultFilterData;
  1942. }
  1943. if (angular.isDefined($scope.searchTypes)) {
  1944. filterData['searchType'] = $scope.searchTypes;
  1945. }
  1946. $scope.myData = [];
  1947. api_bpm_schedule.query(filterData).then(function(data) {
  1948. var myData = Restangular.stripRestangular(data);
  1949. $scope.gridOptions.totalItems = myData.totalNum;
  1950. $scope.myData = myData.list;
  1951. // $scope.ldloading[style.replace('-', '_')] = false;
  1952. }, function() {
  1953. // $scope.ldloading[style.replace('-', '_')] = false;
  1954. });
  1955. };
  1956. }]);
  1957. // delete-event-html="'<i class=\'glyphicon glyphicon-remove\'></i>'"
  1958. // edit-event-html="'<i class=\'glyphicon glyphicon-pencil\'></i>'"