addMaterial.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. options:{
  52. requestUrl:"/api/v1/rms/getMaterialTypeList?apiId=376",
  53. selectionType:"radio",
  54. mapList:[]
  55. }
  56. };
  57. },
  58. mounted() {},
  59. methods: {
  60. currentRadioChange(selection){
  61. this.mapList=selection,
  62. console.log(this.mapList)
  63. this.materialTypeName=this.mapList.materialTypeName
  64. },
  65. onclick(){
  66. this.options.requestUrl="/api/v1/rms/getMaterialTypeList?apiId=376&con=" +this.inputText;
  67. },
  68. makeSure() {
  69. let RmsMaterial = {
  70. materialCode:this.form1.materialCode,
  71. materialName:this.form1.materialName,
  72. materialSpecification:this.form1.materialSpecification,
  73. materialModel:this.form1.materialModel,
  74. materialTypeId:this.mapList.materialTypeId,
  75. unitOfMeasureId:this.form1.unitOfMeasureId,
  76. materialTheoreticalWeight:this.form1.materialTheoreticalWeight,
  77. };
  78. if(
  79. RmsMaterial.materialCode==null ||
  80. RmsMaterial.materialName==null ||
  81. RmsMaterial.materialSpecification==null ||
  82. RmsMaterial.materialModel==null ||
  83. RmsMaterial.materialTypeId==null ||
  84. RmsMaterial.unitOfMeasureId==null ||
  85. RmsMaterial.materialTheoreticalWeight==null
  86. )this.$message.error("存在空值!");
  87. else
  88. this.axios
  89. .post(
  90. "/api/v1/rms/insertMaterial",
  91. RmsMaterial
  92. )
  93. .then((res) => {
  94. if (res.data.code == 200) {
  95. this.$message({
  96. type: "success",
  97. message: "新增成功!",
  98. });
  99. // this.$refs.table.refreshData();
  100. this.$router.go(-1);
  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: 1.5rem;
  136. margin-bottom: 1.25rem;
  137. }
  138. .btn-left {
  139. margin-left: 470px;
  140. }
  141. .input {
  142. margin-left: 90px;
  143. }
  144. .common{
  145. font-weight: 700;
  146. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
  147. Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  148. font-size: 1rem;
  149. cursor: default;
  150. color: #2c3e50;
  151. }
  152. .f1{
  153. margin-top: -2.5rem;
  154. margin-left: 22.3rem;
  155. }
  156. .f11{
  157. margin-top: -3rem;
  158. // margin-left: 29rem;
  159. }
  160. .f2{
  161. margin-top: -2.5rem;
  162. margin-left: 20.7rem;
  163. }
  164. .f3{
  165. margin-top: -2.5rem;
  166. margin-left: 25rem;
  167. }
  168. .form-box{
  169. display: flex;
  170. justify-content: center;
  171. .el-form-item{
  172. display: flex;
  173. justify-content: center;
  174. .el-form-item__label{
  175. display: flex;
  176. align-items: center;
  177. }
  178. .el-form-item__content{
  179. .el-input{
  180. .el-input__inner{
  181. width: 250px;
  182. }
  183. }
  184. }
  185. }
  186. }
  187. </style>