<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('供应信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
<!--                            <li>-->
<!--                                <p>关联商品类别表id：</p>-->
<!--                                <input type="text" name="typeId"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <p>商户表id：</p>-->
<!--                                <input type="text" name="merchantId"/>-->
<!--                            </li>-->
                            <li>
                                <p>供应标题：</p>
                                <input type="text" name="supplyTitle"/>
                            </li>
                            <li>
                                <p>生产厂家：</p>
                                <input type="text" name="manufacturer"/>
                            </li>
                            <li>
                                <p>联系人：</p>
                                <input type="text" name="contacts"/>
                            </li>
                            <li>
                                <p>联系电话：</p>
                                <input type="text" name="telephone"/>
                            </li>
                            <li class="select-time">
                                <p>发布时间：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginReleaseTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endReleaseTime]"/>
                            </li>
                            <li>
                                <p>供应状态：</p>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="0">征集中</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-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="notice:supply:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="notice:supply:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="notice:supply:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="notice:supply:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var conductStatus = [[${@dict.getType('conduct_status')}]];
        var editFlag = [[${@permission.hasPermi('notice:supply:edit')}]];
        //var detailFlag = [[${@permission.hasPermi('monitor:operlog:detail')}]];
        var removeFlag = [[${@permission.hasPermi('notice:supply:remove')}]];
        var prefix = ctx + "notice/supply";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                detailUrl: prefix + "/details/{id}",
                exportUrl: prefix + "/export",
                modalName: "供应信息",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : 'id,主键',
                    visible: false
                },
                // {
                //     field : 'typeId',
                //     title : '关联商品类别表id'
                // },
                // {
                //     field : 'merchantId',
                //     title : '商户表id'
                // },
                {
                    field : 'supplyTitle', 
                    title : '供应标题'
                },
                   /* {
                        field : 'supplyDetails',
                        title : '供应信息详情'
                    },*/
                {
                    field : 'manufacturer', 
                    title : '生产厂家'
                },
                {
                    field : 'contacts', 
                    title : '联系人'
                },
                {
                    field : 'telephone', 
                    title : '联系电话'
                },
                {
                    field : 'releaseTime', 
                    title : '发布时间',
                    formatter: function(value, row, index) {
                        return value.split(' ')[0];
                    }
                },
               /* {
                    field : 'picture',
                    title : '商品图片'
                },*/
                {
                    field : 'status', 
                    title : '供应状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(conductStatus, value);
                    }
                },
              /*  {
                    field : 'remark',
                    title : '备注'
                },*/
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改</a> ');
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });


    </script>
</body>
</html>