editSupplier.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <!-- 修改供应商信息 -->
  3. <div id="contractDetails">
  4. <page-title>编辑</page-title>
  5. <div class="main">
  6. </div>
  7. <div class="contractTitle">
  8. <div class="form-box">
  9. <div class="form-one">
  10. <dil-form :formId="321" v-model="form1"></dil-form>
  11. </div>
  12. </div>
  13. </div>
  14. <div class="button-box">
  15. <el-button @click="onClickCancel">返回</el-button>
  16. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import PageTitle from "@/components/Page/Title";
  22. export default {
  23. components: { PageTitle },
  24. data() {
  25. return {
  26. form1: {},
  27. };
  28. },
  29. mounted() {
  30. console.log(this.$route)
  31. this.information();
  32. },
  33. methods: {
  34. information() {
  35. console.log("supplierId",this.$router.params);
  36. //编辑
  37. this.axios
  38. .post(
  39. "/api/v1/rms/getSupplierById/" +
  40. this.$route.params.supplierId
  41. )
  42. .then((res) => {
  43. console.log(res)
  44. res.data.data.forEach((e) => {
  45. this.form1 = e;
  46. console.log(e);
  47. console.log(this.form1);
  48. console.log(this.$route.params.supplierId);
  49. });
  50. });
  51. },
  52. // 返回
  53. onClickCancel() {
  54. this.$router.go(-1);
  55. },
  56. // 确认
  57. onClickConfirm() {
  58. console.log(this.form1)
  59. let RmsSupplier={
  60. supplierId: this.form1.supplierId,
  61. supplierName: this.form1.supplierName,
  62. supplierAddress: this.form1.supplierAddress,
  63. supplierRegisterDate: sjTime(this.form1.supplierRegisterDate),
  64. supplierContactsName: this.form1.supplierContactsName,
  65. supplierContactNumber: this.form1.supplierContactNumber
  66. };
  67. if(
  68. RmsSupplier.supplierName==null ||
  69. RmsSupplier.supplierAddress==null ||
  70. RmsSupplier.supplierRegisterDate==null ||
  71. RmsSupplier.supplierContactsName==null ||
  72. RmsSupplier.supplierContactNumber==null
  73. )this.$message.error("存在空值!");
  74. this.axios
  75. .post(
  76. "/api/v1/rms/updateSupplier",
  77. RmsSupplier
  78. )
  79. .then((res) => {
  80. if (res.data.code == "200") {
  81. this.$router.go(-1);
  82. }
  83. });
  84. },
  85. },
  86. };
  87. </script>
  88. <style lang='scss' scoped>
  89. .form-box,
  90. .button-box{
  91. display: flex;
  92. justify-content: center;
  93. .el-button{
  94. width: 80px;
  95. margin-right: 10px;
  96. }
  97. }
  98. </style>