| | |
| | | let OutBoundBtn = this.buttons.find((x) => x.value == 'OutBound') |
| | | if (OutBoundBtn) { |
| | | OutBoundBtn.onClick = function () { |
| | | this.$Message.success('点击了按钮') |
| | | // this.$Message.success('点击了按钮') |
| | | let row = this.$refs.table.getSelected() //获取选中的行 |
| | | if (row <= 0) { |
| | | //如果没有选中行 |
| | |
| | | //示例:调用后台接口 |
| | | if (res.status) { |
| | | this.$Message.success('创建任务成功') |
| | | this.refresh() //刷新表格 |
| | | } else { |
| | | this.$Message.error(res.message) //错误提示 |
| | | } |
| | |
| | | //修改颜色 |
| | | if (column.field == 'roadwayNo') { |
| | | column.formatter = (row) => { |
| | | return '<span style="color: #2d8cf0;">' + row.locationInfo.roadwayNo + '</span>' |
| | | console.log("🚀 ~ this.columns.forEach ~ row:", row) |
| | | return '<span style="color: #2d8cf0;">' + row?.locationInfo?.roadwayNo + '</span>' |
| | | } |
| | | } |
| | | //格式化日期 |
| | |
| | | // 定义一个格式化函数,根据 'locationStatus' 的值返回相应的文本 |
| | | column.formatter = (row) => { |
| | | // 使用 statusMap 对象来获取对应的文本,如果没有匹配则返回 '未知状态' |
| | | return statusMap[row.locationInfo.locationStatus] || '未知状态'; |
| | | return statusMap[row?.locationInfo?.locationStatus] || '未知状态'; |
| | | } |
| | | } |
| | | }) |