Sfoglia il codice sorgente

机构没有的项目,点击新增时,自动引入对应的系统项目,然后修改信息。等同于在系统项目列表选择一个项目“引入”,然后确认

张田田 8 mesi fa
parent
commit
8e52ebd497
2 ha cambiato i file con 12 aggiunte e 15 eliminazioni
  1. 10 13
      src/service/AddItems.vue
  2. 2 2
      src/service/IntroduceProjectList.vue

+ 10 - 13
src/service/AddItems.vue

@@ -1,6 +1,6 @@
 <script lang="ts" setup>
 import { ref, watch } from 'vue';
-import {  message } from 'ant-design-vue';
+import { notification } from 'ant-design-vue';
 import { PlusOutlined } from '@ant-design/icons-vue'; // 确保导入
 import VxeUI from 'vxe-table';
 import { useRequest } from 'alova/client';
@@ -45,7 +45,6 @@ const { loading: branchLoading } = useRequest(branchMethod).onSuccess(({ data })
       : [];
   };
   branch.value = to(data);
-  console.log(branch.value, '获取所有的机构');
 });
 const form = reactive<SystemModel>({
   institutionName: '',
@@ -181,17 +180,16 @@ function cancel() {
   VxeUI.modal.close(`add-items-modal`);
 }
 function doSubmit() {
-  console.log(formRef.value, 'formRef==>');
-  console.log(form, 'Form Data Before Submit');
   formRef.value
     ?.validate()
     .then(() => {
       form.photo = fileList.value[0]?.response?.url || fileList.value[0]?.url || '';
       submit(form);
     })
-    .catch((error) => {
-      console.error('Validation Error:', error);
-      message.error('请完善必填项');
+    .catch((error: any) => {
+      notification.error({
+        message: error.message,
+      });
     });
 }
 // 获取方案类型
@@ -202,15 +200,16 @@ async function getConditioningProgramType() {
     if (res?.length > 0) {
       typeOptions.value = res; // 直接使用返回的数据
     }
-  } catch (error) {
-    console.error('获取方案类型列表失败:', error);
+  } catch (error: any) {
+    notification.error({
+      message: error.message,
+    });
   } finally {
     typeOptionsLoading.value = false;
   }
 }
 
 onMounted(async () => {
-  console.log(props.data, '获取传来的数据');
   const deptId = localStorage.getItem('deptId');
   if (props.data.addType === 'system' && deptId) {
     form.institutionId = deptId;
@@ -239,10 +238,9 @@ onMounted(async () => {
           },
         ]
       : [];
-    console.log(props.data, 'form==>');
     if (props.data.addType === 'itemsList' && props.data.sourceId) {
       form.sourceId = form.id;
-      form.institutionId='';
+      form.institutionId = '';
       delete form.id;
     }
   }
@@ -250,7 +248,6 @@ onMounted(async () => {
   // getSupplier({});
   // 获取方案类型
   getConditioningProgramType();
-  console.log(form, 'form==>');
 });
 const emits = defineEmits<{
   submit: [data?: SystemItemModel];

+ 2 - 2
src/service/IntroduceProjectList.vue

@@ -52,9 +52,9 @@ const checked = ref(true);
 function addProject(row: any) {
   console.log(row, '添加项目');
   row.sourceId = row.id;
-  delete row.id;
+  // delete row.id;
   const addType = 'itemsList';
-
+  console.log(row, 'row传入的参数');
   if (row?.isErasable === 'N') {
     // 健康咨询 健康评估 x显示
     VxeUI.modal.open({