feat:【antd】【erp 系统】purchase/return 重构 4/4
This commit is contained in:
@@ -74,21 +74,6 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
fieldName: 'purchaseUserId',
|
|
||||||
label: '采购人员',
|
|
||||||
component: 'ApiSelect',
|
|
||||||
componentProps: {
|
|
||||||
placeholder: '请选择采购人员',
|
|
||||||
allowClear: true,
|
|
||||||
showSearch: true,
|
|
||||||
api: getSimpleUserList,
|
|
||||||
fieldNames: {
|
|
||||||
label: 'nickname',
|
|
||||||
value: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
@@ -188,7 +173,6 @@ export function useFormSchema(formType: string): VbenFormSchema[] {
|
|||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择结算账户',
|
placeholder: '请选择结算账户',
|
||||||
disabled: true,
|
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
api: getAccountSimpleList,
|
api: getAccountSimpleList,
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
||||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
import { getPurchaseOrderPage } from '#/api/erp/purchase/order';
|
|
||||||
|
|
||||||
import { useOrderGridColumns, useOrderGridFormSchema } from '../data';
|
|
||||||
|
|
||||||
const emit = defineEmits(['selectRow']);
|
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
|
||||||
formOptions: {
|
|
||||||
schema: useOrderGridFormSchema(),
|
|
||||||
},
|
|
||||||
gridOptions: {
|
|
||||||
columns: useOrderGridColumns(),
|
|
||||||
height: 'auto',
|
|
||||||
keepSource: true,
|
|
||||||
proxyConfig: {
|
|
||||||
ajax: {
|
|
||||||
query: async ({ page }, formValues) => {
|
|
||||||
return await getPurchaseOrderPage({
|
|
||||||
pageNo: page.currentPage,
|
|
||||||
pageSize: page.pageSize,
|
|
||||||
returnEnable: true,
|
|
||||||
...formValues,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rowConfig: {
|
|
||||||
keyField: 'id',
|
|
||||||
isHover: true,
|
|
||||||
},
|
|
||||||
radioConfig: {
|
|
||||||
trigger: 'row',
|
|
||||||
highlight: true,
|
|
||||||
},
|
|
||||||
toolbarConfig: {
|
|
||||||
refresh: true,
|
|
||||||
search: true,
|
|
||||||
},
|
|
||||||
} as VxeTableGridOptions<ErpPurchaseOrderApi.PurchaseOrder>,
|
|
||||||
gridEvents: {
|
|
||||||
radioChange: ({ row }: { row: ErpPurchaseOrderApi.PurchaseOrder }) => {
|
|
||||||
emit('selectRow', row);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Grid class="max-h-[600px]" table-title="采购订单列表(仅展示可退货)" />
|
|
||||||
</template>
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
@@ -7,9 +8,12 @@ import { IconifyIcon } from '@vben/icons';
|
|||||||
|
|
||||||
import { Input, message, Modal } from 'ant-design-vue';
|
import { Input, message, Modal } from 'ant-design-vue';
|
||||||
|
|
||||||
import PurchaseOrderGrid from './purchase-order-grid.vue';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import { getPurchaseOrderPage } from '#/api/erp/purchase/order';
|
||||||
|
|
||||||
const props = defineProps({
|
import { useOrderGridColumns, useOrderGridFormSchema } from '../data';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
orderNo: {
|
orderNo: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => undefined,
|
default: () => undefined,
|
||||||
@@ -19,16 +23,61 @@ const props = defineProps({
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
'update:order': [order: ErpPurchaseOrderApi.PurchaseOrder];
|
'update:order': [order: ErpPurchaseOrderApi.PurchaseOrder];
|
||||||
}>();
|
}>();
|
||||||
const order = ref<ErpPurchaseOrderApi.PurchaseOrder>();
|
|
||||||
const open = ref<boolean>(false);
|
|
||||||
|
|
||||||
const handleSelectOrder = (selectOrder: ErpPurchaseOrderApi.PurchaseOrder) => {
|
const order = ref<ErpPurchaseOrderApi.PurchaseOrder>(); // 选择的采购订单
|
||||||
|
const open = ref<boolean>(false); // 选择采购订单弹窗是否打开
|
||||||
|
|
||||||
|
/** 表格配置 */
|
||||||
|
const [Grid] = useVbenVxeGrid({
|
||||||
|
formOptions: {
|
||||||
|
schema: useOrderGridFormSchema(),
|
||||||
|
},
|
||||||
|
gridOptions: {
|
||||||
|
columns: useOrderGridColumns(),
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues) => {
|
||||||
|
return await getPurchaseOrderPage({
|
||||||
|
pageNo: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
returnEnable: true,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
|
},
|
||||||
|
radioConfig: {
|
||||||
|
trigger: 'row',
|
||||||
|
highlight: true,
|
||||||
|
},
|
||||||
|
toolbarConfig: {
|
||||||
|
refresh: true,
|
||||||
|
search: true,
|
||||||
|
},
|
||||||
|
} as VxeTableGridOptions<ErpPurchaseOrderApi.PurchaseOrder>,
|
||||||
|
gridEvents: {
|
||||||
|
radioChange: ({ row }: { row: ErpPurchaseOrderApi.PurchaseOrder }) => {
|
||||||
|
handleSelectOrder(row);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 选择采购订单 */
|
||||||
|
function handleSelectOrder(selectOrder: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||||
order.value = selectOrder;
|
order.value = selectOrder;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
/** 确认选择采购订单 */
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
if (!order.value) {
|
if (!order.value) {
|
||||||
message.warning('请选择一个采购订单');
|
message.warning('请选择一个采购订单');
|
||||||
@@ -41,7 +90,6 @@ const handleOk = () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Input
|
<Input
|
||||||
v-bind="$attrs"
|
|
||||||
readonly
|
readonly
|
||||||
:value="orderNo"
|
:value="orderNo"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@@ -52,19 +100,18 @@ const handleOk = () => {
|
|||||||
<IconifyIcon
|
<IconifyIcon
|
||||||
class="h-full w-6 cursor-pointer"
|
class="h-full w-6 cursor-pointer"
|
||||||
icon="ant-design:setting-outlined"
|
icon="ant-design:setting-outlined"
|
||||||
:style="{ cursor: props.disabled ? 'not-allowed' : 'pointer' }"
|
:style="{ cursor: disabled ? 'not-allowed' : 'pointer' }"
|
||||||
@click="() => !props.disabled && (open = true)"
|
@click="() => !disabled && (open = true)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Input>
|
</Input>
|
||||||
<Modal
|
<Modal
|
||||||
|
class="!w-[50vw]"
|
||||||
v-model:open="open"
|
v-model:open="open"
|
||||||
title="选择关联订单"
|
title="选择关联订单"
|
||||||
class="!w-[50vw]"
|
|
||||||
:show-confirm-button="true"
|
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
>
|
>
|
||||||
<PurchaseOrderGrid @select-row="handleSelectOrder" />
|
<Grid class="max-h-[600px]" table-title="采购订单列表(仅展示可退货)" />
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user