cloud-web-corejs 1.0.17 → 1.0.19

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.
Files changed (187) hide show
  1. package/package.json +2 -1
  2. package/src/components/jsonImport/index.js +3 -1
  3. package/src/components/jsonImport/mixins.js +16 -16
  4. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1 -1
  5. package/src/layout/components/Sidebar/default.vue +10 -4
  6. package/src/router/modules/customer.js +8 -8
  7. package/src/router/modules/system.js +1 -1
  8. package/src/utils/aes.js +1 -0
  9. package/src/views/bd/setting/bd_attach_setting/dialog.vue +4 -4
  10. package/src/views/bd/setting/bd_attach_setting/edit.vue +3 -3
  11. package/src/views/bd/setting/bd_attach_setting/list.vue +3 -3
  12. package/src/views/bd/setting/form_script/dialog.vue +14 -12
  13. package/src/views/bd/setting/form_script/edit.vue +6 -5
  14. package/src/views/bd/setting/form_script/edit1.vue +4 -4
  15. package/src/views/bd/setting/form_script/form_list.vue +3 -3
  16. package/src/views/bd/setting/form_script/list.vue +4 -4
  17. package/src/views/bd/setting/form_script/list1.vue +4 -4
  18. package/src/views/bd/setting/form_script/list2.vue +1 -1
  19. package/src/views/bd/setting/form_template/dialog.vue +24 -17
  20. package/src/views/bd/setting/form_template/edit.vue +3 -3
  21. package/src/views/bd/setting/form_template/editWfObjConfigDialog.vue +1 -1
  22. package/src/views/bd/setting/form_template/ftHistoryDialog.vue +5 -5
  23. package/src/views/bd/setting/form_template/itemEdit.vue +3 -3
  24. package/src/views/bd/setting/form_template/itemList.vue +3 -3
  25. package/src/views/bd/setting/form_template/list.vue +4 -4
  26. package/src/views/bd/setting/form_template/preformDialog.vue +2 -2
  27. package/src/views/bd/setting/menu_kind/authDialog.vue +2 -2
  28. package/src/views/bd/setting/menu_kind/dialog.vue +23 -16
  29. package/src/views/bd/setting/menu_kind/list.vue +4 -4
  30. package/src/views/bd/setting/table_model/dialog.vue +4 -4
  31. package/src/views/bd/setting/table_model/edit.vue +1123 -1123
  32. package/src/views/bd/setting/table_model/list.vue +4 -4
  33. package/src/views/bd/setting/table_model/zdDialog.vue +4 -4
  34. package/src/views/mobile/user/area/dialog.vue +3 -2
  35. package/src/views/mobile/user/user/dialog.vue +3 -2
  36. package/src/views/support/export_template/edit.vue +4 -4
  37. package/src/views/support/export_template/list.vue +12 -12
  38. package/src/views/user/access_log/edit.vue +2 -2
  39. package/src/views/user/access_log/list.vue +8 -8
  40. package/src/views/user/access_log/statistics_list.vue +16 -11
  41. package/src/views/user/api_request/edit.vue +7 -4
  42. package/src/views/user/api_request/list.vue +7 -5
  43. package/src/views/user/area/dialog.vue +4 -4
  44. package/src/views/user/area_attribute/configDialog.vue +319 -319
  45. package/src/views/user/area_attribute/edit.vue +2 -2
  46. package/src/views/user/area_attribute/list.vue +1 -1
  47. package/src/views/user/attachment/uploadDialog.vue +11 -11
  48. package/src/views/user/bill_setting/edit.vue +6 -5
  49. package/src/views/user/bill_setting/h5_ModifyDialog.vue +5 -3
  50. package/src/views/user/bill_setting/h5_view.vue +4 -4
  51. package/src/views/user/bill_setting/itemViewDialog.vue +1 -1
  52. package/src/views/user/bill_setting/list.vue +5 -4
  53. package/src/views/user/bill_setting/queryDialog.vue +3 -3
  54. package/src/views/user/bill_setting/render.vue +6 -6
  55. package/src/views/user/bill_setting/template2.json +44 -11
  56. package/src/views/user/bill_setting/userDialog.vue +4 -4
  57. package/src/views/user/code_rules/edit.vue +3 -3
  58. package/src/views/user/code_rules/list.vue +3 -3
  59. package/src/views/user/commMenu/index.vue +2 -2
  60. package/src/views/user/common_attribute/edit.vue +3 -3
  61. package/src/views/user/common_attribute/itemEdit.vue +3 -3
  62. package/src/views/user/common_attribute/list.vue +3 -3
  63. package/src/views/user/common_script/edit.vue +5 -4
  64. package/src/views/user/common_script/list.vue +14 -13
  65. package/src/views/user/company_info/dialog.vue +138 -131
  66. package/src/views/user/company_info/edit.vue +2 -2
  67. package/src/views/user/company_info/view.vue +1 -1
  68. package/src/views/user/country/dialog.vue +6 -6
  69. package/src/views/user/country/edit.vue +8 -7
  70. package/src/views/user/country/list.vue +170 -160
  71. package/src/views/user/data_type_setting/dialog.vue +10 -7
  72. package/src/views/user/data_type_setting/editDialog.vue +12 -11
  73. package/src/views/user/ea/eagroup/eaobj_list.vue +331 -310
  74. package/src/views/user/ea/eagroup/edit.vue +492 -475
  75. package/src/views/user/ea/eaobj/edit.vue +153 -148
  76. package/src/views/user/ea/eaobj/list.vue +147 -135
  77. package/src/views/user/error-page/401.vue +42 -34
  78. package/src/views/user/error-page/404.vue +19 -3
  79. package/src/views/user/extend_datasource/dialog.vue +124 -116
  80. package/src/views/user/extend_datasource/edit.vue +5 -4
  81. package/src/views/user/extend_datasource/list.vue +3 -3
  82. package/src/views/user/fieldTranslation/editDialog.vue +2 -2
  83. package/src/views/user/fieldTranslation/list.vue +4 -3
  84. package/src/views/user/field_values_invisible/edit.vue +85 -83
  85. package/src/views/user/field_values_invisible/list.vue +32 -21
  86. package/src/views/user/file_type/edit.vue +3 -3
  87. package/src/views/user/file_type/list.vue +7 -4
  88. package/src/views/user/file_type/userEdit.vue +188 -188
  89. package/src/views/user/file_view_area/edit.vue +3 -3
  90. package/src/views/user/file_view_area/itemEdit.vue +168 -165
  91. package/src/views/user/file_view_area/list.vue +3 -3
  92. package/src/views/user/file_view_ins/list.vue +55 -36
  93. package/src/views/user/file_view_ins/propertiesDialog.vue +218 -218
  94. package/src/views/user/form/form_ins_list/edit.vue +421 -421
  95. package/src/views/user/form/form_template/dialog.vue +24 -17
  96. package/src/views/user/form/form_template/edit.vue +7 -4
  97. package/src/views/user/form/form_template/itemEdit.vue +3 -3
  98. package/src/views/user/form/form_template/itemList.vue +3 -3
  99. package/src/views/user/form/form_template/list.vue +5 -4
  100. package/src/views/user/form/form_template_field/dialog.vue +11 -8
  101. package/src/views/user/form/form_type/dialog.vue +134 -127
  102. package/src/views/user/form/form_type/edit.vue +4 -4
  103. package/src/views/user/form/form_type/editDialog.vue +10 -9
  104. package/src/views/user/form/form_type/list.vue +128 -118
  105. package/src/views/user/form/report_requestaccess/dialog.vue +106 -99
  106. package/src/views/user/form/report_requestaccess/edit.vue +272 -234
  107. package/src/views/user/form/report_requestaccess/list.vue +29 -18
  108. package/src/views/user/form/vform/designer.vue +164 -164
  109. package/src/views/user/form/vform/formFieldMapping.js +151 -169
  110. package/src/views/user/form/vform/out_render.vue +3 -2
  111. package/src/views/user/form/vform/render.vue +2 -2
  112. package/src/views/user/form/view/edit.vue +7 -7
  113. package/src/views/user/form/view/list.vue +2 -2
  114. package/src/views/user/home/distributor.vue +374 -118
  115. package/src/views/user/home/index.vue +1 -1
  116. package/src/views/user/language_setting/edit.vue +167 -166
  117. package/src/views/user/language_setting/list.vue +3 -3
  118. package/src/views/user/ledger_library/list.vue +2 -2
  119. package/src/views/user/ledger_library/private_list.vue +3 -3
  120. package/src/views/user/login/auth-redirect.vue +1 -1
  121. package/src/views/user/login/index.vue +1 -1
  122. package/src/views/user/login/indexMixin.js +4 -1
  123. package/src/views/user/menu/list.vue +3 -3
  124. package/src/views/user/mobile_menu/list.vue +2 -2
  125. package/src/views/user/notify_message/dialog.vue +8 -6
  126. package/src/views/user/notify_message/list.vue +4 -3
  127. package/src/views/user/notify_template/edit.vue +185 -185
  128. package/src/views/user/notify_template/list.vue +4 -4
  129. package/src/views/user/oplog/edit.vue +108 -103
  130. package/src/views/user/oplog/list.vue +3 -3
  131. package/src/views/user/outLink/form_view.vue +144 -143
  132. package/src/views/user/outLink/index.vue +7 -5
  133. package/src/views/user/outLink/view.vue +119 -117
  134. package/src/views/user/position/dialog.vue +145 -138
  135. package/src/views/user/position/edit.vue +4 -4
  136. package/src/views/user/position/list.vue +170 -160
  137. package/src/views/user/project_tag/dialog.vue +5 -5
  138. package/src/views/user/project_tag/edit.vue +3 -3
  139. package/src/views/user/project_tag/list.vue +3 -3
  140. package/src/views/user/push_setting/edit.vue +7 -4
  141. package/src/views/user/push_setting/list.vue +44 -34
  142. package/src/views/user/redirect/index.vue +4 -4
  143. package/src/views/user/role/dialog.vue +10 -7
  144. package/src/views/user/role/edit.vue +427 -427
  145. package/src/views/user/role/list.vue +125 -114
  146. package/src/views/user/sale_org/dialog.vue +3 -3
  147. package/src/views/user/sale_org/list.vue +11 -11
  148. package/src/views/user/sale_org/moveDialog.vue +2 -2
  149. package/src/views/user/sale_org_net/list.vue +9 -9
  150. package/src/views/user/system_notice/edit.vue +184 -184
  151. package/src/views/user/system_notice/list.vue +156 -145
  152. package/src/views/user/system_parameter/edit.vue +140 -137
  153. package/src/views/user/system_parameter/list.vue +131 -120
  154. package/src/views/user/user/dialog.vue +31 -24
  155. package/src/views/user/user/edit.vue +1021 -1019
  156. package/src/views/user/user/form_edit.vue +481 -483
  157. package/src/views/user/user/form_list.vue +5 -5
  158. package/src/views/user/user/info.vue +271 -256
  159. package/src/views/user/user/infoContent.vue +12 -11
  160. package/src/views/user/user/infoEdit.vue +111 -92
  161. package/src/views/user/user/inner_list.vue +1 -1
  162. package/src/views/user/user/list.vue +55 -50
  163. package/src/views/user/user/list2.vue +1 -1
  164. package/src/views/user/user/modifyPasswordDialog.vue +3 -3
  165. package/src/views/user/user/out_list.vue +1 -1
  166. package/src/views/user/wf/formCustDialog/list.vue +13 -15
  167. package/src/views/user/wf/iframe/index.vue +12 -12
  168. package/src/views/user/wf/iframe/index2.vue +2 -2
  169. package/src/views/user/wf/wf_auto_submit_data/edit.vue +1 -1
  170. package/src/views/user/wf/wf_auto_submit_data/edith.vue +1 -1
  171. package/src/views/user/wf/wf_auto_submit_data/list.vue +8 -6
  172. package/src/views/user/wf/wf_diy_attribute/edit.vue +5 -5
  173. package/src/views/user/wf/wf_manage/list.vue +5 -4
  174. package/src/views/user/wf/wf_obj_config/activiti_wf.vue +11 -10
  175. package/src/views/user/wf/wf_obj_config/dialog.vue +10 -7
  176. package/src/views/user/wf/wf_obj_config/edit.vue +7 -4
  177. package/src/views/user/wf/wf_obj_config/edit_form.vue +70 -63
  178. package/src/views/user/wf/wf_obj_config/itemEdit.vue +3 -3
  179. package/src/views/user/wf/wf_obj_config/itemEdit_form.vue +3 -3
  180. package/src/views/user/wf/wf_obj_config/list.vue +4 -4
  181. package/src/views/user/wf/wf_obj_config/list_form.vue +22 -22
  182. package/src/views/user/wf/wf_param/edit.vue +4 -4
  183. package/src/views/user/wf/wf_work_calendar/components/calendar.vue +27 -13
  184. package/src/views/user/wf/wf_work_calendar/components/calendar2.vue +25 -10
  185. package/src/views/user/wf/wf_work_calendar/configDialog.vue +8 -5
  186. package/src/views/user/wf/wf_work_calendar/date.js +10 -10
  187. package/src/views/user/wf/wf_work_calendar/list.vue +9 -4
@@ -1,1019 +1,1021 @@
1
- <template>
2
- <div class="detail-wrap">
3
- <el-form ref="editForm" :model="user">
4
- <div class="d-header clearfix">
5
- <div class="fl">
6
- <i class="el-icon-info"/>
7
- {{ dataId ? '查看' : '新增' }}用户
8
- </div>
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'">解锁
14
- </el-button>
15
- <el-button type="primary" plain class="button-sty" @click="$baseReload()" icon="el-icon-refresh-right">重置
16
- </el-button>
17
- <el-button type="primary" class="button-sty" icon="el-icon-check" @click="saveData">保存</el-button>
18
- </div>
19
- </div>
20
- <baseTabs>
21
- <baseTabPane label="基本信息">
22
- <template #default>
23
- <table class="table-detail">
24
- <tbody>
25
- <tr>
26
- <th>
27
- <em class="f-red">*</em>
28
- 登录名
29
- </th>
30
- <td colspan="3">
31
- <el-form-item prop="loginAccount" :rules="[{ required: true, trigger: 'blur' }]">
32
- <template v-if="dataId">
33
- <el-input size="small" v-model="user.loginAccount" maxlength="255" autocomplete="off"
34
- lay-verify="required" required="" :readonly="true"/>
35
- </template>
36
- <template v-else>
37
- <el-input size="small" v-model="user.loginAccount" maxlength="255" autocomplete="off"
38
- lay-verify="required" required="" clearable/>
39
- </template>
40
- </el-form-item>
41
- </td>
42
-
43
- <th>
44
- <em class="f-red">*</em>
45
- 姓名
46
- </th>
47
- <td colspan="3">
48
- <el-form-item prop="nickName" :rules="[{ required: true, trigger: 'blur' }]">
49
- <el-input size="small" v-model="user.nickName" maxlength="200" lay-verify="required" required=""
50
- clearable/>
51
- </el-form-item>
52
- </td>
53
- </tr>
54
- <tr>
55
-
56
- <th>
57
- <em class="f-red" v-if="!dataId">*</em>
58
- 密码
59
- </th>
60
- <td>
61
- <el-form-item prop="password" :rules="passRules">
62
- <el-input size="small" type="password" v-model="user.password" show-password maxlength="255"
63
- autocomplete="off" auto-complete="new-password" clearable/>
64
- </el-form-item>
65
- </td>
66
- <th>
67
- <em class="f-red" v-if="!dataId">*</em>
68
- 确认密码
69
- </th>
70
- <td>
71
- <el-form-item prop="rePassword" :rules="pass2Rules">
72
- <el-input
73
- size="small"
74
- type="password"
75
- v-model="user.rePassword"
76
- show-password
77
- maxlength="255"
78
- autocomplete="off"
79
- auto-complete="new-password"
80
- lay-verify="confirmPass"
81
- clearable
82
- />
83
- </el-form-item>
84
- </td>
85
-
86
-
87
- <th>性别</th>
88
- <td>
89
- <el-radio-group v-model="user.gender">
90
- <el-radio :label="1">男</el-radio>
91
- <el-radio :label="2">女</el-radio>
92
- </el-radio-group>
93
- </td>
94
- <th>
95
- 员工编码
96
- </th>
97
- <td>
98
- <el-form-item prop="empNo" :rules="[{ required: false, trigger: 'blur' }]">
99
- <el-input size="small" v-model="user.empNo" maxlength="200" clearable/>
100
- </el-form-item>
101
- </td>
102
- </tr>
103
-
104
- <tr>
105
- <th>出生日期</th>
106
- <td>
107
- <el-date-picker size="small" v-model="user.birth" type="date" placeholder="选择日期"
108
- value-format="yyyy-MM-dd" clearable/>
109
- </td>
110
- <th>邮编</th>
111
- <td>
112
- <el-input size="small" v-model="user.zipCode" maxlength="255" clearable/>
113
- </td>
114
- <th>手机</th>
115
- <td>
116
- <el-form-item prop="mobile" :rules="[{ required: false, trigger: 'blur' }]">
117
- <el-input size="small" v-model="user.mobile" type="text" maxlength="255" autocomplete="off"
118
- lay-verify="required|phone" clearable/>
119
- </el-form-item>
120
- </td>
121
- <th>设置</th>
122
- <td>
123
- <el-checkbox label="是否启用" v-model="user.enabled"></el-checkbox>
124
- </td>
125
-
126
- </tr>
127
-
128
- <tr>
129
- <th>
130
- 邮箱
131
- </th>
132
- <td>
133
- <el-form-item prop="email" :rules="[{ required: false, trigger: 'blur' }]">
134
- <el-input size="small" v-model="user.email" maxlength="200" clearable/>
135
- </el-form-item>
136
- </td>
137
- <th v-if="flag!=='2'">
138
- GUID
139
- </th>
140
- <td v-if="flag!=='2'">
141
- <el-form-item prop="guid" :rules="[{ required: false, trigger: 'blur' }]">
142
- <el-input size="small" v-model="user.guid" maxlength="200" clearable/>
143
- </el-form-item>
144
- </td>
145
- <th>地址</th>
146
- <td colspan="3">
147
- <el-input size="small" v-model="user.address" class="b" maxlength="255" clearable/>
148
- </td>
149
-
150
- </tr>
151
- <tr>
152
- <th>
153
- 国家
154
- </th>
155
- <td colspan="3">
156
- <el-form-item prop="countryName" :rules="[{ required: false, trigger: 'blur' }]">
157
- <el-input
158
- class="search-input"
159
- v-model="user.countryName"
160
- clearable
161
- @clear="
162
- user.countryName = null;
163
- user.countryCode = null;
164
- "
165
- v-el-readonly
166
- >
167
- <i slot="suffix" class="el-input__icon el-icon-search"
168
- @click="showCountryDialog=true"></i>
169
- </el-input>
170
- </el-form-item>
171
- </td>
172
- <th>
173
- 是否锁定
174
- </th>
175
- <td>
176
- {{ user.locked ? "是" : "否" }}
177
- </td>
178
- </tr>
179
- <tr>
180
- <th>头像</th>
181
- <td colspan="7">
182
- <baseUpload :limit="1" accept="image/png, image/jpeg" multi="false" :file.sync="user.headPhotoUrl"
183
- dataType="medium"></baseUpload>
184
- </td>
185
- </tr>
186
- <tr>
187
- <th>创建人</th>
188
- <td>{{ user.createBy }}</td>
189
- <th>创建时间</th>
190
- <td>{{ user.createDate }}</td>
191
- <th>更新人</th>
192
- <td>{{ user.modifyBy }}</td>
193
- <th>更新时间</th>
194
- <td>{{ user.modifyDate }}</td>
195
- </tr>
196
- </tbody>
197
- </table>
198
- </template>
199
- </baseTabPane>
200
- <baseTabPane label="组织信息">
201
- <template #button>
202
- <el-button class="button-sty" @click="addCurrentCompany()" icon="el-icon-search" v-if="!hasCurrentCompany">
203
- 新增组织权限
204
- </el-button>
205
- </template>
206
- <template #default>
207
- <div class="style1">
208
- <div class="d-item" v-for="(item,index1) in user.userCompanyInfoDTOs" :key="index1">
209
- <div class="title">
210
- <b>{{ item.companyName }}</b>
211
- <el-button class="button-sty" icon="el-icon-delete" v-if="isCurrentCompany(item.companyCode)"
212
- @click="deleteCompany(item,index1)">删除
213
- </el-button>
214
- </div>
215
- <div class="title-form">
216
- <span v-if="flag==='2'">
217
- <el-form-item label="GUID" :prop="'userCompanyInfoDTOs.'+index1+'.guid'"
218
- :rules="[{ required: false, trigger: 'blur' }]">
219
- <el-input size="small" v-model="item.guid" maxlength="200" clearable/>
220
- </el-form-item>
221
- </span>
222
- </div>
223
- <div class="m-2">
224
- <div class="d-item" style="width: 65%;">
225
- <div class="title">
226
- <b>机构信息</b>
227
- <el-button class="button-sty" icon="el-icon-search" @click="showSaleOrgDialog = true"
228
- v-if="isCurrentCompany(item.companyCode)">选择机构
229
- </el-button>
230
- </div>
231
- <div class="grid-h">
232
- <vxe-grid
233
- :ref="'saleOrgGrid-'+item.companyCode"
234
- :data="gridSaleOrgDataMap[item.companyCode]"
235
- v-bind="vxeOptionMap['saleOrgGridOption-'+item.companyCode]"
236
- @resizable-change="$vxeTableUtil.onColumnWitchChange"
237
- @custom="$vxeTableUtil.customHandle">
238
- <template #position="{row,rowIndex,$table}">
239
- <el-input
240
- class="search-input"
241
- :value="getSelectPositionName(row)"
242
- clearable
243
- @clear="
244
- row.userSaleOrgPositionDTOs = [];
245
- $forceUpdate();
246
- "
247
- v-el-readonly
248
- v-if="companyInfo.companyCode == row.companyCode"
249
- >
250
- <i slot="suffix" class="el-input__icon el-icon-search"
251
- @click="openSelectPositionDialog(row, rowIndex, $table)"></i>
252
- </el-input>
253
- <template v-else>
254
- {{ getSelectPositionName(row) }}
255
- </template>
256
- </template>
257
- </vxe-grid>
258
- </div>
259
- </div>
260
- <div class="d-item" style="width: 35%;">
261
- <div class="title">
262
- <b>角色信息</b>
263
- <el-button class="button-sty" icon="el-icon-search" @click="showRoleDialog = true"
264
- v-if="isCurrentCompany(item.companyCode)">选择角色
265
- </el-button>
266
- </div>
267
- <div class="grid-h">
268
- <vxe-grid
269
- :ref="'userRoleGrid-'+item.companyCode"
270
- :data="gridRoleDataMap[item.companyCode]"
271
- v-bind="vxeOptionMap['userRoleGridOption-'+item.companyCode]"
272
- @resizable-change="$vxeTableUtil.onColumnWitchChange"
273
- @custom="$vxeTableUtil.customHandle"
274
- ></vxe-grid>
275
- </div>
276
- </div>
277
- </div>
278
- </div>
279
- </div>
280
- </template>
281
- </baseTabPane>
282
- </baseTabs>
283
- </el-form>
284
- <roleDialog v-if="showRoleDialog" :visiable.sync="showRoleDialog" @confirm="confirmRole"
285
- :param="roleDialogParam"/>
286
- <companyDialog v-if="showCompanyDialog" :visiable.sync="showCompanyDialog" @confirm="confirmInsertCompany"/>
287
- <saleOrgDialog v-if="showSaleOrgDialog" :visiable.sync="showSaleOrgDialog" @confirm="confirmInsertSaleOrg"
288
- :param="{ queryAll: true }"/>
289
- <positionDialog v-if="showPositionDialog" :visiable.sync="showPositionDialog" :rows="positionDialogDatas"
290
- @confirm="confirmInsertPosition" :param="{ queryAll: true }"/>
291
- <countryDialog v-if="showCountryDialog" :visiable.sync="showCountryDialog"
292
- @confirm="confirmCountry" multi="false"/>
293
- </div>
294
- </template>
295
-
296
- <script>
297
- import xeUtils from "xe-utils";
298
- /*import tempStorageButton from "@base/components/tempStorage/index.vue";*/
299
-
300
-
301
- export default {
302
- name: 'UserEdit',
303
- components: {
304
- roleDialog: () => import('../../../views/user/role/dialog.vue'),
305
- companyDialog: () => import('../../../views/user/company_info/dialog.vue'),
306
- saleOrgDialog: () => import('../../../views/user/sale_org/dialog.vue'),
307
- positionDialog: () => import('../../../views/user/position/dialog.vue'),
308
- countryDialog: () => import('../../../views/user/country/dialog.vue')/*,
309
- tempStorageButton*/
310
- },
311
- props: ['_dataId', 'userType', 'flag'],
312
- data() {
313
- var validatePass = (rule, value, callback) => {
314
- const isPassRequired = !this.dataId;
315
- if (isPassRequired && (value == '' || value == undefined)) {
316
- callback(new Error('密码不能为空'));
317
- } else {
318
- callback();
319
- }
320
- this.$refs.editForm.validateField('rePassword');
321
- };
322
- var validatePass2 = (rule, value, callback) => {
323
- const isPassRequired = !this.dataId;
324
- const rePassword = value != undefined ? value : '';
325
- const password = this.user.password != undefined ? this.user.password : '';
326
-
327
- if (isPassRequired && rePassword == '') {
328
- callback(new Error('确认密码不能为空'));
329
- } else if (rePassword != password) {
330
- callback(new Error('两次输入密码不一致!'));
331
- } else {
332
- callback();
333
- }
334
- };
335
-
336
- return {
337
- dataId: '',
338
- hBtn: true,
339
- user: {
340
- userCompanyInfoDTOs: [],
341
- userSaleOrgDTOs: [],
342
- userRoleDTOs: [],
343
- gender: null,
344
- enabled: true,
345
- userType: null,
346
- countryName: null,
347
- countryCode: null
348
- },
349
- vxeOption: {},
350
- companyInfoOption: {},
351
- userRoleOption: {},
352
- showRoleDialog: false,
353
- showCompanyDialog: false,
354
- showSaleOrgDialog: false,
355
- showPositionDialog: false,
356
- saleOrgPositionIndex: 0,
357
- passRules: [{validator: validatePass, trigger: 'blur', required: false}],
358
- pass2Rules: [{validator: validatePass2, trigger: 'blur', required: false}],
359
- activeName: 'first',
360
- userCustomerListDTO: {
361
- userCustomerDTOs: []
362
- },
363
- customerOption: {},
364
- showCustomerDialog: false,
365
- exportOption: {
366
- prefix: USER_PREFIX,
367
- title: '用户',
368
- codes: ["USEREXCEL", "USERPDF", "USERPRINT", "USERHIPRINT"],
369
- param: () => {
370
- return [{id: this.dataId}];
371
- }
372
- },
373
- showExtendedProperties: false,
374
- radio1: '0',
375
- companyInfo: {},
376
- vxeOptionMap: {},
377
- gridRoleDataMap: {},
378
- gridSaleOrgDataMap: {},
379
- distributorCode: 'distributor',
380
- distributorRole: null,
381
- outUserCodes: [],
382
- roleDialogParam: {queryAll: true},
383
- tempStorageOption: {
384
- storageType: "user",
385
- data: () => {
386
- this.handleData();
387
- return this.user;
388
- },
389
- chooseConfirm: (tempStorageData) => {
390
- this.user = tempStorageData;
391
- this.gridSaleOrgDataMap = xeUtils.groupBy(this.user.userSaleOrgDTOs, 'companyCode');
392
- this.gridRoleDataMap = xeUtils.groupBy(this.user.userRoleDTOs, 'companyCode');
393
- },
394
- saveConfirm: () => {
395
- }
396
- },
397
- showCountryDialog: false
398
- };
399
- },
400
- computed: {
401
- hasCurrentCompany() {
402
- return this.user.userCompanyInfoDTOs.find(item => item.companyCode == this.companyInfo.companyCode) != null;
403
- }
404
- },
405
- created() {
406
- if (this._dataId && !isNaN(this._dataId)) this.dataId = this._dataId;
407
- },
408
- async mounted() {
409
-
410
- // this.getEainsGroupDTO();
411
- await this.initOutUserRoleCode();
412
- await this.initDistributorRole();
413
- this.getData();
414
- this.getConpanyInfo()
415
- },
416
- methods: {
417
- getData() {
418
- if (this.dataId && !isNaN(this.dataId)) {
419
- this.isEdit = true;
420
- this.$commonHttp({
421
- url: USER_PREFIX + `/user/get`,
422
- method: `post`,
423
- data: {
424
- id: this.dataId
425
- },
426
- isLoading: true,
427
- modalStrictly: true,
428
- success: res => {
429
- let user = res.objx || {};
430
- user.userCompanyInfoDTOs = this.user.userCompanyInfoDTOs;
431
- user.userSaleOrgDTOs = this.user.userSaleOrgDTOs;
432
- user.userRoleDTOs = this.user.userRoleDTOs;
433
- this.user = user;
434
- this.user.password = '';
435
-
436
- this.showExtendedProperties = true;
437
- }
438
- });
439
- } else {
440
- this.user.gender = 1;
441
- this.isEdit = false;
442
- this.showExtendedProperties = true;
443
- }
444
- },
445
- saveData() {
446
- let companyCode = this.companyInfo.companyCode;
447
- this.handleData();
448
- if (this.userType == 2) {
449
- //外部用户
450
- let currentUserCompanyInfo = this.user.userCompanyInfoDTOs.find(item => item.companyCode == companyCode)
451
- if (currentUserCompanyInfo) {
452
- let rows = this.user.userRoleDTOs.filter(item => item.companyCode == companyCode);
453
- if (!rows.length) {
454
- this.$baseAlert("请维护角色");
455
- return
456
- }
457
- }
458
-
459
- }
460
- this.$refs.editForm.$baseValidate(valid => {
461
- if (valid) {
462
- this.$baseConfirm('您确定要保存吗?').then(() => {
463
- var url = USER_PREFIX + (this.isEdit ? '/user/update' : '/user/save');
464
- this.$http({
465
- url: url,
466
- method: `post`,
467
- data: this.user,
468
- isLoading: true,
469
- success: res => {
470
- this.$message({
471
- message: res.content,
472
- type: 'success',
473
- duration: 500,
474
- onClose: t => {
475
- if (this.isEdit) {
476
- this.$baseReload();
477
- } else {
478
- this.$baseReload({
479
- updateParam: {
480
- _dataId: res.objx
481
- }
482
- });
483
- }
484
- }
485
- });
486
- }
487
- });
488
- });
489
- }
490
- });
491
- },
492
- getSaleOrgData() {
493
- if (this.dataId) {
494
- this.$http({
495
- url: USER_PREFIX + '/user/getUserSaleOrg',
496
- method: `post`,
497
- data: {id: this.dataId},
498
- isLoading: true,
499
- modalStrictly: true,
500
- success: res => {
501
- // this.$refs.saleOrgGrid.loadData(res.objx || []);
502
- let rows = res.objx || [];
503
- if (rows.length) {
504
- // this.gridSaleOrgDataMap = xeUtils.groupBy(rows, 'companyCode');
505
- Object.assign(this.gridSaleOrgDataMap, xeUtils.groupBy(rows, 'companyCode'));
506
- }
507
- this.user.userSaleOrgDTOs = rows;
508
- }
509
- });
510
- }
511
- },
512
- getUserRoleData() {
513
- if (this.dataId) {
514
- this.$http({
515
- url: USER_PREFIX + '/user/getUserRole',
516
- method: `post`,
517
- data: {id: this.dataId},
518
- isLoading: true,
519
- modalStrictly: true,
520
- success: res => {
521
- let rows = res.objx || [];
522
- if (rows.length) {
523
- // this.gridRoleDataMap = xeUtils.groupBy(rows, 'companyCode');
524
- Object.assign(this.gridRoleDataMap, xeUtils.groupBy(rows, 'companyCode'));
525
- }
526
- this.user.userRoleDTOs = rows;
527
- }
528
- });
529
- }
530
- },
531
- deleteSaleOrgItem(row, index, $table) {
532
- $table.remove(row);
533
- this.gridSaleOrgDataMap[row.companyCode].splice(index, 1);
534
- },
535
- getCompanyInfoData(callback) {
536
- if (this.dataId) {
537
- this.$http({
538
- url: USER_PREFIX + '/user/getUserCompanyInfo',
539
- method: `post`,
540
- data: {id: this.dataId},
541
- isLoading: true,
542
- modalStrictly: true,
543
- success: res => {
544
- let rows = res.objx || [];
545
- rows.forEach(row => {
546
- this.gridRoleDataMap[row.companyCode] = [];
547
- this.gridSaleOrgDataMap[row.companyCode] = [];
548
- })
549
- this.user.userCompanyInfoDTOs = rows;
550
- callback && callback();
551
- }
552
- });
553
- }
554
- },
555
- initSaleOrg(companyCode) {
556
- if (this.vxeOptionMap['saleOrgGridOption-' + companyCode]) {
557
- return;
558
- }
559
- let tableRef = 'saleOrgGrid-' + companyCode;
560
- const tableOption = {
561
- vue: this,
562
- tableRef: tableRef,
563
- tableName: 'editUser-saleOrgGrid-' + companyCode,
564
- columns: [
565
- {type: 'checkbox', fixed: 'left', width: 48, resizable: false},
566
- {title: '机构名称', field: 'saleOrgName', width: 200},
567
- {title: '机构编码', field: 'sn', width: 200},
568
- {title: '上级机构', field: 'treePathName', width: 200},
569
- {
570
- title: '岗位',
571
- field: 'position',
572
- width: 150,
573
- slots: {
574
- default: 'position'
575
- }
576
- },
577
- {
578
- title: '是否默认',
579
- field: 'defaults',
580
- width: 120,
581
- slots: {
582
- default: ({row, $table, rowIndex}) => {
583
- var isDefault = row.defaults || false;
584
- let disabled = this.companyInfo.companyCode != row.companyCode;
585
- return [
586
- <el-checkbox
587
- v-model={isDefault}
588
- disabled={disabled}
589
- onchange={() => {
590
- this.gridSaleOrgDataMap[row.companyCode].forEach((item, index) => {
591
- if (index == rowIndex) {
592
- item.defaults = true;
593
- } else {
594
- item.defaults = false;
595
- }
596
- });
597
- }}
598
- />
599
- ];
600
- }
601
- }
602
- },
603
- {
604
- width: 47,
605
- fixed: 'right',
606
- title: '',
607
- sortable: false,
608
- slots: {
609
- default: ({row, rowIndex, $table}) => {
610
- if (this.companyInfo.companyCode == row.companyCode) {
611
- return [
612
- <a
613
- href="javascript:void(0);"
614
- class="a-link"
615
- onclick={() => {
616
- this.deleteSaleOrgItem(row, rowIndex, $table);
617
- }}
618
- >
619
- <el-tooltip enterable={false} effect="dark" content="删除" placement="top"
620
- popper-class="tooltip-skin">
621
- <i class="el-icon-delete"/>
622
- </el-tooltip>
623
- </a>
624
- ];
625
- }
626
- }
627
- }
628
- }
629
- ]
630
- };
631
- this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
632
- // this.vxeOptionMap['saleOrgGridOption-'+companyCode] = opts;
633
- this.$set(this.vxeOptionMap, 'saleOrgGridOption-' + companyCode, opts);
634
- });
635
-
636
- },
637
- initUserRole(companyCode) {
638
- if (this.vxeOptionMap['userRoleGridOption-' + companyCode]) {
639
- return;
640
- }
641
- let userType = this.userType;
642
- const tableOption = {
643
- vue: this,
644
- tableRef: 'userRoleGrid-' + companyCode,
645
- tableName: 'editUser-userRoleGrid-' + companyCode,
646
- columns: [
647
- {type: 'checkbox', fixed: 'left', width: 48, resizable: false},
648
- {
649
- title: '角色名称',
650
- field: 'name',
651
- width: 200,
652
- slots: {
653
- default: ({row}) => {
654
- if (!row.isAdd) {
655
- return row.roleName;
656
- } else {
657
- return row.name;
658
- }
659
- }
660
- }
661
- },
662
- {
663
- width: 47,
664
- fixed: 'right',
665
- title: '',
666
- sortable: false,
667
- slots: {
668
- default: ({row, rowIndex, $table}) => {
669
- if (this.companyInfo.companyCode == row.companyCode) {
670
- return [
671
- <a
672
- href="javascript:void(0);"
673
- class="a-link"
674
- onclick={() => {
675
- this.deleteRoleItem(row, rowIndex, $table);
676
- }}
677
- >
678
- <el-tooltip enterable={false} effect="dark" content="删除" placement="top"
679
- popper-class="tooltip-skin">
680
- <i class="el-icon-delete"/>
681
- </el-tooltip>
682
- </a>
683
- ];
684
- }
685
- }
686
- }
687
- }
688
- ]
689
- };
690
- this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
691
- // this.vxeOptionMap['userRoleGridOption-'+companyCode] = opts;
692
- this.$set(this.vxeOptionMap, 'userRoleGridOption-' + companyCode, opts);
693
- });
694
- },
695
- confirmRole(rows) {
696
- if (rows.length > 0) {
697
- let outUserCodes = this.outUserCodes;
698
- if (this.userType === 1) {
699
- //企业用户
700
- rows = rows.filter(row => !outUserCodes.includes(row.code));
701
- } else if (this.userType === 2) {
702
- //外部用户
703
- rows = rows.filter(row => outUserCodes.includes(row.code));
704
- }
705
- let companyCode = this.companyInfo.companyCode;
706
- const $grid = this.$refs['userRoleGrid-' + companyCode][0];
707
- const tableData = this.gridRoleDataMap[companyCode];
708
- const map = {};
709
- tableData.forEach(function (item) {
710
- map[item.roleId] = 1;
711
- });
712
- var items = [];
713
- rows.forEach(row => {
714
- const item = {
715
- roleId: row.id,
716
- roleName: row.name,
717
- companyCode: companyCode,
718
- companyName: row.companyName
719
- };
720
- if (!map[item.roleId]) {
721
- items.push(item);
722
- }
723
- });
724
- // $grid.insertAt(items, -1);
725
- // this.user.userRoleDTOs = this.user.userRoleDTOs.concat(items);
726
- this.gridRoleDataMap[companyCode] = tableData.concat(items)
727
- $grid.loadData(this.gridRoleDataMap[companyCode])
728
- }
729
- },
730
- deleteRole(tableRef) {
731
- this.$baseConfirm('您确定要删除吗?').then(() => {
732
- /*const $grid = this.$refs.userRoleGrid;
733
- $grid.removeCheckboxRow();
734
- this.user.userRoleDTOs = $grid.getTableData().fullData;*/
735
- let companyCode = this.companyInfo.companyCode;
736
- const $grid = this.$refs[tableRef][0];
737
- $grid.removeCheckboxRow();
738
- this.gridRoleDataMap[companyCode] = $grid.getTableData().fullData;
739
-
740
- });
741
- },
742
- deleteRoleItem(row, index, $table) {
743
- $table.remove(row);
744
- this.gridRoleDataMap[row.companyCode].splice(index, 1);
745
- },
746
- confirmInsertCompany(rows, callback) {
747
- if (rows.length > 0) {
748
- const tableData = this.user.userCompanyInfoDTOs;
749
- const map = {};
750
- tableData.forEach(function (item) {
751
- map[item.companyCode] = 1;
752
- });
753
- var items = [];
754
- rows.forEach(row => {
755
- const item = {companyCode: row.companyCode, companyName: row.companyName, guid: null};
756
- if (!map[item.companyCode]) {
757
- items.push(item);
758
- }
759
- this.gridRoleDataMap[item.companyCode] = []
760
- this.gridSaleOrgDataMap[item.companyCode] = []
761
- });
762
- // $grid.insertAt(items, -1);
763
- this.user.userCompanyInfoDTOs.splice(0, 0, ...items);
764
- // this.user.userCompanyInfoDTOs = this.user.userCompanyInfoDTOs.concat(items);
765
- }
766
- callback && callback();
767
- },
768
- deleteCompany(row, index) {
769
- let companyCode = row.companyCode;
770
- this.user.userCompanyInfoDTOs.splice(index, 1);
771
- this.gridSaleOrgDataMap[row.companyCode] = [];
772
- this.gridRoleDataMap[row.companyCode] = [];
773
- this.user.userSaleOrgDTOs = this.user.userSaleOrgDTOs.filter(item => item.companyCode != companyCode);
774
- this.user.userRoleDTOs = this.user.userRoleDTOs.filter(item => item.companyCode != companyCode);
775
- },
776
- confirmInsertSaleOrg(rows) {
777
- if (rows.length > 0) {
778
- let companyCode = this.companyInfo.companyCode;
779
- const $grid = this.$refs['saleOrgGrid-' + companyCode][0];
780
- const tableData = this.gridSaleOrgDataMap[companyCode] || [];
781
- const map = {};
782
- tableData.forEach(function (item) {
783
- map[item.saleOrgId] = 1;
784
- });
785
-
786
- let roleMap = {};
787
- let newUserRoleDTOs = [];
788
- var items = [];
789
-
790
- rows.forEach((row, index) => {
791
- const item = {
792
- companyCode: companyCode,
793
- companyName: row.companyName,
794
- defaults: false,
795
- saleOrgName: row.name,
796
- treePathName: row.treePathName,
797
- userSaleOrgPositionDTOs: [],
798
- saleOrgId: row.id,
799
- sn: row.sn
800
- };
801
-
802
- if (!map[item.saleOrgId]) {
803
- items.push(item);
804
- if (row.roleId && !roleMap[row.roleId]) {
805
- const roleItem = {
806
- id: row.roleId,
807
- name: row.roleName,
808
- companyCode: companyCode,
809
- companyName: row.companyName
810
- };
811
- roleMap[row.roleId] = true;
812
- newUserRoleDTOs.push(roleItem);
813
- }
814
- }
815
- });
816
- if (items.length > 0 && tableData.length == 0) {
817
- items[0].defaults = true;
818
- }
819
- // this.user.userSaleOrgDTOs.push(...items);
820
- this.gridSaleOrgDataMap[companyCode] = tableData.concat(items)
821
- $grid.loadData(this.gridSaleOrgDataMap[companyCode])
822
- this.confirmRole(newUserRoleDTOs);
823
- }
824
- },
825
- openSelectPositionDialog(row, rowIndex, $table) {
826
- const userSaleOrgPositionDTOs = row.userSaleOrgPositionDTOs || [];
827
- const items = [];
828
- userSaleOrgPositionDTOs.forEach(userSaleOrgPositionDTO => {
829
- const item = {
830
- companyCode: userSaleOrgPositionDTO.companyCode,
831
- companyName: userSaleOrgPositionDTO.companyName,
832
- name: userSaleOrgPositionDTO.positionName,
833
- code: userSaleOrgPositionDTO.code,
834
- id: userSaleOrgPositionDTO.positionId
835
- };
836
- items.push(item);
837
- });
838
-
839
- this.positionDialogDatas = items;
840
- this.saleOrgPositionIndex = rowIndex;
841
- this.showPositionDialog = true;
842
- },
843
- confirmInsertPosition(rows) {
844
- let companyCode = this.companyInfo.companyCode;
845
- const saleOrgPositionIndex = this.saleOrgPositionIndex;
846
- const tableData = this.gridSaleOrgDataMap[companyCode];
847
- if (rows.length > 0) {
848
- const oldPositions = tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs || [];
849
- const map = {};
850
- oldPositions.forEach(function (item) {
851
- map[item.positionId] = item;
852
- });
853
- var oItems = [];
854
- var items = [];
855
- rows.forEach(row => {
856
- const item = {
857
- companyCode: row.companyCode,
858
- companyName: row.companyName,
859
- positionName: row.name,
860
- code: row.code,
861
- positionId: row.id
862
- };
863
-
864
- if (!map[item.positionId]) {
865
- items.push(item);
866
- } else {
867
- oItems.push(map[item.positionId]);
868
- }
869
- });
870
- tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs = oItems.concat(items);
871
- } else {
872
- tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs = [];
873
- }
874
- this.$forceUpdate();
875
- },
876
- getSelectPositionName(row) {
877
- var userSaleOrgPositions = row.userSaleOrgPositionDTOs || [];
878
- var allName = '';
879
- userSaleOrgPositions.forEach(function (pItem, pIndex) {
880
- allName = allName + ',' + pItem.positionName;
881
- });
882
- if (allName) {
883
- allName = allName.substr(1);
884
- }
885
- return allName;
886
- },
887
- getConpanyInfo() {
888
- this.$http({
889
- url: USER_PREFIX + '/company_info/getCurrent',
890
- method: `post`,
891
- isLoading: true,
892
- success: res => {
893
- this.companyInfo = res.objx || {};
894
- let companyCode = this.companyInfo.companyCode;
895
- if (!this.isEdit) {
896
- this.addCurrentCompany();
897
- } else {
898
- this.getCompanyInfoData(() => {
899
- this.getUserRoleData();
900
- this.getSaleOrgData();
901
- setTimeout(() => {
902
- this.user.userCompanyInfoDTOs.forEach(userCompanyInfoDTO => {
903
- this.initSaleOrg(userCompanyInfoDTO.companyCode);
904
- this.initUserRole(userCompanyInfoDTO.companyCode);
905
- })
906
- }, 100)
907
- });
908
- }
909
- }
910
- });
911
- },
912
- isCurrentCompany(companyCode) {
913
- return this.companyInfo.companyCode == companyCode;
914
- },
915
- addCurrentCompany(callback) {
916
- this.confirmInsertCompany([this.companyInfo], callback);
917
- setTimeout(() => {
918
- this.initSaleOrg(this.companyInfo.companyCode);
919
- this.initUserRole(this.companyInfo.companyCode);
920
- setTimeout(() => {
921
- if (this.userType === 2) {
922
- //经销商
923
- if (this.distributorRole) {
924
- this.confirmRole([this.distributorRole]);
925
- }
926
- }
927
- }, 100)
928
- }, 100)
929
-
930
-
931
- },
932
- handleData() {
933
- let saleOrgs = [];
934
- Object.keys(this.gridSaleOrgDataMap).forEach(companyCode => {
935
- saleOrgs.push(...this.gridSaleOrgDataMap[companyCode])
936
- });
937
- let roles = [];
938
- Object.keys(this.gridRoleDataMap).forEach(companyCode => {
939
- roles.push(...this.gridRoleDataMap[companyCode])
940
- });
941
- this.user.userRoleDTOs = roles;
942
- this.user.userSaleOrgDTOs = saleOrgs
943
- },
944
- initDistributorRole() {
945
- if (this.outUserCodes && this.outUserCodes.length == 1) {
946
- return this.$http({
947
- url: USER_PREFIX + '/role/list',
948
- method: 'post',
949
- success: res => {
950
- let roleList = res.objx || [];
951
- let distributorCode = this.outUserCodes[0];
952
- this.distributorRole = roleList.find(item => item.code == distributorCode);
953
- }
954
- });
955
- }
956
- },
957
- async initOutUserRoleCode() {
958
- //初始化外部用户编码
959
- return this.$http({
960
- url: USER_PREFIX + '/system_parameter/getByCode',
961
- method: 'post',
962
- data: {"code": "outUserRoleCode"},
963
- success: res => {
964
- let value = (!res.objx || !res.objx.value) ? "distributor" : res.objx.value;
965
- let codes = value.split(',');
966
- this.outUserCodes = codes;//外部用户编码
967
- this.initRoleDialogParam();//初始化角色弹框的查询参数
968
- }
969
- });
970
- },
971
- initRoleDialogParam() {
972
- //初始化角色弹框的查询参数
973
- if (this.userType == 1) {
974
- //企业用户
975
- this.roleDialogParam = {
976
- queryAll: true,
977
- neCodes: [...this.outUserCodes]
978
- };
979
- } else if (this.userType == 2) {
980
- //外部用户
981
- this.roleDialogParam = {
982
- queryAll: true,
983
- eqCodes: [...this.outUserCodes]
984
- };
985
- }
986
- },
987
- unlock() {
988
- this.$baseConfirm('您确定要解锁吗?').then(() => {
989
- var url = USER_PREFIX + '/user/unlockLoginAccount';
990
- this.$http({
991
- url: url,
992
- method: `post`,
993
- data: {
994
- id: this.user.id
995
- },
996
- isLoading: true,
997
- success: res => {
998
- this.$message({
999
- message: res.content,
1000
- type: 'success',
1001
- duration: 500,
1002
- onClose: t => {
1003
- this.$baseReload();
1004
- }
1005
- });
1006
- }
1007
- });
1008
- });
1009
- },
1010
- confirmCountry(rows) {
1011
- if (rows.length) {
1012
- let row = rows[0];
1013
- this.user.countryName = row.countryName;
1014
- this.user.countryCode = row.countryCode;
1015
- }
1016
- }
1017
- }
1018
- };
1019
- </script>
1
+ <template>
2
+ <div class="detail-wrap">
3
+ <el-form ref="editForm" :model="user">
4
+ <div class="d-header clearfix">
5
+ <div class="fl">
6
+ <i class="el-icon-info"/>
7
+ {{ dataId ? $t1('查看') : $t1('新增') }} {{ $t1('用户') }}
8
+ </div>
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('解锁') }}
14
+ </el-button>
15
+ <el-button type="primary" plain class="button-sty" @click="$baseReload()" icon="el-icon-refresh-right">
16
+ {{ $t1('重置') }}
17
+ </el-button>
18
+ <el-button type="primary" class="button-sty" icon="el-icon-check" @click="saveData">{{ $t1('保存') }}
19
+ </el-button>
20
+ </div>
21
+ </div>
22
+ <baseTabs>
23
+ <baseTabPane :label="$t1('基本信息')">
24
+ <template #default>
25
+ <table class="table-detail">
26
+ <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>
44
+
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>
57
+
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">
74
+ <el-input
75
+ size="small"
76
+ type="password"
77
+ v-model="user.rePassword"
78
+ show-password
79
+ maxlength="255"
80
+ autocomplete="off"
81
+ auto-complete="new-password"
82
+ lay-verify="confirmPass"
83
+ clearable
84
+ />
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>
129
+
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'">
140
+ GUID
141
+ </th>
142
+ <td v-if="flag!=='2'">
143
+ <el-form-item prop="guid" :rules="[{ required: false, trigger: 'blur' }]">
144
+ <el-input size="small" v-model="user.guid" maxlength="200" clearable/>
145
+ </el-form-item>
146
+ </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' }]">
159
+ <el-input
160
+ class="search-input"
161
+ v-model="user.countryName"
162
+ clearable
163
+ @clear="
164
+ user.countryName = null;
165
+ user.countryCode = null;
166
+ "
167
+ v-el-readonly
168
+ >
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>
182
+ <th>{{ $t1('头像') }}</th>
183
+ <td colspan="7">
184
+ <baseUpload :limit="1" accept="image/png, image/jpeg" multi="false" :file.sync="user.headPhotoUrl"
185
+ dataType="medium"></baseUpload>
186
+ </td>
187
+ </tr>
188
+ <tr>
189
+ <th>{{ $t1('创建人') }}</th>
190
+ <td>{{ user.createBy }}</td>
191
+ <th>{{ $t1('创建时间') }}</th>
192
+ <td>{{ user.createDate }}</td>
193
+ <th>{{ $t1('更新人') }}</th>
194
+ <td>{{ user.modifyBy }}</td>
195
+ <th>{{ $t1('更新时间') }}</th>
196
+ <td>{{ user.modifyDate }}</td>
197
+ </tr>
198
+ </tbody>
199
+ </table>
200
+ </template>
201
+ </baseTabPane>
202
+ <baseTabPane :label="$t1('组织信息')">
203
+ <template #button>
204
+ <el-button class="button-sty" @click="addCurrentCompany()" icon="el-icon-search" v-if="!hasCurrentCompany">
205
+ {{ $t1('新增组织权限') }}
206
+ </el-button>
207
+ </template>
208
+ <template #default>
209
+ <div class="style1">
210
+ <div class="d-item" v-for="(item,index1) in user.userCompanyInfoDTOs" :key="index1">
211
+ <div class="title">
212
+ <b>{{ item.companyName }}</b>
213
+ <el-button class="button-sty" icon="el-icon-delete" v-if="isCurrentCompany(item.companyCode)"
214
+ @click="deleteCompany(item,index1)">{{ $t1('删除') }}
215
+ </el-button>
216
+ </div>
217
+ <div class="title-form">
218
+ <span v-if="flag==='2'">
219
+ <el-form-item label="GUID" :prop="'userCompanyInfoDTOs.'+index1+'.guid'"
220
+ :rules="[{ required: false, trigger: 'blur' }]">
221
+ <el-input size="small" v-model="item.guid" maxlength="200" clearable/>
222
+ </el-form-item>
223
+ </span>
224
+ </div>
225
+ <div class="m-2">
226
+ <div class="d-item" style="width: 65%;">
227
+ <div class="title">
228
+ <b>{{ $t1('机构信息') }}</b>
229
+ <el-button class="button-sty" icon="el-icon-search" @click="showSaleOrgDialog = true"
230
+ v-if="isCurrentCompany(item.companyCode)">{{ $t1('选择机构') }}
231
+ </el-button>
232
+ </div>
233
+ <div class="grid-h">
234
+ <vxe-grid
235
+ :ref="'saleOrgGrid-'+item.companyCode"
236
+ :data="gridSaleOrgDataMap[item.companyCode]"
237
+ v-bind="vxeOptionMap['saleOrgGridOption-'+item.companyCode]"
238
+ @resizable-change="$vxeTableUtil.onColumnWitchChange"
239
+ @custom="$vxeTableUtil.customHandle">
240
+ <template #position="{row,rowIndex,$table}">
241
+ <el-input
242
+ class="search-input"
243
+ :value="getSelectPositionName(row)"
244
+ clearable
245
+ @clear="
246
+ row.userSaleOrgPositionDTOs = [];
247
+ $forceUpdate();
248
+ "
249
+ v-el-readonly
250
+ v-if="companyInfo.companyCode == row.companyCode"
251
+ >
252
+ <i slot="suffix" class="el-input__icon el-icon-search"
253
+ @click="openSelectPositionDialog(row, rowIndex, $table)"></i>
254
+ </el-input>
255
+ <template v-else>
256
+ {{ getSelectPositionName(row) }}
257
+ </template>
258
+ </template>
259
+ </vxe-grid>
260
+ </div>
261
+ </div>
262
+ <div class="d-item" style="width: 35%;">
263
+ <div class="title">
264
+ <b>{{ $t1('角色信息') }}</b>
265
+ <el-button class="button-sty" icon="el-icon-search" @click="showRoleDialog = true"
266
+ v-if="isCurrentCompany(item.companyCode)">{{ $t1('选择角色') }}
267
+ </el-button>
268
+ </div>
269
+ <div class="grid-h">
270
+ <vxe-grid
271
+ :ref="'userRoleGrid-'+item.companyCode"
272
+ :data="gridRoleDataMap[item.companyCode]"
273
+ v-bind="vxeOptionMap['userRoleGridOption-'+item.companyCode]"
274
+ @resizable-change="$vxeTableUtil.onColumnWitchChange"
275
+ @custom="$vxeTableUtil.customHandle"
276
+ ></vxe-grid>
277
+ </div>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </div>
282
+ </template>
283
+ </baseTabPane>
284
+ </baseTabs>
285
+ </el-form>
286
+ <roleDialog v-if="showRoleDialog" :visiable.sync="showRoleDialog" @confirm="confirmRole"
287
+ :param="roleDialogParam"/>
288
+ <companyDialog v-if="showCompanyDialog" :visiable.sync="showCompanyDialog" @confirm="confirmInsertCompany"/>
289
+ <saleOrgDialog v-if="showSaleOrgDialog" :visiable.sync="showSaleOrgDialog" @confirm="confirmInsertSaleOrg"
290
+ :param="{ queryAll: true }"/>
291
+ <positionDialog v-if="showPositionDialog" :visiable.sync="showPositionDialog" :rows="positionDialogDatas"
292
+ @confirm="confirmInsertPosition" :param="{ queryAll: true }"/>
293
+ <countryDialog v-if="showCountryDialog" :visiable.sync="showCountryDialog"
294
+ @confirm="confirmCountry" multi="false"/>
295
+ </div>
296
+ </template>
297
+
298
+ <script>
299
+ import xeUtils from "xe-utils";
300
+ /*import tempStorageButton from "@base/components/tempStorage/index.vue";*/
301
+
302
+
303
+ export default {
304
+ name: 'UserEdit',
305
+ components: {
306
+ roleDialog: () => import('../../../views/user/role/dialog.vue'),
307
+ companyDialog: () => import('../../../views/user/company_info/dialog.vue'),
308
+ saleOrgDialog: () => import('../../../views/user/sale_org/dialog.vue'),
309
+ positionDialog: () => import('../../../views/user/position/dialog.vue'),
310
+ countryDialog: () => import('../../../views/user/country/dialog.vue')/*,
311
+ tempStorageButton*/
312
+ },
313
+ props: ['_dataId', 'userType', 'flag'],
314
+ data() {
315
+ var validatePass = (rule, value, callback) => {
316
+ const isPassRequired = !this.dataId;
317
+ if (isPassRequired && (value == '' || value == undefined)) {
318
+ callback(new Error(this.$t1('密码不能为空')));
319
+ } else {
320
+ callback();
321
+ }
322
+ this.$refs.editForm.validateField('rePassword');
323
+ };
324
+ var validatePass2 = (rule, value, callback) => {
325
+ const isPassRequired = !this.dataId;
326
+ const rePassword = value != undefined ? value : '';
327
+ const password = this.user.password != undefined ? this.user.password : '';
328
+
329
+ if (isPassRequired && rePassword == '') {
330
+ callback(new Error(this.$t1('确认密码不能为空')));
331
+ } else if (rePassword != password) {
332
+ callback(new Error(this.$t1('两次输入密码不一致!')));
333
+ } else {
334
+ callback();
335
+ }
336
+ };
337
+
338
+ return {
339
+ dataId: '',
340
+ hBtn: true,
341
+ user: {
342
+ userCompanyInfoDTOs: [],
343
+ userSaleOrgDTOs: [],
344
+ userRoleDTOs: [],
345
+ gender: null,
346
+ enabled: true,
347
+ userType: null,
348
+ countryName: null,
349
+ countryCode: null
350
+ },
351
+ vxeOption: {},
352
+ companyInfoOption: {},
353
+ userRoleOption: {},
354
+ showRoleDialog: false,
355
+ showCompanyDialog: false,
356
+ showSaleOrgDialog: false,
357
+ showPositionDialog: false,
358
+ saleOrgPositionIndex: 0,
359
+ passRules: [{validator: validatePass, trigger: 'blur', required: false}],
360
+ pass2Rules: [{validator: validatePass2, trigger: 'blur', required: false}],
361
+ activeName: 'first',
362
+ userCustomerListDTO: {
363
+ userCustomerDTOs: []
364
+ },
365
+ customerOption: {},
366
+ showCustomerDialog: false,
367
+ exportOption: {
368
+ prefix: USER_PREFIX,
369
+ title: this.$t1('用户'),
370
+ codes: ["USEREXCEL", "USERPDF", "USERPRINT", "USERHIPRINT"],
371
+ param: () => {
372
+ return [{id: this.dataId}];
373
+ }
374
+ },
375
+ showExtendedProperties: false,
376
+ radio1: '0',
377
+ companyInfo: {},
378
+ vxeOptionMap: {},
379
+ gridRoleDataMap: {},
380
+ gridSaleOrgDataMap: {},
381
+ distributorCode: 'distributor',
382
+ distributorRole: null,
383
+ outUserCodes: [],
384
+ roleDialogParam: {queryAll: true},
385
+ tempStorageOption: {
386
+ storageType: "user",
387
+ data: () => {
388
+ this.handleData();
389
+ return this.user;
390
+ },
391
+ chooseConfirm: (tempStorageData) => {
392
+ this.user = tempStorageData;
393
+ this.gridSaleOrgDataMap = xeUtils.groupBy(this.user.userSaleOrgDTOs, 'companyCode');
394
+ this.gridRoleDataMap = xeUtils.groupBy(this.user.userRoleDTOs, 'companyCode');
395
+ },
396
+ saveConfirm: () => {
397
+ }
398
+ },
399
+ showCountryDialog: false
400
+ };
401
+ },
402
+ computed: {
403
+ hasCurrentCompany() {
404
+ return this.user.userCompanyInfoDTOs.find(item => item.companyCode == this.companyInfo.companyCode) != null;
405
+ }
406
+ },
407
+ created() {
408
+ if (this._dataId && !isNaN(this._dataId)) this.dataId = this._dataId;
409
+ },
410
+ async mounted() {
411
+
412
+ // this.getEainsGroupDTO();
413
+ await this.initOutUserRoleCode();
414
+ await this.initDistributorRole();
415
+ this.getData();
416
+ this.getConpanyInfo()
417
+ },
418
+ methods: {
419
+ getData() {
420
+ if (this.dataId && !isNaN(this.dataId)) {
421
+ this.isEdit = true;
422
+ this.$commonHttp({
423
+ url: USER_PREFIX + `/user/get`,
424
+ method: `post`,
425
+ data: {
426
+ id: this.dataId
427
+ },
428
+ isLoading: true,
429
+ modalStrictly: true,
430
+ success: res => {
431
+ let user = res.objx || {};
432
+ user.userCompanyInfoDTOs = this.user.userCompanyInfoDTOs;
433
+ user.userSaleOrgDTOs = this.user.userSaleOrgDTOs;
434
+ user.userRoleDTOs = this.user.userRoleDTOs;
435
+ this.user = user;
436
+ this.user.password = '';
437
+
438
+ this.showExtendedProperties = true;
439
+ }
440
+ });
441
+ } else {
442
+ this.user.gender = 1;
443
+ this.isEdit = false;
444
+ this.showExtendedProperties = true;
445
+ }
446
+ },
447
+ saveData() {
448
+ let companyCode = this.companyInfo.companyCode;
449
+ this.handleData();
450
+ if (this.userType == 2) {
451
+ //外部用户
452
+ let currentUserCompanyInfo = this.user.userCompanyInfoDTOs.find(item => item.companyCode == companyCode)
453
+ if (currentUserCompanyInfo) {
454
+ let rows = this.user.userRoleDTOs.filter(item => item.companyCode == companyCode);
455
+ if (!rows.length) {
456
+ this.$baseAlert(this.$t1('请维护角色'));
457
+ return
458
+ }
459
+ }
460
+
461
+ }
462
+ this.$refs.editForm.$baseValidate(valid => {
463
+ if (valid) {
464
+ this.$baseConfirm(this.$t1('您确定要保存吗?')).then(() => {
465
+ var url = USER_PREFIX + (this.isEdit ? '/user/update' : '/user/save');
466
+ this.$http({
467
+ url: url,
468
+ method: `post`,
469
+ data: this.user,
470
+ isLoading: true,
471
+ success: res => {
472
+ this.$message({
473
+ message: res.content,
474
+ type: 'success',
475
+ duration: 500,
476
+ onClose: t => {
477
+ if (this.isEdit) {
478
+ this.$baseReload();
479
+ } else {
480
+ this.$baseReload({
481
+ updateParam: {
482
+ _dataId: res.objx
483
+ }
484
+ });
485
+ }
486
+ }
487
+ });
488
+ }
489
+ });
490
+ });
491
+ }
492
+ });
493
+ },
494
+ getSaleOrgData() {
495
+ if (this.dataId) {
496
+ this.$http({
497
+ url: USER_PREFIX + '/user/getUserSaleOrg',
498
+ method: `post`,
499
+ data: {id: this.dataId},
500
+ isLoading: true,
501
+ modalStrictly: true,
502
+ success: res => {
503
+ // this.$refs.saleOrgGrid.loadData(res.objx || []);
504
+ let rows = res.objx || [];
505
+ if (rows.length) {
506
+ // this.gridSaleOrgDataMap = xeUtils.groupBy(rows, 'companyCode');
507
+ Object.assign(this.gridSaleOrgDataMap, xeUtils.groupBy(rows, 'companyCode'));
508
+ }
509
+ this.user.userSaleOrgDTOs = rows;
510
+ }
511
+ });
512
+ }
513
+ },
514
+ getUserRoleData() {
515
+ if (this.dataId) {
516
+ this.$http({
517
+ url: USER_PREFIX + '/user/getUserRole',
518
+ method: `post`,
519
+ data: {id: this.dataId},
520
+ isLoading: true,
521
+ modalStrictly: true,
522
+ success: res => {
523
+ let rows = res.objx || [];
524
+ if (rows.length) {
525
+ // this.gridRoleDataMap = xeUtils.groupBy(rows, 'companyCode');
526
+ Object.assign(this.gridRoleDataMap, xeUtils.groupBy(rows, 'companyCode'));
527
+ }
528
+ this.user.userRoleDTOs = rows;
529
+ }
530
+ });
531
+ }
532
+ },
533
+ deleteSaleOrgItem(row, index, $table) {
534
+ $table.remove(row);
535
+ this.gridSaleOrgDataMap[row.companyCode].splice(index, 1);
536
+ },
537
+ getCompanyInfoData(callback) {
538
+ if (this.dataId) {
539
+ this.$http({
540
+ url: USER_PREFIX + '/user/getUserCompanyInfo',
541
+ method: `post`,
542
+ data: {id: this.dataId},
543
+ isLoading: true,
544
+ modalStrictly: true,
545
+ success: res => {
546
+ let rows = res.objx || [];
547
+ rows.forEach(row => {
548
+ this.gridRoleDataMap[row.companyCode] = [];
549
+ this.gridSaleOrgDataMap[row.companyCode] = [];
550
+ })
551
+ this.user.userCompanyInfoDTOs = rows;
552
+ callback && callback();
553
+ }
554
+ });
555
+ }
556
+ },
557
+ initSaleOrg(companyCode) {
558
+ if (this.vxeOptionMap['saleOrgGridOption-' + companyCode]) {
559
+ return;
560
+ }
561
+ let tableRef = 'saleOrgGrid-' + companyCode;
562
+ const tableOption = {
563
+ vue: this,
564
+ tableRef: tableRef,
565
+ tableName: 'editUser-saleOrgGrid-' + companyCode,
566
+ columns: [
567
+ {type: 'checkbox', fixed: 'left', width: 48, resizable: false},
568
+ {title: this.$t1('机构名称'), field: 'saleOrgName', width: 200},
569
+ {title: this.$t1('机构编码'), field: 'sn', width: 200},
570
+ {title: this.$t1('上级机构'), field: 'treePathName', width: 200},
571
+ {
572
+ title: this.$t1('岗位'),
573
+ field: 'position',
574
+ width: 150,
575
+ slots: {
576
+ default: 'position'
577
+ }
578
+ },
579
+ {
580
+ title: this.$t1('是否默认'),
581
+ field: 'defaults',
582
+ width: 120,
583
+ slots: {
584
+ default: ({row, $table, rowIndex}) => {
585
+ var isDefault = row.defaults || false;
586
+ let disabled = this.companyInfo.companyCode != row.companyCode;
587
+ return [
588
+ <el-checkbox
589
+ v-model={isDefault}
590
+ disabled={disabled}
591
+ onchange={() => {
592
+ this.gridSaleOrgDataMap[row.companyCode].forEach((item, index) => {
593
+ if (index == rowIndex) {
594
+ item.defaults = true;
595
+ } else {
596
+ item.defaults = false;
597
+ }
598
+ });
599
+ }}
600
+ />
601
+ ];
602
+ }
603
+ }
604
+ },
605
+ {
606
+ width: 47,
607
+ fixed: 'right',
608
+ title: '',
609
+ sortable: false,
610
+ slots: {
611
+ default: ({row, rowIndex, $table}) => {
612
+ if (this.companyInfo.companyCode == row.companyCode) {
613
+ return [
614
+ <a
615
+ href="javascript:void(0);"
616
+ class="a-link"
617
+ onclick={() => {
618
+ this.deleteSaleOrgItem(row, rowIndex, $table);
619
+ }}
620
+ >
621
+ <el-tooltip enterable={false} effect="dark" content={this.$t1('删除')} placement="top"
622
+ popper-class="tooltip-skin">
623
+ <i class="el-icon-delete"/>
624
+ </el-tooltip>
625
+ </a>
626
+ ];
627
+ }
628
+ }
629
+ }
630
+ }
631
+ ]
632
+ };
633
+ this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
634
+ // this.vxeOptionMap['saleOrgGridOption-'+companyCode] = opts;
635
+ this.$set(this.vxeOptionMap, 'saleOrgGridOption-' + companyCode, opts);
636
+ });
637
+
638
+ },
639
+ initUserRole(companyCode) {
640
+ if (this.vxeOptionMap['userRoleGridOption-' + companyCode]) {
641
+ return;
642
+ }
643
+ let userType = this.userType;
644
+ const tableOption = {
645
+ vue: this,
646
+ tableRef: 'userRoleGrid-' + companyCode,
647
+ tableName: 'editUser-userRoleGrid-' + companyCode,
648
+ columns: [
649
+ {type: 'checkbox', fixed: 'left', width: 48, resizable: false},
650
+ {
651
+ title: this.$t1('角色名称'),
652
+ field: 'name',
653
+ width: 200,
654
+ slots: {
655
+ default: ({row}) => {
656
+ if (!row.isAdd) {
657
+ return row.roleName;
658
+ } else {
659
+ return row.name;
660
+ }
661
+ }
662
+ }
663
+ },
664
+ {
665
+ width: 47,
666
+ fixed: 'right',
667
+ title: '',
668
+ sortable: false,
669
+ slots: {
670
+ default: ({row, rowIndex, $table}) => {
671
+ if (this.companyInfo.companyCode == row.companyCode) {
672
+ return [
673
+ <a
674
+ href="javascript:void(0);"
675
+ class="a-link"
676
+ onclick={() => {
677
+ this.deleteRoleItem(row, rowIndex, $table);
678
+ }}
679
+ >
680
+ <el-tooltip enterable={false} effect="dark" content={this.$t1('删除')} placement="top"
681
+ popper-class="tooltip-skin">
682
+ <i class="el-icon-delete"/>
683
+ </el-tooltip>
684
+ </a>
685
+ ];
686
+ }
687
+ }
688
+ }
689
+ }
690
+ ]
691
+ };
692
+ this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
693
+ // this.vxeOptionMap['userRoleGridOption-'+companyCode] = opts;
694
+ this.$set(this.vxeOptionMap, 'userRoleGridOption-' + companyCode, opts);
695
+ });
696
+ },
697
+ confirmRole(rows) {
698
+ if (rows.length > 0) {
699
+ let outUserCodes = this.outUserCodes;
700
+ if (this.userType === 1) {
701
+ //企业用户
702
+ rows = rows.filter(row => !outUserCodes.includes(row.code));
703
+ } else if (this.userType === 2) {
704
+ //外部用户
705
+ rows = rows.filter(row => outUserCodes.includes(row.code));
706
+ }
707
+ let companyCode = this.companyInfo.companyCode;
708
+ const $grid = this.$refs['userRoleGrid-' + companyCode][0];
709
+ const tableData = this.gridRoleDataMap[companyCode];
710
+ const map = {};
711
+ tableData.forEach(function (item) {
712
+ map[item.roleId] = 1;
713
+ });
714
+ var items = [];
715
+ rows.forEach(row => {
716
+ const item = {
717
+ roleId: row.id,
718
+ roleName: row.name,
719
+ companyCode: companyCode,
720
+ companyName: row.companyName
721
+ };
722
+ if (!map[item.roleId]) {
723
+ items.push(item);
724
+ }
725
+ });
726
+ // $grid.insertAt(items, -1);
727
+ // this.user.userRoleDTOs = this.user.userRoleDTOs.concat(items);
728
+ this.gridRoleDataMap[companyCode] = tableData.concat(items)
729
+ $grid.loadData(this.gridRoleDataMap[companyCode])
730
+ }
731
+ },
732
+ deleteRole(tableRef) {
733
+ this.$baseConfirm(this.$t1('您确定要删除吗?')).then(() => {
734
+ /*const $grid = this.$refs.userRoleGrid;
735
+ $grid.removeCheckboxRow();
736
+ this.user.userRoleDTOs = $grid.getTableData().fullData;*/
737
+ let companyCode = this.companyInfo.companyCode;
738
+ const $grid = this.$refs[tableRef][0];
739
+ $grid.removeCheckboxRow();
740
+ this.gridRoleDataMap[companyCode] = $grid.getTableData().fullData;
741
+
742
+ });
743
+ },
744
+ deleteRoleItem(row, index, $table) {
745
+ $table.remove(row);
746
+ this.gridRoleDataMap[row.companyCode].splice(index, 1);
747
+ },
748
+ confirmInsertCompany(rows, callback) {
749
+ if (rows.length > 0) {
750
+ const tableData = this.user.userCompanyInfoDTOs;
751
+ const map = {};
752
+ tableData.forEach(function (item) {
753
+ map[item.companyCode] = 1;
754
+ });
755
+ var items = [];
756
+ rows.forEach(row => {
757
+ const item = {companyCode: row.companyCode, companyName: row.companyName, guid: null};
758
+ if (!map[item.companyCode]) {
759
+ items.push(item);
760
+ }
761
+ this.gridRoleDataMap[item.companyCode] = []
762
+ this.gridSaleOrgDataMap[item.companyCode] = []
763
+ });
764
+ // $grid.insertAt(items, -1);
765
+ this.user.userCompanyInfoDTOs.splice(0, 0, ...items);
766
+ // this.user.userCompanyInfoDTOs = this.user.userCompanyInfoDTOs.concat(items);
767
+ }
768
+ callback && callback();
769
+ },
770
+ deleteCompany(row, index) {
771
+ let companyCode = row.companyCode;
772
+ this.user.userCompanyInfoDTOs.splice(index, 1);
773
+ this.gridSaleOrgDataMap[row.companyCode] = [];
774
+ this.gridRoleDataMap[row.companyCode] = [];
775
+ this.user.userSaleOrgDTOs = this.user.userSaleOrgDTOs.filter(item => item.companyCode != companyCode);
776
+ this.user.userRoleDTOs = this.user.userRoleDTOs.filter(item => item.companyCode != companyCode);
777
+ },
778
+ confirmInsertSaleOrg(rows) {
779
+ if (rows.length > 0) {
780
+ let companyCode = this.companyInfo.companyCode;
781
+ const $grid = this.$refs['saleOrgGrid-' + companyCode][0];
782
+ const tableData = this.gridSaleOrgDataMap[companyCode] || [];
783
+ const map = {};
784
+ tableData.forEach(function (item) {
785
+ map[item.saleOrgId] = 1;
786
+ });
787
+
788
+ let roleMap = {};
789
+ let newUserRoleDTOs = [];
790
+ var items = [];
791
+
792
+ rows.forEach((row, index) => {
793
+ const item = {
794
+ companyCode: companyCode,
795
+ companyName: row.companyName,
796
+ defaults: false,
797
+ saleOrgName: row.name,
798
+ treePathName: row.treePathName,
799
+ userSaleOrgPositionDTOs: [],
800
+ saleOrgId: row.id,
801
+ sn: row.sn
802
+ };
803
+
804
+ if (!map[item.saleOrgId]) {
805
+ items.push(item);
806
+ if (row.roleId && !roleMap[row.roleId]) {
807
+ const roleItem = {
808
+ id: row.roleId,
809
+ name: row.roleName,
810
+ companyCode: companyCode,
811
+ companyName: row.companyName
812
+ };
813
+ roleMap[row.roleId] = true;
814
+ newUserRoleDTOs.push(roleItem);
815
+ }
816
+ }
817
+ });
818
+ if (items.length > 0 && tableData.length == 0) {
819
+ items[0].defaults = true;
820
+ }
821
+ // this.user.userSaleOrgDTOs.push(...items);
822
+ this.gridSaleOrgDataMap[companyCode] = tableData.concat(items)
823
+ $grid.loadData(this.gridSaleOrgDataMap[companyCode])
824
+ this.confirmRole(newUserRoleDTOs);
825
+ }
826
+ },
827
+ openSelectPositionDialog(row, rowIndex, $table) {
828
+ const userSaleOrgPositionDTOs = row.userSaleOrgPositionDTOs || [];
829
+ const items = [];
830
+ userSaleOrgPositionDTOs.forEach(userSaleOrgPositionDTO => {
831
+ const item = {
832
+ companyCode: userSaleOrgPositionDTO.companyCode,
833
+ companyName: userSaleOrgPositionDTO.companyName,
834
+ name: userSaleOrgPositionDTO.positionName,
835
+ code: userSaleOrgPositionDTO.code,
836
+ id: userSaleOrgPositionDTO.positionId
837
+ };
838
+ items.push(item);
839
+ });
840
+
841
+ this.positionDialogDatas = items;
842
+ this.saleOrgPositionIndex = rowIndex;
843
+ this.showPositionDialog = true;
844
+ },
845
+ confirmInsertPosition(rows) {
846
+ let companyCode = this.companyInfo.companyCode;
847
+ const saleOrgPositionIndex = this.saleOrgPositionIndex;
848
+ const tableData = this.gridSaleOrgDataMap[companyCode];
849
+ if (rows.length > 0) {
850
+ const oldPositions = tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs || [];
851
+ const map = {};
852
+ oldPositions.forEach(function (item) {
853
+ map[item.positionId] = item;
854
+ });
855
+ var oItems = [];
856
+ var items = [];
857
+ rows.forEach(row => {
858
+ const item = {
859
+ companyCode: row.companyCode,
860
+ companyName: row.companyName,
861
+ positionName: row.name,
862
+ code: row.code,
863
+ positionId: row.id
864
+ };
865
+
866
+ if (!map[item.positionId]) {
867
+ items.push(item);
868
+ } else {
869
+ oItems.push(map[item.positionId]);
870
+ }
871
+ });
872
+ tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs = oItems.concat(items);
873
+ } else {
874
+ tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs = [];
875
+ }
876
+ this.$forceUpdate();
877
+ },
878
+ getSelectPositionName(row) {
879
+ var userSaleOrgPositions = row.userSaleOrgPositionDTOs || [];
880
+ var allName = '';
881
+ userSaleOrgPositions.forEach(function (pItem, pIndex) {
882
+ allName = allName + ',' + pItem.positionName;
883
+ });
884
+ if (allName) {
885
+ allName = allName.substr(1);
886
+ }
887
+ return allName;
888
+ },
889
+ getConpanyInfo() {
890
+ this.$http({
891
+ url: USER_PREFIX + '/company_info/getCurrent',
892
+ method: `post`,
893
+ isLoading: true,
894
+ success: res => {
895
+ this.companyInfo = res.objx || {};
896
+ let companyCode = this.companyInfo.companyCode;
897
+ if (!this.isEdit) {
898
+ this.addCurrentCompany();
899
+ } else {
900
+ this.getCompanyInfoData(() => {
901
+ this.getUserRoleData();
902
+ this.getSaleOrgData();
903
+ setTimeout(() => {
904
+ this.user.userCompanyInfoDTOs.forEach(userCompanyInfoDTO => {
905
+ this.initSaleOrg(userCompanyInfoDTO.companyCode);
906
+ this.initUserRole(userCompanyInfoDTO.companyCode);
907
+ })
908
+ }, 100)
909
+ });
910
+ }
911
+ }
912
+ });
913
+ },
914
+ isCurrentCompany(companyCode) {
915
+ return this.companyInfo.companyCode == companyCode;
916
+ },
917
+ addCurrentCompany(callback) {
918
+ this.confirmInsertCompany([this.companyInfo], callback);
919
+ setTimeout(() => {
920
+ this.initSaleOrg(this.companyInfo.companyCode);
921
+ this.initUserRole(this.companyInfo.companyCode);
922
+ setTimeout(() => {
923
+ if (this.userType === 2) {
924
+ //经销商
925
+ if (this.distributorRole) {
926
+ this.confirmRole([this.distributorRole]);
927
+ }
928
+ }
929
+ }, 100)
930
+ }, 100)
931
+
932
+
933
+ },
934
+ handleData() {
935
+ let saleOrgs = [];
936
+ Object.keys(this.gridSaleOrgDataMap).forEach(companyCode => {
937
+ saleOrgs.push(...this.gridSaleOrgDataMap[companyCode])
938
+ });
939
+ let roles = [];
940
+ Object.keys(this.gridRoleDataMap).forEach(companyCode => {
941
+ roles.push(...this.gridRoleDataMap[companyCode])
942
+ });
943
+ this.user.userRoleDTOs = roles;
944
+ this.user.userSaleOrgDTOs = saleOrgs
945
+ },
946
+ initDistributorRole() {
947
+ if (this.outUserCodes && this.outUserCodes.length == 1) {
948
+ return this.$http({
949
+ url: USER_PREFIX + '/role/list',
950
+ method: 'post',
951
+ success: res => {
952
+ let roleList = res.objx || [];
953
+ let distributorCode = this.outUserCodes[0];
954
+ this.distributorRole = roleList.find(item => item.code == distributorCode);
955
+ }
956
+ });
957
+ }
958
+ },
959
+ async initOutUserRoleCode() {
960
+ //初始化外部用户编码
961
+ return this.$http({
962
+ url: USER_PREFIX + '/system_parameter/getByCode',
963
+ method: 'post',
964
+ data: {"code": "outUserRoleCode"},
965
+ success: res => {
966
+ let value = (!res.objx || !res.objx.value) ? "distributor" : res.objx.value;
967
+ let codes = value.split(',');
968
+ this.outUserCodes = codes;//外部用户编码
969
+ this.initRoleDialogParam();//初始化角色弹框的查询参数
970
+ }
971
+ });
972
+ },
973
+ initRoleDialogParam() {
974
+ //初始化角色弹框的查询参数
975
+ if (this.userType == 1) {
976
+ //企业用户
977
+ this.roleDialogParam = {
978
+ queryAll: true,
979
+ neCodes: [...this.outUserCodes]
980
+ };
981
+ } else if (this.userType == 2) {
982
+ //外部用户
983
+ this.roleDialogParam = {
984
+ queryAll: true,
985
+ eqCodes: [...this.outUserCodes]
986
+ };
987
+ }
988
+ },
989
+ unlock() {
990
+ this.$baseConfirm(this.$t1('您确定要解锁吗?')).then(() => {
991
+ var url = USER_PREFIX + '/user/unlockLoginAccount';
992
+ this.$http({
993
+ url: url,
994
+ method: `post`,
995
+ data: {
996
+ id: this.user.id
997
+ },
998
+ isLoading: true,
999
+ success: res => {
1000
+ this.$message({
1001
+ message: res.content,
1002
+ type: 'success',
1003
+ duration: 500,
1004
+ onClose: t => {
1005
+ this.$baseReload();
1006
+ }
1007
+ });
1008
+ }
1009
+ });
1010
+ });
1011
+ },
1012
+ confirmCountry(rows) {
1013
+ if (rows.length) {
1014
+ let row = rows[0];
1015
+ this.user.countryName = row.countryName;
1016
+ this.user.countryCode = row.countryCode;
1017
+ }
1018
+ }
1019
+ }
1020
+ };
1021
+ </script>