list.html 8.61 KB
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<th:block th:include="include :: jquery-fancybox-css" />
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
            <form id="formId">
                <div class="select-list">
                    <ul>
<!--                        <li>-->
<!--                            <label>关联单据编码:</label>-->
<!--                            <input type="text" name="referCode"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>图片关联类型:</label>-->
<!--                            <select name="referType">-->
<!--                                <option value="">所有</option>-->
<!--                                <option value="receipt">入库单</option>-->
<!--                                <option value="shipment">出库单</option>-->
<!--                            </select>-->
<!--                        </li>-->
                        <li>
                            <label>图片名称:</label>
                            <input type="text" name="name"/>
                        </li>
                        <!--<li>-->
                        <!--<label>图片格式:</label>-->
                        <!--<input type="text" name="formate"/>-->
                        <!--</li>-->
                        <!--<li>-->
                        <!--<label>`图片大小(字节):</label>-->
                        <!--<input type="text" name="size"/>-->
                        <!--</li>-->
                        <li class="select-time">
                            <label>创建时间:</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginCreated]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endCreated]"/>
                        </li>
<!--                        <li>-->
<!--                            <label>创建人:</label>-->
<!--                            <input type="text" name="createdBy"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>设备名称:</label>-->
<!--                            <input type="text" name="device"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>设备MEID:</label>-->
<!--                            <input type="text" name="meid"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>设备IP:</label>-->
<!--                            <input type="text" name="ip"/>-->
<!--                        </li>-->
                        <li>
                            <label>删除标记:</label>
                            <select name="deleted">
                                <option value="">所有</option>
                                <option value="0" th:selected="true">未删除</option>
                                <option value="1">已删除</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group hidden-xs" id="toolbar" role="group">
            <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-outline btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="task:picture:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-outline btn-danger btn-rounded multiple disabled" onclick="$.operate.batRemove()">
                <i class="fa fa-trash-o"></i> 删除
            </a>
        </div>

        <div class="col-sm-12 select-info table-striped gallery">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>

</div>
<div th:include="include :: footer"></div>
<th:block th:include="include :: jquery-fancybox-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('file:picture:edit')}]];
    var removeFlag = [[${@permission.hasPermi('file:picture:remove')}]];
    var prefix = ctx + "file/picture"
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "图片管理",
            columns: [{
                checkbox: true
            },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="#" onclick="downloads(\'' + row.url + '\',\'' + row.name + '\')" ><i class="fa fa-download"></i>下载</a> ');
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>');
                        return actions.join('');
                    }
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: true
                },
                {
                    field: 'name',
                    title: '图片名称',
                },
                {
                    field: 'url',
                    title: '图地址',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a href="' + value +'" data-fancybox="images" data-caption="' + row.referCode +'"><img width="150" src="' + value +'" alt="' + row.name +'" /></a>')
                        return actions.join(" ")
                    }
                },
                // {
                //     field: 'name',
                //     title: '图片名称'
                // },
                // {
                //     field: 'formate',
                //     title: '图片格式'
                // },
                // {
                //     field: 'size',
                //     title: '`图片大小(字节)'
                // },
                {
                    field: 'created',
                    title: '创建时间'
                },
                {
                    field: 'createdBy',
                    title: '创建人'
                },
                // {
                //     field: 'device',
                //     title: '设备名称'
                // },
                // {
                //     field: 'meid',
                //     title: '设备MEID'
                // },
                // {
                //     field: 'ip',
                //     title: '设备IP'
                // },
                {
                    field: 'description',
                    title: '备注'
                },
                {
                    field: 'deleted',
                    title: '删除标记'
                }]
        };
        $.table.init(options);
    });

    function downloads(url,name){
        let a = document.createElement("a");//创建a标签
        a.setAttribute("href", url);//设置文件下载地址
        a.setAttribute('target', '_blank');//
        a.download = name
        document.body.appendChild(a);//添加到body
        a.click();//触发事件
        document.body.removeChild(a);
    }

    // function preview(url) {
    //     $.modal.open("预览",url, 600, 800)
    // }
</script>
</body>
</html>