万材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.
 
 
 
 

287 lines
13 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="noticeOrderNumber"/>
</li>
<li>
<label>发货日期:</label>
<input type="text" name="deliveryDate"/>
</li>
<li>
<label>客户代码:</label>
<input type="text" name="enterpriseCode"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="enterpriseName"/>
</li>
<li style="display: none">
<label>内外销:</label>
<select name="exportSales" th:with="type=${@dict.getType('sys_export_sales')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li style="display: none">
<label>发货否:</label>
<select name="deliveryGoodsFlag" th:with="type=${@dict.getType('sys_whether')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</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="manufacture:deliveryGoodsNotice:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manufacture:deliveryGoodsNotice:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger single disabled" onclick="removeNotice()" shiro:hasPermission="manufacture:deliveryGoodsNotice:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning single disabled" onclick="exportNotice()" shiro:hasPermission="manufacture:deliveryGoodsNotice:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space: nowrap"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('manufacture:deliveryGoodsNotice:edit')}]];
var removeFlag = [[${@permission.hasPermi('manufacture:deliveryGoodsNotice:remove')}]];
var exportSalesDatas = [[${@dict.getType('sys_export_sales')}]];
var deliveryGoodsFlagDatas = [[${@dict.getType('sys_whether')}]];
var prefix = ctx + "manufacture/deliveryGoodsNotice";
var prefixDetail = ctx + "manufacture/deliveryGoodsDetail";
$(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: 'deliveryGoodsNoticeId',
title: '发货通知单id',
visible: false
},
{
field: 'noticeOrderNumber',
title: '通知单号'
},
{
field: 'deliveryDate',
title: '发货日期'
},
{
field: 'enterpriseCode',
title: '客户代码'
},
{
field: 'enterpriseName',
title: '客户名称'
},
{
field: 'customerContact',
title: '联系人'
},
{
field: 'customerFactory',
title: '客户厂区'
},
{
field: 'deliveryAddress',
title: '送货地址'
},
{
field: 'exportSales',
title: '内外销',
visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(exportSalesDatas, value);
}
},
{
field: 'stockNumber',
title: '仓库编号'
},
{
field: 'stockName',
title: '仓库名称'
},
{
field: 'remarks',
title: '备注'
},
{
field: 'voucherPreparation',
title: '制单人'
},
{
field: 'deliveryGoodsFlag',
title: '发货否',
visible: false,
formatter: function(value, row, index) {
return $.table.selectDictLabel(deliveryGoodsFlagDatas, value);
}
},
{
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 removeNotice() {
var noticeData = $("#bootstrap-table").bootstrapTable("getSelections");
if (noticeData.length === 1) {
// console.log(orderData)
$.ajax({
url: prefixDetail + '/list',
type: 'post',
data: {
deliveryGoodsNoticeId: noticeData[0].deliveryGoodsNoticeId
},
success: function (res) {
console.log(res)
if (res.rows.length > 0) {
$.modal.confirm("该订单内含有"+ res.rows.length+ "条订单数据将一并删除,是否删除?", function () {
$.ajax({
url: prefix + '/removeSelectedOrder',
type: 'post',
data: {
noticeData: JSON.stringify(noticeData)
},
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 : noticeData[0].workOrderId
},
success: function (res) {
// console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
},
error: function (res) {
$.modal.msgError(res.error())
}
})
})
}
}
})
} else {
$.modal.msgWarning("请选择一条数据")
}
}
//导出
function exportNotice() {
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].deliveryGoodsNoticeId,
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)//释放内存
})
});
}
}
</script>
</body>
</html>