|
@ -23,17 +23,12 @@ |
|
|
<input id="unitId" type="hidden" name="unitId" value="@ViewBag.UnitNo" /> |
|
|
<input id="unitId" type="hidden" name="unitId" value="@ViewBag.UnitNo" /> |
|
|
</div> |
|
|
</div> |
|
|
<div class="layui-inline" style="margin-right:5px;"> |
|
|
<div class="layui-inline" style="margin-right:5px;"> |
|
|
<input type="text" class="layui-input" id="edtSearch" value="" placeholder="請輸入內部條碼" style="display: inline-block;width: 140px;height: 30px;line-height: 30px;margin-left:20px;" /> |
|
|
<input id="barcodeNo" name="barcodeNo" autocomplete="off" class="layui-input" placeholder="請輸入內部條碼" style="display: inline-block;width: 140px;height: 30px;line-height: 30px;margin-left:20px;" /> |
|
|
</div> |
|
|
</div> |
|
|
<div class="layui-inline" style="margin-left:0px;"> |
|
|
<div class="layui-inline layui-show-xs-block"> |
|
|
<div class="layui-btn-group"> |
|
|
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="querysubmit"> |
|
|
<button id="btnSearch" class="layui-btn layui-btn-sm"> |
|
|
<i class="layui-icon layui-icon-sm"></i> |
|
|
<i class="layui-icon"></i>搜索 |
|
|
|
|
|
</button> |
|
|
</button> |
|
|
<button id="btnClearSearch" class="layui-btn layui-btn-sm layui-btn-primary"> |
|
|
|
|
|
<i class="layui-icon">ဆ</i>清除 |
|
|
|
|
|
</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="layui-inline"> |
|
|
<div class="layui-inline"> |
|
@ -45,177 +40,69 @@ |
|
|
</div> |
|
|
</div> |
|
|
@section Scripts{ |
|
|
@section Scripts{ |
|
|
<script type="text/javascript"> |
|
|
<script type="text/javascript"> |
|
|
var treeTable; |
|
|
|
|
|
layui.config({ |
|
|
|
|
|
base: '../lib/layui_ext/' |
|
|
layui.use(['form', 'jquery', 'layer'], function () { |
|
|
}).extend({ |
|
|
form = layui.form; |
|
|
treeTable: 'treetable/treeTable' |
|
|
|
|
|
}).use(['treeTable'], function () { |
|
|
var qs = $('button[lay-filter="querysubmit"]'); |
|
|
treeTable = layui.treeTable; |
|
|
qs.click(); |
|
|
//treeTable.on('tool(test)', function (obj) { |
|
|
|
|
|
// if (obj.event == 'edit') { |
|
|
|
|
|
// if (obj.data.lineID) { |
|
|
|
|
|
// hg.open('修改線別', '/BAS/BAS003U/' + obj.data.lineID, 480, 480); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// if (obj.event == 'del') { |
|
|
|
|
|
// var str; |
|
|
|
|
|
// if (obj.data.statusNo == 'A') |
|
|
|
|
|
// str = '停用'; |
|
|
|
|
|
// else |
|
|
|
|
|
// str = '啟用'; |
|
|
|
|
|
// hg.confirm("系統:" + obj.data.lineDesc + ",确定要"+str+"吗?", function () { |
|
|
|
|
|
// $.ajax({ |
|
|
|
|
|
// url: '/BAS/BAS003U2', //抓取停用 |
|
|
|
|
|
// data: { model: obj.data }, |
|
|
|
|
|
// type: 'POST', |
|
|
|
|
|
// success: function (data) { |
|
|
|
|
|
// if (data.success) { |
|
|
|
|
|
// //obj.del(); //只删本地数据 |
|
|
|
|
|
// hg.msghide("成功!"); |
|
|
|
|
|
// var aa = $("#unitId").val(); |
|
|
|
|
|
// request(aa); |
|
|
|
|
|
// } |
|
|
|
|
|
// else { |
|
|
|
|
|
// hg.msg(data.msg); |
|
|
|
|
|
// } |
|
|
|
|
|
// }, |
|
|
|
|
|
// error: function () { |
|
|
|
|
|
// hg.msg("网络请求失败!"); |
|
|
|
|
|
// } |
|
|
|
|
|
// }); |
|
|
|
|
|
// }); |
|
|
|
|
|
// } |
|
|
|
|
|
//}); |
|
|
|
|
|
form.on('select(unit)', function (data) { |
|
|
|
|
|
$("#unitId").val(data.value); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
var data = []; |
|
|
|
|
|
$(document).ready(function () { |
|
|
|
|
|
request(); |
|
|
|
|
|
}); |
|
|
}); |
|
|
//通过table定义reload刷新列表,update本地填充一条数据 |
|
|
|
|
|
var TABLE = function () { |
|
|
//监听表单提交事件 |
|
|
return { |
|
|
hg.form.onsubmit('querysubmit', function (data) { |
|
|
reload: function () { |
|
|
hg.msghide("重新載入資料.."); |
|
|
request(); |
|
|
table && table.reload(data); |
|
|
}, |
|
|
|
|
|
update: function (d) { |
|
|
|
|
|
var model = $.parseJSON(d); |
|
|
|
|
|
var up = false; |
|
|
|
|
|
layui.each(data, function (i, d) { |
|
|
|
|
|
if (d.id == model.id) { |
|
|
|
|
|
data[i] = model; |
|
|
|
|
|
up = true; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
up || data.push(model); |
|
|
|
|
|
init(data); |
|
|
var tableCols = [[ |
|
|
} |
|
|
{ |
|
|
} |
|
|
field: 'b', |
|
|
|
|
|
title: '內部條碼', |
|
|
|
|
|
sort: true, |
|
|
|
|
|
templet: function (d) { |
|
|
|
|
|
return d.b['barcodeNo']; |
|
|
} |
|
|
} |
|
|
var insTb; |
|
|
|
|
|
function init(data) { |
|
|
|
|
|
insTb = treeTable.render({ |
|
|
|
|
|
elem: '#test', |
|
|
|
|
|
height: 'full-180', |
|
|
|
|
|
text: { |
|
|
|
|
|
none: '<div style="padding: 18px 0;">無資料</div>' |
|
|
|
|
|
}, |
|
|
}, |
|
|
data: data, |
|
|
|
|
|
tree: { |
|
|
|
|
|
iconIndex: -1, |
|
|
|
|
|
isPidData: false, |
|
|
|
|
|
idName: 'barcodeID', |
|
|
|
|
|
}, |
|
|
|
|
|
cols: [ |
|
|
|
|
|
{ |
|
|
{ |
|
|
field: 'b', |
|
|
field: 's', |
|
|
minWidth: 100, |
|
|
width: 200, |
|
|
title: '內部條碼' |
|
|
title: '站別', |
|
|
, templet: function (d) { |
|
|
sort: true, |
|
|
console.log(d.b); |
|
|
templet: function (d) { |
|
|
var iN; |
|
|
return d.s['stationName']; |
|
|
if (d.i) |
|
|
|
|
|
iN = d.b["barcodeNo"]; |
|
|
|
|
|
else |
|
|
|
|
|
iN = "N/A"; |
|
|
|
|
|
return iN; |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
field: 'partNo', |
|
|
field: 'itemNo', |
|
|
minWidth: 100, |
|
|
width: 120, |
|
|
title: '組件條碼' |
|
|
title: '組件代碼' |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
field: 'kpItemNo', |
|
|
field: 'kpItemNo', |
|
|
minWidth: 100, |
|
|
width: 200, |
|
|
title: '組件料號' |
|
|
title: '组件料號' |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
field: 'i', |
|
|
field: 'partNo', |
|
|
title: '組件名稱' |
|
|
width: 120, |
|
|
, templet: function (d) { |
|
|
title: '組件條碼' |
|
|
var iN; |
|
|
}] |
|
|
if (d.i) |
|
|
]; |
|
|
iN = d.i["itemName"]; |
|
|
|
|
|
else |
|
|
|
|
|
iN = "N/A"; |
|
|
|
|
|
return iN; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
], |
|
|
|
|
|
style: 'margin-top:0;', |
|
|
|
|
|
done: function () { |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
insTb.expandAll(); |
|
|
|
|
|
} |
|
|
|
|
|
var table = new TABLE() |
|
|
|
|
|
//更新資料 |
|
|
|
|
|
function request() { |
|
|
|
|
|
var aa = $("#unit").val(); |
|
|
|
|
|
var keywords = $('#edtSearch').val(); |
|
|
|
|
|
if (keywords && aa) |
|
|
|
|
|
//hg.request('/PCS/GetBItem/' + aa + '/' + keywords , function (result) { |
|
|
|
|
|
hg.request('/PCS/GetBarcodeItemByUnit/' + aa + '=' + keywords, function (result) { |
|
|
|
|
|
data = result.data; |
|
|
|
|
|
init(data); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
//搜索 |
|
|
|
|
|
$('#btnSearch').click(function () { |
|
|
|
|
|
var aa = $("#unit").val(); |
|
|
|
|
|
var keywords = $('#edtSearch').val(); |
|
|
|
|
|
if (aa) { |
|
|
|
|
|
if (keywords) { |
|
|
|
|
|
hg.msghide("刷新数据!"); |
|
|
|
|
|
request(); |
|
|
|
|
|
} else { |
|
|
|
|
|
alert("請輸入條碼!!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
alert("請選擇生產單位!!"); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
//清除 |
|
|
|
|
|
$('#btnClearSearch').click(function () { |
|
|
|
|
|
$('#edtSearch').val(""); |
|
|
|
|
|
insTb.clearFilter(); |
|
|
|
|
|
}); |
|
|
|
|
|
//新增 |
|
|
//新增 |
|
|
$('#btnAdd').click(function () { |
|
|
$('#btnAdd').click(function () { |
|
|
var keywords = $('#edtSearch').val(); |
|
|
var keywords = $('#barcodeNo').val(); |
|
|
if (keywords) |
|
|
if (keywords) |
|
|
hg.open('新增組件資料', '/PCS/PCS024C/' + keywords, 480, 480); |
|
|
hg.open('新增組件資料', '/PCS/PCS024C/' + keywords, 640, 480); |
|
|
else |
|
|
else |
|
|
alert("請先輸入內部條碼!!"); |
|
|
alert("請先輸入內部條碼!!"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
</script> |
|
|
var aa = $("#unit").val();
var keywords = $('#edtSearch').val(); |
|
|
|
|
|
|
|
|
|
|
|
//基本数据表格 |
|
|
|
|
|
var table = hg.table.datatable('test', '組件資料', '/PCS/GetBarcodeItemByUnit', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
} |
|
|
} |