Commit 69932f978261fb399862ce04ad60f5ee023b9c2d

Authored by 徐烜
2 parents be363bc7 b9150b56

PSM-12

Showing 31 changed files with 4976 additions and 4183 deletions
src/main/resources/static/pages/scheduleApp/Gruntfile.js
@@ -9,343 +9,375 @@ module.exports = function (grunt) { @@ -9,343 +9,375 @@ module.exports = function (grunt) {
9 9
10 // clean清除插件配置 10 // clean清除插件配置
11 clean: { 11 clean: {
12 - demo: { // demo模块  
13 - src: ['app/demo/tmp/', 'app/demo/dist/']  
14 - },  
15 - busInfoManage: { // 车辆信息管理模块  
16 - src: ['app/basicInfo/busInfoManage/tmp/', 'app/basicInfo/busInfoManage/dist/']  
17 - },  
18 - deviceInfoManage: { // 设备信息管理模块  
19 - src: ['app/basicInfo/deviceInfoManage/tmp/', 'app/basicInfo/deviceInfoManage/dist/']  
20 - },  
21 - employeeInfoManage: { // 人员信息管理模块  
22 - src: ['app/basicInfo/employeeInfoManage/tmp/', 'app/basicInfo/employeeInfoManage/dist/']  
23 - },  
24 - busConfig: { // 车辆配置模块  
25 - src: ['app/core/busConfig/tmp/', 'app/core/busConfig/dist/']  
26 - },  
27 - busLineInfoOverview: { // 线路运营概览模块  
28 - src: ['app/core/busLineInfoOverview/tmp/', 'app/core/busLineInfoOverview/dist/']  
29 - },  
30 - dispatchManage: { // 调派管理模块  
31 - src: ['app/core/dispatchManage/tmp/', 'app/core/dispatchManage/dist/']  
32 - },  
33 - employeeConfig: { // 人员配置模块  
34 - src: ['app/core/employeeConfig/tmp/', 'app/core/employeeConfig/dist/']  
35 - },  
36 - guideboardManage: { // 路牌管理模块  
37 - src: ['app/core/guideboardManage/tmp/', 'app/core/guideboardManage/dist/']  
38 - },  
39 - rerunManage: { // 套跑管理模块  
40 - src: ['app/core/rerunManage/tmp/', 'app/core/rerunManage/dist/']  
41 - },  
42 - schedulePlanManage: { // 排班计划管理模块  
43 - src: ['app/core/schedulePlanManage/tmp/', 'app/core/schedulePlanManage/dist/']  
44 - },  
45 - scheduleRuleManage: { // 排班规则管理模块  
46 - src: ['app/core/scheduleRuleManage/tmp/', 'app/core/scheduleRuleManage/dist/']  
47 - },  
48 - timeTableManage: { // 时刻表管理模块  
49 - src: ['app/core/timeTableManage/tmp/', 'app/core/timeTableManage/dist/'] 12 + concat_directive: { // 所有指令合并的js文件
  13 + src: ['module/common/prj-common-directive.js']
50 } 14 }
  15 +
  16 + //,
  17 + //
  18 + //demo: { // demo模块
  19 + // src: ['app/demo/tmp/', 'app/demo/dist/']
  20 + //},
  21 + //busInfoManage: { // 车辆信息管理模块
  22 + // src: ['app/basicInfo/busInfoManage/tmp/', 'app/basicInfo/busInfoManage/dist/']
  23 + //},
  24 + //deviceInfoManage: { // 设备信息管理模块
  25 + // src: ['app/basicInfo/deviceInfoManage/tmp/', 'app/basicInfo/deviceInfoManage/dist/']
  26 + //},
  27 + //employeeInfoManage: { // 人员信息管理模块
  28 + // src: ['app/basicInfo/employeeInfoManage/tmp/', 'app/basicInfo/employeeInfoManage/dist/']
  29 + //},
  30 + //busConfig: { // 车辆配置模块
  31 + // src: ['app/core/busConfig/tmp/', 'app/core/busConfig/dist/']
  32 + //},
  33 + //busLineInfoOverview: { // 线路运营概览模块
  34 + // src: ['app/core/busLineInfoOverview/tmp/', 'app/core/busLineInfoOverview/dist/']
  35 + //},
  36 + //dispatchManage: { // 调派管理模块
  37 + // src: ['app/core/dispatchManage/tmp/', 'app/core/dispatchManage/dist/']
  38 + //},
  39 + //employeeConfig: { // 人员配置模块
  40 + // src: ['app/core/employeeConfig/tmp/', 'app/core/employeeConfig/dist/']
  41 + //},
  42 + //guideboardManage: { // 路牌管理模块
  43 + // src: ['app/core/guideboardManage/tmp/', 'app/core/guideboardManage/dist/']
  44 + //},
  45 + //rerunManage: { // 套跑管理模块
  46 + // src: ['app/core/rerunManage/tmp/', 'app/core/rerunManage/dist/']
  47 + //},
  48 + //schedulePlanManage: { // 排班计划管理模块
  49 + // src: ['app/core/schedulePlanManage/tmp/', 'app/core/schedulePlanManage/dist/']
  50 + //},
  51 + //scheduleRuleManage: { // 排班规则管理模块
  52 + // src: ['app/core/scheduleRuleManage/tmp/', 'app/core/scheduleRuleManage/dist/']
  53 + //},
  54 + //timeTableManage: { // 时刻表管理模块
  55 + // src: ['app/core/timeTableManage/tmp/', 'app/core/timeTableManage/dist/']
  56 + //}
51 }, 57 },
52 58
53 - // unglify压缩插件配置  
54 - uglify: {  
55 - demo: { // demo模块  
56 - files: {  
57 - 'app/demo/dist/demo1.min.js': ['app/demo/demo1.js']  
58 - }  
59 - },  
60 - busInfoManage: { // 车辆信息管理模块  
61 - files: {  
62 - // TODO:  
63 - }  
64 - },  
65 - deviceInfoManage: { // 设备信息管理模块  
66 - files: {  
67 - // TODO:  
68 - }  
69 - },  
70 - employeeInfoManage: { // 人员信息管理模块  
71 - files: {  
72 - // TODO:  
73 - }  
74 - },  
75 - busConfig: { // 车辆配置模块  
76 - files: {  
77 - 'app/core/busConfig/dist/service.min.js': ['app/core/busConfig/service.js'],  
78 - 'app/core/busConfig/dist/controller.min.js': ['app/core/busConfig/controller.js']  
79 - }  
80 - },  
81 - busLineInfoOverview: { // 线路运营概览模块  
82 - files: {  
83 - 'app/core/busLineInfoOverview/dist/service.min.js': ['app/core/busLineInfoOverview/service.js'],  
84 - 'app/core/busLineInfoOverview/dist/controller.min.js': ['app/core/busLineInfoOverview/controller.js']  
85 - }  
86 - },  
87 - dispatchManage: { // 调派管理模块  
88 - files: {  
89 - // TODO:  
90 - }  
91 - },  
92 - employeeConfig: { // 人员配置模块  
93 - files: {  
94 - 'app/core/employeeConfig/dist/service.min.js': ['app/core/employeeConfig/service.js'],  
95 - 'app/core/employeeConfig/dist/controller.min.js': ['app/core/employeeConfig/controller.js']  
96 - }  
97 - },  
98 - guideboardManage: { // 路牌管理模块  
99 - files: {  
100 - 'app/core/guideboardManage/dist/service.min.js': ['app/core/guideboardManage/service.js'],  
101 - 'app/core/guideboardManage/dist/controller.min.js': ['app/core/guideboardManage/controller.js']  
102 - }  
103 - },  
104 - rerunManage: { // 套跑管理模块  
105 - files: {  
106 - // TODO:  
107 - }  
108 - },  
109 - schedulePlanManage: { // 排班计划管理模块  
110 - files: {  
111 - // TODO:  
112 - }  
113 - },  
114 - scheduleRuleManage: { // 排班规则管理模块  
115 - files: {  
116 - // TODO:  
117 - }  
118 - },  
119 - timeTableManage: { // 时刻表管理模块  
120 - files: {  
121 - 'app/core/timeTableManage/dist/service.min.js': ['app/core/timeTableManage/service.js'],  
122 - 'app/core/timeTableManage/dist/controller.min.js': ['app/core/timeTableManage/controller.js']  
123 - } 59 + // concat合并文件插件配置
  60 + concat: {
  61 + directive: {
  62 + options: {
  63 + banner: '//自定义指令'
  64 + },
  65 + src: [
  66 + 'module/common/dts1/load/loadingWidget.js', // loading界面指令
  67 + 'module/common/dts1/validation/remoteValidaton.js',// 服务端验证指令
  68 + 'module/common/dts1/select/saSelect.js', // select整合指令1
  69 + 'module/common/dts1/select/saSelect2.js', // select整合指令2
  70 + 'module/common/dts1/select/saSelect3.js', // select整合指令3
  71 + 'module/common/dts1/select/saSelect4.js', // select整合指令4
  72 + 'module/common/dts1/select/saSelect5.js', // select整合指令5
  73 + 'module/common/dts1/radioButton/saRadiogroup.js', // 单选框组整合指令
  74 + 'module/common/dts1/checkbox/saCheckboxgroup.js', // 多选框组整合指令
  75 + 'module/common/dts2/dateGroup/saDategroup.js', // 特殊日期选择指令
  76 + 'module/common/dts2/guideboardGroup/saGuideboardgroup.js', // 路牌选择整合指令
  77 + 'module/common/dts2/employeeGroup/saEmployeegroup.js', // 人员选饿整合指令
  78 + 'module/common/dts2/bcGroup/saBcgroup.js' // 班次选择整合指令
  79 + ],
  80 + dest: 'module/common/prj-common-directive.js'
124 } 81 }
125 }, 82 },
126 83
  84 + // unglify压缩插件配置
  85 + //uglify: {
  86 + // demo: { // demo模块
  87 + // files: {
  88 + // 'app/demo/dist/demo1.min.js': ['app/demo/demo1.js']
  89 + // }
  90 + // },
  91 + // busInfoManage: { // 车辆信息管理模块
  92 + // files: {
  93 + // // TODO:
  94 + // }
  95 + // },
  96 + // deviceInfoManage: { // 设备信息管理模块
  97 + // files: {
  98 + // // TODO:
  99 + // }
  100 + // },
  101 + // employeeInfoManage: { // 人员信息管理模块
  102 + // files: {
  103 + // // TODO:
  104 + // }
  105 + // },
  106 + // busConfig: { // 车辆配置模块
  107 + // files: {
  108 + // 'app/core/busConfig/dist/service.min.js': ['app/core/busConfig/service.js'],
  109 + // 'app/core/busConfig/dist/controller.min.js': ['app/core/busConfig/controller.js']
  110 + // }
  111 + // },
  112 + // busLineInfoOverview: { // 线路运营概览模块
  113 + // files: {
  114 + // 'app/core/busLineInfoOverview/dist/service.min.js': ['app/core/busLineInfoOverview/service.js'],
  115 + // 'app/core/busLineInfoOverview/dist/controller.min.js': ['app/core/busLineInfoOverview/controller.js']
  116 + // }
  117 + // },
  118 + // dispatchManage: { // 调派管理模块
  119 + // files: {
  120 + // // TODO:
  121 + // }
  122 + // },
  123 + // employeeConfig: { // 人员配置模块
  124 + // files: {
  125 + // 'app/core/employeeConfig/dist/service.min.js': ['app/core/employeeConfig/service.js'],
  126 + // 'app/core/employeeConfig/dist/controller.min.js': ['app/core/employeeConfig/controller.js']
  127 + // }
  128 + // },
  129 + // guideboardManage: { // 路牌管理模块
  130 + // files: {
  131 + // 'app/core/guideboardManage/dist/service.min.js': ['app/core/guideboardManage/service.js'],
  132 + // 'app/core/guideboardManage/dist/controller.min.js': ['app/core/guideboardManage/controller.js']
  133 + // }
  134 + // },
  135 + // rerunManage: { // 套跑管理模块
  136 + // files: {
  137 + // // TODO:
  138 + // }
  139 + // },
  140 + // schedulePlanManage: { // 排班计划管理模块
  141 + // files: {
  142 + // // TODO:
  143 + // }
  144 + // },
  145 + // scheduleRuleManage: { // 排班规则管理模块
  146 + // files: {
  147 + // // TODO:
  148 + // }
  149 + // },
  150 + // timeTableManage: { // 时刻表管理模块
  151 + // files: {
  152 + // 'app/core/timeTableManage/dist/service.min.js': ['app/core/timeTableManage/service.js'],
  153 + // 'app/core/timeTableManage/dist/controller.min.js': ['app/core/timeTableManage/controller.js']
  154 + // }
  155 + // }
  156 + //},
  157 +
127 // replace文本替换插件配置 158 // replace文本替换插件配置
128 - replace: {  
129 - demo: { // demo模块  
130 - src: ["app/demo/demo1.html"],  
131 - dest: "app/demo/tmp/",  
132 - "replacements": [{  
133 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
134 - to: '$1dist/$2.min$3'  
135 - }]  
136 - },  
137 - busInfoManage: { // 车辆信息管理模块  
138 - src: ["app/basicInfo/busInfoManage/busInfoManage.html"],  
139 - dest: "app/basicInfo/busInfoManage/tmp/",  
140 - "replacements": [{  
141 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
142 - to: '$1dist/$2.min$3'  
143 - }]  
144 - },  
145 - deviceInfoManage: { // 设备信息管理模块  
146 - src: ["app/basicInfo/deviceInfoManage/deviceInfoManage.html"],  
147 - dest: "app/basicInfo/deviceInfoManage/tmp/",  
148 - "replacements": [{  
149 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
150 - to: '$1dist/$2.min$3'  
151 - }]  
152 - },  
153 - employeeInfoManage: { // 人员信息管理  
154 - src: ["app/basicInfo/employeeInfoManage/employeeInfoManage.html"],  
155 - dest: "app/basicInfo/employeeInfoManage/tmp/",  
156 - "replacements": [{  
157 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
158 - to: '$1dist/$2.min$3'  
159 - }]  
160 - },  
161 - busConfig: { // 车辆配置模块  
162 - src: ["app/core/busConfig/busConfig.html"],  
163 - dest: "app/core/busConfig/tmp/",  
164 - "replacements": [{  
165 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
166 - to: '$1dist/$2.min$3'  
167 - }]  
168 - },  
169 - busLineInfoOverview: { // 线路运营概览模块  
170 - src: ["app/core/busLineInfoOverview/busLineInfoOverview.html"],  
171 - dest: "app/core/busLineInfoOverview/tmp/",  
172 - "replacements": [{  
173 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
174 - to: '$1dist/$2.min$3'  
175 - }]  
176 - },  
177 - dispatchManage: { // 调派管理模块  
178 - src: ["app/core/dispatchManage/dispatchManage.html"],  
179 - dest: "app/core/dispatchManage/tmp/",  
180 - "replacements": [{  
181 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
182 - to: '$1dist/$2.min$3'  
183 - }]  
184 - },  
185 - employeeConfig: { // 人员配置模块  
186 - src: ["app/core/employeeConfig/employeeConfig.html"],  
187 - dest: "app/core/employeeConfig/tmp/",  
188 - "replacements": [{  
189 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
190 - to: '$1dist/$2.min$3'  
191 - }]  
192 - },  
193 - guideboardManage: { // 路牌管理模块  
194 - src: ["app/core/guideboardManage/guideboardManage.html"],  
195 - dest: "app/core/guideboardManage/tmp/",  
196 - "replacements": [{  
197 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
198 - to: '$1dist/$2.min$3'  
199 - }]  
200 - },  
201 - rerunManage: { // 套跑管理模块  
202 - src: ["app/core/rerunManage/rerunManage.html"],  
203 - dest: "app/core/rerunManage/tmp/",  
204 - "replacements": [{  
205 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
206 - to: '$1dist/$2.min$3'  
207 - }]  
208 - },  
209 - schedulePlanManage: { // 排班计划管理模块  
210 - src: ["app/core/schedulePlanManage/schedulePlanManage.html"],  
211 - dest: "app/core/schedulePlanManage/tmp/",  
212 - "replacements": [{  
213 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
214 - to: '$1dist/$2.min$3'  
215 - }]  
216 - },  
217 - scheduleRuleManage: { // 排班规则管理模块  
218 - src: ["app/core/scheduleRuleManage/scheduleRuleManage.html"],  
219 - dest: "app/core/scheduleRuleManage/tmp/",  
220 - "replacements": [{  
221 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
222 - to: '$1dist/$2.min$3'  
223 - }]  
224 - },  
225 - timeTableManage: { // 时刻表管理模块  
226 - src: ["app/core/timeTableManage/timeTableManage.html"],  
227 - dest: "app/core/timeTableManage/tmp/",  
228 - "replacements": [{  
229 - from: /(<script src=\")([^\"]*?)(.js\")/mg,  
230 - to: '$1dist/$2.min$3'  
231 - }]  
232 - }  
233 - }, 159 + //replace: {
  160 + // demo: { // demo模块
  161 + // src: ["app/demo/demo1.html"],
  162 + // dest: "app/demo/tmp/",
  163 + // "replacements": [{
  164 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  165 + // to: '$1dist/$2.min$3'
  166 + // }]
  167 + // },
  168 + // busInfoManage: { // 车辆信息管理模块
  169 + // src: ["app/basicInfo/busInfoManage/busInfoManage.html"],
  170 + // dest: "app/basicInfo/busInfoManage/tmp/",
  171 + // "replacements": [{
  172 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  173 + // to: '$1dist/$2.min$3'
  174 + // }]
  175 + // },
  176 + // deviceInfoManage: { // 设备信息管理模块
  177 + // src: ["app/basicInfo/deviceInfoManage/deviceInfoManage.html"],
  178 + // dest: "app/basicInfo/deviceInfoManage/tmp/",
  179 + // "replacements": [{
  180 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  181 + // to: '$1dist/$2.min$3'
  182 + // }]
  183 + // },
  184 + // employeeInfoManage: { // 人员信息管理
  185 + // src: ["app/basicInfo/employeeInfoManage/employeeInfoManage.html"],
  186 + // dest: "app/basicInfo/employeeInfoManage/tmp/",
  187 + // "replacements": [{
  188 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  189 + // to: '$1dist/$2.min$3'
  190 + // }]
  191 + // },
  192 + // busConfig: { // 车辆配置模块
  193 + // src: ["app/core/busConfig/busConfig.html"],
  194 + // dest: "app/core/busConfig/tmp/",
  195 + // "replacements": [{
  196 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  197 + // to: '$1dist/$2.min$3'
  198 + // }]
  199 + // },
  200 + // busLineInfoOverview: { // 线路运营概览模块
  201 + // src: ["app/core/busLineInfoOverview/busLineInfoOverview.html"],
  202 + // dest: "app/core/busLineInfoOverview/tmp/",
  203 + // "replacements": [{
  204 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  205 + // to: '$1dist/$2.min$3'
  206 + // }]
  207 + // },
  208 + // dispatchManage: { // 调派管理模块
  209 + // src: ["app/core/dispatchManage/dispatchManage.html"],
  210 + // dest: "app/core/dispatchManage/tmp/",
  211 + // "replacements": [{
  212 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  213 + // to: '$1dist/$2.min$3'
  214 + // }]
  215 + // },
  216 + // employeeConfig: { // 人员配置模块
  217 + // src: ["app/core/employeeConfig/employeeConfig.html"],
  218 + // dest: "app/core/employeeConfig/tmp/",
  219 + // "replacements": [{
  220 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  221 + // to: '$1dist/$2.min$3'
  222 + // }]
  223 + // },
  224 + // guideboardManage: { // 路牌管理模块
  225 + // src: ["app/core/guideboardManage/guideboardManage.html"],
  226 + // dest: "app/core/guideboardManage/tmp/",
  227 + // "replacements": [{
  228 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  229 + // to: '$1dist/$2.min$3'
  230 + // }]
  231 + // },
  232 + // rerunManage: { // 套跑管理模块
  233 + // src: ["app/core/rerunManage/rerunManage.html"],
  234 + // dest: "app/core/rerunManage/tmp/",
  235 + // "replacements": [{
  236 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  237 + // to: '$1dist/$2.min$3'
  238 + // }]
  239 + // },
  240 + // schedulePlanManage: { // 排班计划管理模块
  241 + // src: ["app/core/schedulePlanManage/schedulePlanManage.html"],
  242 + // dest: "app/core/schedulePlanManage/tmp/",
  243 + // "replacements": [{
  244 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  245 + // to: '$1dist/$2.min$3'
  246 + // }]
  247 + // },
  248 + // scheduleRuleManage: { // 排班规则管理模块
  249 + // src: ["app/core/scheduleRuleManage/scheduleRuleManage.html"],
  250 + // dest: "app/core/scheduleRuleManage/tmp/",
  251 + // "replacements": [{
  252 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  253 + // to: '$1dist/$2.min$3'
  254 + // }]
  255 + // },
  256 + // timeTableManage: { // 时刻表管理模块
  257 + // src: ["app/core/timeTableManage/timeTableManage.html"],
  258 + // dest: "app/core/timeTableManage/tmp/",
  259 + // "replacements": [{
  260 + // from: /(<script src=\")([^\"]*?)(.js\")/mg,
  261 + // to: '$1dist/$2.min$3'
  262 + // }]
  263 + // }
  264 + //},
234 265
235 // static-inline静态文件插入替换插件配置 266 // static-inline静态文件插入替换插件配置
236 - staticinline: {  
237 - demo: { // demo模块  
238 - options: {  
239 - basepath: 'app/demo/' // 查找路径  
240 - },  
241 - files: {  
242 - 'app/demo/dist/demo1.dist.html': 'app/demo/tmp/demo1.html'  
243 - }  
244 - },  
245 - busInfoManage: { // 车辆信息管理模块  
246 - options: {  
247 - basepath: 'app/basicInfo/busInfoManage'  
248 - },  
249 - files: {  
250 - 'app/basicInfo/busInfoManage/dist/busInfoManage.dist.html': 'app/basicInfo/busInfoManage/tmp/busInfoManage.html'  
251 - }  
252 - },  
253 - deviceInfoManage: { // 设备信息管理模块  
254 - options: {  
255 - basepath: 'app/basicInfo/deviceInfoManage'  
256 - },  
257 - files: {  
258 - 'app/basicInfo/deviceInfoManage/dist/deviceInfoManage.dist.html': 'app/basicInfo/deviceInfoManage/tmp/deviceInfoManage.html'  
259 - }  
260 - },  
261 - employeeInfoManage: { // 人员信息管理  
262 - options: {  
263 - basepath: 'app/basicInfo/employeeInfoManage'  
264 - },  
265 - files: {  
266 - 'app/basicInfo/employeeInfoManage/dist/employeeInfoManage.dist.html': 'app/basicInfo/employeeInfoManage/tmp/employeeInfoManage.html'  
267 - }  
268 - },  
269 - busConfig: { // 车辆配置模块  
270 - options: {  
271 - basepath: 'app/core/busConfig/'  
272 - },  
273 - files: {  
274 - 'app/core/busConfig/dist/busConfig.dist.html': 'app/core/busConfig/tmp/busConfig.html'  
275 - }  
276 - },  
277 - busLineInfoOverview: { // 线路运营概览模块  
278 - options: {  
279 - basepath: 'app/core/busLineInfoOverview/'  
280 - },  
281 - files: {  
282 - 'app/core/busLineInfoOverview/dist/busLineInfoOverview.dist.html': 'app/core/busLineInfoOverview/tmp/busLineInfoOverview.html'  
283 - }  
284 - },  
285 - dispatchManage: { // 调派管理模块  
286 - options: {  
287 - basepath: 'app/core/dispatchManage'  
288 - },  
289 - files: {  
290 - 'app/core/dispatchManage/dist/dispatchManage.dist.html': 'app/core/dispatchManage/tmp/dispatchManage.html'  
291 - }  
292 - },  
293 - employeeConfig: { // 人员配置模块  
294 - options: {  
295 - basepath: 'app/core/employeeConfig/'  
296 - },  
297 - files: {  
298 - 'app/core/employeeConfig/dist/employeeConfig.dist.html': 'app/core/employeeConfig/tmp/employeeConfig.html'  
299 - }  
300 - },  
301 - guideboardManage: { // 路牌管理模块  
302 - options: {  
303 - basepath: 'app/core/guideboardManage/'  
304 - },  
305 - files: {  
306 - 'app/core/guideboardManage/dist/guideboardManage.dist.html': 'app/core/guideboardManage/tmp/guideboardManage.html'  
307 - }  
308 - },  
309 - rerunManage: { // 套跑管理模块  
310 - options: {  
311 - basepath: 'app/core/rerunManage'  
312 - },  
313 - files: {  
314 - 'app/core/rerunManage/dist/rerunManage.dist.html': 'app/core/rerunManage/tmp/rerunManage.html'  
315 - }  
316 - },  
317 - schedulePlanManage: { // 排版计划管理模块  
318 - options: {  
319 - basepath: 'app/core/schedulePlanManage'  
320 - },  
321 - files: {  
322 - 'app/core/schedulePlanManage/dist/schedulePlanManage.dist.html': 'app/core/schedulePlanManage/tmp/schedulePlanManage.html'  
323 - }  
324 - },  
325 - scheduleRuleManage: { // 排班规则管理模块  
326 - options: {  
327 - basepath: 'app/core/scheduleRuleManage'  
328 - },  
329 - files: {  
330 - 'app/core/scheduleRuleManage/dist/scheduleRuleManage.dist.html': 'app/core/scheduleRuleManage/tmp/scheduleRuleManage.html'  
331 - }  
332 - },  
333 - timeTableManage: { // 时刻表管理模块  
334 - options: {  
335 - basepath: 'app/core/timeTableManage/'  
336 - },  
337 - files: {  
338 - 'app/core/timeTableManage/dist/timeTableManage.html': 'app/core/timeTableManage/tmp/timeTableManage.html',  
339 - 'app/core/timeTableManage/dist/timeTableList.html': 'app/core/timeTableManage/timeTableList.html',  
340 - 'app/core/timeTableManage/dist/timeTableDetail.html': 'app/core/timeTableManage/timeTableDetail.html'  
341 - }  
342 - }  
343 - } 267 + //staticinline: {
  268 + // demo: { // demo模块
  269 + // options: {
  270 + // basepath: 'app/demo/' // 查找路径
  271 + // },
  272 + // files: {
  273 + // 'app/demo/dist/demo1.dist.html': 'app/demo/tmp/demo1.html'
  274 + // }
  275 + // },
  276 + // busInfoManage: { // 车辆信息管理模块
  277 + // options: {
  278 + // basepath: 'app/basicInfo/busInfoManage'
  279 + // },
  280 + // files: {
  281 + // 'app/basicInfo/busInfoManage/dist/busInfoManage.dist.html': 'app/basicInfo/busInfoManage/tmp/busInfoManage.html'
  282 + // }
  283 + // },
  284 + // deviceInfoManage: { // 设备信息管理模块
  285 + // options: {
  286 + // basepath: 'app/basicInfo/deviceInfoManage'
  287 + // },
  288 + // files: {
  289 + // 'app/basicInfo/deviceInfoManage/dist/deviceInfoManage.dist.html': 'app/basicInfo/deviceInfoManage/tmp/deviceInfoManage.html'
  290 + // }
  291 + // },
  292 + // employeeInfoManage: { // 人员信息管理
  293 + // options: {
  294 + // basepath: 'app/basicInfo/employeeInfoManage'
  295 + // },
  296 + // files: {
  297 + // 'app/basicInfo/employeeInfoManage/dist/employeeInfoManage.dist.html': 'app/basicInfo/employeeInfoManage/tmp/employeeInfoManage.html'
  298 + // }
  299 + // },
  300 + // busConfig: { // 车辆配置模块
  301 + // options: {
  302 + // basepath: 'app/core/busConfig/'
  303 + // },
  304 + // files: {
  305 + // 'app/core/busConfig/dist/busConfig.dist.html': 'app/core/busConfig/tmp/busConfig.html'
  306 + // }
  307 + // },
  308 + // busLineInfoOverview: { // 线路运营概览模块
  309 + // options: {
  310 + // basepath: 'app/core/busLineInfoOverview/'
  311 + // },
  312 + // files: {
  313 + // 'app/core/busLineInfoOverview/dist/busLineInfoOverview.dist.html': 'app/core/busLineInfoOverview/tmp/busLineInfoOverview.html'
  314 + // }
  315 + // },
  316 + // dispatchManage: { // 调派管理模块
  317 + // options: {
  318 + // basepath: 'app/core/dispatchManage'
  319 + // },
  320 + // files: {
  321 + // 'app/core/dispatchManage/dist/dispatchManage.dist.html': 'app/core/dispatchManage/tmp/dispatchManage.html'
  322 + // }
  323 + // },
  324 + // employeeConfig: { // 人员配置模块
  325 + // options: {
  326 + // basepath: 'app/core/employeeConfig/'
  327 + // },
  328 + // files: {
  329 + // 'app/core/employeeConfig/dist/employeeConfig.dist.html': 'app/core/employeeConfig/tmp/employeeConfig.html'
  330 + // }
  331 + // },
  332 + // guideboardManage: { // 路牌管理模块
  333 + // options: {
  334 + // basepath: 'app/core/guideboardManage/'
  335 + // },
  336 + // files: {
  337 + // 'app/core/guideboardManage/dist/guideboardManage.dist.html': 'app/core/guideboardManage/tmp/guideboardManage.html'
  338 + // }
  339 + // },
  340 + // rerunManage: { // 套跑管理模块
  341 + // options: {
  342 + // basepath: 'app/core/rerunManage'
  343 + // },
  344 + // files: {
  345 + // 'app/core/rerunManage/dist/rerunManage.dist.html': 'app/core/rerunManage/tmp/rerunManage.html'
  346 + // }
  347 + // },
  348 + // schedulePlanManage: { // 排版计划管理模块
  349 + // options: {
  350 + // basepath: 'app/core/schedulePlanManage'
  351 + // },
  352 + // files: {
  353 + // 'app/core/schedulePlanManage/dist/schedulePlanManage.dist.html': 'app/core/schedulePlanManage/tmp/schedulePlanManage.html'
  354 + // }
  355 + // },
  356 + // scheduleRuleManage: { // 排班规则管理模块
  357 + // options: {
  358 + // basepath: 'app/core/scheduleRuleManage'
  359 + // },
  360 + // files: {
  361 + // 'app/core/scheduleRuleManage/dist/scheduleRuleManage.dist.html': 'app/core/scheduleRuleManage/tmp/scheduleRuleManage.html'
  362 + // }
  363 + // },
  364 + // timeTableManage: { // 时刻表管理模块
  365 + // options: {
  366 + // basepath: 'app/core/timeTableManage/'
  367 + // },
  368 + // files: {
  369 + // 'app/core/timeTableManage/dist/timeTableManage.html': 'app/core/timeTableManage/tmp/timeTableManage.html',
  370 + // 'app/core/timeTableManage/dist/timeTableList.html': 'app/core/timeTableManage/timeTableList.html',
  371 + // 'app/core/timeTableManage/dist/timeTableDetail.html': 'app/core/timeTableManage/timeTableDetail.html'
  372 + // }
  373 + // }
  374 + //}
344 375
345 }); 376 });
346 377
347 // grunt加载的插件 378 // grunt加载的插件
348 grunt.loadNpmTasks("grunt-contrib-clean"); 379 grunt.loadNpmTasks("grunt-contrib-clean");
  380 + grunt.loadNpmTasks("grunt-contrib-concat");
349 grunt.loadNpmTasks("grunt-contrib-uglify"); 381 grunt.loadNpmTasks("grunt-contrib-uglify");
350 grunt.loadNpmTasks("grunt-static-inline"); 382 grunt.loadNpmTasks("grunt-static-inline");
351 grunt.loadNpmTasks("grunt-text-replace"); 383 grunt.loadNpmTasks("grunt-text-replace");
@@ -360,6 +392,14 @@ module.exports = function (grunt) { @@ -360,6 +392,14 @@ module.exports = function (grunt) {
360 3、replace 将指定的html文件复制到tmp目录下,将其中的js后缀名替换成.min.js 392 3、replace 将指定的html文件复制到tmp目录下,将其中的js后缀名替换成.min.js
361 4、staticinline 将.min.js的内容inline-内联插入到tmp的html文件中,然后重命名为.dist.html到dist目录中 393 4、staticinline 将.min.js的内容inline-内联插入到tmp的html文件中,然后重命名为.dist.html到dist目录中
362 */ 394 */
363 - grunt.registerTask('default', ['clean', 'uglify', 'replace', 'staticinline']); 395 + //grunt.registerTask('default', ['clean', 'uglify', 'replace', 'staticinline']);
  396 +
  397 + /*
  398 + 定义了一个directive的grunt任务
  399 + 任务组有顺序,如下说明:
  400 + 1、clean:concat_directive,清除合并生成的prj-common-directive.js文件
  401 + 2、concat:directive,重新合并prj-common-directive.js文件
  402 + */
  403 + grunt.registerTask('directive', ['clean:concat_directive', 'concat:directive']);
364 404
365 }; 405 };
366 \ No newline at end of file 406 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroup.js 0 → 100644
  1 +
  2 +
  3 +/**
  4 + * saCheckboxgroup指令
  5 + * 属性如下:
  6 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  7 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  8 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  9 + * name(必须):控件的名字
  10 + * required(可选):是否要用required验证
  11 + * disabled(可选):标示框是否可选
  12 + *
  13 + */
  14 +angular.module('ScheduleApp').directive('saCheckboxgroup', [
  15 + function() {
  16 + return {
  17 + restrict: 'E',
  18 + templateUrl: '/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroupTemplate.html',
  19 + scope: {
  20 + model: "=" // 独立作用域,关联外部的模型object
  21 + },
  22 + controllerAs: "$saCheckboxgroupCtrl",
  23 + bindToController: true,
  24 + controller: function($scope) {
  25 + var self = this;
  26 + self.$$data = []; // 内部的数据
  27 +
  28 + // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
  29 + self.$$data = [
  30 + {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  31 + {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  32 + {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  33 + {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  34 + {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  35 + {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  36 + {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
  37 + ];
  38 + },
  39 +
  40 + /**
  41 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  42 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  43 + * @param tElem
  44 + * @param tAttrs
  45 + * @returns {{pre: Function, post: Function}}
  46 + */
  47 + compile: function(tElem, tAttrs) {
  48 + // 获取所有的属性
  49 + var $name_attr = tAttrs["name"]; // 控件的名字
  50 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  51 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  52 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  53 +
  54 + // controlAs名字
  55 + var ctrlAs = '$saCheckboxgroupCtrl';
  56 +
  57 + // 如果有required属性,添加angularjs required验证
  58 + if ($required_attr != undefined) {
  59 + //console.log(tElem.html());
  60 + tElem.find("div").attr("required", "");
  61 + }
  62 + // 如果有disabled属性,添加禁用标志
  63 + if ($disabled_attr != undefined) {
  64 + tElem.find("input").attr("ng-disabled", "true");
  65 + }
  66 +
  67 + return {
  68 + pre: function(scope, element, attr) {
  69 + // TODO:
  70 + },
  71 + /**
  72 + * 相当于link函数。
  73 + * @param scope
  74 + * @param element
  75 + * @param attr
  76 + */
  77 + post: function(scope, element, attr) {
  78 + // name属性
  79 + if ($name_attr) {
  80 + scope[ctrlAs]["$name_attr"] = $name_attr;
  81 + }
  82 +
  83 + /**
  84 + * checkbox选择事件处理函数。
  85 + * @param $d 数据对象,$$data中的元素对象
  86 + */
  87 + scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
  88 + $d.ischecked = !$d.ischecked;
  89 + console.log($d);
  90 + };
  91 +
  92 + // 测试使用watch监控$$data的变化
  93 + scope.$watch(
  94 + function() {
  95 + return scope[ctrlAs]["$$data"];
  96 + },
  97 + function(newValue, oldValue) {
  98 + // 根据$$data生成对应的数据
  99 + var rule_days_arr = [];
  100 + var i;
  101 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  102 + if (scope[ctrlAs]["$$data"][i].ischecked)
  103 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
  104 + else
  105 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
  106 + }
  107 + scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
  108 + //scope[ctrlAs].$$internalmodel = undefined;
  109 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  110 +
  111 + // 更新model
  112 + if ($dcname_attr) {
  113 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
  114 + }
  115 +
  116 +
  117 + },
  118 + true
  119 + );
  120 +
  121 + // TODO:
  122 +
  123 + // 监控dcvalue model值变换
  124 + attr.$observe("dcvalue", function(value) {
  125 + console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
  126 + if (value) {
  127 + // 根据value值,修改$$data里的值
  128 + var data_array = value.split(",");
  129 + var i;
  130 + if (data_array.length > scope[ctrlAs]["$$data"].length) {
  131 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
  132 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  133 + scope[ctrlAs]["$$data"][i].ischecked = true;
  134 + } else {
  135 + scope[ctrlAs]["$$data"][i].ischecked = false;
  136 + }
  137 + }
  138 + } else {
  139 + for (i = 0; i < data_array.length; i ++) {
  140 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  141 + scope[ctrlAs]["$$data"][i].ischecked = true;
  142 + } else {
  143 + scope[ctrlAs]["$$data"][i].ischecked = false;
  144 + }
  145 + }
  146 + }
  147 +
  148 + }
  149 + });
  150 + }
  151 +
  152 + };
  153 +
  154 +
  155 + }
  156 +
  157 + };
  158 + }
  159 +]);
  160 +
src/main/resources/static/pages/scheduleApp/module/common/dt/MyCheckboxGroupWrapTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroupTemplate.html
src/main/resources/static/pages/scheduleApp/module/common/dts1/load/loadingWidget.js 0 → 100644
  1 +
  2 +/**
  3 + * loading载入中指令。
  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 +}]);
0 \ No newline at end of file 23 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroup.js 0 → 100644
  1 +
  2 +/**
  3 + * saRadiogroup指令
  4 + * 属性如下:
  5 + * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
  6 + * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
  7 + * name(必须):控件的名字
  8 + * required(可选):是否要用required验证
  9 + * disabled(可选):标示单选框是否可选
  10 + *
  11 + */
  12 +angular.module('ScheduleApp').directive("saRadiogroup", [function() {
  13 + /**
  14 + * 使用字典数据的单选按钮组的指令。
  15 + * 指令名称:truefalse-Dic
  16 + */
  17 + return {
  18 + restrict: 'E',
  19 + templateUrl: '/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroupTemplate.html',
  20 + scope: {
  21 + model: "="
  22 + },
  23 + controllerAs: "$saRadiogroupCtrl",
  24 + bindToController: true,
  25 + controller: function($scope) {
  26 + //$scope["model"] = {selectedOption: null};
  27 + //console.log("controller");
  28 + //console.log("controller:" + $scope["model"]);
  29 +
  30 + var self = this;
  31 + self.$$data = null; // 内部数据
  32 + },
  33 +
  34 + /**
  35 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  36 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  37 + * @param tElem
  38 + * @param tAttrs
  39 + * @returns {{pre: Function, post: Function}}
  40 + */
  41 + compile: function(tElem, tAttrs) {
  42 + // 获取属性
  43 + var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
  44 + var $name_attr = tAttrs["name"]; // 控件的名字
  45 + var $required_attr = tAttrs["required"]; // 是否要用required验证
  46 + var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
  47 +
  48 + // controlAs名字
  49 + var ctrlAs = "$saRadiogroupCtrl";
  50 +
  51 + // 如果有required属性,添加angularjs required验证
  52 + if ($required_attr != undefined) {
  53 + tElem.find("input").attr("required", "");
  54 + }
  55 +
  56 + return {
  57 + pre: function(scope, element, attr) {
  58 +
  59 + },
  60 +
  61 + /**
  62 + * 相当于link函数。
  63 + * @param scope
  64 + * @param element
  65 + * @param attr
  66 + */
  67 + post: function(scope, element, attr) {
  68 + //console.log("link");
  69 + //console.log("link:" + scope.model);
  70 + //scope["model"] = {selectedOption: null};
  71 +
  72 + if ($name_attr) {
  73 + scope[ctrlAs].nv = $name_attr;
  74 + }
  75 +
  76 + if ($disabled_attr) {
  77 + scope[ctrlAs].disabled = true;
  78 + }
  79 + if ($dicgroup_attr) {
  80 + var obj = dictionaryUtils.getByGroup($dicgroup_attr);
  81 + scope[ctrlAs].$$data = obj;
  82 + // 处理 scope["dic"] key值
  83 + scope[ctrlAs].dicvalueCalcu = function(value) {
  84 + if (value == "true") {
  85 + //console.log(value);
  86 + return true;
  87 + } else if (value == "false") {
  88 + //console.log(value);
  89 + return false;
  90 + } else {
  91 + return value;
  92 + }
  93 + };
  94 + }
  95 + }
  96 + };
  97 + }
  98 + };
  99 +}]);
src/main/resources/static/pages/scheduleApp/module/common/dt/MyRadioGroupWrapTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroupTemplate.html
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect.js 0 → 100644
  1 +
  2 +angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
  3 + return {
  4 + restrict: 'E',
  5 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelectTemplate.html',
  6 + scope: {
  7 + model: "="
  8 + },
  9 + controllerAs: "$saSelectCtrl",
  10 + bindToController: true,
  11 + controller: function() {
  12 + var self = this;
  13 + self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}
  14 + },
  15 + /**
  16 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  17 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  18 + * @param tElem
  19 + * @param tAttrs
  20 + * @returns {{pre: Function, post: Function}}
  21 + */
  22 + compile: function(tElem, tAttrs) {
  23 + // 确定是否使用angularjs required验证
  24 + // 属性 required
  25 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  26 + var required_attr = tAttrs["required"];
  27 + if (required_attr) {
  28 + if (required_attr == "true") {
  29 + // 添加required属性指令
  30 + tElem.find("ui-select").attr("required", "");
  31 + } else {
  32 + // 不等于true,不添加required属性指令
  33 + }
  34 + } else {
  35 + // 不添加required属性指令
  36 + }
  37 +
  38 + //console.log("saSelect" + ":compile = >" + tElem.html());
  39 +
  40 + return {
  41 + pre: function(scope, element, attr) {
  42 + // TODO:
  43 + },
  44 + /**
  45 + * 相当于link函数。
  46 + *
  47 + * 重要属性如下:
  48 + * model 是绑定外部值。
  49 + * dicgroup 字典组的类型
  50 + * name input name属性值
  51 + */
  52 + post: function(scope, element, attr) {
  53 + // 1、获取属性
  54 + var dicgroup_attr = attr['dicgroup']; // 字典组的类型
  55 + var name_attr = attr['name']; // input name属性值
  56 + var dicname_attr = attr['dicname']; // model关联的字典名字段
  57 + var codename_attr = attr['codename']; // model关联的字典值字段
  58 + var placeholder_attr = attr['placeholder']; // select placeholder提示
  59 +
  60 + // 系统的字典对象,使用dictionaryUtils类获取
  61 + var origin_dicgroup;
  62 + var dic_key; // 字典key
  63 +
  64 + if (dicgroup_attr) { // 赋值指定的字典数据
  65 + origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);
  66 + for (dic_key in origin_dicgroup) {
  67 + var data = {}; // 重新组合的字典元素对象
  68 + if (dic_key == "true")
  69 + data.code = true;
  70 + else
  71 + data.code = dic_key;
  72 + data.name = origin_dicgroup[dic_key];
  73 + scope["$saSelectCtrl"].datas.push(data);
  74 + }
  75 + }
  76 +
  77 + if (name_attr) {
  78 + scope["$saSelectCtrl"].nv = name_attr;
  79 + }
  80 + if (placeholder_attr) {
  81 + scope["$saSelectCtrl"].ph = placeholder_attr;
  82 + }
  83 +
  84 + scope["$saSelectCtrl"].select = function($item) {
  85 + if (codename_attr) {
  86 + scope["$saSelectCtrl"].model[codename_attr] = $item.code;
  87 + }
  88 + if (dicname_attr) {
  89 + scope["$saSelectCtrl"].model[dicname_attr] = $item.name;
  90 + }
  91 + };
  92 +
  93 + scope["$saSelectCtrl"].remove = function() {
  94 + if (codename_attr) {
  95 + scope["$saSelectCtrl"].model[codename_attr] = null;
  96 + }
  97 + if (dicname_attr) {
  98 + scope["$saSelectCtrl"].model[dicname_attr] = null;
  99 + }
  100 + scope["$saSelectCtrl"].cmodel = null;
  101 + };
  102 +
  103 + $timeout(function() {
  104 + // 创建内部使用的绑定对象
  105 + var model_code = scope["$saSelectCtrl"].model[codename_attr];
  106 + scope["$saSelectCtrl"].cmodel = model_code;
  107 + }, 0);
  108 + }
  109 + }
  110 + }
  111 + };
  112 +}]);
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect2.js 0 → 100644
  1 +
  2 +
  3 +angular.module('ScheduleApp').directive("saSelect2", [
  4 + '$timeout', '$$SearchInfoService_g',
  5 + function($timeout, $$searchInfoService_g) {
  6 + return {
  7 + restrict: 'E',
  8 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect2Template.html',
  9 + scope: {
  10 + model: "=" // 独立作用域,关联外部的模型对象
  11 + },
  12 + controllerAs: "$saSelectCtrl",
  13 + bindToController: true,
  14 + controller: function($scope) {
  15 + var self = this;
  16 + self.$$data = []; // 内部关联的数据
  17 + },
  18 + /**
  19 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  20 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  21 + * @param tElem
  22 + * @param tAttrs
  23 + * @returns {{pre: Function, post: Function}}
  24 + */
  25 + compile: function(tElem, tAttrs) {
  26 + // 1、获取此阶段使用的属性
  27 + var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
  28 +
  29 + // 2、处理属性
  30 +
  31 + // 确定是否使用angularjs required验证
  32 + // 属性 required
  33 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  34 + if ($required_attr) {
  35 + if ($required_attr == "true") {
  36 + // 添加required属性指令
  37 + tElem.find("ui-select").attr("required", "");
  38 + } else {
  39 + // 不等于true,不添加required属性指令
  40 + }
  41 + } else {
  42 + // 不添加required属性指令
  43 + }
  44 +
  45 + //console.log("saSelect" + ":compile = >" + tElem.html());
  46 +
  47 + return {
  48 + pre: function(scope, element, attr) {
  49 + // TODO:
  50 + },
  51 + /**
  52 + * 相当于link函数。
  53 + *
  54 + * 重要属性如下:
  55 + * model 是绑定外部值。
  56 + * dicgroup 字典组的类型
  57 + * name input name属性值
  58 + */
  59 + post: function(scope, element, attr) {
  60 + // 1、获取此阶段使用的属性
  61 + var $name_attr = attr["name"]; // 表单验证时需要的名字
  62 + var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  63 + var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
  64 + var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
  65 + var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
  66 + var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
  67 + var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
  68 + var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
  69 +
  70 + // 2、处理属性、转换成$saSelectCtrl内部使用的属性
  71 + if ($name_attr) {
  72 + scope["$saSelectCtrl"].$name_attr = $name_attr;
  73 + }
  74 + if ($placeholder_attr) {
  75 + scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
  76 + }
  77 + if ($showcolname_attr) {
  78 + scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
  79 + }
  80 +
  81 + // 2-1、添加内部方法,根据type值,改变$$data的值
  82 + scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
  83 + // 根据type属性动态载入数据
  84 + if ($type_attr) {
  85 + $$searchInfoService_g[$type_attr].list(
  86 + {type: "all"},
  87 + function(result) {
  88 + scope["$saSelectCtrl"].$$data = [];
  89 + for (var i = 0; i < result.length; i ++) {
  90 + var data = {}; // data是result的一部分属性集合,根据配置来确定
  91 + if ($datacolname1_attr) {
  92 + data[$datacolname1_attr] = result[i][$datacolname1_attr];
  93 + }
  94 + if ($datacolname2_attr) {
  95 + data[$datacolname2_attr] = result[i][$datacolname2_attr];
  96 + }
  97 + if ($showcolname_attr) {
  98 + // 动态添加基于名字的拼音
  99 + data[$showcolname_attr] = result[i][$showcolname_attr];
  100 + if (data[$showcolname_attr]) {
  101 + data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
  102 + data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
  103 + }
  104 + }
  105 + if (data["fullChars"])
  106 + scope["$saSelectCtrl"].$$data.push(data);
  107 + }
  108 + },
  109 + function(result) {
  110 +
  111 + }
  112 + );
  113 + }
  114 + };
  115 +
  116 + // 3、选择、删除事件映射模型和内部数据对应的字段
  117 + scope["$saSelectCtrl"].$select_fn_attr = function($item) {
  118 + if ($modelcolname1_attr && $datacolname1_attr) {
  119 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];
  120 + }
  121 + if ($modelcolname2_attr && $datacolname2_attr) {
  122 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];
  123 + }
  124 + };
  125 + scope["$saSelectCtrl"].$remove_fn_attr = function() {
  126 + if ($modelcolname1_attr) {
  127 + scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;
  128 + }
  129 + if ($modelcolname2_attr) {
  130 + scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;
  131 + }
  132 + scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空
  133 +
  134 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  135 + };
  136 +
  137 + // 4、搜索事件
  138 + scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {
  139 + //var fullChars = pinyin.getFullChars($search).toUpperCase();
  140 + //var camelChars = pinyin.getCamelChars($search);
  141 + //
  142 + //console.log(fullChars + " " + camelChars);
  143 + // TODO:事件暂时没用,放着以后再说
  144 + };
  145 +
  146 + // 5、全部载入后,输入的
  147 + $timeout(function() {
  148 + // 创建内部使用的绑定对象,用于确认选中那个值
  149 + scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];
  150 +
  151 + scope["$saSelectCtrl"].$$internal_data_change_fn();
  152 + }, 0);
  153 + }
  154 + }
  155 + }
  156 + };
  157 + }
  158 +]);
  159 +
src/main/resources/static/pages/scheduleApp/module/other/MySearchSelectTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect2Template.html
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect3.js 0 → 100644
  1 +
  2 +
  3 +
  4 +/**
  5 + * saSelect3指令
  6 + * 属性如下:
  7 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  8 + * name(必须):控件的名字
  9 + * placeholder(可选):占位符字符串
  10 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  11 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  12 + * icname(必须):内部与之对应的字段名,如:icname=code
  13 + * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
  14 + * icname2(可选):内部与之对应的字段名2,如:icname2=name
  15 + * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
  16 + * icname3(可选):内部与之对应的字段名3,如:icname2=name
  17 + * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
  18 + * required(可选):是否要用required验证
  19 + * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
  20 + * mlp(可选):是否多级属性(这里假设外部model如果多级,内部model也是多级)
  21 + *
  22 + * 高级属性:
  23 + * dataassociate(可选):数据源是否关联属性(内部数据随外部指定的参数变化而变化)
  24 + * dataparam(可选):数据源关联的外部参数对象
  25 + *
  26 + */
  27 +angular.module('ScheduleApp').directive("saSelect3", [
  28 + '$timeout',
  29 + '$$SearchInfoService_g',
  30 + function($timeout, $$searchInfoService_g) {
  31 + return {
  32 + restrict: 'E',
  33 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect3Template.html',
  34 + scope: {
  35 + model: "=" // 独立作用域,关联外部的模型object
  36 + },
  37 + controllerAs: "$saSelectCtrl",
  38 + bindToController: true,
  39 + controller: function($scope) {
  40 + var self = this;
  41 + self.$$data = []; // ui-select显示用的数据源
  42 + self.$$data_real= []; // 内部真实的数据源
  43 + },
  44 +
  45 + /**
  46 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  47 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  48 + * @param tElem
  49 + * @param tAttrs
  50 + * @returns {{pre: Function, post: Function}}
  51 + */
  52 + compile: function(tElem, tAttrs) {
  53 + // 获取所有的属性
  54 + var $name_attr = tAttrs["name"]; // 控件的名字
  55 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  56 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  57 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  58 + var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
  59 + var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
  60 + var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
  61 + var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
  62 +
  63 + var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
  64 + var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
  65 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  66 + var $mlp_attr = tAttrs["mlp"]; // 是否多级属性
  67 + var $dataassociate_attr = tAttrs["dataassociate"]; // 数据源是否关联属性
  68 +
  69 + // controlAs名字
  70 + var ctrlAs = "$saSelectCtrl";
  71 +
  72 + // 数据源初始化标志
  73 + var $$data_init = false;
  74 + // 如果有required属性,添加angularjs required验证
  75 + if ($required_attr != undefined) {
  76 + tElem.find("ui-select").attr("required", "");
  77 + }
  78 +
  79 + // 由于有的属性是多级的如xl.name,所以要在compile阶段重写属性绑定属性定义
  80 + // 原来的设置:{{$select.selected[$saSelectCtrl.$icname_s]}}
  81 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $icname_s_attr + "}}");
  82 + // 原来的设置:item[$saSelectCtrl.$icname] as item in $saSelectCtrl.$$data
  83 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  84 + // 原来的设置:item[$saSelectCtrl.$icname_s]
  85 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $icname_s_attr);
  86 + // 原来的设置:{{$saSelectCtrl.$name}}
  87 + tElem.find("ui-select").attr("name", $name_attr);
  88 + // 原来的设置:{{$saSelectCtrl.$placeholder}}
  89 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  90 +
  91 + return {
  92 + pre: function(scope, element, attr) {
  93 + // TODO:
  94 + },
  95 + /**
  96 + * 相当于link函数。
  97 + * @param scope
  98 + * @param element
  99 + * @param attr
  100 + */
  101 + post: function(scope, element, attr) {
  102 + // 添加选中事件处理函数
  103 + scope[ctrlAs].$$internal_select_fn = function($item) {
  104 + if ($dcname_attr && $icname_attr) {
  105 + if ($mlp_attr) {
  106 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  107 + } else {
  108 + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
  109 + }
  110 + }
  111 + if ($dcname2_attr && $icname2_attr) {
  112 + if ($mlp_attr) {
  113 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = $item" + "." + $icname2_attr + ";");
  114 + } else {
  115 + scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
  116 + }
  117 + }
  118 + if ($dcname3_attr && $icname3_attr) {
  119 + if ($mlp_attr) {
  120 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
  121 + } else {
  122 + scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
  123 + }
  124 + }
  125 + };
  126 +
  127 + // 删除选中事件处理函数
  128 + scope[ctrlAs].$$internal_remove_fn = function() {
  129 + scope[ctrlAs].$$internalmodel = undefined;
  130 + if ($mlp_attr) {
  131 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  132 + } else {
  133 + scope[ctrlAs].model[$dcname_attr] = undefined;
  134 + }
  135 +
  136 + if ($dcname2_attr) {
  137 + if ($mlp_attr) {
  138 + eval("scope[ctrlAs].model" + "." + $dcname2_attr + " = undefined;");
  139 + } else {
  140 + scope[ctrlAs].model[$dcname2_attr] = undefined;
  141 + }
  142 + }
  143 + if ($dcname3_attr) {
  144 + if ($mlp_attr) {
  145 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
  146 + } else {
  147 + scope[ctrlAs].model[$dcname3_attr] = undefined;
  148 + }
  149 + }
  150 + };
  151 +
  152 + /**
  153 + * 内部方法,读取字典数据作为数据源。
  154 + * @param dicgroup 字典类型,如:gsType
  155 + * @param ccol 代码字段名
  156 + * @param ncol 名字字段名
  157 + */
  158 + scope[ctrlAs].$$internal_dic_data = function(dicgroup, ccol, ncol) {
  159 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  160 + var dic_key; // 字典key
  161 + // 清空内部数据
  162 + scope[ctrlAs].$$data_real = [];
  163 + for (dic_key in origin_dicgroup) {
  164 + var data = {}; // 重新组合的字典元素对象
  165 + if (dic_key == "true")
  166 + data[ccol] = true;
  167 + else
  168 + data[ccol] = dic_key;
  169 + data[ncol] = origin_dicgroup[dic_key];
  170 + scope[ctrlAs].$$data_real.push(data);
  171 + }
  172 + // 这里直接将$$data_real数据深拷贝到$$data
  173 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  174 +
  175 + console.log(scope[ctrlAs].$$data);
  176 + };
  177 +
  178 + /**
  179 + * TODO:这个方法有性能问题,result一多就会卡一卡,之后再解决把
  180 + * 内部方法,读取字典数据作为数据源。
  181 + * @param result 原始数据
  182 + * @param dcvalue 传入的关联数据
  183 + */
  184 + scope[ctrlAs].$$internal_other_data = function(result, dcvalue) {
  185 + console.log("start=" + dcvalue);
  186 + // 清空内部数据
  187 + scope[ctrlAs].$$data_real = [];
  188 + scope[ctrlAs].$$data = [];
  189 + for (var i = 0; i < result.length; i ++) {
  190 + if ($icname_s_attr) {
  191 + if ($mlp_attr) {
  192 + if (eval("result[i]" + "." + $icname_s_attr)) {
  193 + // 全拼
  194 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $icname_s_attr)).toUpperCase();
  195 + // 简拼
  196 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $icname_s_attr));
  197 + }
  198 + } else {
  199 + if (result[i][$icname_s_attr]) {
  200 + // 全拼
  201 + result[i]["fullChars"] = pinyin.getFullChars(result[i][$icname_s_attr]).toUpperCase();
  202 + // 简拼
  203 + result[i]["camelChars"] = pinyin.getCamelChars(result[i][$icname_s_attr]);
  204 + }
  205 + }
  206 + }
  207 +
  208 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  209 + scope[ctrlAs].$$data_real.push(result[i]);
  210 + }
  211 +
  212 + }
  213 + //console.log("start2");
  214 +
  215 + // 数量太大取前10条记录作为显示
  216 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  217 + // 先迭代循环查找已经传过来的值
  218 + if (scope[ctrlAs].$$data_real.length > 0) {
  219 + if (dcvalue) {
  220 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  221 + if (scope[ctrlAs].$$data_real[j][$icname_attr] == dcvalue) {
  222 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[j]));
  223 + break;
  224 + }
  225 + }
  226 + }
  227 + }
  228 + // 在插入剩余的数据
  229 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  230 + if (scope[ctrlAs].$$data.length < 10) {
  231 + if ($mlp_attr) {
  232 + if (eval("scope[ctrlAs].$$data_real[k]" + "." + $icname_attr + " != dcvalue")) {
  233 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  234 + }
  235 + } else {
  236 + if (scope[ctrlAs].$$data_real[k][$icname_attr] != dcvalue) {
  237 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  238 + }
  239 + }
  240 + } else {
  241 + break;
  242 + }
  243 + }
  244 + }
  245 +
  246 + //console.log("end");
  247 + };
  248 +
  249 + /**
  250 + * 判定一个对象是否为空对象。
  251 + * @param Obj
  252 + */
  253 + scope[ctrlAs].$$internal_isEmpty_obj = function(obj) {
  254 + console.log(typeof obj);
  255 +
  256 + if (typeof obj === "object" && !(obj instanceof Array)) {
  257 + for (var prop in obj) {
  258 + if (obj.hasOwnProperty(prop)) {
  259 + return false;
  260 + }
  261 + }
  262 + return true;
  263 + } else {
  264 + throw "必须是对象";
  265 + }
  266 + };
  267 +
  268 + // 刷新数据
  269 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  270 + // 绑定的model字段值,此属性是绑定属性,只能在link阶段获取
  271 + var $dcvalue_attr = attr["dcvalue"];
  272 +
  273 + console.log("刷新数据:" + $dcvalue_attr);
  274 +
  275 + if (!$$data_init) { // 只初始化$$data_real一次,重新载入页面才能重新初始化
  276 + if (dictionaryUtils.getByGroup($datatype_attr)) { // 判定是否字典类型数据源
  277 + scope[ctrlAs].$$internal_dic_data(
  278 + $datatype_attr, $icname_attr, $icname_s_attr);
  279 + if ($dcvalue_attr) {
  280 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  281 + }
  282 + } else { // 非字典类型数据源
  283 + if (!$dataassociate_attr) {
  284 + $$searchInfoService_g[$datatype_attr].list(
  285 + {type: "all"},
  286 + function(result) {
  287 + //console.log("ok:" + $datatype_attr);
  288 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  289 + //console.log("ok2:" + $datatype_attr);
  290 + if ($dcvalue_attr) {
  291 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  292 + }
  293 +
  294 + $$data_init = true;
  295 + },
  296 + function(result) {
  297 +
  298 + }
  299 + );
  300 + }
  301 + }
  302 + }
  303 +
  304 + if ($$data_init) {
  305 + if (search && search != "") { // 有search值
  306 + if (!dictionaryUtils.getByGroup($datatype_attr)) { // 其他数据源
  307 + // 处理search
  308 + console.log("search:" + search);
  309 +
  310 + scope[ctrlAs].$$data = [];
  311 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  312 + var upTerm = search.toUpperCase();
  313 + if (scope[ctrlAs].$$data.length < 10) {
  314 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  315 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  316 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  317 + }
  318 + } else {
  319 + break;
  320 + }
  321 + }
  322 + }
  323 + }
  324 +
  325 + }
  326 +
  327 + };
  328 +
  329 +
  330 +
  331 +
  332 +
  333 +
  334 +
  335 +
  336 +
  337 +
  338 + // TODO:
  339 +
  340 + // dom全部载入后调用
  341 + $timeout(function() {
  342 + console.log("dom全部载入后调用");
  343 + }, 0);
  344 + // 监控dcvalue model值变换
  345 + attr.$observe("dcvalue", function(value) {
  346 + console.log("监控dc1 model值变换:" + value);
  347 + scope[ctrlAs].$$internalmodel = value;
  348 + }
  349 + );
  350 + // 监控获取数据参数变换
  351 + attr.$observe("dataparam", function(value) {
  352 + // 判定是否空对象
  353 + console.log(value);
  354 + var obj = JSON.parse(value);
  355 + var $dcvalue_attr = attr["dcvalue"];
  356 + if (!scope[ctrlAs].$$internal_isEmpty_obj(obj)) {
  357 + console.log("dataparam:" + obj);
  358 +
  359 + //
  360 +
  361 + obj["type"] = "all";
  362 +
  363 + $$data_init = false;
  364 + $$searchInfoService_g[$datatype_attr].list(
  365 + obj,
  366 + function(result) {
  367 + //console.log("ok:" + $datatype_attr);
  368 + scope[ctrlAs].$$internal_other_data(result, $dcvalue_attr);
  369 + //console.log("ok2:" + $datatype_attr);
  370 + if ($dcvalue_attr) {
  371 + scope[ctrlAs].$$internalmodel = $dcvalue_attr;
  372 + }
  373 +
  374 + $$data_init = true;
  375 + },
  376 + function(result) {
  377 +
  378 + }
  379 + );
  380 + }
  381 + }
  382 + );
  383 + }
  384 + };
  385 + }
  386 + };
  387 +
  388 + }
  389 +]);
  390 +
src/main/resources/static/pages/scheduleApp/module/common/dt/MyUiSelectWrapTemplate1.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect3Template.html
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/legacy.txt renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect4.js
  1 +
1 /** 2 /**
2 * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。 3 * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
3 * name(必须):控件的名字 4 * name(必须):控件的名字
@@ -19,7 +20,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [ @@ -19,7 +20,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
19 function($timeout, $$searchInfoService_g) { 20 function($timeout, $$searchInfoService_g) {
20 return { 21 return {
21 restrict: 'E', 22 restrict: 'E',
22 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/MyUISelectWrapTemplate2.html', 23 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html',
23 scope: { 24 scope: {
24 model: "=" // 独立作用域,关联外部的模型object 25 model: "=" // 独立作用域,关联外部的模型object
25 }, 26 },
@@ -301,7 +302,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [ @@ -301,7 +302,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
301 scope[ctrlAs].$$internal_select_value = value; 302 scope[ctrlAs].$$internal_select_value = value;
302 scope[ctrlAs].$$internal_validate_model(); 303 scope[ctrlAs].$$internal_validate_model();
303 } 304 }
  305 +
  306 + // 闭包测试
  307 + var obj = {'a':1,'b':2};
  308 + var tfx = scope[ctrlAs].$$test.bind(obj);
  309 + console.log("闭包测试=" + tfx());
304 }); 310 });
  311 +
  312 + scope[ctrlAs].$$test = function() {
  313 + var exp = "this.a + '(' + this.b + ')'";
  314 + console.log("exp=" + exp);
  315 + return eval(exp);
  316 + };
305 } 317 }
306 }; 318 };
307 319
@@ -309,4 +321,5 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [ @@ -309,4 +321,5 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
309 321
310 }; 322 };
311 } 323 }
312 -]);  
313 \ No newline at end of file 324 \ No newline at end of file
  325 +]);
  326 +
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/MyUISelectWrapTemplate2.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
  1 +
  2 +
1 /** 3 /**
2 * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。 4 * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
3 * name(必须):控件的名字 5 * name(必须):控件的名字
4 * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave 6 * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave
5 - * cmaps(必须):外部对象与指令内部数据对象字段名映射对象,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}} 7 + * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}
6 * dcname(必须):绑定的model字段名,如:dcname=xl.id 8 * dcname(必须):绑定的model字段名,如:dcname=xl.id
7 * icname(必须):内部与之对应的字段名,如:icname=id 9 * icname(必须):内部与之对应的字段名,如:icname=id
8 * 10 *
9 * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }} 11 * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  12 + * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}
10 * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item 13 * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item
11 * iterobjexp(必须):内部显示用的表达式 14 * iterobjexp(必须):内部显示用的表达式
12 * searchph(必须):查询输入占位符字符串,如:searchph=请输入... 15 * searchph(必须):查询输入占位符字符串,如:searchph=请输入...
@@ -54,6 +57,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -54,6 +57,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
54 var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名 57 var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
55 58
56 var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象 59 var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象
  60 + var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串
57 var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名 61 var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名
58 var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式 62 var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式
59 var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串 63 var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串
@@ -124,8 +128,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -124,8 +128,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
124 scope[ctrlAs].$$internal_select_fn = function($item) { 128 scope[ctrlAs].$$internal_select_fn = function($item) {
125 eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";"); 129 eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
126 130
127 - for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名  
128 - var ic = $cmaps_attr[mc]; // 内部数据源对应字段 131 + eval("var obj=" + $cmaps_attr);
  132 + for (var mc in obj) { // model的字段名:内部数据源对应字段名
  133 + var ic = obj[mc]; // 内部数据源对应字段
129 eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); 134 eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
130 } 135 }
131 }; 136 };
@@ -134,8 +139,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -134,8 +139,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
134 scope[ctrlAs].$$internal_remove_fn = function() { 139 scope[ctrlAs].$$internal_remove_fn = function() {
135 eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); 140 eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
136 141
  142 + eval("var obj=" + $cmaps_attr);
137 var mc; // model的字段名 143 var mc; // model的字段名
138 - for (mc in $cmaps_attr) { 144 + for (mc in obj) {
139 eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); 145 eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
140 } 146 }
141 }; 147 };
@@ -208,7 +214,13 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -208,7 +214,13 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
208 */ 214 */
209 scope[ctrlAs].$$internal_match_str = function (context) { 215 scope[ctrlAs].$$internal_match_str = function (context) {
210 var fx = function() { 216 var fx = function() {
211 - return eval($searchexp_attr); 217 + try {
  218 + return eval($searchexp_attr);
  219 + } catch (err) {
  220 + //console.log(err);
  221 + return undefined;
  222 + }
  223 +
212 }; 224 };
213 225
214 var str = fx.bind(context)(); 226 var str = fx.bind(context)();
@@ -224,16 +236,39 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -224,16 +236,39 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
224 * @param ajaxparamobj 查询参数对象 236 * @param ajaxparamobj 查询参数对象
225 */ 237 */
226 scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) { 238 scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
227 - ajaxparamobj.type = 'all'; 239 + // 如果ajaxparamobj为空对象,则表示清空内部选项
  240 + var isEmptyObj = true;
  241 + for (var name in ajaxparamobj) {
  242 + isEmptyObj = false;
  243 + }
  244 + if (isEmptyObj) {
  245 + // 重新创建内部保存的数据
  246 + scope[ctrlAs].$$data_real = [];
  247 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  248 + scope[ctrlAs].$$data = [];
  249 +
  250 + scope[ctrlAs].$$internal_remove_fn();
  251 + scope[ctrlAs].$$internal_validate_model();
  252 +
  253 + return;
  254 + }
  255 +
  256 + if ($dsparamsextra_attr) { // 合并附加参数
  257 + eval("var extra = " + $dsparamsextra_attr);
  258 + for (var extrakey in extra) {
  259 + ajaxparamobj[extrakey] = extra[extrakey];
  260 + }
  261 + }
  262 +
228 $$searchInfoService_g[atype].list( 263 $$searchInfoService_g[atype].list(
229 ajaxparamobj, 264 ajaxparamobj,
230 function(result) { 265 function(result) {
231 console.log("$$internal_ajax_data result"); 266 console.log("$$internal_ajax_data result");
232 267
233 // 重新创建内部保存的数据 268 // 重新创建内部保存的数据
234 - scope[ctrlAs].$$data = []; 269 + scope[ctrlAs].$$data_real = [];
235 // result中添加拼音数据,注意:这里要求result返回对象数组 270 // result中添加拼音数据,注意:这里要求result返回对象数组
236 - for (var i = 0; i < result.length; i ++) { 271 + for (var i = 0; i < result.length; i++) {
237 // 闭包绑定返回最终查询的值 272 // 闭包绑定返回最终查询的值
238 var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]); 273 var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
239 if (calcu_str) { 274 if (calcu_str) {
@@ -249,6 +284,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -249,6 +284,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
249 } 284 }
250 285
251 // 重新创建内部ui-select显示用数据,默认取10条记录显示 286 // 重新创建内部ui-select显示用数据,默认取10条记录显示
  287 + scope[ctrlAs].$$data = [];
252 for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) { 288 for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
253 if (scope[ctrlAs].$$data.length < 10) { 289 if (scope[ctrlAs].$$data.length < 10) {
254 scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]); 290 scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
@@ -345,4 +381,5 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -345,4 +381,5 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
345 } 381 }
346 }; 382 };
347 } 383 }
348 -]);  
349 \ No newline at end of file 384 \ No newline at end of file
  385 +]);
  386 +
src/main/resources/static/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelectTemplate.html
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidaton.js 0 → 100644
  1 +angular.module('ScheduleApp').directive("remoteValidaton", [
  2 + 'BusInfoManageService_g',
  3 + 'EmployeeInfoManageService_g',
  4 + 'TimeTableManageService_g',
  5 + function(
  6 + busInfoManageService_g,
  7 + employeeInfoManageService_g,
  8 + timeTableManageService_g
  9 + ) {
  10 + /**
  11 + * 远端验证指令,依赖于ngModel
  12 + * 指令名称 remote-Validation
  13 + * 需要属性 rvtype 表示验证类型
  14 + */
  15 + return {
  16 + restrict: "A",
  17 + require: "^ngModel",
  18 + link: function(scope, element, attr, ngModelCtrl) {
  19 + element.bind("keyup", function() {
  20 + var modelValue = ngModelCtrl.$modelValue;
  21 + var rv1_attr = attr["rv1"];
  22 + if (attr["rvtype"]) {
  23 +
  24 + // 根据rvtype的值,确定使用那个远端验证的url,
  25 + // rv1, rv2, rv3是关联比较值,暂时使用rv1
  26 + // 这个貌似没法通用,根据业务变换
  27 + // TODO:暂时有点乱以后改
  28 + if (attr["rvtype"] == "insideCode") {
  29 + busInfoManageService_g.validate.insideCode(
  30 + {"insideCode_eq": modelValue, type: "equale"},
  31 + function(result) {
  32 + //console.log(result);
  33 + if (result.status == "SUCCESS") {
  34 + ngModelCtrl.$setValidity('remote', true);
  35 + } else {
  36 + ngModelCtrl.$setValidity('remote', false);
  37 + }
  38 + },
  39 + function(result) {
  40 + //console.log(result);
  41 + ngModelCtrl.$setValidity('remote', true);
  42 + }
  43 + );
  44 + } else if (attr["rvtype"] == "jobCode") {
  45 + if (!rv1_attr) {
  46 + ngModelCtrl.$setValidity('remote', false);
  47 + return;
  48 + }
  49 +
  50 + employeeInfoManageService_g.validate.jobCode(
  51 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  52 + function(result) {
  53 + //console.log(result);
  54 + if (result.status == "SUCCESS") {
  55 + ngModelCtrl.$setValidity('remote', true);
  56 + } else {
  57 + ngModelCtrl.$setValidity('remote', false);
  58 + }
  59 + },
  60 + function(result) {
  61 + //console.log(result);
  62 + ngModelCtrl.$setValidity('remote', true);
  63 + }
  64 + );
  65 + } else if (attr["rvtype"] == "ttinfoname") {
  66 + if (!rv1_attr) {
  67 + ngModelCtrl.$setValidity('remote', false);
  68 + return;
  69 + }
  70 +
  71 + timeTableManageService_g.validate.ttinfoname(
  72 + {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},
  73 + function(result) {
  74 + //console.log(result);
  75 + if (result.status == "SUCCESS") {
  76 + ngModelCtrl.$setValidity('remote', true);
  77 + } else {
  78 + ngModelCtrl.$setValidity('remote', false);
  79 + }
  80 + },
  81 + function(result) {
  82 + //console.log(result);
  83 + ngModelCtrl.$setValidity('remote', true);
  84 + }
  85 + );
  86 +
  87 + }
  88 + } else {
  89 + // 没有rvtype,就不用远端验证了
  90 + ngModelCtrl.$setValidity('remote', true);
  91 + }
  92 +
  93 + attr.$observe("rv1", function(value) {
  94 + if (attr["rvtype"] == "jobCode") {
  95 + if (!value) {
  96 + ngModelCtrl.$setValidity('remote', false);
  97 + return;
  98 + }
  99 +
  100 + employeeInfoManageService_g.validate.jobCode(
  101 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  102 + function(result) {
  103 + //console.log(result);
  104 + if (result.status == "SUCCESS") {
  105 + ngModelCtrl.$setValidity('remote', true);
  106 + } else {
  107 + ngModelCtrl.$setValidity('remote', false);
  108 + }
  109 + },
  110 + function(result) {
  111 + //console.log(result);
  112 + ngModelCtrl.$setValidity('remote', true);
  113 + }
  114 + );
  115 + } else if (attr["rvtype"] == "ttinfoname") {
  116 + if (!value) {
  117 + ngModelCtrl.$setValidity('remote', false);
  118 + return;
  119 + }
  120 +
  121 + console.log("rv1:" + value);
  122 +
  123 + timeTableManageService_g.validate.ttinfoname(
  124 + {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},
  125 + function(result) {
  126 + //console.log(result);
  127 + if (result.status == "SUCCESS") {
  128 + ngModelCtrl.$setValidity('remote', true);
  129 + } else {
  130 + ngModelCtrl.$setValidity('remote', false);
  131 + }
  132 + },
  133 + function(result) {
  134 + //console.log(result);
  135 + ngModelCtrl.$setValidity('remote', true);
  136 + }
  137 + );
  138 + }
  139 +
  140 + });
  141 + });
  142 + }
  143 + };
  144 + }
  145 + ]
  146 +);
0 \ No newline at end of file 147 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroup.js
  1 +
  2 +
1 /** 3 /**
2 * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。 4 * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
3 * 属性如下: 5 * 属性如下:
@@ -14,7 +16,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -14,7 +16,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
14 function(timeTableDetailManageService_g) { 16 function(timeTableDetailManageService_g) {
15 return { 17 return {
16 restrict: 'E', 18 restrict: 'E',
17 - templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/MyBcGroupWrapTemplate.html', 19 + templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html',
18 scope: { 20 scope: {
19 model: "=" // 独立作用域,关联外部的模型object 21 model: "=" // 独立作用域,关联外部的模型object
20 }, 22 },
@@ -166,6 +168,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -166,6 +168,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
166 // 监控内部数据,$$data_selected 变化 168 // 监控内部数据,$$data_selected 变化
167 scope.$watch( 169 scope.$watch(
168 function() { 170 function() {
  171 + console.log("长度:" + scope[ctrlAs].$$dataSelected.length);
169 return scope[ctrlAs].$$dataSelected; 172 return scope[ctrlAs].$$dataSelected;
170 }, 173 },
171 function(newValue, oldValue) { 174 function(newValue, oldValue) {
@@ -233,11 +236,14 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -233,11 +236,14 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
233 // 监控内部数据的变化 236 // 监控内部数据的变化
234 attr.$observe("dataparams", function(value) { 237 attr.$observe("dataparams", function(value) {
235 if (value && value != "") { 238 if (value && value != "") {
236 - console.log("observe 监控 dataparams=" + value); 239 + if (value == '{}') {
  240 + return;
  241 + }
  242 +
  243 + console.log("bcgroup observe 监控 dataparams=" + value);
237 244
238 - var obj = JSON.parse(value);  
239 timeTableDetailManageService_g.bcdetails.list( 245 timeTableDetailManageService_g.bcdetails.list(
240 - obj, 246 + JSON.parse(value),
241 function(result) { 247 function(result) {
242 // 获取值了 248 // 获取值了
243 console.log("内部班次数据获取了"); 249 console.log("内部班次数据获取了");
@@ -279,4 +285,5 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -279,4 +285,5 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
279 } 285 }
280 } 286 }
281 } 287 }
282 -]);  
283 \ No newline at end of file 288 \ No newline at end of file
  289 +]);
  290 +
src/main/resources/static/pages/scheduleApp/module/common/dts2/bcGroup/MyBcGroupWrapTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html
src/main/resources/static/pages/scheduleApp/module/common/dts2/dateGroup/saDategroup.js 0 → 100644
  1 +
  2 +
  3 +/**
  4 + * saDategroup指令
  5 + * 属性如下:
  6 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  7 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  8 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  9 + * name(必须):控件的名字
  10 + * required(可选):是否要用required验证
  11 + * disabled(可选):标示框是否可选
  12 + *
  13 + */
  14 +angular.module('ScheduleApp').directive('saDategroup', [
  15 + '$filter',
  16 + function($filter) {
  17 + return {
  18 + restrict: 'E',
  19 + templateUrl: '/pages/scheduleApp/module/common/dts2/dateGroup/saDategroupTemplate.html',
  20 + scope: {
  21 + model: "=" // 独立作用域,关联外部的模型object
  22 + },
  23 + controllerAs: "$saDategroupCtrl",
  24 + bindToController: true,
  25 + controller: function($scope) {
  26 + var self = this;
  27 + self.$$data = []; // 内部的数据
  28 + self.$$date_select; // 内部选中的日期
  29 +
  30 + //// 测试数据
  31 + //self.$$data = [
  32 + // {datestr: '2011-01-01', ischecked: true},
  33 + // {datestr: '2011-01-01', ischecked: true},
  34 + // {datestr: '2011-01-01', ischecked: true}
  35 + //];
  36 + },
  37 +
  38 + /**
  39 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  40 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  41 + * @param tElem
  42 + * @param tAttrs
  43 + * @returns {{pre: Function, post: Function}}
  44 + */
  45 + compile: function(tElem, tAttrs) {
  46 + // 获取所有的属性
  47 + var $name_attr = tAttrs["name"]; // 控件的名字
  48 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  49 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  50 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  51 +
  52 + // controlAs名字
  53 + var ctrlAs = '$saDategroupCtrl';
  54 +
  55 + // 如果有required属性,添加angularjs required验证
  56 + if ($required_attr != undefined) {
  57 + //console.log(tElem.html());
  58 + tElem.find("div").attr("required", "");
  59 + }
  60 + // 如果有disabled属性,添加禁用标志
  61 + if ($disabled_attr != undefined) {
  62 + tElem.find("input").attr("ng-disabled", "true");
  63 + tElem.find("div").attr("ng-disabled", "true");
  64 + }
  65 +
  66 + return {
  67 + pre: function (scope, element, attr) {
  68 + // TODO:
  69 + },
  70 + /**
  71 + * 相当于link函数。
  72 + * @param scope
  73 + * @param element
  74 + * @param attr
  75 + */
  76 + post: function (scope, element, attr) {
  77 + // name属性
  78 + if ($name_attr) {
  79 + scope[ctrlAs]["$name_attr"] = $name_attr;
  80 + }
  81 +
  82 +
  83 + // 日期open属性,及方法
  84 + scope[ctrlAs].$$specialDateOpen = false;
  85 + scope[ctrlAs].$$specialDate_open = function() {
  86 + scope[ctrlAs].$$specialDateOpen = true;
  87 + };
  88 +
  89 + // 监控选择的日期
  90 + scope.$watch(
  91 + function() {
  92 + return scope[ctrlAs]['$$date_select'];
  93 + },
  94 + function(newValue, oldValue) {
  95 + if (newValue) {
  96 + //console.log("saDategroup--->selectdate:" + newValue);
  97 + // 调用内置filter,转换日期到yyyy-MM-dd格式
  98 + var text = $filter('date')(newValue, 'yyyy-MM-dd');
  99 + var i;
  100 + var isexist = false; // 日期是否已经选择标识
  101 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  102 + if (scope[ctrlAs]["$$data"][i].datestr == text) {
  103 + isexist = true;
  104 + break;
  105 + }
  106 + }
  107 + if (!isexist) {
  108 + scope[ctrlAs]["$$data"].push(
  109 + {
  110 + datestr: text,
  111 + ischecked: true
  112 + }
  113 + );
  114 + }
  115 +
  116 + }
  117 +
  118 + }
  119 + );
  120 +
  121 + /**
  122 + * 日期点击事件处理函数。
  123 + * @param $index 索引
  124 + */
  125 + scope[ctrlAs].$$internal_datestr_click = function($index) {
  126 + scope[ctrlAs].$$data.splice($index, 1);
  127 + };
  128 +
  129 + // 测试使用watch监控$$data的变化
  130 + scope.$watch(
  131 + function() {
  132 + return scope[ctrlAs]['$$data'];
  133 + },
  134 + function(newValue, oldValue) {
  135 + // 根据$$data生成对应的数据
  136 + var special_days_arr = [];
  137 + var i;
  138 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  139 + special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
  140 + }
  141 +
  142 + scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
  143 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
  144 +
  145 + // 更新model
  146 + if ($dcname_attr) {
  147 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
  148 + }
  149 + },
  150 + true
  151 + );
  152 +
  153 + // 监控dcvalue model值变换
  154 + attr.$observe("dcvalue", function(value) {
  155 + console.log("saDategroup 监控dc1 model值变换:" + value);
  156 + if (value) {
  157 + // 根据value值,修改$$data里的值
  158 + var date_array = value.split(",");
  159 + var i;
  160 + scope[ctrlAs]["$$data"] = [];
  161 + for (i = 0; i < date_array.length; i++) {
  162 + scope[ctrlAs]["$$data"].push(
  163 + {
  164 + datestr: date_array[i],
  165 + ischecked: true
  166 + }
  167 + );
  168 + }
  169 +
  170 +
  171 +
  172 +
  173 +
  174 +
  175 +
  176 +
  177 +
  178 + }
  179 + });
  180 +
  181 + }
  182 +
  183 + };
  184 + }
  185 + }
  186 + }
  187 +]);
  188 +
src/main/resources/static/pages/scheduleApp/module/common/dt/MyDateGroupWrapTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts2/dateGroup/saDategroupTemplate.html
src/main/resources/static/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroup.js 0 → 100644
  1 +
  2 +
  3 +/**
  4 + * saEmployeegroup指令
  5 + * 属性如下:
  6 + * name(必须):控件的名字
  7 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  8 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  9 + * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  10 + * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
  11 + * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  12 + * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
  13 + * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  14 + * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
  15 + *
  16 + * required(可选):是否要用required验证
  17 + *
  18 + */
  19 +angular.module('ScheduleApp').directive('saEmployeegroup', [
  20 + 'EmployeeConfigService_g',
  21 + function(employeeConfigService_g) {
  22 + return {
  23 + restrict: 'E',
  24 + templateUrl: '/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html',
  25 + scope: {
  26 + model: "=" // 独立作用域,关联外部的模型object
  27 + },
  28 + controllerAs: '$saEmployeegroupCtrl',
  29 + bindToController: true,
  30 + controller: function($scope) {
  31 + var self = this;
  32 + self.$$data = []; // 选择线路后,该线路的人员配置数据
  33 +
  34 + // 测试数据
  35 + //self.$$data = [
  36 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},
  37 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},
  38 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
  39 + //];
  40 +
  41 + self.$$dataSelected = []; // 选中的人员配置列表
  42 + self.$$dataSelectedStart = undefined; // 起始人员配置
  43 +
  44 + //self.$$dataSelected = [
  45 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
  46 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
  47 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
  48 + //];
  49 +
  50 + self.$$isFB = false; // 是否分班
  51 + self.$$dataFBSelected = []; // 选中的分班人员组配置列表
  52 + self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识
  53 + self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合
  54 +
  55 + //self.$$dataFBSelected = [
  56 + // {isstart: true, group: [
  57 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  58 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  59 + // ]},
  60 + // {isstart: false, group: [
  61 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  62 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  63 + // ]}
  64 + //];
  65 +
  66 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  67 + self.$$internalmodel = undefined;
  68 +
  69 + self.$$data_init = false; // *数据源初始化标志
  70 + self.$$data_xl_first_init = false; // 线路是否初始化
  71 + self.$$data_ry_first_init = false; // 人员配置是否初始化
  72 + self.$$data_ry_first_data = undefined; // 人员配置初始化数据
  73 + self.$$data_rycid_first_init = false; // 人员配置id是否初始化
  74 + self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据
  75 + self.$$data_rystart_first_init = false; // 起始人员是否初始化
  76 + self.$$data_rystart_first_data = undefined; // 起始人员初始化数据
  77 +
  78 + },
  79 +
  80 + /**
  81 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  82 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  83 + * @param tElem
  84 + * @param tAttrs
  85 + * @returns {{pre: Function, post: Function}}
  86 + */
  87 + compile: function(tElem, tAttrs) {
  88 + // TODO:获取所有的属性
  89 + var $name_attr = tAttrs["name"]; // 控件的名字
  90 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  91 + var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
  92 + var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
  93 + var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
  94 +
  95 + // controlAs名字
  96 + var ctrlAs = '$saEmployeegroupCtrl';
  97 +
  98 + // 如果有required属性,添加angularjs required验证
  99 + if ($required_attr != undefined) {
  100 + //console.log(tElem.html());
  101 + tElem.find("div").attr("required", "");
  102 + }
  103 +
  104 + return {
  105 + pre: function(scope, element, attr) {
  106 + // TODO:
  107 + },
  108 +
  109 + /**
  110 + * 相当于link函数。
  111 + * @param scope
  112 + * @param element
  113 + * @param attr
  114 + */
  115 + post: function(scope, element, attr) {
  116 + // name属性
  117 + if ($name_attr) {
  118 + scope[ctrlAs]["$name_attr"] = $name_attr;
  119 + }
  120 +
  121 + /**
  122 + * 人员配置列表点击(人员配置列表中选中路牌)
  123 + * @param $index
  124 + */
  125 + scope[ctrlAs].$$internal_rylist_click = function($index) {
  126 + var data_temp = scope[ctrlAs].$$data;
  127 + if (data_temp && data_temp.length > $index) {
  128 + if (!scope[ctrlAs].$$isFB) { // 不分班
  129 + scope[ctrlAs].$$dataSelected.push({
  130 + id : data_temp[$index].id,
  131 + dbbm: data_temp[$index].dbbm,
  132 + jsy: data_temp[$index].jsy,
  133 + spy: data_temp[$index].spy,
  134 + isstart: false
  135 + });
  136 +
  137 + // 如果没有指定过初始人员,默认选择此人员作为起始人员
  138 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  139 + scope[ctrlAs].$$internal_selrylist_click(
  140 + scope[ctrlAs].$$dataSelected.length - 1);
  141 + }
  142 + } else { // 分班
  143 + if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员
  144 + scope[ctrlAs].$$dataFBSelected
  145 + [scope[ctrlAs].$$dataFBInternalSelected.gindex].group
  146 + [scope[ctrlAs].$$dataFBInternalSelected.index] = {
  147 + id : data_temp[$index].id,
  148 + dbbm: data_temp[$index].dbbm,
  149 + jsy: data_temp[$index].jsy,
  150 + spy: data_temp[$index].spy,
  151 + isselected: true
  152 + };
  153 +
  154 + } else {
  155 + scope[ctrlAs].$$dataFBSelected.push({
  156 + isstart: false,
  157 + group: [].concat(
  158 + {
  159 + id : data_temp[$index].id,
  160 + dbbm: data_temp[$index].dbbm,
  161 + jsy: data_temp[$index].jsy,
  162 + spy: data_temp[$index].spy,
  163 + isselected: false
  164 + }, {
  165 + id : data_temp[$index].id,
  166 + dbbm: data_temp[$index].dbbm,
  167 + jsy: data_temp[$index].jsy,
  168 + spy: data_temp[$index].spy,
  169 + isselected: false
  170 + }
  171 + )
  172 + });
  173 + if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {
  174 + scope[ctrlAs].$$internal_selrygrouplist_click(
  175 + scope[ctrlAs].$$dataFBSelected.length - 1);
  176 + }
  177 + }
  178 + }
  179 +
  180 + }
  181 + };
  182 +
  183 + /**
  184 + * 选中的人员单击(初始人员选择)
  185 + * @param $index
  186 + */
  187 + scope[ctrlAs].$$internal_selrylist_click = function($index) {
  188 + var data_temp = scope[ctrlAs].$$dataSelected;
  189 + if (data_temp && data_temp.length > $index) {
  190 + for (var i = 0; i < data_temp.length; i++) {
  191 + data_temp[i].isstart = false;
  192 + }
  193 + data_temp[$index].isstart = true;
  194 + scope[ctrlAs].$$dataSelectedStart = $index;
  195 + }
  196 + };
  197 + /**
  198 + * 选中的人员双击(删除选中的人员)
  199 + * @param $index
  200 + */
  201 + scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
  202 + var data_temp = scope[ctrlAs].$$dataSelected;
  203 + if (data_temp && data_temp.length > $index) {
  204 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  205 + scope[ctrlAs].$$dataSelectedStart = undefined;
  206 + }
  207 + data_temp.splice($index, 1);
  208 + }
  209 + };
  210 +
  211 + /**
  212 + * 选中的分班组人员单击(初始人员选择)
  213 + * @param $index
  214 + */
  215 + scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {
  216 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  217 + if (data_temp && data_temp.length > $index) {
  218 + for (var i = 0; i < data_temp.length; i++) {
  219 + data_temp[i].isstart = false;
  220 + for (var j = 0; j < data_temp[i].group.length; j++) {
  221 + data_temp[i].group[j].isselected = false;
  222 + }
  223 + }
  224 + data_temp[$index].isstart = true;
  225 + scope[ctrlAs].$$dataFBSelectedStart = $index;
  226 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  227 + }
  228 + };
  229 + /**
  230 + * 分组内部单击(选中分班中的某组人员)
  231 + * @param $groupindex 组index
  232 + * @param $index 组内部某个index
  233 + * @param $event 事件防止冒泡
  234 + */
  235 + scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {
  236 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  237 + if (data_temp && data_temp.length > $groupindex) {
  238 + if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {
  239 + // $$dataFBInternalSelected的格式如下:
  240 + //{gindex: 1, index: 0}
  241 + for (var i = 0; i < data_temp.length; i++) {
  242 + data_temp[i].isstart = false;
  243 + for (var j = 0; j < data_temp[i].group.length; j++) {
  244 + data_temp[i].group[j].isselected = false;
  245 + }
  246 + }
  247 + data_temp[$groupindex].group[$index].isselected = true;
  248 + scope[ctrlAs].$$dataFBInternalSelected = {
  249 + gindex: $groupindex, index: $index
  250 + };
  251 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  252 + $event.stopPropagation();
  253 + }
  254 + }
  255 +
  256 + };
  257 + /**
  258 + * 选中的分班人员双击(删除选中的人员)
  259 + * @param $index
  260 + */
  261 + scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {
  262 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  263 + if (data_temp && data_temp.length > $index) {
  264 + if (scope[ctrlAs].$$dataFBSelectedStart == $index) {
  265 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  266 + }
  267 + if (scope[ctrlAs].$$dataFBInternalSelected &&
  268 + scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {
  269 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  270 + }
  271 + data_temp.splice($index, 1);
  272 + }
  273 + };
  274 +
  275 + /**
  276 + * 验证内部数据,更新外部model
  277 + */
  278 + scope[ctrlAs].$$internal_validate_model = function() {
  279 + var data_temp = scope[ctrlAs].$$dataSelected;
  280 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  281 + var data_temp3 = scope[ctrlAs].$$dataFBSelected;
  282 + var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;
  283 + var ryDbbms = [];
  284 + var ryDbbm_group = [];
  285 + var ryCids = [];
  286 + var ryCid_group = [];
  287 + var ryStart = 0;
  288 + var i = 0;
  289 + var j = 0;
  290 +
  291 + var isFB = scope[ctrlAs].$$isFB;
  292 +
  293 + if (isFB) {
  294 + if (data_temp3 &&
  295 + data_temp3.length > 0 &&
  296 + data_temp4 != undefined) {
  297 +
  298 + for (i = 0; i < data_temp3.length; i++) {
  299 + for (j = 0; j < data_temp3[i].group.length; j++) {
  300 + ryDbbm_group.push(data_temp3[i].group[j].dbbm);
  301 + ryCid_group.push(data_temp3[i].group[j].id);
  302 + }
  303 + ryDbbms.push(ryDbbm_group.join("-"));
  304 + ryCids.push(ryCid_group.join("-"));
  305 + ryDbbm_group = [];
  306 + ryCid_group = [];
  307 + }
  308 +
  309 + data_temp3[data_temp4].isstart = true;
  310 + ryStart = data_temp4 + 1;
  311 +
  312 + // 更新内部model,用于外部验证
  313 + // 内部model的值暂时随意,以后再改
  314 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  315 +
  316 + // 更新外部model字段
  317 + if ($dbbmrangename_attr) {
  318 + console.log("dbbmrangename=" + ryDbbms.join(','));
  319 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  320 + }
  321 + if (rycidrangename_attr) {
  322 + console.log("rycidrangename=" + ryCids.join(','));
  323 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  324 + }
  325 + if ($rystartname_attr) {
  326 + console.log("rystartname=" + ryStart);
  327 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  328 + }
  329 +
  330 + } else {
  331 + scope[ctrlAs].$$internalmodel = undefined;
  332 + }
  333 +
  334 + } else {
  335 + if (data_temp &&
  336 + data_temp.length > 0 &&
  337 + data_temp2 != undefined) {
  338 +
  339 + for (i = 0; i < data_temp.length; i++) {
  340 + ryDbbms.push(data_temp[i].dbbm);
  341 + ryCids.push(data_temp[i].id);
  342 + }
  343 + data_temp[data_temp2].isstart = true;
  344 + ryStart = data_temp2 + 1;
  345 +
  346 + // 更新内部model,用于外部验证
  347 + // 内部model的值暂时随意,以后再改
  348 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  349 +
  350 + // 更新外部model字段
  351 + if ($dbbmrangename_attr) {
  352 + console.log("dbbmrangename=" + ryDbbms.join(','));
  353 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  354 + }
  355 + if (rycidrangename_attr) {
  356 + console.log("rycidrangename=" + ryCids.join(','));
  357 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  358 + }
  359 + if ($rystartname_attr) {
  360 + console.log("rystartname=" + ryStart);
  361 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  362 + }
  363 +
  364 + } else {
  365 + scope[ctrlAs].$$internalmodel = undefined;
  366 + }
  367 + }
  368 +
  369 + };
  370 +
  371 + // 监控内部数据,$$dataSelected 变化
  372 + scope.$watch(
  373 + function() {
  374 + return scope[ctrlAs].$$dataSelected;
  375 + },
  376 + function(newValue, oldValue) {
  377 + scope[ctrlAs].$$internal_validate_model();
  378 + },
  379 + true
  380 + );
  381 +
  382 + // 监控内部数据,$$dataSelectedStart 变化
  383 + scope.$watch(
  384 + function() {
  385 + return scope[ctrlAs].$$dataSelectedStart;
  386 + },
  387 + function(newValue, oldValue) {
  388 + scope[ctrlAs].$$internal_validate_model();
  389 + },
  390 + true
  391 + );
  392 +
  393 +
  394 + // 监控内部数据,$$dataFBSelected 变化
  395 + scope.$watch(
  396 + function() {
  397 + return scope[ctrlAs].$$dataFBSelected;
  398 + },
  399 + function(newValue, oldValue) {
  400 + scope[ctrlAs].$$internal_validate_model();
  401 + },
  402 + true
  403 + );
  404 +
  405 + // 监控内部数据,$$dataFBSelectedStart 变化
  406 + scope.$watch(
  407 + function() {
  408 + return scope[ctrlAs].$$dataFBSelectedStart;
  409 + },
  410 + function(newValue, oldValue) {
  411 + scope[ctrlAs].$$internal_validate_model();
  412 + },
  413 + true
  414 + );
  415 +
  416 + // 监控内部数据,$$dataFBInternalSelected 变化
  417 + scope.$watch(
  418 + function() {
  419 + return scope[ctrlAs].$$dataFBInternalSelected;
  420 + },
  421 + function(newValue, oldValue) {
  422 + scope[ctrlAs].$$internal_validate_model();
  423 + },
  424 + true
  425 + );
  426 +
  427 + // 监控内部数据,$$isFB 变化
  428 + scope.$watch(
  429 + function() {
  430 + return scope[ctrlAs].$$isFB;
  431 + },
  432 + function(newValue, oldValue) {
  433 + scope[ctrlAs].$$internal_validate_model();
  434 + },
  435 + true
  436 + );
  437 +
  438 + /**
  439 + * 验证数据是否初始化完成,
  440 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  441 + */
  442 + scope[ctrlAs].$$internal_validate_init = function() {
  443 + var self = scope[ctrlAs];
  444 + var data_temp = self.$$data;
  445 + var dataSelect_temp = self.$$dataSelected;
  446 + var dataFBSelect_temp = self.$$dataFBSelected;
  447 + var dbbmnames = null;
  448 + var dbbmnamegroup = null;
  449 + var rycids = null;
  450 + var rycidgroup = null;
  451 +
  452 + var i = 0;
  453 + var j = 0;
  454 + var k = 0;
  455 +
  456 + if (self.$$data_xl_first_init &&
  457 + self.$$data_ry_first_init &&
  458 + self.$$data_rycid_first_init &&
  459 + self.$$data_rystart_first_init && !self.$$data_init) {
  460 + console.log("开始初始化数据");
  461 +
  462 + // 判定是否分班,字符串中包含-就是了
  463 + if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班
  464 + self.$$isFB = true;
  465 +
  466 + // 搭班编码、人员配置id
  467 + dbbmnames = self.$$data_ry_first_data.split(",");
  468 + rycids = self.$$data_rycid_first_data.split(",");
  469 + for (i = 0; i < dbbmnames.length; i++) {
  470 + dataFBSelect_temp.push({
  471 + group: [],
  472 + isstart: false
  473 + });
  474 + dbbmnamegroup = dbbmnames[i].split("-");
  475 + rycidgroup = rycids[i].split("-");
  476 +
  477 + for (k = 0; k < dbbmnamegroup.length; k++) {
  478 + dataFBSelect_temp[i].group.push({
  479 + id: rycidgroup[k],
  480 + dbbm: dbbmnamegroup[k],
  481 + isselected: false
  482 + });
  483 +
  484 + for (j = 0; j < data_temp.length; j++) {
  485 + if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {
  486 + dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;
  487 + dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;
  488 + break;
  489 + }
  490 + }
  491 + }
  492 +
  493 + }
  494 +
  495 + // 初始人员
  496 + scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;
  497 +
  498 +
  499 + } else if (dataSelect_temp.length == 0) {
  500 + self.$$isFB = false;
  501 +
  502 + // 搭班编码、人员配置id
  503 + dbbmnames = self.$$data_ry_first_data.split(",");
  504 + rycids = self.$$data_rycid_first_data.split(",");
  505 + for (i = 0; i < dbbmnames.length; i++) {
  506 + dataSelect_temp.push({
  507 + id: rycids[i],
  508 + dbbm: dbbmnames[i],
  509 + isstart: false
  510 + });
  511 + for (j = 0; j < data_temp.length; j++) {
  512 + if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
  513 + dataSelect_temp[i].jsy = data_temp[j].jsy;
  514 + dataSelect_temp[i].spy = data_temp[j].spy;
  515 + break;
  516 + }
  517 + }
  518 + }
  519 + // 初始人员
  520 + scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;
  521 +
  522 + }
  523 +
  524 + console.log("数据初始化完毕!");
  525 + self.$$data_init = true;
  526 + }
  527 +
  528 + };
  529 +
  530 + // 监控初始化标志,线路,人员,起始人员
  531 + scope.$watch(
  532 + function() {
  533 + return scope[ctrlAs].$$data_xl_first_init;
  534 + },
  535 + function(newValue, oldValue) {
  536 + scope[ctrlAs].$$internal_validate_init();
  537 + }
  538 + );
  539 + scope.$watch(
  540 + function() {
  541 + return scope[ctrlAs].$$data_ry_first_init;
  542 + },
  543 + function(newValue, oldValue) {
  544 + scope[ctrlAs].$$internal_validate_init();
  545 + }
  546 + );
  547 + scope.$watch(
  548 + function() {
  549 + return scope[ctrlAs].$$data_rycid_first_init;
  550 + },
  551 + function(newValue, oldValue) {
  552 + scope[ctrlAs].$$internal_validate_init();
  553 + }
  554 + );
  555 + scope.$watch(
  556 + function() {
  557 + return scope[ctrlAs].$$data_rystart_first_init;
  558 + },
  559 + function(newValue, oldValue) {
  560 + scope[ctrlAs].$$internal_validate_init();
  561 + }
  562 + );
  563 +
  564 +
  565 + // 监控线路id的变化
  566 + attr.$observe("xlidvalue", function(value) {
  567 + if (value && value != "") {
  568 + console.log("xlidvalue=" + value);
  569 +
  570 + employeeConfigService_g.rest.list(
  571 + {"xl.id_eq": value, "isCancel_eq" : false, size: 100},
  572 + function(result) {
  573 + // 获取值了
  574 + console.log("人员配置获取了");
  575 +
  576 + scope[ctrlAs].$$data = [];
  577 + for (var i = 0; i < result.content.length; i++) {
  578 + scope[ctrlAs].$$data.push({
  579 + id: result.content[i].id,
  580 + dbbm: result.content[i].dbbm,
  581 + jsy: result.content[i].jsy.personnelName,
  582 + spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
  583 + });
  584 + }
  585 + if (scope[ctrlAs].$$data_init) {
  586 + scope[ctrlAs].$$dataSelected = [];
  587 + scope[ctrlAs].$$dataSelectedStart = undefined;
  588 +
  589 + scope[ctrlAs].$$dataFBSelected = [];
  590 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  591 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  592 +
  593 + scope[ctrlAs].$$internalmodel = undefined;
  594 + }
  595 + scope[ctrlAs].$$data_xl_first_init = true;
  596 + },
  597 + function(result) {
  598 +
  599 + }
  600 + );
  601 +
  602 + }
  603 + });
  604 +
  605 + // 监控搭班编码范围值的变化
  606 + attr.$observe("dbbmrangevalue", function(value) {
  607 + if (value && value != "") {
  608 + console.log("dbbmrangevalue变换了");
  609 + scope[ctrlAs].$$data_ry_first_init = true;
  610 + scope[ctrlAs].$$data_ry_first_data = value;
  611 + }
  612 + });
  613 +
  614 + // 监控人员配置id范围值的变化
  615 + attr.$observe("rycidrangevalue", function(value) {
  616 + if (value && value != "") {
  617 + console.log("rycidrangevalue变换了");
  618 + scope[ctrlAs].$$data_rycid_first_init = true;
  619 + scope[ctrlAs].$$data_rycid_first_data = value;
  620 + }
  621 + });
  622 +
  623 + // 监控起始人员的变化
  624 + attr.$observe("rystartvalue", function(value) {
  625 + if (value && value != "") {
  626 + console.log("rystartvalue变换了");
  627 + scope[ctrlAs].$$data_rystart_first_init = true;
  628 + scope[ctrlAs].$$data_rystart_first_data = value;
  629 + }
  630 + });
  631 +
  632 + }
  633 + }
  634 +
  635 + }
  636 + }
  637 + }
  638 +]);
  639 +
src/main/resources/static/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html
src/main/resources/static/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroup.js 0 → 100644
  1 +
  2 +
  3 +/**
  4 + * saGuideboardgroup指令
  5 + * 属性如下:
  6 + * name(必须):控件的名字
  7 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  8 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  9 + * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  10 + * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
  11 + * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  12 + * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
  13 + * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  14 + * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
  15 + *
  16 + * required(可选):是否要用required验证
  17 + *
  18 + */
  19 +angular.module('ScheduleApp').directive('saGuideboardgroup', [
  20 + 'GuideboardManageService_g',
  21 + function(guideboardManageService_g) {
  22 + return {
  23 + restrict: 'E',
  24 + templateUrl: '/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html',
  25 + scope: {
  26 + model: "=" // 独立作用域,关联外部的模型object
  27 + },
  28 + controllerAs: '$saGuideboardgroupCtrl',
  29 + bindToController: true,
  30 + controller: function($scope) {
  31 + var self = this;
  32 + self.$$data = []; // 选择线路后,该线路的路牌数据
  33 +
  34 + // 测试数据
  35 + //self.$$data = [
  36 + // {lpid: 1, lpname: '路1', isstart: false},
  37 + // {lpid: 2, lpname: '路2', isstart: true},
  38 + // {lpid: 3, lpname: '路3', isstart: false}
  39 + //];
  40 +
  41 +
  42 + self.$$dataSelected = []; // 选中的路牌列表
  43 + self.$$dataSelectedStart = undefined; // 起始路牌
  44 +
  45 + //self.$$dataSelected = [
  46 + // {lpid: 11, lpname: '路11', isstart: false},
  47 + // {lpid: 12, lpname: '路12', isstart: true},
  48 + // {lpid: 13, lpname: '路13', isstart: false}
  49 + //];
  50 +
  51 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
  52 + self.$$internalmodel = undefined;
  53 +
  54 + self.$$data_init = false; // *数据源初始化标志
  55 + self.$$data_xl_first_init = false; // 线路是否初始化
  56 + self.$$data_lp_first_init = false; // 路牌名字是否初始化
  57 + self.$$data_lpid_first_init = false; // 路牌id是否初始化
  58 + self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
  59 +
  60 + },
  61 +
  62 + /**
  63 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  64 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  65 + * @param tElem
  66 + * @param tAttrs
  67 + * @returns {{pre: Function, post: Function}}
  68 + */
  69 + compile: function(tElem, tAttrs) {
  70 + // TODO:获取所有的属性
  71 + var $name_attr = tAttrs["name"]; // 控件的名字
  72 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  73 + var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
  74 + var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
  75 + var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
  76 +
  77 + // controlAs名字
  78 + var ctrlAs = '$saGuideboardgroupCtrl';
  79 +
  80 + // 如果有required属性,添加angularjs required验证
  81 + if ($required_attr != undefined) {
  82 + //console.log(tElem.html());
  83 + tElem.find("div").attr("required", "");
  84 + }
  85 +
  86 + return {
  87 + pre: function(scope, element, attr) {
  88 + // TODO:
  89 + },
  90 +
  91 + /**
  92 + * 相当于link函数。
  93 + * @param scope
  94 + * @param element
  95 + * @param attr
  96 + */
  97 + post: function(scope, element, attr) {
  98 + // name属性
  99 + if ($name_attr) {
  100 + scope[ctrlAs]["$name_attr"] = $name_attr;
  101 + }
  102 +
  103 + // TODO:
  104 +
  105 +
  106 + /**
  107 + * 路牌列表点击(路牌列表中选中路牌)
  108 + * @param $index
  109 + */
  110 + scope[ctrlAs].$$internal_lplist_click = function($index) {
  111 + var data_temp = scope[ctrlAs].$$data;
  112 + if (data_temp && data_temp.length > $index) {
  113 + scope[ctrlAs].$$dataSelected.push({
  114 + lpid: data_temp[$index].lpid,
  115 + lpname: data_temp[$index].lpname,
  116 + isstart: data_temp[$index].isstart
  117 + });
  118 +
  119 + // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
  120 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  121 + scope[ctrlAs].$$internal_sellplist_click(
  122 + scope[ctrlAs].$$dataSelected.length - 1);
  123 + }
  124 + }
  125 + };
  126 + /**
  127 + * 选中的路牌单击(初始路牌选择)
  128 + * @param $index
  129 + */
  130 + scope[ctrlAs].$$internal_sellplist_click = function($index) {
  131 + var data_temp = scope[ctrlAs].$$dataSelected;
  132 + if (data_temp && data_temp.length > $index) {
  133 + for (var i = 0; i < data_temp.length; i++) {
  134 + data_temp[i].isstart = false;
  135 + }
  136 + data_temp[$index].isstart = true;
  137 + scope[ctrlAs].$$dataSelectedStart = $index;
  138 + }
  139 + };
  140 + /**
  141 + * 选中的路牌双击(删除选中的路牌)
  142 + * @param $index
  143 + */
  144 + scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
  145 + var data_temp = scope[ctrlAs].$$dataSelected;
  146 + if (data_temp && data_temp.length > $index) {
  147 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  148 + scope[ctrlAs].$$dataSelectedStart = undefined;
  149 + }
  150 + data_temp.splice($index, 1);
  151 + }
  152 + };
  153 +
  154 +
  155 + /**
  156 + * 验证内部数据,更新外部model
  157 + */
  158 + scope[ctrlAs].$$internal_validate_model = function() {
  159 + var data_temp = scope[ctrlAs].$$dataSelected;
  160 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  161 + var lpNames = [];
  162 + var lpIds = [];
  163 + var lpStart = 0;
  164 + var i = 0;
  165 +
  166 + if (data_temp &&
  167 + data_temp.length > 0 &&
  168 + data_temp2 != undefined) {
  169 +
  170 + for (i = 0; i < data_temp.length; i++) {
  171 + lpNames.push(data_temp[i].lpname);
  172 + lpIds.push(data_temp[i].lpid)
  173 + }
  174 + data_temp[data_temp2].isstart = true;
  175 + lpStart = data_temp2 + 1;
  176 +
  177 + // 更新内部model,用于外部验证
  178 + // 内部model的值暂时随意,以后再改
  179 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  180 +
  181 + // 更新外部model字段
  182 + if ($lprangename_attr) {
  183 + console.log("lprangename=" + lpNames.join(','));
  184 + eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
  185 + }
  186 + if ($lpidrangename_attr) {
  187 + console.log("lpidrangename=" + lpIds.join(','));
  188 + eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
  189 + }
  190 + if ($lpstartname_attr) {
  191 + console.log("lpstartname=" + lpStart);
  192 + eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
  193 + }
  194 +
  195 + } else {
  196 + scope[ctrlAs].$$internalmodel = undefined;
  197 + }
  198 +
  199 +
  200 + };
  201 +
  202 + // 监控内部数据,$$data_selected 变化
  203 + scope.$watch(
  204 + function() {
  205 + return scope[ctrlAs].$$dataSelected;
  206 + },
  207 + function(newValue, oldValue) {
  208 + scope[ctrlAs].$$internal_validate_model();
  209 + },
  210 + true
  211 + );
  212 +
  213 + // 监控内部数据,$$data_selected_start 变化
  214 + scope.$watch(
  215 + function() {
  216 + return scope[ctrlAs].$$dataSelectedStart;
  217 + },
  218 + function(newValue, oldValue) {
  219 + scope[ctrlAs].$$internal_validate_model();
  220 + },
  221 + true
  222 + );
  223 +
  224 + /**
  225 + * 验证数据是否初始化完成,
  226 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  227 + */
  228 + scope[ctrlAs].$$internal_validate_init = function() {
  229 + var self = scope[ctrlAs];
  230 +
  231 + if (self.$$data_xl_first_init &&
  232 + self.$$data_lp_first_init &&
  233 + self.$$data_lpid_first_init &&
  234 + self.$$data_lpstart_first_init) {
  235 + console.log("数据初始化完毕!");
  236 + self.$$data_init = true;
  237 + }
  238 +
  239 + };
  240 +
  241 + // 监控初始化标志,线路,路牌,路牌id,起始路牌
  242 + scope.$watch(
  243 + function() {
  244 + return scope[ctrlAs].$$data_xl_first_init;
  245 + },
  246 + function(newValue, oldValue) {
  247 + scope[ctrlAs].$$internal_validate_init();
  248 + }
  249 + );
  250 + scope.$watch(
  251 + function() {
  252 + return scope[ctrlAs].$$data_lp_first_init;
  253 + },
  254 + function(newValue, oldValue) {
  255 + scope[ctrlAs].$$internal_validate_init();
  256 + }
  257 + );
  258 + scope.$watch(
  259 + function() {
  260 + return scope[ctrlAs].$$data_lpid_first_init;
  261 + },
  262 + function(newValue, oldValue) {
  263 + scope[ctrlAs].$$internal_validate_init();
  264 + }
  265 + );
  266 + scope.$watch(
  267 + function() {
  268 + return scope[ctrlAs].$$data_lpstart_first_init;
  269 + },
  270 + function(newValue, oldValue) {
  271 + scope[ctrlAs].$$internal_validate_init();
  272 + }
  273 + );
  274 +
  275 +
  276 + // 监控线路id的变化
  277 + attr.$observe("xlidvalue", function(value) {
  278 + if (value && value != "") {
  279 + console.log("xlidvalue=" + value);
  280 +
  281 + guideboardManageService_g.rest.list(
  282 + {"xl.id_eq": value, size: 100},
  283 + function(result) {
  284 + // 获取值了
  285 + console.log("路牌获取了");
  286 +
  287 + scope[ctrlAs].$$data = [];
  288 + for (var i = 0; i < result.content.length; i++) {
  289 + scope[ctrlAs].$$data.push({
  290 + lpid: result.content[i].id,
  291 + lpname: result.content[i].lpName,
  292 + isstart: false
  293 + });
  294 + }
  295 + if (scope[ctrlAs].$$data_init) {
  296 + scope[ctrlAs].$$dataSelected = [];
  297 + scope[ctrlAs].$$dataSelectedStart = undefined;
  298 + scope[ctrlAs].$$internalmodel = undefined;
  299 + }
  300 + scope[ctrlAs].$$data_xl_first_init = true;
  301 + },
  302 + function(result) {
  303 +
  304 + }
  305 + );
  306 +
  307 + }
  308 + });
  309 +
  310 + // 监控路牌名称范围值的变化
  311 + attr.$observe("lprangevalue", function(value) {
  312 + if (value && value != "") {
  313 + var data_temp = scope[ctrlAs].$$dataSelected;
  314 + var lpnames = value.split(",");
  315 + var i = 0;
  316 + if (data_temp && data_temp.length == 0) { // 初始创建
  317 + console.log("lprangevalue变换了");
  318 + for (i = 0; i < lpnames.length; i++) {
  319 + scope[ctrlAs].$$dataSelected.push({
  320 + lpname: lpnames[i],
  321 + isstart: false
  322 + });
  323 + }
  324 + } else {
  325 + for (i = 0; i < lpnames.length; i++) {
  326 + data_temp[i].lpname = lpnames[i];
  327 + }
  328 + }
  329 + scope[ctrlAs].$$data_lp_first_init = true;
  330 + }
  331 + });
  332 +
  333 + // 监控路牌id范围值的变化
  334 + attr.$observe("lpidrangevalue", function(value) {
  335 + if (value && value != "") {
  336 + console.log("lpidrangevalue=" + value);
  337 + var data_temp = scope[ctrlAs].$$dataSelected;
  338 + var lpids = value.split(",");
  339 + var i = 0;
  340 + if (data_temp && data_temp.length == 0) { // 初始创建
  341 + console.log("lpidrangevalue");
  342 + for (i = 0; i < lpids.length; i++) {
  343 + scope[ctrlAs].$$dataSelected.push({
  344 + lpid: lpids[i],
  345 + isstart: false
  346 + });
  347 + }
  348 + } else {
  349 + for (i = 0; i < lpids.length; i++) {
  350 + data_temp[i].lpid = lpids[i];
  351 + }
  352 + }
  353 + scope[ctrlAs].$$data_lpid_first_init = true;
  354 + }
  355 + });
  356 +
  357 + // 监控起始路牌的变化
  358 + attr.$observe("lpstartvalue", function(value) {
  359 + if (value && value != "") {
  360 + scope[ctrlAs].$$dataSelectedStart = value - 1;
  361 + scope[ctrlAs].$$data_lpstart_first_init = true;
  362 + }
  363 + });
  364 +
  365 +
  366 +
  367 + }
  368 + }
  369 +
  370 + }
  371 + }
  372 + }
  373 +]);
  374 +
src/main/resources/static/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html renamed to src/main/resources/static/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
1 -// 自定义指令,指令模版在dt目录下  
2 -  
3 - 1 +//自定义指令
  2 +/**
  3 + * loading载入中指令。
  4 + */
4 angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) { 5 angular.module('ScheduleApp').directive('loadingWidget', ['requestNotificationChannel', function(requestNotificationChannel) {
5 return { 6 return {
6 restrict: 'A', 7 restrict: 'A',
@@ -19,11 +20,157 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;loadingWidget&#39;, [&#39;requestNotificationCh @@ -19,11 +20,157 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;loadingWidget&#39;, [&#39;requestNotificationCh
19 } 20 }
20 }; 21 };
21 }]); 22 }]);
  23 +angular.module('ScheduleApp').directive("remoteValidaton", [
  24 + 'BusInfoManageService_g',
  25 + 'EmployeeInfoManageService_g',
  26 + 'TimeTableManageService_g',
  27 + function(
  28 + busInfoManageService_g,
  29 + employeeInfoManageService_g,
  30 + timeTableManageService_g
  31 + ) {
  32 + /**
  33 + * 远端验证指令,依赖于ngModel
  34 + * 指令名称 remote-Validation
  35 + * 需要属性 rvtype 表示验证类型
  36 + */
  37 + return {
  38 + restrict: "A",
  39 + require: "^ngModel",
  40 + link: function(scope, element, attr, ngModelCtrl) {
  41 + element.bind("keyup", function() {
  42 + var modelValue = ngModelCtrl.$modelValue;
  43 + var rv1_attr = attr["rv1"];
  44 + if (attr["rvtype"]) {
  45 +
  46 + // 根据rvtype的值,确定使用那个远端验证的url,
  47 + // rv1, rv2, rv3是关联比较值,暂时使用rv1
  48 + // 这个貌似没法通用,根据业务变换
  49 + // TODO:暂时有点乱以后改
  50 + if (attr["rvtype"] == "insideCode") {
  51 + busInfoManageService_g.validate.insideCode(
  52 + {"insideCode_eq": modelValue, type: "equale"},
  53 + function(result) {
  54 + //console.log(result);
  55 + if (result.status == "SUCCESS") {
  56 + ngModelCtrl.$setValidity('remote', true);
  57 + } else {
  58 + ngModelCtrl.$setValidity('remote', false);
  59 + }
  60 + },
  61 + function(result) {
  62 + //console.log(result);
  63 + ngModelCtrl.$setValidity('remote', true);
  64 + }
  65 + );
  66 + } else if (attr["rvtype"] == "jobCode") {
  67 + if (!rv1_attr) {
  68 + ngModelCtrl.$setValidity('remote', false);
  69 + return;
  70 + }
  71 +
  72 + employeeInfoManageService_g.validate.jobCode(
  73 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  74 + function(result) {
  75 + //console.log(result);
  76 + if (result.status == "SUCCESS") {
  77 + ngModelCtrl.$setValidity('remote', true);
  78 + } else {
  79 + ngModelCtrl.$setValidity('remote', false);
  80 + }
  81 + },
  82 + function(result) {
  83 + //console.log(result);
  84 + ngModelCtrl.$setValidity('remote', true);
  85 + }
  86 + );
  87 + } else if (attr["rvtype"] == "ttinfoname") {
  88 + if (!rv1_attr) {
  89 + ngModelCtrl.$setValidity('remote', false);
  90 + return;
  91 + }
  92 +
  93 + timeTableManageService_g.validate.ttinfoname(
  94 + {"name_eq": modelValue, "xl.id_eq": rv1_attr, type: "equale"},
  95 + function(result) {
  96 + //console.log(result);
  97 + if (result.status == "SUCCESS") {
  98 + ngModelCtrl.$setValidity('remote', true);
  99 + } else {
  100 + ngModelCtrl.$setValidity('remote', false);
  101 + }
  102 + },
  103 + function(result) {
  104 + //console.log(result);
  105 + ngModelCtrl.$setValidity('remote', true);
  106 + }
  107 + );
  108 +
  109 + }
  110 + } else {
  111 + // 没有rvtype,就不用远端验证了
  112 + ngModelCtrl.$setValidity('remote', true);
  113 + }
  114 +
  115 + attr.$observe("rv1", function(value) {
  116 + if (attr["rvtype"] == "jobCode") {
  117 + if (!value) {
  118 + ngModelCtrl.$setValidity('remote', false);
  119 + return;
  120 + }
  121 +
  122 + employeeInfoManageService_g.validate.jobCode(
  123 + {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},
  124 + function(result) {
  125 + //console.log(result);
  126 + if (result.status == "SUCCESS") {
  127 + ngModelCtrl.$setValidity('remote', true);
  128 + } else {
  129 + ngModelCtrl.$setValidity('remote', false);
  130 + }
  131 + },
  132 + function(result) {
  133 + //console.log(result);
  134 + ngModelCtrl.$setValidity('remote', true);
  135 + }
  136 + );
  137 + } else if (attr["rvtype"] == "ttinfoname") {
  138 + if (!value) {
  139 + ngModelCtrl.$setValidity('remote', false);
  140 + return;
  141 + }
  142 +
  143 + console.log("rv1:" + value);
  144 +
  145 + timeTableManageService_g.validate.ttinfoname(
  146 + {"name_eq": modelValue, "xl.id_eq": value, type: "equale"},
  147 + function(result) {
  148 + //console.log(result);
  149 + if (result.status == "SUCCESS") {
  150 + ngModelCtrl.$setValidity('remote', true);
  151 + } else {
  152 + ngModelCtrl.$setValidity('remote', false);
  153 + }
  154 + },
  155 + function(result) {
  156 + //console.log(result);
  157 + ngModelCtrl.$setValidity('remote', true);
  158 + }
  159 + );
  160 + }
  161 +
  162 + });
  163 + });
  164 + }
  165 + };
  166 + }
  167 + ]
  168 +);
22 169
23 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) { 170 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
24 return { 171 return {
25 restrict: 'E', 172 restrict: 'E',
26 - templateUrl: '/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html', 173 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelectTemplate.html',
27 scope: { 174 scope: {
28 model: "=" 175 model: "="
29 }, 176 },
@@ -132,548 +279,118 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect&quot;, [&#39;$timeout&#39;, function($timeo @@ -132,548 +279,118 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect&quot;, [&#39;$timeout&#39;, function($timeo
132 }; 279 };
133 }]); 280 }]);
134 281
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 282
163 - var self = this;  
164 - self.$$data = null; // 内部数据  
165 - },  
166 283
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"]; // 标示单选框是否可选 284 +angular.module('ScheduleApp').directive("saSelect2", [
  285 + '$timeout', '$$SearchInfoService_g',
  286 + function($timeout, $$searchInfoService_g) {
  287 + return {
  288 + restrict: 'E',
  289 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect2Template.html',
  290 + scope: {
  291 + model: "=" // 独立作用域,关联外部的模型对象
  292 + },
  293 + controllerAs: "$saSelectCtrl",
  294 + bindToController: true,
  295 + controller: function($scope) {
  296 + var self = this;
  297 + self.$$data = []; // 内部关联的数据
  298 + },
  299 + /**
  300 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  301 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  302 + * @param tElem
  303 + * @param tAttrs
  304 + * @returns {{pre: Function, post: Function}}
  305 + */
  306 + compile: function(tElem, tAttrs) {
  307 + // 1、获取此阶段使用的属性
  308 + var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。
180 309
181 - // controlAs名字  
182 - var ctrlAs = "$saRadiogroupCtrl"; 310 + // 2、处理属性
183 311
184 - // 如果有required属性,添加angularjs required验证  
185 - if ($required_attr != undefined) {  
186 - tElem.find("input").attr("required", "");  
187 - } 312 + // 确定是否使用angularjs required验证
  313 + // 属性 required
  314 + // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加
  315 + if ($required_attr) {
  316 + if ($required_attr == "true") {
  317 + // 添加required属性指令
  318 + tElem.find("ui-select").attr("required", "");
  319 + } else {
  320 + // 不等于true,不添加required属性指令
  321 + }
  322 + } else {
  323 + // 不添加required属性指令
  324 + }
188 325
189 - return {  
190 - pre: function(scope, element, attr) { 326 + //console.log("saSelect" + ":compile = >" + tElem.html());
191 327
192 - }, 328 + return {
  329 + pre: function(scope, element, attr) {
  330 + // TODO:
  331 + },
  332 + /**
  333 + * 相当于link函数。
  334 + *
  335 + * 重要属性如下:
  336 + * model 是绑定外部值。
  337 + * dicgroup 字典组的类型
  338 + * name input name属性值
  339 + */
  340 + post: function(scope, element, attr) {
  341 + // 1、获取此阶段使用的属性
  342 + var $name_attr = attr["name"]; // 表单验证时需要的名字
  343 + var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  344 + var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)
  345 + var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)
  346 + var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)
  347 + var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)
  348 + var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名
  349 + var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述
193 350
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}; 351 + // 2、处理属性、转换成$saSelectCtrl内部使用的属性
  352 + if ($name_attr) {
  353 + scope["$saSelectCtrl"].$name_attr = $name_attr;
  354 + }
  355 + if ($placeholder_attr) {
  356 + scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;
  357 + }
  358 + if ($showcolname_attr) {
  359 + scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;
  360 + }
204 361
205 - if ($name_attr) {  
206 - scope[ctrlAs].nv = $name_attr;  
207 - } 362 + // 2-1、添加内部方法,根据type值,改变$$data的值
  363 + scope["$saSelectCtrl"].$$internal_data_change_fn = function() {
  364 + // 根据type属性动态载入数据
  365 + if ($type_attr) {
  366 + $$searchInfoService_g[$type_attr].list(
  367 + {type: "all"},
  368 + function(result) {
  369 + scope["$saSelectCtrl"].$$data = [];
  370 + for (var i = 0; i < result.length; i ++) {
  371 + var data = {}; // data是result的一部分属性集合,根据配置来确定
  372 + if ($datacolname1_attr) {
  373 + data[$datacolname1_attr] = result[i][$datacolname1_attr];
  374 + }
  375 + if ($datacolname2_attr) {
  376 + data[$datacolname2_attr] = result[i][$datacolname2_attr];
  377 + }
  378 + if ($showcolname_attr) {
  379 + // 动态添加基于名字的拼音
  380 + data[$showcolname_attr] = result[i][$showcolname_attr];
  381 + if (data[$showcolname_attr]) {
  382 + data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼
  383 + data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼
  384 + }
  385 + }
  386 + if (data["fullChars"])
  387 + scope["$saSelectCtrl"].$$data.push(data);
  388 + }
  389 + },
  390 + function(result) {
208 391
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 - lpInfo: $resource(  
462 - '/gic/ttlpnames',  
463 - {order: "lpName", direction: 'ASC'},  
464 - {  
465 - list: {  
466 - method: 'GET',  
467 - isArray: true  
468 - }  
469 - }  
470 - ),  
471 - lpInfo2: $resource(  
472 - '/gic/:type',  
473 - {order: "lpName", direction: 'ASC'},  
474 - {  
475 - list: {  
476 - method: 'GET',  
477 - isArray: true  
478 - }  
479 - }  
480 - ),  
481 - cci: $resource(  
482 - '/cci/cars',  
483 - {},  
484 - {  
485 - list: {  
486 - method: 'GET',  
487 - isArray: true  
488 - }  
489 - }  
490 -  
491 - ),  
492 - cci2: $resource(  
493 - '/cci/:type',  
494 - {},  
495 - {  
496 - list: {  
497 - method: 'GET',  
498 - isArray: true  
499 - }  
500 - }  
501 - ),  
502 - cci3: $resource(  
503 - '/cci/cars2',  
504 - {},  
505 - {  
506 - list: {  
507 - method: 'GET',  
508 - isArray: true  
509 - }  
510 - }  
511 -  
512 - ),  
513 - eci: $resource(  
514 - '/eci/jsy',  
515 - {},  
516 - {  
517 - list: {  
518 - method: 'GET',  
519 - isArray: true  
520 - }  
521 - }  
522 - ),  
523 - eci2: $resource(  
524 - '/eci/spy',  
525 - {},  
526 - {  
527 - list: {  
528 - method: 'GET',  
529 - isArray: true  
530 - }  
531 - }  
532 - ),  
533 - eci3: $resource(  
534 - '/eci/:type',  
535 - {},  
536 - {  
537 - list: {  
538 - method: 'GET',  
539 - isArray: true  
540 - }  
541 - }  
542 - ),  
543 - }  
544 -}]);  
545 -angular.module('ScheduleApp').filter("$$pyFilter", function() {  
546 - return function(items, props) {  
547 - var out = [];  
548 - var limit = props["limit"] || 20; // 默认20条记录  
549 -  
550 - if (angular.isArray(items)) {  
551 - items.forEach(function(item) {  
552 - if (out.length < limit) {  
553 - if (props.search) {  
554 - var upTerm = props.search.toUpperCase();  
555 - if(item.fullChars.indexOf(upTerm) != -1  
556 - || item.camelChars.indexOf(upTerm) != -1) {  
557 - out.push(item);  
558 - }  
559 - }  
560 - }  
561 - });  
562 - }  
563 -  
564 - return out;  
565 - };  
566 -});  
567 -angular.module('ScheduleApp').directive("saSelect2", [  
568 - '$timeout', '$$SearchInfoService_g',  
569 - function($timeout, $$searchInfoService_g) {  
570 - return {  
571 - restrict: 'E',  
572 - templateUrl: '/pages/scheduleApp/module/other/MySearchSelectTemplate.html',  
573 - scope: {  
574 - model: "=" // 独立作用域,关联外部的模型对象  
575 - },  
576 - controllerAs: "$saSelectCtrl",  
577 - bindToController: true,  
578 - controller: function($scope) {  
579 - var self = this;  
580 - self.$$data = []; // 内部关联的数据  
581 - },  
582 - /**  
583 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
584 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
585 - * @param tElem  
586 - * @param tAttrs  
587 - * @returns {{pre: Function, post: Function}}  
588 - */  
589 - compile: function(tElem, tAttrs) {  
590 - // 1、获取此阶段使用的属性  
591 - var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。  
592 -  
593 - // 2、处理属性  
594 -  
595 - // 确定是否使用angularjs required验证  
596 - // 属性 required  
597 - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加  
598 - if ($required_attr) {  
599 - if ($required_attr == "true") {  
600 - // 添加required属性指令  
601 - tElem.find("ui-select").attr("required", "");  
602 - } else {  
603 - // 不等于true,不添加required属性指令  
604 - }  
605 - } else {  
606 - // 不添加required属性指令  
607 - }  
608 -  
609 - //console.log("saSelect" + ":compile = >" + tElem.html());  
610 -  
611 - return {  
612 - pre: function(scope, element, attr) {  
613 - // TODO:  
614 - },  
615 - /**  
616 - * 相当于link函数。  
617 - *  
618 - * 重要属性如下:  
619 - * model 是绑定外部值。  
620 - * dicgroup 字典组的类型  
621 - * name input name属性值  
622 - */  
623 - post: function(scope, element, attr) {  
624 - // 1、获取此阶段使用的属性  
625 - var $name_attr = attr["name"]; // 表单验证时需要的名字  
626 - var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加  
627 - var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)  
628 - var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)  
629 - var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)  
630 - var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)  
631 - var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名  
632 - var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述  
633 -  
634 - // 2、处理属性、转换成$saSelectCtrl内部使用的属性  
635 - if ($name_attr) {  
636 - scope["$saSelectCtrl"].$name_attr = $name_attr;  
637 - }  
638 - if ($placeholder_attr) {  
639 - scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;  
640 - }  
641 - if ($showcolname_attr) {  
642 - scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;  
643 - }  
644 -  
645 - // 2-1、添加内部方法,根据type值,改变$$data的值  
646 - scope["$saSelectCtrl"].$$internal_data_change_fn = function() {  
647 - // 根据type属性动态载入数据  
648 - if ($type_attr) {  
649 - $$searchInfoService_g[$type_attr].list(  
650 - {type: "all"},  
651 - function(result) {  
652 - scope["$saSelectCtrl"].$$data = [];  
653 - for (var i = 0; i < result.length; i ++) {  
654 - var data = {}; // data是result的一部分属性集合,根据配置来确定  
655 - if ($datacolname1_attr) {  
656 - data[$datacolname1_attr] = result[i][$datacolname1_attr];  
657 - }  
658 - if ($datacolname2_attr) {  
659 - data[$datacolname2_attr] = result[i][$datacolname2_attr];  
660 - }  
661 - if ($showcolname_attr) {  
662 - // 动态添加基于名字的拼音  
663 - data[$showcolname_attr] = result[i][$showcolname_attr];  
664 - if (data[$showcolname_attr]) {  
665 - data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼  
666 - data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼  
667 - }  
668 - }  
669 - if (data["fullChars"])  
670 - scope["$saSelectCtrl"].$$data.push(data);  
671 - }  
672 - },  
673 - function(result) {  
674 -  
675 - }  
676 - ); 392 + }
  393 + );
677 } 394 }
678 }; 395 };
679 396
@@ -721,6 +438,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect2&quot;, [ @@ -721,6 +438,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect2&quot;, [
721 } 438 }
722 ]); 439 ]);
723 440
  441 +
  442 +
  443 +
  444 +
724 /** 445 /**
725 * saSelect3指令 446 * saSelect3指令
726 * 属性如下: 447 * 属性如下:
@@ -750,7 +471,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [ @@ -750,7 +471,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
750 function($timeout, $$searchInfoService_g) { 471 function($timeout, $$searchInfoService_g) {
751 return { 472 return {
752 restrict: 'E', 473 restrict: 'E',
753 - templateUrl: '/pages/scheduleApp/module/common/dt/MyUiSelectWrapTemplate1.html', 474 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect3Template.html',
754 scope: { 475 scope: {
755 model: "=" // 独立作用域,关联外部的模型object 476 model: "=" // 独立作用域,关联外部的模型object
756 }, 477 },
@@ -1108,41 +829,44 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [ @@ -1108,41 +829,44 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
1108 } 829 }
1109 ]); 830 ]);
1110 831
  832 +
  833 +
1111 /** 834 /**
1112 - * saCheckboxgroup指令  
1113 - * 属性如下: 835 + * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
  836 + * name(必须):控件的名字
1114 * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave 837 * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  838 + * placeholder(可选):输入框占位符字符串
  839 + *
1115 * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}} 840 * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
1116 * dcname(必须):绑定的model字段名,如:dcname=xl.id 841 * dcname(必须):绑定的model字段名,如:dcname=xl.id
1117 - * name(必须):控件的名字  
1118 - * required(可选):是否要用required验证  
1119 - * disabled(可选):标示框是否可选 842 + * icname(必须):内部与之对应的字段名,如:icname=code
1120 * 843 *
  844 + * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}
  845 + * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  846 + * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name
  847 + * required(可选):是否要用required验证
1121 */ 848 */
1122 -angular.module('ScheduleApp').directive('saCheckboxgroup', [  
1123 - function() { 849 +angular.module('ScheduleApp').directive('saSelect4', [
  850 + '$timeout',
  851 + '$$SearchInfoService_g',
  852 + function($timeout, $$searchInfoService_g) {
1124 return { 853 return {
1125 restrict: 'E', 854 restrict: 'E',
1126 - templateUrl: '/pages/scheduleApp/module/common/dt/MyCheckboxGroupWrapTemplate.html', 855 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html',
1127 scope: { 856 scope: {
1128 model: "=" // 独立作用域,关联外部的模型object 857 model: "=" // 独立作用域,关联外部的模型object
1129 }, 858 },
1130 - controllerAs: "$saCheckboxgroupCtrl", 859 + controllerAs: "$saSelectCtrl",
1131 bindToController: true, 860 bindToController: true,
1132 controller: function($scope) { 861 controller: function($scope) {
1133 var self = this; 862 var self = this;
1134 - self.$$data = []; // 内部的数据 863 + self.$$data = []; // ui-select显示用的数据
  864 + self.$$data_real = []; // 内部真实的数据
1135 865
1136 - // TODO:数据写死,周一至周日选择数据,以后有别的数据再议  
1137 - self.$$data = [  
1138 - {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1139 - {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1140 - {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1141 - {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1142 - {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1143 - {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},  
1144 - {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}  
1145 - ]; 866 + // saSelect4组件的ng-model,用于外部绑定验证等操作
  867 + self.$$internalmodel = undefined;
  868 +
  869 + self.$$internal_select_value = undefined; // 选中的值
1146 }, 870 },
1147 871
1148 /** 872 /**
@@ -1153,29 +877,54 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saCheckboxgroup&#39;, [ @@ -1153,29 +877,54 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saCheckboxgroup&#39;, [
1153 * @returns {{pre: Function, post: Function}} 877 * @returns {{pre: Function, post: Function}}
1154 */ 878 */
1155 compile: function(tElem, tAttrs) { 879 compile: function(tElem, tAttrs) {
1156 - // 获取所有的属性 880 + // 获取属性
1157 var $name_attr = tAttrs["name"]; // 控件的名字 881 var $name_attr = tAttrs["name"]; // 控件的名字
1158 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
1159 - var $disabled_attr = tAttrs["disabled"]; // 是否禁用 882 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  883 +
1160 var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名 884 var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  885 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  886 +
  887 + var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射
  888 + var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息
  889 + var $required_attr = tAttrs["required"]; // 是否需要required验证
1161 890
1162 // controlAs名字 891 // controlAs名字
1163 - var ctrlAs = '$saCheckboxgroupCtrl'; 892 + var ctrlAs = "$saSelectCtrl";
1164 893
1165 - // 如果有required属性,添加angularjs required验证 894 + // 验证属性
  895 + if (!$name_attr) {
  896 + throw new error("name属性必须填写");
  897 + }
  898 + if (!$dcname_attr) {
  899 + throw new error("dcname属性必须填写");
  900 + }
  901 + if (!$icname_attr) {
  902 + throw new error("icname属性必须填写");
  903 + }
  904 + if (!$dscol_attr) {
  905 + throw new error("dscol属性必须填写");
  906 + }
  907 +
  908 + // 动态设置dom
  909 + // dom required 属性
1166 if ($required_attr != undefined) { 910 if ($required_attr != undefined) {
1167 - //console.log(tElem.html());  
1168 tElem.find("div").attr("required", ""); 911 tElem.find("div").attr("required", "");
1169 } 912 }
1170 - // 如果有disabled属性,添加禁用标志  
1171 - if ($disabled_attr != undefined) {  
1172 - tElem.find("input").attr("ng-disabled", "true");  
1173 - } 913 + // dom placeholder 属性
  914 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  915 + // dom dscol 属性
  916 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");
  917 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);
  918 + // dom icname 属性
  919 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  920 + // dom name 属性
  921 + tElem.find("div").attr("name", $name_attr);
1174 922
1175 return { 923 return {
1176 pre: function(scope, element, attr) { 924 pre: function(scope, element, attr) {
1177 // TODO: 925 // TODO:
1178 }, 926 },
  927 +
1179 /** 928 /**
1180 * 相当于link函数。 929 * 相当于link函数。
1181 * @param scope 930 * @param scope
@@ -1183,331 +932,271 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saCheckboxgroup&#39;, [ @@ -1183,331 +932,271 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saCheckboxgroup&#39;, [
1183 * @param attr 932 * @param attr
1184 */ 933 */
1185 post: function(scope, element, attr) { 934 post: function(scope, element, attr) {
1186 - // name属性  
1187 - if ($name_attr) {  
1188 - scope[ctrlAs]["$name_attr"] = $name_attr;  
1189 - }  
1190 935
1191 - /**  
1192 - * checkbox选择事件处理函数。  
1193 - * @param $d 数据对象,$$data中的元素对象  
1194 - */  
1195 - scope[ctrlAs].$$internal_updateCheck_fn = function($d) {  
1196 - $d.ischecked = !$d.ischecked;  
1197 - console.log($d);  
1198 - }; 936 + // 添加选中事件处理函数
  937 + scope[ctrlAs].$$internal_select_fn = function($item) {
  938 + if ($dcname_attr && $icname_attr) {
  939 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  940 + }
1199 941
1200 - // 测试使用watch监控$$data的变化  
1201 - scope.$watch(  
1202 - function() {  
1203 - return scope[ctrlAs]["$$data"];  
1204 - },  
1205 - function(newValue, oldValue) {  
1206 - // 根据$$data生成对应的数据  
1207 - var rule_days_arr = [];  
1208 - var i;  
1209 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
1210 - if (scope[ctrlAs]["$$data"][i].ischecked)  
1211 - rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);  
1212 - else  
1213 - rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue); 942 + if ($cmaps_attr) {
  943 + for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名
  944 + var ic = $cmaps_attr[mc]; // 内部数据源对应字段
  945 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
1214 } 946 }
1215 - scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");  
1216 - //scope[ctrlAs].$$internalmodel = undefined;  
1217 - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel); 947 + }
  948 + };
1218 949
1219 - // 更新model  
1220 - if ($dcname_attr) {  
1221 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");  
1222 - } 950 + // 删除选中事件处理函数
  951 + scope[ctrlAs].$$internal_remove_fn = function() {
  952 + scope[ctrlAs].$$internal_select_value = undefined;
  953 + if ($dcname_attr) {
  954 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  955 + }
1223 956
  957 + if ($cmaps_attr) {
  958 + var mc; // model的字段名
  959 + for (mc in $cmaps_attr) {
  960 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  961 + }
  962 + }
  963 + scope[ctrlAs].$$internal_validate_model();
  964 + };
1224 965
1225 - },  
1226 - true  
1227 - ); 966 + // 刷新数据
  967 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  968 + if (search && search != "") { // 有search值
  969 + // 处理search
  970 + console.log("search:" + search);
1228 971
1229 - // TODO: 972 + scope[ctrlAs].$$data = [];
  973 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  974 + var upTerm = search.toUpperCase();
  975 + if (scope[ctrlAs].$$data.length < 10) {
  976 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  977 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  978 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  979 + }
  980 + } else {
  981 + break;
  982 + }
  983 + }
  984 + }
  985 + };
1230 986
1231 - // 监控dcvalue model值变换  
1232 - attr.$observe("dcvalue", function(value) {  
1233 - console.log("saCheckboxgroup 监控dc1 model值变换:" + value);  
1234 - if (value) {  
1235 - // 根据value值,修改$$data里的值  
1236 - var data_array = value.split(",");  
1237 - var i;  
1238 - if (data_array.length > scope[ctrlAs]["$$data"].length) {  
1239 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {  
1240 - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {  
1241 - scope[ctrlAs]["$$data"][i].ischecked = true;  
1242 - } else {  
1243 - scope[ctrlAs]["$$data"][i].ischecked = false; 987 + /**
  988 + * 验证内部数据,更新外部model
  989 + */
  990 + scope[ctrlAs].$$internal_validate_model = function() {
  991 + if (scope[ctrlAs].$$internal_select_value) {
  992 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  993 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  994 + var obj;
  995 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  996 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  997 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  998 + break;
1244 } 999 }
1245 } 1000 }
1246 - } else {  
1247 - for (i = 0; i < data_array.length; i ++) {  
1248 - if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {  
1249 - scope[ctrlAs]["$$data"][i].ischecked = true;  
1250 - } else {  
1251 - scope[ctrlAs]["$$data"][i].ischecked = false; 1001 + if (obj) { // 在data中判定有没有
  1002 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  1003 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  1004 + obj = undefined;
  1005 + break;
  1006 + }
1252 } 1007 }
  1008 + if (obj) {
  1009 + scope[ctrlAs].$$data.push(obj);
  1010 + }
  1011 + // 更新内部model,用于外部验证
  1012 + // 内部model的值暂时随意,以后再改
  1013 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  1014 + } else {
  1015 + scope[ctrlAs].$$internalmodel = undefined;
1253 } 1016 }
  1017 +
  1018 + } else {
  1019 + scope[ctrlAs].$$internalmodel = undefined;
1254 } 1020 }
1255 1021
  1022 + } else {
  1023 + scope[ctrlAs].$$internalmodel = undefined;
1256 } 1024 }
1257 - });  
1258 - } 1025 + };
1259 1026
1260 - }; 1027 + /**
  1028 + * 内部方法,读取字典数据作为数据源。
  1029 + * @param atype ajax查询类型
  1030 + * @param ajaxparamobj 查询参数对象
  1031 + */
  1032 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  1033 + ajaxparamobj.type = 'all';
  1034 + $$searchInfoService_g[atype].list(
  1035 + ajaxparamobj,
  1036 + function(result) {
  1037 + console.log("$$internal_ajax_data result");
1261 1038
  1039 + // 清空内部数据
  1040 + scope[ctrlAs].$$data_real = [];
  1041 + scope[ctrlAs].$$data = [];
1262 1042
1263 - } 1043 + // result中添加拼音数据,注意:这里要求result返回对象数组
  1044 + for (var i = 0; i < result.length; i ++) {
  1045 + if ($dscol_attr) {
  1046 + if (eval("result[i]" + "." + $dscol_attr)) {
  1047 + // 全拼
  1048 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();
  1049 + // 简拼
  1050 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));
  1051 + }
  1052 + }
1264 1053
1265 - };  
1266 - }  
1267 -]); 1054 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  1055 + scope[ctrlAs].$$data_real.push(result[i]);
  1056 + }
1268 1057
1269 -/**  
1270 - * saDategroup指令  
1271 - * 属性如下:  
1272 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
1273 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
1274 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
1275 - * name(必须):控件的名字  
1276 - * required(可选):是否要用required验证  
1277 - * disabled(可选):标示框是否可选  
1278 - *  
1279 - */  
1280 -angular.module('ScheduleApp').directive('saDategroup', [  
1281 - '$filter',  
1282 - function($filter) {  
1283 - return {  
1284 - restrict: 'E',  
1285 - templateUrl: '/pages/scheduleApp/module/common/dt/MyDateGroupWrapTemplate.html',  
1286 - scope: {  
1287 - model: "=" // 独立作用域,关联外部的模型object  
1288 - },  
1289 - controllerAs: "$saDategroupCtrl",  
1290 - bindToController: true,  
1291 - controller: function($scope) {  
1292 - var self = this;  
1293 - self.$$data = []; // 内部的数据  
1294 - self.$$date_select; // 内部选中的日期 1058 + }
1295 1059
1296 - //// 测试数据  
1297 - //self.$$data = [  
1298 - // {datestr: '2011-01-01', ischecked: true},  
1299 - // {datestr: '2011-01-01', ischecked: true},  
1300 - // {datestr: '2011-01-01', ischecked: true}  
1301 - //];  
1302 - },  
1303 -  
1304 - /**  
1305 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
1306 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
1307 - * @param tElem  
1308 - * @param tAttrs  
1309 - * @returns {{pre: Function, post: Function}}  
1310 - */  
1311 - compile: function(tElem, tAttrs) {  
1312 - // 获取所有的属性  
1313 - var $name_attr = tAttrs["name"]; // 控件的名字  
1314 - var $required_attr = tAttrs["required"]; // 是否需要required验证  
1315 - var $disabled_attr = tAttrs["disabled"]; // 是否禁用  
1316 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
1317 -  
1318 - // controlAs名字  
1319 - var ctrlAs = '$saDategroupCtrl';  
1320 -  
1321 - // 如果有required属性,添加angularjs required验证  
1322 - if ($required_attr != undefined) {  
1323 - //console.log(tElem.html());  
1324 - tElem.find("div").attr("required", "");  
1325 - }  
1326 - // 如果有disabled属性,添加禁用标志  
1327 - if ($disabled_attr != undefined) {  
1328 - tElem.find("input").attr("ng-disabled", "true");  
1329 - tElem.find("div").attr("ng-disabled", "true");  
1330 - }  
1331 -  
1332 - return {  
1333 - pre: function (scope, element, attr) {  
1334 - // TODO:  
1335 - },  
1336 - /**  
1337 - * 相当于link函数。  
1338 - * @param scope  
1339 - * @param element  
1340 - * @param attr  
1341 - */  
1342 - post: function (scope, element, attr) {  
1343 - // name属性  
1344 - if ($name_attr) {  
1345 - scope[ctrlAs]["$name_attr"] = $name_attr;  
1346 - }  
1347 -  
1348 -  
1349 - // 日期open属性,及方法  
1350 - scope[ctrlAs].$$specialDateOpen = false;  
1351 - scope[ctrlAs].$$specialDate_open = function() {  
1352 - scope[ctrlAs].$$specialDateOpen = true;  
1353 - };  
1354 -  
1355 - // 监控选择的日期  
1356 - scope.$watch(  
1357 - function() {  
1358 - return scope[ctrlAs]['$$date_select'];  
1359 - },  
1360 - function(newValue, oldValue) {  
1361 - if (newValue) {  
1362 - //console.log("saDategroup--->selectdate:" + newValue);  
1363 - // 调用内置filter,转换日期到yyyy-MM-dd格式  
1364 - var text = $filter('date')(newValue, 'yyyy-MM-dd');  
1365 - var i;  
1366 - var isexist = false; // 日期是否已经选择标识  
1367 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
1368 - if (scope[ctrlAs]["$$data"][i].datestr == text) {  
1369 - isexist = true;  
1370 - break;  
1371 - }  
1372 - }  
1373 - if (!isexist) {  
1374 - scope[ctrlAs]["$$data"].push(  
1375 - {  
1376 - datestr: text,  
1377 - ischecked: true 1060 + // 数据量太大,取10条记录显示
  1061 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  1062 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1063 + if (scope[ctrlAs].$$data.length < 10) {
  1064 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1065 + } else {
  1066 + break;
1378 } 1067 }
1379 - ); 1068 + }
1380 } 1069 }
1381 1070
1382 - } 1071 + scope[ctrlAs].$$internal_validate_model();
  1072 + },
  1073 + function(result) {
1383 1074
1384 - }  
1385 - ); 1075 + }
  1076 + );
  1077 + };
1386 1078
1387 /** 1079 /**
1388 - * 日期点击事件处理函数。  
1389 - * @param $index 索引 1080 + * 内部方法,读取字典数据作为数据源。
  1081 + * @param dictype 字典类型,如:gsType
1390 */ 1082 */
1391 - scope[ctrlAs].$$internal_datestr_click = function($index) {  
1392 - scope[ctrlAs].$$data.splice($index, 1);  
1393 - };  
1394 -  
1395 - // 测试使用watch监控$$data的变化  
1396 - scope.$watch(  
1397 - function() {  
1398 - return scope[ctrlAs]['$$data'];  
1399 - },  
1400 - function(newValue, oldValue) {  
1401 - // 根据$$data生成对应的数据  
1402 - var special_days_arr = [];  
1403 - var i;  
1404 - for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {  
1405 - special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);  
1406 - }  
1407 -  
1408 - scope[ctrlAs].$$internalmodel = special_days_arr.join(",");  
1409 - console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);  
1410 -  
1411 - // 更新model  
1412 - if ($dcname_attr) {  
1413 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");  
1414 - }  
1415 - },  
1416 - true  
1417 - ); 1083 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  1084 + if (!dictionaryUtils.getByGroup(dictype)) {
  1085 + throw new error("字典数据不窜在=" + dictype);
  1086 + }
1418 1087
1419 - // 监控dcvalue model值变换  
1420 - attr.$observe("dcvalue", function(value) {  
1421 - console.log("saDategroup 监控dc1 model值变换:" + value);  
1422 - if (value) {  
1423 - // 根据value值,修改$$data里的值  
1424 - var date_array = value.split(",");  
1425 - var i;  
1426 - scope[ctrlAs]["$$data"] = [];  
1427 - for (i = 0; i < date_array.length; i++) {  
1428 - scope[ctrlAs]["$$data"].push(  
1429 - {  
1430 - datestr: date_array[i],  
1431 - ischecked: true  
1432 - }  
1433 - );  
1434 - } 1088 + // 清空内部数据
  1089 + scope[ctrlAs].$$data_real = [];
  1090 + scope[ctrlAs].$$data = [];
1435 1091
  1092 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  1093 + var dic_key; // 字典key
1436 1094
  1095 + for (dic_key in origin_dicgroup) {
  1096 + var data = {}; // 重新组合的字典元素对象
  1097 + if (dic_key == "true")
  1098 + data[$icname_attr] = true;
  1099 + else
  1100 + data[$icname_attr] = dic_key;
  1101 + data[$dscol_attr] = origin_dicgroup[dic_key];
  1102 + scope[ctrlAs].$$data_real.push(data);
  1103 + }
  1104 + // 这里直接将$$data_real数据深拷贝到$$data
  1105 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  1106 + scope[ctrlAs].$$internal_validate_model();
  1107 + };
1437 1108
  1109 + attr.$observe("dsparams", function(value) {
  1110 + if (value && value != "") {
  1111 + var obj = JSON.parse(value);
  1112 + console.log("observe 监控 dsparams=" + obj);
1438 1113
  1114 + // dsparams格式如下:
  1115 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
1439 1116
  1117 + if (obj.type == 'dic') {
  1118 + scope[ctrlAs].$$internal_dic_data(obj.param);
1440 1119
  1120 + } else if (obj.type == 'ajax') {
  1121 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  1122 + } else {
  1123 + throw new Error("dsparams参数格式异常=" + obj);
  1124 + }
1441 1125
  1126 + }
1442 1127
  1128 + });
1443 1129
  1130 + // 监控model绑定的dcvalue值变化
  1131 + attr.$observe("dcvalue", function(value) {
  1132 + if (value && value != "") {
  1133 + console.log("observe 监控 dcvalue=" + value);
  1134 + scope[ctrlAs].$$internal_select_value = value;
  1135 + scope[ctrlAs].$$internal_validate_model();
1444 } 1136 }
  1137 +
  1138 + // 闭包测试
  1139 + var obj = {'a':1,'b':2};
  1140 + var tfx = scope[ctrlAs].$$test.bind(obj);
  1141 + console.log("闭包测试=" + tfx());
1445 }); 1142 });
1446 1143
  1144 + scope[ctrlAs].$$test = function() {
  1145 + var exp = "this.a + '(' + this.b + ')'";
  1146 + console.log("exp=" + exp);
  1147 + return eval(exp);
  1148 + };
1447 } 1149 }
1448 -  
1449 }; 1150 };
  1151 +
1450 } 1152 }
1451 - } 1153 +
  1154 + };
1452 } 1155 }
1453 ]); 1156 ]);
1454 1157
  1158 +
  1159 +
  1160 +
1455 /** 1161 /**
1456 - * saGuideboardgroup指令  
1457 - * 属性如下: 1162 + * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
1458 * name(必须):控件的名字 1163 * name(必须):控件的名字
1459 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
1460 - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}  
1461 - * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1462 - * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange  
1463 - * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1464 - * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange  
1465 - * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}  
1466 - * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart 1164 + * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave
  1165 + * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}
  1166 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1167 + * icname(必须):内部与之对应的字段名,如:icname=id
1467 * 1168 *
1468 - * required(可选):是否要用required验证 1169 + * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  1170 + * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}
  1171 + * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item
  1172 + * iterobjexp(必须):内部显示用的表达式
  1173 + * searchph(必须):查询输入占位符字符串,如:searchph=请输入...
  1174 + * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'
  1175 + *
  1176 + * required(可选):是否需要form的required验证
1469 * 1177 *
1470 */ 1178 */
1471 -angular.module('ScheduleApp').directive('saGuideboardgroup', [  
1472 - 'GuideboardManageService_g',  
1473 - function(guideboardManageService_g) { 1179 +angular.module('ScheduleApp').directive('saSelect5', [
  1180 + '$timeout',
  1181 + '$$SearchInfoService_g',
  1182 + function($timeout, $$searchInfoService_g) {
1474 return { 1183 return {
1475 restrict: 'E', 1184 restrict: 'E',
1476 - templateUrl: '/pages/scheduleApp/module/common/dt/MyGuideboardGroupWrapTemplate.html',  
1477 - scope: {  
1478 - model: "=" // 独立作用域,关联外部的模型object 1185 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
  1186 + scope: { // 独立作用域
  1187 + model: "=" // 绑定外部对象
1479 }, 1188 },
1480 - controllerAs: '$saGuideboardgroupCtrl', 1189 + controllerAs: "$saSelectCtrl",
1481 bindToController: true, 1190 bindToController: true,
1482 controller: function($scope) { 1191 controller: function($scope) {
1483 var self = this; 1192 var self = this;
1484 - self.$$data = []; // 选择线路后,该线路的路牌数据 1193 + self.$$data = []; // 内部ui-select显示用数据
  1194 + self.$$data_real = []; // 内部保存的实际数据
1485 1195
1486 - // 测试数据  
1487 - //self.$$data = [  
1488 - // {lpid: 1, lpname: '路1', isstart: false},  
1489 - // {lpid: 2, lpname: '路2', isstart: true},  
1490 - // {lpid: 3, lpname: '路3', isstart: false}  
1491 - //]; 1196 + // myselect组件的ng-model,用于外部绑定验证等操作
  1197 + self.$$internalmodel = undefined;
1492 1198
1493 -  
1494 - self.$$dataSelected = []; // 选中的路牌列表  
1495 - self.$$dataSelectedStart = undefined; // 起始路牌  
1496 -  
1497 - //self.$$dataSelected = [  
1498 - // {lpid: 11, lpname: '路11', isstart: false},  
1499 - // {lpid: 12, lpname: '路12', isstart: true},  
1500 - // {lpid: 13, lpname: '路13', isstart: false}  
1501 - //];  
1502 -  
1503 - // saGuideboardgroup组件的ng-model,用于外部绑定等操作  
1504 - self.$$internalmodel = undefined;  
1505 -  
1506 - self.$$data_init = false; // *数据源初始化标志  
1507 - self.$$data_xl_first_init = false; // 线路是否初始化  
1508 - self.$$data_lp_first_init = false; // 路牌名字是否初始化  
1509 - self.$$data_lpid_first_init = false; // 路牌id是否初始化  
1510 - self.$$data_lpstart_first_init = false; // 起始路牌是否初始化 1199 + self.$$internal_select_value = undefined; // 选中的值
1511 1200
1512 }, 1201 },
1513 1202
@@ -1519,24 +1208,69 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [ @@ -1519,24 +1208,69 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
1519 * @returns {{pre: Function, post: Function}} 1208 * @returns {{pre: Function, post: Function}}
1520 */ 1209 */
1521 compile: function(tElem, tAttrs) { 1210 compile: function(tElem, tAttrs) {
1522 - // TODO:获取所有的属性 1211 + // 获取属性,并验证必须按属性
1523 var $name_attr = tAttrs["name"]; // 控件的名字 1212 var $name_attr = tAttrs["name"]; // 控件的名字
  1213 + var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象
  1214 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  1215 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  1216 +
  1217 + var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象
  1218 + var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串
  1219 + var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名
  1220 + var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式
  1221 + var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串
  1222 + var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式
  1223 +
1524 var $required_attr = tAttrs["required"]; // 是否需要required验证 1224 var $required_attr = tAttrs["required"]; // 是否需要required验证
1525 - var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名  
1526 - var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名  
1527 - var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名  
1528 1225
1529 - // controlAs名字  
1530 - var ctrlAs = '$saGuideboardgroupCtrl'; 1226 + if (!$name_attr) {
  1227 + throw new Error("name属性必须填写");
  1228 + }
  1229 + if (!$cmaps_attr) {
  1230 + throw new Error("cmaps属性必须填写")
  1231 + }
  1232 + if (!$dcname_attr || !$icname_attr) {
  1233 + throw new Error("dcname、icname属性必须填写");
  1234 + }
  1235 + if (!$dsparams_attr) {
  1236 + throw new Error("dsparams属性必须填写");
  1237 + }
  1238 + if (!$iterobjname_attr) {
  1239 + throw new Error("iterobjname属性必须填写");
  1240 + }
  1241 + if (!$iterobjexp_attr) {
  1242 + throw new Error("iterobjexp属性必须填写");
  1243 + }
  1244 + if (!$searchph_attr) {
  1245 + throw new Error("searchph属性必须填写");
  1246 + }
  1247 + if (!$searchexp_attr) {
  1248 + throw new Error("searchexp属性必须填写");
  1249 + }
1531 1250
1532 - // 如果有required属性,添加angularjs required验证 1251 + // 内部controlAs名字
  1252 + var ctrlAs = "$saSelectCtrl";
  1253 +
  1254 + // 动态设置dom
  1255 + // dom,最外层name属性设置
  1256 + tElem.find("div:first").attr("name", $name_attr);
  1257 + // dom,最外层divrequired属性设置
1533 if ($required_attr != undefined) { 1258 if ($required_attr != undefined) {
1534 - //console.log(tElem.html());  
1535 - tElem.find("div").attr("required", ""); 1259 + tElem.find("div[name=\'" + $name_attr + "\']").attr("required", "");
1536 } 1260 }
  1261 + // dom,ui-select-match的placeholder属性设定
  1262 + tElem.find("ui-select-match").attr("placeholder", $searchph_attr);
  1263 + // dom,ui-select-match的内容设定
  1264 + var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";
  1265 + tElem.find("ui-select-match").html(uiSelectMatchHtml);
  1266 + // dom,ui-select-choices的repeat属性设定
  1267 + var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";
  1268 + tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);
  1269 + // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
  1270 + tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
1537 1271
1538 return { 1272 return {
1539 - pre: function(scope, element, attr) { 1273 + pre: function (scope, element, attr) {
1540 // TODO: 1274 // TODO:
1541 }, 1275 },
1542 1276
@@ -1546,359 +1280,405 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [ @@ -1546,359 +1280,405 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
1546 * @param element 1280 * @param element
1547 * @param attr 1281 * @param attr
1548 */ 1282 */
1549 - post: function(scope, element, attr) {  
1550 - // name属性  
1551 - if ($name_attr) {  
1552 - scope[ctrlAs]["$name_attr"] = $name_attr;  
1553 - }  
1554 -  
1555 - // TODO:  
1556 - 1283 + post: function (scope, element, attr) {
1557 1284
1558 - /**  
1559 - * 路牌列表点击(路牌列表中选中路牌)  
1560 - * @param $index  
1561 - */  
1562 - scope[ctrlAs].$$internal_lplist_click = function($index) {  
1563 - var data_temp = scope[ctrlAs].$$data;  
1564 - if (data_temp && data_temp.length > $index) {  
1565 - scope[ctrlAs].$$dataSelected.push({  
1566 - lpid: data_temp[$index].lpid,  
1567 - lpname: data_temp[$index].lpname,  
1568 - isstart: data_temp[$index].isstart  
1569 - }); 1285 + // 添加选中事件处理函数
  1286 + scope[ctrlAs].$$internal_select_fn = function($item) {
  1287 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
1570 1288
1571 - // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌  
1572 - if (scope[ctrlAs].$$dataSelectedStart == undefined) {  
1573 - scope[ctrlAs].$$internal_sellplist_click(  
1574 - scope[ctrlAs].$$dataSelected.length - 1);  
1575 - } 1289 + eval("var obj=" + $cmaps_attr);
  1290 + for (var mc in obj) { // model的字段名:内部数据源对应字段名
  1291 + var ic = obj[mc]; // 内部数据源对应字段
  1292 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
1576 } 1293 }
1577 }; 1294 };
1578 - /**  
1579 - * 选中的路牌单击(初始路牌选择)  
1580 - * @param $index  
1581 - */  
1582 - scope[ctrlAs].$$internal_sellplist_click = function($index) {  
1583 - var data_temp = scope[ctrlAs].$$dataSelected;  
1584 - if (data_temp && data_temp.length > $index) {  
1585 - for (var i = 0; i < data_temp.length; i++) {  
1586 - data_temp[i].isstart = false;  
1587 - }  
1588 - data_temp[$index].isstart = true;  
1589 - scope[ctrlAs].$$dataSelectedStart = $index; 1295 +
  1296 + // 删除选中事件处理函数
  1297 + scope[ctrlAs].$$internal_remove_fn = function() {
  1298 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  1299 +
  1300 + eval("var obj=" + $cmaps_attr);
  1301 + var mc; // model的字段名
  1302 + for (mc in obj) {
  1303 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
1590 } 1304 }
1591 }; 1305 };
1592 - /**  
1593 - * 选中的路牌双击(删除选中的路牌)  
1594 - * @param $index  
1595 - */  
1596 - scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {  
1597 - var data_temp = scope[ctrlAs].$$dataSelected;  
1598 - if (data_temp && data_temp.length > $index) {  
1599 - if (scope[ctrlAs].$$dataSelectedStart == $index) {  
1600 - scope[ctrlAs].$$dataSelectedStart = undefined; 1306 +
  1307 + // 刷新数据
  1308 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  1309 + if (search && search != "") { // 有search值
  1310 + // 处理search
  1311 + console.log("search:" + search);
  1312 +
  1313 + scope[ctrlAs].$$data = [];
  1314 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1315 + var upTerm = search.toUpperCase();
  1316 + if (scope[ctrlAs].$$data.length < 10) {
  1317 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  1318 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  1319 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  1320 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1321 + }
  1322 + } else {
  1323 + break;
  1324 + }
1601 } 1325 }
1602 - data_temp.splice($index, 1);  
1603 } 1326 }
1604 }; 1327 };
1605 1328
1606 -  
1607 /** 1329 /**
1608 * 验证内部数据,更新外部model 1330 * 验证内部数据,更新外部model
1609 */ 1331 */
1610 scope[ctrlAs].$$internal_validate_model = function() { 1332 scope[ctrlAs].$$internal_validate_model = function() {
1611 - var data_temp = scope[ctrlAs].$$dataSelected;  
1612 - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;  
1613 - var lpNames = [];  
1614 - var lpIds = [];  
1615 - var lpStart = 0;  
1616 - var i = 0;  
1617 -  
1618 - if (data_temp &&  
1619 - data_temp.length > 0 &&  
1620 - data_temp2 != undefined) {  
1621 -  
1622 - for (i = 0; i < data_temp.length; i++) {  
1623 - lpNames.push(data_temp[i].lpname);  
1624 - lpIds.push(data_temp[i].lpid)  
1625 - }  
1626 - data_temp[data_temp2].isstart = true;  
1627 - lpStart = data_temp2 + 1;  
1628 -  
1629 - // 更新内部model,用于外部验证  
1630 - // 内部model的值暂时随意,以后再改  
1631 - scope[ctrlAs].$$internalmodel = {desc: "ok"}; 1333 + if (scope[ctrlAs].$$internal_select_value) {
  1334 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  1335 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  1336 + var obj;
  1337 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  1338 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  1339 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  1340 + break;
  1341 + }
  1342 + }
  1343 + if (obj) { // 在data中判定有没有
  1344 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  1345 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  1346 + obj = undefined;
  1347 + break;
  1348 + }
  1349 + }
  1350 + if (obj) {
  1351 + scope[ctrlAs].$$data.push(obj);
  1352 + }
  1353 + // 更新内部model,用于外部验证
  1354 + // 内部model的值暂时随意,以后再改
  1355 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  1356 + } else {
  1357 + scope[ctrlAs].$$internalmodel = undefined;
  1358 + }
1632 1359
1633 - // 更新外部model字段  
1634 - if ($lprangename_attr) {  
1635 - console.log("lprangename=" + lpNames.join(','));  
1636 - eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");  
1637 - }  
1638 - if ($lpidrangename_attr) {  
1639 - console.log("lpidrangename=" + lpIds.join(','));  
1640 - eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");  
1641 - }  
1642 - if ($lpstartname_attr) {  
1643 - console.log("lpstartname=" + lpStart);  
1644 - eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;"); 1360 + } else {
  1361 + scope[ctrlAs].$$internalmodel = undefined;
1645 } 1362 }
1646 1363
1647 } else { 1364 } else {
1648 scope[ctrlAs].$$internalmodel = undefined; 1365 scope[ctrlAs].$$internalmodel = undefined;
1649 } 1366 }
1650 -  
1651 -  
1652 }; 1367 };
1653 1368
1654 - // 监控内部数据,$$data_selected 变化  
1655 - scope.$watch(  
1656 - function() {  
1657 - return scope[ctrlAs].$$dataSelected;  
1658 - },  
1659 - function(newValue, oldValue) {  
1660 - scope[ctrlAs].$$internal_validate_model();  
1661 - },  
1662 - true  
1663 - );  
1664 -  
1665 - // 监控内部数据,$$data_selected_start 变化  
1666 - scope.$watch(  
1667 - function() {  
1668 - return scope[ctrlAs].$$dataSelectedStart;  
1669 - },  
1670 - function(newValue, oldValue) {  
1671 - scope[ctrlAs].$$internal_validate_model();  
1672 - },  
1673 - true  
1674 - );  
1675 -  
1676 /** 1369 /**
1677 - * 验证数据是否初始化完成,  
1678 - * 所谓的初始化就是内部所有的数据被有效设定过一次。 1370 + * 内部match表达式转换函数,需要外部绑定此函数的上下文。
  1371 + * @param context function上下文
1679 */ 1372 */
1680 - scope[ctrlAs].$$internal_validate_init = function() {  
1681 - var self = scope[ctrlAs]; 1373 + scope[ctrlAs].$$internal_match_str = function (context) {
  1374 + var fx = function() {
  1375 + try {
  1376 + return eval($searchexp_attr);
  1377 + } catch (err) {
  1378 + //console.log(err);
  1379 + return undefined;
  1380 + }
1682 1381
1683 - if (self.$$data_xl_first_init &&  
1684 - self.$$data_lp_first_init &&  
1685 - self.$$data_lpid_first_init &&  
1686 - self.$$data_lpstart_first_init) {  
1687 - console.log("数据初始化完毕!");  
1688 - self.$$data_init = true;  
1689 - } 1382 + };
1690 1383
  1384 + var str = fx.bind(context)();
  1385 + if (str && str != "")
  1386 + return str;
  1387 + else
  1388 + return undefined;
1691 }; 1389 };
1692 1390
1693 - // 监控初始化标志,线路,路牌,路牌id,起始路牌  
1694 - scope.$watch(  
1695 - function() {  
1696 - return scope[ctrlAs].$$data_xl_first_init;  
1697 - },  
1698 - function(newValue, oldValue) {  
1699 - scope[ctrlAs].$$internal_validate_init();  
1700 - }  
1701 - );  
1702 - scope.$watch(  
1703 - function() {  
1704 - return scope[ctrlAs].$$data_lp_first_init;  
1705 - },  
1706 - function(newValue, oldValue) {  
1707 - scope[ctrlAs].$$internal_validate_init();  
1708 - }  
1709 - );  
1710 - scope.$watch(  
1711 - function() {  
1712 - return scope[ctrlAs].$$data_lpid_first_init;  
1713 - },  
1714 - function(newValue, oldValue) {  
1715 - scope[ctrlAs].$$internal_validate_init(); 1391 + /**
  1392 + * 内部方法,读取字典数据作为数据源。
  1393 + * @param atype ajax查询类型
  1394 + * @param ajaxparamobj 查询参数对象
  1395 + */
  1396 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  1397 + // 如果ajaxparamobj为空对象,则表示清空内部选项
  1398 + var isEmptyObj = true;
  1399 + for (var name in ajaxparamobj) {
  1400 + isEmptyObj = false;
1716 } 1401 }
1717 - );  
1718 - scope.$watch(  
1719 - function() {  
1720 - return scope[ctrlAs].$$data_lpstart_first_init;  
1721 - },  
1722 - function(newValue, oldValue) {  
1723 - scope[ctrlAs].$$internal_validate_init(); 1402 + if (isEmptyObj) {
  1403 + // 重新创建内部保存的数据
  1404 + scope[ctrlAs].$$data_real = [];
  1405 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  1406 + scope[ctrlAs].$$data = [];
  1407 +
  1408 + scope[ctrlAs].$$internal_remove_fn();
  1409 + scope[ctrlAs].$$internal_validate_model();
  1410 +
  1411 + return;
1724 } 1412 }
1725 - );  
1726 1413
  1414 + if ($dsparamsextra_attr) { // 合并附加参数
  1415 + eval("var extra = " + $dsparamsextra_attr);
  1416 + for (var extrakey in extra) {
  1417 + ajaxparamobj[extrakey] = extra[extrakey];
  1418 + }
  1419 + }
1727 1420
1728 - // 监控线路id的变化  
1729 - attr.$observe("xlidvalue", function(value) {  
1730 - if (value && value != "") {  
1731 - console.log("xlidvalue=" + value); 1421 + $$searchInfoService_g[atype].list(
  1422 + ajaxparamobj,
  1423 + function(result) {
  1424 + console.log("$$internal_ajax_data result");
1732 1425
1733 - guideboardManageService_g.rest.list(  
1734 - {"xl.id_eq": value, size: 100},  
1735 - function(result) {  
1736 - // 获取值了  
1737 - console.log("路牌获取了"); 1426 + // 重新创建内部保存的数据
  1427 + scope[ctrlAs].$$data_real = [];
  1428 + // result中添加拼音数据,注意:这里要求result返回对象数组
  1429 + for (var i = 0; i < result.length; i++) {
  1430 + // 闭包绑定返回最终查询的值
  1431 + var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
  1432 + if (calcu_str) {
  1433 + // 全拼
  1434 + result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  1435 + // 简拼
  1436 + result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  1437 + // 原值
  1438 + result[i]["$calcu_str"] = calcu_str;
1738 1439
1739 - scope[ctrlAs].$$data = [];  
1740 - for (var i = 0; i < result.content.length; i++) {  
1741 - scope[ctrlAs].$$data.push({  
1742 - lpid: result.content[i].id,  
1743 - lpname: result.content[i].lpName,  
1744 - isstart: false  
1745 - });  
1746 - }  
1747 - if (scope[ctrlAs].$$data_init) {  
1748 - scope[ctrlAs].$$dataSelected = [];  
1749 - scope[ctrlAs].$$dataSelectedStart = undefined;  
1750 - scope[ctrlAs].$$internalmodel = undefined; 1440 + scope[ctrlAs].$$data_real.push(result[i]);
1751 } 1441 }
1752 - scope[ctrlAs].$$data_xl_first_init = true;  
1753 - },  
1754 - function(result) { 1442 + }
1755 1443
  1444 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  1445 + scope[ctrlAs].$$data = [];
  1446 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1447 + if (scope[ctrlAs].$$data.length < 10) {
  1448 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  1449 + } else {
  1450 + break;
  1451 + }
1756 } 1452 }
1757 - );  
1758 1453
  1454 + scope[ctrlAs].$$internal_validate_model();
  1455 + },
  1456 + function(result) {
  1457 + throw new Error("ajax查询出错");
  1458 + }
  1459 + );
  1460 + };
  1461 +
  1462 + /**
  1463 + * 内部方法,读取字典数据作为数据源。
  1464 + * @param dictype 字典类型,如:gsType
  1465 + */
  1466 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  1467 + if (!dictionaryUtils.getByGroup(dictype)) {
  1468 + throw new error("字典数据不窜在=" + dictype);
1759 } 1469 }
1760 - });  
1761 1470
1762 - // 监控路牌名称范围值的变化  
1763 - attr.$observe("lprangevalue", function(value) {  
1764 - if (value && value != "") {  
1765 - var data_temp = scope[ctrlAs].$$dataSelected;  
1766 - var lpnames = value.split(",");  
1767 - var i = 0;  
1768 - if (data_temp && data_temp.length == 0) { // 初始创建  
1769 - console.log("lprangevalue变换了");  
1770 - for (i = 0; i < lpnames.length; i++) {  
1771 - scope[ctrlAs].$$dataSelected.push({  
1772 - lpname: lpnames[i],  
1773 - isstart: false  
1774 - });  
1775 - }  
1776 - } else {  
1777 - for (i = 0; i < lpnames.length; i++) {  
1778 - data_temp[i].lpname = lpnames[i];  
1779 - }  
1780 - }  
1781 - scope[ctrlAs].$$data_lp_first_init = true; 1471 + // 重新创建内部保存的数据
  1472 + scope[ctrlAs].$$data_real = [];
  1473 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  1474 + var dic_key; // 字典key
  1475 +
  1476 + for (dic_key in origin_dicgroup) {
  1477 + var data = {}; // 重新组合的字典元素对象
  1478 + if (dic_key == "true")
  1479 + data[$icname_attr] = true;
  1480 + else
  1481 + data[$icname_attr] = dic_key;
  1482 + data[$dscol_attr] = origin_dicgroup[dic_key];
  1483 + scope[ctrlAs].$$data_real.push(data);
1782 } 1484 }
1783 - });  
1784 1485
1785 - // 监控路牌id范围值的变化  
1786 - attr.$observe("lpidrangevalue", function(value) { 1486 + // 重新创建内部ui-select显示用数据,直接复制所有的字典数据
  1487 + scope[ctrlAs].$$data = [];
  1488 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1489 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  1490 + }
  1491 +
  1492 + scope[ctrlAs].$$internal_validate_model();
  1493 + };
  1494 +
  1495 + /**
  1496 + * 监控dsparams属性变化
  1497 + */
  1498 + attr.$observe("dsparams", function(value) {
1787 if (value && value != "") { 1499 if (value && value != "") {
1788 - console.log("lpidrangevalue=" + value);  
1789 - var data_temp = scope[ctrlAs].$$dataSelected;  
1790 - var lpids = value.split(",");  
1791 - var i = 0;  
1792 - if (data_temp && data_temp.length == 0) { // 初始创建  
1793 - console.log("lpidrangevalue");  
1794 - for (i = 0; i < lpids.length; i++) {  
1795 - scope[ctrlAs].$$dataSelected.push({  
1796 - lpid: lpids[i],  
1797 - isstart: false  
1798 - });  
1799 - } 1500 + var obj = JSON.parse(value);
  1501 + console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
  1502 +
  1503 + // dsparams格式如下:
  1504 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
  1505 +
  1506 + if (obj.type == 'dic') {
  1507 + scope[ctrlAs].$$internal_dic_data(obj.param);
  1508 +
  1509 + } else if (obj.type == 'ajax') {
  1510 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
1800 } else { 1511 } else {
1801 - for (i = 0; i < lpids.length; i++) {  
1802 - data_temp[i].lpid = lpids[i];  
1803 - } 1512 + throw new Error("dsparams参数格式异常=" + obj);
1804 } 1513 }
1805 - scope[ctrlAs].$$data_lpid_first_init = true;  
1806 - }  
1807 - });  
1808 1514
1809 - // 监控起始路牌的变化  
1810 - attr.$observe("lpstartvalue", function(value) {  
1811 - if (value && value != "") {  
1812 - scope[ctrlAs].$$dataSelectedStart = value - 1;  
1813 - scope[ctrlAs].$$data_lpstart_first_init = true;  
1814 } 1515 }
1815 }); 1516 });
1816 1517
  1518 + /**
  1519 + * 监控外部模型dcname的值的变化。
  1520 + */
  1521 + scope.$watch(
  1522 + function() {
  1523 + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
  1524 + },
  1525 + function(newValue, oldValue) {
  1526 + if (newValue === undefined && oldValue === undefined) {
  1527 + // 两侧都是undefined,不处理
1817 1528
1818 - 1529 + } else {
  1530 + console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);
  1531 + scope[ctrlAs].$$internal_select_value = newValue;
  1532 + scope[ctrlAs].$$internal_validate_model();
  1533 + }
  1534 + },
  1535 + true
  1536 + );
1819 } 1537 }
1820 - }  
1821 - 1538 + };
1822 } 1539 }
1823 - } 1540 + };
1824 } 1541 }
1825 ]); 1542 ]);
1826 1543
  1544 +
  1545 +
1827 /** 1546 /**
1828 - * saEmployeegroup指令 1547 + * saRadiogroup指令
1829 * 属性如下: 1548 * 属性如下:
  1549 + * model(必须):独立作用域,外部绑定的一个值,如:ctrl.timeTableManageForForm.isEnableDisTemplate
  1550 + * dicgroup(必须):关联的字典数据type(TODO:以后增加其他数据源)
1830 * name(必须):控件的名字 1551 * name(必须):控件的名字
1831 - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave  
1832 - * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}  
1833 - * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1834 - * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange  
1835 - * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}  
1836 - * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange  
1837 - * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}  
1838 - * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart 1552 + * required(可选):是否要用required验证
  1553 + * disabled(可选):标示单选框是否可选
1839 * 1554 *
  1555 + */
  1556 +angular.module('ScheduleApp').directive("saRadiogroup", [function() {
  1557 + /**
  1558 + * 使用字典数据的单选按钮组的指令。
  1559 + * 指令名称:truefalse-Dic
  1560 + */
  1561 + return {
  1562 + restrict: 'E',
  1563 + templateUrl: '/pages/scheduleApp/module/common/dts1/radioButton/saRadiogroupTemplate.html',
  1564 + scope: {
  1565 + model: "="
  1566 + },
  1567 + controllerAs: "$saRadiogroupCtrl",
  1568 + bindToController: true,
  1569 + controller: function($scope) {
  1570 + //$scope["model"] = {selectedOption: null};
  1571 + //console.log("controller");
  1572 + //console.log("controller:" + $scope["model"]);
  1573 +
  1574 + var self = this;
  1575 + self.$$data = null; // 内部数据
  1576 + },
  1577 +
  1578 + /**
  1579 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1580 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1581 + * @param tElem
  1582 + * @param tAttrs
  1583 + * @returns {{pre: Function, post: Function}}
  1584 + */
  1585 + compile: function(tElem, tAttrs) {
  1586 + // 获取属性
  1587 + var $dicgroup_attr = tAttrs["dicgroup"]; // 关联的字典数据type
  1588 + var $name_attr = tAttrs["name"]; // 控件的名字
  1589 + var $required_attr = tAttrs["required"]; // 是否要用required验证
  1590 + var $disabled_attr = tAttrs["disabled"]; // 标示单选框是否可选
  1591 +
  1592 + // controlAs名字
  1593 + var ctrlAs = "$saRadiogroupCtrl";
  1594 +
  1595 + // 如果有required属性,添加angularjs required验证
  1596 + if ($required_attr != undefined) {
  1597 + tElem.find("input").attr("required", "");
  1598 + }
  1599 +
  1600 + return {
  1601 + pre: function(scope, element, attr) {
  1602 +
  1603 + },
  1604 +
  1605 + /**
  1606 + * 相当于link函数。
  1607 + * @param scope
  1608 + * @param element
  1609 + * @param attr
  1610 + */
  1611 + post: function(scope, element, attr) {
  1612 + //console.log("link");
  1613 + //console.log("link:" + scope.model);
  1614 + //scope["model"] = {selectedOption: null};
  1615 +
  1616 + if ($name_attr) {
  1617 + scope[ctrlAs].nv = $name_attr;
  1618 + }
  1619 +
  1620 + if ($disabled_attr) {
  1621 + scope[ctrlAs].disabled = true;
  1622 + }
  1623 + if ($dicgroup_attr) {
  1624 + var obj = dictionaryUtils.getByGroup($dicgroup_attr);
  1625 + scope[ctrlAs].$$data = obj;
  1626 + // 处理 scope["dic"] key值
  1627 + scope[ctrlAs].dicvalueCalcu = function(value) {
  1628 + if (value == "true") {
  1629 + //console.log(value);
  1630 + return true;
  1631 + } else if (value == "false") {
  1632 + //console.log(value);
  1633 + return false;
  1634 + } else {
  1635 + return value;
  1636 + }
  1637 + };
  1638 + }
  1639 + }
  1640 + };
  1641 + }
  1642 + };
  1643 +}]);
  1644 +
  1645 +
  1646 +
  1647 +/**
  1648 + * saCheckboxgroup指令
  1649 + * 属性如下:
  1650 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1651 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1652 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1653 + * name(必须):控件的名字
1840 * required(可选):是否要用required验证 1654 * required(可选):是否要用required验证
  1655 + * disabled(可选):标示框是否可选
1841 * 1656 *
1842 */ 1657 */
1843 -angular.module('ScheduleApp').directive('saEmployeegroup', [  
1844 - 'EmployeeConfigService_g',  
1845 - function(employeeConfigService_g) { 1658 +angular.module('ScheduleApp').directive('saCheckboxgroup', [
  1659 + function() {
1846 return { 1660 return {
1847 restrict: 'E', 1661 restrict: 'E',
1848 - templateUrl: '/pages/scheduleApp/module/common/dt/MyEmployeeGroupWrapTemplate.html', 1662 + templateUrl: '/pages/scheduleApp/module/common/dts1/checkbox/saCheckboxgroupTemplate.html',
1849 scope: { 1663 scope: {
1850 model: "=" // 独立作用域,关联外部的模型object 1664 model: "=" // 独立作用域,关联外部的模型object
1851 }, 1665 },
1852 - controllerAs: '$saEmployeegroupCtrl', 1666 + controllerAs: "$saCheckboxgroupCtrl",
1853 bindToController: true, 1667 bindToController: true,
1854 controller: function($scope) { 1668 controller: function($scope) {
1855 var self = this; 1669 var self = this;
1856 - self.$$data = []; // 选择线路后,该线路的人员配置数据  
1857 -  
1858 - // 测试数据  
1859 - //self.$$data = [  
1860 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},  
1861 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},  
1862 - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}  
1863 - //];  
1864 -  
1865 - self.$$dataSelected = []; // 选中的人员配置列表  
1866 - self.$$dataSelectedStart = undefined; // 起始人员配置  
1867 -  
1868 - //self.$$dataSelected = [  
1869 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},  
1870 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},  
1871 - // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}  
1872 - //];  
1873 -  
1874 - self.$$isFB = false; // 是否分班  
1875 - self.$$dataFBSelected = []; // 选中的分班人员组配置列表  
1876 - self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识  
1877 - self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合  
1878 -  
1879 - //self.$$dataFBSelected = [  
1880 - // {isstart: true, group: [  
1881 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},  
1882 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}  
1883 - // ]},  
1884 - // {isstart: false, group: [  
1885 - // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},  
1886 - // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}  
1887 - // ]}  
1888 - //];  
1889 -  
1890 - // saGuideboardgroup组件的ng-model,用于外部绑定等操作  
1891 - self.$$internalmodel = undefined;  
1892 -  
1893 - self.$$data_init = false; // *数据源初始化标志  
1894 - self.$$data_xl_first_init = false; // 线路是否初始化  
1895 - self.$$data_ry_first_init = false; // 人员配置是否初始化  
1896 - self.$$data_ry_first_data = undefined; // 人员配置初始化数据  
1897 - self.$$data_rycid_first_init = false; // 人员配置id是否初始化  
1898 - self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据  
1899 - self.$$data_rystart_first_init = false; // 起始人员是否初始化  
1900 - self.$$data_rystart_first_data = undefined; // 起始人员初始化数据 1670 + self.$$data = []; // 内部的数据
1901 1671
  1672 + // TODO:数据写死,周一至周日选择数据,以后有别的数据再议
  1673 + self.$$data = [
  1674 + {name: "星期一", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1675 + {name: "星期二", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1676 + {name: "星期三", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1677 + {name: "星期四", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1678 + {name: "星期五", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1679 + {name: "星期六", checkedvalue: "1", uncheckedvalue: "0", ischecked: false},
  1680 + {name: "星期日", checkedvalue: "1", uncheckedvalue: "0", ischecked: false}
  1681 + ];
1902 }, 1682 },
1903 1683
1904 /** 1684 /**
@@ -1909,27 +1689,29 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [ @@ -1909,27 +1689,29 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
1909 * @returns {{pre: Function, post: Function}} 1689 * @returns {{pre: Function, post: Function}}
1910 */ 1690 */
1911 compile: function(tElem, tAttrs) { 1691 compile: function(tElem, tAttrs) {
1912 - // TODO:获取所有的属性 1692 + // 获取所有的属性
1913 var $name_attr = tAttrs["name"]; // 控件的名字 1693 var $name_attr = tAttrs["name"]; // 控件的名字
1914 var $required_attr = tAttrs["required"]; // 是否需要required验证 1694 var $required_attr = tAttrs["required"]; // 是否需要required验证
1915 - var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名  
1916 - var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名  
1917 - var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名 1695 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1696 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
1918 1697
1919 // controlAs名字 1698 // controlAs名字
1920 - var ctrlAs = '$saEmployeegroupCtrl'; 1699 + var ctrlAs = '$saCheckboxgroupCtrl';
1921 1700
1922 // 如果有required属性,添加angularjs required验证 1701 // 如果有required属性,添加angularjs required验证
1923 if ($required_attr != undefined) { 1702 if ($required_attr != undefined) {
1924 //console.log(tElem.html()); 1703 //console.log(tElem.html());
1925 tElem.find("div").attr("required", ""); 1704 tElem.find("div").attr("required", "");
1926 } 1705 }
  1706 + // 如果有disabled属性,添加禁用标志
  1707 + if ($disabled_attr != undefined) {
  1708 + tElem.find("input").attr("ng-disabled", "true");
  1709 + }
1927 1710
1928 return { 1711 return {
1929 pre: function(scope, element, attr) { 1712 pre: function(scope, element, attr) {
1930 // TODO: 1713 // TODO:
1931 }, 1714 },
1932 -  
1933 /** 1715 /**
1934 * 相当于link函数。 1716 * 相当于link函数。
1935 * @param scope 1717 * @param scope
@@ -1943,573 +1725,331 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [ @@ -1943,573 +1725,331 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
1943 } 1725 }
1944 1726
1945 /** 1727 /**
1946 - * 人员配置列表点击(人员配置列表中选中路牌)  
1947 - * @param $index 1728 + * checkbox选择事件处理函数。
  1729 + * @param $d 数据对象,$$data中的元素对象
1948 */ 1730 */
1949 - scope[ctrlAs].$$internal_rylist_click = function($index) {  
1950 - var data_temp = scope[ctrlAs].$$data;  
1951 - if (data_temp && data_temp.length > $index) {  
1952 - if (!scope[ctrlAs].$$isFB) { // 不分班  
1953 - scope[ctrlAs].$$dataSelected.push({  
1954 - id : data_temp[$index].id,  
1955 - dbbm: data_temp[$index].dbbm,  
1956 - jsy: data_temp[$index].jsy,  
1957 - spy: data_temp[$index].spy,  
1958 - isstart: false  
1959 - });  
1960 -  
1961 - // 如果没有指定过初始人员,默认选择此人员作为起始人员  
1962 - if (scope[ctrlAs].$$dataSelectedStart == undefined) {  
1963 - scope[ctrlAs].$$internal_selrylist_click(  
1964 - scope[ctrlAs].$$dataSelected.length - 1);  
1965 - }  
1966 - } else { // 分班  
1967 - if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员  
1968 - scope[ctrlAs].$$dataFBSelected  
1969 - [scope[ctrlAs].$$dataFBInternalSelected.gindex].group  
1970 - [scope[ctrlAs].$$dataFBInternalSelected.index] = {  
1971 - id : data_temp[$index].id,  
1972 - dbbm: data_temp[$index].dbbm,  
1973 - jsy: data_temp[$index].jsy,  
1974 - spy: data_temp[$index].spy,  
1975 - isselected: true  
1976 - };  
1977 -  
1978 - } else {  
1979 - scope[ctrlAs].$$dataFBSelected.push({  
1980 - isstart: false,  
1981 - group: [].concat(  
1982 - {  
1983 - id : data_temp[$index].id,  
1984 - dbbm: data_temp[$index].dbbm,  
1985 - jsy: data_temp[$index].jsy,  
1986 - spy: data_temp[$index].spy,  
1987 - isselected: false  
1988 - }, {  
1989 - id : data_temp[$index].id,  
1990 - dbbm: data_temp[$index].dbbm,  
1991 - jsy: data_temp[$index].jsy,  
1992 - spy: data_temp[$index].spy,  
1993 - isselected: false  
1994 - }  
1995 - )  
1996 - });  
1997 - if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {  
1998 - scope[ctrlAs].$$internal_selrygrouplist_click(  
1999 - scope[ctrlAs].$$dataFBSelected.length - 1);  
2000 - }  
2001 - }  
2002 - }  
2003 -  
2004 - } 1731 + scope[ctrlAs].$$internal_updateCheck_fn = function($d) {
  1732 + $d.ischecked = !$d.ischecked;
  1733 + console.log($d);
2005 }; 1734 };
2006 1735
2007 - /**  
2008 - * 选中的人员单击(初始人员选择)  
2009 - * @param $index  
2010 - */  
2011 - scope[ctrlAs].$$internal_selrylist_click = function($index) {  
2012 - var data_temp = scope[ctrlAs].$$dataSelected;  
2013 - if (data_temp && data_temp.length > $index) {  
2014 - for (var i = 0; i < data_temp.length; i++) {  
2015 - data_temp[i].isstart = false;  
2016 - }  
2017 - data_temp[$index].isstart = true;  
2018 - scope[ctrlAs].$$dataSelectedStart = $index;  
2019 - }  
2020 - };  
2021 - /**  
2022 - * 选中的人员双击(删除选中的人员)  
2023 - * @param $index  
2024 - */  
2025 - scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {  
2026 - var data_temp = scope[ctrlAs].$$dataSelected;  
2027 - if (data_temp && data_temp.length > $index) {  
2028 - if (scope[ctrlAs].$$dataSelectedStart == $index) {  
2029 - scope[ctrlAs].$$dataSelectedStart = undefined;  
2030 - }  
2031 - data_temp.splice($index, 1);  
2032 - }  
2033 - };  
2034 -  
2035 - /**  
2036 - * 选中的分班组人员单击(初始人员选择)  
2037 - * @param $index  
2038 - */  
2039 - scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {  
2040 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
2041 - if (data_temp && data_temp.length > $index) {  
2042 - for (var i = 0; i < data_temp.length; i++) {  
2043 - data_temp[i].isstart = false;  
2044 - for (var j = 0; j < data_temp[i].group.length; j++) {  
2045 - data_temp[i].group[j].isselected = false;  
2046 - }  
2047 - }  
2048 - data_temp[$index].isstart = true;  
2049 - scope[ctrlAs].$$dataFBSelectedStart = $index;  
2050 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
2051 - }  
2052 - };  
2053 - /**  
2054 - * 分组内部单击(选中分班中的某组人员)  
2055 - * @param $groupindex 组index  
2056 - * @param $index 组内部某个index  
2057 - * @param $event 事件防止冒泡  
2058 - */  
2059 - scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {  
2060 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
2061 - if (data_temp && data_temp.length > $groupindex) {  
2062 - if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {  
2063 - // $$dataFBInternalSelected的格式如下:  
2064 - //{gindex: 1, index: 0}  
2065 - for (var i = 0; i < data_temp.length; i++) {  
2066 - data_temp[i].isstart = false;  
2067 - for (var j = 0; j < data_temp[i].group.length; j++) {  
2068 - data_temp[i].group[j].isselected = false;  
2069 - }  
2070 - }  
2071 - data_temp[$groupindex].group[$index].isselected = true;  
2072 - scope[ctrlAs].$$dataFBInternalSelected = {  
2073 - gindex: $groupindex, index: $index  
2074 - };  
2075 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
2076 - $event.stopPropagation();  
2077 - }  
2078 - }  
2079 -  
2080 - };  
2081 - /**  
2082 - * 选中的分班人员双击(删除选中的人员)  
2083 - * @param $index  
2084 - */  
2085 - scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {  
2086 - var data_temp = scope[ctrlAs].$$dataFBSelected;  
2087 - if (data_temp && data_temp.length > $index) {  
2088 - if (scope[ctrlAs].$$dataFBSelectedStart == $index) {  
2089 - scope[ctrlAs].$$dataFBSelectedStart = undefined;  
2090 - }  
2091 - if (scope[ctrlAs].$$dataFBInternalSelected &&  
2092 - scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {  
2093 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
2094 - }  
2095 - data_temp.splice($index, 1);  
2096 - }  
2097 - };  
2098 -  
2099 - /**  
2100 - * 验证内部数据,更新外部model  
2101 - */  
2102 - scope[ctrlAs].$$internal_validate_model = function() {  
2103 - var data_temp = scope[ctrlAs].$$dataSelected;  
2104 - var data_temp2 = scope[ctrlAs].$$dataSelectedStart;  
2105 - var data_temp3 = scope[ctrlAs].$$dataFBSelected;  
2106 - var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;  
2107 - var ryDbbms = [];  
2108 - var ryDbbm_group = [];  
2109 - var ryCids = [];  
2110 - var ryCid_group = [];  
2111 - var ryStart = 0;  
2112 - var i = 0;  
2113 - var j = 0;  
2114 -  
2115 - var isFB = scope[ctrlAs].$$isFB;  
2116 -  
2117 - if (isFB) {  
2118 - if (data_temp3 &&  
2119 - data_temp3.length > 0 &&  
2120 - data_temp4 != undefined) {  
2121 -  
2122 - for (i = 0; i < data_temp3.length; i++) {  
2123 - for (j = 0; j < data_temp3[i].group.length; j++) {  
2124 - ryDbbm_group.push(data_temp3[i].group[j].dbbm);  
2125 - ryCid_group.push(data_temp3[i].group[j].id);  
2126 - }  
2127 - ryDbbms.push(ryDbbm_group.join("-"));  
2128 - ryCids.push(ryCid_group.join("-"));  
2129 - ryDbbm_group = [];  
2130 - ryCid_group = [];  
2131 - }  
2132 -  
2133 - data_temp3[data_temp4].isstart = true;  
2134 - ryStart = data_temp4 + 1;  
2135 -  
2136 - // 更新内部model,用于外部验证  
2137 - // 内部model的值暂时随意,以后再改  
2138 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
2139 -  
2140 - // 更新外部model字段  
2141 - if ($dbbmrangename_attr) {  
2142 - console.log("dbbmrangename=" + ryDbbms.join(','));  
2143 - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");  
2144 - }  
2145 - if (rycidrangename_attr) {  
2146 - console.log("rycidrangename=" + ryCids.join(','));  
2147 - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");  
2148 - }  
2149 - if ($rystartname_attr) {  
2150 - console.log("rystartname=" + ryStart);  
2151 - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");  
2152 - }  
2153 -  
2154 - } else {  
2155 - scope[ctrlAs].$$internalmodel = undefined;  
2156 - }  
2157 -  
2158 - } else {  
2159 - if (data_temp &&  
2160 - data_temp.length > 0 &&  
2161 - data_temp2 != undefined) {  
2162 -  
2163 - for (i = 0; i < data_temp.length; i++) {  
2164 - ryDbbms.push(data_temp[i].dbbm);  
2165 - ryCids.push(data_temp[i].id);  
2166 - }  
2167 - data_temp[data_temp2].isstart = true;  
2168 - ryStart = data_temp2 + 1;  
2169 -  
2170 - // 更新内部model,用于外部验证  
2171 - // 内部model的值暂时随意,以后再改  
2172 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
2173 -  
2174 - // 更新外部model字段  
2175 - if ($dbbmrangename_attr) {  
2176 - console.log("dbbmrangename=" + ryDbbms.join(','));  
2177 - eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");  
2178 - }  
2179 - if (rycidrangename_attr) {  
2180 - console.log("rycidrangename=" + ryCids.join(','));  
2181 - eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");  
2182 - }  
2183 - if ($rystartname_attr) {  
2184 - console.log("rystartname=" + ryStart);  
2185 - eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");  
2186 - }  
2187 -  
2188 - } else {  
2189 - scope[ctrlAs].$$internalmodel = undefined;  
2190 - }  
2191 - }  
2192 -  
2193 - };  
2194 -  
2195 - // 监控内部数据,$$dataSelected 变化  
2196 - scope.$watch(  
2197 - function() {  
2198 - return scope[ctrlAs].$$dataSelected;  
2199 - },  
2200 - function(newValue, oldValue) {  
2201 - scope[ctrlAs].$$internal_validate_model();  
2202 - },  
2203 - true  
2204 - );  
2205 -  
2206 - // 监控内部数据,$$dataSelectedStart 变化 1736 + // 测试使用watch监控$$data的变化
2207 scope.$watch( 1737 scope.$watch(
2208 function() { 1738 function() {
2209 - return scope[ctrlAs].$$dataSelectedStart; 1739 + return scope[ctrlAs]["$$data"];
2210 }, 1740 },
2211 function(newValue, oldValue) { 1741 function(newValue, oldValue) {
2212 - scope[ctrlAs].$$internal_validate_model();  
2213 - },  
2214 - true  
2215 - );  
2216 - 1742 + // 根据$$data生成对应的数据
  1743 + var rule_days_arr = [];
  1744 + var i;
  1745 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1746 + if (scope[ctrlAs]["$$data"][i].ischecked)
  1747 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].checkedvalue);
  1748 + else
  1749 + rule_days_arr.push(scope[ctrlAs]["$$data"][i].uncheckedvalue);
  1750 + }
  1751 + scope[ctrlAs].$$internalmodel = rule_days_arr.join(",");
  1752 + //scope[ctrlAs].$$internalmodel = undefined;
  1753 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
2217 1754
2218 - // 监控内部数据,$$dataFBSelected 变化  
2219 - scope.$watch(  
2220 - function() {  
2221 - return scope[ctrlAs].$$dataFBSelected;  
2222 - },  
2223 - function(newValue, oldValue) {  
2224 - scope[ctrlAs].$$internal_validate_model();  
2225 - },  
2226 - true  
2227 - ); 1755 + // 更新model
  1756 + if ($dcname_attr) {
  1757 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = rule_days_arr.join(',');");
  1758 + }
2228 1759
2229 - // 监控内部数据,$$dataFBSelectedStart 变化  
2230 - scope.$watch(  
2231 - function() {  
2232 - return scope[ctrlAs].$$dataFBSelectedStart;  
2233 - },  
2234 - function(newValue, oldValue) {  
2235 - scope[ctrlAs].$$internal_validate_model();  
2236 - },  
2237 - true  
2238 - );  
2239 1760
2240 - // 监控内部数据,$$dataFBInternalSelected 变化  
2241 - scope.$watch(  
2242 - function() {  
2243 - return scope[ctrlAs].$$dataFBInternalSelected;  
2244 - },  
2245 - function(newValue, oldValue) {  
2246 - scope[ctrlAs].$$internal_validate_model();  
2247 }, 1761 },
2248 true 1762 true
2249 ); 1763 );
2250 1764
2251 - // 监控内部数据,$$isFB 变化  
2252 - scope.$watch(  
2253 - function() {  
2254 - return scope[ctrlAs].$$isFB;  
2255 - },  
2256 - function(newValue, oldValue) {  
2257 - scope[ctrlAs].$$internal_validate_model();  
2258 - },  
2259 - true  
2260 - ); 1765 + // TODO:
2261 1766
2262 - /**  
2263 - * 验证数据是否初始化完成,  
2264 - * 所谓的初始化就是内部所有的数据被有效设定过一次。  
2265 - */  
2266 - scope[ctrlAs].$$internal_validate_init = function() {  
2267 - var self = scope[ctrlAs];  
2268 - var data_temp = self.$$data;  
2269 - var dataSelect_temp = self.$$dataSelected;  
2270 - var dataFBSelect_temp = self.$$dataFBSelected;  
2271 - var dbbmnames = null;  
2272 - var dbbmnamegroup = null;  
2273 - var rycids = null;  
2274 - var rycidgroup = null; 1767 + // 监控dcvalue model值变换
  1768 + attr.$observe("dcvalue", function(value) {
  1769 + console.log("saCheckboxgroup 监控dc1 model值变换:" + value);
  1770 + if (value) {
  1771 + // 根据value值,修改$$data里的值
  1772 + var data_array = value.split(",");
  1773 + var i;
  1774 + if (data_array.length > scope[ctrlAs]["$$data"].length) {
  1775 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i ++) {
  1776 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1777 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1778 + } else {
  1779 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1780 + }
  1781 + }
  1782 + } else {
  1783 + for (i = 0; i < data_array.length; i ++) {
  1784 + if (data_array[i] == scope[ctrlAs]["$$data"][i].checkedvalue) {
  1785 + scope[ctrlAs]["$$data"][i].ischecked = true;
  1786 + } else {
  1787 + scope[ctrlAs]["$$data"][i].ischecked = false;
  1788 + }
  1789 + }
  1790 + }
2275 1791
2276 - var i = 0;  
2277 - var j = 0;  
2278 - var k = 0; 1792 + }
  1793 + });
  1794 + }
2279 1795
2280 - if (self.$$data_xl_first_init &&  
2281 - self.$$data_ry_first_init &&  
2282 - self.$$data_rycid_first_init &&  
2283 - self.$$data_rystart_first_init && !self.$$data_init) {  
2284 - console.log("开始初始化数据"); 1796 + };
2285 1797
2286 - // 判定是否分班,字符串中包含-就是了  
2287 - if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班  
2288 - self.$$isFB = true;  
2289 1798
2290 - // 搭班编码、人员配置id  
2291 - dbbmnames = self.$$data_ry_first_data.split(",");  
2292 - rycids = self.$$data_rycid_first_data.split(",");  
2293 - for (i = 0; i < dbbmnames.length; i++) {  
2294 - dataFBSelect_temp.push({  
2295 - group: [],  
2296 - isstart: false  
2297 - });  
2298 - dbbmnamegroup = dbbmnames[i].split("-");  
2299 - rycidgroup = rycids[i].split("-"); 1799 + }
2300 1800
2301 - for (k = 0; k < dbbmnamegroup.length; k++) {  
2302 - dataFBSelect_temp[i].group.push({  
2303 - id: rycidgroup[k],  
2304 - dbbm: dbbmnamegroup[k],  
2305 - isselected: false  
2306 - }); 1801 + };
  1802 + }
  1803 +]);
2307 1804
2308 - for (j = 0; j < data_temp.length; j++) {  
2309 - if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {  
2310 - dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;  
2311 - dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;  
2312 - break;  
2313 - }  
2314 - }  
2315 - }  
2316 1805
2317 - }  
2318 1806
2319 - // 初始人员  
2320 - scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;  
2321 1807
  1808 +/**
  1809 + * saDategroup指令
  1810 + * 属性如下:
  1811 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  1812 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  1813 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  1814 + * name(必须):控件的名字
  1815 + * required(可选):是否要用required验证
  1816 + * disabled(可选):标示框是否可选
  1817 + *
  1818 + */
  1819 +angular.module('ScheduleApp').directive('saDategroup', [
  1820 + '$filter',
  1821 + function($filter) {
  1822 + return {
  1823 + restrict: 'E',
  1824 + templateUrl: '/pages/scheduleApp/module/common/dts2/dateGroup/saDategroupTemplate.html',
  1825 + scope: {
  1826 + model: "=" // 独立作用域,关联外部的模型object
  1827 + },
  1828 + controllerAs: "$saDategroupCtrl",
  1829 + bindToController: true,
  1830 + controller: function($scope) {
  1831 + var self = this;
  1832 + self.$$data = []; // 内部的数据
  1833 + self.$$date_select; // 内部选中的日期
2322 1834
2323 - } else if (dataSelect_temp.length == 0) {  
2324 - self.$$isFB = false; 1835 + //// 测试数据
  1836 + //self.$$data = [
  1837 + // {datestr: '2011-01-01', ischecked: true},
  1838 + // {datestr: '2011-01-01', ischecked: true},
  1839 + // {datestr: '2011-01-01', ischecked: true}
  1840 + //];
  1841 + },
2325 1842
2326 - // 搭班编码、人员配置id  
2327 - dbbmnames = self.$$data_ry_first_data.split(",");  
2328 - rycids = self.$$data_rycid_first_data.split(",");  
2329 - for (i = 0; i < dbbmnames.length; i++) {  
2330 - dataSelect_temp.push({  
2331 - id: rycids[i],  
2332 - dbbm: dbbmnames[i],  
2333 - isstart: false  
2334 - });  
2335 - for (j = 0; j < data_temp.length; j++) {  
2336 - if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {  
2337 - dataSelect_temp[i].jsy = data_temp[j].jsy;  
2338 - dataSelect_temp[i].spy = data_temp[j].spy;  
2339 - break;  
2340 - }  
2341 - }  
2342 - }  
2343 - // 初始人员  
2344 - scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1; 1843 + /**
  1844 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  1845 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  1846 + * @param tElem
  1847 + * @param tAttrs
  1848 + * @returns {{pre: Function, post: Function}}
  1849 + */
  1850 + compile: function(tElem, tAttrs) {
  1851 + // 获取所有的属性
  1852 + var $name_attr = tAttrs["name"]; // 控件的名字
  1853 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  1854 + var $disabled_attr = tAttrs["disabled"]; // 是否禁用
  1855 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
2345 1856
2346 - } 1857 + // controlAs名字
  1858 + var ctrlAs = '$saDategroupCtrl';
2347 1859
2348 - console.log("数据初始化完毕!");  
2349 - self.$$data_init = true;  
2350 - } 1860 + // 如果有required属性,添加angularjs required验证
  1861 + if ($required_attr != undefined) {
  1862 + //console.log(tElem.html());
  1863 + tElem.find("div").attr("required", "");
  1864 + }
  1865 + // 如果有disabled属性,添加禁用标志
  1866 + if ($disabled_attr != undefined) {
  1867 + tElem.find("input").attr("ng-disabled", "true");
  1868 + tElem.find("div").attr("ng-disabled", "true");
  1869 + }
  1870 +
  1871 + return {
  1872 + pre: function (scope, element, attr) {
  1873 + // TODO:
  1874 + },
  1875 + /**
  1876 + * 相当于link函数。
  1877 + * @param scope
  1878 + * @param element
  1879 + * @param attr
  1880 + */
  1881 + post: function (scope, element, attr) {
  1882 + // name属性
  1883 + if ($name_attr) {
  1884 + scope[ctrlAs]["$name_attr"] = $name_attr;
  1885 + }
2351 1886
  1887 +
  1888 + // 日期open属性,及方法
  1889 + scope[ctrlAs].$$specialDateOpen = false;
  1890 + scope[ctrlAs].$$specialDate_open = function() {
  1891 + scope[ctrlAs].$$specialDateOpen = true;
2352 }; 1892 };
2353 1893
2354 - // 监控初始化标志,线路,人员,起始人员  
2355 - scope.$watch(  
2356 - function() {  
2357 - return scope[ctrlAs].$$data_xl_first_init;  
2358 - },  
2359 - function(newValue, oldValue) {  
2360 - scope[ctrlAs].$$internal_validate_init();  
2361 - }  
2362 - );  
2363 - scope.$watch(  
2364 - function() {  
2365 - return scope[ctrlAs].$$data_ry_first_init;  
2366 - },  
2367 - function(newValue, oldValue) {  
2368 - scope[ctrlAs].$$internal_validate_init();  
2369 - }  
2370 - ); 1894 + // 监控选择的日期
2371 scope.$watch( 1895 scope.$watch(
2372 function() { 1896 function() {
2373 - return scope[ctrlAs].$$data_rycid_first_init; 1897 + return scope[ctrlAs]['$$date_select'];
2374 }, 1898 },
2375 function(newValue, oldValue) { 1899 function(newValue, oldValue) {
2376 - scope[ctrlAs].$$internal_validate_init(); 1900 + if (newValue) {
  1901 + //console.log("saDategroup--->selectdate:" + newValue);
  1902 + // 调用内置filter,转换日期到yyyy-MM-dd格式
  1903 + var text = $filter('date')(newValue, 'yyyy-MM-dd');
  1904 + var i;
  1905 + var isexist = false; // 日期是否已经选择标识
  1906 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1907 + if (scope[ctrlAs]["$$data"][i].datestr == text) {
  1908 + isexist = true;
  1909 + break;
  1910 + }
  1911 + }
  1912 + if (!isexist) {
  1913 + scope[ctrlAs]["$$data"].push(
  1914 + {
  1915 + datestr: text,
  1916 + ischecked: true
  1917 + }
  1918 + );
  1919 + }
  1920 +
  1921 + }
  1922 +
2377 } 1923 }
2378 ); 1924 );
  1925 +
  1926 + /**
  1927 + * 日期点击事件处理函数。
  1928 + * @param $index 索引
  1929 + */
  1930 + scope[ctrlAs].$$internal_datestr_click = function($index) {
  1931 + scope[ctrlAs].$$data.splice($index, 1);
  1932 + };
  1933 +
  1934 + // 测试使用watch监控$$data的变化
2379 scope.$watch( 1935 scope.$watch(
2380 function() { 1936 function() {
2381 - return scope[ctrlAs].$$data_rystart_first_init; 1937 + return scope[ctrlAs]['$$data'];
2382 }, 1938 },
2383 function(newValue, oldValue) { 1939 function(newValue, oldValue) {
2384 - scope[ctrlAs].$$internal_validate_init();  
2385 - }  
2386 - );  
2387 -  
2388 -  
2389 - // 监控线路id的变化  
2390 - attr.$observe("xlidvalue", function(value) {  
2391 - if (value && value != "") {  
2392 - console.log("xlidvalue=" + value);  
2393 -  
2394 - employeeConfigService_g.rest.list(  
2395 - {"xl.id_eq": value, "isCancel_eq" : false, size: 100},  
2396 - function(result) {  
2397 - // 获取值了  
2398 - console.log("人员配置获取了"); 1940 + // 根据$$data生成对应的数据
  1941 + var special_days_arr = [];
  1942 + var i;
  1943 + for (i = 0; i < scope[ctrlAs]["$$data"].length; i++) {
  1944 + special_days_arr.push(scope[ctrlAs]["$$data"][i].datestr);
  1945 + }
2399 1946
2400 - scope[ctrlAs].$$data = [];  
2401 - for (var i = 0; i < result.content.length; i++) {  
2402 - scope[ctrlAs].$$data.push({  
2403 - id: result.content[i].id,  
2404 - dbbm: result.content[i].dbbm,  
2405 - jsy: result.content[i].jsy.personnelName,  
2406 - spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName  
2407 - });  
2408 - }  
2409 - if (scope[ctrlAs].$$data_init) {  
2410 - scope[ctrlAs].$$dataSelected = [];  
2411 - scope[ctrlAs].$$dataSelectedStart = undefined; 1947 + scope[ctrlAs].$$internalmodel = special_days_arr.join(",");
  1948 + console.log("bbbbbbbb--->" + scope[ctrlAs].$$internalmodel);
2412 1949
2413 - scope[ctrlAs].$$dataFBSelected = [];  
2414 - scope[ctrlAs].$$dataFBInternalSelected = undefined;  
2415 - scope[ctrlAs].$$dataFBSelectedStart = undefined; 1950 + // 更新model
  1951 + if ($dcname_attr) {
  1952 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = special_days_arr.join(',');");
  1953 + }
  1954 + },
  1955 + true
  1956 + );
2416 1957
2417 - scope[ctrlAs].$$internalmodel = undefined; 1958 + // 监控dcvalue model值变换
  1959 + attr.$observe("dcvalue", function(value) {
  1960 + console.log("saDategroup 监控dc1 model值变换:" + value);
  1961 + if (value) {
  1962 + // 根据value值,修改$$data里的值
  1963 + var date_array = value.split(",");
  1964 + var i;
  1965 + scope[ctrlAs]["$$data"] = [];
  1966 + for (i = 0; i < date_array.length; i++) {
  1967 + scope[ctrlAs]["$$data"].push(
  1968 + {
  1969 + datestr: date_array[i],
  1970 + ischecked: true
2418 } 1971 }
2419 - scope[ctrlAs].$$data_xl_first_init = true;  
2420 - },  
2421 - function(result) {  
2422 -  
2423 - }  
2424 - ); 1972 + );
  1973 + }
  1974 +
  1975 +
  1976 +
  1977 +
  1978 +
2425 1979
2426 - }  
2427 - });  
2428 1980
2429 - // 监控搭班编码范围值的变化  
2430 - attr.$observe("dbbmrangevalue", function(value) {  
2431 - if (value && value != "") {  
2432 - console.log("dbbmrangevalue变换了");  
2433 - scope[ctrlAs].$$data_ry_first_init = true;  
2434 - scope[ctrlAs].$$data_ry_first_data = value;  
2435 - }  
2436 - });  
2437 1981
2438 - // 监控人员配置id范围值的变化  
2439 - attr.$observe("rycidrangevalue", function(value) {  
2440 - if (value && value != "") {  
2441 - console.log("rycidrangevalue变换了");  
2442 - scope[ctrlAs].$$data_rycid_first_init = true;  
2443 - scope[ctrlAs].$$data_rycid_first_data = value;  
2444 - }  
2445 - });  
2446 1982
2447 - // 监控起始人员的变化  
2448 - attr.$observe("rystartvalue", function(value) {  
2449 - if (value && value != "") {  
2450 - console.log("rystartvalue变换了");  
2451 - scope[ctrlAs].$$data_rystart_first_init = true;  
2452 - scope[ctrlAs].$$data_rystart_first_data = value;  
2453 } 1983 }
2454 }); 1984 });
2455 1985
2456 } 1986 }
2457 - }  
2458 1987
  1988 + };
2459 } 1989 }
2460 } 1990 }
2461 } 1991 }
2462 ]); 1992 ]);
2463 1993
2464 1994
  1995 +
  1996 +
2465 /** 1997 /**
2466 - * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。 1998 + * saGuideboardgroup指令
2467 * 属性如下: 1999 * 属性如下:
2468 * name(必须):控件的名字 2000 * name(必须):控件的名字
2469 * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave 2001 * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
2470 - * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}  
2471 - * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange  
2472 - * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }} 2002 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  2003 + * lprangevalue(必须):绑定的model路牌名字范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  2004 + * lprangename(必须):绑定的model路牌名字范围字段名,如:lprangename=lprange
  2005 + * lpidrangevalue(必须):绑定的model路牌id范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  2006 + * lpidrangename(必须):绑定的model路牌id范围字段名,如:lprangename=lprange
  2007 + * lpstartvalue(必须):绑定的model起始路牌值,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  2008 + * lpstartname(必须):绑定的model起始路牌字段名,如:lpstartname=lpstart
  2009 + *
2473 * required(可选):是否要用required验证 2010 * required(可选):是否要用required验证
2474 * 2011 *
2475 */ 2012 */
2476 -angular.module('ScheduleApp').directive('saBcgroup', [  
2477 - 'TimeTableDetailManageService_g',  
2478 - function(timeTableDetailManageService_g) { 2013 +angular.module('ScheduleApp').directive('saGuideboardgroup', [
  2014 + 'GuideboardManageService_g',
  2015 + function(guideboardManageService_g) {
2479 return { 2016 return {
2480 restrict: 'E', 2017 restrict: 'E',
2481 - templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/MyBcGroupWrapTemplate.html', 2018 + templateUrl: '/pages/scheduleApp/module/common/dts2/guideboardGroup/saGuideboardgroupTemplate.html',
2482 scope: { 2019 scope: {
2483 model: "=" // 独立作用域,关联外部的模型object 2020 model: "=" // 独立作用域,关联外部的模型object
2484 }, 2021 },
2485 - controllerAs: '$saBcgroupCtrl', 2022 + controllerAs: '$saGuideboardgroupCtrl',
2486 bindToController: true, 2023 bindToController: true,
2487 controller: function($scope) { 2024 controller: function($scope) {
2488 var self = this; 2025 var self = this;
2489 - self.$$data = []; // 选择线路,时刻表,路牌后的班次列表 2026 + self.$$data = []; // 选择线路后,该线路的路牌数据
2490 2027
2491 // 测试数据 2028 // 测试数据
2492 //self.$$data = [ 2029 //self.$$data = [
2493 - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},  
2494 - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},  
2495 - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'} 2030 + // {lpid: 1, lpname: '路1', isstart: false},
  2031 + // {lpid: 2, lpname: '路2', isstart: true},
  2032 + // {lpid: 3, lpname: '路3', isstart: false}
2496 //]; 2033 //];
2497 2034
2498 2035
2499 - self.$$dataSelected = []; // 套跑选中的班次列表 2036 + self.$$dataSelected = []; // 选中的路牌列表
  2037 + self.$$dataSelectedStart = undefined; // 起始路牌
2500 2038
2501 //self.$$dataSelected = [ 2039 //self.$$dataSelected = [
2502 - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},  
2503 - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},  
2504 - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'} 2040 + // {lpid: 11, lpname: '路11', isstart: false},
  2041 + // {lpid: 12, lpname: '路12', isstart: true},
  2042 + // {lpid: 13, lpname: '路13', isstart: false}
2505 //]; 2043 //];
2506 2044
2507 - // saBcgroup组件的ng-model,用于外部绑定等操作 2045 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
2508 self.$$internalmodel = undefined; 2046 self.$$internalmodel = undefined;
2509 2047
2510 - self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志  
2511 - self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志  
2512 - self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据 2048 + self.$$data_init = false; // *数据源初始化标志
  2049 + self.$$data_xl_first_init = false; // 线路是否初始化
  2050 + self.$$data_lp_first_init = false; // 路牌名字是否初始化
  2051 + self.$$data_lpid_first_init = false; // 路牌id是否初始化
  2052 + self.$$data_lpstart_first_init = false; // 起始路牌是否初始化
2513 2053
2514 }, 2054 },
2515 2055
@@ -2524,10 +2064,12 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -2524,10 +2064,12 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
2524 // TODO:获取所有的属性 2064 // TODO:获取所有的属性
2525 var $name_attr = tAttrs["name"]; // 控件的名字 2065 var $name_attr = tAttrs["name"]; // 控件的名字
2526 var $required_attr = tAttrs["required"]; // 是否需要required验证 2066 var $required_attr = tAttrs["required"]; // 是否需要required验证
2527 - var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名 2067 + var $lprangename_attr = tAttrs["lprangename"]; // 绑定的model路牌名字范围字段名
  2068 + var $lpidrangename_attr = tAttrs["lpidrangename"]; // 绑定的model路牌id范围字段名
  2069 + var $lpstartname_attr = tAttrs["lpstartname"]; // 绑定的model起始路牌字段名
2528 2070
2529 // controlAs名字 2071 // controlAs名字
2530 - var ctrlAs = '$saBcgroupCtrl'; 2072 + var ctrlAs = '$saGuideboardgroupCtrl';
2531 2073
2532 // 如果有required属性,添加angularjs required验证 2074 // 如果有required属性,添加angularjs required验证
2533 if ($required_attr != undefined) { 2075 if ($required_attr != undefined) {
@@ -2556,38 +2098,49 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -2556,38 +2098,49 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
2556 2098
2557 2099
2558 /** 2100 /**
2559 - * 班次列表点击(班次列表中选中班次 2101 + * 路牌列表点击(路牌列表中选中路牌
2560 * @param $index 2102 * @param $index
2561 */ 2103 */
2562 - scope[ctrlAs].$$internal_bclist_click = function($index) { 2104 + scope[ctrlAs].$$internal_lplist_click = function($index) {
2563 var data_temp = scope[ctrlAs].$$data; 2105 var data_temp = scope[ctrlAs].$$data;
2564 - var data_temp2 = scope[ctrlAs].$$dataSelected;  
2565 - var i = 0;  
2566 - var isunique = true; // 是否已经选择过  
2567 if (data_temp && data_temp.length > $index) { 2106 if (data_temp && data_temp.length > $index) {
2568 - for (i = 0; i < data_temp2.length; i++) {  
2569 - if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {  
2570 - isunique = false;  
2571 - break;  
2572 - } 2107 + scope[ctrlAs].$$dataSelected.push({
  2108 + lpid: data_temp[$index].lpid,
  2109 + lpname: data_temp[$index].lpname,
  2110 + isstart: data_temp[$index].isstart
  2111 + });
  2112 +
  2113 + // 如果没有指定过初始路牌,默认选择此路牌作为起始路牌
  2114 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  2115 + scope[ctrlAs].$$internal_sellplist_click(
  2116 + scope[ctrlAs].$$dataSelected.length - 1);
2573 } 2117 }
2574 - if (isunique) {  
2575 - data_temp2.push({  
2576 - bcttinfoid: data_temp[$index].bcttinfoid,  
2577 - bcfcsj: data_temp[$index].bcfcsj,  
2578 - bctype: data_temp[$index].bctype  
2579 - }); 2118 + }
  2119 + };
  2120 + /**
  2121 + * 选中的路牌单击(初始路牌选择)
  2122 + * @param $index
  2123 + */
  2124 + scope[ctrlAs].$$internal_sellplist_click = function($index) {
  2125 + var data_temp = scope[ctrlAs].$$dataSelected;
  2126 + if (data_temp && data_temp.length > $index) {
  2127 + for (var i = 0; i < data_temp.length; i++) {
  2128 + data_temp[i].isstart = false;
2580 } 2129 }
2581 - 2130 + data_temp[$index].isstart = true;
  2131 + scope[ctrlAs].$$dataSelectedStart = $index;
2582 } 2132 }
2583 }; 2133 };
2584 /** 2134 /**
2585 - * 选中的班次双击(删除选中的班次 2135 + * 选中的路牌双击(删除选中的路牌
2586 * @param $index 2136 * @param $index
2587 */ 2137 */
2588 - scope[ctrlAs].$$internal_selbclist_dbclick = function($index) { 2138 + scope[ctrlAs].$$internal_sellplist_dbclick = function($index) {
2589 var data_temp = scope[ctrlAs].$$dataSelected; 2139 var data_temp = scope[ctrlAs].$$dataSelected;
2590 if (data_temp && data_temp.length > $index) { 2140 if (data_temp && data_temp.length > $index) {
  2141 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  2142 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2143 + }
2591 data_temp.splice($index, 1); 2144 data_temp.splice($index, 1);
2592 } 2145 }
2593 }; 2146 };
@@ -2598,39 +2151,51 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -2598,39 +2151,51 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
2598 */ 2151 */
2599 scope[ctrlAs].$$internal_validate_model = function() { 2152 scope[ctrlAs].$$internal_validate_model = function() {
2600 var data_temp = scope[ctrlAs].$$dataSelected; 2153 var data_temp = scope[ctrlAs].$$dataSelected;
2601 - var bcttinfoIds = []; 2154 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  2155 + var lpNames = [];
  2156 + var lpIds = [];
  2157 + var lpStart = 0;
2602 var i = 0; 2158 var i = 0;
2603 2159
2604 if (data_temp && 2160 if (data_temp &&
2605 - data_temp.length > 0) { 2161 + data_temp.length > 0 &&
  2162 + data_temp2 != undefined) {
2606 2163
2607 for (i = 0; i < data_temp.length; i++) { 2164 for (i = 0; i < data_temp.length; i++) {
2608 - bcttinfoIds.push(data_temp[i].bcttinfoid);  
2609 - }  
2610 -  
2611 - // 更新外部model字段  
2612 - if ($bcttinfoidsname_attr) {  
2613 - console.log("bcttinfoidsname=" + bcttinfoIds.join(','));  
2614 - eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');"); 2165 + lpNames.push(data_temp[i].lpname);
  2166 + lpIds.push(data_temp[i].lpid)
2615 } 2167 }
  2168 + data_temp[data_temp2].isstart = true;
  2169 + lpStart = data_temp2 + 1;
2616 2170
2617 // 更新内部model,用于外部验证 2171 // 更新内部model,用于外部验证
2618 // 内部model的值暂时随意,以后再改 2172 // 内部model的值暂时随意,以后再改
2619 scope[ctrlAs].$$internalmodel = {desc: "ok"}; 2173 scope[ctrlAs].$$internalmodel = {desc: "ok"};
2620 2174
2621 - scope[ctrlAs].$$data_bcdata_first_init = true;  
2622 - scope[ctrlAs].$$data_bcttinfoids_first_init = true; 2175 + // 更新外部model字段
  2176 + if ($lprangename_attr) {
  2177 + console.log("lprangename=" + lpNames.join(','));
  2178 + eval("scope[ctrlAs].model" + "." + $lprangename_attr + " = lpNames.join(',');");
  2179 + }
  2180 + if ($lpidrangename_attr) {
  2181 + console.log("lpidrangename=" + lpIds.join(','));
  2182 + eval("scope[ctrlAs].model" + "." + $lpidrangename_attr + " = lpIds.join(',');");
  2183 + }
  2184 + if ($lpstartname_attr) {
  2185 + console.log("lpstartname=" + lpStart);
  2186 + eval("scope[ctrlAs].model" + "." + $lpstartname_attr + " = lpStart;");
  2187 + }
2623 2188
2624 } else { 2189 } else {
2625 scope[ctrlAs].$$internalmodel = undefined; 2190 scope[ctrlAs].$$internalmodel = undefined;
2626 } 2191 }
2627 2192
  2193 +
2628 }; 2194 };
2629 2195
2630 // 监控内部数据,$$data_selected 变化 2196 // 监控内部数据,$$data_selected 变化
2631 scope.$watch( 2197 scope.$watch(
2632 function() { 2198 function() {
2633 - console.log("长度:" + scope[ctrlAs].$$dataSelected.length);  
2634 return scope[ctrlAs].$$dataSelected; 2199 return scope[ctrlAs].$$dataSelected;
2635 }, 2200 },
2636 function(newValue, oldValue) { 2201 function(newValue, oldValue) {
@@ -2639,6 +2204,17 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -2639,6 +2204,17 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
2639 true 2204 true
2640 ); 2205 );
2641 2206
  2207 + // 监控内部数据,$$data_selected_start 变化
  2208 + scope.$watch(
  2209 + function() {
  2210 + return scope[ctrlAs].$$dataSelectedStart;
  2211 + },
  2212 + function(newValue, oldValue) {
  2213 + scope[ctrlAs].$$internal_validate_model();
  2214 + },
  2215 + true
  2216 + );
  2217 +
2642 /** 2218 /**
2643 * 验证数据是否初始化完成, 2219 * 验证数据是否初始化完成,
2644 * 所谓的初始化就是内部所有的数据被有效设定过一次。 2220 * 所谓的初始化就是内部所有的数据被有效设定过一次。
@@ -2646,41 +2222,20 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -2646,41 +2222,20 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
2646 scope[ctrlAs].$$internal_validate_init = function() { 2222 scope[ctrlAs].$$internal_validate_init = function() {
2647 var self = scope[ctrlAs]; 2223 var self = scope[ctrlAs];
2648 2224
2649 - var data_temp = self.$$data;  
2650 - var dataSelect_temp = self.$$dataSelected;  
2651 - var bcttinfoids = null;  
2652 -  
2653 - var i = 0;  
2654 - var j = 0;  
2655 -  
2656 - if (self.$$data_bcdata_first_init &&  
2657 - self.$$data_bcttinfoids_first_init) {  
2658 - console.log("开始初始化数据");  
2659 -  
2660 - bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];  
2661 -  
2662 - for (i = 0; i < bcttinfoids.length; i++) {  
2663 - dataSelect_temp.push({  
2664 - bcttinfoid: bcttinfoids[i]  
2665 - });  
2666 - for (j = 0; j < data_temp.length; j++) {  
2667 - if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {  
2668 - dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;  
2669 - dataSelect_temp[i].bctype = data_temp[j].bctype;  
2670 - break;  
2671 - }  
2672 - }  
2673 - }  
2674 - 2225 + if (self.$$data_xl_first_init &&
  2226 + self.$$data_lp_first_init &&
  2227 + self.$$data_lpid_first_init &&
  2228 + self.$$data_lpstart_first_init) {
2675 console.log("数据初始化完毕!"); 2229 console.log("数据初始化完毕!");
  2230 + self.$$data_init = true;
2676 } 2231 }
2677 2232
2678 }; 2233 };
2679 2234
2680 - // 监控初始化标志 2235 + // 监控初始化标志,线路,路牌,路牌id,起始路牌
2681 scope.$watch( 2236 scope.$watch(
2682 function() { 2237 function() {
2683 - return scope[ctrlAs].$$data_bcdata_first_init; 2238 + return scope[ctrlAs].$$data_xl_first_init;
2684 }, 2239 },
2685 function(newValue, oldValue) { 2240 function(newValue, oldValue) {
2686 scope[ctrlAs].$$internal_validate_init(); 2241 scope[ctrlAs].$$internal_validate_init();
@@ -2688,59 +2243,121 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -2688,59 +2243,121 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
2688 ); 2243 );
2689 scope.$watch( 2244 scope.$watch(
2690 function() { 2245 function() {
2691 - return scope[ctrlAs].$$data_bcttinfoids_first_init; 2246 + return scope[ctrlAs].$$data_lp_first_init;
  2247 + },
  2248 + function(newValue, oldValue) {
  2249 + scope[ctrlAs].$$internal_validate_init();
  2250 + }
  2251 + );
  2252 + scope.$watch(
  2253 + function() {
  2254 + return scope[ctrlAs].$$data_lpid_first_init;
  2255 + },
  2256 + function(newValue, oldValue) {
  2257 + scope[ctrlAs].$$internal_validate_init();
  2258 + }
  2259 + );
  2260 + scope.$watch(
  2261 + function() {
  2262 + return scope[ctrlAs].$$data_lpstart_first_init;
2692 }, 2263 },
2693 function(newValue, oldValue) { 2264 function(newValue, oldValue) {
2694 scope[ctrlAs].$$internal_validate_init(); 2265 scope[ctrlAs].$$internal_validate_init();
2695 } 2266 }
2696 ); 2267 );
2697 2268
2698 - // 监控内部数据的变化  
2699 - attr.$observe("dataparams", function(value) {  
2700 - if (value && value != "") {  
2701 - if (value == '{}') {  
2702 - return;  
2703 - }  
2704 2269
2705 - console.log("bcgroup observe 监控 dataparams=" + value); 2270 + // 监控线路id的变化
  2271 + attr.$observe("xlidvalue", function(value) {
  2272 + if (value && value != "") {
  2273 + console.log("xlidvalue=" + value);
2706 2274
2707 - timeTableDetailManageService_g.bcdetails.list(  
2708 - JSON.parse(value), 2275 + guideboardManageService_g.rest.list(
  2276 + {"xl.id_eq": value, size: 100},
2709 function(result) { 2277 function(result) {
2710 // 获取值了 2278 // 获取值了
2711 - console.log("内部班次数据获取了"); 2279 + console.log("路牌获取了");
2712 2280
2713 scope[ctrlAs].$$data = []; 2281 scope[ctrlAs].$$data = [];
2714 - for (var i = 0; i < result.length; i++) { 2282 + for (var i = 0; i < result.content.length; i++) {
2715 scope[ctrlAs].$$data.push({ 2283 scope[ctrlAs].$$data.push({
2716 - bcttinfoid: result[i].id,  
2717 - bcfcsj: result[i].fcsj,  
2718 - bctype: result[i].bcType 2284 + lpid: result.content[i].id,
  2285 + lpname: result.content[i].lpName,
  2286 + isstart: false
2719 }); 2287 });
2720 } 2288 }
2721 - if (scope[ctrlAs].$$data_bcdata_first_init &&  
2722 - scope[ctrlAs].$$data_bcttinfoids_first_init) {  
2723 - 2289 + if (scope[ctrlAs].$$data_init) {
2724 scope[ctrlAs].$$dataSelected = []; 2290 scope[ctrlAs].$$dataSelected = [];
  2291 + scope[ctrlAs].$$dataSelectedStart = undefined;
2725 scope[ctrlAs].$$internalmodel = undefined; 2292 scope[ctrlAs].$$internalmodel = undefined;
2726 } 2293 }
2727 - scope[ctrlAs].$$data_bcdata_first_init = true; 2294 + scope[ctrlAs].$$data_xl_first_init = true;
2728 }, 2295 },
2729 function(result) { 2296 function(result) {
2730 2297
2731 } 2298 }
2732 ); 2299 );
  2300 +
2733 } 2301 }
2734 }); 2302 });
2735 - // 监控班次ids数据的变化  
2736 - attr.$observe("bcttinfoidsvalue", function(value) { 2303 +
  2304 + // 监控路牌名称范围值的变化
  2305 + attr.$observe("lprangevalue", function(value) {
2737 if (value && value != "") { 2306 if (value && value != "") {
2738 - console.log("observe 监控 bcttinfoidsvalue=" + value);  
2739 - scope[ctrlAs].$$data_bcttinfoids_first_init = true;  
2740 - scope[ctrlAs].$$data_bcttinfoids_first_data = value; 2307 + var data_temp = scope[ctrlAs].$$dataSelected;
  2308 + var lpnames = value.split(",");
  2309 + var i = 0;
  2310 + if (data_temp && data_temp.length == 0) { // 初始创建
  2311 + console.log("lprangevalue变换了");
  2312 + for (i = 0; i < lpnames.length; i++) {
  2313 + scope[ctrlAs].$$dataSelected.push({
  2314 + lpname: lpnames[i],
  2315 + isstart: false
  2316 + });
  2317 + }
  2318 + } else {
  2319 + for (i = 0; i < lpnames.length; i++) {
  2320 + data_temp[i].lpname = lpnames[i];
  2321 + }
  2322 + }
  2323 + scope[ctrlAs].$$data_lp_first_init = true;
  2324 + }
  2325 + });
  2326 +
  2327 + // 监控路牌id范围值的变化
  2328 + attr.$observe("lpidrangevalue", function(value) {
  2329 + if (value && value != "") {
  2330 + console.log("lpidrangevalue=" + value);
  2331 + var data_temp = scope[ctrlAs].$$dataSelected;
  2332 + var lpids = value.split(",");
  2333 + var i = 0;
  2334 + if (data_temp && data_temp.length == 0) { // 初始创建
  2335 + console.log("lpidrangevalue");
  2336 + for (i = 0; i < lpids.length; i++) {
  2337 + scope[ctrlAs].$$dataSelected.push({
  2338 + lpid: lpids[i],
  2339 + isstart: false
  2340 + });
  2341 + }
  2342 + } else {
  2343 + for (i = 0; i < lpids.length; i++) {
  2344 + data_temp[i].lpid = lpids[i];
  2345 + }
  2346 + }
  2347 + scope[ctrlAs].$$data_lpid_first_init = true;
  2348 + }
  2349 + });
  2350 +
  2351 + // 监控起始路牌的变化
  2352 + attr.$observe("lpstartvalue", function(value) {
  2353 + if (value && value != "") {
  2354 + scope[ctrlAs].$$dataSelectedStart = value - 1;
  2355 + scope[ctrlAs].$$data_lpstart_first_init = true;
2741 } 2356 }
2742 }); 2357 });
2743 2358
  2359 +
  2360 +
2744 } 2361 }
2745 } 2362 }
2746 2363
@@ -2749,42 +2366,84 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [ @@ -2749,42 +2366,84 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saBcgroup&#39;, [
2749 } 2366 }
2750 ]); 2367 ]);
2751 2368
  2369 +
  2370 +
  2371 +
2752 /** 2372 /**
2753 - * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。 2373 + * saEmployeegroup指令
  2374 + * 属性如下:
2754 * name(必须):控件的名字 2375 * name(必须):控件的名字
2755 * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave 2376 * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
2756 - * placeholder(可选):输入框占位符字符串  
2757 - *  
2758 - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}  
2759 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
2760 - * icname(必须):内部与之对应的字段名,如:icname=code 2377 + * xlidvalue(必须):绑定的model线路id值,如:xlidvalue={{ctrl.employeeInfoForSave.xl.id}}
  2378 + * dbbmrangevalue(必须):绑定的model搭班编码范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  2379 + * dbbmrangename(必须):绑定的model搭班编码范围字段名,如:lprangename=lprange
  2380 + * rycidrangevalue(必须):绑定的model人员配置idid范围值,如:lprangevalue={{ctrl.employeeInfoForSave.lprange}}
  2381 + * rycidrangename(必须):绑定的model人员配置id范围字段名,如:lprangename=lprange
  2382 + * rystartvalue(必须):绑定的model起始人员,如:lpstartvalue={{ctrl.employeeInfoForSave.lpstart}}
  2383 + * rystartname(必须):绑定的model起始人员字段名,如:lpstartname=lpstart
2761 * 2384 *
2762 - * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}  
2763 - * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}  
2764 - * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name  
2765 * required(可选):是否要用required验证 2385 * required(可选):是否要用required验证
  2386 + *
2766 */ 2387 */
2767 -angular.module('ScheduleApp').directive('saSelect4', [  
2768 - '$timeout',  
2769 - '$$SearchInfoService_g',  
2770 - function($timeout, $$searchInfoService_g) { 2388 +angular.module('ScheduleApp').directive('saEmployeegroup', [
  2389 + 'EmployeeConfigService_g',
  2390 + function(employeeConfigService_g) {
2771 return { 2391 return {
2772 restrict: 'E', 2392 restrict: 'E',
2773 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/MyUISelectWrapTemplate2.html', 2393 + templateUrl: '/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroupTemplate.html',
2774 scope: { 2394 scope: {
2775 model: "=" // 独立作用域,关联外部的模型object 2395 model: "=" // 独立作用域,关联外部的模型object
2776 }, 2396 },
2777 - controllerAs: "$saSelectCtrl", 2397 + controllerAs: '$saEmployeegroupCtrl',
2778 bindToController: true, 2398 bindToController: true,
2779 controller: function($scope) { 2399 controller: function($scope) {
2780 var self = this; 2400 var self = this;
2781 - self.$$data = []; // ui-select显示用的数据  
2782 - self.$$data_real = []; // 内部真实的数据 2401 + self.$$data = []; // 选择线路后,该线路的人员配置数据
2783 2402
2784 - // saSelect4组件的ng-model,用于外部绑定验证等操作 2403 + // 测试数据
  2404 + //self.$$data = [
  2405 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1'},
  2406 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2'},
  2407 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3'}
  2408 + //];
  2409 +
  2410 + self.$$dataSelected = []; // 选中的人员配置列表
  2411 + self.$$dataSelectedStart = undefined; // 起始人员配置
  2412 +
  2413 + //self.$$dataSelected = [
  2414 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isstart: false},
  2415 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true},
  2416 + // {id: 3, dbbm: "3", jsy: '忍3', spy: '守3', isstart: false}
  2417 + //];
  2418 +
  2419 + self.$$isFB = false; // 是否分班
  2420 + self.$$dataFBSelected = []; // 选中的分班人员组配置列表
  2421 + self.$$dataFBInternalSelected = undefined; // 分班组内人员选中标识
  2422 + self.$$dataFBSelectedStart = undefined; // 选中的起始分班人员组合
  2423 +
  2424 + //self.$$dataFBSelected = [
  2425 + // {isstart: true, group: [
  2426 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  2427 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  2428 + // ]},
  2429 + // {isstart: false, group: [
  2430 + // {id: 1, dbbm: "1", jsy: '忍1', spy: '守1', isselected: false},
  2431 + // {id: 2, dbbm: "2", jsy: '忍2', spy: '守2', isstart: true}
  2432 + // ]}
  2433 + //];
  2434 +
  2435 + // saGuideboardgroup组件的ng-model,用于外部绑定等操作
2785 self.$$internalmodel = undefined; 2436 self.$$internalmodel = undefined;
2786 2437
2787 - self.$$internal_select_value = undefined; // 选中的值 2438 + self.$$data_init = false; // *数据源初始化标志
  2439 + self.$$data_xl_first_init = false; // 线路是否初始化
  2440 + self.$$data_ry_first_init = false; // 人员配置是否初始化
  2441 + self.$$data_ry_first_data = undefined; // 人员配置初始化数据
  2442 + self.$$data_rycid_first_init = false; // 人员配置id是否初始化
  2443 + self.$$data_rycid_first_data = undefined; // 人员配置id初始化数据
  2444 + self.$$data_rystart_first_init = false; // 起始人员是否初始化
  2445 + self.$$data_rystart_first_data = undefined; // 起始人员初始化数据
  2446 +
2788 }, 2447 },
2789 2448
2790 /** 2449 /**
@@ -2795,48 +2454,21 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [ @@ -2795,48 +2454,21 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
2795 * @returns {{pre: Function, post: Function}} 2454 * @returns {{pre: Function, post: Function}}
2796 */ 2455 */
2797 compile: function(tElem, tAttrs) { 2456 compile: function(tElem, tAttrs) {
2798 - // 获取属性 2457 + // TODO:获取所有的属性
2799 var $name_attr = tAttrs["name"]; // 控件的名字 2458 var $name_attr = tAttrs["name"]; // 控件的名字
2800 - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字  
2801 -  
2802 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
2803 - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名  
2804 -  
2805 - var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射  
2806 - var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息  
2807 var $required_attr = tAttrs["required"]; // 是否需要required验证 2459 var $required_attr = tAttrs["required"]; // 是否需要required验证
  2460 + var $dbbmrangename_attr = tAttrs["dbbmrangename"]; // 绑定的model搭班编码范围字段名
  2461 + var rycidrangename_attr = tAttrs["rycidrangename"]; // 绑定的model人员配置id范围字段名
  2462 + var $rystartname_attr = tAttrs["rystartname"]; // 绑定的model起始人员字段名
2808 2463
2809 // controlAs名字 2464 // controlAs名字
2810 - var ctrlAs = "$saSelectCtrl";  
2811 -  
2812 - // 验证属性  
2813 - if (!$name_attr) {  
2814 - throw new error("name属性必须填写");  
2815 - }  
2816 - if (!$dcname_attr) {  
2817 - throw new error("dcname属性必须填写");  
2818 - }  
2819 - if (!$icname_attr) {  
2820 - throw new error("icname属性必须填写");  
2821 - }  
2822 - if (!$dscol_attr) {  
2823 - throw new error("dscol属性必须填写");  
2824 - } 2465 + var ctrlAs = '$saEmployeegroupCtrl';
2825 2466
2826 - // 动态设置dom  
2827 - // dom required 属性 2467 + // 如果有required属性,添加angularjs required验证
2828 if ($required_attr != undefined) { 2468 if ($required_attr != undefined) {
  2469 + //console.log(tElem.html());
2829 tElem.find("div").attr("required", ""); 2470 tElem.find("div").attr("required", "");
2830 } 2471 }
2831 - // dom placeholder 属性  
2832 - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);  
2833 - // dom dscol 属性  
2834 - tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");  
2835 - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);  
2836 - // dom icname 属性  
2837 - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");  
2838 - // dom name 属性  
2839 - tElem.find("div").attr("name", $name_attr);  
2840 2472
2841 return { 2473 return {
2842 pre: function(scope, element, attr) { 2474 pre: function(scope, element, attr) {
@@ -2850,55 +2482,162 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [ @@ -2850,55 +2482,162 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
2850 * @param attr 2482 * @param attr
2851 */ 2483 */
2852 post: function(scope, element, attr) { 2484 post: function(scope, element, attr) {
  2485 + // name属性
  2486 + if ($name_attr) {
  2487 + scope[ctrlAs]["$name_attr"] = $name_attr;
  2488 + }
  2489 +
  2490 + /**
  2491 + * 人员配置列表点击(人员配置列表中选中路牌)
  2492 + * @param $index
  2493 + */
  2494 + scope[ctrlAs].$$internal_rylist_click = function($index) {
  2495 + var data_temp = scope[ctrlAs].$$data;
  2496 + if (data_temp && data_temp.length > $index) {
  2497 + if (!scope[ctrlAs].$$isFB) { // 不分班
  2498 + scope[ctrlAs].$$dataSelected.push({
  2499 + id : data_temp[$index].id,
  2500 + dbbm: data_temp[$index].dbbm,
  2501 + jsy: data_temp[$index].jsy,
  2502 + spy: data_temp[$index].spy,
  2503 + isstart: false
  2504 + });
  2505 +
  2506 + // 如果没有指定过初始人员,默认选择此人员作为起始人员
  2507 + if (scope[ctrlAs].$$dataSelectedStart == undefined) {
  2508 + scope[ctrlAs].$$internal_selrylist_click(
  2509 + scope[ctrlAs].$$dataSelected.length - 1);
  2510 + }
  2511 + } else { // 分班
  2512 + if (scope[ctrlAs].$$dataFBInternalSelected) { // 替换组内人员
  2513 + scope[ctrlAs].$$dataFBSelected
  2514 + [scope[ctrlAs].$$dataFBInternalSelected.gindex].group
  2515 + [scope[ctrlAs].$$dataFBInternalSelected.index] = {
  2516 + id : data_temp[$index].id,
  2517 + dbbm: data_temp[$index].dbbm,
  2518 + jsy: data_temp[$index].jsy,
  2519 + spy: data_temp[$index].spy,
  2520 + isselected: true
  2521 + };
  2522 +
  2523 + } else {
  2524 + scope[ctrlAs].$$dataFBSelected.push({
  2525 + isstart: false,
  2526 + group: [].concat(
  2527 + {
  2528 + id : data_temp[$index].id,
  2529 + dbbm: data_temp[$index].dbbm,
  2530 + jsy: data_temp[$index].jsy,
  2531 + spy: data_temp[$index].spy,
  2532 + isselected: false
  2533 + }, {
  2534 + id : data_temp[$index].id,
  2535 + dbbm: data_temp[$index].dbbm,
  2536 + jsy: data_temp[$index].jsy,
  2537 + spy: data_temp[$index].spy,
  2538 + isselected: false
  2539 + }
  2540 + )
  2541 + });
  2542 + if (scope[ctrlAs].$$dataFBSelectedStart == undefined) {
  2543 + scope[ctrlAs].$$internal_selrygrouplist_click(
  2544 + scope[ctrlAs].$$dataFBSelected.length - 1);
  2545 + }
  2546 + }
  2547 + }
2853 2548
2854 - // 添加选中事件处理函数  
2855 - scope[ctrlAs].$$internal_select_fn = function($item) {  
2856 - if ($dcname_attr && $icname_attr) {  
2857 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");  
2858 } 2549 }
  2550 + };
2859 2551
2860 - if ($cmaps_attr) {  
2861 - for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名  
2862 - var ic = $cmaps_attr[mc]; // 内部数据源对应字段  
2863 - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); 2552 + /**
  2553 + * 选中的人员单击(初始人员选择)
  2554 + * @param $index
  2555 + */
  2556 + scope[ctrlAs].$$internal_selrylist_click = function($index) {
  2557 + var data_temp = scope[ctrlAs].$$dataSelected;
  2558 + if (data_temp && data_temp.length > $index) {
  2559 + for (var i = 0; i < data_temp.length; i++) {
  2560 + data_temp[i].isstart = false;
2864 } 2561 }
  2562 + data_temp[$index].isstart = true;
  2563 + scope[ctrlAs].$$dataSelectedStart = $index;
2865 } 2564 }
2866 }; 2565 };
2867 -  
2868 - // 删除选中事件处理函数  
2869 - scope[ctrlAs].$$internal_remove_fn = function() {  
2870 - scope[ctrlAs].$$internal_select_value = undefined;  
2871 - if ($dcname_attr) {  
2872 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); 2566 + /**
  2567 + * 选中的人员双击(删除选中的人员)
  2568 + * @param $index
  2569 + */
  2570 + scope[ctrlAs].$$internal_selrylist_dbclick = function($index) {
  2571 + var data_temp = scope[ctrlAs].$$dataSelected;
  2572 + if (data_temp && data_temp.length > $index) {
  2573 + if (scope[ctrlAs].$$dataSelectedStart == $index) {
  2574 + scope[ctrlAs].$$dataSelectedStart = undefined;
  2575 + }
  2576 + data_temp.splice($index, 1);
2873 } 2577 }
  2578 + };
2874 2579
2875 - if ($cmaps_attr) {  
2876 - var mc; // model的字段名  
2877 - for (mc in $cmaps_attr) {  
2878 - eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); 2580 + /**
  2581 + * 选中的分班组人员单击(初始人员选择)
  2582 + * @param $index
  2583 + */
  2584 + scope[ctrlAs].$$internal_selrygrouplist_click = function($index) {
  2585 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2586 + if (data_temp && data_temp.length > $index) {
  2587 + for (var i = 0; i < data_temp.length; i++) {
  2588 + data_temp[i].isstart = false;
  2589 + for (var j = 0; j < data_temp[i].group.length; j++) {
  2590 + data_temp[i].group[j].isselected = false;
  2591 + }
2879 } 2592 }
  2593 + data_temp[$index].isstart = true;
  2594 + scope[ctrlAs].$$dataFBSelectedStart = $index;
  2595 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
2880 } 2596 }
2881 - scope[ctrlAs].$$internal_validate_model();  
2882 }; 2597 };
2883 -  
2884 - // 刷新数据  
2885 - scope[ctrlAs].$$internal_refresh_fn = function(search) {  
2886 - if (search && search != "") { // 有search值  
2887 - // 处理search  
2888 - console.log("search:" + search);  
2889 -  
2890 - scope[ctrlAs].$$data = [];  
2891 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
2892 - var upTerm = search.toUpperCase();  
2893 - if (scope[ctrlAs].$$data.length < 10) {  
2894 - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1  
2895 - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {  
2896 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k])); 2598 + /**
  2599 + * 分组内部单击(选中分班中的某组人员)
  2600 + * @param $groupindex 组index
  2601 + * @param $index 组内部某个index
  2602 + * @param $event 事件防止冒泡
  2603 + */
  2604 + scope[ctrlAs].$$internal_selrygroup_click = function($groupindex, $index, $event) {
  2605 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2606 + if (data_temp && data_temp.length > $groupindex) {
  2607 + if (data_temp[$groupindex].group && data_temp[$groupindex].group.length > $index) {
  2608 + // $$dataFBInternalSelected的格式如下:
  2609 + //{gindex: 1, index: 0}
  2610 + for (var i = 0; i < data_temp.length; i++) {
  2611 + data_temp[i].isstart = false;
  2612 + for (var j = 0; j < data_temp[i].group.length; j++) {
  2613 + data_temp[i].group[j].isselected = false;
2897 } 2614 }
2898 - } else {  
2899 - break;  
2900 } 2615 }
  2616 + data_temp[$groupindex].group[$index].isselected = true;
  2617 + scope[ctrlAs].$$dataFBInternalSelected = {
  2618 + gindex: $groupindex, index: $index
  2619 + };
  2620 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2621 + $event.stopPropagation();
  2622 + }
  2623 + }
  2624 +
  2625 + };
  2626 + /**
  2627 + * 选中的分班人员双击(删除选中的人员)
  2628 + * @param $index
  2629 + */
  2630 + scope[ctrlAs].$$internal_selrygrouplist_dbclick = function($index) {
  2631 + var data_temp = scope[ctrlAs].$$dataFBSelected;
  2632 + if (data_temp && data_temp.length > $index) {
  2633 + if (scope[ctrlAs].$$dataFBSelectedStart == $index) {
  2634 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2635 + }
  2636 + if (scope[ctrlAs].$$dataFBInternalSelected &&
  2637 + scope[ctrlAs].$$dataFBInternalSelected.gindex == $index) {
  2638 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
2901 } 2639 }
  2640 + data_temp.splice($index, 1);
2902 } 2641 }
2903 }; 2642 };
2904 2643
@@ -2906,212 +2645,418 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [ @@ -2906,212 +2645,418 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
2906 * 验证内部数据,更新外部model 2645 * 验证内部数据,更新外部model
2907 */ 2646 */
2908 scope[ctrlAs].$$internal_validate_model = function() { 2647 scope[ctrlAs].$$internal_validate_model = function() {
2909 - if (scope[ctrlAs].$$internal_select_value) {  
2910 - var select_value_temp = scope[ctrlAs].$$internal_select_value;  
2911 - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {  
2912 - var obj;  
2913 - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {  
2914 - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {  
2915 - obj = angular.copy(scope[ctrlAs].$$data_real[j]);  
2916 - break; 2648 + var data_temp = scope[ctrlAs].$$dataSelected;
  2649 + var data_temp2 = scope[ctrlAs].$$dataSelectedStart;
  2650 + var data_temp3 = scope[ctrlAs].$$dataFBSelected;
  2651 + var data_temp4 = scope[ctrlAs].$$dataFBSelectedStart;
  2652 + var ryDbbms = [];
  2653 + var ryDbbm_group = [];
  2654 + var ryCids = [];
  2655 + var ryCid_group = [];
  2656 + var ryStart = 0;
  2657 + var i = 0;
  2658 + var j = 0;
  2659 +
  2660 + var isFB = scope[ctrlAs].$$isFB;
  2661 +
  2662 + if (isFB) {
  2663 + if (data_temp3 &&
  2664 + data_temp3.length > 0 &&
  2665 + data_temp4 != undefined) {
  2666 +
  2667 + for (i = 0; i < data_temp3.length; i++) {
  2668 + for (j = 0; j < data_temp3[i].group.length; j++) {
  2669 + ryDbbm_group.push(data_temp3[i].group[j].dbbm);
  2670 + ryCid_group.push(data_temp3[i].group[j].id);
2917 } 2671 }
  2672 + ryDbbms.push(ryDbbm_group.join("-"));
  2673 + ryCids.push(ryCid_group.join("-"));
  2674 + ryDbbm_group = [];
  2675 + ryCid_group = [];
2918 } 2676 }
2919 - if (obj) { // 在data中判定有没有  
2920 - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {  
2921 - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {  
2922 - obj = undefined;  
2923 - break;  
2924 - }  
2925 - }  
2926 - if (obj) {  
2927 - scope[ctrlAs].$$data.push(obj);  
2928 - }  
2929 - // 更新内部model,用于外部验证  
2930 - // 内部model的值暂时随意,以后再改  
2931 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
2932 - } else {  
2933 - scope[ctrlAs].$$internalmodel = undefined; 2677 +
  2678 + data_temp3[data_temp4].isstart = true;
  2679 + ryStart = data_temp4 + 1;
  2680 +
  2681 + // 更新内部model,用于外部验证
  2682 + // 内部model的值暂时随意,以后再改
  2683 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  2684 +
  2685 + // 更新外部model字段
  2686 + if ($dbbmrangename_attr) {
  2687 + console.log("dbbmrangename=" + ryDbbms.join(','));
  2688 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  2689 + }
  2690 + if (rycidrangename_attr) {
  2691 + console.log("rycidrangename=" + ryCids.join(','));
  2692 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  2693 + }
  2694 + if ($rystartname_attr) {
  2695 + console.log("rystartname=" + ryStart);
  2696 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
  2697 + }
  2698 +
  2699 + } else {
  2700 + scope[ctrlAs].$$internalmodel = undefined;
  2701 + }
  2702 +
  2703 + } else {
  2704 + if (data_temp &&
  2705 + data_temp.length > 0 &&
  2706 + data_temp2 != undefined) {
  2707 +
  2708 + for (i = 0; i < data_temp.length; i++) {
  2709 + ryDbbms.push(data_temp[i].dbbm);
  2710 + ryCids.push(data_temp[i].id);
  2711 + }
  2712 + data_temp[data_temp2].isstart = true;
  2713 + ryStart = data_temp2 + 1;
  2714 +
  2715 + // 更新内部model,用于外部验证
  2716 + // 内部model的值暂时随意,以后再改
  2717 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  2718 +
  2719 + // 更新外部model字段
  2720 + if ($dbbmrangename_attr) {
  2721 + console.log("dbbmrangename=" + ryDbbms.join(','));
  2722 + eval("scope[ctrlAs].model" + "." + $dbbmrangename_attr + " = ryDbbms.join(',');");
  2723 + }
  2724 + if (rycidrangename_attr) {
  2725 + console.log("rycidrangename=" + ryCids.join(','));
  2726 + eval("scope[ctrlAs].model" + "." + rycidrangename_attr + " = ryCids.join(',');");
  2727 + }
  2728 + if ($rystartname_attr) {
  2729 + console.log("rystartname=" + ryStart);
  2730 + eval("scope[ctrlAs].model" + "." + $rystartname_attr + " = ryStart;");
2934 } 2731 }
2935 2732
2936 - } else {  
2937 - scope[ctrlAs].$$internalmodel = undefined;  
2938 - } 2733 + } else {
  2734 + scope[ctrlAs].$$internalmodel = undefined;
  2735 + }
  2736 + }
  2737 +
  2738 + };
  2739 +
  2740 + // 监控内部数据,$$dataSelected 变化
  2741 + scope.$watch(
  2742 + function() {
  2743 + return scope[ctrlAs].$$dataSelected;
  2744 + },
  2745 + function(newValue, oldValue) {
  2746 + scope[ctrlAs].$$internal_validate_model();
  2747 + },
  2748 + true
  2749 + );
  2750 +
  2751 + // 监控内部数据,$$dataSelectedStart 变化
  2752 + scope.$watch(
  2753 + function() {
  2754 + return scope[ctrlAs].$$dataSelectedStart;
  2755 + },
  2756 + function(newValue, oldValue) {
  2757 + scope[ctrlAs].$$internal_validate_model();
  2758 + },
  2759 + true
  2760 + );
  2761 +
  2762 +
  2763 + // 监控内部数据,$$dataFBSelected 变化
  2764 + scope.$watch(
  2765 + function() {
  2766 + return scope[ctrlAs].$$dataFBSelected;
  2767 + },
  2768 + function(newValue, oldValue) {
  2769 + scope[ctrlAs].$$internal_validate_model();
  2770 + },
  2771 + true
  2772 + );
  2773 +
  2774 + // 监控内部数据,$$dataFBSelectedStart 变化
  2775 + scope.$watch(
  2776 + function() {
  2777 + return scope[ctrlAs].$$dataFBSelectedStart;
  2778 + },
  2779 + function(newValue, oldValue) {
  2780 + scope[ctrlAs].$$internal_validate_model();
  2781 + },
  2782 + true
  2783 + );
  2784 +
  2785 + // 监控内部数据,$$dataFBInternalSelected 变化
  2786 + scope.$watch(
  2787 + function() {
  2788 + return scope[ctrlAs].$$dataFBInternalSelected;
  2789 + },
  2790 + function(newValue, oldValue) {
  2791 + scope[ctrlAs].$$internal_validate_model();
  2792 + },
  2793 + true
  2794 + );
2939 2795
2940 - } else {  
2941 - scope[ctrlAs].$$internalmodel = undefined;  
2942 - }  
2943 - }; 2796 + // 监控内部数据,$$isFB 变化
  2797 + scope.$watch(
  2798 + function() {
  2799 + return scope[ctrlAs].$$isFB;
  2800 + },
  2801 + function(newValue, oldValue) {
  2802 + scope[ctrlAs].$$internal_validate_model();
  2803 + },
  2804 + true
  2805 + );
2944 2806
2945 /** 2807 /**
2946 - * 内部方法,读取字典数据作为数据源。  
2947 - * @param atype ajax查询类型  
2948 - * @param ajaxparamobj 查询参数对象 2808 + * 验证数据是否初始化完成,
  2809 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
2949 */ 2810 */
2950 - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {  
2951 - ajaxparamobj.type = 'all';  
2952 - $$searchInfoService_g[atype].list(  
2953 - ajaxparamobj,  
2954 - function(result) {  
2955 - console.log("$$internal_ajax_data result"); 2811 + scope[ctrlAs].$$internal_validate_init = function() {
  2812 + var self = scope[ctrlAs];
  2813 + var data_temp = self.$$data;
  2814 + var dataSelect_temp = self.$$dataSelected;
  2815 + var dataFBSelect_temp = self.$$dataFBSelected;
  2816 + var dbbmnames = null;
  2817 + var dbbmnamegroup = null;
  2818 + var rycids = null;
  2819 + var rycidgroup = null;
2956 2820
2957 - // 清空内部数据  
2958 - scope[ctrlAs].$$data_real = [];  
2959 - scope[ctrlAs].$$data = []; 2821 + var i = 0;
  2822 + var j = 0;
  2823 + var k = 0;
2960 2824
2961 - // result中添加拼音数据,注意:这里要求result返回对象数组  
2962 - for (var i = 0; i < result.length; i ++) {  
2963 - if ($dscol_attr) {  
2964 - if (eval("result[i]" + "." + $dscol_attr)) {  
2965 - // 全拼  
2966 - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();  
2967 - // 简拼  
2968 - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));  
2969 - }  
2970 - } 2825 + if (self.$$data_xl_first_init &&
  2826 + self.$$data_ry_first_init &&
  2827 + self.$$data_rycid_first_init &&
  2828 + self.$$data_rystart_first_init && !self.$$data_init) {
  2829 + console.log("开始初始化数据");
2971 2830
2972 - if (result[i]["fullChars"]) { // 有拼音的加入数据源  
2973 - scope[ctrlAs].$$data_real.push(result[i]); 2831 + // 判定是否分班,字符串中包含-就是了
  2832 + if (self.$$data_ry_first_data.indexOf("-") != -1 && dataFBSelect_temp.length == 0) { // 分班
  2833 + self.$$isFB = true;
  2834 +
  2835 + // 搭班编码、人员配置id
  2836 + dbbmnames = self.$$data_ry_first_data.split(",");
  2837 + rycids = self.$$data_rycid_first_data.split(",");
  2838 + for (i = 0; i < dbbmnames.length; i++) {
  2839 + dataFBSelect_temp.push({
  2840 + group: [],
  2841 + isstart: false
  2842 + });
  2843 + dbbmnamegroup = dbbmnames[i].split("-");
  2844 + rycidgroup = rycids[i].split("-");
  2845 +
  2846 + for (k = 0; k < dbbmnamegroup.length; k++) {
  2847 + dataFBSelect_temp[i].group.push({
  2848 + id: rycidgroup[k],
  2849 + dbbm: dbbmnamegroup[k],
  2850 + isselected: false
  2851 + });
  2852 +
  2853 + for (j = 0; j < data_temp.length; j++) {
  2854 + if (dataFBSelect_temp[i].group[k].dbbm == data_temp[j].dbbm) {
  2855 + dataFBSelect_temp[i].group[k].jsy = data_temp[j].jsy;
  2856 + dataFBSelect_temp[i].group[k].spy = data_temp[j].spy;
  2857 + break;
  2858 + }
  2859 + }
2974 } 2860 }
2975 2861
2976 } 2862 }
2977 2863
2978 - // 数据量太大,取10条记录显示  
2979 - if (angular.isArray(scope[ctrlAs].$$data_real)) {  
2980 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
2981 - if (scope[ctrlAs].$$data.length < 10) {  
2982 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
2983 - } else { 2864 + // 初始人员
  2865 + scope[ctrlAs].$$dataFBSelectedStart = self.$$data_rystart_first_data - 1;
  2866 +
  2867 +
  2868 + } else if (dataSelect_temp.length == 0) {
  2869 + self.$$isFB = false;
  2870 +
  2871 + // 搭班编码、人员配置id
  2872 + dbbmnames = self.$$data_ry_first_data.split(",");
  2873 + rycids = self.$$data_rycid_first_data.split(",");
  2874 + for (i = 0; i < dbbmnames.length; i++) {
  2875 + dataSelect_temp.push({
  2876 + id: rycids[i],
  2877 + dbbm: dbbmnames[i],
  2878 + isstart: false
  2879 + });
  2880 + for (j = 0; j < data_temp.length; j++) {
  2881 + if (dataSelect_temp[i].dbbm == data_temp[j].dbbm) {
  2882 + dataSelect_temp[i].jsy = data_temp[j].jsy;
  2883 + dataSelect_temp[i].spy = data_temp[j].spy;
2984 break; 2884 break;
2985 } 2885 }
2986 } 2886 }
2987 } 2887 }
2988 -  
2989 - scope[ctrlAs].$$internal_validate_model();  
2990 - },  
2991 - function(result) { 2888 + // 初始人员
  2889 + scope[ctrlAs].$$dataSelectedStart = self.$$data_rystart_first_data - 1;
2992 2890
2993 } 2891 }
2994 - );  
2995 - };  
2996 2892
2997 - /**  
2998 - * 内部方法,读取字典数据作为数据源。  
2999 - * @param dictype 字典类型,如:gsType  
3000 - */  
3001 - scope[ctrlAs].$$internal_dic_data = function(dictype) {  
3002 - if (!dictionaryUtils.getByGroup(dictype)) {  
3003 - throw new error("字典数据不窜在=" + dictype); 2893 + console.log("数据初始化完毕!");
  2894 + self.$$data_init = true;
3004 } 2895 }
3005 2896
3006 - // 清空内部数据  
3007 - scope[ctrlAs].$$data_real = [];  
3008 - scope[ctrlAs].$$data = [];  
3009 -  
3010 - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);  
3011 - var dic_key; // 字典key 2897 + };
3012 2898
3013 - for (dic_key in origin_dicgroup) {  
3014 - var data = {}; // 重新组合的字典元素对象  
3015 - if (dic_key == "true")  
3016 - data[$icname_attr] = true;  
3017 - else  
3018 - data[$icname_attr] = dic_key;  
3019 - data[$dscol_attr] = origin_dicgroup[dic_key];  
3020 - scope[ctrlAs].$$data_real.push(data); 2899 + // 监控初始化标志,线路,人员,起始人员
  2900 + scope.$watch(
  2901 + function() {
  2902 + return scope[ctrlAs].$$data_xl_first_init;
  2903 + },
  2904 + function(newValue, oldValue) {
  2905 + scope[ctrlAs].$$internal_validate_init();
3021 } 2906 }
3022 - // 这里直接将$$data_real数据深拷贝到$$data  
3023 - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);  
3024 - scope[ctrlAs].$$internal_validate_model();  
3025 - }; 2907 + );
  2908 + scope.$watch(
  2909 + function() {
  2910 + return scope[ctrlAs].$$data_ry_first_init;
  2911 + },
  2912 + function(newValue, oldValue) {
  2913 + scope[ctrlAs].$$internal_validate_init();
  2914 + }
  2915 + );
  2916 + scope.$watch(
  2917 + function() {
  2918 + return scope[ctrlAs].$$data_rycid_first_init;
  2919 + },
  2920 + function(newValue, oldValue) {
  2921 + scope[ctrlAs].$$internal_validate_init();
  2922 + }
  2923 + );
  2924 + scope.$watch(
  2925 + function() {
  2926 + return scope[ctrlAs].$$data_rystart_first_init;
  2927 + },
  2928 + function(newValue, oldValue) {
  2929 + scope[ctrlAs].$$internal_validate_init();
  2930 + }
  2931 + );
3026 2932
3027 - attr.$observe("dsparams", function(value) { 2933 +
  2934 + // 监控线路id的变化
  2935 + attr.$observe("xlidvalue", function(value) {
3028 if (value && value != "") { 2936 if (value && value != "") {
3029 - var obj = JSON.parse(value);  
3030 - console.log("observe 监控 dsparams=" + obj); 2937 + console.log("xlidvalue=" + value);
3031 2938
3032 - // dsparams格式如下:  
3033 - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'} 2939 + employeeConfigService_g.rest.list(
  2940 + {"xl.id_eq": value, "isCancel_eq" : false, size: 100},
  2941 + function(result) {
  2942 + // 获取值了
  2943 + console.log("人员配置获取了");
3034 2944
3035 - if (obj.type == 'dic') {  
3036 - scope[ctrlAs].$$internal_dic_data(obj.param); 2945 + scope[ctrlAs].$$data = [];
  2946 + for (var i = 0; i < result.content.length; i++) {
  2947 + scope[ctrlAs].$$data.push({
  2948 + id: result.content[i].id,
  2949 + dbbm: result.content[i].dbbm,
  2950 + jsy: result.content[i].jsy.personnelName,
  2951 + spy: result.content[i].spy == null ? "" : result.content[i].spy.personnelName
  2952 + });
  2953 + }
  2954 + if (scope[ctrlAs].$$data_init) {
  2955 + scope[ctrlAs].$$dataSelected = [];
  2956 + scope[ctrlAs].$$dataSelectedStart = undefined;
3037 2957
3038 - } else if (obj.type == 'ajax') {  
3039 - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);  
3040 - } else {  
3041 - throw new Error("dsparams参数格式异常=" + obj);  
3042 - } 2958 + scope[ctrlAs].$$dataFBSelected = [];
  2959 + scope[ctrlAs].$$dataFBInternalSelected = undefined;
  2960 + scope[ctrlAs].$$dataFBSelectedStart = undefined;
  2961 +
  2962 + scope[ctrlAs].$$internalmodel = undefined;
  2963 + }
  2964 + scope[ctrlAs].$$data_xl_first_init = true;
  2965 + },
  2966 + function(result) {
  2967 +
  2968 + }
  2969 + );
3043 2970
3044 } 2971 }
  2972 + });
3045 2973
  2974 + // 监控搭班编码范围值的变化
  2975 + attr.$observe("dbbmrangevalue", function(value) {
  2976 + if (value && value != "") {
  2977 + console.log("dbbmrangevalue变换了");
  2978 + scope[ctrlAs].$$data_ry_first_init = true;
  2979 + scope[ctrlAs].$$data_ry_first_data = value;
  2980 + }
3046 }); 2981 });
3047 2982
3048 - // 监控model绑定的dcvalue值变化  
3049 - attr.$observe("dcvalue", function(value) { 2983 + // 监控人员配置id范围值的变化
  2984 + attr.$observe("rycidrangevalue", function(value) {
3050 if (value && value != "") { 2985 if (value && value != "") {
3051 - console.log("observe 监控 dcvalue=" + value);  
3052 - scope[ctrlAs].$$internal_select_value = value;  
3053 - scope[ctrlAs].$$internal_validate_model(); 2986 + console.log("rycidrangevalue变换了");
  2987 + scope[ctrlAs].$$data_rycid_first_init = true;
  2988 + scope[ctrlAs].$$data_rycid_first_data = value;
3054 } 2989 }
  2990 + });
3055 2991
3056 - // 闭包测试  
3057 - var obj = {'a':1,'b':2};  
3058 - var tfx = scope[ctrlAs].$$test.bind(obj);  
3059 - console.log("闭包测试=" + tfx()); 2992 + // 监控起始人员的变化
  2993 + attr.$observe("rystartvalue", function(value) {
  2994 + if (value && value != "") {
  2995 + console.log("rystartvalue变换了");
  2996 + scope[ctrlAs].$$data_rystart_first_init = true;
  2997 + scope[ctrlAs].$$data_rystart_first_data = value;
  2998 + }
3060 }); 2999 });
3061 3000
3062 - scope[ctrlAs].$$test = function() {  
3063 - var exp = "this.a + '(' + this.b + ')'";  
3064 - console.log("exp=" + exp);  
3065 - return eval(exp);  
3066 - };  
3067 } 3001 }
3068 - }; 3002 + }
3069 3003
3070 } 3004 }
3071 -  
3072 - }; 3005 + }
3073 } 3006 }
3074 ]); 3007 ]);
3075 3008
  3009 +
  3010 +
  3011 +
3076 /** 3012 /**
3077 - * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。 3013 + * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
  3014 + * 属性如下:
3078 * name(必须):控件的名字 3015 * name(必须):控件的名字
3079 - * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave  
3080 - * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}  
3081 - * dcname(必须):绑定的model字段名,如:dcname=xl.id  
3082 - * icname(必须):内部与之对应的字段名,如:icname=id  
3083 - *  
3084 - * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}  
3085 - * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}  
3086 - * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item  
3087 - * iterobjexp(必须):内部显示用的表达式  
3088 - * searchph(必须):查询输入占位符字符串,如:searchph=请输入...  
3089 - * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'  
3090 - *  
3091 - * required(可选):是否需要form的required验证 3016 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  3017 + * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}
  3018 + * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange
  3019 + * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  3020 + * required(可选):是否要用required验证
3092 * 3021 *
3093 */ 3022 */
3094 -angular.module('ScheduleApp').directive('saSelect5', [  
3095 - '$timeout',  
3096 - '$$SearchInfoService_g',  
3097 - function($timeout, $$searchInfoService_g) { 3023 +angular.module('ScheduleApp').directive('saBcgroup', [
  3024 + 'TimeTableDetailManageService_g',
  3025 + function(timeTableDetailManageService_g) {
3098 return { 3026 return {
3099 restrict: 'E', 3027 restrict: 'E',
3100 - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',  
3101 - scope: { // 独立作用域  
3102 - model: "=" // 绑定外部对象 3028 + templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html',
  3029 + scope: {
  3030 + model: "=" // 独立作用域,关联外部的模型object
3103 }, 3031 },
3104 - controllerAs: "$saSelectCtrl", 3032 + controllerAs: '$saBcgroupCtrl',
3105 bindToController: true, 3033 bindToController: true,
3106 controller: function($scope) { 3034 controller: function($scope) {
3107 var self = this; 3035 var self = this;
3108 - self.$$data = []; // 内部ui-select显示用数据  
3109 - self.$$data_real = []; // 内部保存的实际数据 3036 + self.$$data = []; // 选择线路,时刻表,路牌后的班次列表
3110 3037
3111 - // myselect组件的ng-model,用于外部绑定验证等操作 3038 + // 测试数据
  3039 + //self.$$data = [
  3040 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  3041 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  3042 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  3043 + //];
  3044 +
  3045 +
  3046 + self.$$dataSelected = []; // 套跑选中的班次列表
  3047 +
  3048 + //self.$$dataSelected = [
  3049 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  3050 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  3051 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  3052 + //];
  3053 +
  3054 + // saBcgroup组件的ng-model,用于外部绑定等操作
3112 self.$$internalmodel = undefined; 3055 self.$$internalmodel = undefined;
3113 3056
3114 - self.$$internal_select_value = undefined; // 选中的值 3057 + self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志
  3058 + self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志
  3059 + self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据
3115 3060
3116 }, 3061 },
3117 3062
@@ -3123,69 +3068,22 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -3123,69 +3068,22 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
3123 * @returns {{pre: Function, post: Function}} 3068 * @returns {{pre: Function, post: Function}}
3124 */ 3069 */
3125 compile: function(tElem, tAttrs) { 3070 compile: function(tElem, tAttrs) {
3126 - // 获取属性,并验证必须按属性 3071 + // TODO:获取所有的属性
3127 var $name_attr = tAttrs["name"]; // 控件的名字 3072 var $name_attr = tAttrs["name"]; // 控件的名字
3128 - var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象  
3129 - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名  
3130 - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名  
3131 -  
3132 - var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象  
3133 - var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串  
3134 - var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名  
3135 - var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式  
3136 - var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串  
3137 - var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式  
3138 -  
3139 var $required_attr = tAttrs["required"]; // 是否需要required验证 3073 var $required_attr = tAttrs["required"]; // 是否需要required验证
  3074 + var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名
3140 3075
3141 - if (!$name_attr) {  
3142 - throw new Error("name属性必须填写");  
3143 - }  
3144 - if (!$cmaps_attr) {  
3145 - throw new Error("cmaps属性必须填写")  
3146 - }  
3147 - if (!$dcname_attr || !$icname_attr) {  
3148 - throw new Error("dcname、icname属性必须填写");  
3149 - }  
3150 - if (!$dsparams_attr) {  
3151 - throw new Error("dsparams属性必须填写");  
3152 - }  
3153 - if (!$iterobjname_attr) {  
3154 - throw new Error("iterobjname属性必须填写");  
3155 - }  
3156 - if (!$iterobjexp_attr) {  
3157 - throw new Error("iterobjexp属性必须填写");  
3158 - }  
3159 - if (!$searchph_attr) {  
3160 - throw new Error("searchph属性必须填写");  
3161 - }  
3162 - if (!$searchexp_attr) {  
3163 - throw new Error("searchexp属性必须填写");  
3164 - }  
3165 -  
3166 - // 内部controlAs名字  
3167 - var ctrlAs = "$saSelectCtrl"; 3076 + // controlAs名字
  3077 + var ctrlAs = '$saBcgroupCtrl';
3168 3078
3169 - // 动态设置dom  
3170 - // dom,最外层name属性设置  
3171 - tElem.find("div:first").attr("name", $name_attr);  
3172 - // dom,最外层divrequired属性设置 3079 + // 如果有required属性,添加angularjs required验证
3173 if ($required_attr != undefined) { 3080 if ($required_attr != undefined) {
3174 - tElem.find("div[name=\'" + $name_attr + "\']").attr("required", ""); 3081 + //console.log(tElem.html());
  3082 + tElem.find("div").attr("required", "");
3175 } 3083 }
3176 - // dom,ui-select-match的placeholder属性设定  
3177 - tElem.find("ui-select-match").attr("placeholder", $searchph_attr);  
3178 - // dom,ui-select-match的内容设定  
3179 - var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";  
3180 - tElem.find("ui-select-match").html(uiSelectMatchHtml);  
3181 - // dom,ui-select-choices的repeat属性设定  
3182 - var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";  
3183 - tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);  
3184 - // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置  
3185 - tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");  
3186 3084
3187 return { 3085 return {
3188 - pre: function (scope, element, attr) { 3086 + pre: function(scope, element, attr) {
3189 // TODO: 3087 // TODO:
3190 }, 3088 },
3191 3089
@@ -3195,263 +3093,206 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -3195,263 +3093,206 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
3195 * @param element 3093 * @param element
3196 * @param attr 3094 * @param attr
3197 */ 3095 */
3198 - post: function (scope, element, attr) {  
3199 -  
3200 - // 添加选中事件处理函数  
3201 - scope[ctrlAs].$$internal_select_fn = function($item) {  
3202 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");  
3203 -  
3204 - eval("var obj=" + $cmaps_attr);  
3205 - for (var mc in obj) { // model的字段名:内部数据源对应字段名  
3206 - var ic = obj[mc]; // 内部数据源对应字段  
3207 - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");  
3208 - }  
3209 - };  
3210 -  
3211 - // 删除选中事件处理函数  
3212 - scope[ctrlAs].$$internal_remove_fn = function() {  
3213 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); 3096 + post: function(scope, element, attr) {
  3097 + // name属性
  3098 + if ($name_attr) {
  3099 + scope[ctrlAs]["$name_attr"] = $name_attr;
  3100 + }
3214 3101
3215 - eval("var obj=" + $cmaps_attr);  
3216 - var mc; // model的字段名  
3217 - for (mc in obj) {  
3218 - eval("scope[ctrlAs].model" + "." + mc + " = undefined;");  
3219 - }  
3220 - }; 3102 + // TODO:
3221 3103
3222 - // 刷新数据  
3223 - scope[ctrlAs].$$internal_refresh_fn = function(search) {  
3224 - if (search && search != "") { // 有search值  
3225 - // 处理search  
3226 - console.log("search:" + search);  
3227 3104
3228 - scope[ctrlAs].$$data = [];  
3229 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
3230 - var upTerm = search.toUpperCase();  
3231 - if (scope[ctrlAs].$$data.length < 10) {  
3232 - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1  
3233 - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1  
3234 - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {  
3235 - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));  
3236 - }  
3237 - } else { 3105 + /**
  3106 + * 班次列表点击(班次列表中选中班次)
  3107 + * @param $index
  3108 + */
  3109 + scope[ctrlAs].$$internal_bclist_click = function($index) {
  3110 + var data_temp = scope[ctrlAs].$$data;
  3111 + var data_temp2 = scope[ctrlAs].$$dataSelected;
  3112 + var i = 0;
  3113 + var isunique = true; // 是否已经选择过
  3114 + if (data_temp && data_temp.length > $index) {
  3115 + for (i = 0; i < data_temp2.length; i++) {
  3116 + if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {
  3117 + isunique = false;
3238 break; 3118 break;
3239 } 3119 }
3240 } 3120 }
  3121 + if (isunique) {
  3122 + data_temp2.push({
  3123 + bcttinfoid: data_temp[$index].bcttinfoid,
  3124 + bcfcsj: data_temp[$index].bcfcsj,
  3125 + bctype: data_temp[$index].bctype
  3126 + });
  3127 + }
  3128 +
3241 } 3129 }
3242 }; 3130 };
3243 -  
3244 /** 3131 /**
3245 - * 验证内部数据,更新外部model 3132 + * 选中的班次双击(删除选中的班次)
  3133 + * @param $index
3246 */ 3134 */
3247 - scope[ctrlAs].$$internal_validate_model = function() {  
3248 - if (scope[ctrlAs].$$internal_select_value) {  
3249 - var select_value_temp = scope[ctrlAs].$$internal_select_value;  
3250 - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {  
3251 - var obj;  
3252 - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {  
3253 - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {  
3254 - obj = angular.copy(scope[ctrlAs].$$data_real[j]);  
3255 - break;  
3256 - }  
3257 - }  
3258 - if (obj) { // 在data中判定有没有  
3259 - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {  
3260 - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {  
3261 - obj = undefined;  
3262 - break;  
3263 - }  
3264 - }  
3265 - if (obj) {  
3266 - scope[ctrlAs].$$data.push(obj);  
3267 - }  
3268 - // 更新内部model,用于外部验证  
3269 - // 内部model的值暂时随意,以后再改  
3270 - scope[ctrlAs].$$internalmodel = {desc: "ok"};  
3271 - } else {  
3272 - scope[ctrlAs].$$internalmodel = undefined;  
3273 - }  
3274 -  
3275 - } else {  
3276 - scope[ctrlAs].$$internalmodel = undefined;  
3277 - }  
3278 -  
3279 - } else {  
3280 - scope[ctrlAs].$$internalmodel = undefined; 3135 + scope[ctrlAs].$$internal_selbclist_dbclick = function($index) {
  3136 + var data_temp = scope[ctrlAs].$$dataSelected;
  3137 + if (data_temp && data_temp.length > $index) {
  3138 + data_temp.splice($index, 1);
3281 } 3139 }
3282 }; 3140 };
3283 3141
  3142 +
3284 /** 3143 /**
3285 - * 内部match表达式转换函数,需要外部绑定此函数的上下文。  
3286 - * @param context function上下文 3144 + * 验证内部数据,更新外部model
3287 */ 3145 */
3288 - scope[ctrlAs].$$internal_match_str = function (context) {  
3289 - var fx = function() {  
3290 - try {  
3291 - return eval($searchexp_attr);  
3292 - } catch (err) {  
3293 - //console.log(err);  
3294 - return undefined; 3146 + scope[ctrlAs].$$internal_validate_model = function() {
  3147 + var data_temp = scope[ctrlAs].$$dataSelected;
  3148 + var bcttinfoIds = [];
  3149 + var i = 0;
  3150 +
  3151 + if (data_temp &&
  3152 + data_temp.length > 0) {
  3153 +
  3154 + for (i = 0; i < data_temp.length; i++) {
  3155 + bcttinfoIds.push(data_temp[i].bcttinfoid);
3295 } 3156 }
3296 3157
3297 - }; 3158 + // 更新外部model字段
  3159 + if ($bcttinfoidsname_attr) {
  3160 + console.log("bcttinfoidsname=" + bcttinfoIds.join(','));
  3161 + eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');");
  3162 + }
3298 3163
3299 - var str = fx.bind(context)();  
3300 - if (str && str != "")  
3301 - return str;  
3302 - else  
3303 - return undefined;  
3304 - }; 3164 + // 更新内部model,用于外部验证
  3165 + // 内部model的值暂时随意,以后再改
  3166 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
3305 3167
3306 - /**  
3307 - * 内部方法,读取字典数据作为数据源。  
3308 - * @param atype ajax查询类型  
3309 - * @param ajaxparamobj 查询参数对象  
3310 - */  
3311 - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {  
3312 - // 如果ajaxparamobj为空对象,则表示清空内部选项  
3313 - var isEmptyObj = true;  
3314 - for (var name in ajaxparamobj) {  
3315 - isEmptyObj = false; 3168 + scope[ctrlAs].$$data_bcdata_first_init = true;
  3169 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  3170 +
  3171 + } else {
  3172 + scope[ctrlAs].$$internalmodel = undefined;
3316 } 3173 }
3317 - if (isEmptyObj) {  
3318 - // 重新创建内部保存的数据  
3319 - scope[ctrlAs].$$data_real = [];  
3320 - // 重新创建内部ui-select显示用数据,默认取10条记录显示  
3321 - scope[ctrlAs].$$data = [];  
3322 3174
3323 - scope[ctrlAs].$$internal_remove_fn(); 3175 + };
  3176 +
  3177 + // 监控内部数据,$$data_selected 变化
  3178 + scope.$watch(
  3179 + function() {
  3180 + console.log("长度:" + scope[ctrlAs].$$dataSelected.length);
  3181 + return scope[ctrlAs].$$dataSelected;
  3182 + },
  3183 + function(newValue, oldValue) {
3324 scope[ctrlAs].$$internal_validate_model(); 3184 scope[ctrlAs].$$internal_validate_model();
  3185 + },
  3186 + true
  3187 + );
3325 3188
3326 - return;  
3327 - } 3189 + /**
  3190 + * 验证数据是否初始化完成,
  3191 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  3192 + */
  3193 + scope[ctrlAs].$$internal_validate_init = function() {
  3194 + var self = scope[ctrlAs];
3328 3195
3329 - if ($dsparamsextra_attr) { // 合并附加参数  
3330 - eval("var extra = " + $dsparamsextra_attr);  
3331 - for (var extrakey in extra) {  
3332 - ajaxparamobj[extrakey] = extra[extrakey];  
3333 - }  
3334 - } 3196 + var data_temp = self.$$data;
  3197 + var dataSelect_temp = self.$$dataSelected;
  3198 + var bcttinfoids = null;
3335 3199
3336 - $$searchInfoService_g[atype].list(  
3337 - ajaxparamobj,  
3338 - function(result) {  
3339 - console.log("$$internal_ajax_data result"); 3200 + var i = 0;
  3201 + var j = 0;
3340 3202
3341 - // 重新创建内部保存的数据  
3342 - scope[ctrlAs].$$data_real = [];  
3343 - // result中添加拼音数据,注意:这里要求result返回对象数组  
3344 - for (var i = 0; i < result.length; i++) {  
3345 - // 闭包绑定返回最终查询的值  
3346 - var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);  
3347 - if (calcu_str) {  
3348 - // 全拼  
3349 - result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);  
3350 - // 简拼  
3351 - result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);  
3352 - // 原值  
3353 - result[i]["$calcu_str"] = calcu_str; 3203 + if (self.$$data_bcdata_first_init &&
  3204 + self.$$data_bcttinfoids_first_init) {
  3205 + console.log("开始初始化数据");
3354 3206
3355 - scope[ctrlAs].$$data_real.push(result[i]);  
3356 - }  
3357 - } 3207 + bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];
3358 3208
3359 - // 重新创建内部ui-select显示用数据,默认取10条记录显示  
3360 - scope[ctrlAs].$$data = [];  
3361 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
3362 - if (scope[ctrlAs].$$data.length < 10) {  
3363 - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);  
3364 - } else { 3209 + for (i = 0; i < bcttinfoids.length; i++) {
  3210 + dataSelect_temp.push({
  3211 + bcttinfoid: bcttinfoids[i]
  3212 + });
  3213 + for (j = 0; j < data_temp.length; j++) {
  3214 + if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {
  3215 + dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;
  3216 + dataSelect_temp[i].bctype = data_temp[j].bctype;
3365 break; 3217 break;
3366 } 3218 }
3367 } 3219 }
3368 -  
3369 - scope[ctrlAs].$$internal_validate_model();  
3370 - },  
3371 - function(result) {  
3372 - throw new Error("ajax查询出错");  
3373 } 3220 }
3374 - );  
3375 - };  
3376 3221
3377 - /**  
3378 - * 内部方法,读取字典数据作为数据源。  
3379 - * @param dictype 字典类型,如:gsType  
3380 - */  
3381 - scope[ctrlAs].$$internal_dic_data = function(dictype) {  
3382 - if (!dictionaryUtils.getByGroup(dictype)) {  
3383 - throw new error("字典数据不窜在=" + dictype); 3222 + console.log("数据初始化完毕!");
3384 } 3223 }
3385 3224
3386 - // 重新创建内部保存的数据  
3387 - scope[ctrlAs].$$data_real = [];  
3388 - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);  
3389 - var dic_key; // 字典key 3225 + };
3390 3226
3391 - for (dic_key in origin_dicgroup) {  
3392 - var data = {}; // 重新组合的字典元素对象  
3393 - if (dic_key == "true")  
3394 - data[$icname_attr] = true;  
3395 - else  
3396 - data[$icname_attr] = dic_key;  
3397 - data[$dscol_attr] = origin_dicgroup[dic_key];  
3398 - scope[ctrlAs].$$data_real.push(data); 3227 + // 监控初始化标志
  3228 + scope.$watch(
  3229 + function() {
  3230 + return scope[ctrlAs].$$data_bcdata_first_init;
  3231 + },
  3232 + function(newValue, oldValue) {
  3233 + scope[ctrlAs].$$internal_validate_init();
3399 } 3234 }
3400 -  
3401 - // 重新创建内部ui-select显示用数据,直接复制所有的字典数据  
3402 - scope[ctrlAs].$$data = [];  
3403 - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {  
3404 - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]); 3235 + );
  3236 + scope.$watch(
  3237 + function() {
  3238 + return scope[ctrlAs].$$data_bcttinfoids_first_init;
  3239 + },
  3240 + function(newValue, oldValue) {
  3241 + scope[ctrlAs].$$internal_validate_init();
3405 } 3242 }
  3243 + );
3406 3244
3407 - scope[ctrlAs].$$internal_validate_model();  
3408 - };  
3409 -  
3410 - /**  
3411 - * 监控dsparams属性变化  
3412 - */  
3413 - attr.$observe("dsparams", function(value) { 3245 + // 监控内部数据的变化
  3246 + attr.$observe("dataparams", function(value) {
3414 if (value && value != "") { 3247 if (value && value != "") {
3415 - var obj = JSON.parse(value);  
3416 - console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value); 3248 + if (value == '{}') {
  3249 + return;
  3250 + }
3417 3251
3418 - // dsparams格式如下:  
3419 - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'} 3252 + console.log("bcgroup observe 监控 dataparams=" + value);
3420 3253
3421 - if (obj.type == 'dic') {  
3422 - scope[ctrlAs].$$internal_dic_data(obj.param); 3254 + timeTableDetailManageService_g.bcdetails.list(
  3255 + JSON.parse(value),
  3256 + function(result) {
  3257 + // 获取值了
  3258 + console.log("内部班次数据获取了");
3423 3259
3424 - } else if (obj.type == 'ajax') {  
3425 - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);  
3426 - } else {  
3427 - throw new Error("dsparams参数格式异常=" + obj);  
3428 - } 3260 + scope[ctrlAs].$$data = [];
  3261 + for (var i = 0; i < result.length; i++) {
  3262 + scope[ctrlAs].$$data.push({
  3263 + bcttinfoid: result[i].id,
  3264 + bcfcsj: result[i].fcsj,
  3265 + bctype: result[i].bcType
  3266 + });
  3267 + }
  3268 + if (scope[ctrlAs].$$data_bcdata_first_init &&
  3269 + scope[ctrlAs].$$data_bcttinfoids_first_init) {
  3270 +
  3271 + scope[ctrlAs].$$dataSelected = [];
  3272 + scope[ctrlAs].$$internalmodel = undefined;
  3273 + }
  3274 + scope[ctrlAs].$$data_bcdata_first_init = true;
  3275 + },
  3276 + function(result) {
3429 3277
  3278 + }
  3279 + );
  3280 + }
  3281 + });
  3282 + // 监控班次ids数据的变化
  3283 + attr.$observe("bcttinfoidsvalue", function(value) {
  3284 + if (value && value != "") {
  3285 + console.log("observe 监控 bcttinfoidsvalue=" + value);
  3286 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  3287 + scope[ctrlAs].$$data_bcttinfoids_first_data = value;
3430 } 3288 }
3431 }); 3289 });
3432 3290
3433 - /**  
3434 - * 监控外部模型dcname的值的变化。  
3435 - */  
3436 - scope.$watch(  
3437 - function() {  
3438 - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);  
3439 - },  
3440 - function(newValue, oldValue) {  
3441 - if (newValue === undefined && oldValue === undefined) {  
3442 - // 两侧都是undefined,不处理  
3443 -  
3444 - } else {  
3445 - console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);  
3446 - scope[ctrlAs].$$internal_select_value = newValue;  
3447 - scope[ctrlAs].$$internal_validate_model();  
3448 - }  
3449 - },  
3450 - true  
3451 - );  
3452 } 3291 }
3453 - }; 3292 + }
  3293 +
3454 } 3294 }
3455 - }; 3295 + }
3456 } 3296 }
3457 -]);  
3458 \ No newline at end of file 3297 \ No newline at end of file
  3298 +]);
  3299 +
src/main/resources/static/pages/scheduleApp/module/common/prj-common-filter.js
1 -// 自定义filter  
2 -  
3 -angular.module('ScheduleApp').filter("dict", [function() {  
4 - /**  
5 - * 字典过滤器,将后台的字典编码转换成文字说明。  
6 - * code,过滤的值,group,过滤的参数(字典group类型),dv没有匹配到的默认值  
7 - * 用例:sfdc | dict:'dctype':'默认值'  
8 - */  
9 - return function(code, group, dv) {  
10 - if (code == null) {  
11 - return dv;  
12 - } else {  
13 - return dictionaryUtils.transformCode(group, code);  
14 - }  
15 - };  
16 -}]);  
17 \ No newline at end of file 1 \ No newline at end of file
  2 +// 自定义filter
  3 +
  4 +angular.module('ScheduleApp').filter("dict", [function() {
  5 + /**
  6 + * 字典过滤器,将后台的字典编码转换成文字说明。
  7 + * code,过滤的值,group,过滤的参数(字典group类型),dv没有匹配到的默认值
  8 + * 用例:sfdc | dict:'dctype':'默认值'
  9 + */
  10 + return function(code, group, dv) {
  11 + if (code == null) {
  12 + return dv;
  13 + } else {
  14 + return dictionaryUtils.transformCode(group, code);
  15 + }
  16 + };
  17 +}]);
  18 +
  19 +
  20 +
  21 +angular.module('ScheduleApp').filter("$$pyFilter", function() {
  22 + return function(items, props) {
  23 + var out = [];
  24 + var limit = props["limit"] || 20; // 默认20条记录
  25 +
  26 + if (angular.isArray(items)) {
  27 + items.forEach(function(item) {
  28 + if (out.length < limit) {
  29 + if (props.search) {
  30 + var upTerm = props.search.toUpperCase();
  31 + if(item.fullChars.indexOf(upTerm) != -1
  32 + || item.camelChars.indexOf(upTerm) != -1) {
  33 + out.push(item);
  34 + }
  35 + }
  36 + }
  37 + });
  38 + }
  39 +
  40 + return out;
  41 + };
  42 +});
  43 +
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
@@ -501,3 +501,172 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusLineInfoStatService_g&#39;, [&#39;$resource&#39;, @@ -501,3 +501,172 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusLineInfoStatService_g&#39;, [&#39;$resource&#39;,
501 ); 501 );
502 }]); 502 }]);
503 503
  504 +/**
  505 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  506 + * 1、compile阶段使用的属性如下:
  507 + * required:用于和表单验证连接,指定成required="true"才有效。
  508 + * 2、link阶段使用的属性如下
  509 + * model:关联的模型对象
  510 + * name:表单验证时需要的名字
  511 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  512 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  513 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  514 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  515 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  516 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  517 + * placeholder:select placeholder字符串描述
  518 + *
  519 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  520 + * $$SearchInfoService_g,内部使用的数据服务
  521 + */
  522 +// saSelect2指令使用的内部信service
  523 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  524 + return {
  525 + xl: $resource(
  526 + '/line/:type',
  527 + {order: 'name', direction: 'ASC'},
  528 + {
  529 + list: {
  530 + method: 'GET',
  531 + isArray: true
  532 + }
  533 + }
  534 + ),
  535 + zd: $resource(
  536 + '/stationroute/stations',
  537 + {order: 'stationCode', direction: 'ASC'},
  538 + {
  539 + list: {
  540 + method: 'GET',
  541 + isArray: true
  542 + }
  543 + }
  544 + ),
  545 + tcc: $resource(
  546 + '/carpark/:type',
  547 + {order: 'parkCode', direction: 'ASC'},
  548 + {
  549 + list: {
  550 + method: 'GET',
  551 + isArray: true
  552 + }
  553 + }
  554 + ),
  555 + ry: $resource(
  556 + '/personnel/:type',
  557 + {order: 'personnelName', direction: 'ASC'},
  558 + {
  559 + list: {
  560 + method: 'GET',
  561 + isArray: true
  562 + }
  563 + }
  564 + ),
  565 + cl: $resource(
  566 + '/cars/:type',
  567 + {order: "insideCode", direction: 'ASC'},
  568 + {
  569 + list: {
  570 + method: 'GET',
  571 + isArray: true
  572 + }
  573 + }
  574 + ),
  575 + ttInfo: $resource(
  576 + '/tic/:type',
  577 + {order: "name", direction: 'ASC'},
  578 + {
  579 + list: {
  580 + method: 'GET',
  581 + isArray: true
  582 + }
  583 + }
  584 + ),
  585 + lpInfo: $resource(
  586 + '/gic/ttlpnames',
  587 + {order: "lpName", direction: 'ASC'},
  588 + {
  589 + list: {
  590 + method: 'GET',
  591 + isArray: true
  592 + }
  593 + }
  594 + ),
  595 + lpInfo2: $resource(
  596 + '/gic/:type',
  597 + {order: "lpName", direction: 'ASC'},
  598 + {
  599 + list: {
  600 + method: 'GET',
  601 + isArray: true
  602 + }
  603 + }
  604 + ),
  605 + cci: $resource(
  606 + '/cci/cars',
  607 + {},
  608 + {
  609 + list: {
  610 + method: 'GET',
  611 + isArray: true
  612 + }
  613 + }
  614 +
  615 + ),
  616 + cci2: $resource(
  617 + '/cci/:type',
  618 + {},
  619 + {
  620 + list: {
  621 + method: 'GET',
  622 + isArray: true
  623 + }
  624 + }
  625 + ),
  626 + cci3: $resource(
  627 + '/cci/cars2',
  628 + {},
  629 + {
  630 + list: {
  631 + method: 'GET',
  632 + isArray: true
  633 + }
  634 + }
  635 +
  636 + ),
  637 + eci: $resource(
  638 + '/eci/jsy',
  639 + {},
  640 + {
  641 + list: {
  642 + method: 'GET',
  643 + isArray: true
  644 + }
  645 + }
  646 + ),
  647 + eci2: $resource(
  648 + '/eci/spy',
  649 + {},
  650 + {
  651 + list: {
  652 + method: 'GET',
  653 + isArray: true
  654 + }
  655 + }
  656 + ),
  657 + eci3: $resource(
  658 + '/eci/:type',
  659 + {},
  660 + {
  661 + list: {
  662 + method: 'GET',
  663 + isArray: true
  664 + }
  665 + }
  666 + )
  667 + }
  668 +}]);
  669 +
  670 +
  671 +
  672 +
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/index.html
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <div class="portlet-title"> 24 <div class="portlet-title">
25 <div class="caption font-dark"> 25 <div class="caption font-dark">
26 <i class="fa fa-database font-dark"></i> 26 <i class="fa fa-database font-dark"></i>
27 - <span class="caption-subject bold uppercase">排班规则</span> 27 + <span class="caption-subject bold uppercase">套跑信息</span>
28 </div> 28 </div>
29 <div class="actions"> 29 <div class="actions">
30 <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()"> 30 <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
src/main/resources/static/pages/scheduleApp/module/main.js
@@ -116,1612 +116,4 @@ ScheduleApp.controller(&#39;ScheduleAppController&#39;, [&#39;$scope&#39;, function($scope) { @@ -116,1612 +116,4 @@ ScheduleApp.controller(&#39;ScheduleAppController&#39;, [&#39;$scope&#39;, function($scope) {
116 }); 116 });
117 }]); 117 }]);
118 118
119 -/** 配置所有模块页面route */  
120 -ScheduleApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {  
121 - // 默认路由  
122 - //$urlRouterProvider.otherwise('/busConfig.html');  
123 -  
124 - $stateProvider  
125 - // 车辆基础信息模块配置  
126 - .state("busInfoManage", {  
127 - url: '/busInfoManage',  
128 - views: {  
129 - "": {  
130 - templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/index.html'  
131 - },  
132 - "busInfoManage_list@busInfoManage": {  
133 - templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/list.html'  
134 - }  
135 - },  
136 -  
137 - resolve: {  
138 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
139 - return $ocLazyLoad.load({  
140 - name: 'busInfoManage_module',  
141 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
142 - files: [  
143 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
144 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
145 - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",  
146 - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js"  
147 - ]  
148 - });  
149 - }]  
150 - }  
151 - })  
152 - .state("busInfoManage_form", {  
153 - url: '/busInfoManage_form',  
154 - views: {  
155 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/form.html'}  
156 - },  
157 - resolve: {  
158 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
159 - return $ocLazyLoad.load({  
160 - name: 'busInfoManage_form_module',  
161 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
162 - files: [  
163 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
164 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
165 - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js"  
166 - ]  
167 - });  
168 - }]  
169 - }  
170 - })  
171 - .state("busInfoManage_edit", {  
172 - url: '/busInfoManage_edit/:id',  
173 - views: {  
174 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/edit.html'}  
175 - },  
176 - resolve: {  
177 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
178 - return $ocLazyLoad.load({  
179 - name: 'busInfoManage_edit_module',  
180 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
181 - files: [  
182 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
183 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
184 - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js"  
185 - ]  
186 - });  
187 - }]  
188 - }  
189 - })  
190 - .state("busInfoManage_detail", {  
191 - url: '/busInfoManage_detail/:id',  
192 - views: {  
193 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/detail.html'}  
194 - },  
195 - resolve: {  
196 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
197 - return $ocLazyLoad.load({  
198 - name: 'busInfoManage_detail_module',  
199 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
200 - files: [  
201 - "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js"  
202 - ]  
203 - });  
204 - }]  
205 - }  
206 - })  
207 -  
208 - // 人员基础信息模块配置  
209 - .state("employeeInfoManage", {  
210 - url: '/employeeInfoManage',  
211 - views: {  
212 - "": {  
213 - templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html'  
214 - },  
215 - "employeeInfoManage_list@employeeInfoManage": {  
216 - templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html'  
217 - }  
218 - },  
219 -  
220 - resolve: {  
221 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
222 - return $ocLazyLoad.load({  
223 - name: 'employeeInfoManage_module',  
224 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
225 - files: [  
226 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
227 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
228 - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",  
229 - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"  
230 - ]  
231 - });  
232 - }]  
233 - }  
234 - })  
235 - .state("employeeInfoManage_form", {  
236 - url: '/employeeInfoManage_form',  
237 - views: {  
238 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html'}  
239 - },  
240 - resolve: {  
241 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
242 - return $ocLazyLoad.load({  
243 - name: 'employeeInfoManage_form_module',  
244 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
245 - files: [  
246 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
247 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
248 - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"  
249 - ]  
250 - });  
251 - }]  
252 - }  
253 - })  
254 - .state("employeeInfoManage_edit", {  
255 - url: '/employeeInfoManage_edit/:id',  
256 - views: {  
257 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html'}  
258 - },  
259 - resolve: {  
260 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
261 - return $ocLazyLoad.load({  
262 - name: 'employeeInfoManage_edit_module',  
263 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
264 - files: [  
265 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
266 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
267 - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"  
268 - ]  
269 - });  
270 - }]  
271 - }  
272 - })  
273 - .state("employeeInfoManage_detail", {  
274 - url: '/employeeInfoManage_detail/:id',  
275 - views: {  
276 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html'}  
277 - },  
278 - resolve: {  
279 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
280 - return $ocLazyLoad.load({  
281 - name: 'employeeInfoManage_detail_module',  
282 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
283 - files: [  
284 - "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"  
285 - ]  
286 - });  
287 - }]  
288 - }  
289 - })  
290 -  
291 - // 车辆设备信息模块配置  
292 - .state("deviceInfoManage", {  
293 - url: '/deviceInfoManage',  
294 - views: {  
295 - "": {  
296 - templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html'  
297 - },  
298 - "deviceInfoManage_list@deviceInfoManage": {  
299 - templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html'  
300 - }  
301 - },  
302 -  
303 - resolve: {  
304 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
305 - return $ocLazyLoad.load({  
306 - name: 'deviceInfoManage_module',  
307 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
308 - files: [  
309 - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"  
310 - ]  
311 - });  
312 - }]  
313 - }  
314 - })  
315 - .state("deviceInfoManage_form", {  
316 - url: '/deviceInfoManage_form',  
317 - views: {  
318 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html'}  
319 - },  
320 - resolve: {  
321 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
322 - return $ocLazyLoad.load({  
323 - name: 'deviceInfoManage_form_module',  
324 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
325 - files: [  
326 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
327 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
328 - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"  
329 - ]  
330 - });  
331 - }]  
332 - }  
333 - })  
334 - .state("deviceInfoManage_edit", {  
335 - url: '/deviceInfoManage_edit/:id',  
336 - views: {  
337 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html'}  
338 - },  
339 - resolve: {  
340 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
341 - return $ocLazyLoad.load({  
342 - name: 'deviceInfoManage_edit_module',  
343 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
344 - files: [  
345 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
346 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
347 - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"  
348 - ]  
349 - });  
350 - }]  
351 - }  
352 - })  
353 - .state("deviceInfoManage_detail", {  
354 - url: '/deviceInfoManage_detail/:id',  
355 - views: {  
356 - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html'}  
357 - },  
358 - resolve: {  
359 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
360 - return $ocLazyLoad.load({  
361 - name: 'deviceInfoManage_detail_module',  
362 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
363 - files: [  
364 - "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"  
365 - ]  
366 - });  
367 - }]  
368 - }  
369 - })  
370 -  
371 - // 车辆配置模块  
372 - .state("busConfig", {  
373 - url: '/busConfig',  
374 - views: {  
375 - "": {  
376 - templateUrl: 'pages/scheduleApp/module/core/busConfig/index.html'  
377 - },  
378 - "busConfig_list@busConfig": {  
379 - templateUrl: 'pages/scheduleApp/module/core/busConfig/list.html'  
380 - }  
381 - },  
382 -  
383 - resolve: {  
384 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
385 - return $ocLazyLoad.load({  
386 - name: 'busConfig_module',  
387 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
388 - files: [  
389 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
390 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
391 - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",  
392 - "pages/scheduleApp/module/core/busConfig/busConfig.js"  
393 - ]  
394 - });  
395 - }]  
396 - }  
397 - })  
398 - .state("busConfig_form", {  
399 - url: '/busConfig_form',  
400 - views: {  
401 - "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/form.html'}  
402 - },  
403 - resolve: {  
404 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
405 - return $ocLazyLoad.load({  
406 - name: 'busConfig_form_module',  
407 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
408 - files: [  
409 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
410 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
411 - "pages/scheduleApp/module/core/busConfig/busConfig.js"  
412 - ]  
413 - });  
414 - }]  
415 - }  
416 - })  
417 - .state("busConfig_edit", {  
418 - url: '/busConfig_edit/:id',  
419 - views: {  
420 - "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/edit.html'}  
421 - },  
422 - resolve: {  
423 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
424 - return $ocLazyLoad.load({  
425 - name: 'busConfig_edit_module',  
426 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
427 - files: [  
428 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
429 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
430 - "pages/scheduleApp/module/core/busConfig/busConfig.js"  
431 - ]  
432 - });  
433 - }]  
434 - }  
435 - })  
436 - .state("busConfig_detail", {  
437 - url: '/busConfig_detail/:id',  
438 - views: {  
439 - "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/detail.html'}  
440 - },  
441 - resolve: {  
442 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
443 - return $ocLazyLoad.load({  
444 - name: 'busConfig_detail_module',  
445 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
446 - files: [  
447 - "pages/scheduleApp/module/core/busConfig/busConfig.js"  
448 - ]  
449 - });  
450 - }]  
451 - }  
452 - })  
453 -  
454 - // 人员配置模块  
455 - .state("employeeConfig", {  
456 - url: '/employeeConfig',  
457 - views: {  
458 - "": {  
459 - templateUrl: 'pages/scheduleApp/module/core/employeeConfig/index.html'  
460 - },  
461 - "employeeConfig_list@employeeConfig": {  
462 - templateUrl: 'pages/scheduleApp/module/core/employeeConfig/list.html'  
463 - }  
464 - },  
465 -  
466 - resolve: {  
467 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
468 - return $ocLazyLoad.load({  
469 - name: 'employeeConfig_module',  
470 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
471 - files: [  
472 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
473 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
474 - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",  
475 - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js"  
476 - ]  
477 - });  
478 - }]  
479 - }  
480 - })  
481 - .state("employeeConfig_form", {  
482 - url: '/employeeConfig_form',  
483 - views: {  
484 - "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/form.html'}  
485 - },  
486 - resolve: {  
487 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
488 - return $ocLazyLoad.load({  
489 - name: 'employeeConfig_form_module',  
490 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
491 - files: [  
492 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
493 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
494 - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js"  
495 - ]  
496 - });  
497 - }]  
498 - }  
499 - })  
500 - .state("employeeConfig_edit", {  
501 - url: '/employeeConfig_edit/:id',  
502 - views: {  
503 - "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/edit.html'}  
504 - },  
505 - resolve: {  
506 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
507 - return $ocLazyLoad.load({  
508 - name: 'employeeConfig_edit_module',  
509 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
510 - files: [  
511 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
512 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
513 - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js"  
514 - ]  
515 - });  
516 - }]  
517 - }  
518 - })  
519 - .state("employeeConfig_detail", {  
520 - url: '/employeeConfig_detail/:id',  
521 - views: {  
522 - "": {templateUrl: 'pages/scheduleApp/module/core/employeeConfig/detail.html'}  
523 - },  
524 - resolve: {  
525 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
526 - return $ocLazyLoad.load({  
527 - name: 'employeeConfig_detail_module',  
528 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
529 - files: [  
530 - "pages/scheduleApp/module/core/employeeConfig/employeeConfig.js"  
531 - ]  
532 - });  
533 - }]  
534 - }  
535 - })  
536 -  
537 - // 路牌管理  
538 - .state("guideboardManage", {  
539 - url: '/guideboardManage',  
540 - views: {  
541 - "": {  
542 - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/index.html'  
543 - },  
544 - "guideboardManage_list@guideboardManage": {  
545 - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/list.html'  
546 - }  
547 - },  
548 -  
549 - resolve: {  
550 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
551 - return $ocLazyLoad.load({  
552 - name: 'guideboardManage_module',  
553 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
554 - files: [  
555 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
556 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
557 - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",  
558 - "pages/scheduleApp/module/core/guideboardManage/guideboardManage.js"  
559 - ]  
560 - });  
561 - }]  
562 - }  
563 - })  
564 - .state("guideboardManage_detail", {  
565 - url: '/guideboardManage_detail/:id',  
566 - views: {  
567 - "": {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/detail.html'}  
568 - },  
569 - resolve: {  
570 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
571 - return $ocLazyLoad.load({  
572 - name: 'guideboardManage_detail_module',  
573 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
574 - files: [  
575 - "pages/scheduleApp/module/core/guideboardManage/guideboardManage.js"  
576 - ]  
577 - });  
578 - }]  
579 - }  
580 - })  
581 -  
582 -  
583 - // 时刻表管理  
584 - .state("timeTableManage", {  
585 - url: '/timeTableManage',  
586 - views: {  
587 - "": {  
588 - templateUrl: 'pages/scheduleApp/module/core/timeTableManage/index.html'  
589 - },  
590 - "timeTableManage_list@timeTableManage": {  
591 - templateUrl: 'pages/scheduleApp/module/core/timeTableManage/list.html'  
592 - }  
593 - },  
594 -  
595 - resolve: {  
596 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
597 - return $ocLazyLoad.load({  
598 - name: 'timeTableManage_module',  
599 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
600 - files: [  
601 - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",  
602 - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js"  
603 - ]  
604 - });  
605 - }]  
606 - }  
607 - })  
608 - .state("timeTableManage_form", {  
609 - url: '/timeTableManage_form',  
610 - views: {  
611 - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/form.html'}  
612 - },  
613 - resolve: {  
614 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
615 - return $ocLazyLoad.load({  
616 - name: 'timeTableManage_form_module',  
617 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
618 - files: [  
619 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
620 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
621 - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js"  
622 - ]  
623 - });  
624 - }]  
625 - }  
626 - })  
627 - .state("timeTableManage_edit", {  
628 - url: '/timeTableManage_edit/:id',  
629 - views: {  
630 - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/edit.html'}  
631 - },  
632 - resolve: {  
633 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
634 - return $ocLazyLoad.load({  
635 - name: 'timeTableManage_edit_module',  
636 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
637 - files: [  
638 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
639 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
640 - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js"  
641 - ]  
642 - });  
643 - }]  
644 - }  
645 - })  
646 - .state("timeTableManage_detail", {  
647 - url: '/timeTableManage_detail/:id',  
648 - views: {  
649 - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail.html'}  
650 - },  
651 - resolve: {  
652 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
653 - return $ocLazyLoad.load({  
654 - name: 'timeTableManage_detail_module',  
655 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
656 - files: [  
657 - "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js"  
658 - ]  
659 - });  
660 - }]  
661 - }  
662 - })  
663 - .state("timeTableDetailInfoManage", {  
664 - url: '/timeTableDetailInfoManage/:xlid/:ttid',  
665 - views: {  
666 - "": {templateUrl: 'pages/scheduleApp/module/core/timeTableManage/detail_info.html'}  
667 - },  
668 - resolve: {  
669 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
670 - return $ocLazyLoad.load({  
671 - name: 'timeTableDetailInfoManage_module',  
672 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
673 - files: [  
674 - "pages/scheduleApp/module/core/timeTableManage/timeTableDetailManage.js"  
675 - ]  
676 - });  
677 - }]  
678 - }  
679 - })  
680 -  
681 - // 排班规则管理模块  
682 - .state("scheduleRuleManage", {  
683 - url: '/scheduleRuleManage',  
684 - views: {  
685 - "": {  
686 - templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/index.html'  
687 - },  
688 - "scheduleRuleManage_list@scheduleRuleManage": {  
689 - templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/list.html'  
690 - }  
691 - },  
692 -  
693 - resolve: {  
694 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
695 - return $ocLazyLoad.load({  
696 - name: 'scheduleRuleManage_module',  
697 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
698 - files: [  
699 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
700 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
701 - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"  
702 - ]  
703 - });  
704 - }]  
705 - }  
706 - })  
707 - .state("scheduleRuleManage_form", {  
708 - url: '/scheduleRuleManage_form',  
709 - views: {  
710 - "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/form.html'}  
711 - },  
712 - resolve: {  
713 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
714 - return $ocLazyLoad.load({  
715 - name: 'scheduleRuleManage_form_module',  
716 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
717 - files: [  
718 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
719 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
720 - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"  
721 - ]  
722 - });  
723 - }]  
724 - }  
725 - })  
726 - .state("scheduleRuleManage_edit", {  
727 - url: '/scheduleRuleManage_edit/:id',  
728 - views: {  
729 - "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/edit.html'}  
730 - },  
731 - resolve: {  
732 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
733 - return $ocLazyLoad.load({  
734 - name: 'scheduleRuleManage_edit_module',  
735 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
736 - files: [  
737 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
738 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
739 - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"  
740 - ]  
741 - });  
742 - }]  
743 - }  
744 - })  
745 - .state("scheduleRuleManage_detail", {  
746 - url: '/scheduleRuleManage_detail/:id',  
747 - views: {  
748 - "": {templateUrl: 'pages/scheduleApp/module/core/scheduleRuleManage/detail.html'}  
749 - },  
750 - resolve: {  
751 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
752 - return $ocLazyLoad.load({  
753 - name: 'scheduleRuleManage_detail_module',  
754 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
755 - files: [  
756 - "pages/scheduleApp/module/core/scheduleRuleManage/scheduleRuleManage.js"  
757 - ]  
758 - });  
759 - }]  
760 - }  
761 - })  
762 -  
763 - // 排班计划管理模块  
764 - .state("schedulePlanManage", {  
765 - url: '/schedulePlanManage',  
766 - views: {  
767 - "": {  
768 - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index.html'  
769 - },  
770 - "schedulePlanManage_list@schedulePlanManage": {  
771 - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list.html'  
772 - }  
773 - },  
774 -  
775 - resolve: {  
776 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
777 - return $ocLazyLoad.load({  
778 - name: 'schedulePlanManage_module',  
779 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
780 - files: [  
781 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
782 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
783 - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanManage.js"  
784 - ]  
785 - });  
786 - }]  
787 - }  
788 - })  
789 - .state("schedulePlanManage_form", {  
790 - url: '/schedulePlanManage_form',  
791 - views: {  
792 - "": {  
793 - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/form.html'  
794 - }  
795 - },  
796 -  
797 - resolve: {  
798 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
799 - return $ocLazyLoad.load({  
800 - name: 'schedulePlanManage_form_module',  
801 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
802 - files: [  
803 - "assets/bower_components/angular-ui-select/dist/select.min.css",  
804 - "assets/bower_components/angular-ui-select/dist/select.min.js",  
805 - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanManage.js"  
806 - ]  
807 - });  
808 - }]  
809 - }  
810 - })  
811 -  
812 - // 排班计划明细管理模块  
813 - .state("schedulePlanInfoManage", {  
814 - url: '/schedulePlanInfoManage/:spid/:xlname/:ttname/:stime/:etime',  
815 - views: {  
816 - "": {  
817 - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/index_info.html'  
818 - },  
819 - "schedulePlanInfoManage_list@schedulePlanInfoManage": {  
820 - templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/list_info.html'  
821 - }  
822 - },  
823 -  
824 - resolve: {  
825 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
826 - return $ocLazyLoad.load({  
827 - name: 'schedulePlanInfoManage_module',  
828 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
829 - files: [  
830 - "pages/scheduleApp/module/core/schedulePlanManage/schedulePlanInfoManage.js"  
831 - ]  
832 - });  
833 - }]  
834 - }  
835 - })  
836 -  
837 - // 线路运营概览模块  
838 - .state("busLineInfoStat", {  
839 - url: '/busLineInfoStat',  
840 - views: {  
841 - "": {  
842 - templateUrl: 'pages/scheduleApp/module/core/busLineInfoStat/index.html'  
843 - },  
844 - "busLineInfoStat_list@busLineInfoStat": {  
845 - templateUrl: 'pages/scheduleApp/module/core/busLineInfoStat/list.html'  
846 - }  
847 - },  
848 -  
849 - resolve: {  
850 - deps: ['$ocLazyLoad', function($ocLazyLoad) {  
851 - return $ocLazyLoad.load({  
852 - name: 'busLineInfoStat_module',  
853 - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置  
854 - files: [  
855 - "pages/scheduleApp/module/core/busLineInfoStat/busLineInfoStat.js"  
856 - ]  
857 - });  
858 - }]  
859 - }  
860 - })  
861 -  
862 -  
863 -  
864 -  
865 -  
866 - // TODO:  
867 -  
868 - ;  
869 -}]);  
870 -  
871 -// 自定义的一些指令  
872 -  
873 -  
874 -  
875 -// 全局service放置在此处,  
876 -// 一般这种服务会被其他模块调用的,所以干脆放到main.js里  
877 -  
878 -// 车辆信息service  
879 -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {  
880 - return {  
881 - rest: $resource(  
882 - '/cars/:id',  
883 - {order: 'carCode', direction: 'ASC', id: '@id_route'},  
884 - {  
885 - list: {  
886 - method: 'GET',  
887 - params: {  
888 - page: 0  
889 - }  
890 - },  
891 - get: {  
892 - method: 'GET'  
893 - },  
894 - save: {  
895 - method: 'POST'  
896 - }  
897 - }  
898 - ),  
899 - validate: $resource(  
900 - '/cars/validate/:type',  
901 - {},  
902 - {  
903 - insideCode: {  
904 - method: 'GET'  
905 - }  
906 - }  
907 - )  
908 - };  
909 -}]);  
910 -// 人员信息service  
911 -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {  
912 - return {  
913 - rest : $resource(  
914 - '/personnel/:id',  
915 - {order: 'jobCode', direction: 'ASC', id: '@id_route'},  
916 - {  
917 - list: {  
918 - method: 'GET',  
919 - params: {  
920 - page: 0  
921 - }  
922 - },  
923 - get: {  
924 - method: 'GET'  
925 - },  
926 - save: {  
927 - method: 'POST'  
928 - }  
929 - }  
930 - ),  
931 - validate: $resource(  
932 - '/personnel/validate/:type',  
933 - {},  
934 - {  
935 - jobCode: {  
936 - method: 'GET'  
937 - }  
938 - }  
939 - )  
940 - };  
941 -}]);  
942 -// 车辆设备信息service  
943 -angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {  
944 - return $resource(  
945 - '/carDevice/:id',  
946 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
947 - {  
948 - list: {  
949 - method: 'GET',  
950 - params: {  
951 - page: 0  
952 - }  
953 - },  
954 - get: {  
955 - method: 'GET'  
956 - },  
957 - save: {  
958 - method: 'POST'  
959 - }  
960 - }  
961 - );  
962 -}]);  
963 -  
964 -// 车辆配置service  
965 -angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {  
966 - return {  
967 - rest : $resource(  
968 - '/cci/:id',  
969 - {order: 'createDate', direction: 'ASC', id: '@id_route'},  
970 - {  
971 - list: {  
972 - method: 'GET',  
973 - params: {  
974 - page: 0  
975 - }  
976 - },  
977 - get: {  
978 - method: 'GET'  
979 - },  
980 - save: {  
981 - method: 'POST'  
982 - }  
983 - }  
984 - )  
985 - };  
986 -}]);  
987 -  
988 -// 人员配置service  
989 -angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {  
990 - return {  
991 - rest : $resource(  
992 - '/eci/:id',  
993 - {order: 'createDate', direction: 'ASC', id: '@id_route'},  
994 - {  
995 - list: {  
996 - method: 'GET',  
997 - params: {  
998 - page: 0  
999 - }  
1000 - },  
1001 - get: {  
1002 - method: 'GET'  
1003 - },  
1004 - save: {  
1005 - method: 'POST'  
1006 - }  
1007 - }  
1008 - ),  
1009 - validate: $resource( // TODO:  
1010 - '/personnel/validate/:type',  
1011 - {},  
1012 - {  
1013 - jobCode: {  
1014 - method: 'GET'  
1015 - }  
1016 - }  
1017 - )  
1018 - };  
1019 -}]);  
1020 -  
1021 -// 路牌管理service  
1022 -angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {  
1023 - return {  
1024 - rest: $resource(  
1025 - '/gic/:id',  
1026 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
1027 - {  
1028 - list: {  
1029 - method: 'GET',  
1030 - params: {  
1031 - page: 0  
1032 - }  
1033 - },  
1034 - get: {  
1035 - method: 'GET'  
1036 - },  
1037 - save: {  
1038 - method: 'POST'  
1039 - }  
1040 - }  
1041 - )  
1042 - };  
1043 -}]);  
1044 -  
1045 -// 排班管理service  
1046 -angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {  
1047 - return {  
1048 - rest: $resource(  
1049 - '/sr1fc/:id',  
1050 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
1051 - {  
1052 - list: {  
1053 - method: 'GET',  
1054 - params: {  
1055 - page: 0  
1056 - }  
1057 - },  
1058 - get: {  
1059 - method: 'GET'  
1060 - },  
1061 - save: {  
1062 - method: 'POST'  
1063 - }  
1064 - }  
1065 - )  
1066 - };  
1067 -}]);  
1068 -  
1069 -// 时刻表管理service  
1070 -angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {  
1071 - return {  
1072 - rest: $resource(  
1073 - '/tic/:id',  
1074 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
1075 - {  
1076 - list: {  
1077 - method: 'GET',  
1078 - params: {  
1079 - page: 0  
1080 - }  
1081 - },  
1082 - get: {  
1083 - method: 'GET'  
1084 - },  
1085 - save: {  
1086 - method: 'POST'  
1087 - }  
1088 - }  
1089 - )  
1090 - };  
1091 -}]);  
1092 -// 时刻表明细管理service  
1093 -angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {  
1094 - return {  
1095 - rest: $resource(  
1096 - '/tidc/:id',  
1097 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
1098 - {  
1099 - get: {  
1100 - method: 'GET'  
1101 - },  
1102 - save: {  
1103 - method: 'POST'  
1104 - }  
1105 - }  
1106 - ),  
1107 - edit: $resource(  
1108 - '/tidc/edit/:xlid/:ttid',  
1109 - {},  
1110 - {  
1111 - list: {  
1112 - method: 'GET'  
1113 - }  
1114 - }  
1115 - )  
1116 - };  
1117 -}]);  
1118 -  
1119 -  
1120 -  
1121 -// 排班计划管理service  
1122 -angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {  
1123 - return {  
1124 - rest : $resource(  
1125 - '/spc/:id',  
1126 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
1127 - {  
1128 - list: {  
1129 - method: 'GET',  
1130 - params: {  
1131 - page: 0  
1132 - }  
1133 - },  
1134 - get: {  
1135 - method: 'GET'  
1136 - },  
1137 - save: {  
1138 - method: 'POST'  
1139 - }  
1140 - }  
1141 - )  
1142 - };  
1143 -}]);  
1144 -  
1145 -// 排班计划明细管理service  
1146 -angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {  
1147 - return {  
1148 - rest : $resource(  
1149 - '/spic/:id',  
1150 - {order: 'scheduleDate,lp,fcno', direction: 'ASC', id: '@id_route'},  
1151 - {  
1152 - list: {  
1153 - method: 'GET',  
1154 - params: {  
1155 - page: 0  
1156 - }  
1157 - },  
1158 - get: {  
1159 - method: 'GET'  
1160 - },  
1161 - save: {  
1162 - method: 'POST'  
1163 - }  
1164 - }  
1165 - )  
1166 - };  
1167 -}]);  
1168 -  
1169 -// 线路运营统计service  
1170 -angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {  
1171 - return $resource(  
1172 - '/bic/:id',  
1173 - {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询  
1174 - {  
1175 - list: {  
1176 - method: 'GET',  
1177 - params: {  
1178 - page: 0  
1179 - }  
1180 - }  
1181 - }  
1182 - );  
1183 -}]);  
1184 -  
1185 -//--------------------------- 通用filter和directive -----------------------------//  
1186 -angular.module('ScheduleApp').filter("dict", [function() {  
1187 - /**  
1188 - * 字典过滤器,将后台的字典编码转换成文字说明。  
1189 - * code,过滤的值,group,过滤的参数(字典group类型),dv没有匹配到的默认值  
1190 - * 用例:sfdc | dict:'dctype'  
1191 - */  
1192 - return function(code, group, dv) {  
1193 - if (code == null) {  
1194 - return dv;  
1195 - } else {  
1196 - return dictionaryUtils.transformCode(group, code);  
1197 - }  
1198 - };  
1199 -}]);  
1200 -  
1201 -angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {  
1202 - return {  
1203 - restrict: 'E',  
1204 - templateUrl: '/pages/scheduleApp/module/other/MyDictionarySelectTemplate.html',  
1205 - scope: {  
1206 - model: "="  
1207 - },  
1208 - controllerAs: "$saSelectCtrl",  
1209 - bindToController: true,  
1210 - controller: function() {  
1211 - var self = this;  
1212 - self.datas = []; // 关联的字典数据,内部格式 {code:{值},name:{名字}}  
1213 - },  
1214 - /**  
1215 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
1216 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
1217 - * @param tElem  
1218 - * @param tAttrs  
1219 - * @returns {{pre: Function, post: Function}}  
1220 - */  
1221 - compile: function(tElem, tAttrs) {  
1222 - // 确定是否使用angularjs required验证  
1223 - // 属性 required  
1224 - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加  
1225 - var required_attr = tAttrs["required"];  
1226 - if (required_attr) {  
1227 - if (required_attr == "true") {  
1228 - // 添加required属性指令  
1229 - tElem.find("ui-select").attr("required", "");  
1230 - } else {  
1231 - // 不等于true,不添加required属性指令  
1232 - }  
1233 - } else {  
1234 - // 不添加required属性指令  
1235 - }  
1236 -  
1237 - //console.log("saSelect" + ":compile = >" + tElem.html());  
1238 -  
1239 - return {  
1240 - pre: function(scope, element, attr) {  
1241 - // TODO:  
1242 - },  
1243 - /**  
1244 - * 相当于link函数。  
1245 - *  
1246 - * 重要属性如下:  
1247 - * model 是绑定外部值。  
1248 - * dicgroup 字典组的类型  
1249 - * name input name属性值  
1250 - */  
1251 - post: function(scope, element, attr) {  
1252 - // 1、获取属性  
1253 - var dicgroup_attr = attr['dicgroup']; // 字典组的类型  
1254 - var name_attr = attr['name']; // input name属性值  
1255 - var dicname_attr = attr['dicname']; // model关联的字典名字段  
1256 - var codename_attr = attr['codename']; // model关联的字典值字段  
1257 - var placeholder_attr = attr['placeholder']; // select placeholder提示  
1258 -  
1259 - // 系统的字典对象,使用dictionaryUtils类获取  
1260 - var origin_dicgroup;  
1261 - var dic_key; // 字典key  
1262 -  
1263 - if (dicgroup_attr) { // 赋值指定的字典数据  
1264 - origin_dicgroup = dictionaryUtils.getByGroup(dicgroup_attr);  
1265 - for (dic_key in origin_dicgroup) {  
1266 - var data = {}; // 重新组合的字典元素对象  
1267 - if (dic_key == "true")  
1268 - data.code = true;  
1269 - else  
1270 - data.code = dic_key;  
1271 - data.name = origin_dicgroup[dic_key];  
1272 - scope["$saSelectCtrl"].datas.push(data);  
1273 - }  
1274 - }  
1275 -  
1276 - if (name_attr) {  
1277 - scope["$saSelectCtrl"].nv = name_attr;  
1278 - }  
1279 - if (placeholder_attr) {  
1280 - scope["$saSelectCtrl"].ph = placeholder_attr;  
1281 - }  
1282 -  
1283 - scope["$saSelectCtrl"].select = function($item) {  
1284 - if (codename_attr) {  
1285 - scope["$saSelectCtrl"].model[codename_attr] = $item.code;  
1286 - }  
1287 - if (dicname_attr) {  
1288 - scope["$saSelectCtrl"].model[dicname_attr] = $item.name;  
1289 - }  
1290 - };  
1291 -  
1292 - scope["$saSelectCtrl"].remove = function() {  
1293 - if (codename_attr) {  
1294 - scope["$saSelectCtrl"].model[codename_attr] = null;  
1295 - }  
1296 - if (dicname_attr) {  
1297 - scope["$saSelectCtrl"].model[dicname_attr] = null;  
1298 - }  
1299 - scope["$saSelectCtrl"].cmodel = null;  
1300 - };  
1301 -  
1302 - $timeout(function() {  
1303 - // 创建内部使用的绑定对象  
1304 - var model_code = scope["$saSelectCtrl"].model[codename_attr];  
1305 - scope["$saSelectCtrl"].cmodel = model_code;  
1306 - }, 0);  
1307 - }  
1308 - }  
1309 - }  
1310 - };  
1311 -}]);  
1312 -  
1313 -angular.module('ScheduleApp').directive("saRadiogroup", [function() {  
1314 - /**  
1315 - * 使用字典数据的单选按钮组的指令。  
1316 - * 指令名称:truefalse-Dic  
1317 - */  
1318 - return {  
1319 - restrict: 'E',  
1320 - templateUrl: '/pages/scheduleApp/module/other/MyDictionaryRadioGroupTemplate.html',  
1321 - scope: {  
1322 - model: "="  
1323 - },  
1324 - controllerAs: "ctrl",  
1325 - bindToController: true,  
1326 - controller: function($scope) {  
1327 - //$scope["model"] = {selectedOption: null};  
1328 - //console.log("controller");  
1329 - //console.log("controller:" + $scope["model"]);  
1330 - },  
1331 - /**  
1332 - * 重要属性如下:  
1333 - * model 是绑定外部值。  
1334 - * disabled 说明是否不能修改  
1335 - * dicgroup 字典组的类型  
1336 - * name input name属性值  
1337 - */  
1338 - link: function(scope, element, attr) {  
1339 - //console.log("link");  
1340 - //console.log("link:" + scope.model);  
1341 - //scope["model"] = {selectedOption: null};  
1342 -  
1343 - if (attr["name"]) {  
1344 - scope["ctrl"].nv = attr["name"];  
1345 - }  
1346 -  
1347 - if (attr["disabled"]) {  
1348 - scope["ctrl"].disabled = true;  
1349 - }  
1350 - if (attr["dicgroup"]) {  
1351 - var obj = dictionaryUtils.getByGroup(attr['dicgroup']);  
1352 - scope["ctrl"].dic = obj;  
1353 - // 处理 scope["dic"] key值  
1354 - scope["ctrl"].dicvalueCalcu = function(value) {  
1355 - if (value == "true") {  
1356 - //console.log(value);  
1357 - return true;  
1358 - } else if (value == "false") {  
1359 - //console.log(value);  
1360 - return false;  
1361 - } else {  
1362 - return value;  
1363 - }  
1364 - };  
1365 - }  
1366 - }  
1367 - };  
1368 -}]);  
1369 -  
1370 -angular.module('ScheduleApp').directive("remoteValidaton", [  
1371 - 'BusInfoManageService_g',  
1372 - 'EmployeeInfoManageService_g',  
1373 - function(  
1374 - busInfoManageService_g,  
1375 - employeeInfoManageService_g  
1376 - ) {  
1377 - /**  
1378 - * 远端验证指令,依赖于ngModel  
1379 - * 指令名称 remote-Validation  
1380 - * 需要属性 rvtype 表示验证类型  
1381 - */  
1382 - return {  
1383 - restrict: "A",  
1384 - require: "^ngModel",  
1385 - link: function(scope, element, attr, ngModelCtrl) {  
1386 - element.bind("keyup", function() {  
1387 - var modelValue = ngModelCtrl.$modelValue;  
1388 - var rv1_attr = attr["rv1"];  
1389 - if (attr["rvtype"]) {  
1390 -  
1391 - // 根据rvtype的值,确定使用那个远端验证的url,  
1392 - // rv1, rv2, rv3是关联比较值,暂时使用rv1  
1393 - // 这个貌似没法通用,根据业务变换  
1394 - // TODO:暂时有点乱以后改  
1395 - if (attr["rvtype"] == "insideCode") {  
1396 - busInfoManageService_g.validate.insideCode(  
1397 - {"insideCode_eq": modelValue, type: "equale"},  
1398 - function(result) {  
1399 - //console.log(result);  
1400 - if (result.status == "SUCCESS") {  
1401 - ngModelCtrl.$setValidity('remote', true);  
1402 - } else {  
1403 - ngModelCtrl.$setValidity('remote', false);  
1404 - }  
1405 - },  
1406 - function(result) {  
1407 - //console.log(result);  
1408 - ngModelCtrl.$setValidity('remote', true);  
1409 - }  
1410 - );  
1411 - } else if (attr["rvtype"] == "jobCode") {  
1412 - if (!rv1_attr) {  
1413 - ngModelCtrl.$setValidity('remote', false);  
1414 - return;  
1415 - }  
1416 -  
1417 - employeeInfoManageService_g.validate.jobCode(  
1418 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
1419 - function(result) {  
1420 - //console.log(result);  
1421 - if (result.status == "SUCCESS") {  
1422 - ngModelCtrl.$setValidity('remote', true);  
1423 - } else {  
1424 - ngModelCtrl.$setValidity('remote', false);  
1425 - }  
1426 - },  
1427 - function(result) {  
1428 - //console.log(result);  
1429 - ngModelCtrl.$setValidity('remote', true);  
1430 - }  
1431 - );  
1432 - }  
1433 - } else {  
1434 - // 没有rvtype,就不用远端验证了  
1435 - ngModelCtrl.$setValidity('remote', true);  
1436 - }  
1437 -  
1438 - attr.$observe("rv1", function(value) {  
1439 - if (attr["rvtype"] == "jobCode") {  
1440 - if (!value) {  
1441 - ngModelCtrl.$setValidity('remote', false);  
1442 - return;  
1443 - }  
1444 -  
1445 - employeeInfoManageService_g.validate.jobCode(  
1446 - {"jobCode_eq": modelValue, "companyCode_eq": rv1_attr, type: "equale"},  
1447 - function(result) {  
1448 - //console.log(result);  
1449 - if (result.status == "SUCCESS") {  
1450 - ngModelCtrl.$setValidity('remote', true);  
1451 - } else {  
1452 - ngModelCtrl.$setValidity('remote', false);  
1453 - }  
1454 - },  
1455 - function(result) {  
1456 - //console.log(result);  
1457 - ngModelCtrl.$setValidity('remote', true);  
1458 - }  
1459 - );  
1460 - }  
1461 -  
1462 - });  
1463 - });  
1464 - }  
1465 - };  
1466 -}]);  
1467 -  
1468 -  
1469 -/**  
1470 - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。  
1471 - * 1、compile阶段使用的属性如下:  
1472 - * required:用于和表单验证连接,指定成required="true"才有效。  
1473 - * 2、link阶段使用的属性如下  
1474 - * model:关联的模型对象  
1475 - * name:表单验证时需要的名字  
1476 - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加  
1477 - * modelcolname1:关联的模型字段名字1(一般应该是编码字段)  
1478 - * modelcolname2:关联的模型字段名字2(一般应该是名字字段)  
1479 - * datacolname1;内部数据对应的字段名字1(与模型字段1对应)  
1480 - * datacolname2:内部数据对应的字段名字2(与模型字段2对应)  
1481 - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用  
1482 - * placeholder:select placeholder字符串描述  
1483 - *  
1484 - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。  
1485 - * $$SearchInfoService_g,内部使用的数据服务  
1486 - */  
1487 -// saSelect2指令使用的内部信service  
1488 -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {  
1489 - return {  
1490 - xl: $resource(  
1491 - '/line/:type',  
1492 - {order: 'name', direction: 'ASC'},  
1493 - {  
1494 - list: {  
1495 - method: 'GET',  
1496 - isArray: true  
1497 - }  
1498 - }  
1499 - ),  
1500 - ry: $resource(  
1501 - '/personnel/:type',  
1502 - {order: 'personnelName', direction: 'ASC'},  
1503 - {  
1504 - list: {  
1505 - method: 'GET',  
1506 - isArray: true  
1507 - }  
1508 - }  
1509 - ),  
1510 - cl: $resource(  
1511 - '/cars/:type',  
1512 - {order: "insideCode", direction: 'ASC'},  
1513 - {  
1514 - list: {  
1515 - method: 'GET',  
1516 - isArray: true  
1517 - }  
1518 - }  
1519 - ),  
1520 - ttInfo: $resource(  
1521 - '/tic/:type',  
1522 - {order: "name", direction: 'ASC'},  
1523 - {  
1524 - list: {  
1525 - method: 'GET',  
1526 - isArray: true  
1527 - }  
1528 - }  
1529 - ),  
1530 - ccl: $resource(  
1531 - '/cci/cars',  
1532 - {},  
1533 - {  
1534 - list: {  
1535 - method: 'GET',  
1536 - isArray: true  
1537 - }  
1538 - }  
1539 -  
1540 - )  
1541 - }  
1542 -}]);  
1543 -angular.module('ScheduleApp').filter("$$pyFilter", function() {  
1544 - return function(items, props) {  
1545 - var out = [];  
1546 - var limit = props["limit"] || 20; // 默认20条记录  
1547 -  
1548 - if (angular.isArray(items)) {  
1549 - items.forEach(function(item) {  
1550 - if (out.length < limit) {  
1551 - if (props.search) {  
1552 - var upTerm = props.search.toUpperCase();  
1553 - if(item.fullChars.indexOf(upTerm) != -1  
1554 - || item.camelChars.indexOf(upTerm) != -1) {  
1555 - out.push(item);  
1556 - }  
1557 - }  
1558 - }  
1559 - });  
1560 - }  
1561 -  
1562 - return out;  
1563 - };  
1564 -});  
1565 -angular.module('ScheduleApp').directive("saSelect2", [  
1566 - '$timeout', '$$SearchInfoService_g',  
1567 - function($timeout, $$searchInfoService_g) {  
1568 - return {  
1569 - restrict: 'E',  
1570 - templateUrl: '/pages/scheduleApp/module/other/MySearchSelectTemplate.html',  
1571 - scope: {  
1572 - model: "=" // 独立作用域,关联外部的模型对象  
1573 - },  
1574 - controllerAs: "$saSelectCtrl",  
1575 - bindToController: true,  
1576 - controller: function($scope) {  
1577 - var self = this;  
1578 - self.$$data = []; // 内部关联的数据  
1579 - },  
1580 - /**  
1581 - * 此阶段可以改dom结构,此时angular还没扫描指令,  
1582 - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。  
1583 - * @param tElem  
1584 - * @param tAttrs  
1585 - * @returns {{pre: Function, post: Function}}  
1586 - */  
1587 - compile: function(tElem, tAttrs) {  
1588 - // 1、获取此阶段使用的属性  
1589 - var $required_attr = tAttrs["required"]; // 用于和表单验证连接,指定成required="true"才有效。  
1590 -  
1591 - // 2、处理属性  
1592 -  
1593 - // 确定是否使用angularjs required验证  
1594 - // 属性 required  
1595 - // 如果没有填写,内部不添加验证,如果填写了,并且等于true添加验证,否则不添加  
1596 - if ($required_attr) {  
1597 - if ($required_attr == "true") {  
1598 - // 添加required属性指令  
1599 - tElem.find("ui-select").attr("required", "");  
1600 - } else {  
1601 - // 不等于true,不添加required属性指令  
1602 - }  
1603 - } else {  
1604 - // 不添加required属性指令  
1605 - }  
1606 -  
1607 - //console.log("saSelect" + ":compile = >" + tElem.html());  
1608 -  
1609 - return {  
1610 - pre: function(scope, element, attr) {  
1611 - // TODO:  
1612 - },  
1613 - /**  
1614 - * 相当于link函数。  
1615 - *  
1616 - * 重要属性如下:  
1617 - * model 是绑定外部值。  
1618 - * dicgroup 字典组的类型  
1619 - * name input name属性值  
1620 - */  
1621 - post: function(scope, element, attr) {  
1622 - // 1、获取此阶段使用的属性  
1623 - var $name_attr = attr["name"]; // 表单验证时需要的名字  
1624 - var $type_attr = attr["type"]; // 关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加  
1625 - var $modelcolname1_attr = attr["modelcolname1"]; // 关联的模型字段名字1(一般应该是编码字段)  
1626 - var $modelcolname2_attr = attr["modelcolname2"]; // 关联的模型字段名字2(一般应该是名字字段)  
1627 - var $datacolname1_attr = attr["datacolname1"]; // 内部数据对应的字段名字1(与模型字段1对应)  
1628 - var $datacolname2_attr = attr["datacolname2"]; // 内部数据对应的字段名字2(与模型字段2对应)  
1629 - var $showcolname_attr = attr["showcolname"]; // 下拉框显示的内部数据字段名  
1630 - var $placeholder_attr = attr["placeholder"]; // select placeholder字符串描述  
1631 -  
1632 - // 2、处理属性、转换成$saSelectCtrl内部使用的属性  
1633 - if ($name_attr) {  
1634 - scope["$saSelectCtrl"].$name_attr = $name_attr;  
1635 - }  
1636 - if ($placeholder_attr) {  
1637 - scope["$saSelectCtrl"].$placeholder_attr = $placeholder_attr;  
1638 - }  
1639 - if ($showcolname_attr) {  
1640 - scope["$saSelectCtrl"].$showcolname_attr = $showcolname_attr;  
1641 - }  
1642 -  
1643 - // 2-1、添加内部方法,根据type值,改变$$data的值  
1644 - scope["$saSelectCtrl"].$$internal_data_change_fn = function() {  
1645 - // 根据type属性动态载入数据  
1646 - if ($type_attr) {  
1647 - $$searchInfoService_g[$type_attr].list(  
1648 - {type: "all"},  
1649 - function(result) {  
1650 - scope["$saSelectCtrl"].$$data = [];  
1651 - for (var i = 0; i < result.length; i ++) {  
1652 - var data = {}; // data是result的一部分属性集合,根据配置来确定  
1653 - if ($datacolname1_attr) {  
1654 - data[$datacolname1_attr] = result[i][$datacolname1_attr];  
1655 - }  
1656 - if ($datacolname2_attr) {  
1657 - data[$datacolname2_attr] = result[i][$datacolname2_attr];  
1658 - }  
1659 - if ($showcolname_attr) {  
1660 - // 动态添加基于名字的拼音  
1661 - data[$showcolname_attr] = result[i][$showcolname_attr];  
1662 - if (data[$showcolname_attr]) {  
1663 - data["fullChars"] = pinyin.getFullChars(result[i][$showcolname_attr]).toUpperCase(); // 全拼  
1664 - data["camelChars"] = pinyin.getCamelChars(result[i][$showcolname_attr]); // 简拼  
1665 - }  
1666 - }  
1667 - if (data["fullChars"])  
1668 - scope["$saSelectCtrl"].$$data.push(data);  
1669 - }  
1670 - },  
1671 - function(result) {  
1672 -  
1673 - }  
1674 - );  
1675 - }  
1676 - };  
1677 -  
1678 - // 3、选择、删除事件映射模型和内部数据对应的字段  
1679 - scope["$saSelectCtrl"].$select_fn_attr = function($item) {  
1680 - if ($modelcolname1_attr && $datacolname1_attr) {  
1681 - scope["$saSelectCtrl"].model[$modelcolname1_attr] = $item[$datacolname1_attr];  
1682 - }  
1683 - if ($modelcolname2_attr && $datacolname2_attr) {  
1684 - scope["$saSelectCtrl"].model[$modelcolname2_attr] = $item[$datacolname2_attr];  
1685 - }  
1686 - };  
1687 - scope["$saSelectCtrl"].$remove_fn_attr = function() {  
1688 - if ($modelcolname1_attr) {  
1689 - scope["$saSelectCtrl"].model[$modelcolname1_attr] = null;  
1690 - }  
1691 - if ($modelcolname2_attr) {  
1692 - scope["$saSelectCtrl"].model[$modelcolname2_attr] = null;  
1693 - }  
1694 - scope["$saSelectCtrl"].$$cmodel = null; // 内部模型清空  
1695 -  
1696 - scope["$saSelectCtrl"].$$internal_data_change_fn();  
1697 - };  
1698 -  
1699 - // 4、搜索事件  
1700 - scope["$saSelectCtrl"].$refreshdata_fn_attr = function($search) {  
1701 - //var fullChars = pinyin.getFullChars($search).toUpperCase();  
1702 - //var camelChars = pinyin.getCamelChars($search);  
1703 - //  
1704 - //console.log(fullChars + " " + camelChars);  
1705 - // TODO:事件暂时没用,放着以后再说  
1706 - };  
1707 -  
1708 - // 5、全部载入后,输入的  
1709 - $timeout(function() {  
1710 - // 创建内部使用的绑定对象,用于确认选中那个值  
1711 - scope["$saSelectCtrl"].$$cmodel = scope["$saSelectCtrl"].model[$modelcolname1_attr];  
1712 -  
1713 - scope["$saSelectCtrl"].$$internal_data_change_fn();  
1714 - }, 0);  
1715 - }  
1716 - }  
1717 - }  
1718 - };  
1719 -}]);  
1720 -  
1721 -  
1722 -  
1723 -  
1724 -  
1725 -  
1726 -  
1727 119
src/main/resources/static/pages/scheduleApp/module/other/MyDictionaryRadioGroupTemplate.html deleted 100644 → 0
1 -<div>  
2 - <!--<label class="radio-inline">-->  
3 - <!--<input type="radio" name="{{nv}}"-->  
4 - <!--ng-value="true" ng-model="model" {{disabled}}/>{{trueDesc}}-->  
5 - <!--</label>-->  
6 - <!--<label class="radio-inline">-->  
7 - <!--<input type="radio" name="{{nv}}"-->  
8 - <!--ng-value="false" ng-model="model" {{disabled}}/>{{falseDesc}}-->  
9 - <!--</label>-->  
10 -  
11 - <!-- 单选按钮组模版 -->  
12 - <!--  
13 - 使用 ng-repeat 循环生成input radio时候,双向绑定会有问题,因为ng-repeat有自己的controller,  
14 - 会影响外部的controller绑定,网上有很多解决方法,这里使用controllerAs方式,让指令定义自己的控制器别名,  
15 - 模版里指定别名就不会和ng-repeat控制器混了。  
16 - -->  
17 -  
18 - <label class="radio-inline" ng-repeat="(dicvalue, dicdesc) in ctrl.dic">  
19 - <input type="radio" name="{{ctrl.nv}}"  
20 - ng-value="ctrl.dicvalueCalcu(dicvalue)" ng-model="ctrl.model" ng-disabled="ctrl.disabled" />{{dicdesc}}  
21 - </label>  
22 -</div>  
23 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/package.json
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "grunt": "^0.4.5", 8 "grunt": "^0.4.5",
9 "grunt-contrib-clean": "^1.0.0", 9 "grunt-contrib-clean": "^1.0.0",
10 "grunt-contrib-uglify": "^1.0.1", 10 "grunt-contrib-uglify": "^1.0.1",
  11 + "grunt-contrib-concat": "^0.5.1",
11 "grunt-static-inline": "^0.1.9", 12 "grunt-static-inline": "^0.1.9",
12 "grunt-text-replace": "^0.4.0", 13 "grunt-text-replace": "^0.4.0",
13 "http-server": "^0.6.1", 14 "http-server": "^0.6.1",
@@ -33,6 +34,6 @@ @@ -33,6 +34,6 @@
33 "protractor": "protractor test/protractor-conf.js", 34 "protractor": "protractor test/protractor-conf.js",
34 35
35 36
36 - "build": "grunt" 37 + "build": "grunt directive"
37 } 38 }
38 } 39 }