cloud-web-corejs 1.0.54-dev.786 → 1.0.54-dev.787
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.
- package/package.json +2 -1
- package/src/components/VabUpload/index.vue +1 -1
- package/src/components/excelImport/index.js +69 -7
- package/src/components/excelImport/mixins.js +841 -9
- package/src/components/fileLibrary/fileHistoryDialog.vue +1 -1
- package/src/components/fileLibrary/fileObjAuthEdit.vue +1 -1
- package/src/components/fileLibrary/filterDialog.vue +1 -1
- package/src/components/formDialog/README.md +324 -241
- package/src/components/formDialog/actionButtons.js +90 -0
- package/src/components/formDialog/index.js +48 -35
- package/src/components/formDialog/index.vue +802 -724
- package/src/components/formDrawer/drawer.vue +719 -0
- package/src/components/formDrawer/index.js +50 -0
- package/src/components/onlineTalk/talkUserDialog.vue +1 -1
- package/src/components/tempStorage/tempStorageDialog.vue +1 -1
- package/src/components/wf/addTaskUserdialog.vue +1 -1
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +115 -4
- package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +102 -5
- package/src/components/xform/form-designer/form-widget/dialog/formFieldDialog.vue +1 -1
- package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/action-button-config-dialog.vue +241 -0
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +116 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +6 -0
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +1 -0
- package/src/components/xform/form-render/container-item/data-table-mixin.js +1460 -1460
- package/src/components/xform/form-render/container-item/detail-item.vue +11 -2
- package/src/components/xform/form-render/indexMixin.js +5 -0
- package/src/index.js +506 -472
- package/src/utils/lazyPlugin.js +66 -0
- package/src/views/bd/setting/bd_attach_setting/dialog.vue +1 -1
- package/src/views/bd/setting/bd_attach_setting/list.vue +1 -1
- package/src/views/bd/setting/bd_company_env/dialog.vue +1 -1
- package/src/views/bd/setting/bd_company_env/list.vue +1 -1
- package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +1 -1
- package/src/views/bd/setting/form_import_log/list.vue +1 -1
- package/src/views/bd/setting/form_script/dialog.vue +1 -1
- package/src/views/bd/setting/form_script/form_list.vue +1 -1
- package/src/views/bd/setting/form_script/list.vue +1 -1
- package/src/views/bd/setting/form_script/list1.vue +1 -1
- package/src/views/bd/setting/form_template/dialog.vue +1 -1
- package/src/views/bd/setting/form_template/ftHistoryDialog.vue +1 -1
- package/src/views/bd/setting/form_template/itemList.vue +1 -1
- package/src/views/bd/setting/form_template/list.vue +1 -1
- package/src/views/bd/setting/form_template/wf_list.vue +1 -1
- package/src/views/bd/setting/logic_param/list.vue +1 -1
- package/src/views/bd/setting/menu_kind/dialog.vue +1 -1
- package/src/views/bd/setting/menu_kind/list.vue +1 -1
- package/src/views/bd/setting/push_data/list.vue +1 -1
- package/src/views/bd/setting/push_data_h/list.vue +1 -1
- package/src/views/bd/setting/request_async_setting/list.vue +1 -1
- package/src/views/bd/setting/request_setting/list.vue +1 -1
- package/src/views/bd/setting/table_model/dialog.vue +1 -1
- package/src/views/bd/setting/table_model/list.vue +1 -1
- package/src/views/bd/setting/table_model/zdDialog.vue +1 -1
- package/src/views/support/export_template/list.vue +1 -1
- package/src/views/user/access_log/list.vue +1 -1
- package/src/views/user/access_log/list2.vue +1 -1
- package/src/views/user/api_request/list.vue +1 -1
- package/src/views/user/area/dialog.vue +1 -1
- package/src/views/user/area/list.vue +1 -1
- package/src/views/user/bill_setting/list.vue +1 -1
- package/src/views/user/bill_setting/userDialog.vue +1 -1
- package/src/views/user/code_rules/list.vue +1 -1
- package/src/views/user/common_attribute/list.vue +1 -1
- package/src/views/user/common_script/list.vue +1 -1
- package/src/views/user/company_info/dialog.vue +1 -1
- package/src/views/user/country/dialog.vue +1 -1
- package/src/views/user/country/list.vue +1 -1
- package/src/views/user/data_type_setting/dialog.vue +1 -1
- package/src/views/user/extend_datasource/dialog.vue +1 -1
- package/src/views/user/extend_datasource/list.vue +1 -1
- package/src/views/user/fieldTranslation/list.vue +1 -1
- package/src/views/user/field_values_invisible/list.vue +1 -1
- package/src/views/user/file_type/list.vue +1 -1
- package/src/views/user/file_view_area/list.vue +1 -1
- package/src/views/user/form/form_template/dialog.vue +1 -1
- package/src/views/user/form/form_template/itemList.vue +1 -1
- package/src/views/user/form/form_template/list.vue +1 -1
- package/src/views/user/form/form_template_field/dialog.vue +1 -1
- package/src/views/user/form/form_type/dialog.vue +1 -1
- package/src/views/user/form/form_type/list.vue +1 -1
- package/src/views/user/form/report_requestaccess/dialog.vue +1 -1
- package/src/views/user/form/report_requestaccess/list.vue +1 -1
- package/src/views/user/groups/dialog.vue +1 -1
- package/src/views/user/groups/list.vue +1 -1
- package/src/views/user/lang_tag/dialog.vue +1 -1
- package/src/views/user/lang_tag/list.vue +1 -1
- package/src/views/user/language_setting/list.vue +1 -1
- package/src/views/user/menu/list.vue +1 -1
- package/src/views/user/mobile_menu/list.vue +1 -1
- package/src/views/user/notify_message/list.vue +1 -1
- package/src/views/user/notify_template/list.vue +1 -1
- package/src/views/user/notify_template/list2.vue +1 -1
- package/src/views/user/oplog/list.vue +1 -1
- package/src/views/user/position/dialog.vue +1 -1
- package/src/views/user/position/list.vue +1 -1
- package/src/views/user/project_tag/dialog.vue +1 -1
- package/src/views/user/project_tag/list.vue +1 -1
- package/src/views/user/push_setting/list.vue +1 -1
- package/src/views/user/request_setting/list.vue +1 -1
- package/src/views/user/role/dialog.vue +1 -1
- package/src/views/user/role/list.vue +1 -1
- package/src/views/user/sale_org/dialog.vue +1 -1
- package/src/views/user/sale_org/list.vue +1 -1
- package/src/views/user/system_notice/list.vue +1 -1
- package/src/views/user/system_parameter/list.vue +1 -1
- package/src/views/user/user/dialog.vue +1 -1
- package/src/views/user/user/form_dialog.vue +1 -1
- package/src/views/user/user/form_list.vue +1 -1
- package/src/views/user/user/list.vue +2 -2
- package/src/views/user/user_log_classify/list.vue +1 -1
- package/src/views/user/wf/wfReport/index.vue +2 -2
- package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -2
- package/src/views/user/wf/wf_manage/list.vue +2 -2
- package/src/views/user/wf/wf_manage/list2.vue +2 -2
- package/src/views/user/wf/wf_obj_config/dialog.vue +1 -1
- package/src/views/user/wf/wf_obj_config/list.vue +1 -1
- package/src/views/user/wf/wf_obj_config/list_form.vue +1 -1
- package/src/views/user/wf/wf_transfer_setting/list.vue +1 -1
- package/src/views/user/workbench_menu/list.vue +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const modules = {};
|
|
2
|
+
import vue from "vue";
|
|
3
|
+
|
|
4
|
+
// 壳组件懒加载:首屏只留本入口几十行;抽屉壳(含 select 逻辑、按钮公共模块)
|
|
5
|
+
// 随首次调用进独立 chunk,xform 渲染器与 formDialog 共享同一异步 chunk
|
|
6
|
+
let FormDrawerCtor = null;
|
|
7
|
+
|
|
8
|
+
function loadCtor() {
|
|
9
|
+
if (FormDrawerCtor) return Promise.resolve(FormDrawerCtor);
|
|
10
|
+
return import(
|
|
11
|
+
/* webpackChunkName: "form-drawer" */ "./drawer.vue"
|
|
12
|
+
).then((m) => {
|
|
13
|
+
FormDrawerCtor = vue.extend(m.default);
|
|
14
|
+
return FormDrawerCtor;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* JS 调用打开 formCode 抽屉。每次调用创建独立实例,支持叠开多层。
|
|
20
|
+
* options:{ formCode, title, size, direction, param, conditionParam, plain,
|
|
21
|
+
* select: {multiple, rows, fieldKey, queryParam, onConfirm},
|
|
22
|
+
* buttons, showFooter, readonly, onReady, beforeConfirm, model, ... }
|
|
23
|
+
* resolve:默认按钮下 select 模式返回选中行数组、表单模式返回表单数据;
|
|
24
|
+
* 配置了自定义按钮(formConfig.actionButtons / options.buttons)返回 {action, data};
|
|
25
|
+
* 取消/关闭返回 null。详见 components/formDialog/README.md。
|
|
26
|
+
*/
|
|
27
|
+
function open(options = {}) {
|
|
28
|
+
return loadCtor().then((Ctor) => {
|
|
29
|
+
const parent
|
|
30
|
+
= typeof window !== "undefined" && window.$vueRoot ? window.$vueRoot : null;
|
|
31
|
+
const instanceOptions = {};
|
|
32
|
+
if (parent) {
|
|
33
|
+
instanceOptions.parent = parent;
|
|
34
|
+
if (parent._i18n) {
|
|
35
|
+
instanceOptions.i18n = parent._i18n;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const instance = new Ctor(instanceOptions);
|
|
39
|
+
instance.$mount();
|
|
40
|
+
document.body.appendChild(instance.$el);
|
|
41
|
+
return instance.open(options);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
modules.install = function (Vue) {
|
|
46
|
+
Vue.prototype.$formDrawer = open;
|
|
47
|
+
};
|
|
48
|
+
modules.open = open;
|
|
49
|
+
|
|
50
|
+
export default modules;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<div class="clearfix screen-btns">
|
|
34
34
|
<div class="fr">
|
|
35
35
|
<vxe-button icon="el-icon-brush" class="button-sty" @click="resetEvent" type="text" status="primary"
|
|
36
|
-
plain>{{ $
|
|
36
|
+
plain>{{ $t1('刷新') }}
|
|
37
37
|
</vxe-button>
|
|
38
38
|
<vxe-button status="warning" icon="el-icon-search" class="button-sty" @click="searchEvent">
|
|
39
39
|
{{ $t2('搜索', 'system.button.search') }}
|
package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
<div class="fr">
|
|
66
66
|
<!-- <vxe-button icon="el-icon-view" class="button-sty" @click="searchEvent">显示总记录数</vxe-button> -->
|
|
67
67
|
<vxe-button icon="el-icon-brush" class="button-sty" @click="resetEvent" type="text" status="primary"
|
|
68
|
-
plain
|
|
68
|
+
plain>刷新
|
|
69
69
|
</vxe-button>
|
|
70
70
|
|
|
71
71
|
<vxe-button status="warning" icon="el-icon-search" class="button-sty" @click="searchEvent">搜索
|
|
@@ -6,7 +6,16 @@
|
|
|
6
6
|
v-bind="dialogConfig"
|
|
7
7
|
@close="close"
|
|
8
8
|
>
|
|
9
|
-
|
|
9
|
+
<!-- host:"list" —— 承载列表宿主页(自带「常规(详情)/列表」页签),行点击进详情等行为与整页一致。
|
|
10
|
+
list.vue 根节点自带 #containt,本分支不再套 id,避免嵌套重复。 -->
|
|
11
|
+
<div
|
|
12
|
+
class="cont designer-view fd-list-host"
|
|
13
|
+
v-bind="bodyConfig"
|
|
14
|
+
v-if="listHost"
|
|
15
|
+
>
|
|
16
|
+
<list-view-host :formCode="listFormCode" :param="dialogParam" />
|
|
17
|
+
</div>
|
|
18
|
+
<div class="cont designer-view" v-bind="bodyConfig" id="containt" v-else>
|
|
10
19
|
<v-form-render
|
|
11
20
|
:form-json.sync="formJson"
|
|
12
21
|
:form-data="formData"
|
|
@@ -22,6 +31,7 @@
|
|
|
22
31
|
v-bind="formConfig"
|
|
23
32
|
:param="dialogParam"
|
|
24
33
|
class="data-table_height"
|
|
34
|
+
@hook:mounted="handleFormMounted"
|
|
25
35
|
/>
|
|
26
36
|
</div>
|
|
27
37
|
<span
|
|
@@ -34,7 +44,27 @@
|
|
|
34
44
|
<i class="el-icon-close el-icon"></i>
|
|
35
45
|
{{ $t2("取 消", "system.button.cancel2") }}
|
|
36
46
|
</el-button>
|
|
37
|
-
|
|
47
|
+
<!-- 模板配了 formConfig.actionButtons 时,用配置按钮替代「确定」(取消保持不变) -->
|
|
48
|
+
<template v-if="visibleFooterButtons">
|
|
49
|
+
<el-button
|
|
50
|
+
v-for="btn in visibleFooterButtons"
|
|
51
|
+
:key="btn.code"
|
|
52
|
+
:type="btn.type || 'primary'"
|
|
53
|
+
:plain="btn.plain === true"
|
|
54
|
+
class="button-sty"
|
|
55
|
+
:loading="!!btnLoadingMap[btn.code]"
|
|
56
|
+
@click="handleActionButton(btn)"
|
|
57
|
+
>
|
|
58
|
+
<i v-if="btn.icon" :class="[btn.icon, 'el-icon']"></i>
|
|
59
|
+
{{ btnLabel(btn) }}
|
|
60
|
+
</el-button>
|
|
61
|
+
</template>
|
|
62
|
+
<el-button
|
|
63
|
+
v-else-if="confirmButtonVisible"
|
|
64
|
+
type="primary"
|
|
65
|
+
@click="dialogSubmit"
|
|
66
|
+
class="button-sty"
|
|
67
|
+
>
|
|
38
68
|
<i class="el-icon-check el-icon"></i>
|
|
39
69
|
{{ $t2("确 定", "system.button.confirm2") }}
|
|
40
70
|
</el-button>
|
|
@@ -44,9 +74,22 @@
|
|
|
44
74
|
|
|
45
75
|
<script>
|
|
46
76
|
import VFormRender from "../../../../../components/xform/form-render/index.vue";
|
|
77
|
+
import {
|
|
78
|
+
resolveActionButtons,
|
|
79
|
+
hasButtonPermission,
|
|
80
|
+
isButtonVisible,
|
|
81
|
+
runActionButton,
|
|
82
|
+
} from "@base/components/formDialog/actionButtons";
|
|
47
83
|
|
|
48
84
|
export default {
|
|
49
|
-
components: {
|
|
85
|
+
components: {
|
|
86
|
+
VFormRender,
|
|
87
|
+
// 列表宿主页(x-tabs:常规/列表/其他页签/多标签编辑),仅 host:"list" 时加载
|
|
88
|
+
ListViewHost: () =>
|
|
89
|
+
import(
|
|
90
|
+
/* webpackChunkName: "form-list-host" */ "@base/views/user/form/view/list.vue"
|
|
91
|
+
),
|
|
92
|
+
},
|
|
50
93
|
props: {
|
|
51
94
|
visiable: Boolean,
|
|
52
95
|
option: Object,
|
|
@@ -76,7 +119,11 @@ export default {
|
|
|
76
119
|
currentLayoutType: null,
|
|
77
120
|
dataId: null,
|
|
78
121
|
formConfig: {},
|
|
79
|
-
confirmButtonVisible: true
|
|
122
|
+
confirmButtonVisible: true,
|
|
123
|
+
// 模板 formConfig.actionButtons(权限过滤后);为空则底部保持默认「确定」
|
|
124
|
+
customButtons: null,
|
|
125
|
+
btnLoadingMap: {},
|
|
126
|
+
formRefMounted: false,
|
|
80
127
|
};
|
|
81
128
|
},
|
|
82
129
|
computed: {
|
|
@@ -86,6 +133,13 @@ export default {
|
|
|
86
133
|
dialogParam() {
|
|
87
134
|
return this.option?.param;
|
|
88
135
|
},
|
|
136
|
+
// host:"list" —— 用列表宿主页承载(带「常规/列表」页签),而非直接渲染单个表单
|
|
137
|
+
listHost() {
|
|
138
|
+
return this.option?.host === "list";
|
|
139
|
+
},
|
|
140
|
+
listFormCode() {
|
|
141
|
+
return this.option?.formCode;
|
|
142
|
+
},
|
|
89
143
|
/* formConfig() {
|
|
90
144
|
return this.option?.formConfig;
|
|
91
145
|
}, */
|
|
@@ -107,6 +161,15 @@ export default {
|
|
|
107
161
|
config.title = this.$t1(config.title);
|
|
108
162
|
return config;
|
|
109
163
|
},
|
|
164
|
+
// 自定义按钮渲染列表:权限已在 initCustomButtons 过滤,此处按 visible 脚本过滤
|
|
165
|
+
visibleFooterButtons() {
|
|
166
|
+
if (!this.customButtons || !this.customButtons.length) return null;
|
|
167
|
+
this.formRefMounted; // eslint-disable-line no-unused-expressions
|
|
168
|
+
let buttons = this.customButtons.filter((btn) =>
|
|
169
|
+
isButtonVisible(btn, this.$refs.vFormRef)
|
|
170
|
+
);
|
|
171
|
+
return buttons.length ? buttons : null;
|
|
172
|
+
},
|
|
110
173
|
bodyConfig() {
|
|
111
174
|
let config = {};
|
|
112
175
|
let classStr = this.currentLayoutType;
|
|
@@ -131,6 +194,8 @@ export default {
|
|
|
131
194
|
this.currentLayoutType = currentFormConfig.layoutType;
|
|
132
195
|
|
|
133
196
|
this.selectMulti = this.option.multiple ?? true;
|
|
197
|
+
// 列表宿主页自己会加载模板;仅在未指定标题时补取一次模板名做弹框标题
|
|
198
|
+
if (this.listHost && this.option.dialogConfig?.title) return;
|
|
134
199
|
this.getReportTemplate();
|
|
135
200
|
},
|
|
136
201
|
methods: {
|
|
@@ -162,6 +227,8 @@ export default {
|
|
|
162
227
|
success: (res) => {
|
|
163
228
|
let formTemplate = res.objx || {};
|
|
164
229
|
this.formTemplate = formTemplate;
|
|
230
|
+
// 列表宿主模式:只借模板名做标题,渲染与按钮均由宿主页自己负责
|
|
231
|
+
if (this.listHost) return;
|
|
165
232
|
this.formJson = formTemplate.formViewContent
|
|
166
233
|
? JSON.parse(formTemplate.formViewContent)
|
|
167
234
|
: {};
|
|
@@ -170,11 +237,47 @@ export default {
|
|
|
170
237
|
if (formConfig.searchDialogUniqueField) {
|
|
171
238
|
this.fieldKey = formConfig.searchDialogUniqueField;
|
|
172
239
|
}
|
|
240
|
+
this.initCustomButtons(formConfig);
|
|
173
241
|
|
|
174
242
|
this.showRender = true;
|
|
175
243
|
},
|
|
176
244
|
});
|
|
177
245
|
},
|
|
246
|
+
// 模板 actionButtons:option.buttons 可覆盖;权限 formCode:authName 在此一次性过滤
|
|
247
|
+
initCustomButtons(formConfig) {
|
|
248
|
+
let buttons = resolveActionButtons(this.option?.buttons, formConfig);
|
|
249
|
+
this.customButtons = buttons
|
|
250
|
+
? buttons.filter((btn) => hasButtonPermission(btn, this.formCode, this))
|
|
251
|
+
: null;
|
|
252
|
+
},
|
|
253
|
+
handleFormMounted() {
|
|
254
|
+
this.formRefMounted = true;
|
|
255
|
+
},
|
|
256
|
+
btnLabel(btn) {
|
|
257
|
+
return this.$t1 ? this.$t1(btn.label) : btn.label;
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* 自定义按钮点击:校验 → onClick 脚本 → done/closeAfter 收口。
|
|
261
|
+
* 收口时优先回调 option.onAction(payload, formRef, vm);
|
|
262
|
+
* 未提供则仅按 closeAfter 关闭(按钮自身脚本即业务处理,不再走 option.confirm)。
|
|
263
|
+
*/
|
|
264
|
+
handleActionButton(btn) {
|
|
265
|
+
let formRef = this.$refs.vFormRef;
|
|
266
|
+
if (!formRef || this.btnLoadingMap[btn.code]) return;
|
|
267
|
+
this.$set(this.btnLoadingMap, btn.code, true);
|
|
268
|
+
let clearLoading = () => this.$set(this.btnLoadingMap, btn.code, false);
|
|
269
|
+
runActionButton(btn, {
|
|
270
|
+
formRef,
|
|
271
|
+
host: this,
|
|
272
|
+
getSelection: () => [],
|
|
273
|
+
onSettle: (payload, close) => {
|
|
274
|
+
if (typeof this.option.onAction === "function") {
|
|
275
|
+
this.option.onAction(payload, formRef, this);
|
|
276
|
+
}
|
|
277
|
+
if (close) this.close();
|
|
278
|
+
},
|
|
279
|
+
}).then(clearLoading, clearLoading);
|
|
280
|
+
},
|
|
178
281
|
close() {
|
|
179
282
|
let formRef = this.$refs.vFormRef;
|
|
180
283
|
this.showDialog = false;
|
|
@@ -206,6 +309,14 @@ export default {
|
|
|
206
309
|
.list-dialog {
|
|
207
310
|
.el-dialog__body {
|
|
208
311
|
height: calc(100% - 42px);
|
|
312
|
+
// host:"list":.cont 已有确定高度,把它传给 list.vue 根节点 #containt,
|
|
313
|
+
// .tab-box 自身是 height:100%,父链没高度页签内容区会塌成一条
|
|
314
|
+
.cont.fd-list-host {
|
|
315
|
+
padding: 0;
|
|
316
|
+
::v-deep > #containt {
|
|
317
|
+
height: 100%;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
209
320
|
.cont {
|
|
210
321
|
height: calc(100vh - 210px);
|
|
211
322
|
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-drawer v-bind="dialogConfig" @close="close" :visible.sync="showDialog">
|
|
3
|
-
|
|
3
|
+
<!-- host:"list" —— 承载列表宿主页(自带「常规(详情)/列表」页签),行点击进详情等行为与整页一致。
|
|
4
|
+
list.vue 根节点自带 #containt,本分支不再套 id,避免嵌套重复。 -->
|
|
5
|
+
<div class="cont fd-list-host" v-bind="bodyConfig" v-if="listHost">
|
|
6
|
+
<list-view-host :formCode="listFormCode" :param="dialogParam"/>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="cont" v-bind="bodyConfig" id="containt" v-else>
|
|
4
9
|
<v-form-render :form-json.sync="formJson" :form-data="formData" :option-data="optionData" ref="vFormRef"
|
|
5
10
|
:reportTemplate.sync="formTemplate" :conditionParam.sync="conditionParam"
|
|
6
11
|
:formInsData.sync="formInsData" v-if="showRender" visible-key="showRender" :parent-target="_self"
|
|
7
12
|
@reload="reload" :param="dialogParam"
|
|
8
|
-
class="data-table_height"/>
|
|
13
|
+
class="data-table_height" @hook:mounted="handleFormMounted"/>
|
|
9
14
|
</div>
|
|
10
15
|
<span class="dialog-footer" v-if="option.showFooter!==false" v-bind="option.footerConfig">
|
|
11
16
|
<el-button type="primary" plain class="button-sty" @click="close">
|
|
12
17
|
<i class="el-icon-close el-icon"></i>
|
|
13
18
|
{{ $t2('取 消', 'system.button.cancel2') }}
|
|
14
19
|
</el-button>
|
|
15
|
-
|
|
20
|
+
<!-- 模板配了 formConfig.actionButtons 时,用配置按钮替代「确定」(取消保持不变) -->
|
|
21
|
+
<template v-if="visibleFooterButtons">
|
|
22
|
+
<el-button v-for="btn in visibleFooterButtons" :key="btn.code" :type="btn.type || 'primary'"
|
|
23
|
+
:plain="btn.plain === true" class="button-sty" :loading="!!btnLoadingMap[btn.code]"
|
|
24
|
+
@click="handleActionButton(btn)">
|
|
25
|
+
<i v-if="btn.icon" :class="[btn.icon, 'el-icon']"></i>
|
|
26
|
+
{{ btnLabel(btn) }}
|
|
27
|
+
</el-button>
|
|
28
|
+
</template>
|
|
29
|
+
<el-button v-else type="primary" @click="dialogSubmit" class="button-sty">
|
|
16
30
|
<i class="el-icon-check el-icon"></i>
|
|
17
31
|
{{ $t2('确 定', 'system.button.confirm2') }}
|
|
18
32
|
</el-button>
|
|
@@ -22,9 +36,22 @@
|
|
|
22
36
|
|
|
23
37
|
<script>
|
|
24
38
|
import VFormRender from "../../../../../components/xform/form-render/index.vue";
|
|
39
|
+
import {
|
|
40
|
+
resolveActionButtons,
|
|
41
|
+
hasButtonPermission,
|
|
42
|
+
isButtonVisible,
|
|
43
|
+
runActionButton,
|
|
44
|
+
} from "@base/components/formDialog/actionButtons";
|
|
25
45
|
|
|
26
46
|
export default {
|
|
27
|
-
components: {
|
|
47
|
+
components: {
|
|
48
|
+
VFormRender,
|
|
49
|
+
// 列表宿主页(x-tabs:常规/列表/其他页签/多标签编辑),仅 host:"list" 时加载
|
|
50
|
+
ListViewHost: () =>
|
|
51
|
+
import(
|
|
52
|
+
/* webpackChunkName: "form-list-host" */ "@base/views/user/form/view/list.vue"
|
|
53
|
+
),
|
|
54
|
+
},
|
|
28
55
|
props: {
|
|
29
56
|
visiable: Boolean,
|
|
30
57
|
option: Object
|
|
@@ -52,7 +79,11 @@ export default {
|
|
|
52
79
|
conditionParam: null,
|
|
53
80
|
formInsData: null,
|
|
54
81
|
$grid: null,
|
|
55
|
-
currentLayoutType: null
|
|
82
|
+
currentLayoutType: null,
|
|
83
|
+
// 模板 formConfig.actionButtons(权限过滤后);为空则底部保持默认「确定」
|
|
84
|
+
customButtons: null,
|
|
85
|
+
btnLoadingMap: {},
|
|
86
|
+
formRefMounted: false
|
|
56
87
|
};
|
|
57
88
|
},
|
|
58
89
|
computed: {
|
|
@@ -62,6 +93,13 @@ export default {
|
|
|
62
93
|
dialogParam() {
|
|
63
94
|
return this.option?.param;
|
|
64
95
|
},
|
|
96
|
+
// host:"list" —— 用列表宿主页承载(带「常规/列表」页签),而非直接渲染单个表单
|
|
97
|
+
listHost() {
|
|
98
|
+
return this.option?.host === "list";
|
|
99
|
+
},
|
|
100
|
+
listFormCode() {
|
|
101
|
+
return this.option?.formCode;
|
|
102
|
+
},
|
|
65
103
|
dialogConfig() {
|
|
66
104
|
let customClass = "dialog-style list-dialog dialog-checkbox pd_0";
|
|
67
105
|
if (this.option.dialogConfig?.customClass) {
|
|
@@ -83,6 +121,15 @@ export default {
|
|
|
83
121
|
config.title = this.$t1(config.title);
|
|
84
122
|
return config;
|
|
85
123
|
},
|
|
124
|
+
// 自定义按钮渲染列表:权限已在 initCustomButtons 过滤,此处按 visible 脚本过滤
|
|
125
|
+
visibleFooterButtons() {
|
|
126
|
+
if (!this.customButtons || !this.customButtons.length) return null;
|
|
127
|
+
this.formRefMounted; // eslint-disable-line no-unused-expressions
|
|
128
|
+
let buttons = this.customButtons.filter((btn) =>
|
|
129
|
+
isButtonVisible(btn, this.$refs.vFormRef)
|
|
130
|
+
);
|
|
131
|
+
return buttons.length ? buttons : null;
|
|
132
|
+
},
|
|
86
133
|
bodyConfig() {
|
|
87
134
|
let config = {};
|
|
88
135
|
let classStr = this.currentLayoutType
|
|
@@ -101,6 +148,8 @@ export default {
|
|
|
101
148
|
this.currentLayoutType = currentFormConfig.layoutType
|
|
102
149
|
|
|
103
150
|
this.selectMulti = this.option.multiple ?? true;
|
|
151
|
+
// 列表宿主页自己会加载模板;仅在未指定标题时补取一次模板名做抽屉标题
|
|
152
|
+
if (this.listHost && this.option.dialogConfig?.title) return;
|
|
104
153
|
this.getReportTemplate();
|
|
105
154
|
},
|
|
106
155
|
methods: {
|
|
@@ -130,12 +179,15 @@ export default {
|
|
|
130
179
|
success: res => {
|
|
131
180
|
let formTemplate = res.objx || {};
|
|
132
181
|
this.formTemplate = formTemplate;
|
|
182
|
+
// 列表宿主模式:只借模板名做标题,渲染与按钮均由宿主页自己负责
|
|
183
|
+
if (this.listHost) return;
|
|
133
184
|
this.formJson = formTemplate.formViewContent ? JSON.parse(formTemplate.formViewContent) : {};
|
|
134
185
|
this.layoutType = this.formJson.formConfig.layoutType
|
|
135
186
|
let formConfig = this.formJson.formConfig;
|
|
136
187
|
if (formConfig.searchDialogUniqueField) {
|
|
137
188
|
this.fieldKey = formConfig.searchDialogUniqueField;
|
|
138
189
|
}
|
|
190
|
+
this.initCustomButtons(formConfig);
|
|
139
191
|
|
|
140
192
|
this.showRender = true;
|
|
141
193
|
|
|
@@ -143,6 +195,41 @@ export default {
|
|
|
143
195
|
}
|
|
144
196
|
});
|
|
145
197
|
},
|
|
198
|
+
// 模板 actionButtons:option.buttons 可覆盖;权限 formCode:authName 在此一次性过滤
|
|
199
|
+
initCustomButtons(formConfig) {
|
|
200
|
+
let buttons = resolveActionButtons(this.option?.buttons, formConfig);
|
|
201
|
+
this.customButtons = buttons
|
|
202
|
+
? buttons.filter((btn) => hasButtonPermission(btn, this.formCode, this))
|
|
203
|
+
: null;
|
|
204
|
+
},
|
|
205
|
+
handleFormMounted() {
|
|
206
|
+
this.formRefMounted = true;
|
|
207
|
+
},
|
|
208
|
+
btnLabel(btn) {
|
|
209
|
+
return this.$t1 ? this.$t1(btn.label) : btn.label;
|
|
210
|
+
},
|
|
211
|
+
/**
|
|
212
|
+
* 自定义按钮点击:校验 → onClick 脚本 → done/closeAfter 收口。
|
|
213
|
+
* 收口时优先回调 option.onAction(payload, formRef, vm);
|
|
214
|
+
* 未提供则仅按 closeAfter 关闭(按钮自身脚本即业务处理,不再走 option.confirm)。
|
|
215
|
+
*/
|
|
216
|
+
handleActionButton(btn) {
|
|
217
|
+
let formRef = this.$refs.vFormRef;
|
|
218
|
+
if (!formRef || this.btnLoadingMap[btn.code]) return;
|
|
219
|
+
this.$set(this.btnLoadingMap, btn.code, true);
|
|
220
|
+
let clearLoading = () => this.$set(this.btnLoadingMap, btn.code, false);
|
|
221
|
+
runActionButton(btn, {
|
|
222
|
+
formRef,
|
|
223
|
+
host: this,
|
|
224
|
+
getSelection: () => [],
|
|
225
|
+
onSettle: (payload, close) => {
|
|
226
|
+
if (typeof this.option.onAction === "function") {
|
|
227
|
+
this.option.onAction(payload, formRef, this);
|
|
228
|
+
}
|
|
229
|
+
if (close) this.close();
|
|
230
|
+
},
|
|
231
|
+
}).then(clearLoading, clearLoading);
|
|
232
|
+
},
|
|
146
233
|
close() {
|
|
147
234
|
let formRef = this.$refs.vFormRef;
|
|
148
235
|
this.showDialog = false;
|
|
@@ -172,6 +259,16 @@ export default {
|
|
|
172
259
|
.el-dialog__body {
|
|
173
260
|
height: calc(100% - 42px);
|
|
174
261
|
|
|
262
|
+
// host:"list":.cont 已有确定高度,把它传给 list.vue 根节点 #containt,
|
|
263
|
+
// .tab-box 自身是 height:100%,父链没高度页签内容区会塌成一条
|
|
264
|
+
.cont.fd-list-host {
|
|
265
|
+
padding: 0;
|
|
266
|
+
|
|
267
|
+
::v-deep > #containt {
|
|
268
|
+
height: 100%;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
175
272
|
.cont {
|
|
176
273
|
height: calc(100vh - 210px);
|
|
177
274
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<div class="clearfix screen-btns">
|
|
28
28
|
<div class="fr">
|
|
29
29
|
<vxe-button icon="el-icon-brush" class="button-sty" @click="resetEvent" type="text" status="primary"
|
|
30
|
-
plain
|
|
30
|
+
plain>刷新
|
|
31
31
|
</vxe-button>
|
|
32
32
|
<vxe-button status="warning" icon="el-icon-search" class="button-sty" @click="searchEvent">搜索</vxe-button>
|
|
33
33
|
</div>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<div class="clearfix screen-btns">
|
|
28
28
|
<div class="fr">
|
|
29
29
|
<vxe-button icon="el-icon-brush" class="button-sty" @click="resetEvent" type="text" status="primary"
|
|
30
|
-
plain
|
|
30
|
+
plain>刷新
|
|
31
31
|
</vxe-button>
|
|
32
32
|
<vxe-button status="warning" icon="el-icon-search" class="button-sty" @click="searchEvent">搜索</vxe-button>
|
|
33
33
|
</div>
|