123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- {extend name="common/base"/}
- <!-- 主体 -->
- {block name="body"}
- <div class="p-3">
- <form class="layui-form gg-form-bar border-t border-x">
- <div class="layui-input-inline" style="width:300px;">
- <input type="text" name="keywords" placeholder="请输入关键字" class="layui-input" autocomplete="off" />
- </div>
- <div class="layui-input-inline">
- <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">提交搜索</button>
- </div>
- </form>
- <table class="layui-hide" id="institution" lay-filter="institution"></table>
- </div>
- <script type="text/html" id="toolbarDemo">
- <div class="layui-btn-container">
- <span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加送审单位">+ 添加业主</span>
- </div>
- </script>
- <script type="text/html" id="barDemo">
- <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>
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
- </div>
- </script>
- {/block}
- <!-- /主体 -->
- <!-- 脚本 -->
- {block name="script"}
- <script>
- const moduleInit = ['tool'];
- function gouguInit() {
- var table = layui.table,tool = layui.tool, form = layui.form;
- layui.pageTable = table.render({
- elem: '#institution',
- title: '总公司列表',
- toolbar: '#toolbarDemo',
- url: '/admin/cpuser.institution/datalist',
- page: true,
- limit: 20,
- cellMinWidth: 80,
- cols: [
- [
- {
- fixed: 'left',
- field: 'id',
- title: '编号',
- align: 'center',
- },{
- field: 'title',
- title: '送审单位',
- align: 'center',
- },{
- field: 'leader',
- title: '负责人',
- align: 'center',
- },{
- field: 'username',
- title: '负责人账号',
- align: 'center',
- },{
- field: 'phone',
- title: '电话',
- align: 'center',
- },{
- field: 'landline',
- title: '座机',
- align: 'center',
- },{
- field: 'address',
- title: '地址',
- align: 'center',
- },{
- fixed: 'right',
- field: 'right',
- title: '操作',
- toolbar: '#barDemo',
- minwidth: 80,
- align: 'center'
- }
- ]
- ]
- });
-
- //监听表头工具栏事件
- table.on('toolbar(institution)', function(obj){
- if (obj.event === 'add') {
- tool.side("/admin/cpuser.institution/add");
- return false;
- }
- });
- //监听表格行工具事件
- table.on('tool(institution)', function(obj) {
- var data = obj.data;
- if (obj.event === 'read') {
- tool.side('/admin/cpuser.institution/read?id='+obj.data.id);
- }
- else if (obj.event === 'edit') {
- tool.side('/admin/cpuser.institution/edit?id='+obj.data.id);
- console.log(obj.data.id)
- }
- else if (obj.event === 'del') {
- layer.confirm('确定要删除该记录吗?', {
- icon: 3,
- title: '提示'
- }, function(index) {
- let callback = function (e) {
- layer.msg(e.msg);
- if (e.code == 0) {
- obj.del();
- }
- }
- tool.delete("/admin/cpuser.institution/del", { id: data.id }, callback);
- layer.close(index);
- });
- }
- return false;
- });
- //监听搜索提交
- form.on('submit(searchform)', function(data) {
- layui.pageTable.reload({
- where: {
- keywords: data.field.keywords
- },
- page: {
- curr: 1
- }
- });
- return false;
- });
- }
- </script>
- {/block}
- <!-- /脚本 -->
|