<template>
    <view>
        <cu-custom bgColor="bg-gradual-blueness" :isBack="true">
            <block slot="backText">返回</block>
            <block slot="content">安全环保检查指派确认人</block>
        </cu-custom>
        <view class="form">
            <view class="wui-form-list">
                <view class="cu-form-group">
                    <text class="title">隐患描述</text>
                    <text class="text-semi">{{ form.HIDDENDESCR }}</text>
                </view>
              <view class="cu-form-group">
                <text class="title">隐患来源</text>
                <text v-if="form.SOURCE=='1'" class="text-semi">隐患快报</text>
                <text v-if="form.SOURCE=='2' || form.SOURCE=='3'" class="text-semi">清单排查</text>
                <text v-if="form.SOURCE=='4'" class="text-semi">安全环保检查</text>
                <text v-if="form.SOURCE=='5'" class="text-semi">安全环保检查</text>
                <text v-if="form.SOURCE=='6'" class="text-semi">消防检查</text>
              </view>
                <view class="cu-form-group">
                    <text class="title">隐患部位</text>
                    <text class="text-semi">{{ form.hregionName?form.hregionName:form.HIDDENPART }}</text>
                </view>
                <view class="cu-form-group">
                    <text class="title">隐患级别</text>
                    <text class="text-semi">{{ form.HIDDENLEVELNAME }}</text>

                </view>
                <view class="cu-form-group">
                    <text class="title">隐患类型</text>
                    <text class="text-semi">{{form.HIDDENTYPE_NAME}}</text>
                </view>
              <view class="cu-form-group">
                <text class="title">整改类型</text>
                <text v-if="form.RECTIFICATIONTYPE=='1'" class="text-semi">立即整改</text>
                <text v-else-if="form.RECTIFICATIONTYPE=='2'" class="text-semi">限期整改</text>
              </view>
<!--              <view v-if="form.RECTIFICATIONTYPE=='2'"class="cu-form-group">-->
<!--                <text class="title">整改期限</text>-->
<!--                <text class="text-semi">{{form.RECTIFICATIONDEADLINE}}</text>-->
<!--              </view>-->
                <view class="cu-form-group">
                    <text class="title">隐患照片</text>
                    <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" style="width: 80upx;height: 80upx;">
                                    <image :src="baseImgPath+item.FILEPATH" :data-index="index"
                                           @click="ViewShowImage" mode=""></image>
                                </view>
                            </view>
                        </scroll-view>
                    </view>
                </view>
<!--                <view class="cu-form-group" >-->
                <view class="cu-form-group" v-if="hiddenVideo.length>0">
                    <text class="title">隐患视频</text>
                    <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="cu-form-group">
                    <text class="title">隐患发现人</text>
                    <text class="text-semi">{{form.CREATORNAME}}</text>
                </view>
                <view class="cu-form-group">
                    <text class="title">发现时间</text>
                    <text class="text-semi">{{form.CREATTIME}}</text>
                </view>
<!--                <view class="cu-form-group">-->
<!--                    <text class="title">是否相关方</text>-->
<!--                    <text class="text-semi">{{form.ISRELEVANT =="1"?"是":"否"}}</text>-->
<!--                </view>-->
<!--                <view class="cu-form-group">-->
<!--                    <text class="title">隐患上报位置</text>-->
<!--                    <text class="text-semi">-->
<!--                      经度:{{form.LATITUDE&&form.LATITUDE}}-->
<!--                      纬度:{{form.LATITUDE&&form.LONGITUDE}}-->
<!--                    </text>-->
<!--                </view>-->
<!--                <view class="cu-form-group">-->
<!--                    <text class="title">隐患位置描述</text>-->
<!--                    <text class="text-semi">{{ form.POSITIONDESC }}</text>-->
<!--                </view>-->

<!--                <view class="cu-form-group"   @click="seeHiddenConfirm=='2'?seeHiddenConfirm='1':seeHiddenConfirm='2'">-->
<!--                    <text class="title">隐患确认信息 </text>-->
<!--                    <text class="text-semi">       <a>查看</a></text>-->
<!--                </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>
                        <tki-tree ref="hiddenLevenTree"
                                  :selectParent=false
                                  :range="levelList"
                                  rangeKey="name"
                                  @confirm="hiddenLevenConfirm"
                                  @cancel="hiddentreeCancel"></tki-tree>
                    </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">{{form.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">{{form.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">{{item.DELAY_TIME}}</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">{{form.conUserName}}</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 v-if="item.DISPOSAL_FILE" class="cu-form-group margin-top">
                        <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 " >
                    <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">{{form.conUserName}}</text>
                            </view>
                        </view>
                    </view>
                    <view class="cu-form-group margin-top" v-if="item.STATE==2">
                        <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="form" >
<!--        <view class="form"  v-if="HIDDEN_STATUS === '-2' ">-->
            <view class="wui-form-list" style="padding: 30upx 20upx;">
                <view class="title1">
                    安全环保检查隐患指派整改人
                </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">{{ form.RECTIFICATIONDEPTNAME }}</text>-->
<!--                      </view>-->
<!--                    </view>-->
                    <view class="picker-tree-box">
                      <view class="picker-tree" @tap="showZgTree('tkiTree1')">
                        {{ form.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">
                    <view class="title">整改负责人：</view>
<!--                    <view class="picker-tree-box">-->
<!--                      <view class="uni-flex-item text-right">-->
<!--                        <text class="text-semi">{{ form.RECTIFICATIONORNAME }}</text>-->
<!--                      </view>-->
<!--                    </view>-->
                    <picker @change="principalChange" :value="form.PRINCIPAL_INDEX"
                            :range="principalList" range-key="NAME">
                      <view class="picker">
                        {{ form.RECTIFICATIONORNAME || '请选择' }}
                      </view>
                    </picker>
                  </view>
                  <view class="cu-form-group margin-top">
                    <view class="title">整改期限</view>
                    <picker mode="date" :value="form.RECTIFICATIONDEADLINE" :start="rectifyPlanCompletionStartTime"
                            @change="changeDate">
                      <view class="picker">
                        {{ form.RECTIFICATIONDEADLINE ? form.RECTIFICATIONDEADLINE : '请选择' }}
                      </view>
                    </picker>
<!--                    <view class="picker-tree-box">-->
<!--                      <view class="uni-flex-item text-right">-->
<!--                        <text class="text-semi">{{ form.RECTIFICATIONDEADLINE }}</text>-->
<!--                      </view>-->
<!--                    </view>-->
                  </view>

            </view>
        </view>
        <view class="cu-bar btn-group" style="margin-top: 30upx;">
            <button v-if="HIDDEN_STATUS === '-2'" class="cu-btn bg-blue margin-tb-sm lg"
                    @click="$noMultipleClicks(submit)">保 存
            </button>
            <button v-else class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goback)">返 回</button>
        </view>
        <view class="padding flex flex-direction"></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, corpinfoId, deptId, loginUser, formatDate, loginSession, baseImgPath
    } from '@/common/tool.js';
    import tkiTree from "@/components/select-tree/select-tree.vue"
    import gcoord from '@/common/gcoord.js'
    import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue'
    import moreSelect from '@/components/more-select/more-select.vue';
    import uniPopup from '@/components/more-select/uni-popup/uni-popup.vue';
    import sign from '@/components/sign/sign.vue';

    export default {
        components: {
            tkiTree, ruiDatePicker, moreSelect, uniPopup, sign
        },
        data() {
            return {
                baseImgPath: baseImgPath,
                isUps: false,
                noClick: true,
                levelList: [],
                treeNode: [],//部门下拉数据
                INSPECTION_ID: '', // 检查ID
                HIDDEN_ID: '', // 检查ID
                HIDDEN_STATUS: '', // 检查ID
                principalList: [],
                form: {
                    HIDDENDESCR: '', // 隐患描述
                    CREATORNAME: '', // 隐患责任人
                    HIDDENLEVELNAME: '', // 隐患级别
                    DISCOVERYTIME: '', // 隐患发现时间
                    hregionName: '', // 隐患部位
                    HIDDENPART: '', // 隐患部位
                    HIDDENTYPE_NAME: '', // 隐患类型1
                    HIDDENTYPENAME2: '', // 隐患类型2
                    LONGITUDE: '', // 隐患坐标经度
                    LATITUDE: '', // 隐患坐标纬度
                    hiddenImgs: [], // 隐患图片
                    hiddenVideos: [], // 隐患视频
                    PRINCIPAL_INDEX: '',
                    RECTIFICATIONTYPE: '2', // 隐患处置
                    conUserIndex: '',
                    CONFIRM_USER: '', // 隐患确认人
                    conUserName: '',
                    HIDDEN_ID: '',
                    POSITIONDESC: '',//隐患位置描述
                },// 数据
                files: [],
                hiddenVideo: [],
                videoSrc: '',
                todayDate: '',
                modalShow: false,
                seeHiddenConfirm: '2',
                hiddenExamineList:[],
                rectifyPlanCompletionStartTime: '',

            }
        },
        onLoad(event) {
            let now = new Date();
            var tomorrow = now.setDate(now.getDate() + 1);
            tomorrow = new Date(tomorrow);
            this.todayDate = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
            this.INSPECTION_ID = event.INSPECTION_ID;
            this.HIDDEN_ID = event.HIDDEN_ID;
            this.HIDDEN_STATUS = event.HIDDEN_STATUS;
            this.getData();
            // 初始化现场作业负责人
            this.getDept()
            loginSession();
            this.rectifyPlanCompletionStartTime = formatDate(tomorrow, 'yyyy-MM-dd');

        },
        methods: {
            changeDate(e) {
              this.form.RECTIFICATIONDEADLINE = e.detail.value
              this.$forceUpdate();//强制刷新
            },
            showZgTree(ref) {
              this.$refs[ref]._show();
            },
            principalChange(e) {
              this.$set(this.form, 'RECTIFICATIONOR', this.principalList[e.detail.value].USER_ID)
              this.$set(this.form, 'RECTIFICATIONORNAME', this.principalList[e.detail.value].NAME)
            },
            zgtreeConfirm(e, list) {
              if (list === "principalList") {
                this.$set(this.form, 'RECTIFICATIONDEPT', e[0].id)
                this.$set(this.form, 'RECTIFICATIONDEPTNAME', e[0].name)
                this.$set(this.form, 'RECTIFICATIONORNAME', '')
              }
              this.getUserList(list, e[0].id);
            },
            zgtreeCancel(e) {
              this.isUps = false;
            },
            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
              }
            },
            // 取消回调事件
            hiddentreeCancel(e) {
              this.isUps = false;
            },
            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
                }
              });
              this.isUps = true
              _this.$refs.hiddenLevenTree._show();
            },
            getData() {
                var _this = this;
                uni.showLoading({
                    title: '请稍候'
                })
                uni.request({
                    url: basePath + '/app/hidden/goEdit',
                    method: 'POST',
                    header: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: {
                        HIDDEN_ID: _this.HIDDEN_ID,
                    },
                    success: (res) => {
                        if ("success" == res.data.result) {
                            uni.hideLoading();
                            _this.form = Object.assign(this.form, res.data.pd) //参数map
                          console.info( _this.form,'打印数据')
                          console.log("隐患位置描述:", _this.form.POSITIONDESC);
                          console.log("图片:", res.data.hImgs);
                            _this.files = res.data.hImgs;
                            _this.hiddenVideo = res.data.hiddenVideo
                            _this.hiddenExamineList = res.data.hiddenExa
                        } else if ("exception" == data.result) {
                            uni.showToast({
                                title: '错误',
                                duration: 2000
                            });
                        }
                    }
                });
            },
            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
            },
          submit() {
            var _this = this;
            // 在发送请求之前进行非空校验
            if (!_this.form.RECTIFICATIONDEPT) {
              uni.showToast({
                icon: 'none',
                title: '整改负责人部门不能为空',
                duration: 2000
              });
              return;
            }
            if (!_this.form.RECTIFICATIONOR) {
              uni.showToast({
                icon: 'none',
                title: '整改负责人不能为空',
                duration: 2000
              });
              return;
            }
            if (!_this.form.RECTIFICATIONDEADLINE) {
              uni.showToast({
                icon: 'none',
                title: '整改期限不能为空',
                duration: 2000
              });
              return;
            }
            uni.showLoading({
              title: '数据保存中'
            });
            uni.request({
              url: basePath + "/app/hidden/confirm",
              method: 'POST',
              dataType: 'json',
              header: {
                'Content-type': 'application/x-www-form-urlencoded'
              },
              data: {
                ..._this.form,
                CORPINFO_ID: corpinfoId,
                USER_ID: loginUser.USER_ID,
                USERNAME: loginUser.NAME,
                HIDDEN_ID: _this.form.HIDDEN_ID,
                HIDDENLEVEL: _this.form.HIDDENLEVEL,
                RECTIFICATIONDEPT: _this.form.RECTIFICATIONDEPT,
                RECTIFICATIONDEADLINE: _this.form.RECTIFICATIONDEADLINE,
                RECTIFICATIONOR: _this.form.RECTIFICATIONOR,
                OPERATOR: loginUser.USER_ID,
                NAME: loginUser.NAME,
                HIDDEN_STATUS: this.HIDDEN_STATUS,
                INSPECTION_ID: this.INSPECTION_ID,
                HIDDENDESCR: this.form.HIDDENDESCR
              },
              success: (res) => {
                if ("success" == res.data.result) {
                  uni.hideLoading();
                  _this.goback()
                } else {
                  uni.showToast({
                    title: res.data.msaesge,
                    duration: 2000
                  });
                }
              },
              fail: (err) => {
                uni.hideLoading();
                uni.showModal({
                  content: err.errMsg,
                  showCancel: false
                });
              }
            });

            // // 提交请求
            // uni.request({
            //   url: basePath + '/app/hidden/assign',
            //   method: 'POST',
            //   dataType: 'json',
            //   header: {
            //     'Content-type': 'application/x-www-form-urlencoded'
            //   },
            //   data: {
            //     ..._this.form,
            //     OPERATOR: loginUser.USER_ID,
            //     NAME: loginUser.NAME,
            //     CORPINFO_ID: corpinfoId,
            //     HIDDEN_STATUS: this.HIDDEN_STATUS,
            //     INSPECTION_ID: this.INSPECTION_ID,
            //     HIDDENDESCR: this.form.HIDDENDESCR
            //   },
            //   success: (res) => {
            //     if ("success" == res.data.result) {
            //       uni.hideLoading();
            //       _this.goback()
            //     } else {
            //       uni.showToast({
            //         title: res.data.msaesge,
            //         duration: 2000
            //       });
            //     }
            //   }
            // });
          },

            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, dept, i) {
                //发送 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: dept, NOMAIN: '1', tm: new Date().getTime()},
                    success: function (res) {
                        if ("success" == res.data.result) {
                            if (i > -1) {
                                _this[list][i] = [];
                                _this[list][i] = res.data.userList;
                                _this.$forceUpdate();//强制刷新
                            } else {
                                _this[list] = res.data.userList;
                            }
                        } else {
                            uni.showToast({
                                title: res.data.message,
                                duration: 2000
                            });
                        }
                    }
                })
            },

            goback() {
                var pages = getCurrentPages();	// 获取当前页面栈
                var prePage = pages[pages.length - 2];	// 上二级页面
                prePage.$vm.initflag = true;    // A 页面 init方法 为true
                uni.navigateBack({delta: 1});
                uni.hideLoading();
            },

            resetHd() {
                this.hiddenForm = {
                    HIDDEN_ID: '', // 隐患ID
                    HIDDENDESCR: '', // 隐患描述
                    HIDDENPART: '', // 隐患部位
                    HIDDENPART_NAME: '',
                    HIDDENLEVEL: '', // 隐患级别
                    HIDDENLEVEL_NAME: '',
                    HIDDENTYPE: '', // 隐患类型1
                    HIDDENTYPE_NAME: '',
                    HIDDENTYPE2: '', // 隐患类型2
                    HIDDENTYPE2_NAME: '',
                    LONGITUDE: '', // 隐患位置经度
                    LATITUDE: '', // 隐患位置纬度
                    DISCOVERYTIME: '', // 隐患发现时间
                    HIDDENFINDDEPT: '', // 隐患发现部门（隐患责任人部门）
                    HIDDENFINDDEPT_NAME: '',
                    CREATOR: '', // 发现人（隐患责任人）
                    CREATOR_INDEX: '',
                    CREATOR_NAME: '',
                    SOURCE: '5', // 隐患描述
                    hiddenImgs: [],
                    hiddenVideos: []
                }
            },
          downloadAppendix(DISPOSAL_FILE) {
            plus.runtime.openURL(this.baseImgPath + DISPOSAL_FILE, function (res) {
            });
          },
        }
    }
</script>

<style>
    .title1 {
        font-weight: bold;
        padding-left: 10 upx;
        border-left: 4px solid #0081FF;
    }

    .imgs {
        width: 80 upx !important;
        height: 80 upx !important;
    }
</style>
