| | |
| | | @keyup.enter="handleSearch" |
| | | > |
| | | <template #prefix> |
| | | <el-icon><Search /></el-icon> |
| | | <el-icon> |
| | | <Search/> |
| | | </el-icon> |
| | | </template> |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-select v-model="searchForm.customerId" placeholder="è¯·éæ©å®¢æ·" clearable> |
| | | <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id"> |
| | | <el-select v-model="searchForm.customer" placeholder="è¯·éæ©å®¢æ·" clearable> |
| | | <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" |
| | | :value="item.customerName"> |
| | | {{ |
| | | item.customerName + "ââ" + item.taxpayerIdentificationNumber |
| | | }} |
| | |
| | | <el-col :span="8"> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | <el-button style="float: right;" type="primary" @click="handleAdd"> |
| | | æ°å¢æ¥ä»· |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20" style="margin-bottom: 20px;"> |
| | | <el-col :span="24"> |
| | | <el-button type="primary" @click="handleAdd">æ°å¢æ¥ä»·</el-button> |
| | | <el-button type="primary" @click="handleImport">导å
¥é宿¥ä»·</el-button> |
| | | <el-button type="success" @click="handleShowImportLog">导å
¥è®°å½</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | |
| | | ¥{{ scope.row.totalAmount.toFixed(2) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" width="200" fixed="right" align="center"> |
| | | <el-table-column label="æä½" width="300" fixed="right" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="handleEdit(scope.row)" :disabled="!['å¾
审æ¹','æç»'].includes(scope.row.status)">ç¼è¾</el-button> |
| | | <el-button link type="primary" @click="handleEdit(scope.row)" |
| | | >ç¼è¾ |
| | | </el-button> |
| | | <el-button link type="primary" @click="handleView(scope.row)" style="color: #67C23A">æ¥ç</el-button> |
| | | <el-button link type="danger" @click="handleDelete(scope.row)">å é¤</el-button> |
| | | <el-button link type="info" @click="handleShowPriceHistory(scope.row)">éä»·åå²</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </el-card> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <FormDialog v-model="dialogVisible" :title="dialogTitle" width="85%" :close-on-click-modal="false" @close="dialogVisible = false" @confirm="handleSubmit" @cancel="dialogVisible = false"> |
| | | <FormDialog v-model="dialogVisible" :title="dialogTitle" width="85%" :close-on-click-modal="false" |
| | | @close="dialogVisible = false" @confirm="handleSubmit" @cancel="dialogVisible = false"> |
| | | <div class="quotation-form-container"> |
| | | <el-form :model="form" :rules="rules" ref="formRef" label-width="120px" class="quotation-form"> |
| | | <!-- åºæ¬ä¿¡æ¯ --> |
| | | <el-card class="form-card" shadow="hover"> |
| | | <template #header> |
| | | <div class="card-header-wrapper"> |
| | | <el-icon class="card-icon"><Document /></el-icon> |
| | | <el-icon class="card-icon"> |
| | | <Document/> |
| | | </el-icon> |
| | | <span class="card-title">åºæ¬ä¿¡æ¯</span> |
| | | </div> |
| | | </template> |
| | | <div class="form-content"> |
| | | <el-row :gutter="24"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客æ·åç§°" prop="customerId"> |
| | | <el-select v-model="form.customerId" placeholder="è¯·éæ©å®¢æ·" style="width: 100%" clearable filterable> |
| | | <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" :value="item.id"></el-option> |
| | | <el-form-item label="客æ·åç§°" prop="customer"> |
| | | <el-select v-model="form.customer" placeholder="è¯·éæ©å®¢æ·" style="width: 100%" |
| | | @change="handleCustomerChange" clearable> |
| | | <el-option v-for="item in customerOption" :key="item.id" :label="item.customerName" |
| | | :value="item.customerName"> |
| | | {{ |
| | | item.customerName + "ââ" + item.taxpayerIdentificationNumber |
| | | }} |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸å¡å" prop="salesperson"> |
| | | <el-select v-model="form.salesperson" placeholder="è¯·éæ©ä¸å¡å" style="width: 100%" clearable filterable> |
| | | <el-select v-model="form.salesperson" placeholder="è¯·éæ©ä¸å¡å" style="width: 100%" clearable> |
| | | <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" |
| | | :value="item.nickName" /> |
| | | </el-select> |
| | |
| | | <el-card class="form-card" shadow="hover"> |
| | | <template #header> |
| | | <div class="card-header-wrapper"> |
| | | <el-icon class="card-icon"><Box /></el-icon> |
| | | <el-icon class="card-icon"> |
| | | <Box/> |
| | | </el-icon> |
| | | <span class="card-title">产åä¿¡æ¯</span> |
| | | <el-button type="primary" size="small" @click="addProduct" class="header-btn"> |
| | | <el-icon><Plus /></el-icon> |
| | | <el-icon> |
| | | <Plus/> |
| | | </el-icon> |
| | | æ·»å 产å |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | <div class="form-content"> |
| | | <el-table :data="form.products" border style="width: 100%" class="product-table" v-if="form.products.length > 0"> |
| | | <el-table :data="form.products" border style="width: 100%" class="product-table" |
| | | v-if="form.products.length > 0"> |
| | | <el-table-column prop="product" label="产ååç§°" width="200"> |
| | | <template #default="scope"> |
| | | <el-form-item :prop="`products.${scope.$index}.productId`" class="product-table-form-item"> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="specification" label="è§æ ¼åå·" width="200"> |
| | | <template #default="scope"> |
| | | <el-form-item :prop="`products.${scope.$index}.productModelId`" class="product-table-form-item"> |
| | | <el-form-item :prop="`products.${scope.$index}.specificationId`" class="product-table-form-item"> |
| | | <el-select |
| | | v-model="scope.row.productModelId" |
| | | v-model="scope.row.specificationId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="getProductModel($event, scope.row)" |
| | |
| | | <el-card class="form-card" shadow="hover"> |
| | | <template #header> |
| | | <div class="card-header-wrapper"> |
| | | <el-icon class="card-icon"><EditPen /></el-icon> |
| | | <el-icon class="card-icon"> |
| | | <EditPen/> |
| | | </el-icon> |
| | | <span class="card-title">夿³¨ä¿¡æ¯</span> |
| | | </div> |
| | | </template> |
| | |
| | | </div> |
| | | </FormDialog> |
| | | |
| | | <ImportDialog ref="importDialogRef" |
| | | v-model="importDialogVisible" |
| | | title="导å
¥æ¥ä»·å" |
| | | :action="importAction" |
| | | :headers="importHeaders" |
| | | :auto-upload="false" |
| | | :on-success="handleImportSuccess" |
| | | :on-error="handleImportError" |
| | | @confirm="handleImportConfirm" |
| | | @download-template="handleDownloadTemplate" |
| | | @close="handleImportClose" /> |
| | | |
| | | <!-- 导å
¥è®°å½å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="importLogDialogVisible" title="导å
¥è®°å½" width="900px"> |
| | | <el-table :data="importLogList" border stripe v-loading="importLogLoading" height="400"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60"/> |
| | | <el-table-column prop="batchNo" label="æ¹æ¬¡å·" min-width="180"/> |
| | | <el-table-column prop="fileName" label="æä»¶å" min-width="160"/> |
| | | <el-table-column prop="totalCount" label="æ»æ°" width="80" align="center"/> |
| | | <el-table-column prop="successCount" label="æå" width="80" align="center"/> |
| | | <el-table-column prop="failCount" label="失败" width="80" align="center"/> |
| | | <el-table-column prop="status" label="ç¶æ" width="100" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="row.status === 'completed' ? 'success' : 'danger'" disable-transitions> |
| | | {{ row.status === 'completed' ? '宿' : row.status }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createUserName" label="æä½äºº" width="100"/> |
| | | <el-table-column prop="createTime" label="导å
¥æ¶é´" width="160"/> |
| | | </el-table> |
| | | <pagination |
| | | v-if="importLogTotal > 0" |
| | | :total="importLogTotal" |
| | | layout="total, prev, pager, next" |
| | | :page="importLogPage.current" |
| | | :limit="importLogPage.size" |
| | | @pagination="handleImportLogPageChange" |
| | | /> |
| | | </el-dialog> |
| | | |
| | | <!-- éä»·åå²å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="priceHistoryDialogVisible" title="éä»·åå²" width="900px"> |
| | | <el-table :data="priceHistoryList" border stripe v-loading="priceHistoryLoading" height="400"> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60"/> |
| | | <el-table-column prop="productName" label="产ååç§°" min-width="140"/> |
| | | <el-table-column prop="specification" label="è§æ ¼åå·" min-width="120"/> |
| | | <el-table-column prop="oldPrice" label="åä»·" width="100" align="center"> |
| | | <template #default="{ row }">Â¥{{ row.oldPrice?.toFixed(2) }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="newPrice" label="æ°ä»·" width="100" align="center"> |
| | | <template #default="{ row }">Â¥{{ row.newPrice?.toFixed(2) }}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="priceChange" label="åå¨" width="100" align="center"> |
| | | <template #default="{ row }"> |
| | | <span :style="{ color: row.priceChange < 0 ? '#67C23A' : '#F56C6C' }"> |
| | | {{ row.priceChange?.toFixed(2) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="changeReason" label="åå " width="100"/> |
| | | <el-table-column prop="importBatch" label="导å
¥æ¹æ¬¡" min-width="180"/> |
| | | <el-table-column prop="importTime" label="导å
¥æ¶é´" width="160"/> |
| | | <el-table-column prop="createUserName" label="æä½äºº" width="100"/> |
| | | </el-table> |
| | | </el-dialog> |
| | | |
| | | <!-- æ¥ç详æ
å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="viewDialogVisible" title="æ¥ä»·è¯¦æ
" width="800px"> |
| | | <el-descriptions :column="2" border> |
| | |
| | | <!-- <el-tag :type="getStatusType(currentQuotation.status)">{{ currentQuotation.status }}</el-tag>--> |
| | | <!-- </el-descriptions-item>--> |
| | | <el-descriptions-item label="æ¥ä»·æ»é¢" :span="2"> |
| | | <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">Â¥{{ currentQuotation.totalAmount?.toFixed(2) }}</span> |
| | | <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">Â¥{{ |
| | | currentQuotation.totalAmount?.toFixed(2) |
| | | }}</span> |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, onMounted, markRaw, shallowRef } from 'vue' |
| | | import {ref, reactive, computed, onMounted, nextTick, getCurrentInstance} from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { Search, Document, Box, EditPen, Plus } from '@element-plus/icons-vue' |
| | | import { |
| | | Search, |
| | | Document, |
| | | UserFilled, |
| | | Box, |
| | | EditPen, |
| | | Plus, |
| | | ArrowRight, |
| | | Delete, |
| | | } from '@element-plus/icons-vue' |
| | | import Pagination from '@/components/PIMTable/Pagination.vue' |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue' |
| | | import {getQuotationList,addQuotation,updateQuotation,deleteQuotation} from '@/api/salesManagement/salesQuotation.js' |
| | | import {modelList, productTreeList} from "@/api/basicData/product.js"; |
| | | import {listCustomer} from "@/api/basicData/customer.js"; |
| | | import ImportDialog from '@/components/Dialog/ImportDialog.vue' |
| | | import { |
| | | getQuotationList, |
| | | addQuotation, |
| | | updateQuotation, |
| | | deleteQuotation, |
| | | downloadQuotationTemplate, |
| | | getImportLogList, |
| | | getPriceHistoryList |
| | | } from '@/api/salesManagement/salesQuotation.js' |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import {customerList} from "@/api/salesManagement/salesLedger.js"; |
| | | import {modelList, productTreeList} from "@/api/basicData/product.js"; |
| | | import {getToken} from "@/utils/auth"; |
| | | |
| | | const {proxy} = getCurrentInstance(); |
| | | |
| | | // ååºå¼æ°æ® |
| | | const loading = ref(false) |
| | | const searchForm = reactive({ |
| | | quotationNo: '', |
| | | customerId: '', |
| | | customer: '', |
| | | status: '' |
| | | }) |
| | | |
| | | const quotationList = ref([]) |
| | | const userList = ref([]) |
| | | const productOptions = ref([]); |
| | | const modelOptions = ref([]); |
| | | const pagination = reactive({ |
| | |
| | | }) |
| | | |
| | | const dialogVisible = ref(false) |
| | | const importDialogVisible = ref(false) |
| | | const importLogDialogVisible = ref(false) |
| | | const priceHistoryDialogVisible = ref(false) |
| | | const viewDialogVisible = ref(false) |
| | | const importDialogRef = ref(null) |
| | | const importAction = import.meta.env.VITE_APP_BASE_API + "/sales/quotation/import" |
| | | const importHeaders = ref({ |
| | | Authorization: `Bearer ${getToken()}`, |
| | | }) |
| | | const importLogList = ref([]) |
| | | const importLogLoading = ref(false) |
| | | const importLogTotal = ref(0) |
| | | const importLogPage = reactive({ current: 1, size: 10 }) |
| | | const priceHistoryList = ref([]) |
| | | const priceHistoryLoading = ref(false) |
| | | const currentQuotationForLog = ref(null) |
| | | const currentQuotationForPriceHistory = ref(null) |
| | | |
| | | const dialogTitle = ref('æ°å¢æ¥ä»·') |
| | | const form = reactive({ |
| | | quotationNo: '', |
| | | customerId: undefined, |
| | | customer: '', |
| | | salesperson: '', |
| | | quotationDate: '', |
| | |
| | | |
| | | const productRowRules = { |
| | | productId: [{ required: true, message: 'è¯·éæ©äº§ååç§°', trigger: 'change' }], |
| | | productModelId: [{ required: true, message: 'è¯·éæ©è§æ ¼åå·', trigger: 'change' }], |
| | | specificationId: [{required: true, message: 'è¯·éæ©è§æ ¼åå·', trigger: 'change'}], |
| | | unit: [{ required: true, message: '请填ååä½', trigger: 'blur' }], |
| | | unitPrice: [{ required: true, message: '请填ååä»·', trigger: 'change' }] |
| | | } |
| | |
| | | const r = { ...baseRules } |
| | | ;(form.products || []).forEach((_, i) => { |
| | | r[`products.${i}.productId`] = productRowRules.productId |
| | | r[`products.${i}.productModelId`] = productRowRules.productModelId |
| | | r[`products.${i}.specificationId`] = productRowRules.specificationId |
| | | r[`products.${i}.unit`] = productRowRules.unit |
| | | r[`products.${i}.unitPrice`] = productRowRules.unitPrice |
| | | }) |
| | | return r |
| | | }) |
| | | const userList = ref([]); |
| | | const customerOption = ref([]); |
| | | |
| | | const isEdit = ref(false) |
| | | const editId = ref(null) |
| | | const currentQuotation = ref({}) |
| | | const formRef = ref() |
| | | |
| | | // 导å
¥æå |
| | | const handleImportSuccess = (response) => { |
| | | if (response.code === 200) { |
| | | ElMessage.success("导å
¥æå") |
| | | importDialogVisible.value = false |
| | | if (importDialogRef.value) { |
| | | importDialogRef.value.clearFiles() |
| | | } |
| | | handleSearch() |
| | | } else { |
| | | ElMessage.error(response.msg || "导å
¥å¤±è´¥") |
| | | } |
| | | } |
| | | |
| | | // 导å
¥å¤±è´¥ |
| | | const handleImportError = () => { |
| | | ElMessage.error("导å
¥å¤±è´¥ï¼è¯·æ£æ¥æä»¶æ ¼å¼æ¯å¦æ£ç¡®") |
| | | } |
| | | |
| | | // 确认导å
¥ |
| | | const handleImportConfirm = () => { |
| | | if (importDialogRef.value) { |
| | | importDialogRef.value.submit() |
| | | } |
| | | } |
| | | |
| | | // ä¸è½½æ¨¡æ¿ |
| | | const handleDownloadTemplate = () => { |
| | | downloadQuotationTemplate().then(blob => { |
| | | const url = window.URL.createObjectURL(blob) |
| | | const a = document.createElement('a') |
| | | a.href = url |
| | | a.download = 'æ¥ä»·å导å
¥æ¨¡æ¿.xlsx' |
| | | a.click() |
| | | window.URL.revokeObjectURL(url) |
| | | }) |
| | | } |
| | | |
| | | // å
³é导å
¥å¼¹çª |
| | | const handleImportClose = () => { |
| | | importDialogVisible.value = false |
| | | if (importDialogRef.value) { |
| | | importDialogRef.value.clearFiles() |
| | | } |
| | | } |
| | | |
| | | // 导å
¥è®°å½ |
| | | const handleShowImportLog = () => { |
| | | importLogPage.current = 1 |
| | | importLogDialogVisible.value = true |
| | | fetchImportLogList() |
| | | } |
| | | |
| | | const fetchImportLogList = () => { |
| | | importLogLoading.value = true |
| | | getImportLogList({ pageNum: importLogPage.current, pageSize: importLogPage.size }).then(res => { |
| | | if (res.code === 200) { |
| | | importLogList.value = res.data.records || [] |
| | | importLogTotal.value = res.data.total || 0 |
| | | } |
| | | }).finally(() => { |
| | | importLogLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const handleImportLogPageChange = (val) => { |
| | | importLogPage.current = val.page |
| | | importLogPage.size = val.limit |
| | | fetchImportLogList() |
| | | } |
| | | |
| | | // éä»·åå² |
| | | const handleShowPriceHistory = (row) => { |
| | | currentQuotationForPriceHistory.value = row |
| | | priceHistoryDialogVisible.value = true |
| | | priceHistoryList.value = [] |
| | | fetchPriceHistoryList(row) |
| | | } |
| | | |
| | | const fetchPriceHistoryList = (row) => { |
| | | priceHistoryLoading.value = true |
| | | getPriceHistoryList({ quotationProductId: row.id }).then(res => { |
| | | priceHistoryList.value = res.data |
| | | }).finally(() => { |
| | | priceHistoryLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | const handlePriceHistoryPageChange = () => {} |
| | | |
| | | // 计ç®å±æ§ |
| | | const filteredList = computed(() => { |
| | |
| | | handleSearch() |
| | | } |
| | | |
| | | // 导å
¥æä»¶ |
| | | const handleImport = () => { |
| | | importDialogVisible.value = true |
| | | nextTick(() => { |
| | | if (importDialogRef.value) { |
| | | importDialogRef.value.clearFiles() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleAdd = async () => { |
| | | dialogTitle.value = 'æ°å¢æ¥ä»·' |
| | | isEdit.value = false |
| | | resetForm() |
| | | dialogVisible.value = true |
| | | let userLists = await userListNoPage(); |
| | | // åªå¤å¶éè¦çåæ®µï¼é¿å
å°ç»ä»¶å¼ç¨æ¾å
¥ååºå¼å¯¹è±¡ |
| | | userList.value = (userLists.data || []).map(item => ({ |
| | | userId: item.userId, |
| | | nickName: item.nickName || '', |
| | | userName: item.userName || '' |
| | | })); |
| | | getProductOptions(); |
| | | fetchCustomerOptions() |
| | | } |
| | | |
| | | const fetchCustomerOptions = () => { |
| | | if (customerOption.value.length > 0) return |
| | | listCustomer({current: -1,size:-1, type: 0}).then((res) => { |
| | | customerOption.value = res.data.records; |
| | | customerList().then((res) => { |
| | | // åªå¤å¶éè¦çåæ®µï¼é¿å
å°ç»ä»¶å¼ç¨æ¾å
¥ååºå¼å¯¹è±¡ |
| | | customerOption.value = (Array.isArray(res) ? res : []).map(item => ({ |
| | | id: item.id, |
| | | customerName: item.customerName || '', |
| | | taxpayerIdentificationNumber: item.taxpayerIdentificationNumber || '' |
| | | })) |
| | | }); |
| | | } |
| | | const getProductOptions = () => { |
| | |
| | | return productOptions.value |
| | | }); |
| | | }; |
| | | |
| | | function convertIdToValue(data) { |
| | | return data.map((item) => { |
| | | const { id, children, ...rest } = item; |
| | |
| | | return newItem; |
| | | }); |
| | | } |
| | | |
| | | // æ ¹æ®åç§°åæ¥èç¹ idï¼ä¾¿äºä»
ååç§°æ¶çåæ¾ |
| | | function findNodeIdByLabel(nodes, label) { |
| | | if (!label) return null; |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | const getModels = (value, row) => { |
| | | if (!row) return; |
| | | // 妿æ¸
ç©ºéæ©ï¼åæ¸
空ç¸å
³å段 |
| | |
| | | row.productId = ''; |
| | | row.product = ''; |
| | | row.modelOptions = []; |
| | | row.productModelId = ''; |
| | | row.specificationId = ''; |
| | | row.specification = ''; |
| | | row.unit = ''; |
| | | return; |
| | |
| | | if (!row) return; |
| | | // 妿æ¸
ç©ºéæ©ï¼åæ¸
空ç¸å
³å段 |
| | | if (!value) { |
| | | row.productModelId = ''; |
| | | row.specificationId = ''; |
| | | row.specification = ''; |
| | | row.unit = ''; |
| | | return; |
| | | } |
| | | // æ´æ° productModelIdï¼v-model å·²ç»èªå¨æ´æ°ï¼è¿éç¡®ä¿ä¸è´æ§ï¼ |
| | | row.productModelId = value; |
| | | // æ´æ° specificationIdï¼v-model å·²ç»èªå¨æ´æ°ï¼è¿éç¡®ä¿ä¸è´æ§ï¼ |
| | | row.specificationId = value; |
| | | const modelOptions = row.modelOptions || []; |
| | | const index = modelOptions.findIndex((item) => item.id === value); |
| | | if (index !== -1) { |
| | |
| | | products: row.products ? row.products.map(product => ({ |
| | | productId: product.productId || '', |
| | | product: product.product || product.productName || '', |
| | | productModelId: product.productModelId || '', |
| | | specificationId: product.specificationId || '', |
| | | specification: product.specification || '', |
| | | quantity: product.quantity || 0, |
| | | unit: product.unit || '', |
| | |
| | | form.id = row.id || form.id || null |
| | | // å
å è½½äº§åæ æ°æ®ï¼å¦å el-tree-select æ æ³åæ¾äº§ååç§° |
| | | await getProductOptions() |
| | | await fetchCustomerOptions() |
| | | |
| | | // åªå¤å¶éè¦çåæ®µï¼é¿å
å°ç»ä»¶å¼ç¨æ¾å
¥ååºå¼å¯¹è±¡ |
| | | form.quotationNo = row.quotationNo || '' |
| | | form.customer = row.customer || '' |
| | | form.customerId = row.customerId || undefined |
| | | form.salesperson = row.salesperson || '' |
| | | form.quotationDate = row.quotationDate || '' |
| | | form.validDate = row.validDate || '' |
| | |
| | | |
| | | // 妿æäº§åIDï¼å 载对åºçè§æ ¼åå·å表 |
| | | let modelOptions = []; |
| | | let resolvedProductModelId = product.productModelId || ''; |
| | | let resolvedSpecificationId = product.specificationId || ''; |
| | | |
| | | if (resolvedProductId) { |
| | | try { |
| | | const res = await modelList({ id: resolvedProductId }); |
| | | modelOptions = res || []; |
| | | |
| | | // 妿è¿åçæ°æ®æ²¡æ productModelIdï¼ä½æ specification åç§°ï¼æ ¹æ®åç§°æ¥æ¾ ID |
| | | if (!resolvedProductModelId && product.specification) { |
| | | // 妿è¿åçæ°æ®æ²¡æ specificationIdï¼ä½æ specification åç§°ï¼æ ¹æ®åç§°æ¥æ¾ ID |
| | | if (!resolvedSpecificationId && product.specification) { |
| | | const foundModel = modelOptions.find(item => item.model === product.specification); |
| | | if (foundModel) { |
| | | resolvedProductModelId = foundModel.id; |
| | | resolvedSpecificationId = foundModel.id; |
| | | } |
| | | } |
| | | } catch (error) { |
| | |
| | | return { |
| | | productId: resolvedProductId, |
| | | product: productName, |
| | | productModelId: resolvedProductModelId, |
| | | specificationId: resolvedSpecificationId, |
| | | specification: product.specification || '', |
| | | quantity: product.quantity || 0, |
| | | unit: product.unit || '', |
| | |
| | | form.discountRate = row.discountRate || 0 |
| | | form.discountAmount = row.discountAmount || 0 |
| | | form.totalAmount = row.totalAmount || 0 |
| | | |
| | | // å è½½ç¨æ·å表 |
| | | let userLists = await userListNoPage(); |
| | | userList.value = (userLists.data || []).map(item => ({ |
| | | userId: item.userId, |
| | | nickName: item.nickName || '', |
| | | userName: item.userName || '' |
| | | })); |
| | | |
| | | dialogVisible.value = true |
| | | } |
| | |
| | | productId: '', |
| | | product: '', |
| | | productName: '', |
| | | productModelId: '', |
| | | specificationId: '', |
| | | specification: '', |
| | | quantity: 1, |
| | | unit: '', |
| | | unitPrice: 0, |
| | |
| | | form.totalAmount = form.subtotal + form.freight + form.otherFee - form.discountAmount |
| | | } |
| | | |
| | | const handleCustomerChange = () => { |
| | | // å¯ä»¥æ ¹æ®å®¢æ·ä¿¡æ¯èªå¨å¡«å
ä¸äºé»è®¤å¼ |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | |
| | | return sum + price |
| | | }, 0) |
| | | |
| | | form.customer = customerOption.value.find(item => item.id === form.customerId)?.customerName || '' |
| | | if (isEdit.value) { |
| | | // ç¼è¾ |
| | | const index = quotationList.value.findIndex(item => item.id === editId.value) |
| | |
| | | }) |
| | | } |
| | | |
| | | const downloadImportTemplate = () => { |
| | | proxy.download("/sales/quotation/downloadTemplate", {}, "æ¥ä»·å导å
¥æ¨¡æ¿.xlsx"); |
| | | } |
| | | |
| | | const handleCurrentChange = (val) => { |
| | | pagination.currentPage = val.page |
| | | pagination.pageSize = val.limit |
| | |
| | | id: item.id, |
| | | quotationNo: item.quotationNo || '', |
| | | customer: item.customer || '', |
| | | customerId: item.customerId || undefined, |
| | | salesperson: item.salesperson || '', |
| | | quotationDate: item.quotationDate || '', |
| | | validDate: item.validDate || '', |
| | | paymentMethod: item.paymentMethod || '', |
| | | status: item.status || 'è稿', |
| | | // 审æ¹äººï¼ç¨äºç¼è¾æ¶åæ¾ï¼ |
| | | approveUserIds: item.approveUserIds || '', |
| | | remark: item.remark || '', |
| | | products: item.products ? item.products.map(product => ({ |
| | | productId: product.productId || '', |
| | | product: product.product || product.productName || '', |
| | | productModelId: product.productModelId || '', |
| | | specificationId: product.specificationId || '', |
| | | specification: product.specification || '', |
| | | quantity: product.quantity || 0, |
| | | unit: product.unit || '', |
| | |
| | | pagination.total = res.data.total |
| | | } |
| | | }) |
| | | // customerList().then((res) => { |
| | | // customerOption.value = res; |
| | | // }); |
| | | } |
| | | |
| | | const getUserList = async () => { |
| | | try { |
| | | const res = await userListNoPage() |
| | | userList.value = Array.isArray(res?.data) ? res.data : [] |
| | | } catch (error) { |
| | | userList.value = [] |
| | | ElMessage.error('å è½½ä¸å¡åå表失败') |
| | | } |
| | | customerList().then((res) => { |
| | | // åªå¤å¶éè¦çåæ®µï¼é¿å
å°ç»ä»¶å¼ç¨æ¾å
¥ååºå¼å¯¹è±¡ |
| | | customerOption.value = (Array.isArray(res) ? res : []).map(item => ({ |
| | | id: item.id, |
| | | customerName: item.customerName || '', |
| | | taxpayerIdentificationNumber: item.taxpayerIdentificationNumber || '' |
| | | })) |
| | | }); |
| | | } |
| | | |
| | | onMounted(()=>{ |
| | | getUserList() |
| | | handleSearch() |
| | | fetchCustomerOptions() |
| | | }) |
| | | </script> |
| | | |
| | |
| | | |
| | | .product-table-form-item { |
| | | margin-bottom: 0; |
| | | |
| | | :deep(.el-form-item__content) { |
| | | margin-left: 0 !important; |
| | | } |
| | | |
| | | :deep(.el-form-item__label) { |
| | | width: auto; |
| | | min-width: auto; |
| | | } |
| | | } |
| | | |
| | | .approver-nodes-container { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 24px; |
| | | padding: 12px 0; |
| | | } |
| | | |
| | | .approver-node-item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 12px; |
| | | padding: 16px; |
| | | background: #f8f9fa; |
| | | border-radius: 8px; |
| | | border: 1px solid #e4e7ed; |
| | | transition: all 0.3s ease; |
| | | min-width: 180px; |
| | | |
| | | &:hover { |
| | | border-color: #409eff; |
| | | background: #f0f7ff; |
| | | box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1); |
| | | } |
| | | } |
| | | |
| | | .approver-node-label { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | font-size: 14px; |
| | | color: #606266; |
| | | |
| | | .node-step { |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 24px; |
| | | height: 24px; |
| | | background: #409eff; |
| | | color: #fff; |
| | | border-radius: 50%; |
| | | font-size: 12px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .node-text { |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .arrow-icon { |
| | | color: #909399; |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | |
| | | .approver-select { |
| | | width: 100%; |
| | | min-width: 150px; |
| | | } |
| | | |
| | | .remove-btn { |
| | | margin-top: 4px; |
| | | } |
| | | |
| | | .product-table { |
| | |
| | | text-align: right; |
| | | } |
| | | |
| | | // ååºå¼ä¼å |
| | | @media (max-width: 1200px) { |
| | | .approver-nodes-container { |
| | | gap: 16px; |
| | | } |
| | | |
| | | .approver-node-item { |
| | | min-width: 160px; |
| | | } |
| | | } |
| | | </style> |