完善接口调试

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) {
return request({
url: '/bmw/paymentFail/list',
method: 'GET',
params: data,
})
return request({
url: '/bmw/payFail/getPageList',
method: 'GET',
params: data,
})
}
// 新增支付失败人员
export function addPaymentFailAPI(data) {
return requestFormData({
url: '/bmw/paymentFail/add',
method: 'POST',
data,
})
return requestFormData({
url: '/bmw/payFail/addData',
method: 'POST',
data,
})
}
// 修改支付失败人员
export function updatePaymentFailAPI(data) {
return requestFormData({
url: '/bmw/paymentFail/update',
method: 'POST',
data,
})
return requestFormData({
url: '/bmw/payFail/updateData',
method: 'POST',
data,
})
}
// 删除支付失败人员
export function deletePaymentFailAPI(data) {
return request({
url: '/bmw/paymentFail/delete',
method: 'POST',
data,
})
return request({
url: '/bmw/payFail/delData',
method: 'POST',
data,
})
}
// 获取支付失败人员详情
export function getPaymentFailDetailAPI(id) {
return request({
url: `/bmw/paymentFail/detail/${id}`,
method: 'GET',
})
return request({
url: `/bmw/payFail/detail/${id}`,
method: 'GET',
})
}
// 导入支付失败数据
export function importPaymentFailAPI(data) {
return requestFormData({
url: '/bmw/paymentFail/import',
method: 'POST',
data,
})
return requestFormData({
url: '/bmw/payFail/importFile',
method: 'POST',
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
async handleSelChange(e, val) {
console.log(e, val, '996')
console.log(['proId', 'subId', 'teamId'].includes(val), '996')
if (['proId', 'subId', 'teamId'].includes(val)) {
this.queryDownloadTask[val] = e
}
@ -227,7 +225,7 @@ export default {
proId: e,
})
this.formLabel[1].f_selList = subList.map((item) => {
this.formLabel[1].f_selList = subList.rows?.map((item) => {
return {
value: item.id,
label: item.subName,
@ -239,7 +237,7 @@ export default {
subId: e,
})
this.formLabel[2].f_selList = teamList.map((item) => {
this.formLabel[2].f_selList = teamList.rows?.map((item) => {
return {
value: item.id,
label: item.teamName,
@ -273,11 +271,12 @@ export default {
}
})
const subList = await getSubSelectListCommonFun({
const subList = await getSubSelectListAPI({
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 {
value: item.id,
label: item.subName,

View File

@ -623,6 +623,7 @@ import {
getLotProjectSelectListByConditionAPI,
} from '@/api/common'
import { getPostTypeSelectListCommonFun } from '@/utils/getCommonData'
import { isPaymentFailAPI } from '@/api/synthesize-query/payment-fail'
export default {
name: 'AddOrEditForm',
dicts: ['salary'],
@ -1660,7 +1661,7 @@ export default {
},
//
onBlurIdNumber() {
async onBlurIdNumber() {
// if (!this.idCardInfoForm.idNumber) return
//
const birthday = this.idCardInfoForm.idNumber.slice(6, 14)
@ -1677,7 +1678,21 @@ export default {
const age = new Date().getFullYear() - birthday.slice(0, 4)
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,
})
this.formLabel[4].f_selList = subList.map((item) => {
this.formLabel[4].f_selList = subList.rows?.map((item) => {
return {
value: item.id,
label: item.subName,
@ -589,7 +589,11 @@ export default {
const teamList = await getTeamSelectListAPI({
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 {
value: item.id,
label: item.teamName,

View File

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

View File

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

View File

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

View File

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