feat:【antd】【erp 系统】sale/order 重构完成

This commit is contained in:
YunaiV
2025-10-03 20:54:22 +08:00
parent 83cffeafc3
commit d5712f2640
3 changed files with 23 additions and 30 deletions

View File

@@ -10,6 +10,7 @@ import { getAccountSimpleList } from '#/api/erp/finance/account';
import { getProductSimpleList } from '#/api/erp/product/product'; import { getProductSimpleList } from '#/api/erp/product/product';
import { getCustomerSimpleList } from '#/api/erp/sale/customer'; import { getCustomerSimpleList } from '#/api/erp/sale/customer';
import { getSimpleUserList } from '#/api/system/user'; import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils';
/** 表单的配置项 */ /** 表单的配置项 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
@@ -166,7 +167,6 @@ export function useFormSchema(): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请输入收取订金', placeholder: '请输入收取订金',
precision: 2, precision: 2,
style: { width: '100%' },
min: 0, min: 0,
}, },
fieldName: 'depositPrice', fieldName: 'depositPrice',
@@ -284,10 +284,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '订单时间', label: '订单时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: {
placeholder: ['开始时间', '结束时间'], ...getRangePickerDefaultProps(),
showTime: true, allowClear: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, },
}, },
{ {

View File

@@ -8,6 +8,7 @@ import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { getAccountSimpleList } from '#/api/erp/finance/account';
import { import {
createSaleOrder, createSaleOrder,
getSaleOrder, getSaleOrder,
@@ -17,7 +18,6 @@ import { $t } from '#/locales';
import { useFormSchema } from '../data'; import { useFormSchema } from '../data';
import ItemForm from './item-form.vue'; import ItemForm from './item-form.vue';
import {getAccountSimpleList} from '#/api/erp/finance/account';
const emit = defineEmits(['success']); const emit = defineEmits(['success']);
const formData = ref<ErpSaleOrderApi.SaleOrder>(); const formData = ref<ErpSaleOrderApi.SaleOrder>();

View File

@@ -228,7 +228,7 @@ onMounted(async () => {
v-model:value="row.productId" v-model:value="row.productId"
:options="productOptions" :options="productOptions"
:field-names="{ label: 'name', value: 'id' }" :field-names="{ label: 'name', value: 'id' }"
style="width: 100%" class="w-full"
placeholder="请选择产品" placeholder="请选择产品"
show-search show-search
@change="handleProductChange($event, row)" @change="handleProductChange($event, row)"
@@ -240,12 +240,11 @@ onMounted(async () => {
v-if="!disabled" v-if="!disabled"
v-model:value="row.count" v-model:value="row.count"
:min="0" :min="0"
:precision="2" :precision="3"
@change="handleRowChange(row)" @change="handleRowChange(row)"
/> />
<span v-else>{{ row.count || '-' }}</span> <span v-else>{{ row.count || '-' }}</span>
</template> </template>
<template #productPrice="{ row }"> <template #productPrice="{ row }">
<InputNumber <InputNumber
v-if="!disabled" v-if="!disabled"
@@ -256,7 +255,6 @@ onMounted(async () => {
/> />
<span v-else>{{ row.productPrice || '-' }}</span> <span v-else>{{ row.productPrice || '-' }}</span>
</template> </template>
<template #taxPercent="{ row }"> <template #taxPercent="{ row }">
<InputNumber <InputNumber
v-if="!disabled" v-if="!disabled"
@@ -268,11 +266,26 @@ onMounted(async () => {
/> />
<span v-else>{{ row.taxPercent || '-' }}</span> <span v-else>{{ row.taxPercent || '-' }}</span>
</template> </template>
<template #remark="{ row }"> <template #remark="{ row }">
<Input v-if="!disabled" v-model:value="row.remark" class="w-full" /> <Input v-if="!disabled" v-model:value="row.remark" class="w-full" />
<span v-else>{{ row.remark || '-' }}</span> <span v-else>{{ row.remark || '-' }}</span>
</template> </template>
<template #actions="{ row }">
<TableAction
v-if="!disabled"
:actions="[
{
label: '删除',
type: 'link',
danger: true,
popConfirm: {
title: '确认删除该产品吗?',
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
<template #bottom> <template #bottom>
<div class="border-border bg-muted mt-2 rounded border p-2"> <div class="border-border bg-muted mt-2 rounded border p-2">
@@ -290,10 +303,9 @@ onMounted(async () => {
</div> </div>
</div> </div>
</div> </div>
<TableAction <TableAction
v-if="!disabled" v-if="!disabled"
class="mt-4 flex justify-center" class="mt-2 flex justify-center"
:actions="[ :actions="[
{ {
label: '添加产品', label: '添加产品',
@@ -303,22 +315,5 @@ onMounted(async () => {
]" ]"
/> />
</template> </template>
<template #actions="{ row }">
<TableAction
v-if="!disabled"
:actions="[
{
label: '删除',
type: 'link',
danger: true,
popConfirm: {
title: '确认删除该产品吗?',
confirm: handleDelete.bind(null, row),
},
},
]"
/>
</template>
</Grid> </Grid>
</template> </template>