@netang/quasar 0.1.28 → 0.1.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/utils/$form.js CHANGED
@@ -28,12 +28,16 @@ function create(params) {
28
28
  const resForm = {
29
29
  // 表单节点
30
30
  formRef: ref(null),
31
- // 原始表单数据(用于业务使用)
31
+ // 初始表单数据, 该数据不会更新
32
+ initFormData: o.formData,
33
+ // 原始表单数据(初始时为 formData, 使用 setRaw 会更新该数据)
32
34
  rawFormData: ref(o.formData),
33
- // 请求服务器的原始表单数据(只有执行 setRaw 方法才会生成, 用于请求接口使用)
35
+ // 请求服务器的原始表单数据(初始时为 null, 只有执行 setRaw 方法才会生成, 用于请求接口使用)
34
36
  requestRawFormData: ref(null),
35
37
  // 表单数据
36
38
  formData: ref(o.formData),
39
+ // 表单参数
40
+ options: o,
37
41
  }
38
42
 
39
43
  /**
@@ -44,7 +48,7 @@ function create(params) {
44
48
  resForm.requestRawFormData.value = resForm.rawFormData.value
45
49
  return value
46
50
  }
47
-
51
+
48
52
  if ($power) {
49
53
  $power.update(function(data, _data) {
50
54
  _data.$form = resForm
package/utils/$power.js CHANGED
@@ -963,6 +963,8 @@ async function request(options) {
963
963
 
964
964
  // 请求数据
965
965
  let requestData = {}
966
+ // 请求之前数据
967
+ let _formDataClone = null
966
968
 
967
969
  // 如果是提交表单
968
970
  // --------------------------------------------------
@@ -1007,6 +1009,7 @@ async function request(options) {
1007
1009
 
1008
1010
  // 合并请求原始表单数据
1009
1011
  if ($n_isValidObject(o.$form.requestRawFormData.value)) {
1012
+ _formDataClone = $n_cloneDeep(o.$form.formData.value)
1010
1013
  Object.assign(requestData, {
1011
1014
  n__raw: o.$form.requestRawFormData.value
1012
1015
  })
@@ -1159,6 +1162,11 @@ async function request(options) {
1159
1162
  }
1160
1163
  }
1161
1164
 
1165
+ // 设置原始数据
1166
+ if (_formDataClone !== null) {
1167
+ o.$form.setRaw(_formDataClone)
1168
+ }
1169
+
1162
1170
  // 请求成功执行
1163
1171
  if (await $n_runAsync(o.requestSuccess)(Object.assign({ next }, resultData)) === false) {
1164
1172
  return
package/utils/$tree.js CHANGED
@@ -79,8 +79,8 @@ function create(options) {
79
79
  expanded,
80
80
  // 菜单参数
81
81
  menu: menuOptions,
82
- // 原始表单数据
83
- rawFormData,
82
+ // 初始表单数据
83
+ initFormData,
84
84
  // 表单数据
85
85
  formData,
86
86
  // 重新加载
@@ -282,7 +282,7 @@ function create(options) {
282
282
  // 添加下级
283
283
  case 'update':
284
284
  // 更新表单数据
285
- formData.value = Object.assign({}, rawFormData.value, {
285
+ formData.value = Object.assign({}, initFormData, {
286
286
  pid: o.node.attr.id,
287
287
  })
288
288
  break