소스 검색

wyn第三次提交修复批量删除错误

wyn 4 달 전
부모
커밋
0f07d6d086
3개의 변경된 파일89개의 추가작업 그리고 14개의 파일을 삭제
  1. 3 4
      src/api/basic/mapconfig/index.ts
  2. 62 0
      src/api/system/marsdept/index.ts
  3. 24 10
      src/views/Basicdata/mapconfig/index.vue

+ 3 - 4
src/api/basic/mapconfig/index.ts

@@ -38,9 +38,8 @@ export const updateIsMap = async (data: MapVO) => {
 }
 
 // 删除地图参数配置
-export const deleteIsMapByIds = async (id: number) => {
-  return await request.post({
-    url: '/iscs/map/deleteMapList',
-    params: { ids: id }
+export const deleteIsMapByIds = async (ids) => {
+  return await request.delete({
+    url: '/iscs/map/deleteMapList?ids=' + ids,
   })
 }

+ 62 - 0
src/api/system/marsdept/index.ts

@@ -0,0 +1,62 @@
+import request from '@/config/axios'
+
+export interface MarsDeptVO {
+  workstationId?: number
+  workstationCode: string
+  workstationName: string
+  enableFlag?: string
+  remark?: string
+  createBy?: string
+  createTime?: Date
+  updateBy?: string
+  updateTime?: Date
+}
+
+export interface PageParam {
+  pageNo: number
+  pageSize: number
+  workstationCode?: string
+  workstationName?: string
+  enableFlag?: string
+}
+
+// 查询玛氏岗位列表
+export const listMarsDept = async (params: PageParam) => {
+  return await request.get({ url: '/iscs/workstation/getWorkstationPage', params })
+}
+
+// 查询玛氏岗位列表(排除节点)
+export const listMarsDeptExcludeChild = async (deptId: number) => {
+  return await request.get({ url: '/system/dept/list/exclude/' + deptId })
+}
+
+// 查询玛氏岗位详细
+export const getMarsDept = async (id: number) => {
+  return await request.get({
+    url: '/iscs/workstation/selectWorkstationById',
+    params: { id: id }
+  })
+}
+
+// 新增玛氏岗位
+export const addMarsDept = async (data: MarsDeptVO) => {
+  return await request.post({ url: '/iscs/workstation/insertWorkstation', data })
+}
+
+// 修改玛氏岗位
+export const updateMarsDept = async (data: MarsDeptVO) => {
+  return await request.put({ url: '/iscs/workstation/updateWorkstation', data })
+}
+
+// 修改玛氏岗位 状态
+export const updateMarsDeptStatus = async (data: MarsDeptVO) => {
+  return await request.post({ url: '/iscs/workstation/updateIsWorkstationStatus', data })
+}
+
+// 删除玛氏岗位
+export const delMarsDept = async (ids: number) => {
+  return await request.delete({
+    url: '/iscs/workstation/deleteWorkstationList',
+    params: { ids: ids }
+  })
+}

+ 24 - 10
src/views/Basicdata/mapconfig/index.vue

@@ -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
 }