123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <template>
- <view class="container uni-container">
- <!-- <uni-section title="操作" type="line">
- <view class="uni-container">
- <uni-row class="demo-uni-row">
- <uni-col :span="4">
- <u-button shape="circle" text="添加" @click="AddPersonnel(0,'')"></u-button>
- </uni-col>
- </uni-row>
- </view>
- </uni-section>-->
- <view class="uni-pagination-box">
- <uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据">
- <uni-tr>
- <uni-th width="50" align="center">序号</uni-th>
- <uni-th width="90" align="center">地点</uni-th>
- <uni-th width="110" align="center">操作</uni-th>
- </uni-tr>
- <uni-tr v-for="(item, index) in tableData" :key="index">
- <uni-td align="center">{{ index }}</uni-td>
- <uni-td align="center">
- <view class="name">{{item.name}}</view>
- </uni-td>
- <uni-td align="center">
- <view class="uni-group">
- <view class=" padding-tb ">
- <u-radio-group v-model="item.status" @change="groupChange" placement="row">
- <u-radio shape="circle" :customStyle="{width: '50%',marginRight:'20upx'}"
- v-for="(item1, index1) in radiolist1" :key="index1" :label="item1.name"
- :name="item1.value" @change="radioChange"></u-radio>
- </u-radio-group>
- </view>
- <view class="" v-if="photoSrc">
- <image :src="photoSrc" mode="" style="width: 32px;height: 32px;">预览</image>
- </view>
- <view class="flex flex-direction-row ">
- <u-button class="margin-right-sm" text="拍照上传" size="small" type="primary"
- @tap="TakePhoto"></u-button>
- <u-button text="扫二维码" size="small" type="primary" @click="signInClick"></u-button>
- </view>
- </view>
- </uni-td>
- </uni-tr>
- </uni-table>
- <!-- <page-pagination :total="total" :pageSize="pageSize" :showAround="true" :btnText="true" :showGoPage="true"
- showPageInfo trigger="click" @change="change"></page-pagination> -->
- </view>
- <view class="margin-top-xl">
- <u-button style="border-radius: 15px;" text="检查完成" size="small" type="primary" @click="submit"></u-button>
- </view>
- </view>
- </template>
- <script>
- import {
- getDailyInspectionUndoneList, // 每日巡查未完成详情列表
- addDailyInspectionUndoneNormal, // 未完成正常提交
- } from "@/api/daily_inspection";
- export default {
- data() {
- return {
- // 人员数据
- tableData: [],
- // 每页数据量
- pageSize: 20,
- // 当前页
- pageNo: 1,
- // 数据总量
- total: 0,
- // tableData数据加载中
- loading: false,
- // 基本案列数据
- radiolist1: [{
- name: '已完成',
- disabled: false,
- value: '1'
- }, {
- name: '有问题',
- disabled: false,
- value: '0'
- }],
- // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
- radiovalue1: '已完成',
- photoSrc: ''
- }
- },
- //目的页面接收
- //这里用onshow()也可以
- onLoad(options) {
- this.selectedIndexs = []
- var id = options.id;
- this.getData(1, options.id)
- },
- methods: {
- groupChange(n) {
- },
- radioChange(n) {
- },
- // 分页触发
- change(e) {
- this.$refs.table.clearSelection()
- this.selectedIndexs.length = 0
- this.getData(e.current)
- },
- // 获取数据
- getData(pageNo, id) {
- this.loading = true
- this.pageNo = pageNo
- getDailyInspectionUndoneList({
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- id: id
- }).then(response => {
- this.tableData = response.data.list;
- this.total = response.data.total;
- this.loading = false;
- });
- },
- // 扫码
- signInClick() {
- // 允许从相机和相册扫码
- uni.scanCode({
- onlyFromCamera: true, // 只允许通过相机扫码
- success: function(res) {
- }
- });
- },
- // 拍照
- TakePhoto() {
- const camera = uni.createCameraContext() //创建照相机对象
- camera.takePhoto({ //实现拍照功能
- quality: 'high', //high 高质量成像、 normal 普通质量、row 低质量
- success: (res) => {
- this.photoSrc = res.tempImagePath
- }
- })
- },
- // ==============提交================================
- // 检查完成提交
- submit() {
- addDailyInspectionUndoneNormal({
- id: '1111'
- }).then(response => {
- uni.showLoading({
- title: response.data.msg
- });
- setTimeout(() => {
- uni.hideLoading();
- this.$tab.navigateTo('/pagesA/fire/inspection_active/index')
- }, 2000);
- });
- }
- }
- }
- </script>
- <style lang="scss">
- // --------------------
- // table
- .uni-group {
- display: flex;
- // align-items: center;
- flex-direction: column;
- }
- </style>
|