软测单独项目
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.

242 lines
9.6 KiB

11 months ago
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>车辆装备管理</title>
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<script type="text/javascript" src="../../js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="../../js/jq_extend.js"></script>
<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../css/public.css" media="all" />
<link rel="stylesheet" href="../../iconfont/iconfont.css" media="all" />
<link rel="stylesheet" href="../../css/bulletframe.css" media="all" />
<link rel="stylesheet" href="../../css/right-list.css" media="all" />
</head>
<body class="childrenBody" style="height:90%">
<div class="layui-col-lg12 layui-col-md12 layui-col-xs12"
style="
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 998;
width: auto;
overflow: hidden;
overflow-y: auto;
box-sizing: border-box;
border: 1px solid #0c6f89;
background: rgba(14, 45, 71, 0.6);
border-radius: 4px;
padding: 5px;
">
<div>
<form class="layui-form">
<blockquote class="layui-elem-quote quoteBox"
style="padding-left: 0; padding-top: 0; text-align:right;">
<div class="layui-inline">
<a class="layui-btn layui-btn-normal" id="add_btn">上传</a>
</div>
</blockquote>
<table id="carEquipListFile" lay-filter="carEquipListFile"></table>
<!--操作-->
<script type="text/html" id="carEquipListFileBar">
<a lay-event="audit"><img src="/images/xiangqing.png" style=" height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="预览" /></a>
<a lay-event="del"><img src="/images/del.png" style=" height:20px; width:20px; margin-right: 20px; cursor:pointer;" title="删除" /></a>
</script>
</form>
</div>
</div>
<script src="../../js/jquery-2.1.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: "../../js/",
}).use(['form', 'layer', 'table', 'laytpl', 'laydate', 'upload'], function () {
var form = layui.form,
layer = parent.layer === undefined ? layui.layer : top.layer,
$ = layui.jquery,
laytpl = layui.laytpl,
upload = layui.upload,
table = layui.table;
laydate = layui.laydate;
$(function () {
var id = getUrlParam("id");
//系统列表
var tableIns = table.render({
elem: "#carEquipListFile",
url: "/ashx/CarHandler.ashx",
where: {
Action: "carEquipFileList",
// 车辆信息ID
id: id,
random: new Date().getTime(),
},
cellMinWidth: 95,
page: true,
height: "full-125",
limits: [10, 15, 20, 25],
limit: 15,
id: "carEquipListFile",
cols: [
[
/* { type: "checkbox", fixed: "left", width: 50 },*/
{
field: "FILE_NAME",
title: "文件名称",
minWidth: 120,
align: "center",
},
{
field: "CREATETIME",
title: "上传时间",
minWidth: 80,
align: "center",
},
{
title: "操作",
width: 220,
templet: "#carEquipListFileBar",
fixed: "right",
align: "center",
},
],
],
});
//列表操作
table.on("tool(carEquipListFile)", function (obj) {
var layEvent = obj.event;
data = obj.data;
var clientWidth = parseInt(document.body.clientWidth * 0.8) + "px";
var clientHeight = parseInt(document.body.clientHeight * 0.9) + "px";
switch (layEvent) {
//预览
case "audit":
//查看
var index = layui.layer.open({
title: "预览",
type: 2,
area: [clientWidth, clientHeight],
maxmin: true,
content: "https://view.officeapps.live.com/op/view.aspx?src=http://xzcamp.xfzn365.com" + data.FILE_URL
});
break;
//删除
case "del":
layer.confirm('是否确认删除?', {
btn: ['确定', '取消']//按钮
}, function (index) {
layer.close(index);
//此处请求后台程序,下方是成功后的前台处理……
//提交信息
$.post(
"/ashx/CarHandler.ashx",
{
Action: "carEquipFileDel",
id: data.ID,
random: new Date().getTime(), //随机参数
},
function (res) {
table.reload("carEquipListFile", {
page: {
curr: 1 //重新从第 1 页开始
},
where: {
Action: "carEquipFileList",
// 车辆信息ID
id: id,
random: new Date().getTime(),
}
});
}
);
});
break;
}
});
//上传excel数据
upload.render({ //允许上传的文件后缀
elem: '#add_btn'
, url: '/ashx/CommonHandler.ashx' //改成您自己的上传接口
, accept: 'file' //普通文件
, exts: 'xls|excel|xlsx' //只允许上传excel
, before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
this.data = {
Action: "carEquipFileUpload",
id: id,
random: new Date().getTime() //随机参数
}
indexload = layer.load(3); //换了种风格
}
, done: function (res) {
layer.close(indexload);
console.log(res)
//layer.msg('上传成功');
table.reload("carEquipListFile", {
page: {
curr: 1 //重新从第 1 页开始
},
where: {
Action: "carEquipFileList",
// 车辆信息ID
id: id,
random: new Date().getTime(),
}
});
}
});
});
//获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}
});
</script>
</body>
</html>