You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

268 lines
9.6 KiB

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../../../component/layui/css/layui.css" />
<style>
th {
color: #303133;
background-color: #f5f7fa;
}
.layui-card {
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0) !important;
margin-bottom: 0 !important;
}
.layui-form-item {
margin-bottom: 0;
}
.layui-table td,
.layui-table th {
font-size: 12px;
}
.bp {
background-color: rgba(23, 179, 163, .1);
padding: 5px 10px;
height: 32px;
line-height: 30px;
font-size: 12px;
color: #17b3a3;
border-radius: 4px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid rgba(23, 179, 163, .2);
white-space: nowrap;
}
.xp {
background-color: rgba(144, 147, 153, .1);
padding: 5px 10px;
height: 32px;
line-height: 30px;
font-size: 12px;
color: #909399;
border-radius: 4px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid rgba(144, 147, 153, .2);
white-space: nowrap;
}
.woo-tool-text-delimiter {
width: 1px;
height: 12px;
background: #EEEEEE;
display: inline-block;
margin: 0 6px 0 4px;
}
.woo-theme-color {
color: #2d8cf0 !important;
}
.woo-tool-span {
margin: 0 3px;
position: relative;
top: -1px;
cursor: pointer;
}
</style>
</head>
<body class="layui-form">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form-item layui-inline">
<button class="layui-btn layui-btn-sm layui-bg-blue" lay-submit lay-filter="add">
<i class="layui-icon layui-icon-add-1"></i>
新 增
</button>
</div>
<div class="layui-form-item layui-inline" style="float: right;">
<button class="layui-btn layui-btn-sm layui-btn-primary layui-border" lay-submit lay-filter="back">
<i class="layui-icon layui-icon-return"></i>
返回
</button>
</div>
<table class="layui-table" id="myTable"></table>
<script type="text/html" id="qyrqTpl">
{{ d.qiyongriqi == '1900-01-01' ? '' : d.qiyongriqi }}
</script>
<script type="text/html" id="mjTpl">
{{ d.mj == 0 ? '' : d.mj }}
</script>
<script type="text/html" id="zhengchangTpl">
{{ d.zhengchang == 0 ? '' : d.zhengchang }}
</script>
<script type="text/html" id="daixiuTpl">
{{ d.daixiu == 0 ? '' : d.daixiu }}
</script>
<script type="text/html" id="zaixiuTpl">
{{ d.zaixiu == 0 ? '' : d.zaixiu }}
</script>
<script type="text/html" id="qxianzhiTpl">
{{ d.xianzhi == 0 ? '' : d.xianzhi }}
</script>
<script type="text/html" id="qitaTpl">
{{ d.qita == 0 ? '' : d.qita }}
</script>
<script type="text/html" id="table-bar">
<span class="woo-tool-span woo-tool-text-span" data-tool-sort="120" lay-event="edit"><a
class="woo-theme-color">编辑</a></span>
<i class="woo-tool-text-delimiter"></i>
<span class="woo-tool-span woo-tool-text-span" data-tool-sort="120" lay-event="remove"><a
class="woo-theme-color">删除</a></span>
</script>
</div>
</div>
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/xm-select.js"></script>
<script>
layui.extend({
toast: '../../../component/pear/module/toast' // {/}的意思即代表采用自有路径,即不跟随 base 路径
}).use(['toast'], function () {
var $ = layui.jquery;
var table = layui.table;
var form = layui.form;
table.render({
elem: '#myTable',
url: '/QingLong/zbdc/getXxzbdcList?dcb_id=7',
height: 'full-70',
cols: [
[
{ title: '序号', align: 'center', width: "60", type: 'numbers', rowspan: 2 },
{ title: '类别', field: 'lb_name', align: 'center', width: "160", rowspan: 2 },
{ title: '主要设备', field: 'lb_sb_name', align: 'center', width: "160", rowspan: 2 },
{ title: '品牌', field: 'pinpai', align: 'center', width: "110", rowspan: 2 },
{ title: '型号', field: 'xinghao', align: 'center', width: "110", rowspan: 2 },
{ title: '现状', align: 'center', colspan: 3 },
{ title: '工作状态', align: 'center', colspan: 6 },
{ title: '备注', field: 'beizhu', align: 'center', width: "135", rowspan: 2 },
{ title: '操作', fixed: 'right', align: 'center', width: "125", rowspan: 2, toolbar: '#table-bar' }
],
[
{ title: '主要设备情况', field: 'zysbqk', align: 'center', width: "150", rowspan: 2 },
{ title: '面积(平方米)', align: 'center', width: "110", rowspan: 2, templet: '#mjTpl' },
{ title: '启用日期', align: 'center', width: "110", rowspan: 2, templet: '#qyrqTpl' },
{ title: '正常使用(台)', align: 'center', width: "110", rowspan: 2, templet: '#zhengchangTpl' },
{ title: '待修(台)', align: 'center', width: "90", rowspan: 2, templet: '#daixiuTpl' },
{ title: '在修(台)', align: 'center', width: "90", rowspan: 2, templet: '#zaixiuTpl' },
{ title: '闲置(台)', align: 'center', width: "90", rowspan: 2, templet: '#qxianzhiTpl' },
{ title: '其他(台)', align: 'center', width: "90", rowspan: 2, templet: '#qitaTpl' },
{ title: '其它(说明原因)', field: 'yuanyin', align: 'center', width: "125", rowspan: 2 },
]
],
defaultToolbar: []
});
form.on('submit(add)', function () {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: ['990px', '500px'],
content: './xxjszb_whshkj3_add.html'
});
// 阻止表单的默认提交行为
return false;
});
form.on('submit(back)', function () {
window.location.href = "./xxjszb.html";
// 阻止表单的默认提交行为
return false;
});
table.on('tool(myTable)', function (obj) {
if (obj.event === 'remove') {
layer.confirm('确定要删除该数据吗?', {
icon: 3,
title: '提示'
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "/QingLong/zbdc/delXxzbdcSingle",
data: { dcb_id: 7, "id": obj.data.id },
type: 'post',
success: function (result) {
layer.close(loading);
if (result.success) {
layer.msg('删除成功!', {
icon: 1,
time: 1000
}, function () {
table.reload('myTable');
});
} else {
layer.msg(result.message, {
icon: 2,
time: 1000
});
}
},
error: function (xhr, status, error) {
layer.close(loading);
console.log('请求出错:' + error + ',' + status);
}
})
});
} else if (obj.event === 'edit') {
layer.open({
type: 2,
title: '编辑',
shade: 0.1,
area: ['990px', '500px'],
content: './xxjszb_whshkj3_update.html?id=' + obj.data.id
});
}
});
});
</script>
</body>
</html>