郑州第一人民医院UI

EvaluateEquipmentRepair.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link href="../../css/plugins/cropper/cropper.min.css" rel="stylesheet">
  7. <script src="../../Script/Common/huayi.load.js"></script>
  8. <script src="../../Script/Common/huayi.config.js"></script>
  9. <script src="../../js/laydate/laydate.js"></script>
  10. <link href="../../css/init.css" rel="stylesheet" />
  11. <link rel="stylesheet" type="text/css" href="../../css/Table/table1.css" />
  12. <link rel="stylesheet" href="../../css/webuploader.css" />
  13. <title>设备维修评价</title>
  14. <style>
  15. .btnn {
  16. background: #2f4050;
  17. color: #fff;
  18. padding: 3px 10px;
  19. border: 0;
  20. border-radius: 3px;
  21. cursor: pointer;
  22. }
  23. .crop_left {
  24. width: 40%;
  25. float: left;
  26. }
  27. .crop_right {
  28. width: 30%;
  29. float: right;
  30. margin-right: 25px;
  31. }
  32. .time-box .dates {
  33. width: 100%!important;
  34. }
  35. i.tub {
  36. right: 25px!important;
  37. }
  38. b.text_require {
  39. color: red;
  40. }
  41. .loader_icon {
  42. display: block;
  43. height: 36px;
  44. width: 36px;
  45. background: url(../../img/upLod.png) no-repeat;
  46. }
  47. .table_extension tr td:last-child {
  48. text-align: right !important;
  49. }
  50. .btn-label {
  51. display: inline-block;
  52. border: 1px solid #ccc;
  53. text-align: center!important;
  54. padding: 7px 14px;
  55. border-radius: 2px;
  56. text-indent: initial;
  57. margin: 5px 2px;
  58. cursor: pointer;
  59. }
  60. .btn-label.active {
  61. border: 1px solid #249fea;
  62. }
  63. </style>
  64. </head>
  65. <body class="">
  66. <div class="container wrapper-content">
  67. <div class="form-horizontal">
  68. <div class="form-group clearfix">
  69. <label for="woCode" class="col-sm-3 control-label text-right"><b class="text_require">*</b>工单编号</label>
  70. <div class="col-sm-9">
  71. <input id="woCode" class="form-control" type="text" autocomplete="off" readonly="readonly" />
  72. </div>
  73. </div>
  74. <div class="form-group clearfix">
  75. <label for="score" class="col-sm-3 control-label text-right"><b class="text_require">*</b>得分</label>
  76. <div class="col-sm-9 clearfix">
  77. <ul id="ratingScores" class="rating clearfix">
  78. <li class="rating-item" title="差"></li>
  79. <li class="rating-item" title="不满意"></li>
  80. <li class="rating-item" title="一般"></li>
  81. <li class="rating-item" title="满意"></li>
  82. <li class="rating-item" title="很满意 "></li>
  83. </ul>
  84. <span id="ratingTips" class="ratingTips"></span>
  85. </div>
  86. </div>
  87. <div class="form-group clearfix">
  88. <label for="arrivetime" class="col-sm-3 control-label text-right"><b class="text_require">*</b>维修工到场时间</label>
  89. <div class="col-sm-9">
  90. <input type="text" class="form-control" id="arrivetime" />
  91. </div>
  92. </div>
  93. <div class="form-group clearfix">
  94. <label for="evaluate" class="col-sm-3 control-label text-right">评价内容</label>
  95. <div class="col-sm-9">
  96. <textarea id="evaluate" class="form-control" name="" rows="" autocomplete="off" cols="" style="resize: none;"></textarea>
  97. </div>
  98. </div>
  99. <div class="form-group clearfix">
  100. <label for="" class="col-sm-3 control-label text-right">附件</label>
  101. <div class="col-sm-9 uploadTP">
  102. <div id="filePicker1" class="imgUpload" data-index="1">
  103. <i class="loader_icon"></i>
  104. </div>
  105. <div id='image_list1' class="row image-list"></div>
  106. </div>
  107. </div>
  108. <div class="form-group clearfix">
  109. <label for="" class="col-sm-3 control-label text-right">评价标签</label>
  110. <div class="col-sm-9 uploadTP">
  111. <div class="greetings_remarks">
  112. <span class="btn-label">维修及时</span>
  113. <span class="btn-label">态度特别棒</span>
  114. <span class="btn-label">服务专业</span>
  115. <span class="btn-label">服务态度差</span>
  116. <span class="btn-label">到场不及时</span>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="form-group clearfix">
  121. <div class="col-sm-12" style="text-align: center;">
  122. <input type="button" id="HY_save" class="btn_gray btn" onclick="btn_save()" value="评价" />
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <script src="../js/equipmentCommon.js"></script>
  128. <script src="../../js/ratingStars/ratingStars.js"></script>
  129. <script src="../../js/webuploader.min.js"></script>
  130. <script>
  131. var starNum = 0; //星星个数,默认是0
  132. var code = helper.request.queryString("code");
  133. var ids = helper.request.queryString("id");
  134. $(document).ready(function() {
  135. $('#woCode').val(code);
  136. //1 差、2 不满意、3 一般、4 满意、5 很满意
  137. rating.init('#ratingScores', {
  138. mode: 'LightEntire',
  139. num: 0,
  140. readOnly: false,
  141. select:function(num,total){
  142. var self = this;
  143. layer.tips($(self).attr('title'), '#ratingTips');
  144. // console.log(this);
  145. // $('#ratingTips').text($(this).attr('title'));
  146. // console.log('当前第' + num + '颗,一共' + total + '颗。');
  147. },
  148. chosen: function(num, total) {
  149. //console.log('当前点击的是第' + num + '颗,一共' + total + '颗。');
  150. //rating.init('#rating1','unbindEvent');//只能选择一次
  151. starNum = num;
  152. layer.closeAll();
  153. $('#ratingTips').text($(this).attr('title'));
  154. },
  155. });
  156. //日期
  157. laydate.render({
  158. elem: '#arrivetime',
  159. theme: '#249fea',
  160. type: 'datetime'
  161. });
  162. $('.greetings_remarks span').click(function() {
  163. $(this).toggleClass('active');
  164. })
  165. gettime()
  166. })
  167. // 获取完成时间
  168. function gettime(){
  169. $.ajax({
  170. type: "get",
  171. url: huayi.config.callcenter_url + "equipmentapi/api/worepairbase/getsingle",
  172. async: true,
  173. dataType: 'json',
  174. data: {
  175. id: ids,
  176. },
  177. success: function(data) {
  178. if(data.state.toLowerCase() == 'success') {
  179. console.log(data)
  180. $('#arrivetime').val(data.data.deals[0].createtime)
  181. }
  182. }
  183. });
  184. }
  185. uploaderImg(1)
  186. var imageArr1 = '';
  187. //添加图片
  188. function uploaderImg(cindex) {
  189. var imgList = $('#image_list' + cindex),
  190. eleId = $('#filePicker' + cindex),
  191. uploader;
  192. uploader = WebUploader.create({
  193. // 自动上传。
  194. auto: true,
  195. // swf文件路径
  196. swf: '../../js/Uploader.swf',
  197. // 文件接收服务端。
  198. server: huayi.config.callcenter_url + 'fileserverapi/Api/Upload',
  199. // 选择文件的按钮。可选。
  200. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  201. pick: eleId,
  202. // 图片数量限制
  203. // fileNumLimit: 4,
  204. //可以重复上传
  205. duplicate: true,
  206. formData: {
  207. uploadtype: 'equipment' //自定义文件夹用于存放图片
  208. },
  209. // 只允许选择文件,可选。
  210. accept: {
  211. title: 'Images',
  212. extensions: 'gif,jpg,jpeg,bmp,png',
  213. mimeTypes: 'image/*'
  214. },
  215. fileSizeLimit: 30 * 1024 * 1024, // 30 M
  216. fileSingleSizeLimit: 5 * 1024 * 1024, // 5 M
  217. resize: false
  218. });
  219. //上传图片提示
  220. uploader.on('error', function(handler) {
  221. switch(code) {
  222. case "Q_EXCEED_NUM_LIMIT":
  223. layer.msg('只能上传六个文件。');
  224. break;
  225. case "Q_TYPE_DENIED":
  226. layer.msg('图片类型不正确。');
  227. break;
  228. case "F_DUPLICATE":
  229. layer.msg('该文件已上传,请选择其它文件。');
  230. break;
  231. case "F_EXCEED_SIZE":
  232. layer.msg('单文件大小不能超过5M。');
  233. break;
  234. case "Q_EXCEED_SIZE_LIMIT":
  235. layer.msg('总文件大小不能超过30M。');
  236. break;
  237. default:
  238. break;
  239. }
  240. });
  241. // 当有文件添加进来的时候
  242. uploader.on('fileQueued', function(file) {
  243. console.log(file);
  244. var $li = $(
  245. '<div id="' + cindex + '' + file.id + '" class="file-item thumbnail">' +
  246. '<div class="image-close">X</div>' +
  247. '<img>' +
  248. '<div class="info">' + file.name + '</div>' +
  249. '</div>'
  250. ),
  251. $img = $li.find('img');
  252. imgList.prepend($li);
  253. $(".image-close").on('click', function() {
  254. event.stopPropagation();
  255. $(this).parent().remove();
  256. uploader.removeFile(file);
  257. helper.methods.delImgs($(this).parent().attr("data-filesmallurl"), $(this).parent().attr("data-fileurl"));
  258. file_num(cindex)
  259. });
  260. });
  261. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  262. uploader.on('uploadSuccess', function(file, response) {
  263. console.log(file)
  264. $.each(response.data, function(i, j) {
  265. // obj=
  266. var $img = $('#' + cindex + file.id).find('img');
  267. $('#' + cindex + file.id).attr({
  268. 'data-filename': j.filename,
  269. 'data-fileext': j.fileext,
  270. 'data-filemd5': j.filemd5,
  271. 'data-filesize': j.filesize,
  272. 'data-fileurl': j.fileurl,
  273. 'data-filesmallurl': j.filesmallurl
  274. });
  275. uploader.makeThumb(file, function(error, src) {
  276. $img.attr('src', j.filesmallurl);
  277. $img.addClass('image-item');
  278. // $img.attr('data-preview-group', "1");
  279. }, 50, 50);
  280. });
  281. $('#' + cindex + file.id).addClass('upload-state-done');
  282. file_num(cindex)
  283. });
  284. // 文件上传失败,现实上传出错。
  285. uploader.on('uploadError', function(file) {
  286. var $li = $('#' + cindex + file.id),
  287. $error = $li.find('div.error');
  288. // 避免重复创建
  289. if(!$error.length) {
  290. $error = $('<div class="error"></div>').appendTo($li);
  291. }
  292. $error.text('上传失败');
  293. });
  294. // 完成上传完了,成功或者失败,先删除进度条。
  295. // uploader.on('uploadComplete', function(file) {
  296. // });
  297. }
  298. //隐藏域值
  299. function file_num(num) {
  300. var arr = [];
  301. $('#image_list' + num).find('.thumbnail').each(function(j, m) {
  302. var obj = {
  303. 'filename': $(m).attr("data-filename"),
  304. 'fileext': $(m).attr("data-fileext"),
  305. 'filemd5': $(m).attr("data-filemd5"),
  306. 'filesize': $(m).attr("data-filesize"),
  307. 'fileurl': $(m).attr("data-fileurl"),
  308. 'filesmallurl': $(m).attr("data-filesmallurl")
  309. }
  310. arr.push(obj)
  311. })
  312. window['imageArr' + num] = arr;
  313. // console.log(imageArr0)
  314. }
  315. //自定义字段 数组
  316. function getExtenArr() {
  317. var extenArr = [];
  318. $('.greetings_remarks span').each(function(g, h) {
  319. if($(h).hasClass('active')) {
  320. extenArr.push($(h).text());
  321. }
  322. })
  323. // console.log(extenArr)
  324. return extenArr;
  325. }
  326. //保存
  327. function btn_save() {
  328. addValue();
  329. }
  330. //处理
  331. function addValue() {
  332. if(starNum === 0) {
  333. layer.confirm('请选择得分!', {
  334. icon: 2,
  335. btn: ['确定'] //按钮
  336. });
  337. return;
  338. }
  339. if($("#arrivetime").val() == '') {
  340. layer.confirm('请选择维修工到场时间!', {
  341. icon: 2,
  342. btn: ['确定'] //按钮
  343. });
  344. return;
  345. }
  346. $.ajax({
  347. type: "post",
  348. url: huayi.config.callcenter_url + "equipmentapi/api/worepairbase/evaluate",
  349. async: true,
  350. dataType: 'json',
  351. data: {
  352. wocode: code, //工单编号
  353. channel: 1, //渠道
  354. score: starNum, //得分
  355. arrivetime: $('#arrivetime').val(), //时间
  356. label: getExtenArr(), //标签
  357. files: imageArr1, // 处理完成照片
  358. evaluate: $('#evaluate').val() //评价内容
  359. },
  360. success: function(data) {
  361. if(data.state.toLowerCase() == 'success') {
  362. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  363. parent.layer.close(index); //再执行关闭
  364. layer.msg(data.message);
  365. parent.$('#table1').bootstrapTable('refresh');
  366. }
  367. }
  368. });
  369. }
  370. </script>
  371. </body>
  372. </html>