editPersonnel.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2.   <!-- 修改人员信息 -->
  3.   <div id="contractDetails">
  4.     <page-title>编辑</page-title>
  5.     <div class="main">
  6.       <span class="text">人员信息</span>
  7.     </div>
  8.     <div class="contractTitle">
  9.       <div class="form-box">
  10.         <div class="form-one">
  11.           <dil-form :formId="324" v-model="form1"></dil-form>
  12.         </div>
  13.       </div>
  14.     </div>
  15.     <div class="button-box">
  16.       <el-button type="primary" @click="onClickConfirm">确认</el-button>
  17.       <el-button @click="onClickCancel">返回</el-button>
  18.     </div>
  19.   </div>
  20. </template>
  21. <script>
  22. import PageTitle from "@/components/Page/Title";
  23. export default {
  24.   components: { PageTitle },
  25.   data() {
  26.     return {
  27.       form1: {},
  28.     };
  29.   },
  30.   mounted() {
  31.     this.information();
  32.   },
  33.   methods: {
  34.     information() {
  35.       //编辑
  36. console.log("personnelId",this.$route.params)
  37.       this.axios
  38.         .post(
  39. "/api/v1/rms/getPersonnelById/" +
  40.             this.$route.params.personnelId
  41.         )
  42.         .then((res) => {
  43. console.log(res.data.data)
  44.           res.data.data.forEach((e) => {
  45.             this.form1 = e;
  46.           });
  47.         });
  48.     },
  49.     // 返回
  50.     onClickCancel() {
  51.       this.$router.go(-1);
  52.     },
  53.     // 确认
  54.     onClickConfirm() {
  55.       console.log(this.form1)
  56.     let RmsPersonnel={
  57. personnelId:this.form1.personnelId,
  58. personnelJobNumber: this.form1.personnelJobNumber,
  59. personnelName: this.form1.personnelName,
  60. personnelPost: this.form1.personnelPost,
  61. personnelWorkshopid: this.form1.personnelWorkshopid,
  62. personnelShifts: this.form1.personnelShifts,
  63. shipperId: this.form1.shipperId,
  64. personnelTeam: this.form1.personnelTeam,
  65. };
  66. if(
  67. RmsPersonnel.personnelJobNumber ==null ||
  68. RmsPersonnel.personnelName ==null ||
  69. RmsPersonnel.personnelPost ==null ||
  70. RmsPersonnel.personnelWorkshopid==null ||
  71. RmsPersonnel.personnelShifts==null ||
  72. RmsPersonnel.departmentId==null
  73. )this.$message.error("存在空值!");
  74.         this.axios
  75.           .post(
  76.             "/api/v1/rms/updatePersonnel",
  77.             RmsPersonnel
  78.           )
  79.           .then((res) => {
  80.             if (res.data.code == "200") {
  81.               this.$router.go(-1);
  82.             }
  83.           });
  84.     },
  85.   },
  86. };
  87. </script>
  88. <style lang='scss' scoped>
  89. .form-box,
  90. .button-box{
  91. display: flex;
  92. text-align: center;
  93. align-items: center;
  94. justify-content: center;
  95. margin-top: 0.3125rem;
  96. margin-bottom: 1.25rem;
  97. }
  98. </style>