carDriver.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //资源管理司机
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <el-input
  6. placeholder="请输入内容"
  7. v-model="textInput"
  8. clearable>
  9. </el-input>
  10. <el-button type="primary" class="btn" @click="onclick">
  11. <i class="el-icon-search"></i>查询
  12. </el-button>
  13. <el-button type="primary" class="btn" @click="toInsert">
  14. <i class="el-icon-plus"></i>新增
  15. </el-button>
  16. </div>
  17. <div class="table">
  18. <dilTable v-bind.sync="options">
  19. <el-table-column fixed="right" label="操作" width="100">
  20. <template slot-scope="scope">
  21. <el-button
  22. type="text"
  23. size="small"
  24. @click="updateCarDriver(scope)"
  25. >
  26. 修改
  27. </el-button>
  28. <el-button
  29. type="text"
  30. size="mini"
  31. @click="deleteCarDriver(scope)"
  32. >
  33. 删除
  34. </el-button>
  35. </template>
  36. </el-table-column>
  37. </dilTable>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. export default {
  43. name:"homeworkPath",
  44. data(){
  45. return{
  46. textInput: "" ,
  47. restaurants: [],
  48. options:{
  49. // first请求数据的地址
  50. requestUrl: "/api/v1/rms/getCarDriverList?apiId=420",
  51. },
  52. }
  53. },
  54. methods:{
  55. onclick(){
  56. this.options.requestUrl = "/api/v1/rms/getCarDriverList?apiId=420&con=" +this.textInput;
  57. },
  58. toInsert() {
  59. this.$router.push("/addCarDriver");
  60. },
  61. updateCarDriver(scope){
  62. console.log(scope.row.driverId)
  63. this.$router.push("/editCarDriver/"+scope.row.driverId)
  64. },
  65. deleteCarDriver(scope){
  66. this.$confirm("是否删除", "提示", {
  67. confirmButtonText: "确定",
  68. cancelButtonText: "取消",
  69. type: "warning",
  70. center: true,
  71. })
  72. .then(() => {
  73. this.axios
  74. .post("/api/v1/rms/deleteCarDriver/" + scope.row.driverId)
  75. .then((res) => {
  76. if (res.data.code == 200) {
  77. this.$message({
  78. type: "success",
  79. message: "删除成功!",
  80. });
  81. this.$router.go(0);
  82. } else {
  83. this.$message({
  84. message: "删除失败",
  85. type: "warning",
  86. });
  87. }
  88. });
  89. })
  90. .catch(() => {
  91. this.$message({
  92. type: "info",
  93. message: "删除操作已取消!",
  94. });
  95. });
  96. },
  97. },
  98. }
  99. </script>
  100. <style lang="scss" scode>
  101. .steel_inbound{
  102. .sache{
  103. padding: 1.25rem 0.375rem;
  104. .el-input {
  105. width: 20%;
  106. margin-right: 1.25rem;
  107. }
  108. }
  109. }
  110. </style>