inspection_list.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. console.log(id)
  92. this.getData(1, options.id)
  93. },
  94. methods: {
  95. groupChange(n) {
  96. console.log('groupChange', n);
  97. },
  98. radioChange(n) {
  99. console.log('radioChange', n);
  100. },
  101. // 分页触发
  102. change(e) {
  103. this.$refs.table.clearSelection()
  104. this.selectedIndexs.length = 0
  105. this.getData(e.current)
  106. },
  107. // 获取数据
  108. getData(pageNo, id) {
  109. this.loading = true
  110. this.pageNo = pageNo
  111. getDailyInspectionUndoneList({
  112. pageNo: this.pageNo,
  113. pageSize: this.pageSize,
  114. id: id
  115. }).then(response => {
  116. this.tableData = response.data.list;
  117. this.total = response.data.total;
  118. this.loading = false;
  119. console.log(response);
  120. });
  121. },
  122. // 扫码
  123. signInClick() {
  124. // 允许从相机和相册扫码
  125. uni.scanCode({
  126. onlyFromCamera: true, // 只允许通过相机扫码
  127. success: function(res) {
  128. console.log('条码类型:' + res.scanType);
  129. console.log('条码内容:' + res.result);
  130. }
  131. });
  132. },
  133. // 拍照
  134. TakePhoto() {
  135. const camera = uni.createCameraContext() //创建照相机对象
  136. camera.takePhoto({ //实现拍照功能
  137. quality: 'high', //high 高质量成像、 normal 普通质量、row 低质量
  138. success: (res) => {
  139. console.log('拍照成功', res)
  140. this.photoSrc = res.tempImagePath
  141. }
  142. })
  143. },
  144. // ==============提交================================
  145. // 检查完成提交
  146. submit() {
  147. addDailyInspectionUndoneNormal({
  148. id: '1111'
  149. }).then(response => {
  150. console.log('response.data.msg0,', response.data.msg);
  151. uni.showLoading({
  152. title: response.data.msg
  153. });
  154. setTimeout(() => {
  155. uni.hideLoading();
  156. this.$tab.navigateTo('/pagesA/fire/inspection_active/index')
  157. }, 2000);
  158. });
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. // --------------------
  165. // table
  166. .uni-group {
  167. display: flex;
  168. // align-items: center;
  169. flex-direction: column;
  170. }
  171. </style>