可信代码库-企业认证驳回后编辑功能对接
This commit is contained in:
@@ -75,3 +75,11 @@ export function addEnterprise(params) {
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
export function updateEnterprise(params) {
|
||||
return request({
|
||||
url: `enterprise/update`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,6 +67,11 @@
|
||||
<span>申请企业认证</span>
|
||||
</template>
|
||||
</d-icon>
|
||||
<d-icon v-if="userInfo.enterpriseId&&enterpriseDetail?.auditStatus===2" class="font-normal" style="margin-right: 4px" name="classroom-post-results-large" operable @click="showModal(enterpriseDetail)">
|
||||
<template #suffix>
|
||||
<span>编辑企业认证</span>
|
||||
</template>
|
||||
</d-icon>
|
||||
<d-icon v-if="!isEdit" class="font-normal" name="edit" operable @click="editIconClick">
|
||||
<template #suffix>
|
||||
<span>编辑</span>
|
||||
@@ -343,7 +348,7 @@ const memberTableData = shallowRef<OrganizationMemberItemType[]>([]);
|
||||
|
||||
function showModal(row) {
|
||||
if (qyrzRef.value) {
|
||||
qyrzRef.value.open();
|
||||
qyrzRef.value.open(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
import { ref, nextTick,defineEmits } from 'vue';
|
||||
import NoData from '@/components/NoData/NoData.vue';
|
||||
import { Message } from 'vue-devui';
|
||||
import { addEnterprise } from '@/api/organizationManage/organizationManageApi';
|
||||
import { addEnterprise, updateEnterprise } from '@/api/organizationManage/organizationManageApi';
|
||||
import { uploadImage } from '@/api/jyh';
|
||||
import { useAccountStore } from '@/stores/user';
|
||||
|
||||
@@ -248,11 +248,17 @@ defineExpose({
|
||||
resetForm // 新增重置表单方法
|
||||
});
|
||||
|
||||
const qyId = ref('');
|
||||
// 打开模态框(支持传入初始数据)
|
||||
function open(initialData = {}) {
|
||||
debugger
|
||||
// 重置表单状态
|
||||
resetForm();
|
||||
|
||||
if(initialData.id) {
|
||||
qyId.value = initialData.id
|
||||
} else {
|
||||
qyId.value = '';
|
||||
}
|
||||
// 填充初始数据(如果有)
|
||||
if (Object.keys(initialData).length) {
|
||||
Object.assign(newFormData.value, initialData);
|
||||
@@ -270,6 +276,7 @@ function open(initialData = {}) {
|
||||
// 关闭模态框
|
||||
function close() {
|
||||
visible.value = false;
|
||||
qyId.value = '';
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
@@ -316,7 +323,27 @@ const handleConfirm = async () => {
|
||||
contactPhone: newFormData.value.contactPhone,
|
||||
businessLicenseUrl: newFormData.value.businessLicenseUrl,
|
||||
};
|
||||
|
||||
if(qyId.value) {
|
||||
try {
|
||||
// 调用编辑接口
|
||||
const response = await updateEnterprise({
|
||||
id: qyId.value,
|
||||
auditStatus: 0,
|
||||
...requestData
|
||||
});
|
||||
if (response.data.code === 200) {
|
||||
Message.success('企业认证编辑成功');
|
||||
close(); // 关闭模态框
|
||||
// 通知父组件刷新列表(可通过事件实现)
|
||||
emits('refresh');
|
||||
} else {
|
||||
Message.error(response.data.msg || '编辑失败,请重试');
|
||||
}
|
||||
} catch (error) {
|
||||
Message.error('网络请求失败,请检查网络连接');
|
||||
console.error('编辑接口异常:', error);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
// 调用新增接口
|
||||
const response = await addEnterprise(requestData);
|
||||
@@ -332,6 +359,7 @@ const handleConfirm = async () => {
|
||||
Message.error('网络请求失败,请检查网络连接');
|
||||
console.error('新增接口异常:', error);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 显示第一个错误字段的提示
|
||||
const firstError = Object.values(invalidFields)[0]?.[0]?.message;
|
||||
|
||||
Reference in New Issue
Block a user