结算和工地直转

This commit is contained in:
syruan 2025-08-23 16:14:57 +08:00
parent 4f90ac4083
commit e1020db09b
8 changed files with 515 additions and 97 deletions

View File

@ -25,6 +25,18 @@ export function getUnitList(data) {
data: data, data: data,
}) })
} }
// 往来单位下拉选,过滤掉班组
// 往来单位下拉选
export function getUnitListFilterTeam(data) {
return request({
url: '/material/select/getUnitListFilterTeam',
method: 'post',
data: data,
})
}
// 协议 // 协议
export function getAgreementInfoById(data) { export function getAgreementInfoById(data) {
return request({ return request({

View File

@ -248,14 +248,40 @@
</el-row> </el-row>
</el-form> </el-form>
<!-- 数据状态提示 -->
<div class="data-status-info" style="margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;">
<!-- 分页状态 -->
<div style="padding: 8px 12px; background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; color: #475569; font-size: 14px;">
<i class="el-icon-info"></i>
总共 <strong>{{ total }}</strong> 条数据当前显示第 <strong>{{ queryParams.pageNum }}</strong> 每页 <strong>{{ queryParams.pageSize }}</strong>
</div>
<!-- 选中数量提示 -->
<div v-if="multipleSelection.length > 0" style="padding: 8px 12px; background-color: #f0f9ff; border: 1px solid #bfdbfe; border-radius: 4px; color: #1e40af;">
<i class="el-icon-info"></i>
已选中 <strong>{{ multipleSelection.length }}</strong> 条数据
<span style="margin-left: 10px; font-size: 12px; color: #64748b;">
<!-- (当前页: {{ equipmentList.filter(row => row.isActive).length }} , 全部: {{ selectedDataArray.length }} )-->
</span>
<el-button type="text" size="mini" style="margin-left: 10px; color: #ef4444;" @click="clearCrossPageSelection">
清空选择
</el-button>
</div>
</div>
<el-table <el-table
v-loading="loading" v-loading="loading"
ref="equipmentList" ref="equipmentList"
:data="equipmentList" :data="equipmentList"
:row-key="getRowKey"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" label="序号" type="index" width="55" /> <el-table-column align="center" label="序号" width="55">
<template slot-scope="scope">
{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column <el-table-column
v-for="(column, index) in tableColumns" v-for="(column, index) in tableColumns"
:key="column.prop" :key="column.prop"
@ -287,6 +313,15 @@
</el-table-column> --> </el-table-column> -->
</el-table> </el-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 图片查看弹窗 --> <!-- 图片查看弹窗 -->
<el-dialog :visible.sync="dialogVisible" width="600px" height="600px"> <el-dialog :visible.sync="dialogVisible" width="600px" height="600px">
<img width="100%" height="500px" :src="dialogImageUrl" /> <img width="100%" height="500px" :src="dialogImageUrl" />
@ -303,11 +338,12 @@ import { getUseringData, receiveSubmit, receiveEdit, receiveDetail, getEquipment
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import Pagination from '@/components/Pagination'
export default { export default {
name: 'DirectApply', name: 'DirectApply',
dicts: ['purchase_task_status'], dicts: ['purchase_task_status'],
components: { Treeselect }, components: { Treeselect, Pagination },
data() { data() {
return { return {
id: '', id: '',
@ -367,10 +403,18 @@ export default {
projectId: null, projectId: null,
// //
queryParams: { queryParams: {
pageNum: 1, //
pageSize: 20, //
maId: undefined, // maId: undefined, //
typeId: '', // typeId: '', //
keyWord: '' keyWord: ''
}, },
//
allData: [], //
//
selectedDataArray: [], //
//
isRestoringSelection: false, // true
maForm: { maForm: {
backUnitId: undefined, backUnitId: undefined,
backProId: undefined, backProId: undefined,
@ -477,6 +521,9 @@ export default {
} }
}, },
created() { created() {
//
this.isRestoringSelection = false
if (this.$route.query.type == 'edit') { if (this.$route.query.type == 'edit') {
this.isEdit = true this.isEdit = true
this.isDetail = false this.isDetail = false
@ -508,7 +555,13 @@ export default {
// this.maForm.backAgreementId // this.maForm.backAgreementId
'maForm.backAgreementId': { 'maForm.backAgreementId': {
handler: function (val, oldVal) { handler: function (val, oldVal) {
if (val && val !== oldVal) {
this.getMaTypeOpt() this.getMaTypeOpt()
//
this.allData = []
this.clearCrossPageSelection()
this.queryParams.pageNum = 1
}
}, },
deep: true deep: true
} }
@ -516,42 +569,126 @@ export default {
methods: { methods: {
// //
handleQuery() { handleQuery() {
//
this.queryParams.pageNum = 1
//
this.allData = []
this.getList() this.getList()
}, },
// //
handleReset() { handleReset() {
this.$refs.queryForm.resetFields() this.$refs.queryForm.resetFields()
//
this.queryParams.pageNum = 1
//
this.allData = []
//
this.clearCrossPageSelection()
this.getList() this.getList()
}, },
//
clearCrossPageSelection() {
console.log('=== 清空所有选中状态 ===')
//
this.selectedDataArray = []
this.multipleSelection = []
//
if (this.$refs.equipmentList) {
// selection-change
this.isRestoringSelection = true
this.$refs.equipmentList.clearSelection()
// isActive
this.equipmentList.forEach(item => {
item.isActive = false
if (!this.isEdit && !this.isDetail) {
item.directNum = undefined
}
})
//
this.$nextTick(() => {
this.isRestoringSelection = false
console.log('清空选中状态完成')
})
} else {
this.isRestoringSelection = false //
}
},
//
clearAllStates() {
this.allData = []
this.equipmentList = []
this.total = 0
this.clearCrossPageSelection()
this.queryParams.pageNum = 1
},
// //
async getList() { async getList() {
this.loading = true
try { try {
//
const needRefreshData = this.queryParams.pageNum === 1 || this.allData.length === 0
if (needRefreshData) {
const params = { const params = {
agreementId: this.maForm.backAgreementId, agreementId: this.maForm.backAgreementId,
...this.queryParams maId: this.queryParams.maId,
typeId: this.queryParams.typeId,
keyWord: this.queryParams.keyWord
//
} }
const res = await getUseringData(params) const res = await getUseringData(params)
console.log('🚀 ~ 获取列表 ~ res:', res) console.log('🚀 ~ 获取列表 ~ res:', res)
this.equipmentList = res.data
if (this.isEdit || this.isDetail) { //
if (res.data && res.data.records) {
this.allData = res.data.records
} else if (Array.isArray(res.data)) {
this.allData = res.data
} else {
this.allData = []
}
}
//
this.total = this.allData.length
const startIndex = (this.queryParams.pageNum - 1) * this.queryParams.pageSize
const endIndex = startIndex + this.queryParams.pageSize
// equipmentListselection-change
this.isRestoringSelection = true
this.equipmentList = this.allData.slice(startIndex, endIndex)
console.log(`🚀 ~ 分页信息 ~ 总数据:${this.total}, 当前页:${this.queryParams.pageNum}, 每页:${this.queryParams.pageSize}, 当前页数据:${this.equipmentList.length}`)
//
if ((this.isEdit || this.isDetail) && this.multipleSelectionTemp.length > 0 && needRefreshData) {
console.log('编辑模式初始化选中数据:', this.multipleSelectionTemp.length)
//
this.selectedDataArray = [...this.multipleSelectionTemp.map(row => ({
...row,
isActive: true
}))]
this.updateCrossPageSelection()
console.log('编辑模式回显选中数据已添加到selectedDataArray:', this.selectedDataArray.length)
}
//
this.$nextTick(() => { this.$nextTick(() => {
this.multipleSelection = this.multipleSelectionTemp this.restoreCurrentPageSelection()
console.log('🚀 ~ 获取列表 ~ this.equipmentList:', this.multipleSelection)
this.multipleSelection.forEach(row => {
const foundRow = this.equipmentList.find(item => item.typeId === row.typeId)
console.log('🚀 ~ getList ~ foundRow:', foundRow)
if (foundRow) {
// directNum foundRow
foundRow.directNum = row.directNum
// toggleRowSelection
this.$refs.equipmentList.toggleRowSelection(foundRow)
}
}) })
})
}
} catch (error) { } catch (error) {
console.log('🚀 ~ 获取列表 ~ error:', error) console.log('🚀 ~ 获取列表 ~ error:', error)
this.tableList = [] this.allData = []
this.equipmentList = []
this.total = 0
} finally {
this.loading = false
} }
}, },
// //
@ -592,6 +729,10 @@ export default {
console.log('🚀 ~ getAgreementId ~ res:', res) console.log('🚀 ~ getAgreementId ~ res:', res)
this.maForm.backAgreementId = res.data.agreementId this.maForm.backAgreementId = res.data.agreementId
this.maForm.backAgreementCode = res.data.agreementCode this.maForm.backAgreementCode = res.data.agreementCode
//
this.allData = []
this.clearCrossPageSelection()
this.queryParams.pageNum = 1
this.getList() this.getList()
} catch (error) { } catch (error) {
console.log('🚀 ~ getAgreementId ~ error:', error) console.log('🚀 ~ getAgreementId ~ error:', error)
@ -715,21 +856,61 @@ export default {
} }
}, },
// //
handleSelectionChange(row) { handleSelectionChange(currentPageSelectedRows) {
console.log('选中了~', row) //
this.multipleSelection = row if (this.isRestoringSelection) {
this.equipmentList.forEach(item => { console.log('正在恢复选中状态忽略selection-change事件')
if (item.id && this.multipleSelection.some(val => val.id === item.id)) { console.trace('忽略selection-change的调用栈:')
item.isActive = true return
// useNum undefined
if (item.useNum !== undefined) {
item.directNum = item.useNum
} }
} else {
item.isActive = false console.log('=== handleSelectionChange 开始 ===')
console.trace('handleSelectionChange调用栈:')
console.log('当前页选中数据:', currentPageSelectedRows)
console.log('选中前全局数据数量:', this.selectedDataArray.length)
console.log('当前页码:', this.queryParams.pageNum)
// rowKey
const currentPageRowKeys = this.equipmentList.map(item => this.getRowKey(item))
// selectedDataArray
const beforeCount = this.selectedDataArray.length
this.selectedDataArray = this.selectedDataArray.filter(item =>
!currentPageRowKeys.includes(this.getRowKey(item))
)
const afterCount = this.selectedDataArray.length
console.log(`移除当前页数据:${beforeCount} -> ${afterCount},移除了 ${beforeCount - afterCount}`)
//
currentPageSelectedRows.forEach(row => {
const completeRow = {
...row,
directNum: row.directNum || row.useNum,
isActive: true
}
this.selectedDataArray.push(completeRow)
})
console.log(`添加当前页选中数据:${currentPageSelectedRows.length}`)
// isActive
this.equipmentList.forEach(item => {
const isSelected = currentPageSelectedRows.some(selectedRow => this.getRowKey(selectedRow) === this.getRowKey(item))
item.isActive = isSelected
if (isSelected && !item.directNum && item.useNum) {
item.directNum = item.useNum
} else if (!isSelected && !this.isEdit && !this.isDetail) {
item.directNum = undefined item.directNum = undefined
} }
}) })
// multipleSelection
this.multipleSelection = [...this.selectedDataArray]
console.log('选中后全局数据数量:', this.selectedDataArray.length)
console.log('当前页选中rowKey列表:', currentPageSelectedRows.map(row => this.getRowKey(row)))
console.log('全局选中rowKey列表:', this.selectedDataArray.map(row => this.getRowKey(row)))
console.log('=== handleSelectionChange 结束 ===')
console.log('')
}, },
// //
@ -740,12 +921,130 @@ export default {
row.directNum = row.useNum row.directNum = row.useNum
}) })
} }
//
const rowKey = this.getRowKey(row)
const selectedIndex = this.selectedDataArray.findIndex(item => this.getRowKey(item) === rowKey)
if (selectedIndex !== -1) {
//
this.selectedDataArray[selectedIndex] = {
...this.selectedDataArray[selectedIndex],
...row,
directNum: row.directNum,
isActive: true
}
// multipleSelection
this.multipleSelection = [...this.selectedDataArray]
console.log('数量变更后跨页选中总数:', this.selectedDataArray.length)
}
},
//
getRowKey(row) {
// 使
const key = `${row.typeId || row.id || 'unknown'}_${row.maCode || ''}_${row.typeModelName || ''}`
// rowKey
// console.log('rowKey:', key, 'for:', row.typeModelName)
return key
},
//
restoreCurrentPageSelection() {
//
if (!this.isRestoringSelection) {
this.isRestoringSelection = true
}
this.$nextTick(() => {
if (!this.$refs.equipmentList) {
this.isRestoringSelection = false //
return
}
console.log('=== 开始恢复选中状态 ===')
console.log('标志位状态:', this.isRestoringSelection)
console.log('全局选中数量:', this.selectedDataArray.length)
console.log('当前页数据数量:', this.equipmentList.length)
console.log('当前页码:', this.queryParams.pageNum)
console.log('是否编辑模式:', this.isEdit || this.isDetail)
if (this.selectedDataArray.length > 0) {
console.log('全局选中数据的前3个rowKey:', this.selectedDataArray.slice(0, 3).map(item => this.getRowKey(item)))
console.log('当前页数据的前3个rowKey:', this.equipmentList.slice(0, 3).map(item => this.getRowKey(item)))
}
try {
//
this.$refs.equipmentList.clearSelection()
//
let matchedCount = 0
this.equipmentList.forEach(row => {
const rowKey = this.getRowKey(row)
//
const selectedData = this.selectedDataArray.find(item => this.getRowKey(item) === rowKey)
if (selectedData) {
matchedCount++
//
row.directNum = selectedData.directNum
row.isActive = true
//
this.$refs.equipmentList.toggleRowSelection(row, true)
console.log(`恢复选中: ${rowKey}`)
} else {
row.isActive = false
if (!this.isEdit && !this.isDetail) {
row.directNum = undefined
}
}
})
console.log(`当前页匹配到 ${matchedCount} 条选中数据`)
// 0
if ((this.isEdit || this.isDetail) && matchedCount === 0 && this.selectedDataArray.length > 0) {
console.warn('编辑模式下当前页没有匹配到任何选中数据检查rowKey匹配:')
console.log('当前页所有rowKey:', this.equipmentList.map(item => this.getRowKey(item)))
console.log('全局选中所有rowKey:', this.selectedDataArray.map(item => this.getRowKey(item)))
}
const restoredCount = this.equipmentList.filter(row => row.isActive).length
console.log('恢复选中状态完成,当前页选中数量:', this.$refs.equipmentList.selection?.length || 0)
console.log('恢复选中状态完成当前页isActive数量:', restoredCount)
console.log('全局选中数量:', this.selectedDataArray.length)
console.log('当前页应该恢复的rowKey:', this.equipmentList.filter(row => {
const rowKey = this.getRowKey(row)
return this.selectedDataArray.some(item => this.getRowKey(item) === rowKey)
}).map(row => this.getRowKey(row)))
console.log('=== 恢复选中状态结束 ===')
console.log('')
} catch (error) {
console.error('恢复选中状态时出错:', error)
} finally {
//
this.isRestoringSelection = false
console.log('标志位已重置为:', this.isRestoringSelection)
}
})
},
//
updateCrossPageSelection() {
// 使
this.multipleSelection = [...this.selectedDataArray]
}, },
/** 保存按钮操作 */ /** 保存按钮操作 */
handleSave() { handleSave() {
// 使
this.updateCrossPageSelection()
console.log('=== 保存操作开始 ===')
console.log('maForm', this.maForm) console.log('maForm', this.maForm)
console.log('选中数据', this.multipleSelection) console.log('selectedDataArray:', this.selectedDataArray)
if (this.multipleSelection.length > 0) { console.log('multipleSelection:', this.multipleSelection)
console.log('选中数据总数:', this.selectedDataArray.length)
console.log('=====================')
if (this.selectedDataArray.length > 0) {
this.$refs['maForm'].validate(valid => { this.$refs['maForm'].validate(valid => {
if (valid) { if (valid) {
this.$modal.confirm('是否确认申请').then(async () => { this.$modal.confirm('是否确认申请').then(async () => {
@ -808,8 +1107,8 @@ export default {
} }
this.$message.success('操作成功') this.$message.success('操作成功')
this.$refs['maForm'].resetFields() this.$refs['maForm'].resetFields()
this.equipmentList = [] //
this.multipleSelection = [] this.clearAllStates()
this.delBusinessFileIdList = [] this.delBusinessFileIdList = []
loading.close() loading.close()
} catch (error) { } catch (error) {
@ -1127,4 +1426,33 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
//
.data-status-info {
font-size: 14px;
@media (max-width: 768px) {
flex-direction: column;
gap: 10px;
align-items: stretch !important;
}
strong {
font-weight: 600;
}
.el-button--text {
padding: 0;
margin-left: 15px;
&:hover {
color: #dc2626 !important;
}
}
.el-icon-info {
margin-right: 5px;
font-size: 16px;
}
}
</style> </style>

View File

@ -213,7 +213,7 @@
import { getSltInfo, submitFee,submitCosts } from '@/api/cost/cost' import { getSltInfo, submitFee,submitCosts } from '@/api/cost/cost'
export default { export default {
name: '', name: 'ApplyDetail',
dicts: [], dicts: [],
props: { props: {
row: { row: {

View File

@ -234,7 +234,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import printJS from 'print-js' import printJS from 'print-js'
export default { export default {
name: 'CostApplyList', name: 'ApplyHome',
dicts: ['cost_status'], dicts: ['cost_status'],
components: { Treeselect, vueEasyPrint }, components: { Treeselect, vueEasyPrint },
data() { data() {
@ -307,6 +307,15 @@ export default {
// this.GetProData() // this.GetProData()
this.getList() this.getList()
}, },
activated() {
// keep-alive
//
console.log('ApplyHome activated - 页面缓存激活')
},
deactivated() {
// keep-alive
console.log('ApplyHome deactivated - 页面缓存')
},
methods: { methods: {
/** 转换菜单数据结构 */ /** 转换菜单数据结构 */
normalizer(node) { normalizer(node) {
@ -387,6 +396,7 @@ export default {
pageSize: this.queryParams.pageSize, pageSize: this.queryParams.pageSize,
projectId: this.queryParams.projectId, projectId: this.queryParams.projectId,
sltStatus: this.queryParams.sltStatus, sltStatus: this.queryParams.sltStatus,
agreementCode: this.queryParams.agreementCode,
// ...this.queryParams, // ...this.queryParams,
unitIds: this.unitIds, unitIds: this.unitIds,

View File

@ -246,7 +246,7 @@ import vueEasyPrint from "vue-easy-print";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: 'CostApplyList', name: 'ExamHome',
dicts: ['cost_status'], dicts: ['cost_status'],
components: { Treeselect, vueEasyPrint }, components: { Treeselect, vueEasyPrint },
data() { data() {

View File

@ -138,12 +138,14 @@
:visible.sync="costDetailVisible" :visible.sync="costDetailVisible"
width="80%" width="80%"
top="5vh" top="5vh"
:close-on-click-modal="false"> :close-on-click-modal="false"
@closed="handleCostDetailDialogClosed">
<!-- 租赁费用详情表格 --> <!-- 租赁费用详情表格 -->
<el-table <el-table
v-if="costDetailType === 'lease'" v-if="costDetailType === 'lease'"
v-loading="costDetailLoading" v-loading="costDetailLoading"
:data="costDetailList" :data="costDetailList"
:key="'lease-table-' + costDetailType"
border border
stripe stripe
height="500"> height="500">
@ -155,7 +157,7 @@
<el-table-column label="数量" align="center" prop="quantity" width="80" /> <el-table-column label="数量" align="center" prop="quantity" width="80" />
<el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" /> <el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" />
<el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" /> <el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" />
<el-table-column label="退日期" align="center" prop="returnDate" width="120" /> <el-table-column label="退日期" align="center" prop="returnDate" width="120" />
<el-table-column label="天数" align="center" prop="days" width="80" /> <el-table-column label="天数" align="center" prop="days" width="80" />
<el-table-column label="费用(元)" align="center" prop="cost" width="100"> <el-table-column label="费用(元)" align="center" prop="cost" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@ -169,6 +171,7 @@
v-if="costDetailType === 'repair'" v-if="costDetailType === 'repair'"
v-loading="costDetailLoading" v-loading="costDetailLoading"
:data="costDetailList" :data="costDetailList"
:key="'repair-table-' + costDetailType"
border border
stripe stripe
height="500"> height="500">
@ -189,6 +192,7 @@
v-if="costDetailType === 'lose'" v-if="costDetailType === 'lose'"
v-loading="costDetailLoading" v-loading="costDetailLoading"
:data="costDetailList" :data="costDetailList"
:key="'lose-table-' + costDetailType"
border border
stripe stripe
height="500"> height="500">
@ -209,6 +213,7 @@
v-if="costDetailType === 'scrap'" v-if="costDetailType === 'scrap'"
v-loading="costDetailLoading" v-loading="costDetailLoading"
:data="costDetailList" :data="costDetailList"
:key="'scrap-table-' + costDetailType"
border border
stripe stripe
height="500"> height="500">
@ -229,6 +234,7 @@
v-if="costDetailType === 'total'" v-if="costDetailType === 'total'"
v-loading="costDetailLoading" v-loading="costDetailLoading"
:data="costDetailList" :data="costDetailList"
:key="'total-table-' + costDetailType"
border border
stripe stripe
height="500"> height="500">
@ -236,12 +242,40 @@
<el-table-column label="名称" align="center" prop="name" :show-overflow-tooltip="true" /> <el-table-column label="名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="型号" align="center" prop="model" :show-overflow-tooltip="true" /> <el-table-column label="型号" align="center" prop="model" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" prop="unit" width="80" /> <el-table-column label="单位" align="center" prop="unit" width="80" />
<el-table-column label="单价(元)" align="center" prop="unitPrice" width="100" /> <el-table-column label="单价(元)" align="center" width="100">
<el-table-column label="数量" align="center" prop="quantity" width="80" /> <template slot-scope="scope">
<el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" /> {{ scope.row.costType === 'lease' ? (scope.row.unitPrice || 0) : '-' }}
<el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" /> </template>
<el-table-column label="退换日期" align="center" prop="returnDate" width="120" /> </el-table-column>
<el-table-column label="天数" align="center" prop="days" width="80" /> <el-table-column label="数量" align="center" width="80">
<template slot-scope="scope">
<span v-if="scope.row.costType === 'lease'">{{ scope.row.quantity || 0 }}</span>
<span v-else-if="scope.row.costType === 'repair'">{{ scope.row.repairQuantity || 0 }}</span>
<span v-else-if="scope.row.costType === 'lose'">{{ scope.row.loseQuantity || 0 }}</span>
<span v-else-if="scope.row.costType === 'scrap'">{{ scope.row.scrapQuantity || 0 }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="归还数量" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.costType === 'lease' ? (scope.row.returnQuantity || 0) : '-' }}
</template>
</el-table-column>
<el-table-column label="租赁日期" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.costType === 'lease' ? (scope.row.leaseDate || '-') : '-' }}
</template>
</el-table-column>
<el-table-column label="退还日期" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.costType === 'lease' ? (scope.row.returnDate || '-') : '-' }}
</template>
</el-table-column>
<el-table-column label="天数" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.costType === 'lease' ? (scope.row.days || 0) : '-' }}
</template>
</el-table-column>
<el-table-column label="费用(元)" align="center" prop="cost" width="100"> <el-table-column label="费用(元)" align="center" prop="cost" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }} {{ scope.row.cost ? scope.row.cost.toFixed(2) : '0.00' }}
@ -278,7 +312,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
export default { export default {
name: 'CostApplyList', name: 'ReportHome',
dicts: ['cost_status'], dicts: ['cost_status'],
components: { Treeselect, vueEasyPrint }, components: { Treeselect, vueEasyPrint },
data() { data() {
@ -575,6 +609,7 @@ export default {
this.costDetailType = costType; this.costDetailType = costType;
this.costDetailVisible = true; this.costDetailVisible = true;
this.costDetailLoading = true; this.costDetailLoading = true;
//
this.costDetailList = []; this.costDetailList = [];
try { try {
@ -614,46 +649,68 @@ export default {
sourceList = []; sourceList = [];
} }
// //
this.costDetailList = sourceList.map(item => { const newDetailList = sourceList.map(item => {
//
const baseData = { const baseData = {
name: item.typeName || '', name: (item.typeName || '').toString(),
model: item.modelName || '', model: (item.modelName || '').toString(),
unit: item.mtUnitName || '', unit: (item.mtUnitName || '').toString(),
cost: item.costs || 0, cost: Number(item.costs || 0),
costType: item.costType || costType costType: (item.costType || costType).toString()
}; };
// //
if (costType === 'lease' || (costType === 'total' && item.costType === 'lease')) { if (costType === 'lease' || (costType === 'total' && item.costType === 'lease')) {
return { return {
...baseData, name: baseData.name,
unitPrice: item.leasePrice || 0, model: baseData.model,
quantity: item.num || 0, unit: baseData.unit,
returnQuantity: item.backNum || 0, cost: baseData.cost,
leaseDate: item.startTime || '', costType: baseData.costType,
returnDate: item.endTime || '', unitPrice: Number(item.leasePrice || 0),
days: item.leaseDays || 0 quantity: Number(item.num || 0),
returnQuantity: Number(item.backNum || 0),
leaseDate: (item.startTime || '').toString(),
returnDate: (item.endTime || '').toString(),
days: Number(item.leaseDays || 0)
}; };
} else if (costType === 'repair' || (costType === 'total' && item.costType === 'repair')) { } else if (costType === 'repair' || (costType === 'total' && item.costType === 'repair')) {
return { return {
...baseData, name: baseData.name,
repairQuantity: item.num || 0 model: baseData.model,
unit: baseData.unit,
cost: baseData.cost,
costType: baseData.costType,
repairQuantity: Number(item.num || 0)
}; };
} else if (costType === 'lose' || (costType === 'total' && item.costType === 'lose')) { } else if (costType === 'lose' || (costType === 'total' && item.costType === 'lose')) {
return { return {
...baseData, name: baseData.name,
loseQuantity: item.num || 0 model: baseData.model,
unit: baseData.unit,
cost: baseData.cost,
costType: baseData.costType,
loseQuantity: Number(item.num || 0)
}; };
} else if (costType === 'scrap' || (costType === 'total' && item.costType === 'scrap')) { } else if (costType === 'scrap' || (costType === 'total' && item.costType === 'scrap')) {
return { return {
...baseData, name: baseData.name,
scrapQuantity: item.num || 0 model: baseData.model,
unit: baseData.unit,
cost: baseData.cost,
costType: baseData.costType,
scrapQuantity: Number(item.num || 0)
}; };
} }
return baseData; return baseData;
}); });
// 使$nextTickDOM
this.$nextTick(() => {
this.costDetailList = newDetailList;
});
} else { } else {
this.$modal.msgError(response.msg || '获取费用详情失败'); this.$modal.msgError(response.msg || '获取费用详情失败');
} }
@ -665,6 +722,15 @@ export default {
} }
}, },
//
handleCostDetailDialogClosed() {
//
this.costDetailList = [];
this.costDetailType = '';
this.costDetailTitle = '';
this.costDetailLoading = false;
},
// Excel // Excel
exportCostDetail() { exportCostDetail() {
if (!this.costDetailList || this.costDetailList.length === 0) { if (!this.costDetailList || this.costDetailList.length === 0) {
@ -688,7 +754,7 @@ export default {
{ key: 'quantity', title: '数量' }, { key: 'quantity', title: '数量' },
{ key: 'returnQuantity', title: '归还数量' }, { key: 'returnQuantity', title: '归还数量' },
{ key: 'leaseDate', title: '租赁日期' }, { key: 'leaseDate', title: '租赁日期' },
{ key: 'returnDate', title: '退日期' }, { key: 'returnDate', title: '退日期' },
{ key: 'days', title: '天数' }, { key: 'days', title: '天数' },
{ key: 'cost', title: '费用(元)' } { key: 'cost', title: '费用(元)' }
]; ];
@ -737,7 +803,7 @@ export default {
{ key: 'quantity', title: '数量' }, { key: 'quantity', title: '数量' },
{ key: 'returnQuantity', title: '归还数量' }, { key: 'returnQuantity', title: '归还数量' },
{ key: 'leaseDate', title: '租赁日期' }, { key: 'leaseDate', title: '租赁日期' },
{ key: 'returnDate', title: '退日期' }, { key: 'returnDate', title: '退日期' },
{ key: 'days', title: '天数' }, { key: 'days', title: '天数' },
{ key: 'cost', title: '费用(元)' }, { key: 'cost', title: '费用(元)' },
{ key: 'costType', title: '费用类型' } { key: 'costType', title: '费用类型' }

View File

@ -141,7 +141,7 @@
<el-table-column label="数量" align="center" prop="quantity" width="80" /> <el-table-column label="数量" align="center" prop="quantity" width="80" />
<el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" /> <el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" />
<el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" /> <el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" />
<el-table-column label="退日期" align="center" prop="returnDate" width="120" /> <el-table-column label="退日期" align="center" prop="returnDate" width="120" />
<el-table-column label="天数" align="center" prop="days" width="80" /> <el-table-column label="天数" align="center" prop="days" width="80" />
<el-table-column label="费用(元)" align="center" prop="cost" width="100"> <el-table-column label="费用(元)" align="center" prop="cost" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@ -226,7 +226,7 @@
<el-table-column label="数量" align="center" prop="quantity" width="80" /> <el-table-column label="数量" align="center" prop="quantity" width="80" />
<el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" /> <el-table-column label="归还数量" align="center" prop="returnQuantity" width="100" />
<el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" /> <el-table-column label="租赁日期" align="center" prop="leaseDate" width="120" />
<el-table-column label="退日期" align="center" prop="returnDate" width="120" /> <el-table-column label="退日期" align="center" prop="returnDate" width="120" />
<el-table-column label="天数" align="center" prop="days" width="80" /> <el-table-column label="天数" align="center" prop="days" width="80" />
<el-table-column label="费用(元)" align="center" prop="cost" width="100"> <el-table-column label="费用(元)" align="center" prop="cost" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@ -264,7 +264,7 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
export default { export default {
name: 'CostApplyList', name: 'UnreportHome',
dicts: ['cost_status'], dicts: ['cost_status'],
components: { Treeselect, vueEasyPrint }, components: { Treeselect, vueEasyPrint },
data() { data() {
@ -720,7 +720,7 @@ export default {
{ key: 'quantity', title: '数量' }, { key: 'quantity', title: '数量' },
{ key: 'returnQuantity', title: '归还数量' }, { key: 'returnQuantity', title: '归还数量' },
{ key: 'leaseDate', title: '租赁日期' }, { key: 'leaseDate', title: '租赁日期' },
{ key: 'returnDate', title: '退日期' }, { key: 'returnDate', title: '退日期' },
{ key: 'days', title: '天数' }, { key: 'days', title: '天数' },
{ key: 'cost', title: '费用(元)' } { key: 'cost', title: '费用(元)' }
]; ];
@ -769,7 +769,7 @@ export default {
{ key: 'quantity', title: '数量' }, { key: 'quantity', title: '数量' },
{ key: 'returnQuantity', title: '归还数量' }, { key: 'returnQuantity', title: '归还数量' },
{ key: 'leaseDate', title: '租赁日期' }, { key: 'leaseDate', title: '租赁日期' },
{ key: 'returnDate', title: '退日期' }, { key: 'returnDate', title: '退日期' },
{ key: 'days', title: '天数' }, { key: 'days', title: '天数' },
{ key: 'cost', title: '费用(元)' }, { key: 'cost', title: '费用(元)' },
{ key: 'costType', title: '费用类型' } { key: 'costType', title: '费用类型' }

View File

@ -6,12 +6,14 @@
:pageContent="pageContent" :pageContent="pageContent"
@goBack="goBack" @goBack="goBack"
/> />
<keep-alive>
<component <component
:is="isShowComponent" :is="isShowComponent"
:row="rowData" :row="rowData"
@goDetail="goDetail" @goDetail="goDetail"
@goBackPage="goBack" @goBackPage="goBack"
/> />
</keep-alive>
</div> </div>
</template> </template>