This commit is contained in:
1378012178@qq.com 2025-07-23 08:39:17 +08:00
commit b1d6bf3b7b
17 changed files with 498 additions and 289 deletions

View File

@ -6,8 +6,8 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :lg="6"> <a-col :lg="6">
<a-form-item name="nuName"> <a-form-item name="nuName">
<template #label><span title="区域信息名称">区域信息名称</span></template> <template #label><span title="区域名称">区域名称</span></template>
<j-input placeholder="请输入区域信息名称" v-model:value="queryParam.nuName" allow-clear ></j-input> <j-input placeholder="请输入区域名称" v-model:value="queryParam.nuName" allow-clear ></j-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <a-col :lg="6">

View File

@ -6,14 +6,14 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :lg="6"> <a-col :lg="6">
<a-form-item name="categoryId"> <a-form-item name="categoryId">
<template #label><span title="物料类别">物料类别</span></template> <template #label><span title="一级分类">一级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择物料类别" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择一级分类" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <a-col :lg="6">
<a-form-item name="typeId"> <a-form-item name="typeId">
<template #label><span title="物料类型">物料类型</span></template> <template #label><span title="二级分类">二级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择物料类别" v-model:value="queryParam.typeId" :dictCode="`nu_config_material_type,type_name,id,iz_enabled = 0 and del_flag = 0 and category_id = ${queryParam.categoryId || -1}`" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择二级分类" v-model:value="queryParam.typeId" :dictCode="`nu_config_material_type,type_name,id,iz_enabled = 0 and del_flag = 0 and category_id = ${queryParam.categoryId || -1}`" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :sm="24"> <a-col :lg="6" :sm="24">
@ -27,60 +27,120 @@
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<!--引用表格--> <div style="width: 100%;">
<BasicTable @register="registerTable" > <div style="width: 300px;float: left; white;">
<!--插槽:table标题--> <div style="background: white; border-radius: 8px;padding: 8px;margin-right: 8px;min-height: 400px;">
<template #tableTitle> <div style="width:100%;text-align: right;" v-if="treeData.length == 0">
<a-button type="primary" v-auth="'ConfigMaterial:config_material_category:add'" @click="handleCategoryAdd" preIcon="ant-design:plus-outlined"> 物料类别</a-button> <a-button type="primary" v-auth="'ConfigMaterial:config_material_category:add'" @click="handleAddbj({levle:'1'})" preIcon="ant-design:plus-outlined"> 一级分类</a-button>
<a-button type="primary" v-auth="'ConfigMaterial:config_material_type:add'" @click="handleTypeAdd" preIcon="ant-design:plus-outlined"> 物料类型</a-button> </div>
<a-button type="primary" v-auth="'ConfigMaterial:config_material_medication:add'" @click="handleMedicationAdd" preIcon="ant-design:plus-outlined"> 用药类型</a-button> <a-tree class="draggable-tree" draggable block-node :tree-data="treeData" >
</template> <template #title="{ data,title }">
<!--字段回显插槽--> <div @mouseenter="data.showContent = true" @mouseleave="data.showContent = false">
<template v-slot:bodyCell="{ column, record, index, text }"> <span @click="handleSearch(data)">{{title}}</span>
</template> <span v-if="data?.izEnabled == '1'" style="color:red;">(已停用)</span>
</BasicTable> <span v-show="data.showContent" style="margin-left: 5px;">
<!-- 表单区域 --> <!-- 下拉菜单 -->
<ConfigMaterialCategoryListModal @register="registerDrawer" @success="handleSuccess"></ConfigMaterialCategoryListModal> <a-dropdown>
<ConfigMaterialTypeListModal @register="registerTypeDrawer" @success="handleSuccess"></ConfigMaterialTypeListModal> <a class="ant-dropdown-link" @click.prevent>
<ConfigMaterialMedicationListModal @register="registerMedicationDrawer" @success="handleSuccess"></ConfigMaterialMedicationListModal> <Icon icon="ant-design:setting-outlined" />
</a>
<template #overlay>
<a-menu>
<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 href="javascript:;" @click="handleAddxj(data)">添加下级</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="handleEdit(data)">编辑</a>
</a-menu-item>
<a-menu-item v-if="data.izEnabled == '1'">
<a href="javascript:;" @click="handleQyty(data,'0')">启用</a>
</a-menu-item>
<a-menu-item v-if="data.izEnabled == '0'">
<a href="javascript:;" @click="handleQyty(data,'1')">停用</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
</div>
</template>
</a-tree>
</div>
</div>
<div style="width: calc(100% - 300px);float: left;">
<!--引用表格-->
<BasicTable @register="registerTable" >
</BasicTable>
</div>
</div>
<ConfigMaterialCategoryModal ref="registerDrawer" @success="handleSuccess"></ConfigMaterialCategoryModal>
<ConfigMaterialTypeModal ref="registerTypeDrawer" @success="handleSuccess"></ConfigMaterialTypeModal>
<ConfigMaterialMedicationModal ref="registerMedicationDrawer" @success="handleSuccess"></ConfigMaterialMedicationModal>
</div> </div>
</template> </template>
<script lang="ts" name="ConfigMaterial-configMaterialCategory" setup> <script lang="ts" name="ConfigMaterial-configMaterialCategory" setup>
import {ref, reactive, computed, unref} from 'vue'; import {ref, reactive, computed, unref, onMounted} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table'; import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal'; import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage' import { useListPage } from '/@/hooks/system/useListPage'
import ConfigMaterialCategoryModal from './components/ConfigMaterialCategoryModal.vue' // import ConfigMaterialCategoryModal from './components/ConfigMaterialCategoryModal.vue'
import {allColumns, searchFormSchema, superQuerySchema} from './ConfigMaterialCategory.data'; import {allColumns, searchFormSchema, superQuerySchema} from './ConfigMaterialCategory.data';
import {selectMaterialList, deleteOne, batchDelete, getImportUrl,getExportUrl} from './ConfigMaterialCategory.api'; import {selectMaterialList, deleteOne, batchDelete, getImportUrl,getExportUrl} from './ConfigMaterialCategory.api';
import { downloadFile } from '/@/utils/common/renderUtils'; import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue'; import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
import ConfigMaterialCategoryListModal from '/@/views/invoicing/ConfigMaterial/ConfigMaterialCategoryListModal.vue';
import ConfigMaterialTypeListModal from '/@/views/invoicing/ConfigMaterial/ConfigMaterialTypeListModal.vue';
import ConfigMaterialMedicationListModal from '/@/views/invoicing/ConfigMaterial/ConfigMaterialMedicationListModal.vue'; import ConfigMaterialCategoryModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue';
import { useDrawer } from '/@/components/Drawer'; import ConfigMaterialTypeModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialTypeModal.vue';
import ConfigMaterialMedicationModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialMedicationModal.vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { defHttp } from '/@/utils/http/axios';
import { useDrawer } from '/@/components/Drawer';
const formRef = ref(); const formRef = ref();
const queryParam = reactive<any>({}); const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]); const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore(); const userStore = useUserStore();
const registerDrawer = ref();
const registerTypeDrawer = ref();
const registerMedicationDrawer = ref();
//model //model
const [registerModal, {openModal}] = useModal(); // const [registerModal, {openModal}] = useModal();
//drawer //drawer
const [registerDrawer, { openDrawer:openCategoryDrawer }] = useDrawer(); // const [registerDrawer, { openDrawer:openCategoryDrawer }] = useDrawer();
const [registerTypeDrawer, { openDrawer: openTypeDrawer }] = useDrawer(); // const [registerTypeDrawer, { openDrawer: openTypeDrawer }] = useDrawer();
const [registerMedicationDrawer, { openDrawer:openMedicationDrawer }] = useDrawer(); // const [registerMedicationDrawer, { openDrawer:openMedicationDrawer }] = useDrawer();
const treeData = ref<any>([]);
// node hover
const menuState = reactive<Record<string, { timer?: number, openedByClick: boolean, open: boolean }>>({
})
//table //table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{ tableProps:{
title: '物料类别', // title: '',
api: selectMaterialList, api: selectMaterialList,
columns: allColumns, columns: allColumns,
canResize:false, canResize:false,
showActionColumn: false, showActionColumn: false,
showIndexColumn: true, showIndexColumn: true,
showTableSetting: false,
formConfig: { formConfig: {
//labelWidth: 120, //labelWidth: 120,
schemas: searchFormSchema, schemas: searchFormSchema,
@ -103,45 +163,99 @@
}) })
const labelCol = reactive({ const labelCol = reactive({
xs:24, xs:24,
sm:4, sm:8,
xl:6, xl:8,
xxl:4 xxl:8
}); });
const wrapperCol = reactive({ const wrapperCol = reactive({
xs: 24, xs: 24,
sm: 20, sm: 16,
}); });
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
function handleSearch(data){
var levle = parseInt(data.levle)
// if(levle == 1){
function handleCategoryAdd(){ queryParam.categoryId = data.key
openCategoryDrawer(true, { queryParam.typeId = ''
isUpdate: false, queryParam.medicationId = ''
showFooter: false, }else if(levle == 2){
tenantSaas: false, queryParam.categoryId = data.categoryId
}); queryParam.typeId = data.key
queryParam.medicationId = ''
}else if(levle == 3){
queryParam.categoryId = data.categoryId
queryParam.typeId = data.typeId
queryParam.medicationId = data.key
}
reload();
}
//
function handleAddbj(data){
// var params = {id:data.key,level:1,title:data.title}
var params = {}
registerDrawer.value.disableSubmit = false;
registerDrawer.value.edit(params);
}
//
function handleAddxj(data){
var levle = parseInt(data.levle)+1;
var params = {levle,categoryId:data.categoryId,typeId:data.typeId}
if(data.levle == 1){
registerTypeDrawer.value.disableSubmit = false;
registerTypeDrawer.value.edit(params);
}else if(data.levle == 2){
registerMedicationDrawer.value.disableSubmit = false;
registerMedicationDrawer.value.edit(params);
}
}
//
function handleEdit(data){
console.log("🚀 ~ handleEdit ~ data:", data)
const params = {id:data.key,categoryId:data.categoryId,typeId:data.typeId,}
if(data.levle == 1){
params.categoryName = data.title
registerDrawer.value.disableSubmit = false;
registerDrawer.value.edit(params);
}else if(data.levle == 2){
params.typeName = data.title
console.log("🚀 ~ handleEdit ~ params:", params)
registerTypeDrawer.value.disableSubmit = false;
registerTypeDrawer.value.edit(params);
}else if(data.levle == 3){
params.medicationName = data.title
console.log("🚀 ~ handleEdit ~ params:", params)
registerMedicationDrawer.value.disableSubmit = false;
registerMedicationDrawer.value.edit(params);
}
}
//
function handleQyty(data,type){
console.log("🚀 ~ handleQyty ~ data:", data)
var levle = data.levle;
var params = {id:data.key,izEnabled:type}
var url = "";
//
if(levle == 1){
url = "/invoicing/configMaterialCategory/edit";
//
}else if(levle == 2){
url = "/invoicing/configMaterialType/edit";
//
}else if(levle == 3){
url = "/invoicing/configMaterialMedication/edit";
}else{
return;
}
defHttp.post({url:url,params}).then(res =>{
console.log("🚀 ~ defHttp.post ~ res:", res)
reload();
getTreeData();
})
} }
//
function handleTypeAdd(){
openTypeDrawer(true, {
isUpdate: false,
showFooter: false,
tenantSaas: false,
});
}
//
function handleMedicationAdd(){
openMedicationDrawer(true, {
isUpdate: false,
showFooter: false,
tenantSaas: false,
});
}
/** /**
* 查询 * 查询
@ -161,8 +275,26 @@
} }
function handleSuccess(){ function handleSuccess(){
searchQuery() getTreeData();
searchQuery();
} }
function getTreeData(){
defHttp.get({url:'/invoicing/configMaterialCategory/getMaterialTreeData'}).then(res =>{
treeData.value = res;
// console.log("🚀 ~ defHttp.get ~ treeData:", treeData)
// console.log("🚀 ~ defHttp.get ~ res:", res)
// if(treeData.value.length > 0){
// treeChildData.value = treeData.value[0].children;
// }
})
}
//
onMounted(() => {
getTreeData()
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -6,7 +6,7 @@ import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '物料类别名称', title: '一级分类',
align:"center", align:"center",
dataIndex: 'categoryName' dataIndex: 'categoryName'
}, },
@ -19,27 +19,27 @@ export const columns: BasicColumn[] = [
export const allColumns: BasicColumn[] = [ export const allColumns: BasicColumn[] = [
{ {
title: '物料类别名称', title: '一级分类',
align:"center", align:"center",
dataIndex: 'categoryName', dataIndex: 'categoryName',
customCell: (record, index, column) => { // customCell: (record, index, column) => {
if (record.categoryRowSpan != null) { // if (record.categoryRowSpan != null) {
return { rowSpan: record.categoryRowSpan }; // return { rowSpan: record.categoryRowSpan };
} // }
}, // },
}, },
{ {
title: '物料类型名称', title: '二级分类',
align:"center", align:"center",
dataIndex: 'typeName', dataIndex: 'typeName',
customCell: (record, index, column) => { // customCell: (record, index, column) => {
if (record.typeRowSpan != null) { // if (record.typeRowSpan != null) {
return { rowSpan: record.typeRowSpan }; // return { rowSpan: record.typeRowSpan };
} // }
}, // },
}, },
{ {
title: '用药类型名称', title: '三级分类',
align:"center", align:"center",
dataIndex: 'medicationName' dataIndex: 'medicationName'
}, },
@ -50,12 +50,12 @@ export const searchFormSchema: FormSchema[] = [
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
label: '物料类别名称', label: '一级分类',
field: 'categoryName', field: 'categoryName',
component: 'Input', component: 'Input',
dynamicRules: ({model,schema}) => { dynamicRules: ({model,schema}) => {
return [ return [
{ required: true, message: '请输入物料类别名称!'}, { required: true, message: '请输入一级分类!'},
]; ];
}, },
}, },
@ -79,7 +79,7 @@ export const formSchema: FormSchema[] = [
// 高级查询数据 // 高级查询数据
export const superQuerySchema = { export const superQuerySchema = {
categoryName: {title: '物料类别名称',order: 0,view: 'text', type: 'string',}, categoryName: {title: '一级分类',order: 0,view: 'text', type: 'string',},
izEnabled: {title: '是否启用',order: 1,view: 'radio', type: 'string',dictCode: 'iz_enabled',}, izEnabled: {title: '是否启用',order: 1,view: 'radio', type: 'string',dictCode: 'iz_enabled',},
}; };

View File

@ -6,8 +6,8 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :lg="12"> <a-col :lg="12">
<a-form-item name="categoryName"> <a-form-item name="categoryName">
<template #label><span title="物料类别">物料类别</span></template> <template #label><span title="一级分类">一级分类</span></template>
<a-input placeholder="请输入物料类别" v-model:value="queryParam.categoryName" allow-clear ></a-input> <a-input placeholder="请输入一级分类" v-model:value="queryParam.categoryName" allow-clear ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12"> <a-col :lg="12">
@ -78,7 +78,7 @@
//table //table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{ tableProps:{
title: '物料类别', title: '一级分类',
api: list, api: list,
columns, columns,
canResize:false, canResize:false,
@ -102,7 +102,7 @@
}, },
}, },
exportConfig: { exportConfig: {
name:"物料类别", name:"一级分类",
url: getExportUrl, url: getExportUrl,
params: queryParam, params: queryParam,
}, },

View File

@ -46,19 +46,19 @@ export const columns: BasicColumn[] = [
width:'200px' width:'200px'
}, },
{ {
title: '物料类别', title: '一级分类',
align: "center", align: "center",
dataIndex: 'categoryId_dictText', dataIndex: 'categoryId_dictText',
width:'100px' width:'100px'
}, },
{ {
title: '物料类型', title: '二级分类',
align: "center", align: "center",
dataIndex: 'typeId_dictText', dataIndex: 'typeId_dictText',
width:'100px' width:'100px'
}, },
{ {
title: '用药类型', title: '三级分类',
align: "center", align: "center",
dataIndex: 'medicationId_dictText', dataIndex: 'medicationId_dictText',
width:'100px' width:'100px'
@ -85,9 +85,9 @@ export const columns: BasicColumn[] = [
// 高级查询数据 // 高级查询数据
export const superQuerySchema = { export const superQuerySchema = {
categoryId: {title: '物料类别',order: 0,view: 'radio', type: 'string',dictTable: "nu_config_material_category", dictCode: 'id', dictText: 'category_name',}, categoryId: {title: '一级分类',order: 0,view: 'radio', type: 'string',dictTable: "nu_config_material_category", dictCode: 'id', dictText: 'category_name',},
typeId: {title: '物料类型',order: 1,view: 'radio', type: 'string',dictTable: "nu_config_material_type", dictCode: 'id', dictText: 'type_name',}, typeId: {title: '二级分类',order: 1,view: 'radio', type: 'string',dictTable: "nu_config_material_type", dictCode: 'id', dictText: 'type_name',},
medicationId: {title: '用药类型',order: 2,view: 'radio', type: 'string',dictTable: "nu_config_material_medication", dictCode: 'id', dictText: 'medication_name',}, medicationId: {title: '三级分类',order: 2,view: 'radio', type: 'string',dictTable: "nu_config_material_medication", dictCode: 'id', dictText: 'medication_name',},
materialName: {title: '货品名称',order: 3,view: 'text', type: 'string',}, materialName: {title: '货品名称',order: 3,view: 'text', type: 'string',},
materialNo: {title: '货品编码',order: 4,view: 'text', type: 'string',}, materialNo: {title: '货品编码',order: 4,view: 'text', type: 'string',},
specificationModel: {title: '规格型号',order: 5,view: 'text', type: 'string',}, specificationModel: {title: '规格型号',order: 5,view: 'text', type: 'string',},

View File

@ -6,20 +6,20 @@
<a-row :gutter="24"> <a-row :gutter="24">
<!-- <a-col :lg="6"> <!-- <a-col :lg="6">
<a-form-item name="categoryId"> <a-form-item name="categoryId">
<template #label><span title="物料类别">物料类别</span></template> <template #label><span title="一级分类">一级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择物料类别" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择一级分类" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <a-col :lg="6">
<a-form-item name="typeId"> <a-form-item name="typeId">
<template #label><span title="物料类型">物料类型</span></template> <template #label><span title="二级分类">二级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择物料类型" v-model:value="queryParam.typeId" :dictCode="`nu_config_material_type,type_name,id,iz_enabled = 0 and del_flag = 0 and category_id = ${queryParam.categoryId || -1}`" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择二级分类" v-model:value="queryParam.typeId" :dictCode="`nu_config_material_type,type_name,id,iz_enabled = 0 and del_flag = 0 and category_id = ${queryParam.categoryId || -1}`" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6"> <a-col :lg="6">
<a-form-item name="medicationId"> <a-form-item name="medicationId">
<template #label><span title="用药类型">用药类型</span></template> <template #label><span title="三级分类">三级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择用药类型" v-model:value="queryParam.medicationId" :dictCode="`config_material_medication,medication_name,id,iz_enabled = 0 and del_flag = 0 and type_id = ${queryParam.typeId || -1}`" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择三级分类" v-model:value="queryParam.medicationId" :dictCode="`config_material_medication,medication_name,id,iz_enabled = 0 and del_flag = 0 and type_id = ${queryParam.typeId || -1}`" allow-clear />
</a-form-item> </a-form-item>
</a-col> --> </a-col> -->
<a-col :lg="6"> <a-col :lg="6">

View File

@ -6,12 +6,12 @@ import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '物料类别', title: '一级分类',
align: "center", align: "center",
dataIndex: 'categoryId_dictText' dataIndex: 'categoryId_dictText'
}, },
{ {
title: '物料类型', title: '二级分类',
align: "center", align: "center",
dataIndex: 'typeId_dictText' dataIndex: 'typeId_dictText'
}, },

View File

@ -6,14 +6,14 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :lg="12"> <a-col :lg="12">
<a-form-item name="categoryId"> <a-form-item name="categoryId">
<template #label><span title="物料类别">物料类别</span></template> <template #label><span title="一级分类">一级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择物料类别" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择一级分类" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12"> <a-col :lg="12">
<a-form-item name="typeId"> <a-form-item name="typeId">
<template #label><span title="物料类型">物料类型</span></template> <template #label><span title="二级分类">二级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择物料类别" v-model:value="queryParam.typeId" :dictCode="`nu_config_material_type,type_name,id,iz_enabled = 0 and del_flag = 0 and category_id = ${queryParam.categoryId || -1}`" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择一级分类" v-model:value="queryParam.typeId" :dictCode="`nu_config_material_type,type_name,id,iz_enabled = 0 and del_flag = 0 and category_id = ${queryParam.categoryId || -1}`" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12"> <a-col :lg="12">
@ -79,7 +79,7 @@
//table //table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: { tableProps: {
title: '物料用药类型', title: '三级分类',
api: list, api: list,
columns, columns,
canResize:false, canResize:false,
@ -93,7 +93,7 @@
}, },
}, },
exportConfig: { exportConfig: {
name: "物料用药类型", name: "三级分类",
url: getExportUrl, url: getExportUrl,
params: queryParam, params: queryParam,
}, },

View File

@ -6,12 +6,12 @@ import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '物料类别', title: '一级分类',
align: "center", align: "center",
dataIndex: 'categoryId_dictText' dataIndex: 'categoryId_dictText'
}, },
{ {
title: '物料类型', title: '二级分类',
align: "center", align: "center",
dataIndex: 'typeName' dataIndex: 'typeName'
}, },

View File

@ -6,14 +6,14 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :lg="12"> <a-col :lg="12">
<a-form-item name="categoryId"> <a-form-item name="categoryId">
<template #label><span title="物料类别">物料类别</span></template> <template #label><span title="一级分类">一级分类</span></template>
<j-dict-select-tag type='list' placeholder="请选择物料类别" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear /> <j-dict-select-tag type='list' placeholder="请选择一级分类" v-model:value="queryParam.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12"> <a-col :lg="12">
<a-form-item name="typeName"> <a-form-item name="typeName">
<template #label><span title="物料类型">物料类型</span></template> <template #label><span title="二级分类">二级分类</span></template>
<a-input placeholder="请输入物料类型" v-model:value="queryParam.typeName" allow-clear ></a-input> <a-input placeholder="请输入二级分类" v-model:value="queryParam.typeName" allow-clear ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12"> <a-col :lg="12">
@ -73,7 +73,7 @@
//table //table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: { tableProps: {
title: '物料类型', title: '二级分类',
api: list, api: list,
columns, columns,
canResize:false, canResize:false,
@ -87,7 +87,7 @@
}, },
}, },
exportConfig: { exportConfig: {
name: "物料类型", name: "二级分类",
url: getExportUrl, url: getExportUrl,
params: queryParam, params: queryParam,
}, },

View File

@ -1,70 +1,147 @@
<template> <template>
<div style="min-height: 400px"> <a-spin :spinning="confirmLoading">
<BasicForm @register="registerForm"></BasicForm> <JFormContainer :disabled="disabled">
<div style="width: 100%;text-align: center" v-if="!formDisabled"> <template #detail>
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button> <a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialMedicationForm">
</div> <a-row>
</div> <a-col :span="24" style="margin-top: 100px;">
<a-form-item label="一级分类" v-bind="validateInfos.categoryName" id="ConfigMaterialMedicationForm-categoryName" name="categoryId">
<a-input v-model:value="formData.categoryName" placeholder="请输入一级分类" allow-clear ></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import {BasicForm, useForm} from '/@/components/Form/index'; import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import {computed, defineComponent} from 'vue'; import { defHttp } from '/@/utils/http/axios';
import {defHttp} from '/@/utils/http/axios'; import { useMessage } from '/@/hooks/web/useMessage';
import { propTypes } from '/@/utils/propTypes'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import {getBpmFormSchema} from '../ConfigMaterialCategory.data'; import { getValueType } from '/@/utils';
import {saveOrUpdate} from '../ConfigMaterialCategory.api'; import { saveOrUpdate } from '../ConfigMaterialCategory.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: '',
categoryName: '',
});
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({
categoryName: [{ required: true, message: '请输入一级分类', trigger: 'blur' }],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
export default defineComponent({ //
name: "ConfigMaterialCategoryForm", const disabled = computed(()=>{
components:{ if(props.formBpm === true){
BasicForm if(props.formData.disabled === false){
}, return false;
props:{ }else{
formData: propTypes.object.def({}), return true;
formBpm: propTypes.bool.def(true), }
}, }
setup(props){ return props.formDisabled;
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ });
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: {span: 24}
});
const formDisabled = computed(()=>{
if(props.formData.disabled === false){
return false;
}
return true;
});
let formData = {}; /**
const queryByIdUrl = '/invoicing/configMaterialCategory/queryById'; * 新增
async function initFormData(){ */
let params = {id: props.formData.dataId}; function add() {
const data = await defHttp.get({url: queryByIdUrl, params}); edit({});
formData = {...data} }
//
await setFieldsValue(formData);
//
await setProps({disabled: formDisabled.value})
}
async function submitForm() { /**
let data = getFieldsValue(); * 编辑
let params = Object.assign({}, formData, data); */
console.log('表单数据', params) function edit(record) {
await saveOrUpdate(params, true) console.log("🚀 ~ edit ~ record:", record)
} nextTick(() => {
resetFields();
initFormData(); const tmpData = {};
Object.keys(formData).forEach((key) => {
return { if(record.hasOwnProperty(key)){
registerForm, tmpData[key] = record[key]
formDisabled,
submitForm,
}
} }
})
//
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(',');
}
}
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
emit('ok');
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script> </script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
.ant-modal .ant-modal-body {
padding: 0;
height: 300px !important;
}
</style>

View File

@ -1,76 +1,77 @@
<template> <template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> <j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<BasicForm @register="registerForm" name="ConfigMaterialCategoryForm" /> <ConfigMaterialCategoryForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ConfigMaterialCategoryForm>
</BasicModal> </j-modal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref, computed, unref} from 'vue'; import { ref, nextTick, defineExpose } from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal'; import ConfigMaterialCategoryForm from './ConfigMaterialCategoryForm.vue'
import {BasicForm, useForm} from '/@/components/Form/index'; import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import {formSchema} from '../ConfigMaterialCategory.data';
import {saveOrUpdate} from '../ConfigMaterialCategory.api'; const title = ref<string>('');
// Emits const width = ref<number>(800);
const emit = defineEmits(['register','success']); const visible = ref<boolean>(false);
const isUpdate = ref(true); const disableSubmit = ref<boolean>(false);
const isDetail = ref(false); const registerForm = ref();
// const emit = defineEmits(['register', 'success']);
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
labelWidth: 150, /**
schemas: formSchema, * 新增
showActionButtonGroup: false, */
baseColProps: {span: 24} function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
}); });
// }
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
// /**
await resetFields(); * 编辑
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); * @param record
isUpdate.value = !!data?.isUpdate; */
isDetail.value = !!data?.showFooter; function edit(record) {
if (unref(isUpdate)) { title.value = disableSubmit.value ? '详情' : '编辑';
// visible.value = true;
await setFieldsValue({ nextTick(() => {
...data.record, registerForm.value.edit(record);
});
}
//
setProps({ disabled: !data?.showFooter })
}); });
// }
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
// /**
async function handleSubmit(v) { * 确定按钮点击事件
try { */
let values = await validate(); function handleOk() {
setModalProps({confirmLoading: true}); registerForm.value.submitForm();
// }
await saveOrUpdate(values, isUpdate.value);
// /**
closeModal(); * form保存回调事件
// */
emit('success'); function submitCallback() {
} catch ({ errorFields }) { handleCancel();
if (errorFields) { emit('success');
const firstField = errorFields[0]; }
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' }); /**
} * 取消按钮回调事件
} */
return Promise.reject(errorFields); function handleCancel() {
} finally { visible.value = false;
setModalProps({confirmLoading: false}); }
}
} defineExpose({
add,
edit,
disableSubmit,
});
</script> </script>
<style lang="less" scoped> <style lang="less">
/** 时间和数字输入框样式 */ /**隐藏样式-modal确定按钮 */
:deep(.ant-input-number) { .jee-hidden {
width: 100%; display: none !important;
}
:deep(.ant-calendar-picker) {
width: 100%;
} }
</style> </style>
<style lang="less" scoped></style>

View File

@ -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"> <a-col :span="8">
<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"> <a-col :span="8">
<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"> <a-col :span="8">
<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">
@ -106,7 +106,7 @@
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="供应商" v-bind="validateInfos.suppliers" id="ConfigMaterialInfoForm-suppliers" name="suppliers" :labelCol="labelCol3" :wrapperCol="wrapperCol3"> <a-form-item label="供应商" v-bind="validateInfos.suppliers" id="ConfigMaterialInfoForm-suppliers" name="suppliers" :labelCol="labelCol3" :wrapperCol="wrapperCol3">
<j-select-multiple placeholder="请选择物料类别" v-model:value="formData.suppliers" dictCode="nu_config_suppliers_info,suppliers_name,id,supply_state = 1 and del_flag = 0" allow-clear /> <j-select-multiple placeholder="请选择一级级分类" v-model:value="formData.suppliers" dictCode="nu_config_suppliers_info,suppliers_name,id,supply_state = 1 and del_flag = 0" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -182,8 +182,8 @@
const confirmLoading = ref<boolean>(false); const confirmLoading = ref<boolean>(false);
// //
const validatorRules = reactive({ const validatorRules = reactive({
categoryId: [{ required: true, message: '请选择物料类别!'},], categoryId: [{ required: true, message: '请选择一级级分类!'},],
typeId: [{ required: true, message: '请选择物料类型!'},], typeId: [{ required: true, message: '请选择二级级分类!'},],
materialName: [{ required: true, message: '请输入货品名称!'},], materialName: [{ required: true, message: '请输入货品名称!'},],
salesUnitPrice: [{ required: true, message: '请输入销售单价!'},], salesUnitPrice: [{ required: true, message: '请输入销售单价!'},],
referenceUnitPrice: [{ required: true, message: '请输入参考单价!'},], referenceUnitPrice: [{ required: true, message: '请输入参考单价!'},],

View File

@ -5,23 +5,18 @@
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialMedicationForm"> <a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialMedicationForm">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="物料类别" v-bind="validateInfos.categoryId" id="ConfigMaterialMedicationForm-categoryId" name="categoryId"> <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 /> <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 v-if="showDictSelect"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="物料类型" v-bind="validateInfos.typeId" id="ConfigMaterialMedicationForm-typeId" name="typeId"> <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 /> <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 v-if="showDictSelect"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="名称" v-bind="validateInfos.medicationName" id="ConfigMaterialMedicationForm-medicationName" name="medicationName"> <a-form-item label="三级分类" v-bind="validateInfos.medicationName" id="ConfigMaterialMedicationForm-medicationName" name="medicationName">
<a-input v-model:value="formData.medicationName" placeholder="请输入名称" allow-clear ></a-input> <a-input v-model:value="formData.medicationName" placeholder="请输入三级分类" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigMaterialMedicationForm-izEnabled" name="izEnabled">
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled" placeholder="请选择是否启用" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -32,7 +27,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue'; import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted,onUnmounted } from 'vue';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
@ -48,12 +43,12 @@
const formRef = ref(); const formRef = ref();
const useForm = Form.useForm; const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']); const emit = defineEmits(['register', 'ok']);
const showDictSelect = ref(false);
const formData = reactive<Record<string, any>>({ const formData = reactive<Record<string, any>>({
id: '', id: '',
categoryId: '', categoryId: '',
typeId: '', typeId: '',
medicationName: '', medicationName: '',
izEnabled: '',
}); });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
@ -61,9 +56,9 @@
const confirmLoading = ref<boolean>(false); const confirmLoading = ref<boolean>(false);
// //
const validatorRules = reactive({ const validatorRules = reactive({
categoryId: [{ required: true, message: '请输入物料类别!'},], categoryId: [{ required: true, message: '请输入一级分类!'},],
typeId: [{ required: true, message: '请输入物料类型!'},], typeId: [{ required: true, message: '请输入二级分类!'},],
medicationName: [{ required: true, message: '请输入名称!'},], medicationName: [{ required: true, message: '请输入三级分类!'},],
}); });
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false }); const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
@ -91,8 +86,10 @@
* 编辑 * 编辑
*/ */
function edit(record) { function edit(record) {
showDictSelect.value = false;
nextTick(() => { nextTick(() => {
resetFields(); resetFields();
showDictSelect.value = true;
const tmpData = {}; const tmpData = {};
Object.keys(formData).forEach((key) => { Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){ if(record.hasOwnProperty(key)){
@ -101,6 +98,7 @@
}) })
// //
Object.assign(formData, tmpData); Object.assign(formData, tmpData);
formData.categoryId = record.categoryId;
}); });
} }
@ -152,7 +150,9 @@
}); });
} }
onUnmounted(() => {
showDictSelect.value = false;
});
defineExpose({ defineExpose({
add, add,
edit, edit,

View File

@ -5,18 +5,13 @@
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialTypeForm"> <a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialTypeForm">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="物料类别" v-bind="validateInfos.categoryId" id="ConfigMaterialTypeForm-categoryId" name="categoryId"> <a-form-item label="一级分类" v-bind="validateInfos.categoryId" id="ConfigMaterialTypeForm-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 /> <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 v-if="showDictSelect"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="物料类型" v-bind="validateInfos.typeName" id="ConfigMaterialTypeForm-typeName" name="typeName"> <a-form-item label="二级分类" v-bind="validateInfos.typeName" id="ConfigMaterialTypeForm-typeName" name="typeName">
<a-input v-model:value="formData.typeName" placeholder="请输入物料类型" allow-clear ></a-input> <a-input v-model:value="formData.typeName" placeholder="请输入二级分类" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigMaterialTypeForm-izEnabled" name="izEnabled">
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled" placeholder="请选择是否启用" allow-clear />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -43,11 +38,11 @@
const formRef = ref(); const formRef = ref();
const useForm = Form.useForm; const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']); const emit = defineEmits(['register', 'ok']);
const showDictSelect = ref(false);
const formData = reactive<Record<string, any>>({ const formData = reactive<Record<string, any>>({
id: '', id: '',
categoryId: '', categoryId: '',
typeName: '', typeName: '',
izEnabled: '',
}); });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
@ -55,8 +50,8 @@
const confirmLoading = ref<boolean>(false); const confirmLoading = ref<boolean>(false);
// //
const validatorRules = reactive({ const validatorRules = reactive({
categoryId: [{ required: true, message: '请输入物料类别!'},], categoryId: [{ required: true, message: '请输入一级分类!'},],
typeName: [{ required: true, message: '请输入物料类型!'},], typeName: [{ required: true, message: '请输入二级分类!'},],
}); });
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false }); const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
@ -84,8 +79,11 @@
* 编辑 * 编辑
*/ */
function edit(record) { function edit(record) {
showDictSelect.value = false;
console.log("🚀 ~ edit ~ record:", record)
nextTick(() => { nextTick(() => {
resetFields(); resetFields();
showDictSelect.value = true;
const tmpData = {}; const tmpData = {};
Object.keys(formData).forEach((key) => { Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){ if(record.hasOwnProperty(key)){
@ -95,6 +93,7 @@
// //
Object.assign(formData, tmpData); Object.assign(formData, tmpData);
}); });
console.log("🚀 ~ nextTick ~ formData:", formData)
} }
/** /**

View File

@ -46,19 +46,19 @@ export const columns: BasicColumn[] = [
width:'200px' width:'200px'
}, },
{ {
title: '物料类别', title: '一级分类',
align: "center", align: "center",
dataIndex: 'categoryId_dictText', dataIndex: 'categoryId_dictText',
width:'100px' width:'100px'
}, },
{ {
title: '物料类型', title: '二级分类',
align: "center", align: "center",
dataIndex: 'typeId_dictText', dataIndex: 'typeId_dictText',
width:'100px' width:'100px'
}, },
{ {
title: '用药类型', title: '三级分类',
align: "center", align: "center",
dataIndex: 'medicationId_dictText', dataIndex: 'medicationId_dictText',
width:'100px' width:'100px'
@ -85,9 +85,9 @@ export const columns: BasicColumn[] = [
// 高级查询数据 // 高级查询数据
export const superQuerySchema = { export const superQuerySchema = {
categoryId: {title: '物料类别',order: 0,view: 'radio', type: 'string',dictTable: "nu_config_material_category", dictCode: 'id', dictText: 'category_name',}, categoryId: {title: '一级分类',order: 0,view: 'radio', type: 'string',dictTable: "nu_config_material_category", dictCode: 'id', dictText: 'category_name',},
typeId: {title: '物料类型',order: 1,view: 'radio', type: 'string',dictTable: "nu_config_material_type", dictCode: 'id', dictText: 'type_name',}, typeId: {title: '二级分类',order: 1,view: 'radio', type: 'string',dictTable: "nu_config_material_type", dictCode: 'id', dictText: 'type_name',},
medicationId: {title: '用药类型',order: 2,view: 'radio', type: 'string',dictTable: "nu_config_material_medication", dictCode: 'id', dictText: 'medication_name',}, medicationId: {title: '三级分类',order: 2,view: 'radio', type: 'string',dictTable: "nu_config_material_medication", dictCode: 'id', dictText: 'medication_name',},
materialName: {title: '货品名称',order: 3,view: 'text', type: 'string',}, materialName: {title: '货品名称',order: 3,view: 'text', type: 'string',},
materialNo: {title: '货品编码',order: 4,view: 'text', type: 'string',}, materialNo: {title: '货品编码',order: 4,view: 'text', type: 'string',},
specificationModel: {title: '规格型号',order: 5,view: 'text', type: 'string',}, specificationModel: {title: '规格型号',order: 5,view: 'text', type: 'string',},

View File

@ -119,8 +119,8 @@
const dataList = ref<any>([]); const dataList = ref<any>([]);
// //
const validatorRules = reactive({ const validatorRules = reactive({
categoryId: [{ required: true, message: '请选择物料类别!'},], categoryId: [{ required: true, message: '请选择一级分类!'},],
typeId: [{ required: true, message: '请选择物料类型!'},], typeId: [{ required: true, message: '请选择二级分类!'},],
materialName: [{ required: true, message: '请输入货品名称!'},], materialName: [{ required: true, message: '请输入货品名称!'},],
salesUnitPrice: [{ required: true, message: '请输入销售单价!'},], salesUnitPrice: [{ required: true, message: '请输入销售单价!'},],
referenceUnitPrice: [{ required: true, message: '请输入参考单价!'},], referenceUnitPrice: [{ required: true, message: '请输入参考单价!'},],