| | |
| | | <div> |
| | | <div style="display: flex; flex-direction: row; justify-content: center; align-items: center;font-size: 24px"> |
| | | <div>当前流程:</div> |
| | | <div v-if="nowProcessId">{{nowProcessName}}</div> |
| | | <div v-if="nowProcessId">{{selectProcessName}}</div> |
| | | <div v-else>未绑定流程</div> |
| | | </div> |
| | | </div> |
| | |
| | | nowProcessId: { // 当前项目绑定的流程id |
| | | required: true, |
| | | type: String |
| | | }, |
| | | nowProcessName: { |
| | | required: true, |
| | | type: String |
| | | } |
| | | }, |
| | | watch: { |
| | | // 监听回显值 |
| | | nowProcessId(newVal, oldVal) { |
| | | projectInfo: { |
| | | handler(newVal, oldVal) { |
| | | console.log("传入值:", newVal, this.processList) |
| | | this.processList.forEach((item,index) => { |
| | | console.log(item.id, newVal, item.id === newVal) |
| | | if(item.id === newVal){ |
| | | console.log("wwwwwww") |
| | | this.selectProcessId = newVal |
| | | this.$nextTick(() => { |
| | | this.$refs.myTable.toggleRowSelection(item); |
| | | }) |
| | | } |
| | | }) |
| | | this.setSelect(this.nowProcessId) |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | selectProcessId: '', // 组件内部选中的流程id |
| | | selectProcessName: '', // 组件内部选中的流程id |
| | | } |
| | | }, |
| | | methods: { |
| | | setSelect(value) { |
| | | console.log("调用值:", value) |
| | | this.processList.forEach((item,index) => { |
| | | console.log(item.id, value, item.id === value) |
| | | if(item.id === value){ |
| | | this.selectProcessName = item.name |
| | | this.$nextTick(() => { |
| | | this.$refs.myTable.toggleRowSelection(item); |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // 实现el-table单选 |
| | | handleSelectionChange(val) { |
| | | console.log(val, "选中") |
| | | if (val.length > 1) { |
| | | this.$refs.myTable.clearSelection(); |
| | | this.$refs.myTable.toggleRowSelection(val.pop()); |
| | | this.$refs.myTable.toggleRowSelection(val[val.length - 1]); |
| | | } |
| | | if(val.length != 0){ |
| | | this.selectProcessId = val[val.length - 1].id; |
| | | console.log("选中id:", this.selectProcessId) |
| | | } |
| | | }, |
| | | // 启动流程 |
| | |
| | | }) |
| | | }, |
| | | handleClose() { |
| | | this.selectProcessId = "" |
| | | this.selectProcessName = "" |
| | | this.$emit("close") |
| | | } |
| | | } |