addMaterial.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <!-- 添加物资信息 -->
  3. <div class="addWagonLoad">
  4. <PageTitle>返回</PageTitle>
  5. <div class="form-box" style="margin-right: 10rem">
  6. <dil-form :formId="326" v-model="form1" ref="from1"></dil-form>
  7. </div>
  8. <div class="form-box f1">
  9. <el-input v-model="materialTypeName" disabled> </el-input>
  10. <el-button type="primary" @click="openDrawer">物资种类</el-button>
  11. </div>
  12. <div class="eldrawer">
  13. <el-drawer
  14. :visible.sync="drawer"
  15. :direction="direction"
  16. :before-close="handleClose"
  17. >
  18. <el-input
  19. placeholder="请输入内容"
  20. v-model="inputText"
  21. clearable
  22. style="width:250px"
  23. >
  24. </el-input>
  25. <el-button type="primary" class="btn" @click="onclick">
  26. <i class="el-icon-search"></i>查询
  27. </el-button>
  28. <div>
  29. <dilTable
  30. v-bind.sync="options"
  31. @radio-change="currentRadioChange"
  32. ></dilTable>
  33. </div>
  34. </el-drawer>
  35. </div>
  36. <div class="button-box">
  37. <el-button @click="cancel">取消</el-button>
  38. <el-button type="primary" @click="makeSure">确定</el-button>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import PageTitle from "@/components/Page/Title";
  44. export default {
  45. components: { PageTitle },
  46. data() {
  47. return {
  48. form1: {},
  49. drawer: false,
  50. direction: "rtl",
  51. inputText: "",
  52. materialTypeId: "",
  53. materialTypeName: null,
  54. options: {
  55. requestUrl: "/api/v1/rms/getMaterialTypeList?apiId=376",
  56. selectionType: "radio"
  57. },
  58. mapList: {}
  59. };
  60. },
  61. mounted() {},
  62. methods: {
  63. currentRadioChange(selection) {
  64. console.log(selection);
  65. this.mapList = selection;
  66. this.materialTypeId = this.mapList.materialTypeId;
  67. console.log(this.mapList);
  68. this.materialTypeName = this.mapList.materialTypeName;
  69. },
  70. openDrawer() {
  71. this.options.requestUrl =
  72. "/api/v1/rms/getMaterialTypeList?apiId=376&i=" + new Date();
  73. this.drawer = true;
  74. this.inputText = null;
  75. },
  76. onclick() {
  77. this.options.requestUrl =
  78. "/api/v1/rms/getMaterialTypeList?apiId=376&con=" + this.inputText;
  79. },
  80. makeSure() {
  81. let RmsMaterial = {
  82. materialName: this.form1.materialName,
  83. materialSpecification: this.form1.materialSpecification,
  84. materialModel: this.form1.materialModel,
  85. materialTypeId: this.materialTypeId,
  86. unitOfMeasureId: this.form1.unitOfMeasureId,
  87. materialTheoreticalWeight: this.form1.materialTheoreticalWeight
  88. };
  89. if (RmsMaterial.materialName == null) this.$message.error("存在空值!");
  90. else
  91. this.axios.post("/api/v1/rms/insertMaterial", RmsMaterial).then(res => {
  92. if (res.data.code == 200) {
  93. this.$message({
  94. type: "success",
  95. message: "新增成功!"
  96. });
  97. // this.$refs.table.refreshData();
  98. this.$router.go(-1);
  99. } else if (res.data.code == "201") {
  100. this.$message.warning("该物资已存在");
  101. } else {
  102. this.$message.error("新增失败");
  103. }
  104. //this.$refs['table'].resetField();
  105. });
  106. },
  107. // 取消
  108. cancel() {
  109. this.$router.go(-1);
  110. }
  111. },
  112. handleClose(done) {
  113. this.$confirm("确认关闭?")
  114. .then(_ => {
  115. done();
  116. })
  117. .catch(_ => {});
  118. }
  119. };
  120. </script>
  121. <style lang="scss">
  122. .button-box {
  123. display: flex;
  124. justify-content: center;
  125. .el-button {
  126. width: 80px;
  127. margin-right: 10px;
  128. }
  129. }
  130. .disableBox {
  131. display: flex;
  132. text-align: center;
  133. align-items: center;
  134. justify-content: center;
  135. margin-top: 2rem;
  136. margin-bottom: 1.25rem;
  137. margin-right: 10px;
  138. }
  139. .btn-left {
  140. margin-left: 470px;
  141. }
  142. .input {
  143. margin-left: 90px;
  144. }
  145. .common {
  146. font-weight: 700;
  147. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
  148. Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  149. font-size: 1rem;
  150. cursor: default;
  151. color: #2c3e50;
  152. }
  153. .f1 {
  154. display: flex;
  155. justify-content: center;
  156. align-items: center;
  157. margin-top: 20px;
  158. .el-input {
  159. width: 250px;
  160. }
  161. }
  162. .f11 {
  163. margin-top: -3rem;
  164. // margin-left: 29rem;
  165. }
  166. .f2 {
  167. margin-top: -2.5rem;
  168. margin-left: 20.7rem;
  169. }
  170. .f3 {
  171. margin-top: -2.5rem;
  172. margin-left: 25rem;
  173. }
  174. .form-box {
  175. display: flex;
  176. justify-content: center;
  177. align-items: center;
  178. .el-form-item {
  179. display: flex;
  180. justify-content: center;
  181. .el-form-item__label {
  182. display: flex;
  183. align-items: center;
  184. }
  185. .el-form-item__content {
  186. .el-input {
  187. .el-input__inner {
  188. width: 250px;
  189. }
  190. }
  191. }
  192. }
  193. }
  194. </style>