|
|
@@ -0,0 +1,142 @@
|
|
|
+{extend name="public/admin_base"}
|
|
|
+{block name="content"}
|
|
|
+<div class="layui-container">
|
|
|
+ <div class="layui-card">
|
|
|
+ <div class="layui-card-header">
|
|
|
+ <div class="layui-row">
|
|
|
+ <div class="layui-col-md6">设备报修管理</div>
|
|
|
+ <div class="layui-col-md6 layui-form">
|
|
|
+ <!-- 状态筛选 -->
|
|
|
+ <div class="layui-form-item layui-form-pane" style="margin: 0; float: right;">
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="layui-form-label">处理状态</label>
|
|
|
+ <div class="layui-input-inline" style="width: 150px;">
|
|
|
+ <select name="status" lay-filter="statusFilter">
|
|
|
+ <option value="-1" {if $status == -1}selected{/if}>全部</option>
|
|
|
+ <option value="0" {if $status == 0}selected{/if}>未处理</option>
|
|
|
+ <option value="1" {if $status == 1}selected{/if}>已处理</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="layui-card-body">
|
|
|
+ <!-- 报修列表表格 -->
|
|
|
+ <table class="layui-hide" id="repairTable" lay-filter="repairTable"></table>
|
|
|
+
|
|
|
+ <!-- 表格工具栏模板 -->
|
|
|
+ <script type="text/html" id="repairToolBar">
|
|
|
+ <div class="layui-btn-container">
|
|
|
+ <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="refresh">刷新列表</button>
|
|
|
+ </div>
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <!-- 操作列模板 -->
|
|
|
+ <script type="text/html" id="repairAction">
|
|
|
+ <button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="download">下载表单</button>
|
|
|
+ {{# if(d.handle_status == 0) { }}
|
|
|
+ <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="markHandled">标记已处理</button>
|
|
|
+ {{# } }}
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <!-- 状态列模板 -->
|
|
|
+ <script type="text/html" id="repairStatus">
|
|
|
+ {{# if(d.handle_status == 0) { }}
|
|
|
+ <span class="layui-badge layui-badge-danger">未处理</span>
|
|
|
+ {{# } else { }}
|
|
|
+ <span class="layui-badge layui-badge-normal">已处理</span>
|
|
|
+ {{# } }}
|
|
|
+ </script>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+{/block}
|
|
|
+
|
|
|
+{block name="script"}
|
|
|
+<script src="{__STATIC__}/layui/layui.js"></script>
|
|
|
+<script>
|
|
|
+ layui.use(['table', 'jquery', 'form', 'layer'], function() {
|
|
|
+ var table = layui.table,
|
|
|
+ $ = layui.jquery,
|
|
|
+ form = layui.form,
|
|
|
+ layer = layui.layer;
|
|
|
+
|
|
|
+ // 渲染报修列表表格
|
|
|
+ var repairTable = table.render({
|
|
|
+ elem: '#repairTable',
|
|
|
+ url: "{:url('admin/device_repair/getRepairList')}", // 数据接口
|
|
|
+ toolbar: '#repairToolBar', // 工具栏
|
|
|
+ page: true, // 分页
|
|
|
+ limit: 10, // 每页条数
|
|
|
+ limits: [10, 20, 30],
|
|
|
+ cols: [[
|
|
|
+ {field: 'id', title: 'ID', width: 80, align: 'center'},
|
|
|
+ {field: 'repair_sn', title: '报修单号', width: 180, align: 'center'},
|
|
|
+ {field: 'device_name', title: '设备名称', width: 150, align: 'center'},
|
|
|
+ {field: 'device_number', title: '数量', width: 80, align: 'center'},
|
|
|
+ {field: 'contact_name', title: '联系人', width: 120, align: 'center'},
|
|
|
+ {field: 'contact_phone', title: '联系电话', width: 130, align: 'center'},
|
|
|
+ {field: 'create_time', title: '提交时间', width: 180, align: 'center',
|
|
|
+ templet: function(d) { return layui.util.toDateString(d.create_time * 1000, 'yyyy-MM-dd HH:mm:ss'); }},
|
|
|
+ {field: 'handle_status', title: '处理状态', width: 120, align: 'center', templet: '#repairStatus'},
|
|
|
+ {fixed: 'right', title: '操作', width: 200, align: 'center', toolbar: '#repairAction'}
|
|
|
+ ]],
|
|
|
+ where: {
|
|
|
+ status: {$status} // 状态筛选参数
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 表格工具栏事件
|
|
|
+ table.on('toolbar(repairTable)', function(obj) {
|
|
|
+ switch(obj.event) {
|
|
|
+ case 'refresh':
|
|
|
+ repairTable.reload(); // 刷新列表
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 表格行操作事件
|
|
|
+ table.on('tool(repairTable)', function(obj) {
|
|
|
+ var data = obj.data; // 当前行数据
|
|
|
+ switch(obj.event) {
|
|
|
+ // 下载表单
|
|
|
+ case 'download':
|
|
|
+ window.location.href = "{:url('admin/device_repair/download')}?id=" + data.id;
|
|
|
+ break;
|
|
|
+
|
|
|
+ // 标记已处理
|
|
|
+ case 'markHandled':
|
|
|
+ layer.confirm('确定要标记此报修单为“已处理”吗?', {icon: 3}, function(index) {
|
|
|
+ $.ajax({
|
|
|
+ url: "{:url('admin/device_repair/markHandled')}",
|
|
|
+ type: 'POST',
|
|
|
+ data: {id: data.id},
|
|
|
+ dataType: 'JSON',
|
|
|
+ success: function(res) {
|
|
|
+ if (res.code == 200) {
|
|
|
+ layer.msg(res.msg, {icon: 1});
|
|
|
+ repairTable.reload(); // 刷新列表
|
|
|
+ } else {
|
|
|
+ layer.msg(res.msg, {icon: 2});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function() {
|
|
|
+ layer.msg('网络异常,请重试', {icon: 2});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ layer.close(index);
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 状态筛选下拉框事件
|
|
|
+ form.on('select(statusFilter)', function(data) {
|
|
|
+ // 跳转到对应状态的列表页
|
|
|
+ window.location.href = "{:url('admin/device_repair/index')}?status=" + data.value;
|
|
|
+ });
|
|
|
+ });
|
|
|
+</script>
|
|
|
+{/block}
|