mooho-base-admin-plus 0.1.0
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/.env +5 -0
- package/.env.development +0 -0
- package/.env.production +0 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +47 -0
- package/.prettierrc +15 -0
- package/README.md +18 -0
- package/dist/favicon.ico +0 -0
- package/dist/mooho-base-admin-plus.min.esm.js +131746 -0
- package/dist/mooho-base-admin-plus.min.js +279 -0
- package/dist/setting.js +31 -0
- package/dist/static/images/app-barcode.png +0 -0
- package/dist/static/images/login/bg.png +0 -0
- package/dist/static/images/login/logo.png +0 -0
- package/dist/static/images/login/password-active.png +0 -0
- package/dist/static/images/login/password-default.png +0 -0
- package/dist/static/images/login/signIn-img.png +0 -0
- package/dist/static/images/login/user-active.png +0 -0
- package/dist/static/images/login/user-default.png +0 -0
- package/dist/static/images/logo-dark.png +0 -0
- package/dist/static/images/logo-small.png +0 -0
- package/dist/static/images/logo.png +0 -0
- package/dist/static/images/logo.svg +510 -0
- package/dist/static/images/no-image.png +0 -0
- package/dist/style.css +4 -0
- package/index.html +18 -0
- package/other/pda.vue +28 -0
- package/package.json +59 -0
- package/public/favicon.ico +0 -0
- package/public/setting.js +31 -0
- package/public/static/images/app-barcode.png +0 -0
- package/public/static/images/login/bg.png +0 -0
- package/public/static/images/login/logo.png +0 -0
- package/public/static/images/login/password-active.png +0 -0
- package/public/static/images/login/password-default.png +0 -0
- package/public/static/images/login/signIn-img.png +0 -0
- package/public/static/images/login/user-active.png +0 -0
- package/public/static/images/login/user-default.png +0 -0
- package/public/static/images/logo-dark.png +0 -0
- package/public/static/images/logo-small.png +0 -0
- package/public/static/images/logo.png +0 -0
- package/public/static/images/logo.svg +510 -0
- package/public/static/images/no-image.png +0 -0
- package/src/App.vue +60 -0
- package/src/api/application.js +35 -0
- package/src/api/customModel.js +187 -0
- package/src/api/customPage.js +15 -0
- package/src/api/customTable.js +24 -0
- package/src/api/dataSource.js +93 -0
- package/src/api/dataView.js +199 -0
- package/src/api/dictType.js +23 -0
- package/src/api/entityView.js +13 -0
- package/src/api/enum.js +15 -0
- package/src/api/filterColumn.js +16 -0
- package/src/api/model.js +244 -0
- package/src/api/movePlan.js +29 -0
- package/src/api/notification.js +28 -0
- package/src/api/openApiPermission.js +25 -0
- package/src/api/permission.js +51 -0
- package/src/api/planJob.js +15 -0
- package/src/api/process.js +23 -0
- package/src/api/processDef.js +36 -0
- package/src/api/processInst.js +16 -0
- package/src/api/rolePermission.js +17 -0
- package/src/api/roleProperty.js +36 -0
- package/src/api/shortcut.js +20 -0
- package/src/api/system.js +23 -0
- package/src/api/task.js +56 -0
- package/src/api/taskQueue.js +24 -0
- package/src/api/user.js +45 -0
- package/src/api/viewColumn.js +16 -0
- package/src/assets/svg/body.svg +17 -0
- package/src/assets/svg/header-theme-dark.svg +40 -0
- package/src/assets/svg/header-theme-primary.svg +40 -0
- package/src/assets/svg/header-top.svg +40 -0
- package/src/assets/svg/icon-happy.svg +1 -0
- package/src/assets/svg/icon-sad.svg +1 -0
- package/src/assets/svg/icon-social-bilibili.svg +1 -0
- package/src/assets/svg/icon-social-dingding.svg +1 -0
- package/src/assets/svg/icon-social-facebook.svg +1 -0
- package/src/assets/svg/icon-social-juejin.svg +1 -0
- package/src/assets/svg/icon-social-qq.svg +1 -0
- package/src/assets/svg/icon-social-twitter.svg +1 -0
- package/src/assets/svg/icon-social-wechat.svg +1 -0
- package/src/assets/svg/icon-social-weibo.svg +1 -0
- package/src/assets/svg/icon-social-zhihu.svg +1 -0
- package/src/assets/svg/nav-theme-dark.svg +40 -0
- package/src/assets/svg/nav-theme-light.svg +40 -0
- package/src/components/copyright/index.vue +28 -0
- package/src/components/home/notice-list.vue +62 -0
- package/src/components/home/shortcut.vue +125 -0
- package/src/components/input/dialog-select.vue +301 -0
- package/src/components/input/item-select.vue +195 -0
- package/src/components/link/index.vue +54 -0
- package/src/components/richEditor/index.vue +86 -0
- package/src/components/upload/file-upload.vue +84 -0
- package/src/components/upload/upload-attachment.vue +119 -0
- package/src/components/upload/upload-image.vue +212 -0
- package/src/components/view/column-check.vue +223 -0
- package/src/components/view/column-edit.vue +850 -0
- package/src/components/view/column-select.vue +206 -0
- package/src/components/view/condition-edit.vue +164 -0
- package/src/components/view/filter-edit.vue +633 -0
- package/src/components/view/filter-setting.vue +126 -0
- package/src/components/view/form-setting-layout.vue +375 -0
- package/src/components/view/form-setting.vue +247 -0
- package/src/components/view/group-column.vue +104 -0
- package/src/components/view/group-method.vue +104 -0
- package/src/components/view/mixin.js +72 -0
- package/src/components/view/modal-form-filter.vue +319 -0
- package/src/components/view/modal-form-sort.vue +248 -0
- package/src/components/view/modal-form.vue +453 -0
- package/src/components/view/modal-table.vue +471 -0
- package/src/components/view/table-filter.vue +702 -0
- package/src/components/view/table-setting.vue +533 -0
- package/src/components/view/view-chart.vue +423 -0
- package/src/components/view/view-form-draggable.vue +837 -0
- package/src/components/view/view-form.vue +1444 -0
- package/src/components/view/view-table.vue +2261 -0
- package/src/components/workflow/flow-chart.vue +846 -0
- package/src/directive/focus.js +10 -0
- package/src/directive/tabHide.js +9 -0
- package/src/i18n/index.js +15 -0
- package/src/i18n/locale/en-US.js +1 -0
- package/src/i18n/locale/lang.js +1 -0
- package/src/i18n/locale/zh-CN.js +1 -0
- package/src/i18n/locale.js +102 -0
- package/src/index.js +222 -0
- package/src/layouts/basic-layout/header-breadcrumb/index.vue +122 -0
- package/src/layouts/basic-layout/header-collapse/index.vue +44 -0
- package/src/layouts/basic-layout/header-fullscreen/index.vue +19 -0
- package/src/layouts/basic-layout/header-i18n/index.vue +45 -0
- package/src/layouts/basic-layout/header-log/index.vue +41 -0
- package/src/layouts/basic-layout/header-logo/index.vue +23 -0
- package/src/layouts/basic-layout/header-notice/index.vue +218 -0
- package/src/layouts/basic-layout/header-reload/index.vue +21 -0
- package/src/layouts/basic-layout/header-search/index.vue +37 -0
- package/src/layouts/basic-layout/header-setting/index.vue +219 -0
- package/src/layouts/basic-layout/header-user/index.vue +175 -0
- package/src/layouts/basic-layout/i18n.js +50 -0
- package/src/layouts/basic-layout/index.vue +280 -0
- package/src/layouts/basic-layout/menu-head/index.vue +120 -0
- package/src/layouts/basic-layout/menu-head/title.vue +48 -0
- package/src/layouts/basic-layout/menu-side/index.vue +113 -0
- package/src/layouts/basic-layout/menu-side/menu-collapse.vue +76 -0
- package/src/layouts/basic-layout/menu-side/menu-item.vue +31 -0
- package/src/layouts/basic-layout/menu-side/menu-title.vue +56 -0
- package/src/layouts/basic-layout/menu-side/submenu.vue +31 -0
- package/src/layouts/basic-layout/mixins/click-item.js +21 -0
- package/src/layouts/basic-layout/mixins/sider-menu-badge.js +13 -0
- package/src/layouts/basic-layout/mixins/translate-title.js +11 -0
- package/src/layouts/basic-layout/tabs/index.vue +192 -0
- package/src/layouts/basic-layout/water-mark/index.vue +29 -0
- package/src/libs/lodop/index.js +145 -0
- package/src/libs/random_str.js +10 -0
- package/src/libs/request/index.js +158 -0
- package/src/libs/system/index.js +234 -0
- package/src/libs/util.cookies.js +44 -0
- package/src/libs/util.db.js +13 -0
- package/src/libs/util.js +55 -0
- package/src/libs/util.log.js +88 -0
- package/src/libs/water-mark.js +44 -0
- package/src/menu/header.js +20 -0
- package/src/menu/modules/dashboard.js +23 -0
- package/src/menu/sider.js +12 -0
- package/src/mixins/app.js +9 -0
- package/src/mixins/page.js +643 -0
- package/src/pages/account/login.vue +101 -0
- package/src/pages/common/home.vue +169 -0
- package/src/pages/common/task-form.vue +350 -0
- package/src/pages/common/todo.vue +31 -0
- package/src/pages/system/apiLog.vue +79 -0
- package/src/pages/system/applicationType.vue +182 -0
- package/src/pages/system/customPage.vue +62 -0
- package/src/pages/system/customTable.vue +98 -0
- package/src/pages/system/dict.vue +36 -0
- package/src/pages/system/dictType.vue +58 -0
- package/src/pages/system/entityView.vue +38 -0
- package/src/pages/system/error/404.vue +6 -0
- package/src/pages/system/extendColumn.vue +99 -0
- package/src/pages/system/formView.vue +136 -0
- package/src/pages/system/log.vue +55 -0
- package/src/pages/system/notice.vue +26 -0
- package/src/pages/system/openApi.vue +26 -0
- package/src/pages/system/openUser.vue +66 -0
- package/src/pages/system/organization.vue +98 -0
- package/src/pages/system/organizationType.vue +26 -0
- package/src/pages/system/permission.vue +175 -0
- package/src/pages/system/planJob.vue +40 -0
- package/src/pages/system/printTemplate.vue +48 -0
- package/src/pages/system/process.vue +79 -0
- package/src/pages/system/processType.vue +26 -0
- package/src/pages/system/role.vue +395 -0
- package/src/pages/system/rolePropertyEdit.vue +480 -0
- package/src/pages/system/sequenceSetting.vue +26 -0
- package/src/pages/system/systemData.vue +52 -0
- package/src/pages/system/tableView.vue +386 -0
- package/src/pages/system/taskQueue.vue +48 -0
- package/src/pages/system/user.vue +250 -0
- package/src/pages/template/processPage.vue +243 -0
- package/src/pages/template/reportPage.vue +66 -0
- package/src/pages/template/viewPage.vue +139 -0
- package/src/plugins/auth/index.js +21 -0
- package/src/plugins/error/index.js +31 -0
- package/src/plugins/index.js +24 -0
- package/src/plugins/sweetalert2/index.js +20 -0
- package/src/router/dynamic.js +183 -0
- package/src/router/index.js +84 -0
- package/src/setting.js +202 -0
- package/src/store/index.js +9 -0
- package/src/store/modules/admin/index.js +16 -0
- package/src/store/modules/admin/modules/account.js +103 -0
- package/src/store/modules/admin/modules/cache.js +119 -0
- package/src/store/modules/admin/modules/dataView.js +112 -0
- package/src/store/modules/admin/modules/db.js +231 -0
- package/src/store/modules/admin/modules/i18n.js +87 -0
- package/src/store/modules/admin/modules/layout.js +115 -0
- package/src/store/modules/admin/modules/loader.js +44 -0
- package/src/store/modules/admin/modules/log.js +77 -0
- package/src/store/modules/admin/modules/menu.js +338 -0
- package/src/store/modules/admin/modules/page.js +466 -0
- package/src/store/modules/admin/modules/user.js +96 -0
- package/src/store/modules/admin/modules/viewPage.js +34 -0
- package/src/styles/common.less +47 -0
- package/src/styles/css/default.css +510 -0
- package/src/styles/css/login.css +1217 -0
- package/src/styles/default/index.less +6 -0
- package/src/styles/font/demo.css +539 -0
- package/src/styles/font/demo_index.html +372 -0
- package/src/styles/font/icon-demo/demo.css +539 -0
- package/src/styles/font/icon-demo/demo_index.html +423 -0
- package/src/styles/font/icon-demo/iconfont.css +61 -0
- package/src/styles/font/icon-demo/iconfont.eot +0 -0
- package/src/styles/font/icon-demo/iconfont.js +1 -0
- package/src/styles/font/icon-demo/iconfont.svg +59 -0
- package/src/styles/font/icon-demo/iconfont.ttf +0 -0
- package/src/styles/font/icon-demo/iconfont.woff +0 -0
- package/src/styles/font/icon-demo/iconfont.woff2 +0 -0
- package/src/styles/font/iconfont.css +47 -0
- package/src/styles/font/iconfont.js +1 -0
- package/src/styles/font/iconfont.json +65 -0
- package/src/styles/font/iconfont.ttf +0 -0
- package/src/styles/font/iconfont.woff +0 -0
- package/src/styles/font/iconfont.woff2 +0 -0
- package/src/styles/font/ionicons.svg +870 -0
- package/src/styles/font/ionicons.ttf +0 -0
- package/src/styles/font/ionicons.woff +0 -0
- package/src/styles/font/ionicons.woff2 +0 -0
- package/src/styles/index.less +7 -0
- package/src/styles/layout/basic-layout/layout.less +527 -0
- package/src/styles/layout/basic-layout/menu.less +274 -0
- package/src/styles/layout/index.less +2 -0
- package/src/styles/setting.less +6 -0
- package/styleguide.config.js +22 -0
- package/test/api/barcode.js +50 -0
- package/test/api/inbound.js +47 -0
- package/test/api/interfaceLog.js +15 -0
- package/test/api/interfaceQueue.js +15 -0
- package/test/api/interfaceServer.js +29 -0
- package/test/api/movePlan.js +50 -0
- package/test/api/movePlanItem.js +13 -0
- package/test/api/moveType.js +22 -0
- package/test/api/openApiPermission.js +25 -0
- package/test/api/outbound.js +40 -0
- package/test/api/permission.js +34 -0
- package/test/api/rolePermission.js +17 -0
- package/test/api/user.js +40 -0
- package/test/api/viewColumn.js +16 -0
- package/test/api/warehouse.js +13 -0
- package/test/api/warehouseMoveType.js +18 -0
- package/test/main.js +55 -0
- package/test/package.js +33 -0
- package/test/pages/home/index.vue +22 -0
- package/test/pages/task/test.vue +28 -0
- package/test/pages/test/dataViewTest.vue +28 -0
- package/test/pages/test/logReport.vue +25 -0
- package/test/pages/test/testPage.vue +38 -0
- package/test/router/routes.js +88 -0
- package/test/setting.env.js +22 -0
- package/test/styles/css/custom.css +0 -0
- package/test/styles/css/login.css +1217 -0
- package/vite.config.js +72 -0
- package/vue.config.js +20 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<Modal
|
|
4
|
+
v-model="opened"
|
|
5
|
+
scrollable
|
|
6
|
+
:mask-closable="maskClosable == null ? layout.maskClosable : maskClosable"
|
|
7
|
+
:draggable="draggable == null ? layout.draggable : draggable"
|
|
8
|
+
:sticky="true"
|
|
9
|
+
:reset-drag-position="true"
|
|
10
|
+
:width="formView.width || '800'"
|
|
11
|
+
:before-close="beforeClose"
|
|
12
|
+
@on-visible-change="onVisibleChange"
|
|
13
|
+
>
|
|
14
|
+
<template #header>
|
|
15
|
+
<div>
|
|
16
|
+
<!--
|
|
17
|
+
@slot 页头
|
|
18
|
+
-->
|
|
19
|
+
<slot name="header">
|
|
20
|
+
<span class="title">{{ formView.name }}</span>
|
|
21
|
+
<span class="description">{{ formView.description }}</span>
|
|
22
|
+
</slot>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
<div class="ivu-ml-8 ivu-mr-8">
|
|
26
|
+
<view-form ref="form" :view-code="viewCode" :readonly="!canSave()" :defaultData="defaultData" :setting-enable="settingEnable" @on-change="onChange" @on-ready="onReady">
|
|
27
|
+
<template #top="{ form }">
|
|
28
|
+
<!--
|
|
29
|
+
@slot 顶部
|
|
30
|
+
@binding {object} form 表单对象
|
|
31
|
+
-->
|
|
32
|
+
<slot name="top" :form="form"></slot>
|
|
33
|
+
</template>
|
|
34
|
+
<template #column="{ form, data, column, code }">
|
|
35
|
+
<!--
|
|
36
|
+
@slot 自定义列
|
|
37
|
+
@binding {object} form 表单对象
|
|
38
|
+
@binding {object} data 数据对象
|
|
39
|
+
@binding {object} column 列对象
|
|
40
|
+
@binding {string} code 列代码
|
|
41
|
+
-->
|
|
42
|
+
<slot name="column" :form="form" :data="data" :column="column" :code="code"></slot>
|
|
43
|
+
</template>
|
|
44
|
+
<template #tableColumn="{ table, tableData, tableColumn, tableCode, row, index, column, code }">
|
|
45
|
+
<!--
|
|
46
|
+
@slot 内嵌表格自定义列
|
|
47
|
+
@binding {object} table 表格对象
|
|
48
|
+
@binding {object} tableData 表格数据对象
|
|
49
|
+
@binding {object} tableColumn 表格列对象
|
|
50
|
+
@binding {string} tableCode 表格列代码
|
|
51
|
+
@binding {object} row 行对象
|
|
52
|
+
@binding {int} index 行序号
|
|
53
|
+
@binding {object} column 行对象
|
|
54
|
+
@binding {string} code 列代码
|
|
55
|
+
-->
|
|
56
|
+
<slot
|
|
57
|
+
name="tableColumn"
|
|
58
|
+
:table="table"
|
|
59
|
+
:tableData="tableData"
|
|
60
|
+
:tableColumn="tableColumn"
|
|
61
|
+
:tableCode="tableCode"
|
|
62
|
+
:row="row"
|
|
63
|
+
:index="index"
|
|
64
|
+
:column="column"
|
|
65
|
+
:code="code"
|
|
66
|
+
></slot>
|
|
67
|
+
</template>
|
|
68
|
+
<template #bottom="{ form }">
|
|
69
|
+
<!--
|
|
70
|
+
@slot 底部
|
|
71
|
+
@binding {object} form 表单对象
|
|
72
|
+
-->
|
|
73
|
+
<slot name="bottom" :form="form"></slot>
|
|
74
|
+
</template>
|
|
75
|
+
</view-form>
|
|
76
|
+
</div>
|
|
77
|
+
<template #footer>
|
|
78
|
+
<div>
|
|
79
|
+
<!--
|
|
80
|
+
@slot 页脚
|
|
81
|
+
-->
|
|
82
|
+
<slot name="footer">
|
|
83
|
+
<Button type="primary" custom-icon="fa fa-save" v-if="canSave() && saveEnable" @click="onSave">保存</Button>
|
|
84
|
+
</slot>
|
|
85
|
+
<Button type="default" custom-icon="fa fa-times" @click="clickClose">关闭</Button>
|
|
86
|
+
<Button type="error" title="设置" custom-icon="fa fa-cog" v-if="settingEnable && allow('permission/formView')" @click="settingOpen"></Button>
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
89
|
+
</Modal>
|
|
90
|
+
<form-setting ref="setting" v-if="settingActive" :is-setting="true" @layout-mode="layoutMode" @on-change="init" />
|
|
91
|
+
<form-setting-layout ref="settingLayout" v-if="settingActive" :is-setting="true" @list-mode="listMode" @on-change="init" />
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
<script>
|
|
95
|
+
import mixinPage from '../../mixins/page';
|
|
96
|
+
import modelApi from '../../api/model';
|
|
97
|
+
import customModelApi from '../../api/customModel';
|
|
98
|
+
import formSetting from './form-setting';
|
|
99
|
+
import formSettingLayout from './form-setting-layout';
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @displayName modal-form 表单对话框
|
|
103
|
+
*/
|
|
104
|
+
export default {
|
|
105
|
+
mixins: [mixinPage],
|
|
106
|
+
components: { formSetting, formSettingLayout },
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
opened: false,
|
|
110
|
+
formView: {},
|
|
111
|
+
settingActive: false
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
async created() {},
|
|
115
|
+
props: {
|
|
116
|
+
/**
|
|
117
|
+
* 表单视图代码
|
|
118
|
+
*/
|
|
119
|
+
viewCode: {
|
|
120
|
+
type: String
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* 只读
|
|
124
|
+
*/
|
|
125
|
+
readonly: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: false
|
|
128
|
+
},
|
|
129
|
+
/**
|
|
130
|
+
* 预设默认值
|
|
131
|
+
*/
|
|
132
|
+
defaultData: {
|
|
133
|
+
type: Object,
|
|
134
|
+
default() {
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* 允许创建
|
|
140
|
+
*/
|
|
141
|
+
createEnable: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: true
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* 允许编辑
|
|
147
|
+
*/
|
|
148
|
+
editEnable: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: true
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* 是否允许保存
|
|
154
|
+
*/
|
|
155
|
+
saveEnable: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: true
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* 是否允许点击遮罩层关闭
|
|
161
|
+
*/
|
|
162
|
+
maskClosable: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
default: null
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* 是否允许拖动
|
|
168
|
+
*/
|
|
169
|
+
draggable: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: null
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* 是否允许配置界面
|
|
175
|
+
*/
|
|
176
|
+
settingEnable: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
default: true
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* 验证方法
|
|
182
|
+
*/
|
|
183
|
+
validateFunction: {
|
|
184
|
+
type: Function
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* 关闭前方法
|
|
188
|
+
*/
|
|
189
|
+
beforeClose: {
|
|
190
|
+
type: Function
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
computed: {
|
|
194
|
+
// formView () {
|
|
195
|
+
// return this.$refs.form.formView;
|
|
196
|
+
// },
|
|
197
|
+
data() {
|
|
198
|
+
return this.$refs.form.data;
|
|
199
|
+
},
|
|
200
|
+
columns() {
|
|
201
|
+
return this.$refs.form.columns;
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
methods: {
|
|
205
|
+
/**
|
|
206
|
+
* 初始化
|
|
207
|
+
*
|
|
208
|
+
* @param {string} viewCode 视图代码
|
|
209
|
+
* @param {function} callback 完成后回调方法
|
|
210
|
+
* @param {function} onFail 失败后回调方法
|
|
211
|
+
* @public
|
|
212
|
+
*/
|
|
213
|
+
async init(viewCode, callback, onFail) {
|
|
214
|
+
await this.$refs.form.init(viewCode, callback, onFail);
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* 加载视图
|
|
218
|
+
*
|
|
219
|
+
* @param {object} view 视图
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
loadView(view) {
|
|
223
|
+
this.$refs.form.loadView(view);
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* 打开
|
|
227
|
+
*
|
|
228
|
+
* @param {object} data 数据
|
|
229
|
+
* @param {object} compare 对比数据,不一致标红
|
|
230
|
+
* @public
|
|
231
|
+
*/
|
|
232
|
+
open(data, compare) {
|
|
233
|
+
if (data) {
|
|
234
|
+
this.$refs.form.data = this.copy(data);
|
|
235
|
+
this.$refs.form.compareData = compare;
|
|
236
|
+
// this.$refs.form.reset();
|
|
237
|
+
} else {
|
|
238
|
+
this.$refs.form.setDefault();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
setTimeout(() => {
|
|
242
|
+
this.$refs.form.onDataChange();
|
|
243
|
+
this.$refs.form.clearValidate();
|
|
244
|
+
this.opened = true;
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* 用默认值打开
|
|
249
|
+
*
|
|
250
|
+
* @param {object} def 默认值
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
openDefault(def) {
|
|
254
|
+
this.$refs.form.setDefault(def);
|
|
255
|
+
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
this.$refs.form.onDataChange();
|
|
258
|
+
this.$refs.form.clearValidate();
|
|
259
|
+
this.opened = true;
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
/**
|
|
263
|
+
* 设置数据
|
|
264
|
+
*
|
|
265
|
+
* @param {object} data 数据
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
setData(data) {
|
|
269
|
+
this.$refs.form.data = data;
|
|
270
|
+
//this.forceUpdate();
|
|
271
|
+
},
|
|
272
|
+
/**
|
|
273
|
+
* 关闭
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
async close() {
|
|
278
|
+
this.opened = false;
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* 设为默认值
|
|
282
|
+
*
|
|
283
|
+
* @param {object}} data 默认值
|
|
284
|
+
* @public
|
|
285
|
+
*/
|
|
286
|
+
setDefault(data) {
|
|
287
|
+
this.$refs.form.setDefault(data);
|
|
288
|
+
},
|
|
289
|
+
/**
|
|
290
|
+
* 验证
|
|
291
|
+
*
|
|
292
|
+
* @public
|
|
293
|
+
*/
|
|
294
|
+
validate() {
|
|
295
|
+
return this.$refs.form.validate();
|
|
296
|
+
},
|
|
297
|
+
/**
|
|
298
|
+
* 获取完整数据
|
|
299
|
+
*
|
|
300
|
+
* @public
|
|
301
|
+
*/
|
|
302
|
+
getFullData() {
|
|
303
|
+
return this.$refs.form.getFullData();
|
|
304
|
+
},
|
|
305
|
+
// /**
|
|
306
|
+
// * 强制更新
|
|
307
|
+
// *
|
|
308
|
+
// * @public
|
|
309
|
+
// */
|
|
310
|
+
// forceUpdate() {
|
|
311
|
+
// //this.$refs.form.$forceUpdate();
|
|
312
|
+
// },
|
|
313
|
+
onChange(sender, oldValue, newValue, selected) {
|
|
314
|
+
/**
|
|
315
|
+
* 数据变化事件
|
|
316
|
+
* @property {object} sender 触发的列对象
|
|
317
|
+
* @property {object} oldValue 原数据
|
|
318
|
+
* @property {object} newValue 新数据
|
|
319
|
+
* @property {object} selected 选中对象(弹出选择框等有效)
|
|
320
|
+
*/
|
|
321
|
+
this.$emit('on-change', sender, oldValue, newValue, selected);
|
|
322
|
+
},
|
|
323
|
+
/**
|
|
324
|
+
* 设置表格字段内容
|
|
325
|
+
*
|
|
326
|
+
* @param {string} code 字段
|
|
327
|
+
* @param {object} value 值
|
|
328
|
+
* @public
|
|
329
|
+
*/
|
|
330
|
+
setTableData(code, value) {
|
|
331
|
+
this.$refs.form.setTableData(code, value);
|
|
332
|
+
},
|
|
333
|
+
/**
|
|
334
|
+
* 刷新
|
|
335
|
+
*
|
|
336
|
+
* @public
|
|
337
|
+
*/
|
|
338
|
+
refresh() {
|
|
339
|
+
this.$refs.form.refresh();
|
|
340
|
+
},
|
|
341
|
+
onReady(formView) {
|
|
342
|
+
this.formView = formView;
|
|
343
|
+
},
|
|
344
|
+
onVisibleChange(show) {
|
|
345
|
+
// 关闭时清空数据
|
|
346
|
+
if (!show) {
|
|
347
|
+
this.$refs.form.reset();
|
|
348
|
+
/**
|
|
349
|
+
* 关闭事件
|
|
350
|
+
*/
|
|
351
|
+
this.$emit('on-close');
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
canSave() {
|
|
355
|
+
if (this.readonly) {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (this.$refs.form && this.$refs.form.data) {
|
|
360
|
+
if (!this.$refs.form.data.id) {
|
|
361
|
+
return this.createEnable;
|
|
362
|
+
} else {
|
|
363
|
+
return this.editEnable;
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
// 保存
|
|
370
|
+
async onSave() {
|
|
371
|
+
let isOK = await this.$refs.form.validate();
|
|
372
|
+
|
|
373
|
+
if (!isOK) {
|
|
374
|
+
this.error('有内容不符合要求,请正确填写!');
|
|
375
|
+
} else {
|
|
376
|
+
// 验证方法
|
|
377
|
+
if (this.validateFunction) {
|
|
378
|
+
if (!this.validateFunction()) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* 保存前事件
|
|
385
|
+
*/
|
|
386
|
+
this.$emit('on-before-save');
|
|
387
|
+
|
|
388
|
+
let data = this.$refs.form.getFullData();
|
|
389
|
+
if (!data) {
|
|
390
|
+
// 表格验证失败
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
this.confirm('确定要保存吗?', async () => {
|
|
395
|
+
if (this.formView.isCustom) {
|
|
396
|
+
if (!data.id) {
|
|
397
|
+
await customModelApi.add(this.formView.model, data);
|
|
398
|
+
} else {
|
|
399
|
+
await customModelApi.update(this.formView.model, data);
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
if (!data.id) {
|
|
403
|
+
await modelApi.add(this.formView.model, data);
|
|
404
|
+
} else {
|
|
405
|
+
await modelApi.update(this.formView.model, data);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
this.success('操作成功!', () => {
|
|
410
|
+
this.$refs.form.data = {};
|
|
411
|
+
/**
|
|
412
|
+
* 保存后事件
|
|
413
|
+
*/
|
|
414
|
+
this.$emit('on-after-save', data);
|
|
415
|
+
this.close();
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
// 打开设置界面
|
|
421
|
+
settingOpen() {
|
|
422
|
+
this.settingActive = true;
|
|
423
|
+
|
|
424
|
+
setTimeout(async () => {
|
|
425
|
+
this.$refs.settingLayout.open(this.formView, this.copy(this.formView.columns));
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
// 切换至列表模式
|
|
429
|
+
listMode({ dataView, columns }) {
|
|
430
|
+
this.$refs.settingLayout.close();
|
|
431
|
+
this.$refs.setting.open(dataView, columns);
|
|
432
|
+
},
|
|
433
|
+
// 切换至预览模式
|
|
434
|
+
layoutMode({ dataView, columns }) {
|
|
435
|
+
this.$refs.setting.close();
|
|
436
|
+
this.$refs.settingLayout.open(dataView, columns);
|
|
437
|
+
},
|
|
438
|
+
// 点击关闭按钮
|
|
439
|
+
clickClose() {
|
|
440
|
+
if (typeof this.beforeClose == 'function') {
|
|
441
|
+
this.beforeClose().then(
|
|
442
|
+
() => {
|
|
443
|
+
this.close();
|
|
444
|
+
},
|
|
445
|
+
() => {}
|
|
446
|
+
);
|
|
447
|
+
} else {
|
|
448
|
+
this.close();
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
</script>
|