shj
2022-09-06 d1a430e88df40d76558a14f890ac0dbd3181f3a0
src/views/facilityManagement/deviceType/index.vue
@@ -10,12 +10,14 @@
         </el-table-column>
         <el-table-column align="center" label="巡检">
            <template #default="scope">
               <span v-if="scope.row.isVisit == 0">-</span>
               <span v-if="scope.row.isVisit == 1">是</span>
               <span v-if="scope.row.isVisit == 2">否</span>
            </template>
         </el-table-column>
         <el-table-column align="center" label="检测">
            <template #default="scope">
               <span v-if="scope.row.isCheck == 0">-</span>
               <span v-if="scope.row.isCheck == 1">是</span>
               <span v-if="scope.row.isCheck == 2">否</span>
            </template>
@@ -25,7 +27,7 @@
            <template #default="scope">
               <el-button type="primary" link :icon="View" @click="openD('查看', scope.row.id)">查看</el-button>
               <el-button type="primary" link :icon="EditPen" @click="openD('修改', scope.row.id)">修改</el-button>
               <el-button type="primary" link :icon="Delete" @click="Delete(scope.row.id)">删除</el-button>
               <el-button type="primary" link :icon="Delete" @click="Deletes(scope.row.id)">删除</el-button>
               <el-button type="primary" link :icon="CirclePlus" @click="openD('添加', scope.row.id)">添加下级设备设施类型管理</el-button>
            </template>
         </el-table-column>
@@ -38,7 +40,7 @@
import { Plus, View, EditPen, Delete, CirclePlus } from '@element-plus/icons-vue';
import Dailog from './component/Dailog.vue';
import { facilityManagementApi } from '/@/api/facilityManagement';
import { ElMessage } from 'element-plus';
import { ElMessage,ElMessageBox } from 'element-plus';
export default defineComponent({
   components: { Dailog },
   setup() {
@@ -62,24 +64,34 @@
         listApi();
      });
      // 删除
      const Delete = (id: number) => {
         facilityManagementApi()
            .getequipmentTypeMngDelete(id)
            .then((res) => {
               if (res.data.code == 200) {
                  ElMessage({
                     showClose: true,
                     message: res.data.msg,
                     type: 'success',
      const Deletes = (id: number) => {
         let arr = [];
         arr.push(id);
         ElMessageBox.confirm('确定删除所选项吗?', 'Warning', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
         })
            .then(() => {
               facilityManagementApi()
                  .getequipmentTypeMngDelete(arr)
                  .then((res) => {
                     if (res.data.code == 200) {
                        ElMessage({
                           showClose: true,
                           message: res.data.msg,
                           type: 'success',
                        });
                        listApi();
                     } else {
                     }
                  });
                  listApi();
               } else {
                  ElMessage({
                     showClose: true,
                     message: res.data.msg,
                     type: 'error',
                  });
               }
            })
            .catch(() => {
               ElMessage({
                  type: 'info',
                  message: 'Delete canceled',
               });
            });
      };
      const add = () => {
@@ -98,13 +110,14 @@
         add,
         tableData,
         Show,
         Delete,
         Deletes,
         openD,
         listApi,
         Plus,
         View,
         EditPen,
         CirclePlus,
         Delete,
      };
   },
});