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 | 123 | }, |
| 124 | 124 | proxyConfig: { |
| 125 | 125 | seq: true, // 启用动态序号代理(分页之后索引自动计算为当前页的起始序号) |
| 126 | + form: true, // 启用表单代理,当点击表单提交按钮时会自动触发 reload 行为 | |
| 126 | 127 | props: { |
| 127 | 128 | result: 'list', |
| 128 | 129 | total: 'total' |
| ... | ... | @@ -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 | 144 | const formItems = ref<VxeFormItemProps[]>([ |
| 151 | 145 | { |
| 152 | 146 | field: 'id', |
| ... | ... | @@ -208,9 +202,8 @@ const handleDetail = (row: PostVO) => { |
| 208 | 202 | } |
| 209 | 203 | // 新增操作 |
| 210 | 204 | const handleCreate = () => { |
| 211 | - const $form = xForm.value | |
| 212 | - $form?.reset() | |
| 213 | 205 | setDialogTile('create') |
| 206 | + xForm.value?.reset() | |
| 214 | 207 | } |
| 215 | 208 | |
| 216 | 209 | // 修改操作 |
| ... | ... | @@ -232,8 +225,7 @@ const handleDelete = (rowId: number) => { |
| 232 | 225 | }) |
| 233 | 226 | .finally(() => { |
| 234 | 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 | 245 | dialogVisible.value = false |
| 254 | 246 | } finally { |
| 255 | 247 | actionLoading.value = false |
| 256 | - const $grid = xGrid.value | |
| 257 | - $grid?.commitProxy('query') | |
| 248 | + xGrid.value?.commitProxy('query') | |
| 258 | 249 | } |
| 259 | 250 | } |
| 260 | 251 | </script> | ... | ... |