Commit a9cc54025c29987cbc1bbb0f83fbba21140e3e62

Authored by 潘钊
2 parents d3caa67a 91456431

Merge branch 'qingpu' of http://222.66.0.204:8090/panzhaov5/bsth_control into qingpu

Showing 31 changed files with 2954 additions and 1412 deletions

Too many changes to show.

To preserve performance only 31 of 43 files are displayed.

src/main/java/com/bsth/controller/CarDeviceController.java
... ... @@ -12,7 +12,7 @@ import java.util.Map;
12 12 * Created by xu on 16/6/15.
13 13 */
14 14 @RestController
15   -@RequestMapping("carDevice")
  15 +@RequestMapping("cde")
16 16 public class CarDeviceController extends BaseController<CarDevice, Long> {
17 17  
18 18 /**
... ...
src/main/java/com/bsth/entity/CarDevice.java
1 1 package com.bsth.entity;
2 2  
  3 +import com.bsth.entity.sys.SysUser;
  4 +
3 5 import javax.persistence.*;
4 6 import java.util.Date;
5 7  
... ... @@ -15,17 +17,32 @@ public class CarDevice {
15 17 @GeneratedValue
16 18 private Long id;
17 19  
18   - /** 公司名称 */
19   - @Column(nullable = false)
  20 + /** 公司名称(留着,暂时不用) */
  21 + @Column
20 22 private String gsName;
  23 +
  24 + /** 车辆id,关联bsth_c_cars */
  25 + @Column(nullable = false)
  26 + private Integer cl;
21 27 /** 内部编号(自编号) */
  28 + @Column(nullable = false)
22 29 private String clZbh;
  30 +
  31 + /** 关联 bsth_c_line 主键,不做mapping */
  32 + @Column(nullable = false)
  33 + private Integer xl;
23 34 /** 线路名称 */
  35 + @Column(nullable = false)
24 36 private String xlName;
  37 + /** 线路编码 */
  38 + @Column(nullable = false)
  39 + private String xlBm;
25 40  
26 41 /** 旧终端号 */
  42 + @Column(nullable = false)
27 43 private String oldDeviceNo;
28 44 /** 新终端号 */
  45 + @Column(nullable = false)
29 46 private String newDeviceNo;
30 47 /** 旧SIM卡号 */
31 48 private String oldSimNo;
... ... @@ -37,11 +54,24 @@ public class CarDevice {
37 54 /** 保修描述 */
38 55 private String guaranteeDesc;
39 56  
40   - // 创建日期
  57 + /** 启用日期 */
  58 + @Column(nullable = false)
  59 + private Date qyrq;
  60 +
  61 + /** 是否删除(标记) */
  62 + @Column(nullable = false)
  63 + private Boolean isCancel = false;
  64 +
  65 + /** 创建人 */
  66 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  67 + private SysUser createBy;
  68 + /** 修改人 */
  69 + @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
  70 + private SysUser updateBy;
  71 + /** 创建日期 */
41 72 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
42 73 private Date createDate;
43   -
44   - // 修改日期
  74 + /** 修改日期 */
45 75 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
46 76 private Date updateDate;
47 77  
... ... @@ -61,6 +91,14 @@ public class CarDevice {
61 91 this.gsName = gsName;
62 92 }
63 93  
  94 + public Integer getCl() {
  95 + return cl;
  96 + }
  97 +
  98 + public void setCl(Integer cl) {
  99 + this.cl = cl;
  100 + }
  101 +
64 102 public String getClZbh() {
65 103 return clZbh;
66 104 }
... ... @@ -69,6 +107,14 @@ public class CarDevice {
69 107 this.clZbh = clZbh;
70 108 }
71 109  
  110 + public Integer getXl() {
  111 + return xl;
  112 + }
  113 +
  114 + public void setXl(Integer xl) {
  115 + this.xl = xl;
  116 + }
  117 +
72 118 public String getXlName() {
73 119 return xlName;
74 120 }
... ... @@ -77,6 +123,14 @@ public class CarDevice {
77 123 this.xlName = xlName;
78 124 }
79 125  
  126 + public String getXlBm() {
  127 + return xlBm;
  128 + }
  129 +
  130 + public void setXlBm(String xlBm) {
  131 + this.xlBm = xlBm;
  132 + }
  133 +
80 134 public String getOldDeviceNo() {
81 135 return oldDeviceNo;
82 136 }
... ... @@ -125,6 +179,22 @@ public class CarDevice {
125 179 this.guaranteeDesc = guaranteeDesc;
126 180 }
127 181  
  182 + public SysUser getCreateBy() {
  183 + return createBy;
  184 + }
  185 +
  186 + public void setCreateBy(SysUser createBy) {
  187 + this.createBy = createBy;
  188 + }
  189 +
  190 + public SysUser getUpdateBy() {
  191 + return updateBy;
  192 + }
  193 +
  194 + public void setUpdateBy(SysUser updateBy) {
  195 + this.updateBy = updateBy;
  196 + }
  197 +
128 198 public Date getCreateDate() {
129 199 return createDate;
130 200 }
... ... @@ -140,4 +210,20 @@ public class CarDevice {
140 210 public void setUpdateDate(Date updateDate) {
141 211 this.updateDate = updateDate;
142 212 }
  213 +
  214 + public Date getQyrq() {
  215 + return qyrq;
  216 + }
  217 +
  218 + public void setQyrq(Date qyrq) {
  219 + this.qyrq = qyrq;
  220 + }
  221 +
  222 + public Boolean getIsCancel() {
  223 + return isCancel;
  224 + }
  225 +
  226 + public void setIsCancel(Boolean isCancel) {
  227 + this.isCancel = isCancel;
  228 + }
143 229 }
... ...
src/main/java/com/bsth/service/impl/CarDeviceServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
  3 +import com.bsth.common.ResponseCode;
3 4 import com.bsth.entity.CarDevice;
  5 +import com.bsth.entity.schedule.rule.RerunRule;
  6 +import com.bsth.repository.CarDeviceRepository;
4 7 import com.bsth.service.CarDeviceService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
5 9 import org.springframework.stereotype.Service;
6 10  
  11 +import javax.transaction.Transactional;
  12 +import java.util.HashMap;
  13 +import java.util.Map;
  14 +
7 15 /**
8 16 * Created by xu on 16/6/15.
9 17 */
10 18 @Service
11 19 public class CarDeviceServiceImpl extends BaseServiceImpl<CarDevice, Long> implements CarDeviceService {
  20 +
  21 + @Autowired
  22 + private CarDeviceRepository carDeviceRepository;
  23 +
  24 + @Transactional
  25 + @Override
  26 + public Map<String, Object> delete(Long aLong) {
  27 + // 获取作废数据
  28 + CarDevice carDevice = carDeviceRepository.findOne(aLong);
  29 +
  30 + toogleIsCancel(carDevice);
  31 +
  32 + Map<String, Object> map = new HashMap<>();
  33 + map.put("status", ResponseCode.SUCCESS);
  34 +
  35 + return map;
  36 + }
  37 +
  38 + /**
  39 + * 撤销/作废切换。
  40 + * @param rerunRule
  41 + */
  42 + private void toogleIsCancel(CarDevice carDevice) {
  43 + boolean isCancel = carDevice.getIsCancel();
  44 + if (isCancel) {
  45 + carDevice.setIsCancel(false);
  46 + } else {
  47 + carDevice.setIsCancel(true);
  48 + }
  49 + }
12 50 }
... ...
src/main/java/com/bsth/util/Geo/AnalySection.java
1 1 package com.bsth.util.Geo;
2 2  
  3 +import com.bsth.util.db.DBUtils_MS;
  4 +
3 5 import java.sql.Connection;
4 6 import java.sql.PreparedStatement;
5 7 import java.sql.ResultSet;
... ... @@ -9,9 +11,7 @@ import java.util.HashMap;
9 11 import java.util.List;
10 12 import java.util.Map;
11 13  
12   -import org.junit.Test;
13   -
14   -import com.bsth.util.db.DBUtils_MS;
  14 +//import org.junit.Test;
15 15  
16 16 public class AnalySection {
17 17  
... ...
src/main/resources/datatools/config-dev.properties
... ... @@ -4,11 +4,11 @@
4 4 datatools.kettle_properties=/datatools/kettle.properties
5 5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正)
6 6 #数据库ip地址
7   -datatools.kvars_dbip=192.168.168.201
  7 +datatools.kvars_dbip=127.0.0.1
8 8 #数据库用户名
9 9 datatools.kvars_dbuname=root
10 10 #数据库密码
11   -datatools.kvars_dbpwd=123456
  11 +datatools.kvars_dbpwd=
12 12 #数据库库名
13 13 datatools.kvars_dbdname=qp_control
14 14  
... ...
src/main/resources/static/pages/scheduleApp/Gruntfile.js
... ... @@ -9,343 +9,375 @@ module.exports = function (grunt) {
9 9  
10 10 // clean清除插件配置
11 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 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 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 378 // grunt加载的插件
348 379 grunt.loadNpmTasks("grunt-contrib-clean");
  380 + grunt.loadNpmTasks("grunt-contrib-concat");
349 381 grunt.loadNpmTasks("grunt-contrib-uglify");
350 382 grunt.loadNpmTasks("grunt-static-inline");
351 383 grunt.loadNpmTasks("grunt-text-replace");
... ... @@ -360,6 +392,14 @@ module.exports = function (grunt) {
360 392 3、replace 将指定的html文件复制到tmp目录下,将其中的js后缀名替换成.min.js
361 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 406 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html
... ... @@ -35,13 +35,6 @@
35 35 <form class="form-horizontal" novalidate name="myForm">
36 36 <div class="form-body">
37 37 <div class="form-group has-success has-feedback">
38   - <label class="col-md-2 control-label">所属公司*:</label>
39   - <div class="col-md-3">
40   - <input type="text" class="form-control" name="gsName"
41   - ng-model="ctrl.deviceInfoForDetail.gsName" readonly/>
42   - </div>
43   - </div>
44   - <div class="form-group has-success has-feedback">
45 38 <label class="col-md-2 control-label">车辆内部编号/自编号*:</label>
46 39 <div class="col-md-3">
47 40 <input type="text" class="form-control" name="clZbh"
... ... @@ -101,6 +94,15 @@
101 94 </div>
102 95 </div>
103 96  
  97 + <div class="form-group has-success has-feedback">
  98 + <label class="col-md-2 control-label">启用日期*:</label>
  99 + <div class="col-md-3">
  100 + <input type="text" class="form-control"
  101 + name="qyrq" uib-datepicker-popup="yyyy年MM月dd日"
  102 + ng-model="ctrl.deviceInfoForDetail.qyrq" readonly/>
  103 + </div>
  104 + </div>
  105 +
104 106 <!-- 其他form-group -->
105 107  
106 108 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js
1 1 // 设备信息维护 service controller 等写在一起
2 2  
3 3 angular.module('ScheduleApp').factory('DeviceInfoManageService', ['DeviceInfoManageService_g', function(service) {
4   - /** 公司字典 */
5   - var gses = [
6   - {gsdm: "55", gsmc: "上南公司"},
7   - {gsdm: "22", gsmc: "金高公司"},
8   - {gsdm: "05", gsmc: "杨高公司"},
9   - {gsdm: "26", gsmc: "南汇公司"}
10   - ];
11   -
12 4 /** 当前的查询条件信息 */
13 5 var currentSearchCondition = {};
14 6  
... ... @@ -17,12 +9,6 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;DeviceInfoManageService&#39;, [&#39;DeviceInfoMan
17 9  
18 10 return {
19 11 /**
20   - * 获取公司字典。
21   - */
22   - getGses: function() {
23   - return gses;
24   - },
25   - /**
26 12 * 获取查询条件信息,
27 13 * 用于给controller用来和页面数据绑定。
28 14 */
... ... @@ -71,6 +57,14 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;DeviceInfoManageService&#39;, [&#39;DeviceInfoMan
71 57 */
72 58 saveDetail: function(obj) {
73 59 return service.save(obj).$promise;
  60 + },
  61 + /**
  62 + * 删除信息。
  63 + * @param id 主键id
  64 + * @returns {*|Function|promise|n}
  65 + */
  66 + deleteDetail: function(id) {
  67 + return service.delete({id: id}).$promise;
74 68 }
75 69 };
76 70  
... ... @@ -130,7 +124,39 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;DeviceInfoManageListCtrl&#39;, [&#39;DeviceInf
130 124 };
131 125 // 重置查询条件
132 126 self.resetSearchCondition = function() {
133   - return deviceInfoManageService.resetSearchCondition();
  127 + deviceInfoManageService.resetSearchCondition();
  128 + self.pageInfo.currentPage = 1;
  129 + self.pageChanaged();
  130 + };
  131 +
  132 + // 作废/撤销
  133 + self.toggleCde = function(id) {
  134 + // TODO:
  135 + deviceInfoManageService.deleteDetail(id).then(
  136 + function(result) {
  137 + if (result.message) { // 暂时这样做,之后全局拦截
  138 + alert("失败:" + result.message);
  139 + } else {
  140 + alert("成功!");
  141 +
  142 + deviceInfoManageService.getPage().then(
  143 + function(result) {
  144 + self.pageInfo.totalItems = result.totalElements;
  145 + self.pageInfo.currentPage = result.number + 1;
  146 + self.pageInfo.infos = result.content;
  147 + deviceInfoManageService.setCurrentPageNo(result.number + 1);
  148 + },
  149 + function(result) {
  150 + alert("出错啦!");
  151 + }
  152 + );
  153 + }
  154 +
  155 + },
  156 + function(result) {
  157 + alert("出错啦!" + result);
  158 + }
  159 + );
134 160 };
135 161  
136 162 }]);
... ... @@ -138,20 +164,15 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;DeviceInfoManageListCtrl&#39;, [&#39;DeviceInf
138 164 angular.module('ScheduleApp').controller('DeviceInfoManageFormCtrl', ['DeviceInfoManageService', '$stateParams', '$state', function(deviceInfoManageService, $stateParams, $state) {
139 165 var self = this;
140 166  
  167 + // 启用日期 日期控件开关
  168 + self.qyrqOpen = false;
  169 + self.qyrq_open = function() {
  170 + self.qyrqOpen = true;
  171 + };
  172 +
141 173 // 欲保存的busInfo信息,绑定
142 174 self.deviceInfoForSave = {};
143 175  
144   - // 公司 selectedItem
145   - self.deviceInfoForSave.gs_selected = null;
146   - self.gses = deviceInfoManageService.getGses();
147   - self.gs_selected_change = function($item, $model) {
148   - self.deviceInfoForSave.gsName = $item.gsmc;
149   - };
150   - self.gs_selected_remove = function() {
151   - self.deviceInfoForSave.gs_selected = null;
152   - self.deviceInfoForSave.gsName = null;
153   - };
154   -
155 176 // 获取传过来的id,有的话就是修改,获取一遍数据
156 177 var id = $stateParams.id;
157 178 if (id) {
... ... @@ -214,7 +235,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;DeviceInfoManageDetailCtrl&#39;, [&#39;DeviceI
214 235 self.deviceInfoForDetail[key] = result[key];
215 236 }
216 237  
217   - self.title = "车辆 " + self.deviceInfoForDetail.clZbh + " 详细信息";
  238 + self.title = "车辆 " + self.deviceInfoForDetail.clZbh + "设备信息";
218 239 },
219 240 function(result) {
220 241 // TODO:弹出框方式以后改
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html
1 1 <div class="page-head">
2 2 <div class="page-title">
3   - <h1>修改车辆设备信息</h1>
  3 + <h1>添加车辆设备信息</h1>
4 4 </div>
5 5 </div>
6 6  
... ... @@ -33,54 +33,48 @@
33 33 <div class="portlet-body form">
34 34 <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
35 35 <div class="form-body">
36   - <div class="form-group has-success has-feedback">
37   - <label class="col-md-2 control-label">所属公司*:</label>
38   - <div class="col-md-3">
39   - <div class="input-group">
40   - <ui-select ng-model="ctrl.deviceInfoForSave.gs_selected"
41   - on-select="ctrl.gs_selected_change($item, $model)"
42   - theme="bootstrap" name="gs" required>
43   - <ui-select-match placeholder="请选择所属公司...">{{$select.selected.gsmc}}</ui-select-match>
44   - <ui-select-choices repeat="item in ctrl.gses">
45   - <span ng-bind="item.gsmc"></span>
46   - </ui-select-choices>
47   - </ui-select>
48   - <span class="input-group-btn">
49   - <button type="button" ng-click="ctrl.gs_selected_remove()" class="btn btn-default">
50   - <span class="glyphicon glyphicon-trash"></span>
51   - </button>
52   - </span>
53   - </div>
54   - </div>
55   - <!-- 隐藏块,显示验证信息 -->
56   - <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
57   - 公司必须选择
58   - </div>
59   - </div>
60 36  
61 37 <div class="form-group has-success has-feedback">
62   - <label class="col-md-2 control-label">车辆内部编号/自编号*:</label>
  38 + <label class="col-md-2 control-label">线路*:</label>
63 39 <div class="col-md-3">
64   - <input type="text" class="form-control"
65   - name="clZbh" ng-model="ctrl.deviceInfoForSave.clZbh"
66   - required placeholder="请输入车辆内部编号/自编号"/>
  40 + <sa-Select5 name="xl"
  41 + model="ctrl.deviceInfoForSave"
  42 + cmaps="{'xl': 'id', 'xlName': 'name', 'xlBm': 'lineCode'}"
  43 + dcname="xl"
  44 + icname="id"
  45 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'xl' } | json }}"
  46 + iterobjname="item"
  47 + iterobjexp="item.name"
  48 + searchph="请输拼音..."
  49 + searchexp="this.name"
  50 + required >
  51 + </sa-Select5>
67 52 </div>
68 53 <!-- 隐藏块,显示验证信息 -->
69   - <div class="alert alert-danger well-sm" ng-show="myForm.clZbh.$error.required">
70   - 车辆内部编号/自编号必须填写
  54 + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
  55 + 线路必须选择
71 56 </div>
72 57 </div>
73 58  
74 59 <div class="form-group has-success has-feedback">
75   - <label class="col-md-2 control-label">线路*:</label>
  60 + <label class="col-md-2 control-label">车辆:</label>
76 61 <div class="col-md-3">
77   - <input type="text" class="form-control"
78   - name="xlName" ng-model="ctrl.deviceInfoForSave.xlName"
79   - required placeholder="请输入线路"/>
  62 + <sa-Select5 name="cl"
  63 + model="ctrl.deviceInfoForSave"
  64 + cmaps="{'cl': 'id', 'clZbh': 'insideCode'}"
  65 + dcname="cl"
  66 + icname="id"
  67 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'cl' } | json }}"
  68 + iterobjname="item"
  69 + iterobjexp="item.insideCode"
  70 + searchph="请输拼音..."
  71 + searchexp="this.insideCode"
  72 + required >
  73 + </sa-Select5>
80 74 </div>
81 75 <!-- 隐藏块,显示验证信息 -->
82   - <div class="alert alert-danger well-sm" ng-show="myForm.xlName.$error.required">
83   - 线路必须填写
  76 + <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
  77 + 车辆必须选饿
84 78 </div>
85 79 </div>
86 80  
... ... @@ -142,6 +136,28 @@
142 136 </div>
143 137 </div>
144 138  
  139 + <div class="form-group has-success has-feedback">
  140 + <label class="col-md-2 control-label">启用日期*:</label>
  141 + <div class="col-md-3">
  142 + <div class="input-group">
  143 + <input type="text" class="form-control"
  144 + name="qyrq" placeholder="请选择启用日期..."
  145 + uib-datepicker-popup="yyyy年MM月dd日"
  146 + is-open="ctrl.qyrqOpen" required
  147 + ng-model="ctrl.deviceInfoForSave.qyrq" readonly/>
  148 + <span class="input-group-btn">
  149 + <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
  150 + <i class="glyphicon glyphicon-calendar"></i>
  151 + </button>
  152 + </span>
  153 + </div>
  154 + </div>
  155 + <!-- 隐藏块,显示验证信息 -->
  156 + <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">
  157 + 启用日期必须选择
  158 + </div>
  159 + </div>
  160 +
145 161 <!-- 其他form-group -->
146 162  
147 163 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html
... ... @@ -33,54 +33,48 @@
33 33 <div class="portlet-body form">
34 34 <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
35 35 <div class="form-body">
36   - <div class="form-group has-success has-feedback">
37   - <label class="col-md-2 control-label">所属公司*:</label>
38   - <div class="col-md-3">
39   - <div class="input-group">
40   - <ui-select ng-model="ctrl.deviceInfoForSave.gs_selected"
41   - on-select="ctrl.gs_selected_change($item, $model)"
42   - theme="bootstrap" name="gs" required>
43   - <ui-select-match placeholder="请选择所属公司...">{{$select.selected.gsmc}}</ui-select-match>
44   - <ui-select-choices repeat="item in ctrl.gses">
45   - <span ng-bind="item.gsmc"></span>
46   - </ui-select-choices>
47   - </ui-select>
48   - <span class="input-group-btn">
49   - <button type="button" ng-click="ctrl.gs_selected_remove()" class="btn btn-default">
50   - <span class="glyphicon glyphicon-trash"></span>
51   - </button>
52   - </span>
53   - </div>
54   - </div>
55   - <!-- 隐藏块,显示验证信息 -->
56   - <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
57   - 公司必须选择
58   - </div>
59   - </div>
60 36  
61 37 <div class="form-group has-success has-feedback">
62   - <label class="col-md-2 control-label">车辆内部编号/自编号*:</label>
  38 + <label class="col-md-2 control-label">线路*:</label>
63 39 <div class="col-md-3">
64   - <input type="text" class="form-control"
65   - name="clZbh" ng-model="ctrl.deviceInfoForSave.clZbh"
66   - required placeholder="请输入车辆内部编号/自编号"/>
  40 + <sa-Select5 name="xl"
  41 + model="ctrl.deviceInfoForSave"
  42 + cmaps="{'xl': 'id', 'xlName': 'name', 'xlBm': 'lineCode'}"
  43 + dcname="xl"
  44 + icname="id"
  45 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'xl' } | json }}"
  46 + iterobjname="item"
  47 + iterobjexp="item.name"
  48 + searchph="请输拼音..."
  49 + searchexp="this.name"
  50 + required >
  51 + </sa-Select5>
67 52 </div>
68 53 <!-- 隐藏块,显示验证信息 -->
69   - <div class="alert alert-danger well-sm" ng-show="myForm.clZbh.$error.required">
70   - 车辆内部编号/自编号必须填写
  54 + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
  55 + 线路必须选择
71 56 </div>
72 57 </div>
73 58  
74 59 <div class="form-group has-success has-feedback">
75   - <label class="col-md-2 control-label">线路*:</label>
  60 + <label class="col-md-2 control-label">车辆:</label>
76 61 <div class="col-md-3">
77   - <input type="text" class="form-control"
78   - name="xlName" ng-model="ctrl.deviceInfoForSave.xlName"
79   - required placeholder="请输入线路"/>
  62 + <sa-Select5 name="cl"
  63 + model="ctrl.deviceInfoForSave"
  64 + cmaps="{'cl': 'id', 'clZbh': 'insideCode'}"
  65 + dcname="cl"
  66 + icname="id"
  67 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'cl' } | json }}"
  68 + iterobjname="item"
  69 + iterobjexp="item.insideCode"
  70 + searchph="请输拼音..."
  71 + searchexp="this.insideCode"
  72 + required >
  73 + </sa-Select5>
80 74 </div>
81 75 <!-- 隐藏块,显示验证信息 -->
82   - <div class="alert alert-danger well-sm" ng-show="myForm.xlName.$error.required">
83   - 线路必须填写
  76 + <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
  77 + 车辆必须选饿
84 78 </div>
85 79 </div>
86 80  
... ... @@ -142,6 +136,28 @@
142 136 </div>
143 137 </div>
144 138  
  139 + <div class="form-group has-success has-feedback">
  140 + <label class="col-md-2 control-label">启用日期*:</label>
  141 + <div class="col-md-3">
  142 + <div class="input-group">
  143 + <input type="text" class="form-control"
  144 + name="qyrq" placeholder="请选择启用日期..."
  145 + uib-datepicker-popup="yyyy年MM月dd日"
  146 + is-open="ctrl.qyrqOpen" required
  147 + ng-model="ctrl.deviceInfoForSave.qyrq" readonly/>
  148 + <span class="input-group-btn">
  149 + <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
  150 + <i class="glyphicon glyphicon-calendar"></i>
  151 + </button>
  152 + </span>
  153 + </div>
  154 + </div>
  155 + <!-- 隐藏块,显示验证信息 -->
  156 + <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">
  157 + 启用日期必须选择
  158 + </div>
  159 + </div>
  160 +
145 161 <!-- 其他form-group -->
146 162  
147 163 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html
... ... @@ -35,7 +35,7 @@
35 35 <div class="btn-group">
36 36 <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
37 37 <i class="fa fa-share"></i>
38   - <span>系统工具</span>
  38 + <span>数据工具</span>
39 39 <i class="fa fa-angle-down"></i>
40 40 </a>
41 41 <ul class="dropdown-menu pull-right">
... ... @@ -45,13 +45,6 @@
45 45 导出excel
46 46 </a>
47 47 </li>
48   - <li class="divider"></li>
49   - <li>
50   - <a href="javascript:" class="tool-action">
51   - <i class="fa fa-refresh"></i>
52   - 刷行数据
53   - </a>
54   - </li>
55 48 </ul>
56 49 </div>
57 50 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html
... ... @@ -5,37 +5,40 @@
5 5 <thead>
6 6 <tr role="row" class="heading">
7 7 <th style="width: 40pt;">序号</th>
8   - <th >线路名称</th>
9   - <th>内部编号</th>
10   - <th>创建时间</th>
  8 + <th style="width: 15%;">线路名称</th>
  9 + <th style="width: 10%;">内部编号</th>
  10 + <th style="width: 100px;">启用日期</th>
11 11 <th>旧设备编号</th>
12 12 <th>新设备编号</th>
13 13 <th>旧SIM卡</th>
14 14 <th>新SIM卡</th>
15   - <th>操作时间</th>
16   - <th style="width: 115pt;">操作</th>
  15 + <th style="width: 180px;">创建时间</th>
  16 + <th style="width: 150pt;">操作</th>
17 17 </tr>
18 18 <tr role="row" class="filter">
19 19 <td></td>
20 20 <td>
21   - <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().xlName_like"/>
  21 + <sa-Select5 name="xl"
  22 + model="ctrl.searchCondition()"
  23 + cmaps="{'xl_eq': 'id'}"
  24 + dcname="xl_eq"
  25 + icname="id"
  26 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'xl' } | json }}"
  27 + iterobjname="item"
  28 + iterobjexp="item.name"
  29 + searchph="请输拼音..."
  30 + searchexp="this.name"
  31 + required >
  32 + </sa-Select5>
22 33 </td>
23 34 <td>
24   - <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().clZbh_like"/>
  35 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['clBm_like']" placeholder="输入内部编号..."/>
25 36 </td>
26 37 <td></td>
27   - <td>
28   - <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().oldDeviceNo_like"/>
29   - </td>
30   - <td>
31   - <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().newDeviceNo_like"/>
32   - </td>
33   - <td>
34   - <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().oldSimNo_like"/>
35   - </td>
36   - <td>
37   - <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().newSimNo_like"/>
38   - </td>
  38 + <td></td>
  39 + <td></td>
  40 + <td></td>
  41 + <td></td>
39 42 <td></td>
40 43 <td>
41 44 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
... ... @@ -50,7 +53,7 @@
50 53 </tr>
51 54 </thead>
52 55 <tbody>
53   - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
  56 + <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
54 57 <td>
55 58 <span ng-bind="$index + 1"></span>
56 59 </td>
... ... @@ -61,7 +64,7 @@
61 64 <span ng-bind="info.clZbh"></span>
62 65 </td>
63 66 <td>
64   - <span ng-bind="info.createDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
  67 + <span ng-bind="info.qyrq | date:'yyyy-MM-dd'"></span>
65 68 </td>
66 69 <td>
67 70 <span ng-bind="info.oldDeviceNo"></span>
... ... @@ -76,13 +79,15 @@
76 79 <span ng-bind="info.newSimNo"></span>
77 80 </td>
78 81 <td>
79   - <span ng-bind="info.updateDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
  82 + <span ng-bind="info.createDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
80 83 </td>
81 84 <td>
82 85 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
83 86 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
84 87 <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
85   - <a ui-sref="deviceInfoManage_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a>
  88 + <a ui-sref="deviceInfoManage_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  89 + <a ng-click="ctrl.toggleCde(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  90 + <a ng-click="ctrl.toggleCde(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
86 91 </td>
87 92 </tr>
88 93 </tbody>
... ...
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 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   -/**
2   - * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
3   - * name(必须):控件的名字
4   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
5   - * placeholder(可选):输入框占位符字符串
6   - *
7   - * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
8   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
9   - * icname(必须):内部与之对应的字段名,如:icname=code
10   - *
11   - * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}
12   - * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
13   - * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name
14   - * required(可选):是否要用required验证
15   - */
16   -angular.module('ScheduleApp').directive('saSelect4', [
17   - '$timeout',
18   - '$$SearchInfoService_g',
19   - function($timeout, $$searchInfoService_g) {
20   - return {
21   - restrict: 'E',
22   - templateUrl: '/pages/scheduleApp/module/common/dts1/select/MyUISelectWrapTemplate2.html',
23   - scope: {
24   - model: "=" // 独立作用域,关联外部的模型object
25   - },
26   - controllerAs: "$saSelectCtrl",
27   - bindToController: true,
28   - controller: function($scope) {
29   - var self = this;
30   - self.$$data = []; // ui-select显示用的数据
31   - self.$$data_real = []; // 内部真实的数据
32   -
33   - // saSelect4组件的ng-model,用于外部绑定验证等操作
34   - self.$$internalmodel = undefined;
35   -
36   - self.$$internal_select_value = undefined; // 选中的值
37   - },
38   -
39   - /**
40   - * 此阶段可以改dom结构,此时angular还没扫描指令,
41   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
42   - * @param tElem
43   - * @param tAttrs
44   - * @returns {{pre: Function, post: Function}}
45   - */
46   - compile: function(tElem, tAttrs) {
47   - // 获取属性
48   - var $name_attr = tAttrs["name"]; // 控件的名字
49   - var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
50   -
51   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
52   - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
53   -
54   - var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射
55   - var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息
56   - var $required_attr = tAttrs["required"]; // 是否需要required验证
57   -
58   - // controlAs名字
59   - var ctrlAs = "$saSelectCtrl";
60   -
61   - // 验证属性
62   - if (!$name_attr) {
63   - throw new error("name属性必须填写");
64   - }
65   - if (!$dcname_attr) {
66   - throw new error("dcname属性必须填写");
67   - }
68   - if (!$icname_attr) {
69   - throw new error("icname属性必须填写");
70   - }
71   - if (!$dscol_attr) {
72   - throw new error("dscol属性必须填写");
73   - }
74   -
75   - // 动态设置dom
76   - // dom required 属性
77   - if ($required_attr != undefined) {
78   - tElem.find("div").attr("required", "");
79   - }
80   - // dom placeholder 属性
81   - tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
82   - // dom dscol 属性
83   - tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");
84   - tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);
85   - // dom icname 属性
86   - tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
87   - // dom name 属性
88   - tElem.find("div").attr("name", $name_attr);
89   -
90   - return {
91   - pre: function(scope, element, attr) {
92   - // TODO:
93   - },
94   -
95   - /**
96   - * 相当于link函数。
97   - * @param scope
98   - * @param element
99   - * @param attr
100   - */
101   - post: function(scope, element, attr) {
102   -
103   - // 添加选中事件处理函数
104   - scope[ctrlAs].$$internal_select_fn = function($item) {
105   - if ($dcname_attr && $icname_attr) {
106   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
107   - }
108   -
109   - if ($cmaps_attr) {
110   - for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名
111   - var ic = $cmaps_attr[mc]; // 内部数据源对应字段
112   - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
113   - }
114   - }
115   - };
116   -
117   - // 删除选中事件处理函数
118   - scope[ctrlAs].$$internal_remove_fn = function() {
119   - scope[ctrlAs].$$internal_select_value = undefined;
120   - if ($dcname_attr) {
121   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
122   - }
123   -
124   - if ($cmaps_attr) {
125   - var mc; // model的字段名
126   - for (mc in $cmaps_attr) {
127   - eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
128   - }
129   - }
130   - scope[ctrlAs].$$internal_validate_model();
131   - };
132   -
133   - // 刷新数据
134   - scope[ctrlAs].$$internal_refresh_fn = function(search) {
135   - if (search && search != "") { // 有search值
136   - // 处理search
137   - console.log("search:" + search);
138   -
139   - scope[ctrlAs].$$data = [];
140   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
141   - var upTerm = search.toUpperCase();
142   - if (scope[ctrlAs].$$data.length < 10) {
143   - if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
144   - || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
145   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
146   - }
147   - } else {
148   - break;
149   - }
150   - }
151   - }
152   - };
153   -
154   - /**
155   - * 验证内部数据,更新外部model
156   - */
157   - scope[ctrlAs].$$internal_validate_model = function() {
158   - if (scope[ctrlAs].$$internal_select_value) {
159   - var select_value_temp = scope[ctrlAs].$$internal_select_value;
160   - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
161   - var obj;
162   - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
163   - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
164   - obj = angular.copy(scope[ctrlAs].$$data_real[j]);
165   - break;
166   - }
167   - }
168   - if (obj) { // 在data中判定有没有
169   - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
170   - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
171   - obj = undefined;
172   - break;
173   - }
174   - }
175   - if (obj) {
176   - scope[ctrlAs].$$data.push(obj);
177   - }
178   - // 更新内部model,用于外部验证
179   - // 内部model的值暂时随意,以后再改
180   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
181   - } else {
182   - scope[ctrlAs].$$internalmodel = undefined;
183   - }
184   -
185   - } else {
186   - scope[ctrlAs].$$internalmodel = undefined;
187   - }
188   -
189   - } else {
190   - scope[ctrlAs].$$internalmodel = undefined;
191   - }
192   - };
193   -
194   - /**
195   - * 内部方法,读取字典数据作为数据源。
196   - * @param atype ajax查询类型
197   - * @param ajaxparamobj 查询参数对象
198   - */
199   - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
200   - ajaxparamobj.type = 'all';
201   - $$searchInfoService_g[atype].list(
202   - ajaxparamobj,
203   - function(result) {
204   - console.log("$$internal_ajax_data result");
205   -
206   - // 清空内部数据
207   - scope[ctrlAs].$$data_real = [];
208   - scope[ctrlAs].$$data = [];
209   -
210   - // result中添加拼音数据,注意:这里要求result返回对象数组
211   - for (var i = 0; i < result.length; i ++) {
212   - if ($dscol_attr) {
213   - if (eval("result[i]" + "." + $dscol_attr)) {
214   - // 全拼
215   - result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();
216   - // 简拼
217   - result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));
218   - }
219   - }
220   -
221   - if (result[i]["fullChars"]) { // 有拼音的加入数据源
222   - scope[ctrlAs].$$data_real.push(result[i]);
223   - }
224   -
225   - }
226   -
227   - // 数据量太大,取10条记录显示
228   - if (angular.isArray(scope[ctrlAs].$$data_real)) {
229   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
230   - if (scope[ctrlAs].$$data.length < 10) {
231   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
232   - } else {
233   - break;
234   - }
235   - }
236   - }
237   -
238   - scope[ctrlAs].$$internal_validate_model();
239   - },
240   - function(result) {
241   -
242   - }
243   - );
244   - };
245   -
246   - /**
247   - * 内部方法,读取字典数据作为数据源。
248   - * @param dictype 字典类型,如:gsType
249   - */
250   - scope[ctrlAs].$$internal_dic_data = function(dictype) {
251   - if (!dictionaryUtils.getByGroup(dictype)) {
252   - throw new error("字典数据不窜在=" + dictype);
253   - }
254   -
255   - // 清空内部数据
256   - scope[ctrlAs].$$data_real = [];
257   - scope[ctrlAs].$$data = [];
258   -
259   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
260   - var dic_key; // 字典key
261   -
262   - for (dic_key in origin_dicgroup) {
263   - var data = {}; // 重新组合的字典元素对象
264   - if (dic_key == "true")
265   - data[$icname_attr] = true;
266   - else
267   - data[$icname_attr] = dic_key;
268   - data[$dscol_attr] = origin_dicgroup[dic_key];
269   - scope[ctrlAs].$$data_real.push(data);
270   - }
271   - // 这里直接将$$data_real数据深拷贝到$$data
272   - angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
273   - scope[ctrlAs].$$internal_validate_model();
274   - };
275   -
276   - attr.$observe("dsparams", function(value) {
277   - if (value && value != "") {
278   - var obj = JSON.parse(value);
279   - console.log("observe 监控 dsparams=" + obj);
280   -
281   - // dsparams格式如下:
282   - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
283   -
284   - if (obj.type == 'dic') {
285   - scope[ctrlAs].$$internal_dic_data(obj.param);
286   -
287   - } else if (obj.type == 'ajax') {
288   - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
289   - } else {
290   - throw new Error("dsparams参数格式异常=" + obj);
291   - }
292   -
293   - }
294   -
295   - });
296   -
297   - // 监控model绑定的dcvalue值变化
298   - attr.$observe("dcvalue", function(value) {
299   - if (value && value != "") {
300   - console.log("observe 监控 dcvalue=" + value);
301   - scope[ctrlAs].$$internal_select_value = value;
302   - scope[ctrlAs].$$internal_validate_model();
303   - }
304   - });
305   - }
306   - };
307   -
308   - }
309   -
310   - };
311   - }
  1 +/**
  2 + * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
  3 + * name(必须):控件的名字
  4 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  5 + * placeholder(可选):输入框占位符字符串
  6 + *
  7 + * dcvalue(必须):绑定的model字段值,如:dcvalue={{ctrl.employeeInfoForSave.xl.id}}
  8 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  9 + * icname(必须):内部与之对应的字段名,如:icname=code
  10 + *
  11 + * cmaps(可选):model其他字段和内部数据字段名映射,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}
  12 + * dsparams(必须):内部数据源查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  13 + * dscol(必须):内部显示的信息(暂时用内部字段),如:dscol=name
  14 + * required(可选):是否要用required验证
  15 + */
  16 +angular.module('ScheduleApp').directive('saSelect4', [
  17 + '$timeout',
  18 + '$$SearchInfoService_g',
  19 + function($timeout, $$searchInfoService_g) {
  20 + return {
  21 + restrict: 'E',
  22 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect4Template.html',
  23 + scope: {
  24 + model: "=" // 独立作用域,关联外部的模型object
  25 + },
  26 + controllerAs: "$saSelectCtrl",
  27 + bindToController: true,
  28 + controller: function($scope) {
  29 + var self = this;
  30 + self.$$data = []; // ui-select显示用的数据
  31 + self.$$data_real = []; // 内部真实的数据
  32 +
  33 + // saSelect4组件的ng-model,用于外部绑定验证等操作
  34 + self.$$internalmodel = undefined;
  35 +
  36 + self.$$internal_select_value = undefined; // 选中的值
  37 + },
  38 +
  39 + /**
  40 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  41 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  42 + * @param tElem
  43 + * @param tAttrs
  44 + * @returns {{pre: Function, post: Function}}
  45 + */
  46 + compile: function(tElem, tAttrs) {
  47 + // 获取属性
  48 + var $name_attr = tAttrs["name"]; // 控件的名字
  49 + var $placeholder_attr = tAttrs["placeholder"]; // 占位符的名字
  50 +
  51 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  52 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  53 +
  54 + var $cmaps_attr = tAttrs["cmaps"]; // model其他字段和内部数据字段名映射
  55 + var $dscol_attr = tAttrs["dscol"]; // 内部显示的信息
  56 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  57 +
  58 + // controlAs名字
  59 + var ctrlAs = "$saSelectCtrl";
  60 +
  61 + // 验证属性
  62 + if (!$name_attr) {
  63 + throw new error("name属性必须填写");
  64 + }
  65 + if (!$dcname_attr) {
  66 + throw new error("dcname属性必须填写");
  67 + }
  68 + if (!$icname_attr) {
  69 + throw new error("icname属性必须填写");
  70 + }
  71 + if (!$dscol_attr) {
  72 + throw new error("dscol属性必须填写");
  73 + }
  74 +
  75 + // 动态设置dom
  76 + // dom required 属性
  77 + if ($required_attr != undefined) {
  78 + tElem.find("div").attr("required", "");
  79 + }
  80 + // dom placeholder 属性
  81 + tElem.find("ui-select-match").attr("placeholder", $placeholder_attr);
  82 + // dom dscol 属性
  83 + tElem.find("ui-select-match").html("{{$select.selected" + "." + $dscol_attr + "}}");
  84 + tElem.find("ui-select-choices span").attr("ng-bind", "item" + "." + $dscol_attr);
  85 + // dom icname 属性
  86 + tElem.find("ui-select-choices").attr("repeat", "item" + "." + $icname_attr + " as item in $saSelectCtrl.$$data");
  87 + // dom name 属性
  88 + tElem.find("div").attr("name", $name_attr);
  89 +
  90 + return {
  91 + pre: function(scope, element, attr) {
  92 + // TODO:
  93 + },
  94 +
  95 + /**
  96 + * 相当于link函数。
  97 + * @param scope
  98 + * @param element
  99 + * @param attr
  100 + */
  101 + post: function(scope, element, attr) {
  102 +
  103 + // 添加选中事件处理函数
  104 + scope[ctrlAs].$$internal_select_fn = function($item) {
  105 + if ($dcname_attr && $icname_attr) {
  106 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  107 + }
  108 +
  109 + if ($cmaps_attr) {
  110 + for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名
  111 + var ic = $cmaps_attr[mc]; // 内部数据源对应字段
  112 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  113 + }
  114 + }
  115 + };
  116 +
  117 + // 删除选中事件处理函数
  118 + scope[ctrlAs].$$internal_remove_fn = function() {
  119 + scope[ctrlAs].$$internal_select_value = undefined;
  120 + if ($dcname_attr) {
  121 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  122 + }
  123 +
  124 + if ($cmaps_attr) {
  125 + var mc; // model的字段名
  126 + for (mc in $cmaps_attr) {
  127 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  128 + }
  129 + }
  130 + scope[ctrlAs].$$internal_validate_model();
  131 + };
  132 +
  133 + // 刷新数据
  134 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  135 + if (search && search != "") { // 有search值
  136 + // 处理search
  137 + console.log("search:" + search);
  138 +
  139 + scope[ctrlAs].$$data = [];
  140 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  141 + var upTerm = search.toUpperCase();
  142 + if (scope[ctrlAs].$$data.length < 10) {
  143 + if (scope[ctrlAs].$$data_real[k].fullChars.indexOf(upTerm) != -1
  144 + || scope[ctrlAs].$$data_real[k].camelChars.indexOf(upTerm) != -1) {
  145 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  146 + }
  147 + } else {
  148 + break;
  149 + }
  150 + }
  151 + }
  152 + };
  153 +
  154 + /**
  155 + * 验证内部数据,更新外部model
  156 + */
  157 + scope[ctrlAs].$$internal_validate_model = function() {
  158 + if (scope[ctrlAs].$$internal_select_value) {
  159 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  160 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  161 + var obj;
  162 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  163 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  164 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  165 + break;
  166 + }
  167 + }
  168 + if (obj) { // 在data中判定有没有
  169 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  170 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  171 + obj = undefined;
  172 + break;
  173 + }
  174 + }
  175 + if (obj) {
  176 + scope[ctrlAs].$$data.push(obj);
  177 + }
  178 + // 更新内部model,用于外部验证
  179 + // 内部model的值暂时随意,以后再改
  180 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  181 + } else {
  182 + scope[ctrlAs].$$internalmodel = undefined;
  183 + }
  184 +
  185 + } else {
  186 + scope[ctrlAs].$$internalmodel = undefined;
  187 + }
  188 +
  189 + } else {
  190 + scope[ctrlAs].$$internalmodel = undefined;
  191 + }
  192 + };
  193 +
  194 + /**
  195 + * 内部方法,读取字典数据作为数据源。
  196 + * @param atype ajax查询类型
  197 + * @param ajaxparamobj 查询参数对象
  198 + */
  199 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  200 + ajaxparamobj.type = 'all';
  201 + $$searchInfoService_g[atype].list(
  202 + ajaxparamobj,
  203 + function(result) {
  204 + console.log("$$internal_ajax_data result");
  205 +
  206 + // 清空内部数据
  207 + scope[ctrlAs].$$data_real = [];
  208 + scope[ctrlAs].$$data = [];
  209 +
  210 + // result中添加拼音数据,注意:这里要求result返回对象数组
  211 + for (var i = 0; i < result.length; i ++) {
  212 + if ($dscol_attr) {
  213 + if (eval("result[i]" + "." + $dscol_attr)) {
  214 + // 全拼
  215 + result[i]["fullChars"] = pinyin.getFullChars(eval("result[i]" + "." + $dscol_attr)).toUpperCase();
  216 + // 简拼
  217 + result[i]["camelChars"] = pinyin.getCamelChars(eval("result[i]" + "." + $dscol_attr));
  218 + }
  219 + }
  220 +
  221 + if (result[i]["fullChars"]) { // 有拼音的加入数据源
  222 + scope[ctrlAs].$$data_real.push(result[i]);
  223 + }
  224 +
  225 + }
  226 +
  227 + // 数据量太大,取10条记录显示
  228 + if (angular.isArray(scope[ctrlAs].$$data_real)) {
  229 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  230 + if (scope[ctrlAs].$$data.length < 10) {
  231 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  232 + } else {
  233 + break;
  234 + }
  235 + }
  236 + }
  237 +
  238 + scope[ctrlAs].$$internal_validate_model();
  239 + },
  240 + function(result) {
  241 +
  242 + }
  243 + );
  244 + };
  245 +
  246 + /**
  247 + * 内部方法,读取字典数据作为数据源。
  248 + * @param dictype 字典类型,如:gsType
  249 + */
  250 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  251 + if (!dictionaryUtils.getByGroup(dictype)) {
  252 + throw new error("字典数据不窜在=" + dictype);
  253 + }
  254 +
  255 + // 清空内部数据
  256 + scope[ctrlAs].$$data_real = [];
  257 + scope[ctrlAs].$$data = [];
  258 +
  259 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  260 + var dic_key; // 字典key
  261 +
  262 + for (dic_key in origin_dicgroup) {
  263 + var data = {}; // 重新组合的字典元素对象
  264 + if (dic_key == "true")
  265 + data[$icname_attr] = true;
  266 + else
  267 + data[$icname_attr] = dic_key;
  268 + data[$dscol_attr] = origin_dicgroup[dic_key];
  269 + scope[ctrlAs].$$data_real.push(data);
  270 + }
  271 + // 这里直接将$$data_real数据深拷贝到$$data
  272 + angular.copy(scope[ctrlAs].$$data_real, scope[ctrlAs].$$data);
  273 + scope[ctrlAs].$$internal_validate_model();
  274 + };
  275 +
  276 + attr.$observe("dsparams", function(value) {
  277 + if (value && value != "") {
  278 + var obj = JSON.parse(value);
  279 + console.log("observe 监控 dsparams=" + obj);
  280 +
  281 + // dsparams格式如下:
  282 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
  283 +
  284 + if (obj.type == 'dic') {
  285 + scope[ctrlAs].$$internal_dic_data(obj.param);
  286 +
  287 + } else if (obj.type == 'ajax') {
  288 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  289 + } else {
  290 + throw new Error("dsparams参数格式异常=" + obj);
  291 + }
  292 +
  293 + }
  294 +
  295 + });
  296 +
  297 + // 监控model绑定的dcvalue值变化
  298 + attr.$observe("dcvalue", function(value) {
  299 + if (value && value != "") {
  300 + console.log("observe 监控 dcvalue=" + value);
  301 + scope[ctrlAs].$$internal_select_value = value;
  302 + scope[ctrlAs].$$internal_validate_model();
  303 + }
  304 +
  305 + // 闭包测试
  306 + var obj = {'a':1,'b':2};
  307 + var tfx = scope[ctrlAs].$$test.bind(obj);
  308 + console.log("闭包测试=" + tfx());
  309 + });
  310 +
  311 + scope[ctrlAs].$$test = function() {
  312 + var exp = "this.a + '(' + this.b + ')'";
  313 + console.log("exp=" + exp);
  314 + return eval(exp);
  315 + };
  316 + }
  317 + };
  318 +
  319 + }
  320 +
  321 + };
  322 + }
312 323 ]);
313 324 \ No newline at end of file
... ...
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   - * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
3   - * name(必须):控件的名字
4   - * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave
5   - * cmaps(必须):外部对象与指令内部数据对象字段名映射对象,如:{{ {'xl.id' : 'id', 'xl.name' : 'name'} | json}}
6   - * dcname(必须):绑定的model字段名,如:dcname=xl.id
7   - * icname(必须):内部与之对应的字段名,如:icname=id
8   - *
9   - * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
10   - * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item
11   - * iterobjexp(必须):内部显示用的表达式
12   - * searchph(必须):查询输入占位符字符串,如:searchph=请输入...
13   - * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'
14   - *
15   - * required(可选):是否需要form的required验证
16   - *
17   - */
18   -angular.module('ScheduleApp').directive('saSelect5', [
19   - '$timeout',
20   - '$$SearchInfoService_g',
21   - function($timeout, $$searchInfoService_g) {
22   - return {
23   - restrict: 'E',
24   - templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
25   - scope: { // 独立作用域
26   - model: "=" // 绑定外部对象
27   - },
28   - controllerAs: "$saSelectCtrl",
29   - bindToController: true,
30   - controller: function($scope) {
31   - var self = this;
32   - self.$$data = []; // 内部ui-select显示用数据
33   - self.$$data_real = []; // 内部保存的实际数据
34   -
35   - // myselect组件的ng-model,用于外部绑定验证等操作
36   - self.$$internalmodel = undefined;
37   -
38   - self.$$internal_select_value = undefined; // 选中的值
39   -
40   - },
41   -
42   - /**
43   - * 此阶段可以改dom结构,此时angular还没扫描指令,
44   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
45   - * @param tElem
46   - * @param tAttrs
47   - * @returns {{pre: Function, post: Function}}
48   - */
49   - compile: function(tElem, tAttrs) {
50   - // 获取属性,并验证必须按属性
51   - var $name_attr = tAttrs["name"]; // 控件的名字
52   - var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象
53   - var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
54   - var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
55   -
56   - var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象
57   - var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名
58   - var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式
59   - var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串
60   - var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式
61   -
62   - var $required_attr = tAttrs["required"]; // 是否需要required验证
63   -
64   - if (!$name_attr) {
65   - throw new Error("name属性必须填写");
66   - }
67   - if (!$cmaps_attr) {
68   - throw new Error("cmaps属性必须填写")
69   - }
70   - if (!$dcname_attr || !$icname_attr) {
71   - throw new Error("dcname、icname属性必须填写");
72   - }
73   - if (!$dsparams_attr) {
74   - throw new Error("dsparams属性必须填写");
75   - }
76   - if (!$iterobjname_attr) {
77   - throw new Error("iterobjname属性必须填写");
78   - }
79   - if (!$iterobjexp_attr) {
80   - throw new Error("iterobjexp属性必须填写");
81   - }
82   - if (!$searchph_attr) {
83   - throw new Error("searchph属性必须填写");
84   - }
85   - if (!$searchexp_attr) {
86   - throw new Error("searchexp属性必须填写");
87   - }
88   -
89   - // 内部controlAs名字
90   - var ctrlAs = "$saSelectCtrl";
91   -
92   - // 动态设置dom
93   - // dom,最外层name属性设置
94   - tElem.find("div:first").attr("name", $name_attr);
95   - // dom,最外层divrequired属性设置
96   - if ($required_attr != undefined) {
97   - tElem.find("div[name=\'" + $name_attr + "\']").attr("required", "");
98   - }
99   - // dom,ui-select-match的placeholder属性设定
100   - tElem.find("ui-select-match").attr("placeholder", $searchph_attr);
101   - // dom,ui-select-match的内容设定
102   - var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";
103   - tElem.find("ui-select-match").html(uiSelectMatchHtml);
104   - // dom,ui-select-choices的repeat属性设定
105   - var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";
106   - tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);
107   - // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
108   - tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
109   -
110   - return {
111   - pre: function (scope, element, attr) {
112   - // TODO:
113   - },
114   -
115   - /**
116   - * 相当于link函数。
117   - * @param scope
118   - * @param element
119   - * @param attr
120   - */
121   - post: function (scope, element, attr) {
122   -
123   - // 添加选中事件处理函数
124   - scope[ctrlAs].$$internal_select_fn = function($item) {
125   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
126   -
127   - for (var mc in $cmaps_attr) { // model的字段名:内部数据源对应字段名
128   - var ic = $cmaps_attr[mc]; // 内部数据源对应字段
129   - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
130   - }
131   - };
132   -
133   - // 删除选中事件处理函数
134   - scope[ctrlAs].$$internal_remove_fn = function() {
135   - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
136   -
137   - var mc; // model的字段名
138   - for (mc in $cmaps_attr) {
139   - eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
140   - }
141   - };
142   -
143   - // 刷新数据
144   - scope[ctrlAs].$$internal_refresh_fn = function(search) {
145   - if (search && search != "") { // 有search值
146   - // 处理search
147   - console.log("search:" + search);
148   -
149   - scope[ctrlAs].$$data = [];
150   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
151   - var upTerm = search.toUpperCase();
152   - if (scope[ctrlAs].$$data.length < 10) {
153   - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
154   - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
155   - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
156   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
157   - }
158   - } else {
159   - break;
160   - }
161   - }
162   - }
163   - };
164   -
165   - /**
166   - * 验证内部数据,更新外部model
167   - */
168   - scope[ctrlAs].$$internal_validate_model = function() {
169   - if (scope[ctrlAs].$$internal_select_value) {
170   - var select_value_temp = scope[ctrlAs].$$internal_select_value;
171   - if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
172   - var obj;
173   - for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
174   - if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
175   - obj = angular.copy(scope[ctrlAs].$$data_real[j]);
176   - break;
177   - }
178   - }
179   - if (obj) { // 在data中判定有没有
180   - for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
181   - if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
182   - obj = undefined;
183   - break;
184   - }
185   - }
186   - if (obj) {
187   - scope[ctrlAs].$$data.push(obj);
188   - }
189   - // 更新内部model,用于外部验证
190   - // 内部model的值暂时随意,以后再改
191   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
192   - } else {
193   - scope[ctrlAs].$$internalmodel = undefined;
194   - }
195   -
196   - } else {
197   - scope[ctrlAs].$$internalmodel = undefined;
198   - }
199   -
200   - } else {
201   - scope[ctrlAs].$$internalmodel = undefined;
202   - }
203   - };
204   -
205   - /**
206   - * 内部match表达式转换函数,需要外部绑定此函数的上下文。
207   - * @param context function上下文
208   - */
209   - scope[ctrlAs].$$internal_match_str = function (context) {
210   - var fx = function() {
211   - return eval($searchexp_attr);
212   - };
213   -
214   - var str = fx.bind(context)();
215   - if (str && str != "")
216   - return str;
217   - else
218   - return undefined;
219   - };
220   -
221   - /**
222   - * 内部方法,读取字典数据作为数据源。
223   - * @param atype ajax查询类型
224   - * @param ajaxparamobj 查询参数对象
225   - */
226   - scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
227   - ajaxparamobj.type = 'all';
228   - $$searchInfoService_g[atype].list(
229   - ajaxparamobj,
230   - function(result) {
231   - console.log("$$internal_ajax_data result");
232   -
233   - // 重新创建内部保存的数据
234   - scope[ctrlAs].$$data = [];
235   - // result中添加拼音数据,注意:这里要求result返回对象数组
236   - for (var i = 0; i < result.length; i ++) {
237   - // 闭包绑定返回最终查询的值
238   - var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
239   - if (calcu_str) {
240   - // 全拼
241   - result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
242   - // 简拼
243   - result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
244   - // 原值
245   - result[i]["$calcu_str"] = calcu_str;
246   -
247   - scope[ctrlAs].$$data_real.push(result[i]);
248   - }
249   - }
250   -
251   - // 重新创建内部ui-select显示用数据,默认取10条记录显示
252   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
253   - if (scope[ctrlAs].$$data.length < 10) {
254   - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
255   - } else {
256   - break;
257   - }
258   - }
259   -
260   - scope[ctrlAs].$$internal_validate_model();
261   - },
262   - function(result) {
263   - throw new Error("ajax查询出错");
264   - }
265   - );
266   - };
267   -
268   - /**
269   - * 内部方法,读取字典数据作为数据源。
270   - * @param dictype 字典类型,如:gsType
271   - */
272   - scope[ctrlAs].$$internal_dic_data = function(dictype) {
273   - if (!dictionaryUtils.getByGroup(dictype)) {
274   - throw new error("字典数据不窜在=" + dictype);
275   - }
276   -
277   - // 重新创建内部保存的数据
278   - scope[ctrlAs].$$data_real = [];
279   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
280   - var dic_key; // 字典key
281   -
282   - for (dic_key in origin_dicgroup) {
283   - var data = {}; // 重新组合的字典元素对象
284   - if (dic_key == "true")
285   - data[$icname_attr] = true;
286   - else
287   - data[$icname_attr] = dic_key;
288   - data[$dscol_attr] = origin_dicgroup[dic_key];
289   - scope[ctrlAs].$$data_real.push(data);
290   - }
291   -
292   - // 重新创建内部ui-select显示用数据,直接复制所有的字典数据
293   - scope[ctrlAs].$$data = [];
294   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
295   - scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
296   - }
297   -
298   - scope[ctrlAs].$$internal_validate_model();
299   - };
300   -
301   - /**
302   - * 监控dsparams属性变化
303   - */
304   - attr.$observe("dsparams", function(value) {
305   - if (value && value != "") {
306   - var obj = JSON.parse(value);
307   - console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
308   -
309   - // dsparams格式如下:
310   - // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
311   -
312   - if (obj.type == 'dic') {
313   - scope[ctrlAs].$$internal_dic_data(obj.param);
314   -
315   - } else if (obj.type == 'ajax') {
316   - scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
317   - } else {
318   - throw new Error("dsparams参数格式异常=" + obj);
319   - }
320   -
321   - }
322   - });
323   -
324   - /**
325   - * 监控外部模型dcname的值的变化。
326   - */
327   - scope.$watch(
328   - function() {
329   - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
330   - },
331   - function(newValue, oldValue) {
332   - if (newValue === undefined && oldValue === undefined) {
333   - // 两侧都是undefined,不处理
334   -
335   - } else {
336   - console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);
337   - scope[ctrlAs].$$internal_select_value = newValue;
338   - scope[ctrlAs].$$internal_validate_model();
339   - }
340   - },
341   - true
342   - );
343   - }
344   - };
345   - }
346   - };
347   - }
  1 +/**
  2 + * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
  3 + * name(必须):控件的名字
  4 + * model(必须):独立作用域,指定一个外部对象模型双向绑定,如:model=ctrl.employeeInfoForSave
  5 + * cmaps(必须):外部对象与指令内部数据对象字段名映射对象字符串,如:{'xl.id' : 'id', 'xl.name' : 'name'}
  6 + * dcname(必须):绑定的model字段名,如:dcname=xl.id
  7 + * icname(必须):内部与之对应的字段名,如:icname=id
  8 + *
  9 + * dsparams(必须):内部数据源查询参数对象,如:{{ {'ttid_eq': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  10 + * dsparamsextra(可选):内部数据源查询附加参数对象字符串,如:{'type':'all'}
  11 + * iterobjname(必须):内部数据源迭代的数据变量名,如:iterobjname=item
  12 + * iterobjexp(必须):内部显示用的表达式
  13 + * searchph(必须):查询输入占位符字符串,如:searchph=请输入...
  14 + * searchexp(必须):查询基于的内部数据源的表达式,如:searchexp=this.name+'('+this.code+')'
  15 + *
  16 + * required(可选):是否需要form的required验证
  17 + *
  18 + */
  19 +angular.module('ScheduleApp').directive('saSelect5', [
  20 + '$timeout',
  21 + '$$SearchInfoService_g',
  22 + function($timeout, $$searchInfoService_g) {
  23 + return {
  24 + restrict: 'E',
  25 + templateUrl: '/pages/scheduleApp/module/common/dts1/select/saSelect5Template.html',
  26 + scope: { // 独立作用域
  27 + model: "=" // 绑定外部对象
  28 + },
  29 + controllerAs: "$saSelectCtrl",
  30 + bindToController: true,
  31 + controller: function($scope) {
  32 + var self = this;
  33 + self.$$data = []; // 内部ui-select显示用数据
  34 + self.$$data_real = []; // 内部保存的实际数据
  35 +
  36 + // myselect组件的ng-model,用于外部绑定验证等操作
  37 + self.$$internalmodel = undefined;
  38 +
  39 + self.$$internal_select_value = undefined; // 选中的值
  40 +
  41 + },
  42 +
  43 + /**
  44 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  45 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  46 + * @param tElem
  47 + * @param tAttrs
  48 + * @returns {{pre: Function, post: Function}}
  49 + */
  50 + compile: function(tElem, tAttrs) {
  51 + // 获取属性,并验证必须按属性
  52 + var $name_attr = tAttrs["name"]; // 控件的名字
  53 + var $cmaps_attr = tAttrs["cmaps"]; // 外部对象与指令内部数据对象字段名映射对象
  54 + var $dcname_attr = tAttrs["dcname"]; // 绑定的model字段名
  55 + var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
  56 +
  57 + var $dsparams_attr = tAttrs["dsparams"]; // 内部数据源查询参数对象
  58 + var $dsparamsextra_attr = tAttrs["dsparamsextra"]; // 内部数据源查询附加参数对象字符串
  59 + var $iterobjname_attr = tAttrs["iterobjname"]; // 内部数据源迭代的数据变量名
  60 + var $iterobjexp_attr = tAttrs["iterobjexp"]; // 内部显示用的表达式
  61 + var $searchph_attr = tAttrs["searchph"]; // 查询输入占位符字符串
  62 + var $searchexp_attr = tAttrs["searchexp"]; // 查询基于的内部数据源的表达式
  63 +
  64 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  65 +
  66 + if (!$name_attr) {
  67 + throw new Error("name属性必须填写");
  68 + }
  69 + if (!$cmaps_attr) {
  70 + throw new Error("cmaps属性必须填写")
  71 + }
  72 + if (!$dcname_attr || !$icname_attr) {
  73 + throw new Error("dcname、icname属性必须填写");
  74 + }
  75 + if (!$dsparams_attr) {
  76 + throw new Error("dsparams属性必须填写");
  77 + }
  78 + if (!$iterobjname_attr) {
  79 + throw new Error("iterobjname属性必须填写");
  80 + }
  81 + if (!$iterobjexp_attr) {
  82 + throw new Error("iterobjexp属性必须填写");
  83 + }
  84 + if (!$searchph_attr) {
  85 + throw new Error("searchph属性必须填写");
  86 + }
  87 + if (!$searchexp_attr) {
  88 + throw new Error("searchexp属性必须填写");
  89 + }
  90 +
  91 + // 内部controlAs名字
  92 + var ctrlAs = "$saSelectCtrl";
  93 +
  94 + // 动态设置dom
  95 + // dom,最外层name属性设置
  96 + tElem.find("div:first").attr("name", $name_attr);
  97 + // dom,最外层divrequired属性设置
  98 + if ($required_attr != undefined) {
  99 + tElem.find("div[name=\'" + $name_attr + "\']").attr("required", "");
  100 + }
  101 + // dom,ui-select-match的placeholder属性设定
  102 + tElem.find("ui-select-match").attr("placeholder", $searchph_attr);
  103 + // dom,ui-select-match的内容设定
  104 + var uiSelectMatchHtml = "{{" + ctrlAs + ".$$internal_match_str($select.selected)}}";
  105 + tElem.find("ui-select-match").html(uiSelectMatchHtml);
  106 + // dom,ui-select-choices的repeat属性设定
  107 + var uiSelectChoices_repeatAttr = $iterobjname_attr + "." + $icname_attr + " as " + $iterobjname_attr + " in " + ctrlAs + ".$$data";
  108 + tElem.find("ui-select-choices").attr("repeat", uiSelectChoices_repeatAttr);
  109 + // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
  110 + tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
  111 +
  112 + return {
  113 + pre: function (scope, element, attr) {
  114 + // TODO:
  115 + },
  116 +
  117 + /**
  118 + * 相当于link函数。
  119 + * @param scope
  120 + * @param element
  121 + * @param attr
  122 + */
  123 + post: function (scope, element, attr) {
  124 +
  125 + // 添加选中事件处理函数
  126 + scope[ctrlAs].$$internal_select_fn = function($item) {
  127 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  128 +
  129 + eval("var obj=" + $cmaps_attr);
  130 + for (var mc in obj) { // model的字段名:内部数据源对应字段名
  131 + var ic = obj[mc]; // 内部数据源对应字段
  132 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  133 + }
  134 + };
  135 +
  136 + // 删除选中事件处理函数
  137 + scope[ctrlAs].$$internal_remove_fn = function() {
  138 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  139 +
  140 + eval("var obj=" + $cmaps_attr);
  141 + var mc; // model的字段名
  142 + for (mc in obj) {
  143 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  144 + }
  145 + };
  146 +
  147 + // 刷新数据
  148 + scope[ctrlAs].$$internal_refresh_fn = function(search) {
  149 + if (search && search != "") { // 有search值
  150 + // 处理search
  151 + console.log("search:" + search);
  152 +
  153 + scope[ctrlAs].$$data = [];
  154 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  155 + var upTerm = search.toUpperCase();
  156 + if (scope[ctrlAs].$$data.length < 10) {
  157 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  158 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  159 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  160 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  161 + }
  162 + } else {
  163 + break;
  164 + }
  165 + }
  166 + }
  167 + };
  168 +
  169 + /**
  170 + * 验证内部数据,更新外部model
  171 + */
  172 + scope[ctrlAs].$$internal_validate_model = function() {
  173 + if (scope[ctrlAs].$$internal_select_value) {
  174 + var select_value_temp = scope[ctrlAs].$$internal_select_value;
  175 + if (scope[ctrlAs].$$data_real && scope[ctrlAs].$$data_real.length > 0) {
  176 + var obj;
  177 + for (var j = 0; j < scope[ctrlAs].$$data_real.length; j++) {
  178 + if (eval("scope[ctrlAs].$$data_real[j]" + "." + $icname_attr + " == select_value_temp")) {
  179 + obj = angular.copy(scope[ctrlAs].$$data_real[j]);
  180 + break;
  181 + }
  182 + }
  183 + if (obj) { // 在data中判定有没有
  184 + for (var k = 0; k < scope[ctrlAs].$$data.length; k++) {
  185 + if (eval("scope[ctrlAs].$$data[k]" + "." + $icname_attr + " == obj." + $icname_attr)) {
  186 + obj = undefined;
  187 + break;
  188 + }
  189 + }
  190 + if (obj) {
  191 + scope[ctrlAs].$$data.push(obj);
  192 + }
  193 + // 更新内部model,用于外部验证
  194 + // 内部model的值暂时随意,以后再改
  195 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  196 + } else {
  197 + scope[ctrlAs].$$internalmodel = undefined;
  198 + }
  199 +
  200 + } else {
  201 + scope[ctrlAs].$$internalmodel = undefined;
  202 + }
  203 +
  204 + } else {
  205 + scope[ctrlAs].$$internalmodel = undefined;
  206 + }
  207 + };
  208 +
  209 + /**
  210 + * 内部match表达式转换函数,需要外部绑定此函数的上下文。
  211 + * @param context function上下文
  212 + */
  213 + scope[ctrlAs].$$internal_match_str = function (context) {
  214 + var fx = function() {
  215 + try {
  216 + return eval($searchexp_attr);
  217 + } catch (err) {
  218 + //console.log(err);
  219 + return undefined;
  220 + }
  221 +
  222 + };
  223 +
  224 + var str = fx.bind(context)();
  225 + if (str && str != "")
  226 + return str;
  227 + else
  228 + return undefined;
  229 + };
  230 +
  231 + /**
  232 + * 内部方法,读取字典数据作为数据源。
  233 + * @param atype ajax查询类型
  234 + * @param ajaxparamobj 查询参数对象
  235 + */
  236 + scope[ctrlAs].$$internal_ajax_data = function(atype, ajaxparamobj) {
  237 + // 如果ajaxparamobj为空对象,则表示清空内部选项
  238 + var isEmptyObj = true;
  239 + for (var name in ajaxparamobj) {
  240 + isEmptyObj = false;
  241 + }
  242 + if (isEmptyObj) {
  243 + // 重新创建内部保存的数据
  244 + scope[ctrlAs].$$data_real = [];
  245 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  246 + scope[ctrlAs].$$data = [];
  247 +
  248 + scope[ctrlAs].$$internal_remove_fn();
  249 + scope[ctrlAs].$$internal_validate_model();
  250 +
  251 + return;
  252 + }
  253 +
  254 + if ($dsparamsextra_attr) { // 合并附加参数
  255 + eval("var extra = " + $dsparamsextra_attr);
  256 + for (var extrakey in extra) {
  257 + ajaxparamobj[extrakey] = extra[extrakey];
  258 + }
  259 + }
  260 +
  261 + $$searchInfoService_g[atype].list(
  262 + ajaxparamobj,
  263 + function(result) {
  264 + console.log("$$internal_ajax_data result");
  265 +
  266 + // 重新创建内部保存的数据
  267 + scope[ctrlAs].$$data_real = [];
  268 + // result中添加拼音数据,注意:这里要求result返回对象数组
  269 + for (var i = 0; i < result.length; i++) {
  270 + // 闭包绑定返回最终查询的值
  271 + var calcu_str = scope[ctrlAs].$$internal_match_str(result[i]);
  272 + if (calcu_str) {
  273 + // 全拼
  274 + result[i]["$fullChars"] = pinyin.getFullChars(calcu_str);
  275 + // 简拼
  276 + result[i]["$camelChars"] = pinyin.getCamelChars(calcu_str);
  277 + // 原值
  278 + result[i]["$calcu_str"] = calcu_str;
  279 +
  280 + scope[ctrlAs].$$data_real.push(result[i]);
  281 + }
  282 + }
  283 +
  284 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  285 + scope[ctrlAs].$$data = [];
  286 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  287 + if (scope[ctrlAs].$$data.length < 10) {
  288 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  289 + } else {
  290 + break;
  291 + }
  292 + }
  293 +
  294 + scope[ctrlAs].$$internal_validate_model();
  295 + },
  296 + function(result) {
  297 + throw new Error("ajax查询出错");
  298 + }
  299 + );
  300 + };
  301 +
  302 + /**
  303 + * 内部方法,读取字典数据作为数据源。
  304 + * @param dictype 字典类型,如:gsType
  305 + */
  306 + scope[ctrlAs].$$internal_dic_data = function(dictype) {
  307 + if (!dictionaryUtils.getByGroup(dictype)) {
  308 + throw new error("字典数据不窜在=" + dictype);
  309 + }
  310 +
  311 + // 重新创建内部保存的数据
  312 + scope[ctrlAs].$$data_real = [];
  313 + var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  314 + var dic_key; // 字典key
  315 +
  316 + for (dic_key in origin_dicgroup) {
  317 + var data = {}; // 重新组合的字典元素对象
  318 + if (dic_key == "true")
  319 + data[$icname_attr] = true;
  320 + else
  321 + data[$icname_attr] = dic_key;
  322 + data[$dscol_attr] = origin_dicgroup[dic_key];
  323 + scope[ctrlAs].$$data_real.push(data);
  324 + }
  325 +
  326 + // 重新创建内部ui-select显示用数据,直接复制所有的字典数据
  327 + scope[ctrlAs].$$data = [];
  328 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  329 + scope[ctrlAs].$$data.push(scope[ctrlAs].$$data_real[k]);
  330 + }
  331 +
  332 + scope[ctrlAs].$$internal_validate_model();
  333 + };
  334 +
  335 + /**
  336 + * 监控dsparams属性变化
  337 + */
  338 + attr.$observe("dsparams", function(value) {
  339 + if (value && value != "") {
  340 + var obj = JSON.parse(value);
  341 + console.log("saSelect5 监控到dsparams属性变化,old=" + $dsparams_attr + ",new=" + value);
  342 +
  343 + // dsparams格式如下:
  344 + // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
  345 +
  346 + if (obj.type == 'dic') {
  347 + scope[ctrlAs].$$internal_dic_data(obj.param);
  348 +
  349 + } else if (obj.type == 'ajax') {
  350 + scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  351 + } else {
  352 + throw new Error("dsparams参数格式异常=" + obj);
  353 + }
  354 +
  355 + }
  356 + });
  357 +
  358 + /**
  359 + * 监控外部模型dcname的值的变化。
  360 + */
  361 + scope.$watch(
  362 + function() {
  363 + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
  364 + },
  365 + function(newValue, oldValue) {
  366 + if (newValue === undefined && oldValue === undefined) {
  367 + // 两侧都是undefined,不处理
  368 +
  369 + } else {
  370 + console.log("saSelect5 监控到外部模型" + $dcname_attr + "属性值变化,old=" + oldValue + ",new=" + newValue);
  371 + scope[ctrlAs].$$internal_select_value = newValue;
  372 + scope[ctrlAs].$$internal_validate_model();
  373 + }
  374 + },
  375 + true
  376 + );
  377 + }
  378 + };
  379 + }
  380 + };
  381 + }
348 382 ]);
349 383 \ No newline at end of file
... ...
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 147 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroup.js
1   -/**
2   - * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
3   - * 属性如下:
4   - * name(必须):控件的名字
5   - * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
6   - * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}
7   - * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange
8   - * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
9   - * required(可选):是否要用required验证
10   - *
11   - */
12   -angular.module('ScheduleApp').directive('saBcgroup', [
13   - 'TimeTableDetailManageService_g',
14   - function(timeTableDetailManageService_g) {
15   - return {
16   - restrict: 'E',
17   - templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/MyBcGroupWrapTemplate.html',
18   - scope: {
19   - model: "=" // 独立作用域,关联外部的模型object
20   - },
21   - controllerAs: '$saBcgroupCtrl',
22   - bindToController: true,
23   - controller: function($scope) {
24   - var self = this;
25   - self.$$data = []; // 选择线路,时刻表,路牌后的班次列表
26   -
27   - // 测试数据
28   - //self.$$data = [
29   - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
30   - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
31   - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
32   - //];
33   -
34   -
35   - self.$$dataSelected = []; // 套跑选中的班次列表
36   -
37   - //self.$$dataSelected = [
38   - // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
39   - // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
40   - // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
41   - //];
42   -
43   - // saBcgroup组件的ng-model,用于外部绑定等操作
44   - self.$$internalmodel = undefined;
45   -
46   - self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志
47   - self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志
48   - self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据
49   -
50   - },
51   -
52   - /**
53   - * 此阶段可以改dom结构,此时angular还没扫描指令,
54   - * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
55   - * @param tElem
56   - * @param tAttrs
57   - * @returns {{pre: Function, post: Function}}
58   - */
59   - compile: function(tElem, tAttrs) {
60   - // TODO:获取所有的属性
61   - var $name_attr = tAttrs["name"]; // 控件的名字
62   - var $required_attr = tAttrs["required"]; // 是否需要required验证
63   - var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名
64   -
65   - // controlAs名字
66   - var ctrlAs = '$saBcgroupCtrl';
67   -
68   - // 如果有required属性,添加angularjs required验证
69   - if ($required_attr != undefined) {
70   - //console.log(tElem.html());
71   - tElem.find("div").attr("required", "");
72   - }
73   -
74   - return {
75   - pre: function(scope, element, attr) {
76   - // TODO:
77   - },
78   -
79   - /**
80   - * 相当于link函数。
81   - * @param scope
82   - * @param element
83   - * @param attr
84   - */
85   - post: function(scope, element, attr) {
86   - // name属性
87   - if ($name_attr) {
88   - scope[ctrlAs]["$name_attr"] = $name_attr;
89   - }
90   -
91   - // TODO:
92   -
93   -
94   - /**
95   - * 班次列表点击(班次列表中选中班次)
96   - * @param $index
97   - */
98   - scope[ctrlAs].$$internal_bclist_click = function($index) {
99   - var data_temp = scope[ctrlAs].$$data;
100   - var data_temp2 = scope[ctrlAs].$$dataSelected;
101   - var i = 0;
102   - var isunique = true; // 是否已经选择过
103   - if (data_temp && data_temp.length > $index) {
104   - for (i = 0; i < data_temp2.length; i++) {
105   - if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {
106   - isunique = false;
107   - break;
108   - }
109   - }
110   - if (isunique) {
111   - data_temp2.push({
112   - bcttinfoid: data_temp[$index].bcttinfoid,
113   - bcfcsj: data_temp[$index].bcfcsj,
114   - bctype: data_temp[$index].bctype
115   - });
116   - }
117   -
118   - }
119   - };
120   - /**
121   - * 选中的班次双击(删除选中的班次)
122   - * @param $index
123   - */
124   - scope[ctrlAs].$$internal_selbclist_dbclick = function($index) {
125   - var data_temp = scope[ctrlAs].$$dataSelected;
126   - if (data_temp && data_temp.length > $index) {
127   - data_temp.splice($index, 1);
128   - }
129   - };
130   -
131   -
132   - /**
133   - * 验证内部数据,更新外部model
134   - */
135   - scope[ctrlAs].$$internal_validate_model = function() {
136   - var data_temp = scope[ctrlAs].$$dataSelected;
137   - var bcttinfoIds = [];
138   - var i = 0;
139   -
140   - if (data_temp &&
141   - data_temp.length > 0) {
142   -
143   - for (i = 0; i < data_temp.length; i++) {
144   - bcttinfoIds.push(data_temp[i].bcttinfoid);
145   - }
146   -
147   - // 更新外部model字段
148   - if ($bcttinfoidsname_attr) {
149   - console.log("bcttinfoidsname=" + bcttinfoIds.join(','));
150   - eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');");
151   - }
152   -
153   - // 更新内部model,用于外部验证
154   - // 内部model的值暂时随意,以后再改
155   - scope[ctrlAs].$$internalmodel = {desc: "ok"};
156   -
157   - scope[ctrlAs].$$data_bcdata_first_init = true;
158   - scope[ctrlAs].$$data_bcttinfoids_first_init = true;
159   -
160   - } else {
161   - scope[ctrlAs].$$internalmodel = undefined;
162   - }
163   -
164   - };
165   -
166   - // 监控内部数据,$$data_selected 变化
167   - scope.$watch(
168   - function() {
169   - return scope[ctrlAs].$$dataSelected;
170   - },
171   - function(newValue, oldValue) {
172   - scope[ctrlAs].$$internal_validate_model();
173   - },
174   - true
175   - );
176   -
177   - /**
178   - * 验证数据是否初始化完成,
179   - * 所谓的初始化就是内部所有的数据被有效设定过一次。
180   - */
181   - scope[ctrlAs].$$internal_validate_init = function() {
182   - var self = scope[ctrlAs];
183   -
184   - var data_temp = self.$$data;
185   - var dataSelect_temp = self.$$dataSelected;
186   - var bcttinfoids = null;
187   -
188   - var i = 0;
189   - var j = 0;
190   -
191   - if (self.$$data_bcdata_first_init &&
192   - self.$$data_bcttinfoids_first_init) {
193   - console.log("开始初始化数据");
194   -
195   - bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];
196   -
197   - for (i = 0; i < bcttinfoids.length; i++) {
198   - dataSelect_temp.push({
199   - bcttinfoid: bcttinfoids[i]
200   - });
201   - for (j = 0; j < data_temp.length; j++) {
202   - if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {
203   - dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;
204   - dataSelect_temp[i].bctype = data_temp[j].bctype;
205   - break;
206   - }
207   - }
208   - }
209   -
210   - console.log("数据初始化完毕!");
211   - }
212   -
213   - };
214   -
215   - // 监控初始化标志
216   - scope.$watch(
217   - function() {
218   - return scope[ctrlAs].$$data_bcdata_first_init;
219   - },
220   - function(newValue, oldValue) {
221   - scope[ctrlAs].$$internal_validate_init();
222   - }
223   - );
224   - scope.$watch(
225   - function() {
226   - return scope[ctrlAs].$$data_bcttinfoids_first_init;
227   - },
228   - function(newValue, oldValue) {
229   - scope[ctrlAs].$$internal_validate_init();
230   - }
231   - );
232   -
233   - // 监控内部数据的变化
234   - attr.$observe("dataparams", function(value) {
235   - if (value && value != "") {
236   - console.log("observe 监控 dataparams=" + value);
237   -
238   - var obj = JSON.parse(value);
239   - timeTableDetailManageService_g.bcdetails.list(
240   - obj,
241   - function(result) {
242   - // 获取值了
243   - console.log("内部班次数据获取了");
244   -
245   - scope[ctrlAs].$$data = [];
246   - for (var i = 0; i < result.length; i++) {
247   - scope[ctrlAs].$$data.push({
248   - bcttinfoid: result[i].id,
249   - bcfcsj: result[i].fcsj,
250   - bctype: result[i].bcType
251   - });
252   - }
253   - if (scope[ctrlAs].$$data_bcdata_first_init &&
254   - scope[ctrlAs].$$data_bcttinfoids_first_init) {
255   -
256   - scope[ctrlAs].$$dataSelected = [];
257   - scope[ctrlAs].$$internalmodel = undefined;
258   - }
259   - scope[ctrlAs].$$data_bcdata_first_init = true;
260   - },
261   - function(result) {
262   -
263   - }
264   - );
265   - }
266   - });
267   - // 监控班次ids数据的变化
268   - attr.$observe("bcttinfoidsvalue", function(value) {
269   - if (value && value != "") {
270   - console.log("observe 监控 bcttinfoidsvalue=" + value);
271   - scope[ctrlAs].$$data_bcttinfoids_first_init = true;
272   - scope[ctrlAs].$$data_bcttinfoids_first_data = value;
273   - }
274   - });
275   -
276   - }
277   - }
278   -
279   - }
280   - }
281   - }
  1 +/**
  2 + * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
  3 + * 属性如下:
  4 + * name(必须):控件的名字
  5 + * model(必须):指定一个外部object,独立作用域,如:model=ctrl.employeeInfoForSave
  6 + * bcttinfoidsvalue(必须):绑定的model班次ids字段值,如:bcttinfoidsvalue={{ctrl.employeeInfoForSave.lprange}}
  7 + * bcttinfoidsname(必须):bind的model班次ids字段名,如:bcttinfoidsname=lprange
  8 + * dataparams (必须):内部数据关联的查询参数,如:{{ {'ttid': ctrl.rerunManageForSave.rerunTtinfo.id} | json }}
  9 + * required(可选):是否要用required验证
  10 + *
  11 + */
  12 +angular.module('ScheduleApp').directive('saBcgroup', [
  13 + 'TimeTableDetailManageService_g',
  14 + function(timeTableDetailManageService_g) {
  15 + return {
  16 + restrict: 'E',
  17 + templateUrl: '/pages/scheduleApp/module/common/dts2/bcGroup/saBcgroupTemplate.html',
  18 + scope: {
  19 + model: "=" // 独立作用域,关联外部的模型object
  20 + },
  21 + controllerAs: '$saBcgroupCtrl',
  22 + bindToController: true,
  23 + controller: function($scope) {
  24 + var self = this;
  25 + self.$$data = []; // 选择线路,时刻表,路牌后的班次列表
  26 +
  27 + // 测试数据
  28 + //self.$$data = [
  29 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  30 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  31 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  32 + //];
  33 +
  34 +
  35 + self.$$dataSelected = []; // 套跑选中的班次列表
  36 +
  37 + //self.$$dataSelected = [
  38 + // {bcttinfoid: 1, bcfcsj: '7:30', bctype: 'out'},
  39 + // {bcttinfoid: 2, bcfcsj: '8:30', bctype: 'normal'},
  40 + // {bcttinfoid: 3, bcfcsj: '9:30', bctype: 'in'}
  41 + //];
  42 +
  43 + // saBcgroup组件的ng-model,用于外部绑定等操作
  44 + self.$$internalmodel = undefined;
  45 +
  46 + self.$$data_bcdata_first_init = false; // 班次数据首次初始化标志
  47 + self.$$data_bcttinfoids_first_init = false; // 班次ids数据首次初始化标志
  48 + self.$$data_bcttinfoids_first_data = undefined; // 班次ids数据首次初始化数据
  49 +
  50 + },
  51 +
  52 + /**
  53 + * 此阶段可以改dom结构,此时angular还没扫描指令,
  54 + * 这里就可以动态添加其他angularjs的指令字符串,如required指令字符串。
  55 + * @param tElem
  56 + * @param tAttrs
  57 + * @returns {{pre: Function, post: Function}}
  58 + */
  59 + compile: function(tElem, tAttrs) {
  60 + // TODO:获取所有的属性
  61 + var $name_attr = tAttrs["name"]; // 控件的名字
  62 + var $required_attr = tAttrs["required"]; // 是否需要required验证
  63 + var $bcttinfoidsname_attr = tAttrs["bcttinfoidsname"]; // bind的model班次ids字段名
  64 +
  65 + // controlAs名字
  66 + var ctrlAs = '$saBcgroupCtrl';
  67 +
  68 + // 如果有required属性,添加angularjs required验证
  69 + if ($required_attr != undefined) {
  70 + //console.log(tElem.html());
  71 + tElem.find("div").attr("required", "");
  72 + }
  73 +
  74 + return {
  75 + pre: function(scope, element, attr) {
  76 + // TODO:
  77 + },
  78 +
  79 + /**
  80 + * 相当于link函数。
  81 + * @param scope
  82 + * @param element
  83 + * @param attr
  84 + */
  85 + post: function(scope, element, attr) {
  86 + // name属性
  87 + if ($name_attr) {
  88 + scope[ctrlAs]["$name_attr"] = $name_attr;
  89 + }
  90 +
  91 + // TODO:
  92 +
  93 +
  94 + /**
  95 + * 班次列表点击(班次列表中选中班次)
  96 + * @param $index
  97 + */
  98 + scope[ctrlAs].$$internal_bclist_click = function($index) {
  99 + var data_temp = scope[ctrlAs].$$data;
  100 + var data_temp2 = scope[ctrlAs].$$dataSelected;
  101 + var i = 0;
  102 + var isunique = true; // 是否已经选择过
  103 + if (data_temp && data_temp.length > $index) {
  104 + for (i = 0; i < data_temp2.length; i++) {
  105 + if (data_temp2[i].bcttinfoid == data_temp[$index].bcttinfoid) {
  106 + isunique = false;
  107 + break;
  108 + }
  109 + }
  110 + if (isunique) {
  111 + data_temp2.push({
  112 + bcttinfoid: data_temp[$index].bcttinfoid,
  113 + bcfcsj: data_temp[$index].bcfcsj,
  114 + bctype: data_temp[$index].bctype
  115 + });
  116 + }
  117 +
  118 + }
  119 + };
  120 + /**
  121 + * 选中的班次双击(删除选中的班次)
  122 + * @param $index
  123 + */
  124 + scope[ctrlAs].$$internal_selbclist_dbclick = function($index) {
  125 + var data_temp = scope[ctrlAs].$$dataSelected;
  126 + if (data_temp && data_temp.length > $index) {
  127 + data_temp.splice($index, 1);
  128 + }
  129 + };
  130 +
  131 +
  132 + /**
  133 + * 验证内部数据,更新外部model
  134 + */
  135 + scope[ctrlAs].$$internal_validate_model = function() {
  136 + var data_temp = scope[ctrlAs].$$dataSelected;
  137 + var bcttinfoIds = [];
  138 + var i = 0;
  139 +
  140 + if (data_temp &&
  141 + data_temp.length > 0) {
  142 +
  143 + for (i = 0; i < data_temp.length; i++) {
  144 + bcttinfoIds.push(data_temp[i].bcttinfoid);
  145 + }
  146 +
  147 + // 更新外部model字段
  148 + if ($bcttinfoidsname_attr) {
  149 + console.log("bcttinfoidsname=" + bcttinfoIds.join(','));
  150 + eval("scope[ctrlAs].model" + "." + $bcttinfoidsname_attr + " = bcttinfoIds.join(',');");
  151 + }
  152 +
  153 + // 更新内部model,用于外部验证
  154 + // 内部model的值暂时随意,以后再改
  155 + scope[ctrlAs].$$internalmodel = {desc: "ok"};
  156 +
  157 + scope[ctrlAs].$$data_bcdata_first_init = true;
  158 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  159 +
  160 + } else {
  161 + scope[ctrlAs].$$internalmodel = undefined;
  162 + }
  163 +
  164 + };
  165 +
  166 + // 监控内部数据,$$data_selected 变化
  167 + scope.$watch(
  168 + function() {
  169 + console.log("长度:" + scope[ctrlAs].$$dataSelected.length);
  170 + return scope[ctrlAs].$$dataSelected;
  171 + },
  172 + function(newValue, oldValue) {
  173 + scope[ctrlAs].$$internal_validate_model();
  174 + },
  175 + true
  176 + );
  177 +
  178 + /**
  179 + * 验证数据是否初始化完成,
  180 + * 所谓的初始化就是内部所有的数据被有效设定过一次。
  181 + */
  182 + scope[ctrlAs].$$internal_validate_init = function() {
  183 + var self = scope[ctrlAs];
  184 +
  185 + var data_temp = self.$$data;
  186 + var dataSelect_temp = self.$$dataSelected;
  187 + var bcttinfoids = null;
  188 +
  189 + var i = 0;
  190 + var j = 0;
  191 +
  192 + if (self.$$data_bcdata_first_init &&
  193 + self.$$data_bcttinfoids_first_init) {
  194 + console.log("开始初始化数据");
  195 +
  196 + bcttinfoids = self.$$data_bcttinfoids_first_data ? self.$$data_bcttinfoids_first_data.split(",") : [];
  197 +
  198 + for (i = 0; i < bcttinfoids.length; i++) {
  199 + dataSelect_temp.push({
  200 + bcttinfoid: bcttinfoids[i]
  201 + });
  202 + for (j = 0; j < data_temp.length; j++) {
  203 + if (dataSelect_temp[i].bcttinfoid == data_temp[j].bcttinfoid) {
  204 + dataSelect_temp[i].bcfcsj = data_temp[j].bcfcsj;
  205 + dataSelect_temp[i].bctype = data_temp[j].bctype;
  206 + break;
  207 + }
  208 + }
  209 + }
  210 +
  211 + console.log("数据初始化完毕!");
  212 + }
  213 +
  214 + };
  215 +
  216 + // 监控初始化标志
  217 + scope.$watch(
  218 + function() {
  219 + return scope[ctrlAs].$$data_bcdata_first_init;
  220 + },
  221 + function(newValue, oldValue) {
  222 + scope[ctrlAs].$$internal_validate_init();
  223 + }
  224 + );
  225 + scope.$watch(
  226 + function() {
  227 + return scope[ctrlAs].$$data_bcttinfoids_first_init;
  228 + },
  229 + function(newValue, oldValue) {
  230 + scope[ctrlAs].$$internal_validate_init();
  231 + }
  232 + );
  233 +
  234 + // 监控内部数据的变化
  235 + attr.$observe("dataparams", function(value) {
  236 + if (value && value != "") {
  237 + if (value == '{}') {
  238 + return;
  239 + }
  240 +
  241 + console.log("bcgroup observe 监控 dataparams=" + value);
  242 +
  243 + timeTableDetailManageService_g.bcdetails.list(
  244 + JSON.parse(value),
  245 + function(result) {
  246 + // 获取值了
  247 + console.log("内部班次数据获取了");
  248 +
  249 + scope[ctrlAs].$$data = [];
  250 + for (var i = 0; i < result.length; i++) {
  251 + scope[ctrlAs].$$data.push({
  252 + bcttinfoid: result[i].id,
  253 + bcfcsj: result[i].fcsj,
  254 + bctype: result[i].bcType
  255 + });
  256 + }
  257 + if (scope[ctrlAs].$$data_bcdata_first_init &&
  258 + scope[ctrlAs].$$data_bcttinfoids_first_init) {
  259 +
  260 + scope[ctrlAs].$$dataSelected = [];
  261 + scope[ctrlAs].$$internalmodel = undefined;
  262 + }
  263 + scope[ctrlAs].$$data_bcdata_first_init = true;
  264 + },
  265 + function(result) {
  266 +
  267 + }
  268 + );
  269 + }
  270 + });
  271 + // 监控班次ids数据的变化
  272 + attr.$observe("bcttinfoidsvalue", function(value) {
  273 + if (value && value != "") {
  274 + console.log("observe 监控 bcttinfoidsvalue=" + value);
  275 + scope[ctrlAs].$$data_bcttinfoids_first_init = true;
  276 + scope[ctrlAs].$$data_bcttinfoids_first_data = value;
  277 + }
  278 + });
  279 +
  280 + }
  281 + }
  282 +
  283 + }
  284 + }
  285 + }
282 286 ]);
283 287 \ No newline at end of file
... ...
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