陈婷婷
2026-01-21 c667fae1aaadb23c83e992a23aa3a081b327d76c
src/views/gyMaterial/GyMaterial.vue
@@ -1,198 +1,105 @@
<template>
  <div style="padding: 10px">
    <el-card style="margin-bottom: 10px;">
    <el-card style="margin-bottom: 10px">
      <el-form :inline="true" :model="queryParams" ref="queryForm" class="mb8">
        <el-form-item label="物料代码" prop="HNumber">
          <el-input
            v-model="queryParams.HNumber"
            placeholder="请输入物料代码"
            style="width: 160px"
          />
          <el-input v-model="queryParams.HNumber" placeholder="请输入物料代码" style="width: 160px" />
        </el-form-item>
        <el-form-item label="物料名称" prop="HName">
          <el-input
            v-model="queryParams.HName"
            placeholder="请输入物料名称"
            style="width: 160px"
          />
          <el-input v-model="queryParams.HName" placeholder="请输入物料名称" style="width: 160px" />
        </el-form-item>
        <el-form-item label="组织名称" prop="HOrgID">
          <el-select
            v-model="queryParams.HOrgID"
            placeholder="请选择组织"
            style="width: 160px"
          >
            <el-option
              v-for="item in organizationOptions"
              :key="item.ID"
              :label="item.Name"
              :value="item.ID"
            />
          <el-select v-model="queryParams.HOrgID" placeholder="请选择组织" style="width: 160px">
            <el-option v-for="(item, index) in organizationOptions" :key="index" :label="item.Name"
              :value="item.ID.toString()" />
          </el-select>
        </el-form-item>
        <el-form-item label="项目号" prop="HProject">
          <el-select
            v-model="queryParams.HProject"
            placeholder="请选择项目号"
            style="width: 160px"
          >
            <el-option
              v-for="item in projectOptions"
              :key="item.HName"
              :label="item.HName"
              :value="item.HName"
            />
          <el-select v-model="queryParams.HProject" placeholder="请选择项目号" style="width: 160px">
            <el-option v-for="item in projectOptions" :key="item.HName" :label="item.HName" :value="item.HName" />
          </el-select>
        </el-form-item>
        <el-form-item label="重新同步">
          <el-input
            v-model="queryParams.HNumber2"
            placeholder="请输入物料代码"
            style="width: 160px"
          />
          <el-button type="primary" @click="handleResCnz" style="margin-left: 10px">重新同步</el-button>
          <el-input v-model="queryParams.HNumber2" placeholder="请输入物料代码" style="width: 160px" />
          <el-button type="primary" size="mini" @click="handleResCnz" style="margin-left: 10px">重新同步</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
          <el-button @click="resetQuery">重置</el-button>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
      <el-form :model="queryParams" ref="filterForm">
        <el-collapse v-model="activeCollapse" class="filter-collapse">
          <el-collapse-item title="更多" name="more">
            <el-form-item label="规格型号" prop="HModel">
              <el-input
                v-model="queryParams.HModel"
                placeholder="请输入规格型号"
                style="width: 160px"
              />
              <el-input v-model="queryParams.HModel" placeholder="请输入规格型号" style="width: 160px" />
            </el-form-item>
            <el-card class="box-card" style="margin-top: 20px;">
            <el-card class="box-card" style="margin-top: 20px">
              <div slot="header" class="clearfix"><span>过滤</span></div>
              <div>
                <el-form-item label-width="0">
                  <el-row>
                    <el-col :span="7">
                      <el-select
                        v-model="queryParams.ColName"
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <el-option
                          v-for="(item, index) in visibleColumns"
                          :key="index"
                          :label="item.title"
                          :value="item.field"
                        ></el-option>
                      <el-select v-model="queryParams.ColName" placeholder="请选择" style="width: 100%">
                        <!-- <el-option value="" label=""></el-option> -->
                        <el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
                          :value="item.field"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="6" style="padding: 0 10px">
                      <el-select
                        v-model="queryParams.Comparator"
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <el-option
                          v-for="(item, index) in comparatorList"
                          :key="index"
                          :label="item.label"
                          :value="item.value"
                        ></el-option>
                      <el-select v-model="queryParams.Comparator" placeholder="请选择" style="width: 100%">
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                          :value="item.value"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="11">
                      <el-input
                        v-model="queryParams.ColContent"
                        placeholder="请输入"
                        clearable
                        @keyup.enter.native="handleQuery"
                      />
                      <el-input v-model="queryParams.ColContent" placeholder="请输入" clearable
                        @keyup.enter.native="handleQuery" />
                    </el-col>
                  </el-row>
                </el-form-item>
                <el-form-item label-width="0">
                  <el-row>
                    <el-col :span="7">
                      <el-select
                        v-model="queryParams.ColName1"
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <el-option
                          v-for="(item, index) in visibleColumns"
                          :key="index"
                          :label="item.title"
                          :value="item.field"
                        ></el-option>
                      <el-select v-model="queryParams.ColName1" placeholder="请选择" style="width: 100%">
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
                          :value="item.field"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="6" style="padding: 0 10px">
                      <el-select
                        v-model="queryParams.Comparator1"
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <el-option
                          v-for="(item, index) in comparatorList"
                          :key="index"
                          :label="item.label"
                          :value="item.value"
                        ></el-option>
                      <el-select v-model="queryParams.Comparator1" placeholder="请选择" style="width: 100%">
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                          :value="item.value"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="11">
                      <el-input
                        v-model="queryParams.ColContent1"
                        placeholder="请输入"
                        clearable
                        @keyup.enter.native="handleQuery"
                      />
                      <el-input v-model="queryParams.ColContent1" placeholder="请输入" clearable
                        @keyup.enter.native="handleQuery" />
                    </el-col>
                  </el-row>
                </el-form-item>
                <el-form-item label-width="0">
                  <el-row>
                    <el-col :span="7">
                      <el-select
                        v-model="queryParams.ColName2"
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <el-option
                          v-for="(item, index) in visibleColumns"
                          :key="index"
                          :label="item.title"
                          :value="item.field"
                        ></el-option>
                      <el-select v-model="queryParams.ColName2" placeholder="请选择" style="width: 100%">
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in visibleColumns" :key="index" :label="item.title"
                          :value="item.field"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="6" style="padding: 0 10px">
                      <el-select
                        v-model="queryParams.Comparator2"
                        placeholder="请选择"
                        style="width: 100%"
                      >
                        <el-option value="0" label=""></el-option>
                        <el-option
                          v-for="(item, index) in comparatorList"
                          :key="index"
                          :label="item.label"
                          :value="item.value"
                        ></el-option>
                      <el-select v-model="queryParams.Comparator2" placeholder="请选择" style="width: 100%">
                        <!-- <el-option value="0" label=""></el-option> -->
                        <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                          :value="item.value"></el-option>
                      </el-select>
                    </el-col>
                    <el-col :span="11">
                      <el-input
                        v-model="queryParams.ColContent2"
                        placeholder="请输入"
                        clearable
                        @keyup.enter.native="handleQuery"
                      />
                      <el-input v-model="queryParams.ColContent2" placeholder="请输入" clearable
                        @keyup.enter.native="handleQuery" />
                    </el-col>
                  </el-row>
                </el-form-item>
@@ -201,257 +108,107 @@
          </el-collapse-item>
        </el-collapse>
      </el-form>
      <div style="text-align:center;font-size:15px;font-weight:bold;color:#fc9393;margin: 20px 0;">
      <div style="
          text-align: center;
          font-size: 15px;
          font-weight: bold;
          color: #fc9393;
          margin: 20px 0;
        ">
        {{ currentFilterScheme }}
      </div>
    </el-card>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          >导入</el-button
        >
        <el-button type="primary" plain size="mini" @click="handleImport">导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          >导出</el-button
        >
        <el-button type="primary" plain size="mini" @click="handleExport">导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-document"
          size="mini"
          @click="handleNumAdd"
          >流水号新增</el-button
        >
        <el-button type="primary" size="mini" @click="handleNumAdd">流水号新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          >新增</el-button
        >
        <el-button type="primary" size="mini" @click="handleAdd">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-document-copy"
          size="mini"
          :disabled="single"
          @click="handleCopy"
          >复制</el-button
        >
        <el-button size="mini" :disabled="single" @click="handleCopy">复制</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleEdit"
          >编辑</el-button
        >
        <el-button size="mini" :disabled="single" @click="handleEdit">编辑</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="single"
          @click="handleDelete"
          >删除</el-button
        >
        <el-button type="danger" size="mini" :disabled="single" @click="handleDelete">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-check"
          size="mini"
          :disabled="single"
          @click="handleAudit(0)"
          >审核</el-button
        >
        <el-button size="mini" :disabled="single" @click="handleAudit(0)">审核</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-close"
          size="mini"
          :disabled="single"
          @click="handleAudit(1)"
          >反审核</el-button
        >
        <el-button size="mini" :disabled="single" @click="handleAudit(1)">反审核</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-turn-off"
          size="mini"
          :disabled="single"
          @click="handleStop(0)"
          >禁用</el-button
        >
        <el-button size="mini" :disabled="single" @click="handleStop(0)">禁用</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-open"
          size="mini"
          :disabled="single"
          @click="handleStop(1)"
          >反禁用</el-button
        >
        <el-button size="mini" :disabled="single" @click="handleStop(1)">反禁用</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-setting"
          size="mini"
          @click="handleColumnSetting"
          >列设置</el-button
        >
        <el-button size="mini" @click="handleColumnSetting">列设置</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-s-operation"
          size="mini"
          @click="handleButtonSetting"
          >按钮设置</el-button
        >
        <el-button size="mini" @click="handleButtonSetting">按钮设置</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-folder-checked"
          size="mini"
          @click="handleSaveScheme"
          >保存方案</el-button
        >
        <el-button type="primary" size="mini" @click="handleSaveScheme">保存方案</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-folder-opened"
          size="mini"
          @click="handleReadScheme"
          >读取方案</el-button
        >
        <el-button type="primary" size="mini" @click="handleReadScheme">读取方案</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-refresh"
          size="mini"
          @click="handleRefresh"
          >刷新</el-button
        >
        <el-button size="mini" @click="handleRefresh">刷新</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-close"
          size="mini"
          @click="handleExit"
          >退出</el-button
        >
        <el-button size="mini" @click="handleExit">退出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-edit"
          size="mini"
          @click="handleCorrect"
          >批改</el-button
        >
        <el-button type="primary" size="mini" @click="handleCorrect">批改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-edit"
          size="mini"
          @click="handleCorrect2"
          >批改(方案2)</el-button
        >
        <el-button type="primary" size="mini" @click="handleCorrect2">批改(方案2)</el-button>
      </el-col>
    </el-row>
    <el-row :gutter="10" style="margin-top: 10px">
      <el-col :span="6">
        <el-card style="height: 600px; overflow: hidden; display: flex; flex-direction: column;">
        <el-card style="height: 600px; overflow: hidden; display: flex; flex-direction: column">
          <div slot="header">
            <span>物料分类</span>
          </div>
          <div style="flex: 1; overflow: auto; margin-bottom: 10px;">
            <el-tree
              :data="treeData"
              :props="treeProps"
              node-key="id"
              default-expand-all
              :expand-on-click-node="false"
              @node-click="handleTreeNodeClick"
              :highlight-current="true"
              class="custom-tree"
            >
          <div style="flex: 1; overflow: auto; margin-bottom: 10px">
            <el-tree :data="treeData" :props="treeProps" node-key="id" default-expand-all :expand-on-click-node="false"
              @node-click="handleTreeNodeClick" :highlight-current="true" class="custom-tree">
              <span class="custom-tree-node" slot-scope="{ node, data }">
                <span>{{ node.label }}</span>
              </span>
            </el-tree>
          </div>
          <div style="height: 200px; border: 1px solid #ebeef5; border-radius: 4px;">
            <el-carousel
              :autoplay="false"
              indicator-position="none"
              height="200px"
              ref="carousel"
            >
          <div style="height: 200px; border: 1px solid #ebeef5; border-radius: 4px">
            <el-carousel :autoplay="false" indicator-position="none" height="200px" ref="carousel">
              <el-carousel-item v-for="(item, index) in fileList" :key="index">
                <div v-if="item.type === 'image'" class="carousel-item">
                  <img
                    :src="item.url"
                    :alt="item.name"
                    style="width: 100%; height: 100%; object-fit: contain;"
                    @click="previewImg(item.url)"
                  />
                  <img :src="item.url" :alt="item.name" style="width: 100%; height: 100%; object-fit: contain"
                    @click="previewImg(item.url)" />
                </div>
                <div v-else-if="item.type === 'pdf'" class="carousel-item">
                  <embed
                    :src="item.url"
                    type="application/pdf"
                    style="width: 100%; height: 100%;"
                  />
                  <embed :src="item.url" type="application/pdf" style="width: 100%; height: 100%" />
                </div>
                <div v-else class="carousel-item">
                  <h1 style="text-align:center;line-height:180px;color:red;font-weight:bolder;">
                  <h1 style="
                      text-align: center;
                      line-height: 180px;
                      color: red;
                      font-weight: bolder;
                    ">
                    暂未上传文件
                  </h1>
                </div>
@@ -463,40 +220,21 @@
      <el-col :span="18">
        <div class="tableBox" v-loading="loading">
          <el-table
            :data="tableData"
            ref="tableData"
            height="600"
            @selection-change="handleSelectionChange"
            border
            @row-click="handleRowClick"
            @row-dblclick="handleDblclick"
            :row-style="rowStyle"
            v-if="tableShow"
          >
          <el-table :data="tableData" ref="tableData" height="600" @selection-change="handleSelectionChange" border
            @row-click="handleRowClick" @row-dblclick="handleDblclick" :row-style="rowStyle" v-if="tableShow">
            <el-table-column type="selection" width="55" align="center" fixed="left" />
            <el-table-column prop="hmainid" label="单据ID" v-if="false" />
            <el-table-column
              v-for="(item, index) in btList"
              :key="index"
              :align="item.align"
              :prop="item.field"
              :label="item.title"
              :width="item.width"
              v-if="!item.hide"
              :sortable="item.sort"
              show-overflow-tooltip
              :fixed="item.fixed"
            >
            <el-table-column v-for="(item, index) in btList" :key="index" :align="item.align" :prop="item.field"
              :label="item.title" :width="item.width" v-if="!item.hide" :sortable="item.sort" show-overflow-tooltip
              :fixed="item.fixed">
              <template slot-scope="{ row, column }">
                <div :style="item.style">
                  <el-button
                    type="text"
                    @click="handleMaterialCodeClick(row)"
                    v-if="column.property === '物料代码'"
                    >{{ row[column.property] }}</el-button
                  >
                  <span v-else-if="(column.property || '').includes('时间') || (column.property || '').includes('日期')">
                  <el-button type="text" @click="handleMaterialCodeClick(row)" v-if="column.property === '物料代码'">{{
                    row[column.property] }}</el-button>
                  <span v-else-if="
                    (column.property || '').includes('时间') ||
                    (column.property || '').includes('日期')
                  ">
                    {{ formatDate(row[column.property]) }}
                  </span>
                  <span v-else>{{ row[column.property] }}</span>
@@ -504,119 +242,56 @@
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="total > 0"
            :total="total"
            :page.sync="page"
            :limit.sync="pageSize"
            :pageSizes="pageSizes"
            @pagination="getList"
          />
          <pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" :pageSizes="pageSizes"
            @pagination="handleQuery" />
        </div>
      </el-col>
    </el-row>
    <el-dialog
      :visible.sync="previewVisible"
      width="80%"
      top="5vh"
      :before-close="handlePreviewClose"
    >
      <img :src="previewImage" style="width: 100%;" />
    <el-dialog :visible.sync="previewVisible" width="80%" top="5vh" :before-close="handlePreviewClose">
      <img :src="previewImage" style="width: 100%" />
    </el-dialog>
    <el-dialog
      title="隐藏列设置"
      :visible.sync="openColumnSetting"
      width="816px"
      append-to-body
    >
      <RowSettings
        :colName="btResList"
        :HModName="HModName"
        @rowEditClose="columnSettingClose"
        v-if="columnSettingShow"
      />
    <el-dialog title="隐藏列设置" :visible.sync="openColumnSetting" width="816px" append-to-body>
      <RowSettings :colName="btResList" :HModName="HModName" @rowEditClose="columnSettingClose"
        v-if="columnSettingShow" />
    </el-dialog>
    <el-dialog
      :title="editTitle"
      :visible.sync="openEdit"
      width="95%"
      top="2vh"
      append-to-body
      class="material-edit-dialog"
      :before-close="closeEdit"
    >
      <MaterialEdit
        v-if="editShow"
        :hID="currentEditId"
        :OperationType="OperationType"
        :HMaterTypeID="currentMaterTypeID"
        @close="handleEditClose"
      />
    <el-dialog :title="editTitle" :visible.sync="openEdit" width="95%" top="2vh" append-to-body
      class="material-edit-dialog" :before-close="closeEdit">
      <MaterialEdit v-if="editShow" :hID="currentEditId" :OperationType="OperationType"
        :HMaterTypeID="currentMaterTypeID" @close="handleEditClose" />
    </el-dialog>
    <MaterialCorrection
      :visible.sync="openCorrect"
      @close="closeCorrect"
    />
    <MaterialCorrection :visible.sync="openCorrect" @close="closeCorrect" />
    <el-dialog
      title="批改(方案2)"
      :visible.sync="openCorrect2"
      width="1480px"
      append-to-body
      :before-close="closeCorrect2"
    >
      <div style="text-align: center; padding: 50px;">
    <el-dialog title="批改(方案2)" :visible.sync="openCorrect2" width="1480px" append-to-body :before-close="closeCorrect2">
      <div style="text-align: center; padding: 50px">
        <h2>物料批改功能(方案2)</h2>
        <p>物料批改功能(方案2)待后续开发</p>
        <el-button type="primary" @click="closeCorrect2">关闭</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :title="upload.title"
      :visible.sync="upload.open"
      width="1500px"
      append-to-body
    >
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="1500px" append-to-body>
      <div style="margin-top: -20px">
        <el-button type="primary" @click="handleImportSubmit">导入数据</el-button>
        <el-button type="primary" @click="upload.open = false">退 出</el-button>
        <el-upload
          ref="upload"
          :limit="1"
          accept=".xlsx, .xls"
          style="display: inline-block; margin-left: 10px"
          :action="upload.url + '?updateSupport=' + upload.updateSupport"
          :disabled="upload.isUploading"
          :on-progress="handleFileUploadProgress"
          :on-success="handleFileSuccess"
        >
          <el-button type="primary">文件上传</el-button>
        <el-button type="primary" size="mini" @click="handleImportSubmit">导入数据</el-button>
        <el-button type="primary" size="mini" @click="upload.open = false">退 出</el-button>
        <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" style="display: inline-block; margin-left: 10px"
          :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
          :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess">
          <el-button type="primary" size="mini">文件上传</el-button>
        </el-upload>
      </div>
      <el-table
        :data="uploadData"
        v-loading="uploadTableLoading"
        border
        height="550"
      >
      <el-table :data="uploadData" v-loading="uploadTableLoading" border height="550">
        <el-table-column type="index" label="序号" width="55" align="center" />
        <el-table-column label="物料代码" prop="物料代码" align="center" width="120" />
        <el-table-column label="物料名称" prop="物料名称" align="center" width="120" />
        <el-table-column label="物料分类" prop="物料分类" align="center" width="120" />
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="uploadDataDelete(scope.$index)"
              >删除</el-button
            >
            <el-button size="mini" type="text" icon="el-icon-delete"
              @click="uploadDataDelete(scope.$index)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -632,55 +307,55 @@
export default {
  name: "GyMaterial",
  components: { RowSettings,MaterialEdit,MaterialCorrection },
  components: { RowSettings, MaterialEdit, MaterialCorrection },
  props: {
    openPage: { type: String },
  },
  data() {
    return {
      activeCollapse: [],
      activeCollapse: [],
      HModName: "Gy_Material",
      HModuleName: "物料列表维护",
      HClassTag: "ForFilteringSchemes",
      treeData: [],
      treeProps: {
        children: 'children',
        label: 'title'
        children: "children",
        label: "title",
      },
      currentMaterTypeID: 0,
      fileList: [
        {
          type: 'empty',
          url: '',
          name: '暂无文件'
        }
          type: "empty",
          url: "",
          name: "暂无文件",
        },
      ],
      // 编辑相关
      editShow: false,
      openEdit: false,
      OperationType: null,
      editTitle: "编辑物料",
      currentEditId: 0,
      // 批改相关
      openCorrect: false,
      openCorrect2: false,
      // 列设置
      columnSettingShow: false,
      openColumnSetting: false,
      // 图片预览
      previewVisible: false,
      previewImage: '',
      previewImage: "",
      // 表格显示
      tableShow: true,
      loading: true,
      queryParams: {
        HNumber: null,
        HName: null,
@@ -688,17 +363,17 @@
        HModel: null,
        HOrgID: null,
        HProject: null,
        ColName: "0",
        ColName1: "0",
        ColName2: "0",
        Comparator: "0",
        Comparator1: "0",
        Comparator2: "0",
        ColName: "",
        ColName1: "",
        ColName2: "",
        Comparator: "",
        Comparator1: "",
        Comparator2: "",
        ColContent: "",
        ColContent1: "",
        ColContent2: "",
      },
      organizationOptions: [],
      organizationOptions: JSON.parse(sessionStorage["organizationList"]),
      projectOptions: [],
      currentFilterScheme: "",
      HInterID_Choose: 0,
@@ -714,9 +389,10 @@
        { label: "右包含", value: "9" },
        { label: "不包含", value: "10" },
      ],
      sWhere: "",
      selectedRow: null,
      selRowList: [],
      ids: [],
      single: true,
      multiple: true,
@@ -737,61 +413,54 @@
      },
      uploadData: [],
      uploadTableLoading: false,
      baseURL: process.env.VUE_APP_BASE_URL || "http://47.96.97.237/API/",
      baseURL: process.env.VUE_APP_BASE_API,
      user: "admin",
    };
  },
  computed: {
    visibleColumns() {
      return this.btList.filter(item => !item.hide && item.field);
    }
      return this.btList.filter((item) => !item.hide && item.field);
    },
  },
  created() {
    this.user = sessionStorage["HUserName"];
    this.queryParams.HOrgID = sessionStorage["OrganizationID"];
  },
  mounted() {
    this.fetchData();
  },
  methods: {
    fetchData() {
      axios
        .get(
          "http://47.96.97.237/API/Web/GetUser?UserName=001&PassWord=123456&HOrgName=100038"
        )
        .then((response) => {
          let data = response.data.data[0];
          this.user = data.Czymc;
          this.getOrganizations();
          this.getTreeData();
          this.getProjectOptions();
          this.getList();
          this.getDefaultFilterScheme();
        })
        .catch((error) => {
          this.$modal.msgError("接口请求失败!");
        });
      this.getOrganizations();
      this.getTreeData();
      this.getProjectOptions();
      this.handleQuery();
      //this.getDefaultFilterScheme();
    },
    getOrganizations() {
      axios
        .get(this.baseURL + "/Web/GetOrganizations")
        .then((response) => {
          if (response.data.count == 1) {
            this.organizationOptions = response.data.data;
            if (this.organizationOptions.length > 0) {
              this.queryParams.HOrgID = this.organizationOptions[0].ID;
            }
            // if (this.organizationOptions.length > 0) {
            //   this.queryParams.HOrgID = this.organizationOptions[0].ID;
            // }
          }
        })
        .catch((error) => {
          this.$modal.msgError("接口请求失败!");
        });
    },
    getTreeData() {
      axios
        .get(this.baseURL + "/Gy_MaterType/Gy_MaterTypeTreeListByLevel",{
            params: {
                HOrgID: '100038'
            }
        .get(this.baseURL + "/Gy_MaterType/Gy_MaterTypeTreeListByLevel", {
          params: {
            HOrgID: this.queryParams.HOrgID,
          },
        })
        .then((response) => {
          if (response.data.count == 1) {
@@ -802,14 +471,13 @@
          this.$modal.msgError("接口请求失败!");
        });
    },
    getProjectOptions() {
      axios
        .get(this.baseURL + "/Gy_Material/Get_HProject", {
          params: {
            HOrgID: this.queryParams.HOrgID
          }
            HOrgID: this.queryParams.HOrgID,
          },
        })
        .then((response) => {
          if (response.data.count == 1) {
@@ -820,12 +488,13 @@
          this.$modal.msgError("接口请求失败!");
        });
    },
    getList() {
      this.tableShow = false;
      this.loading = true;
      let orgName = this.organizationOptions.find((e) => e.ID == this.queryParams.HOrgID)
        ?.Name;
      axios
        .get(this.baseURL + "/Gy_Material/page", {
          params: {
@@ -833,7 +502,7 @@
            user: this.user,
            page: this.page,
            size: this.pageSize,
            Organization: ''
            Organization: orgName || "",
          },
        })
        .then((response) => {
@@ -853,29 +522,27 @@
          this.loading = false;
        });
    },
    setDefaultColumns() {
      this.btList = [
        { type: 'checkbox', fixed: 'left' },
        { field: 'hmainid', title: '单据ID', hide: true },
        { field: '物料代码', title: '物料代码', align: 'center', width: 120 },
        { field: '物料名称', title: '物料名称', align: 'center', width: 120 },
        { field: '规格型号', title: '规格型号', align: 'center', width: 120 },
        { field: '物料属性', title: '物料属性', align: 'center', width: 100 },
        { field: '组织名称', title: '组织名称', align: 'center', width: 120 },
        { field: '项目号', title: '项目号', align: 'center', width: 100 },
        { field: '禁用标记', title: '禁用标记', align: 'center', width: 100 },
        { field: '审核人', title: '审核人', align: 'center', width: 100 },
        { field: '创建人', title: '创建人', align: 'center', width: 100 },
        { field: '创建时间', title: '创建时间', align: 'center', width: 150 }
        { type: "checkbox", fixed: "left" },
        { field: "hmainid", title: "单据ID", hide: true },
        { field: "物料代码", title: "物料代码", align: "center", width: 120 },
        { field: "物料名称", title: "物料名称", align: "center", width: 120 },
        { field: "规格型号", title: "规格型号", align: "center", width: 120 },
        { field: "物料属性", title: "物料属性", align: "center", width: 100 },
        { field: "组织名称", title: "组织名称", align: "center", width: 120 },
        { field: "项目号", title: "项目号", align: "center", width: 100 },
        { field: "禁用标记", title: "禁用标记", align: "center", width: 100 },
        { field: "审核人", title: "审核人", align: "center", width: 100 },
        { field: "创建人", title: "创建人", align: "center", width: 100 },
        { field: "创建时间", title: "创建时间", align: "center", width: 150 },
      ];
    },
    handleTreeNodeClick(data) {
      this.currentMaterTypeID = data.id;
      if (data.id == "100") {
        this.sWhere = " and HMaterTypeID= 0";
      } else if (data.id == "0") {
@@ -883,16 +550,13 @@
      } else {
        this.sWhere = " and HMaterTypeID='" + data.id + "' ";
      }
      this.getList();
      this.handleQuery();
    },
    async handleQuery() {
      this.sWhere = "";
      this.processFilterConditions();
      if (this.queryParams.HNumber) {
        this.sWhere += " and 物料代码 like '%" + this.queryParams.HNumber + "%'";
@@ -909,16 +573,33 @@
      this.getList();
    },
    processFilterConditions() {
      const conditions = [
        { colName: this.queryParams.ColName, comparator: this.queryParams.Comparator, content: this.queryParams.ColContent },
        { colName: this.queryParams.ColName1, comparator: this.queryParams.Comparator1, content: this.queryParams.ColContent1 },
        { colName: this.queryParams.ColName2, comparator: this.queryParams.Comparator2, content: this.queryParams.ColContent2 }
        {
          colName: this.queryParams.ColName,
          comparator: this.queryParams.Comparator,
          content: this.queryParams.ColContent,
        },
        {
          colName: this.queryParams.ColName1,
          comparator: this.queryParams.Comparator1,
          content: this.queryParams.ColContent1,
        },
        {
          colName: this.queryParams.ColName2,
          comparator: this.queryParams.Comparator2,
          content: this.queryParams.ColContent2,
        },
      ];
      conditions.forEach(condition => {
        if (condition.colName && condition.colName !== "0" && condition.comparator && condition.comparator !== "0") {
      conditions.forEach((condition) => {
        if (
          condition.colName &&
          condition.colName !== "0" &&
          condition.comparator &&
          condition.comparator !== "0"
        ) {
          let com = "";
          switch (condition.comparator) {
            case "7":
@@ -941,7 +622,6 @@
        }
      });
    },
    resetQuery() {
      this.sWhere = "";
@@ -950,7 +630,7 @@
        HName: null,
        HNumber2: null,
        HModel: null,
        HOrgID: this.organizationOptions.length > 0 ? this.organizationOptions[0].ID : null,
        HOrgID: sessionStorage["OrganizationID"],
        HProject: null,
        ColName: "0",
        ColName1: "0",
@@ -962,27 +642,26 @@
        ColContent1: "",
        ColContent2: "",
      };
      this.getList();
      this.handleQuery();
    },
    handleResCnz() {
      if (!this.queryParams.HNumber2) {
        this.$modal.msgWarning("请输入物料代码");
        return;
      }
      axios
        .get(this.baseURL + "/Gy_Material/Gy_MaterialViewApi", {
          params: {
            Number: this.queryParams.HNumber2,
            Type: 'WL'
          }
            Type: "WL",
          },
        })
        .then((response) => {
          if (response.data.count == 1) {
            this.$modal.msgSuccess(response.data.Message);
            this.getList();
            this.handleQuery();
          } else {
            this.$modal.msgError(response.data.Message);
          }
@@ -991,22 +670,21 @@
          this.$modal.msgError("接口请求失败!");
        });
    },
    handleImport() {
      this.uploadData = [];
      this.upload.isUploading = false;
      this.upload.title = "导入";
      this.upload.open = true;
    },
    handleExport() {
      axios
        .get(this.baseURL + "/LMES/getReportByModRightNameCheck", {
          params: {
            ModRightNameCheck: "Gy_Material_ExportExcel",
            user: this.user
          }
            user: this.user,
          },
        })
        .then((response) => {
          if (response.data.count == 1) {
@@ -1022,58 +700,61 @@
          this.$modal.msgError("接口请求失败!");
        });
    },
    handleNumAdd() {
    if ((this.currentMaterTypeID == 0 || this.currentMaterTypeID == null) && !this.judgeSkipTouchMaterType()) {
      this.$modal.msgWarning("请选择具体物料分类!");
      return;
    }
    this.OperationType = 4;
    this.currentEditId = 0;
    this.editTitle = "流水号新增物料";
    this.openEdit = true;
    this.editShow = true;
  },
    handleAdd() {
    this.OperationType = 1;
    this.currentEditId = 0;
    this.editTitle = "新增物料";
    this.openEdit = true;
    this.editShow = true;
      if (
        (this.currentMaterTypeID == 0 || this.currentMaterTypeID == null) &&
        !this.judgeSkipTouchMaterType()
      ) {
        this.$modal.msgWarning("请选择具体物料分类!");
        return;
      }
      this.OperationType = 4;
      this.currentEditId = 0;
      this.editTitle = "流水号新增物料";
      this.openEdit = true;
      this.editShow = true;
    },
    handleAdd() {
      this.OperationType = 1;
      this.currentEditId = 0;
      this.editTitle = "新增物料";
      this.openEdit = true;
      this.editShow = true;
    },
    handleCopy() {
    if (this.single) {
      this.$modal.msgWarning("请选择一条数据");
      return;
    }
    this.OperationType = 2;
    this.currentEditId = this.selectedRow.HItemID;
    this.editTitle = "复制物料";
    this.openEdit = true;
    this.editShow = true;
  },
      if (this.single) {
        this.$modal.msgWarning("请选择一条数据");
        return;
      }
      this.OperationType = 2;
      this.currentEditId = this.selectedRow.HItemID;
      this.editTitle = "复制物料";
      this.openEdit = true;
      this.editShow = true;
    },
    handleEdit() {
    if (this.single) {
      this.$modal.msgWarning("请选择一条数据");
      return;
    }
    this.OperationType = 3;
    this.currentEditId = this.selectedRow.HItemID;
    this.editTitle = "编辑物料";
    this.openEdit = true;
    this.editShow = true;
  },
      if (this.single) {
        this.$modal.msgWarning("请选择一条数据");
        return;
      }
      this.OperationType = 3;
      this.currentEditId = this.selectedRow.HItemID;
      this.editTitle = "编辑物料";
      this.openEdit = true;
      this.editShow = true;
    },
    handleDelete() {
      if (this.single) {
        this.$modal.msgWarning("请选择一条数据");
        return;
      }
      if (this.selectedRow.审核人 !== null && this.selectedRow.审核人 !== '') {
      if (this.selectedRow.审核人 !== null && this.selectedRow.审核人 !== "") {
        this.$modal.msgError("已被审核的物料不能被删除!");
        return;
      }
@@ -1085,24 +766,26 @@
            .get(this.baseURL + "/Gy_Material/Delete", {
              params: {
                HItemID: this.selectedRow.HItemID,
                user: this.user
              }
                user: this.user,
              },
            })
            .then((response) => {
              if (response.data.count == 1) {
                this.getList();
                this.handleQuery();
                this.$modal.msgSuccess("删除成功");
              } else {
                this.$modal.msgError("错误:" + response.data.code + response.data.Message);
                this.$modal.msgError(
                  "错误:" + response.data.code + response.data.Message
                );
              }
            })
            .catch((error) => {
              this.$modal.msgError("接口请求失败!");
            });
        })
        .catch(() => {});
        .catch(() => { });
    },
    handleAudit(isAudit) {
      if (this.single) {
        this.$modal.msgWarning("请选择一条数据");
@@ -1114,12 +797,12 @@
          params: {
            HInterID: this.selectedRow.HItemID,
            IsAudit: isAudit,
            CurUserName: this.user
          }
            CurUserName: this.user,
          },
        })
        .then((response) => {
          if (response.data.count == 1) {
            this.getList();
            this.handleQuery();
            this.$modal.msgSuccess(response.data.Message);
          } else {
            this.$modal.msgError(response.data.Message);
@@ -1129,7 +812,7 @@
          this.$modal.msgError("接口请求失败!");
        });
    },
    handleStop(isStop) {
      if (this.single) {
        this.$modal.msgWarning("请选择一条数据");
@@ -1140,12 +823,12 @@
          params: {
            HInterID: this.selectedRow.HItemID,
            IsStop: isStop,
            CurUserName: this.user
          }
            CurUserName: this.user,
          },
        })
        .then((response) => {
          if (response.data.count == 1) {
            this.getList();
            this.handleQuery();
            this.$modal.msgSuccess(response.data.Message);
          } else {
            this.$modal.msgError(response.data.Message);
@@ -1155,52 +838,66 @@
          this.$modal.msgError("接口请求失败!");
        });
    },
    handleColumnSetting() {
      this.columnSettingShow = true;
      this.openColumnSetting = true;
    },
    handleButtonSetting() {
      this.$modal.msgInfo("按钮设置功能");
    },
    handleSaveScheme() {
      this.$modal.msgInfo("保存方案功能");
    },
    handleReadScheme() {
      this.$modal.msgInfo("读取方案功能");
    },
    handleRefresh() {
      this.getList();
      // 刷新时清除表格选择并重置相关状态,保证复制/编辑/删除/审核等按钮被禁用
      if (this.$refs.tableData && this.$refs.tableData.clearSelection) {
        this.$refs.tableData.clearSelection();
      }
      this.selectedRow = null;
      this.ids = [];
      this.single = true;
      this.multiple = true;
      this.handleQuery();
    },
    handleExit() {
      this.$router.go(-1);
    },
    handleCorrect() {
      this.openCorrect = true;
    },
    handleCorrect2() {
      this.openCorrect2 = true;
    },
    // 物料代码点击
    handleMaterialCodeClick(row) {
    this.selectedRow = row;
    this.OperationType = 3;
    this.currentEditId = row.HItemID;
    this.editTitle = "编辑物料";
    this.openEdit = true;
    this.editShow = true;
  },
      this.selectedRow = row;
      this.OperationType = 3;
      this.currentEditId = row.HItemID;
      this.editTitle = "编辑物料";
      this.openEdit = true;
      this.editShow = true;
    },
    handleRowClick(row, column, event) {
      if (this.openPage) {
        if (this.openPage == 'Gy_BarCodeBill') {
          this.$emit('deptEmit', this.selRowList, 3)
        }else{
        this.$emit("deptEmit", row, 3);
        }
      }
      if (this.checkIsIframe()) {
        // 将当前选中的数据暴露到window中
        window.selectedRow = row;
@@ -1209,39 +906,38 @@
      this.selectedRow = row;
      this.getFileList(row.物料代码);
    },
    getFileList(HMaterNumber) {
      if (!HMaterNumber) return;
      axios
        .get(this.baseURL + "/Cj_StationOutBill/Filelist", {
          params: { HBillNo: HMaterNumber }
          params: { HBillNo: HMaterNumber },
        })
        .then((response) => {
          if (response.data.count == 1) {
            this.fileList = [];
            const data = response.data.data;
            if (data.length === 0) {
              this.fileList.push({
                type: 'empty',
                url: '',
                name: '暂无文件'
                type: "empty",
                url: "",
                name: "暂无文件",
              });
            } else {
              data.forEach(item => {
                if (item.HFileType === '.jpeg' || item.HFileType === '.jpg') {
              data.forEach((item) => {
                if (item.HFileType === ".jpeg" || item.HFileType === ".jpg") {
                  this.fileList.push({
                    type: 'image',
                    type: "image",
                    url: `../../..${item.HFilePath}`,
                    name: item.HFileName
                    name: item.HFileName,
                  });
                } else if (item.HFileType === '.pdf') {
                } else if (item.HFileType === ".pdf") {
                  this.fileList.push({
                    type: 'pdf',
                    type: "pdf",
                    url: `../../..${item.HFilePath}`,
                    name: item.HFileName
                    name: item.HFileName,
                  });
                }
              });
@@ -1252,27 +948,37 @@
          this.$modal.msgError("获取文件列表失败!");
        });
    },
    // 图片预览
    previewImg(url) {
      this.previewImage = url;
      this.previewVisible = true;
    },
    handlePreviewClose() {
      this.previewVisible = false;
      this.previewImage = '';
      this.previewImage = "";
    },
    // 行样式
    rowStyle({ row, rowIndex }) {
      if (this.ids.includes(row.hmainid)) {
        return { background: "#ecf5ff" };
        return {};
        // background: "#ecf5ff"
      }
    },
    // 双击行
    handleDblclick(row, column, cell, event) {
      if (this.openPage) {
        if (this.openPage == 'Gy_BarCodeBill') {
          let list = []
          list.push(row)
          this.$emit("deptEmitDb", list, 3)
        } else {
          this.$emit("deptEmitDb", row, 3);
        }
      }
      if (this.checkIsIframe()) {
        // IFrame 双击 返回当前双击的数据
        window.parent.iFrameMaterialCallback(row);
@@ -1283,47 +989,51 @@
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.hmainid);
      this.selRowList = selection
      this.single = selection.length != 1;
      this.multiple = !selection.length;
      if (!this.single) {
        this.selectedRow = selection[0];
      }
      if (this.openPage == 'Gy_BarCodeBill') {
        this.$emit('deptEmit', this.selRowList, 3)
      }
    },
      // 编辑关闭回调
  handleEditClose() {
    this.openEdit = false;
    this.editShow = false;
    this.getList();
  },
    // 编辑关闭回调
    handleEditClose() {
      this.openEdit = false;
      this.editShow = false;
      this.handleQuery();
    },
    // 关闭编辑
    closeEdit() {
      this.openEdit = false;
      this.editShow = false;
    },
    // 关闭批改
    closeCorrect() {
      this.openCorrect = false;
    },
    // 关闭批改方案2
    closeCorrect2() {
      this.openCorrect2 = false;
    },
    // 列设置关闭
    columnSettingClose(val) {
      this.columnSettingShow = false;
      this.openColumnSetting = val;
      this.getList();
      this.handleQuery();
    },
    // 导入相关方法
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
      this.uploadTableLoading = true;
    },
    handleFileSuccess(response, file, fileList) {
      this.upload.isUploading = true;
      this.$refs.upload.clearFiles();
@@ -1333,20 +1043,20 @@
      } else {
        this.$alert(
          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
            response.Message +
            "</div>",
          response.Message +
          "</div>",
          "导入结果",
          { dangerouslyUseHTMLString: true }
        );
      }
    },
    handleImportSubmit() {
      if (this.uploadData.length === 0) {
        this.$modal.msgWarning("请先上传文件");
        return;
      }
      var sMainSub = JSON.stringify(this.uploadData) + "&和" + this.user;
      axios({
        method: "post",
@@ -1358,39 +1068,42 @@
        .then((res) => {
          this.$alert(
            "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
              res.data.Message +
              "</div>",
            res.data.Message +
            "</div>",
            "导入结果",
            { dangerouslyUseHTMLString: true }
          );
          this.upload.open = false;
          this.getList();
          this.handleQuery();
        })
        .catch((error) => {
          this.$modal.msgError("接口请求失败!");
        });
    },
    uploadDataDelete(index) {
      this.uploadData.splice(index, 1);
    },
    formatDate(dateString) {
      if (!dateString) return '';
      if (!dateString) return "";
      const date = new Date(dateString);
      return date.toLocaleString('zh-CN');
      return date.toLocaleString("zh-CN");
    },
    judgeSkipTouchMaterType() {
      if (this.treeData.length > 0 && this.treeData[0].children &&
          this.treeData[0].children.length == 1 &&
          this.treeData[0].children[0].children.length == 0) {
      if (
        this.treeData.length > 0 &&
        this.treeData[0].children &&
        this.treeData[0].children.length == 1 &&
        this.treeData[0].children[0].children.length == 0
      ) {
        return true;
      } else {
        return false;
      }
    },
    getDefaultFilterScheme() {
      this.currentFilterScheme = "当前过滤方案:默认方案";
    },
@@ -1442,7 +1155,7 @@
  width: 100%;
}
.el-tree-node.is-current > .el-tree-node__content {
.el-tree-node.is-current>.el-tree-node__content {
  background-color: #aef0f7;
}
@@ -1453,4 +1166,4 @@
.filter-collapse {
  margin-top: 10px;
}
</style>
</style>