cloud-web-corejs 1.0.54-dev.525 → 1.0.54-dev.526

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,19 +3,44 @@
3
3
  <el-form ref="editForm" :model="user">
4
4
  <div class="d-header clearfix">
5
5
  <div class="fl">
6
- <i class="el-icon-info"/>
7
- {{ dataId ? $t1('查看用户') : $t1('新增用户') }}
6
+ <i class="el-icon-info" />
7
+ {{ dataId ? $t1("查看用户") : $t1("新增用户") }}
8
8
  </div>
9
9
  <div class="fr">
10
- <temp-storage-button :option="tempStorageOption" v-if="!dataId"></temp-storage-button>
11
- <base-input-export :option="exportOption" :parent-target="_self" v-if="dataId"/>
12
- <el-button type="primary" plain class="button-sty" icon="el-icon-unlock" @click="unlock" v-if="user.locked"
13
- v-hasPermi="'user:unlock'">{{ $t1('解锁') }}
10
+ <temp-storage-button
11
+ :option="tempStorageOption"
12
+ v-if="!dataId"
13
+ ></temp-storage-button>
14
+ <base-input-export
15
+ :option="exportOption"
16
+ :parent-target="_self"
17
+ v-if="dataId"
18
+ />
19
+ <el-button
20
+ type="primary"
21
+ plain
22
+ class="button-sty"
23
+ icon="el-icon-unlock"
24
+ @click="unlock"
25
+ v-if="user.locked"
26
+ v-hasPermi="'user:unlock'"
27
+ >{{ $t1("解锁") }}
14
28
  </el-button>
15
- <el-button type="primary" plain class="button-sty" @click="$baseReload()" icon="el-icon-refresh-right">
16
- {{ $t1('重置') }}
29
+ <el-button
30
+ type="primary"
31
+ plain
32
+ class="button-sty"
33
+ @click="$baseReload()"
34
+ icon="el-icon-refresh-right"
35
+ >
36
+ {{ $t1("重置") }}
17
37
  </el-button>
18
- <el-button type="primary" class="button-sty" icon="el-icon-check" @click="saveData">{{ $t1('保存') }}
38
+ <el-button
39
+ type="primary"
40
+ class="button-sty"
41
+ icon="el-icon-check"
42
+ @click="saveData"
43
+ >{{ $t1("保存") }}
19
44
  </el-button>
20
45
  </div>
21
46
  </div>
@@ -24,119 +49,190 @@
24
49
  <template #default>
25
50
  <table class="table-detail">
26
51
  <tbody>
27
- <tr>
28
- <th>
29
- <em class="f-red">*</em>
30
- {{ $t1('登录名') }}
31
- </th>
32
- <td colspan="3">
33
- <el-form-item prop="loginAccount" :rules="[{ required: true, trigger: 'blur' }]">
34
- <template v-if="dataId">
35
- <el-input size="small" v-model="user.loginAccount" maxlength="255" autocomplete="off"
36
- lay-verify="required" required="" :readonly="true"/>
37
- </template>
38
- <template v-else>
39
- <el-input size="small" v-model="user.loginAccount" maxlength="255" autocomplete="off"
40
- lay-verify="required" required="" clearable/>
41
- </template>
42
- </el-form-item>
43
- </td>
52
+ <tr>
53
+ <th>
54
+ <em class="f-red">*</em>
55
+ {{ $t1("登录名") }}
56
+ </th>
57
+ <td colspan="3">
58
+ <el-form-item
59
+ prop="loginAccount"
60
+ :rules="[{ required: true, trigger: 'blur' }]"
61
+ >
62
+ <template v-if="dataId">
63
+ <el-input
64
+ size="small"
65
+ v-model="user.loginAccount"
66
+ maxlength="255"
67
+ autocomplete="off"
68
+ lay-verify="required"
69
+ required=""
70
+ :readonly="true"
71
+ />
72
+ </template>
73
+ <template v-else>
74
+ <el-input
75
+ size="small"
76
+ v-model="user.loginAccount"
77
+ maxlength="255"
78
+ autocomplete="off"
79
+ lay-verify="required"
80
+ required=""
81
+ clearable
82
+ />
83
+ </template>
84
+ </el-form-item>
85
+ </td>
86
+
87
+ <th>
88
+ <em class="f-red">*</em>
89
+ {{ $t1("姓名") }}
90
+ </th>
91
+ <td colspan="3">
92
+ <el-form-item
93
+ prop="nickName"
94
+ :rules="[{ required: true, trigger: 'blur' }]"
95
+ >
96
+ <el-input
97
+ size="small"
98
+ v-model="user.nickName"
99
+ maxlength="200"
100
+ lay-verify="required"
101
+ required=""
102
+ clearable
103
+ />
104
+ </el-form-item>
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <th>
109
+ <em class="f-red" v-if="!dataId">*</em>
110
+ {{ $t1("密码") }}
111
+ </th>
112
+ <td>
113
+ <el-form-item prop="password" :rules="passRules">
114
+ <el-input
115
+ size="small"
116
+ type="password"
117
+ v-model="user.password"
118
+ show-password
119
+ maxlength="255"
120
+ autocomplete="off"
121
+ auto-complete="new-password"
122
+ clearable
123
+ />
124
+ </el-form-item>
125
+ </td>
126
+ <th>
127
+ <em class="f-red" v-if="!dataId">*</em>
128
+ {{ $t1("确认密码") }}
129
+ </th>
130
+ <td>
131
+ <el-form-item prop="rePassword" :rules="pass2Rules">
132
+ <el-input
133
+ size="small"
134
+ type="password"
135
+ v-model="user.rePassword"
136
+ show-password
137
+ maxlength="255"
138
+ autocomplete="off"
139
+ auto-complete="new-password"
140
+ lay-verify="confirmPass"
141
+ clearable
142
+ />
143
+ </el-form-item>
144
+ </td>
44
145
 
45
- <th>
46
- <em class="f-red">*</em>
47
- {{ $t1('姓名') }}
48
- </th>
49
- <td colspan="3">
50
- <el-form-item prop="nickName" :rules="[{ required: true, trigger: 'blur' }]">
51
- <el-input size="small" v-model="user.nickName" maxlength="200" lay-verify="required" required=""
52
- clearable/>
53
- </el-form-item>
54
- </td>
55
- </tr>
56
- <tr>
146
+ <th>{{ $t1("性别") }}</th>
147
+ <td>
148
+ <el-radio-group v-model="user.gender">
149
+ <el-radio :label="1">{{ $t1("男") }}</el-radio>
150
+ <el-radio :label="2">{{ $t1("女") }}</el-radio>
151
+ </el-radio-group>
152
+ </td>
153
+ <th>
154
+ {{ $t1("员工编码") }}
155
+ </th>
156
+ <td>
157
+ <el-form-item
158
+ prop="empNo"
159
+ :rules="[{ required: false, trigger: 'blur' }]"
160
+ >
161
+ <el-input
162
+ size="small"
163
+ v-model="user.empNo"
164
+ maxlength="200"
165
+ clearable
166
+ />
167
+ </el-form-item>
168
+ </td>
169
+ </tr>
57
170
 
58
- <th>
59
- <em class="f-red" v-if="!dataId">*</em>
60
- {{ $t1('密码') }}
61
- </th>
62
- <td>
63
- <el-form-item prop="password" :rules="passRules">
64
- <el-input size="small" type="password" v-model="user.password" show-password maxlength="255"
65
- autocomplete="off" auto-complete="new-password" clearable/>
66
- </el-form-item>
67
- </td>
68
- <th>
69
- <em class="f-red" v-if="!dataId">*</em>
70
- {{ $t1('确认密码') }}
71
- </th>
72
- <td>
73
- <el-form-item prop="rePassword" :rules="pass2Rules">
171
+ <tr>
172
+ <th>{{ $t1("出生日期") }}</th>
173
+ <td>
174
+ <el-date-picker
175
+ size="small"
176
+ v-model="user.birth"
177
+ type="date"
178
+ :placeholder="$t1('选择日期')"
179
+ value-format="yyyy-MM-dd"
180
+ clearable
181
+ />
182
+ </td>
183
+ <th>{{ $t1("邮编") }}</th>
184
+ <td>
74
185
  <el-input
75
186
  size="small"
76
- type="password"
77
- v-model="user.rePassword"
78
- show-password
187
+ v-model="user.zipCode"
79
188
  maxlength="255"
80
- autocomplete="off"
81
- auto-complete="new-password"
82
- lay-verify="confirmPass"
83
189
  clearable
84
190
  />
85
- </el-form-item>
86
- </td>
87
-
88
-
89
- <th>{{ $t1('性别') }}</th>
90
- <td>
91
- <el-radio-group v-model="user.gender">
92
- <el-radio :label="1">{{ $t1('男') }}</el-radio>
93
- <el-radio :label="2">{{ $t1('女') }}</el-radio>
94
- </el-radio-group>
95
- </td>
96
- <th>
97
- {{ $t1('员工编码') }}
98
- </th>
99
- <td>
100
- <el-form-item prop="empNo" :rules="[{ required: false, trigger: 'blur' }]">
101
- <el-input size="small" v-model="user.empNo" maxlength="200" clearable/>
102
- </el-form-item>
103
- </td>
104
- </tr>
105
-
106
- <tr>
107
- <th>{{ $t1('出生日期') }}</th>
108
- <td>
109
- <el-date-picker size="small" v-model="user.birth" type="date" :placeholder="$t1('选择日期')"
110
- value-format="yyyy-MM-dd" clearable/>
111
- </td>
112
- <th>{{ $t1('邮编') }}</th>
113
- <td>
114
- <el-input size="small" v-model="user.zipCode" maxlength="255" clearable/>
115
- </td>
116
- <th>{{ $t1('手机') }}</th>
117
- <td>
118
- <el-form-item prop="mobile" :rules="[{ required: false, trigger: 'blur' }]">
119
- <el-input size="small" v-model="user.mobile" type="text" maxlength="255" autocomplete="off"
120
- lay-verify="required|phone" clearable/>
121
- </el-form-item>
122
- </td>
123
- <th>{{ $t1('设置') }}</th>
124
- <td>
125
- <el-checkbox :label="$t1('是否启用')" v-model="user.enabled"></el-checkbox>
126
- </td>
127
-
128
- </tr>
191
+ </td>
192
+ <th>{{ $t1("手机") }}</th>
193
+ <td>
194
+ <el-form-item
195
+ prop="mobile"
196
+ :rules="[{ required: false, trigger: 'blur' }]"
197
+ >
198
+ <el-input
199
+ size="small"
200
+ v-model="user.mobile"
201
+ type="text"
202
+ maxlength="255"
203
+ autocomplete="off"
204
+ lay-verify="required|phone"
205
+ clearable
206
+ />
207
+ </el-form-item>
208
+ </td>
209
+ <th>{{ $t1("设置") }}</th>
210
+ <td>
211
+ <el-checkbox
212
+ :label="$t1('是否启用')"
213
+ v-model="user.enabled"
214
+ ></el-checkbox>
215
+ </td>
216
+ </tr>
129
217
 
130
- <tr>
131
- <th>
132
- {{ $t1('邮箱') }}
133
- </th>
134
- <td>
135
- <el-form-item prop="email" :rules="[{ required: false, trigger: 'blur' }]">
136
- <el-input size="small" v-model="user.email" maxlength="200" clearable/>
137
- </el-form-item>
138
- </td>
139
- <!-- <th v-if="flag!=='2'">
218
+ <tr>
219
+ <th>
220
+ {{ $t1("邮箱") }}
221
+ </th>
222
+ <td>
223
+ <el-form-item
224
+ prop="email"
225
+ :rules="[{ required: false, trigger: 'blur' }]"
226
+ >
227
+ <el-input
228
+ size="small"
229
+ v-model="user.email"
230
+ maxlength="200"
231
+ clearable
232
+ />
233
+ </el-form-item>
234
+ </td>
235
+ <!-- <th v-if="flag!=='2'">
140
236
  GUID
141
237
  </th>
142
238
  <td v-if="flag!=='2'">
@@ -144,125 +240,188 @@
144
240
  <el-input size="small" v-model="user.guid" maxlength="200" clearable/>
145
241
  </el-form-item>
146
242
  </td>-->
147
- <th>{{ $t1('地址') }}</th>
148
- <td colspan="3">
149
- <el-input size="small" v-model="user.address" class="b" maxlength="255" clearable/>
150
- </td>
151
-
152
- </tr>
153
- <tr>
154
- <th>
155
- {{ $t1('国家') }}
156
- </th>
157
- <td colspan="3">
158
- <el-form-item prop="countryName" :rules="[{ required: false, trigger: 'blur' }]">
243
+ <th>{{ $t1("地址") }}</th>
244
+ <td colspan="3">
159
245
  <el-input
160
- class="search-input"
161
- v-model="user.countryName"
246
+ size="small"
247
+ v-model="user.address"
248
+ class="b"
249
+ maxlength="255"
162
250
  clearable
163
- @clear="
164
- user.countryName = null;
165
- user.countryCode = null;
166
- "
167
- v-el-readonly
251
+ />
252
+ </td>
253
+ </tr>
254
+ <tr>
255
+ <th>
256
+ {{ $t1("国家") }}
257
+ </th>
258
+ <td colspan="3">
259
+ <el-form-item
260
+ prop="countryName"
261
+ :rules="[{ required: false, trigger: 'blur' }]"
262
+ >
263
+ <el-input
264
+ class="search-input"
265
+ v-model="user.countryName"
266
+ clearable
267
+ @clear="
268
+ user.countryName = null;
269
+ user.countryCode = null;
270
+ "
271
+ v-el-readonly
272
+ >
273
+ <i
274
+ slot="suffix"
275
+ class="el-input__icon el-icon-search"
276
+ @click="showCountryDialog = true"
277
+ ></i>
278
+ </el-input>
279
+ </el-form-item>
280
+ </td>
281
+ <th>
282
+ {{ $t1("是否锁定") }}
283
+ </th>
284
+ <td>
285
+ {{ user.locked ? $t1("是") : $t1("否") }}
286
+ </td>
287
+ </tr>
288
+ <tr v-if="userType == 2">
289
+ <th>
290
+ {{ $t1("签约人") }}
291
+ </th>
292
+ <td>
293
+ <el-form-item
294
+ prop="signatoryName"
295
+ :rules="[{ required: false, trigger: 'blur' }]"
168
296
  >
169
- <i slot="suffix" class="el-input__icon el-icon-search"
170
- @click="showCountryDialog=true"></i>
171
- </el-input>
172
- </el-form-item>
173
- </td>
174
- <th>
175
- {{ $t1('是否锁定') }}
176
- </th>
177
- <td>
178
- {{ user.locked ? $t1('是') : $t1('否') }}
179
- </td>
180
- </tr>
181
- <tr v-if="userType==2">
182
- <th>
183
- {{ $t1('签约人') }}
184
- </th>
185
- <td>
186
- <el-form-item prop="signatoryName" :rules="[{ required: false, trigger: 'blur' }]">
187
- <el-input size="small" v-model="user.signatoryName" maxlength="200" clearable/>
188
- </el-form-item>
189
- </td>
190
- <th>
191
- {{ $t1('签约人电话') }}
192
- </th>
193
- <td>
194
- <el-form-item prop="signatoryMobile" :rules="[{ required: false, trigger: 'blur' }]">
195
- <el-input size="small" v-model="user.signatoryMobile" maxlength="200" clearable/>
196
- </el-form-item>
197
- </td>
198
- </tr>
199
- <tr>
200
- <th>{{ $t1('头像') }}</th>
201
- <td colspan="7">
202
- <baseUpload :limit="1" accept="image/png, image/jpeg" multi="false" :file.sync="user.headPhotoUrl"
203
- dataType="medium"></baseUpload>
204
- </td>
205
- </tr>
206
- <tr>
207
- <th>{{ $t1('创建人') }}</th>
208
- <td>{{ user.createBy }}</td>
209
- <th>{{ $t1('创建时间') }}</th>
210
- <td>{{ user.createDate }}</td>
211
- <th>{{ $t1('更新人') }}</th>
212
- <td>{{ user.modifyBy }}</td>
213
- <th>{{ $t1('更新时间') }}</th>
214
- <td>{{ user.modifyDate }}</td>
215
- </tr>
297
+ <el-input
298
+ size="small"
299
+ v-model="user.signatoryName"
300
+ maxlength="200"
301
+ clearable
302
+ />
303
+ </el-form-item>
304
+ </td>
305
+ <th>
306
+ {{ $t1("签约人电话") }}
307
+ </th>
308
+ <td>
309
+ <el-form-item
310
+ prop="signatoryMobile"
311
+ :rules="[{ required: false, trigger: 'blur' }]"
312
+ >
313
+ <el-input
314
+ size="small"
315
+ v-model="user.signatoryMobile"
316
+ maxlength="200"
317
+ clearable
318
+ />
319
+ </el-form-item>
320
+ </td>
321
+ </tr>
322
+ <tr>
323
+ <th>{{ $t1("头像") }}</th>
324
+ <td colspan="7">
325
+ <baseUpload
326
+ :limit="1"
327
+ accept="image/png, image/jpeg"
328
+ multi="false"
329
+ :file.sync="user.headPhotoUrl"
330
+ dataType="medium"
331
+ ></baseUpload>
332
+ </td>
333
+ </tr>
334
+ <tr>
335
+ <th>{{ $t1("创建人") }}</th>
336
+ <td>{{ user.createBy }}</td>
337
+ <th>{{ $t1("创建时间") }}</th>
338
+ <td>{{ user.createDate }}</td>
339
+ <th>{{ $t1("更新人") }}</th>
340
+ <td>{{ user.modifyBy }}</td>
341
+ <th>{{ $t1("更新时间") }}</th>
342
+ <td>{{ user.modifyDate }}</td>
343
+ </tr>
216
344
  </tbody>
217
345
  </table>
218
346
  </template>
219
347
  </baseTabPane>
220
348
  <baseTabPane :label="$t1('组织信息')">
221
349
  <template #button>
222
- <el-button class="button-sty" @click="addCurrentCompany()" icon="el-icon-search" v-if="!hasCurrentCompany">
223
- {{ $t1('新增组织权限') }}
350
+ <el-button
351
+ class="button-sty"
352
+ @click="addCurrentCompany()"
353
+ icon="el-icon-search"
354
+ v-if="!hasCurrentCompany"
355
+ >
356
+ {{ $t1("新增组织权限") }}
224
357
  </el-button>
225
358
  </template>
226
359
  <template #default>
227
360
  <div class="style1">
228
- <div class="d-item" v-for="(item,index1) in user.userCompanyInfoDTOs" :key="index1">
361
+ <div
362
+ class="d-item"
363
+ v-for="(item, index1) in user.userCompanyInfoDTOs"
364
+ :key="index1"
365
+ >
229
366
  <div class="title">
230
367
  <b>{{ item.companyName }}</b>
231
- <el-button class="button-sty" icon="el-icon-delete" v-if="isCurrentCompany(item.companyCode)"
232
- @click="deleteCompany(item,index1)">{{ $t1('删除') }}
368
+ <el-button
369
+ class="button-sty"
370
+ icon="el-icon-delete"
371
+ v-if="isCurrentCompany(item.companyCode)"
372
+ @click="deleteCompany(item, index1)"
373
+ >{{ $t1("删除") }}
233
374
  </el-button>
234
375
  </div>
235
376
  <div class="title-form">
236
377
  <span>
237
- <el-form-item label="GUID" :prop="'userCompanyInfoDTOs.'+index1+'.guid'"
238
- :rules="[{ required: false, trigger: 'blur' }]">
239
- <el-input size="small" v-model="item.guid" maxlength="200" clearable/>
240
- </el-form-item>
378
+ <el-form-item
379
+ label="GUID"
380
+ :prop="'userCompanyInfoDTOs.' + index1 + '.guid'"
381
+ :rules="[{ required: false, trigger: 'blur' }]"
382
+ >
383
+ <el-input
384
+ size="small"
385
+ v-model="item.guid"
386
+ maxlength="200"
387
+ clearable
388
+ />
389
+ </el-form-item>
241
390
  </span>
242
391
  <span>
243
- <el-form-item label="是否默认组织" :prop="'userCompanyInfoDTOs.'+index1+'.defaults'"
244
- :rules="[{ required: false, trigger: 'blur' }]">
245
- <el-checkbox v-model="item.defaults"
246
- @change="changeCompanyDefault(item)"></el-checkbox>
247
- </el-form-item>
392
+ <el-form-item
393
+ label="是否默认组织"
394
+ :prop="'userCompanyInfoDTOs.' + index1 + '.defaults'"
395
+ :rules="[{ required: false, trigger: 'blur' }]"
396
+ >
397
+ <el-checkbox
398
+ v-model="item.defaults"
399
+ @change="changeCompanyDefault(item)"
400
+ ></el-checkbox>
401
+ </el-form-item>
248
402
  </span>
249
403
  </div>
250
404
  <div class="m-2">
251
- <div class="d-item" style="width: 65%;">
405
+ <div class="d-item" style="width: 65%">
252
406
  <div class="title">
253
- <b>{{ $t1('机构信息') }}</b>
254
- <el-button class="button-sty" icon="el-icon-search" @click="showSaleOrgDialog = true"
255
- v-if="isCurrentCompany(item.companyCode)">{{ $t1('选择机构') }}
407
+ <b>{{ $t1("机构信息") }}</b>
408
+ <el-button
409
+ class="button-sty"
410
+ icon="el-icon-search"
411
+ @click="showSaleOrgDialog = true"
412
+ v-if="isCurrentCompany(item.companyCode)"
413
+ >{{ $t1("选择机构") }}
256
414
  </el-button>
257
415
  </div>
258
416
  <div class="grid-h">
259
417
  <vxe-grid
260
- :ref="'saleOrgGrid-'+item.companyCode"
261
- :data="gridSaleOrgDataMap[item.companyCode]"
262
- v-bind="vxeOptionMap['saleOrgGridOption-'+item.companyCode]"
418
+ :ref="'saleOrgGrid-' + item.companyCode"
419
+ :data="item.saleOrgData"
420
+ v-bind="item.saleOrgGridOption"
263
421
  @resizable-change="$vxeTableUtil.onColumnWitchChange"
264
- @custom="$vxeTableUtil.customHandle">
265
- <template #position="{row,rowIndex,$table}">
422
+ @custom="$vxeTableUtil.customHandle"
423
+ >
424
+ <template #position="{ row, rowIndex, $table }">
266
425
  <el-input
267
426
  class="search-input"
268
427
  :value="getSelectPositionName(row)"
@@ -274,8 +433,11 @@
274
433
  v-el-readonly
275
434
  v-if="companyInfo.companyCode == row.companyCode"
276
435
  >
277
- <i slot="suffix" class="el-input__icon el-icon-search"
278
- @click="openSelectPositionDialog(row, rowIndex, $table)"></i>
436
+ <i
437
+ slot="suffix"
438
+ class="el-input__icon el-icon-search"
439
+ @click="openSelectPositionDialog(row, rowIndex, $table)"
440
+ ></i>
279
441
  </el-input>
280
442
  <template v-else>
281
443
  {{ getSelectPositionName(row) }}
@@ -284,18 +446,22 @@
284
446
  </vxe-grid>
285
447
  </div>
286
448
  </div>
287
- <div class="d-item" style="width: 35%;">
449
+ <div class="d-item" style="width: 35%">
288
450
  <div class="title">
289
- <b>{{ $t1('角色信息') }}</b>
290
- <el-button class="button-sty" icon="el-icon-search" @click="showRoleDialog = true"
291
- v-if="isCurrentCompany(item.companyCode)">{{ $t1('选择角色') }}
451
+ <b>{{ $t1("角色信息") }}</b>
452
+ <el-button
453
+ class="button-sty"
454
+ icon="el-icon-search"
455
+ @click="showRoleDialog = true"
456
+ v-if="isCurrentCompany(item.companyCode)"
457
+ >{{ $t1("选择角色") }}
292
458
  </el-button>
293
459
  </div>
294
460
  <div class="grid-h">
295
461
  <vxe-grid
296
- :ref="'userRoleGrid-'+item.companyCode"
297
- :data="gridRoleDataMap[item.companyCode]"
298
- v-bind="vxeOptionMap['userRoleGridOption-'+item.companyCode]"
462
+ :ref="'userRoleGrid-' + item.companyCode"
463
+ :data="item.roleData"
464
+ v-bind="item.roleGridOption"
299
465
  @resizable-change="$vxeTableUtil.onColumnWitchChange"
300
466
  @custom="$vxeTableUtil.customHandle"
301
467
  ></vxe-grid>
@@ -308,15 +474,36 @@
308
474
  </baseTabPane>
309
475
  </baseTabs>
310
476
  </el-form>
311
- <roleDialog v-if="showRoleDialog" :visiable.sync="showRoleDialog" @confirm="confirmRole"
312
- :param="roleDialogParam"/>
313
- <companyDialog v-if="showCompanyDialog" :visiable.sync="showCompanyDialog" @confirm="confirmInsertCompany"/>
314
- <saleOrgDialog v-if="showSaleOrgDialog" :visiable.sync="showSaleOrgDialog" @confirm="confirmInsertSaleOrg"
315
- :param="{ queryAll: true }"/>
316
- <positionDialog v-if="showPositionDialog" :visiable.sync="showPositionDialog" :rows="positionDialogDatas"
317
- @confirm="confirmInsertPosition" :param="{ queryAll: true }"/>
318
- <countryDialog v-if="showCountryDialog" :visiable.sync="showCountryDialog"
319
- @confirm="confirmCountry" multi="false"/>
477
+ <roleDialog
478
+ v-if="showRoleDialog"
479
+ :visiable.sync="showRoleDialog"
480
+ @confirm="confirmRole"
481
+ :param="roleDialogParam"
482
+ />
483
+ <companyDialog
484
+ v-if="showCompanyDialog"
485
+ :visiable.sync="showCompanyDialog"
486
+ @confirm="confirmInsertCompany"
487
+ />
488
+ <saleOrgDialog
489
+ v-if="showSaleOrgDialog"
490
+ :visiable.sync="showSaleOrgDialog"
491
+ @confirm="confirmInsertSaleOrg"
492
+ :param="{ queryAll: true }"
493
+ />
494
+ <positionDialog
495
+ v-if="showPositionDialog"
496
+ :visiable.sync="showPositionDialog"
497
+ :rows="positionDialogDatas"
498
+ @confirm="confirmInsertPosition"
499
+ :param="{ queryAll: true }"
500
+ />
501
+ <countryDialog
502
+ v-if="showCountryDialog"
503
+ :visiable.sync="showCountryDialog"
504
+ @confirm="confirmCountry"
505
+ multi="false"
506
+ />
320
507
  </div>
321
508
  </template>
322
509
 
@@ -324,44 +511,43 @@
324
511
  import xeUtils from "xe-utils";
325
512
  import tempStorageButton from "@base/components/tempStorage/index.vue";
326
513
 
327
-
328
514
  export default {
329
- name: 'UserEdit',
515
+ name: "UserEdit",
330
516
  components: {
331
- roleDialog: () => import('../../../views/user/role/dialog.vue'),
332
- companyDialog: () => import('../../../views/user/company_info/dialog.vue'),
333
- saleOrgDialog: () => import('../../../views/user/sale_org/dialog.vue'),
334
- positionDialog: () => import('../../../views/user/position/dialog.vue'),
335
- countryDialog: () => import('../../../views/user/country/dialog.vue'),
336
- tempStorageButton
517
+ roleDialog: () => import("../../../views/user/role/dialog.vue"),
518
+ companyDialog: () => import("../../../views/user/company_info/dialog.vue"),
519
+ saleOrgDialog: () => import("../../../views/user/sale_org/dialog.vue"),
520
+ positionDialog: () => import("../../../views/user/position/dialog.vue"),
521
+ countryDialog: () => import("../../../views/user/country/dialog.vue"),
522
+ tempStorageButton,
337
523
  },
338
- props: ['_dataId', 'userType', 'flag'],
524
+ props: ["_dataId", "userType", "flag"],
339
525
  data() {
340
526
  var validatePass = (rule, value, callback) => {
341
527
  const isPassRequired = !this.dataId;
342
- if (isPassRequired && (value == '' || value == undefined)) {
343
- callback(new Error(this.$t1('密码不能为空')));
528
+ if (isPassRequired && (value == "" || value == undefined)) {
529
+ callback(new Error(this.$t1("密码不能为空")));
344
530
  } else {
345
531
  callback();
346
532
  }
347
- this.$refs.editForm.validateField('rePassword');
533
+ this.$refs.editForm.validateField("rePassword");
348
534
  };
349
535
  var validatePass2 = (rule, value, callback) => {
350
536
  const isPassRequired = !this.dataId;
351
- const rePassword = value != undefined ? value : '';
352
- const password = this.user.password != undefined ? this.user.password : '';
537
+ const rePassword = value != undefined ? value : "";
538
+ const password = this.user.password != undefined ? this.user.password : "";
353
539
 
354
- if (isPassRequired && rePassword == '') {
355
- callback(new Error(this.$t1('确认密码不能为空')));
540
+ if (isPassRequired && rePassword == "") {
541
+ callback(new Error(this.$t1("确认密码不能为空")));
356
542
  } else if (rePassword != password) {
357
- callback(new Error(this.$t1('两次输入密码不一致!')));
543
+ callback(new Error(this.$t1("两次输入密码不一致!")));
358
544
  } else {
359
545
  callback();
360
546
  }
361
547
  };
362
548
 
363
549
  return {
364
- dataId: '',
550
+ dataId: "",
365
551
  hBtn: true,
366
552
  user: {
367
553
  userCompanyInfoDTOs: [],
@@ -371,8 +557,9 @@ export default {
371
557
  enabled: true,
372
558
  userType: null,
373
559
  countryName: null,
374
- countryCode: null
560
+ countryCode: null,
375
561
  },
562
+ companyTableData: [],
376
563
  vxeOption: {},
377
564
  companyInfoOption: {},
378
565
  userRoleOption: {},
@@ -381,32 +568,29 @@ export default {
381
568
  showSaleOrgDialog: false,
382
569
  showPositionDialog: false,
383
570
  saleOrgPositionIndex: 0,
384
- passRules: [{validator: validatePass, trigger: 'blur', required: false}],
385
- pass2Rules: [{validator: validatePass2, trigger: 'blur', required: false}],
386
- activeName: 'first',
571
+ passRules: [{ validator: validatePass, trigger: "blur", required: false }],
572
+ pass2Rules: [{ validator: validatePass2, trigger: "blur", required: false }],
573
+ activeName: "first",
387
574
  userCustomerListDTO: {
388
- userCustomerDTOs: []
575
+ userCustomerDTOs: [],
389
576
  },
390
577
  customerOption: {},
391
578
  showCustomerDialog: false,
392
579
  exportOption: {
393
580
  prefix: USER_PREFIX,
394
- title: this.$t1('用户'),
581
+ title: this.$t1("用户"),
395
582
  codes: ["USEREXCEL", "USERPDF", "USERPRINT", "USERHIPRINT"],
396
583
  param: () => {
397
- return [{id: this.dataId}];
398
- }
584
+ return [{ id: this.dataId }];
585
+ },
399
586
  },
400
587
  showExtendedProperties: false,
401
- radio1: '0',
588
+ radio1: "0",
402
589
  companyInfo: {},
403
- vxeOptionMap: {},
404
- gridRoleDataMap: {},
405
- gridSaleOrgDataMap: {},
406
- distributorCode: 'distributor',
590
+ distributorCode: "distributor",
407
591
  distributorRole: null,
408
592
  outUserCodes: [],
409
- roleDialogParam: {queryAll: true},
593
+ roleDialogParam: { queryAll: true },
410
594
  tempStorageOption: {
411
595
  storageType: "user",
412
596
  data: () => {
@@ -415,30 +599,35 @@ export default {
415
599
  },
416
600
  chooseConfirm: (tempStorageData) => {
417
601
  this.user = tempStorageData;
418
- this.gridSaleOrgDataMap = xeUtils.groupBy(this.user.userSaleOrgDTOs, 'companyCode');
419
- this.gridRoleDataMap = xeUtils.groupBy(this.user.userRoleDTOs, 'companyCode');
602
+ let map = xeUtils.groupBy(this.user.userRoleDTOs, "companyCode");
603
+ Object.keys(map).forEach((key) => {
604
+ let comapnyDTO = this.getCompanyDTO(key);
605
+ comapnyDTO.roleData = map[key];
606
+ });
420
607
  },
421
- saveConfirm: () => {
422
- }
608
+ saveConfirm: () => {},
423
609
  },
424
- showCountryDialog: false
610
+ showCountryDialog: false,
425
611
  };
426
612
  },
427
613
  computed: {
428
614
  hasCurrentCompany() {
429
- return this.user.userCompanyInfoDTOs.find(item => item.companyCode == this.companyInfo.companyCode) != null;
430
- }
615
+ return (
616
+ this.user.userCompanyInfoDTOs.find(
617
+ (item) => item.companyCode == this.companyInfo.companyCode
618
+ ) != null
619
+ );
620
+ },
431
621
  },
432
622
  created() {
433
623
  if (this._dataId && !isNaN(this._dataId)) this.dataId = this._dataId;
434
624
  },
435
625
  async mounted() {
436
-
437
626
  // this.getEainsGroupDTO();
438
627
  await this.initOutUserRoleCode();
439
628
  await this.initDistributorRole();
440
629
  this.getData();
441
- this.getConpanyInfo()
630
+ this.getConpanyInfo();
442
631
  },
443
632
  methods: {
444
633
  getData() {
@@ -448,20 +637,20 @@ export default {
448
637
  url: USER_PREFIX + `/user/get`,
449
638
  method: `post`,
450
639
  data: {
451
- id: this.dataId
640
+ id: this.dataId,
452
641
  },
453
642
  isLoading: true,
454
643
  modalStrictly: true,
455
- success: res => {
644
+ success: (res) => {
456
645
  let user = res.objx || {};
457
646
  user.userCompanyInfoDTOs = this.user.userCompanyInfoDTOs;
458
647
  user.userSaleOrgDTOs = this.user.userSaleOrgDTOs;
459
648
  user.userRoleDTOs = this.user.userRoleDTOs;
460
649
  this.user = user;
461
- this.user.password = '';
650
+ this.user.password = "";
462
651
 
463
652
  this.showExtendedProperties = true;
464
- }
653
+ },
465
654
  });
466
655
  } else {
467
656
  this.user.gender = 1;
@@ -474,43 +663,60 @@ export default {
474
663
  this.handleData();
475
664
  if (this.userType == 2) {
476
665
  //外部用户
477
- let currentUserCompanyInfo = this.user.userCompanyInfoDTOs.find(item => item.companyCode == companyCode)
666
+ let currentUserCompanyInfo = this.user.userCompanyInfoDTOs.find(
667
+ (item) => item.companyCode == companyCode
668
+ );
478
669
  if (currentUserCompanyInfo) {
479
- let rows = this.user.userRoleDTOs.filter(item => item.companyCode == companyCode);
670
+ let rows = this.user.userRoleDTOs.filter(
671
+ (item) => item.companyCode == companyCode
672
+ );
480
673
  if (!rows.length) {
481
- this.$baseAlert(this.$t1('请维护角色'));
482
- return
674
+ this.$baseAlert(this.$t1("请维护角色"));
675
+ return;
483
676
  }
484
677
  }
485
-
486
678
  }
487
- this.$refs.editForm.$baseValidate(valid => {
679
+ this.$refs.editForm.$baseValidate((valid) => {
488
680
  if (valid) {
489
- this.$baseConfirm(this.$t1('您确定要保存吗?')).then(() => {
490
- var url = USER_PREFIX + (this.isEdit ? '/user/update' : '/user/save');
681
+ this.$baseConfirm(this.$t1("您确定要保存吗?")).then(() => {
682
+ var url = USER_PREFIX + (this.isEdit ? "/user/update" : "/user/save");
683
+ let userCompanyInfoDTOs = this.user.userCompanyInfoDTOs.map((item) => {
684
+ return {
685
+ ...item,
686
+ saleOrgGridOption: null,
687
+ roleGridOption: null,
688
+ saleOrgData: null,
689
+ roleData: null,
690
+ };
691
+ });
692
+ let formData = {
693
+ ...this.user,
694
+ userCompanyInfoDTOs,
695
+ };
696
+
491
697
  this.$http({
492
698
  url: url,
493
699
  method: `post`,
494
- data: this.user,
700
+ data: formData,
495
701
  isLoading: true,
496
- success: res => {
702
+ success: (res) => {
497
703
  this.$message({
498
704
  message: res.content,
499
- type: 'success',
705
+ type: "success",
500
706
  duration: 500,
501
- onClose: t => {
707
+ onClose: (t) => {
502
708
  if (this.isEdit) {
503
709
  this.$baseReload();
504
710
  } else {
505
711
  this.$baseReload({
506
712
  updateParam: {
507
- _dataId: res.objx
508
- }
713
+ _dataId: res.objx,
714
+ },
509
715
  });
510
716
  }
511
- }
717
+ },
512
718
  });
513
- }
719
+ },
514
720
  });
515
721
  });
516
722
  }
@@ -519,94 +725,106 @@ export default {
519
725
  getSaleOrgData() {
520
726
  if (this.dataId) {
521
727
  this.$http({
522
- url: USER_PREFIX + '/user/getUserSaleOrg',
728
+ url: USER_PREFIX + "/user/getUserSaleOrg",
523
729
  method: `post`,
524
- data: {id: this.dataId},
730
+ data: { id: this.dataId },
525
731
  isLoading: true,
526
732
  modalStrictly: true,
527
- success: res => {
733
+ success: (res) => {
528
734
  // this.$refs.saleOrgGrid.loadData(res.objx || []);
529
735
  let rows = res.objx || [];
530
736
  if (rows.length) {
531
- // this.gridSaleOrgDataMap = xeUtils.groupBy(rows, 'companyCode');
532
- Object.assign(this.gridSaleOrgDataMap, xeUtils.groupBy(rows, 'companyCode'));
737
+ let map = xeUtils.groupBy(rows, "companyCode");
738
+ Object.keys(map).forEach((key) => {
739
+ let companyDTO = this.getCompanyDTO(key);
740
+ companyDTO.saleOrgData = map[key];
741
+ });
533
742
  }
534
743
  this.user.userSaleOrgDTOs = rows;
535
- }
744
+ },
536
745
  });
537
746
  }
538
747
  },
539
748
  getUserRoleData() {
540
749
  if (this.dataId) {
541
750
  this.$http({
542
- url: USER_PREFIX + '/user/getUserRole',
751
+ url: USER_PREFIX + "/user/getUserRole",
543
752
  method: `post`,
544
- data: {id: this.dataId},
753
+ data: { id: this.dataId },
545
754
  isLoading: true,
546
755
  modalStrictly: true,
547
- success: res => {
756
+ success: (res) => {
548
757
  let rows = res.objx || [];
549
758
  if (rows.length) {
550
- // this.gridRoleDataMap = xeUtils.groupBy(rows, 'companyCode');
551
- Object.assign(this.gridRoleDataMap, xeUtils.groupBy(rows, 'companyCode'));
759
+ let map = xeUtils.groupBy(rows, "companyCode");
760
+ Object.keys(map).forEach((key) => {
761
+ let companyDTO = this.getCompanyDTO(key);
762
+ companyDTO.roleData = map[key];
763
+ });
552
764
  }
553
765
  this.user.userRoleDTOs = rows;
554
- }
766
+ },
555
767
  });
556
768
  }
557
769
  },
558
770
  deleteSaleOrgItem(row, index, $table) {
559
- $table.remove(row);
560
- this.gridSaleOrgDataMap[row.companyCode].splice(index, 1);
771
+ this.getCompanyDTO(row.companyCode).saleOrgData.splice(index, 1);
561
772
  },
562
773
  getCompanyInfoData(callback) {
563
774
  if (this.dataId) {
564
775
  this.$http({
565
- url: USER_PREFIX + '/user/getUserCompanyInfo',
776
+ url: USER_PREFIX + "/user/getUserCompanyInfo",
566
777
  method: `post`,
567
- data: {id: this.dataId},
778
+ data: { id: this.dataId },
568
779
  isLoading: true,
569
780
  modalStrictly: true,
570
- success: res => {
781
+ success: (res) => {
571
782
  let rows = res.objx || [];
572
- rows.forEach(row => {
573
- this.gridRoleDataMap[row.companyCode] = [];
574
- this.gridSaleOrgDataMap[row.companyCode] = [];
575
- })
783
+ let companyTableData = [];
784
+ rows.forEach((row) => {
785
+ Object.assign(row, {
786
+ saleOrgGridOption: {},
787
+ roleGridOption: {},
788
+ saleOrgData: [],
789
+ roleData: [],
790
+ });
791
+ });
792
+
576
793
  this.user.userCompanyInfoDTOs = rows;
577
794
  callback && callback();
578
- }
795
+ },
579
796
  });
580
797
  }
581
798
  },
582
799
  initSaleOrg(companyCode) {
583
- if (this.vxeOptionMap['saleOrgGridOption-' + companyCode]) {
800
+ let companyDTO = this.getCompanyDTO(companyCode);
801
+ if (Object.keys(companyDTO.saleOrgGridOption).length) {
584
802
  return;
585
803
  }
586
- let tableRef = 'saleOrgGrid-' + companyCode;
804
+ let tableRef = "saleOrgGrid-" + companyCode;
587
805
  const tableOption = {
588
806
  vue: this,
589
807
  tableRef: tableRef,
590
- tableName: 'editUser-saleOrgGrid-' + companyCode,
808
+ tableName: "editUser-saleOrgGrid-" + companyCode,
591
809
  columns: [
592
- {type: 'checkbox', fixed: 'left', width: 48, resizable: false},
593
- {title: this.$t1('机构名称'), field: 'saleOrgName', width: 200},
594
- {title: this.$t1('机构编码'), field: 'sn', width: 200},
595
- {title: this.$t1('上级机构'), field: 'treePathName', width: 200},
810
+ { type: "checkbox", fixed: "left", width: 48, resizable: false },
811
+ { title: this.$t1("机构名称"), field: "saleOrgName", width: 200 },
812
+ { title: this.$t1("机构编码"), field: "sn", width: 200 },
813
+ { title: this.$t1("上级机构"), field: "treePathName", width: 200 },
596
814
  {
597
- title: this.$t1('岗位'),
598
- field: 'position',
815
+ title: this.$t1("岗位"),
816
+ field: "position",
599
817
  width: 150,
600
818
  slots: {
601
- default: 'position'
602
- }
819
+ default: "position",
820
+ },
603
821
  },
604
822
  {
605
- title: this.$t1('是否默认'),
606
- field: 'defaults',
823
+ title: this.$t1("是否默认"),
824
+ field: "defaults",
607
825
  width: 120,
608
826
  slots: {
609
- default: ({row, $table, rowIndex}) => {
827
+ default: ({ row, $table, rowIndex }) => {
610
828
  var isDefault = row.defaults || false;
611
829
  let disabled = this.companyInfo.companyCode != row.companyCode;
612
830
  return [
@@ -614,27 +832,28 @@ export default {
614
832
  v-model={isDefault}
615
833
  disabled={disabled}
616
834
  onchange={() => {
617
- this.gridSaleOrgDataMap[row.companyCode].forEach((item, index) => {
835
+ let companyDTO = this.getCompanyDTO(row.companyCode);
836
+ companyDTO.saleOrgData.forEach((item, index) => {
618
837
  if (index !== rowIndex) {
619
838
  item.defaults = false;
620
839
  }
621
840
  });
622
- this.$nextTick(()=>{
841
+ this.$nextTick(() => {
623
842
  row.defaults = true;
624
- })
843
+ });
625
844
  }}
626
- />
845
+ />,
627
846
  ];
628
- }
629
- }
847
+ },
848
+ },
630
849
  },
631
850
  {
632
851
  width: 47,
633
- fixed: 'right',
634
- title: '',
852
+ fixed: "right",
853
+ title: "",
635
854
  sortable: false,
636
855
  slots: {
637
- default: ({row, rowIndex, $table}) => {
856
+ default: ({ row, rowIndex, $table }) => {
638
857
  if (this.companyInfo.companyCode == row.companyCode) {
639
858
  return [
640
859
  <a
@@ -644,56 +863,60 @@ export default {
644
863
  this.deleteSaleOrgItem(row, rowIndex, $table);
645
864
  }}
646
865
  >
647
- <el-tooltip enterable={false} effect="dark" content={this.$t1('删除')} placement="top"
648
- popper-class="tooltip-skin">
649
- <i class="el-icon-delete"/>
866
+ <el-tooltip
867
+ enterable={false}
868
+ effect="dark"
869
+ content={this.$t1("删除")}
870
+ placement="top"
871
+ popper-class="tooltip-skin"
872
+ >
873
+ <i class="el-icon-delete" />
650
874
  </el-tooltip>
651
- </a>
875
+ </a>,
652
876
  ];
653
877
  }
654
- }
655
- }
656
- }
657
- ]
878
+ },
879
+ },
880
+ },
881
+ ],
658
882
  };
659
- this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
660
- // this.vxeOptionMap['saleOrgGridOption-'+companyCode] = opts;
661
- this.$set(this.vxeOptionMap, 'saleOrgGridOption-' + companyCode, opts);
883
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
884
+ companyDTO.saleOrgGridOption = opts;
662
885
  });
663
-
664
886
  },
665
887
  initUserRole(companyCode) {
666
- if (this.vxeOptionMap['userRoleGridOption-' + companyCode]) {
888
+ let companyDTO = this.getCompanyDTO(companyCode);
889
+ if (Object.keys(companyDTO.roleGridOption).length) {
667
890
  return;
668
891
  }
669
892
  let userType = this.userType;
670
893
  const tableOption = {
671
894
  vue: this,
672
- tableRef: 'userRoleGrid-' + companyCode,
673
- tableName: 'editUser-userRoleGrid-' + companyCode,
895
+ tableRef: "userRoleGrid-" + companyCode,
896
+ tableName: "editUser-userRoleGrid-" + companyCode,
674
897
  columns: [
675
- {type: 'checkbox', fixed: 'left', width: 48, resizable: false},
898
+ { type: "checkbox", fixed: "left", width: 48, resizable: false },
676
899
  {
677
- title: this.$t1('角色名称'),
678
- field: 'name',
900
+ title: this.$t1("角色名称"),
901
+ field: "name",
679
902
  width: 200,
680
903
  slots: {
681
- default: ({row}) => {
904
+ default: ({ row }) => {
682
905
  if (!row.isAdd) {
683
906
  return row.roleName;
684
907
  } else {
685
908
  return row.name;
686
909
  }
687
- }
688
- }
910
+ },
911
+ },
689
912
  },
690
913
  {
691
914
  width: 47,
692
- fixed: 'right',
693
- title: '',
915
+ fixed: "right",
916
+ title: "",
694
917
  sortable: false,
695
918
  slots: {
696
- default: ({row, rowIndex, $table}) => {
919
+ default: ({ row, rowIndex, $table }) => {
697
920
  if (this.companyInfo.companyCode == row.companyCode) {
698
921
  return [
699
922
  <a
@@ -703,73 +926,66 @@ export default {
703
926
  this.deleteRoleItem(row, rowIndex, $table);
704
927
  }}
705
928
  >
706
- <el-tooltip enterable={false} effect="dark" content={this.$t1('删除')} placement="top"
707
- popper-class="tooltip-skin">
708
- <i class="el-icon-delete"/>
929
+ <el-tooltip
930
+ enterable={false}
931
+ effect="dark"
932
+ content={this.$t1("删除")}
933
+ placement="top"
934
+ popper-class="tooltip-skin"
935
+ >
936
+ <i class="el-icon-delete" />
709
937
  </el-tooltip>
710
- </a>
938
+ </a>,
711
939
  ];
712
940
  }
713
- }
714
- }
715
- }
716
- ]
941
+ },
942
+ },
943
+ },
944
+ ],
717
945
  };
718
- this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
719
- // this.vxeOptionMap['userRoleGridOption-'+companyCode] = opts;
720
- this.$set(this.vxeOptionMap, 'userRoleGridOption-' + companyCode, opts);
946
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
947
+ companyDTO.roleGridOption = opts;
721
948
  });
722
949
  },
723
950
  confirmRole(rows) {
724
951
  if (rows.length > 0) {
952
+ let companyCode = this.companyInfo.companyCode;
953
+ let companyDTO = this.getCompanyDTO(companyCode);
725
954
  let outUserCodes = this.outUserCodes;
726
955
  if (this.userType === 1) {
727
956
  //组织用户
728
- rows = rows.filter(row => !outUserCodes.includes(row.code));
957
+ rows = rows.filter((row) => !outUserCodes.includes(row.code));
729
958
  } else if (this.userType === 2) {
730
959
  //外部用户
731
- rows = rows.filter(row => outUserCodes.includes(row.code));
960
+ rows = rows.filter((row) => outUserCodes.includes(row.code));
732
961
  }
733
- let companyCode = this.companyInfo.companyCode;
734
- const $grid = this.$refs['userRoleGrid-' + companyCode][0];
735
- const tableData = this.gridRoleDataMap[companyCode];
962
+
963
+ const $grid = this.$refs["userRoleGrid-" + companyCode][0];
964
+ const tableData = companyDTO.roleData;
736
965
  const map = {};
737
966
  tableData.forEach(function (item) {
738
967
  map[item.roleId] = 1;
739
968
  });
740
969
  var items = [];
741
- rows.forEach(row => {
970
+ rows.forEach((row) => {
742
971
  const item = {
743
972
  roleId: row.id,
744
973
  roleName: row.name,
745
974
  companyCode: companyCode,
746
- companyName: row.companyName
975
+ companyName: row.companyName,
747
976
  };
748
977
  if (!map[item.roleId]) {
749
978
  items.push(item);
750
979
  }
751
980
  });
752
- // $grid.insertAt(items, -1);
753
- // this.user.userRoleDTOs = this.user.userRoleDTOs.concat(items);
754
- this.gridRoleDataMap[companyCode] = tableData.concat(items)
755
- $grid.loadData(this.gridRoleDataMap[companyCode])
756
- }
757
- },
758
- deleteRole(tableRef) {
759
- this.$baseConfirm(this.$t1('您确定要删除吗?')).then(() => {
760
- /*const $grid = this.$refs.userRoleGrid;
761
- $grid.removeCheckboxRow();
762
- this.user.userRoleDTOs = $grid.getTableData().fullData;*/
763
- let companyCode = this.companyInfo.companyCode;
764
- const $grid = this.$refs[tableRef][0];
765
- $grid.removeCheckboxRow();
766
- this.gridRoleDataMap[companyCode] = $grid.getTableData().fullData;
767
981
 
768
- });
982
+ companyDTO.roleData.push(...items);
983
+ }
769
984
  },
770
985
  deleteRoleItem(row, index, $table) {
986
+ let companyDTO = this.getCompanyDTO(row.companyCode);
771
987
  $table.remove(row);
772
- this.gridRoleDataMap[row.companyCode].splice(index, 1);
988
+ companyDTO.roleData.splice(index, 1);
773
989
  },
774
990
  confirmInsertCompany(rows, callback) {
775
991
  if (rows.length > 0) {
@@ -779,18 +995,25 @@ export default {
779
995
  map[item.companyCode] = 1;
780
996
  });
781
997
  var items = [];
782
- rows.forEach(row => {
783
- const item = {companyCode: row.companyCode, companyName: row.companyName, guid: null, defaults: false};
998
+ rows.forEach((row) => {
999
+ const item = {
1000
+ companyCode: row.companyCode,
1001
+ companyName: row.companyName,
1002
+ guid: null,
1003
+ defaults: false,
1004
+ saleOrgGridOption: {},
1005
+ roleGridOption: {},
1006
+ saleOrgData: [],
1007
+ roleData: [],
1008
+ };
784
1009
  if (!map[item.companyCode]) {
785
1010
  items.push(item);
786
1011
  }
787
- this.gridRoleDataMap[item.companyCode] = []
788
- this.gridSaleOrgDataMap[item.companyCode] = []
789
1012
  });
790
1013
  // $grid.insertAt(items, -1);
791
1014
  this.user.userCompanyInfoDTOs.splice(0, 0, ...items);
792
1015
  if (this.user.userCompanyInfoDTOs.length == 1) {
793
- this.user.userCompanyInfoDTOs[0].defaults = true
1016
+ this.user.userCompanyInfoDTOs[0].defaults = true;
794
1017
  }
795
1018
  // this.user.userCompanyInfoDTOs = this.user.userCompanyInfoDTOs.concat(items);
796
1019
  }
@@ -798,17 +1021,23 @@ export default {
798
1021
  },
799
1022
  deleteCompany(row, index) {
800
1023
  let companyCode = row.companyCode;
1024
+ let companyDTO = this.getCompanyDTO(companyCode);
801
1025
  this.user.userCompanyInfoDTOs.splice(index, 1);
802
- this.gridSaleOrgDataMap[row.companyCode] = [];
803
- this.gridRoleDataMap[row.companyCode] = [];
804
- this.user.userSaleOrgDTOs = this.user.userSaleOrgDTOs.filter(item => item.companyCode != companyCode);
805
- this.user.userRoleDTOs = this.user.userRoleDTOs.filter(item => item.companyCode != companyCode);
1026
+ companyDTO.roleData = [];
1027
+ companyDTO.saleOrgData = [];
1028
+ this.user.userSaleOrgDTOs = this.user.userSaleOrgDTOs.filter(
1029
+ (item) => item.companyCode != companyCode
1030
+ );
1031
+ this.user.userRoleDTOs = this.user.userRoleDTOs.filter(
1032
+ (item) => item.companyCode != companyCode
1033
+ );
806
1034
  },
807
1035
  confirmInsertSaleOrg(rows) {
808
1036
  if (rows.length > 0) {
809
1037
  let companyCode = this.companyInfo.companyCode;
810
- const $grid = this.$refs['saleOrgGrid-' + companyCode][0];
811
- const tableData = this.gridSaleOrgDataMap[companyCode] || [];
1038
+ let companyDTO = this.getCompanyDTO(companyCode);
1039
+ const $grid = this.$refs["saleOrgGrid-" + companyCode][0];
1040
+ const tableData = companyDTO.saleOrgData || [];
812
1041
  const map = {};
813
1042
  tableData.forEach(function (item) {
814
1043
  map[item.saleOrgId] = 1;
@@ -827,7 +1056,7 @@ export default {
827
1056
  treePathName: row.treePathName,
828
1057
  userSaleOrgPositionDTOs: [],
829
1058
  saleOrgId: row.id,
830
- sn: row.sn
1059
+ sn: row.sn,
831
1060
  };
832
1061
 
833
1062
  if (!map[item.saleOrgId]) {
@@ -837,7 +1066,7 @@ export default {
837
1066
  id: row.roleId,
838
1067
  name: row.roleName,
839
1068
  companyCode: companyCode,
840
- companyName: row.companyName
1069
+ companyName: row.companyName,
841
1070
  };
842
1071
  roleMap[row.roleId] = true;
843
1072
  newUserRoleDTOs.push(roleItem);
@@ -847,22 +1076,21 @@ export default {
847
1076
  if (items.length > 0 && tableData.length == 0) {
848
1077
  items[0].defaults = true;
849
1078
  }
850
- // this.user.userSaleOrgDTOs.push(...items);
851
- this.gridSaleOrgDataMap[companyCode] = tableData.concat(items)
852
- $grid.loadData(this.gridSaleOrgDataMap[companyCode])
1079
+
1080
+ companyDTO.saleOrgData.push(...items);
853
1081
  this.confirmRole(newUserRoleDTOs);
854
1082
  }
855
1083
  },
856
1084
  openSelectPositionDialog(row, rowIndex, $table) {
857
1085
  const userSaleOrgPositionDTOs = row.userSaleOrgPositionDTOs || [];
858
1086
  const items = [];
859
- userSaleOrgPositionDTOs.forEach(userSaleOrgPositionDTO => {
1087
+ userSaleOrgPositionDTOs.forEach((userSaleOrgPositionDTO) => {
860
1088
  const item = {
861
1089
  companyCode: userSaleOrgPositionDTO.companyCode,
862
1090
  companyName: userSaleOrgPositionDTO.companyName,
863
1091
  name: userSaleOrgPositionDTO.positionName,
864
1092
  code: userSaleOrgPositionDTO.code,
865
- id: userSaleOrgPositionDTO.positionId
1093
+ id: userSaleOrgPositionDTO.positionId,
866
1094
  };
867
1095
  items.push(item);
868
1096
  });
@@ -874,22 +1102,24 @@ export default {
874
1102
  confirmInsertPosition(rows) {
875
1103
  let companyCode = this.companyInfo.companyCode;
876
1104
  const saleOrgPositionIndex = this.saleOrgPositionIndex;
877
- const tableData = this.gridSaleOrgDataMap[companyCode];
1105
+ let companyDTO = this.getCompanyDTO(companyCode);
1106
+ const tableData = companyDTO.saleOrgData || [];
878
1107
  if (rows.length > 0) {
879
- const oldPositions = tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs || [];
1108
+ const oldPositions =
1109
+ tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs || [];
880
1110
  const map = {};
881
1111
  oldPositions.forEach(function (item) {
882
1112
  map[item.positionId] = item;
883
1113
  });
884
1114
  var oItems = [];
885
1115
  var items = [];
886
- rows.forEach(row => {
1116
+ rows.forEach((row) => {
887
1117
  const item = {
888
1118
  companyCode: row.companyCode,
889
1119
  companyName: row.companyName,
890
1120
  positionName: row.name,
891
1121
  code: row.code,
892
- positionId: row.id
1122
+ positionId: row.id,
893
1123
  };
894
1124
 
895
1125
  if (!map[item.positionId]) {
@@ -906,9 +1136,9 @@ export default {
906
1136
  },
907
1137
  getSelectPositionName(row) {
908
1138
  var userSaleOrgPositions = row.userSaleOrgPositionDTOs || [];
909
- var allName = '';
1139
+ var allName = "";
910
1140
  userSaleOrgPositions.forEach(function (pItem, pIndex) {
911
- allName = allName + ',' + pItem.positionName;
1141
+ allName = allName + "," + pItem.positionName;
912
1142
  });
913
1143
  if (allName) {
914
1144
  allName = allName.substr(1);
@@ -917,10 +1147,10 @@ export default {
917
1147
  },
918
1148
  getConpanyInfo() {
919
1149
  this.$http({
920
- url: USER_PREFIX + '/company_info/getCurrent',
1150
+ url: USER_PREFIX + "/company_info/getCurrent",
921
1151
  method: `post`,
922
1152
  isLoading: true,
923
- success: res => {
1153
+ success: (res) => {
924
1154
  this.companyInfo = res.objx || {};
925
1155
  let companyCode = this.companyInfo.companyCode;
926
1156
  if (!this.isEdit) {
@@ -930,14 +1160,14 @@ export default {
930
1160
  this.getUserRoleData();
931
1161
  this.getSaleOrgData();
932
1162
  setTimeout(() => {
933
- this.user.userCompanyInfoDTOs.forEach(userCompanyInfoDTO => {
1163
+ this.user.userCompanyInfoDTOs.forEach((userCompanyInfoDTO) => {
934
1164
  this.initSaleOrg(userCompanyInfoDTO.companyCode);
935
1165
  this.initUserRole(userCompanyInfoDTO.companyCode);
936
- })
937
- }, 100)
1166
+ });
1167
+ }, 100);
938
1168
  });
939
1169
  }
940
- }
1170
+ },
941
1171
  });
942
1172
  },
943
1173
  isCurrentCompany(companyCode) {
@@ -955,48 +1185,45 @@ export default {
955
1185
  this.confirmRole([this.distributorRole]);
956
1186
  }
957
1187
  }
958
- }, 100)
959
- }, 100)
960
-
961
-
1188
+ }, 100);
1189
+ }, 100);
962
1190
  },
963
1191
  handleData() {
964
1192
  let saleOrgs = [];
965
- Object.keys(this.gridSaleOrgDataMap).forEach(companyCode => {
966
- saleOrgs.push(...this.gridSaleOrgDataMap[companyCode])
967
- });
968
1193
  let roles = [];
969
- Object.keys(this.gridRoleDataMap).forEach(companyCode => {
970
- roles.push(...this.gridRoleDataMap[companyCode])
1194
+ this.user.userCompanyInfoDTOs.forEach((companyDTO) => {
1195
+ saleOrgs.push(...companyDTO.saleOrgData);
1196
+ roles.push(...companyDTO.roleData);
971
1197
  });
1198
+
972
1199
  this.user.userRoleDTOs = roles;
973
- this.user.userSaleOrgDTOs = saleOrgs
1200
+ this.user.userSaleOrgDTOs = saleOrgs;
974
1201
  },
975
1202
  initDistributorRole() {
976
1203
  if (this.outUserCodes && this.outUserCodes.length == 1) {
977
1204
  return this.$http({
978
- url: USER_PREFIX + '/role/list',
979
- method: 'post',
980
- success: res => {
1205
+ url: USER_PREFIX + "/role/list",
1206
+ method: "post",
1207
+ success: (res) => {
981
1208
  let roleList = res.objx || [];
982
1209
  let distributorCode = this.outUserCodes[0];
983
- this.distributorRole = roleList.find(item => item.code == distributorCode);
984
- }
1210
+ this.distributorRole = roleList.find((item) => item.code == distributorCode);
1211
+ },
985
1212
  });
986
1213
  }
987
1214
  },
988
1215
  async initOutUserRoleCode() {
989
1216
  //初始化外部用户编码
990
1217
  return this.$http({
991
- url: USER_PREFIX + '/system_parameter/getByCode',
992
- method: 'post',
993
- data: {"code": "outUserRoleCode"},
994
- success: res => {
995
- let value = (!res.objx || !res.objx.value) ? "distributor" : res.objx.value;
996
- let codes = value.split(',');
997
- this.outUserCodes = codes;//外部用户编码
998
- this.initRoleDialogParam();//初始化角色弹框的查询参数
999
- }
1218
+ url: USER_PREFIX + "/system_parameter/getByCode",
1219
+ method: "post",
1220
+ data: { code: "outUserRoleCode" },
1221
+ success: (res) => {
1222
+ let value = !res.objx || !res.objx.value ? "distributor" : res.objx.value;
1223
+ let codes = value.split(",");
1224
+ this.outUserCodes = codes; //外部用户编码
1225
+ this.initRoleDialogParam(); //初始化角色弹框的查询参数
1226
+ },
1000
1227
  });
1001
1228
  },
1002
1229
  initRoleDialogParam() {
@@ -1005,36 +1232,36 @@ export default {
1005
1232
  //组织用户
1006
1233
  this.roleDialogParam = {
1007
1234
  queryAll: true,
1008
- neCodes: [...this.outUserCodes]
1235
+ neCodes: [...this.outUserCodes],
1009
1236
  };
1010
1237
  } else if (this.userType == 2) {
1011
1238
  //外部用户
1012
1239
  this.roleDialogParam = {
1013
1240
  queryAll: true,
1014
- eqCodes: [...this.outUserCodes]
1241
+ eqCodes: [...this.outUserCodes],
1015
1242
  };
1016
1243
  }
1017
1244
  },
1018
1245
  unlock() {
1019
- this.$baseConfirm(this.$t1('您确定要解锁吗?')).then(() => {
1020
- var url = USER_PREFIX + '/user/unlockLoginAccount';
1246
+ this.$baseConfirm(this.$t1("您确定要解锁吗?")).then(() => {
1247
+ var url = USER_PREFIX + "/user/unlockLoginAccount";
1021
1248
  this.$http({
1022
1249
  url: url,
1023
1250
  method: `post`,
1024
1251
  data: {
1025
- id: this.user.id
1252
+ id: this.user.id,
1026
1253
  },
1027
1254
  isLoading: true,
1028
- success: res => {
1255
+ success: (res) => {
1029
1256
  this.$message({
1030
1257
  message: res.content,
1031
- type: 'success',
1258
+ type: "success",
1032
1259
  duration: 500,
1033
- onClose: t => {
1260
+ onClose: (t) => {
1034
1261
  this.$baseReload();
1035
- }
1262
+ },
1036
1263
  });
1037
- }
1264
+ },
1038
1265
  });
1039
1266
  });
1040
1267
  },
@@ -1046,14 +1273,18 @@ export default {
1046
1273
  }
1047
1274
  },
1048
1275
  changeCompanyDefault(item) {
1049
- let companyCode = item.companyCode
1276
+ let companyCode = item.companyCode;
1050
1277
  if (item.defaults) {
1051
- this.user.userCompanyInfoDTOs.forEach(row => {
1278
+ this.user.userCompanyInfoDTOs.forEach((row) => {
1052
1279
  row.defaults = row.companyCode == companyCode;
1053
- })
1280
+ });
1054
1281
  }
1055
-
1056
- }
1057
- }
1282
+ },
1283
+ getCompanyDTO(companyCode) {
1284
+ return this.user.userCompanyInfoDTOs.find(
1285
+ (item) => item.companyCode == companyCode
1286
+ );
1287
+ },
1288
+ },
1058
1289
  };
1059
1290
  </script>