datalist.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .footer{
  5. width: 100%;
  6. height: 25px;
  7. text-align: center;
  8. position: fixed;
  9. bottom: 0;
  10. }
  11. .name{
  12. font-weight: 600;
  13. color: rgb(95,95,95);
  14. }
  15. .number-red{
  16. color: red;
  17. }
  18. .number-green{
  19. color: rgb(11,178,89);
  20. }
  21. .yuan{
  22. padding-right: 2vw;
  23. }
  24. .static{
  25. display: flex;
  26. }
  27. </style>
  28. {/block}
  29. <!-- 主体 -->
  30. {block name="body"}
  31. <div class="p-3">
  32. <form class="layui-form gg-form-bar border-t border-x">
  33. <div class="layui-input-inline" style="width:300px;">
  34. <input type="text" name="keywords" placeholder="请输入关键字" class="layui-input" autocomplete="off"/>
  35. </div>
  36. <div class="layui-input-inline">
  37. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
  38. </div>
  39. </form>
  40. <table class="layui-hide" id="appropriation" lay-filter="appropriation"></table>
  41. </div>
  42. <script type="text/html" id="toolbarDemo">
  43. <div class="layui-btn-container static">
  44. <div>
  45. <span class="name">评审服务费:</span><span class="number-red">{$sent_review_cost}</span><span class="yuan">元</span>
  46. <span class="name">已请款:</span><span class="number-green">{$appropriation_amount}</span><span class="yuan">元</span>
  47. <span class="name">未请款:</span><span class="number-red">{$not_appropriation_amount}</span><span class="yuan">元</span>
  48. <span class="name">已开票:</span><span class="number-green">{$invoicing_amount}</span><span class="yuan">元</span>
  49. <span class="name">未开票:</span><span class="number-red">{$not_invoicing_amount}</span><span class="yuan">元</span>
  50. </div>
  51. <!--<span class="layui-btn layui-btn-sm " data-title="添加造价项目" lay-event="add">+ 添加造价项目</span>-->
  52. </div>
  53. </script>
  54. <script type="text/html" id="barDemo">
  55. </script>
  56. {/block}
  57. <!-- /主体 -->
  58. <!-- 脚本 -->
  59. {block name="script"}
  60. <script>
  61. const moduleInit = ['tool'];
  62. function gouguInit() {
  63. var table = layui.table, tool = layui.tool, form = layui.form;
  64. var allcount;
  65. var num_aaa =0;
  66. layui.pageTable = table.render({
  67. elem: '#appropriation',
  68. title: '造价项目列表',
  69. toolbar: '#toolbarDemo',
  70. url: '/admin/project.appropriation/datalist',
  71. page: true,
  72. limit: 20,
  73. cellMinWidth: 150,
  74. parseData: function(res) { // 数据解析回调函数
  75. // 在这里可以获取数据总数
  76. allcount = res.count;
  77. return {
  78. code: res.code, // 数据状态码
  79. msg: res.msg, // 状态信息
  80. count: res.count, // 数据总数
  81. data: res.data // 当前页数据
  82. };
  83. },
  84. cols: [
  85. [
  86. {fixed: 'left', field: 'id', title: '编号', align: 'center', width: 80,
  87. templet: function(d){
  88. return allcount - (d.LAY_NUM-1);
  89. }
  90. },
  91. {
  92. field: 'status',
  93. title: '项目状态',
  94. align: 'center',
  95. width: 100,
  96. templet: function (item) {
  97. var html = '';
  98. if (item.status === 0) {
  99. html = '<span>立项中</span> ';
  100. } else if (item.status === 1) {
  101. html = '<span">审核中</span> ';
  102. num_aaa += 1;
  103. } else if (item.status === 2) {
  104. html = '<span">已通过</span> ';
  105. } else if (item.status === 3) {
  106. html = '<span">已驳回</span> ';
  107. }
  108. return html;
  109. }
  110. }, {
  111. field: 'review_unit_name',
  112. title: '送审单位',
  113. align: 'center',
  114. width: 100,
  115. }, {
  116. field: 'appropriation_amount',
  117. title: '请款金额',
  118. align: 'center',
  119. width: 100
  120. }, {
  121. field: 'appropriation_time',
  122. title: '请款时间',
  123. align: 'center',
  124. width: 150,
  125. templet: function (d) { if(d.appropriation_time){ return layui.util.toDateString(d.appropriation_time * 1000, "yyyy-MM-dd") }else{return "";}}
  126. }, {
  127. field: 'project_names',
  128. title: '相关项目',
  129. align: 'center',
  130. width: 150
  131. }, {
  132. field: 'refund_amount',
  133. title: '付款金额(元)',
  134. align: 'center',
  135. width: 150,
  136. templet:function (d){
  137. if(d.refund_amount){
  138. return `<u style="color: green">${d.refund_amount}</u>`
  139. }else {
  140. return ""
  141. }
  142. }
  143. }, {
  144. field: 'refund_time',
  145. title: '付款时间',
  146. align: 'center',
  147. width: 150,
  148. templet: function (d) { if(d.refund_time){ return layui.util.toDateString(d.refund_time * 1000, "yyyy-MM-dd") }else{return "";}}
  149. }, {
  150. field: 'invoicing_amount',
  151. title: '发票金额',
  152. align: 'center',
  153. width: 100,
  154. templet:function (d){
  155. if(d.invoicing_amount){
  156. return `<u style="color: green">${d.invoicing_amount}</u>`
  157. }else {
  158. return ""
  159. }
  160. }
  161. }, {
  162. field: 'invoicing_num',
  163. title: '发票编号',
  164. align: 'center',
  165. width: 150
  166. }, {
  167. field: 'invoice_status',
  168. title: '发票状态',
  169. align: 'center',
  170. width: 150,
  171. templet:function (d){
  172. var h="";
  173. if(d.invoice_status==1){
  174. h="已开票";
  175. }else if(d.invoice_status==0){
  176. h="未开票";
  177. }
  178. return h;
  179. }
  180. }, {
  181. field: 'invoice_type',
  182. title: '发票类型',
  183. align: 'center',
  184. width: 100,
  185. templet: function (d){
  186. var h="";
  187. if(d.invoice_type==1){
  188. h="专用发票";
  189. }else if(d.invoice_type==2){
  190. h="专用发票2";
  191. }
  192. return h;
  193. }
  194. }, {
  195. field: 'invoice_detail',
  196. title: '请款函',
  197. align: 'center',
  198. }, {
  199. field: 'maker_name',
  200. title: '创建人名称',
  201. align: 'center',
  202. }, {
  203. fixed: 'right',
  204. field: 'right',
  205. title: '操作',
  206. width: 136,
  207. align: 'center',
  208. templet:function(d){
  209. var h = "";
  210. if(d.status==1){
  211. h=`<div class="layui-btn-container"><div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a></div></div>`
  212. }else{
  213. h=`<div class="layui-btn-container"><div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a></div></div>`
  214. }
  215. return h;
  216. }
  217. }
  218. ]
  219. ],
  220. done:function () {
  221. if(num_aaa === 0){
  222. parent.showhongdian()
  223. // console.log('2执行了')
  224. }
  225. }
  226. });
  227. table.on('tool(appropriation)', function (obj) {
  228. var data = obj.data;
  229. if (obj.event === 'read') {
  230. tool.side('/admin/project.appropriation/read?id=' + obj.data.id);
  231. } else if (obj.event === 'edit') {
  232. tool.side('/admin/project.appropriation/c_edit?id=' + obj.data.id);
  233. }
  234. })
  235. //监听搜索提交
  236. form.on('submit(searchform)', function (data) {
  237. layui.pageTable.reload({
  238. where: {
  239. keywords: data.field.keywords
  240. },
  241. page: {
  242. curr: 1
  243. }
  244. });
  245. return false;
  246. });
  247. }
  248. </script>
  249. {/block}
  250. <!-- /脚本 -->