wujingjing
2024-07-08 61ceb613399ee6ee7f99363c742cf68e8d79d1b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<template>
    <el-row :gutter="8" class="h100">
        <el-col :span="4" :xs="24" class="h100">
            <el-card shadow="hover" class="h100 left-tree-card" v-loading="treeLoading">
                <LeftTreeByMgr :treedata="listTreeData" title-name="泵站列表" :current-node-key="currentListID" @click="handleClickNode">
                </LeftTreeByMgr>
            </el-card>
        </el-col>
        <el-col :span="20" :xs="24" class="flex-column h100">
            <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
                <el-form :inline="true" :model="queryParams" label-width="120px" :rules="queryParamsRules">
                    <el-form-item label="进口水位" prop="WaterLevel">
                        <el-input v-model="queryParams.WaterLevel" style="width: 180px" clearable></el-input>
                    </el-form-item>
                    <el-form-item label="目标流量(m³/h)" prop="TargetFlow">
                        <el-input v-model="queryParams.TargetFlow" style="width: 180px" clearable />
                    </el-form-item>
                    <el-form-item label="目标压力(MPa)" prop="TargetPressure">
                        <el-input v-model="queryParams.TargetPressure" style="width: 180px" clearable />
                    </el-form-item>
                    <el-form-item>
                        <el-button icon="ele-Refresh" @click="resetQuery" type="primary">调度 </el-button>
                    </el-form-item>
                </el-form>
            </el-card>
            <el-card class="mt8" shadow="hover">
                <div style="width: 100%; height: 100px" class="aside_main">
                    <el-form :inline="true" :model="pumpPanel" label-width="120px">
                        <div class="flex">
                            <el-form-item label="总流量">
                                <el-input v-model="pumpPanel.TotalFlow" style="width: 180px" readonly></el-input>
                            </el-form-item>
                            <el-form-item label="总压力">
                                <el-input v-model="pumpPanel.TotalPressure" style="width: 180px" readonly />
                            </el-form-item>
                            <el-form-item label="总功率">
                                <el-input v-model="pumpPanel.TotalPower" style="width: 180px" readonly />
                            </el-form-item>
                            <el-form-item label="总效率">
                                <el-input v-model="pumpPanel.TotalEfficiency" style="width: 180px" readonly />
                            </el-form-item>
                        </div>
                        <div class="flex">
                            <el-form-item label="总千吨能耗">
                                <el-input v-model="pumpPanel.WP" style="width: 180px" readonly />
                            </el-form-item>
                            <el-form-item label="总单位能耗">
                                <el-input v-model="pumpPanel.UWP" style="width: 180px" readonly />
                            </el-form-item>
                            <el-form-item label="开泵台数">
                                <el-input v-model="pumpPanel.UWP" style="width: 180px" readonly />
                            </el-form-item>
                        </div>
                    </el-form>
                </div>
            </el-card>
            <el-card class="flex-auto scroll-table-card" shadow="hover" style="margin-top: 8px">
                <el-table
                    v-loading="tableLoading"
                    ref="draggableTableRef"
                    border
                    row-key="ID"
                    :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'"
                    :cell-style="{ textAlign: 'center' }"
                    :header-cell-style="{ textAlign: 'center' }"
                    :data="tableData"
                    highlight-current-row
                    style="width: 100%"
                >
                    <el-table-column prop="Name" label="机泵" fixed="left" show-overflow-tooltip width="200" />
                    <el-table-column prop="Flow" label="流量(m³/h)" show-overflow-tooltip width="200" />
                    <el-table-column prop="Head" width="200" label="扬程(m)" show-overflow-tooltip />
                    <el-table-column prop="Power" width="140" label="功率(kW/h)" show-overflow-tooltip />
                    <el-table-column prop="Efficiency" label="效率(%)" show-overflow-tooltip />
                    <el-table-column prop="Frequency" label="频率(hz)" show-overflow-tooltip width="140" />
                    <el-table-column prop="Speed" width="140" label="转速(rpm)" show-overflow-tooltip />
                    <el-table-column prop="Status" width="140" label="状态" show-overflow-tooltip>
                        <template #default="{ row }">
                            {{ row.Status == 0 ? '关' : row.Status == 1 ? '开' : '/' }}
                        </template>
                    </el-table-column>
                </el-table>
            </el-card>
        </el-col>
    </el-row>
</template>
 
<script setup lang="ts">
import { ElMessage } from 'element-plus';
import { computed, onMounted, reactive, ref } from 'vue';
import { CalculateScheduling, GetStationList } from '/@/api/dispatch/dispatch';
import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue';
//#region ====================== 左侧树数据,tree init ======================
const treeLoading = ref(false);
const listTreeData = ref([]);
const currentTreeNode = ref(null);
const currentListID = computed(() => currentTreeNode.value?.ID);
const handleClickNode = (data) => {
    currentTreeNode.value = data;
    getTableData();
};
const getListTreeData = async () => {
    treeLoading.value = true;
    const res = await GetStationList().finally(() => {
        treeLoading.value = false;
    });
    if (res?.Code === 0) {
        const resData = (res.Data || []) as [];
        listTreeData.value = resData;
        const firstListTreeNode = listTreeData.value[0];
        if (firstListTreeNode) {
            handleClickNode(firstListTreeNode);
        } else {
            tableData.value = [];
            currentTreeNode.value = null;
        }
    }
};
//#endregion
 
//#region ====================== 表格数据,table init ======================
const asideStatus = ref(false);
const tableLoading = ref(false);
const tableData = ref([]);
const isDragStatus = ref(false);
const getTableData = async () => {
    tableLoading.value = true;
    const res = await CalculateScheduling({
        StationID: parseInt(currentListID.value),
        ...queryParams.value,
    }).finally(() => {
        tableLoading.value = false;
    });
    if (res?.Code === 0) {
        const resData = (res.Data || []) as [];
        tableData.value = resData?.Pumps;
        let obj = resData?.Station;
        pumpPanel.value.TotalEfficiency = obj?.TotalEfficiency || '';
        pumpPanel.value.TotalFlow = obj?.TotalFlow || '';
        pumpPanel.value.TotalPower = obj?.TotalPower || '';
        pumpPanel.value.TotalPressure = obj?.TotalPressure || '';
        pumpPanel.value.WP = obj?.WP || '';
        pumpPanel.value.UWP = obj?.UWP || '';
    } else {
        ElMessage.error('获取失败' + (res?.Message ? `,${JSON.stringify(res.Message)}` : ''));
    }
};
//调度查询
const resetQuery = () => {
    getTableData();
};
const queryParamsRules = reactive({
    WaterLevel: [{ required: true, message: '必填项', trigger: 'blur' }],
    TargetFlow: [
        {
            required: true,
            message: '必填项',
            trigger: 'blur',
        },
    ],
    TargetPressure: [
        {
            required: true,
            message: '必填项',
            trigger: 'blur',
        },
    ],
});
//#endregion
 
//#region ====================== 表格查询、排序,search form init ======================
const queryParams = ref({
    WaterLevel: 19.2,
    TargetFlow: 23394,
    TargetPressure: 0.3355,
});
//泵站信息面板
const pumpPanel = ref({
    TotalFlow: '',
    TotalPressure: '',
    TotalPower: '',
    TotalEfficiency: '',
    WP: '',
    UWP: '',
});
//#endregion
 
onMounted(() => {
    getListTreeData();
});
</script>
<style scoped lang="scss">
/* 侧边栏样式 */
.aside_main {
    height: 75px !important;
    transition: width 0.3s;
    box-sizing: border-box;
    // box-shadow: inset 0px 0px 1px #3d3d3d;
}
</style>