|
@ -32,42 +32,9 @@ |
|
|
<span>{{ row.number }}</span> |
|
|
<span>{{ row.number }}</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
<template #action="{ row,$index }"> |
|
|
|
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
|
|
</template> |
|
|
|
|
|
</Table> |
|
|
</Table> |
|
|
</ContentWrap> |
|
|
</ContentWrap> |
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
|
|
<BasicForm |
|
|
|
|
|
ref="formRef" |
|
|
|
|
|
:isOpenSearchTable="true" |
|
|
|
|
|
fieldTableColumn="itemCode" |
|
|
|
|
|
:rules="CustomerSaleInvoiceMainRules" |
|
|
|
|
|
:formAllSchemas="CustomerSaleInvoiceMain.allSchemas" |
|
|
|
|
|
:tableAllSchemas="CustomerSaleInvoiceDetail.allSchemas" |
|
|
|
|
|
:tableFormRules="CustomerSaleInvoiceDetailRules" |
|
|
|
|
|
:tableData="tableData" |
|
|
|
|
|
:apiUpdate="CustomerSaleInvoiceMainApi.updateCustomerSaleInvoiceMain" |
|
|
|
|
|
:apiCreate="CustomerSaleInvoiceMainApi.createCustomerSaleInvoiceMain" |
|
|
|
|
|
:isBusiness="true" |
|
|
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
|
|
:isShowReduceButtonSelection="true" |
|
|
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
|
|
@submitForm="submitForm" |
|
|
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
|
|
@onChange="onChange" |
|
|
|
|
|
:sumFormDataByTableCustom=" |
|
|
|
|
|
(formRef, formModel, tableData) => { |
|
|
|
|
|
tableData.forEach(item=>{ |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
" |
|
|
|
|
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail |
|
|
<Detail |
|
@ -91,17 +58,15 @@ |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { CustomerSaleInvoiceMain,CustomerSaleInvoiceMainRules,CustomerSaleInvoiceDetailRules,CustomerSaleInvoiceDetail} from './customerSaleInvoiceRecordMain.data' |
|
|
import { CustomerSaleInvoiceMain,CustomerSaleInvoiceDetailRules,CustomerSaleInvoiceDetail} from './customerSaleInvoiceRecordMain.data' |
|
|
import * as CustomerSaleInvoiceMainApi from '@/api/wms/customerSaleInvoiceMain' |
|
|
import * as CustomerSaleInvoiceMainApi from '@/api/wms/customerSaleInvoiceMain' |
|
|
import * as CustomerSaleInvoiceDetailApi from '@/api/wms/customerSaleInvoiceDetail' |
|
|
import * as CustomerSaleInvoiceDetailApi from '@/api/wms/customerSaleInvoiceDetail' |
|
|
import * as CustomerStatementDetailApi from '@/api/wms/customerStatementDetail' |
|
|
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as AreabasicApi from '@/api/wms/areabasic' |
|
|
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
const { loadStart, loadDone } = usePageLoading() |
|
|
// 销售开票记录 |
|
|
// 销售开票记录 |
|
|
defineOptions({ name: 'customerSaleInvoiceMain' }) |
|
|
defineOptions({ name: 'customerSaleInvoiceRecordMain' }) |
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
const message = useMessage() // 消息弹窗 |
|
|
const { t } = useI18n() // 国际化 |
|
|
const { t } = useI18n() // 国际化 |
|
@ -110,83 +75,16 @@ const route = useRoute() // 路由信息 |
|
|
const routeName = ref() |
|
|
const routeName = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
const businessType = ref() |
|
|
const businessType = ref() |
|
|
const importFileName = ref() |
|
|
|
|
|
console.log(99 , routeName.value) |
|
|
|
|
|
const customerCode = ref() |
|
|
|
|
|
const tableColumns = ref(CustomerSaleInvoiceMain.allSchemas.tableColumns) |
|
|
const tableColumns = ref(CustomerSaleInvoiceMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
getListApi: CustomerSaleInvoiceMainApi.getCustomerSaleInvoiceMainPage // 分页接口 |
|
|
getListApi: CustomerSaleInvoiceMainApi.getCustomerSaleInvoiceRecodeMainPage // 分页接口 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
// 字段设置 更新主列表字段 |
|
|
const updataTableColumns = (val) => { |
|
|
const updataTableColumns = (val) => { |
|
|
tableColumns.value = val |
|
|
tableColumns.value = val |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
|
|
nextTick(async () => { |
|
|
|
|
|
if (type == 'tableForm') { |
|
|
|
|
|
if(formField == 'itemCode') { |
|
|
|
|
|
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
|
|
if(itemCodes.length>0){ |
|
|
|
|
|
itemCodes = itemCodes.map(item=>(item['itemCode'])) |
|
|
|
|
|
message.warning(`物料${itemCodes.join(',')}已经存在`) |
|
|
|
|
|
} |
|
|
|
|
|
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
|
|
if(val.length==0) return |
|
|
|
|
|
val.forEach(item=>{ |
|
|
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
|
|
|
|
|
row[formField] = item[searchField] |
|
|
|
|
|
newRow['uom'] = item['customerUom'] |
|
|
|
|
|
newRow['id'] = item['id'] |
|
|
|
|
|
tableData.value.push(newRow) |
|
|
|
|
|
}) |
|
|
|
|
|
}else{ |
|
|
|
|
|
row[formField] = val[0][searchField] |
|
|
|
|
|
} |
|
|
|
|
|
// if(formField == 'itemCode') { |
|
|
|
|
|
// row['uom'] = val[0]['customerUom'] |
|
|
|
|
|
// } |
|
|
|
|
|
// 明细查询页赋值 |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
const setV = {} |
|
|
|
|
|
if(formField == 'customerStatementNumber') { |
|
|
|
|
|
//客户对账单 |
|
|
|
|
|
setV['customer'] = val[0]['customerCode'] |
|
|
|
|
|
setV['customerName'] = val[0]['customerName'] |
|
|
|
|
|
CustomerStatementDetailApi.getCustomerStatementDetailPage({ |
|
|
|
|
|
pageNo:1, |
|
|
|
|
|
pageNSize: 100, |
|
|
|
|
|
masterId:val[0]['id'] |
|
|
|
|
|
}).then((res) => { |
|
|
|
|
|
console.log(55,res) |
|
|
|
|
|
tableData.value = res.list && res.list.length > 0 ?res.list : [] |
|
|
|
|
|
tableData.value.forEach(item=>{ |
|
|
|
|
|
item['sumPrice'] = item['price'] + item['allocationPrice'] |
|
|
|
|
|
// 未税金额 默认等于数量*合计单价,可修改,必填,最多可输入2位小数 |
|
|
|
|
|
item['beforeTaxAmount'] = item['sumPrice']*item['qty'] |
|
|
|
|
|
item['afterTaxAmount'] = item['beforeTaxAmount'] + item['taxAmount'] //含税金额 |
|
|
|
|
|
|
|
|
|
|
|
// 税额:taxAmount 未税价格*税率/100,四舍五入保留2位小数 |
|
|
|
|
|
item['taxAmount'] = (item['beforeTaxAmount'] * formRef.formModel['taxRate'])/100 //含税金额 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
// tableData.value = [] |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
|
|
formRef.setValues(setV) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
// 查询页面返回——详情 |
|
|
// 查询页面返回——详情 |
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
@ -215,21 +113,11 @@ const HeadButttondata = [ |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
// { |
|
|
|
|
|
// label: '自定义扩展按钮', |
|
|
|
|
|
// name: 'zdy', |
|
|
|
|
|
// hide: false, |
|
|
|
|
|
// type: 'primary', |
|
|
|
|
|
// icon: 'Select', |
|
|
|
|
|
// color: '' |
|
|
|
|
|
// }, |
|
|
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
// 头部按钮事件 |
|
|
const buttonBaseClick = (val, item) => { |
|
|
const buttonBaseClick = (val, item) => { |
|
|
if (val == 'add') { // 新增 |
|
|
if (val == 'import') { // 导入 |
|
|
openForm('create') |
|
|
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
|
|
handleImport() |
|
|
handleImport() |
|
|
} else if (val == 'export') { // 导出 |
|
|
} else if (val == 'export') { // 导出 |
|
|
handleExport() |
|
|
handleExport() |
|
@ -247,146 +135,12 @@ const buttonBaseClick = (val, item) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
|
|
const isShowMainButton = (row,val) => { |
|
|
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
|
|
return false |
|
|
|
|
|
} else { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
|
|
const butttondata = (row,$index) => { |
|
|
|
|
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|
|
|
|
|
if(findIndex>-1&&findIndex<$index){ |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
|
|
|
return [ |
|
|
|
|
|
defaultButtons.mainListPlanOpeBtn({hide:isShowMainButton(row,['5']),hasPermi:`wms:${routeName.value}:open`}), // 打开 |
|
|
|
|
|
defaultButtons.mainListPlanCloBtn({hide:isShowMainButton(row,['1','2','3','4']),hasPermi:`wms:${routeName.value}:close`}), // 关闭 |
|
|
|
|
|
defaultButtons.mainListPlanSubBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:submit`}), // 提交审批 |
|
|
|
|
|
defaultButtons.mainListPlanTurBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:reject`}), // 驳回 |
|
|
|
|
|
defaultButtons.mainListPlanAppBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:agree`}), // 审批通过 |
|
|
|
|
|
defaultButtons.mainListPlanPubBtn({hide:isShowMainButton(row,['3']),hasPermi:`wms:${routeName.value}:publish`}), // 发布 |
|
|
|
|
|
defaultButtons.mainListPlanResBtn({hide:isShowMainButton(row,['4']),hasPermi:`wms:${routeName.value}:resetting`}), // 重置 |
|
|
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:update`}), // 编辑 |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
|
|
if (val == 'mainPlanOpe') { // 打开 |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
CustomerSaleInvoiceMainApi.open(row.masterId).then(() => { |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (val == 'mainPlanClo') { // 关闭 |
|
|
|
|
|
await message.confirm('确认要关闭吗?') |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
CustomerSaleInvoiceMainApi.close(row.masterId).then(() => { |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (val == 'mainPlanSub') { // 提交审批 |
|
|
|
|
|
await message.confirm('确认要提交审批吗?') |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
CustomerSaleInvoiceMainApi.submit(row.masterId).then(() => { |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (val == 'mainPlanTur') { // 驳回 |
|
|
|
|
|
await message.confirm('确认要驳回吗?') |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
CustomerSaleInvoiceMainApi.reject(row.masterId).then(() => { |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (val == 'mainPlanApp') { // 审批通过 |
|
|
|
|
|
await message.confirm('确认要审批通过吗?') |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
CustomerSaleInvoiceMainApi.agree(row.masterId).then(() => { |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (val == 'mainPlanPub') { // 发布 |
|
|
|
|
|
await message.confirm('确认要发布吗?') |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
CustomerSaleInvoiceMainApi.publish(row.masterId).then(() => { |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (val == 'mainPlanRes') { // 重置 |
|
|
|
|
|
await message.confirm('确认要重置吗?') |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
CustomerSaleInvoiceMainApi.resetting(row.masterId).then(() => { |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if (val == 'edit') { // 编辑 |
|
|
|
|
|
openForm('update', row) |
|
|
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
|
|
handleDelete(row.masterId) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
|
|
const formRef = ref() |
|
|
|
|
|
const openForm =async (type: string, row?: number) => { |
|
|
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
|
|
formRef.value.open(type, row) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
/** 详情操作 */ |
|
|
const detailRef = ref() |
|
|
const detailRef = ref() |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
detailRef.value.openDetail(row, titleName, titleValue,'planDeliverMain') |
|
|
detailRef.value.openDetail(row, titleName, titleValue,'planDeliverMain') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
|
|
try { |
|
|
|
|
|
// 删除的二次确认 |
|
|
|
|
|
await message.delConfirm() |
|
|
|
|
|
tableObject.loading = true |
|
|
|
|
|
// 发起删除 |
|
|
|
|
|
await CustomerSaleInvoiceMainApi.deleteCustomerSaleInvoiceMain(id) |
|
|
|
|
|
tableObject.loading = false |
|
|
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
|
|
// 刷新列表 |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
} catch {} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
/** 导出按钮操作 */ |
|
|
const handleExport = async () => { |
|
|
const handleExport = async () => { |
|
|
try { |
|
|
try { |
|
@ -403,124 +157,6 @@ const handleExport = async () => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* tableForm方法 |
|
|
|
|
|
*/ |
|
|
|
|
|
const tableFormKeys = {} |
|
|
|
|
|
CustomerSaleInvoiceDetail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
|
|
}) |
|
|
|
|
|
const tableData = ref([]) |
|
|
|
|
|
|
|
|
|
|
|
// 添加明细 |
|
|
|
|
|
const handleAddTable = () => { |
|
|
|
|
|
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys))) |
|
|
|
|
|
} |
|
|
|
|
|
// 删除明细 |
|
|
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
|
|
|
let itemIndex = tableData.value.indexOf(item) |
|
|
|
|
|
if(itemIndex>-1){ |
|
|
|
|
|
tableData.value.splice(itemIndex, 1) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const tableSelectionDelete = (selection) => { |
|
|
|
|
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onChange = (field, cur, formRef)=>{ |
|
|
|
|
|
|
|
|
|
|
|
console.log('onChange',field, cur, formRef) |
|
|
|
|
|
|
|
|
|
|
|
if(field == 'taxRate'){ |
|
|
|
|
|
// 税额:taxAmount 未税价格*税率/100,四舍五入保留2位小数 |
|
|
|
|
|
tableData.value.forEach(item=>{ |
|
|
|
|
|
item['taxAmount'] = (item['beforeTaxAmount'] * cur)/100 //含税金额 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const inputNumberChange = (field, index, row, val) => { |
|
|
|
|
|
console.log('inputNumberChange',field, index, row, val) |
|
|
|
|
|
// 合计单价 = 销售单价 + 模具分摊单价 |
|
|
|
|
|
row['sumPrice'] = row['price'] + row['allocationPrice'] |
|
|
|
|
|
|
|
|
|
|
|
// 含税金额 = 未税价格+税额,四舍五入保留2位小数 |
|
|
|
|
|
row['afterTaxAmount'] = row['beforeTaxAmount'] + row['taxAmount'] |
|
|
|
|
|
|
|
|
|
|
|
// 模具分摊单价 默认从模具分摊对账单带出,未税金额修改后重新计算,等于未税金额/数量-销售单价 |
|
|
|
|
|
row['allocationPrice'] = row['beforeTaxAmount']/row['qty'] - row['price'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
//为true表示子表数据中存在数量为0的数据 |
|
|
|
|
|
const flag = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
// 主子数据 提交 |
|
|
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
|
|
let data = {...submitData} |
|
|
|
|
|
if(data.masterId){ |
|
|
|
|
|
data.id = data.masterId |
|
|
|
|
|
} |
|
|
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
|
|
data.subList.forEach(item=>{ |
|
|
|
|
|
item.toWarehouseCode = data.toWarehouseCode |
|
|
|
|
|
item.toLocationCode = data.toLocationCode |
|
|
|
|
|
}) |
|
|
|
|
|
data.businessType = businessType.value |
|
|
|
|
|
// 判断是否重复物料 |
|
|
|
|
|
let isExist = false |
|
|
|
|
|
tableData.value.forEach(item => { |
|
|
|
|
|
let rs = tableData.value.filter(filterItem => (filterItem.itemCode == item.itemCode)) |
|
|
|
|
|
if(rs.length > 1) isExist = true |
|
|
|
|
|
}) |
|
|
|
|
|
if (isExist) { |
|
|
|
|
|
formRef.value.formLoading = false |
|
|
|
|
|
return message.warning('物料代码重复') |
|
|
|
|
|
} |
|
|
|
|
|
data.subList.forEach(obj => { |
|
|
|
|
|
if(obj.qty == 0){ |
|
|
|
|
|
message.error(`数量不能为0!`) |
|
|
|
|
|
flag.value = true |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
if(flag.value){ |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
var isHave =CustomerSaleInvoiceMain.allSchemas.formSchema.some(function (item) { |
|
|
|
|
|
return item.field === 'beginTime' || item.field === 'endTime'; |
|
|
|
|
|
}); |
|
|
|
|
|
if(isHave){ |
|
|
|
|
|
if(data.beginTime && data.endTime && data.beginTime >=data.expireTime){ |
|
|
|
|
|
message.error('结束时间要大于开始时间') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
console.log(data.beginTime) |
|
|
|
|
|
if(!data.beginTime)data.beginTime = null; |
|
|
|
|
|
if(!data.planDate)data.planDate = null; |
|
|
|
|
|
if(!data.endTime)data.endTime = null; |
|
|
|
|
|
formRef.value.formLoading = true |
|
|
|
|
|
try { |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
await CustomerSaleInvoiceMainApi.createCustomerSaleInvoiceMain(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
await CustomerSaleInvoiceMainApi.updateCustomerSaleInvoiceMain(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
|
|
|
formRef.value.dialogVisible = false |
|
|
|
|
|
// 刷新当前列表 |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
getList() |
|
|
|
|
|
}else{ |
|
|
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
formRef.value.formLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 导入 */ |
|
|
/** 导入 */ |
|
|
const importFormRef = ref() |
|
|
const importFormRef = ref() |
|
|
const handleImport = () => { |
|
|
const handleImport = () => { |
|
|