addShipmentInstructions.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. <span> 二程:海港-江港</span>
  9. <el-switch
  10. v-model="status"
  11. active-color="#13ce66"
  12. inactive-color="#909399"
  13. @change="changeStatus"
  14. >
  15. </el-switch>
  16. </div>
  17. <div class="liulan">
  18. <el-button type="primary" class="btn" @click="onDrawer">浏览</el-button>
  19. </div>
  20. </div>
  21. <!-- 确定和取消 -->
  22. <div class="button_box">
  23. <el-button @click="cancel">取消</el-button>
  24. <el-button type="primary" @click="makeSure">确定</el-button>
  25. </div>
  26. <!-- 模态框 -->
  27. <el-drawer
  28. :visible.sync="drawer"
  29. :direction="direction"
  30. :before-close="handleClose"
  31. size="35%"
  32. >
  33. <el-input
  34. placeholder="请输入内容"
  35. v-model="input"
  36. style="margin-top: 10px; margin-left: 20px; width: 250px"
  37. clearable
  38. >
  39. </el-input>
  40. <el-button
  41. type="primary"
  42. class="btn"
  43. @click="onclick()"
  44. style="margin-bottom: 15px"
  45. >
  46. <i class="el-icon-search"></i>查询
  47. </el-button>
  48. <dilTable
  49. v-bind.sync="options"
  50. @radio-change="currentRadioChange1"
  51. ></dilTable>
  52. </el-drawer>
  53. </div>
  54. </template>
  55. <script>
  56. import PageTitle from "@/components/Page/Title";
  57. import { sjTime, isNumber } from "@/utils/sharedJsFile";
  58. export default {
  59. components: { PageTitle },
  60. data() {
  61. return {
  62. drawer: false,
  63. direction: "rtl",
  64. input: "",
  65. options: {
  66. requestUrl: "/api/v1/tms/getBatchListForAttorney?apiId=383",
  67. selectionType: "radio",
  68. maplist: [],
  69. },
  70. status: false,
  71. form1: {},
  72. value: undefined,
  73. batchId: "",
  74. };
  75. },
  76. mounted() {},
  77. methods: {
  78. onDrawer() {
  79. this.drawer = true;
  80. },
  81. changeStatus(){
  82. this.status=true,
  83. console.log("aaa",this.status);
  84. },
  85. onclick() {
  86. this.options.requestUrl =
  87. "/api/v1/tms/getBatchList?apiId=383&con=" + this.input;
  88. },
  89. currentRadioChange1(selection) {
  90. this.maplist = selection;
  91. if (JSON.stringify(this.maplist).length > 2) {
  92. this.$set(
  93. this.form1,
  94. "batchId",
  95. selection.resultForeignShipName +
  96. "-" +
  97. selection.materialName +
  98. "-" +
  99. selection.infactoryShipName
  100. );
  101. this.batchId = selection.batchId;
  102. }
  103. },
  104. handleClose(done) {
  105. done();
  106. },
  107. // 确定
  108. makeSure() {
  109. if (this.batchId == "" || this.batchId == undefined) {
  110. this.$message.warning("请选择批次号");
  111. return;
  112. }
  113. let omsshipShipmentInstructions = {
  114. batchId: this.maplist.batchId,
  115. instructionsTotalTonnage: this.form1.instructionsTotalTonnage,
  116. instructionTime: sjTime(this.form1.instructionTime),
  117. statu:this.status,
  118. };
  119. //判断合计吨位是否为数字
  120. function isNumber() {
  121. var value = omsshipShipmentInstructions.instructionsTotalTonnage;
  122. //验证是否为数字
  123. var patrn = /^(-)?\d+(\.\d+)?$/;
  124. if (patrn.exec(value) == null || value == "") {
  125. return false;
  126. } else {
  127. return true;
  128. }
  129. }
  130. var val = this.value;
  131. if (
  132. omsshipShipmentInstructions.batchId == null ||
  133. omsshipShipmentInstructions.instructionsTotalTonnage == null ||
  134. omsshipShipmentInstructions.instructionTime == null
  135. )
  136. this.$message.error("存在空值!");
  137. else if (!isNumber(val)) this.$message.warning("合计吨位请填写数字");
  138. else
  139. this.axios
  140. .post(
  141. "/api/v1/tms/addShipmentInstructions",
  142. omsshipShipmentInstructions
  143. )
  144. .then((res) => {
  145. if (res.data.code == "200") {
  146. this.$message({
  147. type: "success",
  148. message: "新增成功",
  149. });
  150. }
  151. this.$router.go(-1);
  152. });
  153. },
  154. // 取消
  155. cancel() {
  156. this.$router.go(-1);
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang="scss">
  162. .shipTransport {
  163. .form {
  164. display: flex;
  165. .form_box {
  166. width: 320px;
  167. margin-left: 35%;
  168. margin-top: 30px;
  169. margin-right: 20px;
  170. .el-form {
  171. .preview-group {
  172. .el-form-item {
  173. .el-form-item__label {
  174. display: inline-block;
  175. width: 70px !important;
  176. }
  177. .el-form-item__content {
  178. .el-select {
  179. width: 250px;
  180. }
  181. .el-input {
  182. width: 250px;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. }
  190. .liulan {
  191. width: 120px;
  192. margin-top: 30px;
  193. .el-button {
  194. width: 100px !important;
  195. margin: auto;
  196. }
  197. .btn {
  198. margin-top: 0px;
  199. }
  200. .btn1 {
  201. margin-top: 13px;
  202. }
  203. .btn2 {
  204. margin-top: 67px;
  205. }
  206. }
  207. .button_box {
  208. margin-left: 42.5%;
  209. }
  210. }
  211. </style>