@bytenew/bn-bus-ui 1.1.462 → 1.1.463

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 (167) hide show
  1. package/install.js +134 -0
  2. package/package.json +20 -4
  3. package/packages/BnAddress/index.vue +141 -0
  4. package/packages/BnAddressParse/index.vue +75 -0
  5. package/packages/BnAdvancedFilter/BnFilterView.vue +145 -0
  6. package/packages/BnAdvancedFilter/index.vue +345 -0
  7. package/packages/BnAdvancedFilter/util.js +171 -0
  8. package/packages/BnCascader/BnCascader.vue +543 -0
  9. package/packages/BnCascader/BnCascaderPanel.vue +1331 -0
  10. package/packages/BnCascader/cascaderDisplay.js +102 -0
  11. package/packages/BnCheck/BnCheck.vue +253 -0
  12. package/packages/BnColumnConfig/columnConfigDialog.vue +134 -0
  13. package/packages/BnColumnConfig/component/childrenFormSetting/assocTable.vue +143 -0
  14. package/packages/BnColumnConfig/component/childrenFormSetting/assocTableSearch.vue +314 -0
  15. package/packages/BnColumnConfig/component/childrenFormSetting/index.vue +243 -0
  16. package/packages/BnColumnConfig/component/defaultSet/defaultSet.vue +114 -0
  17. package/packages/BnColumnConfig/component/defaultSet/stringDefault.vue +210 -0
  18. package/packages/BnColumnConfig/component/funcExprDialog/funcExprDialog.vue +126 -0
  19. package/packages/BnColumnConfig/component/packageFilter/index.vue +141 -0
  20. package/packages/BnColumnConfig/component/paraExplainSet/index.vue +156 -0
  21. package/packages/BnColumnConfig/component/setOption/setOption.vue +321 -0
  22. package/packages/BnColumnConfig/component/setRelationOption/ConditionList.vue +277 -0
  23. package/packages/BnColumnConfig/component/setRelationOption/LevelHeader.vue +144 -0
  24. package/packages/BnColumnConfig/component/setRelationOption/setRelationOption.vue +642 -0
  25. package/packages/BnColumnConfig/data.js +129 -0
  26. package/packages/BnColumnConfig/index.scss +23 -0
  27. package/packages/BnColumnConfig/index.vue +309 -0
  28. package/packages/BnCondVal/BnCondVal.vue +112 -0
  29. package/packages/BnCondVal/itemVal/dateRegVal.vue +39 -0
  30. package/packages/BnCondVal/itemVal/dateVal.vue +39 -0
  31. package/packages/BnCondVal/itemVal/numRegVal.vue +67 -0
  32. package/packages/BnCondVal/itemVal/numVal.vue +44 -0
  33. package/packages/BnCondVal/itemVal/relationVal.vue +73 -0
  34. package/packages/BnCondVal/itemVal/selectColumnVal.vue +58 -0
  35. package/packages/BnCondVal/itemVal/selectVal.vue +59 -0
  36. package/packages/BnCondVal/itemVal/stringVal.vue +156 -0
  37. package/packages/BnCondition/index.vue +551 -0
  38. package/packages/BnCondition/util.js +232 -0
  39. package/packages/BnDatePicker/BnDatePicker.vue +194 -0
  40. package/packages/BnDrop/BnDrop.vue +917 -0
  41. package/packages/BnEmptyTip/BnEmptyTip.vue +107 -0
  42. package/packages/BnExportOrder/BnExportOrder.vue +241 -0
  43. package/packages/BnExportOrder/validatorCode.vue +94 -0
  44. package/packages/BnFileView/BnFileView.vue +271 -0
  45. package/packages/BnFileView/FileDetail.vue +125 -0
  46. package/packages/BnFileView/videoPreview.vue +70 -0
  47. package/packages/BnFilterOption/BnFilterOption.vue +160 -0
  48. package/packages/BnFunExpr/BnFunExpr.vue +608 -0
  49. package/packages/BnImportOrder/BnImportOrder.vue +323 -0
  50. package/packages/BnImportTemplate/BnImportTemplate.vue +866 -0
  51. package/packages/BnImportTemplate/assets/merge_tip_img.png +0 -0
  52. package/packages/BnImportTemplate/assets/sheet_tip.png +0 -0
  53. package/packages/BnImportTemplate/assets/xls.png +0 -0
  54. package/packages/BnImportTemplate/components/ImportTemplateTrigger.vue +198 -0
  55. package/packages/BnImportTemplate/components/TemplateEditDialog.vue +340 -0
  56. package/packages/BnImportTemplate/components/TemplateFieldsConfig.vue +401 -0
  57. package/packages/BnImportTemplate/components/TemplateListDialog.vue +297 -0
  58. package/packages/BnInpNum/BnInpNum.vue +165 -0
  59. package/packages/BnMenus/BnMenus.vue +502 -0
  60. package/packages/BnMenus/MenuItem.vue +321 -0
  61. package/packages/BnOrderCard/BnOrderCard.vue +389 -0
  62. package/packages/BnOrderCard/orderRemark.vue +178 -0
  63. package/packages/BnOrderCard/util.js +94 -0
  64. package/packages/BnOrderDetail/BnOrderDetail.vue +338 -0
  65. package/packages/BnOrderDetail/filterLogByUser.vue +108 -0
  66. package/packages/BnOrderDetail/orderLogs.vue +53 -0
  67. package/packages/BnOrderDetail/showSubForm/index.vue +41 -0
  68. package/packages/BnOrderDetail/showSubForm/showChildTable.vue +61 -0
  69. package/packages/BnOrderDetail/showSubForm/showTimeLine.vue +131 -0
  70. package/packages/BnOrderDetail/showSubForm/tableCellCopy.vue +84 -0
  71. package/packages/BnOrderShare/index.vue +378 -0
  72. package/packages/BnOrderShare/shareUrlInp.vue +54 -0
  73. package/packages/BnRadio/BnRadio.vue +181 -0
  74. package/packages/BnRelation/BnRelation.vue +120 -0
  75. package/packages/BnSelect/BnSelect.vue +485 -0
  76. package/packages/BnSmartForm/BnBatchForm.vue +334 -0
  77. package/packages/BnSmartForm/BnBatchFormDialog.vue +423 -0
  78. package/packages/BnSmartForm/BnSmartElf/elfLog/index.vue +57 -0
  79. package/packages/BnSmartForm/BnSmartElf/index.vue +95 -0
  80. package/packages/BnSmartForm/BnSmartFormPsychic.js +629 -0
  81. package/packages/BnSmartForm/BnSmartFormUtil.js +524 -0
  82. package/packages/BnSmartForm/addressForm/index.vue +73 -0
  83. package/packages/BnSmartForm/checkboxForm/index.vue +99 -0
  84. package/packages/BnSmartForm/childrenForm/childFormFile.vue +237 -0
  85. package/packages/BnSmartForm/childrenForm/childrenFormBody.vue +260 -0
  86. package/packages/BnSmartForm/childrenForm/index.vue +110 -0
  87. package/packages/BnSmartForm/childrenForm/searchInventory.vue +115 -0
  88. package/packages/BnSmartForm/chooseAssocTable/chooseAssocTable.vue +451 -0
  89. package/packages/BnSmartForm/chooseAssocTable/chooseChildGood.vue +229 -0
  90. package/packages/BnSmartForm/chooseAssocTable/tableCellCopy.vue +84 -0
  91. package/packages/BnSmartForm/chooseChildOrder/chooseChildOrder.vue +158 -0
  92. package/packages/BnSmartForm/chooseIPaasData/chooseIPaasData.vue +307 -0
  93. package/packages/BnSmartForm/chooseIPaasData/tableCellCopy.vue +84 -0
  94. package/packages/BnSmartForm/choosePackage/choosePackage.vue +361 -0
  95. package/packages/BnSmartForm/dateDualForm/index.vue +37 -0
  96. package/packages/BnSmartForm/dateForm/index.vue +38 -0
  97. package/packages/BnSmartForm/fileForm/fileFormData.js +50 -0
  98. package/packages/BnSmartForm/fileForm/index.vue +240 -0
  99. package/packages/BnSmartForm/formItemFooter/formItemFooter.vue +38 -0
  100. package/packages/BnSmartForm/formItemTop/formItemTop.vue +42 -0
  101. package/packages/BnSmartForm/index.vue +1201 -0
  102. package/packages/BnSmartForm/numberForm/index.vue +63 -0
  103. package/packages/BnSmartForm/radioForm/index.vue +72 -0
  104. package/packages/BnSmartForm/receiveForm/index.vue +112 -0
  105. package/packages/BnSmartForm/relationForm/index.vue +82 -0
  106. package/packages/BnSmartForm/scoreForm/index.vue +39 -0
  107. package/packages/BnSmartForm/selectForm/index.vue +55 -0
  108. package/packages/BnSmartForm/showValForm/index.vue +42 -0
  109. package/packages/BnSmartForm/showValForm/showValFormTable.vue +104 -0
  110. package/packages/BnSmartForm/smartFormsCommon.scss +43 -0
  111. package/packages/BnSmartForm/stringForm/index.vue +170 -0
  112. package/packages/BnVirtPopover/index.vue +319 -0
  113. package/packages/BnWebLog/BnWebLog.vue +140 -0
  114. package/packages/BnWorkSettingDrop/advancedOptions.js +112 -0
  115. package/packages/BnWorkSettingDrop/benBenAIUtil.js +89 -0
  116. package/packages/BnWorkSettingDrop/index.vue +292 -0
  117. package/packages/font/iconfont.css +243 -0
  118. package/packages/font/iconfont.ttf +0 -0
  119. package/packages/font/iconfont.woff +0 -0
  120. package/packages/font/iconfont.woff2 +0 -0
  121. package/utils/addressParse-old.js +645 -0
  122. package/utils/addressParse.js +735 -0
  123. package/utils/config.js +68 -0
  124. package/utils/index.js +1171 -0
  125. package/dist/assocTableSearch-CmzOXI5w.js +0 -349
  126. package/dist/assocTableSearch.css +0 -1
  127. package/dist/bn-bus-ui.es.js +0 -65
  128. package/dist/bn-bus-ui.umd.js +0 -49
  129. package/dist/chooseIPaasData-jkTJEMKT.js +0 -391
  130. package/dist/chooseIPaasData.css +0 -1
  131. package/dist/defaultSet-CiYuSOzT.js +0 -297
  132. package/dist/defaultSet.css +0 -1
  133. package/dist/fileFormData-D_Q1vylE.js +0 -53
  134. package/dist/formItemFooter-BpnVUUgV.js +0 -108
  135. package/dist/formItemFooter.css +0 -1
  136. package/dist/funcExprDialog-BMc-n5FL.js +0 -139
  137. package/dist/funcExprDialog.css +0 -1
  138. package/dist/index-8GQJARcF.js +0 -44
  139. package/dist/index-8apT0r8m.js +0 -66
  140. package/dist/index-BOFu3qAH.js +0 -183
  141. package/dist/index-BSKXuSid.js +0 -89
  142. package/dist/index-BhYvDd_Q.js +0 -45
  143. package/dist/index-BhqkeVFc.js +0 -45
  144. package/dist/index-CK7_Ou7F.js +0 -89
  145. package/dist/index-Cfb8D3Fg.js +0 -58
  146. package/dist/index-D1fGD0mX.js +0 -51
  147. package/dist/index-DE_eQGbT.js +0 -746
  148. package/dist/index-DfgiBqzS.js +0 -221
  149. package/dist/index-Dobi0ms9.js +0 -66
  150. package/dist/index-DuyQNxe0.js +0 -118
  151. package/dist/index-DxpJkrN7.js +0 -64
  152. package/dist/index-FGHeG46m.js +0 -109
  153. package/dist/index-P2M7CUTe.js +0 -178
  154. package/dist/index-xCz2zysE.js +0 -135
  155. package/dist/index.css +0 -1
  156. package/dist/index2.css +0 -1
  157. package/dist/index3.css +0 -1
  158. package/dist/index4.css +0 -1
  159. package/dist/index5.css +0 -1
  160. package/dist/index6.css +0 -1
  161. package/dist/index7.css +0 -1
  162. package/dist/install--7IU60oV.js +0 -23103
  163. package/dist/install.css +0 -1
  164. package/dist/setOption-DehYZpZr.js +0 -329
  165. package/dist/setOption.css +0 -1
  166. package/dist/setRelationOption-BL-AFUoF.js +0 -5217
  167. package/dist/setRelationOption.css +0 -1
@@ -0,0 +1,112 @@
1
+ /**
2
+ * 工单高级设置项配置
3
+ *
4
+ * 与开放平台 editBusTable.advancedOptions 及接口返回的 tableInfo.advanced 字段对应。
5
+ *
6
+ * 后台配置 -> 接口 advanced 字段映射:
7
+ * | 后台 advancedOptions.type | tableInfo.advanced 字段 | 说明 |
8
+ * |--------------------------|-------------------------------|-------------------------------|
9
+ * | orderRemark | automaticRemark.enable | 订单备注 |
10
+ * | notice | notice.enable | 消息通知 |
11
+ * | tb/jxz/flyPigeon/... | buyerNotice.enable + platforms| 买家通知(前端合并为一项) |
12
+ * | autoDistribute | autoDistribute.enable | 自动分配 |
13
+ * | columnPsychic | columnPsychic.enable | 组件显隐 |
14
+ * | submitCheck | submitCheck.enable | 提交校验 |
15
+ * | shareConfig | shareConfig.enable | 分享配置 |
16
+ * | benBenAIOrder | benBenAIOrder.enable | 犇犇AI建单 |
17
+ * | dataSynchronization | dataSynchronization.enable | 数据同步 |
18
+ */
19
+
20
+ /** 买家通知支持的平台类型,对应 buyerNotice.platforms 数组元素 */
21
+ export const BUYER_NOTICE_PLATFORMS = ['tb', 'jxz', 'flyPigeon', 'jdPop', 'jdSelf', 'pdd', 'ks'];
22
+
23
+ /**
24
+ * 高级设置菜单项完整配置
25
+ *
26
+ * @typedef {Object} AdvancedSettingOption
27
+ * @property {string} type - 设置项唯一标识,也作为 iframe 路由 type(除非指定 routeType)
28
+ * @property {string} title - 下拉菜单展示文案
29
+ * @property {string} icon - bnUIcon 图标类名
30
+ * @property {string} advancedKey - 对应 tableInfo.advanced 下的字段名,通过 enable 控制显隐
31
+ * @property {string} [routeType] - iframe 路由 type,当与 type 不一致时使用(如数据同步)
32
+ * @property {string} [iconClass] - 图标附加样式类
33
+ */
34
+ export const ADVANCED_SETTING_OPTIONS = [
35
+ {
36
+ type: 'benBenAIOrder',
37
+ title: '犇犇AI建单',
38
+ icon: 'bnUIcon-benAi',
39
+ advancedKey: 'benBenAIOrder',
40
+ iconClass: 'w-color-red w-font-weight600 w-font17',
41
+ },
42
+ {
43
+ type: 'buyerNotice',
44
+ title: '买家通知',
45
+ icon: 'bnUIcon-bell',
46
+ advancedKey: 'buyerNotice',
47
+ iconClass: 'w-color-orange',
48
+ },
49
+ {
50
+ type: 'notice',
51
+ title: '消息通知',
52
+ icon: 'bnUIcon-message',
53
+ advancedKey: 'notice',
54
+ iconClass: 'w-color-orange',
55
+ },
56
+ {
57
+ type: 'automaticRemark',
58
+ title: '订单备注',
59
+ icon: 'bnUIcon-remarks',
60
+ advancedKey: 'automaticRemark',
61
+ iconClass: 'w-color-orange',
62
+ },
63
+ {
64
+ type: 'autoDistribute',
65
+ title: '自动分配',
66
+ icon: 'bnUIcon-robot',
67
+ advancedKey: 'autoDistribute',
68
+ iconClass: 'w-color-orange',
69
+ },
70
+ {
71
+ type: 'columnPsychic',
72
+ title: '组件显隐',
73
+ icon: 'bnUIcon-psychic',
74
+ advancedKey: 'columnPsychic',
75
+ iconClass: 'w-color-orange w-font17',
76
+ },
77
+ {
78
+ type: 'submitCheck',
79
+ title: '提交校验',
80
+ icon: 'bnUIcon-submitCheck',
81
+ advancedKey: 'submitCheck',
82
+ iconClass: 'w-color-orange w-font17',
83
+ },
84
+ {
85
+ type: 'shareConfig',
86
+ title: '分享配置',
87
+ icon: 'bnUIcon-share',
88
+ advancedKey: 'shareConfig',
89
+ iconClass: 'w-color-orange',
90
+ },
91
+ {
92
+ type: 'dataSynchronization',
93
+ title: '数据同步',
94
+ icon: 'bnUIcon-linkage',
95
+ advancedKey: 'dataSynchronization',
96
+ // 后台字段为 dataSynchronization,iframe 路由为 simpleDataSynchronization
97
+ routeType: 'simpleDataSynchronization',
98
+ iconClass: 'w-color-orange',
99
+ },
100
+ ];
101
+
102
+ /**
103
+ * 根据 tableInfo.advanced 获取当前表可见的高级设置菜单项
104
+ * @param {Object} advanced - tableInfo.advanced 对象
105
+ * @returns {AdvancedSettingOption[]}
106
+ */
107
+ export function getVisibleAdvancedOptions(advanced) {
108
+ if (!advanced) return [];
109
+ return ADVANCED_SETTING_OPTIONS.filter(
110
+ (option) => advanced[option.advancedKey]?.enable === true,
111
+ );
112
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * 犇犇AI建单 & 普通高级设置 iframe URL 构建工具
3
+ *
4
+ * 普通设置页走 app.html#/simpleOrderFun/{appId}/{tableId}/{type}
5
+ * 犇犇AI建单走 agent.html#/settingCenter/aiCreateOrder/{tabName}
6
+ */
7
+
8
+ /** 犇犇AI建单全屏面板 Tab 配置 */
9
+ export const BENBEN_AI_TABS = [
10
+ { label: '建单配置', name: 'editConfig' },
11
+ { label: '数据分析', name: 'dataAnalyze' },
12
+ { label: '调优中心', name: 'tuningCenter' },
13
+ ];
14
+
15
+ /**
16
+ * 各 Tab 对应的 defaultGetBaseUrl 入参 type
17
+ * dataAnalyze 使用 agent 域名但路由不同,type 传 undefined 走默认 agent 逻辑
18
+ */
19
+ export const SETTING_TAB_BASE_TYPE = {
20
+ editConfig: 'benBenAIOrder',
21
+ dataAnalyze: undefined,
22
+ tuningCenter: 'benBenAIOrder',
23
+ };
24
+
25
+ /**
26
+ * 根据当前环境和设置项类型,获取 iframe 基础 URL
27
+ *
28
+ * 本地开发:
29
+ * - benBenAIOrder -> http://localhost:5177(agent 项目)
30
+ * - 其他 -> http://localhost:8088(app 项目)
31
+ * 生产环境:
32
+ * - benBenAIOrder -> /agent.html
33
+ * - 其他 -> /app.html
34
+ *
35
+ * @param {string} type - 设置项 type,如 benBenAIOrder、buyerNotice
36
+ * @param {string} baseUrl - 普通设置默认基础路径,默认 /app.html
37
+ * @returns {string}
38
+ */
39
+ export function defaultGetBaseUrl(type, baseUrl = '/app.html') {
40
+ const host = window.location.host;
41
+ if (host.includes('localhost')) {
42
+ return type === 'benBenAIOrder' ? 'http://localhost:5177' : 'http://localhost:8088';
43
+ }
44
+ return type === 'benBenAIOrder' ? '/agent.html' : baseUrl;
45
+ }
46
+
47
+ /**
48
+ * 将基础 URL 补全为带 .html 的路径
49
+ * @param {string} base - 如 http://localhost:8088 或 /app.html
50
+ * @param {string} fallback - 缺省 html 文件名,如 app.html
51
+ */
52
+ function resolveHtmlBase(base, fallback) {
53
+ if (base.endsWith('.html')) return base;
54
+ if (base.startsWith('http')) return `${base}/${fallback}`;
55
+ return `/${fallback}`;
56
+ }
57
+
58
+ /**
59
+ * 构建普通高级设置 iframe 地址
60
+ * 示例:/app.html#/simpleOrderFun/50802/1744458/buyerNotice?tableCode=anw_install
61
+ *
62
+ * @param {string} base - defaultGetBaseUrl 返回值
63
+ * @param {Object} tableInfo - 含 appId、tableId、tableCode
64
+ * @param {string} type - iframe 路由 type
65
+ */
66
+ export function buildSimpleOrderFunUrl(base, tableInfo, type) {
67
+ const { appId, tableId, tableCode } = tableInfo;
68
+ const prefix = resolveHtmlBase(base, 'app.html');
69
+ return `${prefix}#/simpleOrderFun/${appId}/${tableId}/${type}?tableCode=${tableCode}`;
70
+ }
71
+
72
+ /**
73
+ * 构建犇犇AI建单配置页 iframe 地址
74
+ * 示例:/agent.html#/settingCenter/aiCreateOrder/editConfig?tableId=...&full=true&tableMode=true
75
+ */
76
+ export function buildBenBenSettingUrl(base, tableInfo, tabName) {
77
+ const { appId, tableId, tableCode, name } = tableInfo;
78
+ const prefix = base.endsWith('.html') || base.startsWith('http') ? base : '/agent.html';
79
+ return `${prefix}#/settingCenter/aiCreateOrder/${tabName}?tableId=${tableId}&appId=${appId}&tableCode=${tableCode}&tableName=${encodeURIComponent(name || '')}&full=true&tableMode=true`;
80
+ }
81
+
82
+ /**
83
+ * 构建犇犇AI建单「数据分析」Tab iframe 地址
84
+ * 示例:/agent.html#/simpleBrain/268625922244?tableId=...&tableName=...
85
+ */
86
+ export function buildBenBenAnalyzeUrl(base, tableInfo, brainId) {
87
+ const prefix = base.endsWith('.html') || base.startsWith('http') ? base : '/agent.html';
88
+ return `${prefix}#/simpleBrain/${brainId}?tableId=${tableInfo.tableId}&tableName=${encodeURIComponent(tableInfo.name || '')}`;
89
+ }
@@ -0,0 +1,292 @@
1
+ <template>
2
+ <div class="BnWorkSettingDrop">
3
+ <!-- 有可用高级设置项时展示下拉菜单 -->
4
+ <el-dropdown v-if="visibleOptions.length" trigger="click">
5
+ <div class="BnWorkSettingDrop-title w-flex-center w-cursor-pointer">
6
+ <slot>{{ tableInfo.name }}</slot>
7
+ <span class="bnUIcon bnUIcon-setting w-margin-left3 w-color-gray"></span>
8
+ </div>
9
+ <template #dropdown>
10
+ <el-dropdown-menu>
11
+ <el-dropdown-item
12
+ v-for="item in visibleOptions"
13
+ :key="item.type"
14
+ @click="openSetting(item.type)"
15
+ >
16
+ <span
17
+ :class="['bnUIcon', item.icon, 'w-margin-right5', item.iconClass]"
18
+ ></span>{{ item.title }}
19
+ </el-dropdown-item>
20
+ </el-dropdown-menu>
21
+ </template>
22
+ </el-dropdown>
23
+ <!-- 无可用设置项时仅展示表名 -->
24
+ <div v-else class="BnWorkSettingDrop-title w-flex-center">
25
+ <slot>{{ tableInfo.name }}</slot>
26
+ </div>
27
+
28
+ <!-- 全屏设置面板:普通项走 simpleOrderFun 路由,犇犇AI建单走 agent 独立页 -->
29
+ <div class="BnWorkSettingDrop-panel" v-if="show">
30
+ <div class="BnWorkSettingDrop-panel-header">
31
+ <div class="BnWorkSettingDrop-panel-header-left">
32
+ <el-page-header :icon="ArrowLeft" @back="closeSetting">
33
+ <template #content>
34
+ <span class="text-large font-600 mr-3">{{ tableInfo.name }}</span>
35
+ </template>
36
+ </el-page-header>
37
+ <!-- 犇犇AI建单专属 Tab:建单配置 / 数据分析 / 调优中心 -->
38
+ <el-tabs
39
+ v-if="isBenBenAIOrder"
40
+ v-model="activeTab"
41
+ class="BnWorkSettingDrop-tabs"
42
+ @tab-change="handleBenBenTabChange"
43
+ >
44
+ <el-tab-pane
45
+ v-for="tab in benBenTabs"
46
+ :key="tab.name"
47
+ :label="tab.label"
48
+ :name="tab.name"
49
+ />
50
+ </el-tabs>
51
+ </div>
52
+ <!-- 建单配置 Tab 下的 AI 建单开关,需 postFunc 拉取配置后才展示 -->
53
+ <el-switch
54
+ v-if="isBenBenAIOrder && activeTab === 'editConfig' && isShowSwitch"
55
+ v-model="optStatus"
56
+ :active-value="1"
57
+ :inactive-value="0"
58
+ @change="handleBenBenAIOrderChange"
59
+ />
60
+ </div>
61
+ <iframe
62
+ class="BnWorkSettingDrop-panel-main"
63
+ ref="iframe"
64
+ allow="clipboard-write"
65
+ :key="url"
66
+ sandbox="allow-scripts allow-same-origin allow-downloads allow-forms allow-popups allow-top-navigation allow-pointer-lock allow-modals allow-presentation allow-popups-to-escape-sandbox allow-orientation-lock allow-top-navigation-by-user-activation"
67
+ :src="url"
68
+ ></iframe>
69
+ </div>
70
+ </div>
71
+ </template>
72
+
73
+ <script>
74
+ /**
75
+ * 工单高级设置下拉菜单 + 全屏 iframe 配置面板
76
+ *
77
+ * 使用方式:
78
+ * <BnWorkSettingDrop :tableInfo="tableInfo" :postFunc="post" @close="queryTableInfo" />
79
+ *
80
+ * tableInfo 需包含:name、appId、tableId、tableCode、advanced
81
+ * advanced 各字段 enable 控制菜单项显隐,配置来源见 advancedOptions.js
82
+ */
83
+ import { ArrowLeft } from '@element-plus/icons-vue';
84
+ import { getVisibleAdvancedOptions, ADVANCED_SETTING_OPTIONS } from './advancedOptions.js';
85
+ import {
86
+ BENBEN_AI_TABS,
87
+ SETTING_TAB_BASE_TYPE,
88
+ defaultGetBaseUrl,
89
+ buildSimpleOrderFunUrl,
90
+ buildBenBenSettingUrl,
91
+ buildBenBenAnalyzeUrl,
92
+ } from './benBenAIUtil.js';
93
+
94
+ /** 犇犇AI建单「数据分析」Tab 默认大脑 ID,可被 advanced.benBenAIOrder.brainId 覆盖 */
95
+ const DEFAULT_BRAIN_ID = '268625922244';
96
+
97
+ export default {
98
+ name: 'BnWorkSettingDrop',
99
+ props: {
100
+ /** 表完整信息,至少含 name、appId、tableId、tableCode、advanced */
101
+ tableInfo: {
102
+ type: Object,
103
+ default: () => ({}),
104
+ },
105
+ /** 项目统一请求方法,用于犇犇AI建单开关的 get / edit 接口 */
106
+ postFunc: {
107
+ type: Function,
108
+ default: null,
109
+ },
110
+ },
111
+ emits: ['close'],
112
+ data() {
113
+ return {
114
+ ArrowLeft,
115
+ /** 是否展示全屏设置面板 */
116
+ show: false,
117
+ /** 当前 iframe 地址 */
118
+ url: '',
119
+ /** 当前 iframe 基础域名(app.html 或 agent.html) */
120
+ localUrl: '',
121
+ /** 当前是否为犇犇AI建单模式(决定 header 是否展示 Tab 和开关) */
122
+ isBenBenAIOrder: false,
123
+ /** 犇犇AI建单当前 Tab */
124
+ activeTab: 'editConfig',
125
+ benBenTabs: BENBEN_AI_TABS,
126
+ /** AI 建单开关状态:0 关闭 / 1 开启 */
127
+ optStatus: 0,
128
+ /** 是否展示 AI 建单开关(接口返回有效配置后才为 true) */
129
+ isShowSwitch: false,
130
+ /** 犇犇AI建单配置缓存,含 id、open_status 等 */
131
+ benbenAIOrderConfig: {},
132
+ };
133
+ },
134
+ computed: {
135
+ /** 根据 tableInfo.advanced 各 enable 字段过滤出可见菜单项 */
136
+ visibleOptions() {
137
+ return getVisibleAdvancedOptions(this.tableInfo?.advanced);
138
+ },
139
+ /** 数据分析 Tab 使用的大脑 ID */
140
+ brainId() {
141
+ return this.tableInfo?.advanced?.benBenAIOrder?.brainId || DEFAULT_BRAIN_ID;
142
+ },
143
+ },
144
+ methods: {
145
+ /**
146
+ * 打开指定高级设置项
147
+ * @param {string} type 设置项类型,如 buyerNotice、benBenAIOrder,见 advancedOptions.js
148
+ */
149
+ openSetting(type) {
150
+ const option = ADVANCED_SETTING_OPTIONS.find((item) => item.type === type);
151
+ // routeType 用于 advanced 字段名与 iframe 路由不一致的场景,如 dataSynchronization -> simpleDataSynchronization
152
+ const routeType = option?.routeType || type;
153
+ this.localUrl = defaultGetBaseUrl(type);
154
+ if (type === 'benBenAIOrder') {
155
+ this.isBenBenAIOrder = true;
156
+ this.activeTab = 'editConfig';
157
+ this.url = buildBenBenSettingUrl(this.localUrl, this.tableInfo, 'editConfig');
158
+ this.loadBenBenAIOrderConfig();
159
+ } else {
160
+ this.isBenBenAIOrder = false;
161
+ this.url = buildSimpleOrderFunUrl(this.localUrl, this.tableInfo, routeType);
162
+ }
163
+ this.$nextTick(() => {
164
+ this.show = true;
165
+ });
166
+ },
167
+ /** 供外部 ref 编程式调用,如 $refs.setting.open('notice') */
168
+ open(type) {
169
+ this.openSetting(type);
170
+ },
171
+ /** 犇犇AI建单 Tab 切换,各 Tab 对应不同 iframe 地址 */
172
+ handleBenBenTabChange(tabName) {
173
+ if (!this.isBenBenAIOrder) return;
174
+
175
+ this.localUrl = defaultGetBaseUrl(SETTING_TAB_BASE_TYPE[tabName]);
176
+ if (tabName === 'dataAnalyze') {
177
+ this.url = buildBenBenAnalyzeUrl(this.localUrl, this.tableInfo, this.brainId);
178
+ } else {
179
+ if (tabName === 'editConfig') {
180
+ this.loadBenBenAIOrderConfig();
181
+ }
182
+ this.url = buildBenBenSettingUrl(this.localUrl, this.tableInfo, tabName);
183
+ }
184
+ },
185
+ /** 获取犇犇AI建单配置,决定是否展示开关及当前开关状态 */
186
+ loadBenBenAIOrderConfig() {
187
+ if (!this.postFunc) {
188
+ this.benbenAIOrderConfig = {};
189
+ this.isShowSwitch = false;
190
+ this.optStatus = 0;
191
+ return;
192
+ }
193
+ this.postFunc('/agent/config/table/get', { table_id: this.tableInfo.tableId })
194
+ .then((res) => {
195
+ if (res?.code === 0 && res.data) {
196
+ this.benbenAIOrderConfig = res.data;
197
+ this.optStatus = res.data.open_status;
198
+ this.isShowSwitch = true;
199
+ } else {
200
+ this.benbenAIOrderConfig = {};
201
+ this.isShowSwitch = false;
202
+ this.optStatus = 0;
203
+ }
204
+ })
205
+ .catch(() => {
206
+ this.benbenAIOrderConfig = {};
207
+ this.isShowSwitch = false;
208
+ this.optStatus = 0;
209
+ });
210
+ },
211
+ /** 切换犇犇AI建单开关,失败时回滚 optStatus */
212
+ handleBenBenAIOrderChange() {
213
+ if (!this.postFunc) return;
214
+ this.postFunc('/agent/config/table/edit_open_status', {
215
+ id: this.benbenAIOrderConfig.id,
216
+ open_status: this.optStatus,
217
+ }).then((res) => {
218
+ if (res?.code !== 0) {
219
+ this.optStatus = this.optStatus === 1 ? 0 : 1;
220
+ }
221
+ }).catch(() => {
222
+ this.optStatus = this.optStatus === 1 ? 0 : 1;
223
+ });
224
+ },
225
+ /** 关闭全屏面板并重置状态,触发 close 事件供父组件刷新 tableInfo */
226
+ closeSetting() {
227
+ this.show = false;
228
+ this.url = '';
229
+ this.localUrl = '';
230
+ this.isBenBenAIOrder = false;
231
+ this.activeTab = 'editConfig';
232
+ this.isShowSwitch = false;
233
+ this.optStatus = 0;
234
+ this.benbenAIOrderConfig = {};
235
+ this.$emit('close');
236
+ },
237
+ },
238
+ };
239
+ </script>
240
+
241
+ <style scoped lang="scss">
242
+ .BnWorkSettingDrop {
243
+ &-title {
244
+ margin-bottom: 16px;
245
+ padding-right: 20px;
246
+ font-size: 16px;
247
+ font-weight: 500;
248
+ }
249
+
250
+ &-panel {
251
+ position: fixed;
252
+ left: 0;
253
+ right: 0;
254
+ top: 0;
255
+ bottom: 0;
256
+ overflow: auto;
257
+ z-index: 100;
258
+ background: #fff;
259
+
260
+ &-header {
261
+ height: 42px;
262
+ padding: 0 20px;
263
+ display: flex;
264
+ align-items: center;
265
+ justify-content: space-between;
266
+ border-bottom: 1px solid #e5e5e5;
267
+
268
+ &-left {
269
+ display: flex;
270
+ align-items: center;
271
+ min-width: 0;
272
+ }
273
+ }
274
+
275
+ &-main {
276
+ width: 100%;
277
+ height: calc(100% - 47px);
278
+ border: none;
279
+ }
280
+ }
281
+
282
+ &-tabs {
283
+ :deep(.el-tabs__header) {
284
+ margin-bottom: 0;
285
+ }
286
+
287
+ :deep(.el-tabs__nav-wrap::after) {
288
+ display: none;
289
+ }
290
+ }
291
+ }
292
+ </style>