guoshilong
2022-09-30 109bf30f15bdf3c153cb087de38dfa17b53d0230
添加详情页的按钮事件,添加弹窗确认防误触
5 files modified
1 files renamed
91 ■■■■ changed files
App.vue 3 ●●●●● patch | view | raw | blame | history
pages.json 2 ●●● patch | view | raw | blame | history
pages/eventgm/eventsReported.vue 15 ●●●● patch | view | raw | blame | history
pages/service/service.vue 2 ●●● patch | view | raw | blame | history
pages/taskinfo/detail.vue 48 ●●●●● patch | view | raw | blame | history
pages/taskinfo/list.vue 21 ●●●●● patch | view | raw | blame | history
App.vue
@@ -16,4 +16,7 @@
    @import "uview-ui/index.scss";
    /*app全局样式*/
    @import 'static/style/app.scss';
    uni-modal{
        z-index:199999 !important;
    }
</style>
pages.json
@@ -42,7 +42,7 @@
            }
        },
        {
            "path": "pages/taskinfo/eventsReported",
            "path": "pages/eventgm/eventsReported",
            "style": {
                "navigationBarTitleText": "事件上报",
                "enablePullDownRefresh": false
pages/eventgm/eventsReported.vue
File was renamed from pages/taskinfo/eventsReported.vue
@@ -3,7 +3,7 @@
        <u-form :model="form" ref="uForm" :rules="rules">
            
            <u-form-item label="地址:">
                <u-input v-model="form.address" placeholder="请输入地址" @click="getAddress"/>
                <u-input :disabled="true" v-model="form.address" placeholder="请输入地址" @click="getAddress"/>
            </u-form-item>
            
            <u-form-item label-width="20%" label="事件类型:" prop="type">
@@ -17,7 +17,7 @@
            >
            </u-action-sheet>
            
            <u-form-item label-width="20%" label="事件状态:" prop="state">
<!--             <u-form-item label-width="20%" label="事件状态:" prop="state">
                <u-input v-model="form.stateText" type="select" @click="showState = true" placeholder="请选择事件状态"/>
            </u-form-item>
            <u-action-sheet
@@ -26,15 +26,15 @@
                title="请选择事件状态"
                @click="stateSelect"
            >
            </u-action-sheet>
            </u-action-sheet> -->
            
            <u-form-item label-width="20%" label="事件来源:">
<!--             <u-form-item label-width="20%" label="事件来源:">
                <u-input :disabled="true" v-model="form.sourceText" type="select" @click="showSource = true" placeholder="请选择事件来源"/>
            </u-form-item>
<!--             <u-action-sheet
            <u-action-sheet
                v-model="showSource"
                :list="sourceList"
                title="请选择事件状态"
                title="请选择事件来源"
                @click="sourceSelect"
            >
            </u-action-sheet> -->
@@ -67,7 +67,7 @@
    data() {
        return {
            form: {
                address:"",
                address:"章贡区",
                longitude:"",
                latitude:"",
                type:"",
@@ -172,6 +172,7 @@
                            key:e.dictKey
                        })
                    })
                    this.form.state = this.stateList[0].key
                }
            })
        },
pages/service/service.vue
@@ -44,7 +44,7 @@
                    {
                        img: '/static/images/service/b1.png',
                        name: '事件上报',
                        url: ''
                        url: '../eventgm/eventsReported'
                    }
                ],
                // 服务列表
pages/taskinfo/detail.vue
@@ -52,7 +52,9 @@
                </span>
            </view>
            <view class="once-c">
                <u-button type="success">开始任务</u-button>
                <u-button v-if="taskinfoData.state == 0" type="success" @click="startTask(taskinfoData)">开始任务</u-button>
                <u-button v-if="taskinfoData.state == 1" type="success" @click="finishTask(taskinfoData)">完成任务</u-button>
                <u-button v-if="taskinfoData.state == 1" type="error" @click="goToEventsReported">事件上报</u-button>
            </view>
        </view>
    </view>
@@ -60,7 +62,7 @@
<script>
    import {
        getDetail
        getDetail,update
    } from "@/api/taskinfo/taskinfo"
    export default {
        data() {
@@ -122,7 +124,47 @@
                    }
                })
            },
            //任务开始事件
            startTask(item){
                uni.showModal({
                    title:"提示",
                    content:"是否开始任务?",
                    success:(res)=> {
                        if(res.confirm){
                            item.state = '1'
                            item.routeRange =  '\'' + item.routeRange + '\''
                            update(item).then(res=>{
                                if(res.code == 200){
                                    this.getTaskinfoDetail()
            }
                            })
                        }
                    }
                })
            },
            finishTask(item){
                uni.showModal({
                    title:"提示",
                    content:"是否结束任务?",
                    success:(res)=> {
                        if(res.confirm){
                            item.state = '2'
                            item.routeRange =  '\'' + item.routeRange + '\''
                            update(item).then(res=>{
                                if(res.code == 200){
                                    this.getTaskinfoDetail()
                                }
                            })
                        }
                    }
                })
            },
            goToEventsReported(){
                uni.navigateTo({
                    url:"/pages/eventgm/eventsReported"
                })
            },
        },
        onLoad: function(options) {
            if (options.id) {
@@ -355,4 +397,6 @@
            transform: rotate(1turn);
        }
    }
</style>
pages/taskinfo/list.vue
@@ -75,6 +75,9 @@
                taskinfoList: null
            }
        },
        onShow() {
            this.getList()
        },
        created() {
            this.getList()
        },
@@ -112,6 +115,11 @@
            },
            //任务开始事件
            startTask(item){
                uni.showModal({
                    title:"提示",
                    content:"是否开始任务?",
                    success:(res)=> {
                        if(res.confirm){
                item.state = '1'
                item.routeRange =  '\'' + item.routeRange + '\''
                update(item).then(res=>{
@@ -120,9 +128,17 @@
                        this.getList()
                    }
                })
                        }
                    }
                })
            },
            //任务结束事件
            finishTask(item){
                uni.showModal({
                    title:"提示",
                    content:"是否结束任务?",
                    success:(res)=> {
                        if(res.confirm){
                item.state = '2'
                item.routeRange =  '\'' + item.routeRange + '\''
                update(item).then(res=>{
@@ -131,11 +147,14 @@
                        this.getList()
                    }
                })
                        }
                    }
                })
            },
            //事件上报
            goToEventsReported(){
                uni.navigateTo({
                    url:"../taskinfo/eventsReported"
                    url:"/pages/eventgm/eventsReported"
                })
            }
        }