@netang/quasar 0.0.20
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/LICENSE +21 -0
- package/README.md +17 -0
- package/components/column-title/index.vue +32 -0
- package/components/dialog/components/index.js +6 -0
- package/components/dialog/components/move-to-tree/index.vue +150 -0
- package/components/dialog/index.vue +330 -0
- package/components/dialog-table/index.vue +92 -0
- package/components/dragger/index.vue +202 -0
- package/components/drawer/index.vue +262 -0
- package/components/field-date/index.vue +844 -0
- package/components/field-date/methods.js +100 -0
- package/components/field-table/index.vue +468 -0
- package/components/field-text/index.vue +167 -0
- package/components/field-tree/index.vue +435 -0
- package/components/input-number/index.vue +324 -0
- package/components/input-number/number.js +67 -0
- package/components/input-price-cent/index.vue +213 -0
- package/components/input-price-yuan/index.vue +179 -0
- package/components/layout/index.vue +119 -0
- package/components/list-menu/index.vue +137 -0
- package/components/list-menu-item/index.vue +79 -0
- package/components/power-data/index.vue +667 -0
- package/components/search/index.vue +176 -0
- package/components/search-item/index.vue +219 -0
- package/components/select/index.vue +71 -0
- package/components/select-filter/index.vue +75 -0
- package/components/table/index.vue +347 -0
- package/components/table-column-fixed/index.vue +68 -0
- package/components/table-pagination/index.vue +83 -0
- package/components/table-summary/index.vue +91 -0
- package/components/thumbnail/index.vue +87 -0
- package/components/toolbar/container.vue +31 -0
- package/components/toolbar/index.vue +405 -0
- package/components/uploader/index.vue +157 -0
- package/components/uploader-query/index.vue +731 -0
- package/package.json +21 -0
- package/sass/common.scss +165 -0
- package/sass/index.scss +14 -0
- package/sass/line.scss +39 -0
- package/sass/quasar/btn.scss +46 -0
- package/sass/quasar/common.scss +3 -0
- package/sass/quasar/dialog.scss +7 -0
- package/sass/quasar/drawer.scss +6 -0
- package/sass/quasar/field.scss +210 -0
- package/sass/quasar/loading.scss +6 -0
- package/sass/quasar/menu.scss +8 -0
- package/sass/quasar/table.scss +112 -0
- package/sass/quasar/toolbar.scss +22 -0
- package/store/index.js +32 -0
- package/utils/$area.js +387 -0
- package/utils/$auth.js +135 -0
- package/utils/$dialog.js +43 -0
- package/utils/$role.js +807 -0
- package/utils/$rule.js +17 -0
- package/utils/$search.js +336 -0
- package/utils/$table.js +802 -0
- package/utils/$tree.js +620 -0
- package/utils/$uploader.js +1029 -0
- package/utils/alert.js +10 -0
- package/utils/bus.js +6 -0
- package/utils/config.js +22 -0
- package/utils/confrim.js +11 -0
- package/utils/dict.js +44 -0
- package/utils/getData.js +61 -0
- package/utils/getFile.js +30 -0
- package/utils/getImage.js +136 -0
- package/utils/getTime.js +94 -0
- package/utils/http.js +251 -0
- package/utils/loading.js +13 -0
- package/utils/notify.js +13 -0
- package/utils/previewImage.js +8 -0
- package/utils/symbols.js +3 -0
- package/utils/timestamp.js +18 -0
- package/utils/toast.js +13 -0
- package/utils/uploader/aliyun.js +6 -0
- package/utils/uploader/local.js +8 -0
- package/utils/uploader/qiniu.js +311 -0
- package/utils/useAuth.js +26 -0
- package/utils/useRouter.js +36 -0
- package/utils/useUploader.js +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-present, Netang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## Installation
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npm install @netang/admin --save-dev
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Install mandatory peer dependencies
|
|
8
|
+
```bash
|
|
9
|
+
npm install @netang/utils --save-dev
|
|
10
|
+
npm install lodash --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
[MIT](https://opensource.org/licenses/MIT)
|
|
16
|
+
|
|
17
|
+
Copyright (c) 2022-present, Netang
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="full-width">
|
|
3
|
+
<q-badge
|
|
4
|
+
:label="label"
|
|
5
|
+
color="grey-7"
|
|
6
|
+
outline
|
|
7
|
+
>
|
|
8
|
+
<!-- 提示信息 -->
|
|
9
|
+
<q-tooltip anchor="center right" self="center left" v-if="tooltip">{{tooltip}}</q-tooltip>
|
|
10
|
+
</q-badge>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 标识
|
|
19
|
+
*/
|
|
20
|
+
name: 'NColumnTitle',
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 声明属性
|
|
24
|
+
*/
|
|
25
|
+
props: {
|
|
26
|
+
// 标签
|
|
27
|
+
label: [String, Number],
|
|
28
|
+
// 提示信息
|
|
29
|
+
tooltip: [String, Number],
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="q-pa-sm q-gutter-sm">
|
|
3
|
+
|
|
4
|
+
<!-- 搜索框 -->
|
|
5
|
+
<q-input
|
|
6
|
+
v-model="treeFilter"
|
|
7
|
+
placeholder="搜索"
|
|
8
|
+
dense
|
|
9
|
+
outlined
|
|
10
|
+
clearable
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
<!-- 分类树 -->
|
|
14
|
+
<q-tree
|
|
15
|
+
ref="treeRef"
|
|
16
|
+
color="grey-5"
|
|
17
|
+
:nodes="treeNodes"
|
|
18
|
+
:filter="treeFilter"
|
|
19
|
+
:node-key="treeNodeKey"
|
|
20
|
+
v-model:expanded="treeExpanded"
|
|
21
|
+
selected-color="primary"
|
|
22
|
+
v-model:selected="treeSelected"
|
|
23
|
+
no-selection-unset
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { ref, isRef, toRaw, watch } from 'vue'
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 标识
|
|
35
|
+
*/
|
|
36
|
+
name: 'NMoveToTree',
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 组合式
|
|
40
|
+
*/
|
|
41
|
+
setup() {
|
|
42
|
+
|
|
43
|
+
// ==========【注入】============================================================================================
|
|
44
|
+
|
|
45
|
+
// 获取对话框注入数据
|
|
46
|
+
const {
|
|
47
|
+
// 提交数据
|
|
48
|
+
submit,
|
|
49
|
+
// 父级声明属性
|
|
50
|
+
props,
|
|
51
|
+
} = utils.$dialog.inject()
|
|
52
|
+
|
|
53
|
+
const {
|
|
54
|
+
// 树节点列表
|
|
55
|
+
nodes,
|
|
56
|
+
// 树展开节点
|
|
57
|
+
expanded,
|
|
58
|
+
// 节点唯一键值
|
|
59
|
+
nodeKey,
|
|
60
|
+
|
|
61
|
+
} = Object.assign({
|
|
62
|
+
nodeKey: 'id',
|
|
63
|
+
}, props)
|
|
64
|
+
|
|
65
|
+
// 对话框提交数据
|
|
66
|
+
submit(onSubmit)
|
|
67
|
+
|
|
68
|
+
// ==========【数据】=============================================================================================
|
|
69
|
+
|
|
70
|
+
// 树节点
|
|
71
|
+
const treeRef = ref(null)
|
|
72
|
+
|
|
73
|
+
// 树节点列表
|
|
74
|
+
const treeNodes = format(nodes)
|
|
75
|
+
|
|
76
|
+
// 树节点唯一键值
|
|
77
|
+
const treeNodeKey = ref(nodeKey)
|
|
78
|
+
|
|
79
|
+
// 树筛选
|
|
80
|
+
const treeFilter = ref('')
|
|
81
|
+
|
|
82
|
+
// 树展开节点
|
|
83
|
+
const treeExpanded = format(expanded)
|
|
84
|
+
|
|
85
|
+
// 树选择数据
|
|
86
|
+
const treeSelected = ref(0)
|
|
87
|
+
|
|
88
|
+
// 当前选择值
|
|
89
|
+
const currentValue = ref({})
|
|
90
|
+
|
|
91
|
+
// ==========【监听数据】==========================================================================================
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 监听树选择数据
|
|
95
|
+
*/
|
|
96
|
+
watch(treeSelected, function(value) {
|
|
97
|
+
// 设置当前选择值
|
|
98
|
+
currentValue.value = {
|
|
99
|
+
value,
|
|
100
|
+
node: treeRef.value.getNodeByKey(value),
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// ==========【方法】=============================================================================================
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 提交
|
|
108
|
+
*/
|
|
109
|
+
function onSubmit() {
|
|
110
|
+
return currentValue.value
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 格式化列表
|
|
115
|
+
*/
|
|
116
|
+
function format(val) {
|
|
117
|
+
|
|
118
|
+
if (val) {
|
|
119
|
+
|
|
120
|
+
if (isRef(val)) {
|
|
121
|
+
return ref(val.value)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (utils.isValidArray(val)) {
|
|
125
|
+
return ref(val)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return ref([])
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ==========【返回】=============================================================================================
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
// 树节点
|
|
136
|
+
treeRef,
|
|
137
|
+
// 树列表
|
|
138
|
+
treeNodes,
|
|
139
|
+
// 节点唯一键值
|
|
140
|
+
treeNodeKey,
|
|
141
|
+
// 树筛选
|
|
142
|
+
treeFilter,
|
|
143
|
+
// 树展开节点
|
|
144
|
+
treeExpanded,
|
|
145
|
+
// 树选择数据
|
|
146
|
+
treeSelected,
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</script>
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-dialog
|
|
3
|
+
class="n-dialog-proxy"
|
|
4
|
+
ref="dialogRef"
|
|
5
|
+
v-bind="dialogProps"
|
|
6
|
+
@hide="onDialogHide"
|
|
7
|
+
>
|
|
8
|
+
<q-card class="flex column" :style="customStyle">
|
|
9
|
+
|
|
10
|
+
<!-- 头部 -->
|
|
11
|
+
<q-toolbar>
|
|
12
|
+
<!-- 标题 -->
|
|
13
|
+
<q-toolbar-title>{{currentTitle}}</q-toolbar-title>
|
|
14
|
+
<!-- 关闭按钮 -->
|
|
15
|
+
<q-btn flat round dense icon="close" v-close-popup v-if="close" />
|
|
16
|
+
</q-toolbar>
|
|
17
|
+
|
|
18
|
+
<!-- 内容 -->
|
|
19
|
+
<q-card-section class="n-flex-1 no-padding">
|
|
20
|
+
<q-layout
|
|
21
|
+
class="absolute-full"
|
|
22
|
+
view="hHh lpr fFf"
|
|
23
|
+
container
|
|
24
|
+
>
|
|
25
|
+
<q-page-container>
|
|
26
|
+
<component
|
|
27
|
+
:is="comp"
|
|
28
|
+
v-bind="props"
|
|
29
|
+
/>
|
|
30
|
+
</q-page-container>
|
|
31
|
+
</q-layout>
|
|
32
|
+
</q-card-section>
|
|
33
|
+
|
|
34
|
+
<!-- 底部 -->
|
|
35
|
+
<q-card-actions align="right" v-if="bottom">
|
|
36
|
+
<!-- 取消按钮 -->
|
|
37
|
+
<q-btn label="取消" color="primary" @click="onDialogCancel" flat v-close-popup v-if="cancel" />
|
|
38
|
+
<!-- 确定按钮 -->
|
|
39
|
+
<q-btn label="确定" color="primary" @click="onDialogConfirm" flat />
|
|
40
|
+
</q-card-actions>
|
|
41
|
+
</q-card>
|
|
42
|
+
</q-dialog>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
import { ref, computed, defineAsyncComponent, provide } from 'vue'
|
|
47
|
+
import { useDialogPluginComponent, useQuasar } from 'quasar'
|
|
48
|
+
|
|
49
|
+
import routers from '@/router/routers'
|
|
50
|
+
|
|
51
|
+
import components from './components'
|
|
52
|
+
import { NDialogKey } from '../../utils/symbols'
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 标识
|
|
58
|
+
*/
|
|
59
|
+
name: 'NDialog',
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 声明属性
|
|
63
|
+
*/
|
|
64
|
+
props: {
|
|
65
|
+
// 对话框传参
|
|
66
|
+
dialogProps: Object,
|
|
67
|
+
// 组件标识
|
|
68
|
+
name: String,
|
|
69
|
+
// 路由组件路径
|
|
70
|
+
route: String,
|
|
71
|
+
// 组件传参
|
|
72
|
+
props: Object,
|
|
73
|
+
// 标题
|
|
74
|
+
title: String,
|
|
75
|
+
// 显示关闭按钮
|
|
76
|
+
close: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: true,
|
|
79
|
+
},
|
|
80
|
+
// 显示取消按钮
|
|
81
|
+
cancel: Boolean,
|
|
82
|
+
// 确定按钮
|
|
83
|
+
onConfirm: Function,
|
|
84
|
+
// 显示底部
|
|
85
|
+
bottom: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: true,
|
|
88
|
+
},
|
|
89
|
+
// 宽度
|
|
90
|
+
width: {
|
|
91
|
+
type: [String, Number],
|
|
92
|
+
default: '50%',
|
|
93
|
+
},
|
|
94
|
+
// 高度
|
|
95
|
+
height: {
|
|
96
|
+
type: [String, Number],
|
|
97
|
+
default: '80%',
|
|
98
|
+
},
|
|
99
|
+
// 最小宽度
|
|
100
|
+
minWidth: {
|
|
101
|
+
type: [String, Number],
|
|
102
|
+
default: '600px',
|
|
103
|
+
},
|
|
104
|
+
// 是否全屏
|
|
105
|
+
fullscreen: Boolean,
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 声明事件
|
|
110
|
+
*/
|
|
111
|
+
emits: [
|
|
112
|
+
...useDialogPluginComponent.emits
|
|
113
|
+
],
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 组合式
|
|
117
|
+
*/
|
|
118
|
+
setup(props) {
|
|
119
|
+
|
|
120
|
+
// ==========【数据】============================================================================================
|
|
121
|
+
|
|
122
|
+
// quasar 对象
|
|
123
|
+
const $q = useQuasar()
|
|
124
|
+
|
|
125
|
+
const {
|
|
126
|
+
// 对话框节点
|
|
127
|
+
dialogRef,
|
|
128
|
+
// 对话框取消
|
|
129
|
+
onDialogCancel,
|
|
130
|
+
// 对话框隐藏
|
|
131
|
+
onDialogHide,
|
|
132
|
+
} = useDialogPluginComponent()
|
|
133
|
+
|
|
134
|
+
// ==========【注入】============================================================================================
|
|
135
|
+
|
|
136
|
+
// 对话框值
|
|
137
|
+
const dialogValue = ref(null)
|
|
138
|
+
|
|
139
|
+
// 组件提交方法
|
|
140
|
+
let compSubmit
|
|
141
|
+
|
|
142
|
+
// 向后代注入数据
|
|
143
|
+
provide(NDialogKey, {
|
|
144
|
+
// 值
|
|
145
|
+
value: dialogValue,
|
|
146
|
+
// 表格参数
|
|
147
|
+
dialogProps: props,
|
|
148
|
+
// 传参
|
|
149
|
+
props: props.props,
|
|
150
|
+
// 提交值
|
|
151
|
+
submit(cb) {
|
|
152
|
+
compSubmit = cb
|
|
153
|
+
},
|
|
154
|
+
// 提交
|
|
155
|
+
confirm: onDialogConfirm,
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
// ==========【计算属性】=========================================================================================
|
|
159
|
+
|
|
160
|
+
function setWH(style, field, sign) {
|
|
161
|
+
if (props[field]) {
|
|
162
|
+
if (utils.indexOf(props[field], '%') > -1) {
|
|
163
|
+
style[field] = props[field].replace('%', sign)
|
|
164
|
+
} else {
|
|
165
|
+
style[field] = utils.px(props[field])
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 自定义样式
|
|
172
|
+
*/
|
|
173
|
+
const customStyle = computed(function () {
|
|
174
|
+
|
|
175
|
+
const style = {}
|
|
176
|
+
|
|
177
|
+
if (
|
|
178
|
+
props.fullscreen
|
|
179
|
+
|| $q.platform.is.mobile
|
|
180
|
+
|| (props.width === '100%' && props.height === '100%')
|
|
181
|
+
) {
|
|
182
|
+
style.width = '100vw'
|
|
183
|
+
style.height = '100vh'
|
|
184
|
+
style.borderRadius = 0
|
|
185
|
+
|
|
186
|
+
} else {
|
|
187
|
+
// 宽度
|
|
188
|
+
setWH(style, 'width', 'vw')
|
|
189
|
+
// 高度
|
|
190
|
+
setWH(style, 'height', 'vh')
|
|
191
|
+
// 最小宽度
|
|
192
|
+
setWH(style, 'minWidth', 'vw')
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return style
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 获取当前组件
|
|
200
|
+
*/
|
|
201
|
+
const comp = computed(function () {
|
|
202
|
+
|
|
203
|
+
// 组件
|
|
204
|
+
let comp
|
|
205
|
+
|
|
206
|
+
// 如果是路由路径
|
|
207
|
+
if (props.route) {
|
|
208
|
+
// 获取路由组件
|
|
209
|
+
comp = _.get(routers, `${utils.slash(props.route, 'start', false)}.component`)
|
|
210
|
+
|
|
211
|
+
// 如果有组件标识
|
|
212
|
+
} else if (props.name && _.has(components, props.name)) {
|
|
213
|
+
// 获取自定义组件
|
|
214
|
+
comp = components[props.name]
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// 如果没有组件
|
|
218
|
+
if (! comp) {
|
|
219
|
+
return
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// 如果是方法, 则说明是异步组件
|
|
223
|
+
if (_.isFunction(comp)) {
|
|
224
|
+
return defineAsyncComponent(comp)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// 返回组件
|
|
228
|
+
return comp
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* 当前标题
|
|
233
|
+
*/
|
|
234
|
+
const currentTitle = computed(function () {
|
|
235
|
+
|
|
236
|
+
// 如果有自定义标题
|
|
237
|
+
if (props.title) {
|
|
238
|
+
return props.title
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return props.route ?
|
|
242
|
+
// 如果是路由路径, 则获取路由标题
|
|
243
|
+
_.get(routers, `${utils.slash(props.route, 'start', false)}.meta.title`, '')
|
|
244
|
+
: ''
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
// ==========【方法】=============================================================================================
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* 隐藏对话框
|
|
251
|
+
*/
|
|
252
|
+
function hide() {
|
|
253
|
+
// 隐藏对话框
|
|
254
|
+
dialogRef.value.hide()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 对话框确认
|
|
259
|
+
*/
|
|
260
|
+
async function onDialogConfirm() {
|
|
261
|
+
|
|
262
|
+
// 如果有确定按钮
|
|
263
|
+
if (_.isFunction(props.onConfirm)) {
|
|
264
|
+
|
|
265
|
+
if (! _.isFunction(compSubmit)) {
|
|
266
|
+
// 轻提示
|
|
267
|
+
utils.toast({
|
|
268
|
+
message: '未调用 $dialog.submit 方法',
|
|
269
|
+
})
|
|
270
|
+
return
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const res = await utils.runAsync(props.onConfirm)(await utils.runAsync(compSubmit)(), hide)
|
|
274
|
+
if (res === false) {
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// 隐藏对话框
|
|
280
|
+
hide()
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ==========【返回】=============================================================================================
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
// 自定义样式
|
|
287
|
+
customStyle,
|
|
288
|
+
// 组件
|
|
289
|
+
comp,
|
|
290
|
+
// 当前标题
|
|
291
|
+
currentTitle,
|
|
292
|
+
|
|
293
|
+
// 对话框节点
|
|
294
|
+
dialogRef,
|
|
295
|
+
// 对话框确定
|
|
296
|
+
onDialogConfirm,
|
|
297
|
+
// 对话框取消
|
|
298
|
+
onDialogCancel,
|
|
299
|
+
// 对话框隐藏
|
|
300
|
+
onDialogHide,
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
</script>
|
|
305
|
+
|
|
306
|
+
<style lang="scss">
|
|
307
|
+
|
|
308
|
+
.n-dialog-proxy {
|
|
309
|
+
|
|
310
|
+
&--fullscreen {
|
|
311
|
+
.q-dialog__inner > div {
|
|
312
|
+
border-radius: 0 !important;
|
|
313
|
+
width: 100vw;
|
|
314
|
+
height: 100vh;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.q-dialog__inner > div {
|
|
319
|
+
min-width: inherit;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.q-dialog__inner--minimized {
|
|
323
|
+
padding: 0;
|
|
324
|
+
> div {
|
|
325
|
+
max-width: inherit !important;
|
|
326
|
+
max-height: inherit !important;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
</style>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<slot
|
|
3
|
+
:click="onDialog"
|
|
4
|
+
/>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 标识
|
|
12
|
+
*/
|
|
13
|
+
name: 'NDialogTable',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 声明属性
|
|
17
|
+
*/
|
|
18
|
+
props: {
|
|
19
|
+
// 值
|
|
20
|
+
modelValue: [String, Number, Array, Object],
|
|
21
|
+
// 标题
|
|
22
|
+
title: String,
|
|
23
|
+
// 路由组件路径
|
|
24
|
+
route: String,
|
|
25
|
+
// 宽
|
|
26
|
+
width: {
|
|
27
|
+
type: [Number, String],
|
|
28
|
+
default: '80%',
|
|
29
|
+
},
|
|
30
|
+
// 组件传参
|
|
31
|
+
props: Object,
|
|
32
|
+
// 是否多选
|
|
33
|
+
multiple: Boolean,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 声明事件
|
|
38
|
+
*/
|
|
39
|
+
emits: [
|
|
40
|
+
'update:modelValue',
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 组合式
|
|
45
|
+
*/
|
|
46
|
+
setup(props, { emit }) {
|
|
47
|
+
|
|
48
|
+
// ==========【方法】=============================================================================================
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 弹出对话框
|
|
52
|
+
*/
|
|
53
|
+
function onDialog() {
|
|
54
|
+
|
|
55
|
+
// 创建对话框
|
|
56
|
+
utils.$dialog.create({
|
|
57
|
+
// 标题
|
|
58
|
+
title: props.title,
|
|
59
|
+
// 宽
|
|
60
|
+
width: props.width,
|
|
61
|
+
// width: 1000,
|
|
62
|
+
// 路由组件路径
|
|
63
|
+
route: props.route,
|
|
64
|
+
// 组件传参
|
|
65
|
+
props: Object.assign({
|
|
66
|
+
multiple: props.multiple,
|
|
67
|
+
}, props.props),
|
|
68
|
+
// 对话框传参
|
|
69
|
+
dialogProps: {
|
|
70
|
+
// 不能通过按 ESC 键关闭对话框
|
|
71
|
+
noEscDismiss: true,
|
|
72
|
+
// 不能通过在对话框外单击来关闭对话框
|
|
73
|
+
noBackdropDismiss: true,
|
|
74
|
+
},
|
|
75
|
+
// 显示取消按钮
|
|
76
|
+
cancel: true,
|
|
77
|
+
// 点击确认执行
|
|
78
|
+
async onConfirm(data) {
|
|
79
|
+
console.log('----data---', data)
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ==========【返回】=============================================================================================
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
// 弹出对话框
|
|
88
|
+
onDialog,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
</script>
|