add.vm
13.3 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#set($page_title="服务详情")
#set($crumbs="首页:/home,服务管理:/diliService/list.do")
#set($url_save = "/diliService/save.do")
<div class="page-content">
<div class="page-header">
<span class="pull-right">
<a href="${webUtils.getLocalPath("diliService/list.do")}" class="btn btn-white btn-default">返回</a>
</span>
<h1>
<small>
<i class="icon-double-angle-right"></i>
编辑服务
</small>
</h1>
</div>
<!-- /.page-header -->
<div class="row">
<div class="col-xs-12">
<!-- PAGE CONTENT BEGINS -->
<form class="form-horizontal" role="form" method="post" action="$url_save" id="myForm">
#if($model.id)
<input type="hidden" value="$model.id" name="id">
#end
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-1"> 服务名称: </label>
<div class="col-xs-12 col-sm-4">
<span class="block input-icon input-icon-right">
<input type="text" id="form-field-1"
required="true" data-bv-message="必须填写!"
maxlength="50"
placeholder="服务名称" name="name"
value="$!{model.name}"
class="width-100">
<i class="ace-icon fa fa-asterisk orange"></i>
</span>
</div>
</div>
#if(!$model.id)
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-2"> 服务编码: </label>
<div class="col-xs-12 col-sm-4">
<span class="block input-icon input-icon-right">
<input type="text" id="form-field-2"
required="true"
maxlength="50" data-bv-message="必须填写!"
notIllegalCharacter="true"
placeholder="服务编码" name="code"
value="$!{model.code}"
class="width-100">
<i class="ace-icon fa fa-asterisk orange"></i>
</span>
</div>
</div>
#end
<div class="form-group imgDiv">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-2"> 服务图片: </label>
<div class="col-xs-12 col-sm-4 imgPanel">
## <div class="upload_box">
## <input type="button" class="u-but-sc" value="上传图片">
## <input id="serviceImgBtn" class="uploadFile" name="image" type="file">
## </div>
<input type="file" id="serviceImgBtn" class="uploadFile" name="image" >
<div class="" id="imgView">
#if(${model.image})
<img src="$!{model.image}" id="serviceImg" width="100px" height="100px">
#else
<img src="${webUtils.getCommonAssetsPath("common/images/i/default.gif")}" id="serviceImg" width="100px" height="100px">
#end
</div>
<input type="text" id="serviceImgTxt"
class="uploadFile" name="serviceImage" style="width: 0px; height: 0px; border: 0px;" value="$!{model.image}">
</div>
<i class="ace-icon fa fa-asterisk orange"></i>
</div>
<div class="form-group imgDiv">
<input type="hidden" id="icId" name="icon" value="$!{model.icon}">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-2"> 服务图标: </label>
<div class="col-xs-12 col-sm-4 imgIconPanel">
## <div class="upload_box">
## <input type="button" class="u-but-sc" value="上传图标">
## <input id="serviceIconBtn" class="uploadFile" name="image" type="file">
## </div>
<input type="file" id="serviceIconBtn" class="uploadFile" name="image" >
<div class="" id="imgView">
#if(${model.image})
<img src="$!{model.icon}" id="iconTmgId" width="100px" height="100px">
#else
<img src="${webUtils.getCommonAssetsPath("common/images/i/default.gif")}" id="iconTmgId" width="100px" height="100px">
#end
</div>
<input type="text" id="iconTmgIdTxt"
class="uploadFile" style="width: 0px; height: 0px; border: 0px;" value="$!{model.icon}">
</div>
<i class="ace-icon fa fa-asterisk orange"></i>
</div>
#if(!$model.id)
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-3"> 服务类型: </label>
<div class="col-xs-12 col-sm-4">
<input type="radio" name="type" value="1" #if(!${model.type}||$!{model.type} == 1) checked #end>独立服务
<input type="radio" name="type" value="2" #if($!{model.type} == 2) checked #end>订单服务
<input type="radio" name="type" value="3" #if($!{model.type} == 3) checked #end>通用服务
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-3"> 服务类别: </label>
<div class="col-xs-12 col-sm-4">
<input type="radio" name="category" value="1" #if(!${model.category}||$!{model.category} == 1) checked #end>采购服务
<input type="radio" name="category" value="2" #if($!{model.category} == 2) checked #end>销售服务
<input type="radio" name="category" value="3" #if($!{model.category} == 3) checked #end>通用服务
</div>
</div>
#end
## <div class="form-group">
## <label class="col-sm-3 control-label no-padding-right"
## for="form-field-5"> 上架状态: </label>
##
## <div class="col-xs-12 col-sm-4">
## <input type="radio" name="status" value="0" #if($!{model.status} != 1) checked #end>上架
## <input type="radio" name="status" value="1" #if($!{model.status} == 1) checked #end>下架
## </div>
## </div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-4">可服务区域: </label>
<div class="col-xs-12 col-sm-4">
#foreach($data in $datas)
#foreach($co in $coverages.model)
#set($checkP =0)
#if($co.coverageId ==$data.id)
#set($checkP =1)
#break
#end
#end
<input type="checkbox" name="coverages" value="${data.id}"
#if($checkP == 1) checked="checked" #end >
<span class="lbl"> ${data.pickName}</span>
#end
</div>
<i class="ace-icon fa fa-asterisk orange"></i>
</div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right"
for="form-field-4"> 服务介绍: </label>
<div class="col-xs-12 col-sm-4">
<textarea name="remark" placeholder="服务介绍" class="" rows="3" cols="60" maxlength="500">$!{model.remark}</textarea>
</div>
</div>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-info" type="submit" id="formbtn">
<i class="icon-ok bigger-110"></i>
提交
</button>
<a href="${webUtils.getLocalPath("diliService/list.do")}" class="btn" >
<i class="icon-undo bigger-110"></i>
返回
</a>
</div>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="$!{webUtils.getCommonAssetsPath("common/js/jquery.js")}"></script>
<script type="text/javascript" src="$!{webUtils.getCommonAssetsPath("common/js/ajaxfileupload.js")}"></script>
<script type="text/javascript" src="$!{webUtils.getCommonAssetsPath("common/js/uploadImg.js")}"></script>
<script type="text/javascript" src="$!{webUtils.getCommonAssetsPath("common/js/popup.js")}"></script>
<link rel="stylesheet" href="$!{webUtils.getCommonAssetsPath("common/css/popup.css")}" />
<link rel="stylesheet" href="$!{webUtils.getAssetsPath("/css/validator/bootstrapValidator.min.css")}" />
<script type="text/javascript" src="$!{webUtils.getAssetsPath("/js/validator/bootstrapValidator.min.js")}"></script>
##<script type="text/javascript" src="/assets/js/uploadImg.js"></script>
<script type="text/javascript">
$(function(){
var cfg = {
url:"${webUtils.getLocalPath("diliService/uploadServicePicImage.do")}"
,success:function(data){
// alert(data.message);
if(data.success){
$("#serviceImg").attr("src",data.message);
$("#serviceImgTxt").attr("value",data.message);
// $("[data-bv-validator-for='imagetxt']").remove();
// $(".imgDiv").removeClass("has-error");
//// $("#formbtn").removeAttr("disabled");
} else {
if(data.message){
Alert(data.message, "error");
} else {
Alert("图片上传出错了!", "error");
}
}
},
error:function(data){
if(data.message){
Alert(data.message, "error");
} else {
Alert("图片上传出错了!", "error");
}
}
};
var cfgicon = {
url:"${webUtils.getLocalPath("diliService/uploadServicePicImage.do")}"
,success:function(data){
if(data.success){
$("#iconTmgId").attr("src",data.message);
$("#iconTmgIdTxt").attr("value",data.message);
$("#icId").val(data.message);
// $("[data-bv-validator-for='imagetxt']").remove();
// $(".imgDiv").removeClass("has-error");
// $("#formbtn").removeAttr("disabled");
} else {
if(data.message){
Alert(data.message, "error");
} else {
Alert("图片上传出错了!", "error");
}
}
},
error:function(data){
if(data.message){
Alert(data.message, "error");
} else {
Alert("图片上传出错了!", "error");
}
}
};
$(".imgPanel").uploadImg(cfg);
$(".imgIconPanel").uploadImg(cfgicon);
})
$(document).ready(function() {
$('#myForm').bootstrapValidator();
$("#formbtn").click(function(){
var val = $("#serviceImgTxt").val();
if(val == "") {
Alert("请上传一张图片!");
return false;
}if($("#icId").val() == "") {
Alert("请上传一张图标!");
return false;
}
return true;
});
});
</script>