safesite/safesite/templates/operation.html

121 lines
4.9 KiB
HTML

<table id="zytable" style="width:auto;height:100%;"></table>
<div id="zytablebar" style="padding:6px;height:auto">
<div style="margin-bottom:2px;margin-top:2px">
<!-- <a class="easyui-menubutton" data-options="menu:'#mm1',iconCls: 'fa-plus',plain:true">申请</a> -->
<a id="delzy" class="easyui-linkbutton" onclick="delzy()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
<a id="zydetail" onclick="zydetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a>
<a id="exportzyword" onclick="exportzyword()" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Word</a>
<a id="exportzyexcel" onclick="exportzyexcel()" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Excel</a>
</div>
<!-- <div id="mm1" style="width:150px;">
<div>Cut</div>
<div>Copy</div>
<div>Paste</div>
</div> -->
</div>
<script>
$(function(){
var option = $('#main').attr('value')
$('#zytable').datagrid({url:'api/operation',queryParams:{a:option}});
$.get('getdickey?dicclass=33&a=combobox',function(data){
let html=''
for (var x = 0, len = data.length; x < len; x++) {
html +='<div class="easyui-linkbutton" onclick="addzy(this)" value="'+ data[x].value +'">'+data[x].text+'</div>'
}
$('#mm1').html(html)
})
})
function addzy(obj){
opendg('申请作业','html/operation/add/'+obj.getAttribute("value"))
}
$('#kjcxzy').combobox({
editable:false,
onSelect: function (node) {
if(node.value != 0){
$('#zytable').datagrid({url:'api/suggest',queryParams:{a:node.value}});
}
}
});
function zysearch() {
var querydata = $('#searchzyff').serializeJSON();
querydata['a'] = 'listsearch'
$("#sdg_zy").dialog("close");
$('#zytable').datagrid('load',querydata);
}
$('#zytable').datagrid({
url: '',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
toolbar: '#zytablebar',
border:false,
columns: [[
{ field: 'zyid', title: 'ID', hidden: true },
{ field: 'zynum', title: '编号', width: 120 },
{ field: 'zyzt', title: '作业状态', width: 120 ,formatter: function (value, row, index) {
return value.zyzt;
} },
{ field: 'zylx__dickeyname', title: '作业类型', width: 120 },
{ field: 'zyfzr__name', title: '作业负责人', width: 120 },
{ field: 'zynr', title: '作业内容', width: 200 },
{ field: 'submittime', title: '提交时间', width: 100 },
]]
});
function delzy(){
var row = $('#zytable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
$.ajax({
type: "GET",
url: 'api/operation?a=del',
data: { 'zyid': row.zyid },
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#zytable").datagrid('reload');
}
else {
$.messager.alert('提示', '你无权删除该条记录!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
});
}
else {
$.messager.alert('提示', '请选择一行数据!');
}
}
function zydetail(){
var row = $('#zytable').datagrid('getSelected');
if (row) {
var url = 'html/operation/detail/' + row.zyid
opendg('查看详情',url)
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function exportzyword(){
var row = $('#zytable').datagrid('getSelected');
if (row) {
let url = 'api/operation?a=exportword&id='+row.zyid
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function exportzyexcel() {
let url = 'api/operation?a=exportexcel'
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
}
</script>