| | |
| | | <el-table-column label="入库时间" prop="inboundTime" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="入库批次" prop="inboundBatch" width="160" show-overflow-tooltip /> |
| | | <el-table-column label="供应商名称" prop="supplierName" width="160" show-overflow-tooltip /> |
| | | <el-table-column label="产品大类" prop="productCategory" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="规格型号" prop="specificationModel" width="160" show-overflow-tooltip /> |
| | | <el-table-column label="产品大类" prop="productName" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="规格型号" prop="model" width="160" show-overflow-tooltip /> |
| | | <el-table-column label="单位" prop="unit" width="70" show-overflow-tooltip /> |
| | | <el-table-column label="入库数量" prop="inboundQuantity" width="90" show-overflow-tooltip /> |
| | | <el-table-column label="入库数量" prop="stockQuantity" width="90" show-overflow-tooltip /> |
| | | <el-table-column label="含税单价" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="含税总价" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="税率(%)" prop="taxRate" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="不含税总价" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="入库人" prop="nickname" width="80" show-overflow-tooltip /> |
| | | <el-table-column label="入库人" prop="nickName" width="80" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="操作" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small" @click="openForm(scope.row);">出库</el-button> |
| | |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <el-dialog v-model="dialogFormVisible" :title="'新增出库'" width="70%" @close="closeDia"> |
| | | <el-dialog v-model="dialogFormVisible" :title="'新增出库'" width="40%" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-form-item label="出库数量:" prop="salesContractNo"> |
| | | <el-input v-model="form.salesContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.inboundQuantity" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="出库日期:" prop="projectName"> |
| | | <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | type="date" placeholder="请选择" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="出库人:" prop="entryPerson"> |
| | | <el-select v-model="form.entryPerson" placeholder="请选择" clearable> |
| | | <el-select v-model="form.nickName" placeholder="请选择" clearable> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | import useUserStore from '@/store/modules/user' |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { |
| | | ledgerListPage, |
| | | customerList, |
| | | addOrUpdateSalesLedger, |
| | | getSalesLedgerWithProducts, delLedger |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { |
| | | getStockOutPage, |
| | | addStockOut, |
| | | updateStockOut, |
| | | delStockOut, |
| | | exportStockOut |
| | | } from "@/api/inventoryManagement/stockOut.js"; |
| | | getStockManagePage, |
| | | delStockManage, |
| | | stockOut, |
| | | getStockManageOutPage |
| | | } from "@/api/inventoryManagement/stockManage.js"; |
| | | |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | |
| | | const fileList = ref([]) |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref('') |
| | | const dialogFormVisible = ref(false) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: '', |
| | | }, |
| | | form: { |
| | | salesContractNo: '', |
| | | salesman: '', |
| | | customerContractNo: '', |
| | | customerId: '', |
| | | projectName: '', |
| | | entryPerson: '', |
| | | entryDate: '', |
| | | maintenanceTime: '', |
| | | productData: [], |
| | | executionDate: '' |
| | | supplierId: null, |
| | | supplierName: '', |
| | | productId: null, |
| | | productName: '', |
| | | userId: userStore.userId, |
| | | nickName: '', |
| | | productModelId: null, |
| | | model: '', |
| | | unit: '', |
| | | productrecordId: null, |
| | | taxInclusiveUnitPrice: '', |
| | | taxInclusiveTotalPrice: '', |
| | | taxRate: '', |
| | | taxExclusiveTotalPrice: '', |
| | | inboundTime: '', |
| | | inboundBatch: '', |
| | | stockQuantity: '', |
| | | boundTime: '', |
| | | }, |
| | | rules: { |
| | | salesman: [{ required: true, message: "请选择", trigger: "change" }], |
| | | customerContractNo: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | customerId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | projectName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | entryPerson: [{ required: true, message: "请选择", trigger: "change" }], |
| | | entryDate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | executionDate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | supplierName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | productCategory: [{ required: true, message: "请选择", trigger: "change" }], |
| | | specificationModel: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | inboundTime: [{ required: true, message: "请选择", trigger: "change" }], |
| | | inboundBatch: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | inboundQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | taxInclusiveUnitPrice: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | taxRate: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | nickname: [{ required: true, message: "请选择", trigger: "change" }] |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | getStockOutPage({ ...searchForm.value, ...page }).then(res => { |
| | | getStockManageOutPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | }) |
| | | total.value = res.total |
| | | console.log('res', res.data.records) |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | |
| | | const handleSelectionChange = (selection) => { |
| | | |
| | | // 过滤掉子数据 |
| | | selectedRows.value = selection.filter(item => item.children !== undefined); |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | console.log('selection', selectedRows.value) |
| | | } |
| | | const expandedRowKeys = ref([]) |
| | |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']); |
| | | }; |
| | | const currentRowId = ref(null) // 新增:存储当前操作的行ID |
| | | |
| | | // 打开弹框 |
| | | const openForm = async (row) => { |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | | let userLists = await userListNoPage() |
| | | userList.value = userLists.data |
| | | customerList().then(res => { |
| | | customerOption.value = res |
| | | }) |
| | | console.log('userStore.id', userStore.id) |
| | | form.value.entryPerson = userStore.id |
| | | if (type === 'edit') { |
| | | currentId.value = row.id; |
| | | getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => { |
| | | form.value = { ...res } |
| | | form.value.entryPerson = Number(res.entryPerson) |
| | | productData.value = form.value.productData |
| | | fileList.value = form.value.salesLedgerFiles |
| | | }) |
| | | } |
| | | // let userAll = await userStore.getInfo() |
| | | // userList.value.forEach(element => { |
| | | // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) { |
| | | // form.value.entryPerson = userAll.user.userId // 设置默认业务员为当前用户 |
| | | // } |
| | | // }); |
| | | form.value.entryDate = getCurrentDate() // 设置默认录入日期为当前日期 |
| | | dialogFormVisible.value = true |
| | | currentRowId.value = row.id |
| | | form.value = {} |
| | | // 初始化表单数据 |
| | | form.value = { |
| | | inboundQuantity: '', // 出库数量清空 |
| | | inboundTime: getCurrentDate(), // 默认当前日期 |
| | | nickName: '', // 默认当前用户 |
| | | } |
| | | console.log('form',form.value) |
| | | |
| | | // 加载用户列表 |
| | | try { |
| | | const userLists = await userListNoPage() |
| | | userList.value = userLists.data |
| | | } catch (error) { |
| | | console.error('加载用户列表失败:', error) |
| | | } |
| | | } |
| | | |
| | | // 提交表单 |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | if (productData.value.length > 0) { |
| | | form.value.productData = proxy.HaveJson(productData.value) |
| | | } else { |
| | | proxy.$modal.msgWarning('请添加产品信息') |
| | | return |
| | | if (valid && currentRowId.value) { |
| | | const outData = { |
| | | id: currentRowId.value, // 原始记录ID |
| | | outQuantity: form.value.inboundQuantity, // 出库数量 |
| | | outTime: form.value.inboundTime, // 出库时间 |
| | | userId: form.value.userId // 操作人 |
| | | } |
| | | let tempFileIds = [] |
| | | if (fileList.value.length > 0) { |
| | | tempFileIds = fileList.value.map(item => item.tempId) |
| | | } |
| | | form.value.tempFileIds = tempFileIds |
| | | form.value.type = 1 |
| | | addOrUpdateSalesLedger(form.value).then(res => { |
| | | |
| | | stockOut(outData).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功") |
| | | closeDia() |
| | | getList() |
| | | }).catch(err => { |
| | | proxy.$modal.msgError("出库失败") |
| | | }) |
| | | } |
| | | }) |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/sales/ledger/export", {}, '入库台账.xlsx') |
| | | proxy.download("/stockmanagement/export", {}, '入库台账.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已取消") |
| | | }) |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delLedger(ids).then(res => { |
| | | delStockManage(ids).then(res => { |
| | | proxy.$modal.msgSuccess("删除成功") |
| | | getList() |
| | | }) |