|
|
|
|
@ -1,7 +1,22 @@
@@ -1,7 +1,22 @@
|
|
|
|
|
<template> |
|
|
|
|
<EdfsWrap class="wh-full" :title="'工程列表'" :use-scroll-bar="false"> |
|
|
|
|
<template #title-right> |
|
|
|
|
<div v-if="!isBatchMode"> |
|
|
|
|
<el-button type="danger" plain @click="enterBatchMode"> 批量删除 </el-button> |
|
|
|
|
</div> |
|
|
|
|
<div v-else> |
|
|
|
|
<el-button |
|
|
|
|
type="danger" |
|
|
|
|
:disabled="selectedItems.length === 0" |
|
|
|
|
@click="handleBatchDelete" |
|
|
|
|
> |
|
|
|
|
确认删除 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button @click="exitBatchMode">取消</el-button> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<div class="engineering-list-container"> |
|
|
|
|
<div class="engineering-grid"> |
|
|
|
|
<el-checkbox-group v-model="selectedItems" class="engineering-grid"> |
|
|
|
|
<div class="engineering-card add-card" @click="addEngineering"> |
|
|
|
|
<div class="add-card-content"> |
|
|
|
|
<el-icon :size="48" class="add-icon"> |
|
|
|
|
@ -13,7 +28,25 @@
@@ -13,7 +28,25 @@
|
|
|
|
|
|
|
|
|
|
<div v-for="item in list" :key="item.name" class="engineering-card"> |
|
|
|
|
<div class="card-header"> |
|
|
|
|
<span class="card-title">工程名称:{{ item.name }}</span> |
|
|
|
|
<div class="flex items-center gap-2 flex-1 overflow-hidden"> |
|
|
|
|
<el-checkbox v-if="isBatchMode" :value="item.name" @click.stop> |
|
|
|
|
<span class="card-title" :title="item.name" |
|
|
|
|
>工程名称:{{ item.name }}</span |
|
|
|
|
> |
|
|
|
|
</el-checkbox> |
|
|
|
|
<div v-else class="h-32 leading-32px"> |
|
|
|
|
<span class="card-title" :title="item.name" |
|
|
|
|
>工程名称:{{ item.name }}</span |
|
|
|
|
> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<el-button |
|
|
|
|
link |
|
|
|
|
type="danger" |
|
|
|
|
v-if="!isBatchMode" |
|
|
|
|
:icon="Delete" |
|
|
|
|
@click="handleDelete(item)" |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<div class="card-body"> |
|
|
|
|
<p class="card-desc">工程描述:{{ item.description }}</p> |
|
|
|
|
@ -27,7 +60,7 @@
@@ -27,7 +60,7 @@
|
|
|
|
|
> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
<p v-if="loading" class="loading-text">加载中...</p> |
|
|
|
|
<el-empty v-if="!loading && list.length === 0" description="暂无数据" /> |
|
|
|
|
</div> |
|
|
|
|
@ -41,17 +74,21 @@
@@ -41,17 +74,21 @@
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus' |
|
|
|
|
import EdfsWrap from '@/components/Edfs-wrap.vue' |
|
|
|
|
import type { IEngineeringOV } from '@/api/module/engineering/index.d' |
|
|
|
|
import CreateEngineeringDlg from './components/create-engineering-dlg.vue' |
|
|
|
|
import { Plus } from '@element-plus/icons-vue' |
|
|
|
|
import { Plus, Delete } from '@element-plus/icons-vue' |
|
|
|
|
import { useEngineeringStore } from '@/stores/engineering' |
|
|
|
|
import { storeToRefs } from 'pinia' |
|
|
|
|
import { deleteEngineering, deleteEngineeringBatch } from '@/api/module/engineering' |
|
|
|
|
|
|
|
|
|
const router = useRouter() |
|
|
|
|
const engineeringStore = useEngineeringStore() |
|
|
|
|
|
|
|
|
|
const selectedItems = ref<string[]>([]) |
|
|
|
|
const isBatchMode = ref(false) |
|
|
|
|
|
|
|
|
|
const createEngineeringDlgRef = ref<typeof CreateEngineeringDlg | null>(null) |
|
|
|
|
|
|
|
|
|
const { engineeringList: list, loading } = storeToRefs(engineeringStore) |
|
|
|
|
@ -123,6 +160,53 @@ async function handleDownload(item: IEngineeringOV) {
@@ -123,6 +160,53 @@ async function handleDownload(item: IEngineeringOV) {
|
|
|
|
|
console.error('Download failed:', error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function handleDelete(item: IEngineeringOV) { |
|
|
|
|
ElMessageBox.confirm('确认删除该工程吗?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}) |
|
|
|
|
.then(async () => { |
|
|
|
|
const res = await deleteEngineering({ name: item.name }) |
|
|
|
|
if (res.code === 0) { |
|
|
|
|
ElMessage.success('删除成功') |
|
|
|
|
engineeringStore.fetchEngineeringList() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(() => {}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function handleBatchDelete() { |
|
|
|
|
ElMessageBox.confirm( |
|
|
|
|
`确认删除选中的 ${selectedItems.value.length} 个工程吗?`, |
|
|
|
|
'提示', |
|
|
|
|
{ |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
.then(async () => { |
|
|
|
|
const res = await deleteEngineeringBatch(selectedItems.value) |
|
|
|
|
if (res.code === 0) { |
|
|
|
|
ElMessage.success('删除成功') |
|
|
|
|
selectedItems.value = [] |
|
|
|
|
isBatchMode.value = false |
|
|
|
|
engineeringStore.fetchEngineeringList() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(() => {}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function enterBatchMode() { |
|
|
|
|
isBatchMode.value = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function exitBatchMode() { |
|
|
|
|
isBatchMode.value = false |
|
|
|
|
selectedItems.value = [] |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
|