Ver código fonte

2023-02-15 update

1. 调整windAnalysis 风机绩效榜 search 和 table模块
2. 风机绩效榜剩下 echarts模块未完成
moccus 2 anos atrás
pai
commit
42834df07c

+ 5 - 1
src/components/SubmitBtn.vue

@@ -3,10 +3,14 @@ const props = defineProps({
 	desc: {
 		type: String,
 		default: ''
+	},
+	type: {
+		type: String,
+		default: 'primary'
 	}
 })
 </script>
 <template>
 	<!-- <div class="h-[24px] flex justify-center items-center text-white bg-[rgba(0,70,199,0.5)] px-[15px] cursor-pointer text-[14px] rounded-[13px]">{{props.desc}}</div> -->
-	<el-button type="primary">{{props.desc}}</el-button>
+	<el-button :type="type">{{props.desc}}</el-button>
 </template>

+ 66 - 26
src/pages/dataAnalysis/windAnalysis/components/search.vue

@@ -5,10 +5,11 @@ import SubmitBtn from '@com/SubmitBtn.vue'
 
 const queryForm = reactive({
 	station: '',
+	lineIds: [],
 	wtIds: [],
+	type: '',
 	st: Date.now() - 30 * 24 * 60 * 60 * 1000,
 	et: Date.now(),
-	interval: 3
 })
 /**场站 */
 const stationList = ref([])
@@ -24,17 +25,29 @@ const funStationChange = (stationId) => {
 	if (stationId) {
 		funGetWind(stationId)
 	} else {
+		queryForm.wtIds = []
 		windList.value = []
 	}
 }
-/**风机 */
+/**项目 */
 const checkAll = ref(true)
 const windList = ref([])
 const funGetWind = async (stationId) => {
-	const res = await request.get("/base/windturbine", {params: { stationId }})
+	const res = await request.get("/base/project", {params: { stationId }})
 	windList.value = res.data
 	queryForm.wtIds = res.data.map(o => o.id)
 	checkAll.value = true
+	if (windList.value.length) {
+		funGetLine(queryForm.wtIds)
+	}
+}
+const funWindChange = (windArr) => {
+	if (windArr?.length) {
+		funGetLine(windArr)
+	} else {
+		queryForm.lineIds = []
+		lineList.value = []
+	}
 }
 const funCheckAll = () => {
 	checkAll.value = !checkAll.value
@@ -44,6 +57,23 @@ const funCheckAll = () => {
 		queryForm.wtIds = []
 	}
 }
+/**期次 */
+const checkLineAll = ref(true)
+const lineList = ref([])
+const funGetLine = async (wtIds) => {
+	const res = await request.get("/base/line", {params: { projectId: wtIds.join() }})
+	lineList.value = res.data
+	queryForm.lineIds = res.data.map(o => o.id)
+	checkLineAll.value = true
+}
+const funCheckLineAll = () => {
+	checkLineAll.value = !checkLineAll.value
+	if(checkLineAll.value){
+		queryForm.lineIds = lineList.value.map(o => o.id)
+	}else{
+		queryForm.lineIds = []
+	}
+}
 /**导出 */
 const emits = defineEmits(['submit'])
 const funSubmit = async () => {
@@ -51,24 +81,31 @@ const funSubmit = async () => {
 	const endDate = new Date(queryForm.et).setHours(0,0,0,0)
 	const query = {
 		station: queryForm.station,
-		wtIds: queryForm.wtIds.join(),
+		line: queryForm.lineIds.join(),
+		project: queryForm.wtIds.join(),
+		type: '',
 		st: new Date(startDate).getTime(),
 		et: new Date(endDate).getTime(),
-		interval: queryForm.interval
-	}
-	switch (queryForm.interval) {
-		case 2:
-			query.interval = 60
-			break;
-		case 3:
-			query.interval = 600
-			break;
-		case 4:
-			query.interval = 900
-			break;
 	}
 	emits('submit', query)
 }
+const funType = (type) => {
+	const startDate = new Date(queryForm.st).setHours(0,0,0,0)
+	const endDate = new Date(queryForm.et).setHours(0,0,0,0)
+	queryForm.type = type
+	queryForm.station = ''
+	queryForm.lineIds = []
+	queryForm.wtIds = []
+	const query = {
+		station: queryForm.station,
+		line: queryForm.lineIds.join(),
+		project: queryForm.wtIds.join(),
+		type: queryForm.type,
+		st: new Date(startDate).getTime(),
+		et: new Date(endDate).getTime(),
+	}
+	emits('submit',query)
+}
 /**created */
 funGetStation()
 </script>
@@ -81,29 +118,32 @@ funGetStation()
 					<el-option v-for="item in stationList" :key="item.id" :label="item.name" :value="item.id"></el-option>
 				</el-select>
 			</el-form-item>
-			<el-form-item label="风机" class="!mb-0">
-				<el-select multiple class="w-[150px]" v-model="queryForm.wtIds" @clear="checkAll = false" collapse-tags>
+			<el-form-item label="期次" class="!mb-0">
+				<el-select multiple class="w-[150px]" clearable v-model="queryForm.wtIds" @change="funWindChange"  @clear="checkAll = false" collapse-tags>
 					<el-option label="全选" :class="{'selected': checkAll}" @click="funCheckAll"></el-option>
 					<el-option v-for="item in windList" :key="item.id" :label="item.name" :value="item.id"></el-option>
 				</el-select>
 			</el-form-item>
+			<el-form-item label="线路" class="!mb-0">
+				<el-select multiple class="w-[150px]" clearable v-model="queryForm.lineIds" @clear="checkLineAll = false" collapse-tags>
+					<el-option label="全选" :class="{'selected': checkLineAll}" @click="funCheckLineAll"></el-option>
+					<el-option v-for="item in lineList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+				</el-select>
+			</el-form-item>
 			<el-form-item label="开始时间" class="!mb-0">
 				<el-date-picker type="date" class="!w-[150px]" v-model="queryForm.st"></el-date-picker>
 			</el-form-item>
 			<el-form-item label="结束时间" class="!mb-0">
 				<el-date-picker type="date" class="!w-[150px]" v-model="queryForm.et"></el-date-picker>
 			</el-form-item>
-			<el-form-item label="等间隔" class="!mb-0">
-				<el-radio-group v-model="queryForm.interval">
-					<el-radio :label="1">一秒钟</el-radio>
-					<el-radio :label="2">一分钟</el-radio>
-					<el-radio :label="3">十分钟</el-radio>
-					<el-radio :label="4">十五分钟</el-radio>
-				</el-radio-group>
-			</el-form-item>
 			<el-form-item class="!mb-0">
 				<submit-btn v-prevdbclick:5000="funSubmit" desc="执行"></submit-btn>
 			</el-form-item>
+			<el-form-item class="!mb-0">
+				<submit-btn @click="funType('1')" :type="queryForm.type==='1'? 'primary': 'default'" desc="风场"></submit-btn>
+				<submit-btn @click="funType('2')" :type="queryForm.type==='2'? 'primary': 'default'" desc="期次"></submit-btn>
+				<submit-btn @click="funType('3')" :type="queryForm.type==='3'? 'primary': 'default'" desc="集电线路"></submit-btn>
+			</el-form-item>
 		</el-form>
 	</div>
 </template>

+ 19 - 9
src/pages/dataAnalysis/windAnalysis/index.vue

@@ -107,7 +107,7 @@ const funExport = async () => {
 	a.click()
 }
 /**submit */
-const progress = ref(0)
+/**const progress = ref(0)
 const funWebSocket = () => {
 	const webSocket = new WebSocket(`${socketURL}/ws/powerfitting/admin`)
 	webSocket.onerror = () => setTimeout(() => { funWebSocket() }, 2000)
@@ -124,16 +124,26 @@ const funWebSocket = () => {
 		}
 	}
 }
+*/
 const funSubmit = async (params) => {
-	const res = await request.get('/power/prepare/data', { params: params })
-	if (res.code === 200) {
-		ElMessage.success(res.msg)
-
-	}
+	tableLoading.value = true
+	tableData.value = []
+	const res = await request.get('/fjjxb/index', { params: params })
+	if (res.code !== 200) { tableLoading.value = false; return false}
+	ElMessage.success(res.msg)
+	tableColumn.value = res.data.title.map(o => {
+		return {
+			prop: o.key,
+			label: o.des,
+			width: o.des==='时间'? 100: 80,
+		}
+	})
+	tableData.value = res.data.data
+	tableLoading.value = false
 }
 /**created */
 // funGetTree()
-funWebSocket()
+// funWebSocket()
 /**mounted */
 onMounted(() => {
 	tableHeight.value = window.innerHeight - 260 + 'px'
@@ -166,8 +176,8 @@ onActivated(() => {
 				</el-col>
 				<el-col :span="16">
 					<div>
-						<table-cop class="" :data="tableData" :column="tableColumn" :loading="tableLoading"
-							:height="tableHeight" :tableId="tableShowId" :tableName="tableName" @export="funExport"></table-cop>
+						<table-cop class="" :data="tableData" :column="tableColumn" :loading="tableLoading" :height="tableHeight"
+							:tableId="tableShowId" :tableName="tableName" @export="funExport"></table-cop>
 					</div>
 				</el-col>
 			</el-row>

+ 3 - 3
src/pages/lightAnalysis/glAnalysis/index.vue

@@ -10,9 +10,9 @@ import request from '@/api/axios.js'
 import {baseURL, socketURL} from '@/api/axios.js'
 import dayjs from 'dayjs';
 /**配置参数 */
-const tableHeight = ref(window.innerHeight - 314 + 'px')
-const treeHeight = ref(window.innerHeight - 260 + 'px') //tree高度
-const excelHeight = ref(window.innerHeight - 260 + 'px') //excel高度
+const tableHeight = ref(window.innerHeight - 214 + 'px')
+const treeHeight = ref(window.innerHeight - 160 + 'px') //tree高度
+const excelHeight = ref(window.innerHeight - 160 + 'px') //excel高度
 /**excel 开始 */
 const excelList = ref([])
 const excelCheckIds = ref([])