Bläddra i källkod

Merge branch 'xf_dev' of http://192.168.101.4:3000/jiaxiaoqiang/JG-CLIENT-TEMP into xf_dev

dengrui 9 månader sedan
förälder
incheckning
06cfd8f476

+ 51 - 34
src/components/Upload/CameraUpload.vue

@@ -51,31 +51,38 @@ let mediaStreamTrack = null; // 视频对象(全局)
 let video;
 let photoSize = 800;
 let realSize = 1000;
-const cameraEmit = defineEmits(["uploadFinish", "resetSelect", "deleteAll"]);
+const cameraEmit = defineEmits([
+  "uploadFinish",
+  "resetSelect",
+  "deleteAll",
+  "selectOhos",
+  "cameraOhos",
+]);
 
 const openMedia = async () => {
-  visible.value = true;
-  nextTick(() => {
-    let constraints = {
-      video: { width: photoSize, height: photoSize },
-      audio: false,
-    };
-    //获得video摄像头
-    video = document.getElementById("video");
-    navigator.mediaDevices
-      .getUserMedia(constraints)
-      .then((mediaStream) => {
-        console.log("mediaStream", mediaStream);
-        // mediaStreamTrack = typeof mediaStream.stop === 'function' ? mediaStream : mediaStream.getTracks()[1];
-        mediaStreamTrack = mediaStream.getVideoTracks();
-        video.srcObject = mediaStream;
-        video.play();
-      })
-      .catch((error) => {
-        console.log("Error: " + error);
-        ElMessage.error("没有找到设备,或者没有权限");
-      });
-  });
+  camera_ohos();
+  // visible.value = true;
+  // nextTick(() => {
+  //   let constraints = {
+  //     video: { width: photoSize, height: photoSize },
+  //     audio: false,
+  //   };
+  //   //获得video摄像头
+  //   video = document.getElementById("video");
+  //   navigator.mediaDevices
+  //     .getUserMedia(constraints)
+  //     .then((mediaStream) => {
+  //       console.log("mediaStream", mediaStream);
+  //       // mediaStreamTrack = typeof mediaStream.stop === 'function' ? mediaStream : mediaStream.getTracks()[1];
+  //       mediaStreamTrack = mediaStream.getVideoTracks();
+  //       video.srcObject = mediaStream;
+  //       video.play();
+  //     })
+  //     .catch((error) => {
+  //       console.log("Error: " + error);
+  //       ElMessage.error("没有找到设备,或者没有权限");
+  //     });
+  // });
 };
 
 function dataURItoBlob(base64Data) {
@@ -132,17 +139,18 @@ function closeMedia() {
 const visible = ref(false);
 
 const selectFile = () => {
-  let input = document.getElementById("fileInput");
-  input.click();
-  input.onchange = function () {
-    let file = this.files[0];
-    if (file) {
-      uploadFileApi(file).then((res) => {
-        cameraEmit("uploadFinish", res.data.fileUrl);
-        input.value = "";
-      });
-    }
-  };
+  select_ohos();
+  // let input = document.getElementById("fileInput");
+  // input.click();
+  // input.onchange = function () {
+  //   let file = this.files[0];
+  //   if (file) {
+  //     uploadFileApi(file).then((res) => {
+  //       cameraEmit("uploadFinish", res.data.fileUrl);
+  //       input.value = "";
+  //     });
+  //   }
+  // };
 };
 
 const clickReset = () => {
@@ -152,6 +160,15 @@ const clickReset = () => {
 const clickDeleteAll = () => {
   cameraEmit("deleteAll");
 };
+
+// 适配鸿蒙
+const select_ohos = () => {
+  cameraEmit("selectOhos");
+};
+
+const camera_ohos = () => {
+  cameraEmit("cameraOhos");
+};
 </script>
 
 <style lang="scss" scoped>

+ 1 - 0
src/store/modules/dictionary.ts

@@ -15,6 +15,7 @@ export const useDictionaryStore = defineStore("dictionaryStore", () => {
     "plan_work_order_state",
     "disposal_measures_type",
     "escalation_fault_state",
+    "station_task_state",
   ];
   const dicts = ref<{ [key: string]: any[] }>({});
 

+ 38 - 3
src/views/pro-steps/components/duomeiticaiji.vue

@@ -5,6 +5,8 @@
         @reset-select="clickReset"
         @upload-finish="finish"
         @delete-all="clickDeleteAll"
+        @camera-ohos="camera_ohos"
+        @select-ohos="select_ohos"
       />
       <div
         v-for="(item, index) in medias.filter((item: any) => item.filePath)"
@@ -86,9 +88,10 @@ const getImgurl = (item: any) => {
 };
 
 const clickReset = () => {
-  medias.value.forEach((item: any) => {
-    item.isSelected = false;
-  });
+  // medias.value.forEach((item: any) => {
+  //   item.isSelected = false;
+  // });
+  getListData();
 };
 
 const clickDeleteAll = () => {
@@ -102,6 +105,38 @@ const clickDeleteAll = () => {
       getListData();
     });
 };
+
+const select_ohos = () => {
+  let p = {
+    token: localStorage.getItem("token"),
+
+    operationMediaId: proStore.odersData.operationId,
+    processId: proStore.scanInfo.id,
+    seqNo: proStore.scanInfo.seqNo,
+    methodName: "selectFile",
+    apiUrlPath: "/api/v1/process/media/add", //上传完成后调的接口 不包含baseurl
+    method: "post",
+  };
+
+  if (window.openHarmonyBridge && window.openHarmonyBridge.selectFile) {
+    window.openHarmonyBridge.selectFile(JSON.stringify(p));
+  }
+};
+
+const camera_ohos = () => {
+  let p = {
+    token: localStorage.getItem("token"),
+    operationMediaId: proStore.odersData.operationId,
+    processId: proStore.scanInfo.id,
+    seqNo: proStore.scanInfo.seqNo,
+    apiUrlPath: "/api/v1/process/media/add", //上传完成后调的接口 不包含baseurl
+    method: "post",
+    methodName: "startCamera",
+  };
+  if (window.openHarmonyBridge && window.openHarmonyBridge.startCamera) {
+    window.openHarmonyBridge.startCamera(JSON.stringify(p));
+  }
+};
 </script>
 
 <style lang="scss" scoped>

+ 2 - 14
src/views/process/components/transferNum.vue

@@ -37,21 +37,9 @@
                 >{{ item.seqNo }}</span
               >
             </el-tooltip>
-            <div
-              :class="
-                dictS.getLableByValue(
-                  'work_order_seq_state',
-                  String(item.state)
-                ) == '完成'
-                  ? 'status success'
-                  : 'status'
-              "
-            >
+            <div :class="item.state == '2' ? 'status success' : 'status'">
               {{
-                dictS.getLableByValue(
-                  "work_order_seq_state",
-                  String(item.state)
-                )
+                dictS.getLableByValue("station_task_state", String(item.state))
               }}
             </div>
           </div>