From 64fa2c33cd645e86d4e2a8c34c7881ea4aa678cf Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 17 六月 2025 18:33:37 +0800
Subject: [PATCH] 代码初始化
---
admin/src/components/business/OperaCategoryDcaProblemWindow.vue | 57 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/admin/src/components/business/OperaCategoryDcaProblemWindow.vue b/admin/src/components/business/OperaCategoryDcaProblemWindow.vue
index 5453131..e2002e3 100644
--- a/admin/src/components/business/OperaCategoryDcaProblemWindow.vue
+++ b/admin/src/components/business/OperaCategoryDcaProblemWindow.vue
@@ -10,15 +10,26 @@
<el-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�" v-trim/>
</el-form-item>
<el-form-item label="閫夋嫨鐖剁骇" prop="parentId">
- <el-cascader v-model="form.categoryList" :options="categorys" @change="handleChangeCategory" :show-all-levels="false"
+ <treeselect
+ v-model="form.parentId"
+ placeholder="璇烽�夋嫨"
+ :options="categorys"
+ :normalizer="normalizeOptions"
+ :default-expand-level="1"
+ noChildrenText="娌℃湁瀛愰�夐」"
+ noOptionsText="娌℃湁鍙�夐」"
+ noResultsText="娌℃湁鍖归厤鐨勭粨鏋�"
+ @select="node => treeHandleSelect(node)"
+ />
+<!-- <el-cascader v-model="form.categoryList" :options="categorys" @change="handleChangeCategory" :show-all-levels="false"
clearable filterable :props="categoryprops" >
<template slot-scope="{ node, data }">
- <span>{{ data.name }}</span> <!-- 鑷畾涔夋樉绀哄唴瀹� -->
+ <span>{{ data.name }}</span> <!– 鑷畾涔夋樉绀哄唴瀹� –>
</template>
- </el-cascader>
+ </el-cascader>-->
</el-form-item>
<el-form-item label="鎺掑簭鐮�" prop="sortnum">
- <el-input v-model="form.sortnum" placeholder="璇疯緭鍏ユ帓搴忕爜锛堝崌搴忥級" v-trim/>
+ <el-input v-model="form.sortnum" type="number" placeholder="璇疯緭鍏ユ帓搴忕爜锛堝崌搴忥級" v-trim/>
</el-form-item>
<el-form-item label="澶囨敞" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ娉�" v-trim/>
@@ -66,7 +77,25 @@
})
},
methods: {
+ normalizeOptions (node) {
+ if (node.childList && !node.childList.length) {
+ // 鍘绘帀children=[]鐨刢hildren灞炴��
+ delete node.childList
+ }
+ return {
+ id: node.id,
+ label: node.name,
+ children: node.childList
+ }
+ },
+ treeHandleSelect (node) {
+ if (this.form.id != null && node.id && this.form.id === node.id) {
+ this.$tip.error('瀵逛笉璧凤紝鐖剁骇涓嶈兘璁剧疆涓鸿嚜韬紒')
+ this.form.parentId = null
+ }
+ },
handleChangeCategory (value) {
+ this.form.parentId = null
if (this.form.categoryList && this.form.categoryList.length >= 1) {
this.form.parentId = this.form.categoryList[this.form.categoryList.length - 1]
}
@@ -93,11 +122,10 @@
}
return data
},
- open (title, target, categorys, categoryType, parentIdPath) {
+ open (title, target, categorys, categoryType, parentId) {
this.title = title
- this.categorys = categorys || []
- this.categorys = this.getTreeData(this.categorys)
- console.log(this.categorys)
+ this.categorys = JSON.parse(JSON.stringify(categorys||[]));
+ console.log(parentId)
this.visible = true
this.form = {
id: null,
@@ -106,7 +134,7 @@
categoryList: [],
sortnum: null,
remark: '',
- parentId: null
+ parentId: parentId
}
this.form.type = categoryType
// 鏂板缓
@@ -114,9 +142,10 @@
if (target == null) {
this.$nextTick(() => {
this.$refs.form.resetFields()
+ this.form.parentId = parentId
this.form[this.configData['field.id']] = null
- this.form.categoryList = []
- if (parentIdPath && parentIdPath != null) {
+ // this.form.categoryList = []
+ /*if (parentIdPath && parentIdPath != null) {
var array = parentIdPath.split('/')
array.forEach(item => {
if (item && item != null && item !== '') {
@@ -124,7 +153,7 @@
}
})
that.handleChangeCategory()
- }
+ }*/
})
return
}
@@ -133,7 +162,7 @@
for (const key in this.form) {
this.form[key] = target[key]
}
- this.form.categoryList = []
+ /*this.form.categoryList = []
if (target.parentId && target.idParentPath) {
var array = target.idParentPath.split('/')
array.forEach(item => {
@@ -141,7 +170,7 @@
that.form.categoryList.push(parseInt(item))
}
})
- }
+ }*/
})
}
}
--
Gitblit v1.9.3