quotation.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. {include file="common/header"/}
  2. <style>
  3. .upload-wrap {
  4. position: relative;
  5. display: inline-block;
  6. overflow: hidden;
  7. border: 1px solid #2d78f4;
  8. border-radius: 3px;
  9. }
  10. .upload-wrap .file-ele {
  11. position: absolute;
  12. top: 0;
  13. right: 0;
  14. opacity: 0;
  15. height: 100%;
  16. width: 100%;
  17. cursor: pointer;
  18. }
  19. .upload-wrap .file-open {
  20. width: 90px;
  21. height: 30px;
  22. line-height: 30px;
  23. text-align: center;
  24. color: #fff;
  25. background: #3385ff;
  26. }
  27. </style>
  28. <div class="LM-container">
  29. <div class="LM-main">
  30. <fieldset class="layui-elem-field layui-field-title">
  31. <legend>开盘控制</legend>
  32. <blockquote class="layui-elem-quote">
  33. <div class="LM-table">
  34. </div>
  35. </blockquote>
  36. </fieldset>
  37. <table class="layui-table" id="list" lay-filter="list">
  38. </table>
  39. </div>
  40. </div>
  41. <script type="text/html" id="status">
  42. <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="正常|禁止" lay-filter="status" {{ d.status== 0 ? 'checked' : '' }}>
  43. </script>
  44. {include file="common/footer"/}
  45. <script src="/static/plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  46. <script>
  47. layui.use(['form', 'table'], function () {
  48. var $ = layui.jquery,
  49. form = layui.form,
  50. table = layui.table;
  51. var tableIn = table.render({
  52. elem: '#list',
  53. url: '{:url("quotation")}',
  54. method: 'post',
  55. title: '开盘控制',
  56. loading: true,
  57. toolbar: '#toolbar', //开启头部工具栏,并为其绑定左侧模板
  58. defaultToolbar: ['filter', 'exports', 'print', "excel", { //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
  59. title: '提示'
  60. , layEvent: 'LAYTABLE_TIPS'
  61. , icon: 'layui-icon-tips'
  62. }],
  63. cols: [[
  64. // {checkbox: true, fixed: true},
  65. {field: 'id', title: '星期几', width: 120, fixed: true, sort: true},
  66. {field: 'status', title: '状态', width: 120, templet: '#status'},
  67. {field: 'stat', title: '开始时间', width: 120, edit:"text"},
  68. {field: 'end', title: '结束时间', width: 120, edit:"text"},
  69. ]],
  70. limits: [10, 15, 20, 25, 50, 100],
  71. limit: 10,
  72. page: true
  73. });
  74. //监听单元格编辑
  75. table.on('edit(list)', function(obj){
  76. var value = obj.value //得到修改后的值
  77. ,data = obj.data //得到所在行所有键值
  78. ,field = obj.field; //得到字段
  79. let da={
  80. id:data.id,
  81. field:field,
  82. value:value
  83. }
  84. $.post("{:url('quotation_update_data')}", da, function (res) {
  85. if (res.code ==200) {
  86. layer.msg(res.msg, {time: 1000, icon: 1});
  87. } else {
  88. tableIn.reload()
  89. layer.msg(res.msg, {time: 1000, icon: 2});
  90. }
  91. },"json");
  92. });
  93. form.on('switch(status)', function (data) {
  94. // 修改状态
  95. loading = layer.load(1, {shade: [0.1, '#fff']});
  96. $.post("{:url('quotation_update')}", {id: data.value}, function (res) {
  97. layer.close(loading);
  98. if (res.code == 200) {
  99. layer.msg(res.msg, {time: 1000, icon: 1});
  100. } else {
  101. layer.msg(res.msg, {time: 1000, icon: 2});
  102. }
  103. }, "json");
  104. });
  105. table.on('tool(list)', function (obj) {
  106. var data = obj.data;
  107. let event = obj.event;
  108. });
  109. });
  110. </script>