cloud-web-corejs 1.0.281 → 1.1.0-dev.11

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 (175) hide show
  1. package/package.json +6 -2
  2. package/src/components/VabUpload/image-viewer.vue +442 -442
  3. package/src/components/VabUpload/index.vue +45 -3
  4. package/src/components/VabUpload/mixins.js +126 -19
  5. package/src/components/VabUpload/view.vue +248 -209
  6. package/src/components/baseTabs/mixins.js +181 -181
  7. package/src/components/bizTab/BizBillActions.vue +129 -0
  8. package/src/components/bizTab/BizTabListPage.vue +391 -0
  9. package/src/components/bizTab/README.md +378 -0
  10. package/src/components/bizTab/billTableUtil.js +48 -0
  11. package/src/components/bizTab/billValidators.js +136 -0
  12. package/src/components/bizTab/bizBillDetailMixin.js +705 -0
  13. package/src/components/bizTab/index.js +24 -0
  14. package/src/components/excelExport/exportFieldDialog.vue +23 -12
  15. package/src/components/excelExport/exportItemConfigUtil.js +30 -0
  16. package/src/components/excelExport/mixins.js +3 -3
  17. package/src/components/excelImport/index.vue +156 -156
  18. package/src/components/jsonImport/index.vue +1 -1
  19. package/src/components/langImport/index.vue +1 -1
  20. package/src/components/mobile/statusTag/mixins.js +1 -61
  21. package/src/components/mobile/wf/addTaskUserdialog.vue +23 -3
  22. package/src/components/mobile/wf/content.vue +1705 -1556
  23. package/src/components/mobile/wf/deleteTaskUserDialog.vue +22 -3
  24. package/src/components/mobile/wf/mixins/wfModifyDialogMixin.js +8 -6
  25. package/src/components/mobile/wf/selectUserDialog.vue +118 -0
  26. package/src/components/mobile/wf/setCandidateDialog.vue +25 -4
  27. package/src/components/mobile/wf/urgingDialog.vue +26 -3
  28. package/src/components/mobile/wf/wfModifyDialog.vue +4 -0
  29. package/src/components/obsUpload/index.vue +1 -1
  30. package/src/components/table/config.js +78 -78
  31. package/src/components/table/index.js +1276 -1276
  32. package/src/components/table/plugins/cell-area/index.js +1055 -0
  33. package/src/components/table/plugins/cell-area/index.scss +77 -0
  34. package/src/components/table/plugins/cell-area/util.js +224 -0
  35. package/src/components/table/tableForm.vue +330 -330
  36. package/src/components/table/tableFormMixin.js +318 -318
  37. package/src/components/table/vxeFilter/index.js +163 -163
  38. package/src/components/table/vxeFilter/mixin.js +316 -316
  39. package/src/components/wf/content.vue +1188 -1188
  40. package/src/components/wf/wf.js +40 -20
  41. package/src/components/wf/wfActionDropdown.vue +1 -1
  42. package/src/components/wf/wfActionItems.js +1 -1
  43. package/src/components/xform/form-designer/designer.js +51 -52
  44. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +269 -269
  45. package/src/components/xform/form-designer/form-widget/container-widget/detail-h5-widget.vue +18 -2
  46. package/src/components/xform/form-designer/form-widget/container-widget/detail-temp-widget.vue +132 -0
  47. package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +250 -250
  48. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-pane-widget.vue +23 -2
  49. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-widget.vue +30 -1
  50. package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +319 -320
  51. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +365 -365
  52. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +185 -185
  53. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +554 -555
  54. package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +409 -409
  55. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +150 -132
  56. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +114 -114
  57. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +154 -154
  58. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +47 -1
  59. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +178 -178
  60. package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +77 -77
  61. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +6 -0
  62. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +139 -139
  63. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +1 -1
  64. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +106 -106
  65. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +134 -134
  66. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +3 -2
  67. package/src/components/xform/form-designer/indexMixin.js +35 -1
  68. package/src/components/xform/form-designer/setting-panel/form-setting.vue +39 -39
  69. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +10 -10
  70. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +438 -432
  71. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +2103 -2103
  72. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +90 -0
  73. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +82 -82
  74. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +833 -846
  75. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +8 -8
  76. package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +137 -137
  77. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +237 -237
  78. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +43 -43
  79. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +43 -43
  80. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +96 -96
  81. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +51 -0
  82. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +42 -42
  83. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +43 -43
  84. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +158 -158
  85. package/src/components/xform/form-designer/setting-panel/property-editor/h5Span-editor.vue +51 -0
  86. package/src/components/xform/form-designer/setting-panel/property-editor/itemStyle-editor.vue +39 -0
  87. package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +188 -188
  88. package/src/components/xform/form-designer/setting-panel/property-editor/styleTempClass-editor.vue +51 -0
  89. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +347 -347
  90. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +12 -0
  91. package/src/components/xform/form-designer/toolbar-panel/index.vue +884 -874
  92. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +14 -0
  93. package/src/components/xform/form-designer/widget-panel/index.vue +11 -7
  94. package/src/components/xform/form-designer/widget-panel/indexMixin.js +30 -6
  95. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +112 -4
  96. package/src/components/xform/form-render/container-item/data-table-mixin.js +151 -93
  97. package/src/components/xform/form-render/container-item/detail-h5-item.vue +204 -34
  98. package/src/components/xform/form-render/container-item/detail-temp-item.vue +110 -0
  99. package/src/components/xform/form-render/container-item/h5-card-pane-item.vue +160 -140
  100. package/src/components/xform/form-render/container-item/list-h5-item.vue +1913 -1699
  101. package/src/components/xform/form-render/index.vue +153 -147
  102. package/src/components/xform/form-render/indexMixin.js +35 -3
  103. package/src/components/xform/lang/en-US.js +14 -0
  104. package/src/components/xform/lang/zh-CN.js +17 -0
  105. package/src/components/xform/mixins/defaultHandle.js +707 -707
  106. package/src/components/xform/styles/h5.scss +2262 -0
  107. package/src/components/xform/utils/textMaskUtil.js +182 -179
  108. package/src/components/xform/utils/treeTableUtil.js +1292 -1265
  109. package/src/components/xform/utils/util.js +56 -11
  110. package/src/directive/append-to-body/index.js +48 -0
  111. package/src/index.js +13 -4
  112. package/src/layout/components/Sidebar/default.vue +1655 -1655
  113. package/src/layout/components/extractedCode/viewDialog.vue +7 -7
  114. package/src/router/index.js +48 -27
  115. package/src/router/modules/customer.js +71 -14
  116. package/src/store/modules/permission.js +17 -18
  117. package/src/utils/assetUrl.js +19 -0
  118. package/src/utils/pdfUtil.js +429 -429
  119. package/src/utils/resolveViewComponent.js +142 -16
  120. package/src/utils/vab.js +1283 -1279
  121. package/src/views/bd/project/branch/bd_branch/edit.vue +145 -0
  122. package/src/views/bd/project/branch/bd_branch/list.vue +72 -0
  123. package/src/views/bd/project/branch/bd_branch/menuKindDialog.vue +106 -0
  124. package/src/views/bd/project/branch/bd_branch/mixins/edit.js +189 -0
  125. package/src/views/bd/project/branch/bd_branch/mixins/list.js +124 -0
  126. package/src/views/bd/project/branch/bd_branch/mixins/menuKindDialog.js +85 -0
  127. package/src/views/bd/project/branch/form_script/list.vue +31 -0
  128. package/src/views/bd/project/branch/form_template/list.vue +30 -0
  129. package/src/views/bd/project/branch/menu_kind/list.vue +31 -0
  130. package/src/views/bd/project/common/form_script/list.vue +16 -0
  131. package/src/views/bd/project/common/form_template/list.vue +15 -0
  132. package/src/views/bd/project/common/menu_kind/list.vue +15 -0
  133. package/src/views/bd/project/core/branchContext.js +100 -0
  134. package/src/views/bd/project/core/branchPage.js +78 -0
  135. package/src/views/bd/project/core/branchPageWrap.vue +225 -0
  136. package/src/views/bd/project/core/branchScope.js +44 -0
  137. package/src/views/bd/project/core/branchSearchPage.js +285 -0
  138. package/src/views/bd/project/core/branchSelect.vue +85 -0
  139. package/src/views/bd/project/core/branchTreeBar.vue +81 -0
  140. package/src/views/bd/project/core/httpBranchPatch.js +58 -0
  141. package/src/views/bd/project/datatable/menu_kind/list.vue +15 -0
  142. package/src/views/bd/project/datatable/table_model/list.vue +15 -0
  143. package/src/views/bd/setting/bd_company_env/dialog.vue +174 -174
  144. package/src/views/bd/setting/form_template/edit.vue +378 -356
  145. package/src/views/bd/setting/form_template/formDesignerDialog.vue +6 -0
  146. package/src/views/bd/setting/form_template/formTemplateType.js +43 -0
  147. package/src/views/bd/setting/form_template/list.vue +304 -303
  148. package/src/views/bd/setting/form_template/mixins/edit.js +344 -280
  149. package/src/views/bd/setting/form_template/mixins/list.js +748 -721
  150. package/src/views/bd/setting/table_model/edit.vue +1066 -1066
  151. package/src/views/bd/setting/table_model/mixins/edit.js +1455 -1455
  152. package/src/views/bd/setting/table_model/mixins/zdDialog.js +148 -148
  153. package/src/views/support/form-dialog-demo/demoPickerDialog.vue +72 -0
  154. package/src/views/support/form-dialog-demo/index.vue +537 -0
  155. package/src/views/user/file_view_ins/list.vue +970 -970
  156. package/src/views/user/form/vform/designer.vue +823 -821
  157. package/src/views/user/home/default.vue +1117 -1117
  158. package/src/views/user/home/default2.vue +1 -1
  159. package/src/views/user/home/index.vue +103 -101
  160. package/src/views/user/notify_message/dialog.vue +139 -137
  161. package/src/views/user/outLink/form_view.vue +202 -202
  162. package/src/views/user/outLink/index.vue +110 -110
  163. package/src/views/user/outLink/view.vue +3 -3
  164. package/src/views/user/role/edit.vue +632 -632
  165. package/src/views/user/role/list.vue +260 -260
  166. package/src/views/user/wf/iframe/index.vue +51 -51
  167. package/src/views/user/wf/iframe/index2.vue +64 -64
  168. package/src/views/user/wf/wf_manage/list.vue +1112 -1116
  169. package/src/views/user/wf/wf_manage/list2.vue +871 -875
  170. package/src/views/user/wf/wf_manage/wfContentDialog.vue +134 -131
  171. package/src/views/user/wf/wf_obj_config/importItemDialog.vue +1 -1
  172. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +0 -106
  173. package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +0 -99
  174. package/src/components/xform/form-render/container-item/list-h5-item2.vue +0 -1340
  175. package/src/utils/wf.js +0 -766
@@ -0,0 +1,85 @@
1
+ import { selectDialogMixins } from "@base/mixins/selectDialog";
2
+ import { BRANCH_FLAG } from "../../../core/branchContext";
3
+
4
+ let modules = {};
5
+ modules = {
6
+ props: ["visiable", "multi", "rows"],
7
+ mixins: [selectDialogMixins],
8
+ created() {
9
+ this.initSetting();
10
+ },
11
+ mounted() {
12
+ this.initTableM1();
13
+ },
14
+ data() {
15
+ return {
16
+ showDialog: true,
17
+ falseValue: false,
18
+ selectMulti: true,
19
+ formData: {},
20
+ vxeOption: {},
21
+ };
22
+ },
23
+ methods: {
24
+ initTableM1() {
25
+ let that = this;
26
+ let tableOption = {
27
+ vue: that,
28
+ tableRef: "table-m1",
29
+ tableName: "bd_branch_menuKind_dialog-m1",
30
+ path: USER_PREFIX + "/menuKind/getAllList",
31
+ param: () => {
32
+ return {
33
+ ...this.formData,
34
+ // 只能选择「分类-通用」的一级分类
35
+ parent: 0,
36
+ enabled: true,
37
+ branchFlag: BRANCH_FLAG.COMMON,
38
+ };
39
+ },
40
+ // getAllList 返回的是普通数组而非分页对象
41
+ config: {
42
+ pagerConfig: {
43
+ autoHidden: true,
44
+ },
45
+ proxyConfig: {
46
+ props: {
47
+ result: "objx",
48
+ total: "objx.length",
49
+ },
50
+ },
51
+ checkboxConfig: {
52
+ showHeader: this.selectMulti,
53
+ trigger: "row",
54
+ },
55
+ },
56
+ columns: [
57
+ { type: "checkbox", width: 50, resizable: false, fixed: "left" },
58
+ {
59
+ title: this.$t1("表单分类名称"),
60
+ field: "name",
61
+ width: 250,
62
+ fixed: "left",
63
+ },
64
+ {
65
+ field: "menuKindCode",
66
+ title: this.$t1("表单分类编码"),
67
+ width: 180,
68
+ },
69
+ { field: "treePathName", title: this.$t1("上级分类"), width: 180 },
70
+ { field: "serviceName", title: this.$t1("服务名"), width: 150 },
71
+ {
72
+ width: 47,
73
+ fixed: "right",
74
+ title: "",
75
+ sortable: false,
76
+ },
77
+ ],
78
+ };
79
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
80
+ that.vxeOption = opts;
81
+ });
82
+ },
83
+ },
84
+ };
85
+ export default modules;
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <!-- 分支说明与「打开新分支」放在左侧树区域顶部,不再占用内容区工具条 -->
3
+ <branchPageWrap
4
+ :branchCode.sync="branchCode"
5
+ :branchLabel="branchLabel"
6
+ :show-bar="false"
7
+ @branch-change="onBranchChange"
8
+ >
9
+ <baseList :key="branchCode">
10
+ <template #treeTop>
11
+ <branchTreeBar
12
+ :branchLabel="branchLabel"
13
+ @open-new="openNewBranch"
14
+ ></branchTreeBar>
15
+ </template>
16
+ </baseList>
17
+ </branchPageWrap>
18
+ </template>
19
+
20
+ <script>
21
+ import branchPage from "../../core/branchPage";
22
+ import branchTreeBar from "../../core/branchTreeBar.vue";
23
+ // 逻辑脚本对应 scriptType=1 的 list1
24
+ import baseList from "@base/views/bd/setting/form_script/list1.vue";
25
+
26
+ export default {
27
+ name: "branch_form_script:list",
28
+ components: { baseList, branchTreeBar },
29
+ mixins: [branchPage],
30
+ };
31
+ </script>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <!-- 分支说明与「打开新分支」放在左侧树区域顶部,不再占用内容区工具条 -->
3
+ <branchPageWrap
4
+ :branchCode.sync="branchCode"
5
+ :branchLabel="branchLabel"
6
+ :show-bar="false"
7
+ @branch-change="onBranchChange"
8
+ >
9
+ <baseList :key="branchCode">
10
+ <template #treeTop>
11
+ <branchTreeBar
12
+ :branchLabel="branchLabel"
13
+ @open-new="openNewBranch"
14
+ ></branchTreeBar>
15
+ </template>
16
+ </baseList>
17
+ </branchPageWrap>
18
+ </template>
19
+
20
+ <script>
21
+ import branchPage from "../../core/branchPage";
22
+ import branchTreeBar from "../../core/branchTreeBar.vue";
23
+ import baseList from "@base/views/bd/setting/form_template/list.vue";
24
+
25
+ export default {
26
+ name: "branch_form_template:list",
27
+ components: { baseList, branchTreeBar },
28
+ mixins: [branchPage],
29
+ };
30
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <!-- 先选分支再进入,进入后分支作为第一个查询条件可继续切换;不提供「打开新分支」 -->
3
+ <branchPageWrap
4
+ :branchCode.sync="branchCode"
5
+ :branchLabel="branchLabel"
6
+ :show-bar="false"
7
+ :show-open-new="false"
8
+ @branch-change="onBranchChange"
9
+ >
10
+ <branchList :initBranchCode="branchCode" @branch-change="onBranchChange"></branchList>
11
+ </branchPageWrap>
12
+ </template>
13
+
14
+ <script>
15
+ import branchPage from "../../core/branchPage";
16
+ import branchSearchPage from "../../core/branchSearchPage";
17
+ import baseList from "@base/views/bd/setting/menu_kind/list.vue";
18
+
19
+ // 复用原分类列表,只把分支塞进查询条件
20
+ const branchList = {
21
+ name: "branch_menu_kind_list",
22
+ extends: baseList,
23
+ mixins: [branchSearchPage],
24
+ };
25
+
26
+ export default {
27
+ name: "branch_menu_kind:list",
28
+ components: { branchList },
29
+ mixins: [branchPage],
30
+ };
31
+ </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <baseList></baseList>
3
+ </template>
4
+
5
+ <script>
6
+ import branchScope from "../../core/branchScope";
7
+ import { BRANCH_FLAG } from "../../core/branchContext";
8
+ // 逻辑脚本对应 scriptType=1 的 list1
9
+ import baseList from "@base/views/bd/setting/form_script/list1.vue";
10
+
11
+ export default {
12
+ name: "common_form_script:list",
13
+ components: { baseList },
14
+ mixins: [branchScope(BRANCH_FLAG.COMMON)],
15
+ };
16
+ </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <baseList></baseList>
3
+ </template>
4
+
5
+ <script>
6
+ import branchScope from "../../core/branchScope";
7
+ import { BRANCH_FLAG } from "../../core/branchContext";
8
+ import baseList from "@base/views/bd/setting/form_template/list.vue";
9
+
10
+ export default {
11
+ name: "common_form_template:list",
12
+ components: { baseList },
13
+ mixins: [branchScope(BRANCH_FLAG.COMMON)],
14
+ };
15
+ </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <baseList></baseList>
3
+ </template>
4
+
5
+ <script>
6
+ import branchScope from "../../core/branchScope";
7
+ import { BRANCH_FLAG } from "../../core/branchContext";
8
+ import baseList from "@base/views/bd/setting/menu_kind/list.vue";
9
+
10
+ export default {
11
+ name: "common_menu_kind:list",
12
+ components: { baseList },
13
+ mixins: [branchScope(BRANCH_FLAG.COMMON)],
14
+ };
15
+ </script>
@@ -0,0 +1,100 @@
1
+ /**
2
+ * 分支作用域上下文。
3
+ *
4
+ * 通用工程/分支工程/数据表管理三组菜单直接复用 bd/setting 下的原页面组件,
5
+ * 原组件不感知分支,所以由外层壳组件在自身实例上挂一个作用域标记,
6
+ * 请求注入器沿组件树向上找到该标记后给请求补上 branchFlag / branchCode。
7
+ */
8
+
9
+ export const SCOPE_KEY = "__bdBranchScope__";
10
+
11
+ /** 分支标识:0通用工程 1分支工程 99数据表分类 */
12
+ export const BRANCH_FLAG = {
13
+ COMMON: 0,
14
+ BRANCH: 1,
15
+ DATA_TABLE: 99,
16
+ };
17
+
18
+ /**
19
+ * 只有后端 DTO 真正声明了 branchCode/branchFlag 的接口才允许注入,
20
+ * 否则多余字段会被反序列化拒绝。以路径结尾精确匹配。
21
+ */
22
+ const INJECT_URLS = [
23
+ "/menuKind/getAllList",
24
+ "/menuKind/getChildren",
25
+ "/menuKind/save",
26
+ "/menuKind/update",
27
+
28
+ "/formTemplate/listPage",
29
+ "/formTemplate/listOtherPage",
30
+ "/formTemplate/listPageWf",
31
+ "/formTemplate/save",
32
+ "/formTemplate/update",
33
+ "/formTemplate/updateDesign",
34
+
35
+ "/formScript/listPage",
36
+ "/formScript/listOtherPage",
37
+ "/formScript/save",
38
+ "/formScript/update",
39
+ "/formScript/saves",
40
+ "/formScript/getServiceName",
41
+
42
+ "/szTaMb/listPage",
43
+ "/szTaMb/listOtherPage",
44
+ "/szTaMb/save",
45
+ "/szTaMb/update",
46
+
47
+ "/formVersion/listPage",
48
+ "/form_oplog/listPage",
49
+ "/form_import_log/listPage",
50
+ ];
51
+
52
+ /**
53
+ * 脱离组件树创建的实例($jsonImport 动态弹框等)找不到父链,
54
+ * 由当前激活的分支页面兜底。
55
+ */
56
+ let fallbackScope = null;
57
+
58
+ export function setFallbackScope(scope) {
59
+ fallbackScope = scope || null;
60
+ }
61
+
62
+ export function getFallbackScope() {
63
+ return fallbackScope;
64
+ }
65
+
66
+ /** 沿 $parent 向上找最近的分支作用域,找不到则用兜底作用域 */
67
+ export function findScope(vm) {
68
+ let cur = vm;
69
+ while (cur) {
70
+ if (cur[SCOPE_KEY]) {
71
+ return cur[SCOPE_KEY];
72
+ }
73
+ cur = cur.$parent;
74
+ }
75
+ return fallbackScope;
76
+ }
77
+
78
+ export function needInject(url) {
79
+ if (!url) {
80
+ return false;
81
+ }
82
+ let path = url;
83
+ let qIndex = path.indexOf("?");
84
+ if (qIndex >= 0) {
85
+ path = path.substring(0, qIndex);
86
+ }
87
+ return INJECT_URLS.some((item) => path.endsWith(item));
88
+ }
89
+
90
+ /** 作用域转成请求参数:通用工程/数据表管理没有分支编码 */
91
+ export function getScopeParams(scope) {
92
+ if (!scope) {
93
+ return null;
94
+ }
95
+ let params = { branchFlag: scope.branchFlag };
96
+ if (scope.branchCode) {
97
+ params.branchCode = scope.branchCode;
98
+ }
99
+ return params;
100
+ }
@@ -0,0 +1,78 @@
1
+ import branchScope from "./branchScope";
2
+ import { BRANCH_FLAG } from "./branchContext";
3
+ import branchPageWrap from "./branchPageWrap.vue";
4
+
5
+ /**
6
+ * 分支工程页面通用逻辑:
7
+ * 1. 进入先选分支,选中后再渲染被复用的原组件
8
+ * 2. 选中后分支锁定,不可再改
9
+ * 3. 「打开新分支」以独立标签再开一页(需菜单 meta.repeatOpen)
10
+ */
11
+ let modules = {};
12
+ modules = {
13
+ components: { branchPageWrap },
14
+ mixins: [branchScope(BRANCH_FLAG.BRANCH)],
15
+ data() {
16
+ return {
17
+ branchCode: "",
18
+ branchName: "",
19
+ // 组件创建时记下原始菜单名,避免 route.meta.title 被改写后叠加多个分支名
20
+ baseTabTitle: "",
21
+ };
22
+ },
23
+ computed: {
24
+ branchLabel() {
25
+ if (!this.branchCode) {
26
+ return "";
27
+ }
28
+ if (this.branchName) {
29
+ return `${this.branchName}(${this.branchCode})`;
30
+ }
31
+ return this.branchCode;
32
+ },
33
+ },
34
+ created() {
35
+ this.baseTabTitle = this.resolveBaseTabTitle();
36
+ },
37
+ methods: {
38
+ resolveBaseTabTitle() {
39
+ let matched = this.$route.matched || [];
40
+ let last = matched[matched.length - 1] || {};
41
+ // 优先用路由记录上的原始 menuName,勿用可能已被污染的 meta.title
42
+ return (
43
+ last.menuName ||
44
+ this.$route.menuName ||
45
+ last.meta?.originTitle ||
46
+ this.$route.meta?.originTitle ||
47
+ last.meta?.title ||
48
+ this.$route.meta?.title ||
49
+ ""
50
+ );
51
+ },
52
+ onBranchChange(branch) {
53
+ if (!branch || !branch.branchCode) {
54
+ return;
55
+ }
56
+ this.branchCode = branch.branchCode;
57
+ this.branchName = branch.branchName || "";
58
+ this.updateTabTitle();
59
+ },
60
+ updateTabTitle() {
61
+ let base = this.baseTabTitle || this.resolveBaseTabTitle();
62
+ let suffix = this.branchName || this.branchCode;
63
+ // 菜单名形如「表单模板-分支」,选中分支后把末尾的「分支」换成分支名
64
+ let title = suffix
65
+ ? `${base.replace(/[--—]?\s*分支$/, "")}-${suffix}`
66
+ : base;
67
+ this.$store.dispatch("tagsView/updateVisitedView2", {
68
+ view: this.$route,
69
+ title,
70
+ });
71
+ },
72
+ openNewBranch() {
73
+ // 带 repeatOpen 的菜单:附带唯一 _rk,新开独立标签回到选分支态
74
+ this.$openView({ path: this.$route.path }, this.$route);
75
+ },
76
+ },
77
+ };
78
+ export default modules;
@@ -0,0 +1,225 @@
1
+ <template>
2
+ <div class="bd-branch-page" :class="{ 'has-branch': !!branchCode }">
3
+ <!-- 已选分支:内容区顶部工具条,不可改;提供打开新分支 -->
4
+ <div class="branch-bar" v-if="branchCode && showBar">
5
+ <span class="branch-locked">
6
+ <span class="label">{{ $t1("分支") }}:</span>
7
+ <span class="value">{{ branchLabel || branchCode }}</span>
8
+ </span>
9
+ <el-button
10
+ v-if="showOpenNew"
11
+ size="mini"
12
+ type="primary"
13
+ plain
14
+ icon="el-icon-plus"
15
+ @click="$emit('open-new')"
16
+ >
17
+ {{ $t1("打开新分支") }}
18
+ </el-button>
19
+ </div>
20
+ <div class="branch-body" ref="branchBody" v-if="branchCode">
21
+ <slot></slot>
22
+ </div>
23
+ <!-- 未选:先选分支再进入具体页面 -->
24
+ <div class="branch-empty" v-else>
25
+ <i class="el-icon-office-building"></i>
26
+ <p class="tip">{{ $t1("请先选择分支") }}</p>
27
+ <branchSelect
28
+ :value="branchCode"
29
+ @input="$emit('update:branchCode', $event)"
30
+ @change="$emit('branch-change', $event)"
31
+ ></branchSelect>
32
+ </div>
33
+ </div>
34
+ </template>
35
+
36
+ <script>
37
+ import branchSelect from "./branchSelect.vue";
38
+
39
+ const BADGE_CLASS = "bd-branch-detail-badge";
40
+
41
+ export default {
42
+ name: "bdBranchPageWrap",
43
+ components: { branchSelect },
44
+ props: {
45
+ branchCode: String,
46
+ branchLabel: String,
47
+ // 页面自己在查询条件里展示/切换分支时,顶部工具条就是多余的
48
+ showBar: {
49
+ type: Boolean,
50
+ default: true,
51
+ },
52
+ showOpenNew: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ },
57
+ watch: {
58
+ branchCode() {
59
+ this.scheduleInjectBadge();
60
+ },
61
+ branchLabel() {
62
+ this.scheduleInjectBadge();
63
+ },
64
+ },
65
+ mounted() {
66
+ this.scheduleInjectBadge();
67
+ },
68
+ beforeDestroy() {
69
+ this.clearInjectTimer();
70
+ this.clearBodyObserver();
71
+ },
72
+ methods: {
73
+ clearInjectTimer() {
74
+ if (this._injectTimer) {
75
+ clearTimeout(this._injectTimer);
76
+ this._injectTimer = null;
77
+ }
78
+ },
79
+ clearBodyObserver() {
80
+ if (this._bodyObserver) {
81
+ this._bodyObserver.disconnect();
82
+ this._bodyObserver = null;
83
+ }
84
+ },
85
+ scheduleInjectBadge() {
86
+ this.clearInjectTimer();
87
+ this._injectTimer = setTimeout(() => {
88
+ this.ensureBodyObserver();
89
+ this.injectDetailBadges();
90
+ }, 50);
91
+ },
92
+ ensureBodyObserver() {
93
+ let body = this.$refs.branchBody;
94
+ if (!body || this._bodyObserver) {
95
+ return;
96
+ }
97
+ // 详情页通过 x-tabs 异步挂载,监听后补上分支名
98
+ this._bodyObserver = new MutationObserver(() => {
99
+ if (this._injecting) {
100
+ return;
101
+ }
102
+ this.scheduleInjectBadge();
103
+ });
104
+ this._bodyObserver.observe(body, { childList: true, subtree: true });
105
+ },
106
+ injectDetailBadges() {
107
+ let body = this.$refs.branchBody;
108
+ if (!body || !this.branchCode || this._injecting) {
109
+ return;
110
+ }
111
+ this._injecting = true;
112
+ try {
113
+ let text = this.$t1("分支") + ":" + (this.branchLabel || this.branchCode);
114
+ let headers = body.querySelectorAll(".detail-wrap .d-header .fl");
115
+ headers.forEach((el) => {
116
+ let badge = el.querySelector("." + BADGE_CLASS);
117
+ if (!badge) {
118
+ badge = document.createElement("span");
119
+ badge.className = BADGE_CLASS;
120
+ badge.textContent = text;
121
+ el.appendChild(badge);
122
+ return;
123
+ }
124
+ // 相同文案不要再写,否则会反复触发 MutationObserver 卡死页面
125
+ if (badge.textContent !== text) {
126
+ badge.textContent = text;
127
+ }
128
+ });
129
+ } finally {
130
+ this._injecting = false;
131
+ }
132
+ },
133
+ },
134
+ };</script>
135
+
136
+ <style lang="scss" scoped>
137
+ .bd-branch-page {
138
+ position: relative;
139
+ height: 100%;
140
+
141
+ &.has-branch {
142
+ display: flex;
143
+ flex-direction: column;
144
+ }
145
+
146
+ .branch-bar {
147
+ flex: none;
148
+ display: flex;
149
+ align-items: center;
150
+ gap: 12px;
151
+ margin: 0 10px 8px;
152
+ padding: 8px 12px;
153
+ background: #fff;
154
+ border-radius: 2px;
155
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
156
+
157
+ .branch-locked {
158
+ display: inline-flex;
159
+ align-items: center;
160
+ color: #606266;
161
+ font-size: 13px;
162
+
163
+ .label {
164
+ margin-right: 6px;
165
+ color: #909399;
166
+ }
167
+
168
+ .value {
169
+ max-width: 320px;
170
+ overflow: hidden;
171
+ text-overflow: ellipsis;
172
+ white-space: nowrap;
173
+ font-weight: 500;
174
+ color: #303133;
175
+ }
176
+ }
177
+ }
178
+
179
+ .branch-body {
180
+ flex: 1;
181
+ min-height: 0;
182
+ overflow: hidden;
183
+ }
184
+
185
+ .branch-empty {
186
+ height: 100%;
187
+ display: flex;
188
+ flex-direction: column;
189
+ align-items: center;
190
+ justify-content: center;
191
+ color: #909399;
192
+ background-color: #fff;
193
+ border-radius: 2px;
194
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
195
+ margin: 0 10px;
196
+
197
+ i {
198
+ font-size: 48px;
199
+ margin-bottom: 12px;
200
+ color: #c0c4cc;
201
+ }
202
+
203
+ .tip {
204
+ margin: 0 0 16px;
205
+ font-size: 14px;
206
+ }
207
+ }
208
+ }
209
+ </style>
210
+
211
+ <style lang="scss">
212
+ /* 注入到原详情页标题栏,不能用 scoped */
213
+ .bd-branch-detail-badge {
214
+ display: inline-block;
215
+ margin-left: 12px;
216
+ padding: 2px 8px;
217
+ font-size: 14px;
218
+ font-weight: 600;
219
+ line-height: 20px;
220
+ color: #ff731c;
221
+ background: #fff3ea;
222
+ border-radius: 2px;
223
+ vertical-align: middle;
224
+ }
225
+ </style>
@@ -0,0 +1,44 @@
1
+ import { SCOPE_KEY, setFallbackScope } from "./branchContext";
2
+ import { installBranchHttp } from "./httpBranchPatch";
3
+
4
+ /**
5
+ * 壳组件 mixin:在实例上挂分支作用域标记。
6
+ *
7
+ * created 早于子组件的 created,保证被复用的原组件发出的第一个请求就带上分支参数;
8
+ * 请求补丁也在这里安装,无需改动 main.js。
9
+ *
10
+ * @param {number} branchFlag 分支标识:0通用工程 1分支工程 99数据表分类
11
+ */
12
+ export default function branchScope(branchFlag) {
13
+ return {
14
+ created() {
15
+ installBranchHttp();
16
+ this[SCOPE_KEY] = {
17
+ branchFlag,
18
+ branchCode: this.branchCode || null,
19
+ branchName: this.branchName || null,
20
+ };
21
+ setFallbackScope(this[SCOPE_KEY]);
22
+ },
23
+ mounted() {
24
+ setFallbackScope(this[SCOPE_KEY]);
25
+ },
26
+ activated() {
27
+ setFallbackScope(this[SCOPE_KEY]);
28
+ },
29
+ deactivated() {
30
+ setFallbackScope(null);
31
+ },
32
+ beforeDestroy() {
33
+ setFallbackScope(null);
34
+ },
35
+ watch: {
36
+ branchCode(val) {
37
+ this[SCOPE_KEY].branchCode = val || null;
38
+ },
39
+ branchName(val) {
40
+ this[SCOPE_KEY].branchName = val || null;
41
+ },
42
+ },
43
+ };
44
+ }