Commit 4de4d14e8ed79c1479bbe84b29071604bd60bfe1

Authored by loveumiko
1 parent a0d716d5

fix: 实时数据折线图时间显示改为日期加时间

... ... @@ -146,7 +146,7 @@
146 146 series.value.forEach((item) => {
147 147 if (item.id === deviceId && item.attribute === attribute && value) {
148 148 item.data.push({
149   - name: formatToDateTime(list.time, 'HH:mm:ss'),
  149 + name: formatToDateTime(list.time, 'YYYY-MM-DD HH:mm:ss'),
150 150 value: value,
151 151 });
152 152 if (item.data.length > unref(maxDataPoints)) {
... ... @@ -155,7 +155,7 @@
155 155 }
156 156 });
157 157 });
158   - list.time && timeList.value.push(formatToDateTime(list.time, 'HH:mm:ss'));
  158 + list.time && timeList.value.push(formatToDateTime(list.time, 'YYYY-MM-DD HH:mm:ss'));
159 159 if (unref(timeList).length > unref(maxDataPoints)) {
160 160 timeList.value.shift();
161 161 }
... ...
... ... @@ -89,10 +89,10 @@
89 89 return isBoolean(flag) ? flag : true;
90 90 });
91 91
92   - const isAlarm = computed(() => {
  92 + const isAlarmHistory = computed(() => {
93 93 const frontId = props.sourceInfo.frontId;
94 94 if (
95   - frontId == 'DeviceAlarm' ||
  95 + // frontId == 'DeviceAlarm' ||
96 96 frontId == 'DeviceAlarmHistory' ||
97 97 frontId == 'StatisticsComponent7'
98 98 ) {
... ... @@ -101,6 +101,14 @@
101 101 return false;
102 102 }
103 103 });
  104 + const isAlarm = computed(() => {
  105 + const frontId = props.sourceInfo.frontId;
  106 + if (frontId == 'DeviceAlarm') {
  107 + return false;
  108 + } else {
  109 + return true;
  110 + }
  111 + });
104 112
105 113 async function handleCopy() {
106 114 const id = props.sourceInfo.id;
... ... @@ -150,8 +158,11 @@
150 158 </Tooltip>
151 159
152 160 <div v-if="!getIsSharePage" class="flex items-center w-16 justify-evenly">
153   - <Tooltip v-if="!isCustomerUser && hasTrendQueryIcon" :title="isAlarm ? '时间' : '趋势'">
154   - <FieldTimeOutlined v-if="isAlarm" class="text-lg" @click="handleAlarmModal" />
  161 + <Tooltip
  162 + v-if="!isCustomerUser && hasTrendQueryIcon && isAlarm"
  163 + :title="isAlarmHistory ? '时间' : '趋势'"
  164 + >
  165 + <FieldTimeOutlined v-if="isAlarmHistory" class="text-lg" @click="handleAlarmModal" />
155 166 <AreaChartOutlined v-else class="text-lg" @click="handleOpenTrendModal" />
156 167 </Tooltip>
157 168 <AuthDropDown
... ...