material.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!--管理原料-->
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <el-input
  6. placeholder="请输入内容"
  7. v-model="inputText"
  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="updateMaterial(scope)"
  25. >
  26. 修改
  27. </el-button>
  28. <el-button
  29. type="text"
  30. size="mini"
  31. @click="deleteMaterial(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. data(){
  44. return{
  45. inputText:"",
  46. options:{
  47. // first请求数据的地址
  48. requestUrl: "/api/v1/rms/getMaterialList?apiId=350",
  49. },
  50. }
  51. },
  52. methods:{
  53. onclick(){
  54. this.options.requestUrl="/api/v1/rms/getMaterialList?apiId=350&con=" + this.inputText;
  55. console.log(this.inputText)
  56. },
  57. toInsert() {
  58. this.$router.push("/addMaterial");
  59. },
  60. updateMaterial(scope){
  61. console.log(scope.row.materialId)
  62. //this.$router.push("/editMaterial/"+scope.row.materialId)
  63. this.$router.push({
  64. name:'editMaterial',
  65. params:{
  66. materialId:scope.row.materialId,
  67. materialTypeName:scope.row.materialTypeName
  68. }
  69. })
  70. },
  71. deleteMaterial(scope){
  72. this.$confirm("是否删除", "提示", {
  73. confirmButtonText: "确定",
  74. cancelButtonText: "取消",
  75. type: "warning",
  76. center: true,
  77. })
  78. .then(() => {
  79. this.axios
  80. .post("/api/v1/rms/deleteMaterial/" + scope.row.materialId)
  81. .then((res) => {
  82. if (res.data.code == 200) {
  83. this.$message({
  84. type: "success",
  85. message: "删除成功!",
  86. });
  87. this.$router.go(0);
  88. } else {
  89. this.$message({
  90. message: "删除失败",
  91. type: "warning",
  92. });
  93. }
  94. });
  95. })
  96. .catch(() => {
  97. this.$message({
  98. type: "info",
  99. message: "删除操作已取消!",
  100. });
  101. });
  102. },
  103. },
  104. }
  105. </script>
  106. <style lang="scss" scode>
  107. .steel_inbound{
  108. .sache{
  109. padding: 1.25rem 0.375rem;
  110. .el-input {
  111. width: 20%;
  112. margin-right: 1.25rem;
  113. }
  114. }
  115. }
  116. </style>