notice.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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="120" header-align="center">
  20. <template slot-scope="scope">
  21. <el-button
  22. type="text"
  23. size="small"
  24. @click="noticeDetail(scope)"
  25. >
  26. 详情
  27. </el-button>
  28. <el-button
  29. type="text"
  30. size="small"
  31. @click="updateNotice(scope)"
  32. >
  33. 修改
  34. </el-button>
  35. <el-button
  36. type="text"
  37. size="mini"
  38. @click="deleteNotice(scope)"
  39. >
  40. 删除
  41. </el-button>
  42. </template>
  43. </el-table-column>
  44. </dilTable>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. export default {
  50. name:"homeworkPath",
  51. data(){
  52. return{
  53. textInput: "" ,
  54. restaurants: [],
  55. options:{
  56. // first请求数据的地址
  57. requestUrl: "/api/v1/rms/getNoticeList?apiId=359",
  58. },
  59. }
  60. },
  61. methods:{
  62. onclick(){
  63. this.options.requestUrl = "/api/v1/rms/getNoticeList?apiId=359&con="+this.textInput;
  64. },
  65. toInsert() {
  66. this.$router.push("/addNotice");
  67. },
  68. /*通知详情*/
  69. noticeDetail(scope) {
  70. console.log(scope.row.noticeId)
  71. this.$router.push("/getNoticeById/"+scope.row.noticeId)
  72. },
  73. /*这里要改一改*/
  74. updateNotice(scope){
  75. console.log(scope.row.noticeId)
  76. this.$router.push("/editNotice/"+scope.row.noticeId)
  77. },
  78. deleteNotice(scope){
  79. console.log(scope)
  80. this.$confirm("是否删除", "提示", {
  81. confirmButtonText: "确定",
  82. cancelButtonText: "取消",
  83. type: "warning",
  84. center: true,
  85. })
  86. .then(() => {
  87. console.log("enter")
  88. this.axios
  89. .post("/api/v1/rms/deleteNotice/" + scope.row.noticeId)
  90. .then((res) => {
  91. console.log("res.data.code",res.data.code);
  92. if (res.data.code == 200) {
  93. this.$message({
  94. type: "success",
  95. message: "删除成功!",
  96. });
  97. this.$router.go(0);
  98. } else {
  99. this.$message({
  100. message: "删除失败",
  101. type: "warning",
  102. });
  103. }
  104. });
  105. })
  106. .catch(() => {
  107. this.$message({
  108. type: "info",
  109. message: "删除操作已取消!",
  110. });
  111. });
  112. },
  113. },
  114. }
  115. </script>
  116. <style lang="scss" scode>
  117. .steel_inbound{
  118. .sache{
  119. padding: 1.25rem 0.375rem;
  120. .el-input {
  121. width: 20%;
  122. margin-right: 1.25rem;
  123. }
  124. }
  125. }
  126. </style>