| | |
| | | prop="status$" |
| | | label="状态"> |
| | | </el-table-column> |
| | | <!-- <el-table-column--> |
| | | <!-- prop=""--> |
| | | <!-- label="操作">--> |
| | | <!-- <el-button type="primary" icon="el-icon-edit" circle></el-button>--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column |
| | | label="操作" |
| | | type="template"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | :type="scope.row.status === 0 ? 'primary' : 'danger'" |
| | | size="small" |
| | | @click="toggleStatus(scope.$index, scope.row)"> |
| | | {{ scope.row.status === 0 ? '禁用' : '解除禁用' }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | |
| | | } |
| | | } |
| | | }, |
| | | toggleStatus(index, row) { |
| | | const currentStatus = row.status; |
| | | const targetStatus = currentStatus === 0 ? 1 : 0; |
| | | |
| | | this.$confirm(`确认要${currentStatus === 0 ? '禁用' : '启用'}该设备吗?`, '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | $.ajax({ |
| | | url: baseUrl + "/rgv/disable/rgv/status", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | data: { |
| | | rgvId: row.rgvNo, |
| | | status: targetStatus |
| | | }, |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | this.$message.success(`状态更新成功`); |
| | | row.status$ = targetStatus; // 更新前端状态 |
| | | } else { |
| | | this.$message.error('状态更新失败'); |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | handleChangeValueRight(val) { |
| | | console.log("33333"+val); |
| | | |