@ebiz/designer-components 0.1.39 → 0.1.41

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": "@ebiz/designer-components",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -8,7 +8,7 @@
8
8
  <!-- 表单区域 -->
9
9
  <ebiz-s-form v-if="$slots.form" v-model="formDataValue" ref="formRef" layout="inline" labelAlign="top"
10
10
  @submit="handleSearch" @reset="handleReset">
11
- <slot name="form"></slot>
11
+ <slot name="form" :formValue="formDataValue"></slot>
12
12
  <template #buttons>
13
13
  <t-space>
14
14
  <EbizTdesignButton theme="primary" type="submit">搜索</EbizTdesignButton>
@@ -69,7 +69,7 @@ export default {
69
69
 
70
70
  <script setup>
71
71
  import { defineProps, defineEmits, ref, onMounted, computed, defineExpose } from 'vue';
72
- import { dataService, EbizTableSort, EbizTdesignButton, EbizTdesignCard, EbizPageHeader, EbizSForm } from "../../../index"
72
+ import { dataService, EbizTableSort, EbizTdesignButton, EbizTdesignCard, EbizPageHeader, EbizSForm, EbizDivider } from "../../../index"
73
73
  import { Space as TSpace, Pagination as TPagination, Input as TInput, Icon as TIcon } from 'tdesign-vue-next';
74
74
 
75
75
  const currentPage = ref(1)
@@ -127,7 +127,7 @@ const props = defineProps({
127
127
  },
128
128
  formData: {
129
129
  type: Object,
130
- default: () => ({})
130
+ default: undefined
131
131
  },
132
132
  labelKey: {
133
133
  type: String,
@@ -191,7 +191,7 @@ const computedData = computed(() => {
191
191
  })
192
192
 
193
193
 
194
- const defaultFormData = ref({ ...props.formData })
194
+ const defaultFormData = ref({ ...JSON.parse(JSON.stringify(props.formData)) })
195
195
  const searchValue = ref('')
196
196
 
197
197
  const loadData = async () => {
@@ -203,7 +203,7 @@ const loadData = async () => {
203
203
  page: currentPage.value,
204
204
  pagesize: pageSize.value,
205
205
  queryParams: {
206
- ...params, ...props.defaultParams, ...props.formData
206
+ ...params, ...props.defaultParams, ...formDataValue.value
207
207
  }
208
208
  }, props.apiConfig, props.fetchUrl)
209
209
 
@@ -241,6 +241,7 @@ const handleReset = (context) => {
241
241
  return
242
242
  }
243
243
 
244
+ console.log("handleReset", defaultFormData.value)
244
245
  emit('update:formData', { ...defaultFormData.value })
245
246
  currentPage.value = 1
246
247
  setTimeout(() => {
@@ -253,9 +254,18 @@ const onPageChange = () => {
253
254
  loadData()
254
255
  }
255
256
 
257
+
258
+ const innerFormData = ref({ ...props.formData })
259
+
256
260
  const formDataValue = computed({
257
- get: () => props.formData,
261
+ get: () => {
262
+ if( props.formData == undefined ){
263
+ return innerFormData.value
264
+ }
265
+ return props.formData
266
+ },
258
267
  set: (value) => {
268
+ innerFormData.value = value
259
269
  emit('update:formData', value)
260
270
  }
261
271
  })