editTruckCalculate.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2.   <!-- 修改汽车衡信息 -->
  3.   <div id="contractDetails">
  4.     <page-title>编辑</page-title>
  5.     <div class="main">
  6.     </div>
  7.     <div class="contractTitle">
  8.       <div class="form-box">
  9.         <div class="form-one">
  10.           <dil-form :formId="354" v-model="form1"></dil-form>
  11.         </div>
  12.       </div>
  13. <div class="materialBox">
  14. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  15. <el-form-item>
  16. <el-button type="primary" @click="drawer = true">增加物资</el-button>
  17. </el-form-item>
  18. </el-form>
  19. </div>
  20. <el-drawer
  21. :visible.sync="drawer"
  22. :direction="direction"
  23. :before-close="handleClose">
  24. <div class="inputBox">
  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>
  34. <div><dilTable v-bind.sync="option2" @radio-change="currentRadioChange" ></dilTable></div>
  35. <div class="button-box">
  36. <el-button type="primary" @click="makeSure">确定</el-button>
  37. </div>
  38. </el-drawer>
  39. <dilTable v-bind.sync="option1">
  40. <el-table-column fixed="right" label="操作" align="center" width="200">
  41. <template slot-scope="scope">
  42. <el-button
  43. type="text"
  44. size="mini"
  45. @click="deleteclick(scope)"
  46. >删除</el-button
  47. >
  48. </template>
  49. </el-table-column>
  50. </dilTable>
  51.     <div class="button-box">
  52. <el-button @click="onClickCancel">返回</el-button>
  53.       <el-button type="primary" @click="onClickConfirm">确认</el-button>
  54.     </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import PageTitle from "@/components/Page/Title";
  60. export default {
  61.   components: { PageTitle },
  62.   data() {
  63.     return {
  64. materialName: {},
  65.       form1: {},
  66. drawer: false,
  67. direction: 'rtl',
  68. inputText:"",
  69. option1:{
  70. // first请求数据的地址
  71. requestUrl: "/api/v1/rms/getCalculateOfMaterialList?apiId=379&truckCalculateId="+this.$route.params.truckCalculateId,
  72. },
  73. option2:{
  74. requestUrl:"/api/v1/rms/getMaterialList?apiId=351",
  75. selectionType:"radio",
  76. mapList:[]
  77. }
  78.     };
  79.   },
  80.   mounted() {
  81.       console.log(this.$route)
  82.     this.information();
  83.   },
  84.   methods: {
  85. currentRadioChange(selection){
  86. this.mapList=selection,
  87. console.log(this.mapList)
  88. this.materialName=this.mapList.materialName
  89. },
  90. // onclick(){
  91. // this.options.requestUrl="/api/v1/rms/getMaterialList?apiId=351&con=" +this.inputText;
  92. // },
  93.     information() {
  94.       //编辑
  95. console.log("information")
  96. console.log("truckCalculateId",this.$route.params.truckCalculateId); 
  97.       this.axios
  98.         .post(
  99.           "/api/v1/rms/getTruckCalculateById/" +
  100.             this.$route.params.truckCalculateId
  101.         )
  102.         .then((res) => {
  103. console.log(res.data.data)
  104.           res.data.data.forEach((e) => {
  105.             this.form1 = e;
  106.             console.log(e);
  107.             console.log(this.form1);
  108.             console.log( this.$route.params.truckCalculateId);
  109.           });
  110.         });
  111.     },
  112. onclick(){
  113. this.option2.requestUrl="/api/v1/rms/getMaterialList?apiId=351&con=" +this.inputText;
  114. },
  115.     // 返回
  116.     onClickCancel() {
  117.       this.$router.go(-1);
  118.     },
  119.     // 修改汽车衡
  120.     onClickConfirm() {
  121.       console.log(this.form1)
  122.       let map={
  123. truckCalculateNumber:this.form1.truckCalculateNumber,
  124. truckCalculateId:this.form1.truckCalculateId,
  125. truckCalculateStatus:this.form1.truckCalculateStatus,
  126. truckCalculateLongitude:this.form1.truckCalculateLongitude,
  127. truckCalculateLatitude:this.form1.truckCalculateLatitude,
  128. calculateType:this.form1.calculateType,
  129. };
  130. if(
  131. rmsTruckCalculate.truckCalculateNumber == null ||
  132. rmsTruckCalculate.calculateType ==null
  133. )this.$message.error("存在空值!");
  134.         this.axios
  135.           .post(
  136.             "/api/v1/rms/updateTruckCalculate",
  137.           map
  138.           )
  139.           .then((res) => {
  140.             if (res.data.code == "200") {
  141.               this.$router.go(-1);
  142.             }
  143.           });
  144.     },
  145. //增加汽车衡的物资
  146. makeSure() {
  147. let rmsTruckCalculateMaterial = {
  148. truckCalculateId:this.form1.truckCalculateId,
  149. materialId:this.mapList.materialId,
  150. }
  151. this.axios
  152. .post(
  153. "/api/v1/rms/insertTruckCalculateOfMaterial",
  154. rmsTruckCalculateMaterial
  155. )
  156. .then((res) => {
  157. if (res.data.code == 200) {
  158. this.$message({
  159. type: "success",
  160. message: "添加成功!",
  161. });
  162. this.$router.go(0);
  163. }
  164. });
  165. },
  166. deleteclick(scope){
  167. this.$confirm("是否删除", "提示", {
  168. confirmButtonText: "确定",
  169. cancelButtonText: "取消",
  170. type: "warning",
  171. center: true,
  172. })
  173. .then(() => {
  174. this.axios
  175. .post("/api/v1/rms/deleteTruckCalculateMaterial/" + scope.row.truckCalculateMaterialId)
  176. .then((res) => {
  177. if (res.data.code == 200) {
  178. this.$message({
  179. type: "success",
  180. message: "删除成功!",
  181. });
  182. this.$router.go(0);
  183. } else {
  184. this.$message({
  185. message: "删除失败",
  186. type: "warning",
  187. });
  188. }
  189. });
  190. })
  191. .catch(() => {
  192. this.$message({
  193. type: "info",
  194. message: "删除操作已取消!",
  195. });
  196. });
  197. },
  198. // 取消
  199. cancel() {
  200. this.$router.go(-1);
  201. },
  202.   },
  203. };
  204. </script>
  205. <style lang='scss'>
  206. .form-box{
  207. display: flex;
  208. justify-content: center;
  209. .el-form-item{
  210. display: flex;
  211. justify-content: center;
  212. .el-form-item__label{
  213. display: flex;
  214. align-items: center;
  215. }
  216. .el-form-item__content{
  217. .el-input{
  218. .el-input__inner{
  219. width: 250px;
  220. }
  221. }
  222. }
  223. }
  224. }
  225. .inputBox{
  226. display: flex;
  227. text-align: center;
  228. align-items: center;
  229. justify-content: center;
  230. width: 800px;
  231. }
  232. .button-box{
  233. display: flex;
  234. justify-content: center;
  235. .el-button{
  236. width: 80px;
  237. margin-right: 10px;
  238. }
  239. }
  240. .btn-left {
  241. margin-left: 470px;
  242. }
  243. .input {
  244. margin-left: 90px;
  245. }
  246. .label{
  247. margin-left: 445px;
  248. margin-bottom: -30px;
  249. font: bold;
  250. font-size: 1rem;
  251. padding-left: -30px;
  252. font-family:Arial, Helvetica, sans-serif;
  253. margin-bottom:20px;
  254. }
  255. .label2{
  256. margin-left: 425px;
  257. margin-bottom: -30px;
  258. font: bold;
  259. font-size: 1rem;
  260. font-family:Arial, Helvetica, sans-serif
  261. }
  262. .label1{
  263. margin-left: 345px;
  264. margin-bottom: -30px;
  265. font: bold;
  266. }
  267. .common{
  268. font-weight: 700;
  269. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
  270. Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  271. font-size: 1rem;
  272. cursor: default;
  273. color: #2c3e50;
  274. }
  275. .materialBox{
  276. display: flex;
  277. text-align: center;
  278. align-items: center;
  279. justify-content: center;
  280. margin-top: 0.3125rem;
  281. margin-bottom: 1.25rem;
  282. }
  283. </style>