|
@@ -257,7 +257,8 @@ export default {
|
|
|
|
|
|
|
|
|
|
], // 关联关系数据
|
|
], // 关联关系数据
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ addObj:{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -305,19 +306,8 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async handleSelect(index) {
|
|
async handleSelect(index) {
|
|
- this.activeIndex = index
|
|
|
|
- let leftId = this.paramList[index].id
|
|
|
|
- let arr= await this.getRelationData(this.deatailId,this.Jid,leftId)
|
|
|
|
-
|
|
|
|
- if(arr.length>0){
|
|
|
|
- this.$nextTick(()=>{
|
|
|
|
- // this.paramList[index].group = arr[0]['group']
|
|
|
|
- this.$set(this.paramList, index, { ...this.paramList[index], group: arr[0]['group'] });
|
|
|
|
- })
|
|
|
|
|
|
+ this.paramList[index].group = []
|
|
|
|
|
|
- }else{
|
|
|
|
- this.paramList[index].group = []
|
|
|
|
- }
|
|
|
|
|
|
|
|
},
|
|
},
|
|
async getRelationData(id, groupId,leftId){
|
|
async getRelationData(id, groupId,leftId){
|
|
@@ -388,16 +378,22 @@ export default {
|
|
let clickedIndex = this.paramList.findIndex(listItem => listItem.id === item.id);
|
|
let clickedIndex = this.paramList.findIndex(listItem => listItem.id === item.id);
|
|
console.log(clickedIndex, 'clickedIndex');
|
|
console.log(clickedIndex, 'clickedIndex');
|
|
this.activeIndex = clickedIndex;
|
|
this.activeIndex = clickedIndex;
|
|
-
|
|
|
|
|
|
+ this.paramList[clickedIndex].group = JSON.parse(JSON.stringify(item.group));
|
|
|
|
+ this.addObj = { ...item };
|
|
},
|
|
},
|
|
handleDeleteLinkItem(item,index){
|
|
handleDeleteLinkItem(item,index){
|
|
|
|
+ const {groupId}=item
|
|
|
|
+ if(!groupId){
|
|
|
|
+ this.linkListData.splice(index, 1);
|
|
|
|
+ return
|
|
|
|
+ }
|
|
this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
|
|
this.$confirm('删除后,数据将无法恢复,是否确认删除!', '提示', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
|
|
|
- deleteElementJoin({leftId:item.id}).then((res) => {
|
|
|
|
|
|
+ deleteElementJoin({leftId:item.id,groupId:item.groupId}).then((res) => {
|
|
if(res.data.code==200){
|
|
if(res.data.code==200){
|
|
this.$message.success(res.data.msg);
|
|
this.$message.success(res.data.msg);
|
|
|
|
|
|
@@ -418,13 +414,31 @@ export default {
|
|
|
|
|
|
this.getTableData();
|
|
this.getTableData();
|
|
},
|
|
},
|
|
- handleSelect1(index) {
|
|
|
|
|
|
+ handleSelect1(index,item) {
|
|
this.activeIndex = index
|
|
this.activeIndex = index
|
|
|
|
+
|
|
|
|
+ this.linkListData.forEach(ele=>{
|
|
|
|
+ ele.clicked = false
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ const hasClicked = this.linkListData.some(item => item.clicked === true);
|
|
|
|
+ console.log(hasClicked, 'hasClicked');
|
|
|
|
+ if(!hasClicked) {
|
|
|
|
+ item.group=[]
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
handleDeleteItem(item, index) {
|
|
handleDeleteItem(item, index) {
|
|
this.paramList[this.activeIndex].group.splice(index, 1)
|
|
this.paramList[this.activeIndex].group.splice(index, 1)
|
|
|
|
+
|
|
|
|
+ this.addObj={
|
|
|
|
+ ... this.paramList[this.activeIndex],
|
|
|
|
+ group:this.paramList[this.activeIndex].group
|
|
|
|
+ }
|
|
|
|
+
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
},
|
|
},
|
|
confirmAdd() {
|
|
confirmAdd() {
|
|
@@ -456,11 +470,15 @@ export default {
|
|
|
|
|
|
this.paramList[this.activeIndex].group.push(objArr);
|
|
this.paramList[this.activeIndex].group.push(objArr);
|
|
|
|
|
|
-
|
|
|
|
|
|
+ this.addObj={
|
|
|
|
+ ... this.paramList[this.activeIndex],
|
|
|
|
+ group:this.paramList[this.activeIndex].group
|
|
|
|
+ }
|
|
|
|
+ console.log( this.addObj,' this.addObj11111');
|
|
|
|
|
|
|
|
|
|
this.addDialogVisible = false;
|
|
this.addDialogVisible = false;
|
|
- this.$message.success('添加成功');
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
handleElementSelected(val) {
|
|
handleElementSelected(val) {
|
|
console.log(val, '选中的元素');
|
|
console.log(val, '选中的元素');
|
|
@@ -471,8 +489,28 @@ export default {
|
|
saveEle(){
|
|
saveEle(){
|
|
console.log(this.paramList,'保存条件');
|
|
console.log(this.paramList,'保存条件');
|
|
|
|
|
|
- const filteredArr = this.paramList.filter(item => item.group.length !== 0);
|
|
|
|
- this.linkListData = JSON.parse(JSON.stringify(filteredArr));
|
|
|
|
|
|
+ // const filteredArr = this.paramList.filter(item => item.group.length !== 0);
|
|
|
|
+ // this.linkListData = JSON.parse(JSON.stringify(filteredArr));
|
|
|
|
+ const hasClicked = this.linkListData.some(item => item.clicked === true);
|
|
|
|
+ console.log(hasClicked,'hasClicked');
|
|
|
|
+
|
|
|
|
+ if (!hasClicked) {
|
|
|
|
+ // 如果不存在,则将 addObj 添加到数组中
|
|
|
|
+ this.linkListData.push(this.addObj);
|
|
|
|
+ }else{
|
|
|
|
+ console.log(this.addObj,'this.addObj222222');
|
|
|
|
+
|
|
|
|
+ const clickedItem = this.linkListData.find(item => item.clicked === true);
|
|
|
|
+ if (clickedItem) {
|
|
|
|
+ clickedItem.group = this.addObj.group;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.paramList[this.activeIndex].group = []
|
|
|
|
+ this.linkListData .forEach(ele => {
|
|
|
|
+ ele.clicked = false;
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
|
|
},
|
|
},
|
|
formatTableType(row, column, cellValue) {
|
|
formatTableType(row, column, cellValue) {
|