Browse Source

1. 巡檢結果維護 稽核結果下拉選單加入顏色判定

master
Sai 8 months ago
parent
commit
96aab6c8e0
  1. 31
      AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml
  2. 125
      AMESCoreStudio.Web/Views/SPC/SPC005U.cshtml
  3. 242
      AMESCoreStudio.Web/Views/SPC/SPC005V.cshtml

31
AMESCoreStudio.Web/Views/SPC/SPC005C.cshtml

@ -138,7 +138,7 @@
@*回復*@
<script type="text/html" id="selectResult">
<select name='result' lay-verify='' lay-search='' class="layui-form" lay-filter="result">
<select name='selectResult' id='selectResult' lay-verify='' lay-search='' class="layui-form selectResult" lay-filter="selectResult">
<option value="NA">N/A</option>
<option value="P">PASS</option>
<option value="F">FAIL </option>
@ -584,9 +584,24 @@
elem.val(elem.data('value')).parents('div.layui-table-cell').css('overflow', 'visible');
});
form.render();
handleSelectResult();
}
});
}
// Table SelectResult 選項字體換色
function handleSelectResult() {
$('.selectResult').each(function () {
console.log($(this).val());
if ($(this).val() === 'P') {
$(this).next().find('input').css('color', 'green');
}
else if ($(this).val() === 'F') {
$(this).next().find('input').css('color', 'red');
}
});
}
/*表格列表操作*/
table.on('tool(test)', function (obj) {
var data = obj.data, layEvent = obj.event;
@ -686,6 +701,20 @@
$('table.layui-table thead tr th:nth-child(6)').addClass('layui-hide');
}
});
// 選單選擇後換色 SelectResult 選項字體換色
form.on('select(selectResult)', function (data) {
var id = data.elem.id;
if (data.value === "P") {
$(data.elem).next().find('input').css('color', 'green');
}
else if (data.value === "F") {
$(data.elem).next().find('input').css('color', 'red');
}
else {
$(data.elem).next().find('input').css('color', 'black');
}
});
});
function CheckBarcodeNo(BarcodeNo, WipNo) {

125
AMESCoreStudio.Web/Views/SPC/SPC005U.cshtml

@ -96,34 +96,34 @@
</div>
</div>
@*<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">線別:</label>
<div class="layui-input-inline" style="width:100px">
<select id="theLine" lay-event="theLine" lay-filter="theLine" lay-submit asp-items="@ViewBag.LineList">
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">站別:</label>
<div class="layui-input-inline" style="width:100px">
<select id="theStation" lay-event="theStation" lay-filter="theStation" lay-submit asp-items="@ViewBag.StationList">
</select>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline" style="width:200px">
<input lay-filter="show" lay-skin="primary" type="checkbox" value="" title="勾選確認顯示線別/站別" />
</div>
</div>
</div>*@
<div class="layui-inline">
<label class="layui-form-label">線別:</label>
<div class="layui-input-inline" style="width:100px">
<select id="theLine" lay-event="theLine" lay-filter="theLine" lay-submit asp-items="@ViewBag.LineList">
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">站別:</label>
<div class="layui-input-inline" style="width:100px">
<select id="theStation" lay-event="theStation" lay-filter="theStation" lay-submit asp-items="@ViewBag.StationList">
</select>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline" style="width:200px">
<input lay-filter="show" lay-skin="primary" type="checkbox" value="" title="勾選確認顯示線別/站別" />
</div>
</div>
</div>*@
</div>
@*<div class="layui-inline">
<div class="layui-form-item">
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span>
<button id="querysubmitTmp" class="layui-btn tt">暫存</button>
<button id="querysubmit" class="layui-btn tt">儲存</button>
</div>
</div>*@
<div class="layui-form-item">
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span>
<button id="querysubmitTmp" class="layui-btn tt">暫存</button>
<button id="querysubmit" class="layui-btn tt">儲存</button>
</div>
</div>*@
</form>
<form id="modeltable">
@if (ViewBag.InspectionTypeID == 1000)
@ -143,7 +143,7 @@
@*回復*@
<script type="text/html" id="selectResult">
<select name="selectResult" lay-filter="selectResult" id="selectResult" data-value={{d.result}} class="layui-form">
<select name="selectResult" lay-filter="selectResult" id="selectResult" data-value={{d.result}} class="layui-form selectResult">
<option value="NA">N/A</option>
<option value="P">PASS</option>
<option value="F">FAIL </option>
@ -355,12 +355,14 @@
laytpl = layui.laytpl,
laydate = layui.laydate;
itemslist();
function itemslist() {
var formID = $("#InspectionID").val();
table.render({
elem: '#test',
// url: '/SPC/GetInspectionResultDetails?id=' + formID,
// url: '/SPC/GetInspectionResultDetails?id=' + formID,
url: '/SPC/GetInspectionResultDetailsAndBolb?id=' + formID,
id: 'test',
@ -406,7 +408,7 @@
var btn = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">上傳圖片</a> ';
if (d.stations.newCno > 0)
btn = btn + '<i class="layui-icon" style="font-size: 20px;">&#xe66e;</i> ' ;
btn = btn + '<i class="layui-icon" style="font-size: 20px;">&#xe66e;</i> ';
return btn;
@ -430,9 +432,24 @@
elem.val(elem.data('value')).parents('div.layui-table-cell').css('overflow', 'visible');
});
form.render();
handleSelectResult();
}
});
}
// Table SelectResult 選項字體換色
function handleSelectResult() {
$('.selectResult').each(function () {
console.log($(this).val());
if ($(this).val() === 'P') {
$(this).next().find('input').css('color', 'green');
}
else if ($(this).val() === 'F') {
$(this).next().find('input').css('color', 'red');
}
});
}
/*表格列表操作*/
table.on('tool(test)', function (obj) {
var data = obj.data, layEvent = obj.event;
@ -539,27 +556,41 @@
$('table.layui-table thead tr th:nth-child(6)').addClass('layui-hide');
}
});
});
function GetPLM_ECN() {
var ItemNo = $("#ItemNo").val();
$.ajax({
url: "@Url.Action("SPC005GetPLMECN", "SPC")",
type: "Post",
data: { "ItemNo": ItemNo },
success: function (result) {
if (result.success) {
$('#PLMECN').val(result.msg);
// 選單選擇後換色 SelectResult 選項字體換色
form.on('select(selectResult)', function (data) {
var id = data.elem.id;
if (data.value === "P") {
$(data.elem).next().find('input').css('color', 'green');
}
else {
alert(result.msg);
else if (data.value === "F") {
$(data.elem).next().find('input').css('color', 'red');
}
},
error: function (result) {
alert(`呼叫API失敗`);
}
else{
$(data.elem).next().find('input').css('color', 'black');
}
});
});
}
function GetPLM_ECN() {
var ItemNo = $("#ItemNo").val();
$.ajax({
url: "@Url.Action("SPC005GetPLMECN", "SPC")",
type: "Post",
data: { "ItemNo": ItemNo },
success: function (result) {
if (result.success) {
$('#PLMECN').val(result.msg);
}
else {
alert(result.msg);
}
},
error: function (result) {
alert(`呼叫API失敗`);
}
});
}
// PLM_ECN
$("#GetPLMECN").on("click", function () {
var ItemNo = $("#ItemNo").val();
@ -629,7 +660,5 @@
};
});
</script>
}

242
AMESCoreStudio.Web/Views/SPC/SPC005V.cshtml

@ -1,7 +1,8 @@
@model AMESCoreStudio.WebApi.Models.AMES.InspectionResultMaster
@{ ViewData["Title"] = "SPC005U";
@{
ViewData["Title"] = "SPC005U";
Layout = "~/Views/Shared/_AMESLayout.cshtml";
//Layout = "~/Views/Shared/_FormLayout.cshtml";
}
@ -15,12 +16,24 @@
margin-left: -10px;
margin-right: -10px;
}
.layui-table-cell {
height: auto;
overflow: visible;
text-overflow: inherit;
white-space: normal
}
.layui-disabled-red {
color: red !important;
cursor: not-allowed !important
}
.layui-disabled-green {
color: green !important;
cursor: not-allowed !important
}
green
</style>
<div class="layui-card">
<div class="layui-card-body">
@ -64,15 +77,17 @@
<table class="layui-hide" id="test" lay-filter="test" lay-data="{id:'test'}"></table>
</form>
</div>
</div>
</div>
@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial"); }
@{
await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial");
}
@*回復*@
<script type="text/html" id="selectResult">
<select name="selectResult" lay-filter="selectResult" id="selectResult" data-value={{d.result}} class="layui-form" disabled>
<select name="selectResult" lay-filter="selectResult" id="selectResult" data-value={{d.result}} class="layui-form selectResult" disabled>
<option value="NA">N/A</option>
<option value="P">PASS</option>
<option value="F">FAIL </option>
@ -100,115 +115,130 @@
</script>
<script type="text/javascript">
layui.use(['form', 'layer', 'table', 'laytpl', 'laydate'], function () {
var layer = layui.layer,
$ = layui.jquery,
form = layui.form,
table = layui.table;
itemslist();
function itemslist() {
var formID = $("#InspectionID").val();
table.render({
elem: '#test',
url: '/SPC/GetInspectionResultDetailsandBolb?id=' + formID,
id: 'test',
toolbar: '#toolBar',
//height:720,
page: false,
cols: [[
{ field: 'inspectionItemID', width: 50, title: '#', },
{
field: 'inspectionItem',
title: '項目',
align: 'left',
sort: true,
templet: function (d) {
return d.inspectionItem['inspectionItemName'];
}
},
{
field: 'inspectionItem',
title: '標準值',
minwidth: 80,
align: 'left',
templet: function (d) {
return d.inspectionItem['inspectionItemValue'];
}
},
{ field: 'result', title: '稽核結果', width: 100, align: "left", templet: '#selectResult' },
{ field: 'lineID', title: '線別', width: 100, align: "left", templet: '#selectLine' },
{ field: 'ruleStationID', title: '站別', width: 100, align: "left", templet: '#selectStation' },
{ field: 'location', title: '插件位置', width: 100, align: "left" },
{ field: 'missingUnitNo', title: '缺失單位', width: 100, align: "left", templet: '#selectDept' },
{ field: 'missingUserID', title: '缺失人員', width: 100, align: "left", templet: '#selectUser' },
{ field: 'missingRemark', title: '備註', width: 250, align: "left"},//templet: '#inputTest'
{
field: 'right',
width: 120,
title: '操作',
fixed: 'right',
templet: function (d) {
var btn = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">上傳圖片</a> ';
if (d.stations.newCno > 0)
btn = btn + '<i class="layui-icon" style="font-size: 20px;">&#xe66e;</i> ';
return btn;
layui.use(['form', 'layer', 'table', 'laytpl', 'laydate'], function () {
var layer = layui.layer,
$ = layui.jquery,
form = layui.form,
table = layui.table;
itemslist();
function itemslist() {
var formID = $("#InspectionID").val();
table.render({
elem: '#test',
url: '/SPC/GetInspectionResultDetailsandBolb?id=' + formID,
id: 'test',
toolbar: '#toolBar',
//height:720,
page: false,
cols: [[
{ field: 'inspectionItemID', width: 50, title: '#', },
{
field: 'inspectionItem',
title: '項目',
align: 'left',
sort: true,
templet: function (d) {
return d.inspectionItem['inspectionItemName'];
}
},
{
field: 'inspectionItem',
title: '標準值',
minwidth: 80,
align: 'left',
templet: function (d) {
return d.inspectionItem['inspectionItemValue'];
}
},
{ field: 'result', title: '稽核結果', width: 100, align: "left", templet: '#selectResult' },
{ field: 'lineID', title: '線別', width: 100, align: "left", templet: '#selectLine' },
{ field: 'ruleStationID', title: '站別', width: 100, align: "left", templet: '#selectStation' },
{ field: 'location', title: '插件位置', width: 100, align: "left" },
{ field: 'missingUnitNo', title: '缺失單位', width: 100, align: "left", templet: '#selectDept' },
{ field: 'missingUserID', title: '缺失人員', width: 100, align: "left", templet: '#selectUser' },
{ field: 'missingRemark', title: '備註', width: 250, align: "left" },//templet: '#inputTest'
{
field: 'right',
width: 120,
title: '操作',
fixed: 'right',
templet: function (d) {
var btn = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">上傳圖片</a> ';
if (d.stations.newCno > 0)
btn = btn + '<i class="layui-icon" style="font-size: 20px;">&#xe66e;</i> ';
return btn;
}
}
]],
done: function (res, curr, count) {
$(".layui-table-main tr").each(function (index, val) {
$($(".layui-table-fixed .layui-table-body tbody tr")[index]).height($(val).height());
});
layui.each($('select'), function (index, item) {
var elem = $(item);
elem.val(elem.data('value')).parents('div.layui-table-cell').css('overflow', 'visible');
});
form.render();
handleSelectResult();
}
]],
done: function (res, curr, count) {
$(".layui-table-main tr").each(function (index, val) {
$($(".layui-table-fixed .layui-table-body tbody tr")[index]).height($(val).height());
});
layui.each($('select'), function (index, item) {
var elem = $(item);
elem.val(elem.data('value')).parents('div.layui-table-cell').css('overflow', 'visible');
});
form.render();
}
});
}
/*表格列表操作*/
table.on('tool(test)', function (obj) {
var data = obj.data, layEvent = obj.event;
if (layEvent === 'edit') {
var id = $("#InspectionID").val();
if (obj.data.inspectionItemID) {
layer.open({
type: 2 //此處以iframe舉例
, title: '上傳文件'
, area: ['480px', '400px']
, shade: 0
, maxmin: true
, offset: 'auto'//顯示座標-auto居中
, content: "/SPC/SPC005R?id=" + id + "&itemID=" + obj.data.inspectionItemID
//, btn: ['關閉']
, yes: function () {
//layer.close();
if (layer.confirm('確定要關閉麼')) {
layer.close(index);
});
}
// Table SelectResult 選項字體換色
function handleSelectResult() {
$('.selectResult').each(function () {
console.log($(this));
if ($(this).val() === 'P') {
$(this).next().find('input').addClass('layui-disabled-green');
}
else if ($(this).val() === 'F') {
$(this).next().find('input').addClass('layui-disabled-red');
}
});
}
/*表格列表操作*/
table.on('tool(test)', function (obj) {
var data = obj.data, layEvent = obj.event;
if (layEvent === 'edit') {
var id = $("#InspectionID").val();
if (obj.data.inspectionItemID) {
layer.open({
type: 2 //此處以iframe舉例
, title: '上傳文件'
, area: ['480px', '400px']
, shade: 0
, maxmin: true
, offset: 'auto'//顯示座標-auto居中
, content: "/SPC/SPC005R?id=" + id + "&itemID=" + obj.data.inspectionItemID
//, btn: ['關閉']
, yes: function () {
//layer.close();
if (layer.confirm('確定要關閉麼')) {
layer.close(index);
}
// $(that).click();
}
// $(that).click();
}
, zIndex: 19891014 //layer.zIndex //重點1
, success: function (layero) {
layer.setTop(layero); //重點2
}
});
//hg.open('上傳文件', '/SPC/SPC005R?id=' + id + '&itemID=' + obj.data.inspectionItemID, 1080, 640);
, zIndex: 19891014 //layer.zIndex //重點1
, success: function (layero) {
layer.setTop(layero); //重點2
}
});
//hg.open('上傳文件', '/SPC/SPC005R?id=' + id + '&itemID=' + obj.data.inspectionItemID, 1080, 640);
}
}
});
});
$(document).ready(function () {
var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') {
parent.hg.msg(error);
}
});
});
$(document).ready(function () {
var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') {
parent.hg.msg(error);
}
});
</script>
}

Loading…
Cancel
Save