From d0f98ad8e1047e3161a458399ad3005404ed87b8 Mon Sep 17 00:00:00 2001 From: whychdw <496960745@qq.com> Date: 星期五, 06 六月 2025 15:52:15 +0800 Subject: [PATCH] 标准参数管理 --- src/views/statistics/batt.vue | 438 ++++++++++++++++++++++-------------------------------- 1 files changed, 180 insertions(+), 258 deletions(-) diff --git a/src/views/statistics/batt.vue b/src/views/statistics/batt.vue index 166cff9..5e5ac32 100644 --- a/src/views/statistics/batt.vue +++ b/src/views/statistics/batt.vue @@ -1,5 +1,5 @@ <script setup name="batt"> - import { ref, reactive, onMounted, computed } from "vue"; + import { ref, reactive, onMounted, computed, nextTick } from "vue"; import { storeToRefs } from "pinia"; import { Search, Plus } from "@element-plus/icons-vue"; import ycCard from "@/components/ycCard/index.vue"; @@ -13,139 +13,99 @@ proviceList, cityList, countryList, stationList, } = useStation(); + import { useRouter } from "vue-router"; + const router = useRouter(); + + import { ExportFile } from '@/utils/exportFile.js'; + + import powerTypes from '@/utils/const/const_powerType.js'; + import hrTypes from '@/utils/const/const_hrTestType.js'; import { delBatt, } from "@/api/station"; const userStore = useUserStore(); const { uid, uname } = storeToRefs(userStore); + import moment from 'moment'; - + import formatSeconds from '@/utils/formatSeconds'; + import { + toFixed, + digits, + } from '@/utils/toFixed'; import { - getDevList, - } from "@/api/station"; + getBattStatistic, + } from "@/api/statistic.js"; const { $loading, $message, $confirm } = useElement(); + const headers = [ { prop: "provice", label: "鐪�", - width: "80", + width: "100", }, { prop: "city", label: "甯�", - width: "80", + width: "100", }, { prop: "country", label: "鍖哄幙", - width: "80", + width: "100", }, - { - prop: "stationName", - label: "鏈烘埧鍚嶇О", + { + prop: "fullName", + label: "绔欑偣鍚嶇О", width: "160", }, { - prop: "stationType", - label: "鐢靛帇绛夌骇", - width: "80", - }, - { - prop: "longitude", - label: "缁忓害", - width: "80", - }, - { - prop: "latitude", - label: "绾害", - width: "80", - }, - { - prop: "powerName", - label: "鐢垫簮鍚嶇О", - width: "80", - }, - { - prop: "powerTypeStr", - label: "鐢垫簮绫诲瀷", - width: "80", - }, - { - prop: "company", - label: "鐢垫簮鍝佺墝", - width: "80", - }, - { - prop: "powerModel", - label: "鐢垫簮鍨嬪彿", - width: "80", - }, - { - prop: "protocol", - label: "鐢垫簮鍗忚", - width: "80", - }, - { - prop: "powerIp", - label: "鐢垫簮IP", - width: "120", - }, - { - prop: "devName", + prop: "devName", label: "璁惧鍚嶇О", - width: "120", + width: "80", }, { - prop: "devType", - label: "璁惧鍨嬪彿", - width: "120", - }, - { - prop: "devIp", - label: "璁惧IP", - width: "120", - }, - { - prop: "battgroupName", + prop: "battgroupName", label: "鐢垫睜缁勫悕绉�", - width: "120", + width: "80", }, { - prop: "moncount", - label: "鐢垫睜鍗曚綋涓暟", - width: "120", - }, + prop: "moncount", + label: "鍗曚綋鏁扮洰", + width: "160", + }, { prop: "monvolstd", - label: "鐢垫睜鏍囩О鐢靛帇", - width: "120", + label: "鏍囩О鐢靛帇", + width: "80", }, { prop: "moncapstd", - label: "鐢垫睜鏍囩О瀹归噺", - width: "120", + label: "鏍囩О瀹归噺", + width: "80", }, { - prop: "monresstd", - label: "鐢垫睜鏍囩О鍐呴樆", - width: "120", - }, - { - prop: "product", - label: "鐢垫睜鍝佺墝", - width: "120", - }, - { - prop: "battModel", - label: "鐢垫睜鍨嬪彿", - width: "120", - }, + prop: "monresstd", + label: "鏍囩О鍐呴樆", + width: "80", + }, ]; + + const testType = ref(''); + const hrTypeList = computed(() => { + return Object.keys(hrTypes).map(v => { + return { + value: v, + label: hrTypes[v], + }; + }); + }); + + const background = ref(true); const disabled = ref(false); const pageCurr = ref(1); @@ -155,30 +115,32 @@ const dialogTitle = ref(""); const currentAreaId = ref(); const currentAreaIds = ref([]); + const testStartDate = ref(''); + const testEndDate = ref(''); const datas = reactive({ tableData: [], rowData: {}, }); - // const tableData = reactive([]); - // const rowData = reactive({}); - // const userStore = useUserStore(); - // const { uid, uname } = storeToRefs(userStore); + // 璁$畻灞炴�х敓鎴� picker-options锛堟洿绠�娲侊級 + const startDisabledDate = (time) => testEndDate.value ? moment(testEndDate.value).isBefore(time) || moment().isBefore(time) : moment().isBefore(time); + + const endDisabledDate = (time) => testStartDate.value ? moment(time).isBefore(testStartDate.value) || moment().isBefore(time) : moment().isBefore(time); function getList() { let loading = $loading(); let params = { - // city: "", - // country: "", + provice: provice.value || undefined, + city: city.value || undefined, + country: country.value || undefined, + stationName: stationName.value || undefined, + // testType: testType.value || undefined, pageNum: pageCurr.value, pageSize: pageSize.value, - // powerName: "", - // provice: "", - // stationName: "", }; - getDevList(params) + getBattStatistic(params) .then((res) => { let { code, data, data2 } = res; let list = []; @@ -187,8 +149,6 @@ // console.log(data); list = data2.list.map(v => ({ ...v, - powerTypeStr: powerTypes[v.powerType], - // roleName: roles[v.role], })); _total = data2.total; } @@ -214,61 +174,44 @@ pageCurr.value = val; getList(); } - function add() { - dialogTitle.value = "娣诲姞璁惧"; - datas.rowData = {}; - addEditVisible.value = true; - } - function edit(record) { - dialogTitle.value = "缂栬緫璁惧"; - addEditVisible.value = true; - console.log(record, '=======edit======'); - // if (record.ainfList.idPath) { - // ids = record.ainfList.idPath.split("_").map((v) => v * 1); - // } - // ids.push(record.areaId); - datas.rowData = { ...record }; - } - - function addBatt(record) { - dialogTitle.value = "娣诲姞鐢垫睜缁�"; - datas.rowData = { ...record, addBattFlag: true }; - addEditVisible.value = true; + function filterChange() { + nextTick(() => { + pageCurr.value = 1; + getList(); + }); } - - function confirmRemove(record) { - $confirm("鍒犻櫎", () => { - let { stationId, powerId, battgroupId } = record; - remove(stationId, powerId, battgroupId||undefined); - }); - } - function remove(stationId, powerId, battgroupId) { - let loading = $loading(); - delBatt(stationId, powerId, battgroupId) - .then((res) => { - let { code, data } = res; - loading.close(); - if (code && data) { - $message.success("鎿嶄綔鎴愬姛"); - handleCurrentChange(1); - } else { - $message.success("鎿嶄綔澶辫触"); - } - }) - .catch((err) => { - loading.close(); - console.log(err); - }); - } - function onOk() { - addEditVisible.value = false; - handleCurrentChange(1); - } - function onCanel() { - addEditVisible.value = false; - } + function goRt (row) { + router.push({ + path: '/datas/realtime', + query: { + stationId: row.stationId || undefined, + powerId: row.powerId || undefined, + devId: row.devId || undefined, + battgroupId: row.battgroupId || undefined, + pageFlag: Math.random(), + } + }); + } + + function goHis (row) { + router.push({ + path: '/datas/history', + query: { + stationId: row.stationId || undefined, + powerId: row.powerId || undefined, + devId: row.devId || undefined, + battgroupId: row.battgroupId || undefined, + pageTab: 'his-real', + pageFlag: Math.random(), + } + }); + } + + function exportExcel() { + ExportFile(headers, datas.tableData, "鐢垫睜缁勪俊鎭粺璁�"); + } onMounted(() => { getList(); @@ -283,102 +226,86 @@ <yc-card is-full> <div class="page-content-wrapper"> <div class="page-content-tools page-filter"> - <div class="table-row"> - <div class="table-cell text-right">鐪侊細</div> - <div class="table-cell"> - <el-select - v-model="provice" - size="small" - placeholder="璇烽�夋嫨鐪�" - > - <el-option - v-for="item in proviceList" - :key="'l0_' + item" - :label="item" - :value="item" + <div class="grid-container" :style="{'--counter': 4}"> + <div class="grid-item"> + <div class="label">鐪�</div> + <div class="value"> + <el-select + v-model="provice" + size="small" + clearable + @change="filterChange" + placeholder="璇烽�夋嫨鐪�" > - </el-option> - </el-select> + <el-option + v-for="item in proviceList" + :key="'l0_' + item" + :label="item" + :value="item" + > + </el-option> + </el-select> + </div> </div> - <div class="table-cell text-right">甯傦細</div> - <div class="table-cell"> - <el-select - v-model="city" - size="small" - placeholder="璇烽�夋嫨甯�" - > - <el-option - v-for="item in cityList" - :key="'l1_' + item" - :label="item" - :value="item" + <div class="grid-item"> + <div class="label">甯�</div> + <div class="value"> + <el-select + v-model="city" + size="small" + clearable + @change="filterChange" + placeholder="璇烽�夋嫨甯�" > - </el-option> - </el-select> + <el-option + v-for="item in cityList" + :key="'l1_' + item" + :label="item" + :value="item" + > + </el-option> + </el-select> + </div> </div> - <div class="table-cell text-right">鍖哄幙:</div> - <div class="table-cell"> - <el-select - v-model="country" - size="small" - placeholder="璇烽�夋嫨鍖哄幙" - > - <el-option - v-for="item in countryList" - :key="'l2_' + item" - :label="item" - :value="item" + <div class="grid-item"> + <div class="label">鍖哄幙</div> + <div class="value"> + <el-select + v-model="country" + clearable + @change="filterChange" + size="small" + placeholder="璇烽�夋嫨鍖哄幙" > - </el-option> - </el-select> + <el-option + v-for="item in countryList" + :key="'l2_' + item" + :label="item" + :value="item" + > + </el-option> + </el-select> + </div> </div> - <div class="table-cell text-right">绔欑偣:</div> - <div class="table-cell"> - <el-select - v-model="stationName" - size="small" - placeholder="璇烽�夋嫨绔欑偣" - > - <el-option - v-for="item in stationList" - :key="'l3_' + item.stationId" - :label="item.stationName" - :value="item.stationName" + <div class="grid-item"> + <div class="label">绔欑偣</div> + <div class="value"> + <el-select + v-model="stationName" + clearable + @change="filterChange" + size="small" + placeholder="璇烽�夋嫨绔欑偣" > - </el-option> - </el-select> - </div> - <div class="table-cell text-right">鍝佺墝:</div> - <div class="table-cell"> - <el-select - v-model="country" - size="small" - placeholder="璇烽�夋嫨鍝佺墝" - > - <el-option - v-for="item in countryList" - :key="item.value" - :label="item.label" - :value="item.value" - > - </el-option> - </el-select> - </div> - <div class="table-cell text-right">鐢靛帇绛夌骇:</div> - <div class="table-cell"> - <el-select - v-model="country" - size="small" - placeholder="璇烽�夋嫨鐢靛帇绛夌骇" - > - <el-option - v-for="item in countryList" - :key="item.value" - :label="item.label" - :value="item.value" - > - </el-option> - </el-select> + <el-option + v-for="item in stationList" + :key="'l3_' + item.stationId" + :label="item.stationName" + :value="item.stationName" + > + </el-option> + </el-select> + </div> </div> </div> </div> @@ -389,16 +316,12 @@ <el-table-column type="index" fixed="left" label="搴忓彿" width="60"></el-table-column> <el-table-column v-for="header in headers" :key="header.prop" :prop="header.prop" :label="header.label" :min-width="header.width" align="center"> - <template #default="scope">{{ scope.row[header.prop] || '--' }}</template> + <template #default="scope">{{ scope.row[header.prop] }}</template> </el-table-column> <el-table-column label="鎿嶄綔" fixed="right" width="240" align="center"> <template #default="scope"> - <el-button type="primary" size="small" - @click="edit(scope.row)">缂栬緫</el-button> - <el-button type="danger" size="small" - @click="confirmRemove(scope.row)">鍒犻櫎</el-button> - <el-button type="primary" size="small" - @click="addBatt(scope.row)">娣诲姞鐢垫睜缁�</el-button> + <el-button type="warning" size="small" @click="goRt(scope.row)">瀹炴椂鐩戞祴</el-button> + <el-button type="primary" size="small" @click="goHis(scope.row)">鍘嗗彶鏁版嵁</el-button> </template> </el-table-column> </el-table> @@ -407,7 +330,6 @@ </div> <div class="page-content-page"> <div class="page-tool"> - <el-button type="primary" round size="small" @click="add" :icon="Plus">娣诲姞</el-button> <el-button type="primary" round size="small" @click="getList" :icon="Search">鏌ヨ</el-button> </div> <div class="el-page-container"> @@ -416,17 +338,14 @@ :background="background" layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> </div> - <div class="page-tool"></div> + <div class="page-tool"> + <el-button type="primary" round size="small" @click="exportExcel">瀵煎嚭</el-button> + </div> </div> </div> </yc-card> </div> <div class="page-footer"></div> - <!-- 寮圭獥 --> - <el-dialog :title="dialogTitle" v-model="addEditVisible" top="0" :close-on-click-modal="false" class="dialog-center" - width="860px" center> - <add-edit v-if="addEditVisible" @success="onOk" :info="datas.rowData" @cancel="onCanel"></add-edit> - </el-dialog> </div> </template> @@ -513,4 +432,7 @@ } } } +.max-width { + max-width: 200px; +} </style> \ No newline at end of file -- Gitblit v1.9.1