addMaterial.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. text-align: center;
  126. align-items: center;
  127. justify-content: center;
  128. margin-top: 0.3125rem;
  129. margin-bottom: 1.25rem;
  130. }
  131. .disableBox{
  132. margin-top: 1.7125rem;
  133. margin-bottom: 1.25rem;
  134. margin-left: -27.5rem;
  135. }
  136. .btn-left {
  137. margin-left: 470px;
  138. }
  139. .input {
  140. margin-left: 90px;
  141. }
  142. .label{
  143. margin-left: 445px;
  144. margin-bottom: -30px;
  145. font: bold;
  146. font-size: 1rem;
  147. padding-left: -30px;
  148. font-family:Arial, Helvetica, sans-serif;
  149. margin-bottom:20px;
  150. }
  151. .label2{
  152. margin-left: 425px;
  153. margin-bottom: -30px;
  154. font: bold;
  155. font-size: 1rem;
  156. font-family:Arial, Helvetica, sans-serif
  157. }
  158. .label1{
  159. margin-left: 345px;
  160. margin-bottom: -30px;
  161. font: bold;
  162. }
  163. .common{
  164. font-weight: 700;
  165. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
  166. Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  167. font-size: 1rem;
  168. cursor: default;
  169. color: #2c3e50;
  170. }
  171. .f1{
  172. margin-top: -2.5rem;
  173. margin-left: 22.3rem;
  174. }
  175. .f11{
  176. margin-top: -3rem;
  177. // margin-left: 29rem;
  178. }
  179. .f2{
  180. margin-top: -2.5rem;
  181. margin-left: 20.7rem;
  182. }
  183. .f3{
  184. margin-top: -2.5rem;
  185. margin-left: 25rem;
  186. }
  187. .form-box{
  188. display: flex;
  189. justify-content: center;
  190. .el-form-item{
  191. display: flex;
  192. justify-content: center;
  193. .el-form-item__label{
  194. display: flex;
  195. align-items: center;
  196. }
  197. .el-form-item__content{
  198. .el-input{
  199. .el-input__inner{
  200. width: 250px;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. </style>