初始提交

This commit is contained in:
2026-01-04 11:09:06 +08:00
commit 8fa31df250
1326 changed files with 213907 additions and 0 deletions

29
utils/define.js Normal file
View File

@@ -0,0 +1,29 @@
/* process.env.NODE_ENV设置生产环境模式 */
// #ifndef MP
const baseURL = process.env.NODE_ENV === "production" ? "https://app.java.jnpfsoft.com" : "http://localhost:30000"
const webSocketUrl = process.env.NODE_ENV === "production" ? "wss://app.java.jnpfsoft.com/websocket" :
"ws://localhost:30000/api/message/websocket"
const report = process.env.NODE_ENV === 'production' ? 'https://java.jnpfsoft.com/Report' : 'http://localhost:8200'
const pcURL = process.env.NODE_ENV === 'production' ? 'https://java.jnpfsoft.com' : 'http://localhost:3000'
// #endif
// #ifdef MP
const baseURL = "http://localhost:30000"
const webSocketUrl = "ws://localhost:30000/api/message/websocket"
const report = 'http://localhost:8200'
const pcURL = 'http://localhost:3000'
// #endif
const define = {
copyright: "Copyright @ 2025 引迈信息技术有限公司版权所有",
sysVersion: "V6.0",
baseURL, // 接口前缀
report,
pcURL,
webSocketUrl,
comUploadUrl: baseURL + '/api/file/Uploader/',
timeout: 1000000,
aMapWebKey: '',
cipherKey: 'EY8WePvjM5GGwQzn', // 加密key
}
export default define

591
utils/jnpf.js Normal file
View File

@@ -0,0 +1,591 @@
import CryptoJS from 'crypto-js'
import request from '@/utils/request'
import define from '@/utils/define'
import {
dayjs
} from '@/uni_modules/iRainna-dayjs/js_sdk/dayjs.min.js'
import md5Libs from "@/uni_modules/vk-uview-ui/libs/function/md5";
const jnpf = {
goBack() {
uni.navigateBack()
},
// 跳链接
jumpLink(urlAddress, pageTitle = "") {
if (!urlAddress) return
let url = '/pages/apply/externalLink/index?url=' + encodeURIComponent(urlAddress) + '&fullName= ' +
pageTitle
uni.navigateTo({
url: url,
})
},
/* 传参字符串转义 */
encodeContent(key) {
const encodeArr = [{
code: '%',
encode: '%25'
}, {
code: '?',
encode: '%3F'
}, {
code: '#',
encode: '%23'
}, {
code: '&',
encode: '%26'
}, {
code: '=',
encode: '%3D'
}];
return key.replace(/[%?#&=]/g, ($, index, str) => {
for (const k of encodeArr) {
if (k.code === $) {
return k.encode;
}
}
});
},
solveAddressParam(item, config) {
let jnpfKey = config.jnpfKey
item.urlAddress = item.urlAddress ? item.urlAddress : config.option.appUrlAddress
if (!item.urlAddress) return
let urlAddress = item.urlAddress
const regex = /\${[^{}]+}/g;
urlAddress = urlAddress.replace(regex, match => {
const key = match.slice(2, -1);
let value = '';
if (jnpfKey === 'text') {
return key == 'Field' || key == 'field' ? item.value : match
}
if (jnpfKey === 'timeAxis') {
if (key == 'name') value = item['content'];
if (key == 'timestamp') value = item['timestamp'];
}
if (jnpfKey === 'tableList') {
return item[key] || match
}
if (jnpfKey === 'dataBoard') {
return key == 'Field' || key == 'field' ? item.num : match
}
if (jnpfKey === 'rankList') {
if (key === 'name') value = item.label;
if (key === 'value') value = item.value.replace("¥ ", "");
}
// 图标替换
if (jnpfKey === 'barChart' || jnpfKey === 'lineChart' || jnpfKey === 'pieChart' ||
jnpfKey == 'radarChart' || jnpfKey === 'mapChart') {
if (key === 'name') value = item.name;
if (key === 'long') value = item.long;
if (key === 'lat') value = item.lat;
if (key === 'value') value = item.value;
if (key === 'type') value = item.type;
}
return value || match;
});
item.urlAddress = urlAddress
},
handelFormat(format) {
let formatObj = {
'yyyy': 'yyyy',
'yyyy-MM': 'yyyy-MM',
'yyyy-MM-dd': 'yyyy-MM-dd',
'yyyy-MM-dd HH:mm': 'yyyy-MM-dd HH:mm',
'yyyy-MM-dd HH:mm:ss': 'yyyy-MM-dd HH:mm:ss',
'HH:mm:ss': 'HH:mm:ss',
"HH:mm": "HH:mm",
'YYYY': 'yyyy',
'YYYY-MM': 'yyyy-MM',
'YYYY-MM-DD': 'yyyy-MM-dd',
'YYYY-MM-DD HH:mm': 'yyyy-MM-dd HH:mm',
'YYYY-MM-DD HH:mm:ss': 'yyyy-MM-dd HH:mm:ss',
}
return formatObj[format]
},
toDate(v, format) {
format = format ? format : "yyyy-MM-dd HH:mm:ss"
if (!v) return "";
var d = v;
if (typeof v === 'string') {
if (v.indexOf("/Date(") > -1)
d = new Date(parseInt(v.replace("/Date(", "").replace(")/", ""), 10));
else
d = new Date(Date.parse(v.replace(/-/g, "/").replace("T", " ").split(".")[0]));
} else {
d = new Date(v)
}
var o = {
"M+": d.getMonth() + 1,
"d+": d.getDate(),
"h+": d.getHours(),
"H+": d.getHours(),
"m+": d.getMinutes(),
"s+": d.getSeconds(),
"q+": Math.floor((d.getMonth() + 3) / 3),
"S": d.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" +
o[k])
.length));
}
}
return format;
},
toFileSize(size) {
if (size == null || size == "") {
return "";
}
if (size < 1024.00)
return jnpf.toDecimal(size) + " 字节";
else if (size >= 1024.00 && size < 1048576)
return jnpf.toDecimal(size / 1024.00) + " KB";
else if (size >= 1048576 && size < 1073741824)
return jnpf.toDecimal(size / 1024.00 / 1024.00) + " MB";
else if (size >= 1073741824)
return jnpf.toDecimal(size / 1024.00 / 1024.00 / 1024.00) + " GB";
},
toDecimal(num) {
if (num == null) {
num = "0";
}
num = num.toString().replace(/\$|\,/g, '');
if (isNaN(num))
num = "0";
var sign = (num == (num = Math.abs(num)));
num = Math.floor(num * 100 + 0.50000000001);
var cents = num % 100;
num = Math.floor(num / 100).toString();
if (cents < 10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
num = num.substring(0, num.length - (4 * i + 3)) + '' +
num.substring(num.length - (4 * i + 3));
return (((sign) ? '' : '-') + num + '.' + cents);
},
getScriptFunc(str) {
// #ifndef MP
let func = null
try {
func = eval(str)
if (Object.prototype.toString.call(func) !== '[object Function]') return false;
return func
} catch (error) {
console.log(error);
return false
}
// #endif
// #ifdef MP
return false
// #endif
},
interfaceDataHandler(data) {
if (!data.dataProcessing) return data.data
const dataHandler = this.getScriptFunc(data.dataProcessing)
if (!dataHandler) return data.data
return dataHandler(data.data)
},
toDateText(dateTimeStamp) {
if (!dateTimeStamp) return ''
let result = ''
let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示
let hour = minute * 60;
let day = hour * 24;
let week = day * 7;
let halfamonth = day * 15;
let month = day * 30;
let now = new Date().getTime(); //获取当前时间毫秒
let diffValue = now - dateTimeStamp; //时间差
if (diffValue < 0) return "刚刚"
let minC = diffValue / minute; //计算时间差的分,时,天,周,月
let hourC = diffValue / hour;
let dayC = diffValue / day;
let weekC = diffValue / week;
let monthC = diffValue / month;
if (monthC >= 1 && monthC <= 3) {
result = " " + parseInt(monthC) + "月前"
} else if (weekC >= 1 && weekC <= 3) {
result = " " + parseInt(weekC) + "周前"
} else if (dayC >= 1 && dayC <= 6) {
result = " " + parseInt(dayC) + "天前"
} else if (hourC >= 1 && hourC <= 23) {
result = " " + parseInt(hourC) + "小时前"
} else if (minC >= 1 && minC <= 59) {
result = " " + parseInt(minC) + "分钟前"
} else if (diffValue >= 0 && diffValue <= minute) {
result = "刚刚"
} else {
let datetime = new Date();
datetime.setTime(dateTimeStamp);
let Nyear = datetime.getFullYear();
let Nmonth = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime
.getMonth() + 1;
let Ndate = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
let Nhour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime.getHours();
let Nminute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
let Nsecond = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
result = Nyear + "-" + Nmonth + "-" + Ndate
}
return result;
},
//取整
toRound(number) {
var bite = 0;
if (number < 10) {
return 10;
}
if (number > 10 && number < 50) {
return 50;
}
while (number >= 10) {
number /= 10;
bite += 1;
}
return Math.ceil(number) * Math.pow(10, bite);
},
getAmountChinese(val) {
if (!val && val !== 0) return '';
if (val == 0) return '零元整';
const regExp = /[a-zA-Z]/;
if (regExp.test(val)) return '数字较大溢出';
let amount = +val;
if (isNaN(amount)) return '';
if (amount < 0) amount = Number(amount.toString().split('-')[1]);
const NUMBER = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
const N_UNIT1 = ['', '拾', '佰', '仟'];
const N_UNIT2 = ['', '万', '亿', '兆'];
const D_UNIT = ['角', '分', '厘', '毫'];
let [integer, decimal] = amount.toString().split('.');
if (integer && (integer.length > 15 || integer.indexOf('e') > -1)) return '数字较大溢出';
let res = '';
// 整数部分
if (integer) {
let zeroCount = 0;
for (let i = 0, len = integer.length; i < len; i++) {
const num = integer.charAt(i);
const pos = len - i - 1; // 排除个位后 所处的索引位置
const q = pos / 4;
const m = pos % 4;
if (num === '0') {
zeroCount++;
} else {
if (zeroCount > 0 && m !== 3) res += NUMBER[0];
zeroCount = 0;
res += NUMBER[parseInt(num)] + N_UNIT1[m];
}
if (m == 0 && zeroCount < 4) res += N_UNIT2[Math.floor(q)];
}
}
if (Number(integer) != 0) res += '元';
// 小数部分
if (parseInt(decimal)) {
for (let i = 0; i < 4; i++) {
const num = decimal.charAt(i);
if (parseInt(num)) res += NUMBER[num] + D_UNIT[i];
}
} else {
res += '整';
}
if (val < 0) res = '负数' + res;
return res;
},
thousandsFormat(num) {
if (num === 0) return '0';
if (!num) return '';
const numArr = num.toString().split('.');
numArr[0] = numArr[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return numArr.join('.');
},
base64: {
encode(str, isEncodeURIComponent = true) {
if (!str) return ''
const newStr = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(str))
return isEncodeURIComponent ? encodeURIComponent(newStr) : newStr
},
decode(str, isDecodeURIComponent = true) {
if (!str) return ''
const newStr = isDecodeURIComponent ? decodeURIComponent(str) : str
const result = CryptoJS.enc.Utf8.stringify(CryptoJS.enc.Base64.parse(newStr))
return result
}
},
idGenerator() {
let quotient = (new Date() - new Date('2020-08-01'))
quotient += Math.ceil(Math.random() * 1000)
const chars = '0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz';
const charArr = chars.split("")
const radix = chars.length;
const res = []
do {
let mod = quotient % radix;
quotient = (quotient - mod) / radix;
res.push(charArr[mod])
} while (quotient);
return res.join('')
},
dynamicText(value, options) {
if (!value) return ''
if (Array.isArray(value)) {
if (!options || !Array.isArray(options)) return value.join()
let textList = []
for (let i = 0; i < value.length; i++) {
let item = options.filter(o => o.id == value[i])[0]
if (!item || !item.fullName) {
textList.push(value[i])
} else {
textList.push(item.fullName)
}
}
return textList.join()
}
if (!options || !Array.isArray(options)) return value
let item = options.filter(o => o.id == value)[0]
if (!item || !item.fullName) return value
return item.fullName
},
treeToArray(treeData, type = '') {
let list = []
const loop = (treeData) => {
for (let i = 0; i < treeData.length; i++) {
const item = treeData[i]
if (!type || item.type === type) list.push(item)
if (item.children && Array.isArray(item.children)) loop(item.children)
}
}
loop(treeData)
return list
},
dynamicTreeText(value, options) {
if (!value) return ''
const transfer = (data, partition) => {
let textList = []
const loop = (data, id) => {
for (let i = 0; i < data.length; i++) {
if (data[i].id === id) {
textList.push(data[i].fullName)
break
}
if (data[i].children) loop(data[i].children, id)
}
}
for (let i = 0; i < data.length; i++) {
if (Array.isArray(data[i])) {
textList.push(transfer(data[i], "/"))
} else {
loop(options, data[i])
}
}
return textList.join(partition)
}
if (!options || !Array.isArray(options)) return Array.isArray(value) ? value.join() : value
if (Array.isArray(value)) return transfer(value)
return transfer(value.split())
},
onlineUtils: {
// 获取用户信息
getUserInfo() {
const userInfo = uni.getStorageSync('userInfo') || {};
userInfo.token = uni.getStorageSync('token') || '';
return userInfo;
},
// 获取设备信息
getDeviceInfo() {
const deviceInfo = {
vueVersion: '3',
origin: 'app'
};
return deviceInfo;
},
// 请求
request(url, method, data, header) {
return request({
url: url,
method: method || 'GET',
data: data || {},
header: header || {},
options: {
load: false
}
})
},
// 路由跳转
route(url, type = 'navigateTo') {
if (!url) return;
uni.$u.route({
url,
type
})
},
// 消息提示
toast(message, _type = 'info', duration = 3000) {
uni.$u.toast(message, duration)
},
},
aesEncryption: {
decrypt(str, cipherKey = '') {
if (!cipherKey) cipherKey = md5Libs.md5(define.cipherKey)
const hexStr = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(str))
const decryptedData = CryptoJS.AES.decrypt(hexStr, CryptoJS.enc.Utf8.parse(cipherKey), {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
}).toString(CryptoJS.enc.Utf8);
return decryptedData
},
encrypt(str, cipherKey = '') {
if (!cipherKey) cipherKey = md5Libs.md5(define.cipherKey)
const encryptedData = CryptoJS.AES.encrypt(str, CryptoJS.enc.Utf8.parse(cipherKey), {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
}).toString();
const result = CryptoJS.enc.Hex.stringify(CryptoJS.enc.Base64.parse(encryptedData))
return result
}
},
getDistance(lat1, lon1, lat2, lon2) {
const toRadians = (degrees) => {
return degrees * (Math.PI / 180);
}
const R = 6371;
const dLat = toRadians(lat2 - lat1);
const dLon = toRadians(lon2 - lon1);
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = R * c;
return distance * 1000;
},
getParamList(templateJson, data, rowKey = 'id') {
if (!templateJson || !templateJson.length) return [];
for (let i = 0; i < templateJson.length; i++) {
const e = templateJson[i];
if (e.sourceType == 1 && data) {
e.defaultValue = data[e.relationField] || data[e.relationField] == 0 ||
data[e.relationField] == false ? data[e.relationField] : '';
}
if (e.sourceType == 4 && e.relationField == '@formId') e.defaultValue = data[rowKey] || '';
}
return templateJson;
},
getBatchParamList(templateJson, data) {
if (!templateJson?.length) return [];
for (let i = 0; i < templateJson.length; i++) {
const e = templateJson[i];
if (e.sourceType == 1 && data.items?.length) {
e.defaultValue = data.items.map(o => (data.webType == '4' ? o[e.relationField] : o[e
.relationField + '_jnpfId']));
}
if (e.sourceType == 4 && e.relationField == '@formId') e.defaultValue = data.items.map(o => o.id);
}
return templateJson;
},
getLaunchFlowParamList(transferList, data, rowKey = 'id') {
transferList = JSON.parse(JSON.stringify(transferList))
if (!transferList?.length) return [];
for (let i = 0; i < transferList.length; i++) {
const e = transferList[i];
if (e.sourceType == 1) {
if (e.sourceValue == '@formId') {
e.defaultValue = data[rowKey] || '';
} else {
if (e.sourceValue.includes('-')) {
const tableVModel = e.sourceValue.split('-')[0];
const childVModel = e.sourceValue.split('-')[1];
e.defaultValue = (data[tableVModel] || []).map(o => o[childVModel + '_jnpfId']);
} else {
const key = e.sourceValue + '_jnpfId';
e.defaultValue = data[key] || data[key] == 0 || data[key] == false ? data[key] : '';
}
}
} else {
e.defaultValue = e.sourceValue;
}
}
return transferList;
},
getDateTimeUnit(format) {
if (format == 'YYYY' || format == 'yyyy') return 'year';
if (format == 'YYYY-MM' || format == 'yyyy-MM') return 'month';
if (format == 'YYYY-MM-DD' || format == 'yyyy-MM-dd') return 'day';
if (format == 'YYYY-MM-DD HH:mm' || format == 'yyyy-MM-dd HH:mm') return 'minute';
if (format == 'YYYY-MM-DD HH:mm:ss' || format == 'yyyy-MM-dd HH:mm:ss') return 'second';
return 'day';
},
// 在线开发搜索设置默认值
setSearchDefaultValue(item, now) {
if (!['datePicker', 'organizeSelect', 'posSelect', 'userSelect'].includes(item.jnpfKey) ||
item.sourceType != 4) return;
const val = item.value;
item.value = this.getSearchRealValue(val, item.format, now, item.__config__.isFromParam,
item.searchMultiple);
},
// 代码生成默认值使用
getSearchRealValue(key, format, now, isFromParam = false, multiple = false) {
const userInfo = uni.getStorageSync('userInfo') || {}
// 当前组织
if (key === '@currOrganize') {
if (!userInfo.organizeIds?.length) return !!multiple ? [] : '';
return !!multiple ? userInfo.organizeIds : userInfo.organizeId;
}
// 当前岗位
if (key === '@currPosition') {
if (!userInfo.positionIds?.length) return !!multiple ? [] : '';
return !!multiple ? userInfo.positionIds : userInfo.positionId;
}
// 当前用户
if (key === '@currUser') {
return !!multiple ? [userInfo.userId] : userInfo.userId;
}
now = dayjs(now)
const unit = this.getDateTimeUnit(format || 'YYYY-MM-DD HH:mm:ss');
const lastTimeStamp = now.startOf(unit).valueOf();
if (isFromParam) return lastTimeStamp;
let firstDate = now;
// 前三天
if (key === '@pastThreeDays') {
firstDate = now.subtract(3, 'day');
}
// 前一周
if (key === '@pastWeek') {
firstDate = now.subtract(1, 'week');
}
// 前一个月
if (key === '@pastMonth') {
firstDate = now.subtract(1, 'month');
}
// 前三个月
if (key === '@pastThreeMonths') {
firstDate = now.subtract(3, 'month');
}
// 前半年
if (key === '@pastSixMonths') {
firstDate = now.subtract(6, 'month');
}
// 前一年
if (key === '@pastYear') {
firstDate = now.subtract(1, 'year');
}
const firstTimeStamp = firstDate.startOf(unit).valueOf();
return [firstTimeStamp, lastTimeStamp];
},
getAuthImgUrl(url, isRedirect = true) {
// #ifndef H5
isRedirect = false
// #endif
if (!url) return '';
const base64WithPrefixRegex =
/^data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+);base64,([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;
if (base64WithPrefixRegex.test(url)) return url;
const userInfo = uni.getStorageSync('userInfo') || {}
const securityKey = userInfo?.securityKey || '';
if (!securityKey) return define.baseURL + url;
const realUrl = define.baseURL + url + (url.includes('?') ? '&' : '?') + 's=' + securityKey +
(isRedirect ? '' : '&t=t');
return realUrl;
}
}
export default jnpf

21
utils/refreshCurrent.js Normal file
View File

@@ -0,0 +1,21 @@
// 将对象序列化为查询字符串
function stringifyQuery(obj) {
let ret = [];
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
ret.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));
}
}
return ret.join('&');
}
export function refreshCurrentPage() {
// 获取当前页面的路径
let currentPage = getCurrentPages().pop();
if (currentPage) {
// 重启当前页面
uni.reLaunch({
url: `/${currentPage.route}` + (currentPage.options ? `?${stringifyQuery(currentPage.options)}` :
'')
});
}
}

108
utils/request.js Normal file
View File

@@ -0,0 +1,108 @@
import define from './define'
import {
useLocale
} from '@/locale/useLocale';
const {
getBackLocale
} = useLocale();
const host = define.baseURL
const defaultOpt = {
load: true
}
// 示例
// async xxxx(code) {
// var res = await this.request({
// url: '/api/System/DictionaryData/All',
// method: 'GET',
// data,
// options: {
// load: false
// }
// })
// if (!res) return
// console.log(res)
// }
function request(config) {
config.options = Object.assign(defaultOpt, config.options)
const token = uni.getStorageSync('token') || ''
const systemCode = uni.getStorageSync('systemCode') || ''
const locale = getBackLocale()
let header = {
"App-Code": systemCode,
"Content-Type": "application/json;charset=UTF-8",
"Jnpf-Origin": "app",
"Vue-Version": "3",
"Accept-Language": locale,
...config.header
}
header['App-Code'] = encodeURIComponent(header['App-Code'])
if (token) header['Authorization'] = token
let url = config.url.indexOf('http') > -1 ? config.url : host + config.url
if (config.options.load) {
uni.showLoading({
title: config.options.loadText || '正在加载'
})
}
return new Promise((resolve, reject) => {
uni.request({
url: url,
data: config.data || {},
method: config.method || 'GET',
header: header,
timeout: define.timeout,
success: res => {
if (res.statusCode === 200) {
if (res.data.code == 200) {
resolve(res.data)
} else {
ajaxError(res.data)
reject(res.data.msg)
}
} else {
ajaxError(res.data)
reject(res.errMsg)
}
uni.hideLoading();
},
fail: err => {
uni.showToast({
title: '连接服务器失败',
icon: 'none',
})
setTimeout(function () {
uni.hideLoading();
}, 2000);
reject(err)
}
})
})
}
function ajaxError(data) {
uni.showToast({
title: data.msg || '请求出错,请重试',
icon: 'none',
complete() {
if (data.code === 600 || data.code === 601 || data.code === 602) {
setTimeout(() => {
uni.removeStorageSync('token')
uni.removeStorageSync('cid')
uni.removeStorageSync('userInfo')
uni.removeStorageSync('permissionList')
uni.removeStorageSync('sysVersion')
uni.removeStorageSync('dynamicModelExtra')
uni.reLaunch({
url: '/pages/login/index'
})
}, 1500)
}
}
})
}
export default request

36
utils/share.js Normal file
View File

@@ -0,0 +1,36 @@
export default {
data() {
return {
//设置默认的分享参数
share: {
title: 'jnpf快速开放平台',
path: '/pages/index/index',
imageUrl: '',
desc: '',
content: ''
}
}
},
//#ifdef MP-WEIXIN
onShareAppMessage(res) {
return {
title: this.share.title,
path: this.share.path,
imageUrl: this.share.imageUrl,
desc: this.share.desc,
content: this.share.content,
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
}
}
//#endif
}

148
utils/useDefineSetting.ts Normal file
View File

@@ -0,0 +1,148 @@
export const useDefineSetting = () => {
const flowStatusList = [
{ id: 0, fullName: '待提交' },
{ id: 1, fullName: '进行中' },
{ id: 2, fullName: '已通过' },
{ id: 3, fullName: '已拒绝' },
{ id: 4, fullName: '已终止' },
{ id: 5, fullName: '已暂停' },
{ id: 7, fullName: '已撤销' },
{ id: 8, fullName: '已退回' },
{ id: 9, fullName: '已撤回' },
];
const flowUrgentList = [
{ id: 1, fullName: '普通' },
{ id: 2, fullName: '重要' },
{ id: 3, fullName: '紧急' },
];
function getUrgentText(value) {
if (value == 2) return '重要';
if (value == 3) return '紧急';
return '普通';
}
function getUrgentTextColor(value) {
if (value == 2) return '#E6A23D';
if (value == 3) return '#FF1818';
return '#1890FF';
}
function getFlowStatusContent(value = 0) {
return flowStatusList.filter((o) => o.id == value)[0]?.fullName || '';
}
function getFlowStatusColor(value) {
if (value == 1) return '#0177FF';
if (value == 2) return 'rgba(35,162,5,0.39)';
if (value == 3) return 'rgba(242,68,68,0.39)';
if (value == 4) return 'rgba(241,61,61,0.85)';
if (value == 5) return 'rgba(185,123,6,0.39)';
if (value == 6) return 'rgba(215,149,77,0.39)';
if (value == 7) return 'rgba(245,127,0,0.39)';
if (value == 8) return 'rgba(21,21,157,0.39)';
if (value == 9) return 'rgba(186,33,33,0.39)';
return '#F09437';
}
function getHandlingStatusContent(value) {
if (value == 1) return '流转';
if (value == 2) return '加签';
if (value == 3) return '转审';
if (value == 4) return '指派';
if (value == 5) return '退回';
if (value == 6) return '撤回';
if (value == 7) return '协办';
if (value == 8) return '撤销';
if (value == 9) return '转办';
return '待签收';
}
function getHandlingStatusColor(value) {
if (value == 1) return '#3DC60A';
if (value == 2) return 'rgba(25,185,185,0.39)';
if (value == 3) return 'rgba(49,151,214,0.39)';
if (value == 4) return 'rgba(255,0,0,0.39)';
if (value == 5) return 'rgba(21,21,157,0.39)';
if (value == 6) return 'rgba(186,33,33,0.39)';
if (value == 7) return 'rgba(172,214,58,0.39)';
if (value == 8) return 'rgba(245,127,0,0.39)';
if (value == 9) return 'rgba(186,33,33,0.39)';
return '#2B6EF2';
}
function getFlowStateContent(value) {
const stateList = [
'拒绝',
'同意',
'发起',
'退回',
'撤回',
'加签',
'减签',
'转审',
'暂停',
'恢复',
'复活',
'指派',
'催办',
'协办',
'撤销申请',
'终止',
'同意撤销',
'拒绝撤销',
'转办',
];
if (value == -1) return '待审批';
if (value == -2) return '未审批';
if (value == -3) return '待办理';
if (value == -4) return '未办理';
return stateList[value] || '';
}
function getFlowStateColor(value) {
const colorList = [
'rgba(242,68,68,0.39)',
'rgba(35,162,5,0.39)',
'rgba(0,0,255,0.39)',
'rgba(21,21,157,0.39)',
'rgba(186,33,33,0.39)',
'rgba(25,185,185,0.39)',
'rgba(50,191,61,0.39)',
'rgba(49,151,214,0.39)',
'rgba(185,123,6,0.39)',
'rgba(45,94,186,0.39)',
'rgba(50,191,61,0.39)',
'rgba(255,0,0,0.39)',
'rgba(0,128,0,0.39)',
'rgba(172,214,58,0.39)',
'rgba(245,127,0,0.39)',
'rgba(241,61,61,0.85)',
'rgba(35,162,5,0.39)',
'rgba(242,68,68,0.39)',
'rgba(49,151,214,0.39)',
];
let set = new Set([-1, -2, -3, -4]);
if (set.has(value)) return 'rgba(165,168,172,1)';
return colorList[value] || '';
}
function getHexColor(color) {
let values = color
.replace(/rgba?\(/, '')
.replace(/\)/, '')
.replace(/[\s+]/g, '')
.split(',');
let a = parseFloat(values[3] || 1),
r = Math.floor(a * parseInt(values[0]) + (1 - a) * 255),
g = Math.floor(a * parseInt(values[1]) + (1 - a) * 255),
b = Math.floor(a * parseInt(values[2]) + (1 - a) * 255);
return '#' + ('0' + r.toString(16)).slice(-2) + ('0' + g.toString(16)).slice(-2) + ('0' + b.toString(16)).slice(-2);
}
return {
flowStatusList,
flowUrgentList,
getUrgentText,
getUrgentTextColor,
getFlowStatusContent,
getFlowStatusColor,
getHandlingStatusContent,
getHandlingStatusColor,
getFlowStateContent,
getFlowStateColor,
getHexColor,
};
};