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