|
@@ -108,8 +108,8 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
row: null,
|
|
row: null,
|
|
- editData:null,
|
|
|
|
- addEditData:null,
|
|
|
|
|
|
+ //操作信息
|
|
|
|
+ handleMessage:''
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -125,33 +125,19 @@ export default {
|
|
},
|
|
},
|
|
// 排序数组
|
|
// 排序数组
|
|
sort: [],
|
|
sort: [],
|
|
|
|
+ //事件类型及所选
|
|
|
|
+ action:{
|
|
|
|
+ type:'',//1表示删除,2表示其他,3表示新增
|
|
|
|
+ id:''
|
|
|
|
+ }
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- // 分组时新增或编辑事件处理
|
|
|
|
- 'addEditData'(val) {
|
|
|
|
- let a = this.tableData.findIndex(item => {
|
|
|
|
- return item.id == val[0].id
|
|
|
|
- })
|
|
|
|
- if (a != -1) {
|
|
|
|
- this.$set(this.tableData,[a],val[0])
|
|
|
|
- } else {
|
|
|
|
- this.$set(this.tableData, [this.tableData.length], val[0])
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- 'deleData'(val) {
|
|
|
|
- let a = this.tableData.findIndex(item => {
|
|
|
|
- return item.id == val[0].id
|
|
|
|
- })
|
|
|
|
- if (a != -1) {
|
|
|
|
- this.tableData.splice(a, 1)
|
|
|
|
- console.log(this.tableData);
|
|
|
|
- // 分组时若删除当前分组最后一条数据时重新请求分组接口
|
|
|
|
- if (this.tableData.length==0) {
|
|
|
|
- this.$emit('getData',true)
|
|
|
|
- }
|
|
|
|
|
|
+ handleMessage(val){
|
|
|
|
+ if(val){
|
|
|
|
+ this.updateData()
|
|
}
|
|
}
|
|
- },
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
if (!this.row) {
|
|
if (!this.row) {
|
|
@@ -161,6 +147,58 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ //更新数据
|
|
|
|
+ updateData(){
|
|
|
|
+ if(this.action.type == 1){
|
|
|
|
+ if(this.tableData.length == 1){
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ var startIndex = this.tableData.findIndex(item=>{
|
|
|
|
+ return item.id == this.action.id
|
|
|
|
+ })
|
|
|
|
+ this.tableData.splice(startIndex,1)
|
|
|
|
+ let params = {
|
|
|
|
+ ...this.params,
|
|
|
|
+ ...this.row.searchOption,//检索条件
|
|
|
|
+ orderDTOList: this.sort,//排序
|
|
|
|
+ groupField: this.row.groupBy,
|
|
|
|
+ groupFieldValue: this.row.row.value,
|
|
|
|
+ }
|
|
|
|
+ this.getList2(params,1)
|
|
|
|
+ }else if(this.action.type == 2){
|
|
|
|
+ let params = {
|
|
|
|
+ ...this.params,
|
|
|
|
+ searchQuery:`id=${this.action.id}`,//检索条件
|
|
|
|
+ groupField: this.row.groupBy,
|
|
|
|
+ groupFieldValue: this.row.row.value,
|
|
|
|
+ }
|
|
|
|
+ this.getList2(params,2)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ getList2(params,type){
|
|
|
|
+
|
|
|
|
+ this.$api.queryEvent(params).then(res => {
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ if(type == 1){
|
|
|
|
+ var startIndex = (params.current-1)*size
|
|
|
|
+ var endIndex = this.tableData.length
|
|
|
|
+ var len = endIndex - startIndex
|
|
|
|
+ this.tableData.splice(startIndex,len,...res.data.data)
|
|
|
|
+ this.params.total = res.data.total
|
|
|
|
+ }else if(type == 2){
|
|
|
|
+ var startIndex = this.tableData.findIndex(item=>{
|
|
|
|
+ return item.id == this.action.id
|
|
|
|
+ })
|
|
|
|
+ this.tableData.splice(startIndex,1,...res.data.data)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
getList() {
|
|
getList() {
|
|
if (!this.row) return;
|
|
if (!this.row) return;
|
|
if (this.params.current * this.params.size >= this.params.total) {
|
|
if (this.params.current * this.params.size >= this.params.total) {
|