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 | 74 ++++++++++++++++++++++++++++++++++--
1 files changed, 69 insertions(+), 5 deletions(-)
diff --git a/src/utils/global.js b/src/utils/global.js
index 48fbde4..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() {
@@ -8,8 +11,8 @@
// 澶勭悊琛ㄥご鍗曞厓鏍兼牱寮�
export function headerCellStyle() {
const option = {
- // background: '#eee', padding: '0'
- background: '#f8f8fa', padding: '0', color: '#a7a7a7'
+ // background: '#a7a7a7', padding: '0'
+ background: '#f8f8fa', padding: '0', color: '#000', fontWeight: 500
}
return option
}
@@ -24,12 +27,39 @@
return option
}
-// 鏃堕棿澶勭悊鍑芥暟
+// 鏃堕棿澶勭悊鍑芥暟 骞存湀鏃�
export function handleDatetime(value) {
const data = new Date(value)
const month = data.getMonth() < 9 ? '0' + (data.getMonth() + 1) : data.getMonth() + 1
const date = data.getDate() <= 9 ? '0' + data.getDate() : data.getDate()
return data.getFullYear() + '-' + month + '-' + date
+}
+
+// 浜嬩欢澶勭悊鍑芥暟 鏃跺垎绉�
+// 鑾峰彇褰撳墠鏃堕棿
+export function handleDatetime2(value) {
+ const dt = new Date(value)
+ const wk = dt.getDay()
+ const y = dt.getFullYear()
+ const m = (dt.getMonth() + 1 + '').padStart(2, '0')
+ const d = (dt.getDate() + '').padStart(2, '0')
+
+ const hh = (dt.getHours() + '').padStart(2, '0')
+ const mm = (dt.getMinutes() + '').padStart(2, '0')
+ const ss = (dt.getSeconds() + '').padStart(2, '0')
+ const weeks = ['鏄熸湡鏃�', '鏄熸湡涓�', '鏄熸湡浜�', '鏄熸湡涓�', '鏄熸湡鍥�', '鏄熸湡浜�', '鏄熸湡鍏�']
+ const week = weeks[wk]
+
+ // return `${y}-${m}-${d} ${hh}:${mm}:${ss} ${week}`
+ 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}`
}
// 鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�
@@ -57,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