evaluation_radar.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>诊断用户组列表</title>
  7. </head>
  8. <body layout:fragment="content">
  9. <style>
  10. .stars {
  11. white-space: nowrap;
  12. text-align: center;
  13. }
  14. .stars li {
  15. display: inline-block;
  16. color: #ADADAD;
  17. cursor: pointer;
  18. list-style: none;
  19. }
  20. .stars li .iconfont {
  21. font-size: 30px;
  22. }
  23. .textarea-style {
  24. border: solid 1px #dadada;
  25. padding: 5px;
  26. width: 100%;
  27. height: 80px;
  28. resize: none;
  29. }
  30. .dj-style {
  31. margin-left: 10px;
  32. padding-top: 5px;
  33. }
  34. .chart_data {
  35. position: relative;
  36. border: solid 0px #dadada;
  37. padding: 0 5px;
  38. margin-top: 20px;
  39. }
  40. </style>
  41. <div class="page-container">
  42. <form class="form form-horizontal" id="form-add" style="padding-left: 13px">
  43. <div class="row cl" style="text-align: center;font-size: 20px;">
  44. 诊断满意度打分
  45. </div>
  46. <div class="row cl">
  47. <div class="chart_data mt-20 col-xs-6 col-sm-6" id="left_container">
  48. <div class="clearfix">
  49. <span class="pull-left" style="margin-top: 5px;">打分:</span>
  50. <ul class="stars pull-left">
  51. <li><i class="iconfont">&#xe610;</i></li>
  52. <li><i class="iconfont">&#xe610;</i></li>
  53. <li><i class="iconfont">&#xe610;</i></li>
  54. <li><i class="iconfont">&#xe610;</i></li>
  55. <li><i class="iconfont">&#xe610;</i></li>
  56. </ul>
  57. <div style="text-align: center">
  58. <span id="pjdj" class="dj-style"></span>
  59. <input hidden name="satisfaction_score" th:value="${satisfaction_score}"
  60. th:id="satisfaction_score"/>
  61. <input hidden name="id" th:value="${id}"/>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="chart_data mt-20 col-xs-6 col-sm-6" id="right_container">
  66. <div class="clearfix">
  67. <span class="pull-left" style="margin-top: 5px;">反馈和建议:</span>
  68. <div class="pull-left" style="width: 480px;">
  69. <textarea class="textarea-style" name="feedback" th:id="feedback"
  70. th:value="${feedback}">[[${feedback}]]</textarea>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="row cl">
  76. <div style="text-align: center">
  77. <a class="btn btn-primary radius" onclick="release()"><i class="Hui-iconfont">&#xe632;</i>确定</a>
  78. <a onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
  79. </div>
  80. </div>
  81. </form>
  82. </div>
  83. <script th:inline="javascript">
  84. $(function () {
  85. var star = $("#satisfaction_score").val();
  86. //初始化星星已选中情况
  87. initChosenStars();
  88. //为星星设置hover效果
  89. var isClicked = false;
  90. var beforeClickedIndex = -1;
  91. var clickNum = 0; //点击同一颗星次数
  92. $('.stars li').hover(
  93. function () {
  94. if (!isClicked && star<0) {
  95. $(this).css('color', '#F0AD4E');
  96. var index = $(this).index();
  97. for (var i = 0; i <= index; i++) {
  98. $('li:nth-child(' + i + ')').css('color', '#F0AD4E');
  99. }
  100. }
  101. },
  102. function () {
  103. if (!isClicked && star<0) {
  104. $('li').css('color', '#ADADAD');
  105. }
  106. }
  107. );
  108. //星星点击事件
  109. $('.stars li').click(function () {
  110. $('li').css('color', '#ADADAD');
  111. isClicked = true;
  112. var index = $(this).index();
  113. for (var i = 1; i <= index + 1; i++) {
  114. $('li:nth-child(' + i + ')').css('color', '#F0AD4E');
  115. if (index == 0) {
  116. $('#pjdj').text("不满意")
  117. $('#satisfaction_score').val(1)
  118. } else if (index == 1) {
  119. $('#pjdj').text("不太满意")
  120. $('#satisfaction_score').val(2)
  121. } else if (index == 2) {
  122. $('#pjdj').text("马马虎虎")
  123. $('#satisfaction_score').val(3)
  124. } else if (index == 3) {
  125. $('#pjdj').text("比较满意")
  126. $('#satisfaction_score').val(4)
  127. } else if (index == 4) {
  128. $('#pjdj').text("满意")
  129. $('#satisfaction_score').val(5)
  130. } else {
  131. $('#pjdj').text("")
  132. }
  133. }
  134. if (index == beforeClickedIndex) { //两次点击同一颗星星 该星星颜色变化
  135. clickNum++;
  136. if (clickNum % 2 == 1) {
  137. $('li:nth-child(' + (index + 1) + ')').css('color', '#ADADAD');
  138. $('#pjdj').text("")
  139. } else {
  140. $('li:nth-child(' + (index + 1) + ')').css('color', '#F0AD4E');
  141. }
  142. if (index - 1 == 0) {
  143. $('#pjdj').text("不满意")
  144. $('#satisfaction_score').val(1)
  145. } else if (index - 1 == 1) {
  146. $('#pjdj').text("不太满意")
  147. $('#satisfaction_score').val(2)
  148. } else if (index - 1 == 2) {
  149. $('#pjdj').text("马马虎虎")
  150. $('#satisfaction_score').val(3)
  151. } else if (index - 1 == 3) {
  152. $('#pjdj').text("比较满意")
  153. $('#satisfaction_score').val(4)
  154. } else if (index - 1 == 4) {
  155. $('#pjdj').text("满意")
  156. $('#satisfaction_score').val(5)
  157. } else {
  158. $('#pjdj').text("")
  159. }
  160. } else {
  161. clickNum = 0;
  162. beforeClickedIndex = index;
  163. }
  164. });
  165. });
  166. function initChosenStars() {
  167. //初始化星星已选中情况
  168. var chosenStars = [[${satisfaction_score}]];
  169. if (chosenStars) {
  170. for (var i = 0; i <= chosenStars; i++) {
  171. $('li:nth-child(' + i + ')').css('color', '#F0AD4E');
  172. }
  173. }
  174. if (chosenStars == 1) {
  175. $('#pjdj').text("不满意")
  176. } else if (chosenStars == 2) {
  177. $('#pjdj').text("不太满意")
  178. } else if (chosenStars == 3) {
  179. $('#pjdj').text("马马虎虎")
  180. } else if (chosenStars == 4) {
  181. $('#pjdj').text("比较满意")
  182. } else if (chosenStars == 5) {
  183. $('#pjdj').text("满意")
  184. }
  185. }
  186. function release() {
  187. var score = $("#satisfaction_score").val();
  188. var feedback = $("#feedback").text();
  189. if (!score) {
  190. errorMessage("请选择满意度");
  191. return;
  192. }
  193. if (feedback) {
  194. $("#feedback").text($.trim(feedback));
  195. if ($.trim(feedback).length > 2000) {
  196. errorMessage("反馈和建议最多支持2000个字符");
  197. return;
  198. }
  199. }
  200. $("#form-add").ajaxSubmit({
  201. type: 'post',
  202. url: pagePath + "/policy/save/evaluation",
  203. dataType: "json",
  204. data: {},
  205. success: function (data) {
  206. if (data.success) {
  207. succeedMessage(data.message);
  208. setTimeClose();
  209. } else {
  210. errorMessage(data.message);
  211. }
  212. },
  213. error: function () {
  214. errorMessage('系统错误!');
  215. }
  216. });
  217. }
  218. //取消
  219. function removeIframe() {
  220. var index = parent.layer.getFrameIndex(window.name);
  221. parent.layer.close(index);
  222. }
  223. </script>
  224. </body>
  225. </html>