| 
					
				 | 
			
			
				@@ -14,7 +14,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const emit = defineEmits(['register', 'success']); //定义emit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const isUpdate = ref(true); //判断编辑还是新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const rowId = ref('');//获取主键 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  let classOption = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  let classOption = ref([]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   //获取表单数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const [registerModal, { closeModal, setModalProps }] = useModalInner( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async (data) => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,6 +22,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       await resetFields(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       setModalProps({ confirmLoading: false}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       isUpdate.value = !!data?.isUpdate;      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      getOptions(isUpdate,data.record) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (unref(isUpdate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       rowId.value = data.record.id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       //表单赋值 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,22 +32,36 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  function getOptions(isUpdate,data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     defHttp 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         .then((res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (res.success) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              var option = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               res.result.records.forEach(element => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   var obj = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     label: element.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     value: element.name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  classOption.push( obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              });     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  option.push(obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              });   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              classOption.value = []  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if(unref(isUpdate)){  //编辑 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var row = JSON.parse(JSON.stringify(data)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                option.map(item=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  if(item.label!=row.parentId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    classOption.value.push(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                classOption.value = option 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         .finally(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // loading.value = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   //获取title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const getTitle = computed(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return (!unref(isUpdate) ? '新增产品分类(add)' : '编辑产品分类(edit)'); 
			 |