123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- module.exports = {
- timefilter(type, value) {
- if (this.$isNull(value)) return
- var newDate = ""
- if (String(value).indexOf("-") != -1) {
- newDate = new Date(value.replace(/-/g, "/"))
- } else {
- newDate = new Date(Number(value))
- }
- var hours = newDate.getHours().toString()
- var minutes = newDate.getMinutes().toString()
- var seconds = newDate.getSeconds().toString()
- var year = newDate.getFullYear().toString();
- var month = (newDate.getMonth() + 1).toString();
- var day = (newDate.getDate()).toString();
- if (month.length == 1) {
- month = "0" + month;
- }
- if (day.length == 1) {
- day = "0" + day;
- }
- if (hours.length == 1) {
- hours = "0" + hours;
- }
- if (minutes.length == 1) {
- minutes = "0" + minutes;
- }
- if (seconds.length == 1) {
- seconds = "0" + seconds;
- }
- if (type == 'YY-MM-DD HH:MM:SS') {
- return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
- } else if (type == 'HH:MM') {
- return hours + ':' + minutes
- } else if (type == 'HH:MM:SS') {
- return hours + ':' + minutes + ':' + seconds
- } else if (type == 'YY-MM-DD') {
- return year + '-' + month + '-' + day
- } else if (type == 'YY-MM-DD HH:MM') {
- return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes
- } else if (type == '年月日 HH:MM:SS') {
- return year + '年' + month + '月' + day + '日 ' + hours + ':' + minutes + ':' + seconds
- }
- else if (type == '年月日') {
- return year + '年' + month + '月' + day + '日 '
- }
- },
- isNull(param) {
- if (typeof param == "boolean") {
- return false;
- }
- if (param == null || param == undefined || param == '') {
- return true;
- }
- return false;
- },
- formatPhone(e) {
- if (e == '') return
- var tel = e;
- tel = "" + tel;
- var newTel = tel.substr(0, 3) + "****" + tel.substr(7)
- return newTel
- },
- formatName(e) {
-
- if (e == '') return
- if (e != null || e != undefined) {
- var name = e;
- if (name.length > 1) {
- name = "" + name;
- var newName = name.substr(0, 1) + "*" + name.substr(2,name.length-1)
- return newName
- }
-
- else {
- return name
- }
-
- } else {
- return e
- }
-
-
-
- },
- }
|