8 changed files with 1194 additions and 18 deletions
@ -0,0 +1,515 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "一段式入出庫作業"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
<style type="text/css"> |
||||
|
.layui-table-main .layui-table-cell { |
||||
|
/*height: auto !important;*/ |
||||
|
white-space: normal; |
||||
|
} |
||||
|
|
||||
|
.layui-table img { |
||||
|
max-width: 60px; |
||||
|
max-height: 28px; |
||||
|
} |
||||
|
|
||||
|
.layui-tree-main { |
||||
|
cursor: pointer; |
||||
|
padding-right: 10px; |
||||
|
float: left; |
||||
|
border-width: 1px; |
||||
|
border-style: solid; |
||||
|
border-color: #e6e6e6; |
||||
|
margin: 10px 0; |
||||
|
} |
||||
|
|
||||
|
.green-background { |
||||
|
background-color: lightgreen; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
|
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-header"> |
||||
|
<div class="layui-form"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form"> |
||||
|
<div class="layui-row"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-col-md10"> |
||||
|
<label class="layui-form-label">Record Type:</label> |
||||
|
<div class="layui-input-inline" style="width:150px"> |
||||
|
<select id="recordType" lay-event="RecordType" lay-filter="RecordType" name="recordType" lay-submit asp-items="@ViewBag.RecordType" lay-search> |
||||
|
</select> |
||||
|
</div> |
||||
|
<div class="layui-input-inline" style="width:100px"> |
||||
|
<input id="WorkCenter" name="WorkCenter" autocomplete="off" class="layui-input green-background" value="@ViewBag.WorkCenter"> |
||||
|
</div> |
||||
|
<div class="layui-input-inline" style="width:100px"> |
||||
|
<input id="RBU" name="RBU" autocomplete="off" class="layui-input green-background" value="@ViewBag.RBU"> |
||||
|
</div> |
||||
|
<label class="layui-form-label">RMA NO:</label> |
||||
|
<div class="layui-input-inline" style="width:150px"> |
||||
|
<input id="RMANo" name="RMANo" autocomplete="off" class="layui-input" value="@ViewBag.RMANo"> |
||||
|
</div> |
||||
|
<label class="layui-form-label">Record Date:</label> |
||||
|
<div class="layui-input-inline" style="width:150px"> |
||||
|
<input id="recordDate" name="RecordDate" autocomplete="off" class="layui-input" value="@ViewBag.RecordDate"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-row"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-col-md10"> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">RecordNumber:</label> |
||||
|
<div class="layui-input-inline" style="width:150px"> |
||||
|
<input id="recordNumber" name="RecordNumber" autocomplete="off" class="layui-input" value="@ViewBag.RecordNumber"> |
||||
|
</div> |
||||
|
<label class="layui-form-label">Line NO:</label> |
||||
|
<div class="layui-input-inline" style="width:150px"> |
||||
|
<input id="lineNo" name="LineNo" autocomplete="off" class="layui-input" value="@ViewBag.LineNo"> |
||||
|
</div> |
||||
|
<label class="layui-form-label">Location:</label> |
||||
|
<div class="layui-input-inline" style="width:120px"> |
||||
|
<input id="Location" name="Location" autocomplete="off" class="layui-input" value="@ViewBag.Location"> |
||||
|
</div> |
||||
|
<label class="layui-form-label">Customer:</label> |
||||
|
<div class="layui-input-inline" style="width:120px"> |
||||
|
<input id="Customer" name="Customer" autocomplete="off" class="layui-input green-background" value="@ViewBag.Customer"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-row"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">料號:</label> |
||||
|
<div class="layui-input-inline" style="width:150px"> |
||||
|
<input id="PartNumber" name="PartNumber" autocomplete="off" class="layui-input" value="@ViewBag.PartNumber"> |
||||
|
</div> |
||||
|
<div class="layui-input-inline" style="width:500px"> |
||||
|
<input id="PartDesc" name="PartDesc" autocomplete="off" class="layui-input green-background" placeholder="料號說明" value="@ViewBag.PartDesc"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-row"> |
||||
|
<div class="layui-form-item"> |
||||
|
|
||||
|
<div class="layui-inline" style="margin-right: 100px;"> |
||||
|
<label class="layui-form-label">資料群組:</label> |
||||
|
<input type="radio" name="StockUnit" id="box" value="1" title="Box No(安勤或昶亨生產)" lay-filter="radio-filter" checked /> |
||||
|
<input type="radio" name="StockUnit" id="pcs" value="0" title="PCS" lay-filter="radio-filter" /> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline" style="margin-right: 150px;"> |
||||
|
<div class="layui-input-inline" style="width:100px"> |
||||
|
<input type="checkbox" id="PCSUnit" lay-skin="primary" title="Begin=End" lay-filter="check-filter" disabled /> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-row"> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline"> |
||||
|
<div class="layui-input-inline" style="text-align:left;"> |
||||
|
<input type="radio" name="select" value="1" title="Scanner" /> |
||||
|
</div> |
||||
|
<div class="layui-input-inline" style="margin-left: 0;"> |
||||
|
<input class="layui-input" id="frontSN" autocomplete="off" /> |
||||
|
</div> |
||||
|
<div class="layui-form-mid">~</div> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input class="layui-input" id="endSN" autocomplete="off" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">備貨量:</label> |
||||
|
<div class="layui-input-inline" style="width:70px"> |
||||
|
<input id="StockQty" name="StockQty" autocomplete="off" class="layui-input" value="@ViewBag.StockQty"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline"> |
||||
|
<div class="layui-input-inline layui-col-sm4" style="text-align:left;"> |
||||
|
<input type="radio" name="select" value="0" title="Data" checked="" /> |
||||
|
</div> |
||||
|
<div class="layui-input-inline"> |
||||
|
<textarea class="layui-textarea" id="SNData"></textarea> |
||||
|
</div> |
||||
|
<input type="file" id="excelFileInput" style="display: none;" /> |
||||
|
<button class="layui-btn" onclick="importExcel()">匯入</button> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">作業備註</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<textarea placeholder="作業人員輸入備註" class="layui-textarea"></textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline" style="margin-right:0px;"> |
||||
|
<label id="rowCount" class="layui-inline layui-form-label" style="width:130px; color:red;">刷入數量 : 0 pcs</label> |
||||
|
</div> |
||||
|
</div> |
||||
|
<table class="layui-hide" id="query" lay-filter="query"></table> |
||||
|
<div class="layui-form-item" style="text-align: right;" > |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="submit" id="commit" value="確認扣帳" class="layui-btn" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
@section Scripts{ |
||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.4/xlsx.full.min.js"></script> |
||||
|
<script type="text/javascript"> |
||||
|
layui.use(['form', 'layer', 'laydate','table'], function () { |
||||
|
laydate = layui.laydate; |
||||
|
laydate.render({ |
||||
|
elem: '#recordDate' |
||||
|
, trigger: 'click' |
||||
|
, format: 'yyyy/MM/dd' |
||||
|
, theme: 'grid' |
||||
|
}); |
||||
|
|
||||
|
form.on('radio(radio-filter)', function (data) { |
||||
|
var elem = data.elem; // 获得 radio 原始 DOM 对象 |
||||
|
var checked = elem.checked; // 获得 radio 选中状态 |
||||
|
var value = elem.value; // 获得 radio 值 |
||||
|
var othis = data.othis; // 获得 radio 元素被替换后的 jQuery 对象 |
||||
|
var checkboxElem = layui.$('input[lay-filter="check-filter"]'); |
||||
|
if (value == 0 && checked) { |
||||
|
checkboxElem.prop('disabled', false); |
||||
|
checkboxElem.prop('checked', true); |
||||
|
// 重新渲染表单元素 |
||||
|
layui.form.render('checkbox'); |
||||
|
} else { |
||||
|
// 如果radio按钮未选中 |
||||
|
checkboxElem.prop('disabled', true); |
||||
|
checkboxElem.prop('checked', false); |
||||
|
// 重新渲染表单元素 |
||||
|
layui.form.render('checkbox'); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
</script> |
||||
|
<script type="text/javascript"> |
||||
|
//控項event |
||||
|
$('#lineNo').on('keypress', function (event) { |
||||
|
|
||||
|
if (event.keyCode == 13) { |
||||
|
// 获取 recordNumber 和 lineNo 的值 |
||||
|
var recordNumber = document.getElementById('recordNumber').value; |
||||
|
var lineNo = document.getElementById('lineNo').value; |
||||
|
|
||||
|
// 发送 AJAX 请求到 Controller |
||||
|
$.ajax({ |
||||
|
url: '@Url.Action("GetZDNDetailJson", "PTD")', |
||||
|
type: 'POST', |
||||
|
data: { recordNumber: recordNumber, lineNo: lineNo }, |
||||
|
success: function (result) { |
||||
|
// 处理成功的情况 |
||||
|
if (result.data.data.length > 0) { |
||||
|
$.each(result.data.data, function (index, item) { |
||||
|
$("#Customer").val(item.soldCustomerID); |
||||
|
$('#PartNumber').val(item.productID); |
||||
|
getItemDesc(document.getElementById('PartNumber').value); |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
error: function (error) { |
||||
|
// 处理错误的情况 |
||||
|
console.log(error); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
$('#PartNumber').on('keypress', function (event) { |
||||
|
if (event.keyCode == 13) { |
||||
|
getItemDesc(document.getElementById('PartNumber').value); |
||||
|
} |
||||
|
}); |
||||
|
$('#frontSN').on('keypress', function (event) { |
||||
|
if (event.keyCode == 13) { |
||||
|
var endSN = document.getElementById('endSN'); |
||||
|
var frontSN = document.getElementById('frontSN'); |
||||
|
|
||||
|
endSN.focus(); |
||||
|
endSN.select(); |
||||
|
|
||||
|
if (document.getElementById('PCSUnit').checked) { |
||||
|
endSN.value = frontSN.value; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
$('#endSN').on('keypress', function (event) { |
||||
|
if (event.keyCode == 13) { |
||||
|
var frontSN = document.getElementById('frontSN'); |
||||
|
var endSN = document.getElementById('endSN'); |
||||
|
var dnNo = document.getElementById('recordNumber'); |
||||
|
var lineNo = document.getElementById('lineNo'); |
||||
|
var material = document.getElementById('PartNumber'); |
||||
|
var table = layui.table; |
||||
|
var rowAmount = table.cache['query'].length; |
||||
|
|
||||
|
var prefixCode = frontSN.value.slice(0, -5); |
||||
|
var currentSN = parseInt(frontSN.value.slice(-5)); |
||||
|
|
||||
|
while (currentSN <= parseInt(endSN.value.slice(-5))) { |
||||
|
rowAmount++; |
||||
|
var newRowData = { |
||||
|
itemNo: rowAmount, |
||||
|
dnNo: dnNo.value, |
||||
|
lineNo: lineNo.value, |
||||
|
material: material.value, |
||||
|
sn: prefixCode + currentSN.toString().padStart(5, "0") |
||||
|
}; |
||||
|
// Add the new row data to the table |
||||
|
hg.table.addRow('query', newRowData); |
||||
|
currentSN++; |
||||
|
} |
||||
|
|
||||
|
frontSN.focus(); |
||||
|
frontSN.select(); |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
$('#SNData').on('keypress', function (event) { |
||||
|
if (event.keyCode == 13) { |
||||
|
var SNData = document.getElementById('SNData'); |
||||
|
var dnNo = document.getElementById('recordNumber'); |
||||
|
var lineNo = document.getElementById('lineNo'); |
||||
|
var material = document.getElementById('PartNumber'); |
||||
|
var table = layui.table; |
||||
|
var rowAmount = table.cache['query'].length; |
||||
|
|
||||
|
var arr = SNData.value.split('\n'); |
||||
|
$.each(arr, function (index, SN) { |
||||
|
rowAmount++; |
||||
|
var newRowData = { |
||||
|
itemNo: rowAmount, |
||||
|
dnNo: dnNo.value, |
||||
|
lineNo: lineNo.value, |
||||
|
material: material.value, |
||||
|
sn: SN |
||||
|
}; |
||||
|
// Add the new row data to the table |
||||
|
hg.table.addRow('query', newRowData); |
||||
|
}); |
||||
|
|
||||
|
SNData.select(); |
||||
|
event.preventDefault(); |
||||
|
} |
||||
|
}); |
||||
|
$('#commit').on('click', function () { |
||||
|
var recordType = document.getElementById('recordType').value; |
||||
|
var workCenter = document.getElementById('WorkCenter').value; |
||||
|
var rbu = document.getElementById('RBU').value; |
||||
|
var rmaNo = document.getElementById('RMANo').value; |
||||
|
var recordDate = document.getElementById('recordDate').value; |
||||
|
|
||||
|
var tableData = layui.table.cache['query']; |
||||
|
|
||||
|
var postData = { |
||||
|
recordType: recordType, |
||||
|
workCenter: workCenter, |
||||
|
rbu: rbu, |
||||
|
rmaNo: rmaNo, |
||||
|
recordDate: recordDate, |
||||
|
|
||||
|
tableData: tableData |
||||
|
}; |
||||
|
|
||||
|
console.log(JSON.stringify(postData)); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: '@Url.Action("PTD002_Commit", "PTD")', |
||||
|
dataType: 'json', |
||||
|
data: { data: JSON.stringify(postData) }, |
||||
|
type: 'POST', |
||||
|
success: function (result) { |
||||
|
console.log(result); |
||||
|
}, |
||||
|
error: function (error) { |
||||
|
console.log(error); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
function getItemDesc(itemNo) { |
||||
|
$.ajax({ |
||||
|
url: "/BAS/GetMaterialItemByItemNO", |
||||
|
data: { id: itemNo }, |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json", |
||||
|
type: 'get', |
||||
|
success: function (result) { |
||||
|
if (result.data) { |
||||
|
$("#PartDesc").val(result.data.itemDesc); |
||||
|
} |
||||
|
else { |
||||
|
$("#PartDesc").val(''); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
function isSNAlreadyExist(tableId, sn) { |
||||
|
var table = layui.table; |
||||
|
var currentData = table.cache[tableId]; |
||||
|
|
||||
|
// Check if SN already exists in the table |
||||
|
var isExist = currentData.some(function (row) { |
||||
|
return row.sn === sn; |
||||
|
}); |
||||
|
|
||||
|
return isExist; |
||||
|
} |
||||
|
function calculateRowCount(table) { |
||||
|
var RowCount = table.length; |
||||
|
$("#rowCount").html("刷入數量: " + RowCount + " pcs"); |
||||
|
} |
||||
|
hg.table.addRow = function (tableId, rowData) { |
||||
|
// Get the table instance |
||||
|
var table = layui.table; |
||||
|
console.log(table); |
||||
|
if (isSNAlreadyExist(tableId, rowData.sn)) { |
||||
|
// Handle the case where SN already exists |
||||
|
layer.msg('SN already exists in the table', { icon: 2 }); |
||||
|
return; // Do not add the row |
||||
|
} |
||||
|
// Add the new row data to the table |
||||
|
table.reload(tableId, { |
||||
|
data: [rowData].concat(table.cache[tableId]), |
||||
|
page: false, |
||||
|
limit: 2000 |
||||
|
}); |
||||
|
|
||||
|
calculateRowCount(table.cache[tableId]); |
||||
|
}; |
||||
|
function del(obj) { |
||||
|
if (obj.data.itemNo) { |
||||
|
hg.confirm("SN:" + obj.data.sn + ",確定要刪除嗎?", function () { |
||||
|
// 获取表格数据 |
||||
|
var tableData = layui.table.cache['query']; |
||||
|
|
||||
|
// 找到要删除的行的索引 |
||||
|
var rowIndex = tableData.findIndex(function (row) { |
||||
|
return row.itemNo === obj.data.itemNo; |
||||
|
}); |
||||
|
|
||||
|
// 从表格数据中删除该行 |
||||
|
if (rowIndex !== -1) { |
||||
|
tableData.splice(rowIndex, 1); |
||||
|
|
||||
|
// 重新加载表格数据 |
||||
|
layui.table.reload('query', { |
||||
|
data: tableData, |
||||
|
page: false, |
||||
|
limit: 2000 |
||||
|
}); |
||||
|
|
||||
|
layer.msg('刪除成功', { icon: 1 }); |
||||
|
calculateRowCount(tableData); |
||||
|
} else { |
||||
|
layer.msg('未找到要刪除的數據', { icon: 2 }); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//Excel匯入 |
||||
|
function importExcel() { |
||||
|
// Trigger click on the hidden file input |
||||
|
document.getElementById('excelFileInput').click(); |
||||
|
} |
||||
|
document.getElementById('excelFileInput').addEventListener('change', handleFileSelect); |
||||
|
function handleFileSelect(event) { |
||||
|
var file = event.target.files[0]; |
||||
|
|
||||
|
if (file) { |
||||
|
var reader = new FileReader(); |
||||
|
|
||||
|
reader.onload = function (e) { |
||||
|
var data = new Uint8Array(e.target.result); |
||||
|
var workbook = XLSX.read(data, { type: 'array' }); |
||||
|
|
||||
|
// Assuming the SNs are in the first sheet of the workbook |
||||
|
var sheet = workbook.Sheets[workbook.SheetNames[0]]; |
||||
|
var snData = XLSX.utils.sheet_to_json(sheet); |
||||
|
console.log(snData); |
||||
|
// Process SN data and update textarea |
||||
|
updateTextareaWithExcel(snData); |
||||
|
}; |
||||
|
|
||||
|
reader.readAsArrayBuffer(file); |
||||
|
} |
||||
|
} |
||||
|
function updateTextareaWithExcel(snData) { |
||||
|
var textarea = document.getElementById('SNData'); // Replace with your actual textarea id |
||||
|
var snValues = snData.map(function (obj) { |
||||
|
return obj.SN; |
||||
|
}); |
||||
|
// Combine existing data and imported SNs |
||||
|
textarea.value = snValues.join('\n'); |
||||
|
} |
||||
|
|
||||
|
var tableCols = [[ |
||||
|
{ |
||||
|
field: 'itemNo', |
||||
|
width: 100, |
||||
|
title: 'Item(項次)' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'dnNo', |
||||
|
minWidth: 150, |
||||
|
title: 'DN單號' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'lineNo', |
||||
|
title: 'LineNo', |
||||
|
width: 100 |
||||
|
}, |
||||
|
{ |
||||
|
field: 'material', |
||||
|
title: 'Material(料號)', |
||||
|
width: 150 |
||||
|
}, |
||||
|
{ |
||||
|
field: 'sn', |
||||
|
title: 'SN', |
||||
|
width: 150 |
||||
|
}, |
||||
|
{ |
||||
|
field: 'delete', |
||||
|
width: 100, |
||||
|
title: '刪除', |
||||
|
templet: function (item) { |
||||
|
var btn = ' <a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="del">刪除</a>'; |
||||
|
return btn |
||||
|
} |
||||
|
} |
||||
|
]]; |
||||
|
//基本数据表格 |
||||
|
var table = hg.table.datatable('query', '扣帳資訊', '', {}, tableCols, toolbar, false, '360', ['filter', 'print', 'exports']); |
||||
|
|
||||
|
</script> |
||||
|
} |
@ -0,0 +1,144 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "單頭說明表維護"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-header"> |
||||
|
<div class="layui-form"> |
||||
|
<div class="layui-form-item "> |
||||
|
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-inline"> |
||||
|
<button type="button" id="btnAdd" class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon"></i>新增</button> |
||||
|
</div> |
||||
|
<table class="layui-hide" id="test" lay-filter="test"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
@section Scripts{ |
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
layui.use('table', function () { |
||||
|
var table = layui.table; |
||||
|
table.render({ |
||||
|
elem: '#test' |
||||
|
, url: "@Url.Action("GetRecordTypeInfo", "PTD")" |
||||
|
, title: '單頭說明維護' |
||||
|
, cellMinwidth: 80//全局定义常规单元格的最小宽度,1ayui 2.2.1 新增 |
||||
|
, cols: [[ |
||||
|
{ |
||||
|
field: 'rbu', |
||||
|
width: 160, |
||||
|
title: 'RBU' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'id', |
||||
|
width: 100, |
||||
|
title: '代號' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'typeName', |
||||
|
minWidth: 160, |
||||
|
title: '作業項目' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'typeDesc', |
||||
|
title: '作業說明', |
||||
|
width: 160 |
||||
|
}, |
||||
|
{ |
||||
|
field: 'source', |
||||
|
title: '來源', |
||||
|
width: 160 |
||||
|
}, |
||||
|
{ |
||||
|
field: 'prefixCode', |
||||
|
title: '開頭', |
||||
|
width: 160 |
||||
|
}, |
||||
|
{ |
||||
|
field: 'length', |
||||
|
title: '碼長', |
||||
|
width: 160 |
||||
|
}, |
||||
|
{ |
||||
|
field: 'center', |
||||
|
width: 160, |
||||
|
title: '操作', |
||||
|
templet: function (item) { |
||||
|
var btn = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>'; |
||||
|
btn += ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">刪除</a>'; |
||||
|
return btn |
||||
|
} |
||||
|
} |
||||
|
]] |
||||
|
, page: true |
||||
|
, limits: [2000]//一页选择显示3,5或10条数据 |
||||
|
, limit: 2000 //一页显示10条数据 |
||||
|
, parseData: function (res) { //将原始数据解析成tabe组件所规定的数据,res光 |
||||
|
var result; |
||||
|
console.log(this); |
||||
|
console.log(JSON.stringify(res)); |
||||
|
if (this.page.curr) { |
||||
|
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr) |
||||
|
} |
||||
|
else { |
||||
|
result = res.data.slice(0, this.limit); |
||||
|
} |
||||
|
return { |
||||
|
"code": res.code,//解析接口状态 |
||||
|
"msg": res.msg,//解析提示文本 |
||||
|
"count": res.count,//解析数据长度 |
||||
|
"data": result//解析数据列表 |
||||
|
}; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
table.on('tool(test)', function (obj) { |
||||
|
if (obj.event == 'edit') { |
||||
|
if (obj.data.id) { |
||||
|
hg.open('修改單頭說明', '/PTD/PTD004U/' + obj.data.id, 480, 480); |
||||
|
} |
||||
|
} |
||||
|
if (obj.event == 'del') { |
||||
|
if (obj.data.id) { |
||||
|
hg.confirm("系統:" + obj.data.typeName + ",確定要刪除嗎?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/PTD/PTD004D', |
||||
|
data: { id: obj.data.id }, |
||||
|
type: 'POST', |
||||
|
success: function (res) { |
||||
|
if (res.success) { |
||||
|
hg.msghide("刪除成功!", { |
||||
|
icon: 6 |
||||
|
}); |
||||
|
layui.table.reload('test', { page: { curr: $(".layui-laypage-em").next().html() } }) |
||||
|
} |
||||
|
else { |
||||
|
hg.msg(data.msg); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("网络请求失败!"); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
$('#btnAdd').click(function () { |
||||
|
hg.open('新增單頭說明', '/PTD/PTD004C', 480, 480); |
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.AMES.RecordTypeInfo |
||||
|
|
||||
|
|
||||
|
@{ ViewData["Title"] = "PTD004C"; |
||||
|
Layout = "~/Views/Shared/_FormLayout.cshtml"; } |
||||
|
|
||||
|
|
||||
|
<style> |
||||
|
.control-label { |
||||
|
justify-content: flex-end !important; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12"> |
||||
|
<form enctype="multipart/form-data" method="post" asp-action="PTD004Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="Mode" value="0" /> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RBU" class="control-label col-sm-3">RBU</label> |
||||
|
<input asp-for="RBU" class="form-control col-sm-9" placeholder="請輸入RBU" /> |
||||
|
<span asp-validation-for="RBU" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="ID" class="control-label col-sm-3">代號</label> |
||||
|
<input asp-for="ID" class="form-control col-sm-9" placeholder="請輸入代碼" /> |
||||
|
<span asp-validation-for="ID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="TypeName" class="control-label col-sm-3">作業項目</label> |
||||
|
<input asp-for="TypeName" class="form-control col-sm-9" placeholder="請輸入作業項目" /> |
||||
|
<span asp-validation-for="TypeName" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="TypeDesc" class="control-label col-sm-3">作業說明</label> |
||||
|
<input asp-for="TypeDesc" class="form-control col-sm-9" placeholder="請輸入作業說明" /> |
||||
|
<span asp-validation-for="TypeDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="Source" class="control-label col-sm-3">來源</label> |
||||
|
<input asp-for="Source" class="form-control col-sm-9" placeholder="請輸入來源" /> |
||||
|
<span asp-validation-for="Source" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="PrefixCode" class="control-label col-sm-3">開頭</label> |
||||
|
<input asp-for="PrefixCode" class="form-control col-sm-9" placeholder="請輸入開頭" /> |
||||
|
<span asp-validation-for="PrefixCode" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="Length" class="control-label col-sm-3">碼長</label> |
||||
|
<input asp-for="Length" class="form-control col-sm-9" placeholder="請輸入碼長" /> |
||||
|
<span asp-validation-for="Length" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
||||
|
<div class="form-group"> |
||||
|
<input type="submit" value="儲存" class="btn btn-primary offset-sm-3" /> |
||||
|
</div> |
||||
|
|
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
@section Scripts { |
||||
|
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
||||
|
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
||||
|
|
||||
|
<script type="text/javascript"> |
||||
|
$(document).ready(function () { |
||||
|
var error = '@Html.ValidationMessage("error")'; |
||||
|
if ($(error).text() != '') { |
||||
|
parent.hg.msg(error); |
||||
|
} |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,76 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.AMES.RecordTypeInfo |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "PTD004U"; |
||||
|
Layout = "~/Views/Shared/_FormLayout.cshtml"; |
||||
|
} |
||||
|
|
||||
|
<style> |
||||
|
.control-label { |
||||
|
justify-content: flex-end !important; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12"> |
||||
|
<form enctype="multipart/form-data" method="post" asp-action="PTD004Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="Mode" value="1" /> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RBU" class="control-label col-sm-3">RBU</label> |
||||
|
<input asp-for="RBU" class="form-control col-sm-9" placeholder="請輸入RBU" /> |
||||
|
<span asp-validation-for="RBU" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="ID" class="control-label col-sm-3">代號</label> |
||||
|
<input asp-for="ID" class="form-control col-sm-9" placeholder="請輸入代碼" /> |
||||
|
<span asp-validation-for="ID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="TypeName" class="control-label col-sm-3">作業項目</label> |
||||
|
<input asp-for="TypeName" class="form-control col-sm-9" placeholder="請輸入作業項目" /> |
||||
|
<span asp-validation-for="TypeName" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="TypeDesc" class="control-label col-sm-3">作業說明</label> |
||||
|
<input asp-for="TypeDesc" class="form-control col-sm-9" placeholder="請輸入作業說明" /> |
||||
|
<span asp-validation-for="TypeDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="Source" class="control-label col-sm-3">來源</label> |
||||
|
<input asp-for="Source" class="form-control col-sm-9" placeholder="請輸入來源" /> |
||||
|
<span asp-validation-for="Source" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="PrefixCode" class="control-label col-sm-3">開頭</label> |
||||
|
<input asp-for="PrefixCode" class="form-control col-sm-9" placeholder="請輸入開頭" /> |
||||
|
<span asp-validation-for="PrefixCode" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="Length" class="control-label col-sm-3">碼長</label> |
||||
|
<input asp-for="Length" class="form-control col-sm-9" placeholder="請輸入碼長" /> |
||||
|
<span asp-validation-for="Length" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<input type="submit" value="儲存" class="btn btn-primary offset-sm-3" /> |
||||
|
</div> |
||||
|
|
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
@section Scripts { |
||||
|
@{ |
||||
|
await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
||||
|
await Html.RenderPartialAsync("_FileinputScriptsPartial"); |
||||
|
} |
||||
|
|
||||
|
<script type="text/javascript"> |
||||
|
$(document).ready(function () { |
||||
|
var error = '@Html.ValidationMessage("error")'; |
||||
|
if ($(error).text() != '') { |
||||
|
parent.hg.msg(error); |
||||
|
} |
||||
|
}); |
||||
|
</script> |
||||
|
} |
Loading…
Reference in new issue