<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 plcPointInfoCloum"> <template #default="{ row }" v-if="i.prop == 'pointType'"> <dict-tag :options="plc_point_type" :value="row.pointType" /> </template> <template #default="{ row }" v-if="i.prop == 'reportType'"> <dict-tag :options="report_type" :value="row.reportType" /> </template> <template #default="{ row }" v-if="i.prop == 'dataType'"> <dict-tag :options="data_type" :value="row.dataType" /> </template> <template #default="{ row }" v-if="i.prop == 'monitorType'"> <dict-tag :options="monitor_type" :value="row.monitorType" /> </template> <template #default="{ row }" v-if="i.prop == 'createReport'"> <el-tag class="ml-2" :type="row.createReport == 1 ? 'success' : 'danger'"> {{ row.createReport ? '是' : '否' }}</el-tag> </template> <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 == 'dataShow'"> <el-tag class="ml-2" :type="row.dataShow == 1 ? 'success' : 'danger'"> {{ row.dataShow == 1 ? '展示' : '不展示' }} </el-tag> </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="51%" > <tableDalgo v-if="visible" ref="tableDalgoRef" @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/plcPointInfo'; import tableDalgo from './tableDalgo.vue'; import { plcPointInfoCloum } from '@/utils/cloums'; const { proxy } = getCurrentInstance(); const { data_type, monitor_type, report_type, plc_point_type } = proxy.useDict( 'data_type', 'monitor_type', 'report_type', 'plc_point_type' ); import { reactive } from 'vue'; const { typeListlist } = defineProps(['typeListlist']); let visible = ref(false); let isFlag = ref(1); const tableDalgoRef = ref(); const FormList = ref({}); const totals = ref(0); let dataForm = reactive({ tableData: [], 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 = { ...typeListlist, type: ty, ...data }; visible.value = true; isFlag.value++; } }); // 获取文件列表 } 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></style>