editMaterial.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <!-- 修改物资信息 -->
  3. <div id="contractDetails">
  4. <page-title>编辑</page-title>
  5. <div class="main">
  6. <span class="text">物资信息</span>
  7. </div>
  8. <div class="contractTitle">
  9. <div class="form-box">
  10. <div class="form-one">
  11. <dil-form :formId="314" v-model="form1"></dil-form>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="button-box">
  16. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  17. <el-button @click="onClickCancel">返回</el-button>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import PageTitle from "@/components/Page/Title";
  23. //import { sjTime } from "@/js/sharedJsFile";
  24. export default {
  25. components: { PageTitle },
  26. data() {
  27. return {
  28. form1: {},
  29. };
  30. },
  31. mounted() {
  32. console.log(this.$route)
  33. this.information();
  34. },
  35. methods: {
  36. information() {
  37. //编辑
  38. this.axios
  39. .post(
  40. "/api/v1/rms/getMaterialById/" +
  41. this.$route.params.materialId
  42. )
  43. .then((res) => {
  44. console.log(res)
  45. res.data.data.forEach((e) => {
  46. this.form1 = e;
  47. console.log(e);
  48. console.log(this.form1);
  49. console.log(this.$route.params.materialId);
  50. });
  51. });
  52. },
  53. // 返回
  54. onClickCancel() {
  55. this.$router.go(-1);
  56. },
  57. // 确认
  58. onClickConfirm() {
  59. console.log(this.form1)
  60. let RmsMaterial = {
  61. materialId:this.form1.materialId,
  62. materialCode:this.form1.materialCode,
  63. materialName:this.form1.materialName,
  64. materialSpecification:this.form1.materialSpecification,
  65. materialModel:this.form1.materialModel,
  66. materialTypeId:this.form1.materialTypeId,
  67. unitOfMeasureId:this.form1.unitOfMeasureId,
  68. materialTheoreticalWeight:this.form1.materialTheoreticalWeight,
  69. };
  70. this.axios
  71. .post(
  72. "/api/v1/rms/updateMaterial",
  73. RmsMaterial
  74. )
  75. .then((res) => {
  76. if (res.data.code == "200") {
  77. this.$router.go(-1);
  78. }
  79. });
  80. },
  81. },
  82. // 取消
  83. cancel() {
  84. this.$router.go(-1);
  85. },
  86. };
  87. </script>
  88. <style lang='scss' scoped>
  89. </style>