<!--
 * @Title: 
 * @Description: 预警详情信息
 * @Author: swp
 * @Date: 2022-08-24 10:49:21
 * @LastEditors: 
 * @LastEditTime: 2022-08-24 10:49:21
-->
<template>
    <basic-container>
        <el-form ref="form" :model="form" label-width="120px">

            <el-row v-if="form.orderStatusKey == orderStatusCreateKey">
                <el-card shadow="hover">
                    <div slot="header">
                        <span>维修情况</span>
                    </div>
                    <el-form-item label="维修意见:">
                        <div>
                            <label>{{ form.processDesc }}</label>
                        </div>
                    </el-form-item>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="工单来源">
                                <div>
                                    <label>{{ form.orderFromText }}</label>
                                </div>
                            </el-form-item>
                        </el-col>

                    </el-row>
                </el-card>
            </el-row>
            <el-row v-else-if="form.orderStatusKey == orderStatusConfirmKey">
                <el-card shadow="hover">
                    <div slot="header">
                        <span>维修情况</span>
                    </div>
                    <el-form-item label="维修意见:">
                        <div>
                            <label>{{ form.processDesc }}</label>
                        </div>
                    </el-form-item>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="工单确认人">
                                <div>
                                    <label>{{ form.orderConfirmUserName }}</label>
                                </div>
                            </el-form-item>
                        </el-col>

                    </el-row>
                </el-card>
            </el-row>
            <el-row v-else-if="form.orderStatusKey == orderStatusProcessKey">

                <el-card shadow="hover">
                    <div slot="header">
                        <span>维修情况</span>
                    </div>
                    <el-form-item label="维修意见:">
                        <div>
                            <label>{{ form.processDesc }}</label>
                        </div>
                    </el-form-item>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="图片一">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.basePhoto1Url)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="图片二">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.basePhoto2Url)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>
                <el-card shadow="hover" style="margin-top: 10px;">
                    <div slot="header">
                        <span>RTU设备信息</span>
                    </div>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="运行状态:">
                                <div v-if="form.rtuStatus == 0" class="block">
                                    <div>
                                        <label>正常</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>故障</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="是否更换RTU:">
                                <div v-if="form.rtuReplace == 0" class="block">
                                    <div>
                                        <label>否</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>更换</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>

                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="备注说明:">
                                <label>{{ form.rtuDesc }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="RTU图片">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.rtuPhotoUrl)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>
                <el-card shadow="hover" style="margin-top: 10px;">
                    <div slot="header">
                        <span>雨量传感器</span>
                    </div>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="运行状态:">
                                <div v-if="form.rainSensorStatus == 0" class="block">
                                    <div>
                                        <label>正常</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>故障</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="是否更换雨量传感器">
                                <div v-if="form.rainSensorReplace == 0" class="block">
                                    <div>
                                        <label>否</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>更换</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>



                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="备注说明:">
                                <label>{{ form.rainSensorDesc }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="雨量传感器图片">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.rainSensorPhotoUrl)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card shadow="hover" style="margin-top: 10px;">
                    <div slot="header">
                        <span>水位传感器</span>
                    </div>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="运行状态:">
                                <div v-if="form.waterLevelSensorStatus == 0" class="block">
                                    <div>
                                        <label>正常</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>故障</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>


                    </el-row>

                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="是否更换水位传感器">
                                <div v-if="form.waterSensorReplace == 0" class="block">
                                    <div>
                                        <label>否</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>更换</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>



                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="备注说明:">
                                <label>{{ form.waterSensorDesc }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="水位传感器图片">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.waterSensorPhotoUrl)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card shadow="hover" style="margin-top: 10px;">
                    <div slot="header">
                        <span>墒情传感器</span>
                    </div>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="运行状态:">
                                <div v-if="form.groundWaterSensorStatus == 0" class="block">
                                    <div>
                                        <label>正常</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>故障</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>

                    </el-row>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="是否更换墒情传感器">
                                <div v-if="form.groundSensorReplace == 0" class="block">
                                    <div>
                                        <label>否</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>更换</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>



                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="备注说明:">
                                <label>{{ form.groundSensorDesc }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="墒情传感器图片">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.groundSensorPhotoUrl)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card shadow="hover" style="margin-top: 10px;">
                    <div slot="header">
                        <span>供电系统</span>
                    </div>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="运行状态:">
                                <div v-if="form.powerStatus == 0" class="block">
                                    <div>
                                        <label>正常</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>故障</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="是否更换蓄电池">
                                <div v-if="form.batteryReplace == 0" class="block">
                                    <div>
                                        <label>否</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>更换</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="是否更换太阳能板">
                                <div v-if="form.sunPowerReplace == 0" class="block">
                                    <div>
                                        <label>否</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>更换</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>

                    </el-row>

                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="备注说明:">
                                <label>{{ form.powerDesc }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="蓄电池图片">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.batteryPhotoUrl)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="太阳能板图片">
                                <div class="block">
                                    <!-- <span class="demonstration">默认</span> -->
                                    <el-image :src=toOss(form.sunPhotoUrl)></el-image>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card shadow="hover" style="margin-top: 10px;">
                    <div slot="header">
                        <span>4G移动网络</span>
                    </div>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="运行状态:">
                                <div v-if="form.networkStatus == 0" class="block">
                                    <div>
                                        <label>正常</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>故障</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row type="flex">
                        <el-col :span="12">
                            <el-form-item label="是否欠费">
                                <div v-if="form.networkOverdue == 0" class="block">
                                    <div>
                                        <label>否</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>欠费</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>

                    </el-row>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="备注说明:">
                                <label>{{ form.networkDesc }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-card>

                <el-card shadow="hover" style="margin-top: 10px;">
                    <div slot="header">
                        <span>北斗通讯</span>
                    </div>
                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="运行状态:">
                                <div v-if="satelliteStatus == 0" class="block">
                                    <div>
                                        <label>正常</label>
                                    </div>

                                </div>
                                <div v-else>
                                    <div>
                                        <label>故障</label>
                                    </div>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>


                    <el-row type="flex">
                        <el-col :span="24">
                            <el-form-item label="备注说明:">
                                <label>{{ form.satelliteDesc }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>

                </el-card>
            </el-row>
            <el-row v-else>
                <el-card shadow="hover">
                    <div slot="header">
                        <span>维修情况</span>
                    </div>
                    <el-form-item label="维修意见:">
                        <div>
                            <label>{{ form.processDesc }}</label>
                        </div>
                    </el-form-item>

                </el-card>
            </el-row>

        </el-form>
    </basic-container>
</template>

<script>


import { getDetail } from "@/api/warning/originalWarnInfo";
import { getDictionary } from "@/api/system/dictbiz";
export default {
    components: {

    },
    props: {
        id: {
            type: [Number],
            required: true
        },
    },
    name: 'warndetail',
    data() {
        return {
            orderStatusCreateKey: 0,
            orderStatusConfirmKey: 0,
            orderStatusProcessKey: 0,
            orderStatusCloseKey: 0,
            form: {
                warnName: '',
                warnTime: '',
                warnInfo: '',
            }
        }
    },
    created() {

    },
    methods: {
        toOss(url) {
            //return 'http://111.204.228.227:19000/galaxy/' + url;
            return this.website.ossServer + url;
        },
        init() {
            getDetail(this.id).then(res => {
                const data = res.data;
                if (data.success) {
                    this.form = data.data;
                }
            })
        },
        getOrderStatus() {
            var p = { 'code': "rtu_check_order_status" };
            getDictionary(p).then(res => {
                const data = res.data;
                if (data.success) {

                    const dictList = data.data;



                    for (var i = 0; i < dictList.length; i++) {
                        let dict = dictList[i];
                        console.log(dict);
                        if (dict.dictKey === '1') {
                            this.orderStatusCreateKey = dict.id;
                        } else if (dict.dictKey === '2') {
                            this.orderStatusConfirmKey = dict.id;
                        } else if (dict.dictKey === '3') {
                            this.orderStatusProcessKey = dict.id;
                        } else if (dict.dictKey === '4') {
                            this.orderStatusCloseKey = dict.id;
                        }

                    }

                    this.init();

                }
            })
        }

    }
}
</script>

<style></style>

