| | |
| | | params: query, |
| | | responseType: 'blob' |
| | | }) |
| | | } |
| | | |
| | | //出库接口 |
| | | export const stockOut = (data) => { |
| | | return request({ |
| | | url: '/stockmanagement/stockout', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | |
| | | 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 |
| | | getStockOutPage, |
| | | addStockOut, |
| | | updateStockOut, |
| | | delStockOut, |
| | | exportStockOut |
| | | } from "@/api/inventoryManagement/stockOut.js"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableData = ref([]); |
| | | const productData = ref([]); |
| | | // const productData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const customerOption = ref([]); |
| | | // const customerOption = ref([]); |
| | | const tableLoading = ref(false); |
| | | const supplierList = ref([]) |
| | | const productList = ref([]) |
| | | const productModelList = ref([]) |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: "", |
| | | supplierName: "", |
| | | }, |
| | | form: { |
| | | salesContractNo: "", |
| | | salesman: "", |
| | | customerContractNo: "", |
| | | customerId: "", |
| | | projectName: "", |
| | | entryPerson: "", |
| | | entryDate: "", |
| | | maintenanceTime: "", |
| | | productData: [], |
| | | executionDate: "", |
| | | supplierId: null, |
| | | supplierName: '', |
| | | productId: null, |
| | | productCategory: '', |
| | | specificationModel: '', |
| | | unit: '', |
| | | inboundTime: '', |
| | | inboundBatch: '', |
| | | inboundQuantity: 0, |
| | | taxInclusiveUnitPrice: 0, |
| | | taxInclusiveTotalPrice: 0, |
| | | taxRate: 0, |
| | | taxExclusiveTotalPrice: 0, |
| | | userId: null, |
| | | nickname: '' |
| | | }, |
| | | 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" }], |
| | | supplierId: [{ required: true, message: '请选择供应商', trigger: 'change' }], |
| | | productRecordid: [{ required: true, message: '请选择产品', trigger: 'change' }], |
| | | inboundTime: [{ required: true, message: '请选择入库时间', trigger: 'change' }], |
| | | inboundQuantity: [{ required: true, message: '请输入入库数量', trigger: 'blur' }] |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; // 找到节点,返回该节点 |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode.label; // 在子节点中找到,返回该节点 |
| | | } |
| | | } |
| | | } |
| | | return null; // 没有找到节点,返回null |
| | | }; |
| | | // const findNodeById = (nodes, productId) => { |
| | | // for (let i = 0; i < nodes.length; i++) { |
| | | // if (nodes[i].value === productId) { |
| | | // return nodes[i].label; // 找到节点,返回该节点 |
| | | // } |
| | | // if (nodes[i].children && nodes[i].children.length > 0) { |
| | | // const foundNode = findNodeById(nodes[i].children, productId); |
| | | // if (foundNode) { |
| | | // return foundNode.label; // 在子节点中找到,返回该节点 |
| | | // } |
| | | // } |
| | | // } |
| | | // return null; // 没有找到节点,返回null |
| | | // }; |
| | | // 表格选择数据 |
| | | 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([]); |
| | |
| | | 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) => { |
| | | delStockOut(ids).then((res) => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | | }); |
| | |
| | | <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="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | |
| | | <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> |
| | |
| | | getSalesLedgerWithProducts, delLedger |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { |
| | | getStockOutPage, |
| | | addStockOut, |
| | | updateStockOut, |
| | | delStockOut, |
| | | exportStockOut |
| | | } from "@/api/inventoryManagement/stockOut.js"; |
| | | getStockManagePage, |
| | | delStockManage, |
| | | stockOut |
| | | } from "@/api/inventoryManagement/stockManage.js"; |
| | | |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | |
| | | supplierName: '', |
| | | }, |
| | | form: { |
| | | salesContractNo: '', |
| | | salesman: '', |
| | | customerContractNo: '', |
| | | customerId: '', |
| | | projectName: '', |
| | | entryPerson: '', |
| | | entryDate: '', |
| | | maintenanceTime: '', |
| | | productData: [], |
| | | executionDate: '' |
| | | supplierId: null, |
| | | productId: null, |
| | | userId: null, |
| | | supplierName: '', |
| | | productName: '', |
| | | model: '', |
| | | unit: '', |
| | | inboundTime: '', |
| | | inboundBatch: '', |
| | | inboundQuantity: '', |
| | | taxInclusiveUnitPrice: '', |
| | | taxInclusiveTotalPrice: '', |
| | | taxRate: '', |
| | | taxExclusiveTotalPrice: '', |
| | | nickName: '', |
| | | }, |
| | | 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 => { |
| | | getStockManagePage({ ...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) => { |
| | | // 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() |
| | | }) |
| | |
| | | <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="taxInclusiveUnitPrice" width="100" show-overflow-tooltip /> |
| | |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="供应商名称:" prop="salesContractNo"> |
| | | <el-input v-model="form.salesContractNo" placeholder="请输入" clearable /> |
| | | <el-form-item label="产品名称:" prop="productId"> |
| | | <el-select v-model="form.productId" placeholder="请选择" clearable> |
| | | <el-option v-for="item in productList" :key="item.id" :label="item.productName" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="产品大类:" prop="salesman"> |
| | | <el-select v-model="form.salesman" placeholder="请选择" clearable> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" |
| | | :value="item.nickName" /> |
| | | <el-form-item label="规格型号:" prop="productManageId"> |
| | | <el-select v-model="form.productManageId" placeholder="请选择" clearable> |
| | | <el-option v-for="item in productmodelList" :key="item.id" :label="item.model" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="规格型号:" prop="customerContractNo"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-form-item label="供应商名称:" prop="salesContractNo"> |
| | | <el-select v-model="form.supplierId" placeholder="请选择" clearable> |
| | | <el-option v-for="item in supplierLists" :key="item.id" :label="item.supplierName" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产品大类:" prop="salesman"> |
| | | <el-input v-model="form.productCategory" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="单位:" prop="customerId"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.unit" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <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-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="入库批次:" prop="entryPerson"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.inboundBatch" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="入库数量:" prop="customerContractNo"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.inboundQuantity" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="含税单价:" prop="customerId"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.taxInclusiveUnitPrice" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="含税总价:" prop="customerContractNo"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.taxInclusiveTotalPrice" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="税率:" prop="customerId"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.taxRate" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="不含税总价:" prop="entryDate"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable /> |
| | | <el-input v-model="form.taxExclusiveTotalPrice" placeholder="请输入" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <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 { |
| | | getStockInPage, |
| | | updateStockIn, |
| | | addSutockIn, |
| | | delStockIn, |
| | | exportStockIn |
| | | } from "@/api/inventoryManagement/stockIn.js"; |
| | | import {listSupplier} from "@/api/basicData/supplierManageFile.js"; |
| | | import {modelListPage, productTreeList} from "@/api/basicData/product.js"; |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const productData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const userList = ref([]) |
| | | const customerOption = ref([]) |
| | | const supplierLists = ref([]) |
| | | const productTree = ref([]); // 产品树数据 |
| | | const modelList = ref([]); // 规格型号列表 |
| | | const currentProductId = ref(null); // 当前选中的产品ID |
| | | const loading = ref(false); |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const fileList = ref([]) |
| | | // const fileList = ref([]) |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref('') |
| | |
| | | supplierName: '', |
| | | }, |
| | | form: { |
| | | salesContractNo: '', |
| | | salesman: '', |
| | | customerContractNo: '', |
| | | customerId: '', |
| | | projectName: '', |
| | | entryPerson: '', |
| | | entryDate: '', |
| | | maintenanceTime: '', |
| | | productData: [], |
| | | executionDate: '' |
| | | productManageId: null, |
| | | supplierId: null, |
| | | productId: null, |
| | | userId: null, |
| | | supplierName: '', |
| | | productName: '', |
| | | model: '', |
| | | unit: '', |
| | | inboundTime: '', |
| | | inboundBatch: '', |
| | | inboundQuantity: '', |
| | | taxInclusiveUnitPrice: '', |
| | | taxInclusiveTotalPrice: '', |
| | | taxRate: '', |
| | | taxExclusiveTotalPrice: '', |
| | | nickname: '' |
| | | }, |
| | | 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" }], |
| | | productName: [{ required: true, message: "请选择", trigger: "change" }], |
| | | model: [{ 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) |
| | | // 3. 获取产品树方法 |
| | | const getProductTree = async () => { |
| | | try { |
| | | loading.value = true; |
| | | const res = await productTreeList(); |
| | | productTree.value = res.data; // 根据实际API返回结构调整 |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // 4. 获取规格型号方法 |
| | | const getModelList = async (productId) => { |
| | | try { |
| | | loading.value = true; |
| | | const res = await modelListPage({ |
| | | id: productId, |
| | | current: 1, // 页码 |
| | | size: 10 // 每页条数 |
| | | }); |
| | | modelList.value = res.data.records; // 根据实际API返回结构调整 |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | getStockInPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | }) |
| | | total.value = res.total |
| | | ttotal.value = res.data.total |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; // 找到节点,返回该节点 |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode.label; // 在子节点中找到,返回该节点 |
| | | } |
| | | } |
| | | } |
| | | return null; // 没有找到节点,返回null |
| | | const getProductTreeList = () => { |
| | | treeLoad.value = true; |
| | | productTreeList() |
| | | .then((res) => { |
| | | list.value = res; // 将返回的数据赋给list |
| | | list.value.forEach((a) => { |
| | | expandedKeys.value.push(a.label); // 默认展开所有节点 |
| | | }); |
| | | treeLoad.value = false; |
| | | }) |
| | | .catch((err) => { |
| | | treeLoad.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 openForm = async (type, row) => { |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | | dialogFormVisible.value = true |
| | | 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 |
| | | }) |
| | | console.log('userList', userList.value) |
| | | |
| | | let supplierlists = await listSupplier() |
| | | supplierLists.value = supplierlists.data.records |
| | | console.log('supplierList', supplierLists.value) |
| | | |
| | | await getProductTree(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if (type === 'add') { |
| | | // 新增时重置表单 |
| | | form.value = { |
| | | nickname: userStore.userId // 设置默认入库人为当前用户 |
| | | } |
| | | } else { |
| | | // 编辑时填充表单数据 |
| | | form.value = { ...row } |
| | | } |
| | | // 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 |
| | | } |
| | | } |
| | | |
| | | // 提交表单 |
| | | 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 |
| | | } |
| | | 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 => { |
| | | proxy.$modal.msgSuccess("提交成功") |
| | | const apiMethod = operationType.value === 'add' ? addSutockIn : updateStockIn |
| | | apiMethod(form.value).then(res => { |
| | | proxy.$modal.msgSuccess(operationType.value === 'add' ? "新增成功" : "修改成功") |
| | | closeDia() |
| | | getList() |
| | | }) |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/sales/ledger/export", {}, '入库台账.xlsx') |
| | | proxy.download("/stockin/export", {}, '入库台账.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已取消") |
| | | }) |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delLedger(ids).then(res => { |
| | | delStockIn(ids).then(res => { |
| | | proxy.$modal.msgSuccess("删除成功") |
| | | getList() |
| | | }) |
| | |
| | | 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 { |
| | | getStockManagePage , |
| | | updateStockManage, |
| | | delStockManage, |
| | |
| | | const productData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const userList = ref([]) |
| | | const customerOption = ref([]) |
| | | // const customerOption = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | |
| | | customerId: '', |
| | | boundTime: '', |
| | | inboundTime: '', |
| | | inboundPerson: '', |
| | | userId: '', |
| | | supplierId: '', |
| | | productId: '', |
| | | }, |
| | | 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' }], |
| | | stockQuantity: [{ required: true, message: '请输入出库数量', trigger: 'blur' }], |
| | | taxInclusiveUnitPrice: [{ required: true, message: '请输入含税单价', trigger: 'blur' }], |
| | | taxInclusiveTotalPrice: [{ required: true, message: '请输入含税总价', trigger: 'blur' }], |
| | | taxRate: [{ required: true, message: '请输入税率', trigger: 'blur' }], |
| | | taxExclusiveTotalPrice: [{ required: true, message: '请输入不含税总价', trigger: 'blur' }], |
| | | boundTime: [{ required: true, message: '请选择库存时间', trigger: 'change' }], |
| | | inboundTime: [{ required: true, message: '请选择出库时间', trigger: 'change' }], |
| | | inboundPerson: [{ required: true, message: '请选择出库人', trigger: 'change' }] |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | console.log('res', res) |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | }) |
| | | total.value = res.total |
| | | // tableData.value.map(item => { |
| | | // item.children = [] |
| | | // }) |
| | | // total.value = res.total |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | const findNodeById = (nodes, productId) => { |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | if (nodes[i].value === productId) { |
| | | return nodes[i].label; // 找到节点,返回该节点 |
| | | } |
| | | if (nodes[i].children && nodes[i].children.length > 0) { |
| | | const foundNode = findNodeById(nodes[i].children, productId); |
| | | if (foundNode) { |
| | | return foundNode.label; // 在子节点中找到,返回该节点 |
| | | } |
| | | } |
| | | } |
| | | return null; // 没有找到节点,返回null |
| | | }; |
| | | |
| | | // const findNodeById = (nodes, productId) => { |
| | | // for (let i = 0; i < nodes.length; i++) { |
| | | // if (nodes[i].value === productId) { |
| | | // return nodes[i].label; // 找到节点,返回该节点 |
| | | // } |
| | | // if (nodes[i].children && nodes[i].children.length > 0) { |
| | | // const foundNode = findNodeById(nodes[i].children, productId); |
| | | // if (foundNode) { |
| | | // return foundNode.label; // 在子节点中找到,返回该节点 |
| | | // } |
| | | // } |
| | | // } |
| | | // return null; // 没有找到节点,返回null |
| | | // }; |
| | | // 表格选择数据 |
| | | 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([]) |
| | |
| | | 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 |
| | | // 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 => { |
| | |
| | | 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() |
| | | }) |
| | |
| | | const { VITE_APP_ENV } = env;
|
| | | const baseUrl =
|
| | | VITE_APP_ENV == "development"
|
| | | ? "http://192.168.10.2:7003" // 开发环境后端接口
|
| | | ? "http://127.0.0.1:7005" // 开发环境后端接口
|
| | | : "http://114.132.189.42:7003"; // 生产环境后端接口
|
| | |
|
| | | return {
|