import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { validateTwoNum } from '@/utils/validator' import * as CustomerSaleInvoiceMainApi from '@/api/wms/customerSaleInvoiceMain' const { t } = useI18n() // 国际化 let custormList = [] try { custormList = await CustomerSaleInvoiceMainApi.getCustomerList() if(custormList.length>0){ custormList.unshift({ customerCode:'ALL', customerName:t('ts.全选'), }) } console.log('custormList11',custormList) } catch (error) { } // 表单校验 export const CustomerStatementMainRules = reactive({ customerCode: [required], customerName: [required], yearsMonth: [required], }) export const CustomerStatementMain = useCrudSchemas(reactive([ { label: 'id', field: 'id', isDetail:false, sort: 'custom', isTable: false, isForm: false, }, { label: '单据号', field: 'number', sort: 'custom', isSearch: true, }, { label: '客户代码', field: 'customerCode', sort: 'custom', isSearch: true, search:{ component:'Select', value:custormList.length>1?[custormList[0]['customerCode']]:[], componentProps: { showAll:true,// 备用做全选 multiple:true, // emptyValues:[null, undefined], valueOnClear:null, options:custormList.length>0?custormList.map(item=>({ label:item.customerName, value:item.customerCode })):[] } }, }, { label: '客户名称', field: 'customerName', sort: 'custom', isSearch: false, }, { label: '年月', field: 'yearsMonth', sort: 'custom', formatter: dateFormatter, isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, detail: { dateFormat: 'YYYY-MM' }, isTable:false, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'YYYY-MM' } }, }, // { // label: '年月', // field: 'yearsMonthStr', // sort: 'custom', // detail: { // dateFormat: 'YYYY-MM' // }, // isForm:false, // }, { label: '状态', field: 'status', sort: 'custom', dictType: DICT_TYPE.CUSTOMER_STATEMENT_TYPE, dictClass: 'string', isSearch: true, form: { //value: '',//可以添加默认值 有无都可 component: 'Select', }, search:{ componentProps: { multiple:true } }, }, { label: '创建者', field: 'creator', sort: 'custom', }, { label: '创建时间', field: 'createTime', isTable:true, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', isForm: false, table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, }, { label: '操作', isDetail:false, field: 'action', isForm: false, table: { width: 360, fixed: 'right' } } ])) // 表单校验 export const CustomerStatementDetailRules = reactive({ amount: [ required, { validator: validateTwoNum, message: '小数点后最多2位', trigger: 'blur' } ], }) export const CustomerStatementDetail = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', isSearch: true, isForm: false, }, { label: '开票种类', field: 'invoiceType', sort: 'custom', isForm: false, }, { label: '发行NO', field: 'releaseNumber', sort: 'custom', isSearch: true, isForm: false, }, { label: '受入', field: 'ingress', sort: 'custom', isForm: false, }, { label: '受入2', field: 'ingress2', sort: 'custom', isForm: false, }, { label: '品番', field: 'itemCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '品番2', field: 'articleNumber', sort: 'custom', isSearch: true, isForm: false, }, { label: '品名', field: 'articleName', sort: 'custom', isSearch: true, isForm: false, }, { label: '验收年月日', field: 'checkTime', sort: 'custom', formatter: dateFormatter, isSearch: true, isForm: false, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '单位', field: 'uom', sort: 'custom', isForm: false, }, { label: '数量', field: 'qty', sort: 'custom', isForm: false, }, { label: '单价', field: 'price', sort: 'custom', isForm: false, }, { label: '金额', field: 'amount', sort: 'custom', }, { label: '操作', field: 'action', isForm: false, isTable: false, table: { width: 150, fixed: 'right' } } ])) // 对账差异 export const CustomerStatementReconciliation = useCrudSchemas(reactive([ { label: '品番', field: 'itemCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '背番', field: 'backNumber', sort: 'custom', isSearch: true, isForm: false, }, { label: '出荷日期', field: 'dischargingTime', sort: 'custom', formatter: dateFormatter, isSearch: true, isForm: false, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '验收日期', field: 'checkTime', sort: 'custom', isForm: false, formatter: dateFormatter, }, { label: '订单号', field: 'releaseNumber', sort: 'custom', isForm: false, }, { label: '数量-INTEX', field: 'intexQuantity', sort: 'custom', isForm: false, }, { label: '数量-TFTM', field: 'qty', sort: 'custom', }, { label: '数量差异', field: 'quantityVariance', sort: 'custom', }, { label: '单价-INTEX', field: 'intexPrice', sort: 'custom', }, { label: '单价-TFTM', field: 'price', sort: 'custom', }, { label: '单价差异', field: 'priceVariance', sort: 'priceVariance', }, { label: '金额-INTEX', field: 'intexAmount', sort: 'custom', }, { label: '金额-TFTM', field: 'amount', sort: 'custom', }, { label: '金额差异', field: 'amountVariance', sort: 'custom', }, { label: '操作', field: 'action', isForm: false, isTable: false, table: { width: 150, fixed: 'right' } } ])) // 模具分摊对账单 export const CustomerStatementShareReconciliation = useCrudSchemas(reactive([ { label: '厂家编号', field: 'factoryCode', sort: 'custom', isSearch: true, isForm: false, }, { label: '厂家名称', field: 'factoryName', sort: 'custom', isSearch: true, isForm: false, }, { label: '帐票号', field: 'invoiceNumber', sort: 'custom', formatter: dateFormatter, isSearch: true, isForm: false, form: { }, }, { label: '品号', field: 'articleNumber', sort: 'custom', isForm: false, }, { label: '车型', field: 'vehicleType', sort: 'custom', isForm: false, }, { label: '数量', field: 'qty', sort: 'custom', isForm: false, }, { label: '模具分摊金额', field: 'amount', sort: 'custom', isForm: false, }, { label: '模具分摊单价', field: 'allocationPrice', sort: 'custom', isForm: false, }, { label: '调整金额', field: 'adjustmentAmount', sort: 'custom', form: { component: 'InputNumber', value: 0, componentProps: { precision: 2 }, } }, ]))