Commit 57d1148da822d1fb2397ebbc070e40b266079b68
1 parent
40bd77f4
Exists in
dev
update
Showing
28 changed files
with
563 additions
and
12 deletions
Show diff stats
... | ... | @@ -0,0 +1,23 @@ |
1 | +const CopyWebpackPlugin = require('copy-webpack-plugin') | |
2 | +const path = require('path') | |
3 | + | |
4 | +const files = [ | |
5 | + 'sdk.js', | |
6 | + 'helper.css', | |
7 | + 'sdk.css', | |
8 | + 'iconfont.css', | |
9 | + 'iconfont.eot', | |
10 | + 'iconfont.woff', | |
11 | + 'iconfont.svg', | |
12 | + 'charts.js' | |
13 | +] | |
14 | + | |
15 | +const CopyAMISAssets = new CopyWebpackPlugin( | |
16 | + files.map((file) => { | |
17 | + return { | |
18 | + from: path.resolve(__dirname, 'node_modules', 'amis', 'sdk', file), | |
19 | + to: `./static/amis/${file}`, | |
20 | + } | |
21 | + }) | |
22 | +) | |
23 | +module.exports = CopyAMISAssets | ... | ... |
... | ... | @@ -0,0 +1,78 @@ |
1 | +import request from '@/utils/request' | |
2 | +const form = window.context.form | |
3 | +import axios from 'axios' | |
4 | +import { isExternal } from '@/utils/validate' | |
5 | +export const getAmisTemplate = function (aliasName) { | |
6 | + const params = { | |
7 | + templateId: '1820646919244943360', | |
8 | + queryFilter: { | |
9 | + pageBean: { page: 1, pageSize: 20, total: 5 }, | |
10 | + querys: [ | |
11 | + { | |
12 | + property: 't.F_alias', | |
13 | + value: aliasName, | |
14 | + group: 'main', | |
15 | + operation: 'EQUAL', | |
16 | + relation: 'AND', | |
17 | + }, | |
18 | + ], | |
19 | + sorter: [], | |
20 | + }, | |
21 | + } | |
22 | + return request({ | |
23 | + url: `${form}/form/dataTemplate/v1/listJson`, | |
24 | + method: 'post', | |
25 | + data: params | |
26 | + }) | |
27 | +} | |
28 | + | |
29 | +export const fetcher = ({ | |
30 | + url, // 接口地址 | |
31 | + method, // 请求方法 get、post、put、delete | |
32 | + data, // 请求数据 | |
33 | + responseType, | |
34 | + config, // 其他配置 | |
35 | + headers, // 请求头 | |
36 | +}) => { | |
37 | + config = config || {} | |
38 | + config.withCredentials = true | |
39 | + responseType && (config.responseType = responseType) | |
40 | + | |
41 | + if (config.cancelExecutor) { | |
42 | + config.cancelToken = new axios.CancelToken(config.cancelExecutor) | |
43 | + } | |
44 | + | |
45 | + config.headers = headers || {} | |
46 | + | |
47 | + if (method !== 'post' && method !== 'put' && method !== 'patch') { | |
48 | + if (data) { | |
49 | + config.params = data | |
50 | + } | |
51 | + | |
52 | + return request({ | |
53 | + url: isExternal(url) ? url : `${form}${url}`, | |
54 | + method, | |
55 | + config, | |
56 | + }) | |
57 | + } else if (data && data instanceof FormData) { | |
58 | + config.headers = config.headers || {} | |
59 | + config.headers['Content-Type'] = 'multipart/form-data' | |
60 | + } else if ( | |
61 | + data && | |
62 | + typeof data !== 'string' && | |
63 | + !(data instanceof Blob) && | |
64 | + !(data instanceof ArrayBuffer) | |
65 | + ) { | |
66 | + data = JSON.stringify(data) | |
67 | + config.headers = config.headers || {} | |
68 | + config.headers['Content-Type'] = 'application/json' | |
69 | + } | |
70 | + return request({ | |
71 | + url: isExternal(url) ? url : `${form}${url}`, // 接口地址 | |
72 | + method, // 请求方法 get、post、put、delete | |
73 | + data, // 请求数据 | |
74 | + responseType, | |
75 | + config, // 其他配置 | |
76 | + headers, // 请求头 | |
77 | + }) | |
78 | +} | ... | ... |
1.52 KB
1.13 KB
1.02 KB
796 Bytes
1.29 KB
982 Bytes
... | ... | @@ -0,0 +1,35 @@ |
1 | +import homePage from './homePage.png' | |
2 | +import homePage_active from './homePage_active.png' | |
3 | +import count from './count.png' | |
4 | +import count_active from './count_active.png' | |
5 | +import implement from './implement.png' | |
6 | +import implement_active from './implement_active.png' | |
7 | +import matter_ from './matter_.png' | |
8 | +import matter__active from './matter__active.png' | |
9 | +import meeting from './meeting.png' | |
10 | +import meeting_active from './meeting_active.png' | |
11 | +import report from './report.png' | |
12 | +import report_active from './report_active.png' | |
13 | +import rule from './rule.png' | |
14 | +import rule_active from './rule_active.png' | |
15 | +import setup from './setup.png' | |
16 | +import setup_active from './setup_active.png' | |
17 | + | |
18 | +export default { | |
19 | + homePage, | |
20 | + homePage_active, | |
21 | + count, | |
22 | + count_active, | |
23 | + implement, | |
24 | + implement_active, | |
25 | + matter_, | |
26 | + matter__active, | |
27 | + meeting, | |
28 | + meeting_active, | |
29 | + report, | |
30 | + report_active, | |
31 | + rule, | |
32 | + rule_active, | |
33 | + setup, | |
34 | + setup_active, | |
35 | +} | ... | ... |
1.4 KB
1.03 KB
1.91 KB
1.38 KB
1.01 KB
736 Bytes
1.62 KB
1.12 KB
2.15 KB
1.53 KB
194 KB
326 KB
frontend/front/src/components/amisContainer/AMISRenderer.vue
0 → 100644
... | ... | @@ -0,0 +1,150 @@ |
1 | +<template><div class="amis-container">Loading...</div></template> | |
2 | + | |
3 | +<script> | |
4 | + import qs from 'qs' | |
5 | + | |
6 | + export default { | |
7 | + name: 'AMISRenderer', | |
8 | + components: {}, | |
9 | + props: { | |
10 | + schema: { | |
11 | + type: Object, | |
12 | + default: () => ({}), | |
13 | + }, | |
14 | + locals: { | |
15 | + type: Object, | |
16 | + default: () => ({}), | |
17 | + }, | |
18 | + props: { | |
19 | + type: Object, | |
20 | + default: () => ({}), | |
21 | + }, | |
22 | + env: { | |
23 | + type: Object, | |
24 | + default: () => ({}), | |
25 | + }, | |
26 | + // 这里面的数据所有 amis 页面都可以获取到 | |
27 | + // 可以用来放一下公共数据,比如用户信息等 | |
28 | + // 不要放受控数据,受控数据应该通过 data 下发 | |
29 | + context: { | |
30 | + type: Object, | |
31 | + default: () => ({}), | |
32 | + }, | |
33 | + }, | |
34 | + data() { | |
35 | + const router = this.$router | |
36 | + return { | |
37 | + get location() { | |
38 | + const current = router.history.current | |
39 | + return { | |
40 | + pathname: current.path, | |
41 | + hash: current.hash, | |
42 | + query: current.query, | |
43 | + search: `?${qs.stringify(current.query)}`, | |
44 | + } | |
45 | + }, | |
46 | + loading: false, | |
47 | + amisInstance: null, | |
48 | + unmounted: false, | |
49 | + } | |
50 | + }, | |
51 | + | |
52 | + watch: { | |
53 | + locals: function () { | |
54 | + this.updateProps() | |
55 | + }, | |
56 | + props: function () { | |
57 | + this.updateProps() | |
58 | + }, | |
59 | + $route: function () { | |
60 | + this.updateProps() | |
61 | + }, | |
62 | + }, | |
63 | + async mounted() { | |
64 | + if (this.unmounted) { | |
65 | + return | |
66 | + } | |
67 | + | |
68 | + const scoped = amisRequire('amis/embed') | |
69 | + const { normalizeLink } = amisRequire('amis') | |
70 | + const router = this.$router | |
71 | + const instance = scoped.embed( | |
72 | + this.$el, | |
73 | + this.schema, | |
74 | + { | |
75 | + data: { | |
76 | + ...this.locals, | |
77 | + }, | |
78 | + context: this.context, | |
79 | + location: this.location, | |
80 | + | |
81 | + // todo 下发 location 对象 | |
82 | + ...this.props, | |
83 | + }, | |
84 | + { | |
85 | + jumpTo: (to, action) => { | |
86 | + // 覆盖内置的跳转逻辑,根据项目需求自己处理 | |
87 | + // if (to === 'goBack') { | |
88 | + // return router.go(-1) | |
89 | + // } | |
90 | + // | |
91 | + // to = normalizeLink(to, this.location) | |
92 | + // | |
93 | + // if (action?.actionType === 'url') { | |
94 | + // action.blank === false ? router.push(to) : window.open(to) | |
95 | + // return | |
96 | + // } | |
97 | + // | |
98 | + // // 主要是支持 nav 中的跳转 | |
99 | + // if (action && to && action.target) { | |
100 | + // window.open(to, action.target) | |
101 | + // return | |
102 | + // } | |
103 | + // | |
104 | + // if (/^https?:\/\//.test(to)) { | |
105 | + // window.location.replace(to) | |
106 | + // } else { | |
107 | + // router.push(to) | |
108 | + // } | |
109 | + }, | |
110 | + | |
111 | + updateLocation: (location, replace) => { | |
112 | + // 覆盖内置的跳转逻辑,根据项目需求自己处理 | |
113 | + // if (location === 'goBack') { | |
114 | + // return router.go(-1) | |
115 | + // } | |
116 | + // | |
117 | + // location = normalizeLink(location, this.location) | |
118 | + // replace ? router.replace(location) : router.replace(location) | |
119 | + }, | |
120 | + | |
121 | + ...this.env, | |
122 | + }, | |
123 | + () => { | |
124 | + this.$emit('ready', { | |
125 | + instance, | |
126 | + }) | |
127 | + } | |
128 | + ) | |
129 | + | |
130 | + this.amisInstance = instance | |
131 | + }, | |
132 | + | |
133 | + destroyed() { | |
134 | + this.unmounted = true | |
135 | + this.amisInstance?.unmount() | |
136 | + }, | |
137 | + | |
138 | + methods: { | |
139 | + updateProps() { | |
140 | + this.amisInstance?.updateProps({ | |
141 | + data: { | |
142 | + ...this.locals, | |
143 | + }, | |
144 | + context: this.context, | |
145 | + ...this.props, | |
146 | + }) | |
147 | + }, | |
148 | + }, | |
149 | + } | |
150 | +</script> | ... | ... |
... | ... | @@ -0,0 +1,86 @@ |
1 | +<template> | |
2 | + <AMISRenderer | |
3 | + v-if="!loading" | |
4 | + :env="env" | |
5 | + :schema="schemaContent" | |
6 | + :context="context" | |
7 | + :locals="{ ...locals, userInfo }" | |
8 | + :props="props" | |
9 | + /> | |
10 | +</template> | |
11 | +<script> | |
12 | + import AMISRenderer from './AMISRenderer.vue' | |
13 | + import copy from 'copy-to-clipboard' | |
14 | + import { fetcher, getAmisTemplate } from '@/api/amis' | |
15 | + import getValue from 'lodash/get' | |
16 | + import { mapState } from 'vuex' | |
17 | + export default { | |
18 | + components: { | |
19 | + AMISRenderer, | |
20 | + }, | |
21 | + props: { | |
22 | + alias: { | |
23 | + type: String, | |
24 | + default: '', | |
25 | + }, | |
26 | + schema: { | |
27 | + // 配置的页面数据 | |
28 | + type: Object, | |
29 | + default: () => ({}), | |
30 | + }, | |
31 | + locals: { | |
32 | + type: Object, | |
33 | + default: () => ({}), | |
34 | + }, | |
35 | + props: { | |
36 | + type: Object, | |
37 | + default: () => ({}), | |
38 | + }, | |
39 | + context: { | |
40 | + type: Object, | |
41 | + default: () => ({}), | |
42 | + }, | |
43 | + }, | |
44 | + data() { | |
45 | + return { | |
46 | + env: {}, | |
47 | + mySchema: {}, | |
48 | + loading: false, | |
49 | + } | |
50 | + }, | |
51 | + computed: { | |
52 | + ...mapState('user', ['userInfo']), | |
53 | + schemaContent() { | |
54 | + if (this.alias) { | |
55 | + return this.mySchema | |
56 | + } | |
57 | + return this.schema | |
58 | + }, | |
59 | + }, | |
60 | + created() { | |
61 | + this.getEnv() | |
62 | + this.requestData() | |
63 | + }, | |
64 | + methods: { | |
65 | + requestData() { | |
66 | + if (this.alias) { | |
67 | + // 有传别名就请求服务器获取amis页面内容 | |
68 | + this.loading = true | |
69 | + getAmisTemplate(this.alias) | |
70 | + .then((res) => { | |
71 | + this.mySchema = JSON.parse( | |
72 | + getValue(res, 'rows[0].wamisformtemplateftemplatecontent', '{}') | |
73 | + ) | |
74 | + }) | |
75 | + .finally(() => { | |
76 | + this.loading = false | |
77 | + }) | |
78 | + } | |
79 | + }, | |
80 | + getEnv() { | |
81 | + const isCancel = () => {} | |
82 | + this.env = { isCancel, fetcher, copy, theme: 'cxd' } | |
83 | + }, | |
84 | + }, | |
85 | + } | |
86 | +</script> | ... | ... |
frontend/front/src/components/layouts/HtTabsBar/index.vue
... | ... | @@ -26,22 +26,28 @@ |
26 | 26 | :closable="!isAffix(item)" |
27 | 27 | ></el-tab-pane> |
28 | 28 | </el-tabs> |
29 | - | |
30 | - <!-- 获取系统最新布局 --> | |
31 | - <div v-if="isShowDefaultLayoutBtn" class="layout-content"> | |
32 | - <el-button class="new-layout add-column" @click="handleAddColumn"> | |
29 | + <div class="layout-content"> | |
30 | + <el-button class="new-layout add-column" @click="handleAddOrder"> | |
33 | 31 | <i class="icon-f-plus"></i> |
34 | - 添加栏目 | |
35 | - </el-button> | |
36 | - <el-button | |
37 | - v-if="isNewLayout || isDragColumn" | |
38 | - class="new-layout" | |
39 | - @click="getDefaultLayout" | |
40 | - > | |
41 | - <span class="btn-text">获取最新门户</span> | |
32 | + 添加订单 | |
42 | 33 | </el-button> |
43 | 34 | </div> |
44 | 35 | |
36 | +<!-- <!– 获取系统最新布局 –>--> | |
37 | +<!-- <div v-if="isShowDefaultLayoutBtn" class="layout-content">--> | |
38 | +<!-- <el-button class="new-layout add-column" @click="handleAddColumn">--> | |
39 | +<!-- <i class="icon-f-plus"></i>--> | |
40 | +<!-- 添加栏目--> | |
41 | +<!-- </el-button>--> | |
42 | +<!-- <el-button--> | |
43 | +<!-- v-if="isNewLayout || isDragColumn"--> | |
44 | +<!-- class="new-layout"--> | |
45 | +<!-- @click="getDefaultLayout"--> | |
46 | +<!-- >--> | |
47 | +<!-- <span class="btn-text">获取最新门户</span>--> | |
48 | +<!-- </el-button>--> | |
49 | +<!-- </div>--> | |
50 | + | |
45 | 51 | <ul |
46 | 52 | v-if="contextMenuVisible" |
47 | 53 | :style="{ left: left + 'px', top: '108px' }" |
... | ... | @@ -217,6 +223,9 @@ |
217 | 223 | }) |
218 | 224 | }, |
219 | 225 | methods: { |
226 | + handleAddOrder(){ | |
227 | + this.$router.push('/addOrder') | |
228 | + }, | |
220 | 229 | getDefaultLayout() { |
221 | 230 | const layoutId = sessionStorage.getItem('layoutId') |
222 | 231 | if (layoutId) { | ... | ... |
frontend/front/src/router/index.js
... | ... | @@ -227,6 +227,20 @@ export const constantRoutes = [ |
227 | 227 | anonymous: true, |
228 | 228 | }, |
229 | 229 | }, |
230 | + { | |
231 | + path: '/lpg', | |
232 | + component: () => import('@/components/layouts'), | |
233 | + // redirect: 'index', | |
234 | + children: [ | |
235 | + { | |
236 | + path: '/addOrder', | |
237 | + name: 'addOrder', | |
238 | + component: () => import('@/views/pages/newOrder/index'), | |
239 | + hidden: true, | |
240 | + meta: { title: '新增订单' }, | |
241 | + }, | |
242 | + ], | |
243 | + }, | |
230 | 244 | ] |
231 | 245 | |
232 | 246 | const router = new VueRouter({ | ... | ... |
... | ... | @@ -0,0 +1,17 @@ |
1 | +.overflow-one-lines { | |
2 | + white-space: nowrap; | |
3 | + overflow: hidden; | |
4 | + text-overflow: ellipsis; | |
5 | +} | |
6 | + | |
7 | +.overflow-two-lines { | |
8 | + display: -webkit-box; | |
9 | + -webkit-line-clamp: 2; | |
10 | + -webkit-box-orient: vertical; | |
11 | + overflow: hidden; | |
12 | + text-overflow: ellipsis; | |
13 | +} | |
14 | + | |
15 | +.amis-container .is-required:before{ | |
16 | + display: none; | |
17 | +} | |
0 | 18 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,130 @@ |
1 | +// 快捷margin和padding | |
2 | + | |
3 | +// 方向列表 | |
4 | +$directions: top, right, bottom, left; | |
5 | + | |
6 | +// 数值范围(从1到100) | |
7 | +@for $i from 0 through 100 { | |
8 | + @each $direction in $directions { | |
9 | + | |
10 | + // 生成 margin 类 | |
11 | + .margin-#{$direction}-#{$i} { | |
12 | + margin-#{$direction}: #{$i}px; | |
13 | + } | |
14 | + | |
15 | + // 生成 padding 类 | |
16 | + .padding-#{$direction}-#{$i} { | |
17 | + padding-#{$direction}: #{$i}px; | |
18 | + } | |
19 | + } | |
20 | + | |
21 | + // 生成所有方向的 margin 类 | |
22 | + .margin-#{$i} { | |
23 | + margin: #{$i}px; | |
24 | + } | |
25 | + | |
26 | + // 生成所有方向的 padding 类 | |
27 | + .padding-#{$i} { | |
28 | + padding: #{$i}px; | |
29 | + } | |
30 | +} | |
31 | + | |
32 | + | |
33 | +// 使用Sass的循环生成动态的CSS类 | |
34 | +@for $i from 1 through 100 { | |
35 | + .w#{$i} { | |
36 | + width: $i * 1%; // 使用 $i 乘以 1% 来设置宽度 | |
37 | + } | |
38 | +} | |
39 | + | |
40 | +@for $i from 1 through 100 { | |
41 | + .h#{$i} { | |
42 | + height: $i * 1%; // 使用 $i 乘以 1% 来设置高度 | |
43 | + } | |
44 | +} | |
45 | + | |
46 | + | |
47 | +@for $i from 1 through 100 { | |
48 | + .fs#{$i} { | |
49 | + font-size: #{$i}px; | |
50 | + } | |
51 | +} | |
52 | + | |
53 | + | |
54 | + | |
55 | +// 主轴方向 属性值 | |
56 | +$directionList: row, row-reverse, column, column-reverse; | |
57 | +// 主轴对齐方式 属性值 | |
58 | +$justifyContentList: flex-start, flex-end, center, space-between, space-around; | |
59 | +// 交叉轴对齐方式 属性值 | |
60 | +$alignItemsList: flex-start, flex-end, center, baseline, stretch; | |
61 | + | |
62 | +// 三层遍历,组合所有属性值 | |
63 | +@each $direction in $directionList { | |
64 | + | |
65 | + // 简化一些属性值 | |
66 | + $dir: $direction; | |
67 | + | |
68 | + @if $direction =='row' { | |
69 | + $dir: 'x'; | |
70 | + } | |
71 | + | |
72 | + @if $direction =='column' { | |
73 | + $dir: 'y'; | |
74 | + } | |
75 | + | |
76 | + @each $justifyContent in $justifyContentList { | |
77 | + | |
78 | + // 简化一些属性值 | |
79 | + $JC: $justifyContent; | |
80 | + | |
81 | + @if $justifyContent =='flex-start' { | |
82 | + $JC: 'start'; | |
83 | + } | |
84 | + | |
85 | + @if $justifyContent =='flex-end' { | |
86 | + $JC: 'end'; | |
87 | + } | |
88 | + | |
89 | + @if $justifyContent =='space-between' { | |
90 | + $JC: 'between'; | |
91 | + } | |
92 | + | |
93 | + @if $justifyContent =='space-around' { | |
94 | + $JC: 'around'; | |
95 | + } | |
96 | + | |
97 | + @each $alignItems in $alignItemsList { | |
98 | + | |
99 | + // 简化一些属性值 | |
100 | + $AI: $alignItems; | |
101 | + | |
102 | + @if $alignItems =='flex-start' { | |
103 | + $AI: 'start'; | |
104 | + } | |
105 | + | |
106 | + @if $alignItems =='flex-end' { | |
107 | + $AI: 'end'; | |
108 | + } | |
109 | + | |
110 | + // 根据变量,组合为css代码 | |
111 | + @if $AI =='center' { | |
112 | + .flex-#{$dir}-#{$JC} { | |
113 | + display: flex; | |
114 | + flex-direction: $direction; | |
115 | + justify-content: $justifyContent; | |
116 | + align-items: center; | |
117 | + } | |
118 | + } | |
119 | + | |
120 | + @else { | |
121 | + .flex-#{$dir}-#{$JC}-#{$AI} { | |
122 | + display: flex; | |
123 | + flex-direction: $direction; | |
124 | + justify-content: $justifyContent; | |
125 | + align-items: $alignItems; | |
126 | + } | |
127 | + } | |
128 | + } | |
129 | + } | |
130 | +} | |
0 | 131 | \ No newline at end of file | ... | ... |