@netang/quasar 0.1.65 → 0.1.66
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 +16 -6
- package/package.json +1 -1
- package/utils/$table.js +20 -9
|
@@ -183,6 +183,7 @@ import $n_isFunction from 'lodash/isFunction'
|
|
|
183
183
|
import $n_findIndex from 'lodash/findIndex'
|
|
184
184
|
import $n_get from 'lodash/get'
|
|
185
185
|
|
|
186
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
186
187
|
import $n_forEach from '@netang/utils/forEach'
|
|
187
188
|
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
188
189
|
import $n_join from '@netang/utils/join'
|
|
@@ -406,14 +407,14 @@ export default {
|
|
|
406
407
|
// 刷新后清空已选数据
|
|
407
408
|
refreshResetSelected: false,
|
|
408
409
|
// 自定义请求方法
|
|
409
|
-
async request({ httpOptions }) {
|
|
410
|
+
async request({ httpOptions, props }) {
|
|
410
411
|
return $n_isFunction(props.request) ?
|
|
411
412
|
// 如果有自定义请求方法
|
|
412
413
|
await $n_runAsync(props.request)({
|
|
413
414
|
// http 请求参数
|
|
414
415
|
httpOptions,
|
|
415
416
|
// 对话框是否已显示
|
|
416
|
-
showDialog: showDialog.value,
|
|
417
|
+
showDialog: $n_get(props, 'showDialog') === 1 ? true : showDialog.value,
|
|
417
418
|
}) :
|
|
418
419
|
// 否则请求数据
|
|
419
420
|
await $n_http(httpOptions)
|
|
@@ -996,7 +997,6 @@ export default {
|
|
|
996
997
|
*/
|
|
997
998
|
let _dialogShowed = false
|
|
998
999
|
function onDialogShow() {
|
|
999
|
-
|
|
1000
1000
|
if ($n_isFunction(props.request)) {
|
|
1001
1001
|
|
|
1002
1002
|
if (_dialogShowed) {
|
|
@@ -1037,10 +1037,20 @@ export default {
|
|
|
1037
1037
|
isReload = false
|
|
1038
1038
|
}
|
|
1039
1039
|
|
|
1040
|
-
//
|
|
1041
|
-
|
|
1040
|
+
// 获取表格搜索值
|
|
1041
|
+
let searchValue = $table.getTableSearchValue()
|
|
1042
|
+
if (searchValue.length) {
|
|
1043
|
+
|
|
1044
|
+
// 如果有隐藏搜索字段数组
|
|
1045
|
+
if ($n_isValidArray(props.hideSearchKeys)) {
|
|
1046
|
+
// 从搜索值数组中去除隐藏搜索字段的数组
|
|
1047
|
+
searchValue = searchValue.filter(e => $n_indexOf(e.field, props.hideSearchKeys) === -1)
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1042
1050
|
// 表格搜索重置
|
|
1043
|
-
$table.tableSearchReset(isReload
|
|
1051
|
+
$table.tableSearchReset(isReload && searchValue.length, {
|
|
1052
|
+
showDialog: 1,
|
|
1053
|
+
})
|
|
1044
1054
|
}
|
|
1045
1055
|
}
|
|
1046
1056
|
|
package/package.json
CHANGED
package/utils/$table.js
CHANGED
|
@@ -733,7 +733,7 @@ function create(options) {
|
|
|
733
733
|
/**
|
|
734
734
|
* 表格重新加载
|
|
735
735
|
*/
|
|
736
|
-
async function tableReload() {
|
|
736
|
+
async function tableReload(params = null) {
|
|
737
737
|
|
|
738
738
|
// 表格已加载
|
|
739
739
|
_isTableLoaded = true
|
|
@@ -751,9 +751,10 @@ function create(options) {
|
|
|
751
751
|
// $tableRef?.requestServerInteraction({
|
|
752
752
|
// pagination: o.pagination,
|
|
753
753
|
// })
|
|
754
|
-
|
|
754
|
+
|
|
755
|
+
await tableRequest(Object.assign({
|
|
755
756
|
pagination: o.pagination,
|
|
756
|
-
})
|
|
757
|
+
}, params))
|
|
757
758
|
|
|
758
759
|
// 清空表格已选数据
|
|
759
760
|
if (o.refreshResetSelected) {
|
|
@@ -790,7 +791,7 @@ function create(options) {
|
|
|
790
791
|
/**
|
|
791
792
|
* 表格搜索重置
|
|
792
793
|
*/
|
|
793
|
-
function tableSearchReset(reload = true) {
|
|
794
|
+
function tableSearchReset(reload = true, params = null) {
|
|
794
795
|
|
|
795
796
|
const newValue = []
|
|
796
797
|
|
|
@@ -809,7 +810,8 @@ function create(options) {
|
|
|
809
810
|
|
|
810
811
|
// 表格重新加载
|
|
811
812
|
if (reload) {
|
|
812
|
-
tableReload()
|
|
813
|
+
tableReload(params)
|
|
814
|
+
.finally()
|
|
813
815
|
}
|
|
814
816
|
}
|
|
815
817
|
|
|
@@ -1059,12 +1061,19 @@ function create(options) {
|
|
|
1059
1061
|
}
|
|
1060
1062
|
|
|
1061
1063
|
/**
|
|
1062
|
-
*
|
|
1064
|
+
* 获取表格搜索值
|
|
1063
1065
|
*/
|
|
1064
|
-
function
|
|
1065
|
-
return
|
|
1066
|
+
function getTableSearchValue() {
|
|
1067
|
+
return formatValue(rawSearchOptions, tableSearchValue.value)
|
|
1066
1068
|
}
|
|
1067
1069
|
|
|
1070
|
+
/**
|
|
1071
|
+
* 是否有表格搜索值
|
|
1072
|
+
*/
|
|
1073
|
+
// function hasTableSearchValue() {
|
|
1074
|
+
// return !! formatValue(rawSearchOptions, tableSearchValue.value).length
|
|
1075
|
+
// }
|
|
1076
|
+
|
|
1068
1077
|
// ==========【返回】=================================================================================================
|
|
1069
1078
|
|
|
1070
1079
|
const resTable = {
|
|
@@ -1136,8 +1145,10 @@ function create(options) {
|
|
|
1136
1145
|
// 设置表格搜索参数
|
|
1137
1146
|
setTableSearchOptions,
|
|
1138
1147
|
|
|
1148
|
+
// 获取表格搜索值
|
|
1149
|
+
getTableSearchValue,
|
|
1139
1150
|
// 是否有表格搜索值
|
|
1140
|
-
hasTableSearchValue,
|
|
1151
|
+
// hasTableSearchValue,
|
|
1141
1152
|
|
|
1142
1153
|
// 获取当前路由
|
|
1143
1154
|
getRoute() {
|