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.
yy_rms_39zhiyao_duizhao/templates/hbspy_label.html

342 lines
13 KiB

{% extends 'base.html' %}
{% block content %}
<div class="wrapper wrapper-content animated fadeInDown">
<div class="mail-box-header">
<form method="get" class="pull-right mail-search" accept-charset="UTF-8">
<div class="input-group">
<input type="text" class="form-control input-sm" id="searchValue" name="searchValue" placeholder="搜索名称、编码、标识">
<div class="input-group-btn">
<button type="button" id="btnTableSearch" class="btn btn-sm btn-primary">
搜索
</button>
</div>
</div>
</form>
<h2>
进销存系统标准物质列表
</h2>
<div class="mail-tools tooltip-demo">
<div class="btn-group pull-right">
<button class="btn btn-white btn-sm" id="tablePre">
<i class="fa fa-arrow-left"></i>
</button>
<button class="btn btn-white btn-sm" id="tableNext">
<i class="fa fa-arrow-right"></i>
</button>
</div>
<button class="btn btn-white btn-sm" data-toggle="tooltip" id="btnTableReload" data-placement="left" title="刷新药剂列表"><i class="fa fa-refresh"></i> 刷新</button>
<!-- <button class="btn btn-white btn-sm" data-toggle="tooltip" id="btnTableExport" data-placement="left" title="导出报表统计列表"><i class="fa fa-download"></i> 导出数据</button> -->
<button class="btn btn-white btn-sm" data-toggle="tooltip" id="btnTablePrint" data-placement="top" title="打印所选数据标签">
<i class="fa fa-print"> 打印所选数据标签</i>
</button>
</div>
</div>
<div class="ibox-content">
<table id="dataTableModel" class="table table-striped table-bordered table-hover dataTables-example">
<thead>
<tr>
<th>唯一标识</th>
<th>标准物证编码</th>
<th>标准物证名称</th>
<th>样品浓度</th>
<th>不确定度</th>
<th>证书编号</th>
<th>入库规格</th>
<th>有效日期</th>
</tr>
</thead>
<tbody>
<!-- <tr class="gradeX">
<td class="center">4</td>
<td class="center">X</td>
<td class="center">X</td>
<td class="center">X</td>
<td class="center">X</td>
<td class="center">X</td>
</tr> -->
</tbody>
<!-- <tfoot>
<tr>
<th>唯一标识</th>
<th>标准物证名称</th>
<th>样品浓度</th>
<th>有效日期</th>
<th>不确定度</th>
<th>证书编号</th>
<th>入库规格</th>
</tr>
</tfoot> -->
</table>
</div>
</div>
{% load static %}
<script src="{% static 'js/fileDownload.js' %}"></script>
<script src="{% static 'js/warning.js' %}"></script>
<script type="text/javascript">
$(function () {
$('#navTitle', window.parent.document).text('进销存标签打印');
var tableModel = $('#dataTableModel').DataTable({
searching: false,
lengthChange: false,
select: true,
"ordering": false,
'pageLength': 15,
stripeClasses: ["odd", "even"],//为奇偶行加上样式兼容不支持CSS伪类的场合
order: [], //取消默认排序查询,否则复选框一列会出现小箭头
processing: false, //隐藏加载提示,自行处理
serverSide: true, //启用服务器端分页
searching: true, //禁用原生搜索
ajax: {
url: "{% url 'hbspy_GetDrugListJson' %}",
// data: { searchValue: $("#searchValue").val()},
dataSrc: function(json) {
json.recordsTotal = json.total;
json.recordsFiltered = json.total;
//必须返回是dataSrc数据
return json.data;
},
},
columns: [
{ data: 'BarCode' },
{ data: 'DurgCode' },
{ data: 'DrugName' },
{ data: 'DrugND' },
{ data: 'DrugBQDD' },
{ data: 'DrugZSBH' },
{ data: 'DrugRKGG' },
{ data: 'DrugYXQ' },
],
createdRow: function (row, data, dataIndex) {
},
select : {
style : 'multi',
selector : 'tr'
},
});
$("#btnTableReload").click(function () {
location.href = "{% url 'hbspy_label' %}";
});
$("#btnTablePrint").click(function () {
var selectRows = tableModel.row('.selected').data();
if (selectRows == null) {
layer.msg("请选择要编辑的数据!");
return;
}
var ids=""
$("#dataTableModel tr.selected").each(function(index,elem){
if(ids!="")
{
ids+=','
}
ids+= "'"+ $(this).find("td").eq(0).text()+"'";
});
var loadIndex = layer.load(2);
$.post("{% url 'hbspy_LabelPrint' %}", {ids:ids}, function (obj) {
layer.close(loadIndex);
if (obj.status == 0) {
msg("打印请求执行成功", function () {
// parent.layer.close(index);
});
}
else {
msg("保存失败 " + obj.message);
}
});
});
$("#btnTableSetEmpty").click(function(){
var selectRow = tableModel.row('.selected').data();
if (selectRow == null) {
layer.msg("请选择要设置空瓶的数据!");
return;
}
new $.flavr({
content: '确定要将药剂<p style="line-height:30px;color:red;font-size:20px;">"' + selectRow.Name + '"设为空瓶么?</p>',
dialog: 'confirm',
buttons: {
danger: {
text: '确定',
style: 'danger',
action: function() {
$.post("{% url 'drug:setDrugEmpty' %}", { MedicamentId: selectRow.MedicamentId }, function (obj) {
if (obj.status == 1) {
new $.flavr({ content : '设置成功!',
autoclose : true, timeout : 800 });
// tableModel.draw(false);
location.href = "{% url 'drug_index' %}";
return false;
}
else {
new $.flavr({ content : obj.message,
autoclose : true, timeout : 2000 });
return false;
}
});
}
},
cancel: {
text: '取消',
style: 'default'
}
},
});
});
$("#btnTableDrugRecord").click(function () {
var selectRow = tableModel.row('.selected').data();
if (selectRow == null) {
layer.msg("请选择要查看的数据!");
return;
}
quiteTime = Infinity;
parent.layer.open({
title: "药剂“" + selectRow.BarCode + "”的流转记录",
shift: 2,
type: 2,
area: ['960px', '580px'],
//skin: 'layui-layer-rim', //加上边框
content: ['/home/homeDrugRecord/?BarCode=' + selectRow.BarCode],
end: function () {
currentTime = 0;
quiteTime = 600;
tableModel.ajax.reload();
}
});
});
$("#btnTableSearch").click(function(){
tableModel.ajax.url('/hbspy/GetDrugListJson/?searchValue='+ $("#searchValue").val()).load();
// $("#searchValue").attr('ReserveSearch', $("#searchValue").val());
// tableModel.search($("#searchValue").val()).draw();
tableModel.ajax.reload();
});
$("#btnTableDelete").click(function () {
var selectRow = tableModel.row('.selected').data();
if (selectRow == null) {
layer.msg("请选择要删除的数据!");
return;
}
new $.flavr({
content: '确定要删除药剂<p style="line-height:30px;color:red;font-size:20px;">"' + selectRow.Name + '"?</p>',
dialog: 'confirm',
buttons: {
danger: {
text: '确定',
style: 'danger',
action: function() {
$.post("{% url 'drug:deleteDrug' %}", { MedicamentId: selectRow.MedicamentId }, function (obj) {
if (obj.status == 1) {
new $.flavr({ content : '删除成功!',
autoclose : true, timeout : 800 });
tableModel.row('.selected').remove().draw(false);
return false;
}
else {
new $.flavr({ content : obj.message,
autoclose : true, timeout : 2000 });
return false;
}
})
}
},
cancel: {
text: '取消',
style: 'default'
}
},
});
});
$("#btnTableExport").click(function () {
var index = '';
var url = '/dataReport/exportDrugShelfLifeData/?client_id=' + $('#cabinetSelect').val()+'&searchWord='+$("#searchValue").val();
$.fileDownload(url, {
prepareCallback: function (url) {
index = parent.layer.load(2,{time: 3*1000});
},
successCallback: function (url) {
parent.layer.close(index)
},
failCallback: function (url) {
msg('数据异常, 下载失败');
parent.layer.close(index)
}
})
});
// 分配使用用户
$("#btnTableQx").click(function () {
var selectRow = tableModel.row('.selected').data();
if (selectRow == null) {
layer.msg("请选择要分配用户的终端!");
return;
}
quiteTime = Infinity;
parent.layer.open({
title: "分配药剂禁止使用用户- 药剂名称:" + selectRow.Name,
shift: 2,
type: 2,
area: ['860px', '520px'],
skin: 'layui-layer-rim', //加上边框
content: ["/drug/disabled_user/?barcode=" + selectRow.BarCode, 'no'],
end: function () {
currentTime = 0;
quiteTime = 600;
tableModel.ajax.reload();
}
});
});
$("#tablePre").click(function () {
$("#dataTableModel_previous").click();
});
$("#tableNext").click(function () {
$("#dataTableModel_next").click();
})
});
//
function judge_drugStatus(status) {
switch (status) {
case 1:
return "在库";
case 2:
return "出库";
case 3:
return "空瓶";
case 5:
return "预备入库";
default:
return "异常"
}
}
</script>
<iframe width=0 height=0 frameborder=0 id="export" />
{% endblock %}