Commit 22f5a969b359e4a75f8949b36bf720e5d488c62a

Authored by 潘钊
2 parents 85bee802 92cba787

Merge branch 'qingpu' of http://222.66.0.204:8800/panzhaov5/bsth_control

into qingpu

# Conflicts:
#	src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
#	src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
#	src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
#	src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list_report.html
#	src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js

Too many changes to show.

To preserve performance only 3 of 7 files are displayed.

src/main/resources/application.properties
1 1 spring.profiles: dev,prod
2   -spring.profiles.active: dev
  2 +spring.profiles.active: prod
3 3  
4 4 spring.view.suffix=.html
5 5 server.session-timeout=-1
... ...
src/main/resources/datatools/config-prod.properties
... ... @@ -4,13 +4,13 @@
4 4 datatools.kettle_properties=/datatools/kettle.properties
5 5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正)
6 6 #数据库ip地址
7   -datatools.kvars_dbip=192.168.168.171
  7 +datatools.kvars_dbip=192.168.40.82
8 8 #数据库用户名
9 9 datatools.kvars_dbuname=root
10 10 #数据库密码
11   -datatools.kvars_dbpwd=root2jsp
  11 +datatools.kvars_dbpwd=123456
12 12 #数据库库名
13   -datatools.kvars_dbdname=control
  13 +datatools.kvars_dbdname=qp_control
14 14  
15 15 # 3、上传数据配置信息
16 16 # 上传文件目录配置(根据不同的环境需要修正)
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
1   -// 自定义指令,指令模版在dt目录下
2   -
3   -
4   -angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) {
5   - return {
6   - restrict: 'A',
7   - link: function(scope, element) {
8   - // 初始隐藏loading界面
9   - element.hide();
10   -
11   - // 开始请求通知处理
12   - requestNotificationChannel.onRequestStarted(scope, function() {
13   - element.show();
14   - });
15   - // 请求结束通知处理
16   - requestNotificationChannel.onRequestEnded(scope, function() {
17   - element.hide();
18   - });
19   - }
20   - };
21   -}]);
22   -
23   -angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
24   - return {
25   - restrict: 'E',
26   - templateUrl: '/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html',
27   - scope: {
28   - model: "="
29   - },
30   - controllerAs: "$saSelectCtrl",
31   - bindToController: true,
32   - controller: function() {
33   - var self = this;
34   - self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}
35   - },
36   - /**
37   - * 此阶段可以改dom结构,此时angular还没扫描指令,
38   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
39   - * @param tElem
40   - * @param tAttrs
41   - * @returns {{pre: Function, post: Function}}
42   - */
43   - compile: function(tElem, tAttrs) {
44   - // 确定是否使用angularjs required验证
45   - // 属性 required
46   - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
47   - var required_attr = tAttrs["required"];
48   - if (required_attr) {
49   - if (required_attr == "true") {
50   - // 添加required属性指令
51   - tElem.find("ui-select").attr("required", "");
52   - } else {
53   - // 不等于true,不添加required属性指令
54   - }
55   - } else {
56   - // 不添加required属性指令
57   - }
58   -
59   - //console.log("saSelect" + ":compile = >" + tElem.html());
60   -
61   - return {
62   - pre: function(scope, element, attr) {
63   - // TODO:
64   - },
65   - /**
66   - * 相当于link函数。
67   - *
68   - * 重要属性如下:
69   - * model 是绑定外部值。
70   - * dicgroup 字典组的类型
71   - * name input name属性值
72   - */
73   - post: function(scope, element, attr) {
74   - // 1、获取属性
75   - var dicgroup_attr = attr['dicgroup']; // 字典组的类型
76   - var name_attr = attr['name']; // input name属性值
77   - var dicname_attr = attr['dicname']; // model关联的字典名字段
78   - var codename_attr = attr['codename']; // model关联的字典值字段
79   - var placeholder_attr = attr['placeholder']; // select placeholder提示
80   -
81   - // 系统的字典对象,使用dictionaryUtils类获取
82   - var origin_dicgroup;
83   - var dic_key; // 字典key
84   -
85   - if (dicgroup_attr) { // 赋值指定的字典数据
86   - origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);
87   - for (dic_key in origin_dicgroup) {
88   - var data = {}; // 重新组合的字典元素对象
89   - if (dic_key == "true")
90   - data.code = true;
91   - else
92   - data.code = dic_key;
93   - data.name = origin_dicgroup[dic_key];
94   - scope["$saSelectCtrl"].datas.push(data);
95   - }
96   - }
97   -
98   - if (name_attr) {
99   - scope["$saSelectCtrl"].nv = name_attr;
100   - }
101   - if (placeholder_attr) {
102   - scope["$saSelectCtrl"].ph = placeholder_attr;
103   - }
104   -
105   - scope["$saSelectCtrl"].select = function($item) {
106   - if (codename_attr) {
107   - scope["$saSelectCtrl"].model[codename_attr] = $item.code;
108   - }
109   - if (dicname_attr) {
110   - scope["$saSelectCtrl"].model[dicname_attr] = $item.name;
111   - }
112   - };
113   -
114   - scope["$saSelectCtrl"].remove = function() {
115   - if (codename_attr) {
116   - scope["$saSelectCtrl"].model[codename_attr] = null;
117   - }
118   - if (dicname_attr) {
119   - scope["$saSelectCtrl"].model[dicname_attr] = null;
120   - }
121   - scope["$saSelectCtrl"].cmodel = null;
122   - };
123   -
124   - $timeout(function() {
125   - // 创建内部使用的绑定对象
126   - var model_code = scope["$saSelectCtrl"].model[codename_attr];
127   - scope["$saSelectCtrl"].cmodel = model_code;
128   - }, 0);
129   - }
130   - }
131   - }
132   - };
133   -}]);
134   -
135   -/**
136   - * saRadiogroup指令
137   - * 属性如下:
138   - * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
139   - * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
140   - * name(必须):控件的名字
141   - * required(可选):是否要用required验证
142   - * disabled(可选):标示单选框是否可选
143   - *
144   - */
145   -angular.module('ScheduleApp').directive("saRadiogroup", [function() {
146   - /**
147   - * 使用字典数据的单选按钮组的指令。
148   - * 指令名称:truefalse-Dic
149   - */
150   - return {
151   - restrict: 'E',
152   - templateUrl: '/pages/scheduleApp/module/common/dt/MyRadioGroupWrapTemplate.html',
153   - scope: {
154   - model: "="
155   - },
156   - controllerAs: "$saRadiogroupCtrl",
157   - bindToController: true,
158   - controller: function($scope) {
159   - //$scope["model"] = {selectedOption: null};
160   - //console.log("controller");
161   - //console.log("controller:" + $scope["model"]);
162   -
163   - var self = this;
164   - self.$$data = null; // 内部数据
165   - },
166   -
167   - /**
168   - * 此阶段可以改dom结构,此时angular还没扫描指令,
169   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
170   - * @param tElem
171   - * @param tAttrs
172   - * @returns {{pre: Function, post: Function}}
173   - */
174   - compile: function(tElem, tAttrs) {
175   - // 获取属性
176   - var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
177   - var $name_attr = tAttrs["name"]; // 控件的名字
178   - var $required_attr = tAttrs["required"]; // 是否要用required验证
179   - var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
180   -
181   - // controlAs名字
182   - var ctrlAs = "$saRadiogroupCtrl";
183   -
184   - // 如果有required属性,添加angularjs required验证
185   - if ($required_attr != undefined) {
186   - tElem.find("input").attr("required", "");
187   - }
188   -
189   - return {
190   - pre: function(scope, element, attr) {
191   -
192   - },
193   -
194   - /**
195   - * 相当于link函数。
196   - * @param scope
197   - * @param element
198   - * @param attr
199   - */
200   - post: function(scope, element, attr) {
201   - //console.log("link");
202   - //console.log("link:" + scope.model);
203   - //scope["model"] = {selectedOption: null};
204   -
205   - if ($name_attr) {
206   - scope[ctrlAs].nv = $name_attr;
207   - }
208   -
209   - if ($disabled_attr) {
210   - scope[ctrlAs].disabled = true;
211   - }
212   - if ($dicgroup_attr) {
213   - var obj = dictionaryUtils.getByGroup($dicgroup_attr);
214   - scope[ctrlAs].$$data = obj;
215   - // 处理 scope["dic"] key值
216   - scope[ctrlAs].dicvalueCalcu = function(value) {
217   - if (value == "true") {
218   - //console.log(value);
219   - return true;
220   - } else if (value == "false") {
221   - //console.log(value);
222   - return false;
223   - } else {
224   - return value;
225   - }
226   - };
227   - }
228   - }
229   - };
230   - }
231   - };
232   -}]);
233   -
234   -angular.module('ScheduleApp').directive("remoteValidaton", [
235   - 'BusInfoManageService_g',
236   - 'EmployeeInfoManageService_g',
237   - 'TimeTableManageService_g',
238   - function(
239   - busInfoManageService_g,
240   - employeeInfoManageService_g,
241   - timeTableManageService_g
242   - ) {
243   - /**
244   - * 远端验证指令,依赖于ngModel
245   - * 指令名称 remote-Validation
246   - * 需要属性 rvtype 表示验证类型
247   - */
248   - return {
249   - restrict: "A",
250   - require: "^ngModel",
251   - link: function(scope, element, attr, ngModelCtrl) {
252   - element.bind("keyup", function() {
253   - var modelValue = ngModelCtrl.$modelValue;
254   - var rv1_attr = attr["rv1"];
255   - if (attr["rvtype"]) {
256   -
257   - // 根据rvtype的值,确定使用那个远端验证的url,
258   - // rv1, rv2, rv3是关联比较值,暂时使用rv1
259   - // 这个貌似没法通用,根据业务变换
260   - // TODO:暂时有点乱以后改
261   - if (attr["rvtype"] == "insideCode") {
262   - busInfoManageService_g.validate.insideCode(
263   - {"insideCode_eq": modelValue, type: "equale"},
264   - function(result) {
265   - //console.log(result);
266   - if (result.status == "SUCCESS") {
267   - ngModelCtrl.$setValidity('remote', true);
268   - } else {
269   - ngModelCtrl.$setValidity('remote', false);
270   - }
271   - },
272   - function(result) {
273   - //console.log(result);
274   - ngModelCtrl.$setValidity('remote', true);
275   - }
276   - );
277   - } else if (attr["rvtype"] == "jobCode") {
278   - if (!rv1_attr) {
279   - ngModelCtrl.$setValidity('remote', false);
280   - return;
281   - }
282   -
283   - employeeInfoManageService_g.validate.jobCode(
284   - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
285   - function(result) {
286   - //console.log(result);
287   - if (result.status == "SUCCESS") {
288   - ngModelCtrl.$setValidity('remote', true);
289   - } else {
290   - ngModelCtrl.$setValidity('remote', false);
291   - }
292   - },
293   - function(result) {
294   - //console.log(result);
295   - ngModelCtrl.$setValidity('remote', true);
296   - }
297   - );
298   - } else if (attr["rvtype"] == "ttinfoname") {
299   - if (!rv1_attr) {
300   - ngModelCtrl.$setValidity('remote', false);
301   - return;
302   - }
303   -
304   - timeTableManageService_g.validate.ttinfoname(
305   - {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},
306   - function(result) {
307   - //console.log(result);
308   - if (result.status == "SUCCESS") {
309   - ngModelCtrl.$setValidity('remote', true);
310   - } else {
311   - ngModelCtrl.$setValidity('remote', false);
312   - }
313   - },
314   - function(result) {
315   - //console.log(result);
316   - ngModelCtrl.$setValidity('remote', true);
317   - }
318   - );
319   -
320   - }
321   - } else {
322   - // 没有rvtype,就不用远端验证了
323   - ngModelCtrl.$setValidity('remote', true);
324   - }
325   -
326   - attr.$observe("rv1", function(value) {
327   - if (attr["rvtype"] == "jobCode") {
328   - if (!value) {
329   - ngModelCtrl.$setValidity('remote', false);
330   - return;
331   - }
332   -
333   - employeeInfoManageService_g.validate.jobCode(
334   - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
335   - function(result) {
336   - //console.log(result);
337   - if (result.status == "SUCCESS") {
338   - ngModelCtrl.$setValidity('remote', true);
339   - } else {
340   - ngModelCtrl.$setValidity('remote', false);
341   - }
342   - },
343   - function(result) {
344   - //console.log(result);
345   - ngModelCtrl.$setValidity('remote', true);
346   - }
347   - );
348   - } else if (attr["rvtype"] == "ttinfoname") {
349   - if (!value) {
350   - ngModelCtrl.$setValidity('remote', false);
351   - return;
352   - }
353   -
354   - console.log("rv1:" + value);
355   -
356   - timeTableManageService_g.validate.ttinfoname(
357   - {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},
358   - function(result) {
359   - //console.log(result);
360   - if (result.status == "SUCCESS") {
361   - ngModelCtrl.$setValidity('remote', true);
362   - } else {
363   - ngModelCtrl.$setValidity('remote', false);
364   - }
365   - },
366   - function(result) {
367   - //console.log(result);
368   - ngModelCtrl.$setValidity('remote', true);
369   - }
370   - );
371   - }
372   -
373   - });
374   - });
375   - }
376   - };
377   - }]);
378   -
379   -
380   -/**
381   - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
382   - * 1、compile阶段使用的属性如下:
383   - * required:用于和表单验证连接,指定成required="true"才有效。
384   - * 2、link阶段使用的属性如下
385   - * model:关联的模型对象
386   - * name:表单验证时需要的名字
387   - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
388   - * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
389   - * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
390   - * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
391   - * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
392   - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
393   - * placeholder:select placeholder字符串描述
394   - *
395   - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
396   - * $$SearchInfoService_g,内部使用的数据服务
397   - */
398   -// saSelect2指令使用的内部信service
399   -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
400   - return {
401   - xl: $resource(
402   - '/line/:type',
403   - {order: 'name', direction: 'ASC'},
404   - {
405   - list: {
406   - method: 'GET',
407   - isArray: true
408   - }
409   - }
410   - ),
411   - zd: $resource(
412   - '/stationroute/stations',
413   - {order: 'stationCode', direction: 'ASC'},
414   - {
415   - list: {
416   - method: 'GET',
417   - isArray: true
418   - }
419   - }
420   - ),
421   - tcc: $resource(
422   - '/carpark/:type',
423   - {order: 'parkCode', direction: 'ASC'},
424   - {
425   - list: {
426   - method: 'GET',
427   - isArray: true
428   - }
429   - }
430   - ),
431   - ry: $resource(
432   - '/personnel/:type',
433   - {order: 'personnelName', direction: 'ASC'},
434   - {
435   - list: {
436   - method: 'GET',
437   - isArray: true
438   - }
439   - }
440   - ),
441   - cl: $resource(
442   - '/cars/:type',
443   - {order: "insideCode", direction: 'ASC'},
444   - {
445   - list: {
446   - method: 'GET',
447   - isArray: true
448   - }
449   - }
450   - ),
451   - ttInfo: $resource(
452   - '/tic/:type',
453   - {order: "name", direction: 'ASC'},
454   - {
455   - list: {
456   - method: 'GET',
457   - isArray: true
458   - }
459   - }
460   - ),
461   - cci: $resource(
462   - '/cci/cars',
463   - {},
464   - {
465   - list: {
466   - method: 'GET',
467   - isArray: true
468   - }
469   - }
470   -
471   - ),
472   - cci2: $resource(
473   - '/cci/:type',
474   - {},
475   - {
476   - list: {
477   - method: 'GET',
478   - isArray: true
479   - }
480   - }
481   - ),
482   - cci3: $resource(
483   - '/cci/cars2',
484   - {},
485   - {
486   - list: {
487   - method: 'GET',
488   - isArray: true
489   - }
490   - }
491   -
492   - ),
493   - eci: $resource(
494   - '/eci/jsy',
495   - {},
496   - {
497   - list: {
498   - method: 'GET',
499   - isArray: true
500   - }
501   - }
502   - ),
503   - eci2: $resource(
504   - '/eci/spy',
505   - {},
506   - {
507   - list: {
508   - method: 'GET',
509   - isArray: true
510   - }
511   - }
512   - )
513   - }
514   -}]);
515   -angular.module('ScheduleApp').filter("$$pyFilter", function() {
516   - return function(items, props) {
517   - var out = [];
518   - var limit = props["limit"] || 20; // 默认20条记录
519   -
520   - if (angular.isArray(items)) {
521   - items.forEach(function(item) {
522   - if (out.length < limit) {
523   - if (props.search) {
524   - var upTerm = props.search.toUpperCase();
525   - if(item.fullChars.indexOf(upTerm) != -1
526   - || item.camelChars.indexOf(upTerm) != -1) {
527   - out.push(item);
528   - }
529   - }
530   - }
531   - });
532   - }
533   -
534   - return out;
535   - };
536   -});
537   -angular.module('ScheduleApp').directive("saSelect2", [
538   - '$timeout', '$$SearchInfoService_g',
539   - function($timeout, $$searchInfoService_g) {
540   - return {
541   - restrict: 'E',
542   - templateUrl: '/pages/scheduleApp/module/other/MySearchSelectTemplate.html',
543   - scope: {
544   - model: "=" // 独立作用域,关联外部的模型对象
545   - },
546   - controllerAs: "$saSelectCtrl",
547   - bindToController: true,
548   - controller: function($scope) {
549   - var self = this;
550   - self.$$data = []; // 内部关联的数据
551   - },
552   - /**
553   - * 此阶段可以改dom结构,此时angular还没扫描指令,
554   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
555   - * @param tElem
556   - * @param tAttrs
557   - * @returns {{pre: Function, post: Function}}
558   - */
559   - compile: function(tElem, tAttrs) {
560   - // 1、获取此阶段使用的属性
561   - var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
562   -
563   - // 2、处理属性
564   -
565   - // 确定是否使用angularjs required验证
566   - // 属性 required
567   - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
568   - if ($required_attr) {
569   - if ($required_attr == "true") {
570   - // 添加required属性指令
571   - tElem.find("ui-select").attr("required", "");
572   - } else {
573   - // 不等于true,不添加required属性指令
574   - }
575   - } else {
576   - // 不添加required属性指令
577   - }
578   -
579   - //console.log("saSelect" + ":compile = >" + tElem.html());
580   -
581   - return {
582   - pre: function(scope, element, attr) {
583   - // TODO:
584   - },
585   - /**
586   - * 相当于link函数。
587   - *
588   - * 重要属性如下:
589   - * model 是绑定外部值。
590   - * dicgroup 字典组的类型
591   - * name input name属性值
592   - */
593   - post: function(scope, element, attr) {
594   - // 1、获取此阶段使用的属性
595   - var $name_attr = attr["name"]; // 表单验证时需要的名字
596   - var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
597   - var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
598   - var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
599   - var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
600   - var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
601   - var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
602   - var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
603   -
604   - // 2、处理属性、转换成$saSelectCtrl内部使用的属性
605   - if ($name_attr) {
606   - scope["$saSelectCtrl"].$name_attr = $name_attr;
607   - }
608   - if ($placeholder_attr) {
609   - scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
610   - }
611   - if ($showcolname_attr) {
612   - scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
613   - }
614   -
615   - // 2-1、添加内部方法,根据type值,改变$$data的值
616   - scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
617   - // 根据type属性动态载入数据
618   - if ($type_attr) {
619   - $$searchInfoService_g[$type_attr].list(
620   - {type: "all"},
621   - function(result) {
622   - scope["$saSelectCtrl"].$$data = [];
623   - for (var i = 0; i < result.length; i ++) {
624   - var data = {}; // data是result的一部分属性集合,根据配置来确定
625   - if ($datacolname1_attr) {
626   - data[$datacolname1_attr] = result[i][$datacolname1_attr];
627   - }
628   - if ($datacolname2_attr) {
629   - data[$datacolname2_attr] = result[i][$datacolname2_attr];
630   - }
631   - if ($showcolname_attr) {
632   - // 动态添加基于名字的拼音
633   - data[$showcolname_attr] = result[i][$showcolname_attr];
634   - if (data[$showcolname_attr]) {
635   - data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
636   - data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
637   - }
638   - }
639   - if (data["fullChars"])
640   - scope["$saSelectCtrl"].$$data.push(data);
641   - }
642   - },
643   - function(result) {
644   -
645   - }
646   - );
647   - }
648   - };
649   -
650   - // 3、选择、删除事件映射模型和内部数据对应的字段
651   - scope["$saSelectCtrl"].$select_fn_attr = function($item) {
652   - if ($modelcolname1_attr && $datacolname1_attr) {
653   - scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];
654   - }
655   - if ($modelcolname2_attr && $datacolname2_attr) {
656   - scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];
657   - }
658   - };
659   - scope["$saSelectCtrl"].$remove_fn_attr = function() {
660   - if ($modelcolname1_attr) {
661   - scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;
662   - }
663   - if ($modelcolname2_attr) {
664   - scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;
665   - }
666   - scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空
667   -
668   - scope["$saSelectCtrl"].$$internal_data_change_fn();
669   - };
670   -
671   - // 4、搜索事件
672   - scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {
673   - //var fullChars = pinyin.getFullChars($search).toUpperCase();
674   - //var camelChars = pinyin.getCamelChars($search);
675   - //
676   - //console.log(fullChars + " " + camelChars);
677   - // TODO:事件暂时没用,放着以后再说
678   - };
679   -
680   - // 5、全部载入后,输入的
681   - $timeout(function() {
682   - // 创建内部使用的绑定对象,用于确认选中那个值
683   - scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];
684   -
685   - scope["$saSelectCtrl"].$$internal_data_change_fn();
686   - }, 0);
687   - }
688   - }
689   - }
690   - };
691   - }
692   -]);
693   -
694   -/**
695   - * saSelect3指令
696   - * 属性如下:
697   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
698   - * name(必须):控件的名字
699   - * placeholder(可选):占位符字符串
700   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
701   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
702   - * icname(必须):内部与之对应的字段名,如:icname=code
703   - * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
704   - * icname2(可选):内部与之对应的字段名2,如:icname2=name
705   - * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
706   - * icname3(可选):内部与之对应的字段名3,如:icname2=name
707   - * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
708   - * required(可选):是否要用required验证
709   - * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
710   - * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
711   - *
712   - * 高级属性:
713   - * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
714   - * dataparam(可选):数据源关联的外部参数对象
715   - *
716   - */
717   -angular.module('ScheduleApp').directive("saSelect3", [
718   - '$timeout',
719   - '$$SearchInfoService_g',
720   - function($timeout, $$searchInfoService_g) {
721   - return {
722   - restrict: 'E',
723   - templateUrl: '/pages/scheduleApp/module/common/dt/MyUiSelectWrapTemplate1.html',
724   - scope: {
725   - model: "=" // 独立作用域,关联外部的模型object
726   - },
727   - controllerAs: "$saSelectCtrl",
728   - bindToController: true,
729   - controller: function($scope) {
730   - var self = this;
731   - self.$$data = []; // ui-select显示用的数据源
732   - self.$$data_real= []; // 内部真实的数据源
733   - },
734   -
735   - /**
736   - * 此阶段可以改dom结构,此时angular还没扫描指令,
737   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
738   - * @param tElem
739   - * @param tAttrs
740   - * @returns {{pre: Function, post: Function}}
741   - */
742   - compile: function(tElem, tAttrs) {
743   - // 获取所有的属性
744   - var $name_attr = tAttrs["name"]; // 控件的名字
745   - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
746   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
747   - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
748   - var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
749   - var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
750   - var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
751   - var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
752   -
753   - var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
754   - var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
755   - var $required_attr = tAttrs["required"]; // 是否需要required验证
756   - var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
757   - var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
758   -
759   - // controlAs名字
760   - var ctrlAs = "$saSelectCtrl";
761   -
762   - // 数据源初始化标志
763   - var $$data_init = false;
764   - // 如果有required属性,添加angularjs required验证
765   - if ($required_attr != undefined) {
766   - tElem.find("ui-select").attr("required", "");
767   - }
768   -
769   - // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义
770   - // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}
771   - tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");
772   - // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data
773   - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
774   - // 原来的设置:item[$saSelectCtrl.$icname_s]
775   - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);
776   - // 原来的设置:{{$saSelectCtrl.$name}}
777   - tElem.find("ui-select").attr("name", $name_attr);
778   - // 原来的设置:{{$saSelectCtrl.$placeholder}}
779   - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
780   -
781   - return {
782   - pre: function(scope, element, attr) {
783   - // TODO:
784   - },
785   - /**
786   - * 相当于link函数。
787   - * @param scope
788   - * @param element
789   - * @param attr
790   - */
791   - post: function(scope, element, attr) {
792   - // 添加选中事件处理函数
793   - scope[ctrlAs].$$internal_select_fn = function($item) {
794   - if ($dcname_attr && $icname_attr) {
795   - if ($mlp_attr) {
796   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
797   - } else {
798   - scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
799   - }
800   - }
801   - if ($dcname2_attr && $icname2_attr) {
802   - if ($mlp_attr) {
803   - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");
804   - } else {
805   - scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
806   - }
807   - }
808   - if ($dcname3_attr && $icname3_attr) {
809   - if ($mlp_attr) {
810   - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
811   - } else {
812   - scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
813   - }
814   - }
815   - };
816   -
817   - // 删除选中事件处理函数
818   - scope[ctrlAs].$$internal_remove_fn = function() {
819   - scope[ctrlAs].$$internalmodel = undefined;
820   - if ($mlp_attr) {
821   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
822   - } else {
823   - scope[ctrlAs].model[$dcname_attr] = undefined;
824   - }
825   -
826   - if ($dcname2_attr) {
827   - if ($mlp_attr) {
828   - eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");
829   - } else {
830   - scope[ctrlAs].model[$dcname2_attr] = undefined;
831   - }
832   - }
833   - if ($dcname3_attr) {
834   - if ($mlp_attr) {
835   - eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
836   - } else {
837   - scope[ctrlAs].model[$dcname3_attr] = undefined;
838   - }
839   - }
840   - };
841   -
842   - /**
843   - * 内部方法,读取字典数据作为数据源。
844   - * @param dicgroup 字典类型,如:gsType
845   - * @param ccol 代码字段名
846   - * @param ncol 名字字段名
847   - */
848   - scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {
849   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
850   - var dic_key; // 字典key
851   - // 清空内部数据
852   - scope[ctrlAs].$$data_real = [];
853   - for (dic_key in origin_dicgroup) {
854   - var data = {}; // 重新组合的字典元素对象
855   - if (dic_key == "true")
856   - data[ccol] = true;
857   - else
858   - data[ccol] = dic_key;
859   - data[ncol] = origin_dicgroup[dic_key];
860   - scope[ctrlAs].$$data_real.push(data);
861   - }
862   - // 这里直接将$$data_real数据深拷贝到$$data
863   - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
864   -
865   - console.log(scope[ctrlAs].$$data);
866   - };
867   -
868   - /**
869   - * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把
870   - * 内部方法,读取字典数据作为数据源。
871   - * @param result 原始数据
872   - * @param dcvalue 传入的关联数据
873   - */
874   - scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {
875   - //console.log("start");
876   - // 清空内部数据
877   - scope[ctrlAs].$$data_real = [];
878   - scope[ctrlAs].$$data = [];
879   - for (var i = 0; i < result.length; i ++) {
880   - if ($icname_s_attr) {
881   - if ($mlp_attr) {
882   - if (eval("result[i]" + "." + $icname_s_attr)) {
883   - // 全拼
884   - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();
885   - // 简拼
886   - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));
887   - }
888   - } else {
889   - if (result[i][$icname_s_attr]) {
890   - // 全拼
891   - result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();
892   - // 简拼
893   - result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);
894   - }
895   - }
896   - }
897   -
898   - if (result[i]["fullChars"]) { // 有拼音的加入数据源
899   - scope[ctrlAs].$$data_real.push(result[i]);
900   - }
901   -
902   - }
903   - //console.log("start2");
904   -
905   - // 数量太大取前10条记录作为显示
906   - if (angular.isArray(scope[ctrlAs].$$data_real)) {
907   - // 先迭代循环查找已经传过来的值
908   - if (scope[ctrlAs].$$data_real.length > 0) {
909   - if (dcvalue) {
910   - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
911   - if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {
912   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));
913   - break;
914   - }
915   - }
916   - }
917   - }
918   - // 在插入剩余的数据
919   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
920   - if (scope[ctrlAs].$$data.length < 10) {
921   - if ($mlp_attr) {
922   - if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {
923   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
924   - }
925   - } else {
926   - if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {
927   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
928   - }
929   - }
930   - } else {
931   - break;
932   - }
933   - }
934   - }
935   -
936   - //console.log("end");
937   - };
938   -
939   - /**
940   - * 判定一个对象是否为空对象。
941   - * @param Obj
942   - */
943   - scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
944   - console.log(typeof obj);
945   -
946   - if (typeof obj === "object" && !(obj instanceof Array)) {
947   - for (var prop in obj) {
948   - if (obj.hasOwnProperty(prop)) {
949   - return false;
950   - }
951   - }
952   - return true;
953   - } else {
954   - throw "必须是对象";
955   - }
956   - };
957   -
958   - // 刷新数据
959   - scope[ctrlAs].$$internal_refresh_fn = function(search) {
960   - // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
961   - var $dcvalue_attr = attr["dcvalue"];
962   -
963   - console.log("刷新数据:" + $dcvalue_attr);
964   -
965   - if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化
966   - if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源
967   - scope[ctrlAs].$$internal_dic_data(
968   - $datatype_attr, $icname_attr, $icname_s_attr);
969   - if ($dcvalue_attr) {
970   - scope[ctrlAs].$$internalmodel = $dcvalue_attr;
971   - }
972   - } else { // 非字典类型数据源
973   - if (!$dataassociate_attr) {
974   - $$searchInfoService_g[$datatype_attr].list(
975   - {type: "all"},
976   - function(result) {
977   - //console.log("ok:" + $datatype_attr);
978   - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
979   - //console.log("ok2:" + $datatype_attr);
980   - if ($dcvalue_attr) {
981   - scope[ctrlAs].$$internalmodel = $dcvalue_attr;
982   - }
983   -
984   - $$data_init = true;
985   - },
986   - function(result) {
987   -
988   - }
989   - );
990   - }
991   - }
992   - }
993   -
994   - if ($$data_init) {
995   - if (search && search != "") { // 有search值
996   - if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源
997   - // 处理search
998   - console.log("search:" + search);
999   -
1000   - scope[ctrlAs].$$data = [];
1001   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1002   - var upTerm = search.toUpperCase();
1003   - if (scope[ctrlAs].$$data.length < 10) {
1004   - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
1005   - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
1006   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
1007   - }
1008   - } else {
1009   - break;
1010   - }
1011   - }
1012   - }
1013   - }
1014   -
1015   - }
1016   -
1017   - };
1018   -
1019   -
1020   -
1021   -
1022   -
1023   -
1024   -
1025   -
1026   -
1027   -
1028   - // TODO:
1029   -
1030   - // dom全部载入后调用
1031   - $timeout(function() {
1032   - console.log("dom全部载入后调用");
1033   - }, 0);
1034   - // 监控dcvalue model值变换
1035   - attr.$observe("dcvalue", function(value) {
1036   - console.log("监控dc1 model值变换:" + value);
1037   - scope[ctrlAs].$$internalmodel = value;
1038   - }
1039   - );
1040   - // 监控获取数据参数变换
1041   - attr.$observe("dataparam", function(value) {
1042   - // 判定是否空对象
1043   - console.log(value);
1044   - var obj = JSON.parse(value);
1045   - var $dcvalue_attr = attr["dcvalue"];
1046   - if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
1047   - console.log("dataparam:" + obj);
1048   -
1049   - //
1050   -
1051   - obj["type"] = "all";
1052   -
1053   - $$data_init = false;
1054   - $$searchInfoService_g[$datatype_attr].list(
1055   - obj,
1056   - function(result) {
1057   - //console.log("ok:" + $datatype_attr);
1058   - scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
1059   - //console.log("ok2:" + $datatype_attr);
1060   - if ($dcvalue_attr) {
1061   - scope[ctrlAs].$$internalmodel = $dcvalue_attr;
1062   - }
1063   -
1064   - $$data_init = true;
1065   - },
1066   - function(result) {
1067   -
1068   - }
1069   - );
1070   - }
1071   - }
1072   - );
1073   - }
1074   - };
1075   - }
1076   - };
1077   -
1078   - }
1079   -]);
1080   -
1081   -/**
1082   - * saCheckboxgroup指令
1083   - * 属性如下:
1084   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
1085   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
1086   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
1087   - * name(必须):控件的名字
1088   - * required(可选):是否要用required验证
1089   - * disabled(可选):标示框是否可选
1090   - *
1091   - */
1092   -angular.module('ScheduleApp').directive('saCheckboxgroup', [
1093   - function() {
1094   - return {
1095   - restrict: 'E',
1096   - templateUrl: '/pages/scheduleApp/module/common/dt/MyCheckboxGroupWrapTemplate.html',
1097   - scope: {
1098   - model: "=" // 独立作用域,关联外部的模型object
1099   - },
1100   - controllerAs: "$saCheckboxgroupCtrl",
1101   - bindToController: true,
1102   - controller: function($scope) {
1103   - var self = this;
1104   - self.$$data = []; // 内部的数据
1105   -
1106   - // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
1107   - self.$$data = [
1108   - {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1109   - {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1110   - {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1111   - {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1112   - {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1113   - {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
1114   - {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
1115   - ];
1116   - },
1117   -
1118   - /**
1119   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1120   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1121   - * @param tElem
1122   - * @param tAttrs
1123   - * @returns {{pre: Function, post: Function}}
1124   - */
1125   - compile: function(tElem, tAttrs) {
1126   - // 获取所有的属性
1127   - var $name_attr = tAttrs["name"]; // 控件的名字
1128   - var $required_attr = tAttrs["required"]; // 是否需要required验证
1129   - var $disabled_attr = tAttrs["disabled"]; // 是否禁用
1130   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
1131   -
1132   - // controlAs名字
1133   - var ctrlAs = '$saCheckboxgroupCtrl';
1134   -
1135   - // 如果有required属性,添加angularjs required验证
1136   - if ($required_attr != undefined) {
1137   - //console.log(tElem.html());
1138   - tElem.find("div").attr("required", "");
1139   - }
1140   - // 如果有disabled属性,添加禁用标志
1141   - if ($disabled_attr != undefined) {
1142   - tElem.find("input").attr("ng-disabled", "true");
1143   - }
1144   -
1145   - return {
1146   - pre: function(scope, element, attr) {
1147   - // TODO:
1148   - },
1149   - /**
1150   - * 相当于link函数。
1151   - * @param scope
1152   - * @param element
1153   - * @param attr
1154   - */
1155   - post: function(scope, element, attr) {
1156   - // name属性
1157   - if ($name_attr) {
1158   - scope[ctrlAs]["$name_attr"] = $name_attr;
1159   - }
1160   -
1161   - /**
1162   - * checkbox选择事件处理函数。
1163   - * @param $d 数据对象,$$data中的元素对象
1164   - */
1165   - scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
1166   - $d.ischecked = !$d.ischecked;
1167   - console.log($d);
1168   - };
1169   -
1170   - // 测试使用watch监控$$data的变化
1171   - scope.$watch(
1172   - function() {
1173   - return scope[ctrlAs]["$$data"];
1174   - },
1175   - function(newValue, oldValue) {
1176   - // 根据$$data生成对应的数据
1177   - var rule_days_arr = [];
1178   - var i;
1179   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
1180   - if (scope[ctrlAs]["$$data"][i].ischecked)
1181   - rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
1182   - else
1183   - rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
1184   - }
1185   - scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
1186   - //scope[ctrlAs].$$internalmodel = undefined;
1187   - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
1188   -
1189   - // 更新model
1190   - if ($dcname_attr) {
1191   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
1192   - }
1193   -
1194   -
1195   - },
1196   - true
1197   - );
1198   -
1199   - // TODO:
1200   -
1201   - // 监控dcvalue model值变换
1202   - attr.$observe("dcvalue", function(value) {
1203   - console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
1204   - if (value) {
1205   - // 根据value值,修改$$data里的值
1206   - var data_array = value.split(",");
1207   - var i;
1208   - if (data_array.length > scope[ctrlAs]["$$data"].length) {
1209   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
1210   - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
1211   - scope[ctrlAs]["$$data"][i].ischecked = true;
1212   - } else {
1213   - scope[ctrlAs]["$$data"][i].ischecked = false;
1214   - }
1215   - }
1216   - } else {
1217   - for (i = 0; i < data_array.length; i ++) {
1218   - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
1219   - scope[ctrlAs]["$$data"][i].ischecked = true;
1220   - } else {
1221   - scope[ctrlAs]["$$data"][i].ischecked = false;
1222   - }
1223   - }
1224   - }
1225   -
1226   - }
1227   - });
1228   - }
1229   -
1230   - };
1231   -
1232   -
1233   - }
1234   -
1235   - };
1236   - }
1237   -]);
1238   -
1239   -/**
1240   - * saDategroup指令
1241   - * 属性如下:
1242   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
1243   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
1244   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
1245   - * name(必须):控件的名字
1246   - * required(可选):是否要用required验证
1247   - * disabled(可选):标示框是否可选
1248   - *
1249   - */
1250   -angular.module('ScheduleApp').directive('saDategroup', [
1251   - '$filter',
1252   - function($filter) {
1253   - return {
1254   - restrict: 'E',
1255   - templateUrl: '/pages/scheduleApp/module/common/dt/MyDateGroupWrapTemplate.html',
1256   - scope: {
1257   - model: "=" // 独立作用域,关联外部的模型object
1258   - },
1259   - controllerAs: "$saDategroupCtrl",
1260   - bindToController: true,
1261   - controller: function($scope) {
1262   - var self = this;
1263   - self.$$data = []; // 内部的数据
1264   - self.$$date_select; // 内部选中的日期
1265   -
1266   - //// 测试数据
1267   - //self.$$data = [
1268   - // {datestr: '2011-01-01', ischecked: true},
1269   - // {datestr: '2011-01-01', ischecked: true},
1270   - // {datestr: '2011-01-01', ischecked: true}
1271   - //];
1272   - },
1273   -
1274   - /**
1275   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1276   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1277   - * @param tElem
1278   - * @param tAttrs
1279   - * @returns {{pre: Function, post: Function}}
1280   - */
1281   - compile: function(tElem, tAttrs) {
1282   - // 获取所有的属性
1283   - var $name_attr = tAttrs["name"]; // 控件的名字
1284   - var $required_attr = tAttrs["required"]; // 是否需要required验证
1285   - var $disabled_attr = tAttrs["disabled"]; // 是否禁用
1286   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
1287   -
1288   - // controlAs名字
1289   - var ctrlAs = '$saDategroupCtrl';
1290   -
1291   - // 如果有required属性,添加angularjs required验证
1292   - if ($required_attr != undefined) {
1293   - //console.log(tElem.html());
1294   - tElem.find("div").attr("required", "");
1295   - }
1296   - // 如果有disabled属性,添加禁用标志
1297   - if ($disabled_attr != undefined) {
1298   - tElem.find("input").attr("ng-disabled", "true");
1299   - tElem.find("div").attr("ng-disabled", "true");
1300   - }
1301   -
1302   - return {
1303   - pre: function (scope, element, attr) {
1304   - // TODO:
1305   - },
1306   - /**
1307   - * 相当于link函数。
1308   - * @param scope
1309   - * @param element
1310   - * @param attr
1311   - */
1312   - post: function (scope, element, attr) {
1313   - // name属性
1314   - if ($name_attr) {
1315   - scope[ctrlAs]["$name_attr"] = $name_attr;
1316   - }
1317   -
1318   -
1319   - // 日期open属性,及方法
1320   - scope[ctrlAs].$$specialDateOpen = false;
1321   - scope[ctrlAs].$$specialDate_open = function() {
1322   - scope[ctrlAs].$$specialDateOpen = true;
1323   - };
1324   -
1325   - // 监控选择的日期
1326   - scope.$watch(
1327   - function() {
1328   - return scope[ctrlAs]['$$date_select'];
1329   - },
1330   - function(newValue, oldValue) {
1331   - if (newValue) {
1332   - //console.log("saDategroup--->selectdate:" + newValue);
1333   - // 调用内置filter,转换日期到yyyy-MM-dd格式
1334   - var text = $filter('date')(newValue, 'yyyy-MM-dd');
1335   - var i;
1336   - var isexist = false; // 日期是否已经选择标识
1337   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
1338   - if (scope[ctrlAs]["$$data"][i].datestr == text) {
1339   - isexist = true;
1340   - break;
1341   - }
1342   - }
1343   - if (!isexist) {
1344   - scope[ctrlAs]["$$data"].push(
1345   - {
1346   - datestr: text,
1347   - ischecked: true
1348   - }
1349   - );
1350   - }
1351   -
1352   - }
1353   -
1354   - }
1355   - );
1356   -
1357   - /**
1358   - * 日期点击事件处理函数。
1359   - * @param $index 索引
1360   - */
1361   - scope[ctrlAs].$$internal_datestr_click = function($index) {
1362   - scope[ctrlAs].$$data.splice($index, 1);
1363   - };
1364   -
1365   - // 测试使用watch监控$$data的变化
1366   - scope.$watch(
1367   - function() {
1368   - return scope[ctrlAs]['$$data'];
1369   - },
1370   - function(newValue, oldValue) {
1371   - // 根据$$data生成对应的数据
1372   - var special_days_arr = [];
1373   - var i;
1374   - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
1375   - special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
1376   - }
1377   -
1378   - scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
1379   - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
1380   -
1381   - // 更新model
1382   - if ($dcname_attr) {
1383   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
1384   - }
1385   - },
1386   - true
1387   - );
1388   -
1389   - // 监控dcvalue model值变换
1390   - attr.$observe("dcvalue", function(value) {
1391   - console.log("saDategroup 监控dc1 model值变换:" + value);
1392   - if (value) {
1393   - // 根据value值,修改$$data里的值
1394   - var date_array = value.split(",");
1395   - var i;
1396   - scope[ctrlAs]["$$data"] = [];
1397   - for (i = 0; i < date_array.length; i++) {
1398   - scope[ctrlAs]["$$data"].push(
1399   - {
1400   - datestr: date_array[i],
1401   - ischecked: true
1402   - }
1403   - );
1404   - }
1405   -
1406   -
1407   -
1408   -
1409   -
1410   -
1411   -
1412   -
1413   -
1414   - }
1415   - });
1416   -
1417   - }
1418   -
1419   - };
1420   - }
1421   - }
1422   - }
1423   -]);
1424   -
1425   -/**
1426   - * saGuideboardgroup指令
1427   - * 属性如下:
1428   - * name(必须):控件的名字
1429   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
1430   - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
1431   - * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
1432   - * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
1433   - * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
1434   - * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
1435   - * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
1436   - * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
1437   - *
1438   - * required(可选):是否要用required验证
1439   - *
1440   - */
1441   -angular.module('ScheduleApp').directive('saGuideboardgroup', [
1442   - 'GuideboardManageService_g',
1443   - function(guideboardManageService_g) {
1444   - return {
1445   - restrict: 'E',
1446   - templateUrl: '/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html',
1447   - scope: {
1448   - model: "=" // 独立作用域,关联外部的模型object
1449   - },
1450   - controllerAs: '$saGuideboardgroupCtrl',
1451   - bindToController: true,
1452   - controller: function($scope) {
1453   - var self = this;
1454   - self.$$data = []; // 选择线路后,该线路的路牌数据
1455   -
1456   - // 测试数据
1457   - //self.$$data = [
1458   - // {lpid: 1, lpname: '路1', isstart: false},
1459   - // {lpid: 2, lpname: '路2', isstart: true},
1460   - // {lpid: 3, lpname: '路3', isstart: false}
1461   - //];
1462   -
1463   -
1464   - self.$$dataSelected = []; // 选中的路牌列表
1465   - self.$$dataSelectedStart = undefined; // 起始路牌
1466   -
1467   - //self.$$dataSelected = [
1468   - // {lpid: 11, lpname: '路11', isstart: false},
1469   - // {lpid: 12, lpname: '路12', isstart: true},
1470   - // {lpid: 13, lpname: '路13', isstart: false}
1471   - //];
1472   -
1473   - // saGuideboardgroup组件的ng-model,用于外部绑定等操作
1474   - self.$$internalmodel = undefined;
1475   -
1476   - self.$$data_init = false; // *数据源初始化标志
1477   - self.$$data_xl_first_init = false; // 线路是否初始化
1478   - self.$$data_lp_first_init = false; // 路牌名字是否初始化
1479   - self.$$data_lpid_first_init = false; // 路牌id是否初始化
1480   - self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
1481   -
1482   - self.$$dataDesc = ""; // 路牌列表描述
1483   - self.$$dataSelectDesc = ""; // 选中路牌描述
1484   -
1485   - },
1486   -
1487   - /**
1488   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1489   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1490   - * @param tElem
1491   - * @param tAttrs
1492   - * @returns {{pre: Function, post: Function}}
1493   - */
1494   - compile: function(tElem, tAttrs) {
1495   - // TODO:获取所有的属性
1496   - var $name_attr = tAttrs["name"]; // 控件的名字
1497   - var $required_attr = tAttrs["required"]; // 是否需要required验证
1498   - var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
1499   - var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
1500   - var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
1501   -
1502   - // controlAs名字
1503   - var ctrlAs = '$saGuideboardgroupCtrl';
1504   -
1505   - // 如果有required属性,添加angularjs required验证
1506   - if ($required_attr != undefined) {
1507   - //console.log(tElem.html());
1508   - tElem.find("div").attr("required", "");
1509   - }
1510   -
1511   - return {
1512   - pre: function(scope, element, attr) {
1513   - // TODO:
1514   - },
1515   -
1516   - /**
1517   - * 相当于link函数。
1518   - * @param scope
1519   - * @param element
1520   - * @param attr
1521   - */
1522   - post: function(scope, element, attr) {
1523   - // name属性
1524   - if ($name_attr) {
1525   - scope[ctrlAs]["$name_attr"] = $name_attr;
1526   - }
1527   -
1528   - // TODO:
1529   -
1530   -
1531   - /**
1532   - * 路牌列表点击(路牌列表中选中路牌)
1533   - * @param $index
1534   - */
1535   - scope[ctrlAs].$$internal_lplist_click = function($index) {
1536   - var data_temp = scope[ctrlAs].$$data;
1537   - if (data_temp && data_temp.length > $index) {
1538   - scope[ctrlAs].$$dataSelected.push({
1539   - lpid: data_temp[$index].lpid,
1540   - lpname: data_temp[$index].lpname,
1541   - isstart: data_temp[$index].isstart
1542   - });
1543   -
1544   - // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
1545   - if (scope[ctrlAs].$$dataSelectedStart == undefined) {
1546   - scope[ctrlAs].$$internal_sellplist_click(
1547   - scope[ctrlAs].$$dataSelected.length - 1);
1548   - }
1549   - }
1550   - };
1551   - /**
1552   - * 选中的路牌单击(初始路牌选择)
1553   - * @param $index
1554   - */
1555   - scope[ctrlAs].$$internal_sellplist_click = function($index) {
1556   - var data_temp = scope[ctrlAs].$$dataSelected;
1557   - if (data_temp && data_temp.length > $index) {
1558   - for (var i = 0; i < data_temp.length; i++) {
1559   - data_temp[i].isstart = false;
1560   - }
1561   - data_temp[$index].isstart = true;
1562   - scope[ctrlAs].$$dataSelectedStart = $index;
1563   - }
1564   - };
1565   - /**
1566   - * 选中的路牌双击(删除选中的路牌)
1567   - * @param $index
1568   - */
1569   - scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
1570   - var data_temp = scope[ctrlAs].$$dataSelected;
1571   - if (data_temp && data_temp.length > $index) {
1572   - if (scope[ctrlAs].$$dataSelectedStart == $index) {
1573   - scope[ctrlAs].$$dataSelectedStart = undefined;
1574   - }
1575   - data_temp.splice($index, 1);
1576   - }
1577   - };
1578   -
1579   -
1580   - /**
1581   - * 验证内部数据,更新外部model
1582   - */
1583   - scope[ctrlAs].$$internal_validate_model = function() {
1584   - var data_temp = scope[ctrlAs].$$dataSelected;
1585   - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
1586   - var lpNames = [];
1587   - var lpIds = [];
1588   - var lpStart = 0;
1589   - var i = 0;
1590   -
1591   - if (data_temp &&
1592   - data_temp.length > 0 &&
1593   - data_temp2 != undefined) {
1594   -
1595   - for (i = 0; i < data_temp.length; i++) {
1596   - lpNames.push(data_temp[i].lpname);
1597   - lpIds.push(data_temp[i].lpid)
1598   - }
1599   - data_temp[data_temp2].isstart = true;
1600   - lpStart = data_temp2 + 1;
1601   -
1602   - // 更新内部model,用于外部验证
1603   - // 内部model的值暂时随意,以后再改
1604   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
1605   -
1606   - // 更新外部model字段
1607   - if ($lprangename_attr) {
1608   - console.log("lprangename=" + lpNames.join(','));
1609   - eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
1610   - }
1611   - if ($lpidrangename_attr) {
1612   - console.log("lpidrangename=" + lpIds.join(','));
1613   - eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
1614   - }
1615   - if ($lpstartname_attr) {
1616   - console.log("lpstartname=" + lpStart);
1617   - eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
1618   - }
1619   -
1620   - scope[ctrlAs].$$dataSelectDesc =
1621   - ",共" + data_temp.length + "个," + "初始路牌,第" + lpStart + "个";
1622   -
1623   - } else {
1624   - scope[ctrlAs].$$internalmodel = undefined;
1625   - }
1626   -
1627   -
1628   - };
1629   -
1630   - // 监控内部数据,$$data_selected 变化
1631   - scope.$watch(
1632   - function() {
1633   - return scope[ctrlAs].$$dataSelected;
1634   - },
1635   - function(newValue, oldValue) {
1636   - scope[ctrlAs].$$internal_validate_model();
1637   - },
1638   - true
1639   - );
1640   -
1641   - // 监控内部数据,$$data_selected_start 变化
1642   - scope.$watch(
1643   - function() {
1644   - return scope[ctrlAs].$$dataSelectedStart;
1645   - },
1646   - function(newValue, oldValue) {
1647   - scope[ctrlAs].$$internal_validate_model();
1648   - },
1649   - true
1650   - );
1651   -
1652   - /**
1653   - * 验证数据是否初始化完成,
1654   - * 所谓的初始化就是内部所有的数据被有效设定过一次。
1655   - */
1656   - scope[ctrlAs].$$internal_validate_init = function() {
1657   - var self = scope[ctrlAs];
1658   -
1659   - if (self.$$data_xl_first_init &&
1660   - self.$$data_lp_first_init &&
1661   - self.$$data_lpid_first_init &&
1662   - self.$$data_lpstart_first_init) {
1663   - console.log("数据初始化完毕!");
1664   - self.$$data_init = true;
1665   - }
1666   -
1667   - };
1668   -
1669   - // 监控初始化标志,线路,路牌,路牌id,起始路牌
1670   - scope.$watch(
1671   - function() {
1672   - return scope[ctrlAs].$$data_xl_first_init;
1673   - },
1674   - function(newValue, oldValue) {
1675   - scope[ctrlAs].$$internal_validate_init();
1676   - }
1677   - );
1678   - scope.$watch(
1679   - function() {
1680   - return scope[ctrlAs].$$data_lp_first_init;
1681   - },
1682   - function(newValue, oldValue) {
1683   - scope[ctrlAs].$$internal_validate_init();
1684   - }
1685   - );
1686   - scope.$watch(
1687   - function() {
1688   - return scope[ctrlAs].$$data_lpid_first_init;
1689   - },
1690   - function(newValue, oldValue) {
1691   - scope[ctrlAs].$$internal_validate_init();
1692   - }
1693   - );
1694   - scope.$watch(
1695   - function() {
1696   - return scope[ctrlAs].$$data_lpstart_first_init;
1697   - },
1698   - function(newValue, oldValue) {
1699   - scope[ctrlAs].$$internal_validate_init();
1700   - }
1701   - );
1702   -
1703   -
1704   - // 监控线路id的变化
1705   - attr.$observe("xlidvalue", function(value) {
1706   - if (value && value != "") {
1707   - console.log("xlidvalue=" + value);
1708   -
1709   - guideboardManageService_g.rest.list(
1710   - {"xl.id_eq": value, size: 100},
1711   - function(result) {
1712   - // 获取值了
1713   - console.log("路牌获取了");
1714   -
1715   - scope[ctrlAs].$$data = [];
1716   - for (var i = 0; i < result.content.length; i++) {
1717   - scope[ctrlAs].$$data.push({
1718   - lpid: result.content[i].id,
1719   - lpname: result.content[i].lpName,
1720   - isstart: false
1721   - });
1722   - }
1723   - if (scope[ctrlAs].$$data_init) {
1724   - scope[ctrlAs].$$dataSelected = [];
1725   - scope[ctrlAs].$$dataSelectedStart = undefined;
1726   - scope[ctrlAs].$$internalmodel = undefined;
1727   - scope[ctrlAs].$$dataDesc = "";
1728   - scope[ctrlAs].$$dataSelectDesc = "";
1729   - }
1730   - scope[ctrlAs].$$data_xl_first_init = true;
1731   -
1732   - scope[ctrlAs].$$dataDesc = ",共" + result.content.length + "个";
1733   - },
1734   - function(result) {
1735   -
1736   - }
1737   - );
1738   -
1739   - }
1740   - });
1741   -
1742   - // 监控路牌名称范围值的变化
1743   - attr.$observe("lprangevalue", function(value) {
1744   - if (value && value != "") {
1745   - var data_temp = scope[ctrlAs].$$dataSelected;
1746   - var lpnames = value.split(",");
1747   - var i = 0;
1748   - if (data_temp && data_temp.length == 0) { // 初始创建
1749   - console.log("lprangevalue变换了");
1750   - for (i = 0; i < lpnames.length; i++) {
1751   - scope[ctrlAs].$$dataSelected.push({
1752   - lpname: lpnames[i],
1753   - isstart: false
1754   - });
1755   - }
1756   - } else {
1757   - for (i = 0; i < lpnames.length; i++) {
1758   - data_temp[i].lpname = lpnames[i];
1759   - }
1760   - }
1761   - scope[ctrlAs].$$data_lp_first_init = true;
1762   - }
1763   - });
1764   -
1765   - // 监控路牌id范围值的变化
1766   - attr.$observe("lpidrangevalue", function(value) {
1767   - if (value && value != "") {
1768   - console.log("lpidrangevalue=" + value);
1769   - var data_temp = scope[ctrlAs].$$dataSelected;
1770   - var lpids = value.split(",");
1771   - var i = 0;
1772   - if (data_temp && data_temp.length == 0) { // 初始创建
1773   - console.log("lpidrangevalue");
1774   - for (i = 0; i < lpids.length; i++) {
1775   - scope[ctrlAs].$$dataSelected.push({
1776   - lpid: lpids[i],
1777   - isstart: false
1778   - });
1779   - }
1780   - } else {
1781   - for (i = 0; i < lpids.length; i++) {
1782   - data_temp[i].lpid = lpids[i];
1783   - }
1784   - }
1785   - scope[ctrlAs].$$data_lpid_first_init = true;
1786   - }
1787   - });
1788   -
1789   - // 监控起始路牌的变化
1790   - attr.$observe("lpstartvalue", function(value) {
1791   - if (value && value != "") {
1792   - scope[ctrlAs].$$dataSelectedStart = value - 1;
1793   - scope[ctrlAs].$$data_lpstart_first_init = true;
1794   - }
1795   - });
1796   -
1797   -
1798   -
1799   - }
1800   - }
1801   -
1802   - }
1803   - }
1804   - }
1805   -]);
1806   -
1807   -/**
1808   - * saEmployeegroup指令
1809   - * 属性如下:
1810   - * name(必须):控件的名字
1811   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
1812   - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
1813   - * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
1814   - * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
1815   - * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
1816   - * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
1817   - * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
1818   - * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
1819   - *
1820   - * required(可选):是否要用required验证
1821   - *
1822   - */
1823   -angular.module('ScheduleApp').directive('saEmployeegroup', [
1824   - 'EmployeeConfigService_g',
1825   - function(employeeConfigService_g) {
1826   - return {
1827   - restrict: 'E',
1828   - templateUrl: '/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html',
1829   - scope: {
1830   - model: "=" // 独立作用域,关联外部的模型object
1831   - },
1832   - controllerAs: '$saEmployeegroupCtrl',
1833   - bindToController: true,
1834   - controller: function($scope) {
1835   - var self = this;
1836   - self.$$data = []; // 选择线路后,该线路的人员配置数据
1837   -
1838   - // 测试数据
1839   - //self.$$data = [
1840   - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
1841   - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
1842   - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
1843   - //];
1844   -
1845   -
1846   - self.$$dataSelected = []; // 选中的人员配置列表
1847   - self.$$dataSelectedStart = undefined; // 起始人员配置
1848   -
1849   - // saGuideboardgroup组件的ng-model,用于外部绑定等操作
1850   - self.$$internalmodel = undefined;
1851   -
1852   - self.$$data_init = false; // *数据源初始化标志
1853   - self.$$data_xl_first_init = false; // 线路是否初始化
1854   - self.$$data_ry_first_init = false; // 人员配置是否初始化
1855   - self.$$data_rycid_first_init = false; // 人员配置id是否初始化
1856   - self.$$data_rystart_first_init = false; // 起始人员是否初始化
1857   -
1858   - self.$$dataDesc = ""; // 路牌列表描述
1859   - self.$$dataSelectDesc = ""; // 选中路牌描述
1860   -
1861   - },
1862   -
1863   - /**
1864   - * 此阶段可以改dom结构,此时angular还没扫描指令,
1865   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
1866   - * @param tElem
1867   - * @param tAttrs
1868   - * @returns {{pre: Function, post: Function}}
1869   - */
1870   - compile: function(tElem, tAttrs) {
1871   - // TODO:获取所有的属性
1872   - var $name_attr = tAttrs["name"]; // 控件的名字
1873   - var $required_attr = tAttrs["required"]; // 是否需要required验证
1874   - var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
1875   - var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
1876   - var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
1877   -
1878   - // controlAs名字
1879   - var ctrlAs = '$saEmployeegroupCtrl';
1880   -
1881   - // 如果有required属性,添加angularjs required验证
1882   - if ($required_attr != undefined) {
1883   - //console.log(tElem.html());
1884   - tElem.find("div").attr("required", "");
1885   - }
1886   -
1887   - return {
1888   - pre: function(scope, element, attr) {
1889   - // TODO:
1890   - },
1891   -
1892   - /**
1893   - * 相当于link函数。
1894   - * @param scope
1895   - * @param element
1896   - * @param attr
1897   - */
1898   - post: function(scope, element, attr) {
1899   - // name属性
1900   - if ($name_attr) {
1901   - scope[ctrlAs]["$name_attr"] = $name_attr;
1902   - }
1903   -
1904   - // TODO:
1905   -
1906   -
1907   - /**
1908   - * 人员配置列表点击(人员配置列表中选中路牌)
1909   - * @param $index
1910   - */
1911   - scope[ctrlAs].$$internal_rylist_click = function($index) {
1912   - var data_temp = scope[ctrlAs].$$data;
1913   - if (data_temp && data_temp.length > $index) {
1914   - scope[ctrlAs].$$dataSelected.push({
1915   - id : data_temp[$index].id,
1916   - dbbm: data_temp[$index].dbbm,
1917   - jsy: data_temp[$index].jsy,
1918   - spy: data_temp[$index].spy,
1919   - isstart: data_temp[$index].isstart
1920   - });
1921   -
1922   - // 如果没有指定过初始人员,默认选择此人员作为起始人员
1923   - if (scope[ctrlAs].$$dataSelectedStart == undefined) {
1924   - scope[ctrlAs].$$internal_selrylist_click(
1925   - scope[ctrlAs].$$dataSelected.length - 1);
1926   - }
1927   - }
1928   - };
1929   - /**
1930   - * 选中的人员单击(初始人员选择)
1931   - * @param $index
1932   - */
1933   - scope[ctrlAs].$$internal_selrylist_click = function($index) {
1934   - var data_temp = scope[ctrlAs].$$dataSelected;
1935   - if (data_temp && data_temp.length > $index) {
1936   - for (var i = 0; i < data_temp.length; i++) {
1937   - data_temp[i].isstart = false;
1938   - }
1939   - data_temp[$index].isstart = true;
1940   - scope[ctrlAs].$$dataSelectedStart = $index;
1941   - }
1942   - };
1943   - /**
1944   - * 选中的人员双击(删除选中的人员)
1945   - * @param $index
1946   - */
1947   - scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
1948   - var data_temp = scope[ctrlAs].$$dataSelected;
1949   - if (data_temp && data_temp.length > $index) {
1950   - if (scope[ctrlAs].$$dataSelectedStart == $index) {
1951   - scope[ctrlAs].$$dataSelectedStart = undefined;
1952   - }
1953   - data_temp.splice($index, 1);
1954   - }
1955   - };
1956   -
1957   -
1958   - /**
1959   - * 验证内部数据,更新外部model
1960   - */
1961   - scope[ctrlAs].$$internal_validate_model = function() {
1962   - var data_temp = scope[ctrlAs].$$dataSelected;
1963   - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
1964   - var ryDbbms = [];
1965   - var ryCids = [];
1966   - var ryStart = 0;
1967   - var i = 0;
1968   -
1969   - if (data_temp &&
1970   - data_temp.length > 0 &&
1971   - data_temp2 != undefined) {
1972   -
1973   - for (i = 0; i < data_temp.length; i++) {
1974   - ryDbbms.push(data_temp[i].dbbm);
1975   - ryCids.push(data_temp[i].id);
1976   - }
1977   - data_temp[data_temp2].isstart = true;
1978   - ryStart = data_temp2 + 1;
1979   -
1980   - // 更新内部model,用于外部验证
1981   - // 内部model的值暂时随意,以后再改
1982   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
1983   -
1984   - // 更新外部model字段
1985   - if ($dbbmrangename_attr) {
1986   - console.log("dbbmrangename=" + ryDbbms.join(','));
1987   - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
1988   - }
1989   - if (rycidrangename_attr) {
1990   - console.log("rycidrangename=" + ryCids.join(','));
1991   - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
1992   - }
1993   - if ($rystartname_attr) {
1994   - console.log("rystartname=" + ryStart);
1995   - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
1996   - }
1997   -
1998   - scope[ctrlAs].$$dataSelectDesc =
1999   - ",共" + data_temp.length + "组," + "初始人员,第" + ryStart + "组";
2000   -
2001   - } else {
2002   - scope[ctrlAs].$$internalmodel = undefined;
2003   - }
2004   -
2005   -
2006   - };
2007   -
2008   - // 监控内部数据,$$data_selected 变化
2009   - scope.$watch(
2010   - function() {
2011   - return scope[ctrlAs].$$dataSelected;
2012   - },
2013   - function(newValue, oldValue) {
2014   - scope[ctrlAs].$$internal_validate_model();
2015   - },
2016   - true
2017   - );
2018   -
2019   - // 监控内部数据,$$data_selected_start 变化
2020   - scope.$watch(
2021   - function() {
2022   - return scope[ctrlAs].$$dataSelectedStart;
2023   - },
2024   - function(newValue, oldValue) {
2025   - scope[ctrlAs].$$internal_validate_model();
2026   - },
2027   - true
2028   - );
2029   -
2030   - /**
2031   - * 验证数据是否初始化完成,
2032   - * 所谓的初始化就是内部所有的数据被有效设定过一次。
2033   - */
2034   - scope[ctrlAs].$$internal_validate_init = function() {
2035   - var self = scope[ctrlAs];
2036   - var data_temp = self.$$data;
2037   - var dataSelect_temp = self.$$dataSelected;
2038   - var i = 0;
2039   - var j = 0;
2040   -
2041   - if (self.$$data_xl_first_init &&
2042   - self.$$data_ry_first_init &&
2043   - self.$$data_rycid_first_init &&
2044   - self.$$data_rystart_first_init) {
2045   - console.log("数据初始化完毕!");
2046   - self.$$data_init = true;
2047   -
2048   - // 修正选择dataSelect
2049   - for (i = 0; i < dataSelect_temp.length; i++) {
2050   - for (j = 0; j < data_temp.length; j++) {
2051   - if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
2052   - dataSelect_temp[i].jsy = data_temp[j].jsy;
2053   - dataSelect_temp[i].spy = data_temp[j].spy;
2054   - break;
2055   - }
2056   - }
2057   - }
2058   - }
2059   -
2060   - };
2061   -
2062   - // 监控初始化标志,线路,人员,起始人员
2063   - scope.$watch(
2064   - function() {
2065   - return scope[ctrlAs].$$data_xl_first_init;
2066   - },
2067   - function(newValue, oldValue) {
2068   - scope[ctrlAs].$$internal_validate_init();
2069   - }
2070   - );
2071   - scope.$watch(
2072   - function() {
2073   - return scope[ctrlAs].$$data_ry_first_init;
2074   - },
2075   - function(newValue, oldValue) {
2076   - scope[ctrlAs].$$internal_validate_init();
2077   - }
2078   - );
2079   - scope.$watch(
2080   - function() {
2081   - return scope[ctrlAs].$$data_rycid_first_init;
2082   - },
2083   - function(newValue, oldValue) {
2084   - scope[ctrlAs].$$internal_validate_init();
2085   - }
2086   - );
2087   - scope.$watch(
2088   - function() {
2089   - return scope[ctrlAs].$$data_rystart_first_init;
2090   - },
2091   - function(newValue, oldValue) {
2092   - scope[ctrlAs].$$internal_validate_init();
2093   - }
2094   - );
2095   -
2096   -
2097   - // 监控线路id的变化
2098   - attr.$observe("xlidvalue", function(value) {
2099   - if (value && value != "") {
2100   - console.log("xlidvalue=" + value);
2101   -
2102   - employeeConfigService_g.rest.list(
2103   - {"xl.id_eq": value, size: 100},
2104   - function(result) {
2105   - // 获取值了
2106   - console.log("人员配置获取了");
2107   -
2108   - scope[ctrlAs].$$data = [];
2109   - for (var i = 0; i < result.content.length; i++) {
2110   - scope[ctrlAs].$$data.push({
2111   - id: result.content[i].id,
2112   - dbbm: result.content[i].dbbm,
2113   - jsy: result.content[i].jsy.personnelName,
2114   - spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName,
2115   - isstart: false
2116   - });
2117   - }
2118   - if (scope[ctrlAs].$$data_init) {
2119   - scope[ctrlAs].$$dataSelected = [];
2120   - scope[ctrlAs].$$dataSelectedStart = undefined;
2121   - scope[ctrlAs].$$internalmodel = undefined;
2122   - scope[ctrlAs].$$dataDesc = "";
2123   - scope[ctrlAs].$$dataSelectDesc = "";
2124   - }
2125   - scope[ctrlAs].$$data_xl_first_init = true;
2126   -
2127   - scope[ctrlAs].$$dataDesc = ",共" + result.content.length + "组";
2128   - },
2129   - function(result) {
2130   -
2131   - }
2132   - );
2133   -
2134   - }
2135   - });
2136   -
2137   - // 监控搭班编码范围值的变化
2138   - attr.$observe("dbbmrangevalue", function(value) {
2139   - if (value && value != "") {
2140   - var data_temp = scope[ctrlAs].$$dataSelected;
2141   - var dbbmnames = value.split(",");
2142   - var i = 0;
2143   - if (data_temp && data_temp.length == 0) { // 初始创建
2144   - console.log("dbbmrangevalue变换了");
2145   - for (i = 0; i < dbbmnames.length; i++) {
2146   - scope[ctrlAs].$$dataSelected.push({
2147   - dbbm: dbbmnames[i],
2148   - isstart: false
2149   - });
2150   - }
2151   - } else {
2152   - for (i = 0; i < dbbmnames.length; i++) {
2153   - data_temp[i].dbbm = dbbmnames[i];
2154   - }
2155   - }
2156   - scope[ctrlAs].$$data_ry_first_init = true;
2157   - }
2158   - });
2159   -
2160   - // 监控人员配置id范围值的变化
2161   - attr.$observe("rycidrangevalue", function(value) {
2162   - if (value && value != "") {
2163   - var data_temp = scope[ctrlAs].$$dataSelected;
2164   - var rycids = value.split(",");
2165   - var i = 0;
2166   - if (data_temp && data_temp.length == 0) { // 初始创建
2167   - console.log("rycidrangevalue变换了");
2168   - for (i = 0; i < rycids.length; i++) {
2169   - scope[ctrlAs].$$dataSelected.push({
2170   - id: rycids[i],
2171   - isstart: false
2172   - });
2173   - }
2174   - } else {
2175   - for (i = 0; i < rycids.length; i++) {
2176   - data_temp[i].id = rycids[i];
2177   - }
2178   - }
2179   - scope[ctrlAs].$$data_rycid_first_init = true;
2180   - }
2181   - });
2182   -
2183   - // 监控起始人员的变化
2184   - attr.$observe("rystartvalue", function(value) {
2185   - if (value && value != "") {
2186   - scope[ctrlAs].$$dataSelectedStart = value - 1;
2187   - scope[ctrlAs].$$data_rystart_first_init = true;
2188   - }
2189   - });
2190   -
2191   -
2192   -
2193   - }
2194   - }
2195   -
2196   - }
2197   - }
2198   - }
2199   -]);
2200 1 \ No newline at end of file
  2 +// 自定义指令,指令模版在dt目录下
  3 +
  4 +
  5 +angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) {
  6 + return {
  7 + restrict: 'A',
  8 + link: function(scope, element) {
  9 + // 初始隐藏loading界面
  10 + element.hide();
  11 +
  12 + // 开始请求通知处理
  13 + requestNotificationChannel.onRequestStarted(scope, function() {
  14 + element.show();
  15 + });
  16 + // 请求结束通知处理
  17 + requestNotificationChannel.onRequestEnded(scope, function() {
  18 + element.hide();
  19 + });
  20 + }
  21 + };
  22 +}]);
  23 +
  24 +angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
  25 + return {
  26 + restrict: 'E',
  27 + templateUrl: '/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html',
  28 + scope: {
  29 + model: "="
  30 + },
  31 + controllerAs: "$saSelectCtrl",
  32 + bindToController: true,
  33 + controller: function() {
  34 + var self = this;
  35 + self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}
  36 + },
  37 + /**
  38 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  39 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  40 + * @param tElem
  41 + * @param tAttrs
  42 + * @returns {{pre: Function, post: Function}}
  43 + */
  44 + compile: function(tElem, tAttrs) {
  45 + // 确定是否使用angularjs required验证
  46 + // 属性 required
  47 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  48 + var required_attr = tAttrs["required"];
  49 + if (required_attr) {
  50 + if (required_attr == "true") {
  51 + // 添加required属性指令
  52 + tElem.find("ui-select").attr("required", "");
  53 + } else {
  54 + // 不等于true,不添加required属性指令
  55 + }
  56 + } else {
  57 + // 不添加required属性指令
  58 + }
  59 +
  60 + //console.log("saSelect" + ":compile = >" + tElem.html());
  61 +
  62 + return {
  63 + pre: function(scope, element, attr) {
  64 + // TODO:
  65 + },
  66 + /**
  67 + * 相当于link函数。
  68 + *
  69 + * 重要属性如下:
  70 + * model 是绑定外部值。
  71 + * dicgroup 字典组的类型
  72 + * name input name属性值
  73 + */
  74 + post: function(scope, element, attr) {
  75 + // 1、获取属性
  76 + var dicgroup_attr = attr['dicgroup']; // 字典组的类型
  77 + var name_attr = attr['name']; // input name属性值
  78 + var dicname_attr = attr['dicname']; // model关联的字典名字段
  79 + var codename_attr = attr['codename']; // model关联的字典值字段
  80 + var placeholder_attr = attr['placeholder']; // select placeholder提示
  81 +
  82 + // 系统的字典对象,使用dictionaryUtils类获取
  83 + var origin_dicgroup;
  84 + var dic_key; // 字典key
  85 +
  86 + if (dicgroup_attr) { // 赋值指定的字典数据
  87 + origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);
  88 + for (dic_key in origin_dicgroup) {
  89 + var data = {}; // 重新组合的字典元素对象
  90 + if (dic_key == "true")
  91 + data.code = true;
  92 + else
  93 + data.code = dic_key;
  94 + data.name = origin_dicgroup[dic_key];
  95 + scope["$saSelectCtrl"].datas.push(data);
  96 + }
  97 + }
  98 +
  99 + if (name_attr) {
  100 + scope["$saSelectCtrl"].nv = name_attr;
  101 + }
  102 + if (placeholder_attr) {
  103 + scope["$saSelectCtrl"].ph = placeholder_attr;
  104 + }
  105 +
  106 + scope["$saSelectCtrl"].select = function($item) {
  107 + if (codename_attr) {
  108 + scope["$saSelectCtrl"].model[codename_attr] = $item.code;
  109 + }
  110 + if (dicname_attr) {
  111 + scope["$saSelectCtrl"].model[dicname_attr] = $item.name;
  112 + }
  113 + };
  114 +
  115 + scope["$saSelectCtrl"].remove = function() {
  116 + if (codename_attr) {
  117 + scope["$saSelectCtrl"].model[codename_attr] = null;
  118 + }
  119 + if (dicname_attr) {
  120 + scope["$saSelectCtrl"].model[dicname_attr] = null;
  121 + }
  122 + scope["$saSelectCtrl"].cmodel = null;
  123 + };
  124 +
  125 + $timeout(function() {
  126 + // 创建内部使用的绑定对象
  127 + var model_code = scope["$saSelectCtrl"].model[codename_attr];
  128 + scope["$saSelectCtrl"].cmodel = model_code;
  129 + }, 0);
  130 + }
  131 + }
  132 + }
  133 + };
  134 +}]);
  135 +
  136 +/**
  137 + * saRadiogroup指令
  138 + * 属性如下:
  139 + * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
  140 + * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
  141 + * name(必须):控件的名字
  142 + * required(可选):是否要用required验证
  143 + * disabled(可选):标示单选框是否可选
  144 + *
  145 + */
  146 +angular.module('ScheduleApp').directive("saRadiogroup", [function() {
  147 + /**
  148 + * 使用字典数据的单选按钮组的指令。
  149 + * 指令名称:truefalse-Dic
  150 + */
  151 + return {
  152 + restrict: 'E',
  153 + templateUrl: '/pages/scheduleApp/module/common/dt/MyRadioGroupWrapTemplate.html',
  154 + scope: {
  155 + model: "="
  156 + },
  157 + controllerAs: "$saRadiogroupCtrl",
  158 + bindToController: true,
  159 + controller: function($scope) {
  160 + //$scope["model"] = {selectedOption: null};
  161 + //console.log("controller");
  162 + //console.log("controller:" + $scope["model"]);
  163 +
  164 + var self = this;
  165 + self.$$data = null; // 内部数据
  166 + },
  167 +
  168 + /**
  169 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  170 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  171 + * @param tElem
  172 + * @param tAttrs
  173 + * @returns {{pre: Function, post: Function}}
  174 + */
  175 + compile: function(tElem, tAttrs) {
  176 + // 获取属性
  177 + var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
  178 + var $name_attr = tAttrs["name"]; // 控件的名字
  179 + var $required_attr = tAttrs["required"]; // 是否要用required验证
  180 + var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
  181 +
  182 + // controlAs名字
  183 + var ctrlAs = "$saRadiogroupCtrl";
  184 +
  185 + // 如果有required属性,添加angularjs required验证
  186 + if ($required_attr != undefined) {
  187 + tElem.find("input").attr("required", "");
  188 + }
  189 +
  190 + return {
  191 + pre: function(scope, element, attr) {
  192 +
  193 + },
  194 +
  195 + /**
  196 + * 相当于link函数。
  197 + * @param scope
  198 + * @param element
  199 + * @param attr
  200 + */
  201 + post: function(scope, element, attr) {
  202 + //console.log("link");
  203 + //console.log("link:" + scope.model);
  204 + //scope["model"] = {selectedOption: null};
  205 +
  206 + if ($name_attr) {
  207 + scope[ctrlAs].nv = $name_attr;
  208 + }
  209 +
  210 + if ($disabled_attr) {
  211 + scope[ctrlAs].disabled = true;
  212 + }
  213 + if ($dicgroup_attr) {
  214 + var obj = dictionaryUtils.getByGroup($dicgroup_attr);
  215 + scope[ctrlAs].$$data = obj;
  216 + // 处理 scope["dic"] key值
  217 + scope[ctrlAs].dicvalueCalcu = function(value) {
  218 + if (value == "true") {
  219 + //console.log(value);
  220 + return true;
  221 + } else if (value == "false") {
  222 + //console.log(value);
  223 + return false;
  224 + } else {
  225 + return value;
  226 + }
  227 + };
  228 + }
  229 + }
  230 + };
  231 + }
  232 + };
  233 +}]);
  234 +
  235 +angular.module('ScheduleApp').directive("remoteValidaton", [
  236 + 'BusInfoManageService_g',
  237 + 'EmployeeInfoManageService_g',
  238 + 'TimeTableManageService_g',
  239 + function(
  240 + busInfoManageService_g,
  241 + employeeInfoManageService_g,
  242 + timeTableManageService_g
  243 + ) {
  244 + /**
  245 + * 远端验证指令,依赖于ngModel
  246 + * 指令名称 remote-Validation
  247 + * 需要属性 rvtype 表示验证类型
  248 + */
  249 + return {
  250 + restrict: "A",
  251 + require: "^ngModel",
  252 + link: function(scope, element, attr, ngModelCtrl) {
  253 + element.bind("keyup", function() {
  254 + var modelValue = ngModelCtrl.$modelValue;
  255 + var rv1_attr = attr["rv1"];
  256 + if (attr["rvtype"]) {
  257 +
  258 + // 根据rvtype的值,确定使用那个远端验证的url,
  259 + // rv1, rv2, rv3是关联比较值,暂时使用rv1
  260 + // 这个貌似没法通用,根据业务变换
  261 + // TODO:暂时有点乱以后改
  262 + if (attr["rvtype"] == "insideCode") {
  263 + busInfoManageService_g.validate.insideCode(
  264 + {"insideCode_eq": modelValue, type: "equale"},
  265 + function(result) {
  266 + //console.log(result);
  267 + if (result.status == "SUCCESS") {
  268 + ngModelCtrl.$setValidity('remote', true);
  269 + } else {
  270 + ngModelCtrl.$setValidity('remote', false);
  271 + }
  272 + },
  273 + function(result) {
  274 + //console.log(result);
  275 + ngModelCtrl.$setValidity('remote', true);
  276 + }
  277 + );
  278 + } else if (attr["rvtype"] == "jobCode") {
  279 + if (!rv1_attr) {
  280 + ngModelCtrl.$setValidity('remote', false);
  281 + return;
  282 + }
  283 +
  284 + employeeInfoManageService_g.validate.jobCode(
  285 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  286 + function(result) {
  287 + //console.log(result);
  288 + if (result.status == "SUCCESS") {
  289 + ngModelCtrl.$setValidity('remote', true);
  290 + } else {
  291 + ngModelCtrl.$setValidity('remote', false);
  292 + }
  293 + },
  294 + function(result) {
  295 + //console.log(result);
  296 + ngModelCtrl.$setValidity('remote', true);
  297 + }
  298 + );
  299 + } else if (attr["rvtype"] == "ttinfoname") {
  300 + if (!rv1_attr) {
  301 + ngModelCtrl.$setValidity('remote', false);
  302 + return;
  303 + }
  304 +
  305 + timeTableManageService_g.validate.ttinfoname(
  306 + {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},
  307 + function(result) {
  308 + //console.log(result);
  309 + if (result.status == "SUCCESS") {
  310 + ngModelCtrl.$setValidity('remote', true);
  311 + } else {
  312 + ngModelCtrl.$setValidity('remote', false);
  313 + }
  314 + },
  315 + function(result) {
  316 + //console.log(result);
  317 + ngModelCtrl.$setValidity('remote', true);
  318 + }
  319 + );
  320 +
  321 + }
  322 + } else {
  323 + // 没有rvtype,就不用远端验证了
  324 + ngModelCtrl.$setValidity('remote', true);
  325 + }
  326 +
  327 + attr.$observe("rv1", function(value) {
  328 + if (attr["rvtype"] == "jobCode") {
  329 + if (!value) {
  330 + ngModelCtrl.$setValidity('remote', false);
  331 + return;
  332 + }
  333 +
  334 + employeeInfoManageService_g.validate.jobCode(
  335 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  336 + function(result) {
  337 + //console.log(result);
  338 + if (result.status == "SUCCESS") {
  339 + ngModelCtrl.$setValidity('remote', true);
  340 + } else {
  341 + ngModelCtrl.$setValidity('remote', false);
  342 + }
  343 + },
  344 + function(result) {
  345 + //console.log(result);
  346 + ngModelCtrl.$setValidity('remote', true);
  347 + }
  348 + );
  349 + } else if (attr["rvtype"] == "ttinfoname") {
  350 + if (!value) {
  351 + ngModelCtrl.$setValidity('remote', false);
  352 + return;
  353 + }
  354 +
  355 + console.log("rv1:" + value);
  356 +
  357 + timeTableManageService_g.validate.ttinfoname(
  358 + {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},
  359 + function(result) {
  360 + //console.log(result);
  361 + if (result.status == "SUCCESS") {
  362 + ngModelCtrl.$setValidity('remote', true);
  363 + } else {
  364 + ngModelCtrl.$setValidity('remote', false);
  365 + }
  366 + },
  367 + function(result) {
  368 + //console.log(result);
  369 + ngModelCtrl.$setValidity('remote', true);
  370 + }
  371 + );
  372 + }
  373 +
  374 + });
  375 + });
  376 + }
  377 + };
  378 + }]);
  379 +
  380 +
  381 +/**
  382 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  383 + * 1、compile阶段使用的属性如下:
  384 + * required:用于和表单验证连接,指定成required="true"才有效。
  385 + * 2、link阶段使用的属性如下
  386 + * model:关联的模型对象
  387 + * name:表单验证时需要的名字
  388 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  389 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  390 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  391 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  392 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  393 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  394 + * placeholder:select placeholder字符串描述
  395 + *
  396 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  397 + * $$SearchInfoService_g,内部使用的数据服务
  398 + */
  399 +// saSelect2指令使用的内部信service
  400 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  401 + return {
  402 + xl: $resource(
  403 + '/line/:type',
  404 + {order: 'name', direction: 'ASC'},
  405 + {
  406 + list: {
  407 + method: 'GET',
  408 + isArray: true
  409 + }
  410 + }
  411 + ),
  412 + zd: $resource(
  413 + '/stationroute/stations',
  414 + {order: 'stationCode', direction: 'ASC'},
  415 + {
  416 + list: {
  417 + method: 'GET',
  418 + isArray: true
  419 + }
  420 + }
  421 + ),
  422 + tcc: $resource(
  423 + '/carpark/:type',
  424 + {order: 'parkCode', direction: 'ASC'},
  425 + {
  426 + list: {
  427 + method: 'GET',
  428 + isArray: true
  429 + }
  430 + }
  431 + ),
  432 + ry: $resource(
  433 + '/personnel/:type',
  434 + {order: 'personnelName', direction: 'ASC'},
  435 + {
  436 + list: {
  437 + method: 'GET',
  438 + isArray: true
  439 + }
  440 + }
  441 + ),
  442 + cl: $resource(
  443 + '/cars/:type',
  444 + {order: "insideCode", direction: 'ASC'},
  445 + {
  446 + list: {
  447 + method: 'GET',
  448 + isArray: true
  449 + }
  450 + }
  451 + ),
  452 + ttInfo: $resource(
  453 + '/tic/:type',
  454 + {order: "name", direction: 'ASC'},
  455 + {
  456 + list: {
  457 + method: 'GET',
  458 + isArray: true
  459 + }
  460 + }
  461 + ),
  462 + cci: $resource(
  463 + '/cci/cars',
  464 + {},
  465 + {
  466 + list: {
  467 + method: 'GET',
  468 + isArray: true
  469 + }
  470 + }
  471 +
  472 + ),
  473 + cci2: $resource(
  474 + '/cci/:type',
  475 + {},
  476 + {
  477 + list: {
  478 + method: 'GET',
  479 + isArray: true
  480 + }
  481 + }
  482 + ),
  483 + cci3: $resource(
  484 + '/cci/cars2',
  485 + {},
  486 + {
  487 + list: {
  488 + method: 'GET',
  489 + isArray: true
  490 + }
  491 + }
  492 +
  493 + ),
  494 + eci: $resource(
  495 + '/eci/jsy',
  496 + {},
  497 + {
  498 + list: {
  499 + method: 'GET',
  500 + isArray: true
  501 + }
  502 + }
  503 + ),
  504 + eci2: $resource(
  505 + '/eci/spy',
  506 + {},
  507 + {
  508 + list: {
  509 + method: 'GET',
  510 + isArray: true
  511 + }
  512 + }
  513 + )
  514 + }
  515 +}]);
  516 +angular.module('ScheduleApp').filter("$$pyFilter", function() {
  517 + return function(items, props) {
  518 + var out = [];
  519 + var limit = props["limit"] || 20; // 默认20条记录
  520 +
  521 + if (angular.isArray(items)) {
  522 + items.forEach(function(item) {
  523 + if (out.length < limit) {
  524 + if (props.search) {
  525 + var upTerm = props.search.toUpperCase();
  526 + if(item.fullChars.indexOf(upTerm) != -1
  527 + || item.camelChars.indexOf(upTerm) != -1) {
  528 + out.push(item);
  529 + }
  530 + }
  531 + }
  532 + });
  533 + }
  534 +
  535 + return out;
  536 + };
  537 +});
  538 +angular.module('ScheduleApp').directive("saSelect2", [
  539 + '$timeout', '$$SearchInfoService_g',
  540 + function($timeout, $$searchInfoService_g) {
  541 + return {
  542 + restrict: 'E',
  543 + templateUrl: '/pages/scheduleApp/module/other/MySearchSelectTemplate.html',
  544 + scope: {
  545 + model: "=" // 独立作用域,关联外部的模型对象
  546 + },
  547 + controllerAs: "$saSelectCtrl",
  548 + bindToController: true,
  549 + controller: function($scope) {
  550 + var self = this;
  551 + self.$$data = []; // 内部关联的数据
  552 + },
  553 + /**
  554 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  555 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  556 + * @param tElem
  557 + * @param tAttrs
  558 + * @returns {{pre: Function, post: Function}}
  559 + */
  560 + compile: function(tElem, tAttrs) {
  561 + // 1、获取此阶段使用的属性
  562 + var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
  563 +
  564 + // 2、处理属性
  565 +
  566 + // 确定是否使用angularjs required验证
  567 + // 属性 required
  568 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  569 + if ($required_attr) {
  570 + if ($required_attr == "true") {
  571 + // 添加required属性指令
  572 + tElem.find("ui-select").attr("required", "");
  573 + } else {
  574 + // 不等于true,不添加required属性指令
  575 + }
  576 + } else {
  577 + // 不添加required属性指令
  578 + }
  579 +
  580 + //console.log("saSelect" + ":compile = >" + tElem.html());
  581 +
  582 + return {
  583 + pre: function(scope, element, attr) {
  584 + // TODO:
  585 + },
  586 + /**
  587 + * 相当于link函数。
  588 + *
  589 + * 重要属性如下:
  590 + * model 是绑定外部值。
  591 + * dicgroup 字典组的类型
  592 + * name input name属性值
  593 + */
  594 + post: function(scope, element, attr) {
  595 + // 1、获取此阶段使用的属性
  596 + var $name_attr = attr["name"]; // 表单验证时需要的名字
  597 + var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  598 + var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
  599 + var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
  600 + var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
  601 + var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
  602 + var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
  603 + var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
  604 +
  605 + // 2、处理属性、转换成$saSelectCtrl内部使用的属性
  606 + if ($name_attr) {
  607 + scope["$saSelectCtrl"].$name_attr = $name_attr;
  608 + }
  609 + if ($placeholder_attr) {
  610 + scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
  611 + }
  612 + if ($showcolname_attr) {
  613 + scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
  614 + }
  615 +
  616 + // 2-1、添加内部方法,根据type值,改变$$data的值
  617 + scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
  618 + // 根据type属性动态载入数据
  619 + if ($type_attr) {
  620 + $$searchInfoService_g[$type_attr].list(
  621 + {type: "all"},
  622 + function(result) {
  623 + scope["$saSelectCtrl"].$$data = [];
  624 + for (var i = 0; i < result.length; i ++) {
  625 + var data = {}; // data是result的一部分属性集合,根据配置来确定
  626 + if ($datacolname1_attr) {
  627 + data[$datacolname1_attr] = result[i][$datacolname1_attr];
  628 + }
  629 + if ($datacolname2_attr) {
  630 + data[$datacolname2_attr] = result[i][$datacolname2_attr];
  631 + }
  632 + if ($showcolname_attr) {
  633 + // 动态添加基于名字的拼音
  634 + data[$showcolname_attr] = result[i][$showcolname_attr];
  635 + if (data[$showcolname_attr]) {
  636 + data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
  637 + data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
  638 + }
  639 + }
  640 + if (data["fullChars"])
  641 + scope["$saSelectCtrl"].$$data.push(data);
  642 + }
  643 + },
  644 + function(result) {
  645 +
  646 + }
  647 + );
  648 + }
  649 + };
  650 +
  651 + // 3、选择、删除事件映射模型和内部数据对应的字段
  652 + scope["$saSelectCtrl"].$select_fn_attr = function($item) {
  653 + if ($modelcolname1_attr && $datacolname1_attr) {
  654 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];
  655 + }
  656 + if ($modelcolname2_attr && $datacolname2_attr) {
  657 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];
  658 + }
  659 + };
  660 + scope["$saSelectCtrl"].$remove_fn_attr = function() {
  661 + if ($modelcolname1_attr) {
  662 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;
  663 + }
  664 + if ($modelcolname2_attr) {
  665 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;
  666 + }
  667 + scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空
  668 +
  669 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  670 + };
  671 +
  672 + // 4、搜索事件
  673 + scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {
  674 + //var fullChars = pinyin.getFullChars($search).toUpperCase();
  675 + //var camelChars = pinyin.getCamelChars($search);
  676 + //
  677 + //console.log(fullChars + " " + camelChars);
  678 + // TODO:事件暂时没用,放着以后再说
  679 + };
  680 +
  681 + // 5、全部载入后,输入的
  682 + $timeout(function() {
  683 + // 创建内部使用的绑定对象,用于确认选中那个值
  684 + scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];
  685 +
  686 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  687 + }, 0);
  688 + }
  689 + }
  690 + }
  691 + };
  692 + }
  693 +]);
  694 +
  695 +/**
  696 + * saSelect3指令
  697 + * 属性如下:
  698 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  699 + * name(必须):控件的名字
  700 + * placeholder(可选):占位符字符串
  701 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  702 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  703 + * icname(必须):内部与之对应的字段名,如:icname=code
  704 + * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
  705 + * icname2(可选):内部与之对应的字段名2,如:icname2=name
  706 + * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
  707 + * icname3(可选):内部与之对应的字段名3,如:icname2=name
  708 + * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
  709 + * required(可选):是否要用required验证
  710 + * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
  711 + * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
  712 + *
  713 + * 高级属性:
  714 + * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
  715 + * dataparam(可选):数据源关联的外部参数对象
  716 + *
  717 + */
  718 +angular.module('ScheduleApp').directive("saSelect3", [
  719 + '$timeout',
  720 + '$$SearchInfoService_g',
  721 + function($timeout, $$searchInfoService_g) {
  722 + return {
  723 + restrict: 'E',
  724 + templateUrl: '/pages/scheduleApp/module/common/dt/MyUiSelectWrapTemplate1.html',
  725 + scope: {
  726 + model: "=" // 独立作用域,关联外部的模型object
  727 + },
  728 + controllerAs: "$saSelectCtrl",
  729 + bindToController: true,
  730 + controller: function($scope) {
  731 + var self = this;
  732 + self.$$data = []; // ui-select显示用的数据源
  733 + self.$$data_real= []; // 内部真实的数据源
  734 + },
  735 +
  736 + /**
  737 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  738 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  739 + * @param tElem
  740 + * @param tAttrs
  741 + * @returns {{pre: Function, post: Function}}
  742 + */
  743 + compile: function(tElem, tAttrs) {
  744 + // 获取所有的属性
  745 + var $name_attr = tAttrs["name"]; // 控件的名字
  746 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  747 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  748 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  749 + var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
  750 + var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
  751 + var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
  752 + var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
  753 +
  754 + var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
  755 + var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
  756 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  757 + var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
  758 + var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
  759 +
  760 + // controlAs名字
  761 + var ctrlAs = "$saSelectCtrl";
  762 +
  763 + // 数据源初始化标志
  764 + var $$data_init = false;
  765 + // 如果有required属性,添加angularjs required验证
  766 + if ($required_attr != undefined) {
  767 + tElem.find("ui-select").attr("required", "");
  768 + }
  769 +
  770 + // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义
  771 + // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}
  772 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");
  773 + // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data
  774 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  775 + // 原来的设置:item[$saSelectCtrl.$icname_s]
  776 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);
  777 + // 原来的设置:{{$saSelectCtrl.$name}}
  778 + tElem.find("ui-select").attr("name", $name_attr);
  779 + // 原来的设置:{{$saSelectCtrl.$placeholder}}
  780 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  781 +
  782 + return {
  783 + pre: function(scope, element, attr) {
  784 + // TODO:
  785 + },
  786 + /**
  787 + * 相当于link函数。
  788 + * @param scope
  789 + * @param element
  790 + * @param attr
  791 + */
  792 + post: function(scope, element, attr) {
  793 + // 添加选中事件处理函数
  794 + scope[ctrlAs].$$internal_select_fn = function($item) {
  795 + if ($dcname_attr && $icname_attr) {
  796 + if ($mlp_attr) {
  797 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  798 + } else {
  799 + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
  800 + }
  801 + }
  802 + if ($dcname2_attr && $icname2_attr) {
  803 + if ($mlp_attr) {
  804 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");
  805 + } else {
  806 + scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
  807 + }
  808 + }
  809 + if ($dcname3_attr && $icname3_attr) {
  810 + if ($mlp_attr) {
  811 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
  812 + } else {
  813 + scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
  814 + }
  815 + }
  816 + };
  817 +
  818 + // 删除选中事件处理函数
  819 + scope[ctrlAs].$$internal_remove_fn = function() {
  820 + scope[ctrlAs].$$internalmodel = undefined;
  821 + if ($mlp_attr) {
  822 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  823 + } else {
  824 + scope[ctrlAs].model[$dcname_attr] = undefined;
  825 + }
  826 +
  827 + if ($dcname2_attr) {
  828 + if ($mlp_attr) {
  829 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");
  830 + } else {
  831 + scope[ctrlAs].model[$dcname2_attr] = undefined;
  832 + }
  833 + }
  834 + if ($dcname3_attr) {
  835 + if ($mlp_attr) {
  836 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
  837 + } else {
  838 + scope[ctrlAs].model[$dcname3_attr] = undefined;
  839 + }
  840 + }
  841 + };
  842 +
  843 + /**
  844 + * 内部方法,读取字典数据作为数据源。
  845 + * @param dicgroup 字典类型,如:gsType
  846 + * @param ccol 代码字段名
  847 + * @param ncol 名字字段名
  848 + */
  849 + scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {
  850 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  851 + var dic_key; // 字典key
  852 + // 清空内部数据
  853 + scope[ctrlAs].$$data_real = [];
  854 + for (dic_key in origin_dicgroup) {
  855 + var data = {}; // 重新组合的字典元素对象
  856 + if (dic_key == "true")
  857 + data[ccol] = true;
  858 + else
  859 + data[ccol] = dic_key;
  860 + data[ncol] = origin_dicgroup[dic_key];
  861 + scope[ctrlAs].$$data_real.push(data);
  862 + }
  863 + // 这里直接将$$data_real数据深拷贝到$$data
  864 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  865 +
  866 + console.log(scope[ctrlAs].$$data);
  867 + };
  868 +
  869 + /**
  870 + * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把
  871 + * 内部方法,读取字典数据作为数据源。
  872 + * @param result 原始数据
  873 + * @param dcvalue 传入的关联数据
  874 + */
  875 + scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {
  876 + //console.log("start");
  877 + // 清空内部数据
  878 + scope[ctrlAs].$$data_real = [];
  879 + scope[ctrlAs].$$data = [];
  880 + for (var i = 0; i < result.length; i ++) {
  881 + if ($icname_s_attr) {
  882 + if ($mlp_attr) {
  883 + if (eval("result[i]" + "." + $icname_s_attr)) {
  884 + // 全拼
  885 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();
  886 + // 简拼
  887 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));
  888 + }
  889 + } else {
  890 + if (result[i][$icname_s_attr]) {
  891 + // 全拼
  892 + result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();
  893 + // 简拼
  894 + result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);
  895 + }
  896 + }
  897 + }
  898 +
  899 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  900 + scope[ctrlAs].$$data_real.push(result[i]);
  901 + }
  902 +
  903 + }
  904 + //console.log("start2");
  905 +
  906 + // 数量太大取前10条记录作为显示
  907 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  908 + // 先迭代循环查找已经传过来的值
  909 + if (scope[ctrlAs].$$data_real.length > 0) {
  910 + if (dcvalue) {
  911 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  912 + if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {
  913 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));
  914 + break;
  915 + }
  916 + }
  917 + }
  918 + }
  919 + // 在插入剩余的数据
  920 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  921 + if (scope[ctrlAs].$$data.length < 10) {
  922 + if ($mlp_attr) {
  923 + if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {
  924 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  925 + }
  926 + } else {
  927 + if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {
  928 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  929 + }
  930 + }
  931 + } else {
  932 + break;
  933 + }
  934 + }
  935 + }
  936 +
  937 + //console.log("end");
  938 + };
  939 +
  940 + /**
  941 + * 判定一个对象是否为空对象。
  942 + * @param Obj
  943 + */
  944 + scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
  945 + console.log(typeof obj);
  946 +
  947 + if (typeof obj === "object" && !(obj instanceof Array)) {
  948 + for (var prop in obj) {
  949 + if (obj.hasOwnProperty(prop)) {
  950 + return false;
  951 + }
  952 + }
  953 + return true;
  954 + } else {
  955 + throw "必须是对象";
  956 + }
  957 + };
  958 +
  959 + // 刷新数据
  960 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  961 + // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
  962 + var $dcvalue_attr = attr["dcvalue"];
  963 +
  964 + console.log("刷新数据:" + $dcvalue_attr);
  965 +
  966 + if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化
  967 + if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源
  968 + scope[ctrlAs].$$internal_dic_data(
  969 + $datatype_attr, $icname_attr, $icname_s_attr);
  970 + if ($dcvalue_attr) {
  971 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  972 + }
  973 + } else { // 非字典类型数据源
  974 + if (!$dataassociate_attr) {
  975 + $$searchInfoService_g[$datatype_attr].list(
  976 + {type: "all"},
  977 + function(result) {
  978 + //console.log("ok:" + $datatype_attr);
  979 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  980 + //console.log("ok2:" + $datatype_attr);
  981 + if ($dcvalue_attr) {
  982 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  983 + }
  984 +
  985 + $$data_init = true;
  986 + },
  987 + function(result) {
  988 +
  989 + }
  990 + );
  991 + }
  992 + }
  993 + }
  994 +
  995 + if ($$data_init) {
  996 + if (search && search != "") { // 有search值
  997 + if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源
  998 + // 处理search
  999 + console.log("search:" + search);
  1000 +
  1001 + scope[ctrlAs].$$data = [];
  1002 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1003 + var upTerm = search.toUpperCase();
  1004 + if (scope[ctrlAs].$$data.length < 10) {
  1005 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  1006 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  1007 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1008 + }
  1009 + } else {
  1010 + break;
  1011 + }
  1012 + }
  1013 + }
  1014 + }
  1015 +
  1016 + }
  1017 +
  1018 + };
  1019 +
  1020 +
  1021 +
  1022 +
  1023 +
  1024 +
  1025 +
  1026 +
  1027 +
  1028 +
  1029 + // TODO:
  1030 +
  1031 + // dom全部载入后调用
  1032 + $timeout(function() {
  1033 + console.log("dom全部载入后调用");
  1034 + }, 0);
  1035 + // 监控dcvalue model值变换
  1036 + attr.$observe("dcvalue", function(value) {
  1037 + console.log("监控dc1 model值变换:" + value);
  1038 + scope[ctrlAs].$$internalmodel = value;
  1039 + }
  1040 + );
  1041 + // 监控获取数据参数变换
  1042 + attr.$observe("dataparam", function(value) {
  1043 + // 判定是否空对象
  1044 + console.log(value);
  1045 + var obj = JSON.parse(value);
  1046 + var $dcvalue_attr = attr["dcvalue"];
  1047 + if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
  1048 + console.log("dataparam:" + obj);
  1049 +
  1050 + //
  1051 +
  1052 + obj["type"] = "all";
  1053 +
  1054 + $$data_init = false;
  1055 + $$searchInfoService_g[$datatype_attr].list(
  1056 + obj,
  1057 + function(result) {
  1058 + //console.log("ok:" + $datatype_attr);
  1059 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  1060 + //console.log("ok2:" + $datatype_attr);
  1061 + if ($dcvalue_attr) {
  1062 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  1063 + }
  1064 +
  1065 + $$data_init = true;
  1066 + },
  1067 + function(result) {
  1068 +
  1069 + }
  1070 + );
  1071 + }
  1072 + }
  1073 + );
  1074 + }
  1075 + };
  1076 + }
  1077 + };
  1078 +
  1079 + }
  1080 +]);
  1081 +
  1082 +/**
  1083 + * saCheckboxgroup指令
  1084 + * 属性如下:
  1085 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1086 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1087 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1088 + * name(必须):控件的名字
  1089 + * required(可选):是否要用required验证
  1090 + * disabled(可选):标示框是否可选
  1091 + *
  1092 + */
  1093 +angular.module('ScheduleApp').directive('saCheckboxgroup', [
  1094 + function() {
  1095 + return {
  1096 + restrict: 'E',
  1097 + templateUrl: '/pages/scheduleApp/module/common/dt/MyCheckboxGroupWrapTemplate.html',
  1098 + scope: {
  1099 + model: "=" // 独立作用域,关联外部的模型object
  1100 + },
  1101 + controllerAs: "$saCheckboxgroupCtrl",
  1102 + bindToController: true,
  1103 + controller: function($scope) {
  1104 + var self = this;
  1105 + self.$$data = []; // 内部的数据
  1106 +
  1107 + // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
  1108 + self.$$data = [
  1109 + {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1110 + {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1111 + {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1112 + {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1113 + {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1114 + {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1115 + {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
  1116 + ];
  1117 + },
  1118 +
  1119 + /**
  1120 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1121 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1122 + * @param tElem
  1123 + * @param tAttrs
  1124 + * @returns {{pre: Function, post: Function}}
  1125 + */
  1126 + compile: function(tElem, tAttrs) {
  1127 + // 获取所有的属性
  1128 + var $name_attr = tAttrs["name"]; // 控件的名字
  1129 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1130 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1131 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1132 +
  1133 + // controlAs名字
  1134 + var ctrlAs = '$saCheckboxgroupCtrl';
  1135 +
  1136 + // 如果有required属性,添加angularjs required验证
  1137 + if ($required_attr != undefined) {
  1138 + //console.log(tElem.html());
  1139 + tElem.find("div").attr("required", "");
  1140 + }
  1141 + // 如果有disabled属性,添加禁用标志
  1142 + if ($disabled_attr != undefined) {
  1143 + tElem.find("input").attr("ng-disabled", "true");
  1144 + }
  1145 +
  1146 + return {
  1147 + pre: function(scope, element, attr) {
  1148 + // TODO:
  1149 + },
  1150 + /**
  1151 + * 相当于link函数。
  1152 + * @param scope
  1153 + * @param element
  1154 + * @param attr
  1155 + */
  1156 + post: function(scope, element, attr) {
  1157 + // name属性
  1158 + if ($name_attr) {
  1159 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1160 + }
  1161 +
  1162 + /**
  1163 + * checkbox选择事件处理函数。
  1164 + * @param $d 数据对象,$$data中的元素对象
  1165 + */
  1166 + scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
  1167 + $d.ischecked = !$d.ischecked;
  1168 + console.log($d);
  1169 + };
  1170 +
  1171 + // 测试使用watch监控$$data的变化
  1172 + scope.$watch(
  1173 + function() {
  1174 + return scope[ctrlAs]["$$data"];
  1175 + },
  1176 + function(newValue, oldValue) {
  1177 + // 根据$$data生成对应的数据
  1178 + var rule_days_arr = [];
  1179 + var i;
  1180 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1181 + if (scope[ctrlAs]["$$data"][i].ischecked)
  1182 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
  1183 + else
  1184 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
  1185 + }
  1186 + scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
  1187 + //scope[ctrlAs].$$internalmodel = undefined;
  1188 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  1189 +
  1190 + // 更新model
  1191 + if ($dcname_attr) {
  1192 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
  1193 + }
  1194 +
  1195 +
  1196 + },
  1197 + true
  1198 + );
  1199 +
  1200 + // TODO:
  1201 +
  1202 + // 监控dcvalue model值变换
  1203 + attr.$observe("dcvalue", function(value) {
  1204 + console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
  1205 + if (value) {
  1206 + // 根据value值,修改$$data里的值
  1207 + var data_array = value.split(",");
  1208 + var i;
  1209 + if (data_array.length > scope[ctrlAs]["$$data"].length) {
  1210 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
  1211 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1212 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1213 + } else {
  1214 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1215 + }
  1216 + }
  1217 + } else {
  1218 + for (i = 0; i < data_array.length; i ++) {
  1219 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1220 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1221 + } else {
  1222 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1223 + }
  1224 + }
  1225 + }
  1226 +
  1227 + }
  1228 + });
  1229 + }
  1230 +
  1231 + };
  1232 +
  1233 +
  1234 + }
  1235 +
  1236 + };
  1237 + }
  1238 +]);
  1239 +
  1240 +/**
  1241 + * saDategroup指令
  1242 + * 属性如下:
  1243 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1244 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1245 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1246 + * name(必须):控件的名字
  1247 + * required(可选):是否要用required验证
  1248 + * disabled(可选):标示框是否可选
  1249 + *
  1250 + */
  1251 +angular.module('ScheduleApp').directive('saDategroup', [
  1252 + '$filter',
  1253 + function($filter) {
  1254 + return {
  1255 + restrict: 'E',
  1256 + templateUrl: '/pages/scheduleApp/module/common/dt/MyDateGroupWrapTemplate.html',
  1257 + scope: {
  1258 + model: "=" // 独立作用域,关联外部的模型object
  1259 + },
  1260 + controllerAs: "$saDategroupCtrl",
  1261 + bindToController: true,
  1262 + controller: function($scope) {
  1263 + var self = this;
  1264 + self.$$data = []; // 内部的数据
  1265 + self.$$date_select; // 内部选中的日期
  1266 +
  1267 + //// 测试数据
  1268 + //self.$$data = [
  1269 + // {datestr: '2011-01-01', ischecked: true},
  1270 + // {datestr: '2011-01-01', ischecked: true},
  1271 + // {datestr: '2011-01-01', ischecked: true}
  1272 + //];
  1273 + },
  1274 +
  1275 + /**
  1276 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1277 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1278 + * @param tElem
  1279 + * @param tAttrs
  1280 + * @returns {{pre: Function, post: Function}}
  1281 + */
  1282 + compile: function(tElem, tAttrs) {
  1283 + // 获取所有的属性
  1284 + var $name_attr = tAttrs["name"]; // 控件的名字
  1285 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1286 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1287 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1288 +
  1289 + // controlAs名字
  1290 + var ctrlAs = '$saDategroupCtrl';
  1291 +
  1292 + // 如果有required属性,添加angularjs required验证
  1293 + if ($required_attr != undefined) {
  1294 + //console.log(tElem.html());
  1295 + tElem.find("div").attr("required", "");
  1296 + }
  1297 + // 如果有disabled属性,添加禁用标志
  1298 + if ($disabled_attr != undefined) {
  1299 + tElem.find("input").attr("ng-disabled", "true");
  1300 + tElem.find("div").attr("ng-disabled", "true");
  1301 + }
  1302 +
  1303 + return {
  1304 + pre: function (scope, element, attr) {
  1305 + // TODO:
  1306 + },
  1307 + /**
  1308 + * 相当于link函数。
  1309 + * @param scope
  1310 + * @param element
  1311 + * @param attr
  1312 + */
  1313 + post: function (scope, element, attr) {
  1314 + // name属性
  1315 + if ($name_attr) {
  1316 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1317 + }
  1318 +
  1319 +
  1320 + // 日期open属性,及方法
  1321 + scope[ctrlAs].$$specialDateOpen = false;
  1322 + scope[ctrlAs].$$specialDate_open = function() {
  1323 + scope[ctrlAs].$$specialDateOpen = true;
  1324 + };
  1325 +
  1326 + // 监控选择的日期
  1327 + scope.$watch(
  1328 + function() {
  1329 + return scope[ctrlAs]['$$date_select'];
  1330 + },
  1331 + function(newValue, oldValue) {
  1332 + if (newValue) {
  1333 + //console.log("saDategroup--->selectdate:" + newValue);
  1334 + // 调用内置filter,转换日期到yyyy-MM-dd格式
  1335 + var text = $filter('date')(newValue, 'yyyy-MM-dd');
  1336 + var i;
  1337 + var isexist = false; // 日期是否已经选择标识
  1338 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1339 + if (scope[ctrlAs]["$$data"][i].datestr == text) {
  1340 + isexist = true;
  1341 + break;
  1342 + }
  1343 + }
  1344 + if (!isexist) {
  1345 + scope[ctrlAs]["$$data"].push(
  1346 + {
  1347 + datestr: text,
  1348 + ischecked: true
  1349 + }
  1350 + );
  1351 + }
  1352 +
  1353 + }
  1354 +
  1355 + }
  1356 + );
  1357 +
  1358 + /**
  1359 + * 日期点击事件处理函数。
  1360 + * @param $index 索引
  1361 + */
  1362 + scope[ctrlAs].$$internal_datestr_click = function($index) {
  1363 + scope[ctrlAs].$$data.splice($index, 1);
  1364 + };
  1365 +
  1366 + // 测试使用watch监控$$data的变化
  1367 + scope.$watch(
  1368 + function() {
  1369 + return scope[ctrlAs]['$$data'];
  1370 + },
  1371 + function(newValue, oldValue) {
  1372 + // 根据$$data生成对应的数据
  1373 + var special_days_arr = [];
  1374 + var i;
  1375 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1376 + special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
  1377 + }
  1378 +
  1379 + scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
  1380 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  1381 +
  1382 + // 更新model
  1383 + if ($dcname_attr) {
  1384 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
  1385 + }
  1386 + },
  1387 + true
  1388 + );
  1389 +
  1390 + // 监控dcvalue model值变换
  1391 + attr.$observe("dcvalue", function(value) {
  1392 + console.log("saDategroup 监控dc1 model值变换:" + value);
  1393 + if (value) {
  1394 + // 根据value值,修改$$data里的值
  1395 + var date_array = value.split(",");
  1396 + var i;
  1397 + scope[ctrlAs]["$$data"] = [];
  1398 + for (i = 0; i < date_array.length; i++) {
  1399 + scope[ctrlAs]["$$data"].push(
  1400 + {
  1401 + datestr: date_array[i],
  1402 + ischecked: true
  1403 + }
  1404 + );
  1405 + }
  1406 +
  1407 +
  1408 +
  1409 +
  1410 +
  1411 +
  1412 +
  1413 +
  1414 +
  1415 + }
  1416 + });
  1417 +
  1418 + }
  1419 +
  1420 + };
  1421 + }
  1422 + }
  1423 + }
  1424 +]);
  1425 +
  1426 +/**
  1427 + * saGuideboardgroup指令
  1428 + * 属性如下:
  1429 + * name(必须):控件的名字
  1430 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1431 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  1432 + * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1433 + * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
  1434 + * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1435 + * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
  1436 + * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  1437 + * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
  1438 + *
  1439 + * required(可选):是否要用required验证
  1440 + *
  1441 + */
  1442 +angular.module('ScheduleApp').directive('saGuideboardgroup', [
  1443 + 'GuideboardManageService_g',
  1444 + function(guideboardManageService_g) {
  1445 + return {
  1446 + restrict: 'E',
  1447 + templateUrl: '/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html',
  1448 + scope: {
  1449 + model: "=" // 独立作用域,关联外部的模型object
  1450 + },
  1451 + controllerAs: '$saGuideboardgroupCtrl',
  1452 + bindToController: true,
  1453 + controller: function($scope) {
  1454 + var self = this;
  1455 + self.$$data = []; // 选择线路后,该线路的路牌数据
  1456 +
  1457 + // 测试数据
  1458 + //self.$$data = [
  1459 + // {lpid: 1, lpname: '路1', isstart: false},
  1460 + // {lpid: 2, lpname: '路2', isstart: true},
  1461 + // {lpid: 3, lpname: '路3', isstart: false}
  1462 + //];
  1463 +
  1464 +
  1465 + self.$$dataSelected = []; // 选中的路牌列表
  1466 + self.$$dataSelectedStart = undefined; // 起始路牌
  1467 +
  1468 + //self.$$dataSelected = [
  1469 + // {lpid: 11, lpname: '路11', isstart: false},
  1470 + // {lpid: 12, lpname: '路12', isstart: true},
  1471 + // {lpid: 13, lpname: '路13', isstart: false}
  1472 + //];
  1473 +
  1474 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  1475 + self.$$internalmodel = undefined;
  1476 +
  1477 + self.$$data_init = false; // *数据源初始化标志
  1478 + self.$$data_xl_first_init = false; // 线路是否初始化
  1479 + self.$$data_lp_first_init = false; // 路牌名字是否初始化
  1480 + self.$$data_lpid_first_init = false; // 路牌id是否初始化
  1481 + self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
  1482 +
  1483 + self.$$dataDesc = ""; // 路牌列表描述
  1484 + self.$$dataSelectDesc = ""; // 选中路牌描述
  1485 +
  1486 + },
  1487 +
  1488 + /**
  1489 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1490 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1491 + * @param tElem
  1492 + * @param tAttrs
  1493 + * @returns {{pre: Function, post: Function}}
  1494 + */
  1495 + compile: function(tElem, tAttrs) {
  1496 + // TODO:获取所有的属性
  1497 + var $name_attr = tAttrs["name"]; // 控件的名字
  1498 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1499 + var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
  1500 + var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
  1501 + var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
  1502 +
  1503 + // controlAs名字
  1504 + var ctrlAs = '$saGuideboardgroupCtrl';
  1505 +
  1506 + // 如果有required属性,添加angularjs required验证
  1507 + if ($required_attr != undefined) {
  1508 + //console.log(tElem.html());
  1509 + tElem.find("div").attr("required", "");
  1510 + }
  1511 +
  1512 + return {
  1513 + pre: function(scope, element, attr) {
  1514 + // TODO:
  1515 + },
  1516 +
  1517 + /**
  1518 + * 相当于link函数。
  1519 + * @param scope
  1520 + * @param element
  1521 + * @param attr
  1522 + */
  1523 + post: function(scope, element, attr) {
  1524 + // name属性
  1525 + if ($name_attr) {
  1526 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1527 + }
  1528 +
  1529 + // TODO:
  1530 +
  1531 +
  1532 + /**
  1533 + * 路牌列表点击(路牌列表中选中路牌)
  1534 + * @param $index
  1535 + */
  1536 + scope[ctrlAs].$$internal_lplist_click = function($index) {
  1537 + var data_temp = scope[ctrlAs].$$data;
  1538 + if (data_temp && data_temp.length > $index) {
  1539 + scope[ctrlAs].$$dataSelected.push({
  1540 + lpid: data_temp[$index].lpid,
  1541 + lpname: data_temp[$index].lpname,
  1542 + isstart: data_temp[$index].isstart
  1543 + });
  1544 +
  1545 + // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
  1546 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  1547 + scope[ctrlAs].$$internal_sellplist_click(
  1548 + scope[ctrlAs].$$dataSelected.length - 1);
  1549 + }
  1550 + }
  1551 + };
  1552 + /**
  1553 + * 选中的路牌单击(初始路牌选择)
  1554 + * @param $index
  1555 + */
  1556 + scope[ctrlAs].$$internal_sellplist_click = function($index) {
  1557 + var data_temp = scope[ctrlAs].$$dataSelected;
  1558 + if (data_temp && data_temp.length > $index) {
  1559 + for (var i = 0; i < data_temp.length; i++) {
  1560 + data_temp[i].isstart = false;
  1561 + }
  1562 + data_temp[$index].isstart = true;
  1563 + scope[ctrlAs].$$dataSelectedStart = $index;
  1564 + }
  1565 + };
  1566 + /**
  1567 + * 选中的路牌双击(删除选中的路牌)
  1568 + * @param $index
  1569 + */
  1570 + scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
  1571 + var data_temp = scope[ctrlAs].$$dataSelected;
  1572 + if (data_temp && data_temp.length > $index) {
  1573 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  1574 + scope[ctrlAs].$$dataSelectedStart = undefined;
  1575 + }
  1576 + data_temp.splice($index, 1);
  1577 + }
  1578 + };
  1579 +
  1580 +
  1581 + /**
  1582 + * 验证内部数据,更新外部model
  1583 + */
  1584 + scope[ctrlAs].$$internal_validate_model = function() {
  1585 + var data_temp = scope[ctrlAs].$$dataSelected;
  1586 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  1587 + var lpNames = [];
  1588 + var lpIds = [];
  1589 + var lpStart = 0;
  1590 + var i = 0;
  1591 +
  1592 + if (data_temp &&
  1593 + data_temp.length > 0 &&
  1594 + data_temp2 != undefined) {
  1595 +
  1596 + for (i = 0; i < data_temp.length; i++) {
  1597 + lpNames.push(data_temp[i].lpname);
  1598 + lpIds.push(data_temp[i].lpid)
  1599 + }
  1600 + data_temp[data_temp2].isstart = true;
  1601 + lpStart = data_temp2 + 1;
  1602 +
  1603 + // 更新内部model,用于外部验证
  1604 + // 内部model的值暂时随意,以后再改
  1605 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  1606 +
  1607 + // 更新外部model字段
  1608 + if ($lprangename_attr) {
  1609 + console.log("lprangename=" + lpNames.join(','));
  1610 + eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
  1611 + }
  1612 + if ($lpidrangename_attr) {
  1613 + console.log("lpidrangename=" + lpIds.join(','));
  1614 + eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
  1615 + }
  1616 + if ($lpstartname_attr) {
  1617 + console.log("lpstartname=" + lpStart);
  1618 + eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
  1619 + }
  1620 +
  1621 + scope[ctrlAs].$$dataSelectDesc =
  1622 + ",共" + data_temp.length + "个," + "初始路牌,第" + lpStart + "个";
  1623 +
  1624 + } else {
  1625 + scope[ctrlAs].$$internalmodel = undefined;
  1626 + }
  1627 +
  1628 +
  1629 + };
  1630 +
  1631 + // 监控内部数据,$$data_selected 变化
  1632 + scope.$watch(
  1633 + function() {
  1634 + return scope[ctrlAs].$$dataSelected;
  1635 + },
  1636 + function(newValue, oldValue) {
  1637 + scope[ctrlAs].$$internal_validate_model();
  1638 + },
  1639 + true
  1640 + );
  1641 +
  1642 + // 监控内部数据,$$data_selected_start 变化
  1643 + scope.$watch(
  1644 + function() {
  1645 + return scope[ctrlAs].$$dataSelectedStart;
  1646 + },
  1647 + function(newValue, oldValue) {
  1648 + scope[ctrlAs].$$internal_validate_model();
  1649 + },
  1650 + true
  1651 + );
  1652 +
  1653 + /**
  1654 + * 验证数据是否初始化完成,
  1655 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  1656 + */
  1657 + scope[ctrlAs].$$internal_validate_init = function() {
  1658 + var self = scope[ctrlAs];
  1659 +
  1660 + if (self.$$data_xl_first_init &&
  1661 + self.$$data_lp_first_init &&
  1662 + self.$$data_lpid_first_init &&
  1663 + self.$$data_lpstart_first_init) {
  1664 + console.log("数据初始化完毕!");
  1665 + self.$$data_init = true;
  1666 + }
  1667 +
  1668 + };
  1669 +
  1670 + // 监控初始化标志,线路,路牌,路牌id,起始路牌
  1671 + scope.$watch(
  1672 + function() {
  1673 + return scope[ctrlAs].$$data_xl_first_init;
  1674 + },
  1675 + function(newValue, oldValue) {
  1676 + scope[ctrlAs].$$internal_validate_init();
  1677 + }
  1678 + );
  1679 + scope.$watch(
  1680 + function() {
  1681 + return scope[ctrlAs].$$data_lp_first_init;
  1682 + },
  1683 + function(newValue, oldValue) {
  1684 + scope[ctrlAs].$$internal_validate_init();
  1685 + }
  1686 + );
  1687 + scope.$watch(
  1688 + function() {
  1689 + return scope[ctrlAs].$$data_lpid_first_init;
  1690 + },
  1691 + function(newValue, oldValue) {
  1692 + scope[ctrlAs].$$internal_validate_init();
  1693 + }
  1694 + );
  1695 + scope.$watch(
  1696 + function() {
  1697 + return scope[ctrlAs].$$data_lpstart_first_init;
  1698 + },
  1699 + function(newValue, oldValue) {
  1700 + scope[ctrlAs].$$internal_validate_init();
  1701 + }
  1702 + );
  1703 +
  1704 +
  1705 + // 监控线路id的变化
  1706 + attr.$observe("xlidvalue", function(value) {
  1707 + if (value && value != "") {
  1708 + console.log("xlidvalue=" + value);
  1709 +
  1710 + guideboardManageService_g.rest.list(
  1711 + {"xl.id_eq": value, size: 100},
  1712 + function(result) {
  1713 + // 获取值了
  1714 + console.log("路牌获取了");
  1715 +
  1716 + scope[ctrlAs].$$data = [];
  1717 + for (var i = 0; i < result.content.length; i++) {
  1718 + scope[ctrlAs].$$data.push({
  1719 + lpid: result.content[i].id,
  1720 + lpname: result.content[i].lpName,
  1721 + isstart: false
  1722 + });
  1723 + }
  1724 + if (scope[ctrlAs].$$data_init) {
  1725 + scope[ctrlAs].$$dataSelected = [];
  1726 + scope[ctrlAs].$$dataSelectedStart = undefined;
  1727 + scope[ctrlAs].$$internalmodel = undefined;
  1728 + scope[ctrlAs].$$dataDesc = "";
  1729 + scope[ctrlAs].$$dataSelectDesc = "";
  1730 + }
  1731 + scope[ctrlAs].$$data_xl_first_init = true;
  1732 +
  1733 + scope[ctrlAs].$$dataDesc = ",共" + result.content.length + "个";
  1734 + },
  1735 + function(result) {
  1736 +
  1737 + }
  1738 + );
  1739 +
  1740 + }
  1741 + });
  1742 +
  1743 + // 监控路牌名称范围值的变化
  1744 + attr.$observe("lprangevalue", function(value) {
  1745 + if (value && value != "") {
  1746 + var data_temp = scope[ctrlAs].$$dataSelected;
  1747 + var lpnames = value.split(",");
  1748 + var i = 0;
  1749 + if (data_temp && data_temp.length == 0) { // 初始创建
  1750 + console.log("lprangevalue变换了");
  1751 + for (i = 0; i < lpnames.length; i++) {
  1752 + scope[ctrlAs].$$dataSelected.push({
  1753 + lpname: lpnames[i],
  1754 + isstart: false
  1755 + });
  1756 + }
  1757 + } else {
  1758 + for (i = 0; i < lpnames.length; i++) {
  1759 + data_temp[i].lpname = lpnames[i];
  1760 + }
  1761 + }
  1762 + scope[ctrlAs].$$data_lp_first_init = true;
  1763 + }
  1764 + });
  1765 +
  1766 + // 监控路牌id范围值的变化
  1767 + attr.$observe("lpidrangevalue", function(value) {
  1768 + if (value && value != "") {
  1769 + console.log("lpidrangevalue=" + value);
  1770 + var data_temp = scope[ctrlAs].$$dataSelected;
  1771 + var lpids = value.split(",");
  1772 + var i = 0;
  1773 + if (data_temp && data_temp.length == 0) { // 初始创建
  1774 + console.log("lpidrangevalue");
  1775 + for (i = 0; i < lpids.length; i++) {
  1776 + scope[ctrlAs].$$dataSelected.push({
  1777 + lpid: lpids[i],
  1778 + isstart: false
  1779 + });
  1780 + }
  1781 + } else {
  1782 + for (i = 0; i < lpids.length; i++) {
  1783 + data_temp[i].lpid = lpids[i];
  1784 + }
  1785 + }
  1786 + scope[ctrlAs].$$data_lpid_first_init = true;
  1787 + }
  1788 + });
  1789 +
  1790 + // 监控起始路牌的变化
  1791 + attr.$observe("lpstartvalue", function(value) {
  1792 + if (value && value != "") {
  1793 + scope[ctrlAs].$$dataSelectedStart = value - 1;
  1794 + scope[ctrlAs].$$data_lpstart_first_init = true;
  1795 + }
  1796 + });
  1797 +
  1798 +
  1799 +
  1800 + }
  1801 + }
  1802 +
  1803 + }
  1804 + }
  1805 + }
  1806 +]);
  1807 +
  1808 +/**
  1809 + * saEmployeegroup指令
  1810 + * 属性如下:
  1811 + * name(必须):控件的名字
  1812 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1813 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  1814 + * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1815 + * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
  1816 + * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  1817 + * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
  1818 + * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  1819 + * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
  1820 + *
  1821 + * required(可选):是否要用required验证
  1822 + *
  1823 + */
  1824 +angular.module('ScheduleApp').directive('saEmployeegroup', [
  1825 + 'EmployeeConfigService_g',
  1826 + function(employeeConfigService_g) {
  1827 + return {
  1828 + restrict: 'E',
  1829 + templateUrl: '/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html',
  1830 + scope: {
  1831 + model: "=" // 独立作用域,关联外部的模型object
  1832 + },
  1833 + controllerAs: '$saEmployeegroupCtrl',
  1834 + bindToController: true,
  1835 + controller: function($scope) {
  1836 + var self = this;
  1837 + self.$$data = []; // 选择线路后,该线路的人员配置数据
  1838 +
  1839 + // 测试数据
  1840 + //self.$$data = [
  1841 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
  1842 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
  1843 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
  1844 + //];
  1845 +
  1846 +
  1847 + self.$$dataSelected = []; // 选中的人员配置列表
  1848 + self.$$dataSelectedStart = undefined; // 起始人员配置
  1849 +
  1850 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  1851 + self.$$internalmodel = undefined;
  1852 +
  1853 + self.$$data_init = false; // *数据源初始化标志
  1854 + self.$$data_xl_first_init = false; // 线路是否初始化
  1855 + self.$$data_ry_first_init = false; // 人员配置是否初始化
  1856 + self.$$data_rycid_first_init = false; // 人员配置id是否初始化
  1857 + self.$$data_rystart_first_init = false; // 起始人员是否初始化
  1858 +
  1859 + self.$$dataDesc = ""; // 路牌列表描述
  1860 + self.$$dataSelectDesc = ""; // 选中路牌描述
  1861 +
  1862 + },
  1863 +
  1864 + /**
  1865 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1866 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1867 + * @param tElem
  1868 + * @param tAttrs
  1869 + * @returns {{pre: Function, post: Function}}
  1870 + */
  1871 + compile: function(tElem, tAttrs) {
  1872 + // TODO:获取所有的属性
  1873 + var $name_attr = tAttrs["name"]; // 控件的名字
  1874 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1875 + var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
  1876 + var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
  1877 + var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
  1878 +
  1879 + // controlAs名字
  1880 + var ctrlAs = '$saEmployeegroupCtrl';
  1881 +
  1882 + // 如果有required属性,添加angularjs required验证
  1883 + if ($required_attr != undefined) {
  1884 + //console.log(tElem.html());
  1885 + tElem.find("div").attr("required", "");
  1886 + }
  1887 +
  1888 + return {
  1889 + pre: function(scope, element, attr) {
  1890 + // TODO:
  1891 + },
  1892 +
  1893 + /**
  1894 + * 相当于link函数。
  1895 + * @param scope
  1896 + * @param element
  1897 + * @param attr
  1898 + */
  1899 + post: function(scope, element, attr) {
  1900 + // name属性
  1901 + if ($name_attr) {
  1902 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1903 + }
  1904 +
  1905 + // TODO:
  1906 +
  1907 +
  1908 + /**
  1909 + * 人员配置列表点击(人员配置列表中选中路牌)
  1910 + * @param $index
  1911 + */
  1912 + scope[ctrlAs].$$internal_rylist_click = function($index) {
  1913 + var data_temp = scope[ctrlAs].$$data;
  1914 + if (data_temp && data_temp.length > $index) {
  1915 + scope[ctrlAs].$$dataSelected.push({
  1916 + id : data_temp[$index].id,
  1917 + dbbm: data_temp[$index].dbbm,
  1918 + jsy: data_temp[$index].jsy,
  1919 + spy: data_temp[$index].spy,
  1920 + isstart: data_temp[$index].isstart
  1921 + });
  1922 +
  1923 + // 如果没有指定过初始人员,默认选择此人员作为起始人员
  1924 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  1925 + scope[ctrlAs].$$internal_selrylist_click(
  1926 + scope[ctrlAs].$$dataSelected.length - 1);
  1927 + }
  1928 + }
  1929 + };
  1930 + /**
  1931 + * 选中的人员单击(初始人员选择)
  1932 + * @param $index
  1933 + */
  1934 + scope[ctrlAs].$$internal_selrylist_click = function($index) {
  1935 + var data_temp = scope[ctrlAs].$$dataSelected;
  1936 + if (data_temp && data_temp.length > $index) {
  1937 + for (var i = 0; i < data_temp.length; i++) {
  1938 + data_temp[i].isstart = false;
  1939 + }
  1940 + data_temp[$index].isstart = true;
  1941 + scope[ctrlAs].$$dataSelectedStart = $index;
  1942 + }
  1943 + };
  1944 + /**
  1945 + * 选中的人员双击(删除选中的人员)
  1946 + * @param $index
  1947 + */
  1948 + scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
  1949 + var data_temp = scope[ctrlAs].$$dataSelected;
  1950 + if (data_temp && data_temp.length > $index) {
  1951 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  1952 + scope[ctrlAs].$$dataSelectedStart = undefined;
  1953 + }
  1954 + data_temp.splice($index, 1);
  1955 + }
  1956 + };
  1957 +
  1958 +
  1959 + /**
  1960 + * 验证内部数据,更新外部model
  1961 + */
  1962 + scope[ctrlAs].$$internal_validate_model = function() {
  1963 + var data_temp = scope[ctrlAs].$$dataSelected;
  1964 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  1965 + var ryDbbms = [];
  1966 + var ryCids = [];
  1967 + var ryStart = 0;
  1968 + var i = 0;
  1969 +
  1970 + if (data_temp &&
  1971 + data_temp.length > 0 &&
  1972 + data_temp2 != undefined) {
  1973 +
  1974 + for (i = 0; i < data_temp.length; i++) {
  1975 + ryDbbms.push(data_temp[i].dbbm);
  1976 + ryCids.push(data_temp[i].id);
  1977 + }
  1978 + data_temp[data_temp2].isstart = true;
  1979 + ryStart = data_temp2 + 1;
  1980 +
  1981 + // 更新内部model,用于外部验证
  1982 + // 内部model的值暂时随意,以后再改
  1983 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  1984 +
  1985 + // 更新外部model字段
  1986 + if ($dbbmrangename_attr) {
  1987 + console.log("dbbmrangename=" + ryDbbms.join(','));
  1988 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  1989 + }
  1990 + if (rycidrangename_attr) {
  1991 + console.log("rycidrangename=" + ryCids.join(','));
  1992 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  1993 + }
  1994 + if ($rystartname_attr) {
  1995 + console.log("rystartname=" + ryStart);
  1996 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  1997 + }
  1998 +
  1999 + scope[ctrlAs].$$dataSelectDesc =
  2000 + ",共" + data_temp.length + "组," + "初始人员,第" + ryStart + "组";
  2001 +
  2002 + } else {
  2003 + scope[ctrlAs].$$internalmodel = undefined;
  2004 + }
  2005 +
  2006 +
  2007 + };
  2008 +
  2009 + // 监控内部数据,$$data_selected 变化
  2010 + scope.$watch(
  2011 + function() {
  2012 + return scope[ctrlAs].$$dataSelected;
  2013 + },
  2014 + function(newValue, oldValue) {
  2015 + scope[ctrlAs].$$internal_validate_model();
  2016 + },
  2017 + true
  2018 + );
  2019 +
  2020 + // 监控内部数据,$$data_selected_start 变化
  2021 + scope.$watch(
  2022 + function() {
  2023 + return scope[ctrlAs].$$dataSelectedStart;
  2024 + },
  2025 + function(newValue, oldValue) {
  2026 + scope[ctrlAs].$$internal_validate_model();
  2027 + },
  2028 + true
  2029 + );
  2030 +
  2031 + /**
  2032 + * 验证数据是否初始化完成,
  2033 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  2034 + */
  2035 + scope[ctrlAs].$$internal_validate_init = function() {
  2036 + var self = scope[ctrlAs];
  2037 + var data_temp = self.$$data;
  2038 + var dataSelect_temp = self.$$dataSelected;
  2039 + var i = 0;
  2040 + var j = 0;
  2041 +
  2042 + if (self.$$data_xl_first_init &&
  2043 + self.$$data_ry_first_init &&
  2044 + self.$$data_rycid_first_init &&
  2045 + self.$$data_rystart_first_init) {
  2046 + console.log("数据初始化完毕!");
  2047 + self.$$data_init = true;
  2048 +
  2049 + // 修正选择dataSelect
  2050 + for (i = 0; i < dataSelect_temp.length; i++) {
  2051 + for (j = 0; j < data_temp.length; j++) {
  2052 + if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
  2053 + dataSelect_temp[i].jsy = data_temp[j].jsy;
  2054 + dataSelect_temp[i].spy = data_temp[j].spy;
  2055 + break;
  2056 + }
  2057 + }
  2058 + }
  2059 + }
  2060 +
  2061 + };
  2062 +
  2063 + // 监控初始化标志,线路,人员,起始人员
  2064 + scope.$watch(
  2065 + function() {
  2066 + return scope[ctrlAs].$$data_xl_first_init;
  2067 + },
  2068 + function(newValue, oldValue) {
  2069 + scope[ctrlAs].$$internal_validate_init();
  2070 + }
  2071 + );
  2072 + scope.$watch(
  2073 + function() {
  2074 + return scope[ctrlAs].$$data_ry_first_init;
  2075 + },
  2076 + function(newValue, oldValue) {
  2077 + scope[ctrlAs].$$internal_validate_init();
  2078 + }
  2079 + );
  2080 + scope.$watch(
  2081 + function() {
  2082 + return scope[ctrlAs].$$data_rycid_first_init;
  2083 + },
  2084 + function(newValue, oldValue) {
  2085 + scope[ctrlAs].$$internal_validate_init();
  2086 + }
  2087 + );
  2088 + scope.$watch(
  2089 + function() {
  2090 + return scope[ctrlAs].$$data_rystart_first_init;
  2091 + },
  2092 + function(newValue, oldValue) {
  2093 + scope[ctrlAs].$$internal_validate_init();
  2094 + }
  2095 + );
  2096 +
  2097 +
  2098 + // 监控线路id的变化
  2099 + attr.$observe("xlidvalue", function(value) {
  2100 + if (value && value != "") {
  2101 + console.log("xlidvalue=" + value);
  2102 +
  2103 + employeeConfigService_g.rest.list(
  2104 + {"xl.id_eq": value, size: 100},
  2105 + function(result) {
  2106 + // 获取值了
  2107 + console.log("人员配置获取了");
  2108 +
  2109 + scope[ctrlAs].$$data = [];
  2110 + for (var i = 0; i < result.content.length; i++) {
  2111 + scope[ctrlAs].$$data.push({
  2112 + id: result.content[i].id,
  2113 + dbbm: result.content[i].dbbm,
  2114 + jsy: result.content[i].jsy.personnelName,
  2115 + spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName,
  2116 + isstart: false
  2117 + });
  2118 + }
  2119 + if (scope[ctrlAs].$$data_init) {
  2120 + scope[ctrlAs].$$dataSelected = [];
  2121 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2122 + scope[ctrlAs].$$internalmodel = undefined;
  2123 + scope[ctrlAs].$$dataDesc = "";
  2124 + scope[ctrlAs].$$dataSelectDesc = "";
  2125 + }
  2126 + scope[ctrlAs].$$data_xl_first_init = true;
  2127 +
  2128 + scope[ctrlAs].$$dataDesc = ",共" + result.content.length + "组";
  2129 + },
  2130 + function(result) {
  2131 +
  2132 + }
  2133 + );
  2134 +
  2135 + }
  2136 + });
  2137 +
  2138 + // 监控搭班编码范围值的变化
  2139 + attr.$observe("dbbmrangevalue", function(value) {
  2140 + if (value && value != "") {
  2141 + var data_temp = scope[ctrlAs].$$dataSelected;
  2142 + var dbbmnames = value.split(",");
  2143 + var i = 0;
  2144 + if (data_temp && data_temp.length == 0) { // 初始创建
  2145 + console.log("dbbmrangevalue变换了");
  2146 + for (i = 0; i < dbbmnames.length; i++) {
  2147 + scope[ctrlAs].$$dataSelected.push({
  2148 + dbbm: dbbmnames[i],
  2149 + isstart: false
  2150 + });
  2151 + }
  2152 + } else {
  2153 + for (i = 0; i < dbbmnames.length; i++) {
  2154 + data_temp[i].dbbm = dbbmnames[i];
  2155 + }
  2156 + }
  2157 + scope[ctrlAs].$$data_ry_first_init = true;
  2158 + }
  2159 + });
  2160 +
  2161 + // 监控人员配置id范围值的变化
  2162 + attr.$observe("rycidrangevalue", function(value) {
  2163 + if (value && value != "") {
  2164 + var data_temp = scope[ctrlAs].$$dataSelected;
  2165 + var rycids = value.split(",");
  2166 + var i = 0;
  2167 + if (data_temp && data_temp.length == 0) { // 初始创建
  2168 + console.log("rycidrangevalue变换了");
  2169 + for (i = 0; i < rycids.length; i++) {
  2170 + scope[ctrlAs].$$dataSelected.push({
  2171 + id: rycids[i],
  2172 + isstart: false
  2173 + });
  2174 + }
  2175 + } else {
  2176 + for (i = 0; i < rycids.length; i++) {
  2177 + data_temp[i].id = rycids[i];
  2178 + }
  2179 + }
  2180 + scope[ctrlAs].$$data_rycid_first_init = true;
  2181 + }
  2182 + });
  2183 +
  2184 + // 监控起始人员的变化
  2185 + attr.$observe("rystartvalue", function(value) {
  2186 + if (value && value != "") {
  2187 + scope[ctrlAs].$$dataSelectedStart = value - 1;
  2188 + scope[ctrlAs].$$data_rystart_first_init = true;
  2189 + }
  2190 + });
  2191 +
  2192 +
  2193 +
  2194 + }
  2195 + }
  2196 +
  2197 + }
  2198 + }
  2199 + }
  2200 +]);
  2201 +
... ...