From 061c0a4b46cf5c49d8910eda079d226d46621d78 Mon Sep 17 00:00:00 2001 From: toesbieya <1647775459@126.com> Date: Thu, 15 Oct 2020 08:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E5=B1=8F=E5=8A=A0=E8=BD=BD=E7=9A=84CS?= =?UTF-8?q?S=E7=A7=BB=E5=8A=A8=E5=88=B0=E8=A1=8C=E5=86=85=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86scss=E5=8F=98=E9=87=8F=EF=BC=9A$dialog-top=20?= =?UTF-8?q?abstract-from-item=E7=9A=84dense=E5=B1=9E=E6=80=A7=E6=94=B9?= =?UTF-8?q?=E4=B8=BAthin=20search-form=E5=A2=9E=E5=8A=A0=E4=BA=86=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD=20=E8=A1=8C=E6=94=BF=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E7=9A=84=E6=95=B0=E6=8D=AE=E8=AF=B7=E6=B1=82=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E4=BB=8E@/config=E7=A7=BB=E5=8A=A8=E5=88=B0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=86=85=EF=BC=88@/component/RegionSelector=EF=BC=89?= =?UTF-8?q?=20=E8=B7=AF=E7=94=B1=E6=A0=B9=E8=8A=82=E7=82=B9=E7=9A=84redire?= =?UTF-8?q?ct=E4=BC=98=E5=85=88=E4=BD=BF=E7=94=A8=E9=A2=84=E8=AE=BE?= =?UTF-8?q?=E5=80=BC=20@/util/index.js=E4=B8=AD=E7=9A=84mergeObj=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=B8=8D=E5=86=8D=E5=B0=86function=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E8=BD=AC=E4=B8=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/public/index.html | 3 +- vue/src/asset/style/element-ui.scss | 2 +- vue/src/asset/style/variables.scss | 5 ++- .../component/RegionSelector/Tab/index.vue | 2 +- .../RegionSelector/Tree/TreeDialog.vue | 2 +- vue/src/component/RegionSelector/index.vue | 17 +++++++- vue/src/component/RegionSelector/mixin.js | 3 +- vue/src/component/RegionSelector/store.js | 5 +-- vue/src/component/abstract/Dialog/index.vue | 8 ++-- vue/src/component/abstract/Form/item.vue | 12 +++--- vue/src/component/form/Search/index.vue | 10 ++++- vue/src/config/index.js | 5 +-- vue/src/mixin/docTableMixin.js | 2 +- vue/src/router/util.js | 6 +-- vue/src/util/index.js | 42 +++++++++++-------- vue/src/view/message/manage/EditDialog.vue | 20 ++++----- vue/src/view/stock/current/indexPage.vue | 5 +-- 17 files changed, 87 insertions(+), 62 deletions(-) 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 @@