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.

238 lines
9.7 KiB

{% extends 'baseBZP.html' %}
{% block content %}
{% load static %}
<script src="{% static 'js/jquery-2.1.1.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-card-header" style="font-size: 20px;font-weight: bold;align-items: center;">
库存盘点
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 500px;">
<label class="layui-form-label" style="width: 150px; float: left;">选择盘点药柜:</label>
<div class="layui-input-block" style="width:200px;height:50px;float: left; margin-left: 0;">
<select data-placeholder="选择所属药柜..." id="cabinetSelect" required="required"
class="chosen">
<option value="" onclick="get_data()">全部</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<form class="form-horizontal myForm" style="padding-top: 100rpx;">
<div class="form-group" style="margin-bottom: 30px; font-size: 18px;">
<div>
<label for="exampleInputName2" class="col-md-3 col-md-offset-2 control-label">类别 (纯度)</label>
<label for="exampleInputName2" class="col-md-3 control-label"
style="margin-left: -20px;">请输入校验在库数量</label>
</div>
</div>
{% for variety_obj in variety_obj_list %}
<div class="form-group variety_obj" id="{{ variety_obj.VarietyId }}">
<label
class="layui-form-label col-md-3 col-md-offset-2 control-label">{{ variety_obj.Name }}({{ variety_obj.Purity }})</label>
<div class="layui-input-block col-md-2 col-md-offset-1">
<input type="text" class="layui-input varietyId" id="searchValue" vid="{{ variety_obj.VarietyId }}"
ReserveSearch='' name="searchValue" id="stock_number"
oninput="this.value=this.value.replace(/[^0-9.]+/,'');" placeholder="请输入校验的在库数量"
required="required"
value="0">
</div>
</div>
{% empty %}
<div class="col-md-3 col-md-offset-3 control-label" id="xwu">
<h1>暂无药剂类别</h1>
</div>
{% endfor %}
<div class="col-md-3 col-md-offset-3 control-label" id="wu" hidden>
<h1>暂无药剂类别</h1>
</div>
<div class="form-group"
style="position:fixed;bottom: -15px; background: #fff; width: 100%; padding: 10px; height: 80rpx;">
<div class="col-sm-offset-5 col-sm-6">
<button type="button" class="layui-btn layuiadmin-btn-useradmin" title="提交校验" id="btn_click"
>提交校验
</button>
</div>
</div>
</form>
<script src="{% static 'js/jquery-2.1.1.min.js' %}"></script>
<script src="{% static 'js/warning.js' %}"></script>
<style>
.myForm {
background-color: #fff;
height: 690px;
overflow: auto;
}
</style>
<script>
$(function () {
function a() {
}
$.get('{% url 'dataReport:getClientListJson' %}', function (obj) {
$(obj.data).each(function (index, data) {
let option = "<option hassubinfo='true' value='" + data.ClientId + "' >" + data.ClientName + "</option>"
$("#cabinetSelect").append(option);
layui.use('form', function () {
var form = layui.form;
form.render(); //刷新select选择框渲染
});
layui.use(['form'], function () {
let form = layui.form;
$(document).ready(function () {
// select下拉框选中触发事件
form.on("select", function (data) {
{#alert(data.value); // 获取选中的值#}
$('.variety_obj').hide();
$.ajax({
url: '{% url 'stockTaking:index_json' %}',
type: 'get',
data: {clientId: data.value},
success: function (data) {
if (data.status == 1) {
let data_list = data.data;
let num = 0
for (let i = 0; i < data_list.length; i++) {
var em = data_list[i]
var obj = document.getElementById(em.VarietyId);
if (obj) {
let id = '#' + em.VarietyId;
$(id).show();
num++;
}
}
if (num === 0) {
$("#wu").show();
$("#xwu").hide();
}else{
$("#wu").hide();
}
}
}
});
});
form.render();
});
});
});
$(".chosen").chosen({
no_results_text: "没有找到",
disable_search: true,
allow_single_deselect: true
});
});
$('#navTitle', window.parent.document).text('库存盘点');
$('#btn_click').click(function () {
var tag = 0;
var boole = false
var input_content_data = new Array();
$('.varietyId').each(function () {
varietyId = $(this).attr('vid');
value1 = $(this).val();
reg = /^[0-9]*?./;
if (value1.indexOf('.') > -1) {
boole = true;
return false
}
if (value1 != '') {
tag = tag + 1
}
input_content_data.push({'varietyId': varietyId, 'value': value1})
});
if (boole) {
msg('在库数量请输入整数 ! ');
return false
}
// 判断输入的值是否为空 禁止提交
if (tag < input_content_data.length) {
layer.msg('库存数量不能为空, 请完善库存信息');
return;
}
$.post('{% url 'stockTaking:checkStock' %}', {
'input_values_list': JSON.stringify(input_content_data),
'clientId': $('#cabinetSelect').val()
}, function (obj) {
if (obj.status == 1) {
var storage = window.localStorage;
storage['stockData'] = JSON.stringify(obj.data);
quiteTime = Infinity;
parent.layer.open({
title: "添加药剂模板",
shift: 2,
type: 2,
area: ['1020px', '630px'],
content: ["{% url 'stockTaking:resultPage' %}"],
end: function () {
currentTime = 0;
quiteTime = 600;
}
});
} else {
layer.msg(obj.message)
}
})
// console.log(input_content_data);
// console.log(typeof input_content_data);
/* parent.layer.open({
title: "添加药剂模板",
shift: 2,
type: 2,
area: ['1000px', '560px'],
content: ["/stockTaking/checkStock"], // 自定义content 支持html语法
}); */
});
// 截取长度大于10的字符串
function cut_out_str(params_str) {
if (params_str.length > 10) {
params_str = params_str.substring(0, 10) + '...';
return params_str
} else {
return params_str
}
}
// 限制类别名称以防毁掉样式
$('.name1').each(function () {
update_text = cut_out_str($(this).text());
$(this).text(update_text)
});
})
</script>
{% endblock %}