|
@@ -58,10 +58,10 @@
|
|
|
<div class="layui-col-md12">
|
|
|
<div class="LAY-btns" style="margin-bottom: 10px;">
|
|
|
<div style="float: left">
|
|
|
- <button class="layui-btn" id="equipment_add" data-permission="equipment.add_equipment"><i
|
|
|
+ <button class="layui-btn" id="device_add"><i
|
|
|
class="layui-icon layui-icon-add-circle"></i>添加
|
|
|
</button>
|
|
|
- <button class="layui-nav" data-permission="equipment.add_equipment">
|
|
|
+ <button class="layui-nav">
|
|
|
<div class="layui-nav-item">
|
|
|
<a href="javascript:;" style="color:#fff;">导入</a>
|
|
|
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
|
@@ -78,11 +78,11 @@
|
|
|
</button>
|
|
|
</div>
|
|
|
<div class="seach_items">
|
|
|
- <input type="text" name="type" autocomplete="off" class="layui-input"
|
|
|
+ <input type="text" name="device_model" autocomplete="off" class="layui-input"
|
|
|
placeholder="设备型号"/>
|
|
|
</div>
|
|
|
<div class="seach_items">
|
|
|
- <input type="text" name="number" autocomplete="off" class="layui-input"
|
|
|
+ <input type="text" name="device_no" autocomplete="off" class="layui-input"
|
|
|
placeholder="设备编号"/>
|
|
|
</div>
|
|
|
<div class="seach_items">
|
|
@@ -92,14 +92,16 @@
|
|
|
</form>
|
|
|
<div style="clear: both;"></div>
|
|
|
</div>
|
|
|
- <table class="layui-hide" id="equipment_datagrid" lay-filter="equipment-operate"></table>
|
|
|
+ <table class="layui-hide" id="device_datagrid" lay-filter="device-operate"></table>
|
|
|
|
|
|
- <script type="text/html" id="equipment-operate-bar">
|
|
|
+ <script type="text/html" id="device-operate-bar">
|
|
|
<div class="layui-btn-group">
|
|
|
- <a class="layui-btn layui-btn-xs" lay-event="equipment_edit"
|
|
|
- data-permission="equipment.add_equipment">修改</a>
|
|
|
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="equipment_del"
|
|
|
- data-permission="equipment.delete_equipment">删除</a>
|
|
|
+ <a class="layui-btn layui-btn-xs" lay-event="device_edit"
|
|
|
+ >修改</a>
|
|
|
+ </div>
|
|
|
+ <div class="layui-btn-group">
|
|
|
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="device_del"
|
|
|
+ >删除</a>
|
|
|
</div>
|
|
|
</script>
|
|
|
</div>
|
|
@@ -121,15 +123,17 @@
|
|
|
, admin = layui.admin;
|
|
|
|
|
|
table.render({
|
|
|
- elem: '#equipment_datagrid'
|
|
|
- , url: '../../api/equipment.json'
|
|
|
+ elem: '#device_datagrid'
|
|
|
+ , url: '/tenant/device/'
|
|
|
, cols: [[
|
|
|
{field: 'name', title: '名称', width: 200}
|
|
|
- , {field: 'number', title: "编号", width: 200}
|
|
|
- , {field: 'type', title: '型号', width: 350}
|
|
|
- , {field: 'big_address', title: '大地点', width: 150}
|
|
|
- , {field: 'small_address', title: '小地点', width: 200}
|
|
|
- , {width: 110, align: 'center', fixed: 'right', toolbar: '#equipment-operate-bar'}
|
|
|
+ , {field: 'device_no', title: "编号", width: 200}
|
|
|
+ , {field: 'device_model', title: '型号', width: 200}
|
|
|
+ , {field: 'branch', title: '大地点', width: 150}
|
|
|
+ , {field: 'address', title: '小地点', width: 200}
|
|
|
+ , {field: 'create_user_text', title: '添加人', width: 100}
|
|
|
+ , {field: 'create_time', title: '添加时间', width: 200}
|
|
|
+ , {width: 150, align: 'center', fixed: 'right', toolbar: '#device-operate-bar'}
|
|
|
]]
|
|
|
, page: true
|
|
|
, height: 'full-108'
|
|
@@ -139,14 +143,14 @@
|
|
|
});
|
|
|
upload.render({
|
|
|
elem: '#btn_import'
|
|
|
- , url: '/tenant/equipment/import/'
|
|
|
+ , url: '/tenant/device/import/'
|
|
|
, accept: 'file'
|
|
|
, acceptMime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
, exts: 'xlsx'
|
|
|
, field: 'excel_file'
|
|
|
, done: function (res) {
|
|
|
if (res.code == 0) {
|
|
|
- table.reload('equipment_datagrid', {});
|
|
|
+ table.reload('device_datagrid', {});
|
|
|
} else {
|
|
|
layer.msg(res.msg);
|
|
|
}
|
|
@@ -156,20 +160,20 @@
|
|
|
}
|
|
|
});
|
|
|
//监听工具条
|
|
|
- table.on('tool(equipment-operate)', function (obj) {
|
|
|
+ table.on('tool(device-operate)', function (obj) {
|
|
|
var data = obj.data;
|
|
|
- if (obj.event === 'equipment_del') {
|
|
|
+ if (obj.event === 'device_del') {
|
|
|
layer.confirm('确定要删除吗?', function (index) {
|
|
|
layer.close(index);
|
|
|
admin.req({
|
|
|
- url: '/tenant/equipment/' + data.id + '/'
|
|
|
+ url: '/tenant/device/' + data.id + '/'
|
|
|
, type: 'delete'
|
|
|
, done: function (res) {
|
|
|
- table.reload('equipment_datagrid', {});
|
|
|
+ table.reload('device_datagrid', {});
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- } else if (obj.event === 'equipment_edit') {
|
|
|
+ } else if (obj.event === 'device_edit') {
|
|
|
table.editdata = data;
|
|
|
layer.open({
|
|
|
type: 2,
|
|
@@ -180,7 +184,7 @@
|
|
|
yes: function (index, dom) {
|
|
|
layui.onSubmitChild = function (data) {
|
|
|
layer.close(index);
|
|
|
- table.reload('equipment_datagrid', {});
|
|
|
+ table.reload('device_datagrid', {});
|
|
|
};
|
|
|
layui.submitChild();
|
|
|
},
|
|
@@ -193,7 +197,7 @@
|
|
|
});
|
|
|
|
|
|
form.on('submit(query-form-element1)', function (data) {
|
|
|
- table.reload('equipment_datagrid', {
|
|
|
+ table.reload('device_datagrid', {
|
|
|
where: data.field
|
|
|
, page: {curr: 1}
|
|
|
});
|
|
@@ -201,7 +205,7 @@
|
|
|
return false
|
|
|
});
|
|
|
|
|
|
- $('#equipment_add').on('click', function () {
|
|
|
+ $('#device_add').on('click', function () {
|
|
|
layer.open({
|
|
|
type: 2,
|
|
|
title: '添加',
|
|
@@ -210,7 +214,7 @@
|
|
|
yes: function (index, dom) {
|
|
|
layui.onSubmitChild = function (data) {
|
|
|
layer.close(index);
|
|
|
- table.reload('equipment_datagrid', {});
|
|
|
+ table.reload('device_datagrid', {});
|
|
|
};
|
|
|
layui.submitChild();
|
|
|
},
|