完善接口调试

This commit is contained in:
BianLzhaoMin 2026-02-10 16:28:19 +08:00
parent 4c9ebf3fd7
commit b4229e16eb
8 changed files with 391 additions and 270 deletions

View File

@ -3,53 +3,74 @@ import requestFormData from '@/utils/request_formdata'
// 获取支付失败人员列表 // 获取支付失败人员列表
export function getPaymentFailListAPI(data) { export function getPaymentFailListAPI(data) {
return request({ return request({
url: '/bmw/paymentFail/list', url: '/bmw/payFail/getPageList',
method: 'GET', method: 'GET',
params: data, params: data,
}) })
} }
// 新增支付失败人员 // 新增支付失败人员
export function addPaymentFailAPI(data) { export function addPaymentFailAPI(data) {
return requestFormData({ return requestFormData({
url: '/bmw/paymentFail/add', url: '/bmw/payFail/addData',
method: 'POST', method: 'POST',
data, data,
}) })
} }
// 修改支付失败人员 // 修改支付失败人员
export function updatePaymentFailAPI(data) { export function updatePaymentFailAPI(data) {
return requestFormData({ return requestFormData({
url: '/bmw/paymentFail/update', url: '/bmw/payFail/updateData',
method: 'POST', method: 'POST',
data, data,
}) })
} }
// 删除支付失败人员 // 删除支付失败人员
export function deletePaymentFailAPI(data) { export function deletePaymentFailAPI(data) {
return request({ return request({
url: '/bmw/paymentFail/delete', url: '/bmw/payFail/delData',
method: 'POST', method: 'POST',
data, data,
}) })
} }
// 获取支付失败人员详情 // 获取支付失败人员详情
export function getPaymentFailDetailAPI(id) { export function getPaymentFailDetailAPI(id) {
return request({ return request({
url: `/bmw/paymentFail/detail/${id}`, url: `/bmw/payFail/detail/${id}`,
method: 'GET', method: 'GET',
}) })
} }
// 导入支付失败数据 // 导入支付失败数据
export function importPaymentFailAPI(data) { export function importPaymentFailAPI(data) {
return requestFormData({ return requestFormData({
url: '/bmw/paymentFail/import', url: '/bmw/payFail/importFile',
method: 'POST', method: 'POST',
data, data,
}) })
}
// 模板下载
export function downloadTemplateAPI() {
return request({
url: '/bmw/payFail/downloadFile',
method: 'GET',
responseType: 'blob', // 核心:指定响应类型为二进制流,必须!
headers: {
'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
}
})
}
// 判断人员的工资是否支付
export function isPaymentFailAPI(data) {
return request({
url: '/bmw/payFail/getHistoryPay',
method: 'POST',
data,
})
} }

View File

@ -216,8 +216,6 @@ export default {
// change // change
async handleSelChange(e, val) { async handleSelChange(e, val) {
console.log(e, val, '996')
console.log(['proId', 'subId', 'teamId'].includes(val), '996')
if (['proId', 'subId', 'teamId'].includes(val)) { if (['proId', 'subId', 'teamId'].includes(val)) {
this.queryDownloadTask[val] = e this.queryDownloadTask[val] = e
} }
@ -227,7 +225,7 @@ export default {
proId: e, proId: e,
}) })
this.formLabel[1].f_selList = subList.map((item) => { this.formLabel[1].f_selList = subList.rows?.map((item) => {
return { return {
value: item.id, value: item.id,
label: item.subName, label: item.subName,
@ -239,7 +237,7 @@ export default {
subId: e, subId: e,
}) })
this.formLabel[2].f_selList = teamList.map((item) => { this.formLabel[2].f_selList = teamList.rows?.map((item) => {
return { return {
value: item.id, value: item.id,
label: item.teamName, label: item.teamName,
@ -273,11 +271,12 @@ export default {
} }
}) })
const subList = await getSubSelectListCommonFun({ const subList = await getSubSelectListAPI({
proId: this.sendParams.proId, proId: this.sendParams.proId,
}) })
this.formLabel[1].f_selList = subList.map((item) => { this.formLabel[1].f_selList = []
this.formLabel[1].f_selList = subList.rows?.map((item) => {
return { return {
value: item.id, value: item.id,
label: item.subName, label: item.subName,

View File

@ -623,6 +623,7 @@ import {
getLotProjectSelectListByConditionAPI, getLotProjectSelectListByConditionAPI,
} from '@/api/common' } from '@/api/common'
import { getPostTypeSelectListCommonFun } from '@/utils/getCommonData' import { getPostTypeSelectListCommonFun } from '@/utils/getCommonData'
import { isPaymentFailAPI } from '@/api/synthesize-query/payment-fail'
export default { export default {
name: 'AddOrEditForm', name: 'AddOrEditForm',
dicts: ['salary'], dicts: ['salary'],
@ -1660,7 +1661,7 @@ export default {
}, },
// //
onBlurIdNumber() { async onBlurIdNumber() {
// if (!this.idCardInfoForm.idNumber) return // if (!this.idCardInfoForm.idNumber) return
// //
const birthday = this.idCardInfoForm.idNumber.slice(6, 14) const birthday = this.idCardInfoForm.idNumber.slice(6, 14)
@ -1677,7 +1678,21 @@ export default {
const age = new Date().getFullYear() - birthday.slice(0, 4) const age = new Date().getFullYear() - birthday.slice(0, 4)
this.idCardInfoForm.age = age this.idCardInfoForm.age = age
this.checkShanghaiPro() //
const res = await isPaymentFailAPI({
idCard: this.idCardInfoForm.idNumber,
})
if (res.data && res.code == 200) {
// this.$modal.msgError('')
this.$message({
message: res.data,
type: 'warning',
duration: 5000,
})
setTimeout(() => {
this.checkShanghaiPro()
}, 2000)
}
}, },
// //

View File

@ -578,7 +578,7 @@ export default {
proId: e, proId: e,
}) })
this.formLabel[4].f_selList = subList.map((item) => { this.formLabel[4].f_selList = subList.rows?.map((item) => {
return { return {
value: item.id, value: item.id,
label: item.subName, label: item.subName,
@ -589,7 +589,11 @@ export default {
const teamList = await getTeamSelectListAPI({ const teamList = await getTeamSelectListAPI({
subId: e, subId: e,
}) })
this.formLabel[5].f_selList = teamList.map((item) => {
console.log(teamList, 'teamList')
this.formLabel[5].f_selList = []
this.formLabel[5].f_selList = teamList.rows?.map((item) => {
return { return {
value: item.id, value: item.id,
label: item.teamName, label: item.teamName,

View File

@ -12,6 +12,7 @@
<el-input <el-input
clearable clearable
style="width: 420px" style="width: 420px"
@blur="onBlurIdNumber"
placeholder="请输入身份证号码" placeholder="请输入身份证号码"
v-model.trim="idNumberForm.idNumber" v-model.trim="idNumberForm.idNumber"
/> />
@ -396,6 +397,8 @@ import {
getTeamSelectListByConditionAPI, getTeamSelectListByConditionAPI,
getLotProjectSelectListByConditionAPI, getLotProjectSelectListByConditionAPI,
} from '@/api/common' } from '@/api/common'
import { isPaymentFailAPI } from '@/api/synthesize-query/payment-fail'
export default { export default {
name: 'ShanghaiProSetting', name: 'ShanghaiProSetting',
dicts: ['salary'], dicts: ['salary'],
@ -636,6 +639,24 @@ export default {
this.$emit('closeDialogOuter') this.$emit('closeDialogOuter')
}, },
//
async onBlurIdNumber() {
//
const res = await isPaymentFailAPI({
idCard: this.idNumberForm.idNumber,
})
if (res.data && res.code == 200) {
// this.$modal.msgError('')
this.$message({
message: res.data,
type: 'warning',
showClose: true,
duration: 0,
})
}
},
// //
onHandleNextStep() { onHandleNextStep() {
// this.currentStep = 2 // this.currentStep = 2
@ -648,14 +669,20 @@ export default {
}) })
if (!res) { if (!res) {
this.$modal.msgError('当前人员不存在,请先新增人员!') // this.$modal.msgError('')
this.$message({
message: '当前人员不存在,请先新增人员!',
type: 'danger',
})
return return
} }
if (res?.isShanghai == 0) { if (res?.isShanghai == 0) {
this.$modal.msgError( this.$message({
'该人员当前所在公司不允许同时入场多个工程!', message:
) '该人员当前所在公司不允许同时入场多个工程!',
type: 'danger',
})
return return
} }
this.currentStep = 2 this.currentStep = 2

View File

@ -9,24 +9,24 @@
> >
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="姓名" prop="name"> <el-form-item label="姓名" prop="userName">
<el-input <el-input
clearable clearable
maxlength="20" maxlength="20"
show-word-limit show-word-limit
placeholder="请输入姓名" placeholder="请输入姓名"
v-model="paymentFailForm.name" v-model="paymentFailForm.userName"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="身份证号" prop="idNumber"> <el-form-item label="身份证号" prop="idCard">
<el-input <el-input
clearable clearable
maxlength="18" maxlength="18"
show-word-limit show-word-limit
placeholder="请输入身份证号" placeholder="请输入身份证号"
v-model="paymentFailForm.idNumber" v-model="paymentFailForm.idCard"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -34,62 +34,47 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工程名称" prop="proId"> <el-form-item label="工程名称" prop="proName">
<el-select <el-input
clearable clearable
filterable maxlength="50"
style="width: 100%" show-word-limit
placeholder="请选择工程名称" placeholder="请输入工程名称"
v-model="paymentFailForm.proId" v-model="paymentFailForm.proName"
@change="handleProChange" />
>
<el-option
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in projectOptions"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="分包单位" prop="subId"> <el-form-item label="分包名称" prop="subName">
<el-select <el-input
clearable clearable
filterable maxlength="50"
style="width: 100%" show-word-limit
placeholder="请选择分包单位" placeholder="请输入分包名称"
v-model="paymentFailForm.subId" v-model="paymentFailForm.subName"
> />
<el-option
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in subcontractOptions"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="应发放月份" prop="payMonth"> <el-form-item label="应发放月份" prop="failMonth">
<el-date-picker <el-date-picker
type="month" type="month"
style="width: 100%" style="width: 100%"
value-format="yyyy-MM" value-format="yyyy-MM"
placeholder="请选择应发放月份" placeholder="请选择应发放月份"
v-model="paymentFailForm.payMonth" v-model="paymentFailForm.failMonth"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="应发放金额" prop="payAmount"> <el-form-item label="应发放金额" prop="money">
<el-input <el-input
clearable clearable
placeholder="请输入应发放金额" placeholder="请输入应发放金额"
v-model="paymentFailForm.payAmount" v-model="paymentFailForm.money"
> >
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
@ -102,6 +87,8 @@
<el-form-item label="支付失败原因" prop="failReason"> <el-form-item label="支付失败原因" prop="failReason">
<el-input <el-input
clearable clearable
type="textarea"
:autosize="{ minRows: 4, maxRows: 8 }"
maxlength="200" maxlength="200"
show-word-limit show-word-limit
placeholder="请输入支付失败原因" placeholder="请输入支付失败原因"
@ -110,8 +97,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="记录状态" prop="status"> <el-form-item label="记录状态" prop="failStatus">
<el-radio-group v-model="paymentFailForm.status"> <el-radio-group v-model="paymentFailForm.failStatus">
<el-radio label="0">未处理</el-radio> <el-radio label="0">未处理</el-radio>
<el-radio label="1">已处理</el-radio> <el-radio label="1">已处理</el-radio>
</el-radio-group> </el-radio-group>
@ -168,10 +155,6 @@ import {
addPaymentFailAPI, addPaymentFailAPI,
updatePaymentFailAPI, updatePaymentFailAPI,
} from '@/api/synthesize-query/payment-fail' } from '@/api/synthesize-query/payment-fail'
import {
getLotProjectSelectListCommonFun,
getSubSelectListCommonFun,
} from '@/utils/getCommonData'
import { getSubSelectListAPI } from '@/api/common' import { getSubSelectListAPI } from '@/api/common'
export default { export default {
@ -190,32 +173,38 @@ export default {
type: String, type: String,
default: '', default: '',
}, },
editFormData: {
type: Object,
default: () => null,
},
}, },
data() { data() {
return { return {
// //
paymentFailForm: { paymentFailForm: {
name: '', userName: '', //
idNumber: '', idCard: '', //
proId: '', proName: '', //
subId: '', subName: '', //
payMonth: '', failMonth: '', //
payAmount: '', money: '', //
failReason: '', failReason: '', //
status: '0', // failStatus: '0', // 使 0- 1-
fileList: [], fileSiz: 0, //
remark: '', fileList: [], //
remark: '', //
}, },
allFileList: [], //
// //
paymentFailFormRules: { paymentFailFormRules: {
name: [ userName: [
{ {
required: true, required: true,
message: '姓名不能为空', message: '姓名不能为空',
trigger: 'blur', trigger: 'blur',
}, },
], ],
idNumber: [ idCard: [
{ {
required: true, required: true,
message: '身份证号不能为空', message: '身份证号不能为空',
@ -228,28 +217,14 @@ export default {
trigger: 'blur', trigger: 'blur',
}, },
], ],
proId: [ failMonth: [
{
required: true,
message: '请选择工程名称',
trigger: 'change',
},
],
subId: [
{
required: true,
message: '请选择分包单位',
trigger: 'change',
},
],
payMonth: [
{ {
required: true, required: true,
message: '请选择应发放月份', message: '请选择应发放月份',
trigger: 'change', trigger: 'change',
}, },
], ],
payAmount: [ money: [
{ {
required: true, required: true,
message: '应发放金额不能为空', message: '应发放金额不能为空',
@ -267,7 +242,7 @@ export default {
trigger: 'blur', trigger: 'blur',
}, },
], ],
status: [ failStatus: [
{ {
required: true, required: true,
message: '请选择记录状态', message: '请选择记录状态',
@ -281,24 +256,7 @@ export default {
subcontractOptions: [], subcontractOptions: [],
} }
}, },
watch: {
editId: {
handler(newVal) {
if (newVal && this.formType === 2) {
this.getDetail()
} else {
this.resetForm()
}
},
immediate: true,
},
},
async created() {
await this.initProjectOptions()
if (this.formType === 2 && this.editId) {
await this.getDetail()
}
},
methods: { methods: {
// //
validatePayAmount(rule, value, callback) { validatePayAmount(rule, value, callback) {
@ -326,20 +284,17 @@ export default {
callback() callback()
}, },
//
async initProjectOptions() {
const lotProjectList = await getLotProjectSelectListCommonFun()
this.projectOptions = lotProjectList.map((item) => {
return {
label: item.proName,
value: item.id,
}
})
},
// //
async handleProChange(proId) { async handleProChange(proId) {
if (proId) { if (proId) {
//
const selectedProject = this.projectOptions.find(
(item) => item.value === proId,
)
if (selectedProject) {
this.paymentFailForm.proName = selectedProject.label
}
const subList = await getSubSelectListAPI({ const subList = await getSubSelectListAPI({
proId: proId, proId: proId,
}) })
@ -351,55 +306,41 @@ export default {
}) })
// //
this.paymentFailForm.subId = '' this.paymentFailForm.subId = ''
this.paymentFailForm.subName = ''
} else { } else {
this.subcontractOptions = [] this.subcontractOptions = []
this.paymentFailForm.subId = '' this.paymentFailForm.subId = ''
this.paymentFailForm.proName = ''
this.paymentFailForm.subName = ''
} }
}, },
// //
async getDetail() { handleSubChange(subId) {
if (!this.editId) return if (subId) {
try { const selectedSub = this.subcontractOptions.find(
const res = await getPaymentFailDetailAPI(this.editId) (item) => item.value === subId,
if (res.code === 200 && res.data) { )
const data = res.data if (selectedSub) {
this.paymentFailForm = { this.paymentFailForm.subName = selectedSub.label
name: data.name || '',
idNumber: data.idNumber || '',
proId: data.proId || '',
subId: data.subId || '',
payMonth: data.payMonth || '',
payAmount: data.payAmount || '',
failReason: data.failReason || '',
status:
data.status !== undefined
? String(data.status)
: '0',
fileList: data.fileList || [],
remark: data.remark || '',
}
// ID
if (data.proId) {
await this.handleProChange(data.proId)
}
} }
} catch (error) { } else {
console.error('获取详情失败', error) this.paymentFailForm.subName = ''
} }
}, },
// //
resetForm() { resetForm() {
this.paymentFailForm = { this.paymentFailForm = {
name: '', userName: '',
idNumber: '', idCard: '',
proId: '', proName: '',
subId: '', subName: '',
payMonth: '', failMonth: '',
payAmount: '', money: '',
failReason: '', failReason: '',
status: '0', failStatus: '0',
fileSiz: 0,
fileList: [], fileList: [],
remark: '', remark: '',
} }
@ -426,27 +367,27 @@ export default {
// FormData // FormData
const formData = new FormData() const formData = new FormData()
// // config.js
formData.append('name', this.paymentFailForm.name)
formData.append( formData.append(
'idNumber', 'userName',
this.paymentFailForm.idNumber, this.paymentFailForm.userName,
) )
formData.append('proId', this.paymentFailForm.proId) formData.append('idCard', this.paymentFailForm.idCard)
formData.append('subId', this.paymentFailForm.subId) formData.append('proName', this.paymentFailForm.proName)
formData.append('subName', this.paymentFailForm.subName)
formData.append( formData.append(
'payMonth', 'failMonth',
this.paymentFailForm.payMonth, this.paymentFailForm.failMonth,
)
formData.append(
'payAmount',
this.paymentFailForm.payAmount,
) )
formData.append('money', this.paymentFailForm.money)
formData.append( formData.append(
'failReason', 'failReason',
this.paymentFailForm.failReason, this.paymentFailForm.failReason,
) )
formData.append('status', this.paymentFailForm.status) formData.append(
'failStatus',
this.paymentFailForm.failStatus,
)
formData.append( formData.append(
'remark', 'remark',
this.paymentFailForm.remark || '', this.paymentFailForm.remark || '',
@ -455,6 +396,23 @@ export default {
// id // id
if (this.formType === 2 && this.editId) { if (this.formType === 2 && this.editId) {
formData.append('id', this.editId) formData.append('id', this.editId)
// id
const delFileList = this.allFileList.filter(
(item) => {
return !this.paymentFailForm.fileList.some(
(file) => file.id === item.id,
)
},
)
if (delFileList.length > 0) {
formData.append(
'delFileId',
delFileList
.map((item) => item.id)
.join(','),
)
}
} }
// //
@ -463,7 +421,7 @@ export default {
this.paymentFailForm.fileList.length > 0 this.paymentFailForm.fileList.length > 0
) { ) {
this.paymentFailForm.fileList.forEach((file) => { this.paymentFailForm.fileList.forEach((file) => {
if (file.raw) { if (file.raw && !file.id) {
formData.append('file', file.raw) formData.append('file', file.raw)
} }
}) })
@ -494,6 +452,49 @@ export default {
}) })
}, },
}, },
watch: {
editFormData: {
handler(newVal) {
if (Object.keys(newVal).length > 0) {
// Object.assign(this.paymentFailForm, newVal)
const {
userName,
idCard,
proName,
subName,
failMonth,
money,
failReason,
fileList,
remark,
failStatusString,
} = newVal
this.paymentFailForm = {
userName,
idCard,
proName,
subName,
failMonth,
money,
remark,
failReason,
}
this.paymentFailForm.failStatus = failStatusString
this.allFileList = fileList
this.paymentFailForm.fileList = fileList.map((item) => {
return {
id: item.id,
url: item.lsUrl,
name: item.originFileName,
}
})
}
},
immediate: true,
},
},
} }
</script> </script>

View File

@ -1,70 +1,70 @@
export const formLabel = [ export const formLabel = [
{ {
f_label: '姓名', f_label: '姓名',
f_model: 'name', f_model: 'userName',
f_type: 'ipt', f_type: 'ipt',
f_width: '180px', f_width: '180px',
isShow: false, // 是否展示label isShow: false, // 是否展示label
}, },
{ {
f_label: '身份证', f_label: '身份证',
f_model: 'idNumber', f_model: 'idCard',
f_type: 'ipt', f_type: 'ipt',
f_width: '180px', f_width: '180px',
isShow: false, // 是否展示label isShow: false, // 是否展示label
}, },
{ {
f_label: '工程', f_label: '工程',
f_model: 'proId', f_model: 'proName',
f_type: 'sel', f_type: 'ipt',
f_width: '180px', f_width: '180px',
isShow: false, // 是否展示label isShow: false, // 是否展示label
f_selList: [], // 工程列表
}, },
{ {
f_label: '分包', f_label: '分包',
f_model: 'subId', f_model: 'subName',
f_type: 'sel', f_type: 'ipt',
f_width: '180px', f_width: '180px',
isShow: false, // 是否展示label isShow: false, // 是否展示label
f_selList: [], // 分包列表
}, },
{ {
f_label: '状态', f_label: '状态',
f_model: 'status', f_model: 'failStatus',
f_type: 'sel', f_type: 'sel',
f_width: '180px', f_width: '180px',
isShow: false, // 是否展示label isShow: false, // 是否展示label
f_selList: [ f_selList: [
{ {
label: '未处理', label: '未处理',
value: '0', value: '0',
}, },
{ {
label: '已处理', label: '已处理',
value: '1', value: '1',
}, },
], // 状态列表 ],
}, },
] ]
export const columnsList = [ export const columnsList = [
{ t_props: 'name', t_label: '姓名' }, { t_props: 'userName', t_label: '姓名' },
{ t_props: 'idNumber', t_label: '身份证' }, { t_props: 'idCard', t_label: '身份证' },
{ t_props: 'proName', t_label: '工程名称' }, { t_props: 'proName', t_label: '工程名称' },
{ t_props: 'subName', t_label: '分包名称' }, { t_props: 'subName', t_label: '分包名称' },
{ t_props: 'payMonth', t_label: '应发放月份' }, { t_props: 'failMonth', t_label: '应发放月份' },
{ t_props: 'payAmount', t_label: '应发金额' }, { t_props: 'money', t_label: '应发金额' },
{ t_props: 'failReason', t_label: '支付失败原因' }, { t_props: 'failReason', t_label: '支付失败原因' },
{ t_label: '状态', t_slot: 'status' }, { t_label: '状态', t_slot: 'failStatus' },
{ t_label: '附件', t_slot: 'attachment' }, { t_label: '附件', t_slot: 'fileSiz' },
{ t_props: 'remark', t_label: '备注' }, { t_props: 'remark', t_label: '备注' },
] ]
export const dialogConfig = { export const dialogConfig = {
outerVisible: false, outerVisible: false,
outerTitle: '', outerTitle: '',
outerWidth: '60%', outerWidth: '60%',
minHeight: 'auto', minHeight: 'auto',
maxHeight: '90vh', maxHeight: '90vh',
} }

View File

@ -10,20 +10,27 @@
:requestApi="getPaymentFailListAPI" :requestApi="getPaymentFailListAPI"
@sel-change="handleSelChange" @sel-change="handleSelChange"
> >
<template slot="status" slot-scope="{ data }"> <template slot="failStatus" slot-scope="{ data }">
<el-tag size="mini" type="danger" v-if="data.status === '0'"> <el-tag
size="mini"
type="danger"
v-if="data.failStatusString == '0'"
>
未处理 未处理
</el-tag> </el-tag>
<el-tag size="mini" type="success" v-if="data.status === '1'"> <el-tag
size="mini"
type="success"
v-if="data.failStatusString == '1'"
>
已处理 已处理
</el-tag> </el-tag>
</template> </template>
<template slot="attachment" slot-scope="{ data }"> <template slot="fileSiz" slot-scope="{ data }">
<span v-if="data.attachmentCount > 0"> <span>
{{ data.attachmentCount }} {{ data.fileSiz }}
</span> </span>
<span v-else>0</span>
</template> </template>
<template slot="btn" slot-scope="{ queryParams }"> <template slot="btn" slot-scope="{ queryParams }">
@ -100,6 +107,7 @@
<AddAndEditForm <AddAndEditForm
:formType="formType" :formType="formType"
:editId="editId" :editId="editId"
:editFormData="editFormData"
ref="addAndEditFormRef" ref="addAndEditFormRef"
/> />
@ -160,6 +168,7 @@ import {
getPaymentFailListAPI, getPaymentFailListAPI,
deletePaymentFailAPI, deletePaymentFailAPI,
importPaymentFailAPI, importPaymentFailAPI,
downloadTemplateAPI,
} from '@/api/synthesize-query/payment-fail' } from '@/api/synthesize-query/payment-fail'
import { import {
getLotProjectSelectListCommonFun, getLotProjectSelectListCommonFun,
@ -186,6 +195,7 @@ export default {
editId: '', // id editId: '', // id
importFileList: [], // importFileList: [], //
getPaymentFailListAPI, getPaymentFailListAPI,
editFormData: null, //
} }
}, },
methods: { methods: {
@ -193,7 +203,7 @@ export default {
onHandleExport(queryParams) { onHandleExport(queryParams) {
console.log(queryParams, '导出参数') console.log(queryParams, '导出参数')
this.download( this.download(
'/bmw/paymentFail/export', '/bmw/payFail/export',
{ {
...queryParams, ...queryParams,
}, },
@ -211,9 +221,37 @@ export default {
this.formType = type this.formType = type
if (type === 2) { if (type === 2) {
this.editId = data.id this.editId = data.id
const {
userName,
idCard,
proName,
subName,
failMonth,
money,
failReason,
fileList,
remark,
id,
failStatusString,
} = data
this.editFormData = {
userName,
idCard,
proName,
subName,
failMonth,
money,
failReason,
fileList,
remark,
id,
failStatusString,
}
this.dialogConfig.outerVisible = true this.dialogConfig.outerVisible = true
} else { } else {
this.editId = '' this.editId = ''
this.editFormData = null
this.dialogConfig.outerVisible = true this.dialogConfig.outerVisible = true
} }
}, },
@ -276,13 +314,29 @@ export default {
// //
async onHandleDownloadTemplate() { async onHandleDownloadTemplate() {
// try {
if (process.env.VUE_APP_ENV === 'production') { const res = await downloadTemplateAPI()
window.open( // 1. blob
window.origin + '/hd-realname' + '/支付失败人员-模版.xlsx', if (!res || !(res instanceof Blob)) {
) alert('模板下载失败,文件格式异常')
} else { return
window.open(window.origin + '/支付失败人员-模版.xlsx') }
// 2. BlobMIME
const blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
})
// 3.
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = '支付失败人员-模版.xlsx' //
document.body.appendChild(link)
link.click()
// 4.
document.body.removeChild(link)
URL.revokeObjectURL(link.href)
} catch (error) {
console.error('模板下载失败:', error)
alert('模板下载失败,请重试!')
} }
}, },