<template>
  <div class="page-wrapper">
    <breadcrumb v-if="!multiPage" :breadcrumb-data="breadcrumbData" />
    <div class="page-container">
      <a-form-model
        ref="ruleForm"
        :model="form"
        :rules="rules"
        :label-col="{ span: 7 }"
        :wrapper-col="{ span: 17 }"
      >
        <a-collapse
          v-model="activeKey"
          expand-icon-position="right"
          class="collapse-header-divide"
        >
          <a-collapse-panel key="a" :header="$t('BASE_INFO')">
            <a-row :gutter="24">
              <a-col :span="8">
                <a-form-model-item :label="$t('CODE')" prop="code" allow-clear>
                  <a-input
                    v-model="form.code"
                    :placeholder="`${$t('SYSTEM_DEFAULT_CODE')}${$t(
                      'DATE'
                    )}+${$t('NUMBER')}`"
                    @change="form.code = form.code.slice(0, 50).trim()"
                  />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item :label="$t('TITLE')" prop="name" allow-clear>
                  <a-input
                    v-model="form.name"
                    :placeholder="$t('PLACEENTER')"
                    @change="form.name = form.name.slice(0, 50).trim()"
                  />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item
                  :label="$t('TARGET_PLANT')"
                  prop="toSiteCode"
                  allow-clear
                >
                  <a-select
                    v-model="form.toSiteCode"
                    :placeholder="$t('PLACEENTER')"
                    @change="siteChange"
                  >
                    <a-select-option
                      v-for="(item, index) in sitePermission"
                      :key="index"
                      :value="item.siteCode"
                      >{{ item.siteName }}</a-select-option
                    >
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item
                  :label="$t('TRANSFER_TARGET_POSITION')"
                  prop="locationFirstIdArr"
                >
                  <a-cascader
                    v-model="form.locationFirstIdArr"
                    :placeholder="$t('PLACESELECT')"
                    :options="currentOptions"
                    :field-names="fieldNames"
                  >
                    <template
                      slot="displayRender"
                      slot-scope="{ labels, selectedOptions }"
                    >
                      <span
                        v-for="(label, index) in labels"
                        :key="selectedOptions[index].value"
                      >
                        <span v-if="index !== 0">
                          {{ label }}
                          {{ index !== labels.length - 1 ? "/" : "" }}</span
                        >
                      </span>
                    </template>
                  </a-cascader>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item
                  :label="$t('LENDING_DEPARTMENT')"
                  prop="fromDeptId"
                >
                  <a-tree-select
                    v-model="form.fromDeptId"
                    :replace-fields="treeProps"
                    tree-check-strictly
                    :tree-data="treeData"
                    allow-clear
                    @change="handChangeFromDep"
                  />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item :label="$t('LENDER')" prop="fromUserId">
                  <template>
                    <div style="position: relative">
                      <select-user
                        ref="selectUser"
                        v-model="form.fromUserId"
                        :multiple="false"
                        show-key="name"
                        :default-selected-rows="selectedFromUser"
                        :search-params="searchFromParams"
                        @confirm="getReturnFromData"
                      />
                    </div>
                  </template>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item
                  :label="$t('BORROW_FACTORY')"
                  prop="fromSiteCode"
                  allow-clear
                >
                  <a-select
                    v-model="form.fromSiteCode"
                    :placeholder="$t('PLACEENTER')"
                    @change="siteFromChange"
                  >
                    <a-select-option
                      v-for="(item, index) in sitePermission"
                      :key="index"
                      :value="item.siteCode"
                      >{{ item.siteName }}</a-select-option
                    >
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item :label="$t('RECEIVER_DEPT')" prop="toDeptId">
                  <a-tree-select
                    v-model="form.toDeptId"
                    :replace-fields="treeProps"
                    tree-check-strictly
                    :tree-data="treeData"
                    allow-clear
                    @change="handChangeToDep"
                  />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item :label="$t('RECIPIENT')" prop="toUserId">
                  <template>
                    <div style="position: relative">
                      <select-user
                        ref="selectUser"
                        v-model="form.toUserId"
                        :multiple="false"
                        show-key="name"
                        :default-selected-rows="selectedToUser"
                        :search-params="searchToParams"
                        @confirm="getToReturnData"
                      />
                    </div>
                  </template>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item
                  :label="$t('AUDIT_PROCESS')"
                  prop="checkProcessId"
                >
                  <SelectSearch
                    :show-multiple="false"
                    query-list-key="searchKey"
                    request-api="/api/epm/ebs/epm-check-process/search?checkProcessTypeList=BORROW_CHECK"
                    option-label="checkProcessName"
                    option-value="id"
                    :default-selected-keys="form.checkProcessId"
                    :default-selected-names="form.checkProcessName"
                    :search-params="{
                      siteCode: form.fromSiteCode,
                    }"
                    @change="onSelectSearchChange"
                  />
                </a-form-model-item>
              </a-col>
              <a-col v-if="form.hasOwnProperty('remark')" :span="8">
                <a-form-model-item :label="$t('REMARK')" prop="remark">
                  <a-input
                    v-model="form.remark"
                    :placeholder="$t('PLACEENTER')"
                    onkeyup="value=value.slice(0, 50)"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-collapse-panel>
        </a-collapse>
        <a-collapse
          v-model="activeKeyB"
          expand-icon-position="right"
          class="collapse-header-divide"
        >
          <a-collapse-panel key="b" :header="$t('EQUIPMENT_LIST')">
            <MomTable
              ref="MomTable"
              row-key="itemName"
              :action-buttons="actionButtons"
              :columns="columns"
              :data-source="eqpList"
              :pagination="false"
              @delete="handleDelete"
            >
              <div slot="toolbar" class="button-top-table">
                <a-button @click="handleselectEqp()">{{
                  `${$t("ADD")}`
                }}</a-button>
              </div>
              <div slot="itemType" slot-scope="text, record">
                <span>{{ getAttrValue(itemTypeList, record.itemType) }}</span>
              </div>
              <div slot="imgFlag" slot-scope="text, record">
                <span>{{ getAttrValue(yesNoList, record.imgFlag) }}</span>
              </div>
              <div slot="checkStyle" slot-scope="text, record">
                <span>{{
                  getAttrValue(checkStyleList, record.checkStyle)
                }}</span>
              </div>
              <template slot="assetsStatus" slot-scope="text, record">
                <span class="status-box" :class="text">{{
                  formatData(assetsStatusList, record.assetsStatus)
                }}</span>
              </template>
            </MomTable>
          </a-collapse-panel>
        </a-collapse>
        <!-- 扩展字段 -->
        {{ fieldExRenderFn($createElement, { layout: "grid", itemSpan: 8 }) }}
        <slot name="RenderFieldExtendDom"></slot>
      </a-form-model>
    </div>
    <div class="page-bottom-op">
      <a-button
        type="primary"
        :loading="confirmLoading"
        @click="handleSave('save')"
      >
        <i class="iconfont icon-baocun"></i>
        {{ $t("SAVE") }}
      </a-button>
      <a-button
        :loading="confirmLoading"
        type="primary"
        @click="handleSave('saveAndApproval')"
      >
        <i class="iconfont icon-baocun"></i>
        {{ $t("SAVE_AND_SUBMIT_FOR_APPROVAL") }}
      </a-button>
      <a-button
        :loading="confirmLoading"
        type="primary"
        @click="handleSave('saveAndAdd')"
      >
        <i class="iconfont icon-baocun"></i>
        {{ $t("SAVE_AND_ADD_NEXT") }}
      </a-button>
      <a-button @click="handleCancel">
        <i class="iconfont icon-quxiao"></i>
        {{ $t("CANCEL") }}
      </a-button>
    </div>
    <!-- 选择点检项目组件 -->
    <select-eqp
      ref="selectEqp"
      show-key="id"
      :show-slot="false"
      :search-params="{
        siteCode: form.fromSiteCode,
      }"
      :default-selected-rows="eqpList"
      @confirm="getEqpReturnData"
    />
  </div>
</template>

<script>
import { mapState } from "vuex";
import { deleteLeafArray } from "@mega-apps/utils";
import { uniqBy } from "lodash";
import ApiConstant from "@/api/ApiConstant";
import FieldExtendMixin from "@/mixins/fieldExtend";
import breadcrumb from "@/components/breadcrumb";
import SelectEqp from "@/components/SelectEqp";

export default {
  components: {
    breadcrumb,
    SelectEqp,
  },
  mixins: [FieldExtendMixin],
  data() {
    return {
      breadcrumbData: [
        {
          name: this.$t("EQP_BORROW"),
          url: "/eam/account_management/equipment_borrow",
        },
        { name: this.$t("ADD"), url: "" },
      ],
      tableNameList: [
        {
          key: "epm_eqp_borrow",
          tab: "设备借用",
        },
      ],
      dataAttr: {
        form: "form",
      },
      // 移转类型
      transferTypeList: [],
      // 申请部门
      treeData: [],
      treeProps: {
        value: "id",
        children: "children",
        label: "label",
      },
      fieldNames: { label: "label", value: "code", children: "children" },
      // 申请部门级联用户
      searchParams: {
        deptId: "",
      },
      // 借出部门级联用户
      searchFromParams: {
        deptId: "",
      },
      // 申请部门级联用户
      searchToParams: {
        deptId: "",
      },
      // 选中的申请用户
      selectedUser: [],
      // 选中的借出用户
      selectedFromUser: [],
      // 选中的接收用户
      selectedToUser: [],
      // 目标位置
      currentOptions: [
        {
          code: "LINE",
          label: "车间",
          children: [],
        },
        {
          code: "WAREHOUSE",
          label: "仓库",
          children: [],
        },
      ],
      activeKey: "a",
      activeKeyB: "b",
      isShowButton: false, // 是否显示按钮
      confirmLoading: false,
      dataSource: [],
      form: {
        code: "", // 申请表单编码
        name: "", // 申请移转名称
        toSiteCode: "", // 目标厂区
        locationFirstIdArr: [], // 当前位置
        locationFirstId: "",
        toDeptId: "", // 目标部门
        toUserId: "", // 接收人
        fromDeptId: "", // 借出部门
        fromSiteCode: "", // 借出厂区
        fromUserId: "", // 借出人
        checkProcessId: "", // 审批流程
        remark: "",
      },
      formOld: {
        code: "", // 申请表单编码
        name: "", // 申请移转名称
        toSiteCode: "", // 目标厂区
        locationFirstIdArr: [], // 当前位置
        locationFirstId: "",
        toDeptId: "", // 目标部门
        toUserId: "", // 接收人
        fromDeptId: "", // 借出部门
        fromSiteCode: "", // 借出厂区
        fromUserId: "", // 借出人
        checkProcessId: "", // 审批流程
        remark: "",
      },
      eqpList: [],
      checkStyleList: [], // 点检方式列表
      itemTypeList: [], // 项目类型列表
      compareTypeList: [], // 点检项比较方式列表
      yesNoList: [], // 是否列表
      fieldExtendList: [], // 字段扩展列表
      dynamicFieldList: [], // 字段扩展列表动态
      drawerVisible: false,
      isEdit: false,
      editIndex: 0,
      actionButtons: ["delete"],
      assetsStatusList: [],
      defaultList: [
        {
          dataIndex: "eqpCode", // 设备编码
          sorter: false,
          ellipsis: true,
          title: () => this.$t("EPMS_EQP_CODE"),
        },
        {
          dataIndex: "eqpName", // 设备名称
          title: () => this.$t("EQP_NAME"),
          sorter: false,
          ellipsis: true,
        },
        {
          dataIndex: "eqpTypeName", // 设备类型
          align: "left",
          sorter: false,
          ellipsis: true,
          width: 180,
          title: () => this.$t("EQP_TYPE"),
        },
        {
          dataIndex: "location", // 位置
          sorter: false,
          ellipsis: true,
          width: 360,
          title: () => this.$t("POSITION"),
        },
        {
          dataIndex: "assetsCode", // 资产编码
          sorter: false,
          ellipsis: true,
          title: () => this.$t("EPMS_ASSETS_CODE"),
        },
        {
          dataIndex: "assetsStatus", // 资产状态
          sorter: false,
          ellipsis: true,
          width: 180,
          title: () => this.$t("ASSETS_STATUS"),
          scopedSlots: { customRender: "assetsStatus" },
        },
        {
          dataIndex: "eqpModel", // 规格型号
          sorter: false,
          ellipsis: true,
          width: 180,
          title: () => this.$t("EQP_MODEL"),
        },
        {
          dataIndex: "ownerName", // 设备负责人
          sorter: false,
          ellipsis: true,
          title: () => this.$t("LEADER_NAME"),
        },
      ],
      columnsItem: {
        dataIndex: "",
        title: "",
        ellipsis: true,
        sorter: false,
      },
      selectedRowKeys: [], // 选中行 key 数据
      selectedRows: [], // 选中行 数据
      columnsList: [],
      sitePermission: [],
    };
  },
  computed: {
    ...mapState("setting", ["multiPage"]),
    ...mapState({}),
    rules() {
      return {
        type: [
          {
            required: true,
            message: () => this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        toSiteCode: [
          {
            required: true,
            message: () => this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        toUserId: [
          {
            required: true,
            message: () => this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        checkProcessId: [
          {
            required: true,
            message: () => this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        locationFirstIdArr: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        fromSiteCode: [
          {
            required: true,
            message: () => this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        fromUserId: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
      };
    },
    rulesDrawer() {
      return {
        itemName: [
          {
            required: true,
            max: 50,
            message: () => this.$t("PLACEENTER") + 50 + this.$t("LENGTH_TIP"),
            trigger: "blur",
          },
        ],
        imgFlag: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        checkStyle: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        itemType: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        compareType: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "change",
          },
        ],
        upperLimit: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "blur",
          },
        ],
        lowerLimit: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "blur",
          },
        ],
        autoMatchKey: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "blur",
          },
        ],
        textValue: [
          {
            required: true,
            message: this.$t("PLACESELECT"),
            trigger: "blur",
          },
        ],
      };
    },
    columns() {
      return [...this.defaultList, ...this.columnsList];
    },
  },
  watch: {},
  mounted() {
    const { id } = this.$route.query;
    if (id) {
      this.$axios
        .get(
          `${ApiConstant.PREFIX_CORE}/api/epm/eam/eqp-borrow/get-by-id/${id}`
        )
        .then((detailRes) => {
          /* eslint-enable */
          const { toDeptId, fromDeptId } = {
            ...detailRes.data?.data,
          };
          this.searchFromParams.deptId = fromDeptId || "";
          this.searchToParams.deptId = toDeptId || "";
          this.form = { ...detailRes.data?.data };
          this.selectedFromUser = [
            { id: this.form.fromUserId, name: this.form.fromUserName },
          ];
          this.selectedToUser = [
            { id: this.form.toUserId, name: this.form.toUserName },
          ];
          this.eqpList = [];
          this.form.locationFirstIdArr = [
            this.form.locationType,
            this.form.locationFirstId,
            this.form.locationSecondId,
            this.form.locationThirdId,
          ];
          this.$axios
            .get(
              `${ApiConstant.PREFIX_CORE}/api/epm/eam/eqp/sitecode/location-tree?siteCode=${this.form.toSiteCode}`
            )
            .then((res) => {
              deleteLeafArray(res.data.data.lineTree, "children");
              deleteLeafArray(res.data.data.warehouseTree, "children");
              this.currentOptions[0].children = res.data.data.lineTree;
              this.currentOptions[1].children = res.data.data.warehouseTree;
            });
          this.$set(this.form, "code", "");
          this.$set(this.form, "name", "");
          delete this.form.eqpBorrowItemBPOList;
          this.queryFieldExtend().then(() => {
            // this.$refs.fieldAuthRef.init();
          });
        });
    } else {
      this.queryFieldExtend().then(() => {
        // this.$refs.fieldAuthRef.init();
      });
    }
    // 初始化数据
    this.init();
  },
  methods: {
    // 获取选择申请用户组件返回数据
    getReturnFromData(selectedKeys, selectedRows) {
      this.form.fromUserId = selectedRows[0]?.id;
      this.form.fromUserName = selectedRows[0]?.name;
      this.selectedFromUser = selectedRows;
    },
    // 获取选择接收用户组件返回数据
    getToReturnData(selectedKeys, selectedRows) {
      this.form.toUserId = selectedRows[0]?.id;
      this.selectedToUser = selectedRows;
    },
    // 目标厂区更改
    siteChange() {
      this.form.locationFirstIdArr = [];
      // 获取目标厂区位置的三级树
      this.$axios
        .get(
          `${ApiConstant.PREFIX_CORE}/api/epm/eam/eqp/sitecode/location-tree?siteCode=${this.form.toSiteCode}`
        )
        .then((res) => {
          deleteLeafArray(res.data.data.lineTree, "children");
          deleteLeafArray(res.data.data.warehouseTree, "children");
          this.currentOptions[0].children = res.data.data.lineTree;
          this.currentOptions[1].children = res.data.data.warehouseTree;
        });
    },
    // 借出厂区更改后
    siteFromChange() {
      this.form.checkProcessId = "";
      this.eqpList = [];
    },
    onSelectSearchChange(e, info) {
      this.form.checkProcessId = info.id;
    },
    formatData(data, status = "") {
      const result = data.find((item) => item.value === status.toString());
      return result ? result.label : "";
    },
    // 获取返回数据，点检项目
    getEqpReturnData(selectedKeys, selectedRows) {
      if (selectedRows && selectedRows.length > 0) {
        this.eqpList = this.eqpList.concat(selectedRows);
        this.checkItemList();
      }
    },
    onFormBack(formBackData) {
      this.$nextTick(() => {
        Object.keys(this.form).forEach((key) => {
          // eslint-disable-next-line no-prototype-builtins
          if (!formBackData.hasOwnProperty(key)) {
            delete this.form[key];
          }
        });
        Object.keys(formBackData).forEach((key1) => {
          // eslint-disable-next-line no-prototype-builtins
          if (!this.form.hasOwnProperty(key1)) {
            this.form[key1] = "";
          }
        });
        this.queryFieldExtend();
      });
    },
    // 监听选择借出部门组件返回数据
    handChangeFromDep(val) {
      this.searchFromParams.deptId = val;
      this.form.fromUserId = "";
      this.form.fromUserName = "";
      this.selectedFromUser = [];
    },
    // 监听选择接收部门组件返回数据
    handChangeToDep(val) {
      this.searchToParams.deptId = val;
      this.form.toUserId = "";
      this.form.toUserName = "";
      this.selectedToUser = [];
    },
    handleDelete(row) {
      const index = this.eqpList.findIndex((item) => item.id === row.id);
      this.$confirm({
        title: this.$t("DELETE"),
        content: this.$t("DELETE_INFO"),
        okText: this.$t("DELETE"),
        cancelText: this.$t("CANCEL"),
        centered: false,
        icon: "close-circle",
        onOk: () => {
          this.eqpList.splice(index, 1);
        },
      });
    },
    // 初始化数据
    init() {
      const params = {
        tableNameList: "epm_pc_item",
        moduleCode: this.$store.state.activatedModule,
      };
      return Promise.all([
        this.$axios.get(`${ApiConstant.PREFIX_CORE}/api/sys/org/tree`, {
          params,
        }), // 部门树结构
        this.$axios.get(
          `${ApiConstant.PREFIX_CORE}/api/sys/dict-data/DIC:EPM:ASSETS_STATUS`
        ), // 资产状态
        this.$axios.get(`${ApiConstant.PREFIX_CORE}/api/mdm/fac-site/list`),
      ]).then(([treeRes, assetsStatusRes, siteRes]) => {
        this.treeData = treeRes.data.data;
        this.assetsStatusList = assetsStatusRes.data.data;
        this.sitePermission = siteRes.data?.data;
      });
    },
    // 监听选择设备清单
    handleselectEqp() {
      this.$refs.selectEqp.openDialog();
    },
    // 设备清单去重
    checkItemList() {
      this.eqpList = uniqBy(this.eqpList, "id"); // 去重
    },
    // 监听保存按钮点击事件
    handleSave(type) {
      if (!this.eqpList.length) {
        this.$message.error(this.$t("AT_LEAST_ONE_EQP"));
        return;
      }
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          const arr = this.form.locationFirstIdArr;
          [
            this.form.locationType,
            this.form.locationFirstId,
            this.form.locationSecondId,
            this.form.locationThirdId,
          ] = arr;
          // const { code, name } = this.form;
          let eqpBorrowItemFormParamList = [];
          if (this.eqpList.length > 0) {
            // eslint-disable-next-line array-callback-return
            eqpBorrowItemFormParamList = this.eqpList.map((item) => {
              const { eqpCode, id } = item;
              const req = {
                eqpCode,
                eqpId: id,
              };
              return req;
            });
          }
          this.confirmLoading = true;
          const params = {
            ...this.form,
            eqpBorrowItemFormParamList,
          };
          this.$axios
            .post(`${ApiConstant.PREFIX_CORE}/api/epm/eam/eqp-borrow`, params)
            .then((res) => {
              this.$message.success(this.$t("SAVE_SUCCESS"));
              this.confirmLoading = false;
              if (type === "saveAndAdd") {
                // this.form = {
                //   id: null,
                //   code: "", // 申请表单编码
                //   name: "", // 申请移转名称
                //   toSiteCode: "", // 目标厂区
                //   fromDeptId: "", // 借出部门
                //   fromUserId: "", // 借出人
                //   fromUserName: "",
                //   fromSiteCode: "", // 借出厂区
                //   locationFirstIdArr: [], // 当前位置
                //   locationFirstId: "",
                //   toDeptId: "", // 目标部门
                //   toUserId: "", // 接收人
                //   checkProcessId: "", // 审批流程
                //   remark: "",
                // };
                // this.eqpList = [];
                // // 选中的申请用户
                // this.selectedUser = [];
                // // 选中的借出用户
                // this.selectedFromUser = [];
                // // 选中的接收用户
                // this.selectedToUser = [];
              } else if (type === "saveAndApproval") {
                this.handleAudit(res.data?.data);
              } else {
                this.handleCancel();
              }
            })
            .catch((e) => {
              this.confirmLoading = false;
            });
        }
      });
    },
    // 监听提交事件
    handleAudit(id) {
      const params = {
        ids: [id],
      };
      this.$axios
        .put(
          `${ApiConstant.PREFIX_CORE}/api/epm/eam/eqp-borrow/commit-to-check`,
          params
        )
        .then(() => {
          setTimeout(() => {
            this.handleCancel();
          }, 500);
        });
    },
    // 监听取消按钮点击事件
    handleCancel() {
      this.$store.dispatch("tagsView/jumpBeforeView", {
        to: {
          path: "/eam/account_management/equipment_borrow",
        },
        vm: this,
      });
    },
    // 页面埋点
    handleFuncUseRate(data) {
      this.$axios
        .put(`${ApiConstant.PREFIX_CORE}/api/epm/eam/use`, data)
        .then(() => {});
    },
  },
};
</script>
<style lang="less" scoped>
@import "@/assets/css/fault_repair.less";
/deep/ .mega-design-business-table .mega-design-pro-table {
  padding: 0 !important;
  margin-bottom: 24px;
}
/deep/ .ant-form-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
