| | |
| | | return requestClient.put('/mdm/item/update-status', { id, status }); |
| | | } |
| | | |
| | | /** 更新物料同步状态 */ |
| | | export function updateItemSync(id: number, sync: boolean) { |
| | | return requestClient.put('/mdm/item/update-sync', { id, sync }); |
| | | } |
| | | |
| | | /** 导出物料 */ |
| | | export function exportItem(params: Partial<MdmItemApi.Item>) { |
| | | return requestClient.download('/mdm/item/export-excel', { params }); |
| | |
| | | } |
| | | |
| | | /** 删除 MPS */ |
| | | export function deleteMps(ids: number[]) { |
| | | export function deleteMps(id: number) { |
| | | return requestClient.delete('/mes/pro-mps/delete', { |
| | | params: { ids: ids.join(',') }, |
| | | params: { id }, |
| | | }); |
| | | } |
| | | |
| | |
| | | vendorCode?: string; // 供应商编码 |
| | | vendorName?: string; // 供应商名称 |
| | | vendorNickname?: string; // 供应商简称 |
| | | returnDate?: number; // 退货日期 |
| | | returnDate?: number | string; // 退货日期 |
| | | returnReason?: string; // 退货原因 |
| | | transportCode?: string; // 运单号 |
| | | transportTelephone?: string; // 联系电话 |
| | |
| | | }, |
| | | }, |
| | | { |
| | | component: 'Switch', |
| | | fieldName: 'syncMes', |
| | | label: '同步到MES', |
| | | defaultValue: true, |
| | | componentProps: { |
| | | checkedChildren: '是', |
| | | unCheckedChildren: '否', |
| | | }, |
| | | rules: z.boolean().default(true), |
| | | }, |
| | | { |
| | | component: "RadioGroup", |
| | | fieldName: "status", |
| | | label: "状态", |
| | |
| | | { |
| | | field: "syncedMes", |
| | | title: "同步状态", |
| | | width: 90, |
| | | width: 100, |
| | | fixed: "right", |
| | | slots: { default: "syncedMes" }, |
| | | }, |
| | |
| | | import { confirm, Page, useVbenModal } from '#/packages/effects/common-ui/src'; |
| | | import { downloadFileFromBlobPart, isEmpty } from '#/packages/utils/src'; |
| | | |
| | | import { message, Tag } from 'ant-design-vue'; |
| | | import { message, Switch, Tag } from 'ant-design-vue'; |
| | | |
| | | import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { |
| | |
| | | // exportItem, |
| | | getItemPage, |
| | | updateItemStatus, |
| | | updateItemSync, |
| | | } from '#/api/mdm/item'; |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | import { $t } from '#/locales'; |
| | |
| | | } |
| | | } |
| | | |
| | | const syncingId = ref<number | null>(null); |
| | | |
| | | /** 切换同步状态:关闭开关会从 MES 删除物料,需确认 */ |
| | | async function handleSyncChange(row: MdmItemApi.Item, checked: boolean) { |
| | | if (!checked) { |
| | | await confirm('关闭同步将从 MES 删除该物料及关联配置(BOM/SOP/SIP/批次配置),确认继续?'); |
| | | } |
| | | syncingId.value = row.id!; |
| | | try { |
| | | await updateItemSync(row.id!, checked); |
| | | message.success(checked ? '已同步到 MES' : '已取消同步'); |
| | | handleRefresh(); |
| | | } finally { |
| | | syncingId.value = null; |
| | | } |
| | | } |
| | | |
| | | const checkedIds = ref<number[]>([]); |
| | | function handleRowCheckboxChange({ |
| | | records, |
| | |
| | | <Tag v-else>否</Tag> |
| | | </template> |
| | | <template #syncedMes="{ row }"> |
| | | <Tag v-if="row.syncedMes" color="success">已同步</Tag> |
| | | <Tag v-else color="default">未同步</Tag> |
| | | <Switch |
| | | :checked="row.syncedMes" |
| | | :loading="syncingId === row.id" |
| | | checkedChildren="已同步" |
| | | unCheckedChildren="未同步" |
| | | @change="handleSyncChange(row, $event)" |
| | | /> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <TableAction |
| | |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getItem(data.id); |
| | | // 同步状态映射:详情接口返回 syncedMes,表单字段为 syncMes |
| | | formData.value.syncMes = formData.value.syncedMes ?? true; |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | | modalApi.unlock(); |
| | |
| | | |
| | | /** 转移商机 */ |
| | | function handleTransfer() { |
| | | transferModalApi.setData({ bizType: BizTypeEnum.CRM_BUSINESS }).open(); |
| | | transferModalApi |
| | | .setData({ id: businessId.value, bizType: BizTypeEnum.CRM_BUSINESS }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 更新商机状态操作 */ |
| | |
| | | |
| | | /** 转移线索 */ |
| | | function handleTransfer() { |
| | | transferModalApi.setData({ bizType: BizTypeEnum.CRM_CLUE }).open(); |
| | | transferModalApi |
| | | .setData({ id: clueId.value, bizType: BizTypeEnum.CRM_CLUE }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 转化为客户 */ |
| | |
| | | |
| | | /** 转移联系人 */ |
| | | function handleTransfer() { |
| | | transferModalApi.setData({ id: contactId.value }).open(); |
| | | transferModalApi |
| | | .setData({ id: contactId.value, bizType: BizTypeEnum.CRM_CONTACT }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 加载数据 */ |
| | |
| | | |
| | | /** 转移合同 */ |
| | | function handleTransfer() { |
| | | transferModalApi.setData({ bizType: BizTypeEnum.CRM_CONTRACT }).open(); |
| | | transferModalApi |
| | | .setData({ id: contractId.value, bizType: BizTypeEnum.CRM_CONTRACT }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 加载数据 */ |
| | |
| | | formModalApi.setData({ id: customerId.value }).open(); |
| | | } |
| | | |
| | | /** 转移线索 */ |
| | | /** 转移客户 */ |
| | | function handleTransfer() { |
| | | transferModalApi.setData({ id: customerId.value }).open(); |
| | | transferModalApi |
| | | .setData({ id: customerId.value, bizType: BizTypeEnum.CRM_CUSTOMER }) |
| | | .open(); |
| | | } |
| | | |
| | | /** 锁定客户 */ |
| | |
| | | }) { |
| | | if (records.some((item) => item.level === PermissionLevelEnum.OWNER)) { |
| | | message.warning('不能选择负责人!'); |
| | | checkedRows.value = []; |
| | | gridApi.grid.setAllCheckboxRow(false); |
| | | return; |
| | | } |
| | |
| | | } |
| | | // 提示并返回成功 |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | checkedRows.value = []; |
| | | gridApi.grid.setAllCheckboxRow(false); |
| | | handleRefresh(); |
| | | return true; |
| | | } |
| | | |
| | | /** 退出团队 */ |
| | | async function handleQuit() { |
| | | if (checkedRows.value.length > 0) { |
| | | return handleDelete(); |
| | | } |
| | | |
| | | const permission = gridApi.grid |
| | | .getData() |
| | | .find( |
| | | (item) => |
| | | item.id === userStore.userInfo?.id && |
| | | item.userId === userStore.userInfo?.id && |
| | | item.level === PermissionLevelEnum.OWNER, |
| | | ); |
| | | if (permission) { |
| | |
| | | |
| | | const userPermission = gridApi.grid |
| | | .getData() |
| | | .find((item) => item.id === userStore.userInfo?.id); |
| | | .find((item) => item.userId === userStore.userInfo?.id); |
| | | if (!userPermission) { |
| | | message.warning('你不是团队成员!'); |
| | | return; |
| | |
| | | return; |
| | | } |
| | | // 加载数据 |
| | | const data = modalApi.getData<{ bizType: number }>(); |
| | | if (!data || !data.bizType) { |
| | | const data = modalApi.getData<{ bizType: number; id: number }>(); |
| | | if (!data?.bizType || !data.id) { |
| | | return; |
| | | } |
| | | bizType.value = data.bizType; |
| | | await formApi.setFieldValue('id', data.bizType); |
| | | await formApi.setFieldValue('id', data.id); |
| | | }, |
| | | }); |
| | | </script> |
| | |
| | | 'update:paymentPrice', |
| | | ]); |
| | | |
| | | /** 输入时不补零,失焦后仍按金额格式保留两位小数 */ |
| | | const paymentPriceFormatter = ( |
| | | value: number | string | undefined, |
| | | info: { input: string; userTyping: boolean }, |
| | | ) => { |
| | | return info.userTyping ? info.input : erpPriceInputFormatter(value); |
| | | }; |
| | | |
| | | const tableData = ref<ErpFinancePaymentApi.FinancePaymentItem[]>([]); // 表格数据 |
| | | |
| | | /** 已根据该来票生成的明细,避免重复生成 */ |
| | |
| | | v-model:value="row.paymentPrice" |
| | | :precision="2" |
| | | :disabled="disabled" |
| | | :formatter="erpPriceInputFormatter" |
| | | :formatter="paymentPriceFormatter" |
| | | placeholder="请输入本次付款" |
| | | @change="handleRowChange(row)" |
| | | /> |
| | |
| | | } |
| | | |
| | | /** 删除 */ |
| | | async function handleDelete(ids: number[]) { |
| | | async function handleDelete(row: MesProMpsApi.Mps) { |
| | | const hideLoading = message.loading({ |
| | | content: $t('ui.actionMessage.deleting'), |
| | | duration: 0, |
| | | }); |
| | | try { |
| | | await deleteMps(ids); |
| | | await deleteMps(row.id!); |
| | | message.success($t('ui.actionMessage.deleteSuccess')); |
| | | handleRefresh(); |
| | | } finally { |
| | |
| | | ifShow: () => row.status === MpsStatusEnum.DRAFT, |
| | | popConfirm: { |
| | | title: $t('ui.actionMessage.deleteConfirm', [row.code]), |
| | | confirm: handleDelete.bind(null, [row.id!]), |
| | | confirm: handleDelete.bind(null, row), |
| | | }, |
| | | }, |
| | | ]" |
| | |
| | | |
| | | import { confirm, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmReturnVendorStatusEnum } from '@vben/constants'; |
| | | import { formatDate } from '@vben/utils'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | function normalizeReturnDate(value: unknown): string | undefined { |
| | | if (Array.isArray(value) && value.length >= 3) { |
| | | const [year, month, day] = value; |
| | | return `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')} 00:00:00`; |
| | | } |
| | | if (typeof value === 'number' || typeof value === 'string') { |
| | | return formatDate(value, 'YYYY-MM-DD HH:mm:ss'); |
| | | } |
| | | return undefined; |
| | | } |
| | | |
| | | /** 提交退货单:表单有修改时先保存,再调用提交接口 */ |
| | | async function handleSubmit() { |
| | |
| | | try { |
| | | formData.value = await getReturnVendor(data.id); |
| | | // 设置到 values |
| | | await formApi.setValues(formData.value); |
| | | await formApi.setValues({ |
| | | ...formData.value, |
| | | returnDate: normalizeReturnDate(formData.value.returnDate), |
| | | }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | |
| | | const defineVars: Record<string, string> = { |
| | | __APP_LOGO__: JSON.stringify(appLogo), |
| | | __APP_FAVICON__: JSON.stringify(appFavicon), |
| | | __APP_NAME__: JSON.stringify(company?.name ?? ''), |
| | | }; |
| | | if (!isDev && appApiUrl) { |
| | | defineVars['import.meta.env.VITE_GLOB_API_URL'] = JSON.stringify(appApiUrl); |