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

759 lines
32 KiB

2 years ago
<!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('产品报价列表')"/>
<script type="text/javascript" th:src="@{/js/axios.min.js}"></script>
</head>
<style>
/*提醒框*/
.alert{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/* width: 200px; */
/* margin-left: 20%; */
z-index: 2000;
text-align: center;
font-size: 18px;
padding: 20px 50px;
}
</style>
<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="quotationCode"/>
</li>
<li>
<label>成品代码:</label>
<!-- <select name="finishProductCode">-->
<!-- <option value="">所有</option>-->
<!-- <option value="-1">代码生成请选择字典属性</option>-->
<!-- </select>-->
<input type="text" name="finishProductCode"/>
</li>
<li>
<label>成品名称:</label>
<input type="text" name="finishProductName"/>
</li>
<li>
<label>客户料号:</label>
<input type="text" name="customerNumber"/>
</li>
<li>
<label>客户编号:</label>
<!-- <select name="enterpriseCode">-->
<!-- <option value="">所有</option>-->
<!-- <option value="-1">代码生成请选择字典属性</option>-->
<!-- </select>-->
<input type="text" name="enterpriseCode"/>
</li>
<li>
<label>客户名称:</label>
<!-- <select name="enterpriseName">-->
<!-- <option value="">所有</option>-->
<!-- <option value="-1">代码生成请选择字典属性</option>-->
<!-- </select>-->
<input type="text" name="enterpriseName"/>
</li>
<li>
<label>订价日期:</label>
<input type="text" class="time-input" placeholder="请选择订价日期" name="pricingDate"/>
</li>
<li>
<label>是否为当前报价:</label>
<select name="currentQuote" 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="system:productquotation:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()"
shiro:hasPermission="system:productquotation:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
shiro:hasPermission="system:productquotation:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="exportProductQuotation()"
shiro:hasPermission="system:productquotation:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-info" onclick="quotationAudit()">
<i class="fa fa-file-text"></i> 审核
</a>
<a class="btn btn-success" onclick="quotationConfirm()">
<i class="fa fa-hand-grab-o"></i> 确认
</a>
<a class="btn btn-primary" onclick="quotationApprove()">
<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="AuditModel">
<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-audit-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="productQuotationId" name="productQuotationId" 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="auditNo" name="auditNo" 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="auditTime" name="auditTime" class="form-control "
placeholder="yyyy-MM-dd HH:mm: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="auditName" name="auditName" 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="AuditConfirmSubmit()" class="btn btn-success" data-dismiss="modal">确定
</button>
</div>
</div>
</div>
</div>
<div class="alert alert-success hide">审核成功</div>
<!--核准-->
<div class="modal fade" id="approveModel">
<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-approve-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="productQuotationId3" name="productQuotationId" 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="approveNo" name="approveNo" 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="approveTime" name="approveTime" class="form-control" placeholder="yyyy-MM-dd HH:mm: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="approveName" name="approveName" 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="ApproveConfirmSubmit()" class="btn btn-success" data-dismiss="modal">确定</button>
</div>
</div>
</div>
</div>
<div class="alert alert-warning hide">产品报价已核准</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="productQuotationId2" name="productQuotationId" 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="confirmNo" name="confirmNo" 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="confirmName" name="confirmName" 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>
<div class="alert alert-info hide">产品报价已确认</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:productquotation:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:productquotation:remove')}]];
var inventoryUnitDatas = [[${@dict.getType('sys_unit_class')}]];
var commonCurrencyDatas = [[${@dict.getType('sys_common_currency')}]];
var currentQuoteDatas = [[${@dict.getType('sys_whether')}]];
var confirmNoDatas = [[${@dict.getType('sys_whether')}]];
var auditNoDatas = [[${@dict.getType('sys_whether')}]];
var approveNoDatas = [[${@dict.getType('sys_whether')}]];
var prefix = ctx + "system/productquotation";
var prefixCustomer = ctx + "system/customer";
$(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: 'productQuotationId',
title: '产品报价id',
visible: false
},
{
field: 'auditNo',
title: '审核否',
formatter: function (value, row, index) {
// return $.table.selectDictLabel(auditNoDatas, value);
var actions = [];
if ($.table.selectDictLabel(auditNoDatas, 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: 'confirmNo',
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: 'approveNo',
title: '核准否',
formatter: function (value, row, index) {
// return $.table.selectDictLabel(approveNoDatas, value);
var actions = [];
if ($.table.selectDictLabel(approveNoDatas, 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: 'currentQuote',
title: '是否为当前报价',
formatter: function (value, row, index) {
return $.table.selectDictLabel(currentQuoteDatas, value);
}
},
{
field: 'quotationCode',
title: '报价编码'
},
{
field: 'finishProductCode',
title: '成品代码'
},
{
field: 'finishProductName',
title: '成品名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'typeMachine',
title: '机种'
},
{
field: 'inventoryUnit',
title: '单位',
formatter: function (value, row, index) {
return $.table.selectDictLabel(inventoryUnitDatas, value);
}
},
{
field: 'commonCurrency',
title: '币别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(commonCurrencyDatas, value);
}
},
{
field: 'processPrice',
title: '单价'
},
{
field: 'customerNumber',
title: '客户料号'
},
{
field: 'enterpriseCode',
title: '客户编号'
},
{
field: 'enterpriseName',
title: '客户名称'
},
{
field: 'registrant',
title: '登记人'
},
{
field: 'pricingDate',
title: '订价日期'
},
{
field: 'taxRate',
title: '税率'
},
{
field: 'priceExcludingTax',
title: '不含税价'
},
{
field: 'priceIncludingTax',
title: '含税价'
},
{
field: 'lastPrice',
title: '上次价格'
},
{
field: 'lastPriceEnd',
title: '上次价格2'
},
{
field: 'costRmb',
title: '当前材料成本RMB'
},
{
field: 'currentExchangeRate',
title: '当前汇率'
},
{
field: 'proportionMaterials',
title: '材料占比'
},
{
field: 'quotationExplain',
title: '备注说明'
},
{
field: 'confirmTax',
title: '是否含税'
},
{
field: 'fileUpload',
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: 'confirmName',
title: '确认人'
},
{
field: 'confirmTime',
title: '确认时间'
},
{
field: 'auditName',
title: '审核人'
},
{
field: 'auditTime',
title: '审核时间'
},
{
field: 'approveName',
title: '核准人'
},
{
field: 'approveTime',
title: '核准时间'
},
{
field: 'standbyOne',
title: '备用一',
visible: false
},
{
field: 'standbyTwo',
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];
}
}
}
// {
// title: '操作',
// align: 'center',
// formatter: function (value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.productQuotationId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.productQuotationId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
]
};
$.table.init(options);
});
$("input[name='auditTime']").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
minView: "month",
autoclose: true,
todayBtn: true
});
$("input[name='confirmTime']").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
minView: "month",
autoclose: true,
todayBtn: true
});
$("input[name='approveTime']").datetimepicker({
format: "yyyy-mm-dd hh:ii:ss",
minView: "month",
autoclose: true,
todayBtn: true
});
// 审核确认
function quotationAudit() {
let data = $("#bootstrap-table").bootstrapTable("getSelections");
let userName = [[${@permission.getPrincipalProperty('userName')}]];
console.log(data)
if (data.length === 1) {
$("#productQuotationId").val(data[0].productQuotationId)
$("#auditNo").val(1).trigger("change")
$("#auditName").val(userName)
$("#auditTime").datetimepicker("setDate", new Date());
$("#AuditModel").modal("show");
} else {
$.modal.alert("请选择一条数据");
}
}
// 审核确认
function AuditConfirmSubmit() {
$.ajax({
url: prefix + "/edit",
type: "post",
resultType: "json",
data: $('#form-audit-edit').serialize(),
success: function (resp) {
console.log(resp)
$("#bootstrap-table").bootstrapTable('refresh');
// $(".alert-success").addClass("show");
// window.setTimeout(function () {
// $(".alert-success").removeClass("show");
// }, 1000);//显示的时间
$.modal.msgSuccess("操作成功!")
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
// 确认
function quotationConfirm() {
let data = $("#bootstrap-table").bootstrapTable("getSelections");
let userName = [[${@permission.getPrincipalProperty('userName')}]];
if (data.length === 1) {
$("#productQuotationId2").val(data[0].productQuotationId)
$("#confirmNo").val(1).trigger("change")
$("#confirmName").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)
$("#bootstrap-table").bootstrapTable('refresh');
// $(".alert-info").addClass("show");
// window.setTimeout(function () {
// $(".alert-info").removeClass("show");
// }, 1000);//显示的时间
$.modal.msgSuccess("操作成功!")
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
//核准
function quotationApprove() {
let data = $("#bootstrap-table").bootstrapTable("getSelections");
let userName = [[${@permission.getPrincipalProperty('userName')}]];
if (data.length === 1) {
$("#productQuotationId3").val(data[0].productQuotationId)
$("#approveNo").val(1).trigger("change")
$("#approveName").val(userName)
$("#approveTime").datetimepicker("setDate", new Date());
$("#approveModel").modal("show");
} else {
$.modal.alert("请选择一条数据");
}
}
//核准
function ApproveConfirmSubmit() {
$.ajax({
url: prefix + "/edit",
type: "post",
resultType: "json",
data: $('#form-approve-edit').serialize(),
success: function (resp) {
$("#bootstrap-table").bootstrapTable('refresh');
// $(".alert-warning").addClass("show");
// window.setTimeout(function () {
// $(".alert-warning").removeClass("show");
// }, 1000);//显示的时间
$.modal.msgSuccess("操作成功!")
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
//导出
function exportProductQuotation() {
var enterpriseCode = $("input[name='enterpriseCode']").val()
console.log(enterpriseCode)
var enterpriseName = $("input[name='enterpriseName']").val()
console.log(enterpriseName)
var pricingDate = $("input[name='pricingDate']").val()
if ((enterpriseCode != '')||(enterpriseName != '')){
if (pricingDate == '') {
$.modal.alertWarning("导出前请选择日期进行筛选");
} else {
$.modal.confirm("确认导出以下数据吗?", function() {
$.ajax({
url: prefixCustomer + '/list',
type: 'post',
data: {
enterpriseCode: enterpriseCode,
enterpriseName: enterpriseName
},
success: function (res) {
console.log(res)
var customerData = res.rows;
var selectData = $("#bootstrap-table").bootstrapTable("getData")
console.log(selectData)
var pricingDate = $("input[name='pricingDate']").val()
axios({
url: prefix + '/exportProductQuotation',
method: 'POST',
data: {
scData: {
// "selectData": JSON.stringify(selectData),
"customerData": JSON.stringify(customerData),
"pricingDate": JSON.stringify(pricingDate)
}
},
responseType: 'blob'
}).then(response => {
// console.log(response)
// console.log(response.data)
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)//释放内存
})
}
})
})
}
} else {
$.modal.alertWarning("导出前请选择客户编号或者客户名称进行筛选");
}
}
/*下载*/
function downloadFile(filepath) {
window.location.href =prefix + "/downloadFile?filepath="+ filepath;
}
</script>
</body>
</html>