Merge remote-tracking branch 'yudao/dev' into dev

pull/141/head
jason 2025-06-13 22:03:31 +08:00
commit 24a703a09d
15 changed files with 60 additions and 43 deletions

View File

@ -23,6 +23,11 @@ interface DictTagProps {
const props = defineProps<DictTagProps>(); const props = defineProps<DictTagProps>();
function isHexColor(color: string) {
const reg = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
return reg.test(color);
}
/** 获取字典标签 */ /** 获取字典标签 */
const dictTag = computed(() => { const dictTag = computed(() => {
// //
@ -66,7 +71,16 @@ const dictTag = computed(() => {
</script> </script>
<template> <template>
<Tag v-if="dictTag" :color="dictTag.colorType"> <Tag
v-if="dictTag"
:color="
dictTag.colorType
? dictTag.colorType
: dictTag.cssClass && isHexColor(dictTag.cssClass)
? dictTag.cssClass
: ''
"
>
{{ dictTag.label }} {{ dictTag.label }}
</Tag> </Tag>
</template> </template>

View File

@ -43,28 +43,27 @@ const { hasAccessByCodes } = useAccess();
function isIfShow(action: ActionItem): boolean { function isIfShow(action: ActionItem): boolean {
const ifShow = action.ifShow; const ifShow = action.ifShow;
let isIfShow = true; let isIfShow = true;
if (isBoolean(ifShow)) { if (isBoolean(ifShow)) {
isIfShow = ifShow; isIfShow = ifShow;
} }
if (isFunction(ifShow)) { if (isFunction(ifShow)) {
isIfShow = ifShow(action); isIfShow = ifShow(action);
} }
if (isIfShow) {
isIfShow =
hasAccessByCodes(action.auth || []) || (action.auth || []).length === 0;
}
return isIfShow; return isIfShow;
} }
const getActions = computed(() => { const getActions = computed(() => {
return (toRaw(props.actions) || []) const actions = toRaw(props.actions) || [];
.filter((action) => { return actions
return ( .filter((action: ActionItem) => {
(hasAccessByCodes(action.auth || []) || return isIfShow(action);
(action.auth || []).length === 0) &&
isIfShow(action)
);
}) })
.map((action) => { .map((action: ActionItem) => {
const { popConfirm } = action; const { popConfirm } = action;
return { return {
type: action.type || 'link', type: action.type || 'link',
@ -78,24 +77,21 @@ const getActions = computed(() => {
}); });
const getDropdownList = computed((): any[] => { const getDropdownList = computed((): any[] => {
return (toRaw(props.dropDownActions) || []) const dropDownActions = toRaw(props.dropDownActions) || [];
.filter((action) => { return dropDownActions
return ( .filter((action: ActionItem) => {
(hasAccessByCodes(action.auth || []) || return isIfShow(action);
(action.auth || []).length === 0) &&
isIfShow(action)
);
}) })
.map((action, index) => { .map((action: ActionItem, index: number) => {
const { label, popConfirm } = action; const { label, popConfirm } = action;
delete action.icon;
return { return {
...action, ...action,
...popConfirm, ...popConfirm,
onConfirm: popConfirm?.confirm, onConfirm: popConfirm?.confirm,
onCancel: popConfirm?.cancel, onCancel: popConfirm?.cancel,
text: label, text: label,
divider: divider: index < dropDownActions.length - 1 ? props.divider : false,
index < props.dropDownActions.length - 1 ? props.divider : false,
}; };
}); });
}); });

View File

@ -1,10 +1,11 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { erpPriceMultiply } from '@vben/utils';
import { getBusinessStatusTypeSimpleList } from '#/api/crm/business/status'; import { getBusinessStatusTypeSimpleList } from '#/api/crm/business/status';
import { getCustomerSimpleList } from '#/api/crm/customer'; import { getCustomerSimpleList } from '#/api/crm/customer';
import { getSimpleUserList } from '#/api/system/user'; import { getSimpleUserList } from '#/api/system/user';
import { erpPriceMultiply } from '#/utils';
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {

View File

@ -4,6 +4,7 @@ import type { CrmBusinessApi } from '#/api/crm/business';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { erpPriceMultiply } from '@vben/utils';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
@ -15,7 +16,6 @@ import {
} from '#/api/crm/business'; } from '#/api/crm/business';
import { BizTypeEnum } from '#/api/crm/permission'; import { BizTypeEnum } from '#/api/crm/permission';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { erpPriceMultiply } from '#/utils';
import { ProductEditTable } from '#/views/crm/product'; import { ProductEditTable } from '#/views/crm/product';
import { useFormSchema } from '../data'; import { useFormSchema } from '../data';

View File

@ -1,12 +1,14 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { erpPriceMultiply, floatToFixed2 } from '@vben/utils';
import { z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getSimpleBusinessList } from '#/api/crm/business'; import { getSimpleBusinessList } from '#/api/crm/business';
import { getSimpleContactList } from '#/api/crm/contact'; import { getSimpleContactList } from '#/api/crm/contact';
import { getCustomerSimpleList } from '#/api/crm/customer'; import { getCustomerSimpleList } from '#/api/crm/customer';
import { getSimpleUserList } from '#/api/system/user'; import { getSimpleUserList } from '#/api/system/user';
import { DICT_TYPE, erpPriceMultiply, floatToFixed2 } from '#/utils'; import { DICT_TYPE } from '#/utils';
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {

View File

@ -3,11 +3,14 @@ import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue'; import { h } from 'vue';
import { formatDateTime } from '@vben/utils'; import {
erpPriceInputFormatter,
floatToFixed2,
formatDateTime,
} from '@vben/utils';
import { DictTag } from '#/components/dict-tag'; import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE, erpPriceInputFormatter, floatToFixed2 } from '#/utils'; import { DICT_TYPE } from '#/utils';
/** 详情头部的配置 */ /** 详情头部的配置 */
export function useDetailSchema(): DescriptionItemSchema[] { export function useDetailSchema(): DescriptionItemSchema[] {
return [ return [

View File

@ -4,6 +4,7 @@ import type { CrmContractApi } from '#/api/crm/contract';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenForm, useVbenModal } from '@vben/common-ui'; import { useVbenForm, useVbenModal } from '@vben/common-ui';
import { erpPriceMultiply } from '@vben/utils';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
@ -14,7 +15,6 @@ import {
} from '#/api/crm/contract'; } from '#/api/crm/contract';
import { BizTypeEnum } from '#/api/crm/permission'; import { BizTypeEnum } from '#/api/crm/permission';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { erpPriceMultiply } from '#/utils';
import { ProductEditTable } from '#/views/crm/product'; import { ProductEditTable } from '#/views/crm/product';
import { useFormSchema } from '../data'; import { useFormSchema } from '../data';

View File

@ -140,7 +140,7 @@ async function handleQuit() {
message.warning('你不是团队成员!'); message.warning('你不是团队成员!');
return; return;
} }
await deleteSelfPermission(userPermission.id); await deleteSelfPermission(userPermission.id as number);
message.success('退出团队成员成功!'); message.success('退出团队成员成功!');
emits('quitTeam'); emits('quitTeam');
} }

View File

@ -3,8 +3,10 @@ import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue'; import { h } from 'vue';
import { erpPriceInputFormatter } from '@vben/utils';
import { DictTag } from '#/components/dict-tag'; import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE, erpPriceInputFormatter } from '#/utils'; import { DICT_TYPE } from '#/utils';
/** 详情页的字段 */ /** 详情页的字段 */
export function useDetailSchema(): DescriptionItemSchema[] { export function useDetailSchema(): DescriptionItemSchema[] {

View File

@ -4,11 +4,12 @@ import type { CrmProductApi } from '#/api/crm/product';
import { ref } from 'vue'; import { ref } from 'vue';
import { erpPriceInputFormatter } from '@vben/utils';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getBusiness } from '#/api/crm/business'; import { getBusiness } from '#/api/crm/business';
import { getContract } from '#/api/crm/contract'; import { getContract } from '#/api/crm/contract';
import { BizTypeEnum } from '#/api/crm/permission'; import { BizTypeEnum } from '#/api/crm/permission';
import { erpPriceInputFormatter } from '#/utils';
import { useDetailListColumns } from './detail-data'; import { useDetailListColumns } from './detail-data';

View File

@ -5,12 +5,13 @@ import type { CrmProductApi } from '#/api/crm/product';
import { nextTick, onMounted, ref, watch } from 'vue'; import { nextTick, onMounted, ref, watch } from 'vue';
import { erpPriceMultiply } from '@vben/utils';
import { InputNumber, Select } from 'ant-design-vue'; import { InputNumber, Select } from 'ant-design-vue';
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { BizTypeEnum } from '#/api/crm/permission'; import { BizTypeEnum } from '#/api/crm/permission';
import { getProductSimpleList } from '#/api/crm/product'; import { getProductSimpleList } from '#/api/crm/product';
import { erpPriceMultiply } from '#/utils';
import { useProductEditTableColumns } from '../data'; import { useProductEditTableColumns } from '../data';

View File

@ -1,8 +1,10 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { floatToFixed2 } from '@vben/utils';
import { getCustomerSimpleList } from '#/api/crm/customer'; import { getCustomerSimpleList } from '#/api/crm/customer';
import { DICT_TYPE, floatToFixed2, getDictOptions } from '#/utils'; import { DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {

View File

@ -3,6 +3,7 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { DemoWithdrawApi } from '#/api/pay/demo/withdraw'; import type { DemoWithdrawApi } from '#/api/pay/demo/withdraw';
import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
import { floatToFixed2 } from '@vben/utils';
import { message, Tag } from 'ant-design-vue'; import { message, Tag } from 'ant-design-vue';
@ -12,7 +13,6 @@ import {
transferDemoWithdraw, transferDemoWithdraw,
} from '#/api/pay/demo/withdraw'; } from '#/api/pay/demo/withdraw';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { floatToFixed2 } from '#/utils';
import { useGridColumns } from './data'; import { useGridColumns } from './data';
import Form from './modules/form.vue'; import Form from './modules/form.vue';

View File

@ -4,13 +4,13 @@ import type { PayOrderApi } from '#/api/pay/order';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { formatDateTime } from '@vben/utils'; import { floatToFixed2, formatDateTime } from '@vben/utils';
import { Descriptions, Divider, Tag } from 'ant-design-vue'; import { Descriptions, Divider, Tag } from 'ant-design-vue';
import { getOrder } from '#/api/pay/order'; import { getOrder } from '#/api/pay/order';
import { DictTag } from '#/components/dict-tag'; import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE, floatToFixed2 } from '#/utils'; import { DICT_TYPE } from '#/utils';
const detailData = ref<PayOrderApi.Order>(); const detailData = ref<PayOrderApi.Order>();

View File

@ -4,17 +4,12 @@ import type { DescriptionItemSchema } from '#/components/description';
import { h } from 'vue'; import { h } from 'vue';
import { formatDateTime } from '@vben/utils'; import { floatToFixed2, formatDateTime } from '@vben/utils';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag'; import { DictTag } from '#/components/dict-tag';
import { import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
DICT_TYPE,
floatToFixed2,
getDictOptions,
getRangePickerDefaultProps,
} from '#/utils';
/** 列表的搜索表单 */ /** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {