修改物料迁移功能
This commit is contained in:
parent
47e4eeff30
commit
d1c7735f7a
|
@ -10,7 +10,6 @@
|
||||||
<template v-else #title>
|
<template v-else #title>
|
||||||
<slot name="title"></slot>
|
<slot name="title"></slot>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<ScrollContainer :style="getScrollContentStyle" v-loading="getLoading" :loading-tip="loadingText || t('common.loadingText')">
|
<ScrollContainer :style="getScrollContentStyle" v-loading="getLoading" :loading-tip="loadingText || t('common.loadingText')">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</ScrollContainer>
|
</ScrollContainer>
|
||||||
|
@ -103,10 +102,10 @@
|
||||||
// Custom implementation of the bottom button,
|
// Custom implementation of the bottom button,
|
||||||
const getFooterHeight = computed(() => {
|
const getFooterHeight = computed(() => {
|
||||||
const { footerHeight, showFooter } = unref(getProps);
|
const { footerHeight, showFooter } = unref(getProps);
|
||||||
if (showFooter && footerHeight) {
|
// if (showFooter && footerHeight) {
|
||||||
return isNumber(footerHeight) ? `${footerHeight}px` : `${footerHeight.replace('px', '')}px`;
|
return isNumber(footerHeight) ? `${footerHeight}px` : `${footerHeight.replace('px', '')}px`;
|
||||||
}
|
// }
|
||||||
return `0px`;
|
// return `0px`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const getScrollContentStyle = computed((): CSSProperties => {
|
const getScrollContentStyle = computed((): CSSProperties => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="prefixCls" :style="getStyle" v-if="showFooter || $slots.footer">
|
<div :class="prefixCls" :style="getStyle">
|
||||||
<template v-if="!$slots.footer">
|
<template v-if="!$slots.footer">
|
||||||
<slot name="insertFooter"></slot>
|
<slot name="insertFooter"></slot>
|
||||||
<a-button v-bind="cancelButtonProps" @click="handleClose" class="mr-2" v-if="showCancelBtn">
|
<a-button v-bind="cancelButtonProps" @click="handleClose" class="mr-2" v-if="showCancelBtn">
|
||||||
|
|
|
@ -7,6 +7,7 @@ enum Api {
|
||||||
list = '/invoicing/configMaterialInfo/list',
|
list = '/invoicing/configMaterialInfo/list',
|
||||||
save='/invoicing/configMaterialInfo/add',
|
save='/invoicing/configMaterialInfo/add',
|
||||||
edit='/invoicing/configMaterialInfo/edit',
|
edit='/invoicing/configMaterialInfo/edit',
|
||||||
|
wlqianyi='/invoicing/configMaterialInfo/wlqianyi',
|
||||||
deleteOne = '/invoicing/configMaterialInfo/delete',
|
deleteOne = '/invoicing/configMaterialInfo/delete',
|
||||||
deleteBatch = '/invoicing/configMaterialInfo/deleteBatch',
|
deleteBatch = '/invoicing/configMaterialInfo/deleteBatch',
|
||||||
importExcel = '/invoicing/configMaterialInfo/importExcel',
|
importExcel = '/invoicing/configMaterialInfo/importExcel',
|
||||||
|
@ -70,3 +71,7 @@ export const saveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
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 });
|
||||||
|
}
|
||||||
|
|
|
@ -85,10 +85,10 @@
|
||||||
<a-menu-item v-if="data.levle == '1'">
|
<a-menu-item v-if="data.levle == '1'">
|
||||||
<a href="javascript:;" @click="handleAddbj(data)">添加本级</a>
|
<a href="javascript:;" @click="handleAddbj(data)">添加本级</a>
|
||||||
</a-menu-item>
|
</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 href="javascript:;" @click="handleAddxj(data)">添加下级</a>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item>
|
<a-menu-item v-if="data?.children?.length == 0">
|
||||||
<a href="javascript:;" @click="handleAdd(data)">添加物料</a>
|
<a href="javascript:;" @click="handleAdd(data)">添加物料</a>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
<a-menu-item>
|
<a-menu-item>
|
||||||
|
@ -100,6 +100,9 @@
|
||||||
<a-menu-item v-if="data.izEnabled == '0'">
|
<a-menu-item v-if="data.izEnabled == '0'">
|
||||||
<a href="javascript:;" @click="handleQyty(data,'1')">停用</a>
|
<a href="javascript:;" @click="handleQyty(data,'1')">停用</a>
|
||||||
</a-menu-item>
|
</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>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
|
@ -139,6 +142,8 @@
|
||||||
<ConfigMaterialCategoryModal ref="registerDrawer" @success="handleSuccess"></ConfigMaterialCategoryModal>
|
<ConfigMaterialCategoryModal ref="registerDrawer" @success="handleSuccess"></ConfigMaterialCategoryModal>
|
||||||
<ConfigMaterialTypeModal ref="registerTypeDrawer" @success="handleSuccess"></ConfigMaterialTypeModal>
|
<ConfigMaterialTypeModal ref="registerTypeDrawer" @success="handleSuccess"></ConfigMaterialTypeModal>
|
||||||
<ConfigMaterialMedicationModal ref="registerMedicationDrawer" @success="handleSuccess"></ConfigMaterialMedicationModal>
|
<ConfigMaterialMedicationModal ref="registerMedicationDrawer" @success="handleSuccess"></ConfigMaterialMedicationModal>
|
||||||
|
<QianyiModal ref="qianyiDrawer" @success="handleSuccess"></QianyiModal>
|
||||||
|
<WlqianyiModal ref="wlqianyiDrawer" @success="handleSuccess"></WlqianyiModal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -163,6 +168,9 @@
|
||||||
import ConfigMaterialCategoryModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue';
|
import ConfigMaterialCategoryModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue';
|
||||||
import ConfigMaterialTypeModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialTypeModal.vue';
|
import ConfigMaterialTypeModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialTypeModal.vue';
|
||||||
import ConfigMaterialMedicationModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialMedicationModal.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 formRef = ref();
|
||||||
const queryParam = reactive<any>({});
|
const queryParam = reactive<any>({});
|
||||||
|
@ -183,6 +191,8 @@
|
||||||
const registerDrawer = ref();
|
const registerDrawer = ref();
|
||||||
const registerTypeDrawer = ref();
|
const registerTypeDrawer = ref();
|
||||||
const registerMedicationDrawer = ref();
|
const registerMedicationDrawer = ref();
|
||||||
|
const qianyiDrawer = ref();
|
||||||
|
const wlqianyiDrawer = ref();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击菜单
|
* 点击菜单
|
||||||
|
@ -221,7 +231,7 @@ const getCardStyle = (index,allSize) => {
|
||||||
showIndexColumn: true,
|
showIndexColumn: true,
|
||||||
showTableSetting: false,
|
showTableSetting: false,
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 160,
|
width: 200,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
},
|
},
|
||||||
beforeFetch: async (params) => {
|
beforeFetch: async (params) => {
|
||||||
|
@ -260,20 +270,23 @@ const getCardStyle = (index,allSize) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
function onSelect({ key, domEvent }) {
|
function onSelect({ key, domEvent }) {
|
||||||
// console.log(ids);
|
|
||||||
// console.log(e);
|
|
||||||
// let id = ids[0];
|
|
||||||
queryParam.treeId =key;
|
queryParam.treeId =key;
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 高级查询事件
|
//迁移
|
||||||
*/
|
function handleQianyi(record){
|
||||||
function handleSuperQuery(params) {
|
console.log("🚀 ~ handleQianyi ~ data:", record)
|
||||||
Object.keys(params).map((k) => {
|
record.id = record.key
|
||||||
queryParam[k] = params[k];
|
if(record.children.length > 0){
|
||||||
});
|
record.sfyxj = "1"
|
||||||
searchQuery();
|
}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),
|
onClick: handleWlQyty.bind(null, record),
|
||||||
ifShow: record.izEnabled == 0
|
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){
|
function handleWlQyty(record){
|
||||||
|
@ -448,13 +469,13 @@ const getCardStyle = (index,allSize) => {
|
||||||
var url = "";
|
var url = "";
|
||||||
//一级分类
|
//一级分类
|
||||||
if(levle == 1){
|
if(levle == 1){
|
||||||
url = "/invoicing/configMaterialCategory/edit";
|
url = "/invoicing/configMaterialCategory/editQyty";
|
||||||
//二级分类
|
//二级分类
|
||||||
}else if(levle == 2){
|
}else if(levle == 2){
|
||||||
url = "/invoicing/configMaterialType/edit";
|
url = "/invoicing/configMaterialType/editQyty";
|
||||||
//三级分类
|
//三级分类
|
||||||
}else if(levle == 3){
|
}else if(levle == 3){
|
||||||
url = "/invoicing/configMaterialMedication/edit";
|
url = "/invoicing/configMaterialMedication/editQyty";
|
||||||
}else{
|
}else{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialInfoForm">
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialInfoForm">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="8" hidden>
|
<a-col :span="8" hidden>
|
||||||
<a-form-item label="一级级分类" v-bind="validateInfos.categoryId" id="ConfigMaterialInfoForm-categoryId" name="categoryId">
|
<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" />
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8" hidden>
|
<a-col :span="8" hidden>
|
||||||
<a-form-item label="二级级分类" v-bind="validateInfos.typeId" id="ConfigMaterialInfoForm-typeId" name="typeId">
|
<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 />
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8" hidden>
|
<a-col :span="8" hidden>
|
||||||
<a-form-item label="三级级分类" v-bind="validateInfos.medicationId" id="ConfigMaterialInfoForm-medicationId" name="medicationId">
|
<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 />
|
<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-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -6,6 +6,7 @@
|
||||||
:width="adaptiveWidth"
|
:width="adaptiveWidth"
|
||||||
@ok="handleSubmit"
|
@ok="handleSubmit"
|
||||||
:showFooter="showFooter"
|
:showFooter="showFooter"
|
||||||
|
:showOkBtn="showFooter"
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
>
|
>
|
||||||
<BasicForm @register="registerForm" />
|
<BasicForm @register="registerForm" />
|
||||||
|
|
Loading…
Reference in New Issue