addMaterial.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <!-- 添加物资信息 -->
  3. <div class="addWagonLoad">
  4. <PageTitle>返回</PageTitle>
  5. <el-divider content-position="left">物资信息</el-divider>
  6. <div class="form-box" style="margin-right: 10rem">
  7. <dil-form :formId="326" v-model="form1" ref="from1"></dil-form>
  8. </div>
  9. <div class="form-box f1">
  10. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  11. <div class="disableBox">
  12. <el-form-item>
  13. <el-input v-model="materialTypeName" disabled>
  14. </el-input>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button type="primary" @click="drawer = true">物资种类</el-button>
  18. </el-form-item>
  19. </div>
  20. </el-form>
  21. </div>
  22. <el-drawer
  23. :visible.sync="drawer"
  24. :direction="direction"
  25. :before-close="handleClose">
  26. <el-input
  27. placeholder="请输入内容"
  28. v-model="inputText"
  29. clearable>
  30. </el-input>
  31. <el-button type="primary" class="btn" @click="onclick">
  32. <i class="el-icon-search"></i>查询
  33. </el-button>
  34. <div><dilTable v-bind.sync="options" @radio-change="currentRadioChange" ></dilTable></div>
  35. </el-drawer>
  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. 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. console.log(this.mapList)
  64. this.materialTypeName=this.mapList.materialTypeName
  65. },
  66. onclick(){
  67. this.options.requestUrl="/api/v1/rms/getMaterialTypeList?apiId=376&con=" +this.inputText;
  68. },
  69. makeSure() {
  70. let RmsMaterial = {
  71. materialCode:this.form1.materialCode,
  72. materialName:this.form1.materialName,
  73. materialSpecification:this.form1.materialSpecification,
  74. materialModel:this.form1.materialModel,
  75. materialTypeId:this.mapList.materialTypeId,
  76. unitOfMeasureId:this.form1.unitOfMeasureId,
  77. materialTheoreticalWeight:this.form1.materialTheoreticalWeight,
  78. };
  79. if(
  80. RmsMaterial.materialCode==null ||
  81. RmsMaterial.materialName==null ||
  82. RmsMaterial.materialSpecification==null ||
  83. RmsMaterial.materialModel==null ||
  84. RmsMaterial.materialTypeId==null ||
  85. RmsMaterial.unitOfMeasureId==null ||
  86. RmsMaterial.materialTheoreticalWeight==null
  87. )this.$message.error("存在空值!");
  88. else
  89. this.axios
  90. .post(
  91. "/api/v1/rms/insertMaterial",
  92. RmsMaterial
  93. )
  94. .then((res) => {
  95. if (res.data.code == 200) {
  96. this.$message({
  97. type: "success",
  98. message: "新增成功!",
  99. });
  100. // this.$refs.table.refreshData();
  101. this.$router.go(-1);
  102. } else {
  103. this.$message.error("新增失败,可能存在重复!");
  104. }
  105. this.$refs['table'].resetField();
  106. });
  107. },
  108. // 取消
  109. cancel() {
  110. this.$router.go(-1);
  111. },
  112. },
  113. handleClose(done) {
  114. this.$confirm('确认关闭?')
  115. .then(_ => {
  116. done();
  117. })
  118. .catch(_ => {});
  119. }
  120. };
  121. </script>
  122. <style lang='scss' >
  123. .button-box{
  124. display: flex;
  125. justify-content: center;
  126. .el-button{
  127. width: 80px;
  128. margin-right: 10px;
  129. }
  130. }
  131. .disableBox{
  132. display: flex;
  133. text-align: center;
  134. align-items: center;
  135. justify-content: center;
  136. margin-top: 1.5rem;
  137. margin-bottom: 1.25rem;
  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. margin-top: -2.5rem;
  155. margin-left: 22.3rem;
  156. }
  157. .f11{
  158. margin-top: -3rem;
  159. // margin-left: 29rem;
  160. }
  161. .f2{
  162. margin-top: -2.5rem;
  163. margin-left: 20.7rem;
  164. }
  165. .f3{
  166. margin-top: -2.5rem;
  167. margin-left: 25rem;
  168. }
  169. .form-box{
  170. display: flex;
  171. justify-content: center;
  172. .el-form-item{
  173. display: flex;
  174. justify-content: center;
  175. .el-form-item__label{
  176. display: flex;
  177. align-items: center;
  178. }
  179. .el-form-item__content{
  180. .el-input{
  181. .el-input__inner{
  182. width: 250px;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. </style>