|
@@ -118,6 +118,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, watch } from 'vue'
|
|
|
+import mainApi from '~api/project/gist'
|
|
|
|
|
|
const props = defineProps({
|
|
|
isAdmin: {
|
|
@@ -135,7 +136,7 @@ const props = defineProps({
|
|
|
})
|
|
|
|
|
|
//事件
|
|
|
-const emit = defineEmits(['tap', 'completion', 'examine', 'del', 'export', 'check'])
|
|
|
+const emit = defineEmits(['tap', 'completion', 'examine', 'del', 'export', 'check', 'change'])
|
|
|
|
|
|
//监听权限
|
|
|
const isAdminAuth = ref(props.isAdmin)
|
|
@@ -219,13 +220,15 @@ const examine = (row) => {
|
|
|
}
|
|
|
|
|
|
//删除
|
|
|
-const delTableItem = ({ item }, resolve) => {
|
|
|
- console.log('我被执行了', item)
|
|
|
- //这里可以写一些操作,下面是模拟3秒关闭
|
|
|
- setTimeout(() => {
|
|
|
+const delTableItem = async ({ item }, resolve) => {
|
|
|
+ const { error, code, msg } = await mainApi.remove({ ids: item.id })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('删除成功')
|
|
|
resolve()
|
|
|
- emit('del', item)
|
|
|
- }, 3000)
|
|
|
+ emit('change')
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '删除失败')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//导出数据
|
|
@@ -238,30 +241,12 @@ const deriveTableItem = ({ item }, resolve) => {
|
|
|
}, 3000)
|
|
|
}
|
|
|
|
|
|
-//批量删除
|
|
|
-const batchRemove = () => {
|
|
|
- if (!isAdminAuth.value) return
|
|
|
- const rows = tableCheckKeys.value
|
|
|
- console.log('批量删除', rows)
|
|
|
-}
|
|
|
-
|
|
|
-//批量导出
|
|
|
-const batchExport = () => {
|
|
|
- const rows = tableCheckKeys.value
|
|
|
- console.log('批量导出', rows)
|
|
|
-}
|
|
|
-
|
|
|
//年数据
|
|
|
const yearKey = ref('2023')
|
|
|
const yearData = ref([
|
|
|
{ key: '2023', label: '2023年' },
|
|
|
{ key: '2024', label: '2024年' },
|
|
|
])
|
|
|
-
|
|
|
-defineExpose({
|
|
|
- batchRemove,
|
|
|
- batchExport,
|
|
|
-})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|