refactor: project directory structure

This commit is contained in:
0xJacky 2023-11-26 18:59:12 +08:00
parent c1193a5b8c
commit e5a5889931
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
367 changed files with 710 additions and 756 deletions

View 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>