external_message.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. {extend name="public/layout" /} {block name="title"}装修案例列表{/block} {block name="body"}
  2. <style type="text/css">
  3. html,
  4. body {
  5. display: block;
  6. min-width: 1000px;
  7. }
  8. .layui-fluid {
  9. display: block;
  10. box-shadow: 0 0 4px 0 #B6CADE;
  11. border-radius: 5px;
  12. margin: 15px;
  13. background-color: #ffffff;
  14. box-sizing: border-box;
  15. }
  16. .layui-table thead tr,
  17. .layui-table-header {
  18. background-color: #D8E6F1 !important;
  19. }
  20. .layui-tab {
  21. padding: 15px;
  22. height: 100%;
  23. box-sizing: border-box;
  24. }
  25. .layui-form-item {
  26. width: 100%;
  27. }
  28. .layui-form-item .layui-inline {
  29. display: block;
  30. float: left;
  31. width: 145px;
  32. height: 38px;
  33. line-height: 38px;
  34. background: #FFFFFF;
  35. margin-right: 16px;
  36. }
  37. .layui-form-item .layui-input-inline {
  38. width: 145px;
  39. height: 38px;
  40. line-height: 38px;
  41. margin-bottom: 0;
  42. }
  43. .layui-form-item .layui-input-inline .layui-input {
  44. border: 1px solid #9DB6CF;
  45. border-radius: 5px;
  46. }
  47. .layui-form-select dl dd.layui-this {
  48. background-color: #249EFB;
  49. }
  50. .layui-form-item div.searchBox {
  51. width: 320px;
  52. background: #FFFFFF;
  53. border: 1px solid #B6CADE;
  54. border-radius: 24px;
  55. height: 38px;
  56. overflow: hidden;
  57. padding-left: 18px;
  58. position: relative;
  59. margin-bottom: 0px;
  60. float: right;
  61. }
  62. .searchBox .inputBox {
  63. width: 240px;
  64. float: left;
  65. height: 36px;
  66. line-height: 36px;
  67. border-width: 0;
  68. }
  69. .searchBtn {
  70. position: absolute;
  71. top: 0;
  72. right: 0;
  73. width: 51px;
  74. height: 38px;
  75. background-color: #fff;
  76. }
  77. .searchBtn img {
  78. position: absolute;
  79. width: 26px;
  80. top: 6px;
  81. left: 0;
  82. }
  83. .layui-form-label {
  84. width: auto;
  85. }
  86. .layui-btn-primary {
  87. color: #249EFB;
  88. border: 1px solid #249EFB;
  89. }
  90. .layui-btn-primary:hover {
  91. background-color: #E3F7FF;
  92. color: #249EFB;
  93. }
  94. .layui-table-page>div {
  95. display: flex;
  96. justify-content: flex-start;
  97. }
  98. .layui-btn-xs,.layui-btn-xs:hover {
  99. border: 1px solid #249EFB;
  100. background-color: #fff;
  101. color: #249EFB;
  102. padding: 0px 10px;
  103. }
  104. .layui-btn-danger,.layui-btn-danger:hover{
  105. color: #FF5722;
  106. background-color: #fff;
  107. border: 1px solid #FF5722;
  108. padding: 0px 10px;
  109. }
  110. .ml10 {
  111. margin-left: 10px;
  112. }
  113. .wxAddSend {
  114. position: relative;
  115. }
  116. .absolute-bottom {
  117. position: absolute;
  118. width: 122px;
  119. z-index: 99;
  120. display: flex;
  121. flex-direction: column;
  122. justify-content: center;
  123. align-items: center;
  124. background-color: #fff;
  125. box-sizing: border-box;
  126. padding: 5px;
  127. }
  128. .none {
  129. display: none;
  130. }
  131. </style>
  132. <body>
  133. <div class="layui-fluid">
  134. <div class="layui-card">
  135. <div class="layui-card-header layuiadmin-card-header-auto" style="padding: 15px 15px 20px;">
  136. <a type="button" class="layui-btn layui-btn-primary wxAddSend">添加群发内容</a>
  137. <div style="float:right;" class="layui-form">
  138. <div class="layui-inline">
  139. <label class="layui-form-label">群发时间</label>
  140. <div class="layui-input-inline select-date">
  141. <input type="text" name="date" id="select_date" placeholder="选择时间" autocomplete="off" class="layui-input">
  142. </div>
  143. </div>
  144. <div class="layui-inline ml10">
  145. <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
  146. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  147. </button>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="layui-card-body" style="text-align: center;">
  152. <table id="qunfa-table" lay-filter="qunfa-table"></table>
  153. </div>
  154. </div>
  155. </div>
  156. </body>
  157. {/block} {block name="js"}
  158. <script type="text/html" id="table-wxshow-action">
  159. <a class="layui-btn layui-btn-xs" lay-event="send-edit" data->编辑</a>
  160. {auth:check name="wework/delete_external_message" }
  161. <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
  162. {/auth:check}
  163. </script>
  164. <script type="text/html" id="sendtime">
  165. <span>{{d.sendtime}} -- {{d.endtime}}</span>
  166. </script>
  167. <script type="text/html" id="statistics">
  168. <a class="layui-btn layui-btn-xs" lay-event="statistics-view">查看</a>
  169. </script>
  170. <script>
  171. layui.config({
  172. base: '__LAYUI__/',
  173. urlbase: '/sys'
  174. }).extend({
  175. index: 'lib/index' //主入口模块
  176. }).use(['index', 'table', 'element', 'laydate'], function () {
  177. var $ = layui.$,
  178. form = layui.form,
  179. element = layui.element,
  180. laydate = layui.laydate,
  181. table = layui.table;
  182. //日期范围
  183. laydate.render({
  184. elem: '#select_date',
  185. range:true
  186. });
  187. // 添加群发内容
  188. $('.wxAddSend').click(function () {
  189. layer.open({
  190. type: 2,
  191. title: ['添加群发内容', 'color:#333333;background-color:#D8E6F1;'],
  192. content: '{:url("wework/add_external_message")}',
  193. resize: false,
  194. area: ['80%', '80%'],
  195. });
  196. })
  197. //监听搜索
  198. form.on('submit(LAY-app-contlist-search)', function (data) {
  199. var field = data.field;
  200. console.log(data)
  201. //执行重载
  202. table.reload('qunfa-table', {
  203. where: field
  204. , page: { curr: 1 }
  205. });
  206. });
  207. ///default entery
  208. var firstTabTableLoad = function () {
  209. //装修案例列表
  210. table.render({
  211. elem: '#qunfa-table',
  212. autoSort: false,
  213. url: "{:url('wework/external_message')}",
  214. cols: [
  215. [{
  216. align: 'center',
  217. type: 'numbers',
  218. field: 'id',
  219. width: 80,
  220. title: '序号',
  221. sort: true
  222. }, {
  223. align: 'center',
  224. field: 'content',
  225. width: 100,
  226. title: '群发内容',
  227. }, {
  228. align: 'center',
  229. title: '群发类型',
  230. field: 'send_type_name',
  231. }, {
  232. align: 'center',
  233. title: '群发对象',
  234. field: 'customer_group_name'
  235. }, {
  236. align: 'center',
  237. title: '执行人员',
  238. field: 'employee_name'
  239. },
  240. {
  241. align: 'center',
  242. field: 'square',
  243. title: '群发时间',
  244. minWidth: 300,
  245. templet: '#sendtime'
  246. }, {
  247. align: 'center',
  248. title: '执行统计',
  249. width: 100,
  250. templet: '#statistics'
  251. },
  252. {
  253. align: 'center',
  254. title: '操作',
  255. width: 240,
  256. align: 'center',
  257. fixed: 'right',
  258. templet: "#table-wxshow-action"
  259. }]
  260. ],
  261. page: true,
  262. limit: 30,
  263. height: 'full-160',
  264. text: '对不起,加载出现异常!'
  265. });
  266. //监听列表
  267. table.on('tool(qunfa-table)', function (obj) {
  268. var data = obj.data;
  269. if (obj.event === 'send-edit') {
  270. console.log(data.edit_per)
  271. if (!data.edit_per) {
  272. layer.msg('已执行群发无法编辑')
  273. return false
  274. }
  275. layer.open({
  276. type: 2,
  277. title: ['编辑群发内容', 'color:#333333;background-color:#D8E6F1;'],
  278. content: "{:url('wework/edit_external_message')}?id=" + data.id,
  279. resize: false,
  280. area: ['80%', '80%']
  281. });
  282. }
  283. if (obj.event === 'del') {
  284. layer.confirm('确定删除此群发?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
  285. $.ajax({
  286. url: "{:url('wework/delete_external_message')}",
  287. data: {
  288. id: data.id
  289. },
  290. type: 'post',
  291. success:function (res) {
  292. console.log(res)
  293. if (res.code == 0) {
  294. layer.msg('删除成功')
  295. obj.del();
  296. layer.close(index);
  297. } else {
  298. layer.msg(res.msg)
  299. }
  300. }
  301. });
  302. });
  303. }
  304. if(obj.event === 'statistics-view') {
  305. layer.open({
  306. type: 2,
  307. title: ['执行情况', 'color:#333333;background-color:#D8E6F1;'],
  308. content: "{:url('wework/statistics_external_message')}?id=" + data.id,
  309. resize: false,
  310. area: ['80%', '80%']
  311. });
  312. }
  313. });
  314. };
  315. firstTabTableLoad();
  316. var field = {};
  317. form.on('select(state)', function (data) {
  318. field['state'] = data.value;
  319. table.reload('qunfa-table', {
  320. where: field
  321. , page: { curr: 1 }
  322. });
  323. });
  324. form.on('select(user_id)', function (data) {
  325. field['user_id'] = data.value;
  326. table.reload('qunfa-table', {
  327. where: field
  328. , page: { curr: 1 }
  329. });
  330. });
  331. form.on('select(means)', function (data) {
  332. field['means'] = data.value;
  333. table.reload('qunfa-table', {
  334. where: field
  335. , page: { curr: 1 }
  336. });
  337. });
  338. form.on('select(date)', function (data) {
  339. field['date'] = data.value;
  340. table.reload('qunfa-table', {
  341. where: field
  342. , page: { curr: 1 }
  343. });
  344. });
  345. });
  346. </script>
  347. {/block}