associatedCabinetLock.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!--关联化学品柜-->
  2. <template>
  3. <div class="associatedCabinetLock">
  4. <div class="title-box">
  5. <p>关联化学品柜</p>
  6. <p class="reset-button-one" @click="backPage"><i class="el-icon-arrow-left"></i>返回</p>
  7. </div>
  8. <div class="associatedCabinetLock-min-page">
  9. <el-form style="flex: 1;flex-direction: column;display: flex;overflow: hidden;" ref="form" :model="form" label-width="0px">
  10. <el-table border :data="tableList" ref="multipleTable">
  11. <el-table-column label="柜锁编号" align="center" prop="hardwareNum" width="300px"/>
  12. <el-table-column label="柜锁名称" align="center" prop="name" width="200px"/>
  13. <el-table-column label="学院" align="center" prop="deptName" width="200px"/>
  14. <el-table-column label="所在位置" align="center" prop="posi"/>
  15. <el-table-column label="化学品柜" align="center" width="240" >
  16. <template slot-scope="scope">
  17. <el-form-item label="" prop="joinCabinetId">
  18. <el-select v-model="scope.row.joinCabinetId" clearable placeholder="请选择化学品柜" style="width:200px;">
  19. <el-option
  20. v-for="item in scope.row.cabinetList"
  21. :key="item.id"
  22. :label="item.cabinetName"
  23. :value="item.id">
  24. </el-option>
  25. </el-select>
  26. </el-form-item>
  27. </template>
  28. </el-table-column>
  29. </el-table>
  30. </el-form>
  31. <div class="table-button-p">
  32. <p class="inquire-button-one" @click="submitForm">确定</p>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import { setLockJoinCabinet } from "@/api/medicUniversity-3_1/index";
  39. export default {
  40. name: "associatedCabinetLock",
  41. props:{
  42. associatedCabinetLockPropsData:{},
  43. },
  44. data() {
  45. return {
  46. tableList:[],
  47. form:{},
  48. rules:{
  49. joinCabinetId: [
  50. { required: true, trigger: "blur", message: "请选择化学品柜" },
  51. ],
  52. },
  53. }
  54. },
  55. created() {
  56. },
  57. mounted(){
  58. this.tableList = JSON.parse(JSON.stringify(this.associatedCabinetLockPropsData))
  59. },
  60. methods:{
  61. //提交按钮
  62. submitForm(){
  63. let self = this;
  64. this.$refs["form"].validate((valid) => {
  65. if (valid) {
  66. self.$confirm(`确认提交吗?`, "提示", {
  67. confirmButtonText: "确定",
  68. cancelButtonText: "取消",
  69. type: "warning"
  70. }).then(async () => {
  71. let list = [];
  72. for(let i=0;i<self.tableList.length;i++){
  73. let obj = {
  74. id:self.tableList[i].id,
  75. joinCabinet:self.tableList[i].joinCabinetId,
  76. }
  77. list.push(obj);
  78. }
  79. setLockJoinCabinet(list).then(response => {
  80. if (response.code == 200){
  81. self.msgSuccess(response.msg);
  82. self.$parent.pageToggle(0);
  83. }
  84. });
  85. }).catch(() => {})
  86. }
  87. })
  88. },
  89. //返回
  90. backPage(){
  91. this.$parent.pageToggle(0);
  92. },
  93. }
  94. }
  95. </script>
  96. <style scoped lang="scss">
  97. .associatedCabinetLock{
  98. flex: 1;
  99. display: flex;
  100. flex-direction: column;
  101. overflow: hidden;
  102. p{
  103. margin:0;
  104. }
  105. .title-box{
  106. display: flex;
  107. height:90px;
  108. border-bottom: 1px solid #D8D8D8;
  109. p:nth-child(1){
  110. flex:1;
  111. font-size:16px;
  112. line-height:90px;
  113. margin-left:18px;
  114. color:#0045AF;
  115. }
  116. p:nth-child(2){
  117. margin:25px 25px 0 0;
  118. }
  119. }
  120. .associatedCabinetLock-min-page{
  121. flex: 1;
  122. display: flex;
  123. flex-direction: column;
  124. overflow: hidden;
  125. padding:20px !important;
  126. .el-form-item{
  127. margin:0;
  128. }
  129. .table-button-p{
  130. margin:20px auto 0;
  131. p{
  132. margin-right:72px;
  133. }
  134. }
  135. }
  136. }
  137. </style>