addMaterial.vue 4.4 KB

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