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 | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/src/utils/global.js b/src/utils/global.js
index 81c59db..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 })
@@ -76,5 +87,39 @@
}
return items
}
-
export default clearAllChildren
+
+// 姝e垯琛ㄨ揪寮� 缂栫爜涓嶈兘鍚湁涓枃鎴栫壒娈婂瓧绗�
+const SER_HZ = /^[a-zA-Z0-9_\-;,.<>() ]{0,}$/
+export const validateCode = (rule, value, callback) => {
+ if (!value) {
+ return callback(new Error('璇疯緭鍏ョ紪鐮�'))
+ } else {
+ if (!SER_HZ.test(value)) {
+ return callback(new Error('缂栫爜涓嶈兘鍚湁涓枃鎴栫壒娈婂瓧绗�'))
+ } else {
+ callback()
+ }
+ }
+}
+
+// 鑾峰彇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