Compare commits
No commits in common. "ef2910286d6d83b4933efd73bbe913df638f4b6a" and "c835e38d8293861e650d4732b481d64dd96b4b00" have entirely different histories.
ef2910286d
...
c835e38d82
|
@ -42,11 +42,10 @@ export function exportExcel(deviceId, inputTime, shift) {
|
|||
}
|
||||
|
||||
// 报警相关接口
|
||||
// 时间点确认点检,传递多个 alarmId
|
||||
export function sharpConfirm(alarmIdList, confirmTime, checkUser) {
|
||||
const alarmIdParams = alarmIdList.map(id => `alarmIdList=${id}`).join('&');
|
||||
// 时间点确认点检,不传时间,默认当前时间
|
||||
export function sharpConfirm(alarmId, confirmTime, checkUser) {
|
||||
return request({
|
||||
url: `/Check/sharpConfirm?${alarmIdParams}&checkUser=${checkUser}`,
|
||||
url: `/Check/sharpConfirm?alarmId=${alarmId}&checkUser=${checkUser}`,
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
@ -59,11 +58,3 @@ export function alarmReasonConfirm(data) {
|
|||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询某一报警信息
|
||||
export function getAlarmReason(alarmId, checkParamId) {
|
||||
return request({
|
||||
url: `Check/GetAlarmReason?alarmId=${alarmId}&checkParamId=${checkParamId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
|
@ -6,17 +6,17 @@
|
|||
<div class="block">
|
||||
<div class="flex-row">
|
||||
<h2 class="juice-title">果汁调配</h2>
|
||||
<span class="flow-label">累计流量:{{ formatNumberWithCommas(totalTrafficJuice) }}</span>
|
||||
<span class="flow-label">累计流量:{{ totalTrafficJuice }}</span>
|
||||
</div>
|
||||
<div class="spacing"></div>
|
||||
<div v-for="item in progressList" :key="item.name" class="juice-item"
|
||||
:data-device-id="item?.deviceId"
|
||||
@click="handleBlockClick(item?.deviceId, item.aliasName, false)">
|
||||
@click="handleBlockClick(item?.deviceId, item.name, false)">
|
||||
<span class="juice-name">{{ item.name }}:</span>
|
||||
<div class="progress-bar" style="cursor: pointer;">
|
||||
<div class="progress"
|
||||
:style="{ width: item.rate + '%', background: filterStatusColor(item.deviceStatus) }">
|
||||
<span class="progress-text">{{ formatNumberWithCommas(item.value) }}</span>
|
||||
<span class="progress-text">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<img style="padding-left: 1rem;" v-if="item.rate < 10" src="@/assets/alarm.svg" />
|
||||
|
@ -25,17 +25,17 @@
|
|||
<div class="block">
|
||||
<div class="flex-row">
|
||||
<h2 class="juice-title">果肉调配</h2>
|
||||
<span class="flow-label">累计流量:{{ formatNumberWithCommas(totalTrafficPulp) }}</span>
|
||||
<span class="flow-label">累计流量:{{ totalTrafficPulp }}</span>
|
||||
</div>
|
||||
<div class="spacing"></div>
|
||||
<div v-for="item in innerProgressList" :key="item.name" class="juice-item"
|
||||
:data-device-id="item?.deviceId"
|
||||
@click="handleBlockClick(item?.deviceId, item.aliasName, false)">
|
||||
@click="handleBlockClick(item?.deviceId, item.name, false)">
|
||||
<span class="juice-name">{{ item.name }}:</span>
|
||||
<div class="progress-bar" style="cursor: pointer;">
|
||||
<div class="progress"
|
||||
:style="{ width: item.rate + '%', background: filterStatusColor(item.deviceStatus) }">
|
||||
<span class="progress-text">{{ formatNumberWithCommas(item.value) }}</span>
|
||||
<span class="progress-text">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<img style="padding-left: 1rem;" v-if="item.rate > 90" src="@/assets/alarm.svg" />
|
||||
|
@ -67,11 +67,11 @@
|
|||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 25%">
|
||||
<div class="info-row">
|
||||
<span class="info-label">累计流量:</span>
|
||||
<span class="info-value">{{ formatNumberWithCommas(processForm_uht.totalTraffic) }}</span>
|
||||
<span class="info-value">{{ processForm_uht.totalTraffic }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">产品流量:</span>
|
||||
<span class="info-value">{{ formatNumberWithCommas(processForm_uht.productFlowRate) }}</span>
|
||||
<span class="info-value">{{ processForm_uht.productFlowRate }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">平衡温度:</span>
|
||||
|
@ -147,11 +147,11 @@
|
|||
<div class="info-panel" style="display: flex; justify-content: space-between;width: 25%;">
|
||||
<div class="info-row">
|
||||
<span class="info-label">累计流量:</span>
|
||||
<span class="info-value">{{ formatNumberWithCommas(processForm_pulp.totalTraffic) }}</span>
|
||||
<span class="info-value">{{ processForm_pulp.totalTraffic }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">产品流量:</span>
|
||||
<span class="info-value">{{ formatNumberWithCommas(processForm_pulp.productFlowRate) }}</span>
|
||||
<span class="info-value">{{ processForm_pulp.productFlowRate }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">平衡温度:</span>
|
||||
|
@ -234,12 +234,12 @@
|
|||
<div class="progress-bar">
|
||||
<div class="progress"
|
||||
:style="{ width: juiceTank.rate + '%', background: juiceTank.rate > 70 ? '#00D2A0' : juiceTank.rate > 50 ? '#FF9000' : juiceTank.rate > 30 ? '#FFD732' : '#FF0000' }">
|
||||
<span class="progress-text">{{ formatNumberWithCommas(juiceTank.liquidLevel) }}</span>
|
||||
<span class="progress-text">{{ juiceTank.liquidLevel }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-item" style="padding: 1rem 0 0 0;">
|
||||
<span class="info-label" :style="{ color: '#00FFB9' }">▼果汁流量:{{ formatNumberWithCommas(juiceTank.productFlowRate)
|
||||
<span class="info-label" :style="{ color: '#00FFB9' }">▼果汁流量:{{ juiceTank.productFlowRate
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -285,18 +285,18 @@
|
|||
<div class="info-panel">
|
||||
<div class="info-row">
|
||||
<span class="info-label">当前液位:</span>
|
||||
<span class="info-value">{{ formatNumberWithCommas(dynamicMixer.liquidLevel) }}</span>
|
||||
<span class="info-value">{{ dynamicMixer.liquidLevel }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">当前流量:</span>
|
||||
<span class="info-value">{{ formatNumberWithCommas(dynamicMixer.productFlowRate) }}</span>
|
||||
<span class="info-value">{{ dynamicMixer.productFlowRate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<div class="info-item" style="padding: 0.5rem 0 0 0;">
|
||||
<span class="info-label" :style="{ color: '#00FFB9' }">▲果肉流量:{{ formatNumberWithCommas(pulpTank.productFlowRate)
|
||||
<span class="info-label" :style="{ color: '#00FFB9' }">▲果肉流量:{{ pulpTank.productFlowRate
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="flex-row">
|
||||
|
@ -334,7 +334,7 @@
|
|||
<div class="progress-bar">
|
||||
<div class="progress"
|
||||
:style="{ width: pulpTank.rate + '%', background: pulpTank.rate > 70 ? '#00D2A0' : pulpTank.rate > 50 ? '#FF9000' : pulpTank.rate > 30 ? '#FFD732' : '#FF0000' }">
|
||||
<span class="progress-text">{{ formatNumberWithCommas(pulpTank.liquidLevel) }}</span>
|
||||
<span class="progress-text">{{ pulpTank.liquidLevel }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -369,7 +369,7 @@
|
|||
<IxButton Outline class="btnStyle"> 生产步骤:{{ mixerStep }} </IxButton> <!-- 增加 step 字段显示 -->
|
||||
<IxButton Outline class="btnStyle"> 开始时间:{{ startTimeFormatted }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 结束时间:{{ endTimeFormatted }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 流量:{{ formatNumberWithCommas(productFlowRate) }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 流量:{{ productFlowRate }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 配方:{{ formula }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 持续时长:{{ duration }} </IxButton>
|
||||
<IxButton Outline id="triggerId" :disabled="currentStatus !== '停机'"> {{ selectedReason ? '停机原因:' +
|
||||
|
@ -392,7 +392,7 @@
|
|||
<IxButton Outline class="btnStyle"> 结束时间:{{ endTimeFormatted }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 持续时长:{{ duration }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 调配状态:{{ blendStatus }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 罐重:{{ formatNumberWithCommas(capacity) }} </IxButton>
|
||||
<IxButton Outline class="btnStyle"> 罐重:{{ capacity }} </IxButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -540,6 +540,7 @@ const processDataFromAPI = (apiData) => {
|
|||
data: {
|
||||
id: item.data.id || 0,
|
||||
weight: item.data.weight || 0,
|
||||
capacity: item.data.capacity,
|
||||
deviceStatus: item.data.deviceStatus || '',
|
||||
cleanStatus: item.data.cleanStatus || '',
|
||||
productFlowRate: item.data.productFlowRate || 0,
|
||||
|
@ -547,9 +548,7 @@ const processDataFromAPI = (apiData) => {
|
|||
formula: item.data.formula || '',
|
||||
mixerStep: item.data.mixerStep || '',
|
||||
temperature: item.data.temperature || 0,
|
||||
liquidLevel: item.data.liquidLevel || 0,
|
||||
capacity: item.data.capacity,
|
||||
aliasName: item.data.aliasName || '',
|
||||
liquidLevel: item.data.liquidLevel || 0
|
||||
},
|
||||
statusList: item.statusList || []
|
||||
};
|
||||
|
@ -615,7 +614,7 @@ const updateData = (processedData) => {
|
|||
// 设置默认值
|
||||
if (juiceData.value.deviceId) {
|
||||
globalDeviceId.value = juiceData.value.deviceId;
|
||||
currentTitle.value = juiceData.value.data[0].aliasName;
|
||||
currentTitle.value = juiceData.value.data[0].name;
|
||||
}
|
||||
// 累计流量
|
||||
totalTrafficJuice.value = juiceData.value.totalTraffic.toFixed(2);
|
||||
|
@ -624,7 +623,6 @@ const updateData = (processedData) => {
|
|||
if (juiceData.value.data.length > 0) {
|
||||
progressList.value = juiceData.value.data.map(item => ({
|
||||
name: item.name,
|
||||
aliasName: item.aliasName,
|
||||
deviceId: item.deviceId,
|
||||
deviceStatus: item.deviceStatus,
|
||||
value: item.weight,
|
||||
|
@ -634,7 +632,6 @@ const updateData = (processedData) => {
|
|||
if (pulpData.value.data.length > 0) {
|
||||
innerProgressList.value = pulpData.value.data.map(item => ({
|
||||
name: item.name,
|
||||
aliasName: item.aliasName,
|
||||
deviceId: item.deviceId,
|
||||
deviceStatus: item.deviceStatus,
|
||||
value: item.weight,
|
||||
|
@ -915,10 +912,10 @@ let autoUpdateInterval = null;
|
|||
|
||||
// 生命周期钩子
|
||||
onMounted(async () => {
|
||||
await fetchStatusColors(); // 调用获取颜色状态数据的函数
|
||||
await fetchData();
|
||||
fetchGanttData();
|
||||
fetchStopReason();
|
||||
await fetchStatusColors(); // 调用获取颜色状态数据的函数
|
||||
sendDataToParent();
|
||||
|
||||
const setupAutoUpdate = () => {
|
||||
|
@ -970,7 +967,7 @@ onUnmounted(() => {
|
|||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: #000028;
|
||||
height: calc(100vh - 4rem);
|
||||
height: 100vh;
|
||||
width: calc(100% + 1.5rem);
|
||||
overflow: hidden;
|
||||
color: white;
|
||||
|
@ -983,7 +980,7 @@ onUnmounted(() => {
|
|||
.upper-section {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 65%;
|
||||
height: 60%;
|
||||
/* 调整高度 */
|
||||
}
|
||||
|
||||
|
|
|
@ -29,17 +29,13 @@
|
|||
<script setup>
|
||||
import { ref, defineProps, defineEmits, onMounted } from 'vue';
|
||||
import { IxButton, IxChip } from '@siemens/ix-vue';
|
||||
import { getAlarmReason } from '@/api/inspection';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
const props = defineProps({
|
||||
itemName: String,
|
||||
itemTime: String,
|
||||
timezone: String,
|
||||
currentAlarmInfo: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
currentStatus: String,
|
||||
});
|
||||
|
||||
const reason = ref('');
|
||||
|
@ -60,11 +56,9 @@ const handleSubmit = () => {
|
|||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (props.currentAlarmInfo.currentStatus === '已处理') {
|
||||
if(props.currentStatus === '已处理') {
|
||||
// 数据库读取当前的处理信息
|
||||
getAlarmReason(props.currentAlarmInfo.currentAlarmId, props.currentAlarmInfo.currentCheckParamId).then((res) => {
|
||||
reason.value = res.data.check_text;
|
||||
});
|
||||
reason.value = '已处理';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -88,17 +82,14 @@ onMounted(() => {
|
|||
background-color:#23233C;
|
||||
padding: 2rem;
|
||||
border-radius: 0.5rem;
|
||||
width: 25rem;
|
||||
/* 设置表单宽度 */
|
||||
width: 25rem; /* 设置表单宽度 */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 0.0625rem solid white;
|
||||
/* 增加白色边框 */
|
||||
border: 0.0625rem solid white; /* 增加白色边框 */
|
||||
}
|
||||
|
||||
.form-header h5 {
|
||||
color: #9898A8;
|
||||
/* 修改颜色 */
|
||||
color: #9898A8; /* 修改颜色 */
|
||||
}
|
||||
|
||||
.form-body {
|
||||
|
@ -127,43 +118,32 @@ onMounted(() => {
|
|||
.form-header h5,
|
||||
.form-body p,
|
||||
.form-body label {
|
||||
color: #9898A8;
|
||||
/* 修改颜色 */
|
||||
text-align: left;
|
||||
/* 文字靠左对齐 */
|
||||
font-size: 0.7rem;
|
||||
/* 字体大小为9px */
|
||||
color: #9898A8; /* 修改颜色 */
|
||||
text-align: left; /* 文字靠左对齐 */
|
||||
font-size: 0.7rem; /* 字体大小为9px */
|
||||
}
|
||||
|
||||
.form-header p {
|
||||
text-align: left;
|
||||
/* 文字靠左对齐 */
|
||||
font-size: 0.875rem;
|
||||
/* 字体大小为12px */
|
||||
text-align: left; /* 文字靠左对齐 */
|
||||
font-size: 0.875rem; /* 字体大小为12px */
|
||||
|
||||
}
|
||||
|
||||
.item-chip-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.03125rem;
|
||||
/* 0.5px */
|
||||
height: 100%;
|
||||
/* 确保容器高度 */
|
||||
gap: 0.03125rem; /* 0.5px */
|
||||
height: 100%; /* 确保容器高度 */
|
||||
}
|
||||
|
||||
.item-chip-container p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* 上下居中 */
|
||||
margin: 0;
|
||||
/* 移除默认外边距 */
|
||||
line-height: 1;
|
||||
/* 确保行高 */
|
||||
align-items: center; /* 上下居中 */
|
||||
margin: 0; /* 移除默认外边距 */
|
||||
line-height: 1; /* 确保行高 */
|
||||
}
|
||||
|
||||
.chip {
|
||||
font-size: 0.7rem;
|
||||
/* 字体大小为9px */
|
||||
font-size: 0.7rem; /* 字体大小为9px */
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div class="header_right">
|
||||
<!-- 设备列表按钮 -->
|
||||
<span v-for="(item, index) in deviceList" :key="item.id">
|
||||
<IxButton :outline="selectedDeviceTypeId !== item.id" class="btn-style" @click="handleDeviceListChange(item.id)">
|
||||
<IxButton :outline="selectedDeviceId !== item.id" class="btn-style" @click="handleDeviceListChange(item.id)">
|
||||
{{ item.name }}
|
||||
</IxButton>
|
||||
</span>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<span class="header-row">参考值</span>
|
||||
<span class="header-row">当前值</span>
|
||||
<span class="header-row" v-for="hour in hours" :key="hour"
|
||||
:style="{ backgroundColor: getDeviceNameById(selectedDeviceTypeId) === '灌注机' ? '#00FFB9' : '#00E4FF', color: '#000028' }">
|
||||
:style="{ backgroundColor: getDeviceNameById(selectedDeviceId) === '灌注机' ? '#00FFB9' : '#00E4FF', color: '#000028' }">
|
||||
{{ hour }}
|
||||
</span>
|
||||
</div>
|
||||
|
@ -73,7 +73,7 @@
|
|||
'alarm-cell': item.data[hour]?.checkStatus === 0
|
||||
}"
|
||||
@click="item.data[hour]?.checkStatus === 0 || item.data[hour]?.checkStatus === 1 ? handleAlarmInspection(hour, index, item.data[hour]?.checkStatus) : null">
|
||||
{{ formatNumberWithCommas(item.data[hour]?.value) || '--' }}
|
||||
{{ item.data[hour]?.value || '--' }}
|
||||
</span>
|
||||
</div>
|
||||
</IxEventListItem>
|
||||
|
@ -81,7 +81,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- 点检表单 -->
|
||||
<InspectionForm v-if="showForm" :itemName="selectedItemName" :itemTime="selectedItemTime" :timezone="timezone" :currentAlarmInfo="currentAlarmInfo" @close="showForm = false" @submit="(currentTime, reason) => handleFormSubmit(selectedItemIndex, reason)" />
|
||||
<InspectionForm v-if="showForm" :itemName="selectedItemName" :itemTime="selectedItemTime" :timezone="timezone" :currentStatus="currentStatus" @close="showForm = false" @submit="(currentTime, reason) => handleFormSubmit(selectedItemIndex, reason)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -119,15 +119,13 @@ const status = ref('0'); // 确保 status 变量已定义
|
|||
|
||||
// 设备列表
|
||||
const deviceList = ref([]);
|
||||
const selectedDeviceTypeId = ref(null);
|
||||
const selectedDeviceId = ref(null);
|
||||
|
||||
const showForm = ref(false);
|
||||
const selectedItemName = ref('');
|
||||
const selectedItemTime = ref('');
|
||||
const selectedItemIndex = ref(null);
|
||||
|
||||
const currentDeviceId = ref(null);
|
||||
|
||||
const selectedDate = ref(null);
|
||||
|
||||
const formatDate = (date) => {
|
||||
|
@ -137,17 +135,7 @@ const formatDate = (date) => {
|
|||
const day = d.getDate().toString().padStart(2, '0');
|
||||
return `${year}/${month}/${day}`;
|
||||
};
|
||||
|
||||
const formatNumberWithCommas = (number) => {
|
||||
if (number === null || number === undefined) return '--';
|
||||
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
};
|
||||
|
||||
const currentAlarmInfo = ref({
|
||||
currentStatus: '',
|
||||
currentAlarmId: '',
|
||||
currentCheckParamId: '',
|
||||
});
|
||||
const currentStatus = ref('');
|
||||
|
||||
const currentDate = formatDate(new Date());
|
||||
|
||||
|
@ -180,7 +168,7 @@ const confirmedTimes = ref({});
|
|||
// 点检状态
|
||||
const hourCheckStatus = ref({});
|
||||
const hourCheckTime = ref({});
|
||||
const alarmId = ref({}); // 改为双层结构:{ [deviceId: string]: { [recordTime: string]: number } }
|
||||
const alarmId = ref({});
|
||||
const hourCheckValid = ref({});
|
||||
|
||||
const formatTime = (time) => {
|
||||
|
@ -190,35 +178,28 @@ const formatTime = (time) => {
|
|||
return `${hours}:${minutes}`;
|
||||
};
|
||||
|
||||
// 点检按钮点击事件
|
||||
// 点检按钮点击事件 handleAlarmConfirm
|
||||
const handleInspection = (hour, index) => {
|
||||
selectedItemName.value = inspectionItems.value[index].label;
|
||||
selectedItemTime.value = hour;
|
||||
selectedItemIndex.value = index; // 保存当前索引
|
||||
// 获取当前时间点所有设备报警ID
|
||||
const currentAlarmIds = [];
|
||||
|
||||
// 校验是否已经确认异常数据
|
||||
if (hourCheckValid.value[hour] !== 1) {
|
||||
console.log("🚀 ~ handleInspection ~ hourCheckValid.value[hour]:", hourCheckValid.value[hour])
|
||||
showWarningMessage('存在设备异常,无法执行点检操作!');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("🚀 ~ handleInspection ~ inspectionItems.value:", inspectionItems.value)
|
||||
// 校验这个时刻这一列有咩有报警未处理的数据,也就是checkStatus为0的数据
|
||||
if (inspectionItems.value.some(item => item.data[hour]?.checkStatus === 0)) {
|
||||
showWarningMessage('存在报警数据未处理,无法执行点检操作!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 遍历所有设备收集报警ID和状态
|
||||
Object.keys(alarmId.value).forEach(deviceId => {
|
||||
if (alarmId.value[deviceId]?.[hour]) {
|
||||
currentAlarmIds.push(alarmId.value[deviceId][hour]);
|
||||
}
|
||||
});
|
||||
console.log("🚀 ~ handleInspection ~ currentAlarmIds:", currentAlarmIds)
|
||||
|
||||
showConfirmMessage('确认要执行点检操作吗?', async () => {
|
||||
await sharpConfirm(currentAlarmIds, 'admin').then(() => {
|
||||
await sharpConfirm(alarmId.value[hour], 'admin').then(() => {
|
||||
confirmedHours.value.push(selectedItemTime.value);
|
||||
confirmedTimes.value[selectedItemTime.value] = moment().tz(timezone).format('HH:mm');
|
||||
hourCheckStatus.value[hour] = 1; // 更新点检状态
|
||||
|
@ -234,24 +215,15 @@ const handleAlarmInspection = (hour, index, status) => {
|
|||
selectedItemName.value = inspectionItems.value[index].label;
|
||||
selectedItemTime.value = hour;
|
||||
selectedItemIndex.value = index; // 确保在这里设置 selectedItemIndex
|
||||
|
||||
// 从数据项中获取实际设备ID
|
||||
currentDeviceId.value = inspectionItems.value[index].data[hour]?.deviceId;
|
||||
|
||||
currentAlarmInfo.value = {
|
||||
currentStatus : status === 0 ? '未处理' : '已处理',
|
||||
currentAlarmId: alarmId.value[currentDeviceId.value]?.[selectedItemTime.value],
|
||||
currentCheckParamId: inspectionItems.value[index].data[hour]?.checkParamId
|
||||
}
|
||||
|
||||
currentStatus.value = status === 0 ? '未处理' : '已处理';
|
||||
showForm.value = true;
|
||||
};
|
||||
|
||||
// 点检表单提交事件
|
||||
const handleFormSubmit = async (index, reason) => {
|
||||
await alarmReasonConfirm({
|
||||
alarmId: currentAlarmInfo.value.currentAlarmId, // alarmId.value[selectedItemTime.value],
|
||||
checkParamId: currentAlarmInfo.value.currentCheckParamId,//inspectionItems.value[index].data[selectedItemTime.value]checkParamId,
|
||||
alarmId: alarmId.value[selectedItemTime.value],
|
||||
checkParamId: inspectionItems.value[index].data[selectedItemTime.value].checkParamId,
|
||||
alarmReason: reason,
|
||||
checkUser: 'admin'
|
||||
}).then(() => {
|
||||
|
@ -300,7 +272,7 @@ const handleShiftChange = (event) => {
|
|||
|
||||
// 切换设备
|
||||
const handleDeviceListChange = (id) => {
|
||||
selectedDeviceTypeId.value = id;
|
||||
selectedDeviceId.value = id;
|
||||
fetchInspectionData();
|
||||
fetchCurrentValues();
|
||||
};
|
||||
|
@ -311,7 +283,7 @@ const fetchDeviceList = async () => {
|
|||
const response = await getDeviceList();
|
||||
if (response.code === 200) {
|
||||
deviceList.value = response.data;
|
||||
selectedDeviceTypeId.value = deviceList.value[0].id; // 默认选中第一个设备
|
||||
selectedDeviceId.value = deviceList.value[0].id; // 默认选中第一个设备
|
||||
} else {
|
||||
showWarningMessage('获取设备列表失败!');
|
||||
}
|
||||
|
@ -323,27 +295,15 @@ const fetchDeviceList = async () => {
|
|||
// 获取当前值、参考值、单位等信息
|
||||
const fetchCurrentValues = async () => {
|
||||
try {
|
||||
const deviceId = selectedDeviceTypeId.value; // 根据实际情况设置设备ID
|
||||
const deviceId = selectedDeviceId.value; // 根据实际情况设置设备ID
|
||||
const dateValue = selectedDate.value || currentDate;
|
||||
const response = await getInspectionCurrent(deviceId, dateValue);
|
||||
const params = await getCheckParas(deviceId, dateValue);
|
||||
|
||||
if (response.data) {
|
||||
const currentValueList = response.data;
|
||||
console.log("🚀 ~ fetchCurrentValues ~ currentValueList:", currentValueList)
|
||||
const currentValues = {};
|
||||
currentValueList.forEach(item => {
|
||||
// 解析设备实时数据并过滤掉值为 null 的项
|
||||
for (const [key, value] of Object.entries(item.data)) {
|
||||
if (value !== null) {
|
||||
currentValues[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log("🚀 ~ fetchCurrentValues ~ currentValues:", currentValues)
|
||||
|
||||
const currentValues = response.data.data;
|
||||
inspectionItems.value.forEach(item => {
|
||||
item.current = formatNumberWithCommas(currentValues?.[item.name]) || '--'; // 添加对 currentValues 的检查
|
||||
item.current = currentValues?.[item.name] || '--'; // 添加对 currentValues 的检查
|
||||
});
|
||||
} else {
|
||||
showWarningMessage('获取当前设备当前值失败!');
|
||||
|
@ -375,25 +335,19 @@ const fetchCurrentValues = async () => {
|
|||
// 获取点检数据
|
||||
const fetchInspectionData = async () => {
|
||||
try {
|
||||
const deviceTypeId = selectedDeviceTypeId.value; // 根据实际情况设置设备ID
|
||||
const deviceId = selectedDeviceId.value; // 根据实际情况设置设备ID
|
||||
const shiftValue = shift.value;
|
||||
const dateValue = selectedDate.value || currentDate;
|
||||
const response = await getInspectionData(deviceTypeId, dateValue, shiftValue);
|
||||
const response = await getInspectionData(deviceId, dateValue, shiftValue);
|
||||
if (response.data) {
|
||||
const inspectionData = response.data;
|
||||
const itemsMap = {};
|
||||
inspectionData.forEach(record => {
|
||||
const recordTime = record.recordTime;
|
||||
const data = record.data;
|
||||
const deviceId = record.deviceId;
|
||||
hourCheckStatus.value[recordTime] = record.hourCheckStatus;
|
||||
hourCheckTime.value[recordTime] = formatTime(record.hourCheckTime);
|
||||
|
||||
if (!alarmId.value[deviceId]) {
|
||||
alarmId.value[deviceId] = {} // 初始化设备ID对应的存储空间
|
||||
}
|
||||
alarmId.value[deviceId][recordTime] = record.alarmId;
|
||||
|
||||
alarmId.value[recordTime] = record.alarmId;
|
||||
hourCheckValid.value[recordTime] = record.hourCheckValid;
|
||||
|
||||
for (const [name, valueObj] of Object.entries(data)) {
|
||||
|
@ -413,8 +367,7 @@ const fetchInspectionData = async () => {
|
|||
checkStatus: valueObj.checkStatus,
|
||||
checkText: valueObj.checkText,
|
||||
checkParamId: valueObj.checkParamId,
|
||||
checkUser: valueObj.checkUser,
|
||||
deviceId: record.deviceId,
|
||||
checkUser: valueObj.checkUser
|
||||
// hourCheckStatus: valueObj.hourCheckStatus,
|
||||
// hourCheckTime: valueObj.hourCheckTime
|
||||
};
|
||||
|
@ -430,17 +383,14 @@ const fetchInspectionData = async () => {
|
|||
};
|
||||
|
||||
// 查询接口数据
|
||||
const handleSearch = async () => {
|
||||
try {
|
||||
await Promise.all([fetchInspectionData(), fetchCurrentValues()]);
|
||||
// showInfoMessage('数据刷新成功');
|
||||
} catch (error) {
|
||||
showWarningMessage('数据刷新失败');
|
||||
console.error('Error refreshing data:', error);
|
||||
}
|
||||
const handleSearch = () => {
|
||||
fetchInspectionData();
|
||||
fetchCurrentValues();
|
||||
};
|
||||
|
||||
const handleExport = () => {
|
||||
console.log("🚀 ~ handleExport ~ inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0)):", inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0)))
|
||||
|
||||
// 增加一个判断,判断当前的数据中inspectionItems.value中是否有报警数据,如果有则提示不允许导出
|
||||
if (inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0))) {
|
||||
showWarningMessage('请先处理报警数据,再进行导出!');
|
||||
|
@ -448,7 +398,7 @@ const handleExport = () => {
|
|||
}
|
||||
|
||||
showInfoMessage('导出全部');
|
||||
exportExcel(selectedDeviceTypeId.value, selectedDate.value || currentDate, shift.value)
|
||||
exportExcel(selectedDeviceId.value, selectedDate.value || currentDate, shift.value)
|
||||
.then((response) => {
|
||||
if (response) {
|
||||
// 有数据的处理
|
||||
|
@ -481,7 +431,8 @@ const getDeviceNameById = (id) => {
|
|||
|
||||
onMounted(async () => {
|
||||
await fetchDeviceList();
|
||||
await handleSearch();
|
||||
fetchCurrentValues();
|
||||
fetchInspectionData();
|
||||
sendDataToParent();
|
||||
|
||||
// const setupAutoUpdate = () => {
|
||||
|
@ -566,7 +517,7 @@ onMounted(async () => {
|
|||
width: 100%;
|
||||
height: 90%;
|
||||
/* 修改为90%,使其高度铺满剩余部分 */
|
||||
overflow-x: visible;
|
||||
overflow-x: auto;
|
||||
/* 添加水平滚动条 */
|
||||
}
|
||||
|
||||
|
@ -574,7 +525,7 @@ onMounted(async () => {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 100%;
|
||||
overflow-x: visible;
|
||||
overflow-x: auto;
|
||||
/* 添加水平滚动条 */
|
||||
position: relative; /* 添加此行以确保表头和数据在同一容器内滚动 */
|
||||
}
|
||||
|
@ -593,15 +544,11 @@ onMounted(async () => {
|
|||
justify-content: space-around;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
padding: 0 0 0 0.5rem;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background-color: #000028; /* 添加此行以确保表头背景色一致 */
|
||||
}
|
||||
|
||||
.table-row-1.fixed-row {
|
||||
top: 40px;
|
||||
z-index: 2;
|
||||
background-color: inherit; /* 添加此行以确保表头背景色一致 */
|
||||
}
|
||||
|
||||
.fixed-width {
|
||||
|
@ -679,9 +626,8 @@ onMounted(async () => {
|
|||
.fixed-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background-color: #000028;
|
||||
z-index: 2;
|
||||
margin-left: 1rem;
|
||||
background-color: inherit;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.highlight-cell {
|
||||
|
|
|
@ -410,7 +410,7 @@ ix-application {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #000028;
|
||||
height: calc(100vh - 4rem);
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue