瀏覽代碼

新增时间显示

wukai 1 月之前
父節點
當前提交
d7ec65b527
共有 5 個文件被更改,包括 55 次插入13 次删除
  1. 3 1
      src/main.js
  2. 8 7
      src/pages/components/Fac.vue
  3. 1 2
      src/pages/components/In02.vue
  4. 7 3
      src/pages/components/In03.vue
  5. 36 0
      src/utils/timeDisplay.js

+ 3 - 1
src/main.js

@@ -19,6 +19,7 @@ import { BpmnElement, Control, MiniMap,Menu,Snapshot,RectResize  } from '@logicf
 import { VueDraggableNext } from 'vue-draggable-next'
 // 左边工具栏以及编辑节点的样式
 // import 'bpmn-js-properties-panel/dist/assets/bpmn-js-properties-panel.css'
+import { initTimeDisplay } from '@/utils/timeDisplay';
 const app = createApp(App)
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
     app.component(key, component)
@@ -44,4 +45,5 @@ app.config.globalProperties.ReplaceNull=function(v,defaultValue){
     return v;
 }
 app.mount('#app')
-
+// 启动时间显示功能
+initTimeDisplay('timeDisplay');

+ 8 - 7
src/pages/components/Fac.vue

@@ -9,6 +9,7 @@
                 style="cursor: pointer;height: 38px;width: 38px;text-align: center;float: right;margin: 0 10px;"
                 @click.stop="backMasterViewByFac"><img src="../../assets/image/view.png">
             </div>
+            <div id="timeDisplay" title="当前时间" style="position: fixed; cursor: pointer; height: 38px; width: 300px; text-align: center; margin-top: 75px; line-height: 38px; top: 0; left: 50%; transform: translateX(-50%); z-index: 9999; color: #cccccc; font-weight: bold; font-size: 14px;"></div>
     </div>
     <div class="bg1"></div>
     <div class="abs tools" v-if="showIndexData=='dataindex'">
@@ -197,7 +198,7 @@ export default {
             {"code":"tools02","name":"成本","active":false},
             {"code":"tools03","name":"销售","active":false},
         ]);
-
+        
         let buttonCode1 = ref('');
         let buttonCode2 = ref('');
         let deviceStatData=ref({"avgMonth":{},"currYield":{"jb":{},"rz":{}}});
@@ -254,12 +255,11 @@ export default {
             showIndexData.value = newVal;
         },{deep:true,immediate:true})
 
-        function loadTools(v){
-            for(let i=0;i<toolsBtnList.value.length;i++){
-                if(toolsBtnList.value[i].code==item.code){
-                    toolsBtnList.value[i].active=true;
-                }else toolsBtnList.value[i].active=false;
-            }
+        
+        function loadTools(item) {
+            toolsBtnList.value.forEach(btn => {
+                btn.active = (btn.code === item.code);
+            });
         }
 
         let DataFull={
@@ -1316,6 +1316,7 @@ export default {
         }
     }
 }
+        
 </script>
 <style scope="FAC">
 .bg1{

+ 1 - 2
src/pages/components/In02.vue

@@ -30,6 +30,7 @@
            style="cursor: pointer;height: 38px;width: 38px;float: right;margin: 0 10px;" @click.stop="OpenBPBWin">
         <img src="../../assets/image/icon-ai1.png">
       </div>
+      <div title="当前时间" id="timeDisplay" style="position: fixed; cursor: pointer; height: 38px; width: 300px; text-align: center; margin-top: 75px; line-height: 38px; top: 0; left: 50%; transform: translateX(-50%); z-index: 9999; color: #cccccc; font-weight: bold; font-size: 14px;"></div>
     </div>
     <div v-if="isShowFuncMenuList" id="func_menulist">
       <div id="maogao_btn" title="" style="cursor: pointer;" @click="OpenMaoGaoWin">毛高比重</div>
@@ -2104,7 +2105,6 @@ export default {
       HideWindow,
       clickalarmtr,
       openStopView,
-      OpenBPBWin,
       indexjsondata,
       alarmjsondata,
       scxljsondata,
@@ -2133,7 +2133,6 @@ export default {
       isShowIframeWin,
       OpenMaoGaoWin,
       OpenMaoGaoDetailWin,
-      OpenBPBWin,
       OpenIframe,
       maogaoData,
       maogaoDetailData,

+ 7 - 3
src/pages/components/In03.vue

@@ -1,7 +1,7 @@
 <template>
     <div  @click="HideWindow">
         <!--这是印花模块的模块展示内容-->
-        <div for="IN03"  id="top" class="top top03" style="padding: 32px 0 0px 0;" @click="switchIndex">
+              <div for="IN03"  id="top" class="top top03" style="padding: 32px 0 0px 0;" @click="switchIndex">
                 <div title="进入数据消费平台"
                     style="cursor: pointer;height: 38px;width: 38px;text-align: center;float: right;margin: 0px 49px 0px 10px;"
                     @click.stop="toAdmin"><img src="../../assets/image/toAdmin.png">
@@ -14,6 +14,7 @@
                     style="cursor: pointer;height: 38px;width: 38px;float: right;margin: 0 10px;" @click.stop="OpenAI">
                     <img src="../../assets/image/icon-ai1.png">
                 </div>
+              <div title="当前时间" id="timeDisplay" style="position: fixed; cursor: pointer; height: 38px; width: 300px; text-align: center; margin-top: 75px; line-height: 38px; top: 0; left: 50%; transform: translateX(-50%); z-index: 9999; color: #cccccc; font-weight: bold; font-size: 14px;"></div>
         </div>
         <div class="bg20"></div>
         <div v-if="isShowAI" class="abs aiPanel" @click.stop="void(0)">
@@ -37,9 +38,9 @@
         </div>
         <template v-if="showIndexData=='index'">
             <div class="abs" style="left:50%;top:10%;width: 210px;margin-left:-105px;text-align: center;">
-                <div>请选择要查看的产线</div>
+<!--                <div>请选择要查看的产线</div>-->
                 <div class="cx">
-                    <span @click="switchCX(item.index)" :class="item.active?'btn active':'btn'" v-for="item in cxList" :style="{backgroundImage: item.active?`url(${btnFrontBg})`:''}">{{ item.name }}</span>
+                    <span @click="switchCX(item.index)" :class="item. active?'btn active':'btn'" v-for="item in cxList" :style="{backgroundImage: item.active?`url(${btnFrontBg})`:''}">{{ item.name }}</span>
                     <div  @click="switchCX(0)" :class="currentCXNo==0?'btn active':'btn'" :style="{width:'94%', backgroundImage: currentCXNo==0 ?`url(${btnFrontBg})`:''}">全部</div>
                 </div>
             </div>
@@ -230,6 +231,7 @@ import * as echarts from 'echarts';
 import { ElDatePicker,ElMessage } from 'element-plus';
 import 'element-plus/dist/index.css'; // 确保导入样式文件
 import NumberAnimation from './NumberAnimation.vue';
+import { initTimeDisplay } from '@/utils/timeDisplay';
 export default {
     components: {
         NumberAnimation
@@ -392,6 +394,8 @@ export default {
 
         async function init(){
             backMasterViewByFac();
+            // 初始化时间显示
+            initTimeDisplay('timeDisplay');
             (async()=>{
                             let marklst = await player.Native.GisMarker.getMarkerList();
                             if(marklst!=null){

+ 36 - 0
src/utils/timeDisplay.js

@@ -0,0 +1,36 @@
+/**
+ * 公用时间显示功能
+ * 格式:yyyy年MM月dd日星期X HH:mm:ss
+ */
+export function initTimeDisplay(elementId) {
+    // 时间更新函数
+    function updateNativeTime() {
+        const now = new Date();
+        const year = now.getFullYear();
+        const month = String(now.getMonth() + 1).padStart(2, '0');
+        const day = String(now.getDate()).padStart(2, '0');
+        const hours = String(now.getHours()).padStart(2, '0');
+        const minutes = String(now.getMinutes()).padStart(2, '0');
+        const seconds = String(now.getSeconds()).padStart(2, '0');
+        const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
+        const weekday = weekdays[now.getDay()];
+        // 移除月份和日期的前导零
+        const monthNum = now.getMonth() + 1;
+        const dayNum = now.getDate();
+        const timeString = `${year}年${monthNum}月${dayNum}日 ${weekday} ${hours}:${minutes}:${seconds}`;
+        
+        const timeElement = document.getElementById(elementId);
+        if (timeElement) {
+            timeElement.textContent = timeString;
+        }
+        
+        console.log('原生时间更11新:', timeString);
+    }
+
+    // 页面加载完成后开始定时更新
+    window.addEventListener('load', () => {
+        updateNativeTime(); // 立即执行一次
+        setInterval(updateNativeTime, 1000); // 每秒更新
+        console.log('原生时间显示已启动');
+    });
+}