From 0a742d63e828d5baaa30d261a5dc9c011e5f6ab2 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期四, 08 五月 2025 17:20:36 +0800 Subject: [PATCH] 销售台账页面开发 --- src/api/salesManagement/salesLedger.js | 11 + src/views/salesManagement/salesLedger/index.vue | 299 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 310 insertions(+), 0 deletions(-) diff --git a/src/api/salesManagement/salesLedger.js b/src/api/salesManagement/salesLedger.js new file mode 100644 index 0000000..aa40926 --- /dev/null +++ b/src/api/salesManagement/salesLedger.js @@ -0,0 +1,11 @@ +// 閿�鍞彴璐﹂〉闈㈡帴鍙� +import request from '@/utils/request' + +// 鍒嗛〉鏌ヨ +export function customerList(query) { + return request({ + url: '/basic/customer/customerList', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue new file mode 100644 index 0000000..f8e40af --- /dev/null +++ b/src/views/salesManagement/salesLedger/index.vue @@ -0,0 +1,299 @@ +<template> + <div class="app-container"> + <div class="search_form"> + <div> + <span class="search_title">瀹㈡埛鍚嶇О锛�</span> + <el-input + v-model="searchForm.customerName" + style="width: 240px" + placeholder="璇疯緭鍏�" + @change="handleQuery" + clearable + :prefix-icon="Search" + /> + <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button> + </div> + <div> + <el-button type="primary" @click="openForm('add')">鏂板鍙拌处</el-button> + <el-button @click="handleOut">瀵煎嚭</el-button> + <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> + </div> + </div> + <div class="table_list"> + <el-table :data="tableData" border :preserve-expanded-content="preserveExpanded" v-loading="tableLoading" + @selection-change="handleSelectionChange" :toggleRowExpansion="toggleRowExpansion" + :header-cell-style="{ background: '#F0F1F5', color: '#333333' }" height="calc(100vh - 18.5em)"> + <el-table-column align="center" type="selection" width="55" /> + <el-table-column type="expand"> + <template #default="props"> + <el-table :data="props.row.children" border> + <el-table-column label="浜у搧澶х被" prop="productCategory" /> + <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" /> + <el-table-column label="鍗曚綅" prop="unit" /> + <el-table-column label="鏁伴噺" prop="quantity" /> + <el-table-column label="绋庣巼" prop="taxRate" /> + <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" /> + <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" /> + <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" /> + </el-table> + </template> + </el-table-column> + <el-table-column align="center" label="搴忓彿" type="index" width="60" /> + <el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" show-overflow-tooltip/> + <el-table-column label="瀹㈡埛鍚堝悓鍙�" prop="customerContractNo" show-overflow-tooltip/> + <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" /> + <el-table-column label="涓氬姟鍛�" prop="salesman" /> + <el-table-column label="椤圭洰鍚嶇О" prop="projectName" /> + <el-table-column label="褰曞叆浜�" prop="entryPerson" /> + <el-table-column label="褰曞叆鏃ユ湡" prop="entryDate" /> + <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center"> + <template #default="scope"> + <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">缂栬緫</el-button> + </template> + </el-table-column> + </el-table> + <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-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="customerName"> + <el-input v-model="form.customerName" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="绾崇◣浜鸿瘑鍒彿锛�" prop="taxpayerIdentificationNumber"> + <el-input v-model="form.taxpayerIdentificationNumber" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鍏徃鍦板潃锛�" prop="companyAddress"> + <el-input v-model="form.companyAddress" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍏徃鐢佃瘽锛�" prop="companyPhone"> + <el-input v-model="form.companyPhone" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="鑱旂郴浜猴細" prop="contactPerson"> + <el-input v-model="form.contactPerson" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑱旂郴鐢佃瘽锛�" prop="contactPhone"> + <el-input v-model="form.contactPhone" placeholder="璇疯緭鍏�" clearable/> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="30"> + <el-col :span="12"> + <el-form-item label="缁存姢浜猴細" prop="maintainer"> + <el-select v-model="form.maintainer" placeholder="璇烽�夋嫨" clearable> + <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="缁存姢鏃堕棿锛�" prop="maintenanceTime"> + <el-date-picker + style="width: 100%" + v-model="form.maintenanceTime" + value-format="YYYY-MM-DD" + format="YYYY-MM-DD" + type="date" + placeholder="璇烽�夋嫨" + clearable + /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭</el-button> + <el-button @click="closeDia">鍙栨秷</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup> +import pagination from '@/components/PIMTable/Pagination.vue' +import { ref } from 'vue' +import {Search} from "@element-plus/icons-vue"; +import {addCustomer, delCustomer, getCustomer, listCustomer, updateCustomer} from "@/api/basicData/customerFile.js"; +import {ElMessageBox } from "element-plus"; +import {userListNoPage} from "@/api/system/user.js"; +import {customerList} from "@/api/salesManagement/salesLedger.js"; +const { proxy } = getCurrentInstance() +const preserveExpanded = ref(false) +const tableData = ref([]) +const selectedRows = ref([]) +const userList = ref([]) +const tableLoading = ref(false) +const page = reactive({ + current: 1, + size: 10, +}) +const total = ref(0) + +// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁 +const operationType = ref('') +const dialogFormVisible = ref(false) +const data = reactive({ + searchForm: { + customerName: '', + }, + form: { + customerName: '', + taxpayerIdentificationNumber: '', + companyAddress: '', + companyPhone: '', + contactPerson: '', + contactPhone: '', + maintainer: '', + maintenanceTime: '', + }, + rules: { + customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + taxpayerIdentificationNumber: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + contactPerson: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + contactPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }], + maintainer: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }], + maintenanceTime: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }], + } +}) +const { searchForm, form, rules } = toRefs(data) + +// 鏌ヨ鍒楄〃 +/** 鎼滅储鎸夐挳鎿嶄綔 */ +const handleQuery = () => { + page.current = 1 + getList() +} +const paginationChange = ({ current, limit }) => { + page.current = current; + page.size = limit; + getList() +} +const getList = () => { + tableLoading.value = true + customerList({...searchForm.value, ...page}).then(res => { + tableLoading.value = false + tableData.value = res.rows + total.value = res.total + }) +} +// 琛ㄦ牸閫夋嫨鏁版嵁 +const handleSelectionChange = (selection) => { + selectedRows.value = selection +} +// 灞曞紑琛� +const toggleRowExpansion = (row, expanded) => { + console.log('row', row) + console.log('expanded', expanded) +} +// 鎵撳紑寮规 +const openForm = (type, row) => { + operationType.value = type + form.value = {} + userListNoPage().then(res => { + userList.value = res.data + }) + if (type === 'edit') { + getCustomer(row.id).then(res => { + form.value = {...res.data} + }) + } + dialogFormVisible.value = true +} +// 鎻愪氦琛ㄥ崟 +const submitForm = () => { + proxy.$refs["formRef"].validate(valid => { + if (valid) { + if (operationType.value === "edit") { + submitEdit() + } else { + submitAdd() + } + } + }) +} +// 鎻愪氦鏂板 +const submitAdd = () => { + addCustomer(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛") + closeDia() + getList() + }) +} +// 鎻愪氦淇敼 +const submitEdit = () => { + updateCustomer(form.value).then(res => { + proxy.$modal.msgSuccess("鎻愪氦鎴愬姛") + closeDia() + getList() + }) +} +// 鍏抽棴寮规 +const closeDia = () => { + proxy.resetForm("formRef") + dialogFormVisible.value = false +} +// 瀵煎嚭 +const handleOut = () => { + ElMessageBox.confirm( + '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�', + '瀵煎嚭', { + confirmButtonText: '纭', + cancelButtonText: '鍙栨秷', + type: 'warning', + } + ).then(() => { + proxy.download("/basic/customer/export", {}, '瀹㈡埛妗f.xlsx') + }).catch(() => { + proxy.$modal.msg("宸插彇娑�") + }) +} +// 鍒犻櫎 +const handleDelete = () => { + let ids = [] + if (selectedRows.value.length > 0) { + ids = selectedRows.value.map(item => item.id); + } else { + proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁') + return + } + ElMessageBox.confirm( + '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', + '瀵煎嚭', { + confirmButtonText: '纭', + cancelButtonText: '鍙栨秷', + type: 'warning', + } + ).then(() => { + delCustomer(ids).then(res => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }) + getList() + }).catch(() => { + proxy.$modal.msg("宸插彇娑�") + }) +} +getList() +</script> + +<style scoped lang="scss"> + +</style> \ No newline at end of file -- Gitblit v1.9.3