personal_case_list.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. {extend name="public/layout" /} {block name="title"}个人案例{/block} {block name="body"}
  2. <link rel="stylesheet" href="__LAYUI__/common.css" media="all">
  3. <style type="text/css">
  4. html,
  5. body {
  6. display: block;
  7. min-width: 1100px;
  8. font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
  9. }
  10. .layui-table thead tr,
  11. .layui-table-header {
  12. background-color: #D8E6F1 !important;
  13. }
  14. .layui-tab {
  15. padding: 15px;
  16. height: 100%;
  17. box-sizing: border-box;
  18. }
  19. .layui-fluid {
  20. display: block;
  21. box-shadow: 0 0 4px 0 #B6CADE;
  22. border-radius: 5px;
  23. margin: 15px;
  24. background-color: #ffffff;
  25. }
  26. .layui-form-label {
  27. width: auto;
  28. }
  29. .layui-laydate-range {
  30. width: 581px;
  31. }
  32. .layui-table-page>div {
  33. display: flex;
  34. justify-content: flex-start;
  35. }
  36. .layui-btn-primary,
  37. .layui-btn-primary:hover {
  38. border: 1px solid #249EFB;
  39. background-color: #fff;
  40. color: #249EFB;
  41. }
  42. .layui-form-item .layui-inline {
  43. margin-right: 0px;
  44. }
  45. .layui-btn-normal,
  46. .layui-btn-normal:hover {
  47. border: 1px solid #249EFB;
  48. background-color: #fff;
  49. color: #249EFB;
  50. }
  51. .layui-btn-danger,
  52. .layui-btn-danger:hover {
  53. color: #FF5722;
  54. border: 1px solid #FF5722;
  55. background-color: #fff;
  56. }
  57. .li_active {
  58. font-weight: 700;
  59. background-color: #249EFB;
  60. color: #fff;
  61. }
  62. .relative {
  63. position: relative;
  64. }
  65. .noneClass {
  66. display: none !important;
  67. }
  68. .c_wordlist {
  69. width: 20px;
  70. position: absolute;
  71. top: 43px;
  72. right: 1px;
  73. display: flex;
  74. flex-direction: column;
  75. z-index: 99999;
  76. height: auto;
  77. justify-content: flex-start;
  78. align-items: center;
  79. box-sizing: border-box;
  80. padding: 4px 0px;
  81. overflow: hidden;
  82. max-height: 297px;
  83. -ms-overflow-style: none;
  84. /* IE 10+ */
  85. scrollbar-width: none;
  86. /* Firefox */
  87. overflow-y: scroll;
  88. background-color: #f5f5f5;
  89. }
  90. .c_wordlist::-webkit-scrollbar {
  91. display: none;
  92. /* Chrome Safari */
  93. }
  94. .c_wordlist>li {
  95. width: 20px;
  96. height: 37px;
  97. cursor: pointer;
  98. display: flex;
  99. justify-content: center;
  100. align-items: center;
  101. margin-bottom: 0px;
  102. line-height: 37px;
  103. }
  104. .s_wordlist {
  105. width: 20px;
  106. position: absolute;
  107. top: 43px;
  108. right: 1px;
  109. display: flex;
  110. flex-direction: column;
  111. z-index: 99999;
  112. height: auto;
  113. justify-content: flex-start;
  114. align-items: center;
  115. box-sizing: border-box;
  116. padding: 4px 0px;
  117. overflow: hidden;
  118. max-height: 297px;
  119. -ms-overflow-style: none;
  120. /* IE 10+ */
  121. scrollbar-width: none;
  122. /* Firefox */
  123. overflow-y: scroll;
  124. background-color: #f5f5f5;
  125. }
  126. .s_wordlist::-webkit-scrollbar {
  127. display: none;
  128. /* Chrome Safari */
  129. }
  130. .s_wordlist>li {
  131. width: 20px;
  132. height: 37px;
  133. cursor: pointer;
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. margin-bottom: 0px;
  138. line-height: 37px;
  139. }
  140. dd {
  141. border-bottom: 1px solid #EFEFEF;
  142. }
  143. .layui-anim-upbit {
  144. -ms-overflow-style: none;
  145. /* IE 10+ */
  146. scrollbar-width: none;
  147. /* Firefox */
  148. overflow-y: scroll;
  149. background-color: #fff;
  150. }
  151. .layui-anim-upbit::-webkit-scrollbar {
  152. display: none;
  153. /* Chrome Safari */
  154. }
  155. .layui-form-select dl {
  156. width: 100% !important;
  157. }
  158. .layui-tab {
  159. width: 98%;
  160. background-color: #fff;
  161. margin: 15px auto;
  162. box-shadow: 0 0 4px 0 #B6CADE;
  163. border-radius: 5px;
  164. }
  165. .layui-tab-title .layui-this {
  166. color: #249EFB;
  167. }
  168. .layui-tab-title .layui-this:after {
  169. width: 50px;
  170. height: 4px;
  171. background-color: #249EFB;
  172. top: 36px !important;
  173. left: 50%;
  174. transform: translateX(-50%);
  175. border: none;
  176. }
  177. .layui-tab-title li {
  178. margin: 0px 5px;
  179. }
  180. .layui-tab-title {
  181. box-sizing: border-box;
  182. border-bottom: 1px solid #f5f5f5;
  183. padding: 0px 5px;
  184. }
  185. .li_active {
  186. font-weight: 700;
  187. background-color: #249EFB;
  188. color: #fff;
  189. }
  190. .ablock {
  191. display: inline-block;
  192. width: 100%;
  193. height: 100%;
  194. }
  195. .ml5 {
  196. margin-left: 14px !important;
  197. }
  198. </style>
  199. <body>
  200. <div class="layui-tab">
  201. <ul class="layui-tab-title">
  202. <li class=""><a class="ablock" href="{:url('material/caselisting')}">公司上传</a></li>
  203. <li class="layui-this ml5">案例审核</li>
  204. <li id="details"><a class="ablock" href="{:url('material/case_data_statistics')}">数据统计</a></li>
  205. </ul>
  206. <div class="layui-tab-content">
  207. <div class="layui-tab-item layui-show">
  208. <div class="layui-card">
  209. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  210. <div class="layui-form-item">
  211. <div style="float:right;">
  212. <div class="layui-inline" style="margin-right: 0px;">
  213. <label class="layui-form-label">员工筛选</label>
  214. <div class="layui-input-inline relative">
  215. <select name="employee_id" lay-filter="employee" id="employee" lay-search>
  216. <option value="">请选择员工</option>
  217. {volist name="employee" id="t"}
  218. <option data-py="{$t.s}" value="{$t.id}">{$t.name}</option>
  219. {/volist}
  220. </select>
  221. </div>
  222. </div>
  223. <div class="layui-inline" style="margin-right: 0px;">
  224. <label class="layui-form-label">小区筛选</label>
  225. <div class="layui-input-inline relative" id="box212">
  226. <select name="community" lay-filter="community" id="community" lay-search>
  227. <option value="">请选择小区</option>
  228. {notempty name="communityList"}
  229. {volist name="communityList.arr" id="t"}
  230. <option data-py="{$t.s}" value="{$t.id}">{$t.name}</option>
  231. {/volist}
  232. {/notempty}
  233. </select>
  234. <ul class="c_wordlist noneClass">
  235. {notempty name="communityList"}
  236. {volist name="communityList.sort" id="vo"}
  237. <li data-py="{$vo}">{$vo}</li>
  238. {/volist}
  239. {/notempty}
  240. </ul>
  241. </div>
  242. </div>
  243. <div class="layui-inline" style="margin-right: 0px;">
  244. <label class="layui-form-label">设计师筛选</label>
  245. <div class="layui-input-inline relative" id="box616">
  246. <select name="designer_id" lay-filter="designer" id="designer" lay-search>
  247. <option value="">请选择设计师</option>
  248. {notempty name="designers"}
  249. {volist name="designers.arr" id="t"}
  250. <option data-py="{$t.s}" value="{$t.id}">{$t.name}</option>
  251. {/volist}
  252. {/notempty}
  253. </select>
  254. <ul class="s_wordlist noneClass">
  255. {notempty name="designers"}
  256. {volist name="designers.sort" id="vo"}
  257. <li data-py="{$vo}">{$vo}</li>
  258. {/volist}
  259. {/notempty}
  260. </ul>
  261. </div>
  262. </div>
  263. <div class="layui-inline">
  264. <button class="layui-btn layuiadmin-btn-course searchBtn submitbtn" lay-submit
  265. lay-filter="LAY-user-front-search">
  266. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  267. </button>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. <div class="layui-card-body" style="text-align: center;">
  273. <table id="personal_approval" lay-filter="personal_approval"></table>
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. </body>
  280. <script type="text/html" id="cover">
  281. {{# if(d.cover){ }}
  282. <img style="display: inline-block; width: 25%; height: 100%;" src="{{d.cover}}?x-oss-process=image/resize,w_50">
  283. {{# }else{ }}
  284. <span style="color: #cccccc;">无</span>
  285. {{# } }}
  286. </script>
  287. <script type="text/html" id="community_name">
  288. {{# if(d.community){ }}
  289. <span>{{d.community.name}}</span>
  290. {{# }else{ }}
  291. <span style="color: #cccccc;">无</span>
  292. {{# } }}
  293. </script>
  294. <script type="text/html" id="squaretpl">
  295. {{# if(d.square){ }}
  296. <span>{{d.square}}㎡</span>
  297. {{# }else{ }}
  298. <span style="color: #cccccc;">无</span>
  299. {{# } }}
  300. </script>
  301. <script type="text/html" id="housetype_name">
  302. {{# if(d.decostyle){ }}
  303. <span>{{d.decostyle.name}}</span>
  304. {{# }else{ }}
  305. <span style="color: #cccccc;">无</span>
  306. {{# } }}
  307. </script>
  308. <script type="text/html" id="designer_name">
  309. {{# if(d.designer){ }}
  310. <span>{{d.designer.name}}</span>
  311. {{# }else{ }}
  312. <span style="color: #cccccc;">无</span>
  313. {{# } }}
  314. </script>
  315. <script type="text/html" id="employee_name">
  316. {{# if(d.employee){ }}
  317. <span>{{d.employee.name}}</span>
  318. {{# }else{ }}
  319. <span style="color: #cccccc;">无</span>
  320. {{# } }}
  321. </script>
  322. <script type="text/html" id="viewQr">
  323. {{# if(d.qrcode){ }}
  324. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="viewQrcode">查看</a>
  325. {{# }else{ }}
  326. <span style="color: #cccccc;">无</span>
  327. {{# } }}
  328. </script>
  329. <script type="text/html" id="table-user-bind">
  330. {{# if(d.publish != 1){ }}
  331. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="pass">
  332. 通过
  333. </a>
  334. {{# }else{ }}
  335. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="pass">
  336. 下架
  337. </a>
  338. {{# } }}
  339. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
  340. 修改
  341. </a>
  342. <a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-danger" lay-event="del">
  343. 删除
  344. </a>
  345. </script>
  346. {/block} {block name="js"}
  347. <script>
  348. layui.config({
  349. base: '__LAYUI__/',
  350. urlbase: '/sys'
  351. }).extend({
  352. index: 'lib/index' //主入口模块
  353. }).use(['index', 'form', 'table', 'laydate'], function () {
  354. var $ = layui.$,
  355. form = layui.form,
  356. laydate = layui.laydate,
  357. table = layui.table,
  358. scrollTopNum = 0;
  359. //日期范围
  360. laydate.render({
  361. elem: '#select_date',
  362. range: true
  363. });
  364. //监听搜索
  365. form.on('submit(LAY-user-front-search)', function (data) {
  366. var field = data.field;
  367. //执行重载
  368. table.reload('personal_approval', {
  369. where: field
  370. });
  371. });
  372. //事件
  373. var active = {
  374. add: function () {
  375. layer.open({
  376. type: 2,
  377. title: ['活动添加', 'color:#333333;background-color:#D8E6F1;'],
  378. content: '{:url("activity/add")}',
  379. resize: false,
  380. area: ['80%', '80%'],
  381. // btn: ['确定', '取消'],
  382. yes: function (index, layero) {
  383. //点击确认触发 iframe 内容中的按钮提交
  384. // var submit = layero.find('iframe').contents().find("#activity-submit");
  385. // submit.click();
  386. }
  387. });
  388. }
  389. };
  390. /*---------------------------------------------------------*/
  391. $(document).click((e) => {
  392. let c_element = $('#community').next();
  393. if (c_element[0].className.indexOf('layui-form-selected') < 0) {
  394. $('.c_wordlist').addClass('noneClass');
  395. }
  396. let s_element = $('#designer').next();
  397. if (s_element[0].className.indexOf('layui-form-selected') < 0) {
  398. $('.s_wordlist').addClass('noneClass');
  399. }
  400. })
  401. $('dd').click(() => {
  402. $('.c_wordlist').addClass('noneClass');
  403. $('.s_wordlist').addClass('noneClass');
  404. })
  405. $('#box212').click(() => {
  406. $('.c_wordlist').toggleClass('noneClass');
  407. })
  408. $('#box616').click(() => {
  409. $('.s_wordlist').toggleClass('noneClass');
  410. })
  411. let xqElement = $('.layui-anim-upbit')[1];
  412. xqElement.classList.add('xqElement');
  413. let dsElement = $('.layui-anim-upbit')[2];
  414. dsElement.classList.add('dsElement');
  415. let options = [];
  416. let xqDatalist = $('#community').children();
  417. for (let i = 0; i < xqDatalist.length; i++) {
  418. if (xqDatalist[i].dataset.py) {
  419. options.push(xqDatalist[i].dataset.py)
  420. }
  421. }
  422. let options2 = [];
  423. let dsDatalist = $('#designer').children();
  424. for (let i = 0; i < dsDatalist.length; i++) {
  425. if (dsDatalist[i].dataset.py) {
  426. options2.push(dsDatalist[i].dataset.py)
  427. }
  428. }
  429. $('.c_wordlist').click((e) => {
  430. if (e.target.localName != 'li') {
  431. e.stopPropagation();
  432. return;
  433. }
  434. let index = 0;
  435. let curWord = e.target.dataset.py;
  436. let lilist = $('.c_wordlist').children();
  437. for (let i = 0; i < lilist.length; i++) {
  438. lilist[i].className = '';
  439. }
  440. if (parseInt(curWord) != NaN) {
  441. // let word1 = curWord.toLowerCase();
  442. index = options.indexOf(curWord)
  443. } else {
  444. index = options.indexOf(curWord)
  445. }
  446. setTimeout(() => {
  447. e.target.className = 'li_active';
  448. let num = index * 37 + 37;
  449. $('.xqElement').scrollTop(num);
  450. }, 50)
  451. e.stopPropagation();
  452. })
  453. $('.s_wordlist').click((e) => {
  454. if (e.target.localName != 'li') {
  455. e.stopPropagation();
  456. return;
  457. }
  458. let index = 0;
  459. let curWord = e.target.dataset.py;
  460. let lilist = $('.s_wordlist').children();
  461. for (let i = 0; i < lilist.length; i++) {
  462. lilist[i].className = '';
  463. }
  464. if (parseInt(curWord) != NaN) {
  465. // let word1 = curWord.toLowerCase();
  466. index = options2.indexOf(curWord)
  467. } else {
  468. index = options2.indexOf(curWord)
  469. }
  470. setTimeout(() => {
  471. e.target.className = 'li_active';
  472. let num = index * 37 + 37;
  473. $('.dsElement').scrollTop(num);
  474. }, 50)
  475. e.stopPropagation();
  476. })
  477. /*--------------------------------------------*/
  478. let filterData = { from: '1' };
  479. //活动列表
  480. table.render({
  481. elem: '#personal_approval',
  482. url: "{:url('material/caselist')}",
  483. where: filterData,
  484. height: 'full-160',
  485. cols: [
  486. [{
  487. align: 'center',
  488. field: 'title',
  489. title: '案例标题',
  490. minWidth: 100,
  491. templet: '#titletpl'
  492. }, {
  493. align: 'center',
  494. title: '小区名称',
  495. templet: '#community_name'
  496. }, {
  497. align: 'center',
  498. title: '房屋面积',
  499. templet: '#squaretpl'
  500. }, {
  501. align: 'center',
  502. title: '装修报价',
  503. field: 'money'
  504. }, {
  505. align: 'center',
  506. title: '装修风格',
  507. templet: '#housetype_name'
  508. },
  509. {
  510. align: 'center',
  511. title: '设计师',
  512. minWidth: 100,
  513. templet: '#designer_name'
  514. }
  515. , {
  516. align: 'center',
  517. title: '上传员工',
  518. minWidth: 100,
  519. templet: '#employee_name'
  520. },
  521. {
  522. align: 'center',
  523. field: 'addtime',
  524. title: '上传时间',
  525. minWidth: 100
  526. }, /*{
  527. align: 'center',
  528. title: '扫码预览',
  529. minWidth: 100,
  530. templet: '#viewQr'
  531. },*/ {
  532. align: 'center',
  533. title: '操作',
  534. width: 200,
  535. align: 'center',
  536. fixed: 'right',
  537. templet: "#table-user-bind"
  538. }]
  539. ],
  540. page: true,
  541. height: 'full-240',
  542. text: '对不起,加载出现异常!'
  543. });
  544. setTimeout(() => {
  545. $('.layui-table-main').scroll(function (e) {
  546. scrollTopNum = $(this).scrollTop();
  547. })
  548. }, 800)
  549. function scrollPostion(num) {
  550. $('.layui-table-main').scrollTop(num)
  551. }
  552. //监听审核
  553. table.on('tool(personal_approval)', function (obj) {
  554. var data = obj.data;
  555. if (obj.event === 'pass') {
  556. let msg = data.publish == 1 ? '确定下架当前案例?' : '确定通过审核?';
  557. layer.confirm(msg, { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
  558. $.ajax({
  559. type: "post",
  560. url: '{:url("material/apipublish")}',
  561. data: {
  562. id: data.id,
  563. cate: 'case'
  564. },
  565. success: function (res) {
  566. if (res.code == 0) {
  567. layer.msg(res.msg, {
  568. anim: 0
  569. }, function () {
  570. //执行重载
  571. table.reload('personal_approval');
  572. // obj.del();
  573. layer.close(index);
  574. });
  575. } else {
  576. layer.msg(res.msg, {
  577. anim: 6
  578. });
  579. }
  580. }
  581. });
  582. });
  583. } else if (obj.event === 'edit') {
  584. layer.open({
  585. type: 2,
  586. title: ['个人案例修改', 'color:#333333;background-color:#D8E6F1;'],
  587. content: "{:url('material/casedetail')}?id=" + data.id,
  588. // content: layui.setter.urlbase + "/activity/edit/id/" + data.id,
  589. resize: false,
  590. area: ['90%', '90%'],
  591. // btn: ['确定', '取消'],
  592. yes: function (index, layero) {
  593. //点击确认触发 iframe 内容中的按钮提交
  594. // var submit = layero.find('iframe').contents().find("#activity-submit");
  595. // submit.click();
  596. },
  597. end: function () {
  598. scrollPostion(scrollTopNum)
  599. setTimeout(() => {
  600. $('.layui-table-main').scroll(function (e) {
  601. scrollTopNum = $(this).scrollTop();
  602. console.log(scrollTopNum, '<<<记录位置');
  603. })
  604. }, 800)
  605. }
  606. });
  607. } else if (obj.event === 'del') {
  608. layer.confirm('确定删除此案例?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
  609. $.get("{:url('material/apicasedelete')}?id=" + data.id, function (res) {
  610. if (res.code == 0) {
  611. layer.msg(res.msg, {
  612. anim: 0
  613. }, function () {
  614. //执行重载
  615. table.reload('personal_approval');
  616. // obj.del();
  617. layer.close(index);
  618. });
  619. } else {
  620. layer.msg(res.msg, {
  621. anim: 6
  622. });
  623. }
  624. });
  625. });
  626. } else if (obj.event === 'viewQrcode') {
  627. layer.photos({ photos: { "data": [{ "src": data.qrcode }] }, closeBtn: true });
  628. }
  629. });
  630. form.on('switch(show)', function (obj) {
  631. var id = obj.value;
  632. $.ajax({
  633. type: "post",
  634. url: '{:url("activity/show")}',
  635. data: {
  636. id: id
  637. },
  638. success: function (res) {
  639. layer.msg(res.msg);
  640. }
  641. });
  642. });
  643. $('.layui-btn.layuiadmin-btn-course').on('click', function () {
  644. var type = $(this).data('type');
  645. active[type] ? active[type].call(this) : '';
  646. });
  647. //发布
  648. form.on('switch(show)', function (obj) {
  649. // console.log(obj)
  650. // return false;
  651. var id = obj.value;
  652. $.ajax({
  653. type: "post",
  654. url: '{:url("activity/show")}',
  655. data: {
  656. id: id,
  657. cate: 'case'
  658. },
  659. success: function (res) {
  660. layer.msg(res.msg, { time: 2000 });
  661. }
  662. });
  663. });
  664. });
  665. </script>
  666. {/block}