添加供应商审批功能
This commit is contained in:
parent
1afb46d3a5
commit
a022397634
|
|
@ -0,0 +1,72 @@
|
|||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/configSuppliersApply/nuConfigSuppliersApply/list',
|
||||
save='/configSuppliersApply/nuConfigSuppliersApply/add',
|
||||
edit='/configSuppliersApply/nuConfigSuppliersApply/edit',
|
||||
deleteOne = '/configSuppliersApply/nuConfigSuppliersApply/delete',
|
||||
deleteBatch = '/configSuppliersApply/nuConfigSuppliersApply/deleteBatch',
|
||||
importExcel = '/configSuppliersApply/nuConfigSuppliersApply/importExcel',
|
||||
exportXls = '/configSuppliersApply/nuConfigSuppliersApply/exportXls',
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '供应商名称',
|
||||
align: "center",
|
||||
dataIndex: 'suppliersName'
|
||||
},
|
||||
{
|
||||
title: '供应商性质',
|
||||
align: "center",
|
||||
dataIndex: 'suppliersNature_dictText'
|
||||
},
|
||||
{
|
||||
title: '供应商地址',
|
||||
align: "center",
|
||||
dataIndex: 'suppliersAddress'
|
||||
},
|
||||
{
|
||||
title: '负责人',
|
||||
align: "center",
|
||||
dataIndex: 'personInCharge'
|
||||
},
|
||||
{
|
||||
title: '联系电话',
|
||||
align: "center",
|
||||
dataIndex: 'contactNumber'
|
||||
},
|
||||
{
|
||||
title: '开户行',
|
||||
align: "center",
|
||||
dataIndex: 'openingBank'
|
||||
},
|
||||
{
|
||||
title: '开户行账号',
|
||||
align: "center",
|
||||
dataIndex: 'openingBankNo'
|
||||
},
|
||||
{
|
||||
title: '资质照片',
|
||||
align: "center",
|
||||
dataIndex: 'imgPath'
|
||||
},
|
||||
{
|
||||
title: '审核状态',
|
||||
align: "center",
|
||||
dataIndex: 'applyStatus',
|
||||
customRender: ({ text, record }) => {
|
||||
console.log(text);
|
||||
var applyStatus = ""
|
||||
if(text == '1'){
|
||||
applyStatus = "待审核"
|
||||
}else if(text == '2'){
|
||||
applyStatus = "审核通过"
|
||||
}else if(text == '3'){
|
||||
applyStatus = "审核未通过"
|
||||
}
|
||||
return applyStatus;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '审核备注',
|
||||
align: "center",
|
||||
dataIndex: 'applyContent'
|
||||
},
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
suppliersName: {title: '供应商名称',order: 0,view: 'text', type: 'string',},
|
||||
suppliersNature: {title: '供应商性质 1代理商 2批发商 3制造商',order: 1,view: 'text', type: 'string',},
|
||||
suppliersAddress: {title: '供应商地址',order: 2,view: 'text', type: 'string',},
|
||||
personInCharge: {title: '负责人',order: 3,view: 'text', type: 'string',},
|
||||
contactNumber: {title: '联系电话',order: 4,view: 'text', type: 'string',},
|
||||
supplyState: {title: '供应状态 1正常供应 2暂停供应',order: 5,view: 'text', type: 'string',},
|
||||
openingBank: {title: '开户行',order: 6,view: 'text', type: 'string',},
|
||||
openingBankNo: {title: '开户行账号',order: 7,view: 'text', type: 'string',},
|
||||
wechartId: {title: '微信账号',order: 8,view: 'text', type: 'string',},
|
||||
imgPath: {title: '资质照片',order: 9,view: 'text', type: 'string',},
|
||||
applyStatus: {title: '审核状态',order: 10,view: 'text', type: 'string',},
|
||||
applyContent: {title: '审核备注',order: 11,view: 'text', type: 'string',},
|
||||
};
|
||||
|
|
@ -0,0 +1,221 @@
|
|||
<template>
|
||||
<div class="p-2">
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<NuConfigSuppliersApplyModal ref="registerModal" @success="handleSuccess"></NuConfigSuppliersApplyModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="configSuppliersApply-nuConfigSuppliersApply" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns, superQuerySchema } from './NuConfigSuppliersApply.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuConfigSuppliersApply.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import NuConfigSuppliersApplyModal from './components/NuConfigSuppliersApplyModal.vue'
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
const userStore = useUserStore();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: 'nu_config_suppliers_apply',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "nu_config_suppliers_apply",
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs:24,
|
||||
sm:4,
|
||||
xl:6,
|
||||
xxl:4
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: 24,
|
||||
sm: 20,
|
||||
});
|
||||
|
||||
// 高级查询配置
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
/**
|
||||
* 高级查询事件
|
||||
*/
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).map((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '审核',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
ifShow: record.applyStatus == '1'
|
||||
},
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
auth: 'configSuppliersApply:nu_config_suppliers_apply:delete'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
padding: 0;
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
.ant-form-item:not(.ant-form-item-with-help){
|
||||
margin-bottom: 16px;
|
||||
height: 32px;
|
||||
}
|
||||
:deep(.ant-picker),:deep(.ant-input-number){
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<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>
|
||||
</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-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-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</a-spin>
|
||||
</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';
|
||||
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;
|
||||
}
|
||||
}
|
||||
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 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;
|
||||
}
|
||||
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,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
padding: 14px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<template>
|
||||
|
||||
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
|
||||
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
|
||||
<NuConfigSuppliersApplyForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuConfigSuppliersApplyForm>
|
||||
<template #footer>
|
||||
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
|
||||
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import NuConfigSuppliersApplyForm from './NuConfigSuppliersApplyForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<string>('80%');
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
Loading…
Reference in New Issue