13 changed files with 872 additions and 331 deletions
@ -0,0 +1,280 @@ |
|||
|
|||
@{ ViewData["Title"] = "工單檢驗工項維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; } |
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</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 class="layui-inline"> |
|||
<label class="layui-form-label">料號:</label> |
|||
<div class="layui-input-inline"> |
|||
<input id="itemNo" name="itemNo" style="text-transform:uppercase;" autocomplete="off" class="layui-input" placeholder="請輸入料號"> |
|||
<input id="itemNoOld" name="itemNoOld" type="hidden" /> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline layui-show-xs-block"> |
|||
<button class="layui-btn layui-btn-sm layui-btn-normal" id="querysubmit" lay-submit lay-filter="querysubmit"> |
|||
<i class="layui-icon layui-icon-sm"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="layui-card-body"> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3" id="error"></span> |
|||
<table class="layui-hide" id="tableQuery" name="tableQuery" lay-filter="tableQuery"></table> |
|||
</div> |
|||
</div> |
|||
<script type="text/html" id="toolbarDemo"> |
|||
<div class="layui-btn-container"> |
|||
<button class="layui-btn layui-btn-sm layui-btn" lay-event="add"><i class="layui-icon"></i>保存</button> |
|||
</div> |
|||
</script> |
|||
|
|||
|
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
//搜索 |
|||
$('#querysubmit').click(function () { |
|||
hg.msghide('刷新数据!'); |
|||
initQuery(); |
|||
}); |
|||
|
|||
function initQuery(data) { |
|||
layui.use(['form', 'table'], function () { |
|||
var itemNo = $('#itemNo').val().toUpperCase(); |
|||
$('#itemNoOld').val(itemNo); |
|||
//记录当前页数据的临时变量 |
|||
//var $ = layui.$; |
|||
//var id_lists = []; |
|||
|
|||
table = layui.table; |
|||
form = layui.form; |
|||
|
|||
//方法級渲染 |
|||
table.render({ //其它参数在此省略 |
|||
elem: '#tableQuery', |
|||
url: "@Url.Action("FQC009ItemQuery", "FQC")", |
|||
title: '檢驗工項', |
|||
id: 'itemID', |
|||
page: false, //开启分页 |
|||
toolbar: '#toolbarDemo', |
|||
limits: [20, 50, 100], |
|||
defaultToolbar: ['filter', 'print', 'exports'], |
|||
cols: tableCols, |
|||
response: { msgName: 'msg' }, |
|||
where: {itemNo:itemNo}, |
|||
done: function (res, curr, count) { |
|||
// |
|||
if (res.msg != '') { |
|||
hg.msg(res.msg); |
|||
$('#error').text(res.msg); |
|||
} |
|||
|
|||
//迴圈所有資料,找出對應關係,設定checkbox選中狀態 |
|||
for (var i = 0; i < res.data.length; i++) { |
|||
if (res.data[i].check) { |
|||
//這裡才是真正的有效勾選 |
|||
res.data[i]["LAY_CHECKED"] = 'true'; |
|||
//找到對應資料改變勾選樣式,呈現出選中效果 |
|||
var index = res.data[i]['LAY_TABLE_INDEX']; |
|||
$('.layui-table tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', true); |
|||
$('.layui-table tr[data-index=' + index + '] input[type="checkbox"]').next().addClass('layui-form-checked'); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
|
|||
//触发事件 |
|||
table.on('toolbar(tableQuery)', function (obj) { |
|||
if ($('#itemNo').val().replace(/\s+/g, '').toUpperCase() == '') { |
|||
hg.msg('請輸入料號,請再重新查詢!'); |
|||
return; |
|||
} |
|||
|
|||
if ($('#itemNo').val().toUpperCase() != $('#itemNoOld').val()) { |
|||
hg.msg('保存失敗,原先查詢料號有異動過,請再重新查詢!'); |
|||
return; |
|||
}; |
|||
|
|||
|
|||
var checkStatus = table.checkStatus(obj.config.id); |
|||
if (obj.event == 'add') { |
|||
if (checkStatus && checkStatus.data.length > 0) { |
|||
console.log(checkStatus.data.map(function (x) { return x.itemID }).join(',')) |
|||
var itemID = checkStatus.data.map(function (x) { return x.itemID }).join(','); |
|||
var groupID = checkStatus.data.map(function (x) { return x.groupID }).join(','); |
|||
hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () { |
|||
$.ajax({ |
|||
url: '/FQC/FQC009C', |
|||
data: { 'itemID': itemID, 'groupID': groupID ,'itemNo': $('#itemNo').val().toUpperCase() }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
hg.msg('保存成功!'); |
|||
//重载表格数据 |
|||
//initQuery(data); |
|||
} |
|||
else { |
|||
//hg.msg(data.msg); |
|||
hg.msg(data.msg); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("网络请求失败!"); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
} else { |
|||
hg.msg('请勾選要綁定的檢驗工項,再執行!'); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
/** |
|||
* 复选框的点击事件 |
|||
* 主要操作为: |
|||
* 将所有的勾选成功的id储存传入后台拉取数据存到本地销售数据库 |
|||
*/ |
|||
//var id_checkeds = [];//所有選中的ID |
|||
//table.on('checkbox(tableQuery)', function (obj) { |
|||
// //console.log(obj.type); //如果触发的是全选,则为:all,如果触发的是单选,则为:one |
|||
// //var data = 'one' === obj.type ? [obj.data] : cookiePageArray; |
|||
// var is_all = obj.type == 'all' ? true : false ; // 是否全選 |
|||
// var is_checked = obj.checked; // 是否選中 |
|||
|
|||
// if (is_all) { |
|||
// if (is_checked) id_checkeds = id_lists; |
|||
// if (!is_checked) is_checkeds = []; |
|||
// } |
|||
// if(!is_all) |
|||
// { |
|||
// var this_PKID = obj.data.itemID; |
|||
// if (!is_checked) { |
|||
// id_checkeds.splice($.inArray(this_PKID, id_checkeds), 1); |
|||
// } |
|||
// if (is_checked) { |
|||
// var index = $.inArray(this_PKID, id_checkeds); |
|||
// if (index == -1) { |
|||
// id_checkeds.push(this_PKID); |
|||
// } |
|||
// } |
|||
// } |
|||
// console.log(id_checkeds); |
|||
|
|||
// ////if (obj.type == 'one') { |
|||
// ////遍历数据 |
|||
// //$.each(data, function (index, item) { |
|||
// // //假设你数据中 id 是唯一关键字 |
|||
// // if (obj.checked) { |
|||
// // //.增加已选中项 |
|||
// // layui.data('checked', { |
|||
// // key: item.itemID, value: item |
|||
// // }); |
|||
// // } else { |
|||
// // //.删除 |
|||
// // layui.data('checked', { |
|||
// // key: item.itemID, remove: true |
|||
// // }); |
|||
// // } |
|||
// //}); |
|||
// //} |
|||
|
|||
//}); |
|||
}); |
|||
}; |
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
initQuery(); |
|||
}); |
|||
|
|||
//监听表单提交事件 |
|||
|
|||
|
|||
////监听表单提交事件 |
|||
//hg.form.onsubmit('querysubmit', function (data) { |
|||
// table && table.reload(data); |
|||
//}); |
|||
var tableCols = [[ |
|||
{ type: 'checkbox', title:'全選' }, |
|||
{ |
|||
field: 'groupNameCN', |
|||
title: '類別中文', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'groupNameEN', |
|||
title: '類別英文', |
|||
}, |
|||
{ |
|||
field: 'itemNameCN', |
|||
title: '項目中文', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'itemNameEN', |
|||
title: '項目英文', |
|||
}, |
|||
] |
|||
]; |
|||
|
|||
var Toolbar = [{ |
|||
text: '保存', |
|||
layuiicon: '', |
|||
class: 'layui-btn', |
|||
handler: function (obj, row) { |
|||
if (obj.checkstatus && obj.checkstatus.data.length > 0) { |
|||
console.log(obj.checkstatus.data.map(function (x) { return x.itemID }).join(',')) |
|||
|
|||
hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () { |
|||
$.ajax({ |
|||
url: '/FQC/FQC009C', |
|||
data: { 'ids': obj.checkstatus.data.map(function (x) { return x.itemID }).join(','), 'itemNo':'aaa' }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
hg.msg('保存成功!'); |
|||
//重载表格数据 |
|||
table && table.reload(); |
|||
} |
|||
else { |
|||
//hg.msg(data.msg); |
|||
hg.msg('保存失败!'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("网络请求失败!"); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
} else { |
|||
hg.msg('请勾選要綁定的檢驗工項,再執行!'); |
|||
} |
|||
} |
|||
} |
|||
]; |
|||
//基本数据表格 |
|||
//var tableQuery = hg.table.datatable('tableQuery', '檢驗工項', '/FQC/FQC009ItemQuery', {}, tableCols, Toolbar, false, 'full-100', ['filter', 'print', 'exports']); |
|||
</script> |
|||
|
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
@model AMESCoreStudio.WebApi.DTO.AMES.FqcDto |
|||
|
|||
|
|||
@{ ViewData["Title"] = "FQC文件維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; } |
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</style> |
|||
|
|||
<div class="layui-card"> |
|||
<form enctype="multipart/form-data" method="post" asp-action="FQC007D" class="layui-form"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<div class="layui-card-body"> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3" id="error"></span> |
|||
<table lay-filter="demo" class="layui-table"> |
|||
<thead> |
|||
<tr> |
|||
<th lay-data="{field:'username', width:100}">檔案名稱</th> |
|||
<th lay-data="{field:'experience', width:80, sort:true}">檔案路徑</th> |
|||
<th lay-data="{field:'right', width:80, sort:true}">預覽</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
@foreach (var index in Model.fqcResultMasterBlobs) |
|||
{ |
|||
<tr> |
|||
<td> |
|||
<span id="FileName">@index.ImageName</span> |
|||
</td> |
|||
<td> |
|||
<span id="Filepath">@index.Filepath</span> |
|||
</td> |
|||
<td> |
|||
<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-read" onclick="show(this)">預覽</a> |
|||
</td> |
|||
</tr> |
|||
} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">檔案</label> |
|||
<label class="layui-btn"> |
|||
<input type="file" name="formFile"> |
|||
@*<i class="layui-icon"></i>上傳文件*@ |
|||
</label> |
|||
<input type="hidden" asp-for="WipNo"> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
layui.use(['form'], function () { |
|||
form = layui.form; |
|||
|
|||
}); |
|||
|
|||
//通过行tool编辑,lay-event="show" |
|||
function show(obj) { |
|||
var Path = $(obj).closest("TR").find('span[id*=Filepath]').text();; |
|||
var FileName = $(obj).closest("TR").find('span[id*=FileName]').text();; |
|||
layui.use('layer', function () { |
|||
var layer = layui.layer; |
|||
layer.open({ |
|||
type: 2, |
|||
title: '預覽文件', |
|||
shadeClose: true,//点击遮罩关闭层 |
|||
shade: 0.8, |
|||
area: ['90%', '90%'], |
|||
zIndex: 19891014, |
|||
content: "../../" + Path + FileName |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
@ -1,257 +0,0 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.QcGroup |
|||
|
|||
|
|||
@{ ViewData["Title"] = "料號檢驗工項新增"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; } |
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</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 class="layui-inline"> |
|||
<label class="layui-form-label">料號:</label> |
|||
<div class="layui-input-inline"> |
|||
<input id="itemNo" name="itemNo" autocomplete="off" class="layui-input" placeholder="請輸入料號"> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline layui-show-xs-block"> |
|||
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="querysubmit"> |
|||
<i class="layui-icon layui-icon-sm"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="layui-card-body"> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
|||
<table class="layui-hide" id="tableQuery" name="tableQuery" lay-filter="tableQuery"></table> |
|||
</div> |
|||
</div> |
|||
<script type="text/html" id="toolbarDemo"> |
|||
<div class="layui-btn-container"> |
|||
<button class="layui-btn layui-btn-sm layui-btn" lay-event="add"><i class="layui-icon"></i>保存</button> |
|||
</div> |
|||
</script> |
|||
|
|||
|
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
|
|||
hg.form.onsubmit('querysubmit', function (data) { |
|||
tableIns.reload(data); |
|||
}); |
|||
|
|||
layui.use(['form', 'table'], function () { |
|||
//记录当前页数据的临时变量 |
|||
//var $ = layui.$; |
|||
//var id_lists = []; |
|||
|
|||
table = layui.table; |
|||
form = layui.form; |
|||
|
|||
//方法級渲染 |
|||
var tableIns = table.render({ //其它参数在此省略 |
|||
elem: '#tableQuery', |
|||
url: "@Url.Action("FQC009ItemQuery", "FQC")", |
|||
title: '檢驗工項', |
|||
id:'itemID', |
|||
page: false, //开启分页 |
|||
toolbar: '#toolbarDemo', |
|||
limits: [20, 50, 100], |
|||
defaultToolbar: ['filter', 'print', 'exports'], |
|||
cols: tableCols, |
|||
done: function (res, curr, count) { |
|||
//在快取中找到PM_CODE ,然後設定data表格中的選中狀態 |
|||
//迴圈所有資料,找出對應關係,設定checkbox選中狀態 |
|||
for (var i = 0; i < res.data.length; i++) { |
|||
if (res.data[i].check) { |
|||
//這裡才是真正的有效勾選 |
|||
res.data[i]["LAY_CHECKED"] = 'true'; |
|||
//找到對應資料改變勾選樣式,呈現出選中效果 |
|||
var index = res.data[i]['LAY_TABLE_INDEX']; |
|||
$('.layui-table tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', true); |
|||
$('.layui-table tr[data-index=' + index + '] input[type="checkbox"]').next().addClass('layui-form-checked'); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
|
|||
//触发事件 |
|||
table.on('toolbar(tableQuery)', function (obj) { |
|||
var checkStatus = table.checkStatus(obj.config.id); |
|||
if (obj.event == 'add') { |
|||
if (checkStatus && checkStatus.data.length > 0) { |
|||
console.log(checkStatus.data.map(function (x) { return x.itemID }).join(',')) |
|||
|
|||
hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () { |
|||
$.ajax({ |
|||
url: '/FQC/FQC009C', |
|||
data: { 'ids': checkStatus.data.map(function (x) { return x.itemID }).join(','), 'itemNo': 'aaa' }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
hg.msg('保存成功!'); |
|||
//重载表格数据 |
|||
table && table.reload(); |
|||
} |
|||
else { |
|||
//hg.msg(data.msg); |
|||
hg.msg('保存失败!'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("网络请求失败!"); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
} else { |
|||
hg.msg('请勾選要綁定的檢驗工項,再執行!'); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
/** |
|||
* 复选框的点击事件 |
|||
* 主要操作为: |
|||
* 将所有的勾选成功的id储存传入后台拉取数据存到本地销售数据库 |
|||
*/ |
|||
//var id_checkeds = [];//所有選中的ID |
|||
//table.on('checkbox(tableQuery)', function (obj) { |
|||
// //console.log(obj.type); //如果触发的是全选,则为:all,如果触发的是单选,则为:one |
|||
// //var data = 'one' === obj.type ? [obj.data] : cookiePageArray; |
|||
// var is_all = obj.type == 'all' ? true : false ; // 是否全選 |
|||
// var is_checked = obj.checked; // 是否選中 |
|||
|
|||
// if (is_all) { |
|||
// if (is_checked) id_checkeds = id_lists; |
|||
// if (!is_checked) is_checkeds = []; |
|||
// } |
|||
// if(!is_all) |
|||
// { |
|||
// var this_PKID = obj.data.itemID; |
|||
// if (!is_checked) { |
|||
// id_checkeds.splice($.inArray(this_PKID, id_checkeds), 1); |
|||
// } |
|||
// if (is_checked) { |
|||
// var index = $.inArray(this_PKID, id_checkeds); |
|||
// if (index == -1) { |
|||
// id_checkeds.push(this_PKID); |
|||
// } |
|||
// } |
|||
// } |
|||
// console.log(id_checkeds); |
|||
|
|||
// ////if (obj.type == 'one') { |
|||
// ////遍历数据 |
|||
// //$.each(data, function (index, item) { |
|||
// // //假设你数据中 id 是唯一关键字 |
|||
// // if (obj.checked) { |
|||
// // //.增加已选中项 |
|||
// // layui.data('checked', { |
|||
// // key: item.itemID, value: item |
|||
// // }); |
|||
// // } else { |
|||
// // //.删除 |
|||
// // layui.data('checked', { |
|||
// // key: item.itemID, remove: true |
|||
// // }); |
|||
// // } |
|||
// //}); |
|||
// //} |
|||
|
|||
//}); |
|||
}); |
|||
|
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
|
|||
//监听表单提交事件 |
|||
|
|||
|
|||
////监听表单提交事件 |
|||
//hg.form.onsubmit('querysubmit', function (data) { |
|||
// table && table.reload(data); |
|||
//}); |
|||
var tableCols = [[ |
|||
{ type: 'checkbox', title:'全選' }, |
|||
{ |
|||
field: 'groupNameCN', |
|||
title: '類別中文', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'groupNameEN', |
|||
title: '類別英文', |
|||
}, |
|||
{ |
|||
field: 'itemNameCN', |
|||
title: '項目中文', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'itemNameEN', |
|||
title: '項目英文', |
|||
}, |
|||
] |
|||
]; |
|||
|
|||
var Toolbar = [{ |
|||
text: '保存', |
|||
layuiicon: '', |
|||
class: 'layui-btn', |
|||
handler: function (obj, row) { |
|||
if (obj.checkstatus && obj.checkstatus.data.length > 0) { |
|||
console.log(obj.checkstatus.data.map(function (x) { return x.itemID }).join(',')) |
|||
|
|||
hg.confirm("確定要綁定有勾選的檢驗工項嗎?", function () { |
|||
$.ajax({ |
|||
url: '/FQC/FQC009C', |
|||
data: { 'ids': obj.checkstatus.data.map(function (x) { return x.itemID }).join(','), 'itemNo':'aaa' }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
hg.msg('保存成功!'); |
|||
//重载表格数据 |
|||
table && table.reload(); |
|||
} |
|||
else { |
|||
//hg.msg(data.msg); |
|||
hg.msg('保存失败!'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("网络请求失败!"); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
} else { |
|||
hg.msg('请勾選要綁定的檢驗工項,再執行!'); |
|||
} |
|||
} |
|||
} |
|||
]; |
|||
//基本数据表格 |
|||
//var tableQuery = hg.table.datatable('tableQuery', '檢驗工項', '/FQC/FQC009ItemQuery', {}, tableCols, Toolbar, false, 'full-100', ['filter', 'print', 'exports']); |
|||
</script> |
|||
|
|||
|
|||
} |
Loading…
Reference in new issue