index.html
7.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<html ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题</title>
<link rel="stylesheet" href="http://xn-static.oss-cn-hangzhou.aliyuncs.com/css/xn-bootstrap/1.0.2/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.xiniunet.com/font/xn-icon-common/2.0.9/iconfont.min.css">
<link rel="stylesheet" href="../directive/style.css">
<link href="../demo/base.css" rel="stylesheet">
<link rel="stylesheet/less" href="../spm_modules/xn-style-common/2.3.5/public/common.less">
<script type="text/javascript" src="http://xn-static.oss-cn-hangzhou.aliyuncs.com/js/less/1.7.0/less.min.js"></script>
<!-- <script type="text/javascript" src="http://xn-static.oss-cn-hangzhou.aliyuncs.com/js/base/2.0.0/base.min.js"></script>-->
<script type="text/javascript" src="./base.min.js"></script>
<script type="text/javascript" src="http://xn-static.oss-cn-hangzhou.aliyuncs.com/js/xn-common/2.0.1/commons.min.js"></script>
<script type="text/javascript" src="../directive/locations.js"></script>
<style>
.xn-province-city-box{
border: 1px solid #dcdcdc;
background: #fff;
border-radius: 4px ;
}
.xn-input-line{
margin-bottom: 15px;
}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=RZakDY4AilwGcwGTICH6faU8BwHy8u39"></script>
</head>
<body ng-controller="MyController">
<div class="xn-width clearfix auto" style="width:1000px;">
<div style="width:400px;">
<!--省市区街道-->
<h2>省市区街道</h2>
{{locationTown}}
<div xn-location-town ng-model="locationTown" ></div>
<div style="margin-top:50px;"></div>
<div>地址指令</div>
<div >{{address}}</div>
<div xn-location ng-model="address" data-location-id="{{location.id}}" if-country='false' enabled-map='true' ></div>
<!--异步调用-->
<h3>异步调用</h3>
{{requestaddress}}
<div xn-request-location ng-model="requestaddress" old-location="oldLocation"></div>
<!---地址组件-->
<h3 >地址组件</h3>
<div>{{location}}</div>
<!-- <div xn-location ng-model="location" if-country='false' enabled-map='true'></div>-->
<div>省份多选</div>
{{selectProvinceId}}
<div xn-multiple-province class="xn-province-city-box" ng-model="selectProvinceId" name="打开" data-province-id-list="provinceIdList"></div>
<button ng-click="doSave()" style="margin-top:20px;" >保存</button>
<div style="margin-top:50px;">省份多选下拉形式</div>
<div>{{resultId}}</div>
<div xn-multiple-select-location type="text" select-data="sourceList" ng-model="resultId" name="result"></div>
<button ng-click="doSave1()" style="margin-top:20px;" >保存</button>
<div>单个城市指令</div>
<div xn-location-city ng-model="cardCity" data-city-id="{{employee.cityId}}"></div>
<div>多选框</div>
<div xn-location-city-list ng-model="city" data-city-id-list="cityIdList"></div>
<div>物流多选</div>
{{selectCityId}}
<div xn-province-city class="xn-province-city-box" ng-model="selectCityId" name="打开" data-city-id-list="cityIdList"></div>
<div>物流查看</div>{{selectCity.idList}}
<div xn-province-city-view class="xn-province-city-box" data-city-id-list="cityIdViewList"></div>
<div>物流多选到区</div>
{{selectDistrictId}}
<div xn-province-city-district class="xn-province-city-box" ng-model="selectDistrictId" name="打开" data-district-id-list="districtIdList"></div>
<ul style="padding: 100px">
<li ng-repeat="item in demo">{{item.val}}
<div xn-province-city-district class="xn-province-city-box" ng-model="item.districtIdList11" name="打开" data-district-id-list="item.districtIdList"></div>
<!-- <div xn-province-city-district-view class="xn-province-city-box" data-district-id-list="item.districtIdList"></div>-->
</li>
</ul>
<div ng-click="add()">增加一个</div>
<div>物流多选到区 查看</div>
{{districtIdList}}
<div xn-province-city-district-view class="xn-province-city-box" data-district-id-list="districtIdList"></div>
<h3>省市区选择指令( 备注。城市名称不是必填,但是id为必填)</h3>
<h4>用法:</h4>
1. $scope.locationDistrict 里可以负值:{"provinceId":340000,"cityId":340400,"districtId":340404,"provinceName":"安徽省","cityName":"淮南市","districtName":"谢家集区"};
//设置默认数据时候。城市名称不是必填,但是id为必填
{{locationDistrict}}
<div xn-location-district ng-model="locationDistrict" placeholder="说明"></div>
</div>
<div class="" style="margin-bottom: 150px"></div>
</div>
</body>
<script type="text/javascript">
var xnConfig={
myUrl: "http://my-plat.xiniunet.com/"
};
var app=angular.module("myApp", ["ui.bootstrap","xn.service.interceptor","xn.common","xn.directive.location"]);
app.value("xnConfig",xnConfig);
app.config(["$httpProvider", function ($httpProvider) {
$httpProvider.interceptors.push("httpInterceptor");
}]);
app.controller("MyController", ["$scope","$timeout", function($scope,$timeout){
$timeout(function(){
$scope.demo=[
{key:1,val:"第一个",
districtIdList:[130102,230203]},
{key:1,val:"第一个",
districtIdList:[130102,130103,130104]
},
{key:1,val:"第一个",
districtIdList:[130102]
}
];
$scope.add=function(){
$scope.demo.push( {key:1,val:"第一个",
districtIdList:[130102,230203]})
};
$scope.cityIdList=[110100,130100,130200,130300,130400,130500,130600,130700,130800,130900,131000,131100,320300];
$scope.provinceIdList=[110000,150000,210000,120000];
$scope.cityIdViewList=[110100,130100,411400,411500,411600,411700,419000];
$scope.districtIdList=[130102,130103,131127,131128,131181,131182,230281];
$scope.locationDistrict={
"provinceId":110000,
"cityId":110100,
"districtId":110102,
"provinceName":"北京市",
"cityName":"北京市",
"districtName":"西城区"};
$scope.locationTown={
"provinceId":320000,
"cityId":320500,
"districtId":320508,
"provinceName":"江苏省",
"cityName":"苏州市",
"districtName":"姑苏区"
}
$scope.location={
id:'532120821632995329'
}
$scope.oldLocation={"countryId":"86","countryIdName":"中国","provinceId":"110000","provinceName":"北京市"};
},1000);
//备注。城市名称不是必填,但是id为必填
$scope.doSave=function(){
var aaa= angular.copy($scope.selectCityId);
var bbb= angular.copy($scope.selectProvinceId);
// console.log(aaa);
console.log(bbb);
};
$scope.doSave1=function(){
var q= angular.copy($scope.resultId);
alert(q);
};
$scope.sourceList = [];
$scope.result = [];
$scope.sourceList=[110000,150000,210000];
$scope.locationDistrict={
}
}]);
</script>
</html>