问题修复
This commit is contained in:
parent
1a9c5c67c4
commit
ce6f27739d
|
|
@ -0,0 +1,243 @@
|
|||
<template>
|
||||
<div class="app-container" >
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item prop="projectIds">
|
||||
<treeselect
|
||||
v-model="queryParams.projectId"
|
||||
:options="proList" :normalizer="normalizer"
|
||||
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
|
||||
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
|
||||
placeholder="请选择结算工程" @select="proChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.startTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
placeholder="开始日期"
|
||||
style="width: 130px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>-</el-form-item>
|
||||
<el-form-item prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.endTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
placeholder="结束日期"
|
||||
style="width: 130px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" >重置</el-button>
|
||||
<el-button type="success" icon="el-icon-download" size="mini" @click="exportExcel" :disabled="tableList.length === 0">导出Excel</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="tableList" border stripe :max-height="650">
|
||||
<el-table-column label="序号" align="center" type="index" width="60">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工程名称" align="center" prop="agreementCode" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="投入" align="center" prop="buyPrice" />
|
||||
<el-table-column label="在用" align="center" prop="buyPrice" >
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.buyPrice ? scope.row.buyPrice.toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getProjectList,
|
||||
getAgreementInfoById,
|
||||
getUnitListFilterTeam,
|
||||
} from '@/api/back/index.js'
|
||||
import { getLostReportList } from '@/api/cost/cost'
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import * as XLSX from 'xlsx';
|
||||
|
||||
export default {
|
||||
name: 'LostReportHome',
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 工程数据
|
||||
proList: [],
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: null,
|
||||
dateRange: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initDefaultDateRange()
|
||||
this.GetProData()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 初始化默认日期范围(当月第一天到最后一天)
|
||||
initDefaultDateRange() {
|
||||
const now = new Date()
|
||||
const year = now.getFullYear()
|
||||
const month = now.getMonth()
|
||||
|
||||
// 当月第一天
|
||||
const firstDay = new Date(year, month, 1)
|
||||
const firstDayStr = this.formatDate(firstDay)
|
||||
|
||||
// 当月最后一天
|
||||
const lastDay = new Date(year, month + 1, 0)
|
||||
const lastDayStr = this.formatDate(lastDay)
|
||||
|
||||
this.queryParams.dateRange = [firstDayStr, lastDayStr]
|
||||
this.queryParams.startTime = firstDayStr
|
||||
this.queryParams.endTime = lastDayStr
|
||||
},
|
||||
|
||||
// 格式化日期为 yyyy-MM-dd 格式
|
||||
formatDate(date) {
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
},
|
||||
|
||||
// 处理日期范围变化
|
||||
handleDateRangeChange(dateRange) {
|
||||
if (dateRange && dateRange.length === 2) {
|
||||
this.queryParams.startTime = dateRange[0]
|
||||
this.queryParams.endTime = dateRange[1]
|
||||
} else {
|
||||
this.queryParams.startTime = null
|
||||
this.queryParams.endTime = null
|
||||
}
|
||||
},
|
||||
|
||||
/** 转换菜单数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.name,
|
||||
children: node.children,
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
// 获取 工程名称 列表数据
|
||||
async GetProData() {
|
||||
const params = {
|
||||
unitId: null,
|
||||
}
|
||||
const res = await getProjectList(params)
|
||||
this.proList = res.data;
|
||||
},
|
||||
|
||||
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
getLostReportList(this.queryParams).then((response) => {
|
||||
this.tableList = response.rows || []
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}).catch((error) => {
|
||||
console.error('获取丢失费用报表失败:', error)
|
||||
this.tableList = []
|
||||
this.total = 0
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: null,
|
||||
agreementCode: null,
|
||||
dateRange: null,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
}
|
||||
// 重新初始化默认日期范围
|
||||
this.initDefaultDateRange()
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
|
||||
// 导出Excel
|
||||
exportExcel() {
|
||||
if (!this.tableList || this.tableList.length === 0) {
|
||||
this.$modal.msgWarning('没有可导出的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
const formatTime = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
|
||||
};
|
||||
|
||||
const currentTime = formatTime(new Date());
|
||||
this.download(
|
||||
'/material/slt_agreement_info/exportLostList',
|
||||
{
|
||||
...this.queryParams,
|
||||
},
|
||||
`资产占有月度报表_${currentTime}.xlsx`
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.el-table .fixed-width .el-button--mini {
|
||||
width: 80px !important;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -229,8 +229,8 @@ export default {
|
|||
getList() {
|
||||
this.loading = true;
|
||||
getProtocolList(this.queryParams).then((response) => {
|
||||
this.protocolList = response.rows;
|
||||
this.total = response.total;
|
||||
this.protocolList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1095,8 +1095,8 @@ export default {
|
|||
const currentTime = formatTime(new Date())
|
||||
const params = {
|
||||
keyWord: this.queryParams.keyWord,
|
||||
startTime: this.queryParams.time && this.queryParams.time[0],
|
||||
endTime: this.queryParams.time && this.queryParams.time[1],
|
||||
startTime: this.queryParams.startTime,
|
||||
endTime: this.queryParams.endTime,
|
||||
pageSize: this.queryParams.pageSize,
|
||||
pageNum: this.queryParams.pageNum,
|
||||
hasSign: 1
|
||||
|
|
@ -1128,8 +1128,10 @@ export default {
|
|||
const currentTime = formatTime(new Date())
|
||||
const params = {
|
||||
keyWord: this.queryParams.keyWord,
|
||||
startTime: this.queryParams.time && this.queryParams.time[0],
|
||||
endTime: this.queryParams.time && this.queryParams.time[1],
|
||||
startTime: this.queryParams.startTime,
|
||||
endTime: this.queryParams.endTime,
|
||||
leaseUnitId: this.queryParams.leaseUnitId,
|
||||
leaseProjectId: this.queryParams.leaseProjectId,
|
||||
pageSize: this.queryParams.pageSize,
|
||||
pageNum: this.queryParams.pageNum,
|
||||
hasSign: 1
|
||||
|
|
|
|||
|
|
@ -97,6 +97,13 @@
|
|||
<span>{{ scope.row.partCost.toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否收费" align="center" prop="partType" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.partType == 1" effect="plain">收费</el-tag>
|
||||
<el-tag type="warning" v-if="scope.row.partType == 0" effect="plain">不收费</el-tag>
|
||||
<el-tag v-if="scope.row.partType == null" effect="plain">不收费</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用班组" align="center" prop="createBy" width="120px" :show-overflow-tooltip="true"/>
|
||||
</el-table>
|
||||
<pagination
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ export default {
|
|||
},
|
||||
handleExport() {
|
||||
try {
|
||||
let fileName = `修饰后入库_${formatTime(new Date())}.xLsx`
|
||||
let fileName = `修试后入库_${formatTime(new Date())}.xLsx`
|
||||
let url = '/material/repair_input_details/export'
|
||||
const params = { ...this.queryParams }
|
||||
console.log('🚀 ~ 导出 ~ params:', params)
|
||||
|
|
|
|||
Loading…
Reference in New Issue