1、迁移部分全局挂在的方法
2、安装moment.js
This commit is contained in:
parent
2053ebbdc2
commit
3e22e5bd93
@ -39,6 +39,7 @@
|
||||
"image-conversion": "2.1.1",
|
||||
"js-cookie": "3.0.5",
|
||||
"jsencrypt": "3.3.2",
|
||||
"moment": "^2.24.0",
|
||||
"nprogress": "0.2.0",
|
||||
"pinia": "3.0.2",
|
||||
"screenfull": "6.0.2",
|
||||
|
@ -46,6 +46,7 @@ ElDialog.props.closeOnClickModal.default = false;
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
/*app.component('MyComponent', MyComponent)*/
|
||||
app.use(HighLight);
|
||||
app.use(ElementIcons);
|
||||
app.use(router);
|
||||
|
@ -9,7 +9,18 @@ import animate from '@/animate';
|
||||
import { download as dl } from '@/utils/request';
|
||||
import { useDict } from '@/utils/dict';
|
||||
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
|
||||
import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi';
|
||||
import {
|
||||
parseTime,
|
||||
addDateRange,
|
||||
handleTree,
|
||||
selectDictLabel,
|
||||
selectDictLabels,
|
||||
addDateRange2,
|
||||
addDateRange3,
|
||||
resetForm,
|
||||
getHiddenName,
|
||||
getHiddenDetailAddress
|
||||
} from '@/utils/ruoyi';
|
||||
|
||||
import { App } from 'vue';
|
||||
|
||||
@ -40,4 +51,9 @@ export default function installPlugin(app: App) {
|
||||
app.config.globalProperties.selectDictLabel = selectDictLabel;
|
||||
app.config.globalProperties.selectDictLabels = selectDictLabels;
|
||||
app.config.globalProperties.animate = animate;
|
||||
app.config.globalProperties.addDateRange3 = addDateRange3;
|
||||
app.config.globalProperties.resetForm = resetForm;
|
||||
app.config.globalProperties.addDateRange2 = addDateRange2;
|
||||
app.config.globalProperties.getHiddenName = getHiddenName;
|
||||
app.config.globalProperties.getHiddenDetailAddress = getHiddenDetailAddress;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import moment from 'moment';
|
||||
// 日期格式化
|
||||
export function parseTime(time: any, pattern?: string) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
@ -63,6 +64,39 @@ export const addDateRange = (params: any, dateRange: any[], propName?: string) =
|
||||
return search;
|
||||
};
|
||||
|
||||
export function addDateRange2(params, dateRange, addDay = true) {
|
||||
const search = params;
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : [];
|
||||
if (addDay) {
|
||||
search['beginTime'] = dateRange[0];
|
||||
search['endTime'] = moment(dateRange[1]).add(1, 'days').format('yyyy-MM-DD');
|
||||
} else {
|
||||
search['beginTime'] = dateRange[0];
|
||||
search['endTime'] = dateRange[1];
|
||||
}
|
||||
return search;
|
||||
}
|
||||
|
||||
export function addDateRange3(params, dateRange, addDay = true) {
|
||||
const search = params;
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : [];
|
||||
if (addDay) {
|
||||
search['beginTime'] = dateRange[0] + ' 00:00:00';
|
||||
search['endTime'] = moment(dateRange[1]).add(1, 'days').format('yyyy-MM-DD') + ' 00:00:00';
|
||||
} else {
|
||||
search['beginTime'] = dateRange[0] + ' 00:00:00';
|
||||
search['endTime'] = dateRange[1] + ' 00:00:00';
|
||||
}
|
||||
return search;
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
export function resetForm(refName) {
|
||||
if (this.$refs[refName]) {
|
||||
this.$refs[refName].resetFields();
|
||||
}
|
||||
}
|
||||
|
||||
// 回显数据字典
|
||||
export const selectDictLabel = (datas: any, value: number | string) => {
|
||||
if (value === undefined) {
|
||||
@ -231,6 +265,36 @@ export const blobValidate = (data: any) => {
|
||||
return data.type !== 'application/json';
|
||||
};
|
||||
|
||||
/**
|
||||
* 姓名隐藏,只展示第一位,其余替换为 *
|
||||
*/
|
||||
export function getHiddenName(data) {
|
||||
if (!data) return '';
|
||||
const surname = data.substr(0, 1);
|
||||
const star = '*'.repeat(data.length - 1);
|
||||
return surname + star;
|
||||
}
|
||||
|
||||
/**
|
||||
* 详细地址隐藏数字包含中文数字,替换为 *
|
||||
*/
|
||||
export function getHiddenDetailAddress(data) {
|
||||
const chineseNumbers = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
|
||||
if (!data || data.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const tempResult = data.replace(/\d/g, '*');
|
||||
let result = '';
|
||||
for (let i = 0; i < tempResult.length; i++) {
|
||||
if (chineseNumbers.includes(tempResult[i])) {
|
||||
result += '*';
|
||||
} else {
|
||||
result += tempResult[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export default {
|
||||
handleTree
|
||||
};
|
||||
|
@ -391,7 +391,7 @@ export default {
|
||||
this.open = true;
|
||||
},
|
||||
confirmReceive(orderId, type) {
|
||||
this.$confirm(`您确认收到售后单号为【${order.id}】的货物了吗?`, '温馨提示', { type: 'warning' }).then(() => {
|
||||
this.$confirm(`您确认收到售后单号为【${orderId}】的货物了吗?`, '温馨提示', { type: 'warning' }).then(() => {
|
||||
this.updateOrderForm.orderId = orderId;
|
||||
this.updateOrderForm.optType = type;
|
||||
dealWithAftersale(this.updateOrderForm).then((response) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user