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

274 lines
10 KiB

<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('上传图片')"/>
<th:block th:include="include :: datetimepicker-css"/>
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
</head>
<body class="white-bg">
<!-- <div class="wrapper wrapper-content animated fadeInRight ibox-content">-->
<div class="container-div">
<div class="row">
<div class="col-sm-12">
</div>
<form class="form-horizontal m" id="form-poinvoicehead-add">
<div class="form-group">
<input id="filePath" name="filePath" class="form-control" type="file">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料代码:</label>
<div class="col-sm-8">
<input name="itemCode" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">图纸类型:</label>
<div class="col-sm-8">
<select name="type" class="form-control m-b" th:with="type=${@dict.getType('sys_upload_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</form>
<div class="modal inmodal" id="itemModal" tabindex="-1"
role="dilog" aria-hidden="true" style="padding-bottom: 100px;">
<div class="modal-dialog" style="width: 800px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true"></button>
<h4 class="modal-title">选择物料</h4>
</div>
<div class="modal-body" style="text-align: center;">
<div class="row" style="margin-bottom: 20px;">
<div class="col-md-5">
<form id="formId">
<div class="form-group">
<label class="control-label col-md-4">物料代码:</label>
<div class="col-md-8">
<input type="text" class="form-control"
id="wlCode" name="wlCode">
</div>
</div>
</form>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success" id="wlCodeSearch">搜索</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table id="wlTable"
class="table table-striped table-responsive">
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
onClick="selectWl();">选择
</button>
<button type="button" class="btn btn-default" data-dismiss="modal" name="close">关闭</button>
</div>
</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:src="@{/ajax/libs/select2/select2.js}"></script>
<script th:inline="javascript">
let prefix = ctx + "ck/upload"
$("#form-poinvoicehead-add").validate({
focusCleanup: true
});
//鼠标移入,显示完整的数据
function paramsMatter(value, row, index) {
var span = document.createElement("span");
span.setAttribute("title", value);
span.innerHTML = value;
return span.outerHTML;
}
function submitHandler() {
if ($.validate.form()) {
uploadFile();
}
}
function uploadFile() {
var formData = new FormData();
if ($('#filePath')[0].files[0] == null) {
$.modal.alertWarning("请先选择文件路径");
return false;
}
let itemCode = $("input[name='itemCode']").val();
if (itemCode===null || itemCode===""){
$.modal.alertWarning("请先选择物料");
return false;
}
formData.append('type', $("select[name='type']").val());
formData.append('file', $('#filePath')[0].files[0]);
formData.append('itemCode', itemCode);
$.ajax({
url: prefix + "/upload",
type: 'post',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function (resp) {
// $.operate.successCallback(result);
if (resp.code === 0) {
alert("上传成功!")
var index = parent.layer.getFrameIndex(window.name);
var parent2 = window.parent;
parent2.$.table.refresh();
parent.layer.close(index);//关闭当前页
} else {
$.modal.msgError("上传失败");
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
});
}
$("input[name='itemCode']").on("click", function () {
$("#itemModal").modal("show");
})
//选择物料列表
$('#wlTable').bootstrapTable({
url: '/ck/itemCP/itemList',
pagination: true,
pageNumber: 1,
pageSize: 10,
pageList: [10, 25, 50, 100],
showRefresh: true,
method: "post",
contentType: "application/x-www-form-urlencoded",
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
clickToSelect: true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
singleSelect: true,
height: 400,
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
searchValue: params.search,
orderByColumn: params.sort,
isAsc: params.order
};
//console.log(curParams);
var json = $.extend(curParams, $.common.formToJSON("formId"));
//console.log(json);
return json;
},
columns: [
{
checkbox: true
}, {
field: 'wlCode',
title: '物料代码',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
}, {
field: 'itemname',
title: '物料名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
}, {
field: 'itemstandard',
title: '规格型号',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
}, {
field: 'machineNo',
title: '机种',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
}, {
field: 'stockDw',
title: '单位'
}
]
});
//搜索物料列表
$("#wlCodeSearch").on("click", function () {
$("#wlTable").bootstrapTable('refresh');
$("#wlCode").val("");
})
//点击选择物料
function selectWl() {
let row = $("#wlTable").bootstrapTable("getSelections");
$("#itemModal").modal("hide");
$("input[name='itemCode']").val(row[0].wlCode);
}
</script>
</body>
</html>