提交 7abfad24 authored 作者: 王腾飞's avatar 王腾飞

12.31

上级 daf19ee6
......@@ -45,3 +45,13 @@
}
}
}
.has-gutter {
tr {
th:nth-of-type(1) {
.el-checkbox__inner {
display:none;
}
}
}
}
......@@ -189,7 +189,7 @@
<div class="name">{{ item.value }}</div>
</template>
</el-autocomplete>
<el-table :data="gridData" :row-key="getRowKeys" @selection-change="handleSelectionChange" ref="multipleTable">
<el-table :data="gridData" @filter-method="filterChange" :row-key="getRowKeys" @select="selectItem" @selection-change="handleSelectionChange" ref="multipleTable">
<el-table-column
type="selection"
:reserve-selection="true"
......@@ -242,6 +242,7 @@ export default {
},
data() {
return {
pages: null, //资源标签分页的页数
delArr:[],
selectItemArr: [],
restaurants: [],
......@@ -389,7 +390,6 @@ export default {
this.getSearchPageLable ();
//this.formSixBtn();
this.getMetaDataPlanList();
console.log(this.formData.fieldJsonArr, 'XXeeeeeeeeeee')
},
watch: {
$route: {
......@@ -412,6 +412,9 @@ export default {
}
},
methods: {
filterChange(row, value) {
console.log(row,"123456+++++++++++++++++++++")
},
showMark() {
this.isShowMark = true;
},
......@@ -628,6 +631,7 @@ export default {
}
},
getLookContent() {//查看
//this.dialogTableVisible = true;
let _this = this;
if(this.$route.query.oid && this.$route.query.flag) {
this.isShowSavaBtn1 = true;
......@@ -658,26 +662,31 @@ export default {
if (res.data.data.longitude) {
this.location = '经度:' + res.data.data.longitude + ',' + '维度:' + res.data.data.latitude + ',' + res.data.data.address;
}
console.log(this.gridData, '123OP')
_this.$nextTick(() => {
res.data.data.label.map((item, index) => {
_this.$set(item, 'value', item.labelId);
_this.resourceLabel.push(item)
})
console.log(_this.resourceLabel, 'KLlll')
_this.resourceLabel.map(itemX => {
console.log(itemX, "123")
_this.gridData.map((itemY, index) => {
console.log(itemY, 'HJHJHj')
if (itemX.labelId == itemY.id) {
_this.$nextTick(function () {
// DOM 更新了
_this.$refs.multipleTable.toggleRowSelection(_this.gridData[index], true);
})
}
})
})
res.data.data.label.map((item, index) => {
_this.$set(item, 'value', item.labelId);
_this.resourceLabel.push(item)
})
// console.log(this.gridData, '123OP')
// _this.$nextTick(function() {
// res.data.data.label.map((item, index) => {
// _this.$set(item, 'value', item.labelId);
// _this.resourceLabel.push(item)
// })
// console.log(_this.resourceLabel, 'KLlll')
// _this.resourceLabel.map(itemX => {
// console.log(itemX, "123")
// _this.gridData.map((itemY, index) => {
// console.log(itemY, 'HJHJHj')
// if (itemX.labelId == itemY.id) {
// _this.$nextTick(function () {
// // DOM 更新了
// console.log(_this.$refs.multipleTable, '123456789')
// _this.$refs.multipleTable.toggleRowSelection(_this.gridData[index], true);
// })
// }
// })
// })
// })
res.data.data.diyType.map((item, index) => {
this.$set(item, 'value', item.dtId);
this.$set(item, 'label', item.typeName);
......@@ -693,6 +702,15 @@ export default {
}
},
saveEdit() {//保存编辑
let optIdArr = [];
this.resourceLabel.map((item, index) => {
var obj = {
labelId: item.labelId
}
optIdArr.push(obj)
})
this.formData.label = optIdArr;
console.log(optIdArr, '312312312')
this.formData.fieldJson = JSON.stringify(this.fieldJsonData)
const formOne = new Promise((resolve,reject) => {
this.$refs['formOne'].validate(valid=>{
......@@ -794,10 +812,11 @@ export default {
getSearchPageLable () {
searchPageLableAPI(this.searchPageLableForm)
.then(res => {
console.log(res, '21312')
console.log(res, '21312ttttt')
if ( res.data.code === 0 ) {
this.gridData = res.data.data.list
this.totalCount = res.data.data.total
this.totalCount = res.data.data.total;
this.pages = res.data.data.pages;
for ( let [ index, ele ] of this.gridData.entries () ) {
this.$set( ele, 'value', ele.name )
};
......@@ -806,13 +825,47 @@ export default {
})
},
showLableDia () {
let _this = this;
this.dialogTableVisible = true;
if (this.$route.query.flag === 'look') {
_this.resourceLabel.map(itemX => {
if (_this.gridData.length > 0) {
_this.gridData.map((itemY, index) => {
if (itemX.labelId == itemY.id) {
_this.$nextTick(function () {
// DOM 更新了
_this.$refs.multipleTable.toggleRowSelection(_this.gridData[index], true);
})
}
})
}
})
}
this.setDelData();
},
handleSelectionChange (val) {
// multipleSelection
console.log(val, '123123')
console.log(val, 'valvalvalval')
val.map(item => {
this.$set(item, 'labelId', item.id)
})
this.multipleSelection = val;
if (this.$route.query.flag === 'look') {
console.log(this.resourceLabel, "&*&*&*")
//val.length = 0;
this.multipleSelection = this.resourceLabel;
// this.multipleSelection = [...this.multipleSelection, ...val];//需要去重
// //数组对象去重
// let obj = {};
// let peon = this.multipleSelection.reduce((cur,next) => {
// obj[next.labelId] ? "" : obj[next.labelId] = true && cur.push(next);
// return cur;
// },[]) //设置cur默认类型为数组,并且初始值为空的数组
// this.multipleSelection = peon;
// console.log(val, '123123ttttttttttt')
}
// let arr = [...this.multipleSelection, ...val];
// console.log(arr,123)
// //数组对象去重
......@@ -831,17 +884,66 @@ export default {
// })
// this.formData.label = optIdArr;
},
// selectAll(selection) {
// if (selection.length != 0) {
// this.multipleSelection = [...this.multipleSelection, ...selection];
// }
// },
selectItem(selection, row) {
console.log(selection, "KKKKKKKKKKKKK")
console.log(row, "LLLLLLLLLLLLLLLLL")
console.log(this.resourceLabel, "66666666666666")
let ids = [];
this.resourceLabel.map(item => {
ids.push(item.labelId)
})
//判断selection中有没有row,若果有true,没有false;
if (selection.length != 0) {
selection.map(item => {
if (item.id === row.id && ids.includes(row.id) === false) {//如果二者相等说明点击的row是一开始没有被选中的需要返显到resourceLabel
this.resourceLabel.unshift(row)
} else { //剩下最后一个再点的时候selection是个空数组,没有元素,没有对应的item.id,所以下边的代码不跑
console.log(this.resourceLabel, "88888888888")//没有666说明二者不相等,不相等就删除resourceLabel中的对应项
this.resourceLabel.map((item2, index) => {
if (!item2.labelId) {
this.$set(item2, 'labelId', item2.id)
}
if (row.id === item2.labelId) {
this.resourceLabel.splice(index, 1)
}
})
}
})
} else {
this.resourceLabel.map((item2, index) => {
if (!item2.labelId) {
this.$set(item2, 'labelId', item2.id)
}
if (row.id === item2.labelId) {
this.resourceLabel.splice(index, 1)
}
})
}
},
sureLable () {
// this.multipleSelection.map((item, index) => {
// if (!this.resourceLabel.includes(item.name)) {
// this.resourceLabel.push(item.name)
// }
// })
console.log(this.multipleSelection, "789OOO")
this.resourceLabel = this.multipleSelection;
let optIdArr = [];
this.resourceLabel.map((item, index) => {
var obj = {
labelId: item.id
labelId: item.labelId
}
optIdArr.push(obj)
})
......@@ -857,8 +959,25 @@ export default {
this.getSearchPageLable()
},
handleCurrentChange(val) {
let _this = this;
this.searchPageLableForm.pageNum = val
this.getSearchPageLable();
setTimeout(() => {
if (_this.$route.query.flag === 'look') {
_this.resourceLabel.map(itemX => {
if (_this.gridData.length > 0) {
_this.gridData.map((itemY, index) => {
if (itemX.labelId == itemY.id) {
_this.$nextTick(function () {
// DOM 更新了
_this.$refs.multipleTable.toggleRowSelection(_this.gridData[index], true);
})
}
})
}
})
}
}, 100)
},
closeLableDia() {
console.log(this.resourceLabel,'88888')
......@@ -903,7 +1022,7 @@ export default {
let optIdArr = [];
this.resourceLabel.map((item, index) => {
var obj = {
labelId: item.id
labelId: item.labelId
}
optIdArr.push(obj)
})
......@@ -938,7 +1057,7 @@ export default {
},
getRowKeys(row) {
return row.id
},
},
},
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论