cloud-web-corejs 1.0.258 → 1.0.259

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 (248) hide show
  1. package/package.json +32 -25
  2. package/src/components/VabUpload/fileLibraryDialog.vue +296 -0
  3. package/src/components/VabUpload/index.js +22 -2
  4. package/src/components/VabUpload/index.vue +242 -231
  5. package/src/components/VabUpload/mixins/fileLibraryDialog.js +1112 -0
  6. package/src/components/VabUpload/mixins.js +1971 -1829
  7. package/src/components/VabUpload/privateProfileDialog.vue +2 -2
  8. package/src/components/baseArea/index.vue +1628 -0
  9. package/src/components/baseInputExport/mixins.js +48 -31
  10. package/src/components/baseInputNumber/index.vue +9 -9
  11. package/src/components/baseTabs/index.vue +16 -8
  12. package/src/components/code-editor/async.js +29 -0
  13. package/src/components/code-editor/index.vue +93 -4
  14. package/src/components/errorMsg/index.js +10 -9
  15. package/src/components/errorMsg/mixins.js +25 -23
  16. package/src/components/excelExport/exportFieldDialog.vue +40 -18
  17. package/src/components/excelExport/index.js +62 -3
  18. package/src/components/excelExport/index.vue +2 -1
  19. package/src/components/excelExport/mixins.js +496 -340
  20. package/src/components/excelImport/index.js +69 -7
  21. package/src/components/excelImport/mixins.js +841 -9
  22. package/src/components/fileLibrary/categoryMoveDialog.vue +109 -109
  23. package/src/components/fileLibrary/fileHistoryDialog.vue +1 -1
  24. package/src/components/fileLibrary/fileObjAuthDialog.vue +297 -298
  25. package/src/components/fileLibrary/fileObjAuthEdit.vue +1 -1
  26. package/src/components/fileLibrary/filterDialog.vue +1 -1
  27. package/src/components/fileLibrary/index.vue +1109 -1110
  28. package/src/components/fileLibrary/mixins/indexMixins.js +10 -0
  29. package/src/components/fileLibrary/propertiesDialog.vue +190 -190
  30. package/src/components/fileLibrary/recycleBinDialog.vue +237 -236
  31. package/src/components/formOplog/mixins.js +85 -80
  32. package/src/components/hiprint/view/design/index.vue +7 -2
  33. package/src/components/jsonImport/exportUtil.js +106 -0
  34. package/src/components/jsonImport/index.js +75 -50
  35. package/src/components/jsonImport/mixins.js +350 -348
  36. package/src/components/langImport/mixins.js +502 -500
  37. package/src/components/micro-view-host/contract.js +66 -0
  38. package/src/components/micro-view-host/index.vue +148 -0
  39. package/src/components/mobile/file/index.vue +10 -0
  40. package/src/components/mobile/wf/mixins/wfModifyDialogMixin.js +51 -47
  41. package/src/components/obsUpload/index.vue +234 -231
  42. package/src/components/obsUpload/mixins.js +1542 -1476
  43. package/src/components/onlineTalk/talkUserDialog.vue +1 -1
  44. package/src/components/table/CellSlot.vue +12 -10
  45. package/src/components/table/config.js +74 -1
  46. package/src/components/table/index.js +1208 -1
  47. package/src/components/table/tableFormMixin.js +285 -1
  48. package/src/components/table/util/index.js +38 -40
  49. package/src/components/table/vxeFilter/index.js +153 -2
  50. package/src/components/table/vxeFilter/mixin.js +305 -3
  51. package/src/components/tempStorage/tempStorageDialog.vue +1 -1
  52. package/src/components/vb-tabs/x-tabs.vue +10 -5
  53. package/src/components/wf/addTaskUserdialog.vue +1 -1
  54. package/src/components/wf/mixins/setCandidateDialog.js +217 -217
  55. package/src/components/wf/mixins/setCandidateDialog2.js +252 -252
  56. package/src/components/wf/wf.js +2224 -2203
  57. package/src/components/wf/wfUtil.js +2 -1
  58. package/src/components/xform/docs/2026-08 /345/210/227/350/241/250/345/257/274/345/207/272/350/204/261/346/225/217/345/210/227/345/211/224/351/231/244/350/220/275/345/234/260/346/226/207/346/241/243.md" +173 -0
  59. package/src/components/xform/form-designer/designer.js +1 -0
  60. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +110 -1
  61. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +282 -1
  62. package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +272 -0
  63. package/src/components/xform/form-designer/form-widget/field-widget/autocomplete-widget.vue +119 -0
  64. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +14 -0
  65. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +18 -73
  66. package/src/components/xform/form-designer/form-widget/field-widget/mixins/autocomplete-mixin.js +451 -0
  67. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +157 -0
  68. package/src/components/xform/form-designer/form-widget/field-widget/mixins/utc-transform-mixin.js +75 -0
  69. package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +112 -0
  70. package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +149 -0
  71. package/src/components/xform/form-designer/form-widget/indexMixin.js +179 -1
  72. package/src/components/xform/form-designer/indexMixin.js +823 -1
  73. package/src/components/xform/form-designer/refMixinDesign.js +27 -1
  74. package/src/components/xform/form-designer/setting-panel/action-button-config-dialog.vue +241 -0
  75. package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +601 -0
  76. package/src/components/xform/form-designer/setting-panel/form-setting.vue +6 -0
  77. package/src/components/xform/form-designer/setting-panel/index.vue +314 -309
  78. package/src/components/xform/form-designer/setting-panel/indexMixin.js +324 -1
  79. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +8 -7
  80. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +8 -7
  81. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +344 -0
  82. package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +2 -2
  83. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaDataType-editor.vue +25 -0
  84. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaMinLevel-editor.vue +50 -0
  85. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaName-editor.vue +20 -0
  86. package/src/components/xform/form-designer/setting-panel/property-editor/field-autocomplete/autocomplete-vabSearchName-editor.vue +199 -0
  87. package/src/components/xform/form-designer/setting-panel/property-editor/field-baseAttachment/baseAttachment-fileTypes-editor.vue +23 -0
  88. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/showAllLevels-editor.vue +21 -0
  89. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +157 -0
  90. package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +55 -0
  91. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/vabUpload-fileTypes-editor.vue +23 -0
  92. package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesEditorMixin.js +116 -0
  93. package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesSelect.vue +176 -0
  94. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +3 -3
  95. package/src/components/xform/form-designer/setting-panel/property-editor/utcTransformEnabled-editor.vue +19 -0
  96. package/src/components/xform/form-designer/setting-panel/widgetPropertyDialogMixin.js +186 -0
  97. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +566 -1
  98. package/src/components/xform/form-designer/widget-panel/indexMixin.js +290 -1
  99. package/src/components/xform/form-render/compareDelList.vue +83 -0
  100. package/src/components/xform/form-render/compareView.vue +76 -0
  101. package/src/components/xform/form-render/container-item/containerItemMixin.js +378 -1
  102. package/src/components/xform/form-render/container-item/data-table-mixin.js +35 -0
  103. package/src/components/xform/form-render/container-item/detail-item.vue +41 -0
  104. package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +285 -0
  105. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +416 -0
  106. package/src/components/xform/form-render/container-item/list-h5-item.vue +12 -0
  107. package/src/components/xform/form-render/dynamicDialogRender.js +195 -1
  108. package/src/components/xform/form-render/dynamicDrawerRender.js +229 -0
  109. package/src/components/xform/form-render/formDynamicFieldMixin.js +131 -0
  110. package/src/components/xform/form-render/refMixin.js +29 -1
  111. package/src/components/xform/mixins/scriptHttp.js +172 -1
  112. package/src/components/xform/utils/dynamicSchemaUtil.js +361 -0
  113. package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
  114. package/src/components/xform/utils/textMaskUtil.js +179 -0
  115. package/src/components/xform/utils/treeTableUtil.js +1265 -0
  116. package/src/components/xform/utils/util.js +1 -0
  117. package/src/components/xform/utils/validators.js +133 -1
  118. package/src/directive/LimitNumber/index.js +143 -124
  119. package/src/microRouter/index.js +447 -0
  120. package/src/mixins/tableTree/index.js +77 -14
  121. package/src/permission.js +132 -107
  122. package/src/public-path.js +38 -0
  123. package/src/router/index.js +3 -3
  124. package/src/store/modules/micro.js +57 -0
  125. package/src/store/modules/permission.js +535 -371
  126. package/src/store/modules/tagsView.js +38 -21
  127. package/src/store/modules/user.js +409 -370
  128. package/src/utils/aes.js +9 -3
  129. package/src/utils/auth.js +1 -1
  130. package/src/utils/componentDialog.js +162 -40
  131. package/src/utils/global.js +35 -34
  132. package/src/utils/index.js +579 -579
  133. package/src/utils/keepAlive.js +8 -4
  134. package/src/utils/lazyPlugin.js +66 -0
  135. package/src/utils/menuAdapter.js +277 -0
  136. package/src/utils/repeatOpen.js +48 -0
  137. package/src/utils/request.js +417 -395
  138. package/src/utils/resolveViewComponent.js +203 -0
  139. package/src/utils/vab.js +14 -3
  140. package/src/utils/validate.js +104 -106
  141. package/src/views/bd/setting/bd_attach_setting/dialog.vue +1 -1
  142. package/src/views/bd/setting/bd_attach_setting/list.vue +1 -1
  143. package/src/views/bd/setting/bd_company_env/dialog.vue +1 -1
  144. package/src/views/bd/setting/bd_company_env/list.vue +1 -1
  145. package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +488 -489
  146. package/src/views/bd/setting/form_import_log/list.vue +1 -1
  147. package/src/views/bd/setting/form_script/dialog.vue +1 -1
  148. package/src/views/bd/setting/form_script/form_list.vue +174 -166
  149. package/src/views/bd/setting/form_script/list.vue +1 -1
  150. package/src/views/bd/setting/form_script/list1.vue +1 -1
  151. package/src/views/bd/setting/form_script/mixins/form_list.js +330 -322
  152. package/src/views/bd/setting/form_template/dialog.vue +1 -1
  153. package/src/views/bd/setting/form_template/formDesignerDialog.vue +172 -171
  154. package/src/views/bd/setting/form_template/ftHistoryDialog.vue +1 -1
  155. package/src/views/bd/setting/form_template/itemList.vue +1 -1
  156. package/src/views/bd/setting/form_template/list.vue +3 -3
  157. package/src/views/bd/setting/form_template/mixins/edit.js +3 -3
  158. package/src/views/bd/setting/form_template/mixins/list.js +3 -3
  159. package/src/views/bd/setting/form_template/mixins/list2.js +3 -3
  160. package/src/views/bd/setting/form_template/mixins/wf_list.js +3 -3
  161. package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +253 -254
  162. package/src/views/bd/setting/form_template/wf_list.vue +3 -3
  163. package/src/views/bd/setting/logic_param/edit.vue +20 -20
  164. package/src/views/bd/setting/logic_param/list.vue +1 -1
  165. package/src/views/bd/setting/menu_kind/dialog.vue +1 -1
  166. package/src/views/bd/setting/menu_kind/list.vue +1 -1
  167. package/src/views/bd/setting/push_data/list.vue +1 -1
  168. package/src/views/bd/setting/push_data_h/list.vue +1 -1
  169. package/src/views/bd/setting/request_async_setting/list.vue +1 -1
  170. package/src/views/bd/setting/request_setting/list.vue +1 -1
  171. package/src/views/bd/setting/table_model/dialog.vue +1 -1
  172. package/src/views/bd/setting/table_model/list.vue +1 -1
  173. package/src/views/bd/setting/table_model/zdDialog.vue +1 -1
  174. package/src/views/user/access_log/list.vue +1 -1
  175. package/src/views/user/access_log/list2.vue +1 -1
  176. package/src/views/user/api_request/list.vue +1 -1
  177. package/src/views/user/area/dialog.vue +1 -1
  178. package/src/views/user/area/list.vue +1 -1
  179. package/src/views/user/bill_setting/list.vue +1 -1
  180. package/src/views/user/bill_setting/userDialog.vue +1 -1
  181. package/src/views/user/code_rules/list.vue +1 -1
  182. package/src/views/user/commMenu/index.vue +2 -2
  183. package/src/views/user/common_attribute/list.vue +2 -2
  184. package/src/views/user/common_script/list.vue +1 -1
  185. package/src/views/user/company_info/dialog.vue +1 -1
  186. package/src/views/user/country/dialog.vue +1 -1
  187. package/src/views/user/country/list.vue +1 -1
  188. package/src/views/user/data_type_setting/dialog.vue +1 -1
  189. package/src/views/user/extend_datasource/dialog.vue +4 -1
  190. package/src/views/user/extend_datasource/edit.vue +2 -1
  191. package/src/views/user/extend_datasource/list.vue +4 -1
  192. package/src/views/user/fieldTranslation/list.vue +1 -1
  193. package/src/views/user/field_values_invisible/list.vue +1 -1
  194. package/src/views/user/file_type/list.vue +1 -1
  195. package/src/views/user/file_view_area/list.vue +1 -1
  196. package/src/views/user/file_view_ins/list.vue +22 -1
  197. package/src/views/user/form/view/list.vue +64 -1
  198. package/src/views/user/groups/dialog.vue +1 -1
  199. package/src/views/user/groups/list.vue +1 -1
  200. package/src/views/user/home/default.vue +2 -2
  201. package/src/views/user/home/default2.vue +1158 -1148
  202. package/src/views/user/home/index.vue +3 -10
  203. package/src/views/user/lang_tag/dialog.vue +1 -1
  204. package/src/views/user/lang_tag/list.vue +1 -1
  205. package/src/views/user/language_setting/list.vue +1 -1
  206. package/src/views/user/login/default.vue +0 -8
  207. package/src/views/user/login/indexMixin.js +547 -556
  208. package/src/views/user/menu/list.vue +25 -2
  209. package/src/views/user/menuFallback/index.vue +123 -0
  210. package/src/views/user/mobile_menu/list.vue +1 -1
  211. package/src/views/user/notify_message/dialog.vue +22 -1
  212. package/src/views/user/notify_message/list.vue +1 -1
  213. package/src/views/user/notify_template/list.vue +1 -1
  214. package/src/views/user/notify_template/list2.vue +1 -1
  215. package/src/views/user/oplog/list.vue +1 -1
  216. package/src/views/user/outLink/form_view.vue +5 -14
  217. package/src/views/user/outLink/index.vue +6 -1
  218. package/src/views/user/outLink/view.vue +5 -13
  219. package/src/views/user/position/dialog.vue +1 -1
  220. package/src/views/user/position/list.vue +1 -1
  221. package/src/views/user/project_tag/dialog.vue +1 -1
  222. package/src/views/user/project_tag/list.vue +1 -1
  223. package/src/views/user/push_setting/list.vue +1 -1
  224. package/src/views/user/request_setting/list.vue +1 -1
  225. package/src/views/user/role/dialog.vue +1 -1
  226. package/src/views/user/role/list.vue +1 -1
  227. package/src/views/user/sale_org/dialog.vue +1 -1
  228. package/src/views/user/sale_org/list.vue +1 -1
  229. package/src/views/user/system_notice/list.vue +1 -1
  230. package/src/views/user/system_parameter/list.vue +1 -1
  231. package/src/views/user/user/dialog.vue +1 -1
  232. package/src/views/user/user/edit.vue +306 -159
  233. package/src/views/user/user/form_dialog.vue +1 -1
  234. package/src/views/user/user/form_list.vue +1 -1
  235. package/src/views/user/user/list.vue +2 -2
  236. package/src/views/user/user_log_classify/list.vue +1 -1
  237. package/src/views/user/wf/iframe/index.vue +6 -1
  238. package/src/views/user/wf/iframe/index2.vue +6 -1
  239. package/src/views/user/wf/wfReport/index.vue +12 -6
  240. package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -2
  241. package/src/views/user/wf/wf_manage/list.vue +97 -24
  242. package/src/views/user/wf/wf_manage/list2.vue +875 -0
  243. package/src/views/user/wf/wf_manage/wfContentDialog.vue +23 -1
  244. package/src/views/user/wf/wf_obj_config/dialog.vue +1 -1
  245. package/src/views/user/wf/wf_obj_config/list.vue +1 -1
  246. package/src/views/user/wf/wf_obj_config/list_form.vue +1 -1
  247. package/src/views/user/wf/wf_transfer_setting/list.vue +1 -1
  248. package/src/views/user/workbench_menu/list.vue +1 -1
@@ -347,6 +347,47 @@
347
347
  </el-form-item>
348
348
  </td>
349
349
  </tr>
350
+ <tr>
351
+ <th>{{ $t1("坐席ID") }}</th>
352
+ <td>
353
+ <el-input
354
+ size="small"
355
+ v-model="user.agentId"
356
+ maxlength="200"
357
+ clearable
358
+ />
359
+ </td>
360
+ <th>{{ $t1("技能组ID") }}</th>
361
+ <td>
362
+ <el-input
363
+ size="small"
364
+ v-model="user.groupId"
365
+ maxlength="200"
366
+ clearable
367
+ />
368
+ </td>
369
+ <th>{{ $t1("手机/sip号") }}</th>
370
+ <td>
371
+ <el-input
372
+ size="small"
373
+ v-model="user.voipAccount"
374
+ maxlength="200"
375
+ clearable
376
+ />
377
+ </td>
378
+ <th>{{ $t1("登录方式") }}</th>
379
+ <td>
380
+ <el-select
381
+ size="small"
382
+ v-model="user.callWay"
383
+ maxlength="200"
384
+ clearable
385
+ >
386
+ <el-option label="sip话机" value="2"></el-option>
387
+ <el-option label="手机" value="3"></el-option>
388
+ </el-select>
389
+ </td>
390
+ </tr>
350
391
  <tr>
351
392
  <th>{{ $t1("头像") }}</th>
352
393
  <td colspan="7">
@@ -389,7 +430,7 @@
389
430
  <div
390
431
  class="d-item"
391
432
  v-for="(item, index1) in user.userCompanyInfoDTOs"
392
- :key="index1"
433
+ :key="item.companyCode"
393
434
  >
394
435
  <div class="title">
395
436
  <b>{{ item.companyName }}</b>
@@ -397,7 +438,7 @@
397
438
  class="button-sty"
398
439
  icon="el-icon-delete"
399
440
  v-if="isCurrentCompany(item.companyCode)"
400
- @click="deleteCompany(item, index1)"
441
+ @click="deleteCompany(item)"
401
442
  >{{ $t1("删除") }}
402
443
  </el-button>
403
444
  </div>
@@ -449,22 +490,19 @@
449
490
  @resizable-change="$vxeTableUtil.onColumnWitchChange"
450
491
  @custom="$vxeTableUtil.customHandle"
451
492
  >
452
- <template #position="{ row, rowIndex, $table }">
493
+ <template #position="{ row }">
453
494
  <el-input
454
495
  class="search-input"
455
496
  :value="getSelectPositionName(row)"
456
497
  clearable
457
- @clear="
458
- row.userSaleOrgPositionDTOs = [];
459
- $forceUpdate();
460
- "
498
+ @clear="clearSaleOrgPosition(row)"
461
499
  v-el-readonly
462
500
  v-if="companyInfo.companyCode == row.companyCode"
463
501
  >
464
502
  <i
465
503
  slot="suffix"
466
504
  class="el-input__icon el-icon-search"
467
- @click="openSelectPositionDialog(row, rowIndex, $table)"
505
+ @click="openSelectPositionDialog(row)"
468
506
  ></i>
469
507
  </el-input>
470
508
  <template v-else>
@@ -508,11 +546,6 @@
508
546
  @confirm="confirmRole"
509
547
  :param="roleDialogParam"
510
548
  />
511
- <companyDialog
512
- v-if="showCompanyDialog"
513
- :visiable.sync="showCompanyDialog"
514
- @confirm="confirmInsertCompany"
515
- />
516
549
  <saleOrgDialog
517
550
  v-if="showSaleOrgDialog"
518
551
  :visiable.sync="showSaleOrgDialog"
@@ -542,14 +575,12 @@
542
575
  </template>
543
576
 
544
577
  <script>
545
- import xeUtils from "xe-utils";
546
578
  import tempStorageButton from "@base/components/tempStorage/index.vue";
547
579
 
548
580
  export default {
549
581
  name: "UserEdit",
550
582
  components: {
551
583
  roleDialog: () => import("../../../views/user/role/dialog.vue"),
552
- companyDialog: () => import("../../../views/user/company_info/dialog.vue"),
553
584
  saleOrgDialog: () => import("../../../views/user/sale_org/dialog.vue"),
554
585
  positionDialog: () => import("../../../views/user/position/dialog.vue"),
555
586
  countryDialog: () => import("../../../views/user/country/dialog.vue"),
@@ -570,7 +601,8 @@ export default {
570
601
  var validatePass2 = (rule, value, callback) => {
571
602
  const isPassRequired = !this.dataId;
572
603
  const rePassword = value != undefined ? value : "";
573
- const password = this.user.password != undefined ? this.user.password : "";
604
+ const password =
605
+ this.user.password != undefined ? this.user.password : "";
574
606
 
575
607
  if (isPassRequired && rePassword == "") {
576
608
  callback(new Error(this.$t1("确认密码不能为空")));
@@ -583,7 +615,7 @@ export default {
583
615
 
584
616
  return {
585
617
  dataId: "",
586
- hBtn: true,
618
+ isEdit: false,
587
619
  user: {
588
620
  userCompanyInfoDTOs: [],
589
621
  userSaleOrgDTOs: [],
@@ -596,23 +628,17 @@ export default {
596
628
  areaName: null,
597
629
  areaId: null,
598
630
  },
599
- companyTableData: [],
600
- vxeOption: {},
601
- companyInfoOption: {},
602
- userRoleOption: {},
603
631
  showRoleDialog: false,
604
- showCompanyDialog: false,
605
632
  showSaleOrgDialog: false,
606
633
  showPositionDialog: false,
607
- saleOrgPositionIndex: 0,
608
- passRules: [{ validator: validatePass, trigger: "blur", required: false }],
609
- pass2Rules: [{ validator: validatePass2, trigger: "blur", required: false }],
610
- activeName: "first",
611
- userCustomerListDTO: {
612
- userCustomerDTOs: [],
613
- },
614
- customerOption: {},
615
- showCustomerDialog: false,
634
+ positionDialogDatas: [],
635
+ positionDialogRow: null,
636
+ passRules: [
637
+ { validator: validatePass, trigger: "blur", required: false },
638
+ ],
639
+ pass2Rules: [
640
+ { validator: validatePass2, trigger: "blur", required: false },
641
+ ],
616
642
  exportOption: {
617
643
  prefix: USER_PREFIX,
618
644
  title: this.$t1("用户"),
@@ -621,11 +647,9 @@ export default {
621
647
  return [{ id: this.dataId }];
622
648
  },
623
649
  },
624
- showExtendedProperties: false,
625
- radio1: "0",
626
650
  companyInfo: {},
627
- distributorCode: "distributor",
628
651
  distributorRole: null,
652
+ unassignedTipShown: false,
629
653
  outUserCodes: [],
630
654
  roleDialogParam: { queryAll: true },
631
655
  tempStorageOption: {
@@ -636,11 +660,9 @@ export default {
636
660
  },
637
661
  chooseConfirm: (tempStorageData) => {
638
662
  this.user = tempStorageData;
639
- let map = xeUtils.groupBy(this.user.userRoleDTOs, "companyCode");
640
- Object.keys(map).forEach((key) => {
641
- let comapnyDTO = this.getCompanyDTO(key);
642
- comapnyDTO.roleData = map[key];
643
- });
663
+ // 暂存时 getReqFormData 把表格数据和表格配置都置空了,这里必须整体还原,
664
+ // 否则机构信息丢失、表格无列,且保存时 handleData 展开 null 会直接报错
665
+ this.restoreCompanyGrids();
644
666
  },
645
667
  saveConfirm: () => {},
646
668
  },
@@ -686,14 +708,11 @@ export default {
686
708
  user.userRoleDTOs = this.user.userRoleDTOs;
687
709
  this.user = user;
688
710
  this.user.password = "";
689
-
690
- this.showExtendedProperties = true;
691
711
  },
692
712
  });
693
713
  } else {
694
714
  this.user.gender = 1;
695
715
  this.isEdit = false;
696
- this.showExtendedProperties = true;
697
716
  }
698
717
  },
699
718
  getReqFormData() {
@@ -710,6 +729,11 @@ export default {
710
729
  ...this.user,
711
730
  userCompanyInfoDTOs,
712
731
  };
732
+ //编辑态不修改密码时不下发密码字段,避免被空值覆盖
733
+ if (this.isEdit && !formData.password) {
734
+ delete formData.password;
735
+ delete formData.rePassword;
736
+ }
713
737
  return formData;
714
738
  },
715
739
  saveData() {
@@ -733,7 +757,8 @@ export default {
733
757
  this.$refs.editForm.$baseValidate((valid) => {
734
758
  if (valid) {
735
759
  this.$baseConfirm(this.$t1("您确定要保存吗?")).then(() => {
736
- var url = USER_PREFIX + (this.isEdit ? "/user/update" : "/user/save");
760
+ var url =
761
+ USER_PREFIX + (this.isEdit ? "/user/update" : "/user/save");
737
762
  let formData = this.getReqFormData();
738
763
  this.$http({
739
764
  url: url,
@@ -772,16 +797,8 @@ export default {
772
797
  isLoading: true,
773
798
  modalStrictly: true,
774
799
  success: (res) => {
775
- // this.$refs.saleOrgGrid.loadData(res.objx || []);
776
- let rows = res.objx || [];
777
- if (rows.length) {
778
- let map = xeUtils.groupBy(rows, "companyCode");
779
- Object.keys(map).forEach((key) => {
780
- let companyDTO = this.getCompanyDTO(key);
781
- companyDTO.saleOrgData = map[key];
782
- });
783
- }
784
- this.user.userSaleOrgDTOs = rows;
800
+ this.user.userSaleOrgDTOs = res.objx || [];
801
+ this.initCompanyGrids(this.syncCompanyGrids());
785
802
  },
786
803
  });
787
804
  }
@@ -795,21 +812,20 @@ export default {
795
812
  isLoading: true,
796
813
  modalStrictly: true,
797
814
  success: (res) => {
798
- let rows = res.objx || [];
799
- if (rows.length) {
800
- let map = xeUtils.groupBy(rows, "companyCode");
801
- Object.keys(map).forEach((key) => {
802
- let companyDTO = this.getCompanyDTO(key);
803
- companyDTO.roleData = map[key];
804
- });
805
- }
806
- this.user.userRoleDTOs = rows;
815
+ this.user.userRoleDTOs = res.objx || [];
816
+ this.initCompanyGrids(this.syncCompanyGrids());
807
817
  },
808
818
  });
809
819
  }
810
820
  },
811
- deleteSaleOrgItem(row, index, $table) {
812
- this.getCompanyDTO(row.companyCode).saleOrgData.splice(index, 1);
821
+ deleteSaleOrgItem(row) {
822
+ const companyDTO = this.getCompanyDTO(row.companyCode);
823
+ const rows = (companyDTO && companyDTO.saleOrgData) || [];
824
+ // 用行对象定位,rowIndex 是渲染序,排序/过滤后会删错行
825
+ const index = rows.indexOf(row);
826
+ if (index > -1) {
827
+ rows.splice(index, 1);
828
+ }
813
829
  },
814
830
  getCompanyInfoData(callback) {
815
831
  if (this.dataId) {
@@ -821,7 +837,6 @@ export default {
821
837
  modalStrictly: true,
822
838
  success: (res) => {
823
839
  let rows = res.objx || [];
824
- let companyTableData = [];
825
840
  rows.forEach((row) => {
826
841
  Object.assign(row, {
827
842
  saleOrgGridOption: {},
@@ -839,7 +854,10 @@ export default {
839
854
  },
840
855
  initSaleOrg(companyCode) {
841
856
  let companyDTO = this.getCompanyDTO(companyCode);
842
- if (Object.keys(companyDTO.saleOrgGridOption).length) {
857
+ if (!companyDTO) {
858
+ return;
859
+ }
860
+ if (Object.keys(companyDTO.saleOrgGridOption || {}).length) {
843
861
  return;
844
862
  }
845
863
  let tableRef = "saleOrgGrid-" + companyCode;
@@ -865,23 +883,14 @@ export default {
865
883
  field: "defaults",
866
884
  width: 120,
867
885
  slots: {
868
- default: ({ row, $table, rowIndex }) => {
869
- var isDefault = row.defaults || false;
886
+ default: ({ row }) => {
870
887
  let disabled = this.companyInfo.companyCode != row.companyCode;
871
888
  return [
872
889
  <el-checkbox
873
- v-model={isDefault}
890
+ value={!!row.defaults}
874
891
  disabled={disabled}
875
- onchange={() => {
876
- let companyDTO = this.getCompanyDTO(row.companyCode);
877
- companyDTO.saleOrgData.forEach((item, index) => {
878
- if (index !== rowIndex) {
879
- item.defaults = false;
880
- }
881
- });
882
- this.$nextTick(() => {
883
- row.defaults = true;
884
- });
892
+ onchange={(checked) => {
893
+ this.changeSaleOrgDefault(row, checked);
885
894
  }}
886
895
  />,
887
896
  ];
@@ -894,14 +903,14 @@ export default {
894
903
  title: "",
895
904
  sortable: false,
896
905
  slots: {
897
- default: ({ row, rowIndex, $table }) => {
906
+ default: ({ row }) => {
898
907
  if (this.companyInfo.companyCode == row.companyCode) {
899
908
  return [
900
909
  <a
901
910
  href="javascript:void(0);"
902
911
  class="a-link"
903
912
  onclick={() => {
904
- this.deleteSaleOrgItem(row, rowIndex, $table);
913
+ this.deleteSaleOrgItem(row);
905
914
  }}
906
915
  >
907
916
  <el-tooltip
@@ -927,10 +936,12 @@ export default {
927
936
  },
928
937
  initUserRole(companyCode) {
929
938
  let companyDTO = this.getCompanyDTO(companyCode);
930
- if (Object.keys(companyDTO.roleGridOption).length) {
939
+ if (!companyDTO) {
940
+ return;
941
+ }
942
+ if (Object.keys(companyDTO.roleGridOption || {}).length) {
931
943
  return;
932
944
  }
933
- let userType = this.userType;
934
945
  const tableOption = {
935
946
  vue: this,
936
947
  tableRef: "userRoleGrid-" + companyCode,
@@ -942,13 +953,7 @@ export default {
942
953
  field: "name",
943
954
  width: 200,
944
955
  slots: {
945
- default: ({ row }) => {
946
- if (!row.isAdd) {
947
- return row.roleName;
948
- } else {
949
- return row.name;
950
- }
951
- },
956
+ default: ({ row }) => row.roleName || row.name,
952
957
  },
953
958
  },
954
959
  {
@@ -957,14 +962,14 @@ export default {
957
962
  title: "",
958
963
  sortable: false,
959
964
  slots: {
960
- default: ({ row, rowIndex, $table }) => {
965
+ default: ({ row }) => {
961
966
  if (this.companyInfo.companyCode == row.companyCode) {
962
967
  return [
963
968
  <a
964
969
  href="javascript:void(0);"
965
970
  class="a-link"
966
971
  onclick={() => {
967
- this.deleteRoleItem(row, rowIndex, $table);
972
+ this.deleteRoleItem(row);
968
973
  }}
969
974
  >
970
975
  <el-tooltip
@@ -992,17 +997,24 @@ export default {
992
997
  if (rows.length > 0) {
993
998
  let companyCode = this.companyInfo.companyCode;
994
999
  let companyDTO = this.getCompanyDTO(companyCode);
1000
+ if (!companyDTO) {
1001
+ return;
1002
+ }
995
1003
  let outUserCodes = this.outUserCodes;
996
- if (this.userType === 1) {
1004
+ // 由机构带出的角色没有 code,不参与内外部过滤,否则会被整批丢弃
1005
+ if (this.userType == 1) {
997
1006
  //组织用户
998
- rows = rows.filter((row) => !outUserCodes.includes(row.code));
999
- } else if (this.userType === 2) {
1007
+ rows = rows.filter(
1008
+ (row) => !row.code || !outUserCodes.includes(row.code)
1009
+ );
1010
+ } else if (this.userType == 2) {
1000
1011
  //外部用户
1001
- rows = rows.filter((row) => outUserCodes.includes(row.code));
1012
+ rows = rows.filter(
1013
+ (row) => !row.code || outUserCodes.includes(row.code)
1014
+ );
1002
1015
  }
1003
1016
 
1004
- const $grid = this.$refs["userRoleGrid-" + companyCode][0];
1005
- const tableData = companyDTO.roleData;
1017
+ const tableData = companyDTO.roleData || [];
1006
1018
  const map = {};
1007
1019
  tableData.forEach(function (item) {
1008
1020
  map[item.roleId] = 1;
@@ -1020,22 +1032,26 @@ export default {
1020
1032
  }
1021
1033
  });
1022
1034
 
1023
- companyDTO.roleData.push(...items);
1035
+ tableData.push(...items);
1036
+ companyDTO.roleData = tableData;
1024
1037
  }
1025
1038
  },
1026
- deleteRoleItem(row, index, $table) {
1027
- let companyDTO = this.getCompanyDTO(row.companyCode);
1028
- $table.remove(row);
1029
- companyDTO.roleData.splice(index, 1);
1039
+ deleteRoleItem(row) {
1040
+ const companyDTO = this.getCompanyDTO(row.companyCode);
1041
+ const rows = (companyDTO && companyDTO.roleData) || [];
1042
+ const index = rows.indexOf(row);
1043
+ if (index > -1) {
1044
+ rows.splice(index, 1);
1045
+ }
1030
1046
  },
1031
1047
  confirmInsertCompany(rows, callback) {
1048
+ const items = [];
1032
1049
  if (rows.length > 0) {
1033
1050
  const tableData = this.user.userCompanyInfoDTOs;
1034
1051
  const map = {};
1035
1052
  tableData.forEach(function (item) {
1036
1053
  map[item.companyCode] = 1;
1037
1054
  });
1038
- var items = [];
1039
1055
  rows.forEach((row) => {
1040
1056
  const item = {
1041
1057
  companyCode: row.companyCode,
@@ -1051,25 +1067,29 @@ export default {
1051
1067
  items.push(item);
1052
1068
  }
1053
1069
  });
1054
- // $grid.insertAt(items, -1);
1055
1070
  this.user.userCompanyInfoDTOs.splice(0, 0, ...items);
1056
1071
  if (this.user.userCompanyInfoDTOs.length == 1) {
1057
1072
  this.user.userCompanyInfoDTOs[0].defaults = true;
1058
1073
  }
1059
- // this.user.userCompanyInfoDTOs = this.user.userCompanyInfoDTOs.concat(items);
1074
+ // 该企业可能已经加载过角色/机构(组织数据缺失时尤其如此),需要回填,
1075
+ // 否则新建的卡片是两张空表,保存时 handleData 会把已有数据清掉
1076
+ items.forEach((item) => this.fillCompanyGrids(item));
1060
1077
  }
1061
1078
  callback && callback();
1079
+ return items;
1062
1080
  },
1063
- deleteCompany(row, index) {
1081
+ deleteCompany(row) {
1064
1082
  let companyCode = row.companyCode;
1065
- let companyDTO = this.getCompanyDTO(companyCode);
1066
- this.user.userCompanyInfoDTOs.splice(index, 1);
1067
- companyDTO.roleData = [];
1068
- companyDTO.saleOrgData = [];
1069
- this.user.userSaleOrgDTOs = this.user.userSaleOrgDTOs.filter(
1083
+ let index = this.user.userCompanyInfoDTOs.indexOf(row);
1084
+ if (index > -1) {
1085
+ this.user.userCompanyInfoDTOs.splice(index, 1);
1086
+ }
1087
+ row.roleData = [];
1088
+ row.saleOrgData = [];
1089
+ this.user.userSaleOrgDTOs = (this.user.userSaleOrgDTOs || []).filter(
1070
1090
  (item) => item.companyCode != companyCode
1071
1091
  );
1072
- this.user.userRoleDTOs = this.user.userRoleDTOs.filter(
1092
+ this.user.userRoleDTOs = (this.user.userRoleDTOs || []).filter(
1073
1093
  (item) => item.companyCode != companyCode
1074
1094
  );
1075
1095
  },
@@ -1077,7 +1097,9 @@ export default {
1077
1097
  if (rows.length > 0) {
1078
1098
  let companyCode = this.companyInfo.companyCode;
1079
1099
  let companyDTO = this.getCompanyDTO(companyCode);
1080
- const $grid = this.$refs["saleOrgGrid-" + companyCode][0];
1100
+ if (!companyDTO) {
1101
+ return;
1102
+ }
1081
1103
  const tableData = companyDTO.saleOrgData || [];
1082
1104
  const map = {};
1083
1105
  tableData.forEach(function (item) {
@@ -1088,7 +1110,7 @@ export default {
1088
1110
  let newUserRoleDTOs = [];
1089
1111
  var items = [];
1090
1112
 
1091
- rows.forEach((row, index) => {
1113
+ rows.forEach((row) => {
1092
1114
  const item = {
1093
1115
  companyCode: companyCode,
1094
1116
  companyName: row.companyName,
@@ -1118,11 +1140,12 @@ export default {
1118
1140
  items[0].defaults = true;
1119
1141
  }
1120
1142
 
1121
- companyDTO.saleOrgData.push(...items);
1143
+ tableData.push(...items);
1144
+ companyDTO.saleOrgData = tableData;
1122
1145
  this.confirmRole(newUserRoleDTOs);
1123
1146
  }
1124
1147
  },
1125
- openSelectPositionDialog(row, rowIndex, $table) {
1148
+ openSelectPositionDialog(row) {
1126
1149
  const userSaleOrgPositionDTOs = row.userSaleOrgPositionDTOs || [];
1127
1150
  const items = [];
1128
1151
  userSaleOrgPositionDTOs.forEach((userSaleOrgPositionDTO) => {
@@ -1137,17 +1160,17 @@ export default {
1137
1160
  });
1138
1161
 
1139
1162
  this.positionDialogDatas = items;
1140
- this.saleOrgPositionIndex = rowIndex;
1163
+ // 保存行对象而不是 rowIndex,避免排序/过滤后岗位写到别的机构上
1164
+ this.positionDialogRow = row;
1141
1165
  this.showPositionDialog = true;
1142
1166
  },
1143
1167
  confirmInsertPosition(rows) {
1144
- let companyCode = this.companyInfo.companyCode;
1145
- const saleOrgPositionIndex = this.saleOrgPositionIndex;
1146
- let companyDTO = this.getCompanyDTO(companyCode);
1147
- const tableData = companyDTO.saleOrgData || [];
1168
+ const saleOrgRow = this.positionDialogRow;
1169
+ if (!saleOrgRow) {
1170
+ return;
1171
+ }
1148
1172
  if (rows.length > 0) {
1149
- const oldPositions =
1150
- tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs || [];
1173
+ const oldPositions = saleOrgRow.userSaleOrgPositionDTOs || [];
1151
1174
  const map = {};
1152
1175
  oldPositions.forEach(function (item) {
1153
1176
  map[item.positionId] = item;
@@ -1169,22 +1192,15 @@ export default {
1169
1192
  oItems.push(map[item.positionId]);
1170
1193
  }
1171
1194
  });
1172
- tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs = oItems.concat(items);
1195
+ this.$set(saleOrgRow, "userSaleOrgPositionDTOs", oItems.concat(items));
1173
1196
  } else {
1174
- tableData[saleOrgPositionIndex].userSaleOrgPositionDTOs = [];
1197
+ this.$set(saleOrgRow, "userSaleOrgPositionDTOs", []);
1175
1198
  }
1176
1199
  this.$forceUpdate();
1177
1200
  },
1178
1201
  getSelectPositionName(row) {
1179
- var userSaleOrgPositions = row.userSaleOrgPositionDTOs || [];
1180
- var allName = "";
1181
- userSaleOrgPositions.forEach(function (pItem, pIndex) {
1182
- allName = allName + "," + pItem.positionName;
1183
- });
1184
- if (allName) {
1185
- allName = allName.substr(1);
1186
- }
1187
- return allName;
1202
+ const userSaleOrgPositions = row.userSaleOrgPositionDTOs || [];
1203
+ return userSaleOrgPositions.map((item) => item.positionName).join(",");
1188
1204
  },
1189
1205
  getConpanyInfo() {
1190
1206
  this.$http({
@@ -1193,19 +1209,13 @@ export default {
1193
1209
  isLoading: true,
1194
1210
  success: (res) => {
1195
1211
  this.companyInfo = res.objx || {};
1196
- let companyCode = this.companyInfo.companyCode;
1197
1212
  if (!this.isEdit) {
1198
1213
  this.addCurrentCompany();
1199
1214
  } else {
1200
1215
  this.getCompanyInfoData(() => {
1201
1216
  this.getUserRoleData();
1202
1217
  this.getSaleOrgData();
1203
- setTimeout(() => {
1204
- this.user.userCompanyInfoDTOs.forEach((userCompanyInfoDTO) => {
1205
- this.initSaleOrg(userCompanyInfoDTO.companyCode);
1206
- this.initUserRole(userCompanyInfoDTO.companyCode);
1207
- });
1208
- }, 100);
1218
+ this.initCompanyGrids(this.user.userCompanyInfoDTOs);
1209
1219
  });
1210
1220
  }
1211
1221
  },
@@ -1215,26 +1225,19 @@ export default {
1215
1225
  return this.companyInfo.companyCode == companyCode;
1216
1226
  },
1217
1227
  addCurrentCompany(callback) {
1218
- this.confirmInsertCompany([this.companyInfo], callback);
1219
- setTimeout(() => {
1220
- this.initSaleOrg(this.companyInfo.companyCode);
1221
- this.initUserRole(this.companyInfo.companyCode);
1222
- setTimeout(() => {
1223
- if (this.userType === 2) {
1224
- //经销商
1225
- if (this.distributorRole) {
1226
- this.confirmRole([this.distributorRole]);
1227
- }
1228
- }
1229
- }, 100);
1230
- }, 100);
1228
+ const items = this.confirmInsertCompany([this.companyInfo], callback);
1229
+ if (this.userType == 2 && this.distributorRole) {
1230
+ //经销商,默认带出经销商角色
1231
+ this.confirmRole([this.distributorRole]);
1232
+ }
1233
+ this.initCompanyGrids(items);
1231
1234
  },
1232
1235
  handleData() {
1233
1236
  let saleOrgs = [];
1234
1237
  let roles = [];
1235
1238
  this.user.userCompanyInfoDTOs.forEach((companyDTO) => {
1236
- saleOrgs.push(...companyDTO.saleOrgData);
1237
- roles.push(...companyDTO.roleData);
1239
+ saleOrgs.push(...(companyDTO.saleOrgData || []));
1240
+ roles.push(...(companyDTO.roleData || []));
1238
1241
  });
1239
1242
 
1240
1243
  this.user.userRoleDTOs = roles;
@@ -1248,7 +1251,9 @@ export default {
1248
1251
  success: (res) => {
1249
1252
  let roleList = res.objx || [];
1250
1253
  let distributorCode = this.outUserCodes[0];
1251
- this.distributorRole = roleList.find((item) => item.code == distributorCode);
1254
+ this.distributorRole = roleList.find(
1255
+ (item) => item.code == distributorCode
1256
+ );
1252
1257
  },
1253
1258
  });
1254
1259
  }
@@ -1260,7 +1265,8 @@ export default {
1260
1265
  method: "post",
1261
1266
  data: { code: "outUserRoleCode" },
1262
1267
  success: (res) => {
1263
- let value = !res.objx || !res.objx.value ? "distributor" : res.objx.value;
1268
+ let value =
1269
+ !res.objx || !res.objx.value ? "distributor" : res.objx.value;
1264
1270
  let codes = value.split(",");
1265
1271
  this.outUserCodes = codes; //外部用户编码
1266
1272
  this.initRoleDialogParam(); //初始化角色弹框的查询参数
@@ -1319,7 +1325,148 @@ export default {
1319
1325
  this.user.userCompanyInfoDTOs.forEach((row) => {
1320
1326
  row.defaults = row.companyCode == companyCode;
1321
1327
  });
1328
+ } else {
1329
+ // 至少保留一个默认组织,取消唯一的默认项时回填
1330
+ let hasDefault = this.user.userCompanyInfoDTOs.some(
1331
+ (row) => row.defaults
1332
+ );
1333
+ if (!hasDefault) {
1334
+ item.defaults = true;
1335
+ }
1336
+ }
1337
+ },
1338
+ changeSaleOrgDefault(row, checked) {
1339
+ const companyDTO = this.getCompanyDTO(row.companyCode);
1340
+ const rows = (companyDTO && companyDTO.saleOrgData) || [];
1341
+ rows.forEach((item) => {
1342
+ if (item === row) {
1343
+ this.$set(item, "defaults", !!checked);
1344
+ } else if (checked) {
1345
+ this.$set(item, "defaults", false);
1346
+ }
1347
+ });
1348
+ },
1349
+ clearSaleOrgPosition(row) {
1350
+ this.$set(row, "userSaleOrgPositionDTOs", []);
1351
+ this.$forceUpdate();
1352
+ },
1353
+ normalizeSaleOrgRow(row) {
1354
+ //后端返回的机构行可能缺字段,先补齐保证响应式
1355
+ if (row.defaults === undefined) {
1356
+ this.$set(row, "defaults", false);
1357
+ }
1358
+ if (!row.userSaleOrgPositionDTOs) {
1359
+ this.$set(row, "userSaleOrgPositionDTOs", []);
1322
1360
  }
1361
+ return row;
1362
+ },
1363
+ // userRoleDTOs / userSaleOrgDTOs 是唯一事实源,这里统一分发到各组织卡片。
1364
+ // handleData 保存时只认组织卡片里的数据,所以任何没有归属组织的行都必须
1365
+ // 补出一张组织卡片,否则用户点一次保存就被静默删掉了。
1366
+ // 返回本次补建的组织卡片,交给调用方决定何时初始化表格。
1367
+ syncCompanyGrids() {
1368
+ this.dropUnassignedRows();
1369
+ const items = this.getLackCompanyCodes().map((companyCode) => {
1370
+ return {
1371
+ companyCode: companyCode,
1372
+ companyName: this.getRowCompanyName(companyCode),
1373
+ guid: null,
1374
+ defaults: false,
1375
+ saleOrgGridOption: {},
1376
+ roleGridOption: {},
1377
+ saleOrgData: [],
1378
+ roleData: [],
1379
+ };
1380
+ });
1381
+ if (items.length) {
1382
+ this.user.userCompanyInfoDTOs.push(...items);
1383
+ }
1384
+ this.user.userCompanyInfoDTOs.forEach((companyDTO) =>
1385
+ this.fillCompanyGrids(companyDTO)
1386
+ );
1387
+ return items;
1388
+ },
1389
+ fillCompanyGrids(companyDTO) {
1390
+ const companyCode = companyDTO.companyCode;
1391
+ const saleOrgData = (this.user.userSaleOrgDTOs || []).filter(
1392
+ (row) => row.companyCode == companyCode
1393
+ );
1394
+ saleOrgData.forEach((row) => this.normalizeSaleOrgRow(row));
1395
+ this.$set(companyDTO, "saleOrgData", saleOrgData);
1396
+ this.$set(
1397
+ companyDTO,
1398
+ "roleData",
1399
+ (this.user.userRoleDTOs || []).filter(
1400
+ (row) => row.companyCode == companyCode
1401
+ )
1402
+ );
1403
+ },
1404
+ getLackCompanyCodes() {
1405
+ //有角色/机构数据、但没有对应组织的企业编码
1406
+ const rows = (this.user.userSaleOrgDTOs || []).concat(
1407
+ this.user.userRoleDTOs || []
1408
+ );
1409
+ const codes = [];
1410
+ rows.forEach((row) => {
1411
+ const companyCode = row.companyCode;
1412
+ if (codes.includes(companyCode) || this.getCompanyDTO(companyCode)) {
1413
+ return;
1414
+ }
1415
+ codes.push(companyCode);
1416
+ });
1417
+ return codes;
1418
+ },
1419
+ getRowCompanyName(companyCode) {
1420
+ const rows = (this.user.userSaleOrgDTOs || []).concat(
1421
+ this.user.userRoleDTOs || []
1422
+ );
1423
+ const row = rows.find(
1424
+ (item) => item.companyCode == companyCode && item.companyName
1425
+ );
1426
+ return row ? row.companyName : companyCode;
1427
+ },
1428
+ dropUnassignedRows() {
1429
+ //companyCode 为空的行补不出有效组织,保留会往提交体里塞一条空组织关系
1430
+ const isUnassigned = (row) => {
1431
+ const code = row.companyCode;
1432
+ return code === null || code === undefined || code === "";
1433
+ };
1434
+ const roles = this.user.userRoleDTOs || [];
1435
+ const saleOrgs = this.user.userSaleOrgDTOs || [];
1436
+ const badRows = roles.filter(isUnassigned).concat(
1437
+ saleOrgs.filter(isUnassigned)
1438
+ );
1439
+ if (!badRows.length) {
1440
+ return;
1441
+ }
1442
+ this.user.userRoleDTOs = roles.filter((row) => !isUnassigned(row));
1443
+ this.user.userSaleOrgDTOs = saleOrgs.filter((row) => !isUnassigned(row));
1444
+ console.warn("[UserEdit] 忽略未归属组织的角色/机构数据", badRows);
1445
+ if (this.unassignedTipShown) {
1446
+ return;
1447
+ }
1448
+ this.unassignedTipShown = true;
1449
+ this.$baseAlert(this.$t1("存在未归属组织的角色/机构数据,已忽略"));
1450
+ },
1451
+ initCompanyGrids(companyDTOs) {
1452
+ if (!companyDTOs || !companyDTOs.length) {
1453
+ return;
1454
+ }
1455
+ this.$nextTick(() => {
1456
+ companyDTOs.forEach((companyDTO) => {
1457
+ this.initSaleOrg(companyDTO.companyCode);
1458
+ this.initUserRole(companyDTO.companyCode);
1459
+ });
1460
+ });
1461
+ },
1462
+ restoreCompanyGrids() {
1463
+ //暂存恢复:表格配置被置空过,需要连同表格一起重建
1464
+ (this.user.userCompanyInfoDTOs || []).forEach((companyDTO) => {
1465
+ this.$set(companyDTO, "saleOrgGridOption", {});
1466
+ this.$set(companyDTO, "roleGridOption", {});
1467
+ });
1468
+ this.syncCompanyGrids();
1469
+ this.initCompanyGrids(this.user.userCompanyInfoDTOs);
1323
1470
  },
1324
1471
  getCompanyDTO(companyCode) {
1325
1472
  return this.user.userCompanyInfoDTOs.find(