inspection_list.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="container uni-container">
  3. <!-- <uni-section title="操作" type="line">
  4. <view class="uni-container">
  5. <uni-row class="demo-uni-row">
  6. <uni-col :span="4">
  7. <u-button shape="circle" text="添加" @click="AddPersonnel(0,'')"></u-button>
  8. </uni-col>
  9. </uni-row>
  10. </view>
  11. </uni-section>-->
  12. <view class="uni-pagination-box">
  13. <uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据">
  14. <uni-tr>
  15. <uni-th width="50" align="center">序号</uni-th>
  16. <uni-th width="90" align="center">地点</uni-th>
  17. <uni-th width="110" align="center">操作</uni-th>
  18. </uni-tr>
  19. <uni-tr v-for="(item, index) in tableData" :key="index">
  20. <uni-td align="center">{{ index }}</uni-td>
  21. <uni-td align="center">
  22. <view class="name">{{item.name}}</view>
  23. </uni-td>
  24. <uni-td align="center">
  25. <view class="uni-group">
  26. <view class=" padding-tb ">
  27. <u-radio-group v-model="item.status" @change="groupChange" placement="row">
  28. <u-radio shape="circle" :customStyle="{width: '50%',marginRight:'20upx'}"
  29. v-for="(item1, index1) in radiolist1" :key="index1" :label="item1.name"
  30. :name="item1.value" @change="radioChange"></u-radio>
  31. </u-radio-group>
  32. </view>
  33. <view class="" v-if="photoSrc">
  34. <image :src="photoSrc" mode="" style="width: 32px;height: 32px;">预览</image>
  35. </view>
  36. <view class="flex flex-direction-row ">
  37. <u-button class="margin-right-sm" text="拍照上传" size="small" type="primary"
  38. @tap="TakePhoto"></u-button>
  39. <u-button text="扫二维码" size="small" type="primary" @click="signInClick"></u-button>
  40. </view>
  41. </view>
  42. </uni-td>
  43. </uni-tr>
  44. </uni-table>
  45. <!-- <page-pagination :total="total" :pageSize="pageSize" :showAround="true" :btnText="true" :showGoPage="true"
  46. showPageInfo trigger="click" @change="change"></page-pagination> -->
  47. </view>
  48. <view class="margin-top-xl">
  49. <u-button style="border-radius: 15px;" text="检查完成" size="small" type="primary" @click="submit"></u-button>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. getDailyInspectionUndoneList, // 每日巡查未完成详情列表
  56. addDailyInspectionUndoneNormal, // 未完成正常提交
  57. } from "@/api/daily_inspection";
  58. export default {
  59. data() {
  60. return {
  61. // 人员数据
  62. tableData: [],
  63. // 每页数据量
  64. pageSize: 20,
  65. // 当前页
  66. pageNo: 1,
  67. // 数据总量
  68. total: 0,
  69. // tableData数据加载中
  70. loading: false,
  71. // 基本案列数据
  72. radiolist1: [{
  73. name: '已完成',
  74. disabled: false,
  75. value: '1'
  76. }, {
  77. name: '有问题',
  78. disabled: false,
  79. value: '0'
  80. }],
  81. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  82. radiovalue1: '已完成',
  83. photoSrc: ''
  84. }
  85. },
  86. //目的页面接收
  87. //这里用onshow()也可以
  88. onLoad(options) {
  89. this.selectedIndexs = []
  90. var id = options.id;
  91. this.getData(1, options.id)
  92. },
  93. methods: {
  94. groupChange(n) {
  95. },
  96. radioChange(n) {
  97. },
  98. // 分页触发
  99. change(e) {
  100. this.$refs.table.clearSelection()
  101. this.selectedIndexs.length = 0
  102. this.getData(e.current)
  103. },
  104. // 获取数据
  105. getData(pageNo, id) {
  106. this.loading = true
  107. this.pageNo = pageNo
  108. getDailyInspectionUndoneList({
  109. pageNo: this.pageNo,
  110. pageSize: this.pageSize,
  111. id: id
  112. }).then(response => {
  113. this.tableData = response.data.list;
  114. this.total = response.data.total;
  115. this.loading = false;
  116. });
  117. },
  118. // 扫码
  119. signInClick() {
  120. // 允许从相机和相册扫码
  121. uni.scanCode({
  122. onlyFromCamera: true, // 只允许通过相机扫码
  123. success: function(res) {
  124. }
  125. });
  126. },
  127. // 拍照
  128. TakePhoto() {
  129. const camera = uni.createCameraContext() //创建照相机对象
  130. camera.takePhoto({ //实现拍照功能
  131. quality: 'high', //high 高质量成像、 normal 普通质量、row 低质量
  132. success: (res) => {
  133. this.photoSrc = res.tempImagePath
  134. }
  135. })
  136. },
  137. // ==============提交================================
  138. // 检查完成提交
  139. submit() {
  140. addDailyInspectionUndoneNormal({
  141. id: '1111'
  142. }).then(response => {
  143. uni.showLoading({
  144. title: response.data.msg
  145. });
  146. setTimeout(() => {
  147. uni.hideLoading();
  148. this.$tab.navigateTo('/pagesA/fire/inspection_active/index')
  149. }, 2000);
  150. });
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss">
  156. // --------------------
  157. // table
  158. .uni-group {
  159. display: flex;
  160. // align-items: center;
  161. flex-direction: column;
  162. }
  163. </style>