This commit is contained in:
孟帅
2023-10-21 18:02:24 +08:00
parent d2d18dd69a
commit 088203c1cb
24 changed files with 497 additions and 514 deletions

View File

@@ -1,84 +1,93 @@
<template>
<n-date-picker v-bind="$props" v-model:value="modelValue" :shortcuts="shortcuts" />
<n-date-picker v-bind="$props" v-model:value="modelValue" :shortcuts="shortcuts" :clearable="true"/>
</template>
<script lang="ts">
import { computed, defineComponent, onMounted, ref } from 'vue';
import {
dateToTimestamp,
formatToDate,
formatToDateTime,
timestampToTime,
defShortcuts,
defRangeShortcuts,
} from '@/utils/dateUtil';
import { basicProps } from './props';
import { computed, defineComponent, onMounted, ref } from 'vue';
import {
dateToTimestamp,
formatToDate,
formatToDateTime,
timestampToTime,
defShortcuts,
defRangeShortcuts,
} from '@/utils/dateUtil';
import { basicProps } from './props';
export default defineComponent({
name: 'BasicUpload',
props: {
...basicProps,
},
emits: ['update:formValue', 'update:startValue', 'update:endValue'],
setup(props, { emit }) {
const shortcuts = ref<any>({});
export default defineComponent({
name: 'BasicUpload',
props: {
...basicProps,
},
emits: ['update:formValue', 'update:startValue', 'update:endValue'],
setup(props, { emit }) {
const shortcuts = ref<any>({});
function getTimestamp(value) {
let t = dateToTimestamp(value);
if (t === 0) {
return new Date().getTime();
}
return t;
function getTimestamp(value) {
let t = dateToTimestamp(value);
if (t === 0) {
return new Date().getTime();
}
return t;
}
function setTimestamp(value) {
if (!isTimeType()) {
return formatToDate(new Date(Number(value)).toDateString());
} else {
return formatToDateTime(timestampToTime(Number(value / 1000)));
}
function setTimestamp(value) {
if (!isTimeType()) {
return formatToDate(new Date(Number(value)).toDateString());
} else {
return formatToDateTime(timestampToTime(Number(value / 1000)));
}
}
function isRangeType() {
return props.type.indexOf('range') != -1;
}
function isRangeType() {
return props.type.indexOf('range') != -1;
}
function isTimeType() {
return props.type.indexOf('time') != -1;
}
function isTimeType() {
return props.type.indexOf('time') != -1;
}
const modelValue = computed({
get() {
if (!isRangeType()) {
return getTimestamp(props.formValue);
} else {
return [getTimestamp(props.startValue), getTimestamp(props.endValue)];
}
},
set(value) {
if (!isRangeType()) {
const modelValue = computed({
get() {
if (!isRangeType()) {
const value = getTimestamp(props.formValue);
if (props.formValue == ""){
emit('update:formValue', setTimestamp(value));
} else {
}
return value;
} else {
const value = [getTimestamp(props.startValue), getTimestamp(props.endValue)];
if (props.startValue == "" && props.endValue == ""){
emit('update:startValue', setTimestamp(value[0]));
emit('update:endValue', setTimestamp(value[1]));
}
},
});
onMounted(async () => {
if (!isRangeType()) {
shortcuts.value = defShortcuts();
} else {
shortcuts.value = defRangeShortcuts();
return value
}
});
},
set(value) {
if (!isRangeType()) {
emit('update:formValue', setTimestamp(value));
} else {
emit('update:startValue', setTimestamp(value[0]));
emit('update:endValue', setTimestamp(value[1]));
}
},
});
return {
modelValue,
shortcuts,
};
},
});
onMounted(async () => {
if (!isRangeType()) {
shortcuts.value = defShortcuts();
} else {
shortcuts.value = defRangeShortcuts();
}
});
return {
modelValue,
shortcuts,
};
},
});
</script>
<style lang="less"></style>

View File

@@ -198,7 +198,7 @@
<!--导航卡片-->
<div class="mt-4">
<n-grid cols="1 s:2 m:3 l:8 xl:8 2xl:8" responsive="screen" :x-gap="16" :y-gap="8">
<n-grid-item v-for="(item, index) in iconList" :key="index">
<n-grid-item v-for="(item, index) in iconList" :key="index" @click="item.eventObject || {}">
<NCard content-style="padding-top: 0;" size="small" :bordered="false">
<template #footer>
<n-skeleton v-if="loading" size="medium" />
@@ -226,6 +226,7 @@
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { getConsoleInfo } from '@/api/dashboard/console';
import VisiTab from './components/VisiTab.vue';
import { CountTo } from '@/components/CountTo/index';
@@ -247,6 +248,7 @@
const saleroom = ref<any>({});
const orderLarge = ref<any>({});
const volume = ref({});
const router = useRouter();
// 图标列表
const iconList = [
@@ -256,7 +258,7 @@
title: '用户',
color: '#69c0ff',
eventObject: {
click: () => {},
click: () => router.push({ name: 'user' }),
},
},
{

View File

@@ -13,10 +13,9 @@
:row-key="(row) => row.id"
ref="actionRef"
:canResize="true"
:resizeHeightOffset="-20000"
:pagination="false"
:scroll-x="1090"
:scrollbar-props="{ trigger: 'none' }"
:scroll-x="3000"
:scroll-y="720"
>
<template #tableTitle>
<n-tooltip placement="top-start" trigger="hover">

View File

@@ -106,6 +106,7 @@
import { statusOptions } from '@/enums/optionsiEnum';
import { TypeSelect } from '@/api/sys/config';
import { Option } from '@/utils/hotgo';
import {cloneDeep} from "lodash-es";
const options = ref<Option>();
interface Props {
checkedId?: number;
@@ -292,7 +293,7 @@
function handleEdit(record: Recordable) {
showModal.value = true;
formParams.value = record;
formParams.value = cloneDeep(record);
}
function handleSubmit(_values: Recordable) {