| | |
| | | import type { VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | |
| | | import { useUserStore } from '../../../packages/stores/src'; |
| | | import { erpPriceInputFormatter, erpPriceMultiply } from '../../../packages/utils/src'; |
| | | import { useUserStore } from '@vben/stores'; |
| | | import { erpPriceInputFormatter, erpPriceMultiply } from '@vben/utils'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { getSimpleBusinessList } from '#/api/crm/business'; |
| | | import { getSimpleContactList } from '#/api/crm/contact'; |
| | | import { getCustomerSimpleList } from '#/api/crm/customer'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | /** 新增/修改的表单 */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | |
| | | { |
| | | fieldName: 'customerId', |
| | | label: '客户名称', |
| | | component: 'ApiSelect', |
| | | component: markRaw(CrmCustomerSelect), |
| | | rules: 'required', |
| | | componentProps: { |
| | | api: getCustomerSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | placeholder: '请选择客户', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['customerId'], |
| | | disabled: (values) => !!values.customerId, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | placeholder: '请选择商机', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['customerId'], |
| | | disabled: (values) => !values.customerId, |
| | | triggerFields: ['customerId', 'businessId'], |
| | | disabled: (values) => !!values.businessId || !values.customerId, |
| | | async componentProps(values) { |
| | | if (values.businessId && values.businessName) { |
| | | return { |
| | | options: [{ label: values.businessName, value: values.businessId }], |
| | | placeholder: '请选择商机', |
| | | }; |
| | | } |
| | | if (!values.customerId) { |
| | | return { |
| | | options: [], |
| | |
| | | { |
| | | fieldName: 'customerId', |
| | | label: '客户', |
| | | component: 'ApiSelect', |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | api: getCustomerSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | placeholder: '请选择客户', |
| | | allowClear: true, |
| | | }, |