| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="éæåå·ï¼"> |
| | | <el-input |
| | | v-model="searchForm.no" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> æç´¢ </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <div> |
| | | <el-button type="primary" @click="isShowNewModal = true" |
| | | >æ°å¢</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :tableLoading="tableLoading" |
| | | :isSelection="true" |
| | | :page="page" |
| | | :height="'calc(100vh - 18.5em)'" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="paginationChange" |
| | | > |
| | | <template #operation="{ row }"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | style="color: #67c23a" |
| | | @click="handleDetail(row)" |
| | | >详æ
</el-button |
| | | > |
| | | <el-button link size="small" @click="handleDelete(row)" |
| | | >å é¤</el-button |
| | | > |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <new |
| | | v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | @completed="handleQuery" |
| | | /> |
| | | |
| | | <el-dialog |
| | | v-model="detailVisible" |
| | | title="éè´é货详æ
" |
| | | width="1200" |
| | | destroy-on-close |
| | | > |
| | | <div v-loading="detailLoading"> |
| | | <el-descriptions :column="3" border> |
| | | <el-descriptions-item label="éæåå·">{{ |
| | | detailData.no || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="éè´§æ¹å¼">{{ |
| | | getReturnTypeLabel(detailData.returnType) |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="ä¾åºååç§°">{{ |
| | | detailData.supplierName || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="项ç®é¶æ®µ">{{ |
| | | getProjectPhaseLabel(detailData.projectPhase) |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="å
³èçéè´è®¢åå·">{{ |
| | | detailData.purchaseContractNumber || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="å¶ä½æ¥æ">{{ |
| | | detailData.preparedAt || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="å¶å人">{{ |
| | | detailData.preparedUserName || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="éæäºº">{{ |
| | | detailData.returnUserName || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ´åææ£é¢">{{ |
| | | formatAmount(detailData.totalDiscountAmount) |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="æ´åææ£ç">{{ |
| | | detailData.totalDiscountRate ?? "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="æäº¤éé¢">{{ |
| | | formatAmount(detailData.totalAmount) |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="å建人">{{ |
| | | detailData.createUserName || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="å建æ¶é´">{{ |
| | | detailData.createTime || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="æè¿æ´æ°æ¶é´">{{ |
| | | detailData.updateTime || "--" |
| | | }}</el-descriptions-item> |
| | | <el-descriptions-item label="夿³¨" :span="3">{{ |
| | | detailData.remark || "--" |
| | | }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | |
| | | <el-divider content-position="left">产åå表</el-divider> |
| | | |
| | | <el-table |
| | | :data="detailProducts" |
| | | border |
| | | max-height="420" |
| | | style="width: 100%" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="å
¥åºåå·" prop="inboundBatches" width="150" /> |
| | | <el-table-column label="æ¹æ¬¡å·" prop="batchNo" width="150" /> |
| | | <el-table-column |
| | | label="产å大类" |
| | | prop="productCategory" |
| | | min-width="120" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="è§æ ¼åå·" |
| | | prop="specificationModel" |
| | | min-width="140" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column label="åä½" prop="unit" width="80" /> |
| | | <el-table-column label="æ°é" prop="stockInNum" width="80" /> |
| | | <el-table-column label="å¯éè´§æ°é" |
| | | prop="unQuantity" |
| | | width="100" /> |
| | | <el-table-column label="å·²éè´§æ°é" |
| | | width="100"> |
| | | <template #default="scope"> |
| | | {{ calcAlreadyReturned(scope.row) }} |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="åºåé¢è¦æ°é" prop="warnNum" width="120" /> --> |
| | | <!-- <el-table-column label="ç¨ç(%)" prop="taxRate" width="90" /> --> |
| | | <el-table-column |
| | | label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | width="130" |
| | | > |
| | | <template #default="scope">{{ |
| | | formatAmount(scope.row.taxInclusiveUnitPrice) |
| | | }}</template> |
| | | </el-table-column> |
| | | <!-- <el-table-column |
| | | label="éè´§æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | width="130" |
| | | > |
| | | <template #default="scope">{{ |
| | | formatAmount(scope.row.taxInclusiveTotalPrice) |
| | | }}</template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="ä¸éè´§æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | width="140" |
| | | > |
| | | <template #default="scope">{{ |
| | | formatAmount(scope.row.taxExclusiveTotalPrice) |
| | | }}</template> |
| | | </el-table-column> --> |
| | | <el-table-column |
| | | label="æ¯å¦è´¨æ£" |
| | | prop="isChecked" |
| | | width="100" |
| | | align="center" |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.isChecked ? 'success' : 'info'"> |
| | | {{ scope.row.isChecked ? "æ¯" : "å¦" }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <template #footer> |
| | | <el-button @click="detailVisible = false">å
³é</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { |
| | | ref, |
| | | reactive, |
| | | toRefs, |
| | | onMounted, |
| | | defineAsyncComponent, |
| | | getCurrentInstance, |
| | | } from "vue"; |
| | | const { proxy } = getCurrentInstance(); |
| | | import { |
| | | findPurchaseReturnOrderListPage, |
| | | getPurchaseReturnOrderDetail, |
| | | deletePurchaseReturnOrder, |
| | | } from "@/api/procurementManagement/purchase_return_order.js"; |
| | | const New = defineAsyncComponent(() => |
| | | import("@/views/procurementManagement/purchaseReturnOrder/New.vue") |
| | | ); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const detailVisible = ref(false); |
| | | const detailLoading = ref(false); |
| | | const detailData = ref({}); |
| | | const detailProducts = ref([]); |
| | | // æ¯å¦æ¾ç¤ºæ°å¢å¼¹æ¡ |
| | | const isShowNewModal = ref(false); |
| | | const returnTypeOptions = [ |
| | | { label: "éè´§éæ¬¾", value: 0 }, |
| | | { label: "ææ¶", value: 1 }, |
| | | ]; |
| | | const projectPhaseOptions = [ |
| | | { label: "ç«é¡¹", value: 0 }, |
| | | { label: "设计", value: 1 }, |
| | | { label: "éè´", value: 2 }, |
| | | { label: "ç产", value: 3 }, |
| | | { label: "åºè´§", value: 4 }, |
| | | ]; |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "éæåå·", |
| | | prop: "no", |
| | | }, |
| | | { |
| | | label: "éè´§æ¹å¼", |
| | | prop: "returnType", |
| | | formatData: (val) => |
| | | returnTypeOptions.find((item) => item.value === val)?.label || "--", |
| | | }, |
| | | { |
| | | label: "ä¾åºååç§°", |
| | | prop: "supplierName", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "项ç®é¶æ®µ", |
| | | prop: "projectPhase", |
| | | width: 100, |
| | | formatData: (val) => |
| | | projectPhaseOptions.find((item) => String(item.value) === String(val)) |
| | | ?.label || "--", |
| | | }, |
| | | { |
| | | label: "å
³èçéè´è®¢åå·", |
| | | prop: "purchaseContractNumber", |
| | | width: 160, |
| | | }, |
| | | { |
| | | label: "å¶ä½æ¥æ", |
| | | prop: "preparedAt", |
| | | width: 130, |
| | | }, |
| | | { |
| | | label: "å¶å人", |
| | | prop: "preparedUserName", |
| | | width: 110, |
| | | }, |
| | | { |
| | | label: "éæäºº", |
| | | prop: "returnUserName", |
| | | width: 110, |
| | | }, |
| | | |
| | | { |
| | | label: "æ´åææ£é¢", |
| | | prop: "totalDiscountAmount", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "æ´åææ£ç", |
| | | prop: "totalDiscountRate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "æäº¤éé¢", |
| | | prop: "totalAmount", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å建人", |
| | | prop: "createUserName", |
| | | width: 110, |
| | | }, |
| | | { |
| | | label: "å建æ¶é´", |
| | | prop: "createTime", |
| | | width: 170, |
| | | }, |
| | | { |
| | | label: "æè¿æ´æ°æ¶é´", |
| | | prop: "updateTime", |
| | | width: 170, |
| | | }, |
| | | { |
| | | label: "夿³¨", |
| | | prop: "remark", |
| | | width: 180, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | width: 120, |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | operation: [ |
| | | { |
| | | name: "详æ
", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | handleDetail(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | clickFun: (row) => { |
| | | handleDelete(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | no: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | // å é¤æä½ |
| | | const handleDelete = (row) => { |
| | | console.log("å é¤è¡æ°æ®ï¼", row); |
| | | proxy?.$modal |
| | | ?.confirm("ç¡®å®è¦å é¤åï¼å é¤å°æ æ³æ¢å¤") |
| | | .then(() => { |
| | | // è¿éè°ç¨å 餿¥å£ï¼ä¼ å
¥ row.id |
| | | deletePurchaseReturnOrder(row.id) |
| | | .then(() => { |
| | | proxy?.$modal?.msgSuccess?.("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | proxy?.$modal?.msgError?.("å é¤å¤±è´¥"); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | // åæ¶å é¤ |
| | | proxy?.$modal?.msgInfo?.("已忶å é¤"); |
| | | }); |
| | | }; |
| | | // æ¥ç详æ
|
| | | const handleDetail = (row) => { |
| | | if (!row?.id) { |
| | | proxy?.$modal?.msgWarning?.("æªè·åå°åæ®ID"); |
| | | return; |
| | | } |
| | | detailVisible.value = true; |
| | | detailLoading.value = true; |
| | | getPurchaseReturnOrderDetail(row.id) |
| | | .then((res) => { |
| | | const payload = res?.data || {}; |
| | | detailData.value = payload; |
| | | // æ¼æ¥è¿ä¸ªå¯¹è±¡æä¸ä¸ªå¯¹è±¡ï¼æ¹ä¾¿å±ç¤º item å item.salesLedgerProduct éçåæ®µ |
| | | |
| | | detailProducts.value = |
| | | payload.purchaseReturnOrderProductsDetailVoList.map((item) => ({ |
| | | ...item, |
| | | ...item.salesLedgerProduct, |
| | | })) || []; |
| | | }) |
| | | .catch(() => { |
| | | proxy?.$modal?.msgError?.("è·å详æ
失败"); |
| | | }) |
| | | .finally(() => { |
| | | detailLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | findPurchaseReturnOrderListPage({ ...searchForm.value, ...page }) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | // è¿æ»¤æåæ°æ® |
| | | selectedRows.value = selection.filter((item) => item.id); |
| | | }; |
| | | |
| | | const getReturnTypeLabel = (value) => { |
| | | return ( |
| | | returnTypeOptions.find((item) => String(item.value) === String(value)) |
| | | ?.label || "--" |
| | | ); |
| | | }; |
| | | |
| | | const getProjectPhaseLabel = (value) => { |
| | | return ( |
| | | projectPhaseOptions.find((item) => String(item.value) === String(value)) |
| | | ?.label || "--" |
| | | ); |
| | | }; |
| | | |
| | | const formatAmount = (value) => { |
| | | if (value === null || value === undefined || value === "") { |
| | | return "--"; |
| | | } |
| | | const num = Number(value); |
| | | if (Number.isNaN(num)) { |
| | | return value; |
| | | } |
| | | return num.toFixed(2); |
| | | }; |
| | | |
| | | /** å·²éè´§æ°é = å
¥åºè¡æ»æ°é â å½åå¯éè´§æ°éï¼å©ä½ï¼ */ |
| | | const calcAlreadyReturned = (row) => { |
| | | const total = Number(row?.stockInNum ?? row?.totalQuantity ?? row?.quantity ?? 0); |
| | | const un = Number(row?.unQuantity ?? 0); |
| | | if (!Number.isFinite(total) || !Number.isFinite(un)) return 0; |
| | | return Math.max(total - un, 0); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | <style scoped> |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | </style> |
| | | |