责任制度
This commit is contained in:
parent
08565de0e3
commit
2f83444d7a
|
|
@ -143,9 +143,9 @@ def api(req):
|
|||
obj.save()
|
||||
return JsonResponse({"code":1,"url": a.url})
|
||||
#观看详情
|
||||
|
||||
elif a=='detail':
|
||||
id =req.GET.get('eduid')
|
||||
a = EdulessonWatch.objects.filter(edulesson=id).values('id','user__name','submittime')
|
||||
total = a.count()
|
||||
return HttpResponse(transjson(total,a),content_type="application/json")
|
||||
|
||||
id=req.GET.get('zrid')
|
||||
a = EdulessonWatch.objects.filter(edulesson=id).values('id','user__name','submittime')
|
||||
total = a.count()
|
||||
return HttpResponse(transjson(total,a),content_type="application/json")
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Generated by Django 2.2.8 on 2019-12-16 17:00
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0296_auto_20191206_1559'),
|
||||
('safesite', '0296_auto_20191209_1029'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# Generated by Django 2.2.8 on 2019-12-16 17:00
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0297_merge_20191216_1700'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='companyinfo',
|
||||
name='liaison_fax',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operproce',
|
||||
name='filepath',
|
||||
field=models.CharField(blank=True, max_length=200, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='operproce',
|
||||
name='operprocepath',
|
||||
field=models.CharField(blank=True, max_length=200, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='resbility',
|
||||
name='filepath',
|
||||
field=models.CharField(blank=True, max_length=200, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='resbility',
|
||||
name='resbilitypath',
|
||||
field=models.CharField(blank=True, max_length=200, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -1121,10 +1121,12 @@ class Resbility(models.Model):
|
|||
jobs = models.ForeignKey(Group,on_delete=models.CASCADE,null=True,blank=True)#岗位
|
||||
homeworktype=models.ForeignKey(Dickey,on_delete=models.CASCADE,null=True,blank=True)#作业许可类型
|
||||
department = models.ForeignKey(Partment,related_name='resbbm',on_delete=models.CASCADE,null=True,blank=True)#部门
|
||||
resbilitypath = models.CharField(max_length=200,null=True,blank=True)#上传文件
|
||||
createuser = models.ForeignKey(User,on_delete=models.CASCADE)#上传者
|
||||
createdate = models.DateTimeField(default = timezone.now)#上传时间
|
||||
usecomp = models.ForeignKey(Partment,related_name='resbgs',on_delete=models.CASCADE,null=True,blank=True)#所属公司
|
||||
deletemark = models.IntegerField(default=1)#是否删除
|
||||
filepath=models.CharField(max_length=200,null=True,blank=True)
|
||||
reads = models.IntegerField(default='0')
|
||||
#操作规程
|
||||
class Operproce(models.Model):
|
||||
|
|
@ -1133,10 +1135,12 @@ class Operproce(models.Model):
|
|||
jobs = models.ForeignKey(Group,on_delete=models.CASCADE,null=True,blank=True)#岗位
|
||||
homeworktype=models.ForeignKey(Dickey,on_delete=models.CASCADE,null=True,blank=True)#作业许可类型
|
||||
department = models.ForeignKey(Partment,related_name='optbm',on_delete=models.CASCADE,null=True,blank=True)#部门
|
||||
operprocepath = models.CharField(max_length=200,null=True,blank=True)#上传文件
|
||||
createuser = models.ForeignKey(User,on_delete=models.CASCADE)#上传者
|
||||
createdate = models.DateTimeField(default = timezone.now)#上传时间
|
||||
usecomp = models.ForeignKey(Partment,related_name='optgs',on_delete=models.CASCADE,null=True,blank=True)#所属公司
|
||||
deletemark = models.IntegerField(default=1)#是否删除
|
||||
filepath=models.CharField(max_length=200,null=True,blank=True)
|
||||
reads = models.IntegerField(default='0')
|
||||
#责任阅读表
|
||||
class Readerblility(models.Model):
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@
|
|||
<span>选择视频: </span>
|
||||
<!--文件选择按钮-->
|
||||
<a class="list" href="javascript:;">
|
||||
<input id="file" type="file" name="myfile" accept=".mp4" onchange="UpladFile();" /><span>选择视频</span>
|
||||
<input id="file" type="file" name="myfile" accept=".mp4" onchange="UpladFile(this);" /><span>选择视频</span>
|
||||
</a>
|
||||
<!--<button class="btn" type="button" onclick="sub();">上传</button>-->
|
||||
|
||||
|
|
@ -214,20 +214,47 @@
|
|||
var ot; //时间
|
||||
var oloaded;//大小
|
||||
//上传文件方法
|
||||
function UpladFile() {
|
||||
function UpladFile(target, id) {
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj.name) {
|
||||
$(".el-upload-list").css("display", "block");
|
||||
$(".el-upload-list li").css("border", "1px solid #20a0ff");
|
||||
$("#videoName").text(fileObj.name);
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj == undefined || fileObj == "") {
|
||||
alert("请选择文件");
|
||||
return false;
|
||||
};
|
||||
var imagSize = document.getElementById("file").files[0].size;
|
||||
|
||||
|
||||
|
||||
var filetypes = [".mp4"];
|
||||
var filepath = target.value;
|
||||
if (filepath) {
|
||||
var isnext = false;
|
||||
var fileend = filepath.substring(filepath.indexOf("."));
|
||||
if (filetypes && filetypes.length > 0) {
|
||||
for (var i = 0; i < filetypes.length; i++) {
|
||||
if (filetypes[i] == fileend) {
|
||||
isnext = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isnext) {
|
||||
alert("不接受此文件类型!");
|
||||
target.value = "";
|
||||
$("#videoName").text('文件格式不支持,请重新选择上传文件!');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var imagSize = fileObj.size;
|
||||
if (imagSize > 1024 * 1024 * 10) {
|
||||
alert("视频大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择3M以内的视频!");
|
||||
alert("视频大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择10M以内的视频!");
|
||||
$("#videoName").text('文件太大了超出范围!');
|
||||
return false;
|
||||
}
|
||||
var url = "edu/api/upload"; // 接收上传文件的后台地址
|
||||
|
|
@ -241,8 +268,10 @@
|
|||
xhr.upload.onloadstart = function () { //上传开始执行方法
|
||||
ot = new Date().getTime(); //设置上传开始时间
|
||||
oloaded = 0; //设置上传开始时,以上传的文件大小为0
|
||||
|
||||
};
|
||||
xhr.send(form); //开始上传,发送form数据
|
||||
$("#videoName").text(fileObj.name);
|
||||
} else {
|
||||
alert("请选择文件");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@
|
|||
<p class="_p">
|
||||
|
||||
<a class="list" href="javascript:;">
|
||||
<input id="file" type="file" name="myfile" accept=".xls,.doc,.txt,.pdf" onchange="UpladFile(); " /><span>选择文件</span>
|
||||
<input id="file" type="file" name="myfile" accept=".xls,.txt,.ppt,.doc,.pdf,dot" onchange="UpladFile(this); " /><span>选择文件</span>
|
||||
</a>
|
||||
<!--<button class="btn" type="button" onclick="sub();">上传</button>-->
|
||||
<a class="el-upload-list__item-name">
|
||||
|
|
@ -221,21 +221,46 @@
|
|||
var ot; //时间
|
||||
var oloaded;//大小
|
||||
//上传文件方法
|
||||
function UpladFile() {
|
||||
function UpladFile(target, id) {
|
||||
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj.name) {
|
||||
$(".el-upload-list").css("display", "block");
|
||||
$(".el-upload-list li").css("border", "1px solid #20a0ff");
|
||||
$("#fileName").text(fileObj.name);
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj == undefined || fileObj == "") {
|
||||
alert("请选择文件");
|
||||
return false;
|
||||
};
|
||||
var imagSize = document.getElementById("file").files[0].size;
|
||||
|
||||
|
||||
var filetypes = [".xls",".txt",".ppt",".doc",".pdf",".dot"];
|
||||
var filepath = target.value;
|
||||
if (filepath) {
|
||||
var isnext = false;
|
||||
var fileend = filepath.substring(filepath.indexOf("."));
|
||||
if (filetypes && filetypes.length > 0) {
|
||||
for (var i = 0; i < filetypes.length; i++) {
|
||||
if (filetypes[i] == fileend) {
|
||||
isnext = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isnext) {
|
||||
alert("不接受此文件类型!");
|
||||
target.value = "";
|
||||
$("#videoName").text('文件格式不支持,请重新选择上传文件!');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var imagSize = fileObj.size;
|
||||
if (imagSize > 1024 * 1024 * 3) {
|
||||
alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择3M以内的文件!");
|
||||
$("#videoName").text('文件太大了超出范围!');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -252,6 +277,7 @@
|
|||
oloaded = 0; //设置上传开始时,以上传的文件大小为0
|
||||
};
|
||||
xhr.send(form); //开始上传,发送form数据
|
||||
$("#fileName").text(fileObj.name);
|
||||
}
|
||||
|
||||
else {
|
||||
|
|
@ -312,7 +338,6 @@
|
|||
var str = data.filepath;
|
||||
document.getElementById('url').innerHTML = str;
|
||||
alert("上传成功!");
|
||||
|
||||
}
|
||||
} else {
|
||||
alert("上传失败");
|
||||
|
|
|
|||
|
|
@ -126,21 +126,16 @@
|
|||
<span>选择文件: </span>
|
||||
<!--文件选择按钮-->
|
||||
<a class="list" href="javascript:;">
|
||||
<input id="file" type="file" name="myfile" accept=".rtf,.doc,.txt,.pdf" onchange="UpladFile();" /><span>选择文件</span>
|
||||
<input id="file" type="file" name="myfile" accept=".txt,.ppt,.doc,.pdf,dot" onchange="UpladFile(this);" /><span>选择文件</span>
|
||||
</a>
|
||||
|
||||
|
||||
<a class="el-upload-list__item-name">
|
||||
<i class="el-icon-document"></i><span class="ploadname" id="fileName"></span>
|
||||
</a>
|
||||
<span id="url" style="display:none"></span>
|
||||
</p>
|
||||
<!--显示消失-->
|
||||
<ul class="el-upload-list el-upload-list--text" style="display: none;list-style-type:none">
|
||||
<li tabindex="0" class="el-upload-list__item is-success">
|
||||
<a class="el-upload-list__item-name">
|
||||
<i class="el-icon-document"></i><span class="ploadname" id="videoName">food.jpeg</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<span id="url" style="display:none"></span>
|
||||
|
||||
|
||||
<!--进度条-->
|
||||
<div class="el-progress el-progress--line" style="display: none;">
|
||||
<div class='container'>
|
||||
|
|
@ -209,36 +204,65 @@
|
|||
var ot; //时间
|
||||
var oloaded;//大小
|
||||
//上传文件方法
|
||||
function UpladFile() {
|
||||
function UpladFile(target, id) {
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj.name) {
|
||||
$(".el-upload-list").css("display", "block");
|
||||
$(".el-upload-list li").css("border", "1px solid #20a0ff");
|
||||
$("#videoName").text(fileObj.name);
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj == undefined || fileObj == "") {
|
||||
alert("请选择文件");
|
||||
return false;
|
||||
};
|
||||
var imagSize = document.getElementById("file").files[0].size;
|
||||
if (imagSize > 1024 * 1024 * 10) {
|
||||
alert("视频大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择3M以内的视频!");
|
||||
|
||||
var filetypes = [ ".txt", ".ppt", ".doc", ".pdf", ".dot"];//判断上传文件格式类型
|
||||
var filepath = target.value;
|
||||
if (filepath) {
|
||||
var isnext = false;
|
||||
var fileend = filepath.substring(filepath.indexOf("."));
|
||||
if (filetypes && filetypes.length > 0) {
|
||||
for (var i = 0; i < filetypes.length; i++) {
|
||||
if (filetypes[i] == fileend) {
|
||||
isnext = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isnext) {
|
||||
alert("不接受此文件类型!");
|
||||
target.value = "";
|
||||
$("#videoName").text('文件格式不支持,请重新选择上传文件!');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
var url = "mgt/upload"; // 接收上传文件的后台地址
|
||||
var form = new FormData(); // FormData 对象
|
||||
form.append("mf", fileObj); // 文件对象
|
||||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||||
xhr.onload = uploadComplete; //请求完成
|
||||
xhr.onerror = uploadFailed; //请求失败
|
||||
xhr.upload.onprogress = progressFunction; //【上传进度调用方法实现】
|
||||
xhr.upload.onloadstart = function () { //上传开始执行方法
|
||||
ot = new Date().getTime(); //设置上传开始时间
|
||||
oloaded = 0; //设置上传开始时,以上传的文件大小为0
|
||||
};
|
||||
xhr.send(form); //开始上传,发送form数据
|
||||
} else {
|
||||
var imagSize = fileObj.size;
|
||||
|
||||
if (imagSize > 1024 * 1024 * 10) {
|
||||
alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择10M以内的视频!");
|
||||
$("#videoName").text('文件太大了超出范围!');
|
||||
return false;
|
||||
}
|
||||
|
||||
var url = "mgt/upload"; // 接收上传文件的后台地址
|
||||
var form = new FormData(); // FormData 对象
|
||||
form.append("mf", fileObj); // 文件对象
|
||||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||||
xhr.onload = uploadComplete; //请求完成
|
||||
xhr.onerror = uploadFailed; //请求失败
|
||||
xhr.upload.onprogress = progressFunction; //【上传进度调用方法实现】
|
||||
xhr.upload.onloadstart = function () { //上传开始执行方法
|
||||
ot = new Date().getTime(); //设置上传开始时间
|
||||
oloaded = 0; //设置上传开始时,以上传的文件大小为0
|
||||
};
|
||||
xhr.send(form); //开始上传,发送form数据
|
||||
|
||||
$("#fileName").text(fileObj.name);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
alert("请选择文件");
|
||||
}
|
||||
}
|
||||
|
|
@ -297,7 +321,6 @@
|
|||
var str = data.filepath;
|
||||
document.getElementById('url').innerHTML = str;
|
||||
alert("上传成功!");
|
||||
$(".preview").append("<video controls='' autoplay='' style='width:200px;height;200px' name='media'><source src=" + str + " type='video/mp4'></video>");
|
||||
}
|
||||
} else {
|
||||
alert("上传失败");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
<div id="edubar" style="padding: 4px;height: 40px;background-color:#FCFCFC">
|
||||
<div style="width: 500px;padding: 5px;">
|
||||
<a id="addedu" class="easyui-linkbutton" onclick="javascript:opendg('新增文件','html/addoperproce')" data-options="iconCls: 'fa-plus',plain:true">新增</a>
|
||||
<a id="tzdetail" onclick="tzdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">点击查看</a>
|
||||
<a id="edulook" class="easyui-linkbutton" onclick="jydetail()" data-options="iconCls: 'fa-plus',plain:true">观看详情</a>
|
||||
<a id="deledu" class="easyui-linkbutton" onclick="deledu()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table id="mgttab" style="width:100%;height:100%;text-align: center;"></table>
|
||||
<script>
|
||||
|
||||
//点击观看
|
||||
function tzdetail() {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
if (row) {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "api/getprodata?a=readnum",
|
||||
data: { 'id': row.id },
|
||||
dateType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
document.getElementById("tzdetail").href = data.url;
|
||||
document.getElementById("tzdetail").target = '_blank';//定义成打开新窗口
|
||||
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
async: false
|
||||
});
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||||
}
|
||||
$('#mgttab').datagrid({
|
||||
url: 'api/getprodata?a=listall',
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
fitColumns: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
border: false,
|
||||
toolbar: '#edubar',
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'title', title: '操作规程名称', width: 100 },
|
||||
{ field: 'jobs__groupname', title: '操作岗位', width: 100 },
|
||||
{ field: 'homeworktype__dickeyname', title: '作业许可类型', width: 100 },
|
||||
{ field: 'department__partname', title: '操作部门', width: 100 },
|
||||
{ field: 'createdate', title: '上传时间', width: 100 },
|
||||
{ field: 'createuser__name', title: '创建人', width: 100 },
|
||||
|
||||
{ field: 'reads', title: '查看次数', width: 100, },
|
||||
|
||||
|
||||
|
||||
]]
|
||||
});
|
||||
|
||||
|
||||
function deledu() {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'api/getprodata?a=del',
|
||||
data: { 'id': row.id },
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$("#mgttab").datagrid('reload');
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '你无权删除该条责任制度!');
|
||||
}
|
||||
},
|
||||
complete: function (XMLHttpRequest, textStatus) {
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请选择一行数据!');
|
||||
}
|
||||
}
|
||||
|
||||
function jydetail() {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
if (row) {
|
||||
var url = 'html/resbility/detail/' + row.id
|
||||
|
||||
opendg('观看详情', url)
|
||||
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
<style type="text/css">
|
||||
|
||||
#content {
|
||||
border: 1px solid saddlebrown;
|
||||
padding: 16px;
|
||||
border-radius: 2px
|
||||
}
|
||||
|
||||
.list {
|
||||
top: 15px;
|
||||
width: 140px;
|
||||
height: 40px;
|
||||
border: 1px solid #0082E6;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
#file {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
color: white;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.list span {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
line-height: 40px;
|
||||
position: absolute;
|
||||
color: #0082E6;
|
||||
}
|
||||
|
||||
video {
|
||||
margin-top: 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
._p {
|
||||
margin: 14px;
|
||||
}
|
||||
|
||||
._p input {
|
||||
display: inline-block;
|
||||
width: 70%;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
._p span {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
#progress {
|
||||
height: 20px;
|
||||
background-color: orange;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.btn {
|
||||
text-align: center;
|
||||
color: #0082E6;
|
||||
width: 140px;
|
||||
height: 41px;
|
||||
border: 1px solid #0082E6;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
line-height: 40px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.ploadname {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
color: #0082E6;
|
||||
height: 40px;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
line-height: 40px;
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<form id="edu" method="post" name="edu" enctype="multipart/form-data">
|
||||
<div data-options="region:'center'" style="padding:15px 15px;">
|
||||
|
||||
<table class="listTab">
|
||||
<tr>
|
||||
<td>操作制标题:</td>
|
||||
<td>
|
||||
<input id="title" class="easyui-textbox" name="title" style="width:480px">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>操作制岗位:</td>
|
||||
<td>
|
||||
<input id="jobtype" name="group" class="easyui-textbox" style="width:480px">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>操作制部门:</td>
|
||||
<td>
|
||||
|
||||
<input id="jobpart" name="jobpart" style="width:480px;" class="easyui-textbox" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>作业许可证类型:</td>
|
||||
<td>
|
||||
<input id="grouptype" name="type" class="easyui-textbox" style="width:480px">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>上传时间:</td>
|
||||
<td>
|
||||
<input id="submittime" editable="false" name="publisdate" class="easyui-datetimebox" style="width:480px"
|
||||
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="content">
|
||||
|
||||
<p class="_p">
|
||||
<span>选择文件: </span>
|
||||
<!--文件选择按钮-->
|
||||
<a class="list" href="javascript:;">
|
||||
<input id="file" type="file" name="myfile" accept=".rtf,.doc,.txt,.pdf" onchange="UpladFile(this);" /><span>选择文件</span>
|
||||
</a>
|
||||
|
||||
|
||||
</p>
|
||||
<!--显示消失-->
|
||||
<ul class="el-upload-list el-upload-list--text" style="display: none;list-style-type:none">
|
||||
<li tabindex="0" class="el-upload-list__item is-success">
|
||||
<a class="el-upload-list__item-name">
|
||||
<i class="el-icon-document"></i><span class="ploadname" id="videoName"></span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<span id="url" style="display:none"></span>
|
||||
<!--进度条-->
|
||||
<div class="el-progress el-progress--line" style="display: none;">
|
||||
<div class='container'>
|
||||
<span id="progress"></span>
|
||||
|
||||
</div>
|
||||
<!--上传速度显示-->
|
||||
<span id="time"></span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
|
||||
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="wssubmitForm()" id="submitb">提交</a>
|
||||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#grouptype").combobox({
|
||||
url: 'api/getprodata?a=dic&&dicclass=33',
|
||||
valueField: 'value',
|
||||
textField: 'text',
|
||||
editable: false,
|
||||
});
|
||||
$("#jobtype").combobox({
|
||||
url: 'api/getresbilitydata?a=job',
|
||||
valueField: 'value',
|
||||
textField: 'text',
|
||||
editable: false,
|
||||
});
|
||||
$("#jobpart").combotree({
|
||||
url: 'api/getprodata?a=tree',
|
||||
method: 'get',
|
||||
multiple: true,
|
||||
loadFilter: function (rows) {
|
||||
return convert(rows);
|
||||
},
|
||||
formatter: function (node) {
|
||||
var s = node.text;
|
||||
if (node.children) {
|
||||
s += ' <span style=\'color:blue\'>(' + node.children.length + ')</span>';
|
||||
}
|
||||
return s;
|
||||
},
|
||||
editable: false,
|
||||
});
|
||||
function wssubmitForm() {
|
||||
|
||||
|
||||
var edudata = $('#edu').serializeJSON();
|
||||
edudata['filepath'] = document.getElementById('url').innerHTML;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/getprodata?a=add',
|
||||
data: JSON.stringify(edudata),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
var bo = $('#edu').form('validate')
|
||||
if (bo == false) {
|
||||
return bo
|
||||
} else {
|
||||
$('#submitb').linkbutton('disable');
|
||||
}
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
alert("数据保存!");
|
||||
$('#mgttab').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'); }
|
||||
$('#submitb').linkbutton('enable');
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var xhr;//异步请求对象
|
||||
var ot; //时间
|
||||
var oloaded;//大小
|
||||
//上传文件方法
|
||||
function UpladFile(target, id) {
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj.name) {
|
||||
$(".el-upload-list").css("display", "block");
|
||||
$(".el-upload-list li").css("border", "1px solid #20a0ff");
|
||||
if (fileObj == undefined || fileObj == "") {
|
||||
alert("请选择文件");
|
||||
return false;
|
||||
};
|
||||
|
||||
var filetypes = [".txt", ".ppt", ".doc", ".pdf", ".dot"];//判断上传文件格式类型
|
||||
var filepath = target.value;
|
||||
if (filepath) {
|
||||
var isnext = false;
|
||||
var fileend = filepath.substring(filepath.indexOf("."));
|
||||
if (filetypes && filetypes.length > 0) {
|
||||
for (var i = 0; i < filetypes.length; i++) {
|
||||
if (filetypes[i] == fileend) {
|
||||
isnext = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isnext) {
|
||||
alert("不接受此文件类型!");
|
||||
target.value = "";
|
||||
$("#videoName").text('文件格式不支持,请重新选择上传文件!');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
var imagSize = fileObj.size;
|
||||
|
||||
if (imagSize > 1024 * 1024 * 10) {
|
||||
alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择10M以内的视频!");
|
||||
$("#videoName").text('文件太大了超出范围!');
|
||||
return false;
|
||||
}
|
||||
|
||||
var url = "api/getprodata?a=upload"; // 接收上传文件的后台地址
|
||||
var form = new FormData(); // FormData 对象
|
||||
form.append("mf", fileObj); // 文件对象
|
||||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||||
xhr.onload = uploadComplete; //请求完成
|
||||
xhr.onerror = uploadFailed; //请求失败
|
||||
xhr.upload.onprogress = progressFunction; //【上传进度调用方法实现】
|
||||
xhr.upload.onloadstart = function () { //上传开始执行方法
|
||||
ot = new Date().getTime(); //设置上传开始时间
|
||||
oloaded = 0; //设置上传开始时,以上传的文件大小为0
|
||||
};
|
||||
xhr.send(form); //开始上传,发送form数据
|
||||
|
||||
$("#videoName").text(fileObj.name);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
alert("请选择文件");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//上传进度实现方法,上传过程中会频繁调用该方法
|
||||
function progressFunction(evt) {
|
||||
// event.total是需要传输的总字节,event.loaded是已经传输的字节。如果event.lengthComputable不为真,则event.total等于0
|
||||
if (evt.lengthComputable) {
|
||||
|
||||
$(".el-progress--line").css("display", "block");
|
||||
var percent = Math.round(evt.loaded * 100 / evt.total);
|
||||
|
||||
/*进度条显示进度*/
|
||||
document.getElementById('progress').innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";
|
||||
document.getElementById('progress').style.width = percent.toFixed(2) + '%';
|
||||
|
||||
}
|
||||
|
||||
var time = document.getElementById("time");
|
||||
var nt = new Date().getTime(); //获取当前时间
|
||||
var pertime = (nt - ot) / 1000; //计算出上次调用该方法时到现在的时间差,单位为s
|
||||
ot = new Date().getTime(); //重新赋值时间,用于下次计算
|
||||
|
||||
var perload = evt.loaded - oloaded; //计算该分段上传的文件大小,单位b
|
||||
oloaded = evt.loaded; //重新赋值已上传文件大小,用以下次计算
|
||||
|
||||
//上传速度计算
|
||||
var speed = perload / pertime; //单位b/s
|
||||
var bspeed = speed;
|
||||
var units = 'b/s'; //单位名称
|
||||
if (speed / 1024 > 1) {
|
||||
speed = speed / 1024;
|
||||
units = 'k/s';
|
||||
}
|
||||
if (speed / 1024 > 1) {
|
||||
speed = speed / 1024;
|
||||
units = 'M/s';
|
||||
}
|
||||
speed = speed.toFixed(1);
|
||||
//剩余时间
|
||||
var resttime = ((evt.total - evt.loaded) / bspeed).toFixed(1);
|
||||
time.innerHTML = '上传速度:' + speed + units + ',剩余时间:' + resttime + 's';
|
||||
if (bspeed == 0)
|
||||
time.innerHTML = '上传已取消';
|
||||
}
|
||||
//上传成功响应
|
||||
function uploadComplete(evt) {
|
||||
//服务断接收完文件返回的结果 注意返回的字符串要去掉双引号
|
||||
|
||||
if (evt.target.responseText) {
|
||||
var data = JSON.parse(evt.target.responseText);
|
||||
if (data.code = 1) {
|
||||
|
||||
var str = data.filepath;
|
||||
document.getElementById('url').innerHTML = str;
|
||||
alert("上传成功!");
|
||||
}
|
||||
} else {
|
||||
alert("上传失败");
|
||||
}
|
||||
}
|
||||
//上传失败
|
||||
function uploadFailed(evt) {
|
||||
alert("上传失败!");
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
<div style="height:100%;">
|
||||
<table id="zrtable" style="width:100%;height:100%"></table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var id = {{ id }};
|
||||
$('#zrtable').datagrid({
|
||||
url: 'api/getprodata?a=detail&zrid='+id,
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
fitColumns: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
toolbar: '#zytablebar',
|
||||
border:false,
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'readeruser__name', title: '查看人姓名', width: 100 },
|
||||
{ field: 'readertime', title: '查阅时间', width: 100 },
|
||||
|
||||
]]
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
<div id="edubar" style="padding: 4px;height: 40px;background-color:#FCFCFC">
|
||||
<div style="width: 500px;padding: 5px;">
|
||||
<a id="addedu" class="easyui-linkbutton" onclick="javascript:opendg('新增文件','html/addresbility')" data-options="iconCls: 'fa-plus',plain:true">新增</a>
|
||||
<a id="tzdetail" onclick="tzdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">点击查看</a>
|
||||
<a id="edulook" class="easyui-linkbutton" onclick="jydetail()" data-options="iconCls: 'fa-plus',plain:true">观看详情</a>
|
||||
<a id="deledu" class="easyui-linkbutton" onclick="deledu()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table id="mgttab" style="width:100%;height:100%;text-align: center;"></table>
|
||||
<script>
|
||||
|
||||
//点击观看
|
||||
function tzdetail() {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
if (row) {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "api/getresbilitydata?a=readnum",
|
||||
data: { 'id': row.id },
|
||||
dateType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
document.getElementById("tzdetail").href = data.url;
|
||||
document.getElementById("tzdetail").target = '_blank';//定义成打开新窗口
|
||||
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
async: false
|
||||
});
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||||
}
|
||||
$('#mgttab').datagrid({
|
||||
url: 'api/getresbilitydata?a=listall',
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
fitColumns: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
border: false,
|
||||
toolbar:'#edubar',
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'title', title: '制度名称', width: 100 },
|
||||
{ field: 'jobs__groupname', title: '岗位', width: 100 },
|
||||
{ field: 'homeworktype__dickeyname', title: '作业许可类型', width: 100 },
|
||||
{ field: 'department__partname', title: '部门', width: 100 },
|
||||
{ field: 'createdate', title: '上传时间', width: 100 },
|
||||
{ field: 'createuser__name', title: '创建人', width: 100 },
|
||||
|
||||
{field: 'reads', title: '查看次数', width: 100,},
|
||||
|
||||
|
||||
|
||||
]]
|
||||
});
|
||||
|
||||
|
||||
function deledu() {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'api/getresbilitydata?a=del',
|
||||
data: { 'id': row.id },
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$("#mgttab").datagrid('reload');
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '你无权删除该条责任制度!');
|
||||
}
|
||||
},
|
||||
complete: function (XMLHttpRequest, textStatus) {
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请选择一行数据!');
|
||||
}
|
||||
}
|
||||
|
||||
function jydetail() {
|
||||
var row = $('#mgttab').datagrid('getSelected');
|
||||
if (row) {
|
||||
var url = 'html/resbility/detail/' + row.id
|
||||
|
||||
opendg('观看详情', url)
|
||||
|
||||
}
|
||||
else { $.messager.alert('提示', '请选择一行数据!'); }
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
<style type="text/css">
|
||||
|
||||
#content {
|
||||
border: 1px solid saddlebrown;
|
||||
padding: 16px;
|
||||
border-radius: 2px
|
||||
}
|
||||
|
||||
.list {
|
||||
top: 15px;
|
||||
width: 140px;
|
||||
height: 40px;
|
||||
border: 1px solid #0082E6;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
#file {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
color: white;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.list span {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
line-height: 40px;
|
||||
position: absolute;
|
||||
color: #0082E6;
|
||||
}
|
||||
|
||||
video {
|
||||
margin-top: 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
._p {
|
||||
margin: 14px;
|
||||
}
|
||||
|
||||
._p input {
|
||||
display: inline-block;
|
||||
width: 70%;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
._p span {
|
||||
font-size: 15px;
|
||||
}
|
||||
.container {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
background-color: gray;
|
||||
|
||||
}
|
||||
|
||||
#progress {
|
||||
height: 20px;
|
||||
background-color: orange;
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
.btn {
|
||||
text-align: center;
|
||||
color: #0082E6;
|
||||
width: 140px;
|
||||
height: 41px;
|
||||
border: 1px solid #0082E6;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
line-height: 40px;
|
||||
background-color: white;
|
||||
}
|
||||
.ploadname {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
color: #0082E6;
|
||||
height: 40px;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
line-height: 40px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="easyui-layout" style="width:100%;height:100%;">
|
||||
<form id="edu" method="post" name="edu" enctype="multipart/form-data">
|
||||
<div data-options="region:'center'" style="padding:15px 15px;">
|
||||
|
||||
<table class="listTab">
|
||||
<tr>
|
||||
<td>责任制标题:</td>
|
||||
<td>
|
||||
<input id="title" class="easyui-textbox" name="title" style="width:480px">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>责任制岗位:</td>
|
||||
<td>
|
||||
<input id="jobtype" name="group" class="easyui-textbox" style="width:480px">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>责任制部门:</td>
|
||||
<td>
|
||||
|
||||
<input id="jobpart" name="jobpart" style="width:480px;" class="easyui-textbox" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>作业许可证类型:</td>
|
||||
<td>
|
||||
<input id="grouptype" name="type" class="easyui-textbox" style="width:480px">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>上传时间:</td>
|
||||
<td>
|
||||
<input id="submittime" editable="false" name="publisdate" class="easyui-datetimebox" style="width:480px"
|
||||
data-options="currentText:'今天',closeText:'关闭',showSeconds:false" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="content">
|
||||
|
||||
<p class="_p">
|
||||
<span>选择文件: </span>
|
||||
<!--文件选择按钮-->
|
||||
<a class="list" href="javascript:;">
|
||||
<input id="file" type="file" name="myfile" accept=".rtf,.doc,.txt,.pdf" onchange="UpladFile(this);" /><span>选择文件</span>
|
||||
</a>
|
||||
|
||||
|
||||
</p>
|
||||
<!--显示消失-->
|
||||
<ul class="el-upload-list el-upload-list--text" style="display: none;list-style-type:none">
|
||||
<li tabindex="0" class="el-upload-list__item is-success">
|
||||
<a class="el-upload-list__item-name">
|
||||
<i class="el-icon-document"></i><span class="ploadname" id="videoName"></span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<span id="url" style="display:none"></span>
|
||||
<!--进度条-->
|
||||
<div class="el-progress el-progress--line" style="display: none;">
|
||||
<div class='container'>
|
||||
<span id="progress"></span>
|
||||
|
||||
</div>
|
||||
<!--上传速度显示-->
|
||||
<span id="time"></span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
|
||||
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="wssubmitForm()" id="submitb">提交</a>
|
||||
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#grouptype").combobox({
|
||||
url: 'api/getresbilitydata?a=dic&&dicclass=33',
|
||||
valueField: 'value',
|
||||
textField: 'text',
|
||||
editable: false,
|
||||
});
|
||||
$("#jobtype").combobox({
|
||||
url: 'api/getresbilitydata?a=job',
|
||||
valueField: 'value',
|
||||
textField: 'text',
|
||||
editable: false,
|
||||
});
|
||||
$("#jobpart").combotree({
|
||||
url: 'api/getresbilitydata?a=tree',
|
||||
method: 'get',
|
||||
multiple: true,
|
||||
loadFilter: function (rows) {
|
||||
return convert(rows);
|
||||
},
|
||||
formatter: function (node) {
|
||||
var s = node.text;
|
||||
if (node.children) {
|
||||
s += ' <span style=\'color:blue\'>(' + node.children.length + ')</span>';
|
||||
}
|
||||
return s;
|
||||
},
|
||||
editable: false,
|
||||
});
|
||||
function wssubmitForm() {
|
||||
|
||||
|
||||
var edudata = $('#edu').serializeJSON();
|
||||
edudata['filepath'] = document.getElementById('url').innerHTML;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'api/getresbilitydata?a=add',
|
||||
data: JSON.stringify(edudata),
|
||||
datatype: "json",
|
||||
processData: false,
|
||||
contentType: "application/json;charset=utf-8",
|
||||
beforeSend: function () {
|
||||
var bo = $('#edu').form('validate')
|
||||
if (bo == false) {
|
||||
return bo
|
||||
} else {
|
||||
$('#submitb').linkbutton('disable');
|
||||
}
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
alert("数据保存!");
|
||||
$('#mgttab').datagrid('reload');
|
||||
$("#dd").dialog("close");
|
||||
} else { $.messager.alert('提示', '失败!'); }
|
||||
$('#submitb').linkbutton('enable');
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var xhr;//异步请求对象
|
||||
var ot; //时间
|
||||
var oloaded;//大小
|
||||
//上传文件方法
|
||||
function UpladFile(target, id) {
|
||||
var fileObj = document.getElementById("file").files[0]; // js 获取文件对象
|
||||
if (fileObj.name) {
|
||||
$(".el-upload-list").css("display", "block");
|
||||
$(".el-upload-list li").css("border", "1px solid #20a0ff");
|
||||
if (fileObj == undefined || fileObj == "") {
|
||||
alert("请选择文件");
|
||||
return false;
|
||||
};
|
||||
|
||||
var filetypes = [ ".txt", ".ppt", ".doc", ".pdf", ".dot"];//判断上传文件格式类型
|
||||
var filepath = target.value;
|
||||
if (filepath) {
|
||||
var isnext = false;
|
||||
var fileend = filepath.substring(filepath.indexOf("."));
|
||||
if (filetypes && filetypes.length > 0) {
|
||||
for (var i = 0; i < filetypes.length; i++) {
|
||||
if (filetypes[i] == fileend) {
|
||||
isnext = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isnext) {
|
||||
alert("不接受此文件类型!");
|
||||
target.value = "";
|
||||
$("#videoName").text('文件格式不支持,请重新选择上传文件!');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
var imagSize = fileObj.size;
|
||||
|
||||
if (imagSize > 1024 * 1024 * 10) {
|
||||
alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M,超出了上传大小," + "请选择10M以内的视频!");
|
||||
$("#videoName").text('文件太大了超出范围!');
|
||||
return false;
|
||||
}
|
||||
|
||||
var url = "api/getresbilitydata?a=upload"; // 接收上传文件的后台地址
|
||||
var form = new FormData(); // FormData 对象
|
||||
form.append("mf", fileObj); // 文件对象
|
||||
xhr = new XMLHttpRequest(); // XMLHttpRequest 对象
|
||||
xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
|
||||
xhr.onload = uploadComplete; //请求完成
|
||||
xhr.onerror = uploadFailed; //请求失败
|
||||
xhr.upload.onprogress = progressFunction; //【上传进度调用方法实现】
|
||||
xhr.upload.onloadstart = function () { //上传开始执行方法
|
||||
ot = new Date().getTime(); //设置上传开始时间
|
||||
oloaded = 0; //设置上传开始时,以上传的文件大小为0
|
||||
};
|
||||
xhr.send(form); //开始上传,发送form数据
|
||||
|
||||
$("#videoName").text(fileObj.name);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
alert("请选择文件");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//上传进度实现方法,上传过程中会频繁调用该方法
|
||||
function progressFunction(evt) {
|
||||
// event.total是需要传输的总字节,event.loaded是已经传输的字节。如果event.lengthComputable不为真,则event.total等于0
|
||||
if (evt.lengthComputable) {
|
||||
|
||||
$(".el-progress--line").css("display", "block");
|
||||
var percent = Math.round(evt.loaded * 100 / evt.total);
|
||||
|
||||
/*进度条显示进度*/
|
||||
document.getElementById('progress').innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";
|
||||
document.getElementById('progress').style.width = percent.toFixed(2) + '%';
|
||||
|
||||
}
|
||||
|
||||
var time = document.getElementById("time");
|
||||
var nt = new Date().getTime(); //获取当前时间
|
||||
var pertime = (nt - ot) / 1000; //计算出上次调用该方法时到现在的时间差,单位为s
|
||||
ot = new Date().getTime(); //重新赋值时间,用于下次计算
|
||||
|
||||
var perload = evt.loaded - oloaded; //计算该分段上传的文件大小,单位b
|
||||
oloaded = evt.loaded; //重新赋值已上传文件大小,用以下次计算
|
||||
|
||||
//上传速度计算
|
||||
var speed = perload / pertime; //单位b/s
|
||||
var bspeed = speed;
|
||||
var units = 'b/s'; //单位名称
|
||||
if (speed / 1024 > 1) {
|
||||
speed = speed / 1024;
|
||||
units = 'k/s';
|
||||
}
|
||||
if (speed / 1024 > 1) {
|
||||
speed = speed / 1024;
|
||||
units = 'M/s';
|
||||
}
|
||||
speed = speed.toFixed(1);
|
||||
//剩余时间
|
||||
var resttime = ((evt.total - evt.loaded) / bspeed).toFixed(1);
|
||||
time.innerHTML = '上传速度:' + speed + units + ',剩余时间:' + resttime + 's';
|
||||
if (bspeed == 0)
|
||||
time.innerHTML = '上传已取消';
|
||||
}
|
||||
//上传成功响应
|
||||
function uploadComplete(evt) {
|
||||
//服务断接收完文件返回的结果 注意返回的字符串要去掉双引号
|
||||
|
||||
if (evt.target.responseText) {
|
||||
var data = JSON.parse(evt.target.responseText);
|
||||
if (data.code = 1) {
|
||||
|
||||
var str = data.filepath;
|
||||
document.getElementById('url').innerHTML = str;
|
||||
alert("上传成功!");
|
||||
}
|
||||
} else {
|
||||
alert("上传失败");
|
||||
}
|
||||
}
|
||||
//上传失败
|
||||
function uploadFailed(evt) {
|
||||
alert("上传失败!");
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
<div style="height:100%;">
|
||||
<table id="zrtable" style="width:100%;height:100%"></table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var id = {{ id }};
|
||||
$('#zrtable').datagrid({
|
||||
url: 'api/getresbilitydata?a=detail&zrid='+id,
|
||||
rownumbers: true,
|
||||
singleSelect: true,
|
||||
striped: true,
|
||||
fitColumns: true,
|
||||
method: 'get',
|
||||
pagination: 'true',
|
||||
pageSize: 20,
|
||||
toolbar: '#zytablebar',
|
||||
border:false,
|
||||
columns: [[
|
||||
{ field: 'id', title: 'ID', hidden: true },
|
||||
{ field: 'readeruser__name', title: '查看人姓名', width: 100 },
|
||||
{ field: 'readertime', title: '查阅时间', width: 100 },
|
||||
|
||||
]]
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
|
@ -91,6 +91,14 @@ urlpatterns = [
|
|||
path('html/riskact/chose',views.riskactchose),
|
||||
path('html/trainfig',views.trainfigure),
|
||||
path('html/equipmentfig',views.equipmentfigure),
|
||||
|
||||
path('html/resbility',views.resbility),#责任制度
|
||||
path('html/addresbility',views.addresbility),#责任制度
|
||||
path('html/resbility/detail/<int:id>/',views.resbilitydetail),#责任制度观看详情
|
||||
|
||||
path('html/operproce',views.operproce),#操作规程
|
||||
path('html/addoperproce',views.addoperproce),
|
||||
path('html/operproce/detail/<int:id>/',views.operprocedetail),#责任制度观看详情
|
||||
#html页面
|
||||
|
||||
|
||||
|
|
@ -173,7 +181,8 @@ urlpatterns = [
|
|||
path('test',views.test),
|
||||
path('.well-known/pki-validation/fileauth.txt',views.vewechat),#验证
|
||||
path('miniprogram/boUR15vyNu.txt',views.minip_px),
|
||||
|
||||
path('api/getresbilitydata',views.getresbilitydata),#责任制
|
||||
path('api/getprodata',views.getprodata),#操作规程
|
||||
|
||||
#合作模块
|
||||
path('edu/',include('safesite.edu.urls')),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from captcha.helpers import captcha_image_url
|
|||
from captcha.models import CaptchaStore
|
||||
from django.shortcuts import render, redirect, render_to_response
|
||||
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
|
||||
from .models import User, Trouble, Dickey, Partment, Dicclass, Train, Drill, TroubleAccess, Group, Yjyc, Trainuser, Drilluser, Yjsetup, Menu, Observe, Observeto, Unsafes, Miss, Socertificate, Userprofile, Suggest, Notice, Noticeto, Operation, Operzyry, Fxcs, Operationspjd, Operspxq, Question, ExamPaper, ExamTest, ExamPaperDetail, ExamTestDetail, Questioncat, Safecert, Map, Area, Missto, Suggestflow, Equipment, Inspect, Risk, RiskAct, Risktask, Riskcheck, Report, RiskActTask, Riskcheck2
|
||||
from .models import User, Trouble, Dickey, Partment, Dicclass, Train, Drill, TroubleAccess, Group, Yjyc, Trainuser, Drilluser, Yjsetup, Menu, Observe, Observeto, Unsafes, Miss, Socertificate, Userprofile, Suggest, Notice, Noticeto, Operation, Operzyry, Fxcs, Operationspjd, Operspxq, Question, ExamPaper, ExamTest, ExamPaperDetail, ExamTestDetail, Questioncat, Safecert, Map, Area, Missto, Suggestflow, Equipment, Inspect, Risk, RiskAct, Risktask, Riskcheck, Report, RiskActTask, Riskcheck2,Resbility,Operproce,Readerblility,ReaderOperproce
|
||||
from django.template import RequestContext
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.core import serializers
|
||||
|
|
@ -471,6 +471,22 @@ def trainfigure(req):
|
|||
def equipmentfigure(req):
|
||||
return render(req, 'equipmentfigure.html')
|
||||
|
||||
def resbility(req):
|
||||
return render(req, 'resbility.html')
|
||||
|
||||
|
||||
def addresbility(req):#责任制
|
||||
return render(req,'resbilityadd.html')
|
||||
def resbilitydetail(req, id):
|
||||
return render(req, 'resbilitydetail.html', {'id': id})
|
||||
|
||||
def operproce(req):#操作规程
|
||||
return render(req, 'operproce.html')
|
||||
def addoperproce(req):#责任制
|
||||
return render(req,'operproceadd.html')
|
||||
|
||||
def operprocedetail(req, id):
|
||||
return render(req, 'operprocedetail.html', {'id': id})
|
||||
|
||||
def mainhtml(req):
|
||||
# 计算一些数据
|
||||
|
|
@ -7021,3 +7037,177 @@ def equipmentfig(req):
|
|||
'area__name').annotate(num=Count('area'))
|
||||
|
||||
return HttpResponse(json.dumps({'code': 1, 'data': {'eqmlist': list(eqmlist)}}), content_type='application/json')
|
||||
|
||||
|
||||
#责任制
|
||||
def getresbilitydata(req):
|
||||
a = req.GET.get('a')
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
if a=='dic':#行为列表
|
||||
|
||||
dicclass=req.GET.get('dicclass')
|
||||
a = Dickey.objects.filter(dicparent=dicclass,deletemark=1)
|
||||
a = (a.filter(usecomps__contains=',1,')|a.filter(usecomps__contains=','+companyid+',')).exclude(nousecomps__contains=','+companyid+',')
|
||||
a = a.values('dickeyid','dicparent__dicname','dickeyname','dicparent__dicid','detail').order_by('dickeyid')
|
||||
return HttpResponse(transstr(a,'dickeyid','dickeyname'),content_type="application/json")
|
||||
elif a=='job':#岗位列表
|
||||
joblist = Group.objects.filter(usecomp__partid=companyid).exclude(grouptype=0).values('groupid', 'groupname', 'grouptype')
|
||||
return HttpResponse(transstr(joblist,'groupid','groupname'),content_type="application/json")
|
||||
elif a== 'tree':#部门列表
|
||||
list_items = (Partment.objects.filter(partlink__contains=','+companyid+',') | Partment.objects.filter(partid=companyid)
|
||||
).annotate(id=F('partid'), parentId=F('parentid'), name=F('partname')).values('id', 'parentId', 'name')
|
||||
return HttpResponse(json.dumps(list(list_items)), content_type="application/json")
|
||||
elif a== 'upload':#文件上传
|
||||
username = User.objects.get(userid=req.session['userid']).username
|
||||
file_name = time.strftime('%Y%m%d%H%M%S')+ '_' + req.FILES['mf'].name
|
||||
user_upload_folder = os.path.join('media/zeren', username)
|
||||
if not os.path.exists(user_upload_folder):
|
||||
os.mkdir(user_upload_folder)
|
||||
filepath = os.path.join(user_upload_folder, file_name)
|
||||
filepath = filepath.replace('\\','/')
|
||||
with open( filepath, 'wb') as f:
|
||||
f.write(req.FILES['mf'].read())
|
||||
return JsonResponse({"code":1,"filename":file_name,"filepath":filepath})
|
||||
elif a=='add':#新增责任制
|
||||
obj = Resbility()
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
obj.title = data['title']
|
||||
obj.jobs =Group.objects.get(groupid= data['group'])
|
||||
obj.homeworktype= Dickey.objects.get(dickeyid=data['type'])
|
||||
obj.department=Partment.objects.get(partid=data['jobpart'])
|
||||
obj.resbilitypath=data['filepath']
|
||||
obj.createuser=User.objects.get(userid=userid)
|
||||
obj.createdate=data['publisdate']
|
||||
obj.usecomp=Partment.objects.get(partid=companyid)
|
||||
obj.filepath=data['filepath']
|
||||
obj.save()
|
||||
return JsonResponse({"code":1})
|
||||
elif a=='listall':#责任列表
|
||||
startnum,endnum=fenye(req)
|
||||
#groups = Group.objects.filter(users__userid=userid)
|
||||
# part= Partment.objects.filter(partid=User.objects.get(userid=userid).ubelongpart.partid)
|
||||
#a = Resbility.objects.filter(usecomp=companyid,jobs__in=groups,department__in=part).order_by('id')
|
||||
a = Resbility.objects.filter(usecomp=companyid,deletemark=1).order_by('id')
|
||||
total = a.count()
|
||||
startnum,endnum=fenye(req)
|
||||
a = a[startnum:endnum].values('id','title','department__partname','jobs__groupname','resbilitypath','homeworktype__dickeyname','createdate','createuser__name','reads')
|
||||
return HttpResponse(transjson(total,a),content_type="application/json")
|
||||
#点击阅读
|
||||
elif a=='readnum':
|
||||
id =req.GET.get('id')
|
||||
a = Resbility.objects.get(id=id)
|
||||
a.reads=a.reads+1
|
||||
a.save()
|
||||
obj = Readerblility()
|
||||
obj.readid=a
|
||||
obj.num=''
|
||||
obj.readeruser=User.objects.get(userid=userid)
|
||||
obj.save()
|
||||
return JsonResponse({"code":1,"url": a.resbilitypath})
|
||||
#删除
|
||||
elif a == 'del':
|
||||
id =req.GET.get('id')
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)#公司ID
|
||||
a = Resbility.objects.get(id=id)
|
||||
if a.createuser==User.objects.get(userid=userid):
|
||||
a.deletemark=0
|
||||
a.save()
|
||||
return JsonResponse({"code":1})
|
||||
|
||||
else:
|
||||
|
||||
return JsonResponse({"code":0})
|
||||
elif a=='detail':
|
||||
id =req.GET.get('zrid')
|
||||
a = Readerblility.objects.filter(readid=id).values('id','readeruser__name','readertime')
|
||||
total = a.count()
|
||||
return HttpResponse(transjson(total,a),content_type="application/json")
|
||||
|
||||
|
||||
#操作规程
|
||||
def getprodata(req):
|
||||
a = req.GET.get('a')
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
if a=='dic':#行为列表
|
||||
|
||||
dicclass=req.GET.get('dicclass')
|
||||
a = Dickey.objects.filter(dicparent=dicclass,deletemark=1)
|
||||
a = (a.filter(usecomps__contains=',1,')|a.filter(usecomps__contains=','+companyid+',')).exclude(nousecomps__contains=','+companyid+',')
|
||||
a = a.values('dickeyid','dicparent__dicname','dickeyname','dicparent__dicid','detail').order_by('dickeyid')
|
||||
return HttpResponse(transstr(a,'dickeyid','dickeyname'),content_type="application/json")
|
||||
elif a=='job':#岗位列表
|
||||
joblist = Group.objects.filter(usecomp__partid=companyid).exclude(grouptype=0).values('groupid', 'groupname', 'grouptype')
|
||||
return HttpResponse(transstr(joblist,'groupid','groupname'),content_type="application/json")
|
||||
elif a== 'tree':#部门列表
|
||||
list_items = (Partment.objects.filter(partlink__contains=','+companyid+',') | Partment.objects.filter(partid=companyid)
|
||||
).annotate(id=F('partid'), parentId=F('parentid'), name=F('partname')).values('id', 'parentId', 'name')
|
||||
return HttpResponse(json.dumps(list(list_items)), content_type="application/json")
|
||||
elif a== 'upload':#文件上传
|
||||
username = User.objects.get(userid=req.session['userid']).username
|
||||
file_name = time.strftime('%Y%m%d%H%M%S')+ '_' + req.FILES['mf'].name
|
||||
user_upload_folder = os.path.join('media/caozuo', username)
|
||||
if not os.path.exists(user_upload_folder):
|
||||
os.mkdir(user_upload_folder)
|
||||
filepath = os.path.join(user_upload_folder, file_name)
|
||||
filepath = filepath.replace('\\','/')
|
||||
with open( filepath, 'wb') as f:
|
||||
f.write(req.FILES['mf'].read())
|
||||
return JsonResponse({"code":1,"filename":file_name,"filepath":filepath})
|
||||
elif a=='add':#新增责任制
|
||||
obj = Operproce()
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
obj.title = data['title']
|
||||
obj.jobs =Group.objects.get(groupid= data['group'])
|
||||
obj.homeworktype= Dickey.objects.get(dickeyid=data['type'])
|
||||
obj.department=Partment.objects.get(partid=data['jobpart'])
|
||||
obj.operprocepath=data['filepath']
|
||||
obj.createuser=User.objects.get(userid=userid)
|
||||
obj.createdate=data['publisdate']
|
||||
obj.usecomp=Partment.objects.get(partid=companyid)
|
||||
obj.filepath=data['filepath']
|
||||
obj.save()
|
||||
return JsonResponse({"code":1})
|
||||
elif a=='listall':#责任列表
|
||||
startnum,endnum=fenye(req)
|
||||
#groups = Group.objects.filter(users__userid=userid)
|
||||
# part= Partment.objects.filter(partid=User.objects.get(userid=userid).ubelongpart.partid)
|
||||
#a = Resbility.objects.filter(usecomp=companyid,jobs__in=groups,department__in=part).order_by('id')
|
||||
a = Operproce.objects.filter(usecomp=companyid,deletemark=1).order_by('id')
|
||||
total = a.count()
|
||||
startnum,endnum=fenye(req)
|
||||
a = a[startnum:endnum].values('id','title','department__partname','jobs__groupname','operprocepath','homeworktype__dickeyname','createdate','createuser__name','reads')
|
||||
return HttpResponse(transjson(total,a),content_type="application/json")
|
||||
#点击阅读
|
||||
elif a=='readnum':
|
||||
id =req.GET.get('id')
|
||||
a = Operproce.objects.get(id=id)
|
||||
a.reads=a.reads+1
|
||||
a.save()
|
||||
obj = ReaderOperproce()
|
||||
obj.readid=a
|
||||
obj.num=''
|
||||
obj.readeruser=User.objects.get(userid=userid)
|
||||
obj.save()
|
||||
return JsonResponse({"code":1,"url": a.operprocepath})
|
||||
#删除
|
||||
elif a == 'del':
|
||||
id =req.GET.get('id')
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)#公司ID
|
||||
a = Operproce.objects.get(id=id)
|
||||
if a.createuser==User.objects.get(userid=userid):
|
||||
a.deletemark=0
|
||||
a.save()
|
||||
return JsonResponse({"code":1})
|
||||
|
||||
else:
|
||||
|
||||
return JsonResponse({"code":0})
|
||||
elif a=='detail':
|
||||
id =req.GET.get('zrid')
|
||||
a = ReaderOperproce.objects.filter(readid=id).values('id','readeruser__name','readertime')
|
||||
total = a.count()
|
||||
return HttpResponse(transjson(total,a),content_type="application/json")
|
||||
|
|
|
|||
Loading…
Reference in New Issue