<template> <div class="water-analysis-page"> <el-table :key="isFlag" :data="tableData" v-loading="tableLoading" max-height="600"> <el-table-column type="index" width="70" label="序号" /> <el-table-column :label="i.label" :prop="i.prop" show-overflow-tooltip v-for="i in stationInfoCloum"> <template #default="{ row }" v-if="i.prop == 'status'"> <el-tag class="ml-2" :type="row.status == 1 ? 'success' : 'danger'"> {{ row.status == 1 ? '启用' : '停用' }}</el-tag> </template> <template #default="{ row }" v-if="i.prop == 'plcStationType'"> <dict-tag :options="plc_station_type" :value="row.plcStationType" /> </template> </el-table-column> <el-table-column label="操作" width="250"> <template #default="{ row }"> <el-button link type="primary" icon="View" @click="onCheck(row, 1, '详情')">详情</el-button> <el-button link icon="Edit" type="warning" @click="onCheck(row, 2, '修改')">修改</el-button> <el-button link icon="Delete" type="danger" @click="onCheck(row, 3)">删除</el-button> </template> </el-table-column> </el-table> <pagination v-show="totals > 0" :total="totals" v-model:page="FormList.pageNum" v-model:limit="FormList.pageSize" @pagination="getInfoList(FormList)" /> </div> <el-dialog v-model="visible" :title="'PLC站点信息' + FormList.title" :modal-append-to-body="false" :close-on-click-modal="false" width="55%" > <tableDalgo ref="tableDalgoRef" v-if="visible" @onModalClose="onModalClose" :typeList="typeList" :key="isFlag"></tableDalgo> <template #footer> <div class="dialog-footer"> <el-button v-show="typeList.type == '2'" @click="open2" type="primary">确定</el-button> <el-button @click="visible = false">关闭</el-button> </div> </template> </el-dialog> </template> <script setup> import { ElMessage, ElMessageBox } from 'element-plus'; import { getInfo, projectInfoDelete, projectInfoGet } from '@/api/scada/stationInfo'; import { FileSystemList } from '@/api/project/tenderReview'; import tableDalgo from './tableDalgo.vue'; import { stationInfoCloum } from '@/utils/cloums'; const { proxy } = getCurrentInstance(); const { plc_station_type } = proxy.useDict('plc_station_type'); import { reactive } from 'vue'; let visible = ref(false); let isFlag = ref(1); const tableDalgoRef = ref(); const FormList = ref({}); const totals = ref(0); let dataForm = reactive({ tableData: [], tableDateTwo: '', tableLoading: true, }); let { tableData, tableLoading } = toRefs(dataForm); //获取列表数据 const getInfoList = async prams => { tableLoading.value = true; let { data, total } = await getInfo(prams); tableData.value = data; totals.value = total; tableLoading.value = false; }; //搜索 const search = p => { FormList.value = p; FormList.value.pageNum = 1; getInfoList(p); isFlag.value++; }; defineExpose({ search }); // 查看上报数据 let typeList = ref({}); const onCheck = (row, ty, t) => { FormList.value.title = t; if (ty == 1 || ty == 2) { projectInfoGet(row.id).then(({ code, data }) => { if (code == 200) { typeList.value = { ...data, type: ty }; visible.value = true; FileSystemList({ refId: row.id, refType: 'plcStationPictures', }).then(({ data }) => { typeList.value.fileSaveRequestList = data; }); } }); // 获取文件列表 } else if (ty == 3) { ElMessageBox.confirm(`您确定删除吗?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', }) .then(() => { proxy.$modal.msgSuccess('操作成功!'); projectInfoDeleteM(row.id); }) .catch(() => {}); // emgBox(row.id, projectInfoDeleteM, "您确定删除吗?"); } }; //删除 const projectInfoDeleteM = async id => { let { code } = await projectInfoDelete(id); getInfoList(); }; function onModalClose() { visible.value = false; getInfoList(); } function open2() { tableDalgoRef.value.submit(); } onMounted(() => {}); </script> <style lang="scss" scoped> .water-analysis-page { padding: 10px; // overflow-y: hidden; } </style>