@netang/quasar 0.0.89 → 0.0.90
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/package.json +1 -1
- package/utils/$power.js +36 -27
- package/components/index.js +0 -71
package/package.json
CHANGED
package/utils/$power.js
CHANGED
|
@@ -330,12 +330,12 @@ function create(params) {
|
|
|
330
330
|
})
|
|
331
331
|
|
|
332
332
|
// 权限按钮点击
|
|
333
|
-
data.powerBtnClick = async function (
|
|
333
|
+
data.powerBtnClick = async function (powerBtn, tableSelected) {
|
|
334
334
|
|
|
335
335
|
// 权限请求
|
|
336
336
|
await request({
|
|
337
337
|
// 按钮数据
|
|
338
|
-
|
|
338
|
+
powerBtn,
|
|
339
339
|
// 权限路由参数
|
|
340
340
|
$route,
|
|
341
341
|
// 当前路由参数
|
|
@@ -852,8 +852,8 @@ async function request(params) {
|
|
|
852
852
|
|
|
853
853
|
// 参数
|
|
854
854
|
const o = Object.assign({
|
|
855
|
-
//
|
|
856
|
-
|
|
855
|
+
// 权限按钮数据
|
|
856
|
+
powerBtn: {},
|
|
857
857
|
// 表格选中数据
|
|
858
858
|
tableSelected: [],
|
|
859
859
|
// 检查是否正在上传文件
|
|
@@ -878,7 +878,7 @@ async function request(params) {
|
|
|
878
878
|
o.query = $route.query
|
|
879
879
|
|
|
880
880
|
// 判断类型
|
|
881
|
-
if (! $n_get(o.
|
|
881
|
+
if (! $n_get(o.powerBtn, 'data.type')) {
|
|
882
882
|
|
|
883
883
|
// 【调试模式】
|
|
884
884
|
// --------------------------------------------------
|
|
@@ -890,18 +890,18 @@ async function request(params) {
|
|
|
890
890
|
return
|
|
891
891
|
}
|
|
892
892
|
|
|
893
|
-
//
|
|
894
|
-
o.
|
|
893
|
+
// 克隆按钮
|
|
894
|
+
o.powerBtn = $n_cloneDeep(o.powerBtn)
|
|
895
895
|
|
|
896
896
|
// 判断 url
|
|
897
|
-
o.data.url = $n_toLower($n_trimString(o.data.url))
|
|
898
|
-
if (! o.data.url) {
|
|
897
|
+
o.powerBtn.data.url = $n_toLower($n_trimString(o.powerBtn.data.url))
|
|
898
|
+
if (! o.powerBtn.data.url) {
|
|
899
899
|
|
|
900
900
|
if (
|
|
901
901
|
// 如果没有跳转页面地址
|
|
902
|
-
! $n_has(o.data, 'toPage')
|
|
902
|
+
! $n_has(o.powerBtn.data, 'toPage')
|
|
903
903
|
// 或跳转页面地址为空
|
|
904
|
-
|| ! $n_isValidString(o.data.toPage)
|
|
904
|
+
|| ! $n_isValidString(o.powerBtn.data.toPage)
|
|
905
905
|
) {
|
|
906
906
|
// 【调试模式】
|
|
907
907
|
// --------------------------------------------------
|
|
@@ -914,26 +914,35 @@ async function request(params) {
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
// 用跳转页面地址替换 toPage
|
|
917
|
-
o.data = Object.assign({}, o.data, {
|
|
918
|
-
url: o.data.toPage,
|
|
917
|
+
o.powerBtn.data = Object.assign({}, o.powerBtn.data, {
|
|
918
|
+
url: o.powerBtn.data.toPage,
|
|
919
919
|
})
|
|
920
920
|
}
|
|
921
921
|
|
|
922
|
+
// 获取按钮数据
|
|
923
|
+
const btnData = o.powerBtn.data
|
|
924
|
+
|
|
922
925
|
// 获取请求参数
|
|
923
926
|
let query = getRequestQuery(o)
|
|
924
927
|
|
|
925
928
|
// 如果是打开新窗口
|
|
926
929
|
// --------------------------------------------------
|
|
927
|
-
if (
|
|
930
|
+
if (btnData.type === dicts.POWER_DATA_TYPE__OPEN) {
|
|
928
931
|
|
|
929
932
|
query = formatQuery(query, true)
|
|
930
933
|
|
|
931
934
|
// 如果不是禁止添加来源页面参数
|
|
932
|
-
if ($n_get(
|
|
935
|
+
if ($n_get(btnData, 'noFromPageQuery') !== true) {
|
|
933
936
|
// 来源页面是当前路由的完整路径
|
|
934
937
|
query.n_from_page = encodeURIComponent($currentRoute.fullPath)
|
|
935
938
|
}
|
|
936
939
|
|
|
940
|
+
// 如果按钮有标题
|
|
941
|
+
const pageTitle = $n_trimString(o.powerBtn.title)
|
|
942
|
+
if (pageTitle) {
|
|
943
|
+
query.n_page_title = pageTitle
|
|
944
|
+
}
|
|
945
|
+
|
|
937
946
|
// 请求前执行
|
|
938
947
|
const resBefore = await $n_runAsync(o.requestBefore)({ params: o, requestData: query })
|
|
939
948
|
if (resBefore !== void 0) {
|
|
@@ -944,7 +953,7 @@ async function request(params) {
|
|
|
944
953
|
}
|
|
945
954
|
|
|
946
955
|
$n_router.push({
|
|
947
|
-
path:
|
|
956
|
+
path: btnData.url,
|
|
948
957
|
query,
|
|
949
958
|
})
|
|
950
959
|
return
|
|
@@ -955,7 +964,7 @@ async function request(params) {
|
|
|
955
964
|
|
|
956
965
|
// 如果是提交表单
|
|
957
966
|
// --------------------------------------------------
|
|
958
|
-
if (
|
|
967
|
+
if (btnData.type === dicts.POWER_DATA_TYPE__FORM) {
|
|
959
968
|
|
|
960
969
|
// 获取表单注入
|
|
961
970
|
o.$form = $n_has(params, '$form') ? params.$form : inject(NFormKey)
|
|
@@ -965,7 +974,7 @@ async function request(params) {
|
|
|
965
974
|
}
|
|
966
975
|
|
|
967
976
|
// 如果验证表单
|
|
968
|
-
if ($n_get(
|
|
977
|
+
if ($n_get(btnData, 'validate') !== false) {
|
|
969
978
|
|
|
970
979
|
if (! o.$form.formRef) {
|
|
971
980
|
throw new Error('没有绑定 fromRef')
|
|
@@ -1005,12 +1014,12 @@ async function request(params) {
|
|
|
1005
1014
|
}
|
|
1006
1015
|
|
|
1007
1016
|
// 判断是否有确认框
|
|
1008
|
-
const isConfirm = $n_get(
|
|
1017
|
+
const isConfirm = $n_get(btnData, 'confirm')
|
|
1009
1018
|
if (
|
|
1010
1019
|
// 如果有确认框
|
|
1011
1020
|
isConfirm
|
|
1012
1021
|
// 如果有密码确认框
|
|
1013
|
-
|| $n_get(
|
|
1022
|
+
|| $n_get(btnData, 'confirmPassword')
|
|
1014
1023
|
) {
|
|
1015
1024
|
// 如果需要先弹出确认框
|
|
1016
1025
|
if (isConfirm) {
|
|
@@ -1047,7 +1056,7 @@ async function request(params) {
|
|
|
1047
1056
|
// 请求
|
|
1048
1057
|
const res = await $n_http({
|
|
1049
1058
|
// 请求地址
|
|
1050
|
-
url:
|
|
1059
|
+
url: btnData.url,
|
|
1051
1060
|
// 请求数据
|
|
1052
1061
|
data: requestData,
|
|
1053
1062
|
})
|
|
@@ -1080,8 +1089,8 @@ async function request(params) {
|
|
|
1080
1089
|
}
|
|
1081
1090
|
|
|
1082
1091
|
// 判断是否有请求成功后的操作动作
|
|
1083
|
-
if ($n_has(
|
|
1084
|
-
switch (
|
|
1092
|
+
if ($n_has(btnData, 'requestSuccess.type')) {
|
|
1093
|
+
switch (btnData.requestSuccess.type) {
|
|
1085
1094
|
|
|
1086
1095
|
// 关闭当前页面
|
|
1087
1096
|
case 'close':
|
|
@@ -1103,7 +1112,7 @@ async function request(params) {
|
|
|
1103
1112
|
|
|
1104
1113
|
if (
|
|
1105
1114
|
// 如果不是关闭当前页面, 则为关闭窗口并跳转页面
|
|
1106
|
-
|
|
1115
|
+
btnData.requestSuccess.type !== 'close'
|
|
1107
1116
|
// 如果有来源页面
|
|
1108
1117
|
&& $n_has($route.query, 'n_from_page')
|
|
1109
1118
|
&& $n_isValidString($route.query.n_from_page)
|
|
@@ -1112,12 +1121,12 @@ async function request(params) {
|
|
|
1112
1121
|
// 跳转页面地址
|
|
1113
1122
|
pushPage: decodeURIComponent($route.query.n_from_page),
|
|
1114
1123
|
// 是否跳转并刷新页面
|
|
1115
|
-
isPushRefresh:
|
|
1124
|
+
isPushRefresh: btnData.requestSuccess.type === 'closePushRefresh',
|
|
1116
1125
|
})
|
|
1117
1126
|
|
|
1118
1127
|
// 否则如果定义了跳转页面
|
|
1119
|
-
// else if ($n_has(
|
|
1120
|
-
// pushPage =
|
|
1128
|
+
// else if ($n_has(btnData, 'requestSuccess.params') && $n_isValidString(btnData.requestSuccess.params)) {
|
|
1129
|
+
// pushPage = btnData.requestSuccess.params
|
|
1121
1130
|
// }
|
|
1122
1131
|
}
|
|
1123
1132
|
|
package/components/index.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 组件
|
|
3
|
-
*/
|
|
4
|
-
import ColumnTitle from './column-title'
|
|
5
|
-
import Data from './data'
|
|
6
|
-
import Dialog from './dialog'
|
|
7
|
-
import Dragger from './dragger'
|
|
8
|
-
import Drawer from './drawer'
|
|
9
|
-
import EditorCode from './editor-code'
|
|
10
|
-
import Empty from './empty'
|
|
11
|
-
import FieldDate from './field-date'
|
|
12
|
-
import FieldTable from './field-table'
|
|
13
|
-
import FieldText from './field-text'
|
|
14
|
-
import FieldTree from './field-tree'
|
|
15
|
-
import Img from './img'
|
|
16
|
-
import InputNumber from './input-number'
|
|
17
|
-
import ListMenu from './list-menu'
|
|
18
|
-
import ListMenuItem from './list-menu-item'
|
|
19
|
-
import PowerPage from './power-page'
|
|
20
|
-
import Price from './price'
|
|
21
|
-
import Render from './render'
|
|
22
|
-
import Search from './search'
|
|
23
|
-
import SearchItem from './search-item'
|
|
24
|
-
import Select from './select'
|
|
25
|
-
import Splitter from './splitter'
|
|
26
|
-
import Table from './table'
|
|
27
|
-
import TableColumnFixed from './table-column-fixed'
|
|
28
|
-
import TablePagination from './table-pagination'
|
|
29
|
-
import TableSplitter from './table-splitter'
|
|
30
|
-
import TableSummary from './table-summary'
|
|
31
|
-
import Thumbnail from './thumbnail'
|
|
32
|
-
import Toolbar from './toolbar'
|
|
33
|
-
import Uploader from './uploader'
|
|
34
|
-
import UploaderQuery from './uploader-query'
|
|
35
|
-
import ValueFormat from './value-format'
|
|
36
|
-
|
|
37
|
-
export default function(Vue) {
|
|
38
|
-
|
|
39
|
-
Vue.component(ColumnTitle.name, ColumnTitle)
|
|
40
|
-
Vue.component(Data.name, Data)
|
|
41
|
-
Vue.component(Dialog.name, Dialog)
|
|
42
|
-
Vue.component(Dragger.name, Dragger)
|
|
43
|
-
Vue.component(Drawer.name, Drawer)
|
|
44
|
-
Vue.component(EditorCode.name, EditorCode)
|
|
45
|
-
Vue.component(Empty.name, Empty)
|
|
46
|
-
Vue.component(FieldDate.name, FieldDate)
|
|
47
|
-
Vue.component(FieldTable.name, FieldTable)
|
|
48
|
-
Vue.component(FieldText.name, FieldText)
|
|
49
|
-
Vue.component(FieldTree.name, FieldTree)
|
|
50
|
-
Vue.component(Img.name, Img)
|
|
51
|
-
Vue.component(InputNumber.name, InputNumber)
|
|
52
|
-
Vue.component(ListMenu.name, ListMenu)
|
|
53
|
-
Vue.component(ListMenuItem.name, ListMenuItem)
|
|
54
|
-
Vue.component(PowerPage.name, PowerPage)
|
|
55
|
-
Vue.component(Price.name, Price)
|
|
56
|
-
Vue.component(Render.name, Render)
|
|
57
|
-
Vue.component(Search.name, Search)
|
|
58
|
-
Vue.component(SearchItem.name, SearchItem)
|
|
59
|
-
Vue.component(Select.name, Select)
|
|
60
|
-
Vue.component(Splitter.name, Splitter)
|
|
61
|
-
Vue.component(Table.name, Table)
|
|
62
|
-
Vue.component(TableColumnFixed.name, TableColumnFixed)
|
|
63
|
-
Vue.component(TablePagination.name, TablePagination)
|
|
64
|
-
Vue.component(TableSplitter.name, TableSplitter)
|
|
65
|
-
Vue.component(TableSummary.name, TableSummary)
|
|
66
|
-
Vue.component(Thumbnail.name, Thumbnail)
|
|
67
|
-
Vue.component(Toolbar.name, Toolbar)
|
|
68
|
-
Vue.component(Uploader.name, Uploader)
|
|
69
|
-
Vue.component(UploaderQuery.name, UploaderQuery)
|
|
70
|
-
Vue.component(ValueFormat.name, ValueFormat)
|
|
71
|
-
}
|