修改物料迁移功能

This commit is contained in:
yangjun 2025-08-06 15:58:08 +08:00
parent 47e4eeff30
commit d1c7735f7a
10 changed files with 616 additions and 28 deletions

View File

@ -10,7 +10,6 @@
<template v-else #title>
<slot name="title"></slot>
</template>
<ScrollContainer :style="getScrollContentStyle" v-loading="getLoading" :loading-tip="loadingText || t('common.loadingText')">
<slot></slot>
</ScrollContainer>
@ -103,10 +102,10 @@
// Custom implementation of the bottom button,
const getFooterHeight = computed(() => {
const { footerHeight, showFooter } = unref(getProps);
if (showFooter && footerHeight) {
// if (showFooter && footerHeight) {
return isNumber(footerHeight) ? `${footerHeight}px` : `${footerHeight.replace('px', '')}px`;
}
return `0px`;
// }
// return `0px`;
});
const getScrollContentStyle = computed((): CSSProperties => {

View File

@ -1,5 +1,5 @@
<template>
<div :class="prefixCls" :style="getStyle" v-if="showFooter || $slots.footer">
<div :class="prefixCls" :style="getStyle">
<template v-if="!$slots.footer">
<slot name="insertFooter"></slot>
<a-button v-bind="cancelButtonProps" @click="handleClose" class="mr-2" v-if="showCancelBtn">

View File

@ -7,6 +7,7 @@ enum Api {
list = '/invoicing/configMaterialInfo/list',
save='/invoicing/configMaterialInfo/add',
edit='/invoicing/configMaterialInfo/edit',
wlqianyi='/invoicing/configMaterialInfo/wlqianyi',
deleteOne = '/invoicing/configMaterialInfo/delete',
deleteBatch = '/invoicing/configMaterialInfo/deleteBatch',
importExcel = '/invoicing/configMaterialInfo/importExcel',
@ -70,3 +71,7 @@ export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}
export const wlqianyi = (params, isUpdate) => {
let url = Api.wlqianyi;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -85,10 +85,10 @@
<a-menu-item v-if="data.levle == '1'">
<a href="javascript:;" @click="handleAddbj(data)">添加本级</a>
</a-menu-item>
<a-menu-item v-if="data.levle == '1' || data.levle == '2'">
<a-menu-item v-if="(data.levle == '1' || data.levle == '2') && data.tjxj == 0">
<a href="javascript:;" @click="handleAddxj(data)">添加下级</a>
</a-menu-item>
<a-menu-item>
<a-menu-item v-if="data?.children?.length == 0">
<a href="javascript:;" @click="handleAdd(data)">添加物料</a>
</a-menu-item>
<a-menu-item>
@ -100,6 +100,9 @@
<a-menu-item v-if="data.izEnabled == '0'">
<a href="javascript:;" @click="handleQyty(data,'1')">停用</a>
</a-menu-item>
<a-menu-item v-if="data.levle == '2' || data.levle == '3'">
<a href="javascript:;" @click="handleQianyi(data)">迁移</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
@ -139,6 +142,8 @@
<ConfigMaterialCategoryModal ref="registerDrawer" @success="handleSuccess"></ConfigMaterialCategoryModal>
<ConfigMaterialTypeModal ref="registerTypeDrawer" @success="handleSuccess"></ConfigMaterialTypeModal>
<ConfigMaterialMedicationModal ref="registerMedicationDrawer" @success="handleSuccess"></ConfigMaterialMedicationModal>
<QianyiModal ref="qianyiDrawer" @success="handleSuccess"></QianyiModal>
<WlqianyiModal ref="wlqianyiDrawer" @success="handleSuccess"></WlqianyiModal>
</div>
</template>
@ -163,6 +168,9 @@
import ConfigMaterialCategoryModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue';
import ConfigMaterialTypeModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialTypeModal.vue';
import ConfigMaterialMedicationModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialMedicationModal.vue';
import QianyiModal from '/@/views/invoicing/ConfigMaterial/components/QianyiModal.vue';
import WlqianyiModal from '/@/views/invoicing/ConfigMaterial/components/WlqianyiModal.vue';
const formRef = ref();
const queryParam = reactive<any>({});
@ -183,6 +191,8 @@
const registerDrawer = ref();
const registerTypeDrawer = ref();
const registerMedicationDrawer = ref();
const qianyiDrawer = ref();
const wlqianyiDrawer = ref();
/**
* 点击菜单
@ -221,7 +231,7 @@ const getCardStyle = (index,allSize) => {
showIndexColumn: true,
showTableSetting: false,
actionColumn: {
width: 160,
width: 200,
fixed: 'right',
},
beforeFetch: async (params) => {
@ -260,20 +270,23 @@ const getCardStyle = (index,allSize) => {
};
function onSelect({ key, domEvent }) {
// console.log(ids);
// console.log(e);
// let id = ids[0];
queryParam.treeId =key;
reload();
}
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
//
function handleQianyi(record){
console.log("🚀 ~ handleQianyi ~ data:", record)
record.id = record.key
if(record.children.length > 0){
record.sfyxj = "1"
}else{
record.sfyxj = "0"
}
console.log("🚀 ~ handleQianyi ~ record:", record)
qianyiDrawer.value.disableSubmit = false;
qianyiDrawer.value.edit(record);
}
/**
@ -370,9 +383,17 @@ const getCardStyle = (index,allSize) => {
onClick: handleWlQyty.bind(null, record),
ifShow: record.izEnabled == 0
},
{
label: '迁移',
onClick: handleWlqianyi.bind(null, record),
},
];
}
function handleWlqianyi(record: Recordable) {
wlqianyiDrawer.value.disableSubmit = false;
wlqianyiDrawer.value.edit(record);
}
//
function handleWlQyty(record){
@ -448,13 +469,13 @@ const getCardStyle = (index,allSize) => {
var url = "";
//
if(levle == 1){
url = "/invoicing/configMaterialCategory/edit";
url = "/invoicing/configMaterialCategory/editQyty";
//
}else if(levle == 2){
url = "/invoicing/configMaterialType/edit";
url = "/invoicing/configMaterialType/editQyty";
//
}else if(levle == 3){
url = "/invoicing/configMaterialMedication/edit";
url = "/invoicing/configMaterialMedication/editQyty";
}else{
return;
}

View File

@ -5,18 +5,18 @@
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialInfoForm">
<a-row>
<a-col :span="8" hidden>
<a-form-item label="一级分类" v-bind="validateInfos.categoryId" id="ConfigMaterialInfoForm-categoryId" name="categoryId">
<j-dict-select-tag type='list' v-model:value="formData.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" placeholder="请选择一级分类" allow-clear @change="formData.typeId = null , formData.medicationId = null" />
<a-form-item label="一级分类" v-bind="validateInfos.categoryId" id="ConfigMaterialInfoForm-categoryId" name="categoryId">
<j-dict-select-tag type='list' v-model:value="formData.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" placeholder="请选择一级分类" allow-clear @change="formData.typeId = null , formData.medicationId = null" />
</a-form-item>
</a-col>
<a-col :span="8" hidden>
<a-form-item label="二级分类" v-bind="validateInfos.typeId" id="ConfigMaterialInfoForm-typeId" name="typeId">
<j-dict-select-tag type='list' v-model:value="formData.typeId" :dictCode="`nu_config_material_type,type_name,id,category_id = ${formData.categoryId || -1} and iz_enabled = 0 and del_flag = 0 `" placeholder="请选择二级分类" @change="formData.medicationId = null" allow-clear />
<a-form-item label="二级分类" v-bind="validateInfos.typeId" id="ConfigMaterialInfoForm-typeId" name="typeId">
<j-dict-select-tag type='list' v-model:value="formData.typeId" :dictCode="`nu_config_material_type,type_name,id,category_id = ${formData.categoryId || -1} and iz_enabled = 0 and del_flag = 0 `" placeholder="请选择二级分类" @change="formData.medicationId = null" allow-clear />
</a-form-item>
</a-col>
<a-col :span="8" hidden>
<a-form-item label="三级分类" v-bind="validateInfos.medicationId" id="ConfigMaterialInfoForm-medicationId" name="medicationId">
<j-dict-select-tag type='list' v-model:value="formData.medicationId" :dictCode="`nu_config_material_medication,medication_name,id,type_id = ${formData.typeId || -1} and iz_enabled = 0 and del_flag = 0`" placeholder="请选择三级分类" allow-clear />
<a-form-item label="三级分类" v-bind="validateInfos.medicationId" id="ConfigMaterialInfoForm-medicationId" name="medicationId">
<j-dict-select-tag type='list' v-model:value="formData.medicationId" :dictCode="`nu_config_material_medication,medication_name,id,type_id = ${formData.typeId || -1} and iz_enabled = 0 and del_flag = 0`" placeholder="请选择三级分类" allow-clear />
</a-form-item>
</a-col>
<a-col :span="8">

View File

@ -0,0 +1,196 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialMedicationForm">
<a-row>
<a-col :span="24" >
<a-form-item label="迁移至几级" v-bind="validateInfos.qycj" id="ConfigMaterialMedicationForm-qycj" name="qycj">
<j-dict-select-tag type='radio' v-model:value="formData.qycj" dictCode="multiUnitType" allow-clear/>
</a-form-item>
</a-col>
<a-col :span="24" v-show="formData.qycj=='1' || formData.qycj=='0'" >
<a-form-item label="一级分类" v-bind="validateInfos.categoryId" id="ConfigMaterialMedicationForm-categoryId" name="categoryId">
<j-dict-select-tag type='radio' v-model:value="formData.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" placeholder="请选择一级分类" allow-clear/>
</a-form-item>
</a-col>
<a-col :span="24" v-show="formData.qycj=='0'" >
<a-form-item label="二级分类" v-bind="validateInfos.typeId" id="ConfigMaterialMedicationForm-typeId" name="typeId">
<j-dict-select-tag type='radio' v-model:value="formData.typeId" :dictCode="`nu_config_material_type,type_name,id,iz_enabled = 0 and del_flag = 0 and category_id = ${formData.categoryId || -1}`" placeholder="请选择二级分类" allow-clear/>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
<a-modal v-model:visible="visible" title="迁移失败" width="400px">
<div style="padding: 20px;">
<p style="font-size: 16px;">您当前的分类包含下级不能迁移至三级分类请您重新选择或者请先将下级分类迁移至别的层级后再进行次操作</p>
</div>
<template #footer>
<a-button @click="visible = false">取消</a-button>
</template>
</a-modal>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted,onUnmounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../ConfigMaterialMedication.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import { e } from 'unocss';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const visible = ref<boolean>(false);
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
categoryId: '',
typeId: '',
qycj: '',
levle: '',
sfyxj: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
qycj: [{ required: true, message: '请选择您要迁入到第几层级!'},],
});
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(record) {
edit(record);
}
/**
* 编辑
*/
function edit(record) {
console.log("🚀 ~ edit ~ record:", record)
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
formData.categoryId = record.categoryId;
if(record.levle == '1'){
formData.qycj = '2';
}else if(record.levle == '2'){
formData.qycj = '1';
}else if(record.levle == '3'){
formData.qycj = '0';
}
console.log("🚀 ~ edit ~ formData:", formData)
});
}
/**
* 提交数据
*/
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(',');
}
}
}
console.log("🚀 ~ submitForm ~ model:", model)
confirmLoading.value = false;
if(model.qycj == '2'){//
model.categoryId = "";
model.typeId = "";
}else if(model.qycj == '1'){//
model.typeId = "";
if(!model.categoryId){
createMessage.success("请选择一级分类!");
return;
}
}else{
if(model.sfyxj == '1'){
visible.value = true;
return;
}
if(!model.categoryId){
createMessage.success("请选择一级分类!");
return;
}
if(!model.typeId){
createMessage.success("请选择二级分类!");
return;
}
}
defHttp.post({ url: '/invoicing/configMaterialMedication/editQianyi', params: model }).then((res) => {
emit('ok');
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,83 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
<QianyiForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></QianyiForm>
<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 QianyiForm from './QianyiForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<number>(800);
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 = '迁移';
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>

View File

@ -0,0 +1,201 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialInfoForm">
<a-row>
<a-col :span="24">
<a-form-item label="货品名称" v-bind="validateInfos.materialName" id="ConfigMaterialInfoForm-materialName" name="materialName">
<a-input v-model:value="formData.materialName" placeholder="请输入货品名称" maxlength="20" allow-clear disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="24" >
<a-form-item label="一级分类" v-bind="validateInfos.categoryId" id="ConfigMaterialInfoForm-categoryId" name="categoryId">
<j-dict-select-tag type='radio' v-model:value="formData.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" placeholder="请选择一级分类" allow-clear @change="formData.typeId = null , formData.medicationId = null" />
</a-form-item>
</a-col>
<a-col :span="24" >
<a-form-item label="二级分类" v-bind="validateInfos.typeId" id="ConfigMaterialInfoForm-typeId" name="typeId">
<j-dict-select-tag type='radio' v-model:value="formData.typeId" :dictCode="`nu_config_material_type,type_name,id,category_id = ${formData.categoryId || -1} and iz_enabled = 0 and del_flag = 0 `" placeholder="请选择二级分类" @change="formData.medicationId = null" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24" >
<a-form-item label="三级分类" v-bind="validateInfos.medicationId" id="ConfigMaterialInfoForm-medicationId" name="medicationId">
<j-dict-select-tag type='radio' v-model:value="formData.medicationId" :dictCode="`nu_config_material_medication,medication_name,id,type_id = ${formData.typeId || -1} and iz_enabled = 0 and del_flag = 0`" placeholder="请选择三级分类" allow-clear />
</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 JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSwitch from '/@/components/Form/src/jeecg/components/JSwitch.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getValueType } from '/@/utils';
import { wlqianyi } from '../ConfigMaterialInfo.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
import { duplicateValidate } from '/@/utils/helper/validator'
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: '',
categoryId: '',
typeId: '',
medicationId: '',
materialName: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
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(record) {
edit(record);
}
/**
* 编辑
*/
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(',');
}
}
}
confirmLoading.value = false;
console.log(model);
if(!model.categoryId){
createMessage.error('请选择一级分类');
return;
}
let sfjx = 0;
if(!model.typeId){
await defHttp.get({ url: "/invoicing/configMaterialType/list", params: {categoryId:model.categoryId} }).then(res=>{
console.log("🚀 ~111 submitForm ~ res:", res)
var list = res.records;
console.log("🚀 ~ submitForm ~ list.length:", list.length)
if(list.length>0){
createMessage.error("请选择二级分类");
sfjx = 1;
return;
}
});
}
if(model.typeId && !model.medicationId){
await defHttp.get({ url: "/invoicing/configMaterialMedication/list", params: {typeId:model.typeId} }).then(res=>{
console.log("🚀 ~222 submitForm ~ res:", res)
var list = res.records;
if(list.length>0){
createMessage.error("请选择三级分类");
sfjx = 1;
return;
}
});
}
if(sfjx == 0){
await wlqianyi(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>

View File

@ -0,0 +1,82 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
<WlqianyiForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></WlqianyiForm>
<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 WlqianyiForm from './WlqianyiForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add(record) {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add(record);
});
}
/**
* 编辑
* @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>

View File

@ -6,6 +6,7 @@
:width="adaptiveWidth"
@ok="handleSubmit"
:showFooter="showFooter"
:showOkBtn="showFooter"
destroyOnClose
>
<BasicForm @register="registerForm" />