Browse Source

附件展示、导出修改

liuzhen 6 years ago
parent
commit
078464a5a4

+ 63 - 0
CallCenterWeb.UI/Script/Common/huayi.http.js

@@ -768,6 +768,69 @@ helper.methods = {
768 768
 		}
769 769
 	},
770 770
 	/**
771
+	 * 初始化layer-photo 图片的大小
772
+	 * @el 图片元素
773
+	 * @pic layer-photo 回调的参数 当前图片的一些信息
774
+	 * @layero layer-photo 回调的参数 当前弹框的一些信息
775
+	 */
776
+	initLayerPhotos: function(el, pic, layero) {
777
+		console.log($(el).find('img[alt="' + pic.alt + '"]'));
778
+		console.log(el);
779
+		console.log(pic);
780
+		console.log(layero);
781
+		var layerHeight = $(layero[0]).height();
782
+		var picHeight = $(el).find('img[alt="' + pic.alt + '"]').height() / 2;
783
+		var picWidth = $(el).find('img[alt="' + pic.alt + '"]').width() / 2;
784
+		var rate = picWidth / picHeight;
785
+		if(picHeight > layerHeight) {
786
+			picHeight = layerHeight - 110;
787
+			picWidth = rate * picHeight;
788
+		}
789
+		$(el).find('img[alt="' + pic.alt + '"]').css({
790
+			width: picWidth,
791
+			height: picHeight,
792
+			overflow: 'auto',
793
+			margin: 'auto',
794
+			position: 'absolute',
795
+			top: 0,
796
+			left: 0,
797
+			bottom: 0,
798
+			right: 0,
799
+		});
800
+	},
801
+	/**
802
+	 * 鼠标滚轮放大缩小
803
+	 * o img元素
804
+	 * d 滚轮的方向
805
+	 * */
806
+	zoomImg: function(o, d) {
807
+		console.log(o);
808
+		console.log(d);
809
+		//d 1 上 -1 下
810
+		var width = $(o).width();
811
+		var height = $(o).height();
812
+		if(d === 1) {
813
+			$(o).css({
814
+				"left": "50%",
815
+				"marginLeft": -(width * 1.2) / 2,
816
+				"top": "50%",
817
+				"marginTop": -(height * 1.2) / 2,
818
+				"width": width * 1.2,
819
+				"height": height * 1.2
820
+			});
821
+		}
822
+		if(d === -1) {
823
+			$(o).css({
824
+				"left": "50",
825
+				"marginLeft": -(width * 1.2) / 2,
826
+				"top": "50%",
827
+				"marginTop": -(height * 1.2) / 2,
828
+				"width": width / 1.2,
829
+				"height": height / 1.2
830
+			});
831
+		}
832
+	},
833
+	/**
771 834
 	 * 将一维的扁平数组转换为多层级对象
772 835
 	 * @param  {[type]} list 一维数组,数组中每一个元素需包含id和ParentId两个属性 
773 836
 	 * @return {[type]} tree 多层级树状结构

+ 3 - 3
CallCenterWeb.UI/WorkOrder/WorkOrderSearch.html

@@ -26,11 +26,11 @@
26 26
 			height: 34px;
27 27
 			line-height: 34px;
28 28
 		}
29
-		.caret{
29
+		/*.caret{
30 30
 			right: 10px;
31 31
 			top: 13px;
32 32
 			position: absolute;
33
-		}
33
+		}*/
34 34
 		.drop_down{
35 35
 			width: 100%;
36 36
 		}
@@ -91,7 +91,7 @@
91 91
 						<div class="clearfix order_transfer" id="order_transfer_depts">
92 92
 							<div class="form-group drop_down">
93 93
 								<input type="text" class="form-control input-sm" id="order_transfer_dept" data-id="0" placeholder="请选择接收部门" autocomplete="off" />
94
-								<span class="caret"></span>
94
+								<span class="caret" style="right: 10px;top: 13px;position: absolute;"></span>
95 95
 								<div id="reginsTreeView" class="hidden"></div>
96 96
 							</div>
97 97
 						</div>

+ 22 - 2
CallCenterWeb.UI/WorkOrder/template/orderDetails.html

@@ -17,6 +17,7 @@
17 17
 				<li>催办记录</li>
18 18
 				<li class="hidden">评论记录</li>
19 19
 				<li>修改记录</li>
20
+				<li>附件记录</li>
20 21
 				<!--<span class="Closed">×</span>-->
21 22
 			</ul>
22 23
 			<div class="gdxq">
@@ -155,13 +156,30 @@
155 156
 					</thead>
156 157
 				</table>
157 158
 			</div>
159
+			<div class="gdxq" style="display:none;">
160
+				<table id="itemTableList5" data-row-style="rowStyle" data-query-params="queryParams" data-pagination="true">
161
+					<thead>
162
+						<table id="gdxq_table" border="0" class="table table-bordered  table-hover " style="width: 100%;">
163
+							<tbody class="tbodys">
164
+								<tr>
165
+									<th>附件:</th>
166
+									<td colspan="3">
167
+										<ul id="fileList" class="clearfix">
168
+										</ul>
169
+									</td>
170
+									
171
+									
172
+								</tr>
173
+						</table>
174
+					</thead>
175
+				</table>
176
+			</div>
158 177
 			<div id="print_foot">
159 178
 				<a href="" class="print_foot">导出</a>
160 179
 			</div>
161 180
 		</div>
162 181
 		<script type="text/javascript">
163 182
 			var wid = helper.request.queryString("Str");
164
-			
165 183
 			// 工单详情
166 184
 			$(function(){
167 185
 				getWorkOrderDetails(wid);
@@ -177,6 +195,8 @@
177 195
 						getItemList(tabindex,wid);
178 196
 					} else if(tabindex === 4) {
179 197
 						initTableLogs();
198
+					} else if(tabindex === 5) {
199
+						getWorkOrderDe(wid);
180 200
 					}
181 201
 				});
182 202
 				//如果是来电弹屏中的 工单详情不显示关闭按钮
@@ -190,7 +210,7 @@
190 210
 				
191 211
 				$("#order_details ul li").eq(0).trigger("click");
192 212
 				//导出功能
193
-				$('#print_foot').on('click',print_list);
213
+				$('#print_foot').on('click',print_list(wid));
194 214
 			});
195 215
 			function print_list(wid){
196 216
 				var url = huayi.config.callcenter_url + "WorkOrder/ExportWorkOrder?orderid="+wid +"&token=" + $.cookie("token");

+ 70 - 1
CallCenterWeb.UI/js/WorkOrder/WorkOrder.js

@@ -810,7 +810,7 @@ function getWorkOrderDetails(detailOrderNum) {
810 810
 				$("#xq_company").text(data.County); //公司名称
811 811
 
812 812
 				$("#xq_iseffective").html(formatterIsEffective(data.IsEffective)); //工单有效性
813
-				$("#xq_source").text(formatterSource(data.GDLYName)); //工单来源
813
+				$("#xq_source").html(formatterSource(data.GDLYName)); //工单来源
814 814
 				$('#xq_handle').text(data.YWLXName); //业务办理(业务类型)	
815 815
 				$("#xq_fkdep").text(data.ResponDeptName); //接收部门
816 816
 				$("#xq_responseUser").text(data.AuditUserNameRel); //接收人
@@ -828,7 +828,76 @@ function getWorkOrderDetails(detailOrderNum) {
828 828
 		}
829 829
 	});
830 830
 }
831
+// 获取附件信息
832
+function getWorkOrderDe(wid) {
833
+	$.getJSON(huayi.config.callcenter_url + 'WorkOrder/GetWorkOrder', {
834
+		'orderid': wid,
835
+		"token": $.cookie("token")
836
+	}, function(result) {
837
+		if(result.state.toLowerCase() == "success") {
838
+			var con = result;
839
+			if (con) {			
840
+				$("#fileList").empty();
841
+				var proimglist = con.data.ResultFileUrl;
842
+				if (proimglist && proimglist.length > 0) {
843
+					$(proimglist).each(function(i, n) {
844
+						var fileType = n.F_FileType;
845
+						var fileType1 = n.F_FileType.split("\/")[0];
846
+						if (fileType === '.jpg'||fileType === '.png'||fileType1==='image') {
847
+							$('<div class="img-box">' +
848
+								'<span class="img_mask"><span onclick=downloadFile("'+ n.F_FileUrl + '","' + n.F_FileName + '","' + n.F_FileType +
849
+								'") title="点击下载"><i class="fa fa-download" aria-hidden="true"></i></span></span>' +
850
+								'<img layer-src="' + n.F_FileUrl + '" src="' + n.F_FileUrl + '" alt="' + n.F_FileName +
851
+								'" class="image-item" /><div>').appendTo("#fileList");
852
+						} else {
853
+							$('<div class="img-box">' +
854
+								'<span class="img_mask"><span href="javascript:;" onclick=downloadFile("' +  n.F_FileUrl + '","' + n.F_FileName +
855
+								'","' + n.F_FileType +
856
+								'") title="点击下载"><i class="fa fa-download" aria-hidden="true"></i></span></span>' +
857
+								'<span class="img_filename">'+n.F_OriName + n.F_FileName.split(".")[1] + '</span><div>').appendTo("#fileList");
858
+						}
859
+					});
860
+					layer.photos({
861
+						photos: '#fileList',
862
+						anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
863
+						title: '查看图片',
864
+						move: '.layui-layer-title',
865
+						shadeClose: false,
866
+						closeBtn: 1,
867
+						area: ['80%', '90%'],
868
+						tab: function(pic, layero) {
869
+							$('.layui-layer-content').on("mousewheel", function(e, d) {
870
+								
871
+								helper.methods.zoomImg($('#layui-layer-photos').find('img[alt="' + pic.alt + '"]'), d);
872
+								$('#layui-layer-photos').find('img[alt="' + pic.alt + '"]').dragging({
873
+									move: "both", //拖动方向,x y both
874
+									randomPosition: false //初始位置是否随机
875
+								});
876
+								return false;
877
+								
878
+							});
879
+							helper.methods.initLayerPhotos('#layui-layer-photos', pic, layero);
880
+						},
881
+					});
882
+				}
883
+				
884
+			}
885
+		}
886
+	});
887
+}
831 888
 
889
+//下载
890
+function downloadFile(data, strFileName, strMimeType) {
891
+	event.preventDefault();
892
+	//详细见文档 http://danml.com/download.html
893
+	var x = new XMLHttpRequest();
894
+	x.open("GET", data, true);
895
+	x.responseType = 'blob';
896
+	x.onload = function(e) {
897
+		download(x.response, strFileName, strMimeType);
898
+	}
899
+	x.send();
900
+}
832 901
 //获取修改记录
833 902
 function initTableLogs() {
834 903
 	//先销毁表格