| | |
| | | }, |
| | | methods: { |
| | | handleOk() { |
| | | if(this.list.length == 0) { |
| | | this.$modal.msgError("请选择至少一项!"); |
| | | return |
| | | } else{ |
| | | this.open = false |
| | | this.$emit('add', this.list); |
| | | } |
| | | |
| | | }, |
| | | handleQuery() { |
| | | this.getList(); |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | if (selection.length > 1) { |
| | | // 如果选择了多行,保留最后一行 |
| | | this.$refs.elTable.clearSelection(); // 清空所有选择 |
| | | this.$refs.elTable.toggleRowSelection(selection[selection.length - 1]); // 重新选择最后一项 |
| | | } |
| | | |
| | | // 获取最后选择的行 |
| | | this.list = [selection[selection.length - 1]]; |
| | | this.list = selection |
| | | }, |
| | | getList() { |
| | | this.loading = true; |
| | | selectZT({ |
| | | proId: this.proId |
| | | }).then((res) => { |
| | | if (res.data) { |
| | | if (res.data.length>0) { |
| | | this.open = true |
| | | this.dataList = res.data; |
| | | this.loading = false; |
| | | } else { |
| | | this.open = false |
| | | } |
| | | }); |
| | | }, |