| | |
| | | <div> |
| | | <span class="search_title">设备名称:</span> |
| | | <el-input |
| | | v-model="searchForm.name" |
| | | v-model="searchForm.deviceName" |
| | | style="width: 240px" |
| | | placeholder="请输入" |
| | | @change="handleQuery" |
| | |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">新增</el-button> |
| | | <el-button type="info" plain icon="Upload" @click="handleImport">导入</el-button> |
| | | <el-button @click="handleOut">导出</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">删除</el-button> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {onMounted, ref, reactive, nextTick} from "vue"; |
| | | import {onMounted, ref, reactive, nextTick, getCurrentInstance} from "vue"; |
| | | import FormDia from "@/views/energyManagement/waterManagement/components/formDia.vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import {getToken} from "@/utils/auth.js"; |
| | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "设备名称", |
| | | prop: "name", |
| | | prop: "deviceName", |
| | | width: 200, |
| | | }, |
| | | { |
| | | label: "规格型号", |
| | | prop: "code", |
| | | prop: "deviceModel", |
| | | width: 200, |
| | | }, |
| | | { |
| | | label: "额定流量", |
| | | prop: "flowRating", |
| | | prop: "ratedRate", |
| | | }, |
| | | { |
| | | label: "实际流量", |
| | | prop: "flowActual", |
| | | prop: "actualTraffic", |
| | | }, |
| | | { |
| | | label: "运行时间", |
| | | prop: "runDate", |
| | | prop: "runTime", |
| | | width:150 |
| | | }, |
| | | { |
| | | label: "当日用水量", |
| | | prop: "dayNum", |
| | | prop: "waterDay", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "每日限制水量", |
| | | prop: "everyNum", |
| | | prop: "waterDayLimit", |
| | | width:220 |
| | | }, |
| | | { |
| | |
| | | // 设置上传的请求头部 |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | // 上传的地址 |
| | | url: import.meta.env.VITE_APP_BASE_API + "/waterEquipmentConsumption/importData", |
| | | url: import.meta.env.VITE_APP_BASE_API + "/waterRecord/importData", |
| | | // 文件上传前的回调 |
| | | beforeUpload: (file) => { |
| | | console.log('文件即将上传', file); |
| | |
| | | } |
| | | function importTemplate() { |
| | | proxy.download( |
| | | "/waterEquipmentConsumption/export", |
| | | "/waterRecord/export", |
| | | {}, |
| | | '用水设备导入模版.xlsx' |
| | | ); |
| | |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | // 导出 |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/waterRecord/export", {}, "用水管理.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |