<template>
    <div id="show-platform" v-loading="loading" element-loading-text="数据分析中" element-loading-spinner="el-icon-loading"  element-loading-background="rgba(0, 0, 0, 0.8)">
        <my-header/>
        <login-out/>
        <div id="interfaceBrowse">
            <div id="querybody">
                <div id="querybody_top">
                    <span style="margin-left: 10px">接口共享 / </span>
                    <span>详情</span>
                    <span class="out_part" v-on:click="onback">
                      <i class="fa fa-reply"></i>
                       <span></span>
                    </span>
                </div>
                <div id="querybody_body">
                    <el-form size="small" :model="formData" inline>
                        <el-row  :gutter="20">
                            <el-col :span="4">
                                <span ><h3>基础信息</h3></span>
                            </el-col>
                        </el-row>
                        <el-row  :gutter="20">
                            <el-col :span="3">
                                <span >资源图标：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-image  class="slt_img" :src="formData.SLT_URL"></el-image>
                            </el-col>
                        </el-row>
                        <el-row  :gutter="20">
                            <el-col :span="3">
                                <span >资源名称：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                        v-model="formData.RESOURCE_NAME"
                                        placeholder="资源名称">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>资源分类：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-select v-model="formData.RESOURCE_TYPE" readonly placeholder="请选择资源分类">
                                    <el-option label="资源访问类" value="1"></el-option>
                                    <el-option label="地图类" value="2"></el-option>
                                    <el-option label="控件类" value="3"></el-option>
                                </el-select>
                            </el-col>
                        </el-row>
                        <el-row  :gutter="20">
                            <el-col :span="3">
                                <span >共享类型：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-checkbox v-model="formData.SHARING_TOOLKIT=='2'" value="2"><span style="color:#ffffff;">工具包共享</span></el-checkbox>
                                <el-checkbox v-model="formData.SHARING_INTERFACE=='2'" value="2"><span style="color:#ffffff;">接口共享</span></el-checkbox>
                            </el-col>
                            <el-col :span="2">
                                <span>发布时间：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                        v-model="formData.RELEASE_TIME"
                                        placeholder="发布时间">
                                </el-input>
                            </el-col>
                        </el-row>
                        <el-row  :gutter="20">
                            <el-col :span="3">
                                <span >资源简介：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-input readonly type="textarea" v-model="formData.RELEASE_REMARKS" rows="5"></el-input>
                            </el-col>
                        </el-row>

                        <el-row v-show="show_toolkit" :gutter="20">
                            <el-col :span="4">
                                <span ><h3>工具包信息</h3></span>
                            </el-col>
                        </el-row>

                        <el-row v-show="show_toolkit"  :gutter="20">
                            <el-col :span="3">
                                <span >文件：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-input readonly
                                          v-model="formData.TOOLKIT_FILES"
                                          placeholder="文件">
                                    <el-button style="padding:12px 50px 10px 50px;margin-right:-5px;" slot="suffix" v-on:click="download" type="text" >下载</el-button>
                                </el-input>
                            </el-col>
                        </el-row>

                        <el-row  v-show="show_toolkit" :gutter="20">
                            <el-col :span="3">
                                <span >说明：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-input readonly type="textarea" v-model="formData.TOOLKIT_REMARKS" rows="5"></el-input>
                            </el-col>
                        </el-row>

                        <el-row v-show="show_interface" :gutter="20">
                            <el-col :span="4">
                                <span ><h3>接口信息</h3></span>
                            </el-col>
                        </el-row>
                        <el-row  v-show="show_interface"  :gutter="20">
                            <el-col :span="3">
                                <span >接口地址：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-input readonly
                                          v-model="formData.INTERFACE_ADDRESS"
                                          placeholder="接口地址">
                                </el-input>
                            </el-col>
                        </el-row>

                        <el-row  v-show="show_interface"  :gutter="20">
                            <el-col :span="3">
                                <span >接口类型：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-select  readonly v-model="formData.INTERFACE_TYPE" placeholder="请选择接口类型">
                                    <el-option label="http" value="1"></el-option>
                                    <el-option label="webService" value="2"></el-option>
                                </el-select>
                            </el-col>
                            <el-col :span="2">
                                <span>请求方式：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-select  readonly v-model="formData.REQUEST_MODE" placeholder="请选择请求方式">
                                    <el-option label="get" value="1"></el-option>
                                    <el-option label="post" value="2"></el-option>
                                </el-select>
                            </el-col>
                        </el-row>


                        <el-row  v-show="show_interface"  :gutter="20">
                            <el-col :span="3">
                                <span >说明：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-input  readonly type="textarea" v-model="formData.INTERFACE_REMARKS" rows="5"></el-input>
                            </el-col>
                        </el-row>

                        <el-row  v-show="show_interface"  :gutter="20">
                            <el-col :span="3">
                                <span >入参信息：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-table
                                        :data="put_tableData"
                                        :height="250"
                                        style="width: 100%">
                                    <el-table-column
                                            v-for="(item,index) in coloumList" :key="index"
                                            show-overflow-tooltip
                                            :prop="item.prop"
                                            :label="item.label">
                                    </el-table-column>
                                </el-table>
                            </el-col>
                        </el-row>

                        <el-row  v-show="show_interface"  :gutter="20">
                            <el-col :span="3">
                                <span >出参信息：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-table
                                        :data="out_tableData"
                                        :height="250"
                                        style="width: 100%">
                                    <el-table-column
                                            v-for="(item,index) in coloumList" :key="index"
                                            show-overflow-tooltip
                                            :prop="item.prop"
                                            :label="item.label">
                                    </el-table-column>
                                </el-table>
                            </el-col>
                        </el-row>

                        <el-row v-if="type=='apply'"  :gutter="20">
                            <el-col :span="4">
                                <span ><h3>申请信息</h3></span>
                            </el-col>
                        </el-row>

                        <el-row v-if="type=='apply'"  :gutter="20">
                            <el-col :span="3">
                                <span >共享频率：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input
                                          v-model="applyData.SHARED_FREQUENCY"
                                          placeholder="">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>共享开始时间：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-date-picker
                                        v-model="applyData.SHARED_STARTTIME"
                                        type="date"
                                        placeholder="选择日期">
                                </el-date-picker>
                            </el-col>
                        </el-row>

                        <el-row v-if="type=='apply'"  :gutter="20">
                            <el-col :span="3">
                                <span >共享结束时间：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-select   v-model="applyData.SHARED_ENDTIME" placeholder="请选择共享结束时间">
                                    <el-option label="无期限" value="1"></el-option>
                                    <el-option label="固定结束时间" value="2"></el-option>
                                </el-select>
                            </el-col>
                            <el-col :span="2">
                                <span>使用期限（天）：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input
                                          v-model="applyData.USE_TERM"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>

                        <el-row  v-if="type=='apply'" :gutter="20">
                            <el-col :span="3">
                                <span >IP：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input
                                          v-model="applyData.IP_ADDRESS"
                                          placeholder="">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>并发量：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input
                                          v-model="applyData.CONCURRENCY"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>


                        <el-row v-if="type=='apply'"  :gutter="20">
                            <el-col :span="3">
                                <span >每天访问限制数 ：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input
                                          v-model="applyData.DAY_LIMIT"
                                          placeholder=" ">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>申请人：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="applyData.APPLY_USER_NAME"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>

                        <el-row  v-if="type=='apply'" :gutter="20">
                            <el-col :span="3">
                                <span >申请单位 ：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="applyData.APPLY_UNIT_NAME"
                                          placeholder="">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>申请时间：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input  readonly
                                          v-model="applyData.APPLY_TIME"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>
                        <el-row v-if="type=='apply'"  :gutter="20">
                            <el-col :span="3">
                                <span >申请原因：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-input type="textarea" v-model="applyData.APPYL_REASON" rows="5"></el-input>
                            </el-col>
                        </el-row>

                        <el-row v-if="show_apply"  :gutter="20">
                            <el-col :span="4">
                                <span ><h3>审核信息</h3></span>
                            </el-col>
                        </el-row>

                        <el-row v-if="show_apply"  :gutter="20">
                            <el-col :span="3">
                                <span >审核人 ：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                        v-model="applyData.AUDIT_USER_NAME"
                                        placeholder="">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>审核单位：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="applyData.AUDIT_UNIT_NAME"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>

                        <el-row v-if="show_apply"  :gutter="20">
                            <el-col :span="3">
                                <span >审核时间 ：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="applyData.AUDIT_TIME"
                                          placeholder="">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>审核结果：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="applyData.AUDIT_STATE"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>
                        <el-row v-if="show_apply"  :gutter="20">
                            <el-col :span="3">
                                <span >审核意见：</span>
                            </el-col>
                            <el-col :span="14">
                                <el-input readonly type="textarea" v-model="applyData.AUDIT_OPINION" rows="5"></el-input>
                            </el-col>
                        </el-row>
                        <el-row v-if="show_warrant"  :gutter="20">
                            <el-col :span="4">
                                <span ><h3>密钥信息</h3></span>
                            </el-col>
                        </el-row>

                        <el-row v-if="show_warrant"  :gutter="20">
                            <el-col :span="3">
                                <span >目录编码 ：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="warrantData.CID"
                                          placeholder="">
                                </el-input>
                            </el-col>
                            <el-col :span="2">
                                <span>单位编码：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="warrantData.RID"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>
                        <el-row v-if="show_warrant"  :gutter="20">
                            <el-col :span="3">
                                <span >密钥 ：</span>
                            </el-col>
                            <el-col :span="6">
                                <el-input readonly
                                          v-model="warrantData.TOKEN"
                                          placeholder="">
                                </el-input>
                            </el-col>
                        </el-row>

                        <el-row   :gutter="20">
                            <el-col :span="17">
                                <div style="text-align: center">
                                    <el-button v-if="show_save_button" v-on:click="onSave">提交</el-button>&nbsp;&nbsp;
                                    <el-button v-on:click="onback">关闭</el-button>
                                </div>
                            </el-col>
                        </el-row>
                    </el-form>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import {baseUrl} from "@/service/config";
    import {MessageBox} from "element-ui";
    import MyHeader from "@/view/show-platform/common/MyHeader";
    import LoginOut from "@/view/show-platform/common/LoginOut";
    import {selectInterfaceKoolkitMain,selectInterfaceKoolkitParameter,addInterfaceKoolkitApply,selectInterfaceKoolkitApplyByUuid,selectInterfaceKoolkitWarrant} from "@/service/interfaceKoolkit";

    export default {
        name: "interfaceBrowseDetails",
        components: {LoginOut,MyHeader},
        data() {
            return {
                loading: false,
                show_width:346,//图片宽度
                show_height:319,//图片高度
                uuid:"",
                type:"",
                apply_uuid:"",
                show_toolkit:false,
                show_interface:false,
                show_apply:false,
                show_save_button:false,
                show_warrant:false,
                coloumList:[
                    {
                        prop:"PARAM_NAME",
                        label:"参数"
                    },
                    {
                        prop:"PARAM_DESCRIBE",
                        label:"名称"
                    },
                    {
                        prop:"PARAM_EXPLAIN",
                        label:"说明"
                    },
                    {
                        prop:"PARAM_TYPE",
                        label:"数据类型"
                    }
                ],
                put_tableData:[
                    {"PARAM_NAME":"PARAM_NAME","PARAM_DESCRIBE":"PARAM_DESCRIBE","PARAM_EXPLAIN":"PARAM_EXPLAIN","PARAM_TYPE":"数据类型"}
                ],
                out_tableData:[
                    {"PARAM_NAME":"PARAM_NAME","PARAM_DESCRIBE":"PARAM_DESCRIBE","PARAM_EXPLAIN":"PARAM_EXPLAIN","PARAM_TYPE":"数据类型"}
                ],
                warrantData:{
                    UUID:'',
                    APPLY_UUID:'',
                    CID:'',
                    RID:'',
                    TOKEN:'',
                    STATE:'',
                },
                applyData:{
                    INTERFACE_UUID:'',
                    SHARED_FREQUENCY:'',
                    SHARED_STARTTIME:'',
                    SHARED_ENDTIME:'',
                    USE_TERM:'',
                    IP_ADDRESS:'',
                    CONCURRENCY:'',
                    DAY_LIMIT:'',
                    APPLY_USER:'',
                    APPLY_USER_NAME:'',
                    APPLY_UNIT:'',
                    APPLY_UNIT_NAME:'',
                    APPLY_TIME:'',
                    APPYL_REASON:'',
                    AUDIT_OPINION:'',
                    AUDIT_USER:'',
                    AUDIT_USER_NAME:'',
                    AUDIT_UNIT:'',
                    AUDIT_UNIT_NAME:'',
                    AUDIT_TIME:'',
                    AUDIT_STATE:''
                },
                formData:{
                    UUID:'',
                    RESOURCE_NAME:'',
                    RESOURCE_TYPE:'',
                    SHARING_TOOLKIT:'',
                    SHARING_INTERFACE:'',
                    RELEASE_TIME:'',
                    RELEASE_REMARKS:'',
                    RESOURCE_THUMBNAIL:'',
                    TOOLKIT_FILES:'',
                    TOOLKIT_REMARKS:'',
                    INTERFACE_ADDRESS:'',
                    INTERFACE_TYPE:'',
                    REQUEST_MODE:'',
                    INTERFACE_REMARKS:'',
                    INTERFACE_STATE:'',
                    UNIT_CODE:'',
                    USER_CODE:'',
                    SLT_URL:''
                },
            }
        },
        mounted() {
            this.applyData.APPLY_UNIT = localStorage.getItem("zhfx_unitcode");
            this.applyData.APPLY_UNIT_NAME = localStorage.getItem("zhfx_unitname");
            this.applyData.APPLY_USER = localStorage.getItem("zhfx_usercode");
            this.applyData.APPLY_USER_NAME = localStorage.getItem("zhfx_username");
            this.uuid = JSON.parse(localStorage.getItem("JSON_PARA"))["uuid"];
            this.type = JSON.parse(localStorage.getItem("JSON_PARA"))["type"];
            this.apply_uuid = JSON.parse(localStorage.getItem("JSON_PARA"))["apply_uuid"];

            if(this.type=="apply"){
                this.show_save_button = true;
            }
            this.queryInterfaceToolkit();
            this.queryInterfaceToolkitPara();
        },methods:{
            queryInterfaceToolkit(){
                this.loading=true;
                this.formData.UUID='';
                this.formData.RESOURCE_NAME='';
                this.formData.RESOURCE_TYPE='';
                this.formData.SHARING_TOOLKIT='';
                this.formData.SHARING_INTERFACE='';
                this.formData.RELEASE_TIME='';
                this.formData.RELEASE_REMARKS='';
                this.formData.RESOURCE_THUMBNAIL='';
                this.formData.TOOLKIT_FILES='';
                this.formData.TOOLKIT_REMARKS='';
                this.formData.INTERFACE_ADDRESS='';
                this.formData.INTERFACE_TYPE='';
                this.formData.REQUEST_MODE='';
                this.formData.INTERFACE_REMARKS='';
                this.formData.INTERFACE_STATE='';
                this.formData.UNIT_CODE='';
                this.formData.USER_CODE='';
                this.formData.SLT_URL='';


                selectInterfaceKoolkitMain(
                    this.uuid).then(response => {
                    this.loading=false;
                    let dataArr = response.msg[0].Rows
                    this.totalCount =response.msg[0].TotalRowCount;
                    if(dataArr.length > 0){
                        this.formData = dataArr[0];

                        this.formData.UUID=dataArr[0]["UUID"];
                        this.formData.RESOURCE_NAME=dataArr[0]["RESOURCE_NAME"];
                        this.formData.RESOURCE_TYPE=dataArr[0]["RESOURCE_TYPE"];
                        this.formData.SHARING_TOOLKIT=dataArr[0]["SHARING_TOOLKIT"];
                        this.formData.SHARING_INTERFACE=dataArr[0]["SHARING_INTERFACE"];
                        this.formData.RELEASE_TIME=dataArr[0]["RELEASE_TIME"];
                        this.formData.RELEASE_REMARKS=dataArr[0]["RELEASE_REMARKS"];
                        this.formData.RESOURCE_THUMBNAIL=dataArr[0]["RESOURCE_THUMBNAIL"];
                        this.formData.TOOLKIT_FILES=dataArr[0]["TOOLKIT_FILES"];
                        this.formData.TOOLKIT_REMARKS=dataArr[0]["TOOLKIT_REMARKS"];
                        this.formData.INTERFACE_ADDRESS=dataArr[0]["INTERFACE_ADDRESS"];
                        this.formData.INTERFACE_TYPE=dataArr[0]["INTERFACE_TYPE"];
                        this.formData.REQUEST_MODE=dataArr[0]["REQUEST_MODE"];
                        this.formData.INTERFACE_REMARKS=dataArr[0]["INTERFACE_REMARKS"];
                        this.formData.INTERFACE_STATE=dataArr[0]["INTERFACE_STATE"];
                        this.formData.UNIT_CODE=dataArr[0]["UNIT_CODE"];
                        this.formData.USER_CODE=dataArr[0]["USER_CODE"];
                        this.formData.SLT_URL=dataArr[0]["SLT_URL"];
                        //判断是否上传过缩略图，如果未上传使用默认缩略图
                        if(this.formData["RESOURCE_THUMBNAIL"] == null || this.formData["RESOURCE_THUMBNAIL"] == ""){
                            //判断访问类型 添加默认图标
                            switch(this.formData["RESOURCE_TYPE"]){
                                case "1":
                                    this.formData["SLT_URL"] = baseUrl+"//fileController//image?path=D://files//interfaceKoolkit//slt//资源访问类.jpg";
                                    break;
                                case "2":
                                    this.formData["SLT_URL"] = baseUrl+"//fileController//image?path=D://files//interfaceKoolkit//slt//地图类.jpg";
                                    break;
                                case "3":
                                    this.formData["SLT_URL"] = baseUrl+"//fileController//image?path=D://files//interfaceKoolkit//slt//控件类.jpg";
                                    break;
                            }

                        }else{
                            this.formData["SLT_URL"] = baseUrl+"//fileController//image?path="+this.formData["RESOURCE_THUMBNAIL"];
                        }

                        if(this.formData["RELEASE_TIME"] != null ){
                            this.formData["RELEASE_TIME"] = this.formData["RELEASE_TIME"].toString().split(".")[0];
                        }

                        if(this.apply_uuid == null || this.apply_uuid == ""){
                            this.show_apply = false;
                        }else{
                            this.show_apply = true;
                            this.selectInterfaceKoolkitApplyByUuid();
                            this.show_save_button=false;
                        }
                    }else{
                        this.loading=false;
                        this.formData={};
                    }
                });
            },
            queryInterfaceToolkitPara(){
                this.put_tableData=[];
                this.out_tableData=[];
                selectInterfaceKoolkitParameter(
                    this.uuid).then(response => {
                    let dataArr = response.msg[0].Rows;
                    this.totalCount =response.msg[0].TotalRowCount;
                    if(dataArr.length > 0){
                        for(var i = 0 ; i < dataArr.length ;i++){
                            switch(dataArr[i]["PARAM_TYPE"]){
                                case "1":
                                    dataArr[i]["PARAM_TYPE"]="字符型";
                                    break;
                                case "2":
                                    dataArr[i]["PARAM_TYPE"]= "数值型";
                                    break;
                                case "3":
                                    dataArr[i]["PARAM_TYPE"]= "日期型";
                                    break;
                                case "4":
                                    dataArr[i]["PARAM_TYPE"]= "日期时间型";
                                    break;
                                case "5":
                                    dataArr[i]["PARAM_TYPE"]= "货币型";
                                    break;
                                case "6":
                                    dataArr[i]["PARAM_TYPE"]= "逻辑型";
                                    break;
                                case "7":
                                    dataArr[i]["PARAM_TYPE"]= "备注型";
                                    break;
                                case "8":
                                    dataArr[i]["PARAM_TYPE"]= "通用型";
                                    break;
                                case "9":
                                    dataArr[i]["PARAM_TYPE"]= "双精度型";
                                    break;
                                case "10":
                                    dataArr[i]["PARAM_TYPE"]= "整型";
                                    break;
                                case "11":
                                    dataArr[i]["PARAM_TYPE"]= "浮点型";
                                    break;
                                case "99":
                                    dataArr[i]["PARAM_TYPE"]= "其它";
                                    break;
                            }
                            if(dataArr[i]["TYPE"] == "1"){
                                this.put_tableData.push(dataArr[i]);
                            }else{
                                this.out_tableData.push(dataArr[i]);
                            }
                        }
                    }else{
                        this.put_tableData=[];
                        this.out_tableData=[];
                    }
                });

            },
            onback(){
                if(this.apply_uuid == null || this.apply_uuid == ""){
                    this.$router.push('interfaceBrowseController');
                }else{
                    this.$router.push('myInterfaceController');
                }

            },onSave(){
                //验证
                if(this.applyData.SHARED_FREQUENCY == null || this.applyData.SHARED_FREQUENCY == "" || this.applyData.SHARED_FREQUENCY.length == 0){
                    MessageBox.alert('共享频率不能为空', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }
                if(this.applyData.SHARED_FREQUENCY.length > 25){
                    MessageBox.alert('共享频率超出长度', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }

                if(this.applyData.SHARED_STARTTIME == null || this.applyData.SHARED_STARTTIME == "" || this.applyData.SHARED_STARTTIME.length == 0){
                    MessageBox.alert('共享开始时间不能为空', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }
                if(this.applyData.SHARED_ENDTIME == null || this.applyData.SHARED_ENDTIME == "" || this.applyData.SHARED_ENDTIME.length == 0){
                    MessageBox.alert('共享结束时间不能为空', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }

                if(this.applyData.SHARED_ENDTIME == "2"){
                    if(this.applyData.USE_TERM == null || this.applyData.USE_TERM == "" || this.applyData.USE_TERM.length == 0){
                        MessageBox.alert('使用期限（天）不能为空', '提示', {
                            confirmButtonText: '确定'
                        });
                        return;
                    }else{
                        var numReg = /^[0-9]*$/
                        var numRe = new RegExp(numReg)
                        if (!numRe.test(this.applyData.USE_TERM)) {
                            MessageBox.alert('使用期限（天）填写错误', '提示', {
                                confirmButtonText: '确定'
                            });
                            return;
                        }
                    }
                }

                if(this.applyData.USE_TERM.length > 10){
                    MessageBox.alert('使用期限（天）超出长度', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }

                if(this.applyData.IP_ADDRESS == null || this.applyData.IP_ADDRESS == "" || this.applyData.IP_ADDRESS.length == 0){
                    MessageBox.alert('IP不能为空', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }
                if(this.applyData.IP_ADDRESS.length > 200){
                    MessageBox.alert('IP超出长度', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }

                if(this.applyData.CONCURRENCY == null || this.applyData.CONCURRENCY == "" || this.applyData.CONCURRENCY.length == 0){
                    MessageBox.alert('并发量不能为空', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }

                if(this.applyData.CONCURRENCY.length > 10){
                    MessageBox.alert('并发量超出长度', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }

                if(this.applyData.DAY_LIMIT == null || this.applyData.DAY_LIMIT == "" || this.applyData.DAY_LIMIT.length == 0){
                    MessageBox.alert('每天访问限制数不能为空', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }
                if(this.applyData.DAY_LIMIT.length > 10){
                    MessageBox.alert('每天访问限制超出长度', '提示', {
                        confirmButtonText: '确定'
                    });
                    return;
                }

                    addInterfaceKoolkitApply(
                    this.uuid,
                    this.applyData.SHARED_FREQUENCY,
                    this.applyData.SHARED_STARTTIME,
                    this.applyData.SHARED_ENDTIME,
                    this.applyData.USE_TERM,
                    this.applyData.IP_ADDRESS,
                    this.applyData.CONCURRENCY,
                    this.applyData.DAY_LIMIT,
                    this.applyData.APPLY_USER,
                    this.applyData.APPLY_UNIT,
                    this.applyData.APPLY_TIME,
                    this.applyData.APPYL_REASON).then(response => {
                    var date = response.msg;
                    if (date[0]["success"] == "true") {
                        MessageBox('提交成功', '提示', {
                            confirmButtonText: '确定',
                        }).then(()=>{
                            this.onback();
                        })
                        return;
                    } else {
                        //   1 sucess   2 error   3 疑问  4 锁定 5 哭脸 6 笑脸  0 警告
                        MessageBox.alert('提交失败', '提示', {
                            confirmButtonText: '确定'
                        });
                        return;
                    }

                });
                //提交资源申请信息
            },selectInterfaceKoolkitApplyByUuid(){
                this.applyData.INTERFACE_UUID='';
                this.applyData.SHARED_FREQUENCY='';
                this.applyData.SHARED_STARTTIME='';
                this.applyData.SHARED_ENDTIME='';
                this.applyData.USE_TERM='';
                this.applyData.IP_ADDRESS='';
                this.applyData.CONCURRENCY='';
                this.applyData.DAY_LIMIT='';
                this.applyData.APPLY_USER='';
                this.applyData.APPLY_USER_NAME='';
                this.applyData.APPLY_UNIT='';
                this.applyData.APPLY_UNIT_NAME='';
                this.applyData.APPLY_TIME='';
                this.applyData.APPYL_REASON='';
                this.applyData.AUDIT_OPINION='';
                this.applyData.AUDIT_USER='';
                this.applyData.AUDIT_TIME='';
                this.applyData.AUDIT_STATE='';

                this.applyData.AUDIT_USER_NAME='';
                this.applyData.AUDIT_UNIT_NAME='';

                if(this.apply_uuid == null){
                    return;
                }
                selectInterfaceKoolkitApplyByUuid(
                    this.apply_uuid).then(response => {
                    let dataArr = response.msg[0].Rows;
                    if(dataArr.length > 0){
                        this.applyData.INTERFACE_UUID=dataArr[0]["INTERFACE_UUID"];
                        this.applyData.SHARED_FREQUENCY=dataArr[0]["SHARED_FREQUENCY"];
                        this.applyData.SHARED_STARTTIME=dataArr[0]["SHARED_STARTTIME"];
                        this.applyData.SHARED_ENDTIME=dataArr[0]["SHARED_ENDTIME"];
                        this.applyData.USE_TERM=dataArr[0]["USE_TERM"];
                        this.applyData.IP_ADDRESS=dataArr[0]["IP_ADDRESS"];
                        this.applyData.CONCURRENCY=dataArr[0]["CONCURRENCY"];
                        this.applyData.DAY_LIMIT=dataArr[0]["DAY_LIMIT"];
                        this.applyData.APPLY_USER=dataArr[0]["APPLY_USER"];
                        this.applyData.APPLY_USER_NAME=dataArr[0]["APPLY_USER_NAME"];
                        this.applyData.APPLY_UNIT=dataArr[0]["APPLY_UNIT"];
                        this.applyData.APPLY_UNIT_NAME=dataArr[0]["APPLY_UNIT_NAME"];
                        this.applyData.APPLY_TIME=dataArr[0]["APPLY_TIME"];
                        this.applyData.APPYL_REASON=dataArr[0]["APPYL_REASON"];
                        this.applyData.AUDIT_OPINION=dataArr[0]["AUDIT_OPINION"];
                        this.applyData.AUDIT_USER=dataArr[0]["AUDIT_USER"];
                        this.applyData.AUDIT_TIME=dataArr[0]["AUDIT_TIME"];
                        this.applyData.AUDIT_STATE=dataArr[0]["AUDIT_STATE"];

                        this.applyData.AUDIT_USER_NAME=dataArr[0]["AUDIT_USER_NAME"];
                        this.applyData.AUDIT_UNIT_NAME=dataArr[0]["AUDIT_UNIT_NAME"];
                        switch (this.applyData["AUDIT_STATE"]) {
                            case "1":
                                this.applyData["AUDIT_STATE"] =  "待审核";
                                break;
                            case "2":
                                this.applyData["AUDIT_STATE"] =  "审核通过";
                                break;
                            case "3":
                                this.applyData["AUDIT_STATE"] =  "审核不通过";
                                break;
                        }
                        if(this.applyData["APPLY_TIME"] != null ){
                            this.applyData["APPLY_TIME"] = this.applyData["APPLY_TIME"].toString().split(".")[0];
                        }
                        if(this.applyData["AUDIT_TIME"] != null ){
                            this.applyData["AUDIT_TIME"] = this.applyData["AUDIT_TIME"].toString().split(".")[0];
                        }
                        if(this.applyData["AUDIT_STATE"] == "审核通过"){
                            this.show_warrant = true;
                            if(this.formData.SHARING_TOOLKIT == "2"){
                                this.show_toolkit = true;
                            }
                            if(this.formData.SHARING_INTERFACE == "2"){
                                this.show_interface = true;
                            }
                            this.selectInterfaceKoolkitWarrant();
                        }

                    }else{
                        this.applyData = {};
                    }
                });
            }
            ,selectInterfaceKoolkitWarrant(){
                this.warrantData.UUID='';
                this.warrantData.APPLY_UUID='';
                this.warrantData.CID='';
                this.warrantData.RID='';
                this.warrantData.TOKEN='';
                this.warrantData.STATE='';
                selectInterfaceKoolkitWarrant(this.uuid,
                    this.apply_uuid).then(response => {
                    let dataArr = response.msg[0].Rows;
                    if(dataArr.length > 0){
                        this.warrantData.UUID=dataArr[0]["UUID"];
                        this.warrantData.APPLY_UUID=dataArr[0]["APPLY_UUID"];
                        this.warrantData.CID=dataArr[0]["CID"];
                        this.warrantData.RID=dataArr[0]["RID"];
                        this.warrantData.TOKEN=dataArr[0]["TOKEN"];
                        this.warrantData.STATE=dataArr[0]["STATE"];
                    }
                });
            },download(){
                if(this.formData.TOOLKIT_FILES == null || this.formData.TOOLKIT_FILES == ""){
                    return;
                }
                window.location.href=baseUrl+"/ywtb/exportYwtbDocument?path="+this.formData.TOOLKIT_FILES;
            }
        }
    }
</script>

<style scoped lang="scss">
    ::v-deep{

        .el-tabs__item{
            color: #fff;
        }
        .el-tabs__item.is-active {
            color: #409EFF !important;
        }
        .el-tabs--card>.el-tabs__header{
            border-bottom: 1px solid rgba(0, 170, 255, 0.8);
        }
        .el-tabs--card>.el-tabs__header .el-tabs__item.is-active{
            border-bottom: 1px solid rgba(0, 170, 255, 0.8);
        }
        .el-tabs--card>.el-tabs__header .el-tabs__nav{
            border:1px solid rgba(0, 170, 255, 0.8);
        }
        .el-tabs--card>.el-tabs__header .el-tabs__item{
            border-left:1px solid rgba(0, 170, 255, 0.8);
        }
        .el-table, .el-table__expanded-cell{
            background-color: transparent;
        }
        .el-table th.el-table__cell{
            background-color: transparent;
        }
        .el-table tr{
            background-color: transparent;
        }
        .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf{
            border-bottom: 1px solid rgba(0, 170, 255, 0.8);
        }
        .el-table thead{
            color: #fff;
        }
        .el-table{
            color: #fff;
            border: 1px solid #00aaff;
        }
        .el-table--border::after, .el-table--group::after, .el-table::before{
            background-color: transparent;
        }
        .el-table tbody tr:hover>td {
            background: rgba(0, 204, 255, 0.7) !important
        }
        .el-button{
            box-sizing: border-box;
            border: 1px solid #00aaff;
            background: rgba(255, 255, 255, 0.1);
            outline: #00aaff;
            color: white;
            resize:none;
        }
        .el-date-editor.el-input, .el-date-editor.el-input__inner {
            width: 100%;
        }
        textarea{
            box-sizing: border-box;
            border: 1px solid #00aaff;
            background: rgba(255, 255, 255, 0.1);
            outline: #00aaff;
            resize:none;
            color: white;
        }
        .el-select{
            width:100%;
        }
    }
    #show-platform{
        width: 100%;
        height:100%;
        overflow: hidden;
    }
    #interfaceBrowse{
        width:100%;
        height: 100%;
        background-color:#061635;
        position: absolute;
        color: white;
        font-size: 14px;

    }

    #querybody{
        width: 96%;
        border:1px solid red;
        position:absolute;
        left: 2%;
        top:13%;
        background: rgba(0, 38, 115, 0.6);
        border: 1px solid #00aaff;
        border-radius: 4px;
        color: white;
        font-size: 14px;
        height:86%;
    }




    #querybody_top{
        width:100%;
        height: 50px;
        line-height: 50px;
        border-bottom: 1px solid #00aaff;
        font-size: 18px;
    }
    .out_part{
        float:right;
        margin-right: 10px;
    }

    #querybody_body{
        padding: 10px;
        font-size: 16px;
        color: white;
        overflow-y: scroll;/*y轴滚动*/
        height:90%;
    }

    #querybody_body::-webkit-scrollbar {
        display: none;/*隐藏滚动条*/
    }

    #querybody_body span{
        display: inline-block;
        width:100%;
        text-align: right;
    }

    #querybody_body h3{
        margin-left: 30px;
        text-align: left;
    }


    .slt_img{
        width: 346px;
        height: 139px
    }
    .el-row{
        margin-top:15px;
    }
</style>