对比新文件 |
| | |
| | | <template> |
| | | <el-dialog |
| | | title="当前值" |
| | | :close-on-click-modal="false" |
| | | width="50%" |
| | | v-model="visible" |
| | | > |
| | | <el-form |
| | | :model="dataForm" |
| | | v-loading="formLoading" |
| | | label-width="120px" |
| | | > |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="测点编码" prop="pointNo"> |
| | | <el-input v-model="dataForm.pointNo" readonly/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="测点名称" prop="pointName"> |
| | | <el-input v-model="dataForm.pointName" readonly/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="数据时间" prop="dataTime"> |
| | | <el-input v-model="dataForm.dataTime" readonly/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="数据值" prop="dataValue"> |
| | | <el-input v-model="dataForm.dataValue" readonly> |
| | | <template #append>{{ dataForm.unit }}</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <!-- 列表 --> |
| | | <ContentWrap v-if="dataForm.pointType === 'CALCULATE'"> |
| | | <el-table border stripe v-loading="tableLoading" :data="list"> |
| | | <el-table-column type="index" header-align="center" align="center" fixed="left" width="50"/> |
| | | <el-table-column fixed label="测点编码" header-align="center" align="left" min-width="130" prop="pointNo" /> |
| | | <el-table-column fixed label="测点名称" header-align="center" align="left" min-width="240" prop="pointName" /> |
| | | <el-table-column fixed label="当前值" header-align="center" align="left" min-width="240" prop="currentValue" /> |
| | | </el-table> |
| | | <!-- 分页 --> |
| | | <Pagination |
| | | :total="total" |
| | | v-model:page="queryParams.pageNo" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </ContentWrap> |
| | | |
| | | </el-dialog> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {getYMDHM0} from "@/utils/dateUtil"; |
| | | import * as DaPoint from "@/api/data/da/point/daPointChart"; |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | const visible = ref(false); |
| | | const formLoading = ref(false) |
| | | const tableLoading = ref(false) |
| | | const total = ref(0) // 列表的总页数 |
| | | const list = ref([]) // 列表的数据 |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | pointNo: undefined |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | | |
| | | const dataForm = ref({ |
| | | id: "", |
| | | pointNo: "", |
| | | pointName: "", |
| | | pointType: "", |
| | | unit: "", |
| | | dataTime: "", |
| | | dataValue: "", |
| | | }); |
| | | |
| | | /** 打开弹窗 */ |
| | | const open = async (row: object) => { |
| | | visible.value = true |
| | | resetForm() |
| | | dataForm.value.id = row.id; |
| | | dataForm.value.pointNo = row.pointNo; |
| | | dataForm.value.pointName = row.pointName; |
| | | dataForm.value.pointType = row.pointType; |
| | | dataForm.value.unit = row.unit; |
| | | getCurrentData() |
| | | queryParams.pointNo = row.pointNo; |
| | | if (dataForm.value.pointType === "CALCULATE") { |
| | | getList() |
| | | } |
| | | } |
| | | |
| | | defineExpose({open}) // 提供 open 方法,用于打开弹窗 |
| | | |
| | | async function getCurrentData() { |
| | | visible.value = true; |
| | | formLoading.value = true |
| | | if (dataForm.value.id) { |
| | | let params0 = [dataForm.value.pointNo] |
| | | const data = await DaPoint.getPointsRealValue(params0) |
| | | formLoading.value = false |
| | | dataForm.value.dataTime = getYMDHM0(new Date()); |
| | | dataForm.value.dataValue = data[dataForm.value.pointNo] |
| | | } |
| | | } |
| | | |
| | | /** 查询列表 */ |
| | | const getList = async () => { |
| | | tableLoading.value = true |
| | | try { |
| | | const page = await DaPoint.getMathPointCurrentValue(queryParams) |
| | | list.value = page.list |
| | | total.value = page.total |
| | | } finally { |
| | | tableLoading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 重置表单 */ |
| | | const resetForm = () => { |
| | | dataForm.value = { |
| | | id: undefined, |
| | | pointNo: undefined, |
| | | pointName: undefined, |
| | | pointType: undefined, |
| | | unit: undefined, |
| | | dataTime: undefined, |
| | | dataValue: undefined, |
| | | } |
| | | } |
| | | |
| | | </script> |