标签项管理
This commit is contained in:
@@ -36,7 +36,10 @@
|
|||||||
:label-col="labelCol"
|
:label-col="labelCol"
|
||||||
:wrapper-col="wrapperCol"
|
:wrapper-col="wrapperCol"
|
||||||
>
|
>
|
||||||
<a-form-model-item :label="$t('name')" prop="name">
|
<a-form-model-item :label="$t('name')" prop="itemText" v-if="dictVal=='list'">
|
||||||
|
<a-input v-model="form.itemText" :placeholder="$t('enterName')" />
|
||||||
|
</a-form-model-item>
|
||||||
|
<a-form-model-item :label="$t('name')" prop="name" v-if="dictVal=='tree'">
|
||||||
<a-input v-model="form.name" :placeholder="$t('enterName')" />
|
<a-input v-model="form.name" :placeholder="$t('enterName')" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item :label="$t('DataValue')" prop="itemValue">
|
<a-form-model-item :label="$t('DataValue')" prop="itemValue">
|
||||||
@@ -102,6 +105,10 @@
|
|||||||
newVisible:false,
|
newVisible:false,
|
||||||
rules:{
|
rules:{
|
||||||
name:[
|
name:[
|
||||||
|
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
|
||||||
|
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
|
||||||
|
],
|
||||||
|
itemText:[
|
||||||
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
|
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
|
||||||
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
|
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
|
||||||
],
|
],
|
||||||
@@ -127,17 +134,36 @@
|
|||||||
total:0,
|
total:0,
|
||||||
isEdit:false,
|
isEdit:false,
|
||||||
selectedIds:[], //树形选中的id
|
selectedIds:[], //树形选中的id
|
||||||
parentData:[]
|
parentData:[],
|
||||||
|
editPId:'',
|
||||||
|
tabletreeDataSource:[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
parentName(value) {
|
parentName(value) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
},
|
},
|
||||||
|
editPId(){
|
||||||
|
this.parentData=this.getParents
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
//获取父级名称
|
||||||
|
getParents(){
|
||||||
|
let parents=[]
|
||||||
|
if(this.tabletreeDataSource&&this.tabletreeDataSource.length>0){
|
||||||
|
this.tabletreeDataSource.forEach((item)=>{
|
||||||
|
if(item.pid=='0'&&item.id!=this.editPId){
|
||||||
|
parents.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return parents
|
||||||
|
},
|
||||||
|
},
|
||||||
methods:{
|
methods:{
|
||||||
//获取列表数据
|
//获取列表数据
|
||||||
loadData(){
|
loadData(){
|
||||||
@@ -164,25 +190,16 @@
|
|||||||
isTagDict:1
|
isTagDict:1
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
let parentNode=[]
|
let parentNode=[]
|
||||||
let tabletreeData=[...res.result]
|
this.tabletreeDataSource=[...res.result]
|
||||||
let data = this.toTree(tabletreeData)
|
let data = this.toTree(this.tabletreeDataSource)
|
||||||
this.tabletreeData=data
|
this.tabletreeData=data
|
||||||
this.parentData=this.getParents(tabletreeData)
|
this.parentData=this.getParents
|
||||||
this.dataFlag=true
|
this.dataFlag=true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
//获取父级名称
|
|
||||||
getParents(data){
|
|
||||||
let parents=[]
|
|
||||||
data.forEach((item)=>{
|
|
||||||
if(item.pid=='0'){
|
|
||||||
parents.push(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return parents
|
|
||||||
},
|
|
||||||
//将数据拼成树形结构
|
//将数据拼成树形结构
|
||||||
toTree(config) {
|
toTree(config) {
|
||||||
config.forEach(function(item) {
|
config.forEach(function(item) {
|
||||||
@@ -313,6 +330,8 @@
|
|||||||
//树状编辑
|
//树状编辑
|
||||||
editTreeDict(val,form){
|
editTreeDict(val,form){
|
||||||
this.title=this.$t('edit')
|
this.title=this.$t('edit')
|
||||||
|
this.editPId=form.id
|
||||||
|
// console.log('dictId',form)
|
||||||
this.isEdit=true
|
this.isEdit=true
|
||||||
this.form={...form}
|
this.form={...form}
|
||||||
if(form.pid=='0'){
|
if(form.pid=='0'){
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
deleteAction(`sys/category/delete`, { id: val.id }).then((res) => {
|
deleteAction(`sys/category/delete`, { id: val.id }).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$message.success(this.$t('OperationSuccessful'));
|
this.$message.success(this.$t('OperationSuccessful'));
|
||||||
this.$emit('ok')
|
this.$emit('ok',this.queryParams)
|
||||||
}else{
|
}else{
|
||||||
this.$message.warning(this.$t('operationFailed'));
|
this.$message.warning(this.$t('operationFailed'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,8 +111,8 @@
|
|||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: this.$t('LabelName'),
|
title: this.$t('LabelName'),
|
||||||
dataIndex: 'dict_name',
|
dataIndex: 'dictName',
|
||||||
key: 'dict_name',
|
key: 'dictName',
|
||||||
align: "center",
|
align: "center",
|
||||||
width: 100,
|
width: 100,
|
||||||
},
|
},
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
title: this.$t('LabelType'),
|
title: this.$t('LabelType'),
|
||||||
align: "center",
|
align: "center",
|
||||||
width: 100,
|
width: 100,
|
||||||
dataIndex: 'attribute_type_name',
|
dataIndex: 'attributeType_dictText',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('describe'),
|
title: this.$t('describe'),
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
getAction(`sys/dict/page`,params).then(res=>{
|
getAction(`sys/dict/page`,params).then(res=>{
|
||||||
if(res.success){
|
if(res.success){
|
||||||
this.total=res.result.total
|
this.total=res.result.total
|
||||||
this.tableData=[...res.result]
|
this.tableData=[...res.result.records]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
title: this.$t('DisplayArea'),
|
title: this.$t('DisplayArea'),
|
||||||
align: "center",
|
align: "center",
|
||||||
width: 80,
|
width: 80,
|
||||||
dataIndex: 'showAreaName_dictText'
|
dataIndex: 'showAreaName'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('operation'),
|
title: this.$t('operation'),
|
||||||
|
|||||||
Reference in New Issue
Block a user