@netang/quasar 0.0.95 → 0.0.96
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/components/field-table/index.vue +23 -12
- package/package.json +1 -1
- package/utils/$table.js +24 -29
|
@@ -248,8 +248,6 @@ export default {
|
|
|
248
248
|
|
|
249
249
|
// 请求路径
|
|
250
250
|
path: String,
|
|
251
|
-
// 请求地址(如果为空, 则默认为表格路由地址)
|
|
252
|
-
url: String,
|
|
253
251
|
// 请求参数
|
|
254
252
|
query: Object,
|
|
255
253
|
// 附加请求数据
|
|
@@ -298,7 +296,7 @@ export default {
|
|
|
298
296
|
default: 500
|
|
299
297
|
},
|
|
300
298
|
// 自定义请求方法
|
|
301
|
-
|
|
299
|
+
request: Function,
|
|
302
300
|
},
|
|
303
301
|
|
|
304
302
|
/**
|
|
@@ -402,6 +400,19 @@ export default {
|
|
|
402
400
|
},
|
|
403
401
|
// 刷新后清空已选数据
|
|
404
402
|
refreshResetSelected: false,
|
|
403
|
+
// 自定义请求方法
|
|
404
|
+
async request({ httpOptions }) {
|
|
405
|
+
return $n_isFunction(props.request) ?
|
|
406
|
+
// 如果有自定义请求方法
|
|
407
|
+
await $n_runAsync(props.request)({
|
|
408
|
+
// http 请求参数
|
|
409
|
+
httpOptions,
|
|
410
|
+
// 对话框是否已显示
|
|
411
|
+
showDialog: showDialog.value,
|
|
412
|
+
}) :
|
|
413
|
+
// 否则请求数据
|
|
414
|
+
await $n_http(httpOptions)
|
|
415
|
+
},
|
|
405
416
|
})
|
|
406
417
|
|
|
407
418
|
// 创建睡眠实例
|
|
@@ -747,8 +758,8 @@ export default {
|
|
|
747
758
|
async function onRequestSelected(value) {
|
|
748
759
|
|
|
749
760
|
// 请求参数
|
|
750
|
-
const
|
|
751
|
-
url:
|
|
761
|
+
const httpOptions = {
|
|
762
|
+
url: $table.routePath,
|
|
752
763
|
data: Object.assign(
|
|
753
764
|
// 获取表格请求数据
|
|
754
765
|
$table.getTableRequestData({
|
|
@@ -777,16 +788,16 @@ export default {
|
|
|
777
788
|
}
|
|
778
789
|
|
|
779
790
|
// 请求数据
|
|
780
|
-
const { status, data } = $n_isFunction(props.
|
|
791
|
+
const { status, data } = $n_isFunction(props.request) ?
|
|
781
792
|
// 如果有自定义请求方法
|
|
782
|
-
await $n_runAsync(props.
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
//
|
|
786
|
-
|
|
793
|
+
await $n_runAsync(props.request)({
|
|
794
|
+
// http 请求参数
|
|
795
|
+
httpOptions,
|
|
796
|
+
// 对话框是否已显示
|
|
797
|
+
showDialog: showDialog.value,
|
|
787
798
|
}) :
|
|
788
799
|
// 否则请求数据
|
|
789
|
-
await $n_http(
|
|
800
|
+
await $n_http(httpOptions)
|
|
790
801
|
|
|
791
802
|
return status && $n_isValidArray($n_get(data, 'rows')) ? data.rows : []
|
|
792
803
|
}
|
package/package.json
CHANGED
package/utils/$table.js
CHANGED
|
@@ -55,7 +55,7 @@ const {
|
|
|
55
55
|
/**
|
|
56
56
|
* 创建表格
|
|
57
57
|
*/
|
|
58
|
-
function create(
|
|
58
|
+
function create(options) {
|
|
59
59
|
|
|
60
60
|
// ==========【数据】=================================================================================================
|
|
61
61
|
|
|
@@ -130,10 +130,10 @@ function create(params) {
|
|
|
130
130
|
rowClick: null,
|
|
131
131
|
// 双击表格行事件
|
|
132
132
|
rowDblClick: null,
|
|
133
|
-
},
|
|
133
|
+
}, options)
|
|
134
134
|
|
|
135
135
|
// 获取权限注入
|
|
136
|
-
const $power = $n_has(
|
|
136
|
+
const $power = $n_has(options, '$power') ? options.$power : inject(NPowerKey)
|
|
137
137
|
const hasPowr = !! $power
|
|
138
138
|
|
|
139
139
|
// 获取渲染注入
|
|
@@ -718,36 +718,31 @@ function create(params) {
|
|
|
718
718
|
}
|
|
719
719
|
} = props
|
|
720
720
|
|
|
721
|
-
//
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
721
|
+
// http 请求参数
|
|
722
|
+
const httpOptions = Object.assign({
|
|
723
|
+
// 请求数据
|
|
724
|
+
url: $route.path,
|
|
725
|
+
// 请求数据
|
|
726
|
+
data: getTableRequestData(props, isRequestSummary),
|
|
727
|
+
// ~~~~~~ 先开启防抖, 如果后期遇到表格加载不出来的情况, 再关闭防抖
|
|
728
|
+
// 关闭防抖(允许重复请求)
|
|
729
|
+
// debounce: false,
|
|
730
|
+
}, o.httpSettings)
|
|
731
|
+
|
|
732
|
+
const { status, data: res } = $n_isFunction(o.request)
|
|
733
|
+
// 如果有自定义请求方法
|
|
734
|
+
? await $n_runAsync(o.request)({
|
|
735
|
+
// http 请求参数
|
|
736
|
+
httpOptions,
|
|
737
|
+
// 表格声明属性
|
|
730
738
|
props,
|
|
739
|
+
// 表格行数据
|
|
731
740
|
rows: tableRows,
|
|
741
|
+
// 表格已选数据
|
|
732
742
|
selected: tableSelected,
|
|
733
743
|
})
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
} else {
|
|
737
|
-
const opts = Object.assign({
|
|
738
|
-
// 请求数据
|
|
739
|
-
url: $route.path,
|
|
740
|
-
// 请求数据
|
|
741
|
-
data,
|
|
742
|
-
// ~~~~~~ 先开启防抖, 如果后期遇到表格加载不出来的情况, 再关闭防抖
|
|
743
|
-
// 关闭防抖(允许重复请求)
|
|
744
|
-
// debounce: false,
|
|
745
|
-
}, o.httpSettings)
|
|
746
|
-
|
|
747
|
-
result = await $n_http(opts)
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
const { status, data: res } = result
|
|
744
|
+
// 否则请求服务器
|
|
745
|
+
: await $n_http(httpOptions)
|
|
751
746
|
|
|
752
747
|
// 请求成功
|
|
753
748
|
if (status) {
|