Commit 3cd6bb314860092a2ae8952aeeb05c71503026f5
1 parent
8917dcf6
fix: seach
Showing
1 changed file
with
5 additions
and
14 deletions
yudao-ui-admin-vue3/src/views/system/post/index.vue
| @@ -123,6 +123,7 @@ const gridOptions = reactive<VxeGridProps>({ | @@ -123,6 +123,7 @@ const gridOptions = reactive<VxeGridProps>({ | ||
| 123 | }, | 123 | }, |
| 124 | proxyConfig: { | 124 | proxyConfig: { |
| 125 | seq: true, // 启用动态序号代理(分页之后索引自动计算为当前页的起始序号) | 125 | seq: true, // 启用动态序号代理(分页之后索引自动计算为当前页的起始序号) |
| 126 | + form: true, // 启用表单代理,当点击表单提交按钮时会自动触发 reload 行为 | ||
| 126 | props: { | 127 | props: { |
| 127 | result: 'list', | 128 | result: 'list', |
| 128 | total: 'total' | 129 | total: 'total' |
| @@ -139,14 +140,7 @@ const gridOptions = reactive<VxeGridProps>({ | @@ -139,14 +140,7 @@ const gridOptions = reactive<VxeGridProps>({ | ||
| 139 | } | 140 | } |
| 140 | } | 141 | } |
| 141 | }) | 142 | }) |
| 142 | -const formData = ref<PostVO>({ | ||
| 143 | - name: '', | ||
| 144 | - code: '', | ||
| 145 | - sort: 0, | ||
| 146 | - status: 0, | ||
| 147 | - remark: '', | ||
| 148 | - createTime: '' | ||
| 149 | -}) | 143 | +const formData = ref<PostVO>() |
| 150 | const formItems = ref<VxeFormItemProps[]>([ | 144 | const formItems = ref<VxeFormItemProps[]>([ |
| 151 | { | 145 | { |
| 152 | field: 'id', | 146 | field: 'id', |
| @@ -208,9 +202,8 @@ const handleDetail = (row: PostVO) => { | @@ -208,9 +202,8 @@ const handleDetail = (row: PostVO) => { | ||
| 208 | } | 202 | } |
| 209 | // 新增操作 | 203 | // 新增操作 |
| 210 | const handleCreate = () => { | 204 | const handleCreate = () => { |
| 211 | - const $form = xForm.value | ||
| 212 | - $form?.reset() | ||
| 213 | setDialogTile('create') | 205 | setDialogTile('create') |
| 206 | + xForm.value?.reset() | ||
| 214 | } | 207 | } |
| 215 | 208 | ||
| 216 | // 修改操作 | 209 | // 修改操作 |
| @@ -232,8 +225,7 @@ const handleDelete = (rowId: number) => { | @@ -232,8 +225,7 @@ const handleDelete = (rowId: number) => { | ||
| 232 | }) | 225 | }) |
| 233 | .finally(() => { | 226 | .finally(() => { |
| 234 | ElMessage.success(t('common.delSuccess')) | 227 | ElMessage.success(t('common.delSuccess')) |
| 235 | - const $grid = xGrid.value | ||
| 236 | - $grid?.commitProxy('query') | 228 | + xGrid.value?.commitProxy('query') |
| 237 | }) | 229 | }) |
| 238 | } | 230 | } |
| 239 | // 提交按钮 | 231 | // 提交按钮 |
| @@ -253,8 +245,7 @@ const submitForm: VxeFormEvents.Submit = async () => { | @@ -253,8 +245,7 @@ const submitForm: VxeFormEvents.Submit = async () => { | ||
| 253 | dialogVisible.value = false | 245 | dialogVisible.value = false |
| 254 | } finally { | 246 | } finally { |
| 255 | actionLoading.value = false | 247 | actionLoading.value = false |
| 256 | - const $grid = xGrid.value | ||
| 257 | - $grid?.commitProxy('query') | 248 | + xGrid.value?.commitProxy('query') |
| 258 | } | 249 | } |
| 259 | } | 250 | } |
| 260 | </script> | 251 | </script> |