<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--分类数据-->
      <el-col :span="4" :xs="24">
        <div class="head-container">
          <el-input v-model="itemTypeName" clearable size="small" prefix-icon="el-icon-search"
            style="margin-bottom: 20px" />
        </div>
        <div class="head-container" style="overflow: auto;">
          <el-tree :data="itemTypeOptions" :props="defaultProps" :expand-on-click-node="false" class="el-tree-pro" node-key="id"
            :filter-node-method="filterNode" ref="tree" :default-expanded-keys="defaultExpandedKeys" @node-click="handleNodeClick" >
            <span slot-scope="{ data }" :title="data.label"
              >{{ data.label }}</span>
          </el-tree>
        </div>
      </el-col>
      <!--物料数据-->
      <el-col :span="20" :xs="24">
        <el-form :model="queryParams" @submit.native.prevent ref="queryForm" size="small" :inline="true" v-show="showSearch"
          label-width="68px">
          <el-form-item :label="$t('物料编码')" prop="itemCode">
            <el-input v-model="queryParams.itemCode" clearable style="width: 240px"
              @keyup.enter.native="handleQuery" />
          </el-form-item>
          <el-form-item :label="$t('物料名称')" prop="itemName">
            <el-input v-model="queryParams.itemName" clearable style="width: 240px"
              @keyup.enter.native="handleQuery" />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('common.search') }}</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('common.reset') }}</el-button>
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">{{ $t('common.add') }}</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
              @click="handleUpdate">{{ $t('common.edit') }}</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
              @click="handleDelete">{{ $t('common.del') }}</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="success" plain size="mini"
              @click="handleSyncData">{{$t('ERP数据同步')}}</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport">{{ $t('common.import') }}</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">{{ $t('common.export') }}</el-button>
          </el-col>
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
        </el-row>

        <el-table v-loading="loading" :data="itemList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column :label="$t('物料编码')" width="120" align="center" key="itemCode" prop="itemCode"
            v-if="columns[0].visible">
            <template slot-scope="scope">
              <el-button size="mini" type="text" @click="handleView(scope.row)">{{ scope.row.itemCode }}</el-button>
            </template>
          </el-table-column>
          <el-table-column :label="$t('物料名称')" min-width="120" align="left" key="itemName" prop="itemName"
            v-if="columns[1].visible" :show-overflow-tooltip="true" />
          <el-table-column :label="$t('产品图号')" align="left" key="customerDrawingNo" prop="customerDrawingNo" v-if="columns[9].visible"
          :show-overflow-tooltip="true" />
          <el-table-column :label="$t('规格型号')" align="left" key="specification" prop="specification" v-if="columns[2].visible"
            :show-overflow-tooltip="true" />
          <el-table-column :label="$t('单位')" align="center" key="unitOfMeasure" prop="unitOfMeasure" v-if="columns[3].visible"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column :label="$t('所属产线')" align="center" key="lineName" prop="lineName" v-if="columns[4].visible" :show-overflow-tooltip="true" >
          </el-table-column>

          <el-table-column :label="$t('所属分类')" align="center" key="itemTypeName" prop="itemTypeName" v-if="columns[5].visible"
            width="120" />
          <el-table-column :label="$t('是否启用')" align="center" key="enableFlag" v-if="columns[6].visible">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag" />
            </template>
          </el-table-column>
          <el-table-column :label="$t('common.create_time')" align="center" prop="createTime" v-if="columns[8].visible" width="160">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column :label="$t('common.option')" align="center" width="160" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">{{ $t('common.edit') }}</el-button>
              <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">{{ $t('common.del') }}</el-button>
            </template>
          </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize" @pagination="getList" />
      </el-col>
    </el-row>

    <!-- 添加或修改物料产品编码对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('物料编码')" prop="itemCode">
              <el-input v-model="form.itemCode" readonly="readonly" maxlength="64" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('物料名称')" prop="itemName">
              <el-input v-model="form.itemName" maxlength="255" readonly="readonly" v-if="optType == 'view'" />
              <el-input v-model="form.itemName" maxlength="255" v-else />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item :label="$t('规格型号')" prop="specification">
              <el-input v-model="form.specification" type="textarea" maxlength="500" readonly="readonly"
                v-if="optType == 'view'" />
              <el-input v-model="form.specification" type="textarea" maxlength="500" v-else />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('单位')" prop="unitOfMeasure">
              <el-select v-model="form.unitOfMeasure" disabled v-if="optType == 'view'">
                <el-option v-for="item in measureOptions" :key="item.measureCode" :label="item.measureName"
                  :value="item.measureCode" :disabled="item.enableFlag == 'N'"></el-option>
              </el-select>

              <el-select v-model="form.unitOfMeasure" filterable v-else>
                <el-option v-for="item in measureOptions" :key="item.measureCode" :label="item.measureName"
                  :value="item.measureCode" :disabled="item.enableFlag == 'N'"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('物料/产品分类')" prop="itemTypeId">
              <treeselect v-model="form.itemTypeId" :options="itemTypeOptions" :show-count="true" disabled
                v-if="optType == 'view'" />
              <treeselect v-model="form.itemTypeId" :options="itemTypeOptions" :show-count="true" @select="changeTree"
                v-else :disable-branch-nodes="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('产品代号')" prop="itemNo">
              <el-input v-model="form.itemNo" maxlength="255" readonly="readonly" v-if="optType == 'view'" />
              <el-input v-model="form.itemNo" maxlength="255" v-else />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('英文名称')" prop="itemEnglishName">
              <el-input v-model="form.itemEnglishName" maxlength="255" readonly="readonly" v-if="optType == 'view'" />
              <el-input v-model="form.itemEnglishName" maxlength="255" v-else />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item :label="$t('是否启用')">
              <el-radio-group v-model="form.enableFlag" disabled v-if="optType == 'view'">
                <el-radio v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.value">{{ dict.label
                  }}</el-radio>
              </el-radio-group>
              <el-radio-group v-model="form.enableFlag" v-else>
                <el-radio v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.value">{{ dict.label
                  }}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item :label="$t('common.remark')">
              <el-input v-model="form.remark" type="textarea" readonly v-if="optType == 'view'"></el-input>
              <el-input v-model="form.remark" type="textarea" v-else></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-tabs type="border-card" v-model="activeName" @tab-click="onTabClick"
        v-if="form.itemId != null && form.itemOrProduct == 'PRODUCT'">
        <el-tab-pane :label="$t('基本信息')" name="BaseInfo">
          <BaseInfo ref="BaseInfo" :optType="optType" :itemId="form.itemId"></BaseInfo>
        </el-tab-pane>
        <!-- <el-tab-pane label="产品特性" name="SpecProperty">
          <SpecProperty ref="SpecProperty" :optType="optType" :itemId="form.itemId"></SpecProperty>
        </el-tab-pane>
        <el-tab-pane label="销售单位转换" name="SaleUnit">
          <SaleUnit ref="SaleUnit" :optType="optType" :itemId="form.itemId"></SaleUnit>
        </el-tab-pane>
        <el-tab-pane label="工厂信息" name="Factory">
          <Factory ref="Factory" :optType="optType" :itemId="form.itemId"></Factory>
        </el-tab-pane> -->
        <!--        <el-tab-pane label="客户信息">
          <Customer :optType="optType" :itemId="form.itemId"></Customer>
        </el-tab-pane>-->
        <el-tab-pane :label="$t('产品外观')" name="Look">
          <Look ref="Look" :optType="optType" :itemId="form.itemId"></Look>
        </el-tab-pane>
        <el-tab-pane :label="$t('生产版本')" name="ProductionPlan">
          <ProductionPlan ref="ProductionPlan" :optType="optType" :itemId="form.itemId"></ProductionPlan>
        </el-tab-pane>
      </el-tabs>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="cancel" v-if="optType == 'view'">{{ $t('common.back') }}</el-button>
        <el-button type="primary" @click="submitForm" v-else>{{ $t('common.confirm') }}</el-button>
        <el-button @click="cancel">{{$t('关 闭')}}</el-button>
      </div>
    </el-dialog>

    <!-- 物料导入对话框 -->

    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">{{$t('将文件拖到此处，或')}}<em>{{$t('点击上传')}}</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" />{{$t('是否更新已经存在的用户数据')}}</div>
          <span>{{$t('仅允许导入xls、xlsx格式文件。')}}</span>
          <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
            @click="importTemplate">{{$t('下载模板')}}</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">{{ $t('common.confirm') }}</el-button>
        <el-button @click="upload.open = false">{{ $t('common.cancel') }}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>


import {
  listMdItem,
  getMdItem,
  delMdItem,
  addMdItem,
  updateMdItem,
  becomeFormalProduct,
  syncData
} from "@/api/mes/md/mdItem";

import BaseInfo from "./components/baseInfo.vue";
import Look from "./components/look.vue";
import ProductionPlan from "./components/productionPlan.vue";
import { listAllUnitmeasure } from "@/api/mes/md/unitmeasure";
import { genCode } from "@/api/system/autocode/rule";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/mes/md/itemtype";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  name: "MdItem",
  dicts: ["sys_yes_no", "mes_item_product"],
  components: {
    Treeselect,
    BaseInfo,
    Look,
    ProductionPlan,

  },
  data() {
    return {
      activeName: "BaseInfo",
      defaultExpandedKeys: [],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 物料产品表格数据
      itemList: null,
      // 弹出层标题
      title: "",
      // 部门树选项
      itemTypeOptions: undefined,
      // 是否显示弹出层
      open: false,
      //弹框的操作类型 view add edit
      optType: undefined,
      // 部门名称
      itemTypeName: undefined,
      //自动生成物料编码标识
      autoGenFlag: true,
      // 日期范围
      dateRange: [],
      //单位列表
      measureOptions: [],
      // 表单参数
      form: {},
      defaultProps: {
        children: "children",
        label: "label",
      },
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/mes/md/mditem/importData",
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        itemCode: undefined,
        itemName: undefined,
        itemTypeId: 0,
      },
      // 列信息
      columns: [
        { key: 0, label: this.$t('物料/产品编码'), visible: true },
        { key: 1, label: this.$t('物料/产品名称'), visible: true },
        { key: 2, label: this.$t('规格型号'), visible: true },
        { key: 3, label: this.$t('单位'), visible: true },
        { key: 4, label: this.$t('物料/产品'), visible: true },
        { key: 5, label: this.$t('物料分类'), visible: true },
        { key: 6, label: this.$t('是否启用'), visible: true },
        { key: 7, label: this.$t('是否设置安全库存'), visible: true },
        { key: 8, label: this.$t('创建时间'), visible: true },
        { key: 9, label: this.$t('产品图号'), visible: true },
      ],
      // 表单校验
      rules: {
        itemCode: [
          { required: true, message: this.$t('物料/产品编码不能为空'), trigger: "blur" },
          {
            max: 64,
            message: this.$t('物料/产品编码长度必须小于64个字符'),
            trigger: "blur",
          },
        ],
        itemName: [
          { required: true, message: this.$t('物料/产品名称不能为空'), trigger: "blur" },
        ],
        unitOfMeasure: [
          { required: true, message: this.$t('单位不能为空'), trigger: "blur" },
        ],
        itemTypeId: [
          { required: true, message: this.$t('物料分类不能为空'), trigger: "blur" },
        ],
      },
    };
  },
  watch: {
    // 根据名称筛选分类树
    itemTypeName(val) {
      this.$refs.tree.filter(val);
    },
  },
  created() {
    this.getList();
    this.getTreeselect();
    this.getUnits();
  },
  methods: {
    /** 查询物料编码列表 */
    getList() {
      this.loading = true;
      listMdItem(this.queryParams).then((response) => {
        this.itemList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    handleSyncData() {
      syncData().then((response) => {
        this.$modal.msgSuccess(response.msg);
        this.getList()
      });
    },
    getUnits() {
      listAllUnitmeasure().then((response) => {
        this.measureOptions = response.data;
      });
    },
    /** 查询分类下拉树结构 */
    getTreeselect() {
      treeselect().then((response) => {
        this.itemTypeOptions = response.data;
        if(response.data.length > 0) {
          this.defaultExpandedKeys.push(response.data[0]?.id)
        }
      });
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    // 节点单击事件
    handleNodeClick(data) {
      this.queryParams.itemTypeId = data.id;
      this.handleQuery();
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        itemId: undefined,
        itemTypeId: undefined,
        itemCode: undefined,
        message: undefined,
        itemName: undefined,
        specification: undefined,
        unitOfMeasrue: undefined,
        itemOrProduct: undefined,
        enableFlag: "Y",
        safeStockFlag: "N",
        minStock: 0,
        maxStock: 0,
        optType: undefined,
        remark: undefined,
      };
      this.autoGenFlag = true;
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.itemId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    // 查询明细按钮操作
    handleView(row) {
      this.reset();
      this.getTreeselect();
      const itemId = row.itemId || this.ids;
      getMdItem(itemId).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = this.$t('查看物料/产品');
        this.optType = "view";
      });
    },
    changeTree(row){
      this.form.itemTypeId = row.id
      this.form.itemTypeName = row.label
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.getTreeselect();
      this.handleAutoGenChange(true);
      if (this.queryParams.itemTypeId != 0) {
        this.form.itemTypeId = this.queryParams.itemTypeId;
      }
      this.activeName = "BaseInfo";
      this.optType = "add";
      this.open = true;
      this.title = this.$t('新增物料/产品');
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.getTreeselect();
      this.activeName = "BaseInfo";
      const itemId = row.itemId || this.ids;
      getMdItem(itemId).then((response) => {
        this.form = response.data;
        this.open = true;
        this.optType = "edit";
        this.title = this.$t('修改物料/产品');
      });
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate(async (valid) => {
        if (valid) {
          if (this.form.itemId != undefined) {
            //基本信息保存
            const baseInfoData = await this.$refs["BaseInfo"].getBaseInfoData();
            baseInfoData.itemId = this.form.itemId;
            //产品外观保存
            const lookData = await this.$refs["Look"].getLookFormData();
            lookData.itemId = this.form.itemId;

            //产品参数配置保存  publishedConf
            const publishedConfData = await this.$refs[
              "PublishedConf"
            ].getPublishedConfData();
            publishedConfData.itemId = this.form.itemId;

            //销售单位转换保存
            //const saleUnit = await this.$refs["SaleUnit"].getSaleUnitFormData();
            //saleUnit.itemId = this.form.itemId;

            const params = {
              ...this.form,
              baseInfo: baseInfoData,
              look: lookData,
              publishedConf: publishedConfData,
              //saleUnit: saleUnit
            };
            updateMdItem(params).then((response) => {
              this.$modal.msgSuccess(this.$t('common.edit_success'));
              this.open = false;
              this.getList();
            });
          } else {
            debugger;
            addMdItem(this.form).then((response) => {
              this.$modal.msgSuccess(this.$t('common.add_success'));
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const itemIds = row.itemId || this.ids;
      this.$modal
        .confirm(this.$t('确认删除数据项？'))
        .then(function () {
          return delMdItem(itemIds);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess(this.$t('common.del_success'));
        })
        .catch(() => { });
    },
    /** 临时产品转正式按钮操作 */
    handBecomeFormalProduct(row) {
      const itemIds = row.itemId || this.ids;
      this.$modal
        .confirm(this.$t('确认转正式产品？'))
        .then(function () {
          return becomeFormalProduct(itemIds);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess(this.$t('转正式成功'));
        })
        .catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "mes/md/mditem/export",
        {
          ...this.queryParams,
        },
        `md_item_${new Date().getTime()}.xlsx`
      );
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = this.$t('物料/产品导入');
      this.upload.open = true;
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download(
        "mes/md/mditem/importTemplate",
        {},
        `md_item_${new Date().getTime()}.xlsx`
      );
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(
        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
        response.msg +
        "</div>",
        this.$t('导入结果'),
        { dangerouslyUseHTMLString: true }
      );
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
    //自动生成物料编码
    handleAutoGenChange(autoGenFlag) {
      if (autoGenFlag) {
        genCode("ITEM_CODE").then((response) => {
          this.form.itemCode = response;
        });
      } else {
        this.form.itemCode = null;
      }
    },
    onTabClick() {
      if (this.activeName === "SapBaseInfoProperty") {
        this.$refs.SapBaseInfoProperty.init(
          2,
          "sapBaseInfo",
          this.form.itemId,
          this.form
        );
      } else if (this.activeName === "SapSaleProperty") {
        this.$refs.SapSaleProperty.init(
          2,
          "sapSale",
          this.form.itemId,
          this.form
        );
      } else if (this.activeName === "SapPurchaseProperty") {
        this.$refs.SapPurchaseProperty.init(
          2,
          "sapPurchase",
          this.form.itemId,
          this.form
        );
      } else if (this.activeName === "SapPMCProperty") {
        this.$refs.SapPMCProperty.init(
          2,
          "sapPMC",
          this.form.itemId,
          this.form
        );
      } else if (this.activeName === "SapStorageProperty") {
        this.$refs.SapStorageProperty.init(
          2,
          "sapStorage",
          this.form.itemId,
          this.form
        );
      } else if (this.activeName === "SapQAProperty") {
        this.$refs.SapQAProperty.init(2, "sapQA", this.form.itemId, this.form);
      } else if (this.activeName === "SapFinanceProperty") {
        this.$refs.SapFinanceProperty.init(
          2,
          "sapFinance",
          this.form.itemId,
          this.form
        );
      } //else this.$refs[this.activeName].init && this.$refs[this.activeName].init(this.form)
    },
  },
};
</script>
<style scoped>
.el-tree-pro {
  height: 700px;
  padding-right: 5px;
}
.el-tree-pro .el-tree-node__content span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
