测试bug修改
This commit is contained in:
parent
82bab0ea11
commit
21455a9258
|
|
@ -238,4 +238,71 @@ export function formatDate(dateStr) {
|
|||
const day = match[3].padStart(2, '0'); // 日期补零
|
||||
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
// 将中文日期(包括毕业证书上的日期)转换为yyyy-MM-dd格式
|
||||
export function convertChineseDate(chineseDate) {
|
||||
if (!chineseDate) return '';
|
||||
|
||||
const chineseNumbers = {
|
||||
'〇': '0', '○': '0', '零': '0', '○': '0',
|
||||
'一': '1', '二': '2', '三': '3', '四': '4', '五': '5',
|
||||
'六': '6', '七': '7', '八': '8', '九': '9', '十': '10'
|
||||
};
|
||||
|
||||
const monthMap = {
|
||||
'一': '01', '二': '02', '三': '03', '四': '04', '五': '05', '六': '06',
|
||||
'七': '07', '八': '08', '九': '09', '十': '10', '十一': '11', '十二': '12',
|
||||
'1': '01', '2': '02', '3': '03', '4': '04', '5': '05', '6': '06',
|
||||
'7': '07', '8': '08', '9': '09', '10': '10', '11': '11', '12': '12'
|
||||
};
|
||||
|
||||
try {
|
||||
let dateStr = chineseDate.toString();
|
||||
|
||||
// 处理年份中的中文数字
|
||||
let yearPart = dateStr.split('年')[0];
|
||||
let convertedYear = '';
|
||||
for (let char of yearPart) {
|
||||
convertedYear += chineseNumbers[char] || char;
|
||||
}
|
||||
|
||||
// 提取月日部分
|
||||
const monthDayPart = dateStr.split('年')[1];
|
||||
if (!monthDayPart) return chineseDate;
|
||||
|
||||
const monthMatch = monthDayPart.match(/(.+?)月/);
|
||||
const dayMatch = monthDayPart.match(/(\d+|[一二三四五六七八九十]+)日/);
|
||||
|
||||
const year = convertedYear;
|
||||
let month = monthMatch ? (monthMap[monthMatch[1]] || monthMatch[1].padStart(2, '0')) : '01';
|
||||
let day = '01';
|
||||
|
||||
// 处理日
|
||||
if (dayMatch) {
|
||||
let dayStr = dayMatch[1];
|
||||
// 转换中文日
|
||||
if (isNaN(dayStr)) {
|
||||
if (dayStr === '十') day = '10';
|
||||
else if (dayStr.startsWith('十')) day = '1' + (chineseNumbers[dayStr[1]] || '0');
|
||||
else if (dayStr.endsWith('十')) day = (chineseNumbers[dayStr[0]] || '0') + '0';
|
||||
else day = dayStr.split('').map(char => chineseNumbers[char] || char).join('');
|
||||
} else {
|
||||
day = dayStr;
|
||||
}
|
||||
day = day.padStart(2, '0');
|
||||
}
|
||||
|
||||
// 验证日期有效性
|
||||
const finalDate = `${year}-${month}-${day}`;
|
||||
if (!isNaN(new Date(finalDate).getTime())) {
|
||||
return finalDate;
|
||||
}
|
||||
|
||||
return chineseDate;
|
||||
|
||||
} catch (error) {
|
||||
console.error('日期转换错误:', error);
|
||||
return chineseDate;
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
|||
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
timeout: 60000 * 2,
|
||||
timeout: 60000 * 4,
|
||||
})
|
||||
|
||||
// 判断是否为二进制数据(File/Blob)
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@
|
|||
<script>
|
||||
import UploadFile from '@/views/common/UploadFile.vue'
|
||||
import { validMobile, validIdCard } from '@/utils/validate'
|
||||
import {convertChineseDate} from '@/utils/bonus'
|
||||
export default {
|
||||
name: 'BasicInfoPersonnel',
|
||||
dicts: ['personnel_position', 'identification_tag'],
|
||||
|
|
@ -289,7 +290,12 @@ export default {
|
|||
Object.keys(chat_res).forEach(key => {
|
||||
const formField = this.ocrResultParams[key];
|
||||
if (formField && chat_res[key]) {
|
||||
this.form[formField] = chat_res[key];
|
||||
if (formField === 'graduationDate') {
|
||||
// 单独处理毕业日期
|
||||
this.form[formField] = convertChineseDate(chat_res[key]);
|
||||
} else {
|
||||
this.form[formField] = chat_res[key];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@ export default {
|
|||
flex: 1;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.el-dropdown-link {
|
||||
|
|
@ -238,6 +239,7 @@ export default {
|
|||
.category-name {
|
||||
color: #1F72EA;
|
||||
font-weight: 500;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
i {
|
||||
|
|
|
|||
|
|
@ -126,11 +126,12 @@ export default {
|
|||
|
||||
/** 修改操作 */
|
||||
handleUpdate(row) {
|
||||
|
||||
this.$router.push({
|
||||
name: 'TechnicalEdit',
|
||||
query: {
|
||||
enterpriseId: encryptWithSM4(this.enterpriseId || '0'),
|
||||
technicalSolutionTypeId: encryptWithSM4(this.value || '0'),
|
||||
technicalSolutionTypeId: encryptWithSM4(this.value + '' || '0'),
|
||||
type: encryptWithSM4('edit'),
|
||||
technicalSolutionId: encryptWithSM4(row.technicalSolutionId + '' || '0'),
|
||||
}
|
||||
|
|
@ -138,7 +139,6 @@ export default {
|
|||
},
|
||||
/** 查看操作 */
|
||||
handleDetail(row) {
|
||||
console.log(row);
|
||||
|
||||
this.$router.push({
|
||||
name: 'TechnicalDetail',
|
||||
|
|
|
|||
Loading…
Reference in New Issue