|
|
@@ -56,6 +56,7 @@ export function dateFormat(date, format) {
|
|
|
* type 1为 [yyyy-MM-dd,yyyy-MM-dd]
|
|
|
* type 2为 [yyyy-MM-dd 00:00:00,yyyy-MM-dd 23:59:59]
|
|
|
* type 4为 [yyyy-MM-dd,yyyy-MM-dd] 当月的第一天和最后一天
|
|
|
+ * type 5为 [yyyy-MM-dd,yyyy-MM-dd] 前三个月的第一天和后三个月最后一天
|
|
|
* type为空默认2
|
|
|
*/
|
|
|
export function defaultDate(type) {
|
|
|
@@ -78,6 +79,11 @@ export function defaultDate(type) {
|
|
|
dateFormat(new Date(date.getFullYear(), date.getMonth(), 1), "yyyy-MM-dd"),
|
|
|
dateFormat(new Date(date.getFullYear(), date.getMonth() + 1, 0), "yyyy-MM-dd")
|
|
|
];
|
|
|
+ } else if (type == 5) {
|
|
|
+ return [
|
|
|
+ dateFormat(new Date(date.getFullYear(), date.getMonth() - 3, 1), "yyyy-MM-dd") + " 00:00:00",
|
|
|
+ dateFormat(new Date(date.getFullYear(), date.getMonth() + 4, 0), "yyyy-MM-dd") + " 23:59:59"
|
|
|
+ ];
|
|
|
} else {
|
|
|
return [
|
|
|
dateFormat(startDate, "yyyy-MM-dd") + " 00:00:00",
|
|
|
@@ -282,53 +288,53 @@ export function checkFullWidthSymbols_bak(text) {
|
|
|
}
|
|
|
// wfg
|
|
|
export function checkFullWidthSymbols(text) {
|
|
|
- if (text) {
|
|
|
- const fullWidthRegex = /[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u3400-\u4dbf]/g;
|
|
|
- const matchesItem = [];
|
|
|
- // TAB 键转为空格
|
|
|
- let lines = text.trimEnd().replaceAll("\t", " ").split('\n')
|
|
|
- let match;
|
|
|
- lines.forEach((ln, index, array) => {
|
|
|
- ln=ln.trimEnd();
|
|
|
- lines[index]=ln
|
|
|
- while ((match = fullWidthRegex.exec(ln)) !== null) {
|
|
|
- matchesItem.push({
|
|
|
- row: index + 1, // 行号
|
|
|
- index: match.index, // 符号的位置
|
|
|
- symbol: match[0], // 符号本身
|
|
|
- input: match.input // 行
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- let resetText = lines.join("\n")
|
|
|
- let isResetText = resetText != text
|
|
|
- let message=[]
|
|
|
- matchesItem.forEach(m=>{
|
|
|
- message.push(`第 ${m.row} 行第 ${m.index} 个字符 ${m.symbol} 不符合要求,存在全角字符或汉字等!`)
|
|
|
- })
|
|
|
- return {
|
|
|
- hasFullWidth: matchesItem.length > 0, // 是否包含全角符号
|
|
|
- positions: matchesItem, // 符号的详细位置和内容
|
|
|
- message: message.join("<br>"),
|
|
|
- isResetText: isResetText, // 是否重设文本
|
|
|
- resetText: resetText, // 重设的文本
|
|
|
- };
|
|
|
- } else {
|
|
|
- return {
|
|
|
- hasFullWidth: false, // 是否包含全角符号
|
|
|
- positions: [], // 符号的详细位置和内容
|
|
|
- message: "",
|
|
|
- isResetText:false, // 是否重设文本
|
|
|
- resetText: "", // 重设的文本
|
|
|
- };
|
|
|
- }
|
|
|
+ if (text) {
|
|
|
+ const fullWidthRegex = /[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u3400-\u4dbf]/g;
|
|
|
+ const matchesItem = [];
|
|
|
+ // TAB 键转为空格
|
|
|
+ let lines = text.trimEnd().replaceAll("\t", " ").split('\n')
|
|
|
+ let match;
|
|
|
+ lines.forEach((ln, index, array) => {
|
|
|
+ ln = ln.trimEnd();
|
|
|
+ lines[index] = ln
|
|
|
+ while ((match = fullWidthRegex.exec(ln)) !== null) {
|
|
|
+ matchesItem.push({
|
|
|
+ row: index + 1, // 行号
|
|
|
+ index: match.index, // 符号的位置
|
|
|
+ symbol: match[0], // 符号本身
|
|
|
+ input: match.input // 行
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let resetText = lines.join("\n")
|
|
|
+ let isResetText = resetText != text
|
|
|
+ let message = []
|
|
|
+ matchesItem.forEach(m => {
|
|
|
+ message.push(`第 ${m.row} 行第 ${m.index} 个字符 ${m.symbol} 不符合要求,存在全角字符或汉字等!`)
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ hasFullWidth: matchesItem.length > 0, // 是否包含全角符号
|
|
|
+ positions: matchesItem, // 符号的详细位置和内容
|
|
|
+ message: message.join("<br>"),
|
|
|
+ isResetText: isResetText, // 是否重设文本
|
|
|
+ resetText: resetText, // 重设的文本
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ hasFullWidth: false, // 是否包含全角符号
|
|
|
+ positions: [], // 符号的详细位置和内容
|
|
|
+ message: "",
|
|
|
+ isResetText: false, // 是否重设文本
|
|
|
+ resetText: "", // 重设的文本
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
//判断是否超过设置天数
|
|
|
export function overdueJudgment(date) {
|
|
|
const overDay = localStorage.getItem('lockTermDays')
|
|
|
if (overDay) {
|
|
|
- const nowDate = new Date(dateFormat(new Date(),'yyyy-MM-dd'))
|
|
|
- const startDate = new Date(dateFormat(new Date(date),'yyyy-MM-dd'))
|
|
|
+ const nowDate = new Date(dateFormat(new Date(), 'yyyy-MM-dd'))
|
|
|
+ const startDate = new Date(dateFormat(new Date(date), 'yyyy-MM-dd'))
|
|
|
startDate.setDate(startDate.getDate() + Number(overDay))
|
|
|
if (startDate < nowDate) {
|
|
|
return true
|