@netang/quasar 0.0.90 → 0.0.92

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/$power.js +16 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.0.90",
3
+ "version": "0.0.92",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/utils/$power.js CHANGED
@@ -743,12 +743,15 @@ function formatBtns(powerBtns, filterBtns, toObject = false) {
743
743
  */
744
744
  function getRequestQuery(o) {
745
745
 
746
+ // 获取按钮数据
747
+ const btnData = o.powerBtn.data
748
+
746
749
  // 传参
747
750
  const query = {}
748
751
 
749
752
  // 如果有请求传参的传参设置
750
- if ($n_has(o.data, 'requestQuery.query')) {
751
- const resQuery = parseQuery(o.query, o.data.requestQuery.query)
753
+ if ($n_has(btnData, 'requestQuery.query')) {
754
+ const resQuery = parseQuery(o.query, btnData.requestQuery.query)
752
755
  if ($n_isValidObject(resQuery)) {
753
756
  Object.assign(query, resQuery)
754
757
  }
@@ -757,18 +760,18 @@ function getRequestQuery(o) {
757
760
  // 获取列表数据
758
761
  if (
759
762
  // 如果按钮参数有显示类型
760
- $n_has(o.data, 'show')
763
+ $n_has(btnData, 'show')
761
764
  // 按钮参数的显示类型必须是单选或多选
762
- && $n_indexOf(['single', 'multiple'], o.data.show) > -1
765
+ && $n_indexOf(['single', 'multiple'], btnData.show) > -1
763
766
  // 如果有请求传参的列表设置
764
- && $n_has(o.data, 'requestQuery.list')
767
+ && $n_has(btnData, 'requestQuery.list')
765
768
  // 如果有表格数据
766
769
  && $n_isValidArray(o.tableSelected)
767
770
  ) {
768
771
  let newQuery = {}
769
772
 
770
773
  // 如果是单选
771
- if (o.data.show === 'single') {
774
+ if (btnData.show === 'single') {
772
775
  // 取表格选中第一条数据
773
776
  newQuery = o.tableSelected[0]
774
777
 
@@ -786,7 +789,7 @@ function getRequestQuery(o) {
786
789
  }
787
790
  }
788
791
 
789
- const resTable = parseQuery(newQuery, o.data.requestQuery.list)
792
+ const resTable = parseQuery(newQuery, btnData.requestQuery.list)
790
793
  if ($n_isValidObject(resTable)) {
791
794
  Object.assign(query, resTable)
792
795
  }
@@ -931,18 +934,18 @@ async function request(params) {
931
934
 
932
935
  query = formatQuery(query, true)
933
936
 
934
- // 如果不是禁止添加来源页面参数
935
- if ($n_get(btnData, 'noFromPageQuery') !== true) {
936
- // 来源页面是当前路由的完整路径
937
- query.n_from_page = encodeURIComponent($currentRoute.fullPath)
938
- }
939
-
940
937
  // 如果按钮有标题
941
938
  const pageTitle = $n_trimString(o.powerBtn.title)
942
939
  if (pageTitle) {
943
940
  query.n_page_title = pageTitle
944
941
  }
945
942
 
943
+ // 如果不是禁止添加来源页面参数
944
+ if ($n_get(btnData, 'noFromPageQuery') !== true) {
945
+ // 来源页面是当前路由的完整路径
946
+ query.n_from_page = encodeURIComponent($currentRoute.fullPath)
947
+ }
948
+
946
949
  // 请求前执行
947
950
  const resBefore = await $n_runAsync(o.requestBefore)({ params: o, requestData: query })
948
951
  if (resBefore !== void 0) {