同步操作将从 zuohuaijun/Admin.NET 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
// 通用函数import useClipboard from 'vue-clipboard3';import { ElMessage } from 'element-plus';import { formatDate } from '/@/utils/formatTime';import { useI18n } from 'vue-i18n';export default function () {const { t } = useI18n();const { toClipboard } = useClipboard();// 百分比格式化const percentFormat = (row: EmptyArrayType, column: number, cellValue: string) => {return cellValue ? `${cellValue}%` : '-';};// 列表日期时间格式化const dateFormatYMD = (row: EmptyArrayType, column: number, cellValue: string) => {if (!cellValue) return '-';return formatDate(new Date(cellValue), 'YYYY-mm-dd');};// 列表日期时间格式化const dateFormatYMDHMS = (row: EmptyArrayType, column: number, cellValue: string) => {if (!cellValue) return '-';return formatDate(new Date(cellValue), 'YYYY-mm-dd HH:MM:SS');};// 列表日期时间格式化const dateFormatHMS = (row: EmptyArrayType, column: number, cellValue: string) => {if (!cellValue) return '-';let time = 0;if (typeof row === 'number') time = row;if (typeof cellValue === 'number') time = cellValue;return formatDate(new Date(time * 1000), 'HH:MM:SS');};// 小数格式化const scaleFormat = (value: string = '0', scale: number = 4) => {return Number.parseFloat(value).toFixed(scale);};// 小数格式化const scale2Format = (value: string = '0') => {return Number.parseFloat(value).toFixed(2);};// 点击复制文本const copyText = (text: string) => {return new Promise((resolve, reject) => {try {//复制toClipboard(text);//下面可以设置复制成功的提示框等操作ElMessage.success(t('message.layout.copyTextSuccess'));resolve(text);} catch (e) {//复制失败ElMessage.error(t('message.layout.copyTextError'));reject(e);}});};// 去掉Html标签(取前面5个字符)const removeHtmlSub = (value: string) => {var str = value.replace(/<[^>]+>/g, '');if (str.length > 50) return str.substring(0, 50) + '......';else return str;};// 去掉Html标签const removeHtml = (value: string) => {return value.replace(/<[^>]+>/g, '');};return {percentFormat,dateFormatYMD,dateFormatYMDHMS,dateFormatHMS,scaleFormat,scale2Format,copyText,removeHtmlSub,removeHtml,};}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。