From 8172078620b09aec0798309dafdf172efc0340dc Mon Sep 17 00:00:00 2001 From: lrw <319150264@qq.com> Date: Tue, 9 May 2023 16:12:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=9B=E6=9F=A5=E5=9C=BA=E6=99=AF=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=84=8F=E8=A7=81=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.js | 62 ++++++++++++++++--- src/views/followupquery/FollowUpDetail.vue | 8 +++ .../followupquery/components/FollowReview.vue | 16 +++-- src/views/followupquery/index.vue | 20 ++++-- src/views/followupresearch/index.vue | 17 +++-- src/views/screening/index.vue | 18 +++++- 6 files changed, 114 insertions(+), 27 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index dc2d158..43759a9 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -153,7 +153,7 @@ export function getInfoByIdCard(idCard, type = "birthDate") { d.getFullYear() - birthdays.getFullYear() - (d.getMonth() < birthdays.getMonth() || - (d.getMonth() == birthdays.getMonth() && d.getDate() < birthdays.getDate()) + (d.getMonth() == birthdays.getMonth() && d.getDate() < birthdays.getDate()) ? 1 : 0) @@ -182,12 +182,12 @@ export function paramObj(url) { } return JSON.parse( '{"' + - decodeURIComponent(search) - .replace(/"/g, '\\"') - .replace(/&/g, '","') - .replace(/=/g, '":"') - .replace(/\+/g, " ") + - '"}' + decodeURIComponent(search) + .replace(/"/g, '\\"') + .replace(/&/g, '","') + .replace(/=/g, '":"') + .replace(/\+/g, " ") + + '"}' ) } @@ -522,7 +522,51 @@ export function changeTime(time) { let seconds = Math.floor(time % 60) //秒 return `${day ? day + "天" : ""} ${hours ? hours + "小时" : ""}${ minutes ? minutes + "分" : "" - }${seconds}秒` + }${seconds}秒` } -export default { formatDicList, excelExport } +/** + * 数字转中文(万亿一下) + * @export + * @param num + * @returns {string} + */ +export function toChineseNumber(num) { + const str = num + .toString() + .replace(/(?=(\d{4})+$)/g, ",") + .split(",") + .filter(Boolean) + const chars = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"] + const units = ["", "十", "百", "千"] + const bigUnits = ["", "万", "亿"] + function _transform(numStr) { + let result = "" + for (let i = 0; i < numStr.length; i++) { + const digit = +numStr[i] + const c = chars[digit] + const u = units[numStr.length - 1 - i] + if (digit === 0) { + if (result[result.length - 1] !== chars[0]) { + result += c + } + } else { + result += c + u + } + } + if (result[result.length - 1] === chars[0]) { + result = result.slice(0, -1) + } + return result + } + let result = "" + for (let i = 0; i < str.length; i++) { + const part = str[i] + const c = _transform(part) + const u = c ? bigUnits[str.length - 1 - i] : "" + result += c + u + } + return result +} + +export default { formatDicList, excelExport, toChineseNumber } diff --git a/src/views/followupquery/FollowUpDetail.vue b/src/views/followupquery/FollowUpDetail.vue index afc204d..ffa5171 100644 --- a/src/views/followupquery/FollowUpDetail.vue +++ b/src/views/followupquery/FollowUpDetail.vue @@ -5,6 +5,8 @@ titlePosition="top" @update="update" > + +