From a93255e0a0334b51ecbaf3d8f496ad0fae1ed747 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 07 六月 2023 10:38:00 +0800
Subject: [PATCH] 1.生产入库有源单提交测试OK

---
 src/utils/global.js |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/src/utils/global.js b/src/utils/global.js
index dedc120..4df4457 100644
--- a/src/utils/global.js
+++ b/src/utils/global.js
@@ -1,4 +1,7 @@
-import { NewEncodingRules } from '@/api/xtsz'
+import { NewEncodingRules } from '@/api/systemSettings'
+import { AppTicketSelect } from '@/api/basicInfo'
+import axios from 'axios'
+import Vue from 'vue'
 
 // 鍏ㄥ眬涓昏棰滆壊
 export function getGlobalColor() {
@@ -51,6 +54,14 @@
   return `${y}-${m}-${d}  ${hh}:${mm}:${ss}`
 }
 
+// 鏃堕棿澶勭悊鍑芥暟   杩斿洖 鏃跺垎
+export function handleDatetime3(value) {
+  const dt = new Date(value)
+  const hh = (dt.getHours() + '').padStart(2, '0')
+  const mm = (dt.getMinutes() + '').padStart(2, '0')
+  return `${hh}:${mm}`
+}
+
 // 鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�
 export async function getNewEncodingRules(encode) {
   const res = await NewEncodingRules({ rightcode: encode })
@@ -91,3 +102,24 @@
     }
   }
 }
+
+// 鑾峰彇token 鐢ㄤ簬璇锋眰鐣呮嵎閫氭帴鍙�
+export async function getTPlusToken() {
+  const r1 = await AppTicketSelect()
+  const r2 = r1.data[0]
+  Vue.prototype.$AppKey = r2.appKey
+  Vue.prototype.$AppSecret = r2.appSecret
+  const data = {
+    appTicket: r2.AppTicket,
+    certificate: r2.certificate
+  }
+  const r3 = await axios.post(Vue.prototype.$chanjetBaseUrl + '/v1/common/auth/selfBuiltApp/generateToken',
+    data, {
+      headers: {
+        'appKey': Vue.prototype.$AppKey,
+        'appSecret': Vue.prototype.$AppSecret,
+        'Content-Type': 'application/json'
+      }
+    })
+  return r3.data.value.accessToken
+}

--
Gitblit v1.9.3