<template>
    <view>
        <cu-custom bgColor="bg-gradual-blueness" :isBack="true">
            <block slot="backText">返回</block>
            <block slot="content">特殊处置审核</block>
        </cu-custom>
        <scroll-view scroll-y>
            <view class="de-card-list de-list">
                <view class="de-item">
                    <text class="text-semi">{{pd.HIDDENDESCR}}</text>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患来源</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text v-if="pd.SOURCE=='1'" class="text-semi">隐患快报</text>
                        <text v-if="pd.SOURCE=='2' || pd.SOURCE=='3'" class="text-semi">清单排查</text>
                        <text v-if="pd.SOURCE=='4'" class="text-semi">安全环保检查（监管端）</text>
                        <text v-if="pd.SOURCE=='5'" class="text-semi">安全环保检查（企业端）</text>
                    </view>
                </view>
                <view class="de-item" v-if="pd.SOURCE==2">
                    <view class="de-sub-title">
                        <text class="text-grey">风险点（单元）</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.RISK_UNIT}}</text>
                    </view>
                </view>
                <view class="de-item" v-if="pd.SOURCE==2">
                    <view class="de-sub-title">
                        <text class="text-grey">辨识部位</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.IDENTIFICATION}}</text>
                    </view>
                </view>
                <view class="de-item-sp" v-if="pd.SOURCE==2">
                    <view class="de-sub-title">
                        <text class="text-grey">存在风险</text>
                    </view>
                    <view class="de-sub-content">
                        <text class="text-semi">{{pd.RISK_DESCR}}</text>
                    </view>
                </view>
                <view class="de-item">
                    <view style="width: 200px" class="de-sub-title">
                        <text class="text-grey">隐患上报位置（经纬度）</text>
                    </view>
                    <view class="uni-flex-item text-right" v-if="pd.LONGITUDE">
                        <text class="text-semi">
                            {{ pd.LONGITUDE &&
                            pd.LONGITUDE.length>6?pd.LONGITUDE.substr(0,6):pd.LONGITUDE}},{{pd.LATITUDE &&
                            pd.LATITUDE.length>6?pd.LATITUDE.substr(0,6):pd.LATITUDE}}
                        </text>
                    </view>
                </view>
<!--                <view class="de-item-sp">-->
<!--                    <view class="de-sub-title">-->
<!--                        <text class="text-grey">隐患位置描述</text>-->
<!--                    </view>-->
<!--                    <view class="de-sub-content">-->
<!--                        <text class="text-semi">{{pd.POSITIONDESC}}</text>-->
<!--                    </view>-->
<!--                </view>-->
                <view class="de-item" v-if="pd.SOURCE==2">
                    <view class="de-sub-title">
                        <text class="text-grey">风险分级</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.LEVEL}}</text>
                    </view>
                </view>
                <view class="de-item-sp" v-if="pd.SOURCE==2">
                    <view class="de-sub-title">
                        <text class="text-grey">检查内容</text>
                    </view>
                    <view class="de-sub-content">
                        <text class="text-semi">{{pd.CHECK_CONTENT}}</text>
                    </view>
                </view>
                <!-- 				<view class="de-item-sp">
                                    <view class="de-sub-title">
                                        <text class="text-grey">隐患描述</text>
                                    </view>
                                    <view class="de-sub-content">
                                        <text class="text-semi">{{pd.HIDDENDESCR}}</text>
                                    </view>
                                </view> -->
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患部位</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.hregionName?pd.hregionName:pd.HIDDENPART}}</text>
                    </view>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患位置描述</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.POSITIONDESC}}</text>
                    </view>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患类型</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.HIDDENTYPENAME}}</text>
                    </view>
                </view>
                <!--<view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患类型2</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.HIDDENTYPENAME2}}</text>
                    </view>
                </view>-->
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患级别</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.HIDDENLEVELNAME}}</text>
                    </view>
                </view>
                <view class="de-item" v-for="(item, index) in hiddenFindPeople" :key="index">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患发现人</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{item.NAME}}</text>
                    </view>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患发现时间</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{formatDate(pd.DISCOVERYTIME)}}</text>
                    </view>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">整改类型</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text v-if="pd.RECTIFICATIONTYPE=='1'" class="text-semi">立即整改</text>
                        <text v-else-if="pd.RECTIFICATIONTYPE=='2'" class="text-semi">限期整改</text>
                    </view>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">整改负责部门</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.editDeptName}}</text>
                    </view>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">整改负责人</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.editUserName}}</text>
                    </view>
                </view>
                <view v-if="pd.RECTIFICATIONTYPE=='2'" class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">整改期限</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text class="text-semi">{{pd.editRectificationDeadline }}</text>
                    </view>
                </view>
                <view class="de-item">
                    <view class="de-sub-title">
                        <text class="text-grey">是否相关方</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <text v-if="pd.ISRELEVANT=='1'" class="text-semi">是</text>
                        <text v-else-if="pd.ISRELEVANT=='2'" class="text-semi">否</text>
                    </view>
                </view>
                <view class="de-item-sp">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患照片</text>
                    </view>
                    <view class="de-sub-content">
                        <scroll-view scroll-x class="bg-white nav" scroll-with-animation>
                            <view class="cu-item" v-for="(item,index) in files" v-bind:key="index">
                                <view class="imgs">
                                    <image :src="baseImgPath+item.FILEPATH" :data-index="index" @click="ViewShowImage"
                                           mode=""></image>
                                </view>
                            </view>
                        </scroll-view>
                    </view>
                </view>

                <view class="de-item-sp" v-if="hiddenVideo.length>0">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患视频</text>
                    </view>
                    <view class="de-sub-content" style="background-color: #000;width: 120upx;">
                        <image src="/static/icon-apps/video.png" mode="aspectFill" @click="playVideo"
                               :data-src="baseImgPath + hiddenVideo[0].FILEPATH"
                               style="width: 120upx;height: 120upx;"></image>
                    </view>
                </view>
                <view class="de-item" @click="seeHiddenConfirm=='2'?seeHiddenConfirm='1':seeHiddenConfirm='2'">
                    <view class="de-sub-title">
                        <text class="text-grey">隐患确认信息</text>
                    </view>
                    <view class="uni-flex-item text-right">
                        <a>查看</a>
                    </view>
                </view>
            </view>
            <div v-for="(item,index) in hiddenExamineList" :key="index" v-if="seeHiddenConfirm=='1'">
                <view class="de-card-list de-list" v-if="item.TYPE === 4 ||item.TYPE === 2||item.TYPE === 1  ">
                    <div v-if="item.TYPE === 4">
                        <view class="de-title">
                            <text class="text-semi">隐患确认</text>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">隐患级别</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.editLevelName}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">整改负责人</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.editUserName}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">整改完成期限</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.spare3}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">隐患确认人</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{pd.conUserName}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">隐患确认时间</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{pd.CONFIRM_TIME}}</text>
                                </view>
                            </view>
                        </view>
                    </div>
                    <div v-if="item.TYPE === 2">
                        <view class="de-title">
                            <text class="text-semi">延期信息</text>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">申请延期日期</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.CREATTIME}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">审核人</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{pd.conUserName}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">延期日期</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.DELAY_TIME}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top"  v-if="item.DISPOSAL_PLAN">
                            <view class="title">处置方案</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.DISPOSAL_PLAN}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top" v-if="item.DISPOSAL_FILE">
<!--                            <view class="title">方案附件</view>-->
<!--                            <view class="picker-tree-box">-->
<!--                                <view class="uni-flex-item text-right">-->
<!--                                    <text class="text-semi">{{item.DISPOSAL_FILE}}</text>-->
<!--                                </view>-->
<!--                            </view>-->
                            <view class="title">方案附件</view>
                            <view class="picker-tree-box">
                                <button class="cu-btn bg-blue" style="width: 160px" @click="downloadAppendix(item.DISPOSAL_FILE)">
                                    下载
                                </button>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">延期审核状态</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi" v-if="item.STATE===-1">待审核</text>
                                    <text class="text-semi" v-if="item.STATE===1">通过</text>
                                    <text class="text-semi" v-if="item.STATE===2">未通过</text>

                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top" v-if="item.STATE!==-1">
                            <view class="title">审核时间</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.OPERATTIME}}</text>
                                </view>
                            </view>
                        </view>
                    </div>
                    <div v-if="item.TYPE === 1 && item.HIDDENEXAMINE_ID != hiddenexamine.HIDDENEXAMINE_ID " >
                        <view class="de-title">
                            <text class="text-semi">特殊处理审核信息</text>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">无法整改原因</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.EXAMINE}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top">
                            <view class="title">特殊处置审核状态</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi" v-if="item.STATE===-1">待审核</text>
                                    <text class="text-semi" v-if="item.STATE===2">通过</text>
                                    <text class="text-semi" v-if="item.STATE===1">未通过</text>

                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top"  v-if="item.DISPOSAL_PLAN">
                            <view class="title">处置方案</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.DISPOSAL_PLAN}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top" v-if="item.DISPOSAL_FILE">
                            <view class="title">处置方案附件</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <button class="cu-btn bg-blue" style="width: 160px" @click="downloadAppendix(item.DISPOSAL_FILE)">
                                        下载
                                    </button>
                                </view>

                            </view>
                        </view>
                        <view class="cu-form-group margin-top" v-if="item.STATE!==-1">
                            <view class="title">审核时间</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.OPERATTIME}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top" v-if="item.STATE!==-1">
                            <view class="title">审核人</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{pd.conUserName}}</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top" v-if="item.STATE!==-1">
                            <view class="title">是否更换整改负责人</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi" v-if="item.spare1==='1'">是</text>
                                    <text class="text-semi" v-else>否</text>
                                </view>
                            </view>
                        </view>
                        <view class="cu-form-group margin-top" v-if="item.spare1=='1'">
                            <view class="title">整改负责人</view>
                            <view class="picker-tree-box">
                                <view class="uni-flex-item text-right">
                                    <text class="text-semi">{{item.NEWRECTIFICATIONOR}}</text>
                                </view>
                            </view>
                        </view>
                    </div>
                </view>
            </div>
            <view class="de-card-list de-list" v-if="hiddenexamine.STATE == '-1'">
                <view class="cu-form-textarea" >
                    <view class="cu-form-title text-grey">无法整改原因</view>
                    <textarea maxlength="-1" disabled v-model="hiddenexamine.EXAMINE" placeholder="请输入无法整改原因"></textarea>
                </view>
            </view>
            <view class="de-card-list de-list">
                <view>
                    <view class="cu-form-group margin-top" v-if="activeType == 'disposal'">
                        <view class="title text-hui">处置审核</view>
                        <radio-group class="selected">
                            <view class="group mr20">
                                <radio class='radio' value="1" :checked="hiddenexamine.DISPOSITION_AUDIT=='1'"
                                       @click="radioDispositionAudit('1')"></radio>
                                <text>通过</text>
                            </view>
                            <view class="group">
                                <radio class='radio' value="2" :checked="hiddenexamine.DISPOSITION_AUDIT=='2'"
                                       @click="radioDispositionAudit('2')"></radio>
                                <text>不通过</text>
                            </view>
                        </radio-group>
                    </view>
                </view>
                <view class="cu-form-textarea" v-if="hiddenexamine.DISPOSITION_AUDIT=='1'">
                    <view class="cu-form-title text-grey">临时措施</view>
                    <textarea maxlength="-1" v-model="hiddenexamine.TEMPORARY_MEASURES" placeholder="请输入临时措施"></textarea>
                </view>
                <block v-if="hiddenexamine.DISPOSITION_AUDIT=='2'">
                    <view class="cu-form-group margin-top">
                        <view class="title text-hui">是否更换整改负责人</view>
                        <radio-group class="selected">
                            <view class="group mr20">
                                <radio class='radio' value="1" :checked="hiddenexamine.REPLACE_PRINCIPAL=='1'"
                                       @click="radioReplacePrincipal('1')"></radio>
                                <text>是</text>
                            </view>
                            <view class="group">
                                <radio class='radio' value="2" :checked="hiddenexamine.REPLACE_PRINCIPAL=='2'"
                                       @click="radioReplacePrincipal('2')"></radio>
                                <text>否</text>
                            </view>
                        </radio-group>
                    </view>
                    <block v-if="hiddenexamine.REPLACE_PRINCIPAL=='1'">
                        <view class="cu-form-group margin-top">
                            <view class="title">整改负责人部门</view>
                            <view class="picker-tree-box">
                                <view class="picker-tree" @tap="showZgTree('tkiTree1')">
                                    {{ hiddenexamine.PRINCIPAL_DEPARTMENT_NAME || '请选择' }}
                                </view>
                            </view>
                            <tki-tree ref="tkiTree1" :selectParent=true :range="treeNode" rangeKey="name"
                                      @confirm="zgtreeConfirm($event,'principalList')"
                                      @cancel="zgtreeCancel"></tki-tree>
                        </view>
                        <view class="cu-form-group" v-if="hiddenexamine.PRINCIPAL_DEPARTMENT_ID">
                            <view class="title">整改负责人：</view>
                            <picker @change="principalChange" :value="hiddenexamine.PRINCIPAL_INDEX"
                                    :range="principalList" range-key="NAME">
                                <view class="picker">
                                    {{ hiddenexamine.PRINCIPAL_NAME || '请选择' }}
                                </view>
                            </picker>
                        </view>
                    </block>
                </block>
            </view>
            <view class="cu-bar btn-group" style="margin-top: 30upx;">
                <button class="cu-btn bg-green margin-tb-sm lg" @click="goback">返回</button>
                <button class="cu-btn bg-blue margin-tb-sm lg" v-if="activeType == 'disposal'"
                        @click="submit">提交
                </button>
            </view>
            <view class="cu-tabbar-height"></view>
        </scroll-view>
        <view :class="['cu-modal',{'show':modalShow}]" v-if="modalShow">
            <view class="cu-dialog">
                <view class="cu-bar bg-white justify-end">
                    <view class="content">播放视频</view>
                    <view class="action" @tap="modalShow = false">
                        <text class="cuIcon-close text-red"></text>
                    </view>
                </view>
                <video :src="videoSrc" :autoplay="true"></video>
                <view class="cu-bar bg-white justify-end">
                    <view class="action">
                        <button class="cu-btn line-green text-green" @click="modalShow = false">关闭</button>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
    import {
        basePath, baseImgPath, corpinfoId, loginUser, formatDate
    } from '@/common/tool.js';
    import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
    import tkiTree from "@/components/select-tree/select-tree.vue"

    export default {
        components: {
            ruiDatePicker,
            tkiTree
        },
        data() {
            return {
                HIDDEN_ID: '',
                HIDDENEXAMINE_ID:'',
                pd: [],
                hiddenexamine:{},
                baseImgPath:baseImgPath,
                files:[],
                hiddenVideo:[],
                basePath: basePath,
                modalShow: false,
                videoSrc: '',
                activeType: '',
                hiddenExamineList:'',
                hiddenFindPeople: [], //隐患发现人
                seeHiddenConfirm: '2',
                treeNode:[],
                principalList:[]
            }
        },
        onLoad(e) {
            this.activeType = e.activeType;
            this.HIDDEN_ID = e.HIDDEN_ID;
            this.HIDDENEXAMINE_ID = e.HIDDENEXAMINE_ID;
            this.getData();
            if(this.activeType !='view'){
                this.getHiddenDeferredData() //只有审批的时候查看
            }

            this.getDept();
        },

        methods: {
            getHiddenDeferredData() {
                var _this = this;
                uni.showLoading({
                    title: '请稍候'
                })
                uni.request({
                    url: basePath + '/app/hiddenexamine/goEdit',
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        HIDDENEXAMINE_ID: _this.HIDDENEXAMINE_ID,
                    },
                    success: (res) => {
                        if ("success" === res.data.result) {
                            uni.hideLoading();
                            _this.hiddenexamine = res.data.pd; //参数map
                        } else if ("exception" === res.data.result) {
                            uni.showToast({
                                title: '错误',
                                duration: 2000
                            });
                        }
                    }
                });
            },
            getData() {
                var _this = this;
                uni.showLoading({
                    title: '请稍候'
                })
                uni.request({
                    url: basePath + '/app/hidden/goEdit',
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        HIDDEN_ID: _this.HIDDEN_ID,
                    },
                    success: (res) => {
                        if ("success" === res.data.result) {
                            uni.hideLoading();
                            _this.pd = res.data.pd; //参数map
                            _this.files = res.data.hImgs;
                            _this.hiddenVideo = res.data.hiddenVideo
                            _this.hiddenFindPeople = res.data.hiddenFindPeople
                            _this.hiddenExamineList = res.data.hiddenExa
                        } else if ("exception" === res.data.result) {
                            uni.showToast({
                                title: '错误',
                                duration: 2000
                            });
                        }
                    }
                });
            },
            radioDispositionAudit(e) {
                this.$set(this.hiddenexamine, 'DISPOSITION_AUDIT', e)
            },
            radioReplacePrincipal(e) {
                this.$set(this.hiddenexamine, 'REPLACE_PRINCIPAL', e)
            },
            submit() {
                var _this = this;
                let required = true
                console.info(this.hiddenexamine)
                if (!this.hiddenexamine.DISPOSITION_AUDIT) {
                    uni.showToast({
                        icon: 'none',
                        title: '请选择处置审核是否通过',
                        duration: 1500
                    });
                    required = false
                }

                if (this.hiddenexamine.DISPOSITION_AUDIT == '1') {
                    if (!this.hiddenexamine.TEMPORARY_MEASURES) {
                        uni.showToast({
                            icon: 'none',
                            title: '请输入临时措施',
                            duration: 1500
                        });
                        required = false
                    }
                }
                if (this.hiddenexamine.DISPOSITION_AUDIT == '2') {
                    if (!this.hiddenexamine.REPLACE_PRINCIPAL) {
                        uni.showToast({
                            icon: 'none',
                            title: '请选择是否更换整改负责人',
                            duration: 1500
                        });
                        required = false
                    }
                    if (this.hiddenexamine.REPLACE_PRINCIPAL == '1') {
                        if (!this.hiddenexamine.PRINCIPAL_DEPARTMENT_NAME) {
                            uni.showToast({
                                icon: 'none',
                                title: '请选择整改负责人部门',
                                duration: 1500
                            });
                            required = false
                        }
                        if (!this.hiddenexamine.PRINCIPAL_NAME) {
                            uni.showToast({
                                icon: 'none',
                                title: '请选择整改负责人',
                                duration: 1500
                            });
                            required = false
                        }
                    }
                }

                if (!required) {
                    return
                }
                uni.showLoading({
                    title: '请稍候'
                })
                uni.request({
                    url: basePath + "/app/hiddenexamine/specialExamine",
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        CORPINFO_ID: corpinfoId,
                        loginUserId: loginUser.USER_ID,
                        USERNAME: loginUser.NAME,
                        HIDDENEXAMINE_ID: _this.HIDDENEXAMINE_ID,
                        TYPE: _this.hiddenexamine.DISPOSITION_AUDIT, //是否通过
                        disposalPlan: this.hiddenexamine.TEMPORARY_MEASURES,
                        OLDRECTIFICATIONOR: this.pd.RECTIFICATIONOR,
                        spare2: this.hiddenexamine.PRINCIPAL_ID,//修改了整改负责人
                        spare1: this.hiddenexamine.REPLACE_PRINCIPAL,
                        isChange: this.hiddenexamine.REPLACE_PRINCIPAL,
                        changeUserDepartment: this.hiddenexamine.PRINCIPAL_DEPARTMENT_ID,
                        changeUser: this.hiddenexamine.PRINCIPAL_ID,

                    },
                    success: (res) => {
                        uni.showToast({
                            icon: 'none',
                            title: '提交成功',
                            duration: 2000
                        });
                        _this.goback()
                    },
                    fail: (err) => {
                        uni.hideLoading();
                        uni.showModal({
                            content: err.errMsg,
                            showCancel: false
                        });
                    }
                })
            },
            getDept() {
                var _this = this;
                uni.request({
                    url: basePath + '/app/sys/listTree', //部门下拉接口
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        CORPINFO_ID: corpinfoId,
                    },
                    success: (res) => {
                        if ("success" === res.data.result) {
                            _this.treeNode = eval(res.data.zTreeNodes);
                        } else {
                            uni.showToast({
                                title: res.data.message,
                                duration: 2000
                            });
                        }
                    }
                });
            },
            getUserList(list, DEPARTMENT_ID) {
                //发送 post 请求
                var _this = this;
                uni.request({
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    url: basePath + '/app/sys/listUser',
                    data: {
                        DEPARTMENT_ID, NOMAIN:'1',
                        tm: new Date().getTime()
                    },
                    success: function (res) {
                        if ("success" == res.data.result) {
                            _this[list] = res.data.userList;
                        } else {
                            uni.showToast({
                                title: res.data.message,
                                duration: 2000
                            });
                        }
                    }
                })
            },
            showZgTree(ref) {
                this.$refs[ref]._show();
            },
            zgtreeConfirm(e, list) {
                if (list === "principalList") {
                    this.$set(this.hiddenexamine, 'PRINCIPAL_DEPARTMENT_ID', e[0].id)
                    this.$set(this.hiddenexamine, 'PRINCIPAL_DEPARTMENT_NAME', e[0].name)
                    this.$set(this.hiddenexamine, 'PRINCIPAL_INDEX', '')
                    this.$set(this.hiddenexamine, 'PRINCIPAL_ID', '')
                    this.$set(this.hiddenexamine, 'PRINCIPAL_NAME', '')
                }
                this.getUserList(list, e[0].id);
            },
            zgtreeCancel(e) {
                this.isUps = false;
            },
            principalChange(e) {
                this.hiddenexamine.PRINCIPAL_INDEX = e.detail.value;
                this.hiddenexamine.PRINCIPAL_ID = this.principalList[e.detail.value].USER_ID;
                this.hiddenexamine.PRINCIPAL_NAME = this.principalList[e.detail.value].NAME;
            },
            goback() {
                uni.navigateBack({
                    delta: 1
                });
                uni.hideLoading();
            },
            formatDate(time) {
                let date = new Date(time)
                return formatDate(date, 'yyyy-MM-dd hh:mm')
            },
            ViewShowImage(e) {
                let files = [];
                for (var i = 0; i < this.files.length; i++) {
                    files.push(baseImgPath + this.files[i].FILEPATH)
                }
                uni.previewImage({
                    urls: files,
                    current: e.currentTarget.dataset.index
                });
            },
            playVideo(e) {
                this.videoSrc = e.currentTarget.dataset.src
                this.modalShow = true
            },
            downloadAppendix(DISPOSAL_FILE) {
                plus.runtime.openURL(this.baseImgPath + DISPOSAL_FILE, function (res) {
                    console.log(res);
                });
            },

        }
    }
</script>

<style>
    .bb {
        border-top: 1upx solid #f1f1f1;
        border-bottom: 1upx solid #f1f1f1;
    }

    .cu-bar .action:first-child {
        font-size: 26upx
    }

    .cu-form-title {
        padding: 20upx 0;
    }

    .cu-form-textarea {
        background-color: #ffffff;
        padding: 1upx 30upx 20upx;
        min-height: 100upx;
    }

    .cu-form-textarea textarea {
        height: 4.6em;
        width: 100%;
        line-height: 1.2em;
        flex: 1;
        font-size: 28upx;
        padding: 0;
    }

    .cu-form-group {
        padding: 0upx 25upx;
    }

    .cu-form-group picker .picker {
        line-height: 76upx;
    }

    .cu-form-group .title {
        font-size: 28upx;
        line-height: 76upx;
        color: #888;
    }

    .cu-form-group uni-picker::after {
        top: -11upx;
    }

    .selected {
        display: flex;
        align-items: center;
    }

    .selected .radio {
        transform: scale(0.5);
        margin-right: 10upx;
    }

    .cu-btn {
        border-radius: 0;
        width: 100%;
        height: 84upx;
        font-weight: bold;
    }

    .group {
        display: flex;
        align-items: center;
    }
</style>
