diff --git a/public/web/subscribe.html b/public/web/subscribe.html
index a584e41..0b0b185 100644
--- a/public/web/subscribe.html
+++ b/public/web/subscribe.html
@@ -665,8 +665,8 @@
// 延迟跳转回原页面
const targetUrl = decodeURIComponent(returnUrl);
- console.log('[subscribe] 开通成功,即将跳转到:', targetUrl);
- console.log('[subscribe] 原始 returnUrl:', returnUrl);
+ // console.log('[subscribe] 开通成功,即将跳转到:', targetUrl);
+ // console.log('[subscribe] 原始 returnUrl:', returnUrl);
setTimeout(() => {
let finalUrl;
diff --git a/src/views/assets/asset/component/editAsset.vue b/src/views/assets/asset/component/editAsset.vue
index 92b57af..eba6a3e 100644
--- a/src/views/assets/asset/component/editAsset.vue
+++ b/src/views/assets/asset/component/editAsset.vue
@@ -24,7 +24,7 @@
([]);
const categoryAttrs = ref([]);
+
+// 分类选择器配置 - 只能选择最下级节点(isLeafNode: true)
+const categoryProps = {
+ checkStrictly: true,
+ emitPath: false,
+ value: 'id',
+ label: 'name',
+ children: 'children',
+ disabled: (data: any) => !data.isLeafNode,
+};
const isTimeSlotLimitReached = computed(() => ruleForm.serviceAssetConfig.serviceAssetArrivalConfig.schedule.timeSlots.length >= MAX_TIME_SLOTS);
// 获取属性的key
@@ -609,6 +620,7 @@ const getInitialForm = (): RuleForm => ({
name: '',
type: 'physical',
categoryId: '',
+ categoryPath: '',
description: '',
onlineTime: '',
offlineTime: '',
@@ -872,15 +884,38 @@ const fetchCategories = () => {
});
};
-// 分类变更时获取分类属性
+// 递归查找分类节点
+const findCategoryNode = (nodes: any[], id: string): any => {
+ for (const node of nodes) {
+ if (node.id === id) return node;
+ if (node.children?.length) {
+ const found = findCategoryNode(node.children, id);
+ if (found) return found;
+ }
+ }
+ return null;
+};
+
+// 分类变更时获取分类属性和path
const onCategoryChange = (categoryId: string) => {
categoryAttrs.value = [];
ruleForm.metadata = {};
+ ruleForm.categoryPath = '';
if (!categoryId) return;
+ // 从分类树中查找选中节点,获取path
+ const node = findCategoryNode(categoryOptions.value, categoryId);
+ if (node?.path !== undefined) {
+ ruleForm.categoryPath = node.path;
+ }
+
getCategory(categoryId)
.then((res: any) => {
const data = res.data;
+ // 如果接口返回了path,优先使用接口返回的
+ if (data?.path !== undefined) {
+ ruleForm.categoryPath = data.path;
+ }
if (data?.attrs && Array.isArray(data.attrs)) {
categoryAttrs.value = data.attrs;
// 初始化属性值,确保 boolean 类型默认为 false
@@ -915,6 +950,7 @@ const openDialog = (row?: any, edit?: boolean) => {
ruleForm.name = data.name || '';
ruleForm.type = data.type || 'physical';
ruleForm.categoryId = data.categoryId || '';
+ ruleForm.categoryPath = data.categoryPath || '';
ruleForm.description = data.description || '';
ruleForm.onlineTime = data.onlineTime || '';
ruleForm.offlineTime = data.offlineTime || '';
@@ -1116,6 +1152,7 @@ const buildRequestBody = async (): Promise => {
name: ruleForm.name,
type: ruleForm.type,
categoryId: ruleForm.categoryId,
+ categoryPath: ruleForm.categoryPath || '',
description: ruleForm.description || '',
};