|
|
@@ -18,15 +18,22 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
- <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
|
|
+ <el-button @click="handleQuery">
|
|
|
+ <Icon icon="ep:search" class="mr-5px" />
|
|
|
+ 搜索
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="resetQuery">
|
|
|
+ <Icon icon="ep:refresh" class="mr-5px" />
|
|
|
+ 重置
|
|
|
+ </el-button>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
plain
|
|
|
@click="openForm('create')"
|
|
|
v-hasPermi="['iscs:map:create']"
|
|
|
>
|
|
|
- <Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
+ <Icon icon="ep:plus" class="mr-5px" />
|
|
|
+ 新增
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
type="danger"
|
|
|
@@ -35,7 +42,8 @@
|
|
|
@click="handleDelete"
|
|
|
v-hasPermi="['iscs:map:delete']"
|
|
|
>
|
|
|
- <Icon icon="ep:delete" class="mr-5px" /> 删除
|
|
|
+ <Icon icon="ep:delete" class="mr-5px" />
|
|
|
+ 删除
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -115,7 +123,6 @@ import { dateFormatter } from '@/utils/formatTime'
|
|
|
import * as MapConfigApi from '@/api/basic/mapconfig'
|
|
|
import MapConfigForm from './MapConfigForm.vue'
|
|
|
|
|
|
-
|
|
|
defineOptions({ name: 'SystemMap' })
|
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
@@ -124,7 +131,7 @@ const { t } = useI18n() // 国际化
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
const list = ref([]) // 列表的数据
|
|
|
-const ids = ref<number[]>([]) // 选中的数据
|
|
|
+const ids = ref() // 选中的数据
|
|
|
const multiple = ref(true) // 非多个禁用
|
|
|
const queryParams = reactive({
|
|
|
pageNo: 1,
|
|
|
@@ -164,18 +171,25 @@ const openForm = (type: string, id?: number) => {
|
|
|
}
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
-const handleDelete = async (id: number) => {
|
|
|
+const handleDelete = async (id?: number) => {
|
|
|
try {
|
|
|
await message.delConfirm()
|
|
|
- await MapConfigApi.deleteIsMapByIds(id)
|
|
|
+ // 类型守卫处理
|
|
|
+ const realId = id instanceof PointerEvent
|
|
|
+ ? ids.value
|
|
|
+ : id || ids.value;
|
|
|
+ await MapConfigApi.deleteIsMapByIds(realId)
|
|
|
message.success(t('common.delSuccess'))
|
|
|
await getList()
|
|
|
- } catch {}
|
|
|
+ } catch (error) {
|
|
|
+ console.error('删除失败:', error)
|
|
|
+ message.error(t('common.delFailed'))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
|
const handleSelectionChange = (selection: any[]) => {
|
|
|
- ids.value = selection.map(item => item.id)
|
|
|
+ ids.value = selection.map((item) => item.id)
|
|
|
multiple.value = !selection.length
|
|
|
}
|
|
|
|