Commit 09b4ba4b85db83a761746d796faada181b70204f

Authored by 徐烜
1 parent 751d4fb5

Update

src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
@@ -20,7 +20,8 @@ angular.module('ScheduleApp').directive('saSelect5', [ @@ -20,7 +20,8 @@ angular.module('ScheduleApp').directive('saSelect5', [
20 '$timeout', 20 '$timeout',
21 '$$SearchInfoService_g', 21 '$$SearchInfoService_g',
22 'UserPrincipal', 22 'UserPrincipal',
23 - function($timeout, $$searchInfoService_g, UserPrincipal) { 23 + 'DataStore',
  24 + function($timeout, $$searchInfoService_g, UserPrincipal, DataStore) {
24 return { 25 return {
25 restrict: 'E', 26 restrict: 'E',
26 templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html', 27 templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
@@ -302,11 +303,17 @@ angular.module('ScheduleApp').directive('saSelect5', [ @@ -302,11 +303,17 @@ angular.module('ScheduleApp').directive('saSelect5', [
302 var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]); 303 var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
303 if (calcu_str) { 304 if (calcu_str) {
304 // 全拼 305 // 全拼
305 - result[i]["$fullChars"] = pinyin.getFullChars(calcu_str); 306 + if (!result[i]["$fullChars"]) {
  307 + result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  308 + }
306 // 简拼 309 // 简拼
307 - result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str); 310 + if (!result[i]["$camelChars"]) {
  311 + result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  312 + }
308 // 原值 313 // 原值
309 - result[i]["$calcu_str"] = calcu_str; 314 + if (!result[i]["$calcu_str"]) {
  315 + result[i]["$calcu_str"] = calcu_str;
  316 + }
310 317
311 scope[ctrlAs].$$data_real.push(result[i]); 318 scope[ctrlAs].$$data_real.push(result[i]);
312 } 319 }
@@ -367,18 +374,26 @@ angular.module('ScheduleApp').directive('saSelect5', [ @@ -367,18 +374,26 @@ angular.module('ScheduleApp').directive('saSelect5', [
367 374
368 /** 375 /**
369 * 内部方法,读取本地动态数据源。 376 * 内部方法,读取本地动态数据源。
370 - * @param ldata 377 + * @param type
371 */ 378 */
372 - scope[ctrlAs].$$internal_local_data = function(ldata) { 379 + scope[ctrlAs].$$internal_local_data = function(type) {
373 // 重新创建内部保存的数据 380 // 重新创建内部保存的数据
374 scope[ctrlAs].$$data_real = []; 381 scope[ctrlAs].$$data_real = [];
375 - // 重新创建内部ui-select显示用数据,默认取10条记录显示  
376 - scope[ctrlAs].$$data = [];  
377 -  
378 // 本地动态数据直接显示,暂时不优化 382 // 本地动态数据直接显示,暂时不优化
  383 + var ldata = DataStore.getData(type);
379 for (var i = 0; i < ldata.length; i++) { 384 for (var i = 0; i < ldata.length; i++) {
380 scope[ctrlAs].$$data_real.push(ldata[i]); 385 scope[ctrlAs].$$data_real.push(ldata[i]);
381 - scope[ctrlAs].$$data.push(ldata[i]); 386 +
  387 + }
  388 +
  389 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  390 + scope[ctrlAs].$$data = [];
  391 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  392 + if (scope[ctrlAs].$$data.length < 10) {
  393 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  394 + } else {
  395 + break;
  396 + }
382 } 397 }
383 398
384 scope[ctrlAs].$$internal_validate_model(); 399 scope[ctrlAs].$$internal_validate_model();
@@ -393,7 +408,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -393,7 +408,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
393 console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value); 408 console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
394 409
395 // dsparams格式如下: 410 // dsparams格式如下:
396 - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'} 411 + // {type: 'ajax', param: 'ajax查询参数对象', atype: 'ajax查询累西'}
  412 + // {type: 'dic', param: 'dic名字'}
  413 + // {type: 'local', param: '本地存储type名字'}
397 414
398 if (obj.type == 'dic') { 415 if (obj.type == 'dic') {
399 dataModelType = 'dic'; 416 dataModelType = 'dic';
@@ -404,7 +421,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -404,7 +421,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
404 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param); 421 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
405 } else if (obj.type == 'local') { 422 } else if (obj.type == 'local') {
406 dataModelType = 'local'; 423 dataModelType = 'local';
407 - scope[ctrlAs].$$internal_local_data(obj.ldata); 424 + scope[ctrlAs].$$internal_local_data(obj.param);
408 } else { 425 } else {
409 throw new Error("dsparams参数格式异常=" + obj); 426 throw new Error("dsparams参数格式异常=" + obj);
410 } 427 }
src/main/resources/static/pages/scheduleApp/module/common/main.js
@@ -51,6 +51,60 @@ ScheduleApp.factory(&#39;UserPrincipal&#39;, [ @@ -51,6 +51,60 @@ ScheduleApp.factory(&#39;UserPrincipal&#39;, [
51 } 51 }
52 ]); 52 ]);
53 53
  54 +ScheduleApp.factory('DataStore', [
  55 + '$http',
  56 + function($http) {
  57 + // 本地数据存储,如车辆数据,人员数据
  58 + var dataMap = {
  59 + "cl": [],
  60 + "ry": []
  61 + };
  62 +
  63 + $http({
  64 + method: 'GET',
  65 + url: '/cars_sc/all'
  66 + }).then(function(result) {
  67 + // 简拼数据
  68 + dataMap.cl = result.data.data;
  69 + angular.forEach(result.data.data, function(obj) {
  70 + // 全拼
  71 + obj["$fullChars"] = pinyin.getFullChars(obj.insideCode ? "": obj.insideCode);
  72 + // 简拼
  73 + obj["$camelChars"] = pinyin.getCamelChars(obj.insideCode ? "": obj.insideCode);
  74 + // 原值
  75 + obj["$calcu_str"] = obj.insideCode? "": obj.insideCode;
  76 + });
  77 + });
  78 +
  79 + $http({
  80 + method: 'GET',
  81 + url: '/ee/all'
  82 + }).then(function(result) {
  83 + // 简拼数据
  84 + dataMap.ry = result.data.data;
  85 + angular.forEach(dataMap.ryInfos, function(obj) {
  86 + // 全拼
  87 + obj["$fullChars"] = pinyin.getFullChars(obj.personnelName + "-" + obj.jobCode);
  88 + // 简拼
  89 + obj["$camelChars"] = pinyin.getCamelChars(obj.personnelName + "-" + obj.jobCode);
  90 + // 原值
  91 + obj["$calcu_str"] = obj.personnelName + "-" + obj.jobCode;
  92 + });
  93 + });
  94 +
  95 + return {
  96 + getData: function(type) {
  97 + if (dataMap[type]) {
  98 + return dataMap[type];
  99 + } else {
  100 + return [];
  101 + }
  102 + }
  103 + }
  104 +
  105 + }
  106 +]);
  107 +
54 /** 108 /**
55 * 用于请求通知。 109 * 用于请求通知。
56 */ 110 */
@@ -199,12 +253,16 @@ ScheduleApp.factory(&#39;settings&#39;, [&#39;$rootScope&#39;, function($rootScope) { @@ -199,12 +253,16 @@ ScheduleApp.factory(&#39;settings&#39;, [&#39;$rootScope&#39;, function($rootScope) {
199 ScheduleApp.controller('ScheduleAppController', [ 253 ScheduleApp.controller('ScheduleAppController', [
200 '$scope', 254 '$scope',
201 'UserPrincipal', 255 'UserPrincipal',
202 - function($scope, UserPrincipal) { 256 + 'DataStore',
  257 + function($scope, UserPrincipal, DataStore) {
203 $scope.$on('$viewContentLoaded', function(event) { 258 $scope.$on('$viewContentLoaded', function(event) {
204 console.log("子页面已载入:" + event); 259 console.log("子页面已载入:" + event);
205 }); 260 });
206 261
207 // 获取一次用户身份信息 262 // 获取一次用户身份信息
208 UserPrincipal.getGsStrs(); 263 UserPrincipal.getGsStrs();
  264 + // 获取本地数据
  265 + DataStore.getData("cl");
  266 + DataStore.getData("ry");
209 } 267 }
210 ]); 268 ]);
211 \ No newline at end of file 269 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
@@ -1325,7 +1325,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1325,7 +1325,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1325 '$timeout', 1325 '$timeout',
1326 '$$SearchInfoService_g', 1326 '$$SearchInfoService_g',
1327 'UserPrincipal', 1327 'UserPrincipal',
1328 - function($timeout, $$searchInfoService_g, UserPrincipal) { 1328 + 'DataStore',
  1329 + function($timeout, $$searchInfoService_g, UserPrincipal, DataStore) {
1329 return { 1330 return {
1330 restrict: 'E', 1331 restrict: 'E',
1331 templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html', 1332 templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
@@ -1607,11 +1608,17 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1607,11 +1608,17 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1607 var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]); 1608 var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
1608 if (calcu_str) { 1609 if (calcu_str) {
1609 // 全拼 1610 // 全拼
1610 - result[i]["$fullChars"] = pinyin.getFullChars(calcu_str); 1611 + if (!result[i]["$fullChars"]) {
  1612 + result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  1613 + }
1611 // 简拼 1614 // 简拼
1612 - result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str); 1615 + if (!result[i]["$camelChars"]) {
  1616 + result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  1617 + }
1613 // 原值 1618 // 原值
1614 - result[i]["$calcu_str"] = calcu_str; 1619 + if (!result[i]["$calcu_str"]) {
  1620 + result[i]["$calcu_str"] = calcu_str;
  1621 + }
1615 1622
1616 scope[ctrlAs].$$data_real.push(result[i]); 1623 scope[ctrlAs].$$data_real.push(result[i]);
1617 } 1624 }
@@ -1672,18 +1679,26 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1672,18 +1679,26 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1672 1679
1673 /** 1680 /**
1674 * 内部方法,读取本地动态数据源。 1681 * 内部方法,读取本地动态数据源。
1675 - * @param ldata 1682 + * @param type
1676 */ 1683 */
1677 - scope[ctrlAs].$$internal_local_data = function(ldata) { 1684 + scope[ctrlAs].$$internal_local_data = function(type) {
1678 // 重新创建内部保存的数据 1685 // 重新创建内部保存的数据
1679 scope[ctrlAs].$$data_real = []; 1686 scope[ctrlAs].$$data_real = [];
1680 - // 重新创建内部ui-select显示用数据,默认取10条记录显示  
1681 - scope[ctrlAs].$$data = [];  
1682 -  
1683 // 本地动态数据直接显示,暂时不优化 1687 // 本地动态数据直接显示,暂时不优化
  1688 + var ldata = DataStore.getData(type);
1684 for (var i = 0; i < ldata.length; i++) { 1689 for (var i = 0; i < ldata.length; i++) {
1685 scope[ctrlAs].$$data_real.push(ldata[i]); 1690 scope[ctrlAs].$$data_real.push(ldata[i]);
1686 - scope[ctrlAs].$$data.push(ldata[i]); 1691 +
  1692 + }
  1693 +
  1694 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  1695 + scope[ctrlAs].$$data = [];
  1696 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1697 + if (scope[ctrlAs].$$data.length < 10) {
  1698 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  1699 + } else {
  1700 + break;
  1701 + }
1687 } 1702 }
1688 1703
1689 scope[ctrlAs].$$internal_validate_model(); 1704 scope[ctrlAs].$$internal_validate_model();
@@ -1698,7 +1713,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1698,7 +1713,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1698 console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value); 1713 console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
1699 1714
1700 // dsparams格式如下: 1715 // dsparams格式如下:
1701 - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'} 1716 + // {type: 'ajax', param: 'ajax查询参数对象', atype: 'ajax查询累西'}
  1717 + // {type: 'dic', param: 'dic名字'}
  1718 + // {type: 'local', param: '本地存储type名字'}
1702 1719
1703 if (obj.type == 'dic') { 1720 if (obj.type == 'dic') {
1704 dataModelType = 'dic'; 1721 dataModelType = 'dic';
@@ -1709,7 +1726,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1709,7 +1726,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1709 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param); 1726 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
1710 } else if (obj.type == 'local') { 1727 } else if (obj.type == 'local') {
1711 dataModelType = 'local'; 1728 dataModelType = 'local';
1712 - scope[ctrlAs].$$internal_local_data(obj.ldata); 1729 + scope[ctrlAs].$$internal_local_data(obj.param);
1713 } else { 1730 } else {
1714 throw new Error("dsparams参数格式异常=" + obj); 1731 throw new Error("dsparams参数格式异常=" + obj);
1715 } 1732 }
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit.html
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 cmaps="{'cl1.id': 'id'}" 54 cmaps="{'cl1.id': 'id'}"
55 dcname="cl1.id" 55 dcname="cl1.id"
56 icname="id" 56 icname="id"
57 - dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'cl' } | json }}" 57 + dsparams="{{ {type: 'local', param: 'cl' } | json }}"
58 iterobjname="item" 58 iterobjname="item"
59 iterobjexp="item.insideCode" 59 iterobjexp="item.insideCode"
60 searchph="请输拼音..." 60 searchph="请输拼音..."
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 cmaps="{'cl2.id': 'id'}" 75 cmaps="{'cl2.id': 'id'}"
76 dcname="cl2.id" 76 dcname="cl2.id"
77 icname="id" 77 icname="id"
78 - dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'cl' } | json }}" 78 + dsparams="{{ {type: 'local', param: 'cl' } | json }}"
79 iterobjname="item" 79 iterobjname="item"
80 iterobjexp="item.insideCode" 80 iterobjexp="item.insideCode"
81 searchph="请输拼音..." 81 searchph="请输拼音..."
@@ -93,11 +93,11 @@ @@ -93,11 +93,11 @@
93 cmaps="{'j1.id' : 'id'}" 93 cmaps="{'j1.id' : 'id'}"
94 dcname="j1.id" 94 dcname="j1.id"
95 icname="id" 95 icname="id"
96 - dsparams="{{ {type: 'ajax', param:{'type': 'all'}, atype:'ry' } | json }}" 96 + dsparams="{{ {type: 'local', param: 'ry' } | json }}"
97 iterobjname="item" 97 iterobjname="item"
98 - iterobjexp="item.personnelName + '<' + item.jobCode + '>'" 98 + iterobjexp="item.personnelName"
99 searchph="请输拼音..." 99 searchph="请输拼音..."
100 - searchexp="this.personnelName + '<' + this.jobCode + '>'" 100 + searchexp="this.personnelName"
101 required > 101 required >
102 </sa-Select5> 102 </sa-Select5>
103 </div> 103 </div>
@@ -114,11 +114,11 @@ @@ -114,11 +114,11 @@
114 cmaps="{'s1.id' : 'id'}" 114 cmaps="{'s1.id' : 'id'}"
115 dcname="s1.id" 115 dcname="s1.id"
116 icname="id" 116 icname="id"
117 - dsparams="{{ {type: 'ajax', param:{'type': 'all'}, atype:'ry' } | json }}" 117 + dsparams="{{ {type: 'local', param: 'ry' } | json }}"
118 iterobjname="item" 118 iterobjname="item"
119 - iterobjexp="item.personnelName + '<' + item.jobCode + '>'" 119 + iterobjexp="item.personnelName"
120 searchph="请输拼音..." 120 searchph="请输拼音..."
121 - searchexp="this.personnelName + '<' + this.jobCode + '>'" 121 + searchexp="this.personnelName"
122 > 122 >
123 </sa-Select5> 123 </sa-Select5>
124 </div> 124 </div>
@@ -132,11 +132,11 @@ @@ -132,11 +132,11 @@
132 cmaps="{'j2.id' : 'id'}" 132 cmaps="{'j2.id' : 'id'}"
133 dcname="j2.id" 133 dcname="j2.id"
134 icname="id" 134 icname="id"
135 - dsparams="{{ {type: 'ajax', param:{'type': 'all'}, atype:'ry' } | json }}" 135 + dsparams="{{ {type: 'local', param: 'ry' } | json }}"
136 iterobjname="item" 136 iterobjname="item"
137 - iterobjexp="item.personnelName + '<' + item.jobCode + '>'" 137 + iterobjexp="item.personnelName"
138 searchph="请输拼音..." 138 searchph="请输拼音..."
139 - searchexp="this.personnelName + '<' + this.jobCode + '>'" 139 + searchexp="this.personnelName"
140 > 140 >
141 </sa-Select5> 141 </sa-Select5>
142 </div> 142 </div>
@@ -149,11 +149,11 @@ @@ -149,11 +149,11 @@
149 cmaps="{'s2.id' : 'id'}" 149 cmaps="{'s2.id' : 'id'}"
150 dcname="s2.id" 150 dcname="s2.id"
151 icname="id" 151 icname="id"
152 - dsparams="{{ {type: 'ajax', param:{'type': 'all'}, atype:'ry' } | json }}" 152 + dsparams="{{ {type: 'local', param: 'ry' } | json }}"
153 iterobjname="item" 153 iterobjname="item"
154 - iterobjexp="item.personnelName + '<' + item.jobCode + '>'" 154 + iterobjexp="item.personnelName"
155 searchph="请输拼音..." 155 searchph="请输拼音..."
156 - searchexp="this.personnelName + '<' + this.jobCode + '>'" 156 + searchexp="this.personnelName"
157 > 157 >
158 </sa-Select5> 158 </sa-Select5>
159 </div> 159 </div>
@@ -167,11 +167,11 @@ @@ -167,11 +167,11 @@
167 cmaps="{'j3.id' : 'id'}" 167 cmaps="{'j3.id' : 'id'}"
168 dcname="j3.id" 168 dcname="j3.id"
169 icname="id" 169 icname="id"
170 - dsparams="{{ {type: 'ajax', param:{'type': 'all'}, atype:'ry' } | json }}" 170 + dsparams="{{ {type: 'local', param: 'ry' } | json }}"
171 iterobjname="item" 171 iterobjname="item"
172 - iterobjexp="item.personnelName + '<' + item.jobCode + '>'" 172 + iterobjexp="item.personnelName"
173 searchph="请输拼音..." 173 searchph="请输拼音..."
174 - searchexp="this.personnelName + '<' + this.jobCode + '>'" 174 + searchexp="this.personnelName"
175 > 175 >
176 </sa-Select5> 176 </sa-Select5>
177 </div> 177 </div>
@@ -184,11 +184,11 @@ @@ -184,11 +184,11 @@
184 cmaps="{'s3.id' : 'id'}" 184 cmaps="{'s3.id' : 'id'}"
185 dcname="s3.id" 185 dcname="s3.id"
186 icname="id" 186 icname="id"
187 - dsparams="{{ {type: 'ajax', param:{'type': 'all'}, atype:'ry' } | json }}" 187 + dsparams="{{ {type: 'local', param: 'ry' } | json }}"
188 iterobjname="item" 188 iterobjname="item"
189 - iterobjexp="item.personnelName + '<' + item.jobCode + '>'" 189 + iterobjexp="item.personnelName"
190 searchph="请输拼音..." 190 searchph="请输拼音..."
191 - searchexp="this.personnelName + '<' + this.jobCode + '>'" 191 + searchexp="this.personnelName"
192 > 192 >
193 </sa-Select5> 193 </sa-Select5>
194 </div> 194 </div>