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,423 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div
|
|
4
|
+
:id="uid"
|
|
5
|
+
style="margin: auto"
|
|
6
|
+
:style="{ height: setting.chartHeight ? setting.chartHeight + 'px' : '400px', width: setting.chartWidth ? setting.chartWidth + 'px' : '95%' }"
|
|
7
|
+
></div>
|
|
8
|
+
<div>
|
|
9
|
+
<Button class="ivu-fr" type="error" title="设置" custom-icon="fa fa-cog" v-if="allow('permission/tableView')" @click="openSetting()"></Button>
|
|
10
|
+
</div>
|
|
11
|
+
<modal-form ref="setting" view-code="ChartSetting">
|
|
12
|
+
<template #column="{ code }">
|
|
13
|
+
<template v-if="code == 'chartXCode' || code == 'chartGroupCode' || code == 'chartValueCode'">
|
|
14
|
+
<Input type="text" :readonly="true" :clearable="true" v-model="$refs.setting.data[code]" @click="columnCheck(tableView, $refs.setting.data, code)">
|
|
15
|
+
<template #prepend>
|
|
16
|
+
<Button custom-icon="fa fa-search" @click="columnCheck(tableView, $refs.setting.data, code)"></Button>
|
|
17
|
+
</template>
|
|
18
|
+
</Input>
|
|
19
|
+
</template>
|
|
20
|
+
</template>
|
|
21
|
+
<template #tableColumn="{ table, tableCode, row, code }">
|
|
22
|
+
<template v-if="tableCode == 'chartSeries' && (code == 'property' || code == 'nameProperty')">
|
|
23
|
+
<Input type="text" size="small" :readonly="true" v-model="row[code]" @click="columnCheck(tableView, row, code, table)">
|
|
24
|
+
<template #prepend>
|
|
25
|
+
<Button size="small" custom-icon="fa fa-search" @click="columnCheck(tableView, row, code, table)"></Button>
|
|
26
|
+
</template>
|
|
27
|
+
</Input>
|
|
28
|
+
</template>
|
|
29
|
+
</template>
|
|
30
|
+
<template #footer>
|
|
31
|
+
<Button type="primary" custom-icon="fa fa-save" @click="saveSetting">保存</Button>
|
|
32
|
+
</template>
|
|
33
|
+
</modal-form>
|
|
34
|
+
<column-check ref="columnCheck" />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
<script>
|
|
38
|
+
import mixinPage from '../../mixins/page';
|
|
39
|
+
import modelApi from '../../api/model';
|
|
40
|
+
import customModelApi from '../../api/customModel';
|
|
41
|
+
import dataSourceApi from '../../api/dataSource';
|
|
42
|
+
import { mapActions } from 'vuex';
|
|
43
|
+
import columnCheck from './column-check.vue';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @displayName view-chart 图表视图
|
|
47
|
+
*/
|
|
48
|
+
export default {
|
|
49
|
+
mixins: [mixinPage],
|
|
50
|
+
components: { columnCheck },
|
|
51
|
+
data() {
|
|
52
|
+
return {
|
|
53
|
+
uid: 'chart_' + (((1 + Math.random()) * 0x10000) | 0).toString(16),
|
|
54
|
+
data: null,
|
|
55
|
+
setting: {},
|
|
56
|
+
tableView: null,
|
|
57
|
+
chart: null
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
props: {
|
|
61
|
+
/**
|
|
62
|
+
* 视图代码
|
|
63
|
+
*/
|
|
64
|
+
viewCode: {
|
|
65
|
+
type: String
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* 是否静态数据
|
|
69
|
+
*/
|
|
70
|
+
static: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
computed: {},
|
|
76
|
+
created() {
|
|
77
|
+
if (this.viewCode) {
|
|
78
|
+
this.init(this.viewCode);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
watch: {},
|
|
82
|
+
methods: {
|
|
83
|
+
...mapActions('admin/dataView', { loadDataView: 'load', saveDataViewSetting: 'saveSetting' }),
|
|
84
|
+
/**
|
|
85
|
+
* 初始化
|
|
86
|
+
*
|
|
87
|
+
* @param {string} viewCode 视图代码
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
async init(viewCode) {
|
|
91
|
+
// 加载表格视图
|
|
92
|
+
let view = await this.loadDataView(viewCode);
|
|
93
|
+
|
|
94
|
+
if (view == null) {
|
|
95
|
+
this.error('视图代码不存在!' + viewCode);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.tableView = view.dataView;
|
|
100
|
+
if (!!(this.tableView.chartSetting || '').trim()) {
|
|
101
|
+
this.setting = JSON.parse(this.tableView.chartSetting);
|
|
102
|
+
} else {
|
|
103
|
+
this.setting = {};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 图表
|
|
107
|
+
this.chart = this.$echarts.init(document.getElementById(this.uid));
|
|
108
|
+
|
|
109
|
+
this.loadData();
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* 根据表格初始化
|
|
113
|
+
*
|
|
114
|
+
* @param {object} tableView 表格视图
|
|
115
|
+
* @param {object} data 数据
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
async initWithTable(tableView) {
|
|
119
|
+
this.tableView = tableView;
|
|
120
|
+
|
|
121
|
+
if (!!(this.tableView.chartSetting || '').trim()) {
|
|
122
|
+
this.setting = JSON.parse(this.tableView.chartSetting);
|
|
123
|
+
} else {
|
|
124
|
+
this.setting = {};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 图表
|
|
128
|
+
this.chart = this.$echarts.init(document.getElementById(this.uid));
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
131
|
+
* 加载数据
|
|
132
|
+
*
|
|
133
|
+
* @param {array} staticData 静态数据
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
async loadData(staticData) {
|
|
137
|
+
if (this.static) {
|
|
138
|
+
this.data = staticData;
|
|
139
|
+
} else {
|
|
140
|
+
let filter = {};
|
|
141
|
+
if (this.tableView.filtering) {
|
|
142
|
+
filter = JSON.parse(this.tableView.filtering);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let data = {
|
|
146
|
+
...filter
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
if (this.tableView.isGroupBy) {
|
|
150
|
+
data.isGroupBy = true;
|
|
151
|
+
data.groupColumn = JSON.parse(this.tableView.groupColumn);
|
|
152
|
+
data.groupMethod = JSON.parse(this.tableView.groupMethod);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (this.tableView.isCustom) {
|
|
156
|
+
let res = await customModelApi.query(this.tableView.model, data);
|
|
157
|
+
|
|
158
|
+
this.total = res.totalCount;
|
|
159
|
+
this.data = res.data;
|
|
160
|
+
} else if (this.tableView.isDataSource) {
|
|
161
|
+
let res = await dataSourceApi.query(this.tableView.dataSource, data);
|
|
162
|
+
|
|
163
|
+
this.total = res.totalCount;
|
|
164
|
+
this.data = res.table;
|
|
165
|
+
} else {
|
|
166
|
+
let res = await modelApi.query(this.tableView.model, data, this.tableView.functionName, this.tableView.functionType);
|
|
167
|
+
|
|
168
|
+
this.total = res.totalCount;
|
|
169
|
+
this.data = res.data;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this.loadChart();
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* 加载图表
|
|
177
|
+
*
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
loadChart(data) {
|
|
181
|
+
if (data) {
|
|
182
|
+
this.data = data;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// 加载图表
|
|
186
|
+
if (this.setting.chartXCode) {
|
|
187
|
+
var option = {
|
|
188
|
+
title: {
|
|
189
|
+
text: this.setting.chartTitle,
|
|
190
|
+
subtext: this.setting.chartSubtitle,
|
|
191
|
+
left: this.setting.chartTitleAlign == null ? 'left' : this.setting.chartTitleAlign
|
|
192
|
+
},
|
|
193
|
+
tooltip: {
|
|
194
|
+
// trigger: 'item'
|
|
195
|
+
},
|
|
196
|
+
legend: {
|
|
197
|
+
orient: this.setting.chartLegendOrient == null ? null : this.setting.chartLegendOrient,
|
|
198
|
+
left: this.setting.chartLegendAlign == null ? 'right' : this.setting.chartLegendAlign
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
if (!this.setting.chartCustomSeries) {
|
|
203
|
+
if (this.setting.chartType != 'Pie') {
|
|
204
|
+
let xAxis = Array.from(
|
|
205
|
+
new Set(
|
|
206
|
+
this.data.map(item => {
|
|
207
|
+
return this.parseData(item, this.setting.chartXCode);
|
|
208
|
+
})
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
// 柱状图或折线图
|
|
213
|
+
option.xAxis = {
|
|
214
|
+
data: xAxis
|
|
215
|
+
};
|
|
216
|
+
option.yAxis = {};
|
|
217
|
+
|
|
218
|
+
let group = [null];
|
|
219
|
+
|
|
220
|
+
if (this.setting.chartGroupCode) {
|
|
221
|
+
// 有分组
|
|
222
|
+
group = Array.from(
|
|
223
|
+
new Set(
|
|
224
|
+
this.data.map(item => {
|
|
225
|
+
return this.parseData(item, this.setting.chartGroupCode);
|
|
226
|
+
})
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
option.legend.data = group;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
option.series = group.map(item => {
|
|
234
|
+
let keyData = {};
|
|
235
|
+
this.data
|
|
236
|
+
.filter(data => {
|
|
237
|
+
return (item == null && group.length == 1) || this.parseData(data, this.setting.chartGroupCode) == item;
|
|
238
|
+
})
|
|
239
|
+
.forEach(data => {
|
|
240
|
+
let key = this.parseData(data, this.setting.chartXCode);
|
|
241
|
+
let value = this.parseData(data, this.setting.chartValueCode);
|
|
242
|
+
|
|
243
|
+
if (key in keyData) {
|
|
244
|
+
keyData[key] += value == null ? 0 : value;
|
|
245
|
+
} else {
|
|
246
|
+
keyData[key] = value == null ? 0 : value;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
return {
|
|
251
|
+
name: item,
|
|
252
|
+
type: this.setting.chartType.substr(0, 1).toLowerCase() + this.setting.chartType.substr(1),
|
|
253
|
+
data: xAxis.map(item => {
|
|
254
|
+
return {
|
|
255
|
+
name: item,
|
|
256
|
+
value: keyData[item]
|
|
257
|
+
};
|
|
258
|
+
})
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
} else {
|
|
262
|
+
let group = [null];
|
|
263
|
+
if (this.setting.chartGroupCode) {
|
|
264
|
+
// 有分组
|
|
265
|
+
group = Array.from(
|
|
266
|
+
new Set(
|
|
267
|
+
this.data.map(item => {
|
|
268
|
+
return this.parseData(item, this.setting.chartGroupCode);
|
|
269
|
+
})
|
|
270
|
+
)
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
let count = group.length;
|
|
275
|
+
|
|
276
|
+
option.series = group.map((item, index) => {
|
|
277
|
+
let keyData = {};
|
|
278
|
+
this.data
|
|
279
|
+
.filter(data => {
|
|
280
|
+
return (item == null && group.length == 1) || this.parseData(data, this.setting.chartGroupCode) == item;
|
|
281
|
+
})
|
|
282
|
+
.forEach(data => {
|
|
283
|
+
let key = this.parseData(data, this.setting.chartXCode);
|
|
284
|
+
let value = this.parseData(data, this.setting.chartValueCode);
|
|
285
|
+
|
|
286
|
+
if (key in keyData) {
|
|
287
|
+
keyData[key] += value == null ? 0 : value;
|
|
288
|
+
} else {
|
|
289
|
+
keyData[key] = value == null ? 0 : value;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
type: 'pie',
|
|
295
|
+
radius: (this.setting.itemWidth == null ? 70 : this.setting.itemWidth) + 100 / count,
|
|
296
|
+
center: [(100 / (count + 1)) * (index + 1) + '%', '50%'],
|
|
297
|
+
datasetIndex: index,
|
|
298
|
+
data: Object.keys(keyData).map(key => {
|
|
299
|
+
return {
|
|
300
|
+
name: key,
|
|
301
|
+
value: keyData[key]
|
|
302
|
+
};
|
|
303
|
+
}),
|
|
304
|
+
emphasis: {
|
|
305
|
+
itemStyle: {
|
|
306
|
+
shadowBlur: 10,
|
|
307
|
+
shadowOffsetX: 0,
|
|
308
|
+
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
// 自定义分组
|
|
316
|
+
let chartSeries = JSON.parse(this.setting.chartSeries);
|
|
317
|
+
let isPie = false;
|
|
318
|
+
|
|
319
|
+
if (
|
|
320
|
+
chartSeries.some(item => {
|
|
321
|
+
return item.chartType == 'Pie';
|
|
322
|
+
})
|
|
323
|
+
) {
|
|
324
|
+
// 饼图
|
|
325
|
+
isPie = true;
|
|
326
|
+
chartSeries = chartSeries.filter(item => {
|
|
327
|
+
return item.chartType == 'Pie';
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// 指定图表的配置项和数据
|
|
332
|
+
if (!isPie) {
|
|
333
|
+
option.xAxis = {
|
|
334
|
+
data: this.data.map(item => {
|
|
335
|
+
return this.parseData(item, this.setting.chartXCode);
|
|
336
|
+
})
|
|
337
|
+
};
|
|
338
|
+
option.yAxis = {};
|
|
339
|
+
option.legend.data = chartSeries.map(item => {
|
|
340
|
+
return item.name;
|
|
341
|
+
});
|
|
342
|
+
option.series = chartSeries.map(item => {
|
|
343
|
+
return {
|
|
344
|
+
name: item.name,
|
|
345
|
+
type: item.chartType.substr(0, 1).toLowerCase() + item.chartType.substr(1),
|
|
346
|
+
data: this.data.map(data => {
|
|
347
|
+
return this.parseData(data, item.property);
|
|
348
|
+
})
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
} else {
|
|
352
|
+
let count = chartSeries.length;
|
|
353
|
+
|
|
354
|
+
option.series = chartSeries.map((item, index) => {
|
|
355
|
+
return {
|
|
356
|
+
type: 'pie',
|
|
357
|
+
radius: (this.setting.itemWidth == null ? 70 : this.setting.itemWidth) + 100 / count,
|
|
358
|
+
center: [(100 / (count + 1)) * (index + 1) + '%', '50%'],
|
|
359
|
+
datasetIndex: index,
|
|
360
|
+
data: this.data.map(data => {
|
|
361
|
+
return {
|
|
362
|
+
name: this.parseData(data, item.nameProperty),
|
|
363
|
+
value: this.parseData(data, item.property)
|
|
364
|
+
};
|
|
365
|
+
}),
|
|
366
|
+
emphasis: {
|
|
367
|
+
itemStyle: {
|
|
368
|
+
shadowBlur: 10,
|
|
369
|
+
shadowOffsetX: 0,
|
|
370
|
+
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// 使用刚指定的配置项和数据显示图表。
|
|
379
|
+
this.chart.clear();
|
|
380
|
+
this.chart.setOption(option);
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
// 打开设置
|
|
384
|
+
openSetting() {
|
|
385
|
+
if (Object.keys(this.setting).length == 0) {
|
|
386
|
+
this.$refs.setting.openDefault();
|
|
387
|
+
} else {
|
|
388
|
+
this.$refs.setting.open(this.setting);
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
// 保存设置
|
|
392
|
+
async saveSetting() {
|
|
393
|
+
let isOK = await this.$refs.setting.validate();
|
|
394
|
+
|
|
395
|
+
if (!isOK) {
|
|
396
|
+
this.error('有内容不符合要求,请正确填写!');
|
|
397
|
+
} else {
|
|
398
|
+
this.confirm('确定要保存设置吗?', async () => {
|
|
399
|
+
this.tableView.chartSetting = JSON.stringify(this.$refs.setting.data);
|
|
400
|
+
await this.saveDataViewSetting(this.tableView);
|
|
401
|
+
this.success('保存成功!', () => {
|
|
402
|
+
this.$refs.setting.close();
|
|
403
|
+
window.location.reload();
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
// 打开字段选择
|
|
409
|
+
columnCheck(tableView, row, code, table) {
|
|
410
|
+
this.$refs.columnCheck.openView(tableView, checked => {
|
|
411
|
+
row[code] = checked.code;
|
|
412
|
+
row[code + 'Type'] = checked.dataType;
|
|
413
|
+
|
|
414
|
+
//this.$forceUpdate();
|
|
415
|
+
|
|
416
|
+
if (table) {
|
|
417
|
+
table.loadData();
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
</script>
|