<template>
  <div class="delegate" ref="viewDelegate" :id="'delegate_' + openParams.actionContent">
    <!-- openType锛� 288(缃戞牸鏄剧ず) -->
    <div class="act-btns view-act-btns" v-if="showtype != 'home' &&
      view.openType != 288 &&
      view.simpleClassName != 'CalendarView' &&
      view.simpleClassName != 'GanttView' &&
      view.simpleClassName != 'TreeView' &&
      view.simpleClassName != 'MapView' &&
      isFormPrint != 5
      ">
      <!-- {{!isView}}--{{showtype}}--{{isShowActivity}} -->
      <!-- {{view.activities}} -->
      <div class="usual-btns" v-if="!isView && showtype != 'home' && isShowActivity">
        <!-- 鏂板锛屽垹闄ょ瓑鎸夐挳 -->
        <activity v-for="activity in view.activities" :key="activity.id" :info="activity" :isBlockClick="isBlockClick"
          @action="onAction" />
      </div>
      <div v-if="isView" class="clear-btn-box">
        <span class="searchBtn danger" @click="clearViewSelect">
          <!-- {{ $t("btns.cancel") }} -->
          娓呴櫎宸查€�
        </span>
        <!-- 鍗曢€夛紝澶氶€� -->
        <template v-if="selectOne || mutil">
          <!-- <el-button @click="viewDialogClean" size="medium" v-if="showCleanBtn">{{ $t("btns.clean") }}</el-button> -->
          <el-button type="primary" @click="viewDialogSure" size="medium">
            <!-- {{ $t("btns.sure")}} -->
            纭
          </el-button>
        </template>
        <span class="searchBtn danger" style="margin: 0 10px" @click="returnPrevious" v-if="cardBack">
          {{ $t("form.back") }}
        </span>
      </div>
      <span></span>
      <div class="search-btns-box view-search-btns-box">
        <div class="search-btns" v-if="view.searchFormId != undefined">
          <div class="left" v-show="!isShowSearchTemplate &&
            view.commonFilterCondition &&
            view.commonFilterCondition != '[]'
            ">
            <form_customize_searchform :appId="openParams.appId" :viewId="openParams.actionContent"
              :commonFilterCondition="view.commonFilterCondition" :openParams="openParams" @onSearch="onSearch"
              ref="searchform" />
          </div>
          <div class="right">
            <span class="advanced-btn" v-show="!isShowSearchTemplate" @click="openSearchTemplate">
              <span v-if="view.commonFilterCondition &&
                view.commonFilterCondition != '[]'
                ">
                楂樼骇鏌ヨ
              </span>
              <span v-else>
                <i class="el-icon-search"></i>
              </span>
            </span>
            <span class="advanced-btn" v-show="isShowSearchTemplate" @click="openSearchTemplate" style="width: 60px">
              <span v-if="view.commonFilterCondition &&
                view.commonFilterCondition != '[]'
                ">
                鏀惰捣
              </span>
              <span v-else>
                <i class="el-icon-search"></i>
              </span>
            </span>
            <span v-if="(mutil || selectOne) &&
              !(this.view.simpleClassName == 'TreeView')
              ">
              <span span class="select">{{ $t("choosed") }}锛�</span>
              <span class="select-num" @click="showCheckedList">{{
                checkedNum
              }}</span>
            </span>
          </div>
        </div>
      </div>
    </div>

    <!--isFormPrint涓�5鐨勬椂鍊欐槸鎵撳嵃-->
    <!--columns锛� view_listView 浼犻€掔殑table鏄剧ず鍒楃殑鏁版嵁 getTableTotalCount: 鑾峰彇table鐨勬€绘潯鏁� -->
    <component ref="delegate" :is="viewType" :view="view" :openParams="openParams" :clearCheckboxVal="clearCheckboxVal"
      :mutil="mutil" :selectOne="selectOne" :showtype="showtype" :isView="isView" :allowOpenDoc="allowOpenDoc"
      :delegateWidth="delegateWidth" :includeDisplayType="includeDisplayType" :toTab="toTab" :currentTab="currentTab"
      :isFormPrint="isFormPrint" :isMultiLevelListHeader="isMultiLevelListHeader"
      :multiLevelColumnData="multiLevelColumnData" v-bind="$attrs" v-on="$listeners" v-if="isRouterAliveInclude"
      @updateView="updateView" @action="closeDialog" @deleted="doRemove" @getDocIds="setDocIds" @selectNum="selectNum"
      @gridviewTem="gridviewTem" v-loading="loading" @columns="getViewTableColumns" @cardBackSign="cardBackSign">
    </component>
    
    <!--鏂板缓浠ュ脊鍑哄眰鏂瑰紡-->
    <el-dialog :class="[
      dialogView.height ? 'configuration-common-dialog' : 'common-dialog',
    ]" :title="dialogTitle" v-if="dialogVisible" :append-to-body="true" :visible.sync="dialogVisible" top="10px"
      :lock-scroll="true" :close-on-click-modal="false" :width="dialogView.width ? dialogView.width + 'px' : '90%'"
      :height="dialogView.height ? dialogView.height + 'px' : ''" :before-close="handleClose">
      <div class="dialog-normalform" :id="'dialog_normalform_' + openParams.actionContent" :style="{
        height: dialogView.height ? dialogView.height - 83 + 'px' : '',
      }">
        <el-scrollbar class="scrollbar">
          <form_normalform :emptyParams="emptyParams" :openParams="newIncludeO" @action="closeDialog" />
        </el-scrollbar>
      </div>
    </el-dialog>

    <el-dialog :title="$t('message')" :visible.sync="popupVisible" :close-on-click-modal="false" :append-to-body="true">
      <div class="bulk-submission">
        <div class="text">
          {{ $t("enter_auditing") }}<br />{{ $t("suggest") }}:
        </div>
        <div class="textarea">
          <el-input type="textarea" rows="8" :placeholder="$t('placeholder.content')" v-model="attitude">
          </el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="popupVisible = false" size="small">{{
          $t("btns.cancel")
        }}</el-button>
        <el-button type="primary" @click="onOk" size="small">{{
          $t("btns.sure")
        }}</el-button>
      </span>
    </el-dialog>

    <customDialog :title="title" :width="width" v-if="customizeVisible" :visible.sync="customizeVisible"
      :lock-scroll="true" :appendToBody="true">
      <excelUpload slot="body" :viewId="view.id" :act="act" :view="view" :openParams="openParams"
        @event="hiddenCustomizeVisible" />
    </customDialog>

    <!--璺宠浆鎸夐挳_寮圭獥鎵撳紑-->
    <div class="common-dialog-box">
      <el-dialog :close-on-click-modal="false" ref="elDialog" class="common-dialog" v-if="jumpPopup"
        :append-to-body="true" :visible.sync="jumpPopup" top="10px" :lock-scroll="true"
        :width="jumpParams.styleParams ? jumpParams.styleParams.dialogWidth : jumpParams.dialogWidth ? jumpParams.dialogWidth : '70%'"
        :before-close="handleClose" center>  
        <!-- {{dialogView}}
      {{jumpParams.styleParams}} -->
        <!-- {{isJumpForm}} {{isJumpView}} {{isExternalLink}}   -->
        <!--琛ㄥ崟-->
        <div v-if="isJumpForm" class="dialog-normalform" :id="'dialog_normalform_' + openParams.actionContent">
          <!--v-if="isJumpForm" :style="{height: jumpParams.styleParams ? jumpParams.styleParams.dialogHeight : screenHeight + 'px'}"  鐖剁骇闄愬埗楂樺害 鏆傛椂鍒犻櫎 -->
          <!-- <el-scrollbar class="scrollbar" style="height: 100;"> -->
          <div style="height: 100%;">
            <form_normalform :openParams="jumpParams" @action="closeDialog" />
          </div>
          <!-- </el-scrollbar> -->
        </div>
        <!--瑙嗗浘555-->
        <div v-else-if="isJumpView" class="dialog-listview"
          :style="{ height: jumpParams.styleParams ? jumpParams.styleParams.dialogHeight : screenHeight + 'px' }">
          <el-scrollbar class="scrollbar" v-if="popupLayerType == 'VIEW'">
            <div>
              <view_delegate :openParams="jumpParams" @popupOpenType="setPopupOpenType">
              </view_delegate>
            </div>
          </el-scrollbar>
          <el-scrollbar class="scrollbar scrollbar-form" v-else>
            <form_normalform :openParams="jumpParamsForm" @popupOpenType="setPopupOpenType" />
          </el-scrollbar>
        </div>

        <!--澶栭儴閾炬帴-->
        <!-- style="height:calc(100% - 40px);" -->
        <div v-else-if="isExternalLink" class="el-dialog-div"
          :style="{ height: jumpParams.styleParams ? jumpParams.styleParams.dialogHeight : screenHeight + 'px' }">
          <el-scrollbar class="scrollbar" v-if="popupLayerType == 'VIEW'">
            <div class="common-linkcontent-wrap">
              <common_linkcontent :openParams="jumpParams">
              </common_linkcontent>
            </div>
          </el-scrollbar>
          <el-scrollbar class="scrollbar" v-else>
            <div class="common-linkcontent-wrap">
              <common_linkcontent :openParams="jumpParams">
              </common_linkcontent>
            </div>
          </el-scrollbar>
        </div>
      </el-dialog>
    </div>

    <!--瀵煎嚭EXCel琛ㄦ牸寮圭獥-->
    <el-dialog :close-on-click-modal="false" title="Excel瀵煎嚭" v-if="exportDialog" :append-to-body="true"
      :visible.sync="exportDialog" :lock-scroll="true" top="100px" width="50%">
      <div style="
          display: flex;
          flex-flow: row nowrap;
          justify-content: space-between;
        ">
        <el-radio-group v-model="exportData">
          <el-radio :label="1">{{ $t("choosed_data") }}</el-radio>
          <el-radio :label="2">{{ $t("all_data") }}</el-radio>
        </el-radio-group>
        <el-switch v-model="switchValue" active-color="#66b1ff" inactive-color="#CCCCCC" :active-text="$t('check_all')"
          @change="dataAll(switchValue)">
        </el-switch>
      </div>
      <div>
        <el-checkbox-group v-model="excelSelectList" @change="isShowSwitch(excelSelectList)">
          <el-checkbox v-for="(column, index) in excelColumns" :key="index" :value="column.name" :label="column.name">
            {{ column.name.indexOf("_") > -1 ? column.name.split("_")[0] : column.name }}</el-checkbox>
        </el-checkbox-group>
      </div>
      <br />
      <div>
        <el-progress v-show="isShowProgress" :percentage="exportProgress" :stroke-width="8"></el-progress>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirmExportFile(currentClickBtnAct)">{{ $t("btns.sure") }}</el-button>
      </span>
    </el-dialog>

    <!-- 鏄剧ず宸查€夋嫨瑙嗗浘鍒楄〃鏁版嵁鐨勫脊绐� -->
    <el-dialog :close-on-click-modal="false" :title="$t('seedata')" :visible.sync="checkedListDialog" width="50%"
      append-to-body>
      <!-- showCheckBox锛� 鏄惁鏄剧ず澶嶉€夋   showPagination锛� 鏄惁鏄剧ず鍒嗛〉  mainData锛氶渶瑕佹樉绀虹殑鏁版嵁;  宸查€�:鏁伴噺锛岀偣鍑绘墦寮€寮圭獥-->
      <view_table :showCheckBox="false" :showPagination="false" :mainData="viewTableData" />
    </el-dialog>

    <!-- 鎵归噺寮圭獥 -->
    <el-dialog :close-on-click-modal="false" :title="$t('view.batch_ss')" class="common-dialog-signature"
      v-if="signatureDialog" :append-to-body="true" :visible.sync="signatureDialog" top="10px" :lock-scroll="true"
      width="50%" :close="signatureDialog == false">
      <div v-if="signatureDialog" style="height: 300px" class="signature-wrap">
        <el-button type="primary" v-for="item in signatureData.acts" :key="item.id">
          <span v-if="item.signatureAction == 'sign'">
            {{ $t("view.sign") }}
          </span>
          <span v-if="item.signatureAction == 'opinion'">
            {{ $t("suggest") }}
          </span>
          <span v-if="item.signatureAction == 'signature'">
            {{ $t("view.seal") }}
          </span>
        </el-button>
        <el-select v-model="signatureValue" style="margin-left: 10px">
          <el-option v-for="item in signatureData.acts" :key="item.id" :label="item.name" :value="item.value">
          </el-option>
        </el-select>
      </div>
    </el-dialog>

    <div v-show="isPrint">
      <div v-if="printParams">
        <div id="print">
          <div class="view-print">
            <view_listview :openParams="openParams" v-if="viewPrintData" :view="viewPrintData" />
          </div>
        </div>
      </div>
    </div>
    <div class="picture-preview-wrap" v-if="imageParams.hiddenDialog" @click="imageParams.hiddenDialog = false">
      <div class="picture-list">
        <el-carousel :autoplay="false" :initial-index="imageParams.initialIndex" arrow="always">
          <el-carousel-item v-for="item in imageParams.pathLists" :key="item">
            <img :src="item" style="height: 100%" @click.stop />
          </el-carousel-item>
        </el-carousel>
      </div>
      <div class="icon-dlose" @click="imageParams.hiddenDialog = false">
        <i class="el-icon-close"></i>
      </div>
    </div>
  </div>
</template>

<script>
import API from "@/api.js";
import Constant from "@/Constant.js";
import view_emptyview from "@/components/view_emptyview.vue";
import view_listview from "@/components/view_listview.vue";
import view_gridview from "@/components/view_gridview.vue";
import view_mapview from "@/components/view_mapview.vue";
import view_treeview from "@/components/view_treeview.vue";
import view_collapsibleview from "@/components/view_collapsibleview.vue";
import view_cardview from "@/components/view_cardview.vue";

import view_calendarview from "@/components/view_calendarview.vue";
import activity from "@/components/activity.vue";
import form_normalform from "@/components/form_normalform.vue";
import customDialog from "@/components/dialog.vue";
import excelUpload from "@/components/excel_upload.vue";
// import Watermark from '@/assets/js/watermark';  //璺緞涓嶈鍐欓敊
import view_print from "@/components/view_print";
import form_customize_searchform from "@/components/form_customize_searchform.vue";
import common_linkcontent from "@/components/common_linkcontent";
import view_gantt from "@/components/view_gantt";
import view_table from "@/expandedComponents/view_table.vue"; // 鍏敤鐨則able缁勪欢

export default {
  name: "view-delegate",
  props: [
    "openParams",
    "clearCheckboxVal",
    "mutil", //鍒ゆ柇瑙嗗浘閫夋嫨妗嗗閫夋垨鑰呮嫾鎺�
    "selectOne", //鍒ゆ柇瑙嗗浘閫夋嫨妗嗗閫夋垨鑰呮嫾鎺�
    "isView",
    "showtype",
    "allowOpenDoc",
    "toTab",
    "openType",
    "includeDisplayType", //鍖呭惈鍏冪礌鎴栬€呴€夐」鍗′负鍙鏃剁殑displayType=1,=4
    "isFormPrint", //琛ㄥ崟鎵撳嵃鏃剁瓑浜�5
    "currentTab",
    "widgetChartView", //widget鐐瑰嚮缁熻鍥炬椂锛屼紶鍒拌繖閲岀殑鏁版嵁
    "showCleanBtn",
  ],
  inject: ["addTab", "openNewpage"],

  watch: {
    listenIncludeViewUpdate(newVal) {
      //濡傛灉鏄寘鍚厓绱犳墦寮€鏍囩椤碉紝杩斿洖鎴栬€呭叧闂〉绛炬椂鍒锋柊瑙嗗浘
      if (newVal == this.includeRefreshId) {
        this.$refs.delegate.getData();
      }
    },

    isShowSearchTemplate() {
      this.$refs.delegate.handleOpenSearchTemplate();
    },
    exportDialog(newVal) {
      if (!newVal) {
        this.isShowProgress = false;
        this.exportProgress = 0;
      }
    },
  },

  created: function () {
    if (this.widgetChartView) {
      //棣栭〉widget缁熻鍥炬暟鎹�
      this.delegateWidth = 0;
      this.view = this.widgetChartView;
      this.loading = false;
    } else {
      this.init();
    }
  },
  mounted: function () {
    window.handleClose = this.handleClose; //璋冩暣鎸夐挳浠frame宓屽鎵撳紑锛屽湪iframe椤甸潰璋冪敤姝ゆ柟娉曞叧闂脊绐�
  },

  beforeDestroy() {
    window.clearInterval(this.task);
  },

  components: {
    view_emptyview,
    view_listview,
    view_gridview,
    view_treeview,
    view_mapview,
    view_collapsibleview,
    view_cardview,
    view_calendarview,
    activity,
    form_normalform,
    customDialog,
    excelUpload,
    view_print,
    form_customize_searchform,
    common_linkcontent,
    view_gantt,
    view_table,
  },

  data: function () {
    return {
      isBlockClick: false,
      // screenHeight: document.documentElement.clientHeight - 180,//楂樺害淇敼bcx
      screenHeight: "", //涓嶈璁剧疆楂樺害
      isShowActivity: true, //瑙嗗浘鎿嶄綔鎸夐挳涓�0鏃讹紝涓嶆樉绀烘搷浣滄寜閽
      exportProgress: 0, //瀵煎嚭杩涘害鏉¤繘搴�
      isShowProgress: false, //瀵煎嚭杩涘害鏉℃槸鍚︽樉绀�
      switchValue: true, //鍏ㄩ€�
      view: { columns: [] }, //瑙嗗浘鐨勫垪
      loading: true,
      title: "",
      dialogTitle: "鏂板缓",
      newIncludeO: "",
      dialogVisible: false,
      isRouterAliveInclude: true,
      currentOpenType: "",
      currentDocIds: [],
      popupVisible: false,
      attitude: "",
      currentAct: "",
      customizeVisible: false,
      width: "40%",
      excelPath: "",
      act: "",
      isPrint: false,
      printParams: "",
      viewPrintData: "",
      delegateWidth: "",
      isSubmissionProcess: "", //鏄惁鏄鍥惧垪鐨勬彁浜ゆ祦绋�
      viewRowId: "", //瑙嗗浘鍒楃殑鎻愪氦娴佺▼docId
      emptyParams: "",
      isShowSearchTemplate: false,
      jumpParams: "", //璺宠浆鎸夐挳鍙傛暟
      jumpPopup: false, //璺宠浆鎸夐挳寮瑰嚭绐�
      isJumpForm: "", //璺宠浆鎸夐挳鍙傛暟
      isJumpView: "", //璺宠浆鎸夐挳鍙傛暟
      isExternalLink: "", //鍒ゆ柇鏄惁鏄閮ㄩ摼鎺�
      checkedNum: 0, //鑾峰彇瑙嗗浘閫夋嫨妗嗛€変腑鐨勬暟鍊�
      jumpParamsForm: "", //寮瑰嚭灞傛墦寮€鐨勮鍥捐繘鍏ヨ〃鍗曠殑鍙傛暟
      viewTableData: {
        // table鐨勬暟鎹�
        tableHeight: 370,
        datas: [], // 琚€変腑鐨勬暟鎹�
        columns: [], // 鏄剧ず鐨勫垪
      },
      checkedListDialog: false, // 瑙嗗浘閫夋嫨妗嗛€変腑鐨勫垪琛�
      excelColumns: [], //瀵煎嚭鏁版嵁搴旇鏄剧ず鐨勫垪
      exportDialog: false, //鏂囦欢瀵煎嚭鐨勫脊绐�
      exportData: 1, //2涓哄鍑哄叏閮ㄦ暟鎹紝1涓哄鍑洪€変腑鏁版嵁
      currentClickBtnAct: "", //褰撳墠鐐瑰嚮鎸夐挳鐨刟ct鏁版嵁
      popupLayerType: "", //鍒ゆ柇寮瑰嚭灞傛槸鎵撳紑琛ㄥ崟杩樻槸瑙嗗浘
      excelSelectList: [],
      searchDocItems: "", //鏌ヨ琛ㄥ崟鐨勬暟鎹�
      imageParams: {
        hiddenDialog: false,
        pathLists: [],
        initialIndex: 0,
      },
      dialogView: {
        //瑙嗗浘寮瑰嚭灞傛墦寮€璁剧疆浜嗗楂�
        width: "",
        height: "",
      },
      cvFormData: {}, //澶嶅埗runBeforeAction鐨勫弬鏁癴ormdata锛屼繚瀛樺湪cvFormData閲岀敤浜庣粰getAxecuteAddress浼犲弬
      signatureDialog: false,
      signatureData: [],
      signatureValue: "",
      task: "", //瀵煎嚭鏃剁殑瀹氭椂鍣�
      isExporting: false, //姝e湪瀵煎嚭
      isMultiLevelListHeader: false,
      multiLevelColumnData: [], //澶氱骇鍒楀垪琛ㄥご
      copyColumns: [], //娣辨嫹璐濊鍥惧垪缁檈xcell瀵煎嚭浣跨敤
      isDialogOpenExternalLink: false,
      refreshId: "",
      cardBack: "",
    };
  },

  methods: {
    viewDialogClean() {
      this.$parent.$parent.$parent.clearCheckbox(); //瑙嗗浘閫夋嫨妗嗙殑clearCheckbox()//view_listview.vue-->toggleSelection()娓呯┖閫変腑  this.$refs.multipleTable.clearSelection();
    },

    viewDialogSure() {
      this.$parent.$parent.$parent.onOk(); //瑙嗗浘閫夋嫨妗嗙殑onOk()
    },

    init(isCloseDialog) {
      // debugger
      console.log(this.jumpParams);
      let op = this.openParams;
      let exparams = {};
      if (op.exparams) {
        //濡傛灉鎼哄甫鍙傛暟
        let ex = op.exparams.replace(/^(\s|&)+|(\s|&)+$/g, "");
        let list = ex.split("&");
        for (let i = 0; i < list.length; i++) {
          let e = list[i].split("=");
          if (e[1]) {
            exparams[e[0]] = e[1];
          }
        }
      }
      if (op.formParams) {
        exparams = this.setParams(op.formParams, exparams);
      }
      this.initView({
        appId: op.appId || this.$route.query.appId, // 闃叉浼犲叆鐨刼penParams瀵硅薄涓璦ppId灞炴€т涪澶�
        viewId: op.actionContent,
        exparams: exparams ? exparams : {},
        isCloseDialog: isCloseDialog,
      });
    },

    setParams(params, obj) {
      params = params.replace(/^(\s|&)+|(\s|&)+$/g, "");
      let list = params.split("&");
      for (let i = 0; i < list.length; i++) {
        let p = list[i].split("=");
        let isJson = this.isJSON(p[1]);
        if (isJson) {
          obj[p[0]] = encodeURI(p[1]);
        } else {
          obj[p[0]] = p[1] ? p[1] : "";
        }
      }
      return obj;
    },

    isJSON(str) {
      //鍒ゆ柇鏄痡son瀛楃涓�
      if (typeof str == "string") {
        try {
          let obj = JSON.parse(str);
          if (typeof obj == "object" && obj) {
            return true;
          } else {
            return false;
          }
        } catch (e) {
          return false;
        }
      }
    },

    //閫変腑鐨勫鍑烘柟寮�
    // handleChange(opt){
    //   if(opt === 1) {
    //     this.switchValue = false;
    //     // this.isDisabled = false;
    //     this.excelSelectList = [];
    //   }
    //   else if(opt === 2) {
    //     let selectAll = [];
    //     let columns = this.excelColumns;
    //     for (let i = 0; i < columns.length; i++) {
    //       selectAll.push(columns[i].name);
    //     }
    //     this.excelSelectList = selectAll;
    //     // this.switchValue = false;
    //     // this.isDisabled = true;
    //   }
    // },
    isShowSwitch(val) {
      if (val.length === this.excelColumns.length) {
        this.switchValue = true;
      } else {
        this.switchValue = false;
      }
    },

    //el-switch鍏ㄩ€�
    dataAll(val) {
      if (val === true) {
        let selectAll = [];
        let columns = this.excelColumns;
        for (let i = 0; i < columns.length; i++) {
          selectAll.push(columns[i].name);
        }
        this.excelSelectList = selectAll;
      } else {
        this.excelSelectList = [];
      }
    },

    setDialogStatus(params) {
      this.imageParams = params;
    },

    setSearchDocItems(doc) {
      this.searchDocItems = doc;
    },

    //鏌ヨ--鍗曚釜鏌ヨ
    onSearch(searchData, data) {
      //鍗曚釜鏌ヨ鎸夐挳--瀛愮粍浠朵负form_customize_searchform.vue 鍦ㄧ缁勪欢view_delegate.vue瑙嗗浘
      this.$store.commit('page', 1)
      this.$store.commit('searchDataStore', searchData)//绗簲姝ワ紝缂撳瓨鏌ヨ鏉′欢鍒皏uex鏁扮粍閲岄潰
      setTimeout(() => {
        this.$refs.delegate.onSearch(searchData, data);
      }, 800);//寮傛璋冪敤20230816--琛屼笟淇℃伅-浠庨珮绛涢€夋嫨淇濆畨鍏徃--寮圭獥瑙嗗浘鏌ヨbug
    },

    //鎵ц甯哥敤鏌ヨ鐨勯噸缃�
    executeCommonReset() {
      this.$refs.searchform.commonReset();
    },

    //鎵撳紑鎴栬€呭叧闂煡璇㈣〃鍗�
    openSearchTemplate() {
      // alert(this.isShowSearchTemplate)
      if (this.isShowSearchTemplate) {//鏀惰捣 閲嶇疆楂樼瓫鎼滅储鏉′欢
        this.$refs.delegate && this.$refs.delegate.$refs.searchform.reset()//閲嶇疆楂樼瓫鎼滅储鏉′欢
      }
      this.isShowSearchTemplate = !this.isShowSearchTemplate;
    },

    updateView() {
      this.isRouterAliveInclude = false;
      this.$nextTick(() => (this.isRouterAliveInclude = true));
    },

    hiddenCustomizeVisible() {
      //璇ユ柟娉曞疄鐜拌鍥句慨鏀规暟鎹紝鎴栬€呭垹闄ゆ暟鎹噸鏂板姞杞借鍥炬暟鎹�
      let openType = this.view.openType;
      if (this.view.simpleClassName == "GanttView") {
        //褰撴槸鐢樼壒瑙嗗浘鐩存帴鍒锋柊鏁翠釜椤甸潰
        // this.updateView();
        this.$refs.delegate.reloadListView();
      } else if (openType == 288) {
        //缃戞牸瑙嗗浘
        setTimeout(() => {
          this.customizeVisible = false;
          this.updateView();
        }, 1000);
      } else {
        setTimeout(() => {
          this.customizeVisible = false;
          this.$refs.delegate && this.$refs.delegate.reloadListView();
        }, 1000);
      }
    },

    setExcelPath(path) {
      this.excelPath = path;
    },

    //鎵归噺鎻愪氦鎴栬€呮彁浜ゆ祦绋�
    onOk() {
      if (this.isSubmissionProcess) {
        if (!this.attitude) {
          this.$message({
            message: this.$t("view.input_ss"),
            type: "warning",
          });
        } else {
          let obj = {
            approveLimit: "",
            attitude: this.attitude,
            docId: this.viewRowId,
          };
          this.$api.operateSubmit(this.openParams.appId, this.view.id, obj, {
            onSucess: (res) => {
              this.popupVisible = false;
              if (res.data.errcode == 0) {
                this.attitude = "";
                this.$notify({
                  title: res.data.data,
                  message: "",
                  type: "success",
                });
              } else {
                this.$notify.error({
                  title: this.$t("msg.err"),
                  message: "",
                });
              }
            },
          });
        }
      } else {
        if (!this.attitude) {
          this.$message({
            message: this.$t("view.input_ss"),
            type: "warning",
          });
        } else {
          // this.v3ActionSubmit(this.currentAct, this.currentDocIds); //bcx鏇挎崲鍚堝苟涓€涓帴鍙�
          this.runBeforeAction(this.currentAct, this.currentDocIds);
        }
      }
    },

    handleClose() {
      this.dialogVisible = false;
      this.jumpPopup = false;
      if (this.isDialogOpenExternalLink) {
        // this.$refs.delegate.getData();
        let isCloseDialog = true;
        this.init(isCloseDialog);
      }
    },

    //鍖呭惈鍏冪礌寮瑰嚭灞傚拰褰撳墠椤垫墦寮€閮芥槸浣跨敤杩欎釜鍒锋柊
    closeDialog(isSave) {
      console.log(this.viewType)
      this.$refs.delegate.reloadListView();
      if (!isSave) {
        this.dialogVisible = false;
        this.jumpPopup = false;
      }
      let _st = this.showtype;
      if (_st && _st == "include") {
        this.$emit("refresh");
      }
    },

    includeReload() {
      //閲嶆柊鍒锋柊缁勪欢鍒锋柊
      this.$emit("change");
      this.isRouterAliveInclude = false;
      this.$nextTick(() => (this.isRouterAliveInclude = true));
    },

    initView({ appId, viewId, exparams, isCloseDialog }) {
      //閲嶆柊鍔犺浇瑙嗗浘
      let op = this.openParams;
      let st = this.showtype;
      exparams = exparams || {};
      if (op.queryString) {
        let qs = op.queryString;
        let list = qs.split("&");
        for (let i = 0; i < list.length; i++) {
          let p = list[i].split("=");
          if (p[1]) {
            exparams[p[0]] = p[1];
          }
        }
      }
      let urlParams = op.urlParams; //璺宠浆鎸夐挳鎼哄甫鐨勫弬鏁�
      if (urlParams) {
        let fp = urlParams.replace(/^(\s|&)+|(\s|&)+$/g, "");
        let list = fp.split("&");
        for (let i = 0; i < list.length; i++) {
          let p = list[i].split("=");
          if (p[0] && p[0] != "appId" && p[0] != "viewId") {
            if (p[1]) {
              exparams[p[0]] = p[1];
            }
          }
        }
      }
      if ((st && st == "tab") || (st && st == "include")) {
        console.log(exparams);
        console.log(5455);
        //濡傛灉鏄帶浠堕€夐」鍗�
        exparams.parentId = op.parentId;
        exparams.isRelate = op.isRelate;
      }
      console.info('delegate 1', appId);
      this.$api.getViewTemplate(appId, viewId, exparams, {
        onSucess: (response) => {
          // alert(88)
          this.loading = true;

          console.info('response', response);
          if (response.data.data) {
            if (!response.data.data.activities) {
              //鍚庡彴閰嶇疆鐨勮鍥炬搷浣滄寜閽负0
              this.isShowActivity = false;
            }
            let viewWidth = "";
            let viewDom = this.$refs.viewDelegate;
            this.delegateWidth = viewWidth = viewDom.clientWidth;
            // this.delegateWidth = this.$refs.viewDelegate.clientWidth;
            // alert(viewWidth)
            if (viewWidth > 0) {
              if (this.showtype == "home") {
                this.delegateWidth = viewWidth - 40;
              } else {
                this.delegateWidth = viewWidth; //鑷姩鎺掔増瑕佽缃浐瀹氬搴�
              }
            }
            let viewData = response.data.data;
            let columns = viewData.columns;
            this.copyColumns = JSON.parse(JSON.stringify(columns));
            if (!columns) {
              this.$message({
                message: this.$t("msg.set_viewlist"),
                type: "warning",
              });
              return;
            }
            let isMultiLevelListHeader = false; //澶氱骇琛ㄥご
            for (let i = 0; i < columns.length; i++) {
              let name = columns[i].name;
              if (!isMultiLevelListHeader) {
                if (name.indexOf("__") > -1) {
                  isMultiLevelListHeader = true;
                }
              }
              if (!columns[i].visible) {
                columns.splice(i, 1);
                i--;
              }
            }
            let iType = this.includeDisplayType;
            if (
              viewData.readonly ||
              (iType &&
                (iType == Constant.PermissionType_READONLY ||
                  iType == Constant.PermissionType_DISABLED))
            ) {
              //鍙鎴栬€呭寘鍚厓绱犱负鍙锛岃鍥鹃兘瑕佸彧璇�
              let btnArr = viewData.activities;
              if (btnArr && btnArr.length > 0) {
                for (let i = btnArr.length - 1; i >= 0; i--) {
                  if (
                    btnArr[i].type != 1 &&
                    btnArr[i].type != 16 &&
                    btnArr[i].type != 26 &&
                    btnArr[i].type != 36 &&
                    btnArr[i].type != 43 &&
                    btnArr[i].type != 27
                  ) {
                    btnArr.splice(i, 1);
                  }
                }
              }
              // 1 16 26 36
            }
            let formPrint = this.isFormPrint;
            if (formPrint && formPrint == "5") {
              //鍒ゆ柇瑙嗗浘鍒楁墦鍗版椂鏄惁闅愯棌
              // let bodyWidth = document.documentElement.clientWidth - 52;
              let tdsWidth = 0;
              for (let j = 0; j < columns.length; j++) {
                if (!columns[j].visible4PagePrint) {
                  columns.splice(j, 1);
                  j--;
                } else {
                  if (columns[j].width) {
                    tdsWidth = tdsWidth + parseInt(columns[j].width);
                  } else {
                    columns[j].width = 100;
                    tdsWidth = tdsWidth + 100;
                  }
                }
              }
              for (let j = 0; j < columns.length; j++) {
                if (columns[j].width) {
                  let tdWidth = Math.floor((columns[j].width / tdsWidth) * 100);
                  columns[j].tdWidth = tdWidth + "%";
                }
              }
            }
            if (viewData.openType != 288) {
              //鍒ゆ柇鏄鍥剧被鍨嬩笉鏄綉鏍艰鍥炬椂锛屾妸淇濆瓨鎸夐挳鍒犻櫎
              if (viewData.activities) {
                if (viewData.activities.length > 0) {
                  for (let i = 0; i < viewData.activities.length; i++) {
                    if (viewData.activities[i].type === 34) {
                      viewData.activities.splice(i, 1);
                      break;
                    }
                  }
                }
              }
            }
            viewData.columns.forEach((item, index) => {
              if (item.iconMapping) {
                if (!viewData.columns[index].visible) {
                  viewData.columns[index].iconMapping = JSON.parse(
                    item.iconMapping
                  ); // item.iconMapping//JSON.parse(item.iconMapping)
                }
              }
            });

            if (viewData.width) {
              //瑙嗗浘鏄脊鍑哄眰鎵撳紑鏃舵湁瀹介珮
              this.dialogView.width = viewData.width;
            }
            if (viewData.height) {
              this.dialogView.height = viewData.height;
            }

            let columnsArray = columns;
            for (let i = 0; i < columnsArray.length; i++) {
              if (!columnsArray[i].visible || columnsArray[i].hiddenColumn) {
                columnsArray.splice(i, 1);
                i--;
              }
            }
            this.view = viewData;
            this.title =
              response.data.data.description || response.data.data.name;
            this.currentOpenType = response.data.data.openType;

            if (viewData.style && viewData.style.content) {
              let viewCss =
                "#view_" + viewData.id + " " + viewData.style.content;
              let css = viewCss,
                head =
                  document.head || document.getElementsByTagName("head")[0],
                style = document.createElement("style");
              head.appendChild(style);
              style.type = "text/css";
              style.appendChild(document.createTextNode(css));
            }

            if (isCloseDialog) {
              //寮圭獥鎵撳紑瑙嗗浘鍚庨噸鏂板姞杞芥暟鎹�
              this.$refs.delegate.getData();
            }

            //澶氱骇琛ㄥご
            if (isMultiLevelListHeader) {
              let listArr = [];
              const loopOpe = (columns) => {
                let arr = [];
                for (let i = 0; i < columns.length; i++) {
                  let name = columns[i].name;
                  if (name.indexOf("__") > -1) {
                    let nArr = name.split("__");
                    let t = nArr[0];
                    let t2 = nArr.slice(1).join("__");
                    let nobj = {
                      id: t,
                      name: t2,
                      label: name,
                      columns: columns[i],
                      haveChildren: true,
                    };
                    arr.push(nobj);
                  } else {
                    let nobj = {
                      id: name,
                      name: name,
                      label: name,
                      columns: columns[i],
                      haveChildren: false,
                    };
                    arr.push(nobj);
                  }
                }
                arr.forEach((el) => {
                  for (let i = 0; i < listArr.length; i++) {
                    if (listArr[i].id == el.id) {
                      listArr[i].children.push({
                        name: el.name,
                        label: el.label,
                        columns: el.columns,
                        id: el.name,
                      });
                      return;
                    }
                  }
                  if (el.haveChildren) {
                    listArr.push({
                      id: el.id,
                      children: [
                        {
                          id: el.name,
                          name: el.name,
                          label: el.label,
                          columns: el.columns,
                        },
                      ],
                    });
                  } else {
                    listArr.push({
                      id: el.id,
                      label: el.label,
                      columns: el.columns,
                    });
                  }
                  // listArr.push({
                  //   id: el.id,
                  //   children: [{
                  //     name: el.name,
                  //   }]
                  // })
                });
              };
              if (columns && columns.length > 0) {
                loopOpe(columns);
              }

              const loopOpe2 = (columns, index) => {
                let arr = [];
                let lArr = [];
                for (let i = 0; i < columns.length; i++) {
                  let name = columns[i].name;
                  if (name.indexOf("__") > -1) {
                    let nArr = name.split("__");
                    let t = nArr[0];
                    let t2 = nArr.slice(1).join("__");
                    let nobj = {
                      id: t,
                      name: t2,
                      label: t2,
                      columns: columns[i].columns,
                      haveChildren: true,
                    };
                    arr.push(nobj);
                  } else {
                    let nobj = {
                      id: name,
                      name: name,
                      label: name,
                      columns: columns[i].columns,
                      haveChildren: false,
                    };
                    arr.push(nobj);
                  }
                }
                arr.forEach((el) => {
                  for (let i = 0; i < lArr.length; i++) {
                    if (lArr[i].id == el.id) {
                      lArr[i].children.push({
                        id: el.name,
                        name: el.name,
                        label: el.label,
                        columns: el.columns,
                      });
                      return;
                    }
                  }
                  if (el.haveChildren) {
                    lArr.push({
                      id: el.id,
                      children: [
                        {
                          id: el.name,
                          name: el.name,
                          label: el.label,
                          columns: el.columns,
                        },
                      ],
                    });
                  } else {
                    lArr.push({
                      id: el.id,
                      label: el.label,
                      columns: el.columns,
                    });
                  }
                });
                listArr[index].children = lArr;
              };

              if (listArr && listArr.length > 0) {
                listArr.forEach((el, index) => {
                  if (el.children && el.children.length > 0) {
                    loopOpe2(el.children, index);
                  }
                });
              }
              this.multiLevelColumnData = listArr;
              this.isMultiLevelListHeader = true;
            }
            this.loading = false;
            // 浼犻€掔粰瀛愮粍浠� view_treeview 鍒ゆ柇鏄惁闇€瑕佹樉绀烘竻闄ゆ寜閽�
            this.$emit("getViewType", response.data.data.simpleClassName);
            if (st && st == "tab" && viewData.openType == 288) {
              //瑙嗗浘鏄€夐」鍗℃墦寮€骞朵笖鏄綉鏍艰鍥撅紝涓轰簡澶栧眰淇濆瓨鎸夐挳淇濆瓨缃戞牸瑙嗗浘
              this.$emit("setTabOpentype", op.tabIndex);
            }
          }
          clearTimeout(timeLoading);
        },
      });
    },

    openForm(params, emptyParams) {
      this.emptyParams = emptyParams;
      this.newIncludeO = params;
      if (params.title != undefined) {
        this.dialogTitle = params.title;
      }
      this.dialogVisible = true;
    },

    //鍒涘缓鏂拌〃鍗�
    doCreate(act, extraParams) {
      let view = this.view;
      let openParams = this.openParams;
      let params = {
        linkType: "00",
        appId: openParams.appId,
        active: true,
        actionContent: act.onActionForm,
        name: view.name,
        refreshId: openParams.id,
        id: new Date().getTime(),
      };

      //浠ヤ笅鐨勫弬鏁板舰寮忔槸鍦ㄦ柊寤哄悗鎵ц鎵ц鍚庤剼鏈�
      let sd = this.searchDocItems;
      let formData = {
        docId: "",
        document: {},
        formId: view.relatedForm,
        parentId: "",
        templateForm: "",
        viewId: openParams.actionContent,
        _selects: this.currentDocIds,
      };
      if (extraParams && extraParams.treedocid) {
        params.treedocid = extraParams.treedocid;
        formData.treedocid = extraParams.treedocid;
      }
      if (sd) {
        formData.document = sd;
      }
      let appId = openParams.appId;
      let divId = act.id;
      let docId = "";
      let parentId = openParams.parentId ? openParams.parentId : "";
      let _templateForm = "";
      let _ = "";
      params.isNewCreate = true;
      params.runAfterParams = {
        appId,
        divId,
        docId,
        actionContent: openParams.actionContent,
        relatedForm: view.relatedForm,
        _templateForm,
        parentId,
        _,
        formData,
      };
      let includeRunAfterParams = params.runAfterParams; //鍖呭惈鍏冪礌閲屽祵濂楄鍥撅紝瑙嗗浘鏂板缓鎵ц鍚庢湁鑴氭湰
      if (view.newPage) {
        //鏂扮獥鍙f墦寮€
        this.isBlockClick = false;
        params.isOpenNewWindow = true;
        params.runAfterParams = JSON.stringify(params.runAfterParams);
        let routeData = this.$router.resolve({
          // name: "form_blank",
          name: "open",
          query: params,
        });
        let winObj = window.open(routeData.href, "_blank");
        let loop = setInterval(() => {
          if (winObj.closed) {
            clearInterval(loop);
            this.$refs.delegate.reloadListView();
          }
        }, 1500);
      } else if (this.widgetChartView) {
        //濡傛灉鏄痺idget鐨勮鍥炬柊寤�
        this.isBlockClick = false;
        this.$emit("action", params);
      } else if (openParams.isOpenNewWindow && view.openType !== 277) {
        //濡傛灉鏄柊绐楀彛鎵撳紑涓旀病璁剧疆瑙嗗浘鎵撳紑鏂瑰紡涓哄脊鍑哄眰
        this.isBlockClick = false;
        let newParams = JSON.parse(JSON.stringify(params));
        newParams.isOpenNewWindow = true;
        let routeData = this.$router.resolve({
          name: "open",
          query: newParams,
        });
        window.open(routeData.href, "_blank");
      } else if (openParams.isPopupLayerDisplay) {
        //濡傛灉鎵撳紑绫诲瀷鏄脊鍑哄眰锛屾柊寤烘椂鎵撳紑琛ㄥ崟
        this.isBlockClick = false;
        this.$emit("popupOpenType", "FORM", params);
      } else if (openParams.isExternalLink) {
        //澶栭摼鎵撳紑锛岀劧鍚庢柊寤鸿〃鍗�,閫氳繃opener缁勪欢
        // params = {
        //   linkType: '00',
        //   appId: openParams.appId,
        //   actionContent: act.onActionForm,//url,
        //   isExternalLink: true, //url鏄墦寮€opener缁勪欢锛屽垽鏂槸澶栭摼銆�
        // };
        this.isBlockClick = false;
        params.isExternalLink = true;
        this.$emit("onAction", params);
      } else {
        if (!this.showtype || this.showtype == "target") {
          this.isBlockClick = false;
          //鏅€氳鍥炬柊寤烘垨鑰呭悗鍙拌缃簡鑿滃崟鐨勬墦寮€閾炬帴鏂瑰紡鏄柊绐楀彛鎵撳紑锛坱arget锛�
          if (view.newPage) {
            //鎵撳紑鏂扮獥鍙�
            let newParams = JSON.parse(JSON.stringify(params));
            newParams.runAfterParams = JSON.stringify(newParams.runAfterParams);
            newParams.isOpenNewWindow = true;
            let routeData = this.$router.resolve({
              // name: "form_blank",
              name: "open",
              query: newParams,
            });
            window.open(routeData.href, "_blank");
          } else {
            if (this.view.openType == 277) {
              //寮瑰嚭灞�
              params.type = 277;
              params.dialogId = "dialog_normalform_" + openParams.actionContent; ////鐢ㄤ簬寮圭獥鎵撳紑琛ㄥ崟鏈夊寘鍚厓绱犳椂锛岃绠楀寘鍚厓绱犲搴�
              this.newIncludeO = params;
              this.dialogVisible = true;
            } else {
              if (this.view.openType == 293) {
                //鏂伴〉绛炬墦寮€
                this.$emit("add-tab", params);
              } else {
                //褰撳墠椤垫墦寮€
                this.openNewpage(params);
              }
            }
          }
        } else {
          if (this.showtype == "include") {
            //鍖呭惈鍏冪礌
            this.isBlockClick = false;
            let params = {
              linkType: "00",
              appId: openParams.appId,
              active: true,
              actionContent: act.onActionForm,
              name: this.view.name,
              refreshId: openParams.id,
              randomRefreshId: new Date().getTime(),
              runAfterParams: includeRunAfterParams,
            };
            params.parentId = openParams.parentId ? openParams.parentId : ""; //鍖呭惈鍏冪礌鏃跺垽鏂槸鍚︽湁parentId
            params.isRelate = openParams.isRelate ? true : "";
            params.isIncludeCreate = "include";
            params.isNewCreate = true;
            this.includeRefreshId = params.randomRefreshId;
            if (this.currentOpenType == 1) {
              if (this.view.simpleClassName == "CollapsibleView") {
                params.viewType = "CollapsibleView";
                this.toTab(params);
              } else {
                this.$refs.delegate.addRow(params);
              }
            } else if (this.currentOpenType == 277) {
              this.newIncludeO = params;
              this.dialogVisible = true;
            } else if (this.currentOpenType == 293) {
              //鏍囩椤垫墦寮€
              params.name = this.view.name;
              params.openType = this.view.openType;
              this.toTab(params);
            }
          } else if (this.showtype == "tab") {
            //閫夐」鍗�
            this.isBlockClick = false;
            params.parentId = openParams.parentId ? openParams.parentId : ""; //鍖呭惈鍏冪礌鏃跺垽鏂槸鍚︽湁parentId
            params.isRelate = openParams.isRelate ? true : "";
            params.istabCreate = "tab";
            this.includeRefreshId = params.randomRefreshId;
            if (this.currentOpenType == 1) {
              if (extraParams && extraParams.innerType == "FORM") {
                //鏍戝舰瑙嗗浘鏂板缓鎵撳紑琛ㄥ崟
                this.toTab(params);
              } else {
                this.$refs.delegate.addRow(params);
              }
            } else if (this.currentOpenType == 277) {
              params.isTabCreate = "tab";
              params.type = 277;
              params.dialogId = "dialog_normalform_" + openParams.actionContent; //鐢ㄤ簬寮圭獥鎵撳紑琛ㄥ崟鏈夊寘鍚厓绱犳椂锛岃绠楀寘鍚厓绱犲搴�
              this.newIncludeO = params;
              this.dialogVisible = true;
            } else if (this.currentOpenType == 293) {
              //鏍囩椤垫墦寮€
              // this.$emit("add-tab", {
              //   linkType: "00",
              //   appId: this.openParams.appId,
              //   active: true,
              //   actionContent: act.onActionForm,
              //   name: this.view.name,
              //   refreshId:this.openParams.id,
              // });
              this.toTab(params);
            }
          }
        }
      }
    },

    setViewRefreshId(id) {
      this.includeRefreshId = id;
    },

    setPopupOpenType(type, params) {
      //褰撹鍥炬槸寮瑰嚭灞傛墦寮€锛屾柊寤烘垨鎵撳紑瑙嗗浘鍒楄〃
      if (type == "FORM") {
        params.isPopupLayerDisplay = true;
        this.jumpParamsForm = params;
        this.popupLayerType = type;
      } else if (type == "VIEW") {
        this.popupLayerType = type;
      }
    },

    //鏄惁鍒犻櫎鐨勫脊绐楁彁绀�
    doRemove(act, value) {
      let docIds = "";
      if (this.currentDocIds && this.currentDocIds.length > 0) {
        docIds = this.currentDocIds;
      } else {
        //鏍戝舰瑙嗗浘鏃�
        docIds = value;
      }
      if (docIds && docIds.length > 0) {
        this.$confirm(
          this.$t("msg.del_select") + `${docIds.length}` + this.$t("msg.data"),
          this.$t("tip"),
          {
            confirmButtonText: this.$t("msg.confirm"),
            cancelButtonText: this.$t("btns.cancel"),
            type: "warning",
          }
        )
          .then(() => {
            this.runBeforeAction(act, docIds);
          })
          .catch(() => { });
      } else {
        this.$confirm(this.$t("msg.least_one_data"), this.$t("tip"), {
          confirmButtonText: this.$t("msg.confirm"),
          cancelButtonText: this.$t("btns.cancel"),
          type: "warning",
        })
          .then(() => { })
          .catch(() => { });
      }
    },

    //鍒犻櫎瑙嗗浘
    removeDocuments(act, docIds) {
      this.$api.batchRemoveDocuments(this.openParams.appId, docIds, {
        onSucess: (res) => {
          if (res.data.errcode == 0) {
            this.$notify({
              title: this.$t("success"),
              message: "",
              type: "success",
            });
            this.runAfterAction(act, []);
            this.$refs.delegate.reloadListView();
            let _st = this.showtype;
            if (_st && _st == "include") {
              //鍖呭惈鍏冪礌鍒犻櫎瑙嗗浘搴斿埛鏂拌〃鍗曢〉闈紝鏂板缓涔熶竴鏍�
              this.$emit("refresh");
            }
            // this.includeReload();
          }
        },
      });
    },

    setDocIds(val) {
      this.currentDocIds = val;
    },

    //鏄惁娓呯┖鎵€鏈夋暟鎹殑寮圭獥
    clearDataPopup(data) {
      this.$confirm(this.$t("msg.del_all"), this.$t("tip"), {
        confirmButtonText: this.$t("msg.confirm"),
        cancelButtonText: this.$t("btns.cancel"),
        type: "warning",
      })
        .then(() => {
          this.runBeforeAction(data);
        })
        .catch(() => { });
    },

    //娓呯┖鎵€鏈夋暟鎹�
    clearAllData(act) {
      let appId = this.openParams.appId;
      let formId = this.view.relatedForm;
      this.$api.deleteAllData(appId, formId, {
        onSucess: (res) => {
          if (res.data.errcode == 0) {
            this.$notify({
              title: res.data.data,
              message: "",
              type: "success",
            });
            this.runAfterAction(act, []);
            this.includeReload();
          }
        },
      });
    },

    //鎵ц鑴氭湰鍓�
    /**
     * docIds 瑙嗗浘閫変腑鐨刬d
     * extraParams 鏍戝舰瑙嗗浘鏂板缓浼犺繃鏉ョ殑鍙傛暟锛屼互鍚庡叾浠栬鍥惧彲鑳戒篃浼氱敤鍒�
     * **/
    runBeforeAction(act, docIds, extraParams) {
      this.isBlockClick = true;
      let view = this.view;
      let sd = this.searchDocItems;
      let openParams = this.openParams;
      let formData = {
        docId: "",
        document: sd ? sd : {},
        formId: view.relatedForm,
        parentId: "",
        templateForm: view.templateForm,
        viewId: openParams.actionContent,
        _selects: docIds && docIds.length > 0 ? docIds : this.currentDocIds,
      };
      this.cvFormData = formData; //澶嶅埗runBeforeAction鐨勫弬鏁癴ormdata锛屼繚瀛樺湪cvFormData閲岀敤浜庣粰getAxecuteAddress浼犲弬
      let st = this.showtype;
      if ((st && st == "tab") || (st && st == "include")) {
        //濡傛灉鏄帶浠堕€夐」鍗℃垨鍖呭惈鍏冪礌
        formData.parentId = openParams.parentId;
        formData.isRelate = openParams.isRelate;
      }
      let treedocid = "";
      if (extraParams && extraParams.treedocid) {
        treedocid = extraParams.treedocid;
        formData.treedocid = extraParams.treedocid;
        formData.document = extraParams.document;
      }
      if (openParams.isRelate) {
        formData.isRelate = openParams.isRelate;
      }
      if (openParams.parentId) {
        formData.parentId = openParams.parentId;
      }
      if (this.$route.query) {
        formData = { ...formData, ...this.$route.query };
      }
      let divId = act.id;
      let actType = act.type;
      this.$api.runBeforeActionScript(
        openParams.appId,
        divId,
        formData,
        actType,
        treedocid ? treedocid : "", //treedocid
        "", //flowType
        {
          onSucess: (response) => {
            if (response.data.data) {
              this.isBlockClick = false;
              //濡傛灉鏈夋暟鎹繑鍥烇紝缁撴潫涓嬩竴姝�
              let resData = response.data.data;
              let errmsg = response.data.data.content;
              if (!resData.type) {
                //娌℃湁type鍊硷紝浣嗘槸鏈夎繑鍥炴暟鎹紝鎶婃暟鎹斁杩沝ocument
                if (resData.changedField) {
                  this.$notify.success({
                    title: resData.content,
                    message: "",
                  });
                }
              } else if (resData.type == 1) {
                if (resData.content == "绔欏唴淇″彂閫佹垚鍔�") {
                  this.$notify.success({
                    title: resData.content,
                    message: "",
                  });
                } else {
                  this.$notify.error({
                    title: errmsg,
                    message: "",
                    customClass: "notify-success", //杞藉叆瑙嗗浘鎵ц鍓嶈剼鏈繑鍥炲€兼樉绀轰负绾㈣壊
                  });
                }
              } else if (resData.type == 16) {
                this.$notify.error({
                  title: errmsg,
                  message: "",
                });
              } else if (resData.type == 32) {
                this.$confirm(`${errmsg}`, this.$t("tip"), {
                  confirmButtonText: this.$t("msg.confirm"),
                  cancelButtonText: this.$t("btns.cancel"),
                  type: "warning",
                })
                  .then(() => {
                    switch (act.type) {
                      case 1: //杞藉叆瑙嗗浘
                        this.getTemplate(act);
                        break;
                      case 2: //鏂板缓琛ㄥ崟
                        this.doCreate(act, extraParams);
                        break;
                      case 3: //鍒犻櫎鏁版嵁
                        this.removeDocuments(act, docIds);
                        break;
                      case 16: //瀵煎嚭excel
                        // debugger
                        this.isBlockClick = false;
                        this.currentClickBtnAct = act;
                        let excelColumns = [];
                        let columns = this.copyColumns;
                        let selectAll = [];
                        for (let i = 0; i < columns.length; i++) {
                          if (columns[i].visible4ExpExcel) {
                            excelColumns.push(columns[i]);
                          }
                          selectAll.push(columns[i].name);
                        }
                        this.excelColumns = excelColumns;
                        this.excelSelectList = selectAll;
                        this.exportDialog = true;
                        this.switchValue = true;
                        this.exportData = 1;
                        break;
                      case 18: //娓呯┖鎵€鏈夋暟鎹�
                        this.clearAllData(act);
                        break;
                      case 20: //鎵归噺鎻愪氦
                        this.onSubmit(act, docIds);
                        break;
                      case 26: //鏂囦欢涓嬭浇
                        this.fileDownload(act.id);
                        break;
                      case 27: //瀵煎叆excel
                        this.showLeadDialog(act);
                        break;
                      case 36: //缃戦〉鎵撳嵃(瑙嗗浘)
                        this.viewPrint(act);
                        break;
                      case 43: //璺宠浆
                        this.jumpType(act);
                        break;
                      default:
                        break;
                    }
                  })
                  .catch(() => { });
              }
            } else {
              switch (act.type) {
                case 1: //杞藉叆瑙嗗浘
                  this.getTemplate(act);
                  break;
                case 2: //鏂板缓琛ㄥ崟
                  this.doCreate(act, extraParams);
                  break;
                case 3: //鍒犻櫎鏁版嵁
                  this.removeDocuments(act, docIds);
                  break;
                case 16: //瀵煎嚭excel
                  debugger
                  this.isBlockClick = false;
                  this.currentClickBtnAct = act;
                  let excelColumns = [];
                  let columns = this.copyColumns;
                  let selectAll = [];
                  console.log(columns)
                  for (let i = 0; i < columns.length; i++) {
                    if (columns[i].visible4ExpExcel) {
                      excelColumns.push(columns[i]);
                    }
                    selectAll.push(columns[i].name);
                  }
                  this.excelColumns = excelColumns;
                  this.excelSelectList = selectAll;
                  this.exportDialog = true;
                  this.switchValue = true;
                  this.exportData = 1;
                  break;
                case 18: //娓呯┖鎵€鏈夋暟鎹�
                  this.clearAllData(act);
                  break;
                case 20: //鎵归噺鎻愪氦
                  this.onSubmit(act, docIds);
                  break;
                case 26: //鏂囦欢涓嬭浇
                  this.fileDownload(act.id);
                  break;
                case 27: //瀵煎叆excel
                  this.showLeadDialog(act);
                  break;
                case 29:
                  break;
                case 36: //缃戦〉鎵撳嵃(瑙嗗浘)
                  this.viewPrint(act);
                  break;
                case 43: //璺宠浆
                  this.jumpType(act);
                  break;
                default:
                  break;
              }
            }

            // if(response.data.errcode == 0 && response.data.data) {
            //   let errcode = response.data.errcode;
            //   let errmsg = response.data.data.content;
            //   this.$notify.error({
            //     title: errmsg,
            //     message: ''
            //   });
            // }else if(response.data.errcode == 0){
            //   switch(act.type) {
            //     case 1: //杞藉叆瑙嗗浘
            //       this.getTemplate(act);
            //       break;
            //     case 2: //鏂板缓琛ㄥ崟
            //       this.doCreate(act);
            //       break;
            //     case 3: //鍒犻櫎鏁版嵁
            //       this.removeDocuments(act,docIds);
            //       break;
            //     case 16: //瀵煎嚭excel
            //       this.currentClickBtnAct = act;
            //       let selectAll = [];
            //       let columns = this.view.columns;
            //       columns.forEach(el => {
            //         selectAll.push(el.name);
            //       });
            //       this.excelSelectList = selectAll;
            //       this.exportDialog = true;
            //       break;
            //     case 18: //娓呯┖鎵€鏈夋暟鎹�
            //       this.clearAllData(act);
            //       break;
            //     case 20: //鎵归噺鎻愪氦
            //       this.onSubmit(act, docIds);
            //       break;
            //     case 26: //鏂囦欢涓嬭浇
            //       this.fileDownload(act.id);
            //       break;
            //     case 36: //缃戦〉鎵撳嵃(瑙嗗浘)
            //       this.viewPrint(act);
            //       break;
            //     case 43: //璺宠浆
            //       this.jumpType(act);
            //       break;
            //     default:
            //       break;
            //   }
            // }
          },
        }
      );
    },

    //鎵ц鑴氭湰鍚�
    runAfterAction(act, docIds, extraParams) {
      let sd = this.searchDocItems;
      let op = this.openParams;
      let formData = {
        docId: "",
        document: sd ? sd : {},
        formId: this.view.relatedForm,
        parentId: "",
        templateForm: "",
        viewId: op.actionContent,
        _selects: docIds && docIds.length > 0 ? docIds : this.currentDocIds,
      };
      let st = this.showtype;
      let parentId = "";
      if ((st && st == "tab") || (st && st == "include")) {
        //濡傛灉鏄帶浠堕€夐」鍗℃垨鍖呭惈鍏冪礌
        formData.parentId = op.parentId;
        formData.isRelate = op.isRelate;
        parentId = op.parentId;
      }
      if (extraParams && extraParams.treedocid) {
        formData.treedocid = extraParams.treedocid;
        formData.document = extraParams.document;
      }
      let appId = op.appId;
      let divId = act.id;
      let docId = "";

      let _templateForm = "";
      let _ = "";
      this.$api.runAfterActionScript(
        appId,
        divId,
        docId,
        op.actionContent,
        this.view.relatedForm,
        _templateForm,
        parentId,
        _,
        formData,
        act.type,
        "", //treedocid
        {
          onSucess: (response) => {
            this.isBlockClick = false;
            if (response.data.data) {
              let returnData = response.data.data;
              if (returnData.changedField) {
                this.$notify.success({
                  title: returnData.content,
                  message: "",
                });
              } else {
                let errmsg = response.data.data.content;
                if (returnData.type && returnData.type == "message") {
                  if (errmsg.type == 16) {
                    this.$notify.success({
                      title: errmsg.content,
                      message: "",
                    });
                  }
                } else if (returnData.type && returnData.type == "1") {
                  this.$notify.success({
                    title: errmsg,
                    message: "",
                  });
                } else {
                  this.$notify.error({
                    title: errmsg,
                    message: "",
                  });
                }
              }
            } else {
              if (act.type == 1) {
                // this.$refs.delegate.reloadListView();
              } else if (act.type == 20) {
                this.popupVisible = false;
              }
            }
            // if(response.data.errcode == 0) {
            //   if(response.data.data.content) {
            //     let errmsg = response.data.data.content.content;
            //     this.$notify({
            //       title: errmsg,
            //       message: '',
            //       type: 'warning'
            //     });
            //   }else {
            //     if(act.type == 20) {
            //       this.popupVisible = false;
            //     }
            //   }
            // }
          },
        }
      );
    },

    //璁$畻鍩烘湰鎵撳紑绐楀彛璺宠浆
    openDialogJump(params, type) {
      if (type == "FORM") {
        params.dialogId = "dialog_normalform_" + this.openParams.actionContent; //鐢ㄤ簬寮圭獥鎵撳紑琛ㄥ崟鏈夊寘鍚厓绱犳椂锛岃绠楀寘鍚厓绱犲搴�
        this.isJumpView = false;
        this.isJumpForm = true;
        this.jumpParams = params;
        this.jumpPopup = true;
      } else if (type == "VIEW") {
        this.popupLayerType = "VIEW";
        this.isJumpForm = false;
        this.isJumpView = true;
        params.isPopupLayerDisplay = true;
        this.jumpParams = params;
        this.jumpPopup = true;
      } else if (type == "JUMP") {
        this.popupLayerType = "VIEW";
        this.isJumpForm = false;
        this.isJumpView = false;
        this.jumpParams = params;
        this.jumpPopup = true;
        this.isExternalLink = true;
      }
      this.$nextTick(() => {
        this.$refs.elDialog.$el.firstChild.style.height = this.jumpParams
          .styleParams
          ? this.jumpParams.styleParams.dialogHeight
          : ""; //elDialog璁剧疆寮圭獥鑷畾涔夐珮搴�--鐐瑰嚮瑙嗗浘寮圭獥鍔犺浇
      });
    },

    //璺宠浆鎸夐挳鐨勮烦杞被鍨�---鏂板璺宠浆
    jumpType(act) {
      // debugger
      let name = this.view.fullName.split("_").join("銆�");
      let _selects = this.cvFormData._selects;
      let op = this.openParams;
      let obj = {
        docId: "",
        appId: this.$api.appid,
        viewId: act.parentView,
        opentarget: "",
        containTitle: name,
        field: "",
        isRelate: undefined,
        parentId: "",
        _selects: _selects,
      };
      if (op.parentId) {
        obj.parentId = op.parentId;
      }
      if (op.isRelate != null) {
        obj.isRelate = op.isRelate;
      }
      obj = { ...obj, ...this.$route.query }; //鎵ц鑾峰彇url鍙傛暟
      this.$api.getAxecuteAddress(this.openParams.appId, act.id, obj, {
        onSucess: (res) => {
          this.isBlockClick = false;
          if (res.data.errcode === 0) {
            let url = res.data.data.content;
            console.log(url);
            let queryString = act.dispatcherParams;
            let isForm = url.search("form.html") != -1; //鍏煎good鐨剈rl鐨勫啓娉曪紙鍚庢湡鏀癸級
            let isView = url.search("view.html") != -1; //鍏煎good鐨剈rl鐨勫啓娉曪紙鍚庢湡鏀癸級
            let isReport = url.search("report.html") != -1; //鍏煎good鐨剈rl鐨勫啓娉曪紙鍚庢湡鏀癸級
            let isOpenCurrentSoftwareData = url.search("open?") != -1;

            let urlArrayF = url.split("?");
            let urlArray = "";
            if (urlArrayF[1]) {
              urlArray = urlArrayF[1].split("&");
            } else {
              if (url.indexOf("?") == -1) {
                url = url + "?";
              }
            }
            this.isJumpForm = isForm;
            this.isJumpView = isView;
            let type = "";
            let isExternalLink = false;

            console.log("缂栬緫娴佺▼");
            console.log(url);
            if (url && url.indexOf("processHtmlTem.html") > -1) {
              API.softwareApplication(this.openParams.appId, {
                onSucess: (res) => {
                  let errcode = res.data.errcode;
                  if (errcode == 0) {
                    let software = JSON.stringify(res.data.data);
                    sessionStorage.setItem("appId", this.openParams.appId);
                    sessionStorage.setItem("software", software);
                  }
                },
              });
            }

            if (isForm) {
              type = "00";
            } else if (isView) {
              type = "01";
            } else if (isReport) {
              //鎶ヨ〃
              type = "09";
            } else if (!isForm && !isView && !isOpenCurrentSoftwareData) {
              isExternalLink = true;
              this.isExternalLink = true; //鍒ゆ柇鏄惁鏄閮ㄩ摼鎺�
            }

            let params = {
              linkType: type,
              appId: op.appId,
              actionContent: "",
              name: act.name,
              _select: "",
              viewId: "",
            };
            if (op.parentId) {
              params.parentId = op.parentId;
            }
            if (op.isRelate != null) {
              params.isRelate = op.isRelate;
            }
            let obj = {};
            if (urlArray && urlArray.length > 0) {
              for (let i = 0; i < urlArray.length; i++) {
                let val = urlArray[i].split("=");
                obj[val[0]] = val[1];
              }
            }
            obj.refreshId = op.id;
            switch (act.jumpActOpenType) {
              case 0:
                if (!isExternalLink) {
                  if (isOpenCurrentSoftwareData) {
                    //濡傛灉澶栭摼褰㈠紡杩樻槸鎵撳紑浜у搧鐨勬帶浠讹紝閭d箞涓嶇敤iframe鐨勬柟娉曞祵濂�
                    if (op.exparams) {
                      obj.exparams = op.exparams;
                    }
                    obj.name = act.name;
                    if (op.isPopupLayerDisplay) {
                      //寮圭獥鎵撳紑瑙嗗浘鍚庯紝璺宠浆鎸夐挳鎵撳紑琛ㄥ崟锛岃繕鏄湪寮圭獥鎵撳紑
                      this.$emit("popupOpenType", "FORM", obj);
                    } else {
                      this.$emit("openNewpage", obj);
                    }
                  } else {
                    params.actionContent = obj.viewId ? obj.viewId : obj.formId;
                    params.clearTemp = obj.clearTemp ? obj.clearTemp : "";
                    param.isCurrentPageOpen = true;
                    param.queryString = queryString;
                    this.$emit("openNewpage", params);
                  }
                } else {
                  params = {
                    linkType: "103",
                    appId: op.appId,
                    actionContent: url,
                  };
                  // this.$emit("openNewpage",params)
                  this.openNewpage(params);
                }
                break;
              case 1:
                if (!isExternalLink) {
                  if (isOpenCurrentSoftwareData) {
                    let formParams = "";
                    console.log(obj);
                    for (let key in obj) {
                      if (
                        key != "name" &&
                        key != "actionContent" &&
                        key != "searchData" &&
                        key != "showtype" &&
                        key != "realformId" &&
                        key != "templateForm" &&
                        key != "urlParams" &&
                        key != "exparams" &&
                        key != "runAfterParams" &&
                        key != "queryString" &&
                        key != "isOpenDialog"
                      ) {
                        if (obj[key]) {
                          formParams += "&" + key + "=" + obj[key];
                        }
                      }
                    }
                    if (op.exparams) {
                      if (formParams) {
                        formParams = formParams + "" + op.exparams;
                      } else {
                        formParams = op.exparams;
                      }
                    }
                    if (formParams) {
                      obj.formParams = formParams;
                    }
                    obj.name = act.name;
                    obj.isPopupLayerDisplay = true;
                    if (obj.linkType == "00") {
                      //琛ㄥ崟
                      this.isJumpForm = true;
                    } else if (obj.linkType == "01") {
                      //瑙嗗浘
                      this.isJumpView = true;
                      this.popupLayerType = "VIEW";
                    }
                    if (obj.isRefresh && obj.isRefresh == "true") {
                      this.isDialogOpenExternalLink = true;
                    }
                    this.jumpParams = obj;
                  } else {
                    params.actionContent = obj.viewId ? obj.viewId : obj.formId;
                    params.clearTemp = obj.clearTemp ? obj.clearTemp : "";
                    params.isPopupLayerDisplay = true;
                    this.jumpParams = params;
                    this.popupLayerType = "VIEW";
                  }
                  this.jumpPopup = true;
                } else {
                  params.linkType = "103";
                  params.actionContent = url; //url + "&isOpenDialog=true"
                  params.clearTemp = obj.clearTemp ? obj.clearTemp : "";
                  params.isExternalLink = true;
                  let linkType = "";
                  for (let i = 0; i < urlArray.length; i++) {
                    if (urlArray[i].indexOf("linkType") > -1) {
                      if (urlArray[i].indexOf("01") > -1) {
                        linkType = "VIEW";
                        params.actionContent = url + "&isOpenDialog=true";
                      } else if (urlArray[i].indexOf("00") > -1) {
                        linkType = "FORM";
                        params.actionContent = url + "&isOpenDialog=true";
                      }
                    }
                  }
                  this.jumpParams = params;
                  this.popupLayerType = linkType;
                  this.jumpPopup = true;
                }
                break;
              case 2:
                if (!isExternalLink) {
                  if (isOpenCurrentSoftwareData) {
                    if (op.exparams) {
                      obj.exparams = op.exparams;
                    }
                    obj.name = act.name;
                    this.addTab(obj);
                  } else {
                    params.actionContent = obj.viewId ? obj.viewId : obj.formId;
                    params.clearTemp = obj.clearTemp ? obj.clearTemp : "";
                    if (isReport) {
                      //鎶ヨ〃
                      if (obj.reportId) {
                        params.actionContent = obj.reportId;
                      }
                      Object.assign(params, obj);
                    }
                    this.addTab(params);
                  }
                } else {
                  params.linkType = "103";
                  params.actionContent = url;
                  params.clearTemp = obj.clearTemp ? obj.clearTemp : "";
                  params.isExternalLink = true;
                  if (isReport) {
                    //鎶ヨ〃
                    if (obj.reportId) {
                      params.actionContent = obj.reportId;
                    }
                    Object.assign(params, obj);
                  }
                  // this.$emit("add-tab", params);
                  this.addTab(params);
                }
                break;
              case 3:
                if (!isExternalLink) {
                  params.actionContent = obj.viewId ? obj.viewId : obj.formId;
                  params.clearTemp = obj.clearTemp ? obj.clearTemp : "";
                  if (isForm) {
                    params.urlParams = urlArrayF[1]; //鎼哄甫url鍚庨潰鐨勫弬鏁�
                    let routeData = this.$router.resolve({
                      // name: "form_blank",
                      name: "open",
                      query: params,
                    });
                    window.open(routeData.href, "_blank");
                  } else if (isView) {
                    let routeData = this.$router.resolve({
                      name: "view_blank",
                      query: params,
                    });
                    window.open(routeData.href, "_blank");
                  } else if (isOpenCurrentSoftwareData) {
                    url += "&isOpenNewWindow=true";
                    window.open(url);
                  }
                } else {
                  params = {
                    linkType: "103",
                    appId: op.appId,
                    actionContent: url,
                  };
                  window.open(params.actionContent);
                }
                break;
              case 4:
                break;
              default:
                break;
            }
          }
        },
      });
    },

    //鎻愪氦
    onSubmit(act, docIds) {
      let attitude = this.attitude;
      let appId = this.openParams.appId;
      let doJson = {
        actId: act.id,
        attitude,
        docIds: docIds,
        limistStrList: "",
        remark: "",
      };
      this.$api.batchApprove(appId, doJson, {
        onSucess: (res) => {
          if (res.data.data && res.data.errcode == 0) {
            this.$notify.success({
              title: this.$t("success"),
              message: res.data.data.content,
            });
            this.popupVisible = false;
            this.runAfterAction(act, docIds);
            this.$refs.delegate.reloadListView(); //鍒锋柊
          } else if (res.data.errcode == 0) {
            this.$notify.success({
              title: this.$t("success"),
              message: res.data.data.content,
            });
            this.popupVisible = false;
            this.runAfterAction(act, docIds);
            this.$refs.delegate.reloadListView(); //鍒锋柊
          } else if (res.data.errcode == 4001) {
            this.isBlockClick = false;
            this.$notify.error({
              title: this.$t("msg.err"),
              message: res.data.errmsg,
            });
          }
        },
      });
    },

    //鑾峰彇瑙嗗浘妯℃澘
    getTemplate(act) {
      let op = this.openParams;
      // this.view = "";
      let appId = op.appId;
      let viewId = act.onActionView;
      let exparams = {};
      let st = this.showtype;
      if ((st && st == "tab") || (st && st == "include")) {
        //濡傛灉鏄帶浠堕€夐」鍗℃垨鍖呭惈鍏冪礌
        exparams.parentId = op.parentId;
        exparams.isRelate = op.isRelate;
      }
      exparams.appId = appId;
      exparams.viewId = viewId;
      this.$api.getViewTemplate(appId, viewId, exparams, {
        onSucess: (response) => {
          if (response.data.errcode == 0) {
            setTimeout(() => {
              this.view = response.data.data;
              this.runAfterAction(act, []);
            }, 1000);
            // this.runAfterAction(act, []);//澶栭潰鎵цthis.view浠嶄负''
          }
        },
      });
    },

    //鎵归噺鎻愪氦鎸夐挳寮圭獥
    showSubmitPanel(act, docIds) {
      if (
        (this.currentDocIds && this.currentDocIds.length > 0) ||
        (docIds && docIds.length > 0)
      ) {
        if (docIds && docIds.length > 0) {
          this.currentDocIds = docIds;
        }
        this.currentAct = act;
        this.popupVisible = true;
      } else {
        this.$alert(this.$t("msg.least_one_data"), this.$t("tip"), {
          confirmButtonText: this.$t("msg.confirm"),
          callback: () => { },
        });
      }
    },

    //鏂囦欢涓嬭浇
    fileDownload(divId) {
      let op = this.openParams;
      let appId = op.appId;
      let docId = "";
      let actId = divId;
      let params = {
        parentId: op.parentId ? op.parentId : "",
        isRelate: op.isRelate,
      };
      API.viewDocumentDownload(appId, docId, actId, params, {
        onSucess: (response) => {
          this.isBlockClick = false;
          if (response.data.errcode != 0) {
            this.$notify({
              title: this.$t("form.warning"),
              message: this.$t("view.nofile"),
              type: "warning",
            });
          } else {
            let fileName = "";
            let url = "";
            let contextPath = obpmConfig.contextPath;
            let filePath = response.data.data; //uploads/doc/202108/鏂囨湰妗唒df瀵煎嚭 (7).pdf
            if (
              filePath &&
              (filePath.indexOf("https://") > -1 ||
                filePath.indexOf("http://") > -1)
            ) {
              window.open(encodeURI(filePath));
              return false;
            }
            fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
            url =
              contextPath +
              "/runtime/file/download?filepath=" +
              filePath +
              "&filename=" +
              fileName;
            window.open(encodeURI(url));
          }
          // let type = response.headers['content-type'];
          // if(response.headers['content-disposition']) {
          //   fileName = decodeURIComponent(response.headers['content-disposition'].split("=")[1]);
          // }else {
          //   fileName=this.$t('report.download');
          // }
          // if(response.data.size >0){
          //   this.download(response, type, fileName);
          // }else {
          //   this.$notify({
          //     title: this.$t('form.warning'),
          //     message: this.$t('view.nofile'),
          //     type: 'warning'
          //   });
          // }
        },
        onError: (error) => {
          this.isBlockClick = false;
          if (error.response && error.response.status == 500)
            this.$notify({
              title: this.$t("form.warning"),
              message: this.$t("view.nofile"),
              type: "warning",
            });
        },
      });
    },

    download(res, type, filename, act) {
      const blob = new Blob([res.data], {
        // 濡傛灉鍚庣娌¤繑鍥炰笅杞芥枃浠剁被鍨嬶紝鍒欓渶瑕佹墜鍔ㄨ缃細type: 'application/pdf;chartset=UTF-8' 琛ㄧず涓嬭浇鏂囨。涓簆df锛屽鏋滄槸word鍒欒缃负msword锛宔xcel涓篹xcel
        type: type,
      });
      const a = document.createElement("a");
      const herf = window.URL.createObjectURL(blob);
      // 涓嬭浇閾炬帴
      a.href = herf;
      // 涓嬭浇鏂囦欢鍚�,濡傛灉鍚庣娌℃湁杩斿洖锛屽彲浠ヨ嚜宸卞啓a.download = '鏂囦欢.pdf'
      a.download = filename;
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
      window.URL.revokeObjectURL(herf);
      this.runAfterAction(act, this.currentDocIds);
      setTimeout(() => {
        window.clearInterval(this.task);
        this.exportDialog = false;
        this.isShowProgress = false; //杩涘害鏉′笅杞藉悗闅愯棌
        this.exportProgress = 0; //杩涘害鏉℃暟鍊间笅杞藉悗涓�0
        this.isExporting = false;
      }, 500);
    },

    //Excel瀵煎嚭寮圭獥
    confirmExportFile(act) {
      if (this.exportData === 1 && this.currentDocIds.length === 0) {
        this.$alert(this.$t("msg.least_one_data"), this.$t("tip"), {
          confirmButtonText: this.$t("msg.confirm"),
          type: "warning",
          callback: () => { },
        });
      } else {
        if (this.excelSelectList.length === 0) {
          this.$alert(this.$t("msg.select_list"), this.$t("tip"), {
            confirmButtonText: this.$t("msg.confirm"),
            type: "warning",
            callback: () => { },
          });
          return false;
        }
        if (this.isExporting) {
          return;
        }
        // this.$message({type:'warning',message:'褰撳墠鏈€澶氬彧鑳藉鍑�5000鏉℃暟鎹�'})
        let view = this.view;
        this.isExporting = true;
        let op = this.openParams;
        let applicationId = op.appId,
          viewId = view.id,
          actId = act.id,
          name = view.name,
          isExpSub = act.expSub,
          parentId = "",
          isRelate = undefined;
        let st = this.showtype;
        if ((st && st == "tab") || (st && st == "include")) {
          //濡傛灉鏄帶浠堕€夐」鍗℃垨鍖呭惈鍏冪礌
          (parentId = op.parentId), (isRelate = op.isRelate);
        }
        let params = this.$refs.delegate.getExcelParams();
        let selectDocId = this.exportData == 2 ? [] : this.currentDocIds;
        let sc = this.excelSelectList;
        let selectColumns = sc && sc.length > 0 ? sc.join(",") : "";
        let obj = {
          selectColumns,
          selectDocIds: selectDocId,
          items: {},
        };
        let sd = this.searchDocItems;
        let commonSearchFlag = true; //甯哥敤鏌ヨ鏄惁鏈夊€�
        for (let key in sd) {
          if (sd[key]) {
            commonSearchFlag = false;
          }
        }
        if (commonSearchFlag) {
          //甯哥敤鏌ヨ
          if (this.$refs.searchform) {
            sd = this.$refs.searchform.buildSearchData();
            obj.items = sd;
          }
        }
        debugger
        console.log(view)
        if (view.searchFormId != undefined) {
          //楂樼骇鏌ヨ
          let sfd = this.$refs.delegate.getSearchformBuildData();
          console.log('sfd', sfd)
          console.log('sd', sd)
          sd = Object.assign(sd, sfd);//瀵煎嚭鍏ㄩ儴--鑾峰彇楂樼瓫鎼滅储鏉′欢sfd
          obj.items = sd;
        }
        this.task = setInterval(() => {
          this.$api.exportExcelProgress({
            onSucess: (response) => {
              if (response.data.errcode == 0) {
                let process; //杩涘害鏉℃暟鍊�
                this.isShowProgress = true;
                let excelExportCount = response.data.data.excelExportCount; //鑾峰彇宸茬粡瀵煎嚭鐨勬潯鏁�
                let excelRowCount = response.data.data.excelRowCount; //闇€瑕佸鍑烘€绘潯鏁�
                if (excelRowCount == 0) {
                  //瀵煎嚭绌鸿〃
                  process = 100;
                } else {
                  process = Math.floor(
                    (excelExportCount / excelRowCount) * 100
                  );
                }
                this.exportProgress = process;
                if (process == 100) {
                  window.clearInterval(this.task);
                }
                console.log(excelRowCount);
                if (excelRowCount == 10000) {
                  process = 100;
                  this.$message({
                    type: "warning",
                    message: "褰撳墠鏈€澶氬彧鑳藉鍑�10000鏉℃暟鎹�",
                  });
                  return;
                }
              }
            },
          });
        }, 500);
        this.$api.exportExcel(
          applicationId,
          viewId,
          actId,
          name,
          isExpSub,
          parentId,
          isRelate,
          params,
          obj,
          {
            onSucess: (response) => {
              let fileName = "";
              let type = response.headers["content-type"];
              if (response.headers["content-disposition"]) {
                fileName = decodeURIComponent(
                  response.headers["content-disposition"].split("=")[1]
                );
                let suffix = fileName.split(".")[1];
                fileName = name + "." + suffix;
              } else {
                fileName = this.$t("report.download");
              }
              setTimeout(() => {
                this.isExporting = false;
              }, 1000);

              this.download(response, type, fileName, act);
            },
          }
        );
      }
    },

    //缃戦〉鎵撳嵃
    viewPrint(act) {
      let openParams = this.openParams;
      let view = this.view;
      let routeData = this.$router.resolve({
        name: "printView",
        query: {
          //缁檖rint_view.vue鎺ユ敹
          viewId: this.view.id,
          isPrint: true,
          openType: view.openType,
          simpleClassName: view.simpleClassName,
          appId: openParams.appId,
          isRelate: openParams.isRelate,
          parentId: openParams.parentId,
        },
      });
      window.open(routeData.href, "_blank");
      this.runAfterAction(act, []);
    },

    //瑙嗗浘鎻愪氦娴佺▼鎵撳紑寮圭獥
    viewColumnSubmission(val, docId) {
      this.isSubmissionProcess = val;
      this.viewRowId = docId;
      this.popupVisible = true;
    },

    //寮瑰嚭瀵煎叆Excel鐨勭獥鍙�
    showLeadDialog(act) {
      this.isBlockClick = false;
      this.act = act;
      this.customizeVisible = true;
    },

    onAction(act) {
      console.log(act);
      //缁戝畾瑙嗗浘鐨勫鐞嗕簨浠�
      let actId = act.id;
      let activityType = act.type;     
      switch (act.type) {
        case 1: //杞藉叆瑙嗗浘
          this.runBeforeAction(act);
          // this.v3ActionSubmit(act, "", "", activityType, "", act); //bcx鏇挎崲鍚堝苟涓€涓帴鍙�
          break;
        case 2: //鍒涘缓
          this.isBlockClick = true;
          let formId = this.view.relatedForm;
          this.$api.hasPermissionToForm(this.openParams.appId, formId, {
            onSucess: (res) => {
              if (res.data.data) {
                this.runBeforeAction(act);
                // this.v3ActionSubmit(act, "", "", activityType, "", act); //bcx鏇挎崲鍚堝苟涓€涓帴鍙�
              } else {
                this.isBlockClick = false;
                this.$message({
                  message: this.$t("msg.refuse"),
                  type: "warning",
                });
              }
            },
          });
          break;
        case 3: //鍒犻櫎
          this.doRemove(act);
          break;
        case 5: //娴佺▼澶勭悊
          this.$parent.flowHandle();
          break;
        case 8: //鍏抽棴绐楀彛
          this.$parent.runBeforeAction(act.id, "", "", activityType);
          break;
        case 10: //杩斿洖
          this.doBack();
          break;
        case 11: //淇濆瓨骞惰繑鍥�
          this.$parent.runBeforeAction(act.id, "", "", activityType);
          break;
        case 14: //缃戦〉鎵撳嵃(琛ㄥ崟)
          this.$parent.runBeforeAction(act.id, "", "", activityType);
          break;
        case 15: //缃戦〉鎵撳嵃鍚巻鍙�
          this.$parent.runBeforeAction(act.id, "", "", activityType);
          break;
        case 16: //瀵煎嚭excel
          this.isShowProgress = false;
          this.exportProgress = 0;
          this.runBeforeAction(act);
          break;
        case 18: //娓呯┖鎵€鏈夋暟鎹�
          this.clearDataPopup(act);
          //this.runBeforeAction(act);
          break;
        case 20: //鎵归噺鎻愪氦
          this.showSubmitPanel(act);
          break;
        case 26: //鏂囦欢涓嬭浇
          this.runBeforeAction(act);
          break;
        case 27: //瀵煎叆excel
          this.showLeadDialog(act);
          break;
        case 28: //鐢靛瓙绛剧珷
          break;
        case 29: //鎵归噺绛剧珷
          this.pdfsignatures(act);
          break;
        case 34: //淇濆瓨
          this.$parent.runBeforeAction(act.id, "", "", activityType);
          break;
        case 36: //缃戦〉鎵撳嵃(瑙嗗浘)
          this.runBeforeAction(act);
          break;
        case 37: //閭欢鐭俊鍒嗕韩
          break;
        case 42: //淇濆瓨骞舵柊寤�
          this.$parent.runBeforeAction(act.id, "", "", activityType);
          break;
        case 43: //璺宠浆
          this.runBeforeAction(act);
          break;
        case 46: //绛剧珷
          break;
        default:
          break;
      }
    },

    pdfsignatures(act) {
      this.isBlockClick = false;
      let cd = this.currentDocIds;
      let appId = this.openParams.appId;
      if (cd.length <= 0) {
        this.$message({
          message: this.$t("msg.least_one_data"),
          type: "warning",
        });
      } else {
        this.$api.getPdfsignatures(appId, cd, {
          onSucess: (res) => {
            this.signatureData = res.data.data;
            this.signatureDialog = true;
          },
        });
      }
    },

    //鑾峰彇瀛愮粍浠剁殑閫変腑鐨勬暟鎹�
    selectNum(val) {
      this.checkedNum = val.length;
      // 宸查€変腑鐨勮鍥惧垪琛�
      this.viewTableData.datas = val;
      if (val.length > 0 && val[0] != undefined) {
        let select = "";
        for (let i = 0; i < val.length; i++) {
          select += val[i].docId + ";";
        }
        let params = {
          linkType: "00",
          appId: this.openParams.appId,
          actionContent: val[0].formId,
          _select: select,
          viewId: this.view.id,
        };

        this.$emit("updateViewData", params, val);
      } else {
        this.$emit("updateViewData", [], val);
      }
    },

    gridviewTem(act) {
      this.getTemplate(act);
    },

    clearViewSelect() {
      let openParams = this.openParams;
      let formId = openParams.actionContent;
      if (this.view.displayType && this.view.displayType == "templateForm") {
        //鍒ゆ柇鏄ā鏉胯〃鍗曡繕鏄暟鎹簮琛ㄥ崟
        formId = this.view.templateForm;
      }
      let params = {
        linkType: "00",
        appId: openParams.appId,
        actionContent: formId, //row.formId,
        _select: "",
        viewId: this.view.id,
        parentId: openParams.parentId ? openParams.parentId : "", //鍖呭惈鍏冪礌鏃跺垽鏂槸鍚︽湁parentId
        isRelate: openParams.isRelate ? openParams.isRelate : "", //鍖呭惈鍏冪礌鏃跺垽鏂璱sRelate鏄惁涓簍rue
        templateForm: this.view.templateForm ? this.view.templateForm : "", //妯℃澘琛ㄥ崟鎼哄甫鐨刦ormId
      };
      let isRadio = true;
      this.$emit("updateViewData", params, [], isRadio);
    },

    /**
     * 鏄剧ず宸查€夋嫨鐨勫垪琛�
     */
    showCheckedList() {
      this.checkedListDialog = true;
    },

    /**
     * 鎺ュ彈view_listview浼犻€抰able鐨刢olumn
     */
    getViewTableColumns(val) {
      let tempColumns = [];
      let columnObj = {};
      for (let k in val) {
        columnObj = {
          prop: k,
          label: val[k].name, //瀛楁鍚�
          columnName: val[k].columnName, //鍒楀悕绉�
        };
        tempColumns.push(columnObj);
      }
      this.viewTableData.columns = tempColumns;
    },
    /**
     * 鎺ュ彈view_cardview鐨勪笅涓€灞傜骇鍑虹幇杩斿洖鎸夐挳鐨勬爣蹇�
     */
    cardBackSign(val) {
      this.cardBack = val;
    },

    returnPrevious(val) {
      //鐐瑰嚮杩斿洖瑙﹀彂鐨勪簨浠� 閲嶆柊鍔犺浇涓婁竴娆$殑鏁版嵁 锛堝彲浠ヤ繚鐣欏湪鐖惰妭鐐圭殑鏁版嵁 鍦ㄥ眰鏁伴珮鐨勬椂鍊欏彲浠ヤ娇鐢ㄥ灞傚湪娴忚鍣ㄧ紦瀛樺お澶氫笉鍚堢畻锛�
      this.$refs.delegate.returnPrevious();
      // if(val){
      //  this.cardBack=false;
      // }
      // else{
      // //  this.$refs.view_cardview.
      // }
    },
    // handleSelectionChange(val) {//鍙傝€冨垪琛ㄨ鍥炬妸鏁版嵁浼犲洖鍘�  2涓棶棰樿兘涓嶈兘姝g‘鍥炴樉鍜屾樉绀哄弬鏁�
    //   //灏嗛暱搴︿紶鍥炲幓
    //   // this.$emit('selectNum',val)
    //   if (this.isView) {
    //     //瑙嗗浘閫夋嫨妗�
    //     if (val.length > 0 && val[0] != undefined) {
    //       let select = "";
    //       for (let i = 0; i < val.length; i++) {
    //         select += val[i].docId + ";";
    //       }
    //       let params = {
    //         linkType: "00",
    //         appId: this.openParams.appId,
    //         actionContent: val[0].formId,
    //         _select: select,
    //         viewId: this.view.id,
    //       };
    //       this.$emit("updateViewData", params, val);
    //     }else{
    //       this.$emit("updateViewData", [], val);
    //     }
    //   } else {
    //     let docIds = []
    //     let hasChildren = ""
    //     if (val.length > 0) {
    //       for (let i = 0; i < val.length; i++) {
    //         docIds.push(val[i].docId);
    //         if (val[i].children) {
    //           hasChildren = true
    //         }
    //       }
    //     } else {
    //       docIds = []
    //     }

    //     let sy = this.showtype

    //     if(sy == 'include' || sy == 'tab') { //濡傛灉鏄寘鍚厓绱犳垨鑰卼ab椤碉紝鑾峰彇鐨刣ocId浼犲埌鏈€涓婂眰琛ㄥ崟
    //       this.setListViewDocIds(docIds)
    //     }

    //     this.$emit("getDocIds", docIds, hasChildren);
    //   }
    // },
    //閲嶆瀯鑷畾涔夈€佹櫘閫氭寜閽殑鍔熻兘
    //鏅€氭寜閽�(type=11: 姣斿: 鑰冭瘯鐢虫姤->璧勬牸璇佹姤鍚嶇鐞�->鎶ュ悕浜哄憳->鎶ュ悕->鎻愪氦鎸夐挳),
    //鑷畾涔夋寜閽�(type=13: 姣斿: 鎶ュ悕瀹℃牳 ->瀛﹀憳绠$悊->鏉愭枡瀹℃牳->鎻愪氦瀹℃牳)
    v3ActionSubmit(act, docIds, extraParams) {
      this.isBlockClick = true;
      let view = this.view;
      let sd = this.searchDocItems;
      let openParams = this.openParams;
      let formData = {
        docId: "",
        document: sd ? sd : {},
        formId: view.relatedForm,
        parentId: "",
        templateForm: view.templateForm,
        viewId: openParams.actionContent,
        _selects: docIds && docIds.length > 0 ? docIds : this.currentDocIds,
      };
      this.cvFormData = formData; //澶嶅埗runBeforeAction鐨勫弬鏁癴ormdata锛屼繚瀛樺湪cvFormData閲岀敤浜庣粰getAxecuteAddress浼犲弬
      let st = this.showtype;
      if ((st && st == "tab") || (st && st == "include")) {
        //濡傛灉鏄帶浠堕€夐」鍗℃垨鍖呭惈鍏冪礌
        formData.parentId = openParams.parentId;
        formData.isRelate = openParams.isRelate;
      }
      let treedocid = "";
      if (extraParams && extraParams.treedocid) {
        treedocid = extraParams.treedocid;
        formData.treedocid = extraParams.treedocid;
        formData.document = extraParams.document;
      }
      if (openParams.isRelate) {
        formData.isRelate = openParams.isRelate;
      }
      if (openParams.parentId) {
        formData.parentId = openParams.parentId;
      }
      if (this.$route.query) {
        formData = { ...formData, ...this.$route.query };
      }
      debugger
      let divId = act.id;
      let actType = act.type;
      
      //閲嶆瀯start  
      let step = "BeforeAction";
      this.v3Activities(
          step,
          openParams.appId,
          divId,
          formData,
          actType,
          treedocid ? treedocid : "", //treedocid
          "", //flowType
          act
        ); //閲嶆瀯鎵ц鍓嶄唬鐮�
        //閲嶆瀯end

      
    },
    v3Activities(step,appId,divId,formData,actType,treedocid,flowType,act){
      API.v3ActivitiesApi(
        step,
        appId,
        divId,
        formData,
        actType,
        treedocid ? treedocid : "", //treedocid
        flowType, //flowType
        {
          onSucess: (response) => {
            if (response.data.data) {
              this.isBlockClick = false;
              //濡傛灉鏈夋暟鎹繑鍥烇紝缁撴潫涓嬩竴姝�
              let resData = response.data.data;
              let errmsg = response.data.data.content;
              if (!resData.type) {
                //娌℃湁type鍊硷紝浣嗘槸鏈夎繑鍥炴暟鎹紝鎶婃暟鎹斁杩沝ocument
                if (resData.changedField) {
                  this.$notify.success({
                    title: resData.content,
                    message: "",
                  });
                }
              } else if (resData.type == 1) {
                if (resData.content == "绔欏唴淇″彂閫佹垚鍔�") {
                  this.$notify.success({
                    title: resData.content,
                    message: "",
                  });
                } else {
                  this.$notify.error({
                    title: errmsg,
                    message: "",
                    customClass: "notify-success", //杞藉叆瑙嗗浘鎵ц鍓嶈剼鏈繑鍥炲€兼樉绀轰负绾㈣壊
                  });
                }
              } else if (resData.type == 16) {
                this.$notify.error({
                  title: errmsg,
                  message: "",
                });
              } else if (resData.type == 32) {
                this.$confirm(`${errmsg}`, this.$t("tip"), {
                  confirmButtonText: this.$t("msg.confirm"),
                  cancelButtonText: this.$t("btns.cancel"),
                  type: "warning",
                })
                  .then(() => {
                    let step=response.data.data.next-step
                    this.v3Activities(step,appId,divId,formData,actType,treedocid,flowType,act) //閲嶆瀯鎵ц鍓嶄唬鐮�  
                    switch (act.type) {
                      case 1: //杞藉叆瑙嗗浘
                        this.getTemplate(act);
                        break;
                      case 2: //鏂板缓琛ㄥ崟
                        this.doCreate(act, extraParams);
                        break;
                      case 3: //鍒犻櫎鏁版嵁
                        this.removeDocuments(act, docIds);
                        break;
                      case 16: //瀵煎嚭excel
                        // debugger
                        this.isBlockClick = false;
                        this.currentClickBtnAct = act;
                        let excelColumns = [];
                        let columns = this.copyColumns;
                        let selectAll = [];
                        for (let i = 0; i < columns.length; i++) {
                          if (columns[i].visible4ExpExcel) {
                            excelColumns.push(columns[i]);
                          }
                          selectAll.push(columns[i].name);
                        }
                        this.excelColumns = excelColumns;
                        this.excelSelectList = selectAll;
                        this.exportDialog = true;
                        this.switchValue = true;
                        this.exportData = 1;
                        break;
                      case 18: //娓呯┖鎵€鏈夋暟鎹�
                        this.clearAllData(act);
                        break;
                      case 20: //鎵归噺鎻愪氦
                        this.onSubmit(act, docIds);
                        break;
                      case 26: //鏂囦欢涓嬭浇
                        this.fileDownload(act.id);
                        break;
                      case 27: //瀵煎叆excel
                        this.showLeadDialog(act);
                        break;
                      case 36: //缃戦〉鎵撳嵃(瑙嗗浘)
                        this.viewPrint(act);
                        break;
                      case 43: //璺宠浆
                        this.jumpType(act);
                        break;
                      default:
                        break;
                    }
                  })
                  .catch(() => {});
              }
            } else {
              switch (act.type) {
                case 1: //杞藉叆瑙嗗浘
                  this.getTemplate(act);
                  break;
                case 2: //鏂板缓琛ㄥ崟
                  this.doCreate(act, extraParams);
                  break;
                case 3: //鍒犻櫎鏁版嵁
                  this.removeDocuments(act, docIds);
                  break;
                case 16: //瀵煎嚭excel
                  // debugger
                  this.isBlockClick = false;
                  this.currentClickBtnAct = act;
                  let excelColumns = [];
                  let columns = this.copyColumns;
                  let selectAll = [];
                  console.log(columns)
                  for (let i = 0; i < columns.length; i++) {
                    if (columns[i].visible4ExpExcel) {
                      excelColumns.push(columns[i]);
                    }
                    selectAll.push(columns[i].name);
                  }
                  this.excelColumns = excelColumns;
                  this.excelSelectList = selectAll;
                  this.exportDialog = true;
                  this.switchValue = true;
                  this.exportData = 1;
                  break;
                case 18: //娓呯┖鎵€鏈夋暟鎹�
                  this.clearAllData(act);
                  break;
                case 20: //鎵归噺鎻愪氦
                  this.onSubmit(act, docIds);
                  break;
                case 26: //鏂囦欢涓嬭浇
                  this.fileDownload(act.id);
                  break;
                case 27: //瀵煎叆excel
                  this.showLeadDialog(act);
                  break;
                case 29:
                  break;
                case 36: //缃戦〉鎵撳嵃(瑙嗗浘)
                  this.viewPrint(act);
                  break;
                case 43: //璺宠浆
                  this.jumpType(act);
                  break;
                default:
                  break;
              }
            }

            // if(response.data.errcode == 0 && response.data.data) {
            //   let errcode = response.data.errcode;
            //   let errmsg = response.data.data.content;
            //   this.$notify.error({
            //     title: errmsg,
            //     message: ''
            //   });
            // }else if(response.data.errcode == 0){
            //   switch(act.type) {
            //     case 1: //杞藉叆瑙嗗浘
            //       this.getTemplate(act);
            //       break;
            //     case 2: //鏂板缓琛ㄥ崟
            //       this.doCreate(act);
            //       break;
            //     case 3: //鍒犻櫎鏁版嵁
            //       this.removeDocuments(act,docIds);
            //       break;
            //     case 16: //瀵煎嚭excel
            //       this.currentClickBtnAct = act;
            //       let selectAll = [];
            //       let columns = this.view.columns;
            //       columns.forEach(el => {
            //         selectAll.push(el.name);
            //       });
            //       this.excelSelectList = selectAll;
            //       this.exportDialog = true;
            //       break;
            //     case 18: //娓呯┖鎵€鏈夋暟鎹�
            //       this.clearAllData(act);
            //       break;
            //     case 20: //鎵归噺鎻愪氦
            //       this.onSubmit(act, docIds);
            //       break;
            //     case 26: //鏂囦欢涓嬭浇
            //       this.fileDownload(act.id);
            //       break;
            //     case 36: //缃戦〉鎵撳嵃(瑙嗗浘)
            //       this.viewPrint(act);
            //       break;
            //     case 43: //璺宠浆
            //       this.jumpType(act);
            //       break;
            //     default:
            //       break;
            //   }
            // }
          },
        }
      );
    }
  },

  computed: {
    viewType() {
      //let type = "view_emptyview";
      let type = "";
      if (this.view) {
        switch (this.view.simpleClassName) {
          case "CollapsibleView": //鎶樺彔瑙嗗浘
            if (this.view.collapsibleShowMode == "card") {
              type = "view_cardview";
            } else {
              type = "view_collapsibleview";
            }

            break;
          case "CalendarView": //鏃ュ巻瑙嗗浘
            type = "view_calendarview";
            break;
          case "TreeView": //鏍戝舰瑙嗗浘
            type = "view_treeview";
            break;
          case "MapView": //鍦板浘瑙嗗浘
            type = "view_mapview";
            break;
          case "GanttView": //鐢樼壒瑙嗗浘
            type = "view_gantt";
            break;
          case "ListView": //鍒楄〃瑙嗗浘
            if (this.view.openType == 288) {
              //缃戞牸鎵撳紑
              type = "view_gridview";
            } else {
              //姝e父鎵撳紑
              type = "view_listview";
            }
            break;
          default:
        }
      }
      return type;
    },

    listenIncludeViewUpdate() {
      return this.$store.state.includeViewId;
    },
  },
};
</script>

<style lang="scss">
.notify-success .el-notification__title {
  color: red;
}

.notify-success .el-icon-success {
  color: red;
}

//瑙嗗浘鍥剧墖鐐瑰嚮寮圭獥鏄剧ず棰勮
.delegate .picture-preview-wrap {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  top: 0;
  left: 0;
  z-index: 9999;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.delegate .picture-preview-wrap .picture-list {
  height: 100%;
  width: 90%;
}

.delegate .picture-preview-wrap .picture-list .el-carousel {
  position: relative;
  height: 100%;
}

.delegate .picture-preview-wrap .picture-list .el-carousel .el-carousel__container {
  position: relative;
  height: 100%;
}

.delegate .picture-preview-wrap .picture-list .el-carousel .el-carousel__container .el-carousel__item {
  width: 100%;
  display: inline-block;
  overflow: hidden;
  z-index: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.delegate .picture-preview-wrap .icon-dlose {
  position: absolute;
  top: 0;
  right: 0;
  width: 50px;
  height: 50px;
  text-align: center;
  line-height: 50px;
  font-size: 40px;
  color: #696c70;
  cursor: pointer;
}
</style>