From 45a0a86b2f6fbef4ee8851f0c60ee61398b9c413 Mon Sep 17 00:00:00 2001
From: yangjun <1173114630@qq.com>
Date: Thu, 24 Jul 2025 11:17:40 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=A9=E6=96=99=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ConfigMaterial/ConfigMaterialInfoList.vue | 233 +++++++++++++-----
.../components/ConfigMaterialCategoryForm.vue | 4 -
.../ConfigMaterialCategoryModal.vue | 3 +-
.../components/ConfigMaterialInfoForm.vue | 36 ++-
.../components/ConfigMaterialInfoModal.vue | 4 +-
5 files changed, 197 insertions(+), 83 deletions(-)
diff --git a/src/views/invoicing/ConfigMaterial/ConfigMaterialInfoList.vue b/src/views/invoicing/ConfigMaterial/ConfigMaterialInfoList.vue
index e3b0bc1..04d88fb 100644
--- a/src/views/invoicing/ConfigMaterial/ConfigMaterialInfoList.vue
+++ b/src/views/invoicing/ConfigMaterial/ConfigMaterialInfoList.vue
@@ -59,56 +59,59 @@
-
-
-
-
-

-
{{ item.title }}
+
-
-
-
-
-
-
-
-
{{item2.title}}
-
-
-
-
- · {{item3.title}}
-
-
-
-
-
-
{{item2.title}}
-
-
-
-
-
+
+
-
+
-
+
@@ -125,6 +128,11 @@
+
+
+
+
+
@@ -143,8 +151,12 @@
import { JInput } from '/@/components/Form';
import type { TreeProps } from 'ant-design-vue';
import { DownOutlined } from '@ant-design/icons-vue';
-import { defHttp } from '/@/utils/http/axios';
-import type { CollapseProps } from 'ant-design-vue';
+ import { defHttp } from '/@/utils/http/axios';
+ import type { CollapseProps } from 'ant-design-vue';
+
+ 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';
const formRef = ref();
const queryParam = reactive
({});
@@ -159,6 +171,12 @@ import type { CollapseProps } from 'ant-design-vue';
const openKeys= []
const selectedKeys= []
const clickCount = ref(0);
+
+
+ const registerDrawer = ref();
+ const registerTypeDrawer = ref();
+ const registerMedicationDrawer = ref();
+
/**
* 点击菜单
* @param index 菜单索引
@@ -189,12 +207,12 @@ const getCardStyle = (index,allSize) => {
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
- title: '物料信息',
api: list,
columns,
canResize:false,
useSearchForm: false,
- showIndexColumn: true,
+ showIndexColumn: true,
+ showTableSetting: false,
actionColumn: {
width: 160,
fixed: 'right',
@@ -254,9 +272,24 @@ const getCardStyle = (index,allSize) => {
/**
* 新增事件
*/
- function handleAdd() {
+ function handleAdd(data) {
+ const record = {categoryId:'',typeId:'',medicationId:''}
+ var levle = parseInt(data.levle)
+ if(levle == 1){
+ record.categoryId = data.key
+ record.typeId = ''
+ record.medicationId = ''
+ }else if(levle == 2){
+ record.categoryId = data.categoryId
+ record.typeId = data.key
+ record.medicationId = ''
+ }else if(levle == 3){
+ record.categoryId = data.categoryId
+ record.typeId = data.typeId
+ record.medicationId = data.key
+ }
registerModal.value.disableSubmit = false;
- registerModal.value.add();
+ registerModal.value.add(record);
}
/**
@@ -293,7 +326,8 @@ const getCardStyle = (index,allSize) => {
* 成功回调
*/
function handleSuccess() {
- (selectedRowKeys.value = []) && reload();
+ getTreeData();
+ searchQuery();
}
/**
@@ -321,6 +355,89 @@ const getCardStyle = (index,allSize) => {
];
}
+ //点击树节点查询右侧列表数据
+ function handleSearch(data){
+ var levle = parseInt(data.levle)
+ if(levle == 1){
+ queryParam.categoryId = data.key
+ queryParam.typeId = ''
+ queryParam.medicationId = ''
+ }else if(levle == 2){
+ 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 handleFenleiEdit(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();
+ })
+
+ }
+
/**
* 查询
@@ -340,18 +457,20 @@ const getCardStyle = (index,allSize) => {
reload();
}
+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(() => {
- 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;
- }
-
- })
+ getTreeData()
});
diff --git a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryForm.vue b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryForm.vue
index 6cabf73..46dc176 100644
--- a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryForm.vue
+++ b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryForm.vue
@@ -140,8 +140,4 @@
.antd-modal-form {
padding: 14px;
}
- .ant-modal .ant-modal-body {
- padding: 0;
- height: 300px !important;
-}
diff --git a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue
index 9477b0f..88d4afb 100644
--- a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue
+++ b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue
@@ -74,4 +74,5 @@
display: none !important;
}
-
+
diff --git a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoForm.vue b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoForm.vue
index 789d5e5..359b209 100644
--- a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoForm.vue
+++ b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoForm.vue
@@ -4,17 +4,17 @@
-
+
-
+
-
+
@@ -65,33 +65,33 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -182,8 +182,6 @@
const confirmLoading = ref(false);
//表单验证
const validatorRules = reactive({
- categoryId: [{ required: true, message: '请选择一级级分类!'},],
- typeId: [{ required: true, message: '请选择二级级分类!'},],
materialName: [{ required: true, message: '请输入货品名称!'},],
salesUnitPrice: [{ required: true, message: '请输入销售单价!'},],
referenceUnitPrice: [{ required: true, message: '请输入参考单价!'},],
@@ -207,8 +205,8 @@
/**
* 新增
*/
- function add() {
- edit({});
+ function add(record) {
+ edit(record);
}
/**
diff --git a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoModal.vue b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoModal.vue
index afc79a5..17b61f9 100644
--- a/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoModal.vue
+++ b/src/views/invoicing/ConfigMaterial/components/ConfigMaterialInfoModal.vue
@@ -19,11 +19,11 @@
/**
* 新增
*/
- function add() {
+ function add(record) {
title.value = '新增';
visible.value = true;
nextTick(() => {
- registerForm.value.add();
+ registerForm.value.add(record);
});
}