| | |
| | | <div> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="总合同号:"> |
| | | <el-input v-model="searchForm.masterContractNo" |
| | | style="width: 240px" |
| | | placeholder="请输入" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | </el-form-item> |
| | | <el-form-item label="供应商名称:"> |
| | | <el-input v-model="searchForm.supplierName" |
| | | placeholder="请输入" |
| | |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | </el-form-item> |
| | | <el-form-item label="销售合同号:"> |
| | | <el-input v-model="searchForm.salesContractNo" |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="订单号:">--> |
| | | <!-- <el-input v-model="searchForm.salesContractNo"--> |
| | | <!-- placeholder="请输入"--> |
| | | <!-- clearable--> |
| | | <!-- prefix-icon="Search"--> |
| | | <!-- @change="handleQuery" />--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="项目名称:"> |
| | | <el-input v-model="searchForm.projectName" |
| | | placeholder="请输入" |
| | |
| | | <el-button @click="handleOut">导出</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">删除 |
| | | @click="handleDelete" v-hasPermi="['procurementManagement:procurementLedger:remove']">删除 |
| | | </el-button> |
| | | </div> |
| | | <el-table :data="tableData" |
| | |
| | | label="序号" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="总合同号" |
| | | prop="masterContractNo" |
| | | width="150" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="采购合同号" |
| | | prop="purchaseContractNumber" |
| | | width="160" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="销售合同号" |
| | | prop="salesContractNo" |
| | | width="160" |
| | | show-overflow-tooltip /> |
| | | <!-- <el-table-column label="订单号"--> |
| | | <!-- prop="salesContractNo"--> |
| | | <!-- width="160"--> |
| | | <!-- show-overflow-tooltip />--> |
| | | <el-table-column label="供应商名称" |
| | | prop="supplierName" |
| | | width="160" |
| | |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="入库状态" |
| | | prop="stockInStatus" |
| | | width="100" |
| | | show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-tag :type="getStockInStatusType(scope.row.stockInStatus)" |
| | | size="small"> |
| | | {{ scope.row.stockInStatus || '--' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="入库状态"--> |
| | | <!-- prop="stockInStatus"--> |
| | | <!-- width="100"--> |
| | | <!-- show-overflow-tooltip>--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <el-tag :type="getStockInStatusType(scope.row.stockInStatus)"--> |
| | | <!-- size="small">--> |
| | | <!-- {{ scope.row.stockInStatus || '--' }}--> |
| | | <!-- </el-tag>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column label="签订日期" |
| | | prop="executionDate" |
| | | width="100" |
| | |
| | | show-overflow-tooltip /> |
| | | <el-table-column fixed="right" |
| | | label="操作" |
| | | width="120" |
| | | width="200" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openForm('edit', scope.row)" |
| | | :disabled="scope.row.stockInStatus === '完全入库'">编辑 |
| | | @click="openForm('edit', scope.row)">编辑 |
| | | </el-button> |
| | | <el-button link |
| | | type="primary" |
| | | @click="openFileDialog(scope.row)">附件</el-button> |
| | | <el-button link |
| | | type="primary" |
| | | v-if="scope.row.masterContractNo" |
| | | @click="openContractFileDialog(scope.row)">总合同附件 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="销售合同号:" |
| | | prop="salesLedgerId"> |
| | | <el-select v-model="form.salesLedgerId" |
| | | placeholder="请选择" |
| | | filterable |
| | | clearable |
| | | @change="salesLedgerChange"> |
| | | <el-option v-for="item in salesContractList" |
| | | :key="item.id" |
| | | :label="item.salesContractNo" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :span="12">--> |
| | | <!-- <el-form-item label="订单号:"--> |
| | | <!-- prop="salesLedgerId">--> |
| | | <!-- <el-select v-model="form.salesLedgerId"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- filterable--> |
| | | <!-- clearable--> |
| | | <!-- @change="salesLedgerChange">--> |
| | | <!-- <el-option v-for="item in salesContractList"--> |
| | | <!-- :key="item.id"--> |
| | | <!-- :label="item.salesContractNo"--> |
| | | <!-- :value="item.id" />--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | |
| | | <el-select v-model="form.supplierId" |
| | | placeholder="请选择" |
| | | filterable |
| | | clearable> |
| | | clearable |
| | | @change="handleSupplierChange"> |
| | | <el-option v-for="item in supplierList" |
| | | :key="item.id" |
| | | :label="item.supplierName" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="总合同号:"> |
| | | <el-select v-model="form.masterContractNo" |
| | | placeholder="请先选择供应商" |
| | | filterable |
| | | clearable |
| | | :disabled="!form.supplierId"> |
| | | <el-option v-for="item in contractList" |
| | | :key="item.id" |
| | | :label="item.masterContractNo" |
| | | :value="item.masterContractNo" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项目名称" |
| | | prop="projectName"> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="付款方式"> |
| | | <el-input v-model="form.paymentMethod" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | <el-select v-model="form.paymentMethod" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 100%"> |
| | | <el-option label="现金" value="现金" /> |
| | | <el-option label="电汇" value="电汇" /> |
| | | <el-option label="微信" value="微信" /> |
| | | <el-option label="支付宝" value="支付宝" /> |
| | | <el-option label="支票" value="支票" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | <el-form-item label="产品信息:" |
| | | prop="entryDate"> |
| | | <el-button type="primary" |
| | | v-if="form.approvalStatus !== 3" |
| | | @click="openProductForm('add')">添加 |
| | | </el-button> |
| | | <el-button plain |
| | | type="danger" |
| | | v-if="form.approvalStatus !== 3" |
| | | @click="deleteProduct">删除 |
| | | </el-button> |
| | | </el-form-item> |
| | |
| | | <el-button link |
| | | type="primary" |
| | | @click="openProductForm('edit', scope.row, scope.$index)" |
| | | :disabled="scope.row.stockInApprovalStatus === '完全入库'">编辑 |
| | | :disabled="form.approvalStatus === 3">编辑 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | v-model:visible="fileListDialogVisible" |
| | | record-type="purchase_ledger" |
| | | :record-id="recordId" /> |
| | | <!-- 总合同附件弹窗 --> |
| | | <el-dialog |
| | | v-model="contractFileDialogVisible" |
| | | title="总合同附件" |
| | | width="700px" |
| | | :close-on-click-modal="false"> |
| | | <el-table :data="contractFileList" border v-if="contractFileList.length"> |
| | | <el-table-column prop="name" label="文件名称" show-overflow-tooltip /> |
| | | <el-table-column prop="byteSize" label="文件大小" width="120"> |
| | | <template #default="{ row }"> |
| | | {{ formatFileSize(row.byteSize) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="{ row }"> |
| | | <el-link type="primary" :href="row.previewURL" target="_blank">预览</el-link> |
| | | <el-link type="primary" :href="row.downloadURL" style="margin-left: 10px">下载</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-empty v-else description="暂无附件" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | const sparePartsOptions = ref([]); |
| | | const salesContractList = ref([]); |
| | | const supplierList = ref([]); |
| | | const contractList = ref([]); // 供应商合同列表 |
| | | const contractFileDialogVisible = ref(false); |
| | | const contractFileList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const recordId = ref(); |
| | | const fileListDialogVisible = ref(false); |
| | |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import { getSparePartsList } from "@/api/equipmentManagement/spareParts.js"; |
| | | import { getSupplierContractList, getSupplierContractFilesByNo } from "@/api/basicData/supplierContract.js"; |
| | | import dayjs from "dayjs"; |
| | | import FileUpload from "@/components/AttachmentUpload/file/index.vue"; |
| | | |
| | |
| | | 待入库: "info", // 待入库 - 灰色 |
| | | 入库中: "warning", // 入库中 - 橙色 |
| | | 完全入库: "success", // 完全入库 - 绿色 |
| | | 已驳回: "danger", // 已驳回 - 红色 |
| | | }; |
| | | return typeMap[status] || ""; |
| | | }; |
| | |
| | | supplierName: "", // 供应商名称 |
| | | purchaseContractNumber: "", // 采购合同编号 |
| | | salesContractNo: "", // 销售合同编号 |
| | | masterContractNo: "", // 总合同号 |
| | | projectName: "", // 项目名称 |
| | | entryDate: null, // 录入日期 |
| | | entryDateStart: undefined, |
| | |
| | | purchaseContractNumber: "", |
| | | salesLedgerId: "", |
| | | projectName: "", |
| | | masterContractNo: "", |
| | | recorderId: "", |
| | | entryDate: "", |
| | | productData: [], |
| | |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = async (type, row) => { |
| | | // 编辑时检查入库状态,完全入库时不能编辑 |
| | | if (type === "edit" && row) { |
| | | if (row.stockInStatus === "完全入库") { |
| | | proxy.$modal.msgWarning("完全入库状态的记录不能编辑"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | await getTemplateList(); |
| | | await userListNoPage().then(res => { |
| | |
| | | type: 2, |
| | | }); |
| | | productData.value = productRes.data || []; |
| | | // 编辑时加载供应商的合同列表以便回显总合同号 |
| | | if (purchaseRes.supplierId) { |
| | | try { |
| | | const contractRes = await getSupplierContractList(purchaseRes.supplierId); |
| | | if (contractRes.code === 200) { |
| | | contractList.value = contractRes.data || []; |
| | | } |
| | | } catch (error) { |
| | | console.error('获取供应商合同列表失败:', error); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error("加载采购台账数据失败:", error); |
| | | proxy.$modal.msgError("加载数据失败"); |
| | |
| | | }; |
| | | // 打开产品弹框 |
| | | const openProductForm = async (type, row, index) => { |
| | | // 编辑时检查产品入库审核状态,完全入库时不能编辑 |
| | | if (type === "edit" && row && row.stockInApprovalStatus === "完全入库") { |
| | | proxy.$modal.msgWarning("完全入库状态的产品不能编辑"); |
| | | // 审批通过时不能编辑产品信息 |
| | | if (type === "edit" && form.value.approvalStatus === 3) { |
| | | proxy.$modal.msgWarning("审批通过的记录不能编辑产品信息"); |
| | | return; |
| | | } |
| | | |
| | |
| | | const deleteProduct = () => { |
| | | if (productSelectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | return; |
| | | } |
| | | // 检查选中的产品中是否有完全入库的 |
| | | const hasFullyStocked = productSelectedRows.value.some( |
| | | row => row.stockInApprovalStatus === "完全入库" |
| | | ); |
| | | if (hasFullyStocked) { |
| | | proxy.$modal.msgWarning("选中的产品中包含完全入库的产品,无法删除"); |
| | | return; |
| | | } |
| | | if (operationType.value === "add") { |
| | |
| | | } |
| | | }; |
| | | |
| | | // 供应商选择变化时,加载该供应商的合同列表 |
| | | const handleSupplierChange = async (supplierId) => { |
| | | form.value.masterContractNo = ''; |
| | | contractList.value = []; |
| | | if (!supplierId) return; |
| | | |
| | | try { |
| | | const res = await getSupplierContractList(supplierId); |
| | | if (res.code === 200) { |
| | | contractList.value = res.data || []; |
| | | } |
| | | } catch (error) { |
| | | console.error('获取供应商合同列表失败:', error); |
| | | } |
| | | }; |
| | | |
| | | // 查看总合同附件 |
| | | const openContractFileDialog = async (row) => { |
| | | if (!row.masterContractNo) { |
| | | proxy.$modal.msgWarning('该记录没有总合同号'); |
| | | return; |
| | | } |
| | | try { |
| | | const res = await getSupplierContractFilesByNo(row.masterContractNo); |
| | | if (res.code === 200) { |
| | | contractFileList.value = res.data || []; |
| | | contractFileDialogVisible.value = true; |
| | | } |
| | | } catch (error) { |
| | | console.error('获取合同附件失败:', error); |
| | | } |
| | | }; |
| | | |
| | | // 格式化文件大小 |
| | | const formatFileSize = (bytes) => { |
| | | if (!bytes) return '0 B'; |
| | | const k = 1024; |
| | | const sizes = ['B', 'KB', 'MB', 'GB']; |
| | | const i = Math.floor(Math.log(bytes) / Math.log(k)); |
| | | return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getTemplateList(); |