addSupplier.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <!-- 添加供应商信息 -->
  3. <div class="addWagonLoad">
  4. <PageTitle>返回</PageTitle>
  5. <el-divider content-position="left">原料供应商信息</el-divider>
  6. <div class="form-box" style="margin-right: 10rem">
  7. <dil-form :formId="320" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. <div class="button-box">
  10. <el-button @click="cancel">取消</el-button>
  11. <el-button type="primary" @click="makeSure">确定</el-button>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import PageTitle from "@/components/Page/Title";
  17. export default {
  18. components: { PageTitle },
  19. data() {
  20. return {
  21. form1: {},
  22. value: undefined,
  23. };
  24. },
  25. mounted() {},
  26. methods: {
  27. makeSure() {
  28. console.log(this.form1)
  29. let RmsSupplier = {
  30. supplierName: this.form1.supplierName,
  31. supplierAddress: this.form1.supplierAddress,
  32. supplierRegisterDate: sjTime(this.form1.supplierRegisterDate),
  33. supplierContactsName: this.form1.supplierContactsName,
  34. supplierContactNumber: this.form1.supplierContactNumber
  35. };
  36. if(
  37. RmsSupplier.supplierName==null ||
  38. RmsSupplier.supplierAddress==null ||
  39. RmsSupplier.supplierRegisterDate==null ||
  40. RmsSupplier.supplierContactsName==null ||
  41. RmsSupplier.supplierContactNumber==null
  42. )this.$message.error("存在空值!");
  43. else
  44. this.axios
  45. .post(
  46. "/api/v1/rms/insertSupplier",
  47. RmsSupplier
  48. )
  49. .then((res) => {
  50. if (res.data.code == 200) {
  51. this.$message({
  52. type: "success",
  53. message: "新增成功!",
  54. });
  55. // this.$refs.table.refreshData();
  56. this.$router.go(-1);
  57. } else {
  58. this.$message.error("新增失败,可能存在重复!");
  59. }
  60. this.$refs['table'].resetField();
  61. });
  62. },
  63. // 取消
  64. cancel() {
  65. this.$router.go(-1);
  66. },
  67. },
  68. };
  69. </script>
  70. <style lang='scss' >
  71. .button-box{
  72. display: flex;
  73. text-align: center;
  74. align-items: center;
  75. justify-content: center;
  76. margin-top: 0.3125rem;
  77. margin-bottom: 1.25rem;
  78. }
  79. .form-box{
  80. display: flex;
  81. justify-content: center;
  82. .el-form-item{
  83. display: flex;
  84. justify-content: center;
  85. .el-form-item__label{
  86. display: flex;
  87. align-items: center;
  88. }
  89. .el-form-item__content{
  90. .el-input{
  91. .el-input__inner{
  92. width: 250px;
  93. }
  94. }
  95. }
  96. }
  97. }
  98. </style>