63 lines
1.6 KiB
Plaintext
63 lines
1.6 KiB
Plaintext
<template>
|
|
<div>
|
|
<Search :search="search" :reset="reset">
|
|
<template v-slot:body>
|
|
{search}
|
|
</template>
|
|
</Search>
|
|
<div class="pl-2 pr-2 bg-white dark:bg-regal-dark rounded-lg mt-4">
|
|
<Operate :show="show" />
|
|
<el-table :data="tableData" class="mt-3" v-loading="loading">
|
|
{table}
|
|
<el-table-column label="操作" width="200">
|
|
<template #default="scope">
|
|
<Update @click="show(scope.row.id)" />
|
|
<Destroy @click="destroy(api, scope.row.id)" />
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<Paginate />
|
|
</div>
|
|
|
|
<Dialog v-model="visible" :title="title" destroy-on-close>
|
|
<Create @close="close" :primary="id" :api="api" />
|
|
</Dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, onMounted, ref, watch } from 'vue'
|
|
import Create from './create.vue'
|
|
import { useGetList } from '/admin/composables/curd/useGetList'
|
|
import { useDestroy } from '/admin/composables/curd/useDestroy'
|
|
import { t } from '/admin/support/helper'
|
|
|
|
const visible = ref<boolean>(false)
|
|
const id = ref(null)
|
|
const api = '{api}'
|
|
const title = ref<string>('')
|
|
|
|
// const { data, query, search, reset, loading } = useGetList(api)
|
|
{useList}
|
|
const { destroy, deleted } = useDestroy()
|
|
|
|
const tableData = computed(() => data.value?.data)
|
|
|
|
const close = () => {
|
|
visible.value = false
|
|
reset()
|
|
}
|
|
|
|
const show = primary => {
|
|
title.value = primary ? t('system.edit') : t('system.add')
|
|
id.value = primary
|
|
visible.value = true
|
|
}
|
|
|
|
onMounted(() => {
|
|
search()
|
|
|
|
deleted(reset)
|
|
})
|
|
</script>
|