From 064128dfb784d9780aa4ac5dbd897c29d46a2666 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 01 十一月 2024 15:22:47 +0800
Subject: [PATCH] ll

---
 admin/src/views/platform/LogisticsRecord/waybill.vue           |    3 
 admin/src/components/business/OperaMemberWindow.vue            |  160 ++++++++++++++++++++++++++
 screen/vite.config.js                                          |    4 
 screen/src/views/EnergyConsum.vue                              |  147 ++++++++++++++----------
 admin/src/components/business/OperaHiddenDangerParamWindow.vue |   12 +
 5 files changed, 254 insertions(+), 72 deletions(-)

diff --git a/admin/src/components/business/OperaHiddenDangerParamWindow.vue b/admin/src/components/business/OperaHiddenDangerParamWindow.vue
index 9d051dc..842718c 100644
--- a/admin/src/components/business/OperaHiddenDangerParamWindow.vue
+++ b/admin/src/components/business/OperaHiddenDangerParamWindow.vue
@@ -4,11 +4,11 @@
       <el-form-item label="鍚嶇О" prop="name">
         <el-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�" v-trim />
       </el-form-item>
-      <el-form-item label="璐d换閮ㄩ棬" prop="companyId">
-        <el-select filterable clearable @change="loadMember" v-model="form.companyId">
+      <!-- <el-form-item label="璐d换閮ㄩ棬" prop="companyId">
+        <el-select filterable clearable @change="() => loadMember(1)" v-model="form.companyId">
           <el-option v-for="op in department" :key="op.id" :label="op.name" :value="op.id"></el-option>
         </el-select>
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item v-if="form.type == 0" label="閫夋嫨瀹夊叏鍛�" prop="memberIdList">
         <el-select v-model="form.memberIdList" filterable multiple clearable placeholder="璇烽�夋嫨">
           <el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id">
@@ -103,8 +103,10 @@
           }
         })
     },
-    loadMember() {
-      this.$set(this.form, 'memberIdList', [])
+    loadMember(flag) {
+      if(flag && flag == 1){
+        this.$set(this.form, 'memberIdList', null)
+      } 
       allList({
         type: 2,
         companyType: 1,
diff --git a/admin/src/components/business/OperaMemberWindow.vue b/admin/src/components/business/OperaMemberWindow.vue
index c4b80a8..e371f39 100644
--- a/admin/src/components/business/OperaMemberWindow.vue
+++ b/admin/src/components/business/OperaMemberWindow.vue
@@ -54,7 +54,37 @@
           </div>
         </div>
       </el-form-item>
+      <el-form-item>
+        <div><el-button type="primary" @click="openCamera">閲囬泦</el-button></div>
+      </el-form-item>
     </el-form>
+    <!--  -->
+    <el-dialog title="鎷嶆憚" :visible.sync="paisheModal" width="760px" :close-on-click-modal="false"
+      :close-on-press-escape="false" append-to-body @close="closeCamera">
+      <video v-show="isShowCamera" id="videoCamera" :width="videoWidth" :height="videoHeight" />
+      <canvas v-show="!isShowCamera" id="canvasCamera" style="display: none" :width="videoWidth"
+        :height="videoHeight" />
+      <span slot="footer">
+        <div>
+          <el-button @click="closeCamera">鍙栨秷</el-button>
+          <el-button v-show="blobFileCamera" type="primary" @click="resetCamera">閲嶆媿</el-button>
+          <el-button v-show="blobFileCamera" :loading="cameraLoading" type="primary"
+            @click="enterCamera">寮�濮嬭鍓�</el-button>
+          <el-button v-show="!blobFileCamera" type="primary" @click="setImage">鎷嶆憚</el-button>
+        </div>
+      </span>
+    </el-dialog>
+    <!--  -->
+    <el-dialog append-to-body :close-on-click-modal="false" title="涓婁紶鍥剧墖" :visible.sync="isShowCropper" width="1000px"
+      class="icon-dialog-wrapper dialong-com-style">
+      <ImageCropper ref="iconShot" v-if="isShowCropper" :imgSrc="blobFileCamera">
+      </ImageCropper>
+      <span slot="footer" class="dialog-footer">
+        <el-button v-if="loading">鍙� 娑�</el-button>
+        <el-button v-else @click="isShowCropper = false">鍙� 娑�</el-button>
+        <el-button :loading="loading" type="primary" @click="uploadIcon">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </GlobalWindow>
 </template>
 
@@ -63,14 +93,26 @@
 import GlobalWindow from '@/components/common/GlobalWindow'
 import UploadAvatarImage from '@/components/common/UploadAvatarImage'
 import UploadFaceImg from '@/components/common/UploadFaceImg'
+import ImageCropper from '@/components/common/ImageCropper'
 import { checkMobile, validIdCardNo, validIdCardNoNew } from '@/utils/form'
 import { allList } from '@/api/business/position'
+import { upload } from '@/api/system/common'
 export default {
   name: 'OperaCompanyWindow',
   extends: BaseOpera,
-  components: { GlobalWindow, UploadAvatarImage, UploadFaceImg },
+  components: { GlobalWindow, UploadAvatarImage, UploadFaceImg, ImageCropper },
   data() {
     return {
+      isShowCamera: false,
+      paisheModal: false,
+      cameraLoading: false,
+      videoWidth: 700,
+      videoHeight: 525,
+      mediaStreamCamera: '',
+      blobFileCamera: '',
+      isShowCropper: false,
+      loading: false,
+      // 浠ヤ笂鏄媿鎽�
       uploadData: {
         folder: 'member'
       },
@@ -119,6 +161,122 @@
     })
   },
   methods: {
+    openCamera() {
+      this.paisheModal = true
+      this.isShowCamera = true
+      const that = this
+      this.$nextTick(() => {
+        var mediaOpts = { audio: false, video: true }
+        navigator.mediaDevices
+          .getUserMedia(mediaOpts)
+          .then(function (stream) {
+            that.mediaStreamCamera = stream
+            const video = document.querySelector('#videoCamera')
+            if ('srcObject' in video) {
+              video.srcObject = stream
+            } else {
+              video.src =
+                (window.URL && window.URL.createObjectURL(stream)) || stream
+            }
+            video.play()
+          })
+          .catch(function (err) {
+            console.log(err)
+          })
+      })
+    },
+    // 閲嶆媿
+    resetCamera() {
+      this.isShowCamera = true
+      this.blobFileCamera = ''
+      this.openCamera()
+    },
+    // 鍏抽棴鐩告満
+    closeCamera() {
+      this.mediaStreamCamera.getVideoTracks().forEach(function (track) {
+        track.stop()
+      })
+      this.paisheModal = false
+    },
+    // 鐐瑰嚮鎷嶆憚
+    setImage() {
+      const that = this
+      that.isShowCamera = false
+      const video = document.querySelector('#videoCamera')
+      const canvas = document.querySelector('#canvasCamera')
+      canvas
+        .getContext('2d')
+        .drawImage(video, 0, 0, that.videoWidth, that.videoHeight)
+      this.mediaStreamCamera.getVideoTracks().forEach(function (track) {
+        track.stop()
+      })
+      const dataurl = canvas.toDataURL('image/jpg')
+      // this.blobFileCamera = that.base64ToFile(dataurl, 'camera')
+      this.blobFileCamera = dataurl
+    },
+    // 纭鎷嶆憚
+    enterCamera() {
+      this.isShowCropper = true
+      this.paisheModal = false
+      this.isShowCamera = true
+    },
+    uploadIcon () {
+      // 鑾峰彇瑁佸壀鍚庣殑鍥剧墖
+      this.$refs.iconShot.getImagecropper().getCropBlob((fileData) => { // 鑾峰彇褰撳墠瑁佸壀濂界殑鏁版嵁
+        // 娉ㄦ鏃剁殑data鏄竴涓狟lob鏁版嵁锛岄儴鍒嗘帴鍙f帴鏀剁殑鏄疐ile杞寲鐨凢ormData鏁版嵁
+        console.log(fileData)
+        const formData = new FormData()
+
+        formData.append('folder', 'member')
+        formData.append(
+            'file',
+            fileData
+        )
+        this.loading = true
+        upload(formData).then(res => {
+          this.loading = false
+          console.log(res)
+          // this.file.imgurl = res.imgaddr
+          // this.file.imgurlfull = res.url
+          this.$message.success('涓婁紶鎴愬姛')
+          // this.imageSrc = res.url
+          // this.updateImg = false
+          this.form.faceImg = res.imgaddr
+          this.form.faceImgFull = res.url
+          // this.$emit('uploadSuccess', { imgurl: res.imgaddr, imgurlfull: res.url, name: res.originname })
+          // this.$emit('uploadEnd')
+        }, () => {
+          this.loading = false
+        })
+      })
+    },
+    base64ToFile(base64, fileName) {
+      // 灏哹ase64鎸夌収 , 杩涜鍒嗗壊 灏嗗墠缂�  涓庡悗缁唴瀹瑰垎闅斿紑
+      const data = base64.split(',')
+      // 鍒╃敤姝e垯琛ㄨ揪寮� 浠庡墠缂�涓幏鍙栧浘鐗囩殑绫诲瀷淇℃伅锛坕mage/png銆乮mage/jpeg銆乮mage/webp绛夛級
+      const type = data[0].match(/:(.*?);/)[1]
+      // 浠庡浘鐗囩殑绫诲瀷淇℃伅涓� 鑾峰彇鍏蜂綋鐨勬枃浠舵牸寮忓悗缂�锛坧ng銆乯peg銆亀ebp锛�
+      const suffix = type.split('/')[1]
+      // 浣跨敤atob()瀵筨ase64鏁版嵁杩涜瑙g爜  缁撴灉鏄竴涓枃浠舵暟鎹祦 浠ュ瓧绗︿覆鐨勬牸寮忚緭鍑�
+      const bstr = window.atob(data[1])
+      // 鑾峰彇瑙g爜缁撴灉瀛楃涓茬殑闀垮害
+      let n = bstr.length
+      // 鏍规嵁瑙g爜缁撴灉瀛楃涓茬殑闀垮害鍒涘缓涓�涓瓑闀跨殑鏁村舰鏁板瓧鏁扮粍
+      // 浣嗗湪鍒涘缓鏃� 鎵�鏈夊厓绱犲垵濮嬪�奸兘涓� 0
+      const u8arr = new Uint8Array(n)
+      // 灏嗘暣褰㈡暟缁勭殑姣忎釜鍏冪礌濉厖涓鸿В鐮佺粨鏋滃瓧绗︿覆瀵瑰簲浣嶇疆瀛楃鐨刄TF-16 缂栫爜鍗曞厓
+      while (n--) {
+        // charCodeAt()锛氳幏鍙栫粰瀹氱储寮曞瀛楃瀵瑰簲鐨� UTF-16 浠g爜鍗曞厓
+        u8arr[n] = bstr.charCodeAt(n)
+      }
+      // 鍒╃敤鏋勯�犲嚱鏁板垱寤篎ile鏂囦欢瀵硅薄
+      // new File(bits, name, options)
+      const file = new File([u8arr], `${fileName}.${suffix}`, {
+        type: type
+      })
+      // 灏咶ile鏂囦欢瀵硅薄杩斿洖缁欐柟娉曠殑璋冪敤鑰�
+      return file
+    },
     handleChangeCompany(value) {
       if (this.form.company && this.form.company.length > 1) {
         this.form.companyId = this.form.company[this.form.company.length - 1]
diff --git a/admin/src/views/platform/LogisticsRecord/waybill.vue b/admin/src/views/platform/LogisticsRecord/waybill.vue
index f0b7a3e..c34af48 100644
--- a/admin/src/views/platform/LogisticsRecord/waybill.vue
+++ b/admin/src/views/platform/LogisticsRecord/waybill.vue
@@ -142,7 +142,6 @@
   },
   created() {
     this.changeRadio('0')
-    this.getList()
   },
   methods: {
     changeRadio(day) {
@@ -215,7 +214,7 @@
         selDate: [],
         fastdate: 0
       }
-      this.getList()
+      this.changeRadio('0')
     },
     handleDetail(row) {
       this.isShowDetail = true
diff --git a/screen/src/views/EnergyConsum.vue b/screen/src/views/EnergyConsum.vue
index 0284eb7..e885fb9 100644
--- a/screen/src/views/EnergyConsum.vue
+++ b/screen/src/views/EnergyConsum.vue
@@ -1,5 +1,5 @@
 <template>
-  <v-scale-screen width="1920" height="960" :fullScreen="true">
+  <v-scale-screen width="1920" height="960" >
     <div class="main_app">
       <img src="@/assets/images/bg_main_app.png" class="main_bg" alt="" />
       <div class="main_header">
@@ -48,11 +48,11 @@
                 <div>鏈堣兘鑰楀垎鏋�</div>
               </div>
               <div class="tabs">
-                <div class="tab active">鐢ㄧ數</div>
+                <div class="tab" :class="{ active: activeTab2 == 0 }" @click="tabsClick2(0)">鐢ㄦ按</div>
                 <div class="separate"></div>
-                <div class="tab">鐢ㄦ按</div>
+                <div class="tab" :class="{ active: activeTab2 == 2 }" @click="tabsClick2(2)">鐢ㄧ數</div>
                 <div class="separate"></div>
-                <div class="tab">鐢ㄦ皵</div>
+                <div class="tab" :class="{ active: activeTab2 == 1 }" @click="tabsClick2(1)">鐢ㄦ皵</div>
               </div>
               <img src="@/assets/images/title@2x.png" class="bg" alt="" />
             </div>
@@ -193,13 +193,13 @@
               <img src="@/assets/images/title@2x.png" class="bg" alt="" />
             </div>
             <div class="list">
-              <div class="line" v-for="item, i in 6">
+              <div class="line" v-for="item, i in data3">
                 <div class="top"><span v-if="i < 3">top</span>{{ i }}</div>
-                <div class="id_card">鐨朅12313</div>
+                <div class="id_card">{{ item.carNo }}</div>
                 <div class="wrap">
-                  <ChargeRate :rate="15" :color />
+                  <ChargeRate :rate="item.rate" :color />
                 </div>
-                <div class="num">1000</div>
+                <div class="num">{{ item.quantity }}</div>
               </div>
             </div>
           </div>
@@ -276,7 +276,13 @@
     xAxis: {
       type: 'category',
       boundaryGap: false,
-      data: [1, 2, 3, 4, 5, 5]
+      data: data5.value.map(i => i.timeData)
+    },
+    tooltip: {
+      trigger: 'axis',
+      axisPointer: {
+        type: 'line'
+      },
     },
     yAxis: {
       type: 'value',
@@ -295,7 +301,7 @@
       }
     },
     grid: {
-      top: '16%',
+      top: '26%',
       left: '4%',
       right: '2%',
       bottom: '2%',
@@ -303,12 +309,7 @@
     },
     series: [
       {
-        data: [1, 2, 3, 4, 4, 5].map(i => {
-          return {
-            name: i,
-            value: i,
-          }
-        }),
+        data: data5.value.map(i => i.energy),
         type: 'line',
         areaStyle: {
           normal: {
@@ -344,7 +345,7 @@
           width: 2, // 绾挎潯绮楃粏
         },
         symbol: 'circle',
-        symbolSize: 10,
+        symbolSize: 6,
         itemStyle: {
           normal: {
             color: '#F3BD00', //鎶樼嚎鐐圭殑棰滆壊
@@ -364,27 +365,31 @@
   var myChart = echarts.init(document.querySelector('.loadRef'))
   // 缁樺埗鍥捐〃
   myChart.setOption({
-    // tooltip: {
-    //   trigger: 'axis',
-    //   axisPointer: {
-    //     type: 'line'
-    //   },
-    //   formatter: function (params) {
-    //     setTimeout(() => {
-    //       console.log('params', params)
-    //     })
-    //     return `
-    //       <div style="background-color: #091123;margin: -12px;padding: 14px;border: 2px solid rgba(1,217,254,0.5);color: #fff;">
-    //         <div>${params[0].name}鎬婚攢鍞(涓囧厓)</div>
-    //         <div style="display: flex;align-items: center;">
-    //           <div style="width: 10px;height: 10px;border-radius: 50%;background-color: #ebbf40;"></div>
-    //           <div style="margin: 0 4px 0 6px;">鎬婚攢鍞�</div>
-    //           <span style="color: #ebbf40;">${params[0].value}</span>
-    //         </div>
-    //       </div>
-    //     `
-    //   }
-    // },
+    tooltip: {
+      trigger: 'axis',
+      axisPointer: {
+        type: 'line'
+      },
+      // trigger: 'axis',
+      // axisPointer: {
+      //   type: 'line'
+      // },
+      // formatter: function (params) {
+      //   setTimeout(() => {
+      //     console.log('params', params)
+      //   })
+      //   return `
+      //     <div style="background-color: #091123;margin: -12px;padding: 14px;border: 2px solid rgba(1,217,254,0.5);color: #fff;">
+      //       <div>${params[0].name}鎬婚攢鍞(涓囧厓)</div>
+      //       <div style="display: flex;align-items: center;">
+      //         <div style="width: 10px;height: 10px;border-radius: 50%;background-color: #ebbf40;"></div>
+      //         <div style="margin: 0 4px 0 6px;">鎬婚攢鍞�</div>
+      //         <span style="color: #ebbf40;">${params[0].value}</span>
+      //       </div>
+      //     </div>
+      //   `
+      // }
+    },
     xAxis: {
       type: 'category',
       boundaryGap: false,
@@ -407,7 +412,7 @@
       }
     },
     grid: {
-      top: '16%',
+      top: '26%',
       left: '4%',
       right: '2%',
       bottom: '2%',
@@ -426,7 +431,7 @@
               y2: 1,
               colorStops: [{
                 offset: 0,
-                color: "rgba(192, 156, 53,.7)" // 0% 澶勭殑棰滆壊
+                color: "#2e6ab5" // 0% 澶勭殑棰滆壊
               }, {
                 offset: 1,
                 color: "#1b1b12" // 100% 澶勭殑棰滆壊
@@ -443,18 +448,18 @@
             x2: 0,
             y2: 1,
             colorStops: [{
-              offset: 0, color: '#F3BD00' // 0% 澶勭殑棰滆壊
+              offset: 0, color: '#2e6ab5' // 0% 澶勭殑棰滆壊
             }, {
-              offset: 1, color: '#F3BD00' // 100% 澶勭殑棰滆壊
+              offset: 1, color: '#2e6ab5' // 100% 澶勭殑棰滆壊
             }],
           },
           width: 2, // 绾挎潯绮楃粏
         },
         symbol: 'circle',
-        symbolSize: 10,
+        symbolSize: 0,
         itemStyle: {
           normal: {
-            color: '#F3BD00', //鎶樼嚎鐐圭殑棰滆壊
+            color: '#2e6ab5', //鎶樼嚎鐐圭殑棰滆壊
           },
         },
         smooth: true
@@ -466,14 +471,12 @@
     myChart.resize()
   })
 }
-const arr = ['#68e2e3', '#50afd3', '#377cdb', '#d5ae3a']
 const initEnergy = () => {
   var myChart = echarts.init(document.querySelector('.energyRef'))
   // 缁樺埗鍥捐〃
-  const arr = ['#68e2e3', '#50afd3', '#377cdb', '#d5ae3a']
   myChart.setOption({
     grid: {
-      top: '20%',
+      top: '26%',
       left: '2%',
       right: '2%',
       bottom: '4%',
@@ -487,7 +490,7 @@
     },
     xAxis: {
       type: 'category',
-      data: [1, 2, 3, 4, 4, 5]
+      data: data2.value.map(i => i.timeData)
     },
     yAxis: {
       type: 'value',
@@ -505,7 +508,7 @@
     },
     series: [
       {
-        data: [1, 2, 3, 4, 5],
+        data: data2.value.map(i => i.energy),
         type: 'bar',
         barWidth: 10,
         itemStyle: {
@@ -513,8 +516,8 @@
             color: new echarts.graphic.LinearGradient(
               0, 0, 0, 1,
               [
-                { offset: 0, color: arr[1] },
-                { offset: 1, color: '#080807' }
+                { offset: 0, color: '#50afd3' },
+                { offset: 1, color: '#1d4861' }
               ]
             ),
             barBorderRadius: [10, 10, 0, 0]
@@ -532,20 +535,32 @@
 const getData1 = () => {
   zxcenterData().then(res => {
     const result = res.data
+    data1.value = result
   })
+}
+const activeTab2 = ref(0)
+const tabsClick2 = (v) => {
+  activeTab2.value = v
+  getData2()
 }
 const data2 = ref([])
 const getData2 = () => {
-  zxenergyDataList().then(res => {
+  zxenergyDataList({type: activeTab2.value}).then(res => {
     const result = res.data
     data2.value = result
+    initEnergy()
   })
 }
 const data3 = ref([])
 const getData3 = () => {
   zxlastMonthOil().then(res => {
-    const result = res.data
-    data3.value = result
+    const result = res.data || []
+    data3.value = result.map(i => {
+      if(i.quantity && i.maxOil){
+        i.rate = ((i.quantity/i.maxOil) * 25).toFixed(0)
+      }
+      return i
+    })
   })
 }
 const data4 = ref([])
@@ -557,11 +572,21 @@
   })
 }
 
+const data5 = ref([])
+const getData5 = () => {
+  zxenergyDataList({type: 3}).then(res => {
+    const result = res.data
+    data5.value = result
+    initOperation()
+  })
+}
+
 onMounted(() => {
   getData1()
   getData2()
   getData3()
   getData4()
+  getData5()
 
 })
 
@@ -606,9 +631,7 @@
 
       .load_wrap {
         width: 100%;
-        height: 210px;
-        padding: 12px 12px;
-
+        height: 250px;
         .loadRef {
           width: 100%;
           height: 100%;
@@ -619,7 +642,7 @@
     .left_box_three {
       .energy_wrap {
         width: 100%;
-        height: 200px;
+        height: 250px;
 
         .energyRef {
           width: 100%;
@@ -890,11 +913,9 @@
 
     .right_box_three {
       .wrap {
-        padding: 8px;
-
         .analyseRef {
           width: 100%;
-          height: 210px;
+          height: 250px;
         }
       }
     }
@@ -934,7 +955,9 @@
     align-items: center;
     font-size: 14px;
     color: #d2e0ff;
-
+    .tab{
+      cursor: pointer;
+    }
     .separate {
       width: 1px;
       height: 14px;
diff --git a/screen/vite.config.js b/screen/vite.config.js
index f4a5d19..1afa5c0 100644
--- a/screen/vite.config.js
+++ b/screen/vite.config.js
@@ -25,9 +25,9 @@
   server: {
     proxy: {
       "/gateway_interface": {
-        target: "http://192.168.0.103:10010",
+        // target: "http://192.168.0.103:10010",
         // target: "http://10.50.250.253:8088/gateway_interface",
-        // target: "http://192.168.0.173/gateway_interface",
+        target: "http://192.168.0.173/gateway_interface",
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/gateway_interface/, ""),
       },

--
Gitblit v1.9.3