addWaterQuality.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <!-- 新增水分质检信息 -->
  3. <div class="shipTransport">
  4. <page-title>返回</page-title>
  5. <!-- 第一部分 -->
  6. <div class="top">
  7. <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
  8. <el-button type="primary" class="btn" @click="onclick()">
  9. <i class="el-icon-search"></i>查询
  10. </el-button>
  11. </div>
  12. <dilTable v-bind.sync="option" @radio-change="currentRadioChange">
  13. </dilTable>
  14. <div class="form">
  15. <!-- 第二部分 -->
  16. <div class="form_box">
  17. <dil-form :formId="128" v-model="form"></dil-form>
  18. </div>
  19. </div>
  20. <!-- 下方内容 -->
  21. <div class="other">
  22. <el-form :inline="true">
  23. <el-form-item>
  24. <label class="el-form-item__label" style="width: auto">含水率</label>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-input placeholder="" v-model="resultMoistureContent"></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <label class="el-form-item__label" style="width: auto"
  31. >合同水分值</label
  32. >
  33. </el-form-item>
  34. <el-form-item>
  35. <el-input
  36. placeholder=""
  37. v-model="contractMoistureValue"
  38. :disabled="true"
  39. ></el-input>
  40. </el-form-item>
  41. <el-form-item>
  42. <label class="el-form-item__label" style="width: auto"
  43. >实装吨位</label
  44. >
  45. </el-form-item>
  46. <el-form-item>
  47. <el-input
  48. placeholder=""
  49. v-model="realWeight"
  50. :disabled="true"
  51. ></el-input>
  52. </el-form-item>
  53. <el-form-item>
  54. <label class="el-form-item__label" style="width: auto"
  55. >水分吨位</label
  56. >
  57. </el-form-item>
  58. <el-form-item>
  59. <el-input
  60. placeholder=""
  61. v-model="moistureTonnage"
  62. :disabled="true"
  63. ></el-input>
  64. </el-form-item>
  65. </el-form>
  66. <el-button type="primary" @click="makeSure">新增水分质检信息</el-button>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import PageTitle from "@/components/Page/Title";
  72. import { sjTime } from "@/utils/sharedJsFile";
  73. export default {
  74. components: { PageTitle },
  75. data() {
  76. return {
  77. resultMoistureContent: "",
  78. contractMoistureValue: "",
  79. realWeight: "",
  80. moistureTonnage: "",
  81. input: "",
  82. restaurants: [],
  83. state: "",
  84. form: {},
  85. option: {
  86. // 表格请求数据的地址
  87. requestUrl: "/api/v1/tms/getCapacityList?apiId=138",
  88. // 控制显示当选列
  89. selectionType: "radio",
  90. waterQualityMap: [],
  91. },
  92. };
  93. },
  94. mounted() {},
  95. methods: {
  96. currentRadioChange(row) {
  97. this.waterQualityMap = row;
  98. if (
  99. this.resultMoistureContent != null &&
  100. this.resultMoistureContent != ""
  101. ) {
  102. let map = {
  103. batchId: this.waterQualityMap.batchId,
  104. resultMoistureContent: this.resultMoistureContent,
  105. };
  106. console.log(map);
  107. this.axios
  108. .post("/api/v1/tms/getMoistureAndInstallations", map)
  109. .then((res) => {
  110. if (res.data.code == 200) {
  111. this.contractMoistureValue =
  112. res.data.data.purchaseContractMoisture;
  113. this.realWeight = res.data.data.resultActualInstallations;
  114. this.moistureTonnage = res.data.data.resultWaterTonnage;
  115. // this.$refs.table.refreshData();
  116. } else {
  117. this.$message.error("失败!");
  118. }
  119. });
  120. }
  121. },
  122. // 新增
  123. makeSure() {
  124. let mapVal = {
  125. resultPlannedDate: sjTime(this.form.planDate),
  126. expectNoticeDate: sjTime(this.form.expectNoticeDate),
  127. resultEmptyHeavyWaterMeter: this.form.resultEmptyHeavyWaterMeter,
  128. resultMoistureContent: this.resultMoistureContent,
  129. resultInspectionFees: this.form.resultInspectionFees,
  130. contractMoistureValue: this.contractMoistureValue,
  131. realWeight: this.realWeight,
  132. moistureTonnage: this.moistureTonnage,
  133. };
  134. //判断放货数量是否为数字
  135. function isNumber() {
  136. var value = mapVal.resultMoistureContent;
  137. //验证是否为数字
  138. var patrn = /^(-)?\d+(\.\d+)?$/;
  139. if (patrn.exec(value) == null || value == "") {
  140. return false;
  141. } else {
  142. return true;
  143. }
  144. }
  145. var val = this.value;
  146. if (
  147. mapVal.resultPlannedDate == null ||
  148. mapVal.resultEmptyHeavyWaterMeter == null ||
  149. mapVal.resultMoistureContent == null ||
  150. mapVal.resultInspectionFees == null ||
  151. mapVal.contractMoistureValue == null ||
  152. mapVal.realWeight == null ||
  153. mapVal.moistureTonnage == null
  154. )
  155. this.$message.error("存在空值!");
  156. else if (!isNumber(val)) this.$message.warning("含水率必须为数字");
  157. else
  158. this.axios
  159. .post("/api/v1/tms/addWaterQualityResult", {
  160. mapVal: mapVal,
  161. waterQualityMap: this.waterQualityMap,
  162. })
  163. .then((res) => {
  164. if (res.data.code == 200) {
  165. this.$message({
  166. type: "success",
  167. message: "新增成功!",
  168. });
  169. // this.$refs.table.refreshData();
  170. this.$router.go(-1);
  171. } else {
  172. this.$message.error("新增失败!");
  173. }
  174. this.$refs["table"].resetField();
  175. });
  176. },
  177. loadAll() {
  178. return [];
  179. },
  180. handleSelect(item) {
  181. console.log(item);
  182. },
  183. onclick() {
  184. this.option.requestUrl =
  185. "/api/v1/tms/getCapacityList?apiId=138&con=" + this.input;
  186. },
  187. },
  188. };
  189. </script>
  190. <style lang='scss' scoped>
  191. .shipTransport {
  192. .form {
  193. display: flex;
  194. .form_box {
  195. width: 320px;
  196. margin-left: 35%;
  197. margin-top: 30px;
  198. margin-right: 20px;
  199. .el-form {
  200. .preview-group {
  201. .el-form-item {
  202. .el-form-item__label {
  203. display: inline-block;
  204. width: 70px !important;
  205. }
  206. .el-form-item__content {
  207. .el-select {
  208. width: 250px;
  209. }
  210. .el-input {
  211. width: 250px;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. .top {
  220. padding: 1.25rem 0.375rem;
  221. .el-input {
  222. width: 20%;
  223. margin-right: 1.25rem;
  224. }
  225. }
  226. .button_box {
  227. margin-left: 45%;
  228. }
  229. .other {
  230. width: 320px;
  231. margin-left: 35%;
  232. margin-right: 20px;
  233. .el-form {
  234. .preview-group {
  235. .el-form-item {
  236. .el-form-item__label {
  237. display: inline-block;
  238. width: 70px !important;
  239. }
  240. .el-form-item__content {
  241. .el-select {
  242. width: 250px;
  243. }
  244. .el-input {
  245. width: 250px;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. }
  252. }
  253. </style>