提交 | 用户 | 时间
|
71e81e
|
1 |
/** |
懒 |
2 |
* 添加或者修改页面 |
|
3 |
*/ |
|
4 |
var EquipmentMaintainTaskInfoDlg = { |
|
5 |
data: { |
|
6 |
id: "", |
|
7 |
equipmentNo: "", |
|
8 |
equipmentName: "", |
|
9 |
taskNo: "", |
|
10 |
planNo: "", |
|
11 |
planName: "", |
|
12 |
maintainType: "", |
|
13 |
maintainState: "", |
|
14 |
maintainResult: "", |
|
15 |
reason: "", |
|
16 |
maintainPrice: "", |
|
17 |
externalMaintain: "", |
|
18 |
maintainUser: "", |
|
19 |
spareField1: "", |
|
20 |
spareField2: "", |
|
21 |
finishTime: "", |
|
22 |
maintainTime: "", |
|
23 |
remarks: "" |
|
24 |
} |
|
25 |
}; |
|
26 |
|
|
27 |
layui.use(['table','form', 'admin', 'ax','laydate','upload','formSelects'], function () { |
|
28 |
var $ = layui.jquery; |
|
29 |
var $ax = layui.ax; |
|
30 |
var form = layui.form; |
|
31 |
var admin = layui.admin; |
|
32 |
var table = layui.table; |
|
33 |
var laydate = layui.laydate; |
|
34 |
|
|
35 |
|
|
36 |
var dataList = new Array(); |
|
37 |
|
|
38 |
laydate.render({ |
|
39 |
elem: '#startTime' //指定元素 |
|
40 |
,type: 'datetime' |
|
41 |
|
|
42 |
,trigger: 'click' |
|
43 |
|
|
44 |
}); |
|
45 |
|
|
46 |
laydate.render({ |
|
47 |
elem: '#endTime' //指定元素 |
|
48 |
}); |
|
49 |
|
|
50 |
//表单提交事件 |
|
51 |
form.on('submit(btnSubmit)', function (data) { |
|
52 |
var ajax = new $ax(Feng.ctxPath + "/equipmentMaintainTask/addItem", function (data) { |
|
53 |
Feng.success("添加成功!"); |
|
54 |
window.location.href = Feng.ctxPath + '/equipmentMaintainTask' |
|
55 |
}, function (data) { |
|
56 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
57 |
}); |
|
58 |
ajax.set(data.field); |
|
59 |
ajax.set("dataList", JSON.stringify(dataList)); |
|
60 |
ajax.start(); |
|
61 |
|
|
62 |
return false; |
|
63 |
}); |
|
64 |
/** |
|
65 |
* 物料档案管理 |
|
66 |
*/ |
|
67 |
var EqConfTable = { |
|
68 |
tableId: "eqConfTable" |
|
69 |
}; |
|
70 |
table.render({ |
|
71 |
elem: '#eqConfTable',page: true |
|
72 |
, cols: [[ //标题栏 |
|
73 |
// {type: 'checkbox'}, |
|
74 |
{field: 'maintainContentCode', title: '编号'}, |
|
75 |
{field: 'maintainContentName', title: '名称'}, |
|
76 |
{field: 'maintainContentType', title: '类型'}, |
|
77 |
{field: 'maintainContent', title: '保养内容描述'}, |
|
78 |
{align: 'center', toolbar: '#tableBar', title: '操作', minWidth: 120} |
|
79 |
]] |
|
80 |
,limit: 10 |
|
81 |
, data: dataList |
|
82 |
, even: true |
|
83 |
}); |
|
84 |
|
|
85 |
table.reload(EqConfTable.tableId, { |
|
86 |
data: dataList |
|
87 |
}); |
|
88 |
|
|
89 |
$('#btnAdds').click(function () { |
|
90 |
console.log("点击保养计划配置") |
|
91 |
EqConfTable.btnForProcess(); |
|
92 |
}); |
|
93 |
|
|
94 |
EqConfTable.btnForProcess = function () { |
|
95 |
layer.open({ |
|
96 |
type: 2, |
|
97 |
title: '保养内容', |
|
98 |
area: ['800px', '650px'], |
|
99 |
content: Feng.ctxPath + '/equipmentMaintainContentConf/addListConf', |
|
100 |
end: function () { |
|
101 |
var info = $("#materialList").val(); |
|
102 |
console.log(info) |
|
103 |
if (info != "") { |
|
104 |
var tempList = eval(info); |
|
105 |
tempList.forEach(function (val, index) { |
|
106 |
var obj = { |
|
107 |
'maintainContentCode': val.maintainContentCode, |
|
108 |
'maintainContentName': val.maintainContentName, |
|
109 |
'maintainContentType': val.maintainContentType, |
|
110 |
'maintainContent': val.maintainContent, |
|
111 |
}; |
|
112 |
dataList.push(obj); |
|
113 |
}); |
|
114 |
table.reload(EqConfTable.tableId, { |
|
115 |
data: dataList |
|
116 |
}); |
|
117 |
$("#materialList").val(""); |
|
118 |
} |
|
119 |
} |
|
120 |
}); |
|
121 |
}; |
|
122 |
|
|
123 |
// 工具条点击事件 |
|
124 |
table.on('tool(' + EqConfTable.tableId + ')', function (obj) { |
|
125 |
var data = obj.data; |
|
126 |
var layEvent = obj.event; |
|
127 |
|
|
128 |
if (layEvent === 'delete') { |
|
129 |
EqConfTable.onDeleteItem(data); |
|
130 |
} |
|
131 |
}); |
|
132 |
|
|
133 |
/** |
|
134 |
* 点击删除 |
|
135 |
* |
|
136 |
* @param data 点击按钮时候的行数据 |
|
137 |
*/ |
|
138 |
EqConfTable.onDeleteItem = function (data) { |
|
139 |
var operation = function () { |
|
140 |
for (var i = 0; i < dataList.length; i++) { |
|
141 |
console.log(dataList[i].maintainContentCode) |
|
142 |
console.log(data.maintainContentCode) |
|
143 |
if (dataList[i].maintainContentCode == data.maintainContentCode) { |
|
144 |
dataList.splice(i, 1); |
|
145 |
Feng.success("删除成功!"); |
|
146 |
} |
|
147 |
} |
|
148 |
table.reload(EqConfTable.tableId, { |
|
149 |
data: dataList |
|
150 |
}); |
|
151 |
}; |
|
152 |
Feng.confirm("是否删除?", operation); |
|
153 |
}; |
|
154 |
|
|
155 |
$('#cancel').click(function(){ |
|
156 |
window.location.href = Feng.ctxPath + '/equipmentMaintainTask' |
|
157 |
}); |
|
158 |
|
|
159 |
}); |