Merge branch 'material-ui' of http://14.103.246.124:16000/bonus/bonus-ui into material-ui
This commit is contained in:
commit
d05c298682
|
|
@ -238,6 +238,24 @@ export function getScrapReportList(query) {
|
|||
})
|
||||
}
|
||||
|
||||
// 查询租赁费用区间报表列表
|
||||
export function getLeaseCostRangeReportList(query) {
|
||||
return request({
|
||||
url: '/material/slt_agreement_info/leasePeriodCostList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询租赁费用明细详情
|
||||
export function getLeaseCostDetails(query) {
|
||||
return request({
|
||||
url: '/material/slt_agreement_info/leasePeriodCostDetails',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export function submitFee(params){
|
|||
// 查询费用推送审核租赁列表
|
||||
export function getLeaseList(query) {
|
||||
return request({
|
||||
url: '/material/iws_cost_push/getLeaseCostsByAgreementIdAndMonth',
|
||||
url: '/material/slt_agreement_info/leasePeriodCostDetails',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
|
|
|||
|
|
@ -70,4 +70,13 @@ export function getInBoundForm(query) {
|
|||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 根据id查3级树
|
||||
export function getSelectPartListApi(query) {
|
||||
return request({
|
||||
url: '/material/part_lease/selectPartList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
@ -242,6 +242,51 @@ export const dynamicRoutes = [
|
|||
component: () => import('@/views/business-examine/reduction-apply/business-details.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
// 丢失费用报表
|
||||
{
|
||||
path: '/material/cost/lost-report',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['material:cost:lost-report'], // 权限字符
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'LostReport',
|
||||
meta: { title: '丢失费用报表', activeMenu: '/material/cost' },
|
||||
component: () => import('@/views/material/cost/lostReportList.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
// 维修费用报表
|
||||
{
|
||||
path: '/material/cost/repair-report',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['material:cost:repair-report'], // 权限字符
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'RepairReport',
|
||||
meta: { title: '维修费用报表', activeMenu: '/material/cost' },
|
||||
component: () => import('@/views/material/cost/repairReportList.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
// 报废费用报表
|
||||
{
|
||||
path: '/material/cost/scrap-report',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['material:cost:scrap-report'], // 权限字符
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'ScrapReport',
|
||||
meta: { title: '报废费用报表', activeMenu: '/material/cost' },
|
||||
component: () => import('@/views/material/cost/scrapReportList.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ export default {
|
|||
pageSize: 10,
|
||||
time: null, //申请时间
|
||||
keyWord: "",
|
||||
taskStatus: null, //状态
|
||||
taskStatus: '1', //状态
|
||||
},
|
||||
|
||||
dialogVisible: false, // 弹框显示
|
||||
|
|
@ -327,10 +327,8 @@ export default {
|
|||
const end = new Date()
|
||||
let start = new Date()
|
||||
start.setMonth(start.getMonth() - 1)
|
||||
this.queryParams.time = [this.format(end), this.format(end)]
|
||||
// 设置默认状态为第一个选项(未完成)
|
||||
// this.queryParams.taskStatus = '1'
|
||||
this.getList();
|
||||
this.queryParams.time = [this.format(start), this.format(end)]
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
format(date) {
|
||||
|
|
@ -384,7 +382,7 @@ export default {
|
|||
const end = new Date()
|
||||
let start = new Date()
|
||||
start.setMonth(start.getMonth() - 1)
|
||||
this.queryParams.time = [this.format(end), this.format(end)]
|
||||
this.queryParams.time = [this.format(start), this.format(end)]
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.keyWord = "";
|
||||
this.handleQuery();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,685 @@
|
|||
<template>
|
||||
<div class="app-container" id="leaseCostRangeReportList">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="查询时间范围" prop="dateRange">
|
||||
<el-date-picker
|
||||
v-model="queryParams.dateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 240px"
|
||||
@change="handleDateRangeChange">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="协议号" prop="agreementCode">
|
||||
<el-input v-model="queryParams.agreementCode" placeholder="请输入协议号" clearable style="width: 180px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结算状态" prop="settlementStatus">
|
||||
<el-select v-model="queryParams.settlementStatus" placeholder="请选择结算状态" clearable style="width: 160px">
|
||||
<el-option label="未结算" value="0"></el-option>
|
||||
<el-option label="已结算" value="1"></el-option>
|
||||
</el-select>
|
||||
</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>
|
||||
<el-table-column label="序号" align="center" type="index" width="60">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="协议号" align="center" prop="agreementCode" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="结算单位" align="center" prop="unitName" :show-overflow-tooltip="true" width="180"/>
|
||||
<el-table-column label="结算工程" align="center" prop="projectName" :show-overflow-tooltip="true" width="200"/>
|
||||
<el-table-column label="结算状态" align="center" prop="isSettled" width="90">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.isSettled === '1' ? 'success' : 'warning'">
|
||||
{{ scope.row.isSettled === '1' ? '已结算' : '未结算' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备类型数" align="center" prop="equipmentTypeCount" width="100"/>
|
||||
<el-table-column label="设备总数量" align="center" prop="totalEquipmentCount" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.totalEquipmentCount ? parseFloat(scope.row.totalEquipmentCount).toFixed(3) : '0.000' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总租赁天数" align="center" prop="totalLeaseDays" width="100"/>
|
||||
<el-table-column label="总租赁费用(元)" align="center" prop="totalLeaseCost" width="130">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.totalLeaseCost ? parseFloat(scope.row.totalLeaseCost).toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="日均租金(元)" align="center" prop="avgDailyRent" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.avgDailyRent ? parseFloat(scope.row.avgDailyRent).toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="查询开始日期" align="center" prop="queryStartDate" width="120"/>
|
||||
<el-table-column label="查询结束日期" align="center" prop="queryEndDate" width="120"/>
|
||||
<el-table-column label="最早租赁时间" align="center" prop="earliestLeaseTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.earliestLeaseTime || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最晚归还时间" align="center" prop="latestReturnTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.latestReturnTime || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结算时间" align="center" prop="settlementTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.settlementTime || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.remark || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="100" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleViewDetails(scope.row)">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<el-dialog
|
||||
title="租赁费用明细详情"
|
||||
:visible.sync="detailDialogVisible"
|
||||
width="90%"
|
||||
:close-on-click-modal="false">
|
||||
<div v-if="detailDialogVisible">
|
||||
<div class="detail-header">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<div class="detail-info">
|
||||
<span class="label">协议号:</span>
|
||||
<span class="value">{{ selectedRowData.agreementCode }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="detail-info">
|
||||
<span class="label">结算单位:</span>
|
||||
<span class="value">{{ selectedRowData.unitName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="detail-info">
|
||||
<span class="label">结算工程:</span>
|
||||
<span class="value">{{ selectedRowData.projectName }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div class="detail-operations">
|
||||
<el-button type="success" icon="el-icon-download" size="mini" @click="exportDetailExcel" :disabled="detailTableList.length === 0">导出明细Excel</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="detailLoading" :data="detailTableList" border stripe max-height="400">
|
||||
<el-table-column label="序号" align="center" type="index" width="60">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="机具规格" align="center" prop="modelName" :show-overflow-tooltip="true" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.modelName || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物资编码" align="center" prop="maCode" :show-overflow-tooltip="true" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.maCode || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="租赁数量" align="center" prop="num" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.num ? parseFloat(scope.row.num).toFixed(3) : '0.000' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" align="center" prop="mtUnitName" width="80"/>
|
||||
<el-table-column label="租赁单价(元)" align="center" prop="leasePrice" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.leasePrice ? parseFloat(scope.row.leasePrice).toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计算开始时间" align="center" prop="calcStartTime" width="120"/>
|
||||
<el-table-column label="计算结束时间" align="center" prop="calcEndTime" width="120"/>
|
||||
<el-table-column label="租赁天数" align="center" prop="leaseDays" width="100"/>
|
||||
<el-table-column label="租赁费用(元)" align="center" prop="leaseCost" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.leaseCost ? parseFloat(scope.row.leaseCost).toFixed(2) : '0.00' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结算状态" align="center" prop="isSettled" width="90">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.isSettled === '1' ? 'success' : 'warning'">
|
||||
{{ scope.row.isSettled === '1' ? '已结算' : '未结算' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结算时间" align="center" prop="settlementTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.settlementTime || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出场时间" align="center" prop="startTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.startTime || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="退场时间" align="center" prop="endTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.endTime || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.remark || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getProjectList,
|
||||
getUnitList,
|
||||
getAgreementInfoById,
|
||||
getUnitListFilterTeam,
|
||||
} from '@/api/back/index.js'
|
||||
import { getLeaseCostRangeReportList, getLeaseCostDetails } 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: 'LeaseCostRangeReportHome',
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
|
||||
// 单位数据
|
||||
unitList: [],
|
||||
// 工程数据
|
||||
proList: [],
|
||||
// 表格数据
|
||||
tableList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
unitId: null,
|
||||
projectId: null,
|
||||
agreementCode: null,
|
||||
isSettled: null,
|
||||
dateRange: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
},
|
||||
// 详情弹窗相关
|
||||
detailDialogVisible: false,
|
||||
detailLoading: false,
|
||||
|
||||
detailTableList: [],
|
||||
selectedRowData: {},
|
||||
detailQueryParams: {
|
||||
agreementId: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initDefaultDateRange()
|
||||
this.GetUnitData()
|
||||
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.startDate = firstDayStr
|
||||
this.queryParams.endDate = 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.startDate = dateRange[0]
|
||||
this.queryParams.endDate = dateRange[1]
|
||||
} else {
|
||||
this.queryParams.startDate = null
|
||||
this.queryParams.endDate = null
|
||||
}
|
||||
},
|
||||
|
||||
/** 转换菜单数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.name,
|
||||
children: node.children,
|
||||
};
|
||||
},
|
||||
|
||||
// 获取 来往单位 列表数据
|
||||
async GetUnitData() {
|
||||
const params = {}
|
||||
const res = await getUnitListFilterTeam(params)
|
||||
this.unitList = res.data;
|
||||
this.getAgreementInfo()
|
||||
},
|
||||
|
||||
unitChange(val){
|
||||
setTimeout(()=>{
|
||||
this.queryParams.projectId=null
|
||||
this.queryParams.agreementCode = null
|
||||
this.GetProData()
|
||||
},500)
|
||||
},
|
||||
|
||||
// 获取 工程名称 列表数据
|
||||
async GetProData() {
|
||||
const params = {
|
||||
unitId: this.queryParams.unitId,
|
||||
}
|
||||
const res = await getProjectList(params)
|
||||
this.proList = res.data;
|
||||
this.getAgreementInfo()
|
||||
},
|
||||
|
||||
proChange(val){
|
||||
setTimeout(()=>{
|
||||
this.GetUnitData()
|
||||
},500)
|
||||
},
|
||||
|
||||
// 获取 协议id
|
||||
async getAgreementInfo() {
|
||||
if (this.queryParams.unitId && this.queryParams.projectId) {
|
||||
const params = {
|
||||
unitId: this.queryParams.unitId,
|
||||
projectId: this.queryParams.projectId,
|
||||
}
|
||||
const res = await getAgreementInfoById(params)
|
||||
if (!(res.data && res.data.agreementId)) {
|
||||
this.$message.error('当前单位和工程无协议!')
|
||||
this.queryParams.unitId = null
|
||||
this.queryParams.projectId = null
|
||||
this.GetUnitData()
|
||||
this.GetProData()
|
||||
} else {
|
||||
this.queryParams.agreementCode = res.data.agreementCode
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
getLeaseCostRangeReportList(this.queryParams).then((response) => {
|
||||
this.tableList = response.rows || []
|
||||
this.loading = false
|
||||
}).catch((error) => {
|
||||
console.error('获取租赁费用区间报表失败:', error)
|
||||
this.tableList = []
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
unitId: null,
|
||||
projectId: null,
|
||||
agreementCode: null,
|
||||
isSettled: null,
|
||||
dateRange: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
}
|
||||
// 重新初始化默认日期范围
|
||||
this.initDefaultDateRange()
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
|
||||
// 导出Excel
|
||||
exportExcel() {
|
||||
if (!this.tableList || this.tableList.length === 0) {
|
||||
this.$modal.msgWarning('没有可导出的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// 定义Excel列配置
|
||||
const columns = [
|
||||
{ key: 'index', title: '序号' },
|
||||
{ key: 'agreementCode', title: '协议号' },
|
||||
{ key: 'unitName', title: '结算单位' },
|
||||
{ key: 'projectName', title: '结算工程' },
|
||||
{ key: 'isSettled', title: '结算状态' },
|
||||
{ key: 'equipmentTypeCount', title: '设备类型数' },
|
||||
{ key: 'totalEquipmentCount', title: '设备总数量' },
|
||||
{ key: 'totalLeaseDays', title: '总租赁天数' },
|
||||
{ key: 'totalLeaseCost', title: '总租赁费用(元)' },
|
||||
{ key: 'avgDailyRent', title: '日均租金(元)' },
|
||||
{ key: 'queryStartDate', title: '查询开始日期' },
|
||||
{ key: 'queryEndDate', title: '查询结束日期' },
|
||||
{ key: 'earliestLeaseTime', title: '最早租赁时间' },
|
||||
{ key: 'latestReturnTime', title: '最晚归还时间' },
|
||||
{ key: 'settlementTime', title: '结算时间' },
|
||||
{ key: 'remark', title: '备注' }
|
||||
];
|
||||
|
||||
// 准备Excel数据
|
||||
const excelData = [];
|
||||
|
||||
// 添加表头
|
||||
const headerRow = columns.map(col => col.title);
|
||||
excelData.push(headerRow);
|
||||
|
||||
// 添加数据行
|
||||
this.tableList.forEach((row, index) => {
|
||||
const dataRow = columns.map(col => {
|
||||
if (col.key === 'index') {
|
||||
return index + 1;
|
||||
} else if (col.key === 'isSettled') {
|
||||
return row.isSettled === '1' ? '已结算' : '未结算';
|
||||
} else if (col.key === 'totalEquipmentCount') {
|
||||
return row.totalEquipmentCount ? parseFloat(row.totalEquipmentCount).toFixed(3) : '0.000';
|
||||
} else if (col.key === 'totalLeaseCost' || col.key === 'avgDailyRent') {
|
||||
return row[col.key] ? parseFloat(row[col.key]).toFixed(2) : '0.00';
|
||||
} else {
|
||||
return row[col.key] || '';
|
||||
}
|
||||
});
|
||||
excelData.push(dataRow);
|
||||
});
|
||||
|
||||
// 创建工作簿和工作表
|
||||
const workbook = XLSX.utils.book_new();
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(excelData);
|
||||
|
||||
// 设置列宽
|
||||
const columnWidths = [
|
||||
{ wch: 8 }, // 序号
|
||||
{ wch: 18 }, // 协议号啊
|
||||
{ wch: 20 }, // 结算单位
|
||||
{ wch: 25 }, // 结算工程
|
||||
{ wch: 10 }, // 结算状态
|
||||
{ wch: 12 }, // 设备类型数
|
||||
{ wch: 12 }, // 设备总数量
|
||||
{ wch: 12 }, // 总租赁天数
|
||||
{ wch: 15 }, // 总租赁费用
|
||||
{ wch: 15 }, // 日均租金
|
||||
{ wch: 15 }, // 查询开始日期
|
||||
{ wch: 15 }, // 查询结束日期
|
||||
{ wch: 15 }, // 最早租赁时间
|
||||
{ wch: 15 }, // 最晚归还时间
|
||||
{ wch: 12 }, // 结算时间
|
||||
{ wch: 20 } // 备注
|
||||
];
|
||||
worksheet['!cols'] = columnWidths;
|
||||
|
||||
// 添加工作表到工作簿
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, '租赁费用区间报表');
|
||||
|
||||
// 生成文件名(包含日期范围)
|
||||
let fileName = '租赁费用区间报表';
|
||||
if (this.queryParams.startDate && this.queryParams.endDate) {
|
||||
fileName += `_${this.queryParams.startDate}_至_${this.queryParams.endDate}`;
|
||||
}
|
||||
fileName += `_${new Date().toISOString().slice(0, 10)}.xlsx`;
|
||||
|
||||
// 生成Excel文件并下载
|
||||
const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
||||
const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
|
||||
// 创建下载链接
|
||||
const link = document.createElement('a');
|
||||
const url = URL.createObjectURL(blob);
|
||||
link.setAttribute('href', url);
|
||||
link.setAttribute('download', fileName);
|
||||
link.style.visibility = 'hidden';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
// 清理URL对象
|
||||
URL.revokeObjectURL(url);
|
||||
|
||||
this.$modal.msgSuccess('Excel导出成功');
|
||||
} catch (error) {
|
||||
console.error('导出Excel失败:', error);
|
||||
this.$modal.msgError('导出Excel失败,请稍后重试');
|
||||
}
|
||||
},
|
||||
|
||||
/** 查看详情 */
|
||||
handleViewDetails(row) {
|
||||
this.selectedRowData = row
|
||||
this.detailQueryParams = {
|
||||
agreementId: row.agreementId,
|
||||
startDate: this.queryParams.startDate,
|
||||
endDate: this.queryParams.endDate,
|
||||
}
|
||||
this.detailDialogVisible = true
|
||||
this.getDetailList()
|
||||
},
|
||||
|
||||
/** 获取详情列表 */
|
||||
getDetailList() {
|
||||
this.detailLoading = true
|
||||
getLeaseCostDetails(this.detailQueryParams).then((response) => {
|
||||
this.detailTableList = response.rows || []
|
||||
this.detailLoading = false
|
||||
}).catch((error) => {
|
||||
console.error('获取租赁费用明细失败:', error)
|
||||
this.detailTableList = []
|
||||
this.detailLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 导出详情Excel */
|
||||
exportDetailExcel() {
|
||||
if (!this.detailTableList || this.detailTableList.length === 0) {
|
||||
this.$modal.msgWarning('没有可导出的详情数据');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// 定义详情Excel列配置
|
||||
const columns = [
|
||||
{ key: 'index', title: '序号' },
|
||||
{ key: 'agreementCode', title: '协议号' },
|
||||
{ key: 'typeName', title: '机具名称' },
|
||||
{ key: 'modelName', title: '机具规格' },
|
||||
{ key: 'maCode', title: '物资编码' },
|
||||
{ key: 'num', title: '租赁数量' },
|
||||
{ key: 'mtUnitName', title: '单位' },
|
||||
{ key: 'leasePrice', title: '租赁单价(元)' },
|
||||
{ key: 'calcStartTime', title: '计算开始时间' },
|
||||
{ key: 'calcEndTime', title: '计算结束时间' },
|
||||
{ key: 'leaseDays', title: '租赁天数' },
|
||||
{ key: 'leaseCost', title: '租赁费用(元)' },
|
||||
{ key: 'isSettled', title: '结算状态' },
|
||||
{ key: 'settlementTime', title: '结算时间' },
|
||||
{ key: 'startTime', title: '出场时间' },
|
||||
{ key: 'endTime', title: '退场时间' },
|
||||
{ key: 'remark', title: '备注' }
|
||||
];
|
||||
|
||||
// 准备Excel数据
|
||||
const excelData = [];
|
||||
|
||||
// 添加表头
|
||||
const headerRow = columns.map(col => col.title);
|
||||
excelData.push(headerRow);
|
||||
|
||||
// 添加数据行
|
||||
this.detailTableList.forEach((row, index) => {
|
||||
const dataRow = columns.map(col => {
|
||||
if (col.key === 'index') {
|
||||
return index + 1;
|
||||
} else if (col.key === 'isSettled') {
|
||||
return row.isSettled === '1' ? '已结算' : '未结算';
|
||||
} else if (col.key === 'num') {
|
||||
return row.num ? parseFloat(row.num).toFixed(3) : '0.000';
|
||||
} else if (col.key === 'leasePrice' || col.key === 'leaseCost') {
|
||||
return row[col.key] ? parseFloat(row[col.key]).toFixed(2) : '0.00';
|
||||
} else {
|
||||
return row[col.key] || '';
|
||||
}
|
||||
});
|
||||
excelData.push(dataRow);
|
||||
});
|
||||
|
||||
// 创建工作簿和工作表
|
||||
const workbook = XLSX.utils.book_new();
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(excelData);
|
||||
|
||||
// 设置列宽
|
||||
const columnWidths = [
|
||||
{ wch: 8 }, // 序号
|
||||
{ wch: 18 }, // 协议号
|
||||
{ wch: 20 }, // 机具名称
|
||||
{ wch: 15 }, // 机具规格
|
||||
{ wch: 15 }, // 物资编码
|
||||
{ wch: 12 }, // 租赁数量
|
||||
{ wch: 8 }, // 单位
|
||||
{ wch: 15 }, // 租赁单价
|
||||
{ wch: 15 }, // 计算开始时间
|
||||
{ wch: 15 }, // 计算结束时间
|
||||
{ wch: 10 }, // 租赁天数
|
||||
{ wch: 15 }, // 租赁费用
|
||||
{ wch: 10 }, // 结算状态
|
||||
{ wch: 15 }, // 结算时间
|
||||
{ wch: 15 }, // 出场时间
|
||||
{ wch: 15 }, // 退场时间
|
||||
{ wch: 20 } // 备注
|
||||
];
|
||||
worksheet['!cols'] = columnWidths;
|
||||
|
||||
// 添加工作表到工作簿
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, '租赁费用明细');
|
||||
|
||||
// 生成文件名
|
||||
let fileName = `租赁费用明细_${this.selectedRowData.agreementCode}`;
|
||||
if (this.detailQueryParams.startDate && this.detailQueryParams.endDate) {
|
||||
fileName += `_${this.detailQueryParams.startDate}_至_${this.detailQueryParams.endDate}`;
|
||||
}
|
||||
fileName += `_${new Date().toISOString().slice(0, 10)}.xlsx`;
|
||||
|
||||
// 生成Excel文件并下载
|
||||
const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
||||
const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
|
||||
// 创建下载链接
|
||||
const link = document.createElement('a');
|
||||
const url = URL.createObjectURL(blob);
|
||||
link.setAttribute('href', url);
|
||||
link.setAttribute('download', fileName);
|
||||
link.style.visibility = 'hidden';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
// 清理URL对象
|
||||
URL.revokeObjectURL(url);
|
||||
|
||||
this.$modal.msgSuccess('详情Excel导出成功');
|
||||
} catch (error) {
|
||||
console.error('导出详情Excel失败:', error);
|
||||
this.$modal.msgError('导出详情Excel失败,请稍后重试');
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.el-table .fixed-width .el-button--mini {
|
||||
width: 80px !important;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
background-color: #f5f7fa;
|
||||
padding: 15px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 15px;
|
||||
|
||||
.detail-info {
|
||||
margin-bottom: 10px;
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: #303133;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail-operations {
|
||||
margin-bottom: 15px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -285,9 +285,9 @@ export default {
|
|||
{ key: 'modelName', title: '规格型号' },
|
||||
{ key: 'mtUnitName', title: '单位' },
|
||||
{ key: 'num', title: '维修数量' },
|
||||
{ key: 'cost', title: '维修费用(元)' },
|
||||
{ key: 'repairDate', title: '维修日期' },
|
||||
{ key: 'createTime', title: '创建时间' },
|
||||
{ key: 'costs', title: '维修费用(元)' },
|
||||
{ key: 'repairType', title: '维修方式' },
|
||||
{ key: 'partType', title: '费用类型' },
|
||||
{ key: 'remark', title: '备注' }
|
||||
];
|
||||
|
||||
|
|
@ -303,9 +303,9 @@ export default {
|
|||
const dataRow = columns.map(col => {
|
||||
if (col.key === 'index') {
|
||||
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1;
|
||||
} else if (col.key === 'cost') {
|
||||
} else if (col.key === 'costs') {
|
||||
// 处理费用字段格式
|
||||
return row.cost ? parseFloat(row.cost.toFixed(2)) : 0.00;
|
||||
return row.costs ? parseFloat(row.costs.toFixed(2)) : 0.00;
|
||||
} else {
|
||||
return row[col.key] || '';
|
||||
}
|
||||
|
|
@ -328,8 +328,8 @@ export default {
|
|||
{ wch: 8 }, // 单位
|
||||
{ wch: 10 }, // 维修数量
|
||||
{ wch: 15 }, // 维修费用
|
||||
{ wch: 12 }, // 维修日期
|
||||
{ wch: 15 }, // 创建时间
|
||||
{ wch: 12 }, // 维修方式
|
||||
{ wch: 12 }, // 费用类型
|
||||
{ wch: 20 } // 备注
|
||||
];
|
||||
worksheet['!cols'] = columnWidths;
|
||||
|
|
|
|||
|
|
@ -284,8 +284,6 @@ export default {
|
|||
{ key: 'mtUnitName', title: '单位' },
|
||||
{ key: 'num', title: '报废数量' },
|
||||
{ key: 'cost', title: '报废费用(元)' },
|
||||
{ key: 'scrapDate', title: '报废日期' },
|
||||
{ key: 'createTime', title: '创建时间' },
|
||||
{ key: 'remark', title: '备注' }
|
||||
];
|
||||
|
||||
|
|
@ -326,8 +324,6 @@ export default {
|
|||
{ wch: 8 }, // 单位
|
||||
{ wch: 10 }, // 报废数量
|
||||
{ wch: 15 }, // 报废费用
|
||||
{ wch: 12 }, // 报废日期
|
||||
{ wch: 15 }, // 创建时间
|
||||
{ wch: 20 } // 备注
|
||||
];
|
||||
worksheet['!cols'] = columnWidths;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<LeaseCostRangeReportHome />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LeaseCostRangeReportHome from './component/leaseCostRangeReportHome.vue'
|
||||
|
||||
export default {
|
||||
name: 'LeaseCostRangeReportList',
|
||||
components: {
|
||||
LeaseCostRangeReportHome
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -111,13 +111,19 @@
|
|||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="费用所属" align="center" prop="settlementType" width="100" >
|
||||
<template slot-scope="scope" >
|
||||
<el-tag v-if="scope.row.settlementType == 1" type="primary" size="small">工器具</el-tag>
|
||||
<el-tag v-if="scope.row.settlementType == 2" type="warning" size="small">安全用品</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="租赁费用" align="center" prop="leaseMoney" >
|
||||
<template slot-scope="scope" >
|
||||
<span class="clickText" v-if="scope.row.leaseMoney!=null && scope.$index!=pushReviewList.length-1" @click="openLease(scope.row)">
|
||||
{{scope.row.leaseMoney}}
|
||||
</span>
|
||||
<span v-if="scope.row.leaseMoney!=null && scope.$index==pushReviewList.length-1" >
|
||||
{{scope.row.leaseMoney}}
|
||||
{{Number(scope.row.leaseMoney).toFixed(3)}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -127,7 +133,7 @@
|
|||
{{scope.row.repairMoney}}
|
||||
</span>
|
||||
<span v-if="scope.row.repairMoney!=null && scope.$index==pushReviewList.length-1" >
|
||||
{{scope.row.repairMoney}}
|
||||
{{Number(scope.row.repairMoney).toFixed(3)}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -137,7 +143,7 @@
|
|||
{{scope.row.scrapMoney}}
|
||||
</span>
|
||||
<span v-if="scope.row.scrapMoney!=null && scope.$index==pushReviewList.length-1" >
|
||||
{{scope.row.scrapMoney}}
|
||||
{{Number(scope.row.scrapMoney).toFixed(3)}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -147,13 +153,16 @@
|
|||
{{scope.row.lostMoney}}
|
||||
</span>
|
||||
<span v-if="scope.row.lostMoney!=null && scope.$index==pushReviewList.length-1" >
|
||||
{{scope.row.lostMoney}}
|
||||
{{Number(scope.row.lostMoney).toFixed(3)}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合计费用" align="center" prop="money" show-overflow-tooltip >
|
||||
<template slot-scope="scope" >
|
||||
<span v-if="scope.row.money!=null" >
|
||||
<span v-if="scope.row.money!=null && scope.$index==pushReviewList.length-1" >
|
||||
{{Number(scope.row.money).toFixed(3)}}
|
||||
</span>
|
||||
<span v-if="scope.row.money!=null && scope.$index!=pushReviewList.length-1" >
|
||||
{{scope.row.money}}
|
||||
</span>
|
||||
</template>
|
||||
|
|
@ -184,7 +193,7 @@
|
|||
</div> -->
|
||||
|
||||
<!-- 租赁费用弹窗-->
|
||||
<el-dialog :title="title" :visible.sync="showLease" width="1200px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="showLease" width="1300px" append-to-body>
|
||||
<el-form :model="dialogLease" ref="dialogLease" size="small" :inline="true" label-width="80px">
|
||||
<el-form-item label="物资名称" prop="typeName">
|
||||
<el-input
|
||||
|
|
@ -220,15 +229,22 @@
|
|||
<el-table-column label="序号" align="center" width="80" type="index" />
|
||||
<el-table-column label="物资名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="计量单位" align="center" prop="mtUnitName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="租赁单价" align="center" prop="leasePrice" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="租赁数量" align="center" prop="leaseNum" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="租赁日期" align="center" prop="leaseDate" width="170px"/>
|
||||
<el-table-column label="归还日期" align="center" prop="backDate" width="170px"/>
|
||||
<el-table-column label="租赁天数" align="center" prop="leaseDays" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="租赁费用" align="center" width="126px" prop="leaseMoney" :show-overflow-tooltip="true">
|
||||
<el-table-column label="租赁数量" align="center" prop="num" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="计算开始时间" align="center" prop="calcStartTime" width="120px"/>
|
||||
<el-table-column label="计算结束时间" align="center" prop="calcEndTime" width="120px"/>
|
||||
<el-table-column label="实际开始时间" align="center" prop="startTime" width="120px"/>
|
||||
<el-table-column label="实际结束时间" align="center" prop="endTime" width="120px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.leaseMoney.toFixed(2) }}
|
||||
<span v-if="scope.row.endTime">{{ scope.row.endTime }}</span>
|
||||
<span v-else style="color: #909399;">未归还</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="租赁天数" align="center" prop="leaseDays" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="租赁费用" align="center" width="126px" prop="leaseCost" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.leaseCost.toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -492,6 +508,7 @@ export default {
|
|||
},
|
||||
dialogLeaseTotal: 0,
|
||||
leaseAllMoney: 0,
|
||||
currentLeaseRow: null, // 当前租赁费用行数据
|
||||
|
||||
//维修费用弹窗
|
||||
showRepair: false,
|
||||
|
|
@ -630,6 +647,13 @@ export default {
|
|||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 重置合计变量,避免重复累加
|
||||
this.leaseAll = 0;
|
||||
this.repairAll = 0;
|
||||
this.scrapAll = 0;
|
||||
this.loseAll = 0;
|
||||
this.moneyAll = 0;
|
||||
|
||||
console.log(this.queryParams.month)
|
||||
getPushReviewList(this.queryParams).then((response) => {
|
||||
this.pushReviewList = response.rows;
|
||||
|
|
@ -653,12 +677,17 @@ export default {
|
|||
this.pushReviewList.push(obj)
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
// 重置合计变量
|
||||
this.leaseAll = 0;
|
||||
this.repairAll = 0;
|
||||
this.scrapAll = 0;
|
||||
this.loseAll = 0;
|
||||
this.moneyAll = 0;
|
||||
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
|
|
@ -702,13 +731,26 @@ export default {
|
|||
this.dialogLease.typeName = ""
|
||||
this.dialogLease.modelName = ""
|
||||
this.dialogLease.id = row.id;
|
||||
this.currentLeaseRow = row; // 保存当前行数据
|
||||
this.getLeaseList(row)
|
||||
},
|
||||
//查询租赁费用
|
||||
getLeaseList(row) {
|
||||
this.loading = true;
|
||||
|
||||
// 根据选择的月份计算开始日期和结束日期
|
||||
const selectedMonth = this.queryParams.month; // 格式: "2024-08"
|
||||
const startDate = selectedMonth + '-01'; // 月份第一天
|
||||
|
||||
// 计算月份最后一天
|
||||
const year = parseInt(selectedMonth.split('-')[0]);
|
||||
const month = parseInt(selectedMonth.split('-')[1]);
|
||||
const endDate = new Date(year, month, 0).toISOString().split('T')[0]; // 当月最后一天
|
||||
|
||||
let params = {
|
||||
month: this.queryParams.month,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
agreementId: row.agreementId,
|
||||
typeName: this.dialogLease.typeName,
|
||||
modelName: this.dialogLease.modelName,
|
||||
|
|
@ -717,14 +759,14 @@ export default {
|
|||
this.dialogLeaseList = response.rows;
|
||||
this.leaseAllMoney = 0;
|
||||
this.dialogLeaseList.forEach(item => {
|
||||
this.leaseAllMoney += Number(item.leaseMoney);
|
||||
this.leaseAllMoney += Number(item.leaseCost);
|
||||
})
|
||||
this.dialogLeaseTotal = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleQueryLease() {
|
||||
this.getLeaseList()
|
||||
this.getLeaseList(this.currentLeaseRow)
|
||||
},
|
||||
//导出租赁费用
|
||||
handleExportLease() {
|
||||
|
|
@ -875,13 +917,13 @@ export default {
|
|||
objectSpanMethod ({ row, column, rowIndex, columnIndex }) {
|
||||
if (rowIndex === this.pushReviewList.length-1 && columnIndex == 1) {
|
||||
let rowspan = 2
|
||||
let colspan = 6
|
||||
let colspan = 7 // 增加了结算类型列,所以从6改为7
|
||||
return { rowspan, colspan }
|
||||
}
|
||||
// 解决偏移的重要代码
|
||||
// 重点在 else if 判断必须加因为合并单元格数据会出现偏移、
|
||||
// 否则如果是 第二行 的 第二列 那么隐藏原有第二行 的 第二列的数据使他隐藏
|
||||
else if (rowIndex === this.pushReviewList.length-1 && columnIndex < 6) {
|
||||
else if (rowIndex === this.pushReviewList.length-1 && columnIndex < 7) { // 从6改为7
|
||||
return {
|
||||
rowspan: 0,
|
||||
colspan: 0
|
||||
|
|
|
|||
|
|
@ -620,6 +620,7 @@ export default {
|
|||
this.isView = true
|
||||
this.confirmForm2.id = row.id
|
||||
this.confirmForm2.keyWord = ''
|
||||
this.confirmForm2.publishTask = row.publishTask || ''
|
||||
this.getConfirmList()
|
||||
this.confirmVisible = true
|
||||
},
|
||||
|
|
@ -645,6 +646,7 @@ export default {
|
|||
this.isView = false
|
||||
this.confirmForm2.id = row.id
|
||||
this.confirmForm2.keyWord = ''
|
||||
this.confirmForm2.publishTask = row.publishTask || ''
|
||||
this.getConfirmList()
|
||||
this.confirmVisible = true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -599,6 +599,7 @@ export default {
|
|||
this.isView = true
|
||||
this.confirmForm2.id = row.id
|
||||
this.confirmForm2.keyWord = ''
|
||||
this.confirmForm2.publishTask = row.publishTask || ''
|
||||
this.getConfirmList()
|
||||
this.confirmVisible = true
|
||||
},
|
||||
|
|
@ -624,6 +625,7 @@ export default {
|
|||
this.isView = false
|
||||
this.confirmForm2.id = row.id
|
||||
this.confirmForm2.keyWord = ''
|
||||
this.confirmForm2.publishTask = row.publishTask || ''
|
||||
this.getConfirmList()
|
||||
this.confirmVisible = true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -56,23 +56,40 @@
|
|||
<span>%</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="类型规格" prop="deviceType">
|
||||
<el-form-item label="类型名称" prop="deviceType">
|
||||
<el-cascader
|
||||
:key="propsKey"
|
||||
v-model="deviceType"
|
||||
:show-all-levels="false"
|
||||
:options="equipmentTypeList"
|
||||
:props="deviceTypeTreeProps"
|
||||
filterable
|
||||
clearable
|
||||
collapse-tags
|
||||
style="width: 240px"
|
||||
placeholder="请选择规格型号"
|
||||
placeholder="请选择类型名称"
|
||||
ref="deviceTypeCascader"
|
||||
popper-class="popper-select"
|
||||
@change="deviceTypeChange"
|
||||
@change="deviceTypeChange2"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="规格型号" prop="maType">
|
||||
<el-select
|
||||
v-model="maForm.maType"
|
||||
placeholder="请选择规格型号"
|
||||
filterable
|
||||
style="width: 240px"
|
||||
@change="maTypeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in maTypeList"
|
||||
:key="item.id"
|
||||
:label="item.paName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="maForm.remark"
|
||||
|
|
@ -124,7 +141,7 @@
|
|||
<el-input
|
||||
v-model.number="scope.row.purchaseNum"
|
||||
controls-position="right" type="number"
|
||||
style="width: 100%" :disabled="scope.row.status!=0"
|
||||
style="width: 100%"
|
||||
:min="0"
|
||||
></el-input>
|
||||
</template>
|
||||
|
|
@ -139,7 +156,7 @@
|
|||
v-model="scope.row.purchaseTaxPrice"
|
||||
controls-position="right"
|
||||
style="width: 100%" @blur="scope.row.purchaseTaxPrice = scope.row.purchaseTaxPrice>0? scope.row.purchaseTaxPrice:0"
|
||||
:min="0" :step="1" :disabled="scope.row.status!=0"
|
||||
:min="0" :step="1"
|
||||
@change="purchaseTaxPriceChange(scope.row,scope.$index)"
|
||||
></el-input-number>
|
||||
</template>
|
||||
|
|
@ -170,7 +187,7 @@
|
|||
v-model="scope.row.productionTime"
|
||||
style="width: 100%"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="date" :disabled="scope.row.status!=0"
|
||||
type="date"
|
||||
placeholder="出厂日期"
|
||||
clearable
|
||||
></el-date-picker>
|
||||
|
|
@ -281,7 +298,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getTypeTree,addPartInfo,getPartTypeCheckInfo,updatePartInfo,getPartTypeFileList } from '@/api/part/partArrived';
|
||||
import { getTypeTree,addPartInfo,getPartTypeCheckInfo,updatePartInfo,getPartTypeFileList, getSelectPartListApi } from '@/api/part/partArrived';
|
||||
import { getListFacturer } from '@/api/ma/supplier';
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
|
|
@ -371,7 +388,9 @@ export default {
|
|||
purchaser: '',
|
||||
remark: '',
|
||||
purchaseNumber: '',
|
||||
maType: null
|
||||
},
|
||||
maTypeList: [],
|
||||
// 表单参数
|
||||
form: {},
|
||||
defaultProps: {
|
||||
|
|
@ -403,7 +422,7 @@ export default {
|
|||
label: 'partName',
|
||||
// multiple: false,
|
||||
value: 'partId',
|
||||
multiple: true,
|
||||
multiple: false,
|
||||
},
|
||||
deviceType: [],
|
||||
propsKey: 1000,
|
||||
|
|
@ -478,16 +497,17 @@ export default {
|
|||
this.equipmentTypeList.forEach((item, index) => {
|
||||
if (item.children && item.children.length > 0) {
|
||||
item.children.forEach((item2, index2) => {
|
||||
if (item2.children && item2.children.length > 0) {
|
||||
item2.children.forEach((item3) => {
|
||||
item2.children.forEach((item3) => {
|
||||
item3.maTypeName = item2.partName
|
||||
item3.specificationType = item3.partName
|
||||
this.$set(item3, 'purchaseTaxPrice', 0)
|
||||
this.$set(item3, 'purchasePrice', 0)
|
||||
})
|
||||
})
|
||||
}
|
||||
delete item2.children
|
||||
// if (item2.children && item2.children.length > 0) {
|
||||
// item2.children.forEach((item3) => {
|
||||
// item2.children.forEach((item3) => {
|
||||
// item3.maTypeName = item2.partName
|
||||
// item3.specificationType = item3.partName
|
||||
// this.$set(item3, 'purchaseTaxPrice', 0)
|
||||
// this.$set(item3, 'purchasePrice', 0)
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
@ -572,6 +592,55 @@ export default {
|
|||
this.equipmentList = []
|
||||
}
|
||||
},
|
||||
deviceTypeChange2(val) {
|
||||
console.log('🚀 ~ deviceTypeChange2 ~ val:', val)
|
||||
this.maTypeList = []
|
||||
this.maForm.maType = ''
|
||||
if (val.length > 0) {
|
||||
this.getMaTypeList(val[1])
|
||||
}
|
||||
},
|
||||
async getMaTypeList(id) {
|
||||
try {
|
||||
const res = await getSelectPartListApi({ id: id })
|
||||
console.log('🚀 ~ getMaTypeList ~ res:', res)
|
||||
this.maTypeList = res.data
|
||||
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ getMaTypeList ~ error:', error)
|
||||
}
|
||||
},
|
||||
maTypeChange (val) {
|
||||
console.log('🚀 ~ maTypeChange ~ val:', this.maForm.maType)
|
||||
if (val) {
|
||||
const obj = this.maTypeList.find(item => item.id === val)
|
||||
console.log('🚀 ~ maTypeChange ~ obj:', obj)
|
||||
// 如果 当前 id 在this.equipmentList 已有 则提示 已添加并阻断
|
||||
const isExist = this.equipmentList.find(item => item.id === obj.id || item.partId == obj.id)
|
||||
console.log('🚀 ~ maTypeChange ~ isExist:', isExist)
|
||||
if (isExist) {
|
||||
this.$message({
|
||||
message: `当前配件 ${obj.paName} 已添加`,
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
} else {
|
||||
this.equipmentList.push({
|
||||
...obj,
|
||||
maTypeName: obj.partName,
|
||||
partId: obj.id,
|
||||
partName: obj.paName,
|
||||
createTime: null,
|
||||
productionTime: this.maForm.productionTime,
|
||||
purchaseTaxPrice: 0,
|
||||
purchaseNum: 0,
|
||||
status: 0,
|
||||
isExitFile: '1',
|
||||
bmFileInfo:[]
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
//选择出厂日期
|
||||
productionTimeChange(val){
|
||||
this.equipmentList.forEach(item=>{
|
||||
|
|
@ -613,12 +682,12 @@ export default {
|
|||
this.$refs['maForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.maForm.taskId = this.taskId;
|
||||
let index =this.equipmentList.findIndex(item=>item.purchaseNum==0)
|
||||
let index2 =this.equipmentList.findIndex(item=>item.purchaseTaxPrice==0)
|
||||
let index =this.equipmentList.findIndex(item=>item.purchaseNum == 0 || !item.purchaseNum)
|
||||
let index2 =this.equipmentList.findIndex(item=>item.purchaseTaxPrice == 0 || !item.purchaseTaxPrice)
|
||||
if(index>-1){
|
||||
this.$modal.msgError('采购数量不能为0!')
|
||||
this.$modal.msgError(`第${index + 1}行采购数量不能为0!`)
|
||||
}else if(index2>-1){
|
||||
this.$modal.msgError('含税单价不能为0!')
|
||||
this.$modal.msgError(`第${index2 + 1}行采购含税价格不能为0!`)
|
||||
}else {
|
||||
this.$modal.confirm('是否确认保存当前页面').then(function () {})
|
||||
.then(() => {
|
||||
|
|
@ -635,7 +704,7 @@ export default {
|
|||
)
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
}).catch(() => { this.loading = false })
|
||||
} else if (!this.isEdit) {
|
||||
console.log('新增')
|
||||
// console.log(this.equipmentList)
|
||||
|
|
@ -650,7 +719,7 @@ export default {
|
|||
)
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
}).catch(() => { this.loading = false })
|
||||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
|
@ -913,12 +982,12 @@ export default {
|
|||
this.$modal
|
||||
.confirm('是否确认删除所选择的数据项?')
|
||||
.then(() => {
|
||||
this.deviceType.forEach((e, index) => {
|
||||
if (e[2] === row.partId) {
|
||||
this.deviceType.splice(index, 1)
|
||||
this.propsKey++
|
||||
}
|
||||
})
|
||||
// this.deviceType.forEach((e, index) => {
|
||||
// if (e[2] === row.partId) {
|
||||
// this.deviceType.splice(index, 1)
|
||||
// this.propsKey++
|
||||
// }
|
||||
// })
|
||||
this.equipmentList.forEach((item, index) => {
|
||||
if (item.partId == row.partId) {
|
||||
this.equipmentList.splice(index, 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue