StationUserRel.js
6.68 KB
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
let action = null;
let $this = null;
layui.config({
base: "/js/",
version: 55
}).use(['system'], function () {
var form = layui.form,
$ = layui.jquery,
table = layui.table,
layer = layui.layer,
tableSelect = layui.tableSelect,
system = layui.system,
u = new system.u(),
areaName = 'configure',
tableName = 'StationUserRel';
action = {
addOptions: function () {
var options = {
fromId: "#modifyForm form",
url: `/${areaName}/${tableName}/Ins`,
submit: "submit(fromAdd)"
}
return options;
},
editOptions: function () {
var options = {
fromId: "#modifyForm form",
url: `/${areaName}/${tableName}/Upd`,
submit: "submit(fromUpdate)"
}
return options;
},
deleteOptions: function () {
var options = {
url: `/${areaName}/${tableName}/DelByIds`,
keyId: "id"
}
return options;
},
exportOptions: function () {
var options = {
fromId: "listForm",
url: `/${areaName}/${tableName}/Export`,
isDefault: false,
excelCols: {
head: app.data.cols
}
}
return options;
},
queryOptions: function () {
var options = {
resetFrom: "form[lay-filter=listForm]",
fromId: "listForm",
urlExport: `/${areaName}/${tableName}/Export`,
urlQuery: `/${areaName}/${tableName}/Load`,
mainTable: app.data.tableIns
}
return options;
},
uploadOptions: function () {
var options = {
url: `/${areaName}/${tableName}/Import`
}
return options;
},
addBefore: function (callBack) {
app.methods.initSelectTable();
if (callBack != null) callBack();
},
editBefore: function (data, callBack) {
app.methods.initSelectTable();
form.val("modifyForm", data);
$("input[name=stationId]").attr("ts-selected", data.stationId);
$("input[name=userId]").attr("ts-selected", data.userId);
//callBack是回调函数,如果editBefore有ajax 放在成功之后
if (callBack != null) callBack();
},
addSaveBefore: function (data, callBack) {
data.field["userids"] = data.field.userId;
data.field.userId = -1;
if (callBack != null) callBack();
},
customTableRowClick: function (obj, tableId) {
debugger;
$this = $(this).find("td div.laytable-cell-checkbox div.layui-form-checkbox I");
$("a[lay-event=btnPeopleStation]").click();
},
//工位人员分配
btnPeopleStation: function (sysU, toolbarId, obj) {
var checkStatus = table.checkStatus(toolbarId),
data = checkStatus.data;
if (data.length !== 1) {
layer.msg("请选择一条要分配的工位");
return false;
}
var ajaxConfig = {
url: `/${areaName}/${tableName}/GetStationUserById?stationId=` + data[0].id,
type: "get",
success: function (result) {
debugger
if (u.successBefore(result)) return;
layer.open({
title: "为工位【" + data[0].workStationName + "】分配人员",
type: 2,
area: ['1000px', '600px'],
content: "/base/SysUser/Index?menuFlag=-2&page=stationUserRel&targetArrValue=" + result.Result.GetArrValue("userId") + "&stationId=" + data[0].id,
cancel: function () {
action.actionSuccess("", app.data.tableIns.config.page.index);
console.log($this);
}
});
}
};
u.ajax(ajaxConfig);
},
//所有动作成功之后
actionSuccess: (falg, curr) => {
debugger;
app.data.tableIns.config.where = {};
app.data.tableIns.config.page.curr = curr;
app.data.tableIns.reload("mainList", {});
}
}
var app = {
data: {
cols: [[
{ type: "radio", fixed: true },
{ field: 'id', width: 80, title: 'id' },
{ field: 'lineName', width: 200, title: '线体名称' },
{ field: 'workStationName', width: 200, title: '工位名称', noExel: true },
{ field: 'peopleStation', width: 300, title: '工位人员' },
{ field: 'createTime', width: 150, title: '建立时间' },
{ field: 'createBy', width: 100, title: '建立者' },
{ field: 'updateTime', width: 150, title: '更新时间' },
{ field: 'updateBy', width: 100, title: '更新者' }
]],
tableIns: null,
tableElem: "mainList"
},
methods: {
initTable: function () {
let options = {
elem: "#" + app.data.tableElem,
url: `/${areaName}/${tableName}/Load`,
cols: u.columnRecord(app.data.tableElem, app.data.cols),
toolbar: '#toolbarTable'
}
app.data.tableIns = u.initTable(options);
},
initSelectTable: function () {
var opt = {
elem: ".stationId",
checkedKey: "id",
doneKey: {
key: "id",
lableName: "input[name=stationName]",
lableValue: "name"
}
};
u.initSelectStation(opt);
var opt1 = {
elem: ".userId",
checkedKey: "id",
doneKey: {
key: "id",
lableName: "input[name=userName]",
lableValue: "name"
}
};
u.initSelectUser(opt1);
}
},
registerEvent: function () {
},
init: function () {
app.methods.initTable();
app.registerEvent();
}
};
app.init();
});