<template>
    <div class="page_project">
        <div style="display:flex;justify-content: space-between;width:100%;margin-bottom:20px;">
            <div class="cell clearfix" style="margin-bottom:0;">
                <el-input style="width: 180px;margin-right:10px;" @keyup.enter.native='searchAction' v-model.trim="search_input" class="filter-item"/>
                <el-button style="margin-right:10px;" class="filter-item" type="primary" icon="el-icon-search" @click="searchAction" >搜索</el-button>
                <label class="title"><span class="name">状态</span> : </label>
                <el-select v-model="is_start" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeStart">
                    <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                    </el-option>
                </el-select>
                <label class="title"><span class="name">是否收费预估项:</span> : </label>
                <el-select v-model="is_charge" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeOption">
                    <el-option
                    v-for="item in optionOne"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                    </el-option>
                </el-select>
                <label class="title"><span class="name">备案:</span> : </label>
                <el-select v-model="is_mark" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeRecord">
                  <el-option
                    v-for="item in optionOne"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
            </div>
            <div>
             <el-button type="primary" @click="openForm(0)">新增</el-button>
             <!-- <el-button type="primary" @click="BatchDelete()" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028">批量备案</el-button>
             <el-button type="primary" v-if="$store.getters.xt_user.org_id != 9504 && $store.getters.xt_user.org_id != 10028" @click="GDYBBatchPutOnRecord">批量备案</el-button> -->
            </div>
        </div>
        <div style="display:flex; align-items:center;margin-bottom:10px;">
        <el-button type="primary" size="small" @click="BatchDelete()" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028" >批量备案</el-button>
        <el-button type="primary" size="small" v-if="$store.getters.xt_user.org_id != 9504 && $store.getters.xt_user.org_id != 10028" @click="GDYBBatchPutOnRecord()">批量备案</el-button>
        <el-link target="_blank" href="https://kuyi.shengws.com/itemTemplate.xlsx" :underline="false"
                 style="margin-left:15px">
          <el-button
            class="filter-item"
            type="primary"
            size="small"
          >下载模版
          </el-button>
        </el-link>

        <project-excel :on-success='handleSuccessOne'></project-excel>

        <el-button
          style="margin-left:10px;"
          @click="generateLog()"
          class="filter-item"
          type="primary"
          size="small"
        >下载日志
        </el-button>
      </div>
        <el-table :data="tableData" border style="width: 100%" :row-style="{ color: '#303133' }" :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}"  @selection-change="handleSelectionChange">
            <el-table-column
              align="center"
              type="selection"
              width="55">
            </el-table-column>
            <el-table-column prop="date" label="序号" width="80" align="center">
                 <template  slot-scope="scope">
                      {{scope.$index+1}}
                 </template>
            </el-table-column>
            <el-table-column prop="date" label="名称" align="center">
                <template  slot-scope="scope">
                    {{scope.row.project_name}}
                </template>
            </el-table-column>
             <el-table-column prop="date" label="单价" align="center">
                <template  slot-scope="scope">
                    {{scope.row.price}}
                </template>
            </el-table-column>
            <el-table-column prop="date" label="单位" align="center">
                <template  slot-scope="scope">
                    {{scope.row.unit}}
                </template>
            </el-table-column>
            <el-table-column prop="date" label="费用类别" align="center">
                  <template  slot-scope="scope">
                     {{getCostClassify(scope.row.cost_classify)}}
                  </template>
            </el-table-column>
            <el-table-column prop="date" label="执行科室" width="140" align="center">
                <template  slot-scope="scope">
                    {{getExecutiveSection(scope.row.executive_section)}}
                </template>
            </el-table-column>
            <el-table-column label="医保编码" width="140" align="center">
                <template  slot-scope="scope">
                   {{scope.row.medical_code}}
                </template>
            </el-table-column>
            <el-table-column label="状态" width="60" align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.medical_status ==0"></span>
                  <span v-if="scope.row.medical_status ==1">停用</span>
                  <span v-if="scope.row.medical_status ==2">收费</span>
                </template>
            </el-table-column>
            <el-table-column prop="date" label="操作" width="300" align="center">
                <template slot-scope="scope">
                    <el-button @click="editHisProject(scope.row.id)" type="primary" size="small">编辑</el-button>
                    <el-button type="danger" size="small" @click="deleteProject(scope.row.id,scope.$index)">删除</el-button>
                    <el-button type="primary" size="small" icon="el-icon-refresh-left" @click="toReturn(scope.row.id,scope.row.is_mark)" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028 || $store.getters.xt_user.org_id == 10138">
                      <span v-if="scope.row.is_mark ==0">备案</span>
                      <span v-if="scope.row.is_mark ==1">撤销</span>
                    </el-button>

                    <el-button type="primary" size="small" icon="el-icon-refresh-left" v-if="$store.getters.xt_user.org_id != 9504 && $store.getters.xt_user.org_id != 10028 && $store.getters.xt_user.org_id != 10138">
                        <span v-if="scope.row.is_mark == 0 || scope.row.is_mark == 2"  @click="putOnRecord(scope.row.id)" >目录对照</span>
                        <span v-if="scope.row.is_mark == 1"  @click="putOnUnRecord(scope.row.id)" >撤消对照</span>
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
         <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :page-sizes="[10, 50, 100]"
            :page-size="10"
            background
            align="right"
            style="margin-top:20px;"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
         >
        </el-pagination>

        <add-project ref="addProject"></add-project>
        <editProject ref="editProject"></editProject>


    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="40%"
    >
      <span>您提交的文档不是系统标准导入模板，请检查您的文档或重新 </span>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>


     <el-dialog
      title="提示"
      :visible.sync="exportLogVisible"
      width="40%"
    >

      <div v-for="(item,index) in logs" :key="index">
        <span> {{ item.export_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
        <br/>
        <br/>
        <span>{{getContent(item)}}</span>
        <span >点击</span>
        <span style="color:blue" @click="generateTxt(item)">查看详情</span>
        <br/>
        <br/>
      </div>

      <span slot="footer" class="dialog-footer">
    <el-button @click="exportLogVisible = false">取 消</el-button>
    <el-button type="primary" @click="exportLogVisible = false">确 定</el-button>
    </span>
    </el-dialog>
    </div>
</template>

<script>
import addProject from './addProject'
import editProject from './editProject'
import { getProjectList,deleteHisProject,getDePartmentList,postProjectInformation } from "@/api/project/project"
import { getDictionaryDataConfig } from "@/utils/data";
import axios from 'axios'
import ProjectExcel from '@/xt_pages/components/ProjectExcel'
import { generateLog } from '@/api/config'
export default {
    components:{
        addProject,
        editProject,
        ProjectExcel
    },
    data(){
        return{
            search_input:'',
            options: [
             {value:0,label:'全部'},
             {value:1,label: '停用'},
             {value:2,label: '收费'}
            ],
            optionOne:[
              {value:0,label:'全部'},
              {value:1,label:'是'},
              {value:2,label:'否'}
            ],
            value: '',
            limit:10,
            page:1,
            total:0,
            tableData: [],
            is_start:0,
            is_charge:'',
            selectDrug:[],
            optionOne: [
            {
              value: '0',
              label: '全部'
            }, {
              value: '1',
              label: '已备案'
            }, {
              value: '2',
              label: '未备案'
          }],
          is_mark:"",
          page:1,
          departMentList:[],
           dialogVisible:false,
           exportLogVisible:false,
           logs:[]

        }
    },
    methods:{
      putOnUnRecord(id){
        var that = this;
        let params = {
          ids:id.toString(),
          record_type: 3,
          admin_user_id:this.$store.getters.xt_user.user.id
        };
        axios.get('http://127.0.0.1:9532/api/uncheckcode/get',{params:params}).then(function(response) {
          if (response.data.state == 0) {
            that.$message.error(response.data.data.msg);
            return false
          } else {
            if(response.data.data.failed_code == -10){
              // that.$message.error(response.data.data.msg)
              that.$confirm(response.data.data.msg, '医保错误信息', {
                confirmButtonText: '确 定',
                type: 'warning'
              }).then(() => {

              }).catch(() => {
              })
            }else{
              // for (let i = 0; i < that.tableData.length; i++) {
              //   if (that.tableData[i].id == that.currentObject.id) {
              //     that.tableData[i].record.is_cancel == 1
              //   }
              // }
            }

          }
        }).catch(function(error) {
        })
      },
      putOnRecord(id){
        var that = this;

        let params = {
          ids:id.toString(),
          record_type: 3,
          admin_user_id:this.$store.getters.xt_user.user.id
        };

        axios.get('http://127.0.0.1:9532/api/checkcode/get',{params:params}).then(function(response) {
          if (response.data.state == 0) {
            that.$message.error(response.data.data.msg);
            return false
          } else {
            if(response.data.data.failed_code == -10){
              // that.$message.error(response.data.data.msg)
              that.$confirm(response.data.data.msg, '医保错误信息', {
                confirmButtonText: '确 定',
                type: 'warning'
              }).then(() => {

              }).catch(() => {
              })
            }else{


            }



          }
        }).catch(function(error) {
        })
      },
      GDYBBatchPutOnRecord(){
        var that = this;
        var ids = [];
        var idMap = {};
        for (const index in this.selectDrug) {
          ids.push(this.selectDrug[index].id);
          idMap[this.selectDrug[index].id] = this.selectDrug[index].id;
        }
        let params = {
          ids:ids.join(','),
          record_type: 3,
          admin_user_id:this.$store.getters.xt_user.user.id
        };
        axios.get('http://127.0.0.1:9532/api/checkcode/get',{params:params}).then(function(response) {
          if (response.data.state == 0) {
            that.$message.error(response.data.data.msg);
            return false
          } else {
            if(response.data.data.failed_code == -10){
              // that.$message.error(response.data.data.msg)
              that.$confirm(response.data.data.msg, '医保错误信息', {
                confirmButtonText: '确 定',
                type: 'warning'
              }).then(() => {

              }).catch(() => {
              })
            }else{


            }
          }
        }).catch(function(error) {
        })
      },

      changeStart(){
         this.getlist()
        },
        handleSizeChange(val) {
            this.limit = val;
            this.getlist()
        },
        handleCurrentChange(val) {
            this.page = val;
            this.getlist()
        },
        searchAction(){
           this.getlist()
        },
        clickSelfPayment(){
            this.$refs.selfPayment.show();
        },
        clickMainTain(){
        },
        openForm(id){
           this.$refs.addProject.show(id);
        },
        editHisProject(id){
           this.$refs.editProject.show(id)
        },
        getCostClassify(id){
          var costClassify = getDictionaryDataConfig('system','cost_classify');
          var name = "";
          for(let i=0;i<costClassify.length;i++){
             if(id == costClassify[i].id){
               name = costClassify[i].name
             }
          }
          return name
        },
        getExecutiveSection(id){
          var executiveSection =  this.departMentList;
          var name = "";
          for(let i=0;i<executiveSection.length;i++){
            if(id == executiveSection[i].id){
               name = executiveSection[i].name
            }
          }
          return name
        },

        getlist(){
            var params = {
               keyword:this.search_input,
               is_charge:this.is_charge,
               is_start:this.is_start,
               limit:this.limit,
               page:this.page,
               is_mark:this.is_mark,
            };

          getProjectList(params).then(response=>{
             if(response.data.state == 1){
               var projecList = response.data.data.projecList;

               this.tableData = projecList;
               var total = response.data.data.total;

               this.total = total
             }
          })
        },
        deleteProject(id,index){
            this.$confirm("确认删除此项目吗?", "删除", {
            confirmButtonText: "确 定",
            cancelButtonText: "取 消",
            type: "warning"
           }).then(() => {
            deleteHisProject(id).then(response => {
               if (response.data.state == 1) {
                 var msg = response.data.data.msg;
                 this.$message.success("删除成功");
                this.tableData.splice(index, 1);
                }
             });
            })
            .catch(() => {});
        },
        changeOption(){
          this.getlist()
        },

        toRecord(){
         var that = this;
         axios.get('http://127.0.0.1:9532/sz/api/treatment/get').then(function(response) {
          if (response.data.state == 0) {
               that.$message.error(response.data.msg);
               return false
            } else {
              that.$message({ message: '备案成功', type: 'success' });
              that.getlist()
             }
           }).catch(function(error) {
        })
      },

     toReturn(id,isMark){

         var that = this;
         let params = {
             'id':id,
             'type_id':2,
             'is_mark':isMark,
             'admin_user_id':this.$store.getters.xt_user.user.id,
          };


         axios.get('http://127.0.0.1:9532/sz/api/revocation/get',{params:params}).then(function(response) {
          if (response.data.state == 0) {
               that.$message.error(response.data.data.msg);
               return false
            } else {
              if(response.data.data.msg == ""){
                  that.$message.success("备案成功!");
                  that.getlist()
               }
               if(response.data.data.msg!=""){
                  that.$message.error(response.data.data.msg);
                  that.getlist()
               }
             }
           }).catch(function(error) {
        })
      },
      handleSelectionChange(val) {
        this.selectDrug = val;
      },
    changeRecord(){
      this.getlist()
    },

    BatchDelete() {
      if (this.selectDrug.length == 0) {
        this.$message.error("请选择要备案的信息");
        return false;
      }
      this.$confirm(
        "确认要备案所选记录吗? <br>",
        "备案提示",
        {
          dangerouslyUseHTMLString: true,
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      ).then(() => {
        var ids = [];
        var idMap = {};
        for (const index in this.selectDrug) {
          ids.push(this.selectDrug[index].id);
          idMap[this.selectDrug[index].id] = this.selectDrug[index].id;
        }

        var idss = ids.join(',');
        let params = {
          ids:idss,
          admin_user_id:this.$store.getters.xt_user.user.id
        };

        var that = this;
        axios.get('http://127.0.0.1:9532/sz/api/treatment/get',{ params: params }).then(function(response) {
         if (response.data.state == 0) {
               that.$message.error(response.data.data.msg);
               return false
            } else {
              if(response.data.data.msg == ""){
                  that.$message.success("备案成功!");
                  that.getlist()
               }
               if(response.data.data.msg!=""){
                  that.$message.error(response.data.data.msg);
                  that.getlist()
               }
             }
           }).catch(function(error) {
        })
       });
     },

     getDartmentList(){
        var params = {
            limit:this.limit,
            page:this.page,
        };
        getDePartmentList(params).then(response=>{
            if(response.data.state == 1){
            var department =   response.data.data.departMentList;

            this.departMentList = department
            }
        })
     },
      handleSuccessOne({ results, header }) {

        if (header != undefined && header.length > 0) {

          var isHasProjectName = header.includes('*项目名称');

          var isHasProjectPrice = header.includes('*零价');

          var isHasProjectUnit = header.includes('*单位');

          var isHasProjectCostClassify = header.includes('*费用类别');

          var isHasProjectExecutiveSection = header.includes('*执行科室');

          var isHasProjectMedicalCoverage = header.includes('*医保等级');

          if (!(isHasProjectName && isHasProjectPrice && isHasProjectUnit && isHasProjectCostClassify && isHasProjectExecutiveSection && isHasProjectMedicalCoverage )) {
            this.dialogVisible = true;
            return
          }
        }else {
          this.dialogVisible = true;
          return
        }

       var tableData = [];
       for(let i=1;i<results.length;i++){
         let obj = {"cost_classify_id":0,"medical_insurance_level_id":0,"executive_section_id":0,"tube_color_id":0,"statistical_classification_id":0,"category":0,"specail_project":0,"medical_status":0};
         for (var key in results[i]) {
           if (results[i]['*项目名称'] === undefined) {
                obj['project_name'] = ''
              } else {
           if (key == '*项目名称') {
               obj['project_name'] = results[i][key].replace(/\s/g,"")
              }
           }

          if (results[i]['*零价'] === undefined) {
                obj['price'] = ''
              } else {
           if (key == '*零价') {
               obj['price'] = results[i][key].replace(/\s/g,"")
              }
           }

         if (results[i]['*单位'] === undefined) {
                obj['unit'] = ''
              } else {
         if (key == '*单位') {
               obj['unit'] = results[i][key].replace(/\s/g,"")
              }
          }

         if (results[i]['*费用类别'] === undefined) {
                obj['cost_classify'] = ''
              } else {
         if (key == '*费用类别') {
               obj['cost_classify'] = results[i][key].replace(/\s/g,"")
              }
          }

        if (results[i]['*执行科室'] === undefined) {
                obj['executive_section'] = ''
              } else {
         if (key == '*执行科室') {
               obj['executive_section'] = results[i][key].replace(/\s/g,"")
              }
          }

         if (results[i]['*医保等级'] === undefined) {
                obj['medical_coverage'] = ''
              } else {
         if (key == '*医保等级') {
               obj['medical_coverage'] = results[i][key].replace(/\s/g,"")
              }
          }

        if (results[i]['拼音'] === undefined) {
                obj['pinyin'] = ''
              } else {
         if (key == '拼音') {
               obj['pinyin'] = results[i][key].replace(/\s/g,"")
              }
          }

        if (results[i]['五笔'] === undefined) {
                obj['wubi'] = ''
              } else {
         if (key == '五笔') {
               obj['wubi'] = results[i][key].replace(/\s/g,"")
              }
          }

         if (results[i]['统计分类'] === undefined) {
                obj['statistical_classification'] = ''
              } else {
         if (key == '统计分类') {
               obj['statistical_classification'] = results[i][key].replace(/\s/g,"")
              }
          }

         if (results[i]['是否特病目录'] === undefined) {
                obj['disease_directory'] = ''
              } else {
         if (key == '是否特病目录') {
               obj['disease_directory'] = results[i][key].replace(/\s/g,"")
              }
          }
         if (results[i]['是否备案'] === undefined) {
                obj['is_record'] = ''
              } else {
         if (key == '是否备案') {
               obj['is_record'] = results[i][key].replace(/\s/g,"")
              }
          }

         if (results[i]['医保编码'] === undefined) {
                obj['medical_code'] = ''
              } else {
         if (key == '医保编码') {
               obj['medical_code'] = results[i][key].replace(/\s/g,"")
              }
          }

         if (results[i]['试管颜色'] === undefined) {
                obj['tube_color'] = ''
              } else {
         if (key == '试管颜色') {
               obj['tube_color'] = results[i][key].replace(/\s/g,"")
              }
          }

          if (results[i]['单次用量'] === undefined) {
                obj['single_dose'] = ''
              } else {
         if (key == '单次用量') {
               obj['single_dose'] = results[i][key].replace(/\s/g,"")
              }
          }

           if (results[i]['用法'] === undefined) {
                obj['delivery_way'] = ''
              } else {
          if (key == '用法') {
               obj['delivery_way'] = results[i][key].replace(/\s/g,"")
              }
          }

          if (results[i]['频率'] === undefined) {
                obj['execution_frequency'] = ''
              } else {
          if (key == '频率') {
               obj['execution_frequency'] = results[i][key].replace(/\s/g,"")
              }
          }


          if (results[i]['天数'] === undefined) {
                obj['number_days'] = ''
              } else {
          if (key == '天数') {
               obj['number_days'] = results[i][key].replace(/\s/g,"")
              }
          }


         if (results[i]['总量'] === undefined) {
                obj['total'] = ''
              } else {
          if (key == '总量') {
               obj['total'] = results[i][key].replace(/\s/g,"")
              }
          }

          if (results[i]['状态'] === undefined) {
                obj['medical_status'] = ''
              } else {
          if (key == '状态') {
               obj['medical_status'] = results[i][key].replace(/\s/g,"")
              }
          }

          if (results[i]['类别'] === undefined) {
                obj['category'] = ''
              } else {
          if (key == '类别') {
               obj['category'] = results[i][key].replace(/\s/g,"")
              }
          }

            if (results[i]['特检项目'] === undefined) {
                obj['specail_project'] = ''
              } else {
          if (key == '特检项目') {
               obj['specail_project'] = results[i][key].replace(/\s/g,"")
              }
          }

           if (results[i]['社保目录编码'] === undefined) {
                obj['social_security_directory_code'] = ''
              } else {
           if (key == '社保目录编码') {
               obj['social_security_directory_code'] = results[i][key].replace(/\s/g,"")
              }
          }

           if (results[i]['备案日期'] === undefined) {
                obj['record_date'] = ''
              } else {
           if (key == '备案日期') {
               obj['record_date'] = results[i][key].replace(/\s/g,"")
              }
          }
           if (results[i]['备注'] === undefined) {
                obj['remark'] = ''
              } else {
           if (key == '备注') {
               obj['remark'] = results[i][key].replace(/\s/g,"")
              }
          }
         }
         tableData.push(obj);


        for(let i=0;i<tableData.length;i++){

          if(tableData[i].disease_directory == ""){
              tableData[i].disease_directory = 0
          }
          if(tableData[i].disease_directory == "是"){
             tableData[i].disease_directory = 1
          }

         if(tableData[i].disease_directory == "否"){
             tableData[i].disease_directory = 2
          }

          if(tableData[i].is_record == ""){
             tableData[i].is_record = 0
          }
           if(tableData[i].is_record == "是"){
             tableData[i].is_record = 1
          }

          if(tableData[i].is_record == "否"){
             tableData[i].is_record = 2
          }



          if(tableData[i].category == ""){
             tableData[i].category = 0
          }
          if(tableData[i].category == "常规诊疗项目"){
             tableData[i].category = 1
          }

           if(tableData[i].category == "辅助器具项目"){
             tableData[i].category = 2
          }

          if(tableData[i].category == "加收项目"){
             tableData[i].category = 3
          }

          if(tableData[i].specail_project == ""){
            tableData[i].specail_project = 0
          }
          if(tableData[i].specail_project == "是"){
             tableData[i].specail_project = 1
          }
          if(tableData[i].specail_project == "否"){
             tableData[i].specail_project = 2
          }
          if(tableData[i].medical_status == ""){
             tableData[i].medical_status = 0
          }

          if(tableData[i].medical_status == "停用"){
            tableData[i].medical_status = 1
          }
          if(tableData[i].medical_status == "收费"){
            tableData[i].medical_status = 2
          }
        }
       }
       let params = {
          'projects':tableData
        };
       console.log("params222",params);

        postProjectInformation(params).then(response=>{
           if(response.data.state == 1){
             var msg =  response.data.data.msg;
             this.$message.success("导入成功!");
             this.getlist()
           }else{
             this.$message.error("导入失败")
           }
        })
      },
      generateTxt: function(log) {
        var content = '';
        var errlog = log.err_logs;
        content = this.getContent(log);
        for (let i = 0; i < errlog.length; i++) {
          if (content.length == 0) {
            content = errlog[i].err_msg
          } else {
            content = content + '\n' + errlog[i].err_msg
          }
        }

        var url = new Blob(['\ufeff' + content], { type: 'text/txt,charset=UTF-8' });
        if (typeof url === 'object' && url instanceof Blob) {
          url = URL.createObjectURL(url) // 创建blob地址
        }
        const aLink = document.createElement('a');
        aLink.href = url;
        aLink.download = this.timestampToTime(log.export_time) + '患者导入日志' + '.txt';
        aLink.click()

      },
      getContent(log) {

        return '您导入的文档共' + log.total_num + '条患者数据' + '，' + '已成功导入' + log.success_num + '条，导入失败' + log.fail_num + '条,'
      },
      timestampToTime(timestamp) {
        var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
        var Y = date.getFullYear() + '年';
        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
        var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 ';
        var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时';
        var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分';
        var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒';
        return Y + M + D + h + m + s
      },
       generateLog() {
        let params = {
          'log_type': 6
        };
        generateLog(params).then(
          response => {
            if (response.data.state === 1) {
              this.logs = response.data.data.logs;
              this.exportLogVisible = true
            } else {
              this.$message.error(response.data.msg)
            }
          }
        )
      },
      getDictionaryDataConfig(module, filed_name) {
          return getDictionaryDataConfig(module, filed_name)
      },
    },
    created(){
      this.getlist();
      this.getDartmentList()

    }
}
</script>
