diff --git a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRecordMain/supplierinvoiceRecordMain.data.ts b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRecordMain/supplierinvoiceRecordMain.data.ts index b80e1f2a5..83aee647a 100644 --- a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRecordMain/supplierinvoiceRecordMain.data.ts +++ b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRecordMain/supplierinvoiceRecordMain.data.ts @@ -1,5 +1,6 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' +import { accountantFormart } from '@/utils/formatter' /** * @returns {Array} 供应商发票记录主表 @@ -35,6 +36,18 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ sortTableDefault:2, isForm: false }, + { + label: '税率', + field: 'taxRate', + sort: 'custom', + table: { + width: 150 + }, + sortTableDefault:3, + form: { + component: 'InputNumber', + } + }, { label: '财务凭证号', field: 'voucher_number', @@ -53,7 +66,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ dictType: DICT_TYPE.SUPPLIERINVOICE_REQUEST_STATUS, dictClass: 'string', isTable: true, - sortTableDefault:8, + sortTableDefault:7, isForm:false, sort: 'custom', table: { @@ -93,45 +106,69 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ table: { width: 150 }, - sortTableDefault:9, + sortTableDefault:5, isSearch: true }, { - label: '税额', + label: '系统税额', field: 'taxAmount', + formatter: accountantFormart, sort: 'custom', table: { width: 150 }, - sortTableDefault:4, + sortTableDefault:8, form: { component: 'InputNumber', } }, { - label: '税后金额',//税后金额 - field: 'afterTaxAmount', - sort: 'custom', + label: '未税金额', + field: 'beforeTaxAmount', + formatter: accountantFormart, table: { width: 150 }, - sortTableDefault:5, - form: { - component: 'InputNumber', - } + sortTableDefault:3, + isForm:false, + isTableForm:false }, { - label: '税率', - field: 'taxRate', - sort: 'custom', + label: '税额', + field: 'totalTaxAmount', + formatter: accountantFormart, table: { width: 150 }, sortTableDefault:3, + isForm:false, + isTableForm:false + }, + { + label: '价税合计金额', + field: 'adTaxAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + sortTableDefault:3, + isForm:false, + isTableForm:false + }, + { + label: '系统价税合计',//税后金额 + field: 'afterTaxAmount', + formatter: accountantFormart, + sort: 'custom', + table: { + width: 150 + }, + sortTableDefault:9, form: { component: 'InputNumber', } }, + { label: '价差',//总差额 field: 'totalDifference', @@ -154,13 +191,14 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ }, { - label: '金额', + label: '系统未税金额', field: 'amount', + formatter: accountantFormart, sort: 'custom', table: { width: 150 }, - sortTableDefault:7, + sortTableDefault:8, form: { component: 'InputNumber', } @@ -171,6 +209,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ { label: '索赔金额', field: 'claimAmount', + formatter: accountantFormart, sort: 'custom', table: { width: 150 @@ -183,6 +222,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ { label: '调整价差', field: 'discountAmount', + formatter: accountantFormart, sort: 'custom', table: { width: 150 @@ -195,6 +235,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ { label: '调整税额', field: 'adjustingTaxAmount', + formatter: accountantFormart, sort: 'custom', table: { width: 150 @@ -208,6 +249,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ { label: '未税差额', field: 'untaxedDifference', + formatter: accountantFormart, table: { width: 150 }, @@ -228,6 +270,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ { label: '含税差额', field: 'taxInclusiveDifference', + formatter: accountantFormart, table: { width: 150 }, @@ -264,7 +307,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, - sortTableDefault:10, + sortTableDefault:4, sort: 'custom', table: { width: 180 @@ -282,7 +325,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ isTableForm: false, isForm:false, isSearch:false, - sortTableDefault:11 + sortTableDefault:10 }, { label: '过账日期', @@ -291,7 +334,8 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, - isTable: false, + isTable: true, + sortTableDefault:6, sort: 'custom', table: { width: 180 @@ -461,7 +505,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ { label: '采购审批时间', field: 'procurementCreateTime', - sortTableDefault:12, + sortTableDefault:11, isTable: true, formatter: dateFormatter, detail: { @@ -480,13 +524,13 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ table: { width: 150 }, - sortTableDefault:13, + sortTableDefault:12, isForm: false, }, { label: '财务审批时间', field: 'financialCreateTime', - sortTableDefault:14, + sortTableDefault:13, isTable: true, formatter: dateFormatter, detail: { @@ -504,7 +548,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ table: { width: 180 }, - sortTableDefault:15, + sortTableDefault:14, isTable: true, isSearch: false, isForm: false, @@ -516,7 +560,7 @@ export const SupplierinvoiceRecordMain = useCrudSchemas(reactive([ table: { width: 180 }, - sortTableDefault:16, + sortTableDefault:15, isTable: true, isSearch: false, isForm: false, @@ -784,6 +828,7 @@ export const SupplierinvoiceRecordDetail = useCrudSchemas(reactive { label: '未税差额', field: 'untaxedDifference', + formatter: accountantFormart, table: { width: 150 }, @@ -803,6 +848,7 @@ export const SupplierinvoiceRecordDetail = useCrudSchemas(reactive { label: '含税差额', field: 'taxInclusiveDifference', + formatter: accountantFormart, table: { width: 150 }, diff --git a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue index 663819072..4eaeb8d8a 100644 --- a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue +++ b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue @@ -54,9 +54,9 @@ :tableFormRules="SupplierinvoiceRequestDetailRules" :tableData="tableData" :sumFormDataByForm ="(formRef,formModel)=>{ - const {taxRate=0,amount=0,taxAmount=0,adjustingTaxAmount=0} = formModel + const {taxRate=0,amount=0,taxAmount=0,adjustingTaxAmount=0} = formModel formRef.value.setValues({ - taxAmount:taxRate*amount*0.01+adjustingTaxAmount, + taxAmount:taxRate*amount*0.01, afterTaxAmount:amount+taxAmount }) }" @@ -76,6 +76,11 @@ @searchTableSuccess="searchTableSuccess" @submitForm="submitForm" > + @@ -186,7 +191,8 @@ import { Supplier } from '../../../basicDataManage/supplierManage/supplier/supplier.data' import { getAccessToken } from '@/utils/auth' import { ElMessageBox } from 'element-plus' -import { getJmreportBaseUrl } from '@/utils/systemParam' + import { getJmreportBaseUrl } from '@/utils/systemParam' + import { accountantFormart } from '@/utils/formatter' defineOptions({ name: 'SupplierinvoiceRequestMain' }) @@ -244,6 +250,17 @@ const searchTableSuccessDetail = async (formField, searchField, val, formRef,sea }) detailRef.value.updateList() } + +const basicFormFooter = computed(()=>{ + let formModel = formRef.value?.formRef?.formModel + if(formModel){ + let price1 = formModel.amount+formModel.discountAmount+formModel.discountAmount1 + let price2 = formModel.taxAmount+formModel.adjustingTaxAmount + return `合计金额:未税金额=${accountantFormart(undefined,undefined,price1)};税额=${accountantFormart(undefined,undefined,price2)};价税合计金额=${accountantFormart(undefined,undefined,price1+price2)};` + } + return `合计金额` + +}) // 查询页面返回 const searchTableSuccess = (formField, searchField, val, searchFormRef, type, row) => { @@ -864,11 +881,21 @@ const handleImport = () => { } // 主子数据 提交 - const submitForm = async (formType, data) => { + const submitForm = async (formType, submitData) => { + let data = {...submitData} tableData.value.forEach((item) => { item.differencePrice = Number((Number(item?.singlePrice)-Number(item?.purchasePrice)).toFixed(6)) }) data.subList = tableData.value // 拼接子表数据参数 + if(data){ + // 未税金额\价税合计金额\税额 + let price1 = data.amount+data.discountAmount+data.discountAmount1 + let price2 = data.taxAmount+data.adjustingTaxAmount + data.beforeTaxAmount = price1 + data.totalTaxAmount = price2 + data.adTaxAmount = price1+price2 + } + try { if (formType === 'create') { if(data.subList.length == 0){ diff --git a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts index 94c347716..62af4a6ee 100644 --- a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts +++ b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts @@ -1,1330 +1,1363 @@ -import type { CrudSchema } from '@/hooks/web/useCrudSchemas' -import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' -import { accountantFormart } from '@/utils/formatter' - -import * as SupplierApi from '@/api/wms/supplier' -import * as SupplierinvoiceRequestMainApi from '@/api/wms/supplierinvoiceRequestMain' -import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' -const { t } = useI18n() // 国际化 - -import * as getRequestsettingApi from '@/api/wms/requestsetting/index' -import * as supplierinvoiceRequestDetailApi from '@/api/wms/supplierinvoiceRequestDetail' - -// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 -const queryParams = { - pageSize: 10, - pageNo: 1, - code: 'PurchaseInvoiceRequest' -} -const data = await getRequestsettingApi.getRequestsettingPage(queryParams) -const requestsettingData = data?.list[0] || {} - - // 获取当前操作人的部门 - import { useUserStore } from '@/store/modules/user' - import { TableColumn } from '@/types/table' - const userStore = useUserStore() - const userDept = userStore.userSelfInfo.dept - // id 转str 否则form回显匹配不到 - userDept.id = userDept.id.toString() - const userDeptArray:any = [userDept] - -const procurementCreators = await SupplierinvoiceRequestMainApi.queryUserInfoByRoleCode({ roleCode: 'purchase',pageSize: 1000,pageNo: 1,sort: '',by: 'ASC' }) -/** - * @returns {Array} 采购员列表 - */ -export const PurchaseMemberInfo = useCrudSchemas(reactive([ - { - label: '用户编号', - field: 'id', - table: { - width: 180, - }, - }, - { - label: '用户名称', - field: 'username', - table: { - width: 180, - }, - }, - { - label: '用户昵称', - field: 'nickname', - table: { - width: 180, - }, - } -])) - -/** - * @returns {Array} 采购订单或者采购退货单 - */ -export const PurchaseReceiptOrReturnRecordDetail = useCrudSchemas(reactive([ - { - label: '单据类型', - field: 'billType' - }, - { - label: '收货日期', - field: 'deliveryDate', - sort: 'custom', - isDetail:false, - isTable: true, - isForm:false, - isTableForm:false, - isSearch:true, - formatter: dateFormatter2, - search: { - component: 'DatePicker', - componentProps: { - valueFormat: 'YYYY-MM-DD', - type: 'daterange', - defaultTime: [new Date('1 '), new Date('1 ')] - } - }, - }, - { - label: '待开票单据号', - field: 'recvBillNum', - table: { - width: 180, - }, - }, - { - label: '供应商发货单号', - field: 'asnBillNum', - table: { - width: 180, - }, - }, - { - label: '供应商代码', - field: 'supplierCode' - }, - { - label: '订单号', - field: 'poNumber' - }, - { - label: '订单行', - field: 'poLine' - }, - { - label: '采购价格', - field: 'purchasePrice' - }, - { - label: '可开票数量', - field: 'invoicableQuantity' - }, - { - label: '物料代码', - field: 'itemCode' - }, - { - label: '创建时间', - field: 'createTime', - isTable: true, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - isTableForm: false, - isForm: false - } -])) - - -/** - * @returns {Array} 供应商发票申请主表 - */ -export const SupplierinvoiceRequestMain = useCrudSchemas(reactive([ - { - label: '单据号', - field: 'number', - sort: 'custom', - table: { - width: 180, - fixed: 'left' - }, - isSearch: true, - isForm: false - }, - { - label: '供应商代码', - field: 'supplierCode', - sort: 'custom', - table: { - width: 150 - }, - sortTableDefault:1, - isSearch: true, - form: { - // labelMessage: '信息提示说明!!!', - componentProps: { - isSearchList: true, // 开启查询弹窗 - searchListPlaceholder: '请选择供应商代码', // 输入框占位文本 - searchField: 'code', // 查询弹窗赋值字段 - searchTitle: '供应商信息', // 查询弹窗标题 - searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 - searchPage: SupplierApi.getSupplierPageSCP // 查询弹窗所需分页方法 - } - } - }, - { - label: '订单类型', - field: 'orderType', - dictType: DICT_TYPE.PURCHASE_INVOICE_ORDER_TYPE, - dictClass: 'string', - isTable: false, - sort: 'custom', - table: { - width: 150 - }, - }, - { - label: '供应商名称', - field: 'supplierName', - sort: 'custom', - table: { - width: 180, - }, - sortTableDefault:2, - isForm: false - }, - { - label: '状态', - field: 'status', - dictType: DICT_TYPE.SUPPLIERINVOICE_REQUEST_STATUS, - dictClass: 'string', - isTable: true, - isForm:false, - sort: 'custom', - table: { - width: 150 - }, - sortTableDefault:6, - isSearch: true, - form: { - value: '1', - componentProps: { - disabled: true - } - } - }, - { - label: '金额', - field: 'amount', - formatter: accountantFormart, - table: { - width: 150 - }, - sortTableDefault:5, - form: { - component: 'InputNumber', - componentProps: { - min: 0, - precision: 6, - disabled: true, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '税率(%)', - field: 'taxRate', - dictType: DICT_TYPE.TAX_RATE_DICT, - dictClass: 'string', - sortTableDefault:3, - isTable: true, - sort: 'custom', - table: { - width: 150 - }, - }, - { - label: '税额', - field: 'taxAmount', - formatter: accountantFormart, - table: { - width: 150 - }, - sortTableDefault:3, - form: { - component: 'InputNumber', - componentProps: { - min: 0, - precision: 6, - disabled: true, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '未税金额', - field: 'beforeTaxAmount', - formatter: accountantFormart, - table: { - width: 150 - }, - sortTableDefault:3, - isForm:false, - isTableForm:false - }, - { - label: '价税合计金额', - field: 'adTaxAmount', - formatter: accountantFormart, - table: { - width: 150 - }, - sortTableDefault:3, - isForm:false, - isTableForm:false - }, - { - label: '税后金额', - field: 'afterTaxAmount', - formatter: accountantFormart, - table: { - width: 150 - }, - sortTableDefault:3, - form: { - component: 'InputNumber', - componentProps: { - min: 0, - precision: 6, - disabled: true, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - disabled: true, - } - }, - { - label: '索赔金额', - field: 'claimAmount', - formatter: accountantFormart, - table: { - width: 150 - }, - isTable:false, - isTableForm:false, - isForm:false, - isDetail:false, - form: { - component: 'InputNumber', - componentProps: { - min: 0, - precision: 6, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '调整价差', - field: 'discountAmount', - formatter: accountantFormart, - table: { - width: 150 - }, - isTable:false, - form: { - component: 'InputNumber', - componentProps: { - precision: 6, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '调整税额', - field: 'adjustingTaxAmount', - table: { - width: 150 - }, - isTable:false, - form: { - component: 'InputNumber', - componentProps: { - precision: 6, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '总差额', - field: 'totalDifference', - formatter: accountantFormart, - table: { - width: 150 - }, - isTable:false, - form: { - component: 'InputNumber', - componentProps: { - precision: 6, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '金税票号', - field: 'goldenTaxInvoiceNumber', - table: { - width: 150, - }, - sortTableDefault:7, - form:{ - componentProps: { - maxlength:23, - showWordLimit:true - } - } - }, - { - label: '快递单号', - field: 'expressTrackingNumber', - isTable:false, - isForm:false, - table: { - width: 150 - }, - }, - { - label: '开票日期', - field: 'invoiceTime', - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - table: { - width: 180 - }, - sortTableDefault:8, - form: { - component: 'DatePicker', - componentProps: { - style: {width:'100%'}, - type: 'datetime', - dateFormat: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'x', - } - }, - }, - { - label: '采购审批人', - field: 'procurementCreatorName', - sort: 'custom', - table: { - width: 180 - }, - isTable:true, - isDetail: false, - isTableForm: false, - isForm:false, - isSearch:false, - sortTableDefault:9 - }, - { - label: '过账日期', - field: 'postingDate', - 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', - } - }, - }, - { - label: '申请时间', - field: 'requestTime', - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - table: { - width: 180 - }, - isTable:false, - isForm:false, - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - dateFormat: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'x', - } - }, - }, - { - label: '部门', - field: 'departmentCode', - sort: 'custom', - table: { - width: 150 - }, - isTable:false, - isTableForm:false, - isForm:false, - formatter: (_: Recordable, __: TableColumn, cellValue: number) => { - return userDeptArray.find((account) => account.id == cellValue)?.name - }, - form: { - value: userDept.id, - component: 'Select', - api: () => userDeptArray, - componentProps: { - disabled: true, - optionsAlias: { - labelField: 'name', - valueField: 'id' - } - } - } - }, - { - label: '创建者', - field: 'creator', - table: { - width: 150 - }, - isTable:false, - sortTableDefault:1001, - isForm: false, - }, - { - label: '创建时间', - field: 'createTime', - isTable:false, - formatter: dateFormatter, - sortTableDefault:1000, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - table: { - width: 180 - }, - isForm: false, - }, - { - label: '最后更新者', - field: 'updater', - sort: 'custom', - table: { - width: 150 - }, - isTable:false, - isForm: false, - }, - { - label: '最后更新时间', - field: 'updateTime', - isTable: false, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - table: { - width: 180 - }, - isForm: false, - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - - dateFormat: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'x', - } - }, - }, - { - label: '采购价格审批人', - field: 'procurementCreator', - sortTableDefault:1003, - table: { - width: 150 - }, - isForm: true, - isTable:false, - form: { - component: 'Select', - api: () => procurementCreators.list, - componentProps: { - optionsAlias: { - labelField: 'nickname', - valueField: 'id' - } - }, - // labelMessage: '信息提示说明!!!', - // componentProps: { - // isSearchList: true, // 开启查询弹窗 - // hiddenFilterButton:true,//是否隐藏筛选按钮 - // dialogWidth:'665px',//搜索出来弹窗的宽度 - // searchListPlaceholder: '请选择采购员', // 输入框占位文本 - // searchField: 'id', // 查询弹窗赋值字段 - // searchTitle: '采购员信息', // 查询弹窗标题 - // searchAllSchemas: PurchaseMemberInfo.allSchemas, // 查询弹窗所需类 - // searchPage: SupplierinvoiceRequestMainApi.queryUserInfoByRoleCode, // 查询弹窗所需分页方法 - // searchCondition: [{ - // key: 'roleCode', // 查询列表中字段 - // value: 'purchase', // 指查询具体值 - // isMainValue: false // 表示查询条件不是主表的字段的值 - // }] - // } - } - }, - - { - label: '采购审批时间', - field: 'procurementCreateTime', - isTable: true, - sortTableDefault:10, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - table: { - width: 180 - }, - isForm: false, - }, - { - label: '财务审批人', - field: 'financialCreatorName', - sort: 'custom', - table: { - width: 150 - }, - sortTableDefault:11, - isForm: false, - }, - { - label: '采购驳回原因', - field: 'purchaseRejectCause', - table: { - width: 180 - }, - sortTableDefault:14, - isTable: true, - isSearch: false, - isForm: false, - isDetail:false, - }, - { - label: '财务驳回原因', - field: 'financeRejectCause', - table: { - width: 180 - }, - sortTableDefault:15, - isTable: true, - isSearch: false, - isForm: false, - isDetail:false, - }, - { - label: '财务审批时间', - field: 'financialCreateTime', - isTable: true, - sortTableDefault:12, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - table: { - width: 180 - }, - isForm: false, - }, - { - label: '供应商审批人', - field: 'supplierCreator', - sort: 'custom', - isTable:false, - sortTableDefault:1006, - table: { - width: 180 - }, - isForm: false, - }, - { - label: '供应商审批时间', - field: 'supplierCreateTime', - isTable:false, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - table: { - width: 180 - }, - isForm: false, - }, - { - label: '备注', - field: 'remark', - sort: 'custom', - table: { - width: 150 - }, - isForm:false, - isTable: false, - }, - { - label: '自动提交', - field: 'autoCommit', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: false, - isForm:false, - isTableForm:false, - isDetail:false, - sort: 'custom', - table: { - width: 150 - }, - form: { - component: 'Switch', - value: requestsettingData.autoCommit, - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE', - disabled: true, - } - } - }, - { - label: '自动通过', - field: 'autoAgree', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: false, - isForm:false, - isTableForm:false, - isDetail:false, - sort: 'custom', - table: { - width: 150 - }, - form: { - component: 'Switch', - value: requestsettingData.autoAgree, - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE', - disabled: true, - } - } - }, - { - label: '自动执行', - field: 'autoExecute', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: false, - isForm:false, - isTableForm:false, - isDetail:false, - sort: 'custom', - table: { - width: 150 - }, - form: { - component: 'Switch', - value: requestsettingData.autoExecute, - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE', - disabled: true, - } - } - }, - { - label: '跳过任务生成记录', - field: 'directCreateRecord', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isTable: false, - isForm:false, - isTableForm:false, - isDetail:false, - sort: 'custom', - table: { - width: 150 - }, - form: { - component: 'Switch', - value: requestsettingData.directCreateRecord, - componentProps: { - inactiveValue: 'FALSE', - activeValue: 'TRUE', - disabled: true, - } - } - }, - { - label: '操作', - field: 'action', - isDetail: false, - isForm: false, - table: { - width: 300, - fixed: 'right' - }, - } -])) - -const singlePriceFormart = (row, column, cellValue) => { - cellValue= Number(cellValue).toFixed(5) - cellValue = cellValue + '' || '' - - let x = cellValue.split('.') - let x1 = x[0] - let x2 = x.length > 1 ? '.' + x[1] : '' - const reg = /(\d+)(\d{3})/ - while(reg.test(x1)){ - x1 = x1.replace(reg, '$1,$2') - } - return x1+x2 -} - -function validateTaxRate(rule, value, callback) { - if (value>0) { - callback() - }else{ - callback(new Error('税率必须大于0')) - } -} - -//表单校验 -export const SupplierinvoiceRequestMainRules = reactive({ - taxRate: [ - required, - { validator:validateTaxRate, message: '税率必须大于0', trigger: 'blur'} - ], - supplierCode: [ - { required: true, message: '请选择供应商代码', trigger: 'change' } - ], - invoiceTime:[ - { required: false, message: '请选择发票日期', trigger: 'blur' } - ], - goldenTaxInvoiceNumber:[ - { required: false, message: '请输入金税票号', trigger: 'blur' } - ], - departmentCode: [ - { required: true, message: '请输入部门', trigger: 'blur' } - ], - autoCommit: [ - { required: true, message: '请选择是否自动提交', trigger: 'change' } - ], - autoAgree: [ - { required: true, message: '请选择是否自动通过', trigger: 'change' } - ], - autoExecute: [ - { required: true, message: '请选择是否自动执行', trigger: 'change' } - ], - directCreateRecord: [ - { required: true, message: '请选择是否跳过任务直接生成记录', trigger: 'change' } - ], - businessType: [ - { required: true, message: '请输入业务类型', trigger: 'blur' } - ], - remark: [ - { max: 50, message: '不得超过50个字符', trigger: 'blur' } - ], - procurementCreator: [ - { required: true, message: '请选择采购员', trigger: 'change' } - ], -}) - - -/** - * @returns {Array} 供应商发票申请子表 - */ -export const SupplierinvoiceRequestDetail = useCrudSchemas(reactive([ - { - label: '物料代码', - field: 'itemCode', - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - { - label: '物料名称', - field: 'itemName', - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - { - label: '物料描述', - field: 'itemDesc', - table: { - width: 150 - }, - isForm:false, - isTableForm:false, - isDetail: false, - isTable: true, - }, - //仅是主列表页面的筛选搜索条件 - { - label: '收货日期', - field: 'deliveryDate', - sort: 'custom', - isDetail:false, - isTable: false, - isForm:false, - isTableForm:false, - isSearch:true, - formatter: dateFormatter, - search: { - value:[], - component: 'DatePicker', - componentProps: { - valueFormat: 'YYYY-MM-DD', - type: 'daterange', - defaultTime: [new Date('1 '), new Date('1 ')] - } - }, - }, - { - label: '收货日期', - field: 'deliveryDate', - table: { - width: 150 - }, - formatter: dateFormatter2, - isForm:false, - isTableForm:true, - isDetail: false, - isTable: true, - tableForm:{ - disabled:true - } - }, - { - label: '可开票数量', - field: 'invoicableQuantity', - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - { - label: '合同价格', - field: 'singlePrice', - formatter: singlePriceFormart, - table: { - width: 150 - }, - form: { - component: 'InputNumber', - componentProps: { - min: 0, - precision: 6, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '采购价格', - field: 'purchasePrice', - formatter: singlePriceFormart, - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true, - min: 0, - precision: 6, - } - }, - tableForm:{ - disabled: true, - min: 0, - precision: 6, - } - }, - { - label: '差额', - field: 'differencePrice', - formatter: singlePriceFormart, - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true, - min: 0, - precision: 6, - } - }, - tableForm:{ - type: 'slot', - disabled: true, - min: 0, - precision: 6, - } - }, - { - label: '到货数量', - field: 'arrivalQty', - table: { - width: 150 - }, - isForm:false, - isTableForm:true, - isDetail: false, - isTable: true, - tableForm:{ - disabled:true - } - }, - { - label: '订单号', - field: 'poNumber', - form: { - componentProps: { - disabled: true - } - }, - table: { - width: 150 - }, - tableForm:{ - disabled: true - } - }, - { - label: '订单行', - field: 'poLine', - table: { - width: 150 - }, - form: { - // labelMessage: '信息提示说明!!!', - componentProps: { - multiple:true,//多选 - isSearchList: true, - searchListPlaceholder: '请选择订单行', - searchField: 'poLine', - searchTitle: '待开票列表', - searchAllSchemas: PurchaseReceiptOrReturnRecordDetail.allSchemas, - searchPage: supplierinvoiceRequestDetailApi.getPoNumberPoLineInfo, - searchCondition: [ - { - key: 'supplierCode', - value: 'supplierCode', - message: '请填供应商信息!', - isMainValue: true - },{ - key: 'orderType', - value: 'orderType', - message: '请填订单类型!', - isMainValue: true - } - ] - } - }, - tableForm: { - multiple:true,//多选 - isInpuFocusShow: true, - searchListPlaceholder: '请选择订单行', - searchField: 'poLine', - searchTitle: '待开票列表', - searchAllSchemas: PurchaseReceiptOrReturnRecordDetail.allSchemas, - searchPage: supplierinvoiceRequestDetailApi.getPoNumberPoLineInfo, - searchCondition: [ - { - key: 'supplierCode', - value: 'supplierCode', - message: '请填供应商信息!', - isMainValue: true - }, - { - key: 'orderType', - value: 'orderType', - message: '请填订单类型!', - isMainValue: true - } - ] - } - }, - { - label: '待开票单据号', - field: 'recvBillNum', - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - { - label: '单据类型', - field: 'billType', - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - { - label: '供应商发货单号', - field: 'asnBillNum', - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - { - label: '供应商代码', - field: 'supplierCode', - hiddenInMain:true, - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - - { - label: '未税差额', - field: 'untaxedDifference', - formatter: accountantFormart, - table: { - width: 150 - }, - form: { - component: 'InputNumber', - componentProps: { - precision: 6, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - { - label: '含税差额', - field: 'taxInclusiveDifference', - formatter: accountantFormart, - table: { - width: 150 - }, - form: { - component: 'InputNumber', - componentProps: { - precision: 6, - } - }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 6, - } - }, - - - //仅是主列表页面的筛选搜索条件 - { - label: '创建时间', - field: 'createTime', - sort: 'custom', - isDetail:false, - isTable: false, - isForm:false, - isTableForm:false, - isSearch:true, - formatter: dateFormatter, - search: { - value:[], - component: 'DatePicker', - componentProps: { - valueFormat: 'YYYY-MM-DD HH:mm:ss', - dateFormat: 'YYYY-MM-DD HH:mm:ss', - type: 'datetimerange', - defaultTime: [new Date('1 '), new Date('1 ')] - } - }, - - }, - - { - label: '货币', - field: 'currency', - table: { - width: 150 - }, - form: { - componentProps: { - disabled: true - } - }, - tableForm:{ - disabled: true - } - }, - { - label: '备注', - field: 'remark', - hiddenInMain:true, - }, - { - label: '创建时间', - field: 'createTime', - hiddenInMain:true, - isTable: false, - table: { - width: 150 - }, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - isTableForm: false, - isForm: false - }, - { - label: '创建者', - field: 'creator', - hiddenInMain:true, - isTableForm: false, - isTable:false, - isForm: false, - table: { - width: 150 - }, - }, - { - label: '操作', - field: 'action', - isDetail: false, - isForm: false, - table: { - width: 250, - fixed: 'right' - }, - hiddenInMain:true, - isTableForm: false, - } -])) -// 批次校验 -const validateSinglePrice = (rule: any, value: any, callback: any) => { - if (Number(value)>0) { - callback(); - } else { - callback(new Error('请输入合同价格')); - } -} -//表单校验 -export const SupplierinvoiceRequestDetailRules = reactive({ - singlePrice: [ - { required: true, message: '请输入合同价格', trigger: 'change' }, - { validator: validateSinglePrice, trigger: 'change' } - ], -}) +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' +import { accountantFormart } from '@/utils/formatter' + +import * as SupplierApi from '@/api/wms/supplier' +import * as SupplierinvoiceRequestMainApi from '@/api/wms/supplierinvoiceRequestMain' +import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' +const { t } = useI18n() // 国际化 + +import * as getRequestsettingApi from '@/api/wms/requestsetting/index' +import * as supplierinvoiceRequestDetailApi from '@/api/wms/supplierinvoiceRequestDetail' + +// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 +const queryParams = { + pageSize: 10, + pageNo: 1, + code: 'PurchaseInvoiceRequest' +} +const data = await getRequestsettingApi.getRequestsettingPage(queryParams) +const requestsettingData = data?.list[0] || {} + + // 获取当前操作人的部门 + import { useUserStore } from '@/store/modules/user' + import { TableColumn } from '@/types/table' + const userStore = useUserStore() + const userDept = userStore.userSelfInfo.dept + // id 转str 否则form回显匹配不到 + userDept.id = userDept.id.toString() + const userDeptArray:any = [userDept] + +const procurementCreators = await SupplierinvoiceRequestMainApi.queryUserInfoByRoleCode({ roleCode: 'purchase',pageSize: 1000,pageNo: 1,sort: '',by: 'ASC' }) +/** + * @returns {Array} 采购员列表 + */ +export const PurchaseMemberInfo = useCrudSchemas(reactive([ + { + label: '用户编号', + field: 'id', + table: { + width: 180, + }, + }, + { + label: '用户名称', + field: 'username', + table: { + width: 180, + }, + }, + { + label: '用户昵称', + field: 'nickname', + table: { + width: 180, + }, + } +])) + +/** + * @returns {Array} 采购订单或者采购退货单 + */ +export const PurchaseReceiptOrReturnRecordDetail = useCrudSchemas(reactive([ + { + label: '单据类型', + field: 'billType' + }, + { + label: '收货日期', + field: 'deliveryDate', + sort: 'custom', + isDetail:false, + isTable: true, + isForm:false, + isTableForm:false, + isSearch:true, + formatter: dateFormatter2, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD', + type: 'daterange', + defaultTime: [new Date('1 '), new Date('1 ')] + } + }, + }, + { + label: '待开票单据号', + field: 'recvBillNum', + table: { + width: 180, + }, + }, + { + label: '供应商发货单号', + field: 'asnBillNum', + table: { + width: 180, + }, + }, + { + label: '供应商代码', + field: 'supplierCode' + }, + { + label: '订单号', + field: 'poNumber' + }, + { + label: '订单行', + field: 'poLine' + }, + { + label: '采购价格', + field: 'purchasePrice' + }, + { + label: '可开票数量', + field: 'invoicableQuantity' + }, + { + label: '物料代码', + field: 'itemCode' + }, + { + label: '创建时间', + field: 'createTime', + isTable: true, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + isTableForm: false, + isForm: false + } +])) + + +/** + * @returns {Array} 供应商发票申请主表 + */ +export const SupplierinvoiceRequestMain = useCrudSchemas(reactive([ + { + label: '单据号', + field: 'number', + sort: 'custom', + table: { + width: 180, + fixed: 'left' + }, + isSearch: true, + isForm: false + }, + { + label: '供应商代码', + field: 'supplierCode', + sort: 'custom', + table: { + width: 150 + }, + sortTableDefault:1, + isSearch: true, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择供应商代码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '供应商信息', // 查询弹窗标题 + searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 + searchPage: SupplierApi.getSupplierPageSCP // 查询弹窗所需分页方法 + } + } + }, + { + label: '订单类型', + field: 'orderType', + dictType: DICT_TYPE.PURCHASE_INVOICE_ORDER_TYPE, + dictClass: 'string', + isTable: false, + sort: 'custom', + table: { + width: 150 + }, + }, + { + label: '供应商名称', + field: 'supplierName', + sort: 'custom', + table: { + width: 180, + }, + sortTableDefault:2, + isForm: false + }, + { + label: '状态', + field: 'status', + dictType: DICT_TYPE.SUPPLIERINVOICE_REQUEST_STATUS, + dictClass: 'string', + isTable: true, + isForm:false, + sort: 'custom', + table: { + width: 150 + }, + sortTableDefault:6, + isSearch: true, + form: { + value: '1', + componentProps: { + disabled: true + } + } + }, + { + label: '系统未税金额', + field: 'amount', + formatter: accountantFormart, + table: { + width: 150 + }, + sortTableDefault:5, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 6, + disabled: true, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + { + label: '税率(%)', + field: 'taxRate', + dictType: DICT_TYPE.TAX_RATE_DICT, + dictClass: 'string', + sortTableDefault:3, + isTable: true, + sort: 'custom', + table: { + width: 150 + }, + }, + + { + label: '未税金额', + field: 'beforeTaxAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + sortTableDefault:3, + isForm:false, + isTableForm:false + }, + { + label: '税额', + field: 'totalTaxAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + sortTableDefault:3, + isForm:false, + isTableForm:false + }, + { + label: '价税合计金额', + field: 'adTaxAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + sortTableDefault:3, + isForm:false, + isTableForm:false + }, + { + label: '系统税额', + field: 'taxAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + sortTableDefault:3, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 6, + disabled: true, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + { + label: '系统价税合计', + field: 'afterTaxAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + sortTableDefault:3, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 6, + disabled: true, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + disabled: true, + } + }, + { + label: '索赔金额', + field: 'claimAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + isTable:false, + isTableForm:false, + isForm:false, + isDetail:false, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + { + label: '调整价差', + field: 'discountAmount', + formatter: accountantFormart, + table: { + width: 150 + }, + isTable:false, + form: { + component: 'InputNumber', + componentProps: { + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + { + label: '调整税额', + field: 'adjustingTaxAmount', + table: { + width: 150 + }, + isTable:false, + form: { + component: 'InputNumber', + componentProps: { + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + { + label: '折扣金额', + field: 'discountAmount1', + formatter: accountantFormart, + table: { + width: 150 + }, + isTable:false, + form: { + component: 'InputNumber', + componentProps: { + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + + // { + // label: '总差额', + // field: 'totalDifference', + // formatter: accountantFormart, + // table: { + // width: 150 + // }, + // isTable:false, + // form: { + // component: 'InputNumber', + // componentProps: { + // precision: 6, + // } + // }, + // tableForm: { + // type: 'InputNumber', + // min: 0, + // precision: 6, + // } + // }, + { + label: '金税票号', + field: 'goldenTaxInvoiceNumber', + table: { + width: 150, + }, + sortTableDefault:7, + form:{ + componentProps: { + maxlength:23, + showWordLimit:true + } + } + }, + { + label: '快递单号', + field: 'expressTrackingNumber', + isTable:false, + isForm:false, + table: { + width: 150 + }, + }, + { + label: '开票日期', + field: 'invoiceTime', + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + sortTableDefault:8, + form: { + component: 'DatePicker', + componentProps: { + style: {width:'100%'}, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + } + }, + }, + { + label: '采购审批人', + field: 'procurementCreatorName', + sort: 'custom', + table: { + width: 180 + }, + isTable:true, + isDetail: false, + isTableForm: false, + isForm:false, + isSearch:false, + sortTableDefault:9 + }, + { + label: '过账日期', + field: 'postingDate', + 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', + } + }, + }, + { + label: '申请时间', + field: 'requestTime', + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + isTable:false, + isForm:false, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + } + }, + }, + { + label: '部门', + field: 'departmentCode', + sort: 'custom', + table: { + width: 150 + }, + isTable:false, + isTableForm:false, + isForm:false, + formatter: (_: Recordable, __: TableColumn, cellValue: number) => { + return userDeptArray.find((account) => account.id == cellValue)?.name + }, + form: { + value: userDept.id, + component: 'Select', + api: () => userDeptArray, + componentProps: { + disabled: true, + optionsAlias: { + labelField: 'name', + valueField: 'id' + } + } + } + }, + { + label: '创建者', + field: 'creator', + table: { + width: 150 + }, + isTable:false, + sortTableDefault:1001, + isForm: false, + }, + { + label: '创建时间', + field: 'createTime', + isTable:false, + formatter: dateFormatter, + sortTableDefault:1000, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + isForm: false, + }, + { + label: '最后更新者', + field: 'updater', + sort: 'custom', + table: { + width: 150 + }, + isTable:false, + isForm: false, + }, + { + label: '最后更新时间', + field: 'updateTime', + isTable: false, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + isForm: false, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + } + }, + }, + { + label: '采购价格审批人', + field: 'procurementCreator', + sortTableDefault:1003, + table: { + width: 150 + }, + isForm: true, + isTable:false, + form: { + component: 'Select', + api: () => procurementCreators.list, + componentProps: { + optionsAlias: { + labelField: 'nickname', + valueField: 'id' + } + }, + // labelMessage: '信息提示说明!!!', + // componentProps: { + // isSearchList: true, // 开启查询弹窗 + // hiddenFilterButton:true,//是否隐藏筛选按钮 + // dialogWidth:'665px',//搜索出来弹窗的宽度 + // searchListPlaceholder: '请选择采购员', // 输入框占位文本 + // searchField: 'id', // 查询弹窗赋值字段 + // searchTitle: '采购员信息', // 查询弹窗标题 + // searchAllSchemas: PurchaseMemberInfo.allSchemas, // 查询弹窗所需类 + // searchPage: SupplierinvoiceRequestMainApi.queryUserInfoByRoleCode, // 查询弹窗所需分页方法 + // searchCondition: [{ + // key: 'roleCode', // 查询列表中字段 + // value: 'purchase', // 指查询具体值 + // isMainValue: false // 表示查询条件不是主表的字段的值 + // }] + // } + } + }, + + { + label: '采购审批时间', + field: 'procurementCreateTime', + isTable: true, + sortTableDefault:10, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + isForm: false, + }, + { + label: '财务审批人', + field: 'financialCreatorName', + sort: 'custom', + table: { + width: 150 + }, + sortTableDefault:11, + isForm: false, + }, + { + label: '采购驳回原因', + field: 'purchaseRejectCause', + table: { + width: 180 + }, + sortTableDefault:14, + isTable: true, + isSearch: false, + isForm: false, + isDetail:false, + }, + { + label: '财务驳回原因', + field: 'financeRejectCause', + table: { + width: 180 + }, + sortTableDefault:15, + isTable: true, + isSearch: false, + isForm: false, + isDetail:false, + }, + { + label: '财务审批时间', + field: 'financialCreateTime', + isTable: true, + sortTableDefault:12, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + isForm: false, + }, + { + label: '供应商审批人', + field: 'supplierCreator', + sort: 'custom', + isTable:false, + sortTableDefault:1006, + table: { + width: 180 + }, + isForm: false, + }, + { + label: '供应商审批时间', + field: 'supplierCreateTime', + isTable:false, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + table: { + width: 180 + }, + isForm: false, + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + table: { + width: 150 + }, + isForm:false, + isTable: false, + }, + { + label: '自动提交', + field: 'autoCommit', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: false, + isForm:false, + isTableForm:false, + isDetail:false, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'Switch', + value: requestsettingData.autoCommit, + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE', + disabled: true, + } + } + }, + { + label: '自动通过', + field: 'autoAgree', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: false, + isForm:false, + isTableForm:false, + isDetail:false, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'Switch', + value: requestsettingData.autoAgree, + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE', + disabled: true, + } + } + }, + { + label: '自动执行', + field: 'autoExecute', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: false, + isForm:false, + isTableForm:false, + isDetail:false, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'Switch', + value: requestsettingData.autoExecute, + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE', + disabled: true, + } + } + }, + { + label: '跳过任务生成记录', + field: 'directCreateRecord', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isTable: false, + isForm:false, + isTableForm:false, + isDetail:false, + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'Switch', + value: requestsettingData.directCreateRecord, + componentProps: { + inactiveValue: 'FALSE', + activeValue: 'TRUE', + disabled: true, + } + } + }, + { + label: '操作', + field: 'action', + isDetail: false, + isForm: false, + table: { + width: 300, + fixed: 'right' + }, + } +])) + +const singlePriceFormart = (row, column, cellValue) => { + cellValue= Number(cellValue).toFixed(5) + cellValue = cellValue + '' || '' + + let x = cellValue.split('.') + let x1 = x[0] + let x2 = x.length > 1 ? '.' + x[1] : '' + const reg = /(\d+)(\d{3})/ + while(reg.test(x1)){ + x1 = x1.replace(reg, '$1,$2') + } + return x1+x2 +} + +function validateTaxRate(rule, value, callback) { + if (value>0) { + callback() + }else{ + callback(new Error('税率必须大于0')) + } +} + +//表单校验 +export const SupplierinvoiceRequestMainRules = reactive({ + taxRate: [ + required, + { validator:validateTaxRate, message: '税率必须大于0', trigger: 'blur'} + ], + supplierCode: [ + { required: true, message: '请选择供应商代码', trigger: 'change' } + ], + invoiceTime:[ + { required: false, message: '请选择发票日期', trigger: 'blur' } + ], + goldenTaxInvoiceNumber:[ + { required: false, message: '请输入金税票号', trigger: 'blur' } + ], + departmentCode: [ + { required: true, message: '请输入部门', trigger: 'blur' } + ], + autoCommit: [ + { required: true, message: '请选择是否自动提交', trigger: 'change' } + ], + autoAgree: [ + { required: true, message: '请选择是否自动通过', trigger: 'change' } + ], + autoExecute: [ + { required: true, message: '请选择是否自动执行', trigger: 'change' } + ], + directCreateRecord: [ + { required: true, message: '请选择是否跳过任务直接生成记录', trigger: 'change' } + ], + businessType: [ + { required: true, message: '请输入业务类型', trigger: 'blur' } + ], + remark: [ + { max: 50, message: '不得超过50个字符', trigger: 'blur' } + ], + procurementCreator: [ + { required: true, message: '请选择采购员', trigger: 'change' } + ], +}) + + +/** + * @returns {Array} 供应商发票申请子表 + */ +export const SupplierinvoiceRequestDetail = useCrudSchemas(reactive([ + { + label: '物料代码', + field: 'itemCode', + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + { + label: '物料名称', + field: 'itemName', + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + { + label: '物料描述', + field: 'itemDesc', + table: { + width: 150 + }, + isForm:false, + isTableForm:false, + isDetail: false, + isTable: true, + }, + //仅是主列表页面的筛选搜索条件 + { + label: '收货日期', + field: 'deliveryDate', + sort: 'custom', + isDetail:false, + isTable: false, + isForm:false, + isTableForm:false, + isSearch:true, + formatter: dateFormatter, + search: { + value:[], + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD', + type: 'daterange', + defaultTime: [new Date('1 '), new Date('1 ')] + } + }, + }, + { + label: '收货日期', + field: 'deliveryDate', + table: { + width: 150 + }, + formatter: dateFormatter2, + isForm:false, + isTableForm:true, + isDetail: false, + isTable: true, + tableForm:{ + disabled:true + } + }, + { + label: '可开票数量', + field: 'invoicableQuantity', + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + { + label: '合同价格', + field: 'singlePrice', + formatter: singlePriceFormart, + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + { + label: '采购价格', + field: 'purchasePrice', + formatter: singlePriceFormart, + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true, + min: 0, + precision: 6, + } + }, + tableForm:{ + disabled: true, + min: 0, + precision: 6, + } + }, + { + label: '差额', + field: 'differencePrice', + formatter: singlePriceFormart, + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true, + min: 0, + precision: 6, + } + }, + tableForm:{ + type: 'slot', + disabled: true, + min: 0, + precision: 6, + } + }, + { + label: '到货数量', + field: 'arrivalQty', + table: { + width: 150 + }, + isForm:false, + isTableForm:true, + isDetail: false, + isTable: true, + tableForm:{ + disabled:true + } + }, + { + label: '订单号', + field: 'poNumber', + form: { + componentProps: { + disabled: true + } + }, + table: { + width: 150 + }, + tableForm:{ + disabled: true + } + }, + { + label: '订单行', + field: 'poLine', + table: { + width: 150 + }, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + multiple:true,//多选 + isSearchList: true, + searchListPlaceholder: '请选择订单行', + searchField: 'poLine', + searchTitle: '待开票列表', + searchAllSchemas: PurchaseReceiptOrReturnRecordDetail.allSchemas, + searchPage: supplierinvoiceRequestDetailApi.getPoNumberPoLineInfo, + searchCondition: [ + { + key: 'supplierCode', + value: 'supplierCode', + message: '请填供应商信息!', + isMainValue: true + },{ + key: 'orderType', + value: 'orderType', + message: '请填订单类型!', + isMainValue: true + } + ] + } + }, + tableForm: { + multiple:true,//多选 + isInpuFocusShow: true, + searchListPlaceholder: '请选择订单行', + searchField: 'poLine', + searchTitle: '待开票列表', + searchAllSchemas: PurchaseReceiptOrReturnRecordDetail.allSchemas, + searchPage: supplierinvoiceRequestDetailApi.getPoNumberPoLineInfo, + searchCondition: [ + { + key: 'supplierCode', + value: 'supplierCode', + message: '请填供应商信息!', + isMainValue: true + }, + { + key: 'orderType', + value: 'orderType', + message: '请填订单类型!', + isMainValue: true + } + ] + } + }, + { + label: '待开票单据号', + field: 'recvBillNum', + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + { + label: '单据类型', + field: 'billType', + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + { + label: '供应商发货单号', + field: 'asnBillNum', + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + { + label: '供应商代码', + field: 'supplierCode', + hiddenInMain:true, + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + + { + label: '未税差额', + field: 'untaxedDifference', + formatter: accountantFormart, + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + { + label: '含税差额', + field: 'taxInclusiveDifference', + formatter: accountantFormart, + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + precision: 6, + } + }, + tableForm: { + type: 'InputNumber', + min: 0, + precision: 6, + } + }, + + + //仅是主列表页面的筛选搜索条件 + { + label: '创建时间', + field: 'createTime', + sort: 'custom', + isDetail:false, + isTable: false, + isForm:false, + isTableForm:false, + isSearch:true, + formatter: dateFormatter, + search: { + value:[], + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'datetimerange', + defaultTime: [new Date('1 '), new Date('1 ')] + } + }, + + }, + + { + label: '货币', + field: 'currency', + table: { + width: 150 + }, + form: { + componentProps: { + disabled: true + } + }, + tableForm:{ + disabled: true + } + }, + { + label: '备注', + field: 'remark', + hiddenInMain:true, + }, + { + label: '创建时间', + field: 'createTime', + hiddenInMain:true, + isTable: false, + table: { + width: 150 + }, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + isTableForm: false, + isForm: false + }, + { + label: '创建者', + field: 'creator', + hiddenInMain:true, + isTableForm: false, + isTable:false, + isForm: false, + table: { + width: 150 + }, + }, + { + label: '操作', + field: 'action', + isDetail: false, + isForm: false, + table: { + width: 250, + fixed: 'right' + }, + hiddenInMain:true, + isTableForm: false, + } +])) +// 批次校验 +const validateSinglePrice = (rule: any, value: any, callback: any) => { + if (Number(value)>0) { + callback(); + } else { + callback(new Error('请输入合同价格')); + } +} +//表单校验 +export const SupplierinvoiceRequestDetailRules = reactive({ + singlePrice: [ + { required: true, message: '请输入合同价格', trigger: 'change' }, + { validator: validateSinglePrice, trigger: 'change' } + ], +})