| | |
| | | <el-table-column label="供应商名称" prop="supplierName" show-overflow-tooltip /> |
| | | <el-table-column label="项目名称" prop="projectName" 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"> |
| | | <!-- <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> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | |
| | | </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-date-picker disabled style="width: 100%" v-model="form.issueDate" type="date" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-table-column label="不含税总价(元)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="本次来票数" prop="ticketsNum" width="170"> |
| | | <template #default="scope"> |
| | | <el-input-number v-model="scope.row.ticketsNum" :precision="0" :step="1" clearable style="width: 100%" |
| | | @blur="invoiceNumBlur(scope.row)" /> |
| | | <el-input-number v-model="scope.row.ticketsNum" placeholder="请选择" :precision="0" :step="1" clearable style="width: 100%" |
| | | @change="invoiceNumBlur(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount" :formatter="formattedNumber"></el-table-column> |
| | | <el-table-column label="本次来票金额(元)" prop="ticketsAmount" :formatter="formattedNumber"> |
| | | <template #default="scope"> |
| | | {{ scope.row.ticketsAmount || 0 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="未来票数" prop="futureTickets" |
| | | :formatter="(row) => row.futureTickets == null || row.futureTickets === '' ? row.quantity : row.futureTickets"> |
| | | : ="(row) => row.futureTickets == null || row.futureTickets === '' ? row.quantity : row.futureTickets"> |
| | | </el-table-column> |
| | | <el-table-column label="未来票金额(元)" prop="futureTicketsAmount" |
| | | :formatter="(row) => (row.futureTicketsAmount !== undefined && row.futureTicketsAmount !== null && row.futureTicketsAmount !== '' ? row.futureTicketsAmount : row.taxExclusiveTotalPrice)"> |
| | |
| | | purchaseContractNumber: '', |
| | | }, |
| | | form: { |
| | | issueDate:"",// 开票日期 |
| | | purchaseLedgerId: '', |
| | | purchaseLedgerNo: '', |
| | | issUerId: '', // 开票人id |
| | | issUer: '' ,// 开票人姓名 |
| | | invoiceNumber:"", // 发票号 |
| | | invoiceAmount:"", // 发票金额 |
| | | }, |
| | | rules: { |
| | | purchaseLedgerId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | invoiceNumber: [{ required: true, message: '请输入发票号' , trigger: 'blur' },{type:"string"}], |
| | | invoiceAmount: [{ required: true, message: '请输入发票金额' , trigger: 'blur'}], |
| | | |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | |
| | | }; |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection |
| | | selectedRows.value = selection.filter(item => item.purchaseContractNumber !== undefined); |
| | | } |
| | | const productSelected = (selectedRows) => { |
| | | productSelectedRows.value = selectedRows |
| | |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | try { |
| | | productList({ salesLedgerId: row.purchaseLedgerId, type: 2 }).then(res => { |
| | | productList({ salesLedgerId: row.id, type: 2 }).then(res => { |
| | | const index = tableData.value.findIndex(item => item.id === row.id); |
| | | if (index > -1) { |
| | | tableData.value[index].children = res.rows; |
| | | tableData.value[index].children = res; |
| | | } |
| | | expandedRowKeys.value.push(row.id) |
| | | }) |
| | |
| | | |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | | invoiceNumBlur(row) |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | | fileList.value = [] |
| | | form.value.issUerId = userStore.id |
| | | form.value.issUer = userStore.name |
| | | form.value.issueDate = getNowFormatDate() |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data |
| | | }) |
| | |
| | | if (type === 'add' && row && row.id) { |
| | | form.value.purchaseLedgerId = row.id |
| | | getPurchaseNoById({ id: row.id }).then(res => { |
| | | purchaseLedgerList.value = res, |
| | | form.value.purchaseLedgerNo = res.purchaseContractNumber; |
| | | form.value.invoiceAmount = res.invoiceAmount; |
| | | form.value.invoiceNumber = res.invoiceNumber; |
| | | setInfo(res.id) |
| | | let result = res.data |
| | | purchaseLedgerList.value = result, |
| | | form.value.purchaseLedgerNo = result.purchaseContractNumber; |
| | | form.value.invoiceAmount = result.invoiceAmount; |
| | | form.value.invoiceNumber = result.invoiceNumber; |
| | | setInfo(result.id) |
| | | }) |
| | | } else { |
| | | getProduct().then(res => { |
| | |
| | | // 选择采购合同号赋值 |
| | | const setInfo = (value) => { |
| | | getInfo({ id: value }).then(res => { |
| | | form.value.salesContractNo = res.salesContractNo |
| | | form.value.projectName = res.projectName |
| | | productData.value = res.productData |
| | | form.value.supplierName = res.supplierName |
| | | let result = res.data |
| | | form.value.salesContractNo = result.salesContractNo |
| | | form.value.projectName = result.projectName |
| | | productData.value = result.productData |
| | | form.value.supplierName = result.supplierName |
| | | }) |
| | | } |
| | | // 提交表单 |
| | |
| | | } |
| | | //本次开票失焦操作 |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.ticketsNum) { |
| | | row.ticketsNum = 0 |
| | | if (!row.ticketsNum || row.ticketsNum === '') { |
| | | row.ticketsNum = 0 |
| | | } |
| | | if (Number(row.ticketsNum) > Number(row.futureTickets)) { |
| | | proxy.$modal.msgWarning('本次开票数不得大于未开票数') |
| | |
| | | // 计算未开票金额 |
| | | row.futureTicketsAmount = row.futureTickets * row.taxInclusiveUnitPrice |
| | | } |
| | | |
| | | // 获取当前日期函数 |
| | | function getNowFormatDate() { |
| | | let date = new Date(), |
| | | year = date.getFullYear(), //获取完整的年份(4位) |
| | | month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月) |
| | | strDate = date.getDate() // 获取当前日(1-31) |
| | | if (month < 10) month = `0${month}` // 如果月份是个位数,在前面补0 |
| | | if (strDate < 10) strDate = `0${strDate}` // 如果日是个位数,在前面补0 |
| | | return `${year}-${month}-${strDate}` |
| | | } |
| | | getList() |
| | | </script> |
| | | |