万材erp项目
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.
 
 
 
 

422 lines
19 KiB

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('入库检验通知列表')" />
<th:block th:include="include :: datetimepicker-css"/>
<script type="text/javascript" th:src="@{/js/axios.min.js}"></script>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>入通知单号:</label>
<input type="text" name="inNoticeNumber"/>
</li>
<li>
<label>订购单号:</label>
<select name="purchaseOrderNumber">
<option value="">所有</option>
<option value="-1">代码生成请选择字典属性</option>
</select>
</li>
<li>
<label>供应商代码:</label>
<input type="text" name="supplierCode"/>
</li>
<li>
<label>供应商名称:</label>
<input type="text" name="supplierName"/>
</li>
<li>
<label>入库类别:</label>
<select name="warehousingCategory" th:with="type=${@dict.getType('warehousing_category')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li class="select-time">
<label>入库日期:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginWarehousingDate]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endWarehousingDate]"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="storehouse:warehousingInspectionNotice:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="storehouse:warehousingInspectionNotice:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger single disabled" onclick="removeSelected()" shiro:hasPermission="storehouse:warehousingInspectionNotice:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="exportSelected()" shiro:hasPermission="storehouse:warehousingInspectionNotice:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-primary" onclick="reviewConfirm()" shiro:hasPermission="storehouse:warehousingInspectionNotice:confirm">
<i class="fa fa-hand-grab-o"></i> 确认
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space: nowrap"></table>
</div>
</div>
</div>
<!--订单确认-->
<div class="modal fade" id="confirmModel">
<div class="modal-dialog">
<div class="modal-content message_align">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认信息</h4>
</div>
<div class="modal-body" style="height: 180px">
<form id="form-confirm-edit">
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label is-required">入库检验通知id:</label>
<div class="col-sm-8">
<input id="warehousingInspectionNoticeId" name="warehousingInspectionNoticeId" class="form-control" type="text" required
readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">确认否:</label>
<div class="col-sm-8">
<select id="confirmFlag" name="confirmFlag" class="form-control" th:with="type=${@dict.getType('sys_whether')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">确认日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input id="confirmTime" name="confirmTime" class="form-control" placeholder="yyyy-mm-dd hh:ii:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">确认人:</label>
<div class="col-sm-8">
<input id="confirmPerson" name="confirmPerson" class="form-control" type="text">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" onclick="confirmSubmit()" class="btn btn-success" data-dismiss="modal">确定</button>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('storehouse:warehousingInspectionNotice:edit')}]];
var removeFlag = [[${@permission.hasPermi('storehouse:warehousingInspectionNotice:remove')}]];
var exportSalesDatas = [[${@dict.getType('sys_export_sales')}]];
var warehousingCategoryDatas = [[${@dict.getType('warehousing_category')}]];
var confirmNoDatas = [[${@dict.getType('sys_whether')}]];
var prefix = ctx + "storehouse/warehousingInspectionNotice";
var prefixDetail = ctx + "storehouse/warehousingInspectionDetail"
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
clickToSelect: true,
modalName: "入库检验通知",
columns: [{
checkbox: true
},
{
field: 'warehousingInspectionNoticeId',
title: '入库检验通知id',
visible: false
},
{
field: 'confirmFlag',
title: '确认否',
formatter: function(value, row, index) {
// return $.table.selectDictLabel(confirmNoDatas, value);
var actions = [];
if ($.table.selectDictLabel(confirmNoDatas, value) == "<span class=''>是</span>") {
actions.push('<a class="btn btn-primary btn-xs disabled">已确认</a> ');
} else {
actions.push('<a class="btn btn-danger btn-xs disabled">未确认</a> ');
}
return actions.join('');
}
},
{
field: 'inNoticeNumber',
title: '入通知单号'
},
{
field: 'purchaseOrderNumber',
title: '订购单号'
},
{
field: 'supplierCode',
title: '供应商代码'
},
{
field: 'supplierName',
title: '供应商名称'
},
{
field: 'customerContact',
title: '联系人'
},
{
field: 'stockNumber',
title: '仓库编号'
},
{
field: 'stockName',
title: '仓库名称'
},
{
field: 'stockManager',
title: '仓库管理员'
},
{
field: 'exportSales',
title: '内外销',
formatter: function(value, row, index) {
return $.table.selectDictLabel(exportSalesDatas, value);
}
},
{
field: 'warehousingCategory',
title: '入库类别',
formatter: function(value, row, index) {
return $.table.selectDictLabel(warehousingCategoryDatas, value);
}
},
{
field: 'inspectionDate',
title: '交检日期'
},
{
field: 'warehousingDate',
title: '入库日期'
},
{
field: 'remarks',
title: '备注'
},
{
field: 'inspectionReport',
title: '检验报告',
formatter: function(value, row, index) {
var filepath = value.substring(value.lastIndexOf("/")+1)
var actions = [];
actions.push('<a href="javascript:void(0)" onclick="downloadFile(\'' + value + '\')">'+filepath+'</a> ');
return actions.join('');
}
},
{
field: 'confirmPerson',
title: '确认人',
visible: false
},
{
field: 'confirmTime',
title: '确认时间',
visible: false
},
{
field: 'firstAddTime',
title: '录入时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
return value;
}
}
},
{
field: 'updateInfoTime',
title: '上次修改时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
var vArr = value.split(',')
return vArr[0];
}
}
}]
};
$.table.init(options);
});
/*下载*/
function downloadFile(filepath) {
window.location.href =prefix + "/downloadFile?filepath="+ filepath;
}
//删除
function removeSelected() {
var orderData = $("#bootstrap-table").bootstrapTable("getSelections");
if (orderData.length === 1) {
// console.log(orderData)
$.ajax({
url: prefixDetail + '/list',
type: 'post',
data: {
inNoticeNumber: orderData[0].inNoticeNumber
},
success: function (res) {
console.log(res)
if (res.rows.length > 0) {
$.modal.confirm("该订单内含有"+ res.rows.length+ "条物料数据将一并删除,是否删除?", function () {
$.ajax({
url: prefix + '/removeSelectedOrder',
type: 'post',
data: {
orderData : JSON.stringify(orderData)
},
success: function (res) {
// console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
},
error: function (res) {
$.modal.msgError(res.error())
}
})
})
} else if (res.rows.length == 0) {
$.modal.confirm("确认删除该订单吗?", function () {
$.ajax({
url: prefix + '/remove',
type: 'post',
data: {
ids : orderData[0].warehousingInspectionNoticeId
},
success: function (res) {
// console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
},
error: function (res) {
$.modal.msgError(res.error())
}
})
})
}
}
})
} else {
$.modal.msgWarning("请选择一条数据")
}
}
//导出
function exportSelected() {
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
var data = $("#bootstrap-table").bootstrapTable("getSelections")
if (rows.length !== 1) {
$.modal.alert("请选择一条记录");
return;
} else {
// rows为选中行的id
// console.log(rows);
// console.log(data);
// console.log(data[0].orderNumber)
$.modal.confirm("是否确认要导出本条订单?", function (){
axios({
url: prefix + '/exportSelected/'+data[0].warehousingInspectionNoticeId,
method: 'POST',
responseType: 'blob'
}).then(response => {
// console.log(response)
const URL = window.URL.createObjectURL(response.data)
// 创建隐藏<a>标签进行下载
const tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = URL
let time = new Date().toLocaleString()
tempLink.setAttribute('download', time + "物料检验通知单.xlsx")
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)// 移除dom元素
window.URL.revokeObjectURL(URL)//释放内存
})
});
}
}
$("input[name='confirmTime']").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
minView: "month",
autoclose: true
});
// 订单确认
function reviewConfirm(){
let data = $("#bootstrap-table").bootstrapTable("getSelections");
let userName = [[${@permission.getPrincipalProperty('userName')}]];
if (data.length ===1) {
$("#warehousingInspectionNoticeId").val(data[0].warehousingInspectionNoticeId)
$("#confirmFlag").val(data[0].confirmFlag).trigger("change")
$("#confirmPerson").val(userName)
$("#confirmTime").datetimepicker("setDate", new Date());
$("#confirmModel").modal("show");
}else {
$.modal.alert("请选择一条数据");
}
}
// 订单确认
function confirmSubmit(){
$.ajax({
url: prefix + "/edit",
type: "post",
resultType: "json",
data: $('#form-confirm-edit').serialize(),
success: function (resp) {
// console.log(resp)
$("#confirmModel").modal("hide");
$("#bootstrap-table").bootstrapTable('refresh');
$.modal.msgSuccess("操作成功!")
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
</script>
</body>
</html>