|
|
@ -232,255 +232,5 @@ |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
@*<script> |
|
|
|
var treeTable; |
|
|
|
layui.config({ |
|
|
|
base: '../lib/layui_ext/' |
|
|
|
}).extend({ |
|
|
|
treeTable: 'treetable/treeTable' |
|
|
|
}).use(['treeTable', 'jquery', 'form', 'laydate'], function () { |
|
|
|
treeTable = layui.treeTable; |
|
|
|
var $ = layui.$; |
|
|
|
var form = layui.form, |
|
|
|
layer = layui.layer; |
|
|
|
treeTable.on('tool(test)', function (obj) { |
|
|
|
if (obj.event == 'edit') { |
|
|
|
if (obj.data.standardID) { |
|
|
|
hg.open('修改標準工時', '/WHS/WHS003U/' + obj.data.standardID, 480, 480); |
|
|
|
} |
|
|
|
} |
|
|
|
if (obj.event == 'del') { |
|
|
|
if (obj.data.standardID) { |
|
|
|
var str; |
|
|
|
str = "刪除"; |
|
|
|
hg.confirm("系統:" + obj.data.standardID + ",確定要" + str + "嗎?", function () { |
|
|
|
$.ajax({ |
|
|
|
url: '/WHS/WHS003D', |
|
|
|
data: { id: obj.data.standardID }, |
|
|
|
type: 'POST', |
|
|
|
success: function (res) { |
|
|
|
if (res.success) { |
|
|
|
obj.del(); //只删本地数据 |
|
|
|
hg.msghide(str + "成功!", { |
|
|
|
icon: 6 |
|
|
|
}); |
|
|
|
layui.table.reload('test', { page: { curr: $(".layui-laypage-em").next().html() } }) |
|
|
|
} |
|
|
|
else { |
|
|
|
hg.msg(data.msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
error: function () { |
|
|
|
hg.msg("网络请求失败!"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
form.on('select(unitNo)', function (data) { |
|
|
|
var data = $("#unitNo").val(); |
|
|
|
//console.info(data); |
|
|
|
getLineInfoes(data); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
var data = []; |
|
|
|
$(document).ready(function () { |
|
|
|
//console.log("ready"); |
|
|
|
request(); |
|
|
|
}); |
|
|
|
//通过table定义reload刷新列表,update本地填充一条数据 |
|
|
|
var TABLE = function () { |
|
|
|
return { |
|
|
|
reload: function () { |
|
|
|
request(); |
|
|
|
}, |
|
|
|
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 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: 'standardID', |
|
|
|
}, |
|
|
|
cols: [ |
|
|
|
{ |
|
|
|
field: 'standardID', |
|
|
|
title: '#', |
|
|
|
sort: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'unitNo', |
|
|
|
title: '單位代號' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'lineInfo', |
|
|
|
title: '線別', |
|
|
|
templet: function (d) { |
|
|
|
var line; |
|
|
|
if (d.lineInfo) |
|
|
|
line = d.lineInfo["lineDesc"]; |
|
|
|
else |
|
|
|
line = "N/A"; |
|
|
|
|
|
|
|
return line; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'stations', |
|
|
|
title: '站別', |
|
|
|
templet: function (d) { |
|
|
|
var station; |
|
|
|
if (d.stations) |
|
|
|
station = d.stations["stationName"]; |
|
|
|
else |
|
|
|
station = "N/A"; |
|
|
|
|
|
|
|
return station; |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'itemNo', |
|
|
|
title: '料號', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'side', |
|
|
|
title: '正背面', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'opcnt', |
|
|
|
title: '作業人數', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'firstTime', |
|
|
|
title: '首件產出時間(分)', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'totalCT', |
|
|
|
title: 'C/T(分)', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'ct', |
|
|
|
title: '節拍時間', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'machineCT', |
|
|
|
title: '操機數', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'center', |
|
|
|
width: 200, |
|
|
|
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 |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
style: 'margin-top:2;', |
|
|
|
done: function () { |
|
|
|
} |
|
|
|
}); |
|
|
|
insTb.expandAll(); |
|
|
|
} |
|
|
|
var table = new TABLE() |
|
|
|
//更新TABLE資料 |
|
|
|
function request() { |
|
|
|
var unit = $("#unitNo").val(); |
|
|
|
var lineID = $('#line').val(); |
|
|
|
var keywords = $('#modelname').val(); |
|
|
|
//if (unit || lineID) { |
|
|
|
hg.request('/WHS/GetStandardWorkTimes2?u=' + unit + '&l=' + lineID + '&i=' + keywords, function (result) { |
|
|
|
console.info(result.data); |
|
|
|
data = result.data; |
|
|
|
init(data); |
|
|
|
}); |
|
|
|
//} |
|
|
|
} |
|
|
|
//新增 |
|
|
|
$('#btnAdd').click(function () { |
|
|
|
var unit = $("#unitNo").val(); |
|
|
|
var lineID = $('#lineID').val(); |
|
|
|
if (lineID) { |
|
|
|
hg.open('新增標準工時', '/WHS/WHS003C?unit=' + unit + "&lineID=" + lineID, 480, 480); |
|
|
|
} |
|
|
|
else { |
|
|
|
alert("請選擇線別!!"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
//搜索 |
|
|
|
$('#btnSearch').click(function () { |
|
|
|
var unit = $("#unitNo").val(); |
|
|
|
|
|
|
|
var lineID = $('#lineID').val(); |
|
|
|
var line = $('#line').val(); |
|
|
|
if (lineID) { |
|
|
|
$('#line').val(lineID); |
|
|
|
} |
|
|
|
else { |
|
|
|
$('#line').val(-99); |
|
|
|
} |
|
|
|
//if (unit) { |
|
|
|
// if (lineID) { |
|
|
|
hg.msghide("刷新数据!"); |
|
|
|
request(); |
|
|
|
// } else { |
|
|
|
// alert("請選擇線別!!"); |
|
|
|
// } |
|
|
|
// } |
|
|
|
//else { |
|
|
|
// alert("請選擇生產單位!!"); |
|
|
|
// } |
|
|
|
}); |
|
|
|
//利用ajax將資料傳到後端,來獲取到對應下拉框選項而出現的值 |
|
|
|
function getLineInfoes(data) { |
|
|
|
$.ajax({ |
|
|
|
url: "/BAS/GetLineInfoByUnit", |
|
|
|
dataType: 'json', |
|
|
|
data: { id: data }, |
|
|
|
contentType: "application/json", |
|
|
|
type: 'get', |
|
|
|
success: function (result) { |
|
|
|
if (result.data) { |
|
|
|
$("#lineID").empty();//清空下拉框的值 |
|
|
|
$('#lineID').append(new Option("全部", "-99"));// 下拉選單裡新增元素 |
|
|
|
$.each(result.data, function (index, item) { |
|
|
|
$('#lineID').append(new Option(item.lineDesc, item.lineID));// 下拉選單裡新增元素 |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
$("#lineID").empty();//清空下拉框的值 |
|
|
|
$('#lineID').append(new Option("無選項", "-99"));// 下拉選單裡新增元素 |
|
|
|
} |
|
|
|
layui.form.render("select");//重新渲染 固定寫法 |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
</script>*@ |
|
|
|
} |