configuration.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('弹框配置列表')" />
  5. <style>
  6. .tableImage_s{
  7. border-radius:2px;
  8. width: 24px;
  9. height: 22px;
  10. }
  11. .tableImage_m{
  12. border-radius:2px;
  13. width: 36px;
  14. height: 30px;
  15. }
  16. .tableImage_l{
  17. border-radius:2px;
  18. width: 73px;
  19. height: 32px;
  20. }
  21. .preview-item{
  22. width: 100%;
  23. height: 100%;
  24. flex-direction: row;
  25. display: flex;
  26. justify-content: center;
  27. align-items: center;
  28. position: fixed;
  29. z-index: 100;
  30. background-color: rgba(0,0,0,0.7);
  31. }
  32. .preview-img{
  33. width: 300px;
  34. max-height: 400px;
  35. overflow-y: scroll;
  36. }
  37. </style>
  38. </head>
  39. <body class="gray-bg">
  40. <div class="container-div">
  41. <div id="previewImg" class="preview-item" onclick="closePreview()">
  42. <div class="preview-img">
  43. <img id="previewImage" src="" style="width: 100%;">
  44. </div>
  45. </div>
  46. <div class="row">
  47. <div class="col-sm-12 search-collapse">
  48. <form id="formId">
  49. <div class="select-list">
  50. <ul>
  51. <li>
  52. <p>弹框内容:</p>
  53. <input type="text" name="alertContent"/>
  54. </li>
  55. <li class="select-time">
  56. <p>弹框开始时间:</p>
  57. <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="alertStartTime"/>
  58. </li>
  59. <li class="select-time">
  60. <p>弹框结束时间:</p>
  61. <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="alertEndTime"/>
  62. </li>
  63. <li>
  64. <p>用户类型</p>
  65. <select name="userType" th:with="type=${@dict.getType('sys_lantern_permission')}">
  66. <option value="">所有</option>
  67. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  68. </select>
  69. </li>
  70. <li>
  71. <p>是否启动</p>
  72. <select name="alertStatus">
  73. <option value="">所有</option>
  74. <option value="0">未启动</option>
  75. <option value="1">启动</option>
  76. </select>
  77. </li>
  78. <li>
  79. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  80. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  81. </li>
  82. </ul>
  83. </div>
  84. </form>
  85. </div>
  86. <div class="btn-group-sm" id="toolbar" role="group">
  87. <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:configuration:add">
  88. <i class="fa fa-plus"></i> 添加
  89. </a>
  90. <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:configuration:edit">-->
  91. <!--<i class="fa fa-edit"></i> 修改-->
  92. <!--</a>-->
  93. <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:configuration:remove">-->
  94. <!--<i class="fa fa-remove"></i> 删除-->
  95. <!--</a>-->
  96. <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:configuration:export">-->
  97. <!--<i class="fa fa-download"></i> 导出-->
  98. <!--</a>-->
  99. </div>
  100. <div class="col-sm-12 select-table table-striped">
  101. <table id="bootstrap-table"></table>
  102. </div>
  103. </div>
  104. </div>
  105. <th:block th:include="include :: footer" />
  106. <script th:inline="javascript">
  107. var editFlag = [[${@permission.hasPermi('system:configuration:edit')}]];
  108. var removeFlag = [[${@permission.hasPermi('system:configuration:remove')}]];
  109. var prefix = ctx + "system/configuration";
  110. $(function() {
  111. $("#previewImg").hide();
  112. var options = {
  113. url: prefix + "/list",
  114. createUrl: prefix + "/add",
  115. updateUrl: prefix + "/edit/{id}",
  116. removeUrl: prefix + "/remove",
  117. exportUrl: prefix + "/export",
  118. modalName: "弹框配置",
  119. columns: [
  120. {
  121. field : 'alertId',
  122. title : 'id',
  123. visible: false
  124. },
  125. {
  126. field : 'alertTitle',
  127. title : '弹框标题'
  128. },
  129. {
  130. field : 'alertContent',
  131. title : '弹框内容',
  132. width : '200px',
  133. formatter: function(value, row, index) {
  134. return $.table.tooltip(value);
  135. }
  136. },
  137. {
  138. field : 'photoUrl',
  139. title : '弹框图片',
  140. width : '100px',
  141. formatter: function(value, row, index) {
  142. if (value != null){
  143. // return $.table.imageView(value,600,300,"tableImage_s img-view");
  144. var valueStr = value + '';
  145. console.log('url1',value);
  146. console.log('url2',valueStr);
  147. return '<img width="24" height="22" src="' + value + '" onclick="imgPreview(\'' + valueStr + '\')"/>'
  148. }
  149. }
  150. },
  151. {
  152. field : 'alertStartTime',
  153. title : '开始时间'
  154. },
  155. {
  156. field : 'alertEndTime',
  157. title : '结束时间'
  158. },
  159. {
  160. field : 'alertNum',
  161. title : '次数'
  162. },
  163. {
  164. field : 'orgName',
  165. title : '通知部门'
  166. },
  167. {
  168. field : 'userType',
  169. title : '用户类型',
  170. formatter: function(value, row, index) {
  171. if (value.indexOf('2') != -1){
  172. return '立邦人员、经销商';
  173. }
  174. if (value.indexOf('1') != -1) {
  175. return '经销商';
  176. }
  177. if (value.indexOf('0') != -1) {
  178. return '立邦员工';
  179. }
  180. if (value.indexOf('3') != -1) {
  181. return '其他';
  182. }
  183. }
  184. },
  185. {
  186. visible: editFlag == 'hidden' ? false : true,
  187. title: '是否启动',
  188. align: 'center',
  189. formatter: function (value, row, index) {
  190. return statusTools(row);
  191. }
  192. },
  193. {
  194. title: '操作',
  195. align: 'center',
  196. formatter: function(value, row, index) {
  197. var actions = [];
  198. if (row.alertStatus == 1) {
  199. actions.push('<a class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>编辑</a> ');
  200. actions.push('<a class="btn btn-default btn-xs ' + removeFlag + '" href="javascript:void(0)"><i class="fa fa-remove"></i>删除</a>');
  201. } else {
  202. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.alertId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  203. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.alertId + '\')"><i class="fa fa-remove"></i>删除</a>');
  204. }
  205. return actions.join('');
  206. }
  207. }]
  208. };
  209. $.table.init(options);
  210. });
  211. /* 启动状态显示 */
  212. function statusTools(row) {
  213. if (row.alertStatus == 0) {
  214. return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.alertId + '&' + row.userType + '&' + row.salesLevel + '&' + row.orgCode + '\')"></i> ';
  215. } else {
  216. return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.alertId + '&' + row.userType + '&' + row.salesLevel + '&' + row.orgCode + '\')"></i> ';
  217. }
  218. }
  219. /* 停用 */
  220. function disable(row) {
  221. var arrayTingyong = row.split('&');
  222. $.modal.confirm("确认关闭该通知吗?", function() {
  223. $.operate.post(prefix + "/release", { "alertId": arrayTingyong[0], "alertStatus": 0, "userType": arrayTingyong[1], "salesLevel": arrayTingyong[2], "orgCode": arrayTingyong[3] });
  224. })
  225. }
  226. /* 启用 */
  227. function enable(row) {
  228. var arrayQiyong = row.split('&');
  229. $.modal.confirm("确认启用该通知吗?", function() {
  230. $.operate.post(prefix + "/release", { "alertId": arrayQiyong[0], "alertStatus": 1, "userType": arrayQiyong[1], "salesLevel": arrayQiyong[2], "orgCode": arrayQiyong[3] });
  231. })
  232. }
  233. $("#previewImage").on('click',function (event) {
  234. event.stopPropagation();
  235. })
  236. function closePreview() {
  237. $("#previewImg").hide();
  238. }
  239. function imgPreview(url) {
  240. $("#previewImage").attr('src',url);
  241. $("#previewImg").show();
  242. }
  243. </script>
  244. </body>
  245. </html>