import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { CustomerStatementMain, } from '../moldAllocation/customerStatement/customerStatementMain.data' import * as CustomerStatementMainApi from '@/api/wms/customerStatementMain' 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 CustomerSaleInvoiceMainRules = reactive({ customerStatementNumber: [required], customerCode: [required], customerName: [required], beforeTaxAmount: [required], taxRate: [required], taxAmount: [required], adTaxAmount: [required], goldenTaxInvoiceNumber: [{ max: 64, message: '字符长度不可以大于64', trigger: 'blur' }] }) export const CustomerSaleInvoiceMain = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', isSearch: true, isForm: false, fixed: 'left', table:{ width:180 } }, { label: '状态', field: 'status', sort: 'custom', isSearch: true, isForm:false, // 0:新增1:已发布2已作废 dictType: DICT_TYPE.CUSTOMER_SALE_INVOICE_TYPE, dictClass: 'string', table:{ width:120 }, search:{ component:'Select', componentProps: { multiple:true, } }, }, { label: '客户对账单', field: 'customerStatementNumber', sort: 'custom', isSearch: true, form: { componentProps: { enterSearch: true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择客户对账单', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '客户对账单信息', // 查询弹窗标题 searchAllSchemas: CustomerStatementMain.allSchemas, // 查询弹窗所需类 searchPage: CustomerStatementMainApi.getCustomerStatementMainPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'status', value: [5], isMainValue: false }, { key: 'available', value: 'TRUE', isMainValue: false }], verificationPage: CustomerStatementMainApi.getCustomerStatementMainPage, // 失去焦点校验参数 verificationParams: [{ key: 'status', value: 5, action: '==', isMainValue: false, isSearch: 'true', isFormModel: false, },{ key: 'number', action: '==', value: '', isMainValue: false, isSearch: 'true', isFormModel: true, }] } }, table:{ width:180 } }, { label: '客户代码', field: 'customerCode', sort: 'custom', isSearch: true, form: { componentProps: { disabled:true } }, isDetail:false, 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 })):[] } }, table:{ width:150 } }, { label: '客户名称', field: 'customerName', sort: 'custom', form: { componentProps: { disabled: true } }, isDetail:false, table:{ width:150 } }, { label: '未税金额', field: 'beforeTaxAmount', sort: 'custom', form: { componentProps: { disabled: true } }, table:{ width:150 } }, { label: '税率(%)', field: 'taxRate', dictType: DICT_TYPE.TAX_RATE_DICT, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '税额', field: 'taxAmount', sort: 'custom', form: { componentProps: { disabled: true } }, table:{ width:150 } }, { label: '价税合计金额', field: 'adTaxAmount', sort: 'custom', form: { componentProps: { disabled: true } }, table:{ width:150 } }, { label: '金税票号', field: 'goldenTaxInvoiceNumber', sort: 'custom', table:{ width:150 } }, { label: '开票日期', field: 'invoiceTime', sort: 'custom', formatter: dateFormatter, 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')] } }, detail: { dateFormat : 'YYYY-MM-DD HH:mm:ss' }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, table:{ width:180 } }, { label: '备注', field: 'remark', sort: 'custom', table:{ width:150 } }, { label: '开票种类', field: 'invoiceType', dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Select', componentProps: { showAll: true,// 备用做全选 multiple: true, // emptyValues:[null, undefined], valueOnClear: null, options: [{ label: '全部', value: '' }, { label: '号口品', value: '号口品' }, { label: '补给品', value: '补给品' }] } }, }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, 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')] } }, detail: { dateFormat : 'YYYY-MM-DD HH:mm:ss' }, isTable:false, isForm: false, table:{ width:180 } }, { label: '创建者', field: 'creator', sort: 'custom', isDetail: true, isForm: false, isTable: false }, { label: '最后更新时间', field: 'updateTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, isTable: false, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x' } }, isForm: false }, { label: '最后更新者', field: 'updater', sort: 'custom', table: { width: 150 }, isTable: false, isForm: false }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ])) // 表单校验 export const CustomerSaleInvoiceDetailRules = reactive({ beforeTaxAmount: [required], taxRate: [required], taxAmount: [required], adTaxAmount: [required], }) export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive([ { label: '序号', type:'index', field: 'numberIndex', sort: 'custom', isSearch: false, isForm: false, isTableForm: false, tableForm: { disabled: true } }, { label: '品番', field: 'itemCode', sort: 'custom', isSearch: true, isForm: false, tableForm:{ disabled:true, // multiple:true, // isInpuFocusShow: true, // 开启查询弹窗 // searchListPlaceholder: '请选择品番', // searchField: 'code', // searchTitle: '物料基础信息', // searchAllSchemas: Itembasic.allSchemas, // searchPage: CustomerStatementDetailApi.getCustomerStatementDetailPage, // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }], // verificationPage: ItembasicApi.getItemListByCodes, // 失去焦点校验输入框的数据内容存在 // isShowTableFormSearch: true, // verificationParams: [{ // key: 'code', // action: '==', // value: '', // isMainValue: false, // isSearch: 'true', // isFormModel: true // }], // 失去焦点校验参数 }, // form: { // // labelMessage: '信息提示说明!!!', // componentProps: { // isSearchList: true, // 开启查询弹窗 // searchListPlaceholder: '请选择品番', // searchField: 'code', // searchTitle: '物料基础信息', // searchAllSchemas: Itembasic.allSchemas, // searchPage: ItembasicApi.getItembasicPage, // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }] // } // } }, { label: '背番', field: 'backNumber', sort: 'custom', isSearch: true, isForm:false, hiddenSearchHigh:true, table: { width: 150 }, form:{ componentProps:{ disabled: true, } }, tableForm:{ disabled:true } }, { label: '开票种类', field: 'invoiceType', dictType: DICT_TYPE.TAX_RATE_DICT, dictClass: 'string', isTable: true, isTableForm: true, sort: 'custom', table: { width: 150 }, tableForm: { disabled:true } }, { label: '品号', field: 'articleNumber', sort: 'custom', isSearch: true, isForm: false, tableForm:{ disabled: true } }, { label: '数量', field: 'qty', sort: 'custom', isSearch: true, form: { componentProps: { type: 'InputNumber', precision: 2, disabled: true } }, tableForm: { type: 'InputNumber', precision: 2, disabled: true } }, { label: '销售单价', field: 'price', sort: 'custom', isSearch: true, form: { componentProps: { type: 'InputNumber', disabled: true } }, tableForm: { type: 'InputNumber', disabled: true } }, { label: '模具分摊单价', field: 'allocationPrice', sort: 'custom', form: { component: 'InputNumber', componentProps: { disabled: true, precision: 5 } }, tableForm: { disabled: true, type: 'InputNumber', precision: 5, } }, { label: '合计单价', field: 'sumPrice', sort: 'custom', form: { component: 'InputNumber', componentProps: { disabled: true } }, tableForm: { disabled: true, type: 'InputNumber', } }, { label: '未税金额', field: 'beforeTaxAmount', sort: 'custom', form: { component: 'InputNumber', componentProps: { precision: 2 } }, tableForm: { type: 'InputNumber', precision: 2, } }, { label: '税额', field: 'taxAmount', sort: 'custom', form: { component: 'InputNumber', componentProps: { precision: 2, disabled: true } }, tableForm: { type: 'InputNumber', precision: 2, disabled: true } }, { label: '含税金额', field: 'afterTaxAmount', sort: 'custom', form: { component: 'InputNumber', componentProps: { disabled: true, precision: 2, } }, tableForm: { disabled: true, type: 'InputNumber', precision: 2, } }, { label: '操作', field: 'action', isForm: false, isTableForm: false, table: { width: 150, fixed: 'right' } } ]))