mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
refactor: project directory structure
This commit is contained in:
parent
c1193a5b8c
commit
e5a5889931
367 changed files with 710 additions and 756 deletions
76
app/src/components/StdDataDisplay/StdBatchEdit.vue
Normal file
76
app/src/components/StdDataDisplay/StdBatchEdit.vue
Normal file
|
@ -0,0 +1,76 @@
|
|||
<script setup lang="ts">
|
||||
import {reactive, ref} from 'vue'
|
||||
import gettext from '@/gettext'
|
||||
import StdDataEntry from '@/components/StdDataEntry'
|
||||
import {message} from 'ant-design-vue'
|
||||
|
||||
const {$gettext} = gettext
|
||||
|
||||
const emit = defineEmits(['onSave'])
|
||||
|
||||
const props = defineProps(['api', 'beforeSave'])
|
||||
|
||||
const batchColumns = ref([])
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
const selectedRowKeys = ref([])
|
||||
|
||||
function showModal(c: any, rowKeys: any) {
|
||||
visible.value = true
|
||||
selectedRowKeys.value = rowKeys
|
||||
batchColumns.value = c
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
showModal
|
||||
})
|
||||
|
||||
const data = reactive({})
|
||||
const error = reactive({})
|
||||
const loading = ref(false)
|
||||
|
||||
async function ok() {
|
||||
loading.value = true
|
||||
|
||||
await props.beforeSave?.()
|
||||
|
||||
await props.api(selectedRowKeys.value, data).then(async () => {
|
||||
message.success($gettext('Save successfully'))
|
||||
emit('onSave')
|
||||
}).catch((e: any) => {
|
||||
message.error($gettext(e?.message) ?? $gettext('Server error'))
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-modal
|
||||
class="std-curd-edit-modal"
|
||||
:mask="false"
|
||||
:title="$gettext('Batch Modify')"
|
||||
v-model:open="visible"
|
||||
:cancel-text="$gettext('Cancel')"
|
||||
:ok-text="$gettext('OK')"
|
||||
@ok="ok"
|
||||
:confirm-loading="loading"
|
||||
:width="600"
|
||||
destroyOnClose
|
||||
>
|
||||
|
||||
<std-data-entry
|
||||
ref="std_data_entry"
|
||||
:data-list="batchColumns"
|
||||
:data-source="data"
|
||||
:error="error"
|
||||
/>
|
||||
|
||||
<slot name="extra"/>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue