updateShipmentInstructions.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <!-- 修改装船指令 -->
  3. <div class="shipTransport">
  4. <page-title>返回</page-title>
  5. <div class="form">
  6. <div class="form_box">
  7. <dil-form :formId="114" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. </div>
  10. <!-- 确定和取消 -->
  11. <div class="button_box">
  12. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  13. <el-button @click="onClickCancel">返回</el-button>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import PageTitle from "@/components/Page/Title";
  19. import { sjTime } from "@/utils/sharedJsFile";
  20. export default {
  21. components: { PageTitle },
  22. data() {
  23. return {
  24. form1: {},
  25. };
  26. },
  27. mounted() {
  28. this.information();
  29. },
  30. methods: {
  31. information() {
  32. //编辑装船指令
  33. this.axios
  34. .post(
  35. "/api/v1/tms/getShipmentInstructions/" +
  36. this.$route.params.instructionsId
  37. )
  38. .then((res) => {
  39. res.data.data.forEach((e) => {
  40. this.form1 = e;
  41. });
  42. });
  43. },
  44. handleCheckedCitiesChange(value) {
  45. console.log(value);
  46. },
  47. // 返回
  48. onClickCancel() {
  49. this.$router.go(-1);
  50. },
  51. currentRadioChange(row) {
  52. this.aaaa = row;
  53. },
  54. // 确认
  55. onClickConfirm() {
  56. let omsshipShipmentInstructions = {
  57. shipmentInstructionsId: this.$route.params.instructionsId,
  58. // batchId: this.form1.batchId,
  59. instructionsTotalTonnage: this.form1.instructionsTotalTonnage,
  60. instructionTime: sjTime(this.form1.instructionTime),
  61. };
  62. //判断合计吨位是否为数字
  63. function isNumber() {
  64. var value = omsshipShipmentInstructions.instructionsTotalTonnage;
  65. //验证是否为数字
  66. var patrn = /^(-)?\d+(\.\d+)?$/;
  67. if (patrn.exec(value) == null || value == "") {
  68. return false;
  69. } else {
  70. return true;
  71. }
  72. }
  73. var val = this.value;
  74. if (
  75. omsshipShipmentInstructions.instructionsTotalTonnage == null ||
  76. omsshipShipmentInstructions.instructionTime==null
  77. )
  78. this.$message.error("存在空值!");
  79. else if (!isNumber(val)) this.$message.warning("合计吨位请填写数字");
  80. else
  81. this.axios
  82. .post(
  83. "/api/v1/tms/updateShipmentInstructions",
  84. omsshipShipmentInstructions
  85. )
  86. .then((res) => {
  87. if (res.data.code == 200) {
  88. this.$message({
  89. type: "success",
  90. message: "修改成功!",
  91. });
  92. // this.$refs.table.refreshData();
  93. this.$router.go(-1);
  94. } else {
  95. this.$message.error("修改失败!");
  96. }
  97. this.$refs["table"].resetField();
  98. });
  99. },
  100. },
  101. };
  102. </script>
  103. <style lang="scss">
  104. .shipTransport {
  105. .form {
  106. display: flex;
  107. .form_box {
  108. width: 320px;
  109. margin-left: 35%;
  110. margin-top: 30px;
  111. margin-right: 20px;
  112. .el-form {
  113. .preview-group {
  114. .el-form-item {
  115. .el-form-item__label {
  116. display: inline-block;
  117. width: 70px !important;
  118. }
  119. .el-form-item__content {
  120. .el-select {
  121. width: 250px;
  122. }
  123. .el-input {
  124. width: 250px;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. .button_box {
  133. margin-left: 45%;
  134. }
  135. }
  136. </style>