addWaterQuality.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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: null,
  78. contractMoistureValue: "",
  79. realWeight: "",
  80. batchId: null,
  81. moistureTonnage: "",
  82. input: "",
  83. restaurants: [],
  84. state: "",
  85. form: {},
  86. option: {
  87. // 表格请求数据的地址
  88. requestUrl: "/api/v1/tms/getCapacityList?apiId=138",
  89. // 控制显示当选列
  90. selectionType: "radio",
  91. waterQualityMap: []
  92. }
  93. };
  94. },
  95. watch: {
  96. resultMoistureContent() {
  97. this.pipeiContarct();
  98. },
  99. batchId() {
  100. this.pipeiContarct();
  101. }
  102. },
  103. mounted() {},
  104. methods: {
  105. currentRadioChange(row) {
  106. this.waterQualityMap = row;
  107. this.batchId = this.waterQualityMap.batchId;
  108. this.pipeiContarct();
  109. },
  110. pipeiContarct() {
  111. if (
  112. this.resultMoistureContent != null &&
  113. this.resultMoistureContent != ""
  114. ) {
  115. let map = {
  116. batchId: this.waterQualityMap.batchId,
  117. resultMoistureContent: this.resultMoistureContent
  118. };
  119. this.axios
  120. .post("/api/v1/tms/getMoistureAndInstallations", map)
  121. .then(res => {
  122. if (res.data.code == 200) {
  123. this.contractMoistureValue =
  124. res.data.data.purchaseContractMoisture;
  125. this.realWeight = res.data.data.resultActualInstallations;
  126. this.moistureTonnage = res.data.data.resultWaterTonnage;
  127. // this.$refs.table.refreshData();
  128. } else {
  129. this.$message.error("失败!");
  130. }
  131. });
  132. }
  133. },
  134. // 新增
  135. makeSure() {
  136. let mapVal = {
  137. resultPlannedDate: sjTime(this.form.planDate),
  138. expectNoticeDate: sjTime(this.form.expectNoticeDate),
  139. resultEmptyHeavyWaterMeter: this.form.resultEmptyHeavyWaterMeter,
  140. resultMoistureContent: this.resultMoistureContent,
  141. resultInspectionFees: this.form.resultInspectionFees,
  142. contractMoistureValue: this.contractMoistureValue,
  143. realWeight: this.realWeight,
  144. moistureTonnage: this.moistureTonnage
  145. };
  146. //判断放货数量是否为数字
  147. function isNumber() {
  148. var value = mapVal.resultMoistureContent;
  149. //验证是否为数字
  150. var patrn = /^(-)?\d+(\.\d+)?$/;
  151. if (patrn.exec(value) == null || value == "") {
  152. return false;
  153. } else {
  154. return true;
  155. }
  156. }
  157. var val = this.value;
  158. if (
  159. mapVal.resultPlannedDate == null ||
  160. mapVal.resultEmptyHeavyWaterMeter == null ||
  161. mapVal.resultMoistureContent == null ||
  162. mapVal.resultInspectionFees == null ||
  163. mapVal.contractMoistureValue == null ||
  164. mapVal.realWeight == null ||
  165. mapVal.moistureTonnage == null
  166. )
  167. this.$message.error("存在空值!");
  168. else if (!isNumber(val)) this.$message.warning("含水率必须为数字");
  169. else
  170. this.axios
  171. .post("/api/v1/tms/addWaterQualityResult", {
  172. mapVal: mapVal,
  173. waterQualityMap: this.waterQualityMap
  174. })
  175. .then(res => {
  176. if (res.data.code == 200) {
  177. this.$message({
  178. type: "success",
  179. message: "新增成功!"
  180. });
  181. // this.$refs.table.refreshData();
  182. this.$router.go(-1);
  183. } else {
  184. this.$message.error("新增失败!");
  185. }
  186. this.$refs["table"].resetField();
  187. });
  188. },
  189. loadAll() {
  190. return [];
  191. },
  192. handleSelect(item) {
  193. console.log(item);
  194. },
  195. onclick() {
  196. this.option.requestUrl =
  197. "/api/v1/tms/getCapacityList?apiId=138&con=" + this.input;
  198. }
  199. }
  200. };
  201. </script>
  202. <style lang="scss" scoped>
  203. .shipTransport {
  204. .form {
  205. display: flex;
  206. .form_box {
  207. width: 320px;
  208. margin-left: 35%;
  209. margin-top: 30px;
  210. margin-right: 20px;
  211. .el-form {
  212. .preview-group {
  213. .el-form-item {
  214. .el-form-item__label {
  215. display: inline-block;
  216. width: 70px !important;
  217. }
  218. .el-form-item__content {
  219. .el-select {
  220. width: 250px;
  221. }
  222. .el-input {
  223. width: 250px;
  224. }
  225. }
  226. }
  227. }
  228. }
  229. }
  230. }
  231. .top {
  232. padding: 1.25rem 0.375rem;
  233. .el-input {
  234. width: 20%;
  235. margin-right: 1.25rem;
  236. }
  237. }
  238. .button_box {
  239. margin-left: 45%;
  240. }
  241. .other {
  242. width: 320px;
  243. margin-left: 35%;
  244. margin-right: 20px;
  245. .el-form {
  246. .preview-group {
  247. .el-form-item {
  248. .el-form-item__label {
  249. display: inline-block;
  250. width: 70px !important;
  251. }
  252. .el-form-item__content {
  253. .el-select {
  254. width: 250px;
  255. }
  256. .el-input {
  257. width: 250px;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. </style>