| | |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">客户名称:</span> |
| | | <span class="search_title">采购合同号:</span> |
| | | <el-input |
| | | v-model="searchForm.customerName" |
| | | v-model="searchForm.purchaseContractNumber" |
| | | style="width: 240px" |
| | | placeholder="请输入" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | prefix-icon="Search" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button> |
| | | </div> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="序号" type="index" width="60" /> |
| | | <el-table-column label="采购合同号" prop="purchaseContractNumber" show-overflow-tooltip/> |
| | | <el-table-column label="销售合同号" prop="salesContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客户合同号" prop="customerContractNo" show-overflow-tooltip/> |
| | | <el-table-column label="客户名称" prop="customerName" show-overflow-tooltip/> |
| | | <el-table-column label="业务员" prop="salesman" show-overflow-tooltip/> |
| | | <el-table-column label="供应商名称" prop="supplierName" show-overflow-tooltip/> |
| | | <el-table-column label="业务员" prop="businessPerson" show-overflow-tooltip/> |
| | | <el-table-column label="电话" prop="businessPerson" show-overflow-tooltip/> |
| | | <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip/> |
| | | <el-table-column label="合同金额(元)" prop="contractAmount" show-overflow-tooltip/> |
| | | <el-table-column label="录入人" prop="entryPerson" show-overflow-tooltip/> |
| | | <el-table-column label="录入人" prop="recorderName" show-overflow-tooltip/> |
| | | <el-table-column label="录入日期" prop="entryDate" show-overflow-tooltip/> |
| | | <el-table-column fixed="right" label="操作" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | |
| | | <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="operationType === 'add' ? '新增销售台账页面' : '编辑销售台账页面'" width="70%" @close="closeDia"> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '新增采购台账页面' : '编辑采购台账页面'" width="70%" @close="closeDia"> |
| | | <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 disabled/> |
| | | <el-form-item label="采购合同号:" prop="purchaseContractNumber"> |
| | | <el-input v-model="form.purchaseContractNumber" placeholder="请输入" clearable/> |
| | | </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="salesLedgerId"> |
| | | <el-select v-model="form.salesLedgerId" placeholder="请选择" clearable> |
| | | <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-form-item label="客户合同号:" prop="customerContractNo"> |
| | | <el-input v-model="form.customerContractNo" placeholder="请输入" clearable/> |
| | | <el-form-item label="供应商名称:" prop="supplierName"> |
| | | <el-input v-model="form.supplierName" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客户名称:" prop="customerId"> |
| | | <el-select v-model="form.customerId" placeholder="请选择" clearable> |
| | | <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id"> |
| | | {{item.customerName + '——' + item.taxpayerIdentificationNumber}} |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项目名称:" prop="projectName"> |
| | | <el-input v-model="form.projectName" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入人:" prop="entryPerson"> |
| | | <el-select v-model="form.entryPerson" placeholder="请选择" clearable> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/> |
| | | <el-form-item label="业务员:" prop="businessPersonId"> |
| | | <el-select v-model="form.businessPersonId" placeholder="请选择" clearable @change="setPhone"> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="电话:" prop="phoneNumber"> |
| | | <el-input v-model="form.phoneNumber" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入人:" prop="recorderId"> |
| | | <el-select v-model="form.recorderId" placeholder="请选择" clearable disabled> |
| | | <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入日期:" prop="entryDate"> |
| | | <el-date-picker |
| | | disabled |
| | | style="width: 100%" |
| | | v-model="form.entryDate" |
| | | value-format="YYYY-MM-DD" |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="附件材料·:" prop="remark"> |
| | | <el-form-item label="附件材料:" prop="remark"> |
| | | <el-upload |
| | | v-model:file-list="fileList" |
| | | :action="upload.url" |
| | |
| | | import {ElMessageBox } from "element-plus"; |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import { |
| | | ledgerList, |
| | | productList, |
| | | customerList, |
| | | addOrUpdateSalesLedger, |
| | | getSalesLedgerWithProducts, delLedger, addOrUpdateSalesLedgerProduct, delProduct, delLedgerFile |
| | | getSalesLedgerWithProducts, addOrUpdateSalesLedgerProduct, delProduct, delLedgerFile |
| | | } from "@/api/salesManagement/salesLedger.js"; |
| | | import { |
| | | addOrEditPurchase, |
| | | delPurchase, |
| | | getSalesNo, |
| | | purchaseList, |
| | | productList, getPurchaseById |
| | | } from "@/api/procurementManagement/procurementLedger.js"; |
| | | const { proxy } = getCurrentInstance() |
| | | const tableData = ref([]) |
| | | const productData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const productSelectedRows = ref([]) |
| | | const userList = ref([]) |
| | | const customerOption = ref([]) |
| | | const salesContractList = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | |
| | | }) |
| | | const total = ref(0) |
| | | const fileList = ref([]) |
| | | import useUserStore from "@/store/modules/user" |
| | | |
| | | const userStore = useUserStore() |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref('') |
| | | const dialogFormVisible = ref(false) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: '', |
| | | purchaseContractNumber: '', |
| | | }, |
| | | form: { |
| | | salesContractNo: '', |
| | | salesman: '', |
| | | customerContractNo: '', |
| | | customerId: '', |
| | | purchaseContractNumber: '', |
| | | salesLedgerId: '', |
| | | projectName: '', |
| | | entryPerson: '', |
| | | recorderId: '', |
| | | entryDate: '', |
| | | maintenanceTime: '', |
| | | productData: [] |
| | | productData: [], |
| | | businessPersonId: '', |
| | | phoneNumber: '', |
| | | supplierName: '', |
| | | }, |
| | | rules: { |
| | | salesman: [{ required: true, message: "请选择", trigger: "change" }], |
| | | customerContractNo: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | customerId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | purchaseContractNumber: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | salesLedgerId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | projectName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | entryPerson: [{ required: true, message: "请选择", trigger: "change" }], |
| | | entryDate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | businessPersonId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | phoneNumber: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | supplierName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | } |
| | | }) |
| | | const { searchForm, form, rules } = toRefs(data) |
| | |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | }) |
| | | |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | |
| | | } |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | ledgerList({...searchForm.value, ...page}).then(res => { |
| | | purchaseList({...searchForm.value, ...page}).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.rows |
| | | tableData.value.map(item => { |
| | | item.children = [] |
| | | }) |
| | | total.value = res.total |
| | | expandedRowKeys.value = [] |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | // 表格选择数据 |
| | |
| | | if (expandedRows.length > 0) { |
| | | expandedRowKeys.value = [] |
| | | try { |
| | | productList({salesLedgerId: row.id}).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; |
| | |
| | | operationType.value = type |
| | | form.value = {} |
| | | productData.value = [] |
| | | fileList.value = [] |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data |
| | | }) |
| | | customerList().then(res => { |
| | | customerOption.value = res |
| | | getSalesNo().then(res => { |
| | | salesContractList.value = res |
| | | }) |
| | | form.value.recorderId = userStore.id |
| | | form.value.entryDate = getCurrentDate(); |
| | | if (type === 'edit') { |
| | | currentId.value = row.id; |
| | | getSalesLedgerWithProducts({id: row.id}).then(res => { |
| | | getPurchaseById({id: row.id, type: 2}).then(res => { |
| | | form.value = {...res} |
| | | productData.value = form.value.productData |
| | | fileList.value = form.value.salesLedgerFiles |
| | | if(form.value.salesLedgerFiles) { |
| | | fileList.value = form.value.salesLedgerFiles |
| | | } else { |
| | | fileList.value = [] |
| | | } |
| | | }) |
| | | } |
| | | dialogFormVisible.value = true |
| | | } |
| | | // 赋值电话 |
| | | const setPhone = (id) => { |
| | | form.value.phoneNumber = userList.value.find(u => u.userId === id)?.phonenumber || ''; |
| | | } |
| | | // 上传前校检 |
| | | function handleBeforeUpload(file) { |
| | |
| | | } |
| | | // 移除文件 |
| | | function handleRemove (file) { |
| | | console.log('handleRemove', file) |
| | | console.log('operationType.value', operationType.value) |
| | | console.log('handleRemove', file.id) |
| | | if (operationType.value === 'edit') { |
| | | let ids = [] |
| | | ids.push(file.value.id) |
| | | ids.push(file.id) |
| | | delLedgerFile(ids).then(res => { |
| | | proxy.$modal.msgSuccess("删除成功") |
| | | }) |
| | |
| | | tempFileIds = fileList.value.map(item => item.tempId) |
| | | } |
| | | form.value.tempFileIds = tempFileIds |
| | | addOrUpdateSalesLedger(form.value).then(res => { |
| | | form.value.type = 2 |
| | | addOrEditPurchase(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功") |
| | | closeDia() |
| | | getList() |
| | |
| | | addOrUpdateSalesLedgerProduct(productForm.value).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功") |
| | | closeProductDia() |
| | | getSalesLedgerWithProducts({id: currentId.value}).then(res => { |
| | | getPurchaseById({id: currentId.value, type: 2}).then(res => { |
| | | productData.value = res.productData |
| | | }) |
| | | }) |
| | |
| | | delProduct(ids).then(res => { |
| | | proxy.$modal.msgSuccess("删除成功") |
| | | closeProductDia() |
| | | getSalesLedgerWithProducts({id: currentId.value}).then(res => { |
| | | getSalesLedgerWithProducts({id: currentId.value, type: 2}).then(res => { |
| | | productData.value = res.productData |
| | | }) |
| | | }) |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | proxy.download("/sales/ledger/export", {}, '销售台账.xlsx') |
| | | proxy.download("/purchase/ledger/export", {}, '采购台账.xlsx') |
| | | }).catch(() => { |
| | | proxy.$modal.msg("已取消") |
| | | }) |
| | |
| | | type: 'warning', |
| | | } |
| | | ).then(() => { |
| | | delLedger(ids).then(res => { |
| | | delPurchase(ids).then(res => { |
| | | proxy.$modal.msgSuccess("删除成功") |
| | | getList() |
| | | }) |
| | |
| | | proxy.$modal.msg("已取消") |
| | | }) |
| | | } |
| | | // 获取当前日期并格式化为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始 |
| | | const day = String(today.getDate()).padStart(2, '0'); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | getList() |
| | | </script> |
| | | |