1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- {extend name="public/layout"/}
- {block name="title"}楼盘进度标签{/block}
- {block name="head"}
- {include file="public/head"}
- <style>
- html {
- width: 100%;
- height: 100%;
- background-color: white;
- }
- .data-table {
- margin: 0 10px;
- }
- </style>
- {/block}
- {block name="body"}
- <body>
- <div class="data-table">
- <table class="layui-table" id="layui-table" lay-filter="building-label"></table>
- </div>
- </body>
- {/block}
- {block name="js"}
- <script type="text/html" id="toolbar">
- <div class="layui-btn-container">
- <button class="layui-btn layui-btn-sm" lay-event="add">添加</button>
- </div>
- </script>
- <script type="text/html" id="op">
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
- </script>
- <script>
- layui.use('table', function () {
- var $ = layui.jquery,
- table = layui.table;
- let labeltable = table.render({
- elem: '#layui-table'
- , url: '{:url("buildingLabel/index")}'
- , page: false
- , toolbar: '#toolbar'
- , defaultToolbar: []
- , cols: [[
- { type: 'numbers', title: '序号', field: 'id' },
- { title: '标签名', field: 'name', edit: 'text' },
- { title: '操作', templet: '#op', width: 100 }
- ]]
- });
- table.on('edit(building-label)', function (obj) {
- $.post('{:url("buildingLabel/update")}', { id: obj.data.id, name: obj.value }, function () {
- layer.msg('修改成功', {
- anim: 0,
- time: 1000
- });
- });
- });
- table.on('tool(building-label)', function (obj) {
- if (obj.event == 'del') {
- layer.confirm('确定删除该标签?', function () {
- $.post('{:url("buildingLabel/delete")}', { id: obj.data.id }, function () {
- obj.del();
- layer.msg('删除成功', {
- anim: 0,
- time: 1000
- });
- })
- })
- }
- });
- table.on('toolbar(building-label)', function (obj) {
- console.log(obj);
- if (obj.event == 'add') {
- layer.prompt({
- title: '添加标签'
- }, function (value, index) {
- $.post('{:url("buildingLabel/save")}', { name: value }, function () {
- table.reload('layui-table');
- layer.close(index);
- });
- });
- }
- });
- });
- </script>
- {/block}
|