feat: 部分组件调整

This commit is contained in:
baiqi 2023-07-19 11:32:39 +08:00 committed by 刘瑞斌
parent 025965b4ee
commit aaf949113e
4 changed files with 52 additions and 29 deletions

View File

@ -1,4 +1,5 @@
<template> <template>
<a-spin style="display: block" :loading="props.loading">
<div class="relative h-full"> <div class="relative h-full">
<div class="card-header"> <div class="card-header">
<div class="back-btn" @click="back"><icon-arrow-left /></div> <div class="back-btn" @click="back"><icon-arrow-left /></div>
@ -24,6 +25,7 @@
</slot> </slot>
</div> </div>
</div> </div>
</a-spin>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -36,6 +38,7 @@
hideContinue?: boolean; hideContinue?: boolean;
handleBack?: () => void; handleBack?: () => void;
hideFooter?: boolean; hideFooter?: boolean;
loading?: boolean;
}>(), }>(),
{ {
hideContinue: false, hideContinue: false,

View File

@ -1,9 +1,9 @@
<template> <template>
<a-descriptions :data="props.descriptions" size="large" :column="1"> <a-descriptions :data="(props.descriptions as unknown as DescData[])" size="large" :column="1">
<a-descriptions-item v-for="item of props.descriptions" :key="item.label" :label="item.label"> <a-descriptions-item v-for="item of props.descriptions" :key="item.label" :label="item.label">
<template v-if="item.isTag"> <template v-if="item.isTag">
<a-tag <a-tag
v-for="tag of item.value.split(',')" v-for="tag of item.value"
:key="tag" :key="tag"
color="var(--color-text-n8)" color="var(--color-text-n8)"
class="mr-[8px] font-normal !text-[var(--color-text-1)]" class="mr-[8px] font-normal !text-[var(--color-text-1)]"
@ -11,19 +11,32 @@
{{ tag }} {{ tag }}
</a-tag> </a-tag>
</template> </template>
<div v-else>{{ item.value }}</div> <a-button v-else-if="item.isButton" type="text" @click="handleItemClick(item)">{{ item.value }}</a-button>
<div v-else>
{{ item.value }}
</div>
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { DescData } from '@arco-design/web-vue';
export interface Description { export interface Description {
label: string; label: string;
value: string; value: (string | number) | (string | number)[];
isTag?: boolean; isTag?: boolean;
isButton?: boolean;
onClick?: () => void;
} }
const props = defineProps<{ descriptions: Description[] }>(); const props = defineProps<{ descriptions: Description[] }>();
function handleItemClick(item: Description) {
if (typeof item.onClick === 'function') {
item.onClick();
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -7,6 +7,7 @@
:class="props.mask ? '' : 'ms-drawer-no-mask'" :class="props.mask ? '' : 'ms-drawer-no-mask'"
@ok="handleOk" @ok="handleOk"
@cancel="handleCancel" @cancel="handleCancel"
@close="handleCancel"
> >
<template #title> <template #title>
<slot name="title"> <slot name="title">
@ -37,11 +38,13 @@
titleTagColor?: string; titleTagColor?: string;
descriptions?: Description[]; descriptions?: Description[];
footer?: boolean; footer?: boolean;
mask?: boolean;
[key: string]: any; [key: string]: any;
} }
const props = withDefaults(defineProps<DrawerProps>(), { const props = withDefaults(defineProps<DrawerProps>(), {
footer: true, footer: true,
mask: true,
}); });
const emit = defineEmits(['update:visible']); const emit = defineEmits(['update:visible']);

View File

@ -198,8 +198,12 @@
const projectList: Ref<ProjectListItem[]> = ref([]); const projectList: Ref<ProjectListItem[]> = ref([]);
onBeforeMount(async () => { onBeforeMount(async () => {
try {
const res = await getProjectList(appStore.getCurrentOrgId); const res = await getProjectList(appStore.getCurrentOrgId);
projectList.value = res; projectList.value = res;
} catch (error) {
console.log(error);
}
}); });
const showProjectSelect = computed(() => { const showProjectSelect = computed(() => {