| | |
| | | <el-table-column label="单位" prop="unit" /> |
| | | <el-table-column label="数量" prop="quantity" /> |
| | | <el-table-column label="税率(%)" prop="taxRate" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber"/> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber"/> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber"/> |
| | | <el-table-column label="本次来票数" prop="ticketsNum" /> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount" /> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount" :formatter="formattedNumber"/> |
| | | <el-table-column label="未来票数" prop="futureTickets" /> |
| | | <el-table-column label="未来票金额(元)" prop="futureTicketsAmount" /> |
| | | <el-table-column label="未来票金额(元)" prop="futureTicketsAmount" :formatter="formattedNumber"/> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-table-column label="采购合同号" prop="purchaseContractNumber" show-overflow-tooltip/> |
| | | <el-table-column label="销售合同号" prop="salesContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="供应商名称" prop="supplierName" show-overflow-tooltip/> |
| | | <el-table-column label="业务员" prop="businessPerson" show-overflow-tooltip/> |
| | | <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip/> |
| | | <el-table-column label="合同金额(元)" prop="contractAmount" show-overflow-tooltip/> |
| | | <el-table-column label="合同金额(元)" prop="contractAmount" show-overflow-tooltip :formatter="formattedNumber"/> |
| | | <el-table-column fixed="right" label="操作" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">编辑</el-button> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="采购合同号:" prop="purchaseLedgerId"> |
| | | <el-select v-model="form.purchaseLedgerId" placeholder="请选择" clearable @change="setInfo"> |
| | | <el-select v-model="form.purchaseLedgerId" placeholder="请选择" clearable @change="setInfo" :disabled="operationType === 'edit'"> |
| | | <el-option v-for="item in purchaseLedgerList" :key="item.id" :label="item.purchaseContractNumber" :value="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="业务员:" prop="businessPersonId"> |
| | | <el-select v-model="form.businessPersonId" placeholder="自动填充" clearable disabled> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"/> |
| | | </el-select> |
| | | <el-form-item label="发票号:" prop="invoiceNumber"> |
| | | <el-input v-model="form.invoiceNumber" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发票金额(元):" prop="invoiceAmount"> |
| | | <el-input type="number" :step="0.01" v-model="form.invoiceAmount" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="开票人:" prop="issUer"> |
| | | <el-input v-model="form.issUer" placeholder="请输入" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="开票日期:" prop="issueDate"> |
| | | <el-date-picker |
| | | disabled |
| | | style="width: 100%" |
| | | v-model="form.issueDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-form-item label="产品信息:" prop="entryDate"> |
| | | </el-form-item> |
| | | </el-row> |
| | | <el-table :data="productData" border @selection-change="productSelected"> |
| | | <el-table :data="productData" border @selection-change="productSelected" show-summary |
| | | :summary-method="summarizeChildrenTable"> |
| | | <el-table-column align="center" label="序号" type="index" width="60" /> |
| | | <el-table-column label="产品大类" prop="productCategory" /> |
| | | <el-table-column label="规格型号" prop="specificationModel" /> |
| | | <el-table-column label="单位" prop="unit" /> |
| | | <el-table-column label="数量" prop="quantity" /> |
| | | <el-table-column label="税率(%)" prop="taxRate" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" /> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" /> |
| | | <el-table-column label="本次来票数" prop="ticketsNum"> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber"/> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber"/> |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber"/> |
| | | <el-table-column label="本次来票数" prop="ticketsNum" width="170"> |
| | | <template #default="scope"> |
| | | <el-input :disabled="!scope.row.editFlag" v-model="scope.row.ticketsNum"></el-input> |
| | | <el-input-number v-model="scope.row.ticketsNum" :precision="0" :step="1" clearable style="width: 100%" @blur="invoiceNumBlur(scope.row)"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount"> |
| | | <template #default="scope"> |
| | | <el-input :disabled="!scope.row.editFlag" v-model="scope.row.ticketsAmount"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未来票数" prop="futureTickets"> |
| | | <template #default="scope"> |
| | | <el-input :disabled="!scope.row.editFlag" v-model="scope.row.futureTickets"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未来票金额(元)" prop="futureTicketsAmount"> |
| | | <template #default="scope"> |
| | | <el-input :disabled="!scope.row.editFlag" v-model="scope.row.futureTicketsAmount"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button v-if="!scope.row.editFlag" link type="primary" size="small" @click="openProductEdit(scope.row);">编辑</el-button> |
| | | <el-button v-else link type="primary" size="small" @click="openProductEdit(scope.row);">保存</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount" :formatter="formattedNumber"></el-table-column> |
| | | <el-table-column label="未来票数" prop="futureTickets"></el-table-column> |
| | | <el-table-column label="未来票金额(元)" prop="futureTicketsAmount" :formatter="formattedNumber"> </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | |
| | | } |
| | | // 主表合计方法 |
| | | const summarizeMainTable = (param) => { |
| | | const { columns, data } = param; |
| | | const sums = []; |
| | | columns.forEach((column, index) => { |
| | | if (index === 0) { |
| | | sums[index] = '合计'; |
| | | return; |
| | | } |
| | | const prop = column.property; |
| | | if (['contractAmount'].includes(prop)) { |
| | | const values = data.map(item => Number(item[prop])); |
| | | if (!values.every(value => isNaN(value))) { |
| | | sums[index] = values.reduce((acc, val) => (!isNaN(val) ? acc + val : acc), 0); |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | }) |
| | | return sums; |
| | | return proxy.summarizeTable(param, ['contractAmount'], { |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | }); |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeChildrenTable = (param) => { |
| | | const { columns, data } = param; |
| | | const sums = []; |
| | | columns.forEach((column, index) => { |
| | | if (index === 0) { |
| | | sums[index] = '合计'; |
| | | return; |
| | | } |
| | | const prop = column.property; |
| | | if (['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'].includes(prop)) { |
| | | const values = data.map(item => Number(item[prop])); |
| | | if (!values.every(value => isNaN(value))) { |
| | | sums[index] = values.reduce((acc, val) => (!isNaN(val) ? acc + val : acc), 0); |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | } else { |
| | | sums[index] = ''; |
| | | } |
| | | }); |
| | | return sums; |
| | | return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'],{ |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | }); |
| | | } |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | |
| | | form.value.projectName = res.projectName |
| | | productData.value = res.productData |
| | | form.value.supplierName = res.supplierName |
| | | form.value.businessPersonId = res.businessPersonId |
| | | }) |
| | | } |
| | | // 提交表单 |
| | |
| | | proxy.$modal.msg("已取消") |
| | | }) |
| | | } |
| | | //本次开票失焦操作 |
| | | const invoiceNumBlur = (row) => { |
| | | if(!row.ticketsNum){ |
| | | row.ticketsNum = 0 |
| | | } |
| | | if(row.ticketsNum > row.futureTickets){ |
| | | proxy.$modal.msgWarning('本次开票数不得大于未开票数') |
| | | row.ticketsNum = 0 |
| | | } |
| | | row.futureTickets = row.futureTickets - row.ticketsNum |
| | | // 计算本次开票金额 |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice |
| | | // 计算未开票数 |
| | | row.futureTickets = row.futureTickets - row.ticketsNum |
| | | // 计算未开票金额 |
| | | row.futureTicketsAmount = row.futureTickets * row.taxInclusiveUnitPrice |
| | | } |
| | | getList() |
| | | </script> |
| | | |