feat(costStatistics):
- 新增全局汇总信息,展示筛选结果条数与全部费用合计
- 保存费用后自动刷新数据并同步已勾选行状态
| | |
| | | // è´¹ç¨ç»è®¡é¡µé¢ç¸å
³æ¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | export function selectRatesSummary(query) { |
| | | return request({ url: '/insOrderRates/selectRatesSummary', method: 'get', params: query }) |
| | | } |
| | | |
| | | // æ¥è¯¢è®¢åå表 |
| | | export function selectRatesPage(query) { |
| | | return request({ |
| | |
| | | @current-change="currentChange" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column v-if="isSelection" align="center" type="selection" width="55" /> |
| | | <el-table-column v-if="isSelection" align="center" type="selection" width="55" :reserve-selection="reserveSelection" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" :index="indexMethod" /> |
| | | |
| | | <el-table-column |
| | |
| | | |
| | | const props = defineProps({ |
| | | isSelection: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | reserveSelection: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | |
| | | }) |
| | | }) |
| | | |
| | | defineExpose({ setCurrent }) |
| | | function clearSelection() { |
| | | multipleTable.value?.clearSelection() |
| | | } |
| | | |
| | | defineExpose({ setCurrent, clearSelection }) |
| | | </script> |
| | | |
| | | <style scoped> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import Big from 'big.js' |
| | | |
| | | export function orderAmount(row) { |
| | | return new Big(Number(row.isDiscount) === 1 && row.discountAmount != null && row.discountAmount !== '' |
| | | ? row.discountAmount : (row.totalPrice || 0)) |
| | | } |
| | | |
| | | export function sumOrderAmounts(rows) { |
| | | return rows.reduce((total, row) => total.plus(orderAmount(row)), new Big(0)).toFixed(2) |
| | | } |
| | |
| | | <div class="search"> |
| | | <div> |
| | | <el-form :model="searchForm" ref="searchForm" size="small" :inline="true"> |
| | | <el-form-item label="客æ·åç§°" prop="unitName" v-if="tabIndex === '0'"> |
| | | <el-form-item label="客æ·åç§°" prop="unitName"> |
| | | <el-input v-model="searchForm.unitName" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æä»¶åç§°" prop="fileName" v-if="tabIndex === '1'"> |
| | | <el-input v-model="searchForm1.fileName" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" size="small" @click="searchList">æ¥è¯¢</el-button> |
| | |
| | | </el-form> |
| | | </div> |
| | | <div> |
| | | <el-button v-if="tabIndex === '0'" size="small" type="primary" @click="openFormDia('add')">æ° å¢</el-button> |
| | | <el-button v-if="tabIndex === '0'" size="small" type="primary" @click="openExportDialog">导 åº</el-button> |
| | | <el-upload v-if="tabIndex === '1'" ref='upload' :action="action" :before-upload="beforeUpload" |
| | | :headers="uploadHeader" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false" |
| | | accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'> |
| | | <el-button :loading="upLoading" size="small" type="primary">导å
¥</el-button> |
| | | </el-upload> |
| | | <el-button size="small" type="primary" @click="openFormDia('add')">æ° å¢</el-button> |
| | | <el-button size="small" type="primary" @click="openExportDialog">导 åº</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <div class="table-tab"> |
| | | <el-radio-group v-model="tabIndex" @change="searchList" size="small"> |
| | | <el-radio-button value="0">å®¢æ·æ»¡æåº¦</el-radio-button> |
| | | <el-radio-button value="1">综ååæ</el-radio-button> |
| | | </el-radio-group> |
| | | </div> |
| | | <div v-if="tabIndex === '0'"> |
| | | <limsTable :column="tableColumn" :height="'calc(100vh - 22em)'" :table-data="tableData" |
| | | :table-loading="tableLoading" @pagination="pagination" |
| | | :page="page"> |
| | | </limsTable> |
| | | </div> |
| | | <div v-if="tabIndex === '1'"> |
| | | <limsTable :column="tableColumn1" :height="'calc(100vh - 22em)'" :table-data="tableData1" |
| | | :table-loading="tableLoading1" @pagination="pagination0"> |
| | | </limsTable> |
| | | </div> |
| | | <limsTable :column="tableColumn" :height="'calc(100vh - 22em)'" :table-data="tableData" |
| | | :table-loading="tableLoading" @pagination="pagination" |
| | | :page="page"> |
| | | </limsTable> |
| | | </div> |
| | | </div> |
| | | <el-dialog v-model="lookDialogVisible" fullscreen title="æ¥çéä»¶" top="5vh" width="800px"> |
| | | <filePreview v-if="lookDialogVisible" :currentFile="{}" :fileUrl="javaApi + '/word/' + currentInfo.fileUrl" |
| | | style="height: 90vh;overflow-y: auto;" /> |
| | | </el-dialog> |
| | | <el-dialog v-model="exportDialogVisible" title="导åºå¹´åº¦æ±æ»" width="360px" :close-on-click-modal="false"> |
| | | <el-form label-width="80px"> |
| | | <el-form-item label="æ±æ»å¹´åº¦"> |
| | |
| | | <script> |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import FormDialog from './components/formDialog.vue'; |
| | | import filePreview from '@/components/Preview/filePreview.vue' |
| | | import limsAttachment from '@/components/Attachment/lims-attachment.vue' |
| | | import { |
| | | pageClientSatisfaction, |
| | | pageAnalyseFile, |
| | | delClientSatisfaction, |
| | | delAnalyseFile, |
| | | exportAnnualSummary, |
| | | } from '@/api/cnas/systemManagement/customerSatisfaction.js' |
| | | |
| | | export default { |
| | | name: 'CustomerSatisfaction', |
| | | // import å¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | | components: { filePreview, FormDialog, limsTable, limsAttachment }, |
| | | components: { FormDialog, limsTable, limsAttachment }, |
| | | data() { |
| | | // è¿éåæ¾æ°æ® |
| | | return { |
| | | searchForm: { |
| | | unitName: '', |
| | | }, |
| | | searchForm1: { |
| | | fileName: '', |
| | | }, |
| | | tabIndex: '0', |
| | | tableColumn: [ |
| | | { |
| | | label: '客æ·åç§°', |
| | |
| | | current: 1, |
| | | total: 0, |
| | | }, |
| | | tableColumn1: [ |
| | | { |
| | | label: 'éä»¶åç§°', |
| | | prop: 'fileName', |
| | | minWidth: '100' |
| | | }, |
| | | { |
| | | label: 'å建人', |
| | | prop: 'userName', |
| | | minWidth: '100' |
| | | }, |
| | | { |
| | | label: 'å建æ¶é´', |
| | | prop: 'createTime', |
| | | minWidth: '100' |
| | | }, |
| | | { |
| | | dataType: 'action', |
| | | label: 'æä½', |
| | | operation: [ |
| | | { |
| | | name: 'é¢è§', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.handleLook(row) |
| | | } |
| | | }, |
| | | { |
| | | name: 'ä¸è½½', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.upload(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: 'å é¤', |
| | | type: 'text', |
| | | color: 'var(--el-color-danger)', |
| | | clickFun: (row) => { |
| | | this.delFile(row) |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | tableData1: [], |
| | | tableLoading1: false, |
| | | page1: { |
| | | size: 20, |
| | | current: 1, |
| | | total: 0, |
| | | }, |
| | | formDialog: false, |
| | | upLoading: false, |
| | | currentInfo: {}, |
| | | lookDialogVisible: false, |
| | | exportDialogVisible: false, |
| | | exportYear: String(new Date().getFullYear()), |
| | | exportLoading: false, |
| | |
| | | methods: { |
| | | // æ¥è¯¢å表 |
| | | searchList() { |
| | | const entity = this.tabIndex === '0' ? this.searchForm : this.searchForm1 |
| | | const page = this.tabIndex === '0' ? this.page : this.page1 |
| | | if (this.tabIndex === '0') { |
| | | this.tableLoading = true |
| | | pageClientSatisfaction({ ...entity, ...page }).then(res => { |
| | | this.tableLoading = false |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | }).catch(err => { |
| | | console.log('err---', err); |
| | | this.tableLoading = false |
| | | }) |
| | | } else { |
| | | this.tableLoading1 = true |
| | | pageAnalyseFile({ ...entity, ...page }).then(res => { |
| | | this.tableLoading1 = false |
| | | this.tableData1 = res.data.records |
| | | this.page1.total = res.data.total |
| | | }).catch(err => { |
| | | console.log('err---', err); |
| | | this.tableLoading1 = false |
| | | }) |
| | | } |
| | | this.tableLoading = true |
| | | pageClientSatisfaction({ ...this.searchForm, ...this.page }).then(res => { |
| | | this.tableLoading = false |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | }).catch(err => { |
| | | console.log('err---', err); |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | openFormDia(type, row) { |
| | | this.formDialog = true |
| | |
| | | // éç½®æ¥è¯¢æ¡ä»¶ |
| | | resetSearchForm() { |
| | | this.searchForm.unitName = ''; |
| | | this.searchForm1.fileName = ''; |
| | | this.searchList() |
| | | }, |
| | | // 导å
¥æµç¨ |
| | | beforeUpload(file) { |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('ä¸ä¼ æä»¶ä¸è¶
è¿10M'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } else { |
| | | this.upLoading = true; |
| | | return true; |
| | | } |
| | | }, |
| | | onError(err, file, fileList) { |
| | | this.$message.error('ä¸ä¼ 失败') |
| | | this.$refs.upload.clearFiles() |
| | | }, |
| | | handleSuccessUp(response) { |
| | | this.upLoading = false; |
| | | if (response.code == 200) { |
| | | this.$message.success('ä¸ä¼ æå'); |
| | | this.searchList() |
| | | } |
| | | }, |
| | | // å é¤å®¢æ·æ»¡æåº¦ |
| | | delPlan(row) { |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | // æ¥çæä»¶ |
| | | handleLook(row) { |
| | | this.currentInfo = row |
| | | this.lookDialogVisible = true |
| | | }, |
| | | // ä¸è½½å®¢æ·ç¦å»º |
| | | upload(row) { |
| | | this.$download.saveAs(row.fileUrl, row.fileName); |
| | | }, |
| | | // å é¤å®¢æ·åæéä»¶ |
| | | delFile(row) { |
| | | this.$confirm('æ¤æä½å°æ°¸ä¹
å é¤è¯¥æ°æ®, æ¯å¦ç»§ç»?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.tableLoading = true |
| | | delAnalyseFile({ analyseFileId: row.analyseFileId }).then(res => { |
| | | this.tableLoading = false |
| | | this.$message.success('å 餿å') |
| | | this.searchList() |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | console.log('err---', err); |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }); |
| | | }); |
| | | }, |
| | | // å页 |
| | | pagination({ page, limit }) { |
| | | this.page.current = page; |
| | | this.page.size = limit; |
| | | this.searchList(); |
| | | }, |
| | | // å页 |
| | | pagination0({ page, limit }) { |
| | | this.page.current = page; |
| | | this.page.size = limit; |
| | | this.searchList(); |
| | | }, |
| | | }, |
| | | // ç¨äºä¸ä¼ æä»¶çä¿¡æ¯ |
| | | computed: { |
| | | action() { |
| | | return this.javaApi + '/clientSatisfaction/uploadAnalyseFile' |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | height: 46px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .table-tab { |
| | | margin: 0 0 20px 0; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <!-- è´¹ç¨ç»è®¡é¡µé¢--> |
| | | <div class="capacity-scope"> |
| | | <div class="capacity-scope" v-loading="feeSaving"> |
| | | <div class="search"> |
| | | <div> |
| | | <el-form :model="entity" ref="entity" size="small" :inline="true"> |
| | |
| | | </div> |
| | | </div> |
| | | <div> |
| | | <lims-table :tableData="tableData" :column="column" |
| | | <lims-table ref="ratesTable" :tableData="tableData" :column="column" |
| | | :height="'calc(100vh - 300px)'" @pagination="pagination" |
| | | :isSelection="true" :handleSelectionChange="handleSelectionChange" |
| | | rowKey="id" :reserveSelection="true" |
| | | :page="page" :tableLoading="tableLoading"> |
| | | <template #isDiscount="{ row }"> |
| | | <el-select v-model="row.isDiscount" size="small" style="width: 80px" |
| | |
| | | </template> |
| | | </lims-table> |
| | | </div> |
| | | <div class="sum-bar"> |
| | | <div class="sum-bar" v-loading="tableLoading"> |
| | | <span class="all-summary">çéç»æ <b class="sum-count">{{ summary ? summary.count : 'â' }}</b> æ¡ï¼ |
| | | å
¨é¨è´¹ç¨ï¼<b class="sum-amount">Â¥{{ summary ? formatAmount(summary.totalAmount) : 'â' }}</b> |
| | | <small>ï¼å
嫿æå页ï¼</small> |
| | | </span> |
| | | <span>å·²å¾é <b class="sum-count">{{ selectedRows.length }}</b> æ¡</span> |
| | | <span>æ»éé¢ï¼<b class="sum-amount">Â¥{{ selectedTotal }}</b></span> |
| | | <span>å¾éå计ï¼<b class="sum-amount">Â¥{{ selectedTotal }}</b></span> |
| | | <el-button link type="primary" :disabled="!selectedRows.length" @click="clearSelection">æ¸
空å¾é</el-button> |
| | | </div> |
| | | <viewInfoDia ref="viewInfoDia" v-if="viewInfoDia"></viewInfoDia> |
| | | </div> |
| | |
| | | <script> |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import viewInfoDia from "./components/viewInfoDia.vue"; |
| | | import {selectRatesPage, updateOrderFee} from "@/api/business/insOrderRates"; |
| | | import {selectRatesPage, selectRatesSummary, updateOrderFee} from "@/api/business/insOrderRates"; |
| | | import {sumOrderAmounts} from "@/utils/orderRates"; |
| | | import Big from 'big.js'; |
| | | import {selectCustomPageList} from "@/api/system/customer"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | |
| | | data() { |
| | | return { |
| | | entity: { |
| | | entrustCode: null, |
| | | sample: null, |
| | | company: null, |
| | | }, |
| | | monthRange: [], |
| | | appliedFilters: {}, |
| | | summary: null, |
| | | savedRows: {}, |
| | | requestVersion: 0, |
| | | feeSaving: false, |
| | | tableData: [], |
| | | tableLoading: false, |
| | | column: [ |
| | |
| | | computed: { |
| | | // å¾éåè®¡ï¼æä¼æ ä¸å¡«äºä¼æ åéé¢çæä¼æ åéé¢ç®ï¼å¦åææ»ä»·ç® |
| | | selectedTotal() { |
| | | const total = this.selectedRows.reduce((sum, row) => { |
| | | const useDiscount = row.isDiscount === 1 && row.discountAmount !== null && row.discountAmount !== undefined |
| | | const amount = Number(useDiscount ? row.discountAmount : row.totalPrice) |
| | | return sum + (isFinite(amount) ? amount : 0) |
| | | }, 0) |
| | | return total.toFixed(2) |
| | | return sumOrderAmounts(this.selectedRows) |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }, |
| | | methods :{ |
| | | refreshTable() { |
| | | this.tableLoading = true |
| | | const [startMonth, endMonth] = this.monthRange || [] |
| | | selectRatesPage({ ...this.page, ...this.entity, startMonth, endMonth }).then(res => { |
| | | this.tableLoading = false |
| | | this.tableData = (res.data.records || []).map(item => { |
| | | item.isDiscount = item.isDiscount === 1 ? 1 : 0 |
| | | return item |
| | | }) |
| | | this.appliedFilters = { ...this.entity, startMonth, endMonth } |
| | | this.page.current = 1 |
| | | this.clearSelection() |
| | | this.savedRows = {} |
| | | this.tableData = [] |
| | | return this.loadTable() |
| | | }, |
| | | async loadTable() { |
| | | const version = ++this.requestVersion |
| | | this.tableLoading = true |
| | | this.summary = null |
| | | try { |
| | | const [res, summary] = await Promise.all([ |
| | | selectRatesPage({ current: this.page.current, size: this.page.size, ...this.appliedFilters }), |
| | | selectRatesSummary(this.appliedFilters), |
| | | ]) |
| | | if (version !== this.requestVersion) return |
| | | this.tableData = (res.data.records || []).map(row => ({ ...row, isDiscount: Number(row.isDiscount || 0) })) |
| | | // ä¿çæå¡ç«¯å¿«ç
§ï¼è¾å
¥æ¡ä¸å°æªä¿åçéé¢ä¸è¿å
¥å计ã |
| | | this.tableData.forEach(row => { this.savedRows[row.id] = { ...row } }) |
| | | this.selectedRows = this.selectedRows.map(row => this.savedRows[row.id] || row) |
| | | this.page.total = res.data.total |
| | | this.selectedRows = [] |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | }) |
| | | this.summary = summary.data |
| | | } catch (err) { |
| | | if (version !== this.requestVersion) return |
| | | this.tableData = [] |
| | | this.page.total = 0 |
| | | this.clearSelection() |
| | | } finally { |
| | | if (version === this.requestVersion) this.tableLoading = false |
| | | } |
| | | }, |
| | | clearSelection() { |
| | | this.$refs.ratesTable?.clearSelection() |
| | | this.selectedRows = [] |
| | | }, |
| | | formatAmount(value) { |
| | | return new Big(value || 0).toFixed(2) |
| | | }, |
| | | // éç½® |
| | | refresh() { |
| | |
| | | }, |
| | | // å页忢 |
| | | pagination(page) { |
| | | this.page.current = page.page |
| | | this.page.size = page.limit |
| | | this.refreshTable() |
| | | return this.loadTable() |
| | | }, |
| | | // å¾éè¡åå |
| | | handleSelectionChange(selection) { |
| | | this.selectedRows = selection |
| | | this.selectedRows = selection.map(row => this.savedRows[row.id] || { ...row }) |
| | | }, |
| | | // 忢æ¯å¦ä¼æ |
| | | handleDiscountChange(row) { |
| | |
| | | } else { |
| | | row.discountAmount = null |
| | | } |
| | | this.saveFee(row) |
| | | return this.saveFee(row) |
| | | }, |
| | | // 伿 åé颿¹å®ä¿å |
| | | handleAmountChange(row) { |
| | |
| | | ElMessage.warning('æä¼æ æ¶è¯·å¡«å伿 åéé¢') |
| | | return |
| | | } |
| | | this.saveFee(row) |
| | | return this.saveFee(row) |
| | | }, |
| | | // 夿³¨æ¹å®ä¿å |
| | | handleFeeRemarkChange(row) { |
| | | this.saveFee(row) |
| | | return this.saveFee(row) |
| | | }, |
| | | amountOf(value) { |
| | | const num = Number(value) |
| | | if (!isFinite(num)) return 0 |
| | | return Math.round(num * 100) / 100 |
| | | }, |
| | | saveFee(row) { |
| | | updateOrderFee({ |
| | | id: row.id, |
| | | isDiscount: row.isDiscount, |
| | | discountAmount: row.isDiscount === 1 ? row.discountAmount : null, |
| | | feeRemark: row.feeRemark || null |
| | | }).catch(() => { |
| | | this.refreshTable() |
| | | }) |
| | | async saveFee(row) { |
| | | if (this.feeSaving) return |
| | | if (row.isDiscount === 1 && (row.discountAmount == null || row.discountAmount === '')) { |
| | | ElMessage.warning('æä¼æ æ¶è¯·å¡«å伿 åéé¢') |
| | | return |
| | | } |
| | | this.feeSaving = true |
| | | // 使修æ¹åä»å¨éçæ¥è¯¢å¤±æï¼é¿å
æ§éé¢è¦çä¿ååçç¶æã |
| | | ++this.requestVersion |
| | | try { |
| | | await updateOrderFee({ |
| | | id: row.id, |
| | | isDiscount: row.isDiscount, |
| | | discountAmount: row.isDiscount === 1 ? row.discountAmount : null, |
| | | feeRemark: row.feeRemark || null |
| | | }) |
| | | } catch (err) { |
| | | // è¯·æ±æ¦æªå¨æç¤ºå¤±è´¥åå ï¼ä¸é¢éæ°è¯»åå®é
ä¿åçéé¢ã |
| | | } finally { |
| | | await this.loadTable() |
| | | this.feeSaving = false |
| | | } |
| | | }, |
| | | // æ¥ç详æ
|
| | | openDia (row) { |
| | |
| | | .search { |
| | | min-height: 46px; |
| | | display: flex; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | justify-content: space-between; |
| | | } |
| | | .sum-bar { |
| | |
| | | bottom: 0; |
| | | z-index: 10; |
| | | display: flex; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | justify-content: flex-end; |
| | | gap: 24px; |
| | | margin-top: 8px; |
| | |
| | | .sum-count { |
| | | color: var(--el-color-primary); |
| | | } |
| | | .all-summary { margin-right: auto; } |
| | | .all-summary small { color: var(--el-text-color-secondary); } |
| | | .sum-amount { |
| | | color: var(--el-color-danger); |
| | | font-size: 16px; |