<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" 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?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>
			<view class="de-card-list de-list" v-if="pd.RECTIFICATIONTYPE=='1'">
				<view class="de-title">
					<text class="text-semi">隐患整改</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 class="text-semi">{{pd.RECTIFYDESCR}}</text>
					</view>
				</view>
				<view class="de-item-sp" v-if="files2.length>0">
					<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 files2" 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>
            <view class="de-card-list de-list" v-if="activeType =='confirm'">
                <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" v-if="pd.SOURCE !== '4' && pd.SOURCE !== '5'">
                        <view class="picker-tree" @tap="showHiddenLevenTreeTree">
                            {{pd.HIDDENLEVELNAME?pd.HIDDENLEVELNAME:'请选择'}}
                        </view>
                    </view>
                    <view class="picker-tree-box" v-else>
                        <view class="picker-tree">
                            {{pd.HIDDENLEVELNAME?pd.HIDDENLEVELNAME:'请选择'}}
                        </view>
                    </view>
                    <tki-tree ref="hiddenLevenTree"
                              :selectParent=false
                              :range="levelList"
                              rangeKey="name"
                              @confirm="hiddenLevenConfirm"
                              @cancel="hiddentreeCancel"></tki-tree>
                </view>
                <view class="cu-form-group margin-top" v-if="pd.RECTIFICATIONTYPE=='1'">
                    <view class="title text-hui asterisk">是否整改完成</view>
                    <radio-group class="selected">
                        <view class="group mr20">
                            <radio class='radio' value="1" :checked="isTrue==1"  @click="radioISRELEVANT(1)"></radio>
                            <text>是</text>
                        </view>
                        <view class="group">
                            <radio class='radio' value="2" :checked="isTrue==2"  @click="radioISRELEVANT(2)"></radio>
                            <text>否</text>
                        </view>
                    </radio-group>
                </view>
                <view class="cu-form-group margin-top" v-if="pd.RECTIFICATIONTYPE=='2' && pd.HIDDENLEVEL !='hiddenLevel1001' || isTrue =='2'">
                    <view class="title">整改负责人部门</view>
                    <view class="picker-tree-box">
                        <view class="picker-tree" @tap="showZgTree('tkiTree1')">
                            {{ pd.RECTIFICATIONDEPTNAME || '请选择' }}
                        </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=" pd.RECTIFICATIONTYPE=='2' && pd.HIDDENLEVEL !='hiddenLevel1001' || isTrue =='2'">
                    <view class="title">整改负责人：</view>
                    <picker @change="principalChange" :value="pd.PRINCIPAL_INDEX"
                            :range="principalList" range-key="NAME">
                        <view class="picker">
                            {{ pd.RECTIFICATIONORNAME || '请选择' }}
                        </view>
                    </picker>
                </view>
                <view class="cu-form-group margin-top" v-if="pd.RECTIFICATIONTYPE=='2' && pd.HIDDENLEVEL !='hiddenLevel1001' || isTrue =='2'">
                    <view class="title">整改期限</view>
                    <picker mode="date" :value="pd.RECTIFICATIONDEADLINE" :start="rectifyPlanCompletionStartTime"
                            @change="changeDate">
                        <view class="picker">
                            {{pd.RECTIFICATIONDEADLINE?pd.RECTIFICATIONDEADLINE:'请选择'}}
                        </view>
                    </picker>
                </view>
            </view>
            <view class="de-card-list de-list" v-if="pd.STATE !='-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">{{pd.HIDDENLEVELNAME}}</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.RECTIFICATIONDEPTNAME}}</text>
                        </view>
                    </view>
                </view>
                <view class="cu-form-group">
                    <view class="title">整改负责人：</view>
                    <view class="picker-tree-box">
                        <view class="uni-flex-item text-right">
                            <text class="text-semi">{{pd.RECTIFICATIONORNAME}}</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.RECTIFICATIONDEADLINE}}</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>
            </view>

            <view class="cu-bar btn-group" style="margin-top: 30upx;">
                <button class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goback)">返回</button>
                <button class="cu-btn bg-blue margin-tb-sm lg" v-if="activeType =='view' && pd.STATE =='-2'"
                        @click="$noMultipleClicks(goView)">修改
                </button>
                <button class="cu-btn bg-blue margin-tb-sm lg" v-if="activeType =='confirm' && pd.SOURCE != 4 && pd.SOURCE != 5"
                        @click="$noMultipleClicks(goreject)">打回
                </button>
                <button class="cu-btn bg-blue margin-tb-sm lg" v-if="activeType =='confirm'"
                        @click="$noMultipleClicks(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 :class="['cu-modal',{'show':dialogFormtoExamine}]" v-if="dialogFormtoExamine">
            <view class="cu-dialog">
                <view class="cu-bar bg-white justify-end">
                    <view class="content">打回原因</view>
                </view>
                <textarea maxlength="-1"  v-model="REJECTOPINION" placeholder="请输入打回原因" style="width: 100%;padding:20upx;"></textarea>
                <view class="cu-bar bg-white justify-end">
                    <button class="cu-btn-r bg-blue margin-tb-sm lg" @click="dialogFormtoExamine = false">关闭</button>
                    <button class="cu-btn-r bg-blue margin-tb-sm lg" @click="$noMultipleClicks(goRepulse)">提交</button>
                </view>
            </view>
        </view>
    </view>
</template>

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

    export default {
        components: {
            tkiTree,
        },
        data() {
            return {
                noClick: true,
                date: '',
                RECTIFICATIONTIME: '',
                imgList: [],
                id: '',
                pd: [],
                hs: [],
                files: [],
                files2: [],
                files3: [],
                files4: [],
                checkList: [],
                CHECKDESCR: '',
                basePath: basePath,
                baseImgPath,
                ISQUALIFIED: '1',
                levelList: [],
                levelList2: [],
                treeNode: [],
                principalList: [],
                lindex: -1,
                hiddenFindPeople: [],
                hiddenVideo: [],
                activeType: 'view',
                rectifyPlanCompletionStartTime: '',
                modalShow: false,
                showStatus: true,
                dialogFormtoExamine: false,
                REJECTOPINION: '', //打回原因
                videoSrc: '',
                isTrue:'1'
            }
        },
        onLoad(e) {
            let now = new Date();
            var tomorrow = now.setDate(now.getDate() + 1);
            tomorrow = new Date(tomorrow);
            this.rectifyPlanCompletionStartTime = formatDate(tomorrow, 'yyyy-MM-dd');
            this.id = e.id;
            1
            this.activeType = e.activeType;
            this.getData();
            this.getLevel();
            this.getDept();
        },

        methods: {
            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.id,
                    },
                    success: (res) => {
                        if ("success" === res.data.result) {
                            uni.hideLoading();
                            _this.pd = res.data.pd; //参数map
                            _this.hs = res.data.hs; //参数map
                            _this.files = res.data.hImgs;
                            _this.files2 = res.data.rImgs;
                            //_this.files3 = res.data.cImgs;
                            _this.files4 = res.data.sImgs;
                            _this.checkList = res.data.checkList;
                            _this.hiddenFindPeople = res.data.hiddenFindPeople
                            _this.hiddenVideo = res.data.hiddenVideo
                            if(res.data.pd.RECTIFICATIONDEPT){
                                _this.getUserList('principalList', res.data.pd.RECTIFICATIONDEPT);
                            }
                            if (res.data.hiddenExa.length > 0) {
                                res.data.hiddenExa.forEach(item => {
                                    if (item.TYPE ==0) {
                                        _this.pd.editUserName = item.editUserName
                                        _this.pd.editDeptName = item.editDeptName
                                        _this.pd.editLevelName = item.editLevelName
                                        _this.pd.editRectificationDeadline = item.spare3
                                    }
                                })
                            }
                            if(_this.pd.HIDDENLEVEL =='hiddenLevel1001'){
                                _this.showStatus = false
                            }else{
                                _this.showStatus = true
                            }
                        } else if ("exception" === res.data.result) {
                            uni.showToast({
                                title: '错误',
                                duration: 2000
                            });
                        }
                    }
                });
            },

            ViewImage(e) {
                uni.previewImage({
                    urls: this.imgList,
                    current: e.currentTarget.dataset.url
                });
            },
            goView(type) {
                this.activeType = 'confirm'
            },
            submit() {
                var _this = this;
                let required = true
                if (this.pd.RECTIFICATIONTYPE == '2' && this.pd.HIDDENLEVEL !='hiddenLevel1001' || this.isTrue =='2') {
                    if (!this.pd.RECTIFICATIONDEADLINE || this.pd.RECTIFICATIONDEADLINE === "undefined"|| this.pd.RECTIFICATIONDEADLINE === "请选择") {
                        uni.showToast({
                            icon: 'none',
                            title: '请选择整改期限',
                            duration: 1500
                        });
                        required = false
                        return false;
                    }
                    if (!this.pd.RECTIFICATIONDEPT && this.pd.HIDDENLEVEL !='hiddenLevel1001' || this.pd.RECTIFICATIONDEPT === "undefined") {
                        uni.showToast({
                            icon: 'none',
                            title: '请选择整改负责人部门',
                            duration: 1500
                        });
                        required = false
                    }
                    if (!this.pd.RECTIFICATIONOR && this.pd.HIDDENLEVEL !='hiddenLevel1001' || this.pd.RECTIFICATIONOR === "undefined") {
                        uni.showToast({
                            icon: 'none',
                            title: '请选择整改负责人',
                            duration: 1500
                        });
                        required = false
                    }

                }
                if (!this.pd.HIDDENLEVELNAME) {
                    uni.showToast({
                        icon: 'none',
                        title: '请选择隐患级别',
                        duration: 1500
                    });
                    required = false
                }
                if (!required) {
                    return
                }
                uni.showLoading({
                    title: '请稍候'
                })
                uni.request({
                    url: basePath + "/app/hidden/confirm",
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        CORPINFO_ID: corpinfoId,
                        USER_ID: loginUser.USER_ID,
                        USERNAME: loginUser.NAME,
                        HIDDEN_ID: _this.pd.HIDDEN_ID,
                        HIDDENLEVEL: _this.pd.HIDDENLEVEL,
                        RECTIFICATIONDEPT: _this.pd.RECTIFICATIONDEPT,
                        RECTIFICATIONDEADLINE: _this.pd.RECTIFICATIONDEADLINE,
                        RECTIFICATIONOR: _this.pd.RECTIFICATIONOR,
                        isTrue: _this.isTrue,
                    },
                    success: (res) => {
                        uni.showToast({
                            icon: 'none',
                            title: '提交成功',
                            duration: 2000
                        });
                        _this.goback()
                    },
                    fail: (err) => {
                        uni.hideLoading();
                        uni.showModal({
                            content: err.errMsg,
                            showCancel: false
                        });
                    }
                })
            },
            // 驳回
            goreject(row) {
                this.dialogFormtoExamine = true
            },
            goRepulse() {
                uni.request({
                    url: basePath + "/app/hidden/repulseHidden",
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        HIDDEN_ID: this.pd.HIDDEN_ID,
                        REPULSE_CAUSE: this.REJECTOPINION,
                        OPERATOR: loginUser.USER_ID,
                        CREATOR: loginUser.USER_ID,
                        TYPE: '6',
                        STATE: '16'
                    },
                    success: (res) => {
                        uni.showToast({
                            icon: 'none',
                            title: '提交成功',
                            duration: 2000
                        });
                        this.goback()
                    },
                    fail: (err) => {
                        uni.hideLoading();
                        uni.showModal({
                            content: err.errMsg,
                            showCancel: false
                        });
                    }
                })
            },
            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
                });
            },
            goToOpen(e) {
                var url = e;
                plus.runtime.openURL(url, function (res) {
                    console.log(res);
                });
            },
            //获取数据字典数据
            getLevel: function () {
            },
            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
                            });
                        }
                    }
                });
            },
            showZgTree(ref) {
                this.$refs[ref]._show();
            },
            zgtreeCancel(e) {
                this.isUps = false;
            },
            zgtreeConfirm(e, list) {
                if (list === "principalList") {
                    this.$set(this.pd, 'RECTIFICATIONDEPT', e[0].id)
                    this.$set(this.pd, 'RECTIFICATIONDEPTNAME', e[0].name)
                    this.$set(this.pd, 'RECTIFICATIONORNAME', '')
                }
                this.getUserList(list, e[0].id);
            },
            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
                            });
                        }
                    }
                })
            },
            levelPickerChange(e) {
                this.pd.HIDDENLEVELBIANMA = this.levelList[e.detail.value].BIANMA
                this.pd.HIDDENLEVELNAME = this.levelList[e.detail.value].NAME
                var _this = this;
                uni.request({
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    url: basePath + '/dictionaries/getLevels?tm=' + new Date().getTime(),
                    data: {DICTIONARIES_ID: this.levelList[e.detail.value].DICTIONARIES_ID},
                    success: function (res) {
                        _this.levelList2 = res.data.list;
                    }
                });
            },
            levelPickerChange2(e) {
                this.$set(this.pd, 'HIDDENLEVEL2NAME', this.levelList2[e.detail.value].NAME)
                this.pd.HIDDENLEVEL2BIANMA = this.levelList2[e.detail.value].BIANMA
            },
            principalChange(e) {
                this.$set(this.pd, 'RECTIFICATIONOR', this.principalList[e.detail.value].USER_ID)
                this.$set(this.pd, 'RECTIFICATIONORNAME', this.principalList[e.detail.value].NAME)
            },
            formatDate(time) {
                let date = new Date(time)
                return formatDate(date, 'yyyy-MM-dd hh:mm')
            },
            goback() {
                uni.navigateBack({
                    delta: 1
                });
                uni.hideLoading();
            },
            showHiddenLevenTreeTree() {
                var _this = this;
                uni.request({
                    method: 'POST',
                    dataType: 'json',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    url: basePath + '/dictionaries/listSelectTreeByTkiTree?tm=' + new Date().getTime(),
                    data: {DICTIONARIES_ID: '5e7cf8620ba54ad89719d0be62133c7a'},
                    success: function (res) {
                        // _this.levelList = JSON.parse(data.zTreeNodes) res.data.zTreeNodes;
                        var jons = res.data.zTreeNodes;
                        // var json2 = jons.replace('nodes', 'children');
                        // console.info(json2)
                        var data = JSON.parse(jons);
                        for(let i=0;i<data.length;i++){
                            for(let j=0;j<data[i].children.length;j++){
                                if(data[i].children[j].id =='jdyh001'){
                                    data[i].children.splice(j,1)
                                }
                            }
                            if(data[i].id =='hiddenLevel0002'){
                                data.splice(i,1)
                            }
                        }
                        _this.levelList = data
                        console.info(_this.levelList)
                    }
                });
                this.isUps = true
                this.$refs.hiddenLevenTree._show();
            },
            hiddenLevenConfirm(e) {
                this.isUps = false;
                this.pd.HIDDENLEVEL = e[0].id;
                this.pd.HIDDENLEVELNAME = e[0].name;

                if (e[0].id == 'hiddenLevel1001') {
                    this.showStatus = false
                } else {
                    this.showStatus = true
                }
            },
            radioISRELEVANT(e){
                this.isTrue = e
            },
            // 取消回调事件
            hiddentreeCancel(e) {
                this.isUps = false;
            },
            changeDate(e) {
                this.pd.RECTIFICATIONDEADLINE = e.detail.value
                this.$forceUpdate();//强制刷新
            },
            playVideo(e) {
                this.videoSrc = e.currentTarget.dataset.src
                this.modalShow = true
            }
        }
    }
</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;
    }

    .cu-btn-r {
        border-radius: 0;
        width: 30%;
        font-weight: bold;
    }

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