1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
| (function (vc) {
| vc.extends({
| data: {
| editEquipmentAccountInfo: {
| machineId: '',
| machineName: '',
| machineCode: '',
| brand: '',
| model: '',
| typeId: '',
| locationDetail: '',
| locationObjId: '',
| locationObjName: '',
| firstEnableTime: '',
| warrantyDeadline: '',
| usefulLife: '',
| importanceLevel: '',
| importanceLevels: [],
| state: '',
| purchasePrice: '',
| netWorth: '',
| useOrgId: "",
| useOrgName: "",
| useUserId: "",
| useUserName: "",
| useUseTel: "",
| chargeOrgId: "",
| chargeOrgName: "",
| chargeOrgTel: "",
| chargeUseId: "",
| chargeUseName: "",
| remark: '',
| useStatus: []
| },
| },
| _initMethod: function () {
| $that.editEquipmentAccountInfo.machineId = vc.getParam('machineId');
| vc.getDict('equipment_account', "importance_level", function (_data) {
| $that.editEquipmentAccountInfo.importanceLevels = _data;
| });
| vc.getDict('equipment_account', "state", function (_data) {
| $that.editEquipmentAccountInfo.useStatus = _data;
| });
| $that._initAddEquipmentAccountInfo();
| $that._listEquipmentAccounts();
| },
| _initEvent: function () {
| },
| methods: {
| _initAddEquipmentAccountInfo: function () {
| $('.addFirstEnableTime').datetimepicker({
| minView: "month",
| language: 'zh-CN',
| fontAwesome: 'fa',
| format: 'yyyy-mm-dd',
| initTime: true,
| initialDate: new Date(),
| autoClose: 1,
| todayBtn: true
| });
| $('.addFirstEnableTime').datetimepicker()
| .on('changeDate', function (ev) {
| var value = $(".addFirstEnableTime").val();
| $that.editEquipmentAccountInfo.firstEnableTime = value;
| });
| $('.addWarrantyDeadlineE').datetimepicker({
| language: 'zh-CN',
| fontAwesome: 'fa',
| format: 'yyyy-mm-dd',
| initTime: true,
| minView: 'month',
| autoClose: 1,
| todayBtn: true
| });
| $('.addWarrantyDeadlineE').datetimepicker()
| .on('changeDate', function (ev) {
| var value = $(".addWarrantyDeadlineE").val();
| $that.editEquipmentAccountInfo.warrantyDeadline = value;
| });
| },
|
| editEquipmentAccountValidate() {
| return vc.validate.validate({
| editEquipmentAccountInfo: $that.editEquipmentAccountInfo
| }, {
| 'editEquipmentAccountInfo.machineName': [
| {
| limit: "required",
| param: "",
| errInfo: "设备名称不能为空"
| },
| {
| limit: "maxLength",
| param: "100",
| errInfo: "设备名称不能超过64"
| },
| ],
| 'editEquipmentAccountInfo.machineCode': [
| {
| limit: "required",
| param: "",
| errInfo: "设备编码不能为空"
| },
| {
| limit: "maxLength",
| param: "100",
| errInfo: "设备编码不能超过64"
| },
| ],
| 'editEquipmentAccountInfo.importanceLevel': [
| {
| limit: "required",
| param: "",
| errInfo: "重要等级不能为空"
| },
| {
| limit: "num",
| param: "",
| errInfo: "重要等级格式错误"
| },
| ],
| 'editEquipmentAccountInfo.state': [
| {
| limit: "required",
| param: "",
| errInfo: "使用状态不能为空"
| },
| {
| limit: "num",
| param: "",
| errInfo: "使用状态格式错误"
| },
| ],
| 'editEquipmentAccountInfo.brand': [
| {
| limit: "maxLength",
| param: "64",
| errInfo: "设备品牌不能超过32"
| },
| ],
| 'editEquipmentAccountInfo.model': [
| {
| limit: "maxLength",
| param: "64",
| errInfo: "设备型号不能超过32"
| },
| ],
| 'editEquipmentAccountInfo.netWorth': [
| {
| limit: "maxLength",
| param: "64",
| errInfo: "资产净值不能超过8"
| },
| ],
| 'editEquipmentAccountInfo.locationDetail': [
| {
| limit: "maxLength",
| param: "64",
| errInfo: "位置详情不能超过150"
| },
| ],
| 'editEquipmentAccountInfo.firstEnableTime': [
| {
| limit: "maxLength",
| param: "64",
| errInfo: "首次启用时间不能超过150"
| },
| ],
| 'editEquipmentAccountInfo.warrantyDeadline': [
| {
| limit: "maxLength",
| param: "64",
| errInfo: "保修截止日期不能超过150"
| },
| ],
| 'editEquipmentAccountInfo.purchasePrice': [
| {
| limit: "maxLength",
| param: "64",
| errInfo: "采购价格不能超过8"
| },
| ],
| 'editEquipmentAccountInfo.useUserName': [
| {
| limit: "required",
| param: "",
| errInfo: "使用人不能为空"
| }
| ],
| 'editEquipmentAccountInfo.chargeUseName': [
| {
| limit: "required",
| param: "",
| errInfo: "责任人不能为空"
| }
| ],
| 'editEquipmentAccountInfo.remark': [
| {
| limit: "maxLength",
| param: "200",
| errInfo: "备注不能超过200"
| },
| ],
| });
| },
| saveEquipmentAccountInfo: function () {
| if (!$that.editEquipmentAccountValidate()) {
| vc.toast(vc.validate.errInfo);
| return;
| }
| $that.editEquipmentAccountInfo.communityId = vc.getCurrentCommunity().communityId;
| vc.http.apiPost(
| '/equipmentAccount.updateEquipmentAccount',
| JSON.stringify($that.editEquipmentAccountInfo),
| {
| emulateJSON: true
| },
| function (json, res) {
| let _json = JSON.parse(json);
| if (_json.code == 0) {
| //关闭model
| vc.goBack();
| vc.toast("修改成功");
| return;
| } else {
| vc.toast(_json.msg);
| }
| },
| function (errInfo, error) {
| console.log('请求失败处理');
| vc.toast(errInfo);
| });
| },
| _listEquipmentAccounts: function (_page, _row) {
| let param = {
| params: {
| page: 1,
| row: 1,
| communityId: vc.getCurrentCommunity().communityId,
| machineId: $that.editEquipmentAccountInfo.machineId
| }
| };
| //发送get请求
| vc.http.apiGet('/equipmentAccount.listEquipmentAccount',
| param,
| function (json, res) {
| let _equipmentAccountManageInfo = JSON.parse(json);
| vc.copyObject(_equipmentAccountManageInfo.data[0], $that.editEquipmentAccountInfo);
| },
| function (errInfo, error) {
| console.log('请求失败处理');
| }
| );
| },
| _goBack:function(){
| vc.goBack()
| }
| }
| });
| })(window.vc);
|
|