提交 | 用户 | 时间
|
4779be
|
1 |
layui.use(['form', 'table', 'admin', 'ax', 'func','element'], function () { |
懒 |
2 |
var $ = layui.$; |
|
3 |
var table = layui.table; |
|
4 |
var $ax = layui.ax; |
|
5 |
var admin = layui.admin; |
|
6 |
var func = layui.func; |
|
7 |
var form = layui.form; |
|
8 |
var element = layui.element; |
|
9 |
|
cd500a
|
10 |
/** |
懒 |
11 |
* 配方配置子信息管理 |
|
12 |
*/ |
|
13 |
var FormulaChildInfo = { |
|
14 |
tableId: "formulaChildInfoTable" |
|
15 |
}; |
|
16 |
|
|
17 |
$('#imgs').attr("src", "http://localhost:8081/img/9f2f070828381f30fdf1be0da9014c086f06f0ad.jpg"); |
|
18 |
|
|
19 |
/** |
|
20 |
* 初始化表格的列 |
|
21 |
*/ |
|
22 |
FormulaChildInfo.initColumn = function () { |
|
23 |
return [[ |
|
24 |
{field: 'id', hide: true, title: 'id'}, |
|
25 |
{type:"numbers" ,title:'工步',width:40}, |
|
26 |
{field: 'operationSteps', sort: true, title: '操作内容'}, |
|
27 |
{field: 'techRequirement', sort: true, title: '技术要求'}, |
|
28 |
{field: 'operationType', sort: true, title: '类型'}, |
|
29 |
]]; |
|
30 |
}; |
|
31 |
|
|
32 |
|
4779be
|
33 |
initLineInfo(); |
懒 |
34 |
|
|
35 |
var ajax = new $ax(Feng.ctxPath + "/workOrder/list?state=3"); |
|
36 |
var result = ajax.start(); |
|
37 |
let msg = result.data[0]; |
|
38 |
$('#workOrder').text(msg.workOrderCode); |
|
39 |
$('#salesOrderCode').text(msg.salesOrderCode); |
|
40 |
$('#productCode').text(msg.productCode); |
|
41 |
$('#productName').text(msg.productName); |
|
42 |
$('#planQty').text(msg.planQty); |
|
43 |
$('#planStartTime').text(msg.planStartTime); |
|
44 |
$('#planEndTime').text(msg.planEndTime); |
ffeba3
|
45 |
$('#recipeCode').text(msg.recipeCode); |
4779be
|
46 |
var radioElement = $('#sex1'); |
懒 |
47 |
|
cd500a
|
48 |
var queryData = {}; |
懒 |
49 |
queryData['formulaCode'] = msg.recipeCode; |
|
50 |
// 渲染表格 |
|
51 |
table.render({ |
|
52 |
elem: '#' + FormulaChildInfo.tableId, |
|
53 |
url: Feng.ctxPath + '/formulaChildInfo/list', |
|
54 |
page: false, |
|
55 |
// height: "full-158", |
|
56 |
height: 460, |
|
57 |
cellMinWidth: 100, |
|
58 |
where: queryData, |
|
59 |
cols: FormulaChildInfo.initColumn(), |
|
60 |
done: function (res, curr, count) { |
|
61 |
console.log(res); |
|
62 |
//得到当前页码 |
|
63 |
console.log(curr); |
|
64 |
//得到数据总量 |
|
65 |
console.log(count); |
|
66 |
// 根据条件判断加背景色 |
|
67 |
$.each(res.data, function (index, item) { |
|
68 |
console.log(item) |
|
69 |
console.log(item.spareField1) |
|
70 |
if (item.spareField1 === "3") { |
|
71 |
// 法1 |
|
72 |
$("#formulaChildInfoTable").next().find('tbody tr[data-index="' + index + |
|
73 |
'"]').css("background-color", "#00ff66"); |
|
74 |
} |
|
75 |
}); |
|
76 |
} |
|
77 |
}); |
|
78 |
|
4779be
|
79 |
function initLineInfo(){ |
懒 |
80 |
$.ajax({ |
|
81 |
type: "POST", |
|
82 |
contentType: "application/json;charset=UTF-8", |
|
83 |
url: Feng.ctxPath + '/lineInfo/list', |
|
84 |
success: function (result) { |
|
85 |
var initIpConf = new $ax(Feng.ctxPath + "/kanbanConf/initIpConf"); |
|
86 |
var initResult = initIpConf.start(); |
|
87 |
|
|
88 |
$('#lineCode').append(new Option("请选择产线", ""));// 下拉菜单里添加元素 |
|
89 |
$.each(result.data, function (index, value) { |
|
90 |
$('#lineCode').append(new Option(value.lineCode));// 下拉菜单里添加元素 |
|
91 |
}); |
|
92 |
if(initResult.data!==""){ |
|
93 |
$('#lineCode').val(initResult.data.lineCode);// 下拉菜单里添加元素 |
|
94 |
$('#locationCode').append(new Option(initResult.data.locationCode));// 下拉菜单里添加元素 |
|
95 |
} |
|
96 |
layui.form.render("select");//重新渲染 固定写法 |
|
97 |
}, |
|
98 |
}); |
|
99 |
} |
|
100 |
|
|
101 |
form.on("select", function (data) { |
|
102 |
switch(data.elem.id){ |
|
103 |
case 'lineCode': |
|
104 |
console.log(data.value); |
|
105 |
if(data.value === ""){ |
|
106 |
$('#locationCode').empty(); |
|
107 |
layui.form.render("select");//重新渲染 固定写法 |
|
108 |
}else { |
|
109 |
$.ajax({ |
|
110 |
type: "POST", |
|
111 |
contentType: "application/json;charset=UTF-8", |
|
112 |
url: Feng.ctxPath + '/locationInfo/list?productionLineCode='+data.value, |
|
113 |
success: function (result) { |
|
114 |
$('#locationCode').empty(); |
|
115 |
$('#locationCode').append(new Option("请选择工位", ""));// 下拉菜单里添加元素 |
|
116 |
|
|
117 |
$.each(result.data, function (index, value) { |
|
118 |
$('#locationCode').append(new Option(value.locationCode));// 下拉菜单里添加元素 |
|
119 |
}); |
|
120 |
layui.form.render("select");//重新渲染 固定写法 |
|
121 |
}, |
|
122 |
}); |
|
123 |
} |
|
124 |
break; |
|
125 |
case 'locationCode': |
|
126 |
console.log($('#locationCode').val()); |
|
127 |
console.log($('#lineCode').val()); |
|
128 |
var getIp = new $ax(Feng.ctxPath + "/kanbanConf/ipSetting?lineCode="+$('#lineCode').val()+"&locationCode="+$('#locationCode').val()); |
|
129 |
var result = getIp.start(); |
|
130 |
Feng.info("更新完成!") |
|
131 |
break; |
|
132 |
} |
|
133 |
}); |
|
134 |
|
|
135 |
setInterval(function() { |
|
136 |
$('input[name="sex1"][value="nan1"]').prop('checked', true); |
|
137 |
}, 1000); |
|
138 |
setInterval(function() { |
|
139 |
radioElement.prop('checked', false); |
|
140 |
}, 2000); |
|
141 |
|
|
142 |
//Hash地址的定位 |
|
143 |
var layid = location.hash.replace(/^#test=/, ''); |
|
144 |
element.tabChange('test', layid); |
|
145 |
|
|
146 |
element.on('tab(test)', function(elem){ |
|
147 |
location.hash = 'test='+ $(this).attr('lay-id'); |
|
148 |
}); |
|
149 |
|
|
150 |
}); |