people_fireStation.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <button @click="addNewPeople" class="antherBtn">{{tomole}}</button>
  4. <u-button type="primary" text="提交测试按钮" @click="addSure" class="antherBtn"></u-button>
  5. <!-- 新增的人员表单项 -->
  6. <div v-for="(person, index) in membersList" :key="index" style="border-bottom: 1px solid black;">
  7. <u--form>
  8. <u-form-item class="typeStyle" :prop="'name' + (index + 1)">
  9. <p style="width: 150rpx;margin-left: 20rpx;">姓名{{(index + 1)}}</p>
  10. <u-input v-model="person.name" :placeholder="'请输入姓名'" />
  11. </u-form-item>
  12. <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  13. <p style="width: 150rpx;margin-left: 20rpx;">身份证号</p>
  14. <u-input v-model="person.userNum" :placeholder="'请输入身份证号'" />
  15. </u-form-item>
  16. <!-- 其他人员信息字段 -->
  17. <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  18. <p style="width: 150rpx;margin-left: 20rpx;">电话号</p>
  19. <u-input v-model="person.phone" :placeholder="'请输入电话号'" />
  20. </u-form-item>
  21. <u-form-item class="typeStyle" :prop="'age' + (index + 1)">
  22. <p style="width: 150rpx;margin-left: 20rpx;">人员类型</p>
  23. <u-input v-model="person.worker" :placeholder="'请输入人员类型'" />
  24. </u-form-item>
  25. <u-form-item class="antherStyle">
  26. <p style="width: 150rpx;">职务</p>
  27. <uni-data-select v-model="person.power" :localdata="range" @change="change"></uni-data-select>
  28. </u-form-item>
  29. </u--form>
  30. </div>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. creatFirePeople,
  36. delFirePeople,
  37. outexcel,
  38. getMesbyid,
  39. getfirelist,
  40. getfirepage,
  41. editFirePeople,
  42. getuserfireid
  43. } from "../../../../api/peoplefire/index.js"
  44. export default {
  45. data() {
  46. return {
  47. membersList: [], //添加的人员数组
  48. resultId: '',
  49. value: 0,
  50. range: [{
  51. value: 0,
  52. text: "负责人"
  53. },
  54. {
  55. value: 1,
  56. text: "值班人员"
  57. },
  58. {
  59. value: 2,
  60. text: "普通人员"
  61. },
  62. ],
  63. tomole: "添加人员",
  64. tableList: [], //显示的人员数组
  65. userId:'',
  66. smallFireId:'',
  67. }
  68. },
  69. methods: {
  70. addNewPeople() {
  71. const newPerson = {
  72. name: '',
  73. userNum: '',
  74. phone: '',
  75. worker: "",
  76. power: "",
  77. // 其他字段
  78. };
  79. this.membersList.push(newPerson);
  80. },
  81. addSure() {
  82. if (this.membersList.length !== 0) {
  83. let result = this.membersList
  84. result = JSON.stringify(result)
  85. localStorage.setItem('peopleNum', result)
  86. }
  87. console.log(this.membersList);
  88. },
  89. change(e) {
  90. console.log("e:", e);
  91. },
  92. getbackid() {
  93. let x = localStorage.getItem('getUserInfo_key')
  94. x = JSON.parse(x)
  95. this.userId = x.data.userInfo.id
  96. getuserfireid({userId:this.userId}).then(res=>{
  97. console.log(res,'userfire');
  98. })
  99. console.log(x.data.userInfo.id,'xxx');
  100. },
  101. getAllFire() {
  102. getfirepage({
  103. pageNo: 1,
  104. pageSize: 10
  105. }).then(res => {
  106. this.tableList = res.data.list
  107. })
  108. }
  109. },
  110. onLoad(options) {
  111. console.log(options, 'options')
  112. this.resultId = this.$route.query.addId
  113. if (this.resultId === '2') {
  114. this.tomole = '添加负责人'
  115. } else if (this.resultId === '1') {
  116. this.tomole = '添加值班人'
  117. } else {
  118. this.tomole = '添加人员信息'
  119. }
  120. console.log(this.$route.query, 'query'); // 输出传递的参数值
  121. },
  122. onShow() {
  123. this.getAllFire()
  124. this.getbackid()
  125. }
  126. }
  127. </script>
  128. <style>
  129. /deep/ .typeStyle {
  130. width: 650rpx !important;
  131. }
  132. /deep/ .antherStyle {
  133. width: 630rpx;
  134. height: 100rpx;
  135. margin-left: 20rpx;
  136. }
  137. /deep/ .antherBtn {
  138. width: 300rpx;
  139. margin-bottom: 30rpx;
  140. background-color: #4DB1B6;
  141. color: white;
  142. }
  143. </style>