Brak opisu

EvaluateEquipmentRepair.html 12KB

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