供应商审核改为:审核驳回时必填审核原因

This commit is contained in:
1378012178@qq.com 2026-01-14 16:19:26 +08:00
parent 9f0d625d4b
commit fdd12f9edd
1 changed files with 208 additions and 196 deletions

View File

@ -2,71 +2,84 @@
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuConfigSuppliersApplyForm">
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
name="NuConfigSuppliersApplyForm">
<a-row>
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
<SectionDivider :title="'基本信息'" />
</a-col>
<a-col :span="8">
<a-form-item label="供应商名称" v-bind="validateInfos.suppliersName" id="NuConfigSuppliersApplyForm-suppliersName" name="suppliersName">
<a-input v-model:value="formData.suppliersName" placeholder="请输入供应商名称" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商性质" v-bind="validateInfos.suppliersNature_dictText" id="NuConfigSuppliersApplyForm-suppliersNature_dictText" name="suppliersNature_dictText">
<a-input v-model:value="formData.suppliersNature_dictText" placeholder="请输入供应商性质" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商地址" v-bind="validateInfos.suppliersAddress" id="NuConfigSuppliersApplyForm-suppliersAddress" name="suppliersAddress">
<a-input v-model:value="formData.suppliersAddress" placeholder="请输入供应商地址" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="负责人" v-bind="validateInfos.personInCharge" id="NuConfigSuppliersApplyForm-personInCharge" name="personInCharge">
<a-input v-model:value="formData.personInCharge" placeholder="请输入负责人" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="联系电话" v-bind="validateInfos.contactNumber" id="NuConfigSuppliersApplyForm-contactNumber" name="contactNumber">
<a-input v-model:value="formData.contactNumber" placeholder="请输入联系电话" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="开户行" v-bind="validateInfos.openingBank" id="NuConfigSuppliersApplyForm-openingBank" name="openingBank">
<a-input v-model:value="formData.openingBank" placeholder="请输入开户行" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="开户行账号" v-bind="validateInfos.openingBankNo" id="NuConfigSuppliersApplyForm-openingBankNo" name="openingBankNo">
<a-input v-model:value="formData.openingBankNo" placeholder="请输入开户行账号" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="资质照片" :labelCol="labelCol2" :wrapperCol="wrapperCol2" v-bind="validateInfos.imgPath" id="NuConfigSuppliersApplyForm-imgPath" name="imgPath">
<!-- <a-input v-model:value="formData.imgPath" placeholder="请输入资质照片" disabled ></a-input> -->
<j-image-upload v-if="formData.imgPath" :fileMax="1" :value="opeMediaAddress + formData.imgPath" disabled></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商名称" v-bind="validateInfos.suppliersName"
id="NuConfigSuppliersApplyForm-suppliersName" name="suppliersName">
<a-input v-model:value="formData.suppliersName" placeholder="请输入供应商名称" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商性质" v-bind="validateInfos.suppliersNature_dictText"
id="NuConfigSuppliersApplyForm-suppliersNature_dictText" name="suppliersNature_dictText">
<a-input v-model:value="formData.suppliersNature_dictText" placeholder="请输入供应商性质" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商地址" v-bind="validateInfos.suppliersAddress"
id="NuConfigSuppliersApplyForm-suppliersAddress" name="suppliersAddress">
<a-input v-model:value="formData.suppliersAddress" placeholder="请输入供应商地址" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="负责人" v-bind="validateInfos.personInCharge"
id="NuConfigSuppliersApplyForm-personInCharge" name="personInCharge">
<a-input v-model:value="formData.personInCharge" placeholder="请输入负责人" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="联系电话" v-bind="validateInfos.contactNumber"
id="NuConfigSuppliersApplyForm-contactNumber" name="contactNumber">
<a-input v-model:value="formData.contactNumber" placeholder="请输入联系电话" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="开户行" v-bind="validateInfos.openingBank" id="NuConfigSuppliersApplyForm-openingBank"
name="openingBank">
<a-input v-model:value="formData.openingBank" placeholder="请输入开户行" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="开户行账号" v-bind="validateInfos.openingBankNo"
id="NuConfigSuppliersApplyForm-openingBankNo" name="openingBankNo">
<a-input v-model:value="formData.openingBankNo" placeholder="请输入开户行账号" disabled></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="资质照片" :labelCol="labelCol2" :wrapperCol="wrapperCol2" v-bind="validateInfos.imgPath"
id="NuConfigSuppliersApplyForm-imgPath" name="imgPath">
<!-- <a-input v-model:value="formData.imgPath" placeholder="请输入资质照片" disabled ></a-input> -->
<j-image-upload v-if="formData.imgPath" :fileMax="1" :value="opeMediaAddress + formData.imgPath"
disabled></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
<SectionDivider :title="'审核信息'" />
</a-col>
<a-col :span="24">
<a-form-item label="审核状态" :labelCol="labelCol2" :wrapperCol="wrapperCol2" v-bind="validateInfos.applyStatus" id="NuConfigSuppliersApplyForm-applyStatus" name="applyStatus">
<!-- <a-input v-model:value="formData.applyStatus" placeholder="请输入审核状态" ></a-input> -->
<a-select v-model:value="formData.applyStatus" placeholder="请选择审核状态" style="width: 200px" :disabled="false">
<a-col :span="24">
<a-form-item label="审核状态" :labelCol="labelCol2" :wrapperCol="wrapperCol2"
v-bind="validateInfos.applyStatus" id="NuConfigSuppliersApplyForm-applyStatus" name="applyStatus">
<!-- <a-input v-model:value="formData.applyStatus" placeholder="请输入审核状态" ></a-input> -->
<a-select v-model:value="formData.applyStatus" placeholder="请选择审核状态" style="width: 200px"
:disabled="false">
<a-select-option value="1">待审核</a-select-option>
<a-select-option value="2">审核通过</a-select-option>
<a-select-option value="3">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="审核备注" :labelCol="labelCol2" :wrapperCol="wrapperCol2" v-bind="validateInfos.applyContent" id="NuConfigSuppliersApplyForm-applyContent" name="applyContent">
<!-- <a-input v-model:value="formData.applyContent" placeholder="请输入审核备注" ></a-input> -->
<a-textarea v-model:value="formData.applyContent" placeholder="请输入审核备注" rows="4" ></a-textarea>
</a-form-item>
</a-col>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="审核备注" :labelCol="labelCol2" :wrapperCol="wrapperCol2"
v-bind="validateInfos.applyContent" id="NuConfigSuppliersApplyForm-applyContent" name="applyContent">
<!-- <a-input v-model:value="formData.applyContent" placeholder="请输入审核备注" ></a-input> -->
<a-textarea v-model:value="formData.applyContent" placeholder="请输入审核备注" rows="4"></a-textarea>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
@ -75,158 +88,157 @@
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../NuConfigSuppliersApply.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../NuConfigSuppliersApply.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
const opeMediaAddress = import.meta.env.VITE_OPE_MEDIA_ADDRESS
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
suppliersName: '',
suppliersNature: '',
suppliersAddress: '',
personInCharge: '',
contactNumber: '',
supplyState: '',
openingBank: '',
openingBankNo: '',
wechartId: '',
imgPath: '',
applyStatus: '',
applyContent: '',
suppliersNature_dictText: '',
applyId: '',
suppliersId : '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 2 } });
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
applyContent: [{ required: true, message: '请输入审核备注!' }],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
suppliersName: '',
suppliersNature: '',
suppliersAddress: '',
personInCharge: '',
contactNumber: '',
supplyState: '',
openingBank: '',
openingBankNo: '',
wechartId: '',
imgPath: '',
applyStatus: '',
applyContent: '',
suppliersNature_dictText: '',
applyId: '',
suppliersId: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 2 } });
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
return Promise.reject(errorFields);
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
if (model.applyStatus == '1') {
createMessage.warning('请选择审核状态');
confirmLoading.value = false;
return;
}
if (model.applyStatus == 3 && !model.applyContent) {
createMessage.warning('请填写审核备注');
confirmLoading.value = false;
return;
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
if(model.applyStatus=='1'){
createMessage.warning('请选择审核状态');
confirmLoading.value = false;
return;
}
if(model.applyStatus=='3' && model.applyContent==''){
createMessage.warning('请填写审核备注');
confirmLoading.value = false;
return;
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
}
defineExpose({
add,
edit,
submitForm,
});
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 0px;
}
.antd-modal-form {
padding: 0px;
}
</style>