优化结算页面问题
This commit is contained in:
parent
cb3652fb1e
commit
d585da9247
|
|
@ -472,322 +472,320 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getAgreementList,
|
getAgreementList,
|
||||||
getUnitList,
|
getUnitList,
|
||||||
getProjectList,
|
getProjectList,
|
||||||
} from '@/api/claimAndRefund/receive'
|
} from '@/api/claimAndRefund/receive'
|
||||||
import { getSltInfo, submitFee, exportLease } from '@/api/cost/cost'
|
import { getSltInfo, submitFee, exportLease } from '@/api/cost/cost'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Agreement',
|
name: 'Agreement',
|
||||||
dicts: ['sys_normal_disable'],
|
dicts: ['sys_normal_disable'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: false,
|
loading: false,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
single: true,
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
multiple: true,
|
multiple: true,
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
// 往来单位数据
|
// 往来单位数据
|
||||||
unitList: [],
|
unitList: [],
|
||||||
// 工程数据
|
// 工程数据
|
||||||
projectList: [],
|
projectList: [],
|
||||||
statusList: [
|
statusList: [
|
||||||
{ id: '0', name: '请选择' },
|
{ id: '0', name: '请选择' },
|
||||||
{ id: '1', name: '已结算' },
|
{ id: '1', name: '已结算' },
|
||||||
{ id: '2', name: '未结算' },
|
{ id: '2', name: '未结算' },
|
||||||
{ id: '3', name: '待审核' },
|
{ id: '3', name: '待审核' },
|
||||||
], //集合
|
], //集合
|
||||||
// 表格数据
|
// 表格数据
|
||||||
agreementList: [],
|
agreementList: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: '',
|
title: '',
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
keyWord: undefined,
|
keyWord: undefined,
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
//图片上传
|
|
||||||
uploadHeader: process.env.VUE_APP_BASE_API,
|
|
||||||
imageUrl: '',
|
|
||||||
imageName: '',
|
|
||||||
fileList: [],
|
|
||||||
field101fileList: [],
|
|
||||||
dialogImageUrl: '',
|
|
||||||
dialogVisible: false,
|
|
||||||
//上传地址
|
|
||||||
// uploadUrl:'http://192.168.0.14:21624/system',//线上服务器地址+system
|
|
||||||
// uploadUrl:'http://112.29.103.165:21626/system',//线上服务器地址+system
|
|
||||||
uploadUrl: process.env.VUE_APP_BASE_API + '/system', // 上传的图片服务器地址
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
contractCode: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '合同编号不能为空',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
signTime: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '签订日期不能为空',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
unitName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '往来单位不能为空',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
projectName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '工程名称不能为空',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
peopleOpen: false,
|
|
||||||
noticeOpen: false,
|
|
||||||
nform: {
|
|
||||||
notice: '',
|
|
||||||
},
|
|
||||||
nrules: {
|
|
||||||
notice: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '通知内容不能为空',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
leaseList: [], //租赁费用列表
|
|
||||||
leaseCost: 0,
|
|
||||||
repairList: [], //维修费用列表
|
|
||||||
repairCost: 0,
|
|
||||||
scrapList: [], //报废费用列表
|
|
||||||
scrapCost: 0,
|
|
||||||
loseList: [], //丢失费用列表
|
|
||||||
loseCost: 0,
|
|
||||||
costAll: 0,
|
|
||||||
deptName: undefined,
|
|
||||||
applyVisible: false,
|
|
||||||
applyList: [],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let arr = JSON.parse(this.$route.query.rowData)
|
|
||||||
this.rowData = arr
|
|
||||||
this.getDataAll()
|
|
||||||
// this.getUnitList();
|
|
||||||
// this.getProjectList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
//获取单位类型 ,getUnitList, getProjectList
|
|
||||||
getUnitList() {
|
|
||||||
getUnitList().then((response) => {
|
|
||||||
this.unitList = response.data
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
getProjectList() {
|
// 表单参数
|
||||||
getProjectList().then((response) => {
|
form: {},
|
||||||
this.projectList = response.data
|
//图片上传
|
||||||
})
|
uploadHeader: process.env.VUE_APP_BASE_API,
|
||||||
},
|
imageUrl: '',
|
||||||
|
imageName: '',
|
||||||
/** 查询列表 */
|
fileList: [],
|
||||||
getDataAll() {
|
field101fileList: [],
|
||||||
getSltInfo(this.rowData).then((response) => {
|
dialogImageUrl: '',
|
||||||
// this.agreementList = response.rows;
|
dialogVisible: false,
|
||||||
this.leaseList = response.data.leaseList //租赁费用列表
|
//上传地址
|
||||||
this.leaseCost = this.countCost(this.leaseList)
|
// uploadUrl:'http://192.168.0.14:21624/system',//线上服务器地址+system
|
||||||
|
// uploadUrl:'http://112.29.103.165:21626/system',//线上服务器地址+system
|
||||||
this.repairList = response.data.repairList //维修费用列表
|
uploadUrl: process.env.VUE_APP_BASE_API + '/system', // 上传的图片服务器地址
|
||||||
this.repairCost = this.countCost(this.repairList)
|
// 表单校验
|
||||||
|
rules: {
|
||||||
this.scrapList = response.data.scrapList //报废费用列表
|
contractCode: [
|
||||||
this.scrapCost = this.countCost(this.scrapList)
|
{
|
||||||
|
required: true,
|
||||||
this.loseList = response.data.loseList //丢失费用列表
|
message: '合同编号不能为空',
|
||||||
this.loseCost = this.countCost(this.loseList)
|
trigger: 'blur',
|
||||||
|
|
||||||
this.applyList = response.data.relations
|
|
||||||
this.applyList.forEach((item) => {
|
|
||||||
item.cost =
|
|
||||||
Number(item.leaseCost) +
|
|
||||||
Number(item.repairCost) +
|
|
||||||
Number(item.scrapCost) +
|
|
||||||
Number(item.loseCost) +
|
|
||||||
Number(item.addCost) -
|
|
||||||
Number(item.subCost)
|
|
||||||
})
|
|
||||||
|
|
||||||
let costSum =
|
|
||||||
Number(this.leaseCost) +
|
|
||||||
Number(this.repairCost) +
|
|
||||||
Number(this.scrapCost) +
|
|
||||||
Number(this.loseCost)
|
|
||||||
this.costAll = costSum.toFixed(2)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//计算金额1
|
|
||||||
countCost(list) {
|
|
||||||
let arrCost = 0
|
|
||||||
list.forEach((item) => {
|
|
||||||
// arrCost += parseInt(item.costs)
|
|
||||||
|
|
||||||
console.log(item)
|
|
||||||
if (item.partType != 0 && item.scrapType != 0) {
|
|
||||||
arrCost = arrCost + Number(item.costs)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return arrCost.toFixed(2)
|
|
||||||
},
|
|
||||||
//提交按钮
|
|
||||||
handleAdd() {
|
|
||||||
this.applyVisible = true
|
|
||||||
},
|
|
||||||
//el-table-合计总费用
|
|
||||||
getSummaries(param) {
|
|
||||||
const { columns, data } = param
|
|
||||||
const sums = []
|
|
||||||
columns.forEach((column, index) => {
|
|
||||||
if (index === 9) {
|
|
||||||
sums[index] = '最终费用'
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const values = data.map((item) =>
|
|
||||||
Number(item[column.property]),
|
|
||||||
)
|
|
||||||
// 只对amount这一列进行总计核算。
|
|
||||||
if (column.property === 'cost') {
|
|
||||||
if (!values.every((value) => isNaN(value))) {
|
|
||||||
sums[index] = values.reduce((prev, curr) => {
|
|
||||||
const value = Number(curr)
|
|
||||||
if (!isNaN(value)) {
|
|
||||||
return prev + curr
|
|
||||||
} else {
|
|
||||||
return prev
|
|
||||||
}
|
|
||||||
}, 0)
|
|
||||||
// sums[index] += ' 元';
|
|
||||||
} else {
|
|
||||||
sums[index] = '---'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return sums
|
|
||||||
},
|
|
||||||
|
|
||||||
countNum(row) {
|
|
||||||
row.cost =
|
|
||||||
Number(row.leaseCost) +
|
|
||||||
Number(row.repairCost) +
|
|
||||||
Number(row.scrapCost) +
|
|
||||||
Number(row.loseCost) +
|
|
||||||
Number(row.addCost) -
|
|
||||||
Number(row.subCost)
|
|
||||||
},
|
|
||||||
|
|
||||||
//提交按钮
|
|
||||||
submitApply() {
|
|
||||||
let costAll = 0
|
|
||||||
this.applyList.forEach((item) => {
|
|
||||||
costAll = costAll + item.cost
|
|
||||||
})
|
|
||||||
console.log(costAll)
|
|
||||||
let param = {
|
|
||||||
relations: this.applyList,
|
|
||||||
cost: costAll,
|
|
||||||
}
|
|
||||||
console.log(param)
|
|
||||||
submitFee(param).then((res) => {
|
|
||||||
console.log(res)
|
|
||||||
if (res.code == 200) {
|
|
||||||
this.$tab.closeOpenPage({
|
|
||||||
path: '/cost/cost/costApplyList',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//返回
|
|
||||||
handleBack() {
|
|
||||||
this.$tab.closeOpenPage({
|
|
||||||
path: '/cost/cost/costApplyList',
|
|
||||||
query: {
|
|
||||||
isEdit: true,
|
|
||||||
},
|
},
|
||||||
})
|
],
|
||||||
|
signTime: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '签订日期不能为空',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
unitName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '往来单位不能为空',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
projectName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '工程名称不能为空',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
peopleOpen: false,
|
||||||
handleSelectionChange(selection) {
|
noticeOpen: false,
|
||||||
this.ids = selection.map((item) => item.agreementId)
|
nform: {
|
||||||
this.single = selection.length != 1
|
notice: '',
|
||||||
this.multiple = !selection.length
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
nrules: {
|
||||||
//租赁
|
notice: [
|
||||||
handleExport1() {
|
{
|
||||||
this.downloadJson(
|
required: true,
|
||||||
'material/sltAgreementInfo/exportLease',
|
message: '通知内容不能为空',
|
||||||
JSON.stringify(this.rowData),
|
trigger: 'blur',
|
||||||
`租赁费用明细_${new Date().getTime()}.xlsx`,
|
},
|
||||||
)
|
],
|
||||||
},
|
|
||||||
//丢失
|
|
||||||
handleExport2() {
|
|
||||||
this.downloadJson(
|
|
||||||
'material/sltAgreementInfo/exportLose',
|
|
||||||
JSON.stringify(this.rowData),
|
|
||||||
`丢失费用明细_${new Date().getTime()}.xlsx`,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
// 维修
|
|
||||||
handleExport3() {
|
|
||||||
this.downloadJson(
|
|
||||||
'material/sltAgreementInfo/exportRepair',
|
|
||||||
JSON.stringify(this.rowData),
|
|
||||||
`维修费用明细_${new Date().getTime()}.xlsx`,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
//报废
|
|
||||||
handleExport4() {
|
|
||||||
this.downloadJson(
|
|
||||||
'material/sltAgreementInfo/exportScrap',
|
|
||||||
JSON.stringify(this.rowData),
|
|
||||||
`报废费用明细_${new Date().getTime()}.xlsx`,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
handleExportAll() {
|
|
||||||
this.handleExport1()
|
|
||||||
this.handleExport2()
|
|
||||||
this.handleExport3()
|
|
||||||
this.handleExport4()
|
|
||||||
},
|
},
|
||||||
|
leaseList: [], //租赁费用列表
|
||||||
|
leaseCost: 0,
|
||||||
|
repairList: [], //维修费用列表
|
||||||
|
repairCost: 0,
|
||||||
|
scrapList: [], //报废费用列表
|
||||||
|
scrapCost: 0,
|
||||||
|
loseList: [], //丢失费用列表
|
||||||
|
loseCost: 0,
|
||||||
|
costAll: 0,
|
||||||
|
deptName: undefined,
|
||||||
|
applyVisible: false,
|
||||||
|
applyList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
let arr = JSON.parse(this.$route.query.rowData)
|
||||||
|
this.rowData = arr
|
||||||
|
this.getDataAll()
|
||||||
|
// this.getUnitList();
|
||||||
|
// this.getProjectList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//获取单位类型 ,getUnitList, getProjectList
|
||||||
|
getUnitList() {
|
||||||
|
getUnitList().then((response) => {
|
||||||
|
this.unitList = response.data
|
||||||
|
})
|
||||||
},
|
},
|
||||||
}
|
getProjectList() {
|
||||||
|
getProjectList().then((response) => {
|
||||||
|
this.projectList = response.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
getDataAll() {
|
||||||
|
getSltInfo(this.rowData).then((response) => {
|
||||||
|
// this.agreementList = response.rows;
|
||||||
|
this.leaseList = response.data.leaseList //租赁费用列表
|
||||||
|
this.leaseCost = this.countCost(this.leaseList)
|
||||||
|
|
||||||
|
this.repairList = response.data.repairList //维修费用列表
|
||||||
|
this.repairCost = this.countCost(this.repairList)
|
||||||
|
|
||||||
|
this.scrapList = response.data.scrapList //报废费用列表
|
||||||
|
this.scrapCost = this.countCost(this.scrapList)
|
||||||
|
|
||||||
|
this.loseList = response.data.loseList //丢失费用列表
|
||||||
|
this.loseCost = this.countCost(this.loseList)
|
||||||
|
|
||||||
|
this.applyList = response.data.relations
|
||||||
|
this.applyList.forEach((item) => {
|
||||||
|
item.cost =
|
||||||
|
Number(item.leaseCost) +
|
||||||
|
Number(item.repairCost) +
|
||||||
|
Number(item.scrapCost) +
|
||||||
|
Number(item.loseCost) +
|
||||||
|
Number(item.addCost) -
|
||||||
|
Number(item.subCost)
|
||||||
|
})
|
||||||
|
|
||||||
|
let costSum =
|
||||||
|
Number(this.leaseCost) +
|
||||||
|
Number(this.repairCost) +
|
||||||
|
Number(this.scrapCost) +
|
||||||
|
Number(this.loseCost)
|
||||||
|
this.costAll = costSum.toFixed(2)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//计算金额1
|
||||||
|
countCost(list) {
|
||||||
|
let arrCost = 0
|
||||||
|
list.forEach((item) => {
|
||||||
|
// arrCost += parseInt(item.costs)
|
||||||
|
|
||||||
|
console.log(item)
|
||||||
|
if (item.partType != 0 && item.scrapType != 0) {
|
||||||
|
arrCost = arrCost + Number(item.costs)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return arrCost.toFixed(2)
|
||||||
|
},
|
||||||
|
//提交按钮
|
||||||
|
handleAdd() {
|
||||||
|
this.applyVisible = true
|
||||||
|
},
|
||||||
|
//el-table-合计总费用
|
||||||
|
getSummaries(param) {
|
||||||
|
const { columns, data } = param
|
||||||
|
const sums = []
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 9) {
|
||||||
|
sums[index] = '最终费用'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const values = data.map((item) => Number(item[column.property]))
|
||||||
|
// 只对amount这一列进行总计核算。
|
||||||
|
if (column.property === 'cost') {
|
||||||
|
if (!values.every((value) => isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr)
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return prev + curr
|
||||||
|
} else {
|
||||||
|
return prev
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
// sums[index] += ' 元';
|
||||||
|
} else {
|
||||||
|
sums[index] = '---'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return sums
|
||||||
|
},
|
||||||
|
|
||||||
|
countNum(row) {
|
||||||
|
row.cost =
|
||||||
|
Number(row.leaseCost) +
|
||||||
|
Number(row.repairCost) +
|
||||||
|
Number(row.scrapCost) +
|
||||||
|
Number(row.loseCost) +
|
||||||
|
Number(row.addCost || 0) -
|
||||||
|
Number(row.subCost || 0)
|
||||||
|
},
|
||||||
|
|
||||||
|
//提交按钮
|
||||||
|
submitApply() {
|
||||||
|
let costAll = 0
|
||||||
|
this.applyList.forEach((item) => {
|
||||||
|
costAll = costAll + item.cost
|
||||||
|
})
|
||||||
|
console.log(costAll)
|
||||||
|
let param = {
|
||||||
|
relations: this.applyList,
|
||||||
|
cost: costAll,
|
||||||
|
}
|
||||||
|
console.log(param)
|
||||||
|
submitFee(param).then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.$tab.closeOpenPage({
|
||||||
|
path: '/cost/cost/costApplyList',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//返回
|
||||||
|
handleBack() {
|
||||||
|
this.$tab.closeOpenPage({
|
||||||
|
path: '/cost/cost/costApplyList',
|
||||||
|
query: {
|
||||||
|
isEdit: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map((item) => item.agreementId)
|
||||||
|
this.single = selection.length != 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
//租赁
|
||||||
|
handleExport1() {
|
||||||
|
this.downloadJson(
|
||||||
|
'material/sltAgreementInfo/exportLease',
|
||||||
|
JSON.stringify(this.rowData),
|
||||||
|
`租赁费用明细_${new Date().getTime()}.xlsx`,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
//丢失
|
||||||
|
handleExport2() {
|
||||||
|
this.downloadJson(
|
||||||
|
'material/sltAgreementInfo/exportLose',
|
||||||
|
JSON.stringify(this.rowData),
|
||||||
|
`丢失费用明细_${new Date().getTime()}.xlsx`,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
// 维修
|
||||||
|
handleExport3() {
|
||||||
|
this.downloadJson(
|
||||||
|
'material/sltAgreementInfo/exportRepair',
|
||||||
|
JSON.stringify(this.rowData),
|
||||||
|
`维修费用明细_${new Date().getTime()}.xlsx`,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
//报废
|
||||||
|
handleExport4() {
|
||||||
|
this.downloadJson(
|
||||||
|
'material/sltAgreementInfo/exportScrap',
|
||||||
|
JSON.stringify(this.rowData),
|
||||||
|
`报废费用明细_${new Date().getTime()}.xlsx`,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
handleExportAll() {
|
||||||
|
this.handleExport1()
|
||||||
|
this.handleExport2()
|
||||||
|
this.handleExport3()
|
||||||
|
this.handleExport4()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
::v-deep.el-table .fixed-width .el-button--mini {
|
::v-deep.el-table .fixed-width .el-button--mini {
|
||||||
width: 80px !important;
|
width: 80px !important;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue