diff --git a/vue/public/index.html b/vue/public/index.html index 06f27e9..249764d 100644 --- a/vue/public/index.html +++ b/vue/public/index.html @@ -7,11 +7,10 @@ <%= webpackConfig.name %> -
-
+

资源加载中......

diff --git a/vue/src/asset/style/element-ui.scss b/vue/src/asset/style/element-ui.scss index 1844cb2..c58301a 100644 --- a/vue/src/asset/style/element-ui.scss +++ b/vue/src/asset/style/element-ui.scss @@ -78,7 +78,7 @@ .el-scrollbar__wrap { //53 for dialog header,53 for dialog footer - max-height: calc(100vh - 53px - 53px - #{$nav-height * 2}); + max-height: calc(100vh - 53px - 53px - #{$dialog-top * 2}); } } diff --git a/vue/src/asset/style/variables.scss b/vue/src/asset/style/variables.scss index 3fa3f46..fc3cefc 100644 --- a/vue/src/asset/style/variables.scss +++ b/vue/src/asset/style/variables.scss @@ -80,6 +80,9 @@ $page-header-padding: 12px; //路由页面的margin $page-view-margin: 24px; +//dialog距离顶部的距离,用于的top属性、中滚动区域的最大高度 +$dialog-top: 100px; + // the :export directive is the magic sauce for webpack // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass :export { @@ -88,5 +91,5 @@ $page-view-margin: 24px; success: $--color-success; danger: $--color-danger; warning: $--color-warning; - navHeight: $nav-height; + dialogTop: $dialog-top; } diff --git a/vue/src/component/RegionSelector/Tab/index.vue b/vue/src/component/RegionSelector/Tab/index.vue index 91154c9..0c3920e 100644 --- a/vue/src/component/RegionSelector/Tab/index.vue +++ b/vue/src/component/RegionSelector/Tab/index.vue @@ -271,7 +271,7 @@ export default { init() { this.loading = true const hasInit = this.regionTree.length > 0 - const promise = () => hasInit ? Promise.resolve() : init() + const promise = () => hasInit ? Promise.resolve() : init(this.regionDataUrl) return promise() .then(() => this.limit ? this.limitApi() : Promise.resolve()) .then(data => { diff --git a/vue/src/component/RegionSelector/Tree/TreeDialog.vue b/vue/src/component/RegionSelector/Tree/TreeDialog.vue index af6e538..addaf7a 100644 --- a/vue/src/component/RegionSelector/Tree/TreeDialog.vue +++ b/vue/src/component/RegionSelector/Tree/TreeDialog.vue @@ -46,7 +46,7 @@ export default { init() { this.loading = true const hasInit = this.regionTree.length > 0 - const promise = () => hasInit ? Promise.resolve() : init() + const promise = () => hasInit ? Promise.resolve() : init(this.regionDataUrl) return promise() .then(() => this.limit ? this.limitApi() : Promise.resolve()) .then(data => data && (this.limitTree = createLimitTree(this.regionTree, data))) diff --git a/vue/src/component/RegionSelector/index.vue b/vue/src/component/RegionSelector/index.vue index 2a3451a..9486ad6 100644 --- a/vue/src/component/RegionSelector/index.vue +++ b/vue/src/component/RegionSelector/index.vue @@ -8,10 +8,25 @@ export default { functional: true, props: { - type: {type: String, default: 'tab', validator: v => ['tree', 'tab'].includes(v)} + type: { + type: String, + default: 'tab', + validator: v => ['tree', 'tab'].includes(v) + }, + + //省市地区json数据请求地址 + regionDataUrl: { + type: String, + default: `${process.env.BASE_URL}static/json/region-pca.json` + } }, render(h, context) { + if (!context.data.props) { + context.data.props = {} + } + context.data.props.regionDataUrl = context.props.regionDataUrl + return h(context.props.type === 'tree' ? Tree : Tab, context.data) } } diff --git a/vue/src/component/RegionSelector/mixin.js b/vue/src/component/RegionSelector/mixin.js index 6087103..f605d6c 100644 --- a/vue/src/component/RegionSelector/mixin.js +++ b/vue/src/component/RegionSelector/mixin.js @@ -5,6 +5,7 @@ export default { size: String, getChildrenOnSelect: Boolean, limit: Boolean, - limitApi: Function + limitApi: Function, + regionDataUrl: String } } diff --git a/vue/src/component/RegionSelector/store.js b/vue/src/component/RegionSelector/store.js index c9d5c7e..786a629 100644 --- a/vue/src/component/RegionSelector/store.js +++ b/vue/src/component/RegionSelector/store.js @@ -1,12 +1,11 @@ import Vue from 'vue' -import {regionDataUrl} from '@/config' export const store = Vue.observable({ data: [] }) -export function init() { - return fetch(regionDataUrl) +export function init(url) { + return fetch(url) .then(r => r.json()) .then(r => store.data = r || []) } diff --git a/vue/src/component/abstract/Dialog/index.vue b/vue/src/component/abstract/Dialog/index.vue index d9ff800..f0d899f 100644 --- a/vue/src/component/abstract/Dialog/index.vue +++ b/vue/src/component/abstract/Dialog/index.vue @@ -11,16 +11,16 @@ export default { value: Boolean, title: String, loading: {type: Boolean, default: true}, - top: {type: String, default: variables['navHeight']}, + top: {type: String, default: variables['dialogTop']}, width: {type: String, default: '30%'} }, render(h, context) { const {data, children, listeners, props: {value, title, loading, top, width}} = context - function onClose() { - listeners.input && listeners.input(false) - } + const onClose = function () { + return listeners.close ? () => listeners.close(false) : () => ({}) + }() return ( + {context.children} diff --git a/vue/src/component/form/Search/index.vue b/vue/src/component/form/Search/index.vue index 7668d7a..87f5bc1 100644 --- a/vue/src/component/form/Search/index.vue +++ b/vue/src/component/form/Search/index.vue @@ -1,9 +1,15 @@