gaoluyang
昨天 df1406d0f571972d033dffd6a93fb4b94febeb56
Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
# src/views/index.vue
已修改21个文件
1036 ■■■■ 文件已修改
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/FileUpload/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/EtableModify.vue 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/archiveManagement/index.vue 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/archiveManagement/mould/archiveDialog.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicInformation/index.vue 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicInformation/mould/coal.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicInformation/mould/coalQualityMaintenance.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicInformation/mould/customer.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicInformation/mould/supplier.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/index.vue 544 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procureMent/components/ProductionDialog.vue 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procureMent/index.vue 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/ProductionDetailsTable.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/ProductionDialog.vue 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/useCoalData.js 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/useDialog.js 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/useTableData.js 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/index.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -21,3 +21,4 @@
package-lock.json
yarn.lock
pnpm-lock.yaml
package.json
@@ -23,7 +23,7 @@
    "axios": "0.28.1",
    "clipboard": "2.0.11",
    "default-passive-events": "^4.0.0",
    "echarts": "5.5.1",
    "echarts": "^5.6.0",
    "element-china-area-data": "^6.1.0",
    "element-plus": "2.7.6",
    "file-saver": "2.0.5",
src/components/FileUpload/index.vue
@@ -231,10 +231,11 @@
  }
  // 桌面端下载
  const link = document.createElement("a");
  link.href = url;
  link.href = file.downloadUrl;
  link.download = file.bucketFilename || file.key;
  link.click();
};
// 上传前校验
const handleBeforeUpload = (file) => {
  // 校验文件名特殊字符
src/components/Table/EtableModify.vue
@@ -28,33 +28,35 @@
      type="index"
      width="60"
      align="center"
    />
    <template v-for="col in columns" :key="col.prop">
    />    <template v-for="col in columns" :key="col.prop">
      <el-table-column
        v-bind="col"
        :show-overflow-tooltip="false"
        align="center"
      >
        <template #default="scope">
          <template v-if="col.slot">
            <slot></slot>
          </template>
          <template v-else>
            <slot
              :name="col.prop"
              :row="scope.row"
              :column="scope.column"
              :index="scope.$index"
            ></slot>
          </template>          <template v-else>
            <div
              class="cell-edit"
              @dblclick="handleCellEdit(scope.row, col.prop)"
              :class="{ editable: isColumnEditable(col.prop) }"
            >
              <!-- 显示状态:使用格式化的值 -->
              <span
                v-if="!scope.row.editing || !scope.row.editing[col.prop]"
                class="cell-text"
              >
                {{
                  scope.row[col.prop] == null || scope.row[col.prop] === ""
                    ? "--"
                    : scope.row[col.prop]
                  formatCellValue(scope.row, scope.column, scope.row[col.prop], col)
                }}
              </span>
              <!-- 编辑状态:使用原始值,不经过格式化 -->
              <el-input
                v-else
                v-model="scope.row[col.prop]"
@@ -69,34 +71,6 @@
        </template>
      </el-table-column>
    </template>
    <!-- 操作列 -->
    <el-table-column
      v-if="showOperations"
      :label="operationsLabel"
      :width="operationsWidth"
      fixed="right"
      align="center"
    >
      <template #default="scope">
        <slot name="operations" :row="scope.row">
          <el-button
            v-if="operations.includes('edit')"
            link
            type="primary"
            size="small"
            @click="handleEdit(scope.row)"
            >编辑</el-button
          >
          <!--            <el-button-->
          <!--              v-if="operations.includes('delete')"-->
          <!--              link-->
          <!--              type="danger"-->
          <!--              size="small"-->
          <!--              @click="handleDelete(scope.row)"-->
          <!--            >删除</el-button>-->
        </slot>
      </template>
    </el-table-column>
  </el-table>
</template>
@@ -217,7 +191,22 @@
  // 检查该列在所有数据中是否有非空值
  return data.some((row) => row[col.prop] != null && row[col.prop] !== "");
};
// 默认的格式化函数
const defaultFormatter = (row, column, cellValue) => {
  return cellValue == null || cellValue === "" || cellValue === 0
    ? "0"
    : cellValue;
};
// 格式化单元格值
const formatCellValue = (row, column, cellValue, col) => {
  // 如果列有自定义格式化器,使用自定义格式化器
  if (col.formatter && typeof col.formatter === 'function') {
    return col.formatter(row, column, cellValue);
  }
  // 否则使用默认格式化器
  return defaultFormatter(row, column, cellValue);
};
// 处理单元格编辑
const handleCellEdit = (row, prop) => {
  // 如果不允许编辑单元格,直接返回
src/views/archiveManagement/index.vue
@@ -4,8 +4,9 @@
      <div class="left-content">
        <div class="tree-header">
          <h3>文档管理</h3>
          <el-button type="primary" size="small" @click="append('')" icon="Plus"
            >新增</el-button
          <el-button icon="Plus" size="small" type="primary" @click="append('')"
          >新增
          </el-button
          >
        </div>
@@ -13,13 +14,15 @@
        <div class="search-box">
          <el-input
            v-model="filterText"
              clearable
            placeholder="输入关键字进行搜索"
            size="small"
            clearable
            @input="handleFilter"
          >
            <template #prefix>
              <el-icon><Search /></el-icon>
              <el-icon>
                <Search/>
              </el-icon>
            </template>
          </el-input>
        </div>
@@ -28,13 +31,13 @@
          <el-tree
            ref="treeRef"
            :data="treeData"
            :props="props"
            :filter-node-method="filterNode"
            :expand-on-click-node="false"
            :default-expand-all="false"
              :expand-on-click-node="false"
              :filter-node-method="filterNode"
              :props="props"
              class="custom-tree"
            node-key="id"
            @node-click="handleNodeClick"
            class="custom-tree"
          >
            <template #default="{ node, data }">
              <div class="tree-node-content" @dblclick="headerDbClick(data)">
@@ -57,31 +60,31 @@
                  <el-input
                    v-else
                    :ref="(el) => setInputRef(el, data)"
                    placeholder="请输入节点名称"
                    v-model="newName"
                    @blur="($event) => handleInputBlur($event, data, node)"
                    @keyup.enter="
                      ($event) => handleInputBlur($event, data, node)
                    "
                    size="small"
                    class="tree-input"
                    autofocus
                      class="tree-input"
                      placeholder="请输入节点名称"
                      size="small"
                      @blur="(event) => handleInputBlur(event, data, node)"
                      @keyup.enter="
                      (event) => handleInputBlur(event, data, node)
                    "
                  />
                </div>
                <div class="node-actions" v-show="!data.isEdit">
                <div v-show="!data.isEdit" class="node-actions">
                  <el-button
                      icon="Plus"
                    link
                    size="small"
                    @click.stop="append(data)"
                    icon="Plus"
                    title="新增子节点"
                      @click.stop="append(data)"
                  ></el-button>
                  <el-button
                      icon="Delete"
                    link
                    size="small"
                    @click.stop="remove(node, data)"
                    icon="Delete"
                    title="删除"
                      @click.stop="remove(node, data)"
                  ></el-button>
                </div>
              </div>
@@ -92,71 +95,64 @@
    </div>
    <div class="right">
      <el-row :gutter="24">
        <el-col :span="2" :offset="20"
          ><el-button :icon="Delete" type="danger" @click="delHandler">删除</el-button></el-col
        <el-col :offset="20" :span="2"
        >
          <el-button :icon="Delete" type="danger" @click="delHandler">删除</el-button>
        </el-col
        >
        <el-col :span="2"
          ><el-button
        >
          <el-button
              :disabled="!tableSwitch"
            :icon="Plus"
            type="primary"
            @click="add"
            :disabled="!tableData.length"
            >新增</el-button
          ></el-col
          >新增
          </el-button
          >
        </el-col
        >
      </el-row>
      <ETable
        :maxHeight="1200"
        :loading="loading"
        :table-data="tableData"
        :columns="columns"
        @selection-change="handleSelectionChange"
        @edit="handleEdit"
        :show-selection="true"
        :border="true"
          :columns="columns"
          :loading="loading"
          :maxHeight="1200"
          :show-selection="true"
          :table-data="tableData"
          @edit="handleEdit"
          @selection-change="handleSelectionChange"
      >
      </ETable>
      <Pagination
        :total="total"
        :page="queryParams.current"
        :limit="queryParams.pageSize"
        :show-total="true"
        @pagination="handlePageChange"
        :layout="'total, prev, pager, next, jumper'"
          :limit="queryParams.pageSize"
          :page="queryParams.current"
          :show-total="true"
          :total="total"
          @pagination="handlePageChange"
      ></Pagination>
    </div>
    <archiveDialog
      v-model:centerDialogVisible="dialogVisible"
      @centerDialogVisible="centerDialogVisible"
      :row="row"
      @submitForm="submitForm"
      ref="archiveDialogs"
        v-model:centerDialogVisible="dialogVisible"
        :row="row"
        @centerDialogVisible="centerDialogVisible"
        @submitForm="submitForm"
    >
    </archiveDialog>
  </el-card>
</template>
<script setup>
import { onMounted, ref, nextTick, reactive } from "vue";
import {nextTick, onMounted, reactive, ref} from "vue";
import ETable from "@/components/Table/ETable.vue";
import { ElButton, ElInput, ElIcon, ElMessage } from "element-plus";
import {ElButton, ElIcon, ElInput, ElMessage} from "element-plus";
import archiveDialog from "./mould/archiveDialog.vue";
import Pagination from "@/components/Pagination/index.vue";
import {
  Plus,
  Search,
  Folder,
  Document,
  Delete,
} from "@element-plus/icons-vue";
import {
  getTree,
  addOrEditTree,
  delTree,
  getArchiveList,
  addOrEditArchive,
  delArchive,
} from "@/api/archiveManagement";
import {Delete, Document, Folder, Plus, Search,} from "@element-plus/icons-vue";
import {addOrEditTree, delArchive, delTree, getArchiveList, getTree,} from "@/api/archiveManagement";
const dialogVisible = ref(false); // 控制归档对话框显示
const loading = ref(false);
const tableData = ref([]);
@@ -192,7 +188,6 @@
};
const submitForm = async (res) => {
  if (res && res.code === 200) {
    ElMessage.success("操作成功");
    // 刷新列表数据
    await getArchiveListData();
  } else {
@@ -201,8 +196,10 @@
}
const centerDialogVisible = (val) => {
};
const tableSwitch = ref(false);
// 处理节点点击
const handleNodeClick = async (data) => {
const handleNodeClick = (data) => {
  tableSwitch.value = true;
  // 切换节点时重置到第一页
  queryParams.current = 1;
  queryParams.treeId = data.id;
@@ -238,7 +235,6 @@
      total.value = 0;
      return;
    }
    tableData.value = res.data?.records || res.data || [];
    total.value = res.data?.total || 0;
    // 确保分页参数正确更新
@@ -303,6 +299,7 @@
// 处理输入框失焦
const handleInputBlur = async (event, comeTreeData, node) => {
  if (!comeTreeData.isEdit) return; // 如果不是编辑状态,直接返回
  console.log("handleInputBlur", event, comeTreeData, node);
  if (event.relatedTarget && event.relatedTarget.tagName === "BUTTON") {
    return;
  }
@@ -439,7 +436,7 @@
  }
};
</script>
<style scoped lang="scss">
<style lang="scss" scoped>
.custom-tree-node {
  flex: 1;
  display: flex;
@@ -630,11 +627,13 @@
    }
  }
}
.el-card {
  width: calc(100% - 40px);
  height: calc(100vh - 130px);
  margin: 20px;
  box-sizing: border-box;
  .left {
    width: 30%;
    height: calc(100vh - 160px);
@@ -651,13 +650,15 @@
      flex-direction: column;
    }
  }
  .right {
    width: 70%;
    height: calc(100vh - 160px);
    padding: 0px 10px;
    padding: 0 10px;
    float: left;
  }
}
.archive-management-card {
  margin: 0;
}
src/views/archiveManagement/mould/archiveDialog.vue
@@ -47,7 +47,7 @@
</template>
<script setup>
import { ref, watch } from "vue";
import {ref, watch, nextTick} from "vue";
import { addOrEditArchive } from "@/api/archiveManagement";
import fileUpload from "@/components/FileUpload/index.vue";
import { ElMessage } from "element-plus";
@@ -100,7 +100,9 @@
const fileUploadRef = ref(null);
const initForm = () => {
  ruleForm.value = {};
  nextTick(() => {
  fileUploadRef.value.init();
  });
};
const editForm = (val) => {
  ruleForm.value = copyForm.value;
@@ -132,10 +134,6 @@
    // 调用 API
    try {
      const res = await addOrEditArchive(ruleForm.value);
      ElMessage({
        type: "success",
        message: res.msg || "操作成功",
      });
      emit("submitForm", res);
    } catch (error) {
      ElMessage({
@@ -147,6 +145,7 @@
    // 发送 emit 事件
    // 关闭对话框
    ElMessage.success("操作成功");
    centerDialogVisible.value = false;
  } catch (error) {
    ElMessage({
src/views/basicInformation/index.vue
@@ -1,6 +1,7 @@
<template>
  <div> <el-form :inline="true" :model="queryParams" class="search-form">
      <el-form-item label="搜索" v-if="shouldShowSearch">
  <div>
    <el-form :inline="true" :model="queryParams" class="search-form">
      <el-form-item v-if="shouldShowSearch" label="搜索">
        <el-input v-model="queryParams.searchAll" :placeholder="searchPlaceholder" clearable />
      </el-form-item>
      <el-form-item>
@@ -16,53 +17,57 @@
      <!-- 操作按钮区 -->
      <el-row :gutter="24" class="table-toolbar">
        <el-button type="primary" :icon="Plus" @click="handleAdd">新建</el-button>
        <el-button type="danger" :icon="Delete" @click="handleDelete">删除</el-button>
        <el-button type="info" :icon="Download" @click="handleExport" v-show="canExport">导出</el-button>
        <el-button :icon="Plus" type="primary" @click="handleAdd">新建</el-button>
        <el-button :icon="Delete" type="danger" @click="handleDelete">删除</el-button>
        <el-button @click="jump">admins</el-button>
        <el-button v-show="canExport" :icon="Download" type="info" @click="handleExport">导出</el-button>
      </el-row> <!-- 表格组件 -->
      <div>
        <data-table :loading="loading" :table-data="tableData" :columns="columns"
          @selection-change="handleSelectionChange" @edit="handleEdit" :show-selection="true" :border="true">          <!-- 字段名称列的自定义插槽 - 显示为标签 -->
        <data-table :border="true" :columns="columns" :loading="loading"
                    :show-selection="true" :table-data="tableData" @edit="handleEdit" @selection-change="handleSelectionChange">
          <!-- 字段名称列的自定义插槽 - 显示为标签 -->
          <template v-if="tabName === 'coalQualityMaintenance'" #fieldIds="{ row }">
            <template v-if="typeof row.fieldIds === 'string' && row.fieldIds.includes(',')">
              <el-tag v-for="(field, index) in row.fieldIds.split(',')" :key="index" type="primary" size="small"
                style="margin-right: 4px; margin-bottom: 2px;">
              <el-tag v-for="(field, index) in row.fieldIds.split(',')" :key="index" size="small" style="margin-right: 4px; margin-bottom: 2px;"
                      type="primary">
                {{ getFieldDisplayName(field.trim()) }}
              </el-tag>
            </template>
            <template v-else>
              <el-tag type="primary" size="small">
              <el-tag size="small" type="primary">
                {{ getFieldDisplayName(row.fieldIds) || '--' }}
              </el-tag>
            </template>
          </template>
        </data-table>
      </div>
      <pagination v-if="total > 0" :page="pageNum" :limit="pageSizes" :total="total" @pagination="handPagination"
        :layout="'total, prev, pager, next, jumper'" />
      <pagination v-if="total > 0" :layout="'total, prev, pager, next, jumper'" :limit="pageSizes" :page="pageNum" :total="total"
                  @pagination="handPagination"/>
      <Supplier v-if="tabName === 'supplier'" v-model:copyForm="copyForm"
        v-model:supplierDialogFormVisible="dialogFormVisible" :form="form" :title="title" @submit="handleSubmit"
        @beforeClose="handleBeforeClose" @update:dialogFormVisible="handleDialogFormVisible" :addOrEdit="addOrEdit" />
                v-model:supplierDialogFormVisible="dialogFormVisible" :addOrEdit="addOrEdit" :form="form" :title="title"
                @beforeClose="handleBeforeClose" @submit="handleSubmit"
                @update:dialogFormVisible="handleDialogFormVisible"/>
      <Customer v-if="tabName === 'customer'" v-model:copyForm="copyForm"
        v-model:customerDialogFormVisible="dialogFormVisible" :form="form" :title="title" @submit="handleSubmit"
        :addOrEdit="addOrEdit" @beforeClose="handleBeforeClose" />
      <Coal v-if="tabName === 'coal'" v-model:copyForm="copyForm" v-model:coalDialogFormVisible="dialogFormVisible"
        :form="form" :title="title" :addOrEdit="addOrEdit" @submit="handleSubmit" />
      <coalQualityMaintenance v-if="tabName === 'coalQualityMaintenance'" v-model:copyForm="copyForm"
        v-model:coalQualityMaintenanceDialogFormVisible="dialogFormVisible" :form="form" :title="title"
        :addOrEdit="addOrEdit" @submit="handleSubmit" />
      <coalMeiZhiZiDuanWeiHu v-if="tabName === 'coalMeiZhiZiDuanWeiHu'" v-model:copyForm="copyForm"
        v-model:coalMaintenanceFieldDialogVisible="dialogFormVisible" :form="form" :title="title" :addOrEdit="addOrEdit"
                v-model:customerDialogFormVisible="dialogFormVisible" :addOrEdit="addOrEdit" :form="form" :title="title"
                @beforeClose="handleBeforeClose" @submit="handleSubmit"/>
      <Coal v-if="tabName === 'coal'" v-model:coalDialogFormVisible="dialogFormVisible" v-model:copyForm="copyForm"
            :addOrEdit="addOrEdit" :form="form" :title="title" @submit="handleSubmit"/>
      <coalQualityMaintenance v-if="tabName === 'coalQualityMaintenance'" v-model:coalQualityMaintenanceDialogFormVisible="dialogFormVisible"
                              v-model:copyForm="copyForm" :addOrEdit="addOrEdit"
                              :form="form"
                              :title="title" @submit="handleSubmit"/>
      <coalMeiZhiZiDuanWeiHu v-if="tabName === 'coalMeiZhiZiDuanWeiHu'" v-model:coalMaintenanceFieldDialogVisible="dialogFormVisible"
                             v-model:copyForm="copyForm" :addOrEdit="addOrEdit" :form="form"
                             :title="title"
        @submit="handleSubmit" />
    </el-card>
  </div>
</template>
<script setup>
// ===== 核心依赖导入 =====
import { ref, reactive, onMounted, computed, getCurrentInstance } from "vue";
import {computed, getCurrentInstance, onMounted, reactive, ref, nextTick} from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue";
import {Delete, Download, Plus} from "@element-plus/icons-vue";
// ===== 组件导入 =====
import DataTable from "@/components/Table/ETable.vue";
@@ -74,18 +79,20 @@
import coalMeiZhiZiDuanWeiHu from "./mould/coalMeiZhiZiDuanWeiHu.vue";
// ===== API 服务导入 =====
import { getSupply, delSupply } from "@/api/basicInformation/supplier.js";
import { getCoalInfo, delCoalInfo } from "@/api/basicInformation/coal.js";
import {delSupply, getSupply} from "@/api/basicInformation/supplier.js";
import {delCoalInfo, getCoalInfo} from "@/api/basicInformation/coal.js";
import { testUserList } from "@/api/tool/publicInterface.js";
import { getAreaOptions } from "@/api/system/area.js";
import { getCustomerList, delCustomer } from "@/api/basicInformation/customer.js";
import {delCustomer, getCustomerList} from "@/api/basicInformation/customer.js";
import { coalField, deleteCoalField } from "@/api/basicInformation/coalFieldMaintenance.js";
import { getCoalFieldList, getCoalPlanList } from "@/api/basicInformation/coalQualityMaintenance";
const { proxy } = getCurrentInstance();
import router from "@/router";
// ===== 响应式状态管理 =====
const jump = () => {
};
// 弹窗控制状态
const dialogFormVisible = ref(false);
const form = ref({});
@@ -608,7 +615,9 @@
    const deleteApiMap = {
      supplier: delSupply,
      coal: delCoalInfo,
      coalQualityMaintenance: () => { throw new Error('delCoalQuality API not imported'); },
      coalQualityMaintenance: () => {
        throw new Error('delCoalQuality API not imported');
      },
      customer: delCustomer,
      coalMeiZhiZiDuanWeiHu: deleteCoalField
    };
src/views/basicInformation/mould/coal.vue
@@ -6,7 +6,8 @@
            width="500"
            :close-on-click-modal="false"
            :before-close="handleClose"
        >            <el-form
    >
      <el-form
                ref="formRef"
                style="max-width: 600px; margin: 0 auto"
                :model="formData"
@@ -18,13 +19,15 @@
                        v-model="formData.coal"
                        placeholder="请输入煤种名称"
                    />
                </el-form-item>                <el-form-item label="维护人姓名" prop="maintainerId">
        </el-form-item>
        <el-form-item label="维护人姓名" prop="maintainerId">
                    <el-input
                        :value="userStore.name || ''"
                        placeholder="维护人姓名"
                        disabled
                    />
                </el-form-item>                <el-form-item label="维护日期" prop="maintenanceDate">
        </el-form-item>
        <el-form-item label="维护日期" prop="maintenanceDate">
                    <el-input
                        :value="getCurrentDate()"
                        placeholder="维护日期"
@@ -54,7 +57,8 @@
const props = defineProps({
    beforeClose: {
        type: Function,
        default: () => {}
    default: () => {
    }
    },
    form: {
        type: Object,
@@ -168,6 +172,7 @@
    { min: 17, max: 20, message: "请输入17-20位纳税人识别号", trigger: "blur" },
  ],
});
// 获取当前日期并格式化为 YYYY-MM-DD
function getCurrentDate() {
  const today = new Date();
src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue
@@ -19,15 +19,18 @@
            v-model="formData.fieldName"
            placeholder="请输入字段名称"
          />
        </el-form-item>        <el-form-item label="字段描述" prop="fieldDescription">
        </el-form-item>
        <el-form-item label="字段描述" prop="fieldDescription">
          <el-input v-model="formData.fieldDescription" type="textarea" placeholder="请输入字段描述" />
        </el-form-item>
        <el-form-item class="dialog-footer">
          <el-button v-if="addOrEdit === 'edit'" @click="resetForm"
            >重置</el-button
          >重置
          </el-button
          >
          <el-button v-if="addOrEdit === 'add'" @click="cancelForm"
            >取消</el-button
          >取消
          </el-button
          >
          <el-button type="primary" @click="submitForm"> 确定 </el-button>
        </el-form-item>
@@ -39,6 +42,7 @@
<script setup>
import { ref, reactive, watch, defineProps } from "vue";
import { addOrEditCoalField } from "@/api/basicInformation/coalFieldMaintenance.js";
const props = defineProps({
  form: {
    type: Object,
src/views/basicInformation/mould/coalQualityMaintenance.vue
@@ -12,7 +12,8 @@
      <!-- 煤质字段多选下拉框 -->
      <el-form-item label="煤质方案类型" prop="coalFieldList">
        <el-select v-model="formData.coalFieldList" placeholder="请选择煤质方案类型" style="width: 100%" clearable multiple>
        <el-select v-model="formData.coalFieldList" placeholder="请选择煤质方案类型" style="width: 100%" clearable
                   multiple>
          <el-option v-for="item in fieldOptions" :key="item.id" :label="item.label" :value="item" />
        </el-select>
      </el-form-item>
@@ -40,7 +41,8 @@
  /** 关闭弹窗前的回调函数 */
  beforeClose: {
    type: Function,
    default: () => { },
    default: () => {
    },
  },
  /** 表单数据 */
  form: {
@@ -58,7 +60,10 @@
    default: "",
  },
});
const copyForm = defineModel("copyForm", {
  required: true,
  type: Object,
});
// ===== 事件定义 =====
const emit = defineEmits(["submit", "handleBeforeClose"]);
@@ -248,8 +253,8 @@
 * 重置表单
 */
const resetForm = () => {
  if (!formRef.value) return;
  formRef.value.resetFields();
  formData.value = JSON.parse(JSON.stringify(copyForm.value));
  initFormData(formData.value);
};
/**
src/views/basicInformation/mould/customer.vue
@@ -2,7 +2,8 @@
  <div>
    <el-dialog v-model="dialogVisible" :title="title" width="600" :close-on-click-modal="false"
      :before-close="handleClose">
      <el-form ref="formRef" style="max-width: 400px; margin: 0 auto" :model="formData" :rules="rules" label-width="auto">
      <el-form ref="formRef" style="max-width: 400px; margin: 0 auto" :model="formData" :rules="rules"
               label-width="auto">
        <el-form-item label="客户名称" prop="customerName">
          <el-input v-model="formData.customerName" placeholder="请输入客户名称" />
        </el-form-item>
@@ -10,7 +11,8 @@
          <el-input v-model="formData.taxpayerId" placeholder="请输入纳税人识别号" />
        </el-form-item>
        <el-form-item label="经营地址" prop="bids">
          <el-cascader placeholder="请选择经营地址" size="default" :options="addressSelectOptions" v-model="formData.bids"
          <el-cascader placeholder="请选择经营地址" size="default" :options="addressSelectOptions"
                       v-model="formData.bids"
           :props="cascaderProps" @change="handleChange">
          </el-cascader>
        </el-form-item>
@@ -31,7 +33,8 @@
        </el-form-item>
  
        <el-form-item label="联系人地址" prop="cids">
          <el-cascader placeholder="请选择联系人地址" size="default" :options="addressSelectOptions" v-model="formData.cids"
          <el-cascader placeholder="请选择联系人地址" size="default" :options="addressSelectOptions"
                       v-model="formData.cids"
            :props="cascaderProps" @change="handleChange">
          </el-cascader>
        </el-form-item>
@@ -59,7 +62,8 @@
const props = defineProps({
  beforeClose: {
    type: Function,
    default: () => { },
    default: () => {
    },
  },
  form: {
    type: Object,
src/views/basicInformation/mould/supplier.vue
@@ -2,7 +2,8 @@
  <div>
    <el-dialog v-model="dialogVisible" :title="title" width="600" :close-on-click-modal="false"
      :before-close="handleClose">
      <el-form ref="formRef" style="max-width: 400px; margin: 0 auto" :model="formData" :rules="rules" label-width="auto">
      <el-form ref="formRef" style="max-width: 400px; margin: 0 auto" :model="formData" :rules="rules"
               label-width="auto">
        <el-form-item label="供应商名称" prop="supplierName">
          <el-input v-model="formData.supplierName" placeholder="请输入供货商名称" />
        </el-form-item>
@@ -10,7 +11,8 @@
          <el-input v-model="formData.taxpayerId" placeholder="请输入纳税人识别号" />
        </el-form-item>
        <el-form-item label="经营地址" prop="bids">
          <el-cascader placeholder="请选择经营地址" size="default" :options="addressSelectOptions" v-model="formData.bids"
          <el-cascader placeholder="请选择经营地址" size="default" :options="addressSelectOptions"
                       v-model="formData.bids"
            :props="cascaderProps" @change="handleChange">
          </el-cascader>
        </el-form-item>
@@ -30,7 +32,8 @@
          <el-input v-model="formData.contactPhone" placeholder="请输入联系人电话" />
        </el-form-item>
        <el-form-item label="联系人地址" prop="cids">
          <el-cascader placeholder="请选择联系人地址" size="default" :options="addressSelectOptions" v-model="formData.cids"
          <el-cascader placeholder="请选择联系人地址" size="default" :options="addressSelectOptions"
                       v-model="formData.cids"
            :props="cascaderProps" @change="handleChange">
          </el-cascader>
        </el-form-item>
@@ -175,7 +178,6 @@
const resetForm = () => {
  if (!formRef.value) return;
  formData.value = JSON.parse(JSON.stringify(copyForm.value));
  // formRef.value.resetFields();
};
// 关闭弹窗
const handleClose = () => {
src/views/index.vue
@@ -1,14 +1,550 @@
<template>
  <div class="app-container">
  <div class="dashboard">
    <!-- 顶部统计卡片 -->
    <div class="top-cards">
      <div class="stat-card revenue">
        <div class="card-icon">
          <i class="el-icon-money"></i>
        </div>
        <div class="card-content">
          <div class="card-title">营收金额</div>
          <div class="card-value">¥1,234,567</div>
          <div class="card-trend">
            <span class="trend-label">较昨日</span>
            <span class="trend-value up">+12.5%</span>
          </div>
        </div>
      </div>
  
      <div class="stat-card supply">
        <div class="card-icon">
          <i class="el-icon-truck"></i>
        </div>
        <div class="card-content">
          <div class="card-title">供应量</div>
          <div class="card-value">8,965 吨</div>
          <div class="card-trend">
            <span class="trend-label">较昨日</span>
            <span class="trend-value up">+8.2%</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 中间图表区域 -->
    <div class="chart-section">
      <div class="chart-container">
        <div class="chart-title">营收分布</div>
        <div ref="pieChart" class="chart-content pie-chart"></div>
      </div>
      <div class="chart-container">
        <div class="chart-title">供应量趋势</div>
        <div ref="areaChart" class="chart-content area-chart"></div>
      </div>
    </div>
    <!-- 底部三栏布局 -->
    <div class="bottom-section">
      <!-- 库存统计 -->
      <div class="bottom-card inventory">
        <div class="card-header">
          <h3>库存统计</h3>
        </div>
        <div class="inventory-items">
          <div class="inventory-item">
            <div class="item-name">原煤</div>
            <div class="item-value">15,432 吨</div>
            <div class="item-status normal">正常</div>
          </div>
          <div class="inventory-item">
            <div class="item-name">精煤</div>
            <div class="item-value">8,765 吨</div>
            <div class="item-status normal">正常</div>
          </div>
          <div class="inventory-item">
            <div class="item-name">焦煤</div>
            <div class="item-value">3,241 吨</div>
            <div class="item-status low">偏低</div>
          </div>
          <div class="inventory-item">
            <div class="item-name">块煤</div>
            <div class="item-value">6,789 吨</div>
            <div class="item-status normal">正常</div>
          </div>
        </div>
      </div>
      <!-- 柱状图 -->
      <div class="bottom-card chart">
        <div class="card-header">
          <h3>月度对比</h3>
        </div>
        <div ref="barChart" class="chart-content bar-chart"></div>
      </div>
      <!-- 销售数据表格 -->
      <div class="bottom-card table">
        <div class="card-header">
          <h3>销售数据</h3>
        </div>
        <el-table
          :data="salesData"
          style="width: 100%"
          :header-cell-style="tableHeaderStyle"
        >
          <el-table-column prop="product" label="产品" width="80"></el-table-column>
          <el-table-column prop="quantity" label="数量" width="80"></el-table-column>
          <el-table-column prop="amount" label="金额" width="90"></el-table-column>
          <el-table-column prop="status" label="状态" width="70">
            <template #default="scope">
              <el-tag
                :type="scope.row.status === '已完成' ? 'success' : 'warning'"
                size="small"
              >
                {{ scope.row.status }}
              </el-tag>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
<script setup name="Index">
<script>
import * as echarts from 'echarts'
export default {
  name: 'Dashboard',
  data() {
    return {
      salesData: [
        { product: '原煤', quantity: '1,234吨', amount: '¥456,789', status: '已完成' },
        { product: '精煤', quantity: '567吨', amount: '¥234,567', status: '已完成' },
        { product: '焦煤', quantity: '890吨', amount: '¥345,678', status: '进行中' },
        { product: '块煤', quantity: '432吨', amount: '¥123,456', status: '已完成' },
        { product: '煤泥', quantity: '678吨', amount: '¥234,567', status: '进行中' }
      ],
      tableHeaderStyle: {
        backgroundColor: '#f5f7fa',
        color: '#606266',
        fontSize: '12px'
      }
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.initCharts()
    })
  },
  methods: {
    initCharts() {
      this.initPieChart()
      this.initAreaChart()
      this.initBarChart()
    },
    initPieChart() {
      const chart = echarts.init(this.$refs.pieChart)
      const option = {
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b}: {c} ({d}%)'
        },
        legend: {
          orient: 'vertical',
          left: 'right',
          top: 'center',
          textStyle: {
            fontSize: 12
          }
        },
        series: [
          {
            name: '营收分布',
            type: 'pie',
            radius: ['30%', '70%'],
            center: ['40%', '50%'],
            avoidLabelOverlap: false,
            label: {
              show: false,
              position: 'center'
            },
            emphasis: {
              label: {
                show: true,
                fontSize: '16',
                fontWeight: 'bold'
              }
            },
            labelLine: {
              show: false
            },
            data: [
              { value: 335, name: '原煤', itemStyle: { color: '#409EFF' } },
              { value: 310, name: '精煤', itemStyle: { color: '#67C23A' } },
              { value: 234, name: '焦煤', itemStyle: { color: '#E6A23C' } },
              { value: 135, name: '块煤', itemStyle: { color: '#F56C6C' } },
              { value: 155, name: '其他', itemStyle: { color: '#909399' } }
            ]
          }
        ]
      }
      chart.setOption(option)
      // 响应式
      window.addEventListener('resize', () => {
        chart.resize()
      })
    },
    initAreaChart() {
      const chart = echarts.init(this.$refs.areaChart)
      const option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            label: {
              backgroundColor: '#6a7985'
            }
          }
        },
        legend: {
          data: ['供应量'],
          top: 10
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          {
            type: 'category',
            boundaryGap: false,
            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月'],
            axisLabel: {
              fontSize: 12
            }
          }
        ],
        yAxis: [
          {
            type: 'value',
            axisLabel: {
              fontSize: 12
            }
          }
        ],
        series: [
          {
            name: '供应量',
            type: 'line',
            stack: 'Total',
            areaStyle: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                { offset: 0, color: 'rgba(64, 158, 255, 0.3)' },
                { offset: 1, color: 'rgba(64, 158, 255, 0.1)' }
              ])
            },
            emphasis: {
              focus: 'series'
            },
            data: [1200, 1320, 1010, 1340, 900, 1230, 1100],
            lineStyle: {
              color: '#409EFF'
            },
            itemStyle: {
              color: '#409EFF'
            }
          }
        ]
      }
      chart.setOption(option)
      // 响应式
      window.addEventListener('resize', () => {
        chart.resize()
      })
    },
    initBarChart() {
      const chart = echarts.init(this.$refs.barChart)
      const option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          }
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: {
          type: 'category',
          data: ['原煤', '精煤', '焦煤', '块煤', '煤泥'],
          axisLabel: {
            fontSize: 11
          }
        },
        yAxis: {
          type: 'value',
          axisLabel: {
            fontSize: 11
          }
        },
        series: [
          {
            name: '销量',
            type: 'bar',
            data: [320, 302, 301, 334, 290],
            itemStyle: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                { offset: 0, color: '#409EFF' },
                { offset: 1, color: '#79bbff' }
              ])
            },
            barWidth: '60%'
          }
        ]
      }
      chart.setOption(option)
      // 响应式
      window.addEventListener('resize', () => {
        chart.resize()
      })
    }
  }
}
</script>
<style scoped lang="scss">
<style scoped>
.dashboard {
  padding: 20px;
  background-color: #f5f7fa;
  min-height: 100vh;
}
/* 顶部统计卡片 */
.top-cards {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.stat-card {
  flex: 1;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
}
.card-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}
.revenue .card-icon {
  background: linear-gradient(135deg, #409EFF, #79bbff);
}
.supply .card-icon {
  background: linear-gradient(135deg, #67C23A, #95d475);
}
.card-content {
  flex: 1;
}
.card-title {
  font-size: 14px;
  color: #909399;
  margin-bottom: 8px;
}
.card-value {
  font-size: 24px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 5px;
}
.card-trend {
  font-size: 12px;
}
.trend-label {
  color: #909399;
  margin-right: 5px;
}
.trend-value.up {
  color: #67C23A;
}
/* 中间图表区域 */
.chart-section {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.el-scrollbar__view{
  width: 100%;
}
.chart-container {
  flex: 1;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.chart-title {
  font-size: 16px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}
.chart-content {
  height: 280px;
}
/* 底部三栏布局 */
.bottom-section {
  display: flex;
  gap: 20px;
}
.bottom-card {
  flex: 1;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.card-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}
.card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
  color: #303133;
}
/* 库存统计样式 */
.inventory-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inventory-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #409EFF;
}
.item-name {
  font-weight: bold;
  color: #303133;
}
.item-value {
  color: #606266;
  font-size: 14px;
}
.item-status {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}
.item-status.normal {
  background: #f0f9ff;
  color: #67C23A;
}
.item-status.low {
  background: #fef0e6;
  color: #E6A23C;
}
/* 柱状图容器 */
.bar-chart {
  height: 200px;
}
/* 表格样式调整 */
.bottom-card.table {
  min-width: 320px;
}
.bottom-card.table .el-table {
  font-size: 12px;
}
.bottom-card.table .el-table td,
.bottom-card.table .el-table th {
  padding: 8px 0;
}
/* 响应式设计 */
@media (max-width: 1200px) {
  .bottom-section {
    flex-direction: column;
  }
  .chart-section {
    flex-direction: column;
  }
}
@media (max-width: 768px) {
  .top-cards {
    flex-direction: column;
  }
  .dashboard {
    padding: 10px;
  }
  .stat-card {
    padding: 15px;
  }
  .card-value {
    font-size: 20px;
  }
}
</style>
src/views/procureMent/components/ProductionDialog.vue
@@ -26,17 +26,6 @@
            <el-option :label="item.label" v-for="item in coalList" :key="item.value" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="单位" prop="unit">
          <el-select
            v-model="form.unit"
            placeholder="请选择单位"
            clearable
            style="width: 100%"
          >
            <el-option label="吨" value="吨" />
            <el-option label="千克" value="千克" />
          </el-select>
        </el-form-item>
        <el-form-item label="采购数量" prop="purchaseQuantity">
          <el-input
            v-model.number="form.purchaseQuantity"
@@ -44,10 +33,12 @@
            @blur="handleQuantityBlur"
          >
            <template v-slot:suffix>
              <i style="font-style: normal">{{ form.unit ? form.unit : "" }}</i>
              <i style="font-style: normal">吨</i>
            </template>
          </el-input> </el-form-item
        ><el-form-item label="税率" prop="taxRate">
          </el-input>
        </el-form-item
        >
        <el-form-item label="税率" prop="taxRate">
          <el-input
            v-model.number="form.taxRate"
            placeholder="请输入税率"
@@ -117,10 +108,12 @@
        <div class="dialog-footer">
          <!-- 重置和取消 -->
          <el-button @click="handleClose" v-if="title.includes('新增')"
            >取消</el-button
          >取消
          </el-button
          >
          <el-button @click="handleReset" v-if="title.includes('编辑')"
            >重置</el-button
          >重置
          </el-button
          >
          <el-button type="primary" @click="handleSubmit">确认</el-button>
        </div>
@@ -134,8 +127,7 @@
import { ElMessage } from "element-plus";
import useUserStore from "@/store/modules/user";
import { addOrEditPR,getSupplyList, getCoalInfoList } from "@/api/procureMent";
import { getSupply } from "@/api/basicInformation/supplier";
import { getCoalInfo } from "@/api/basicInformation/coal";
const props = defineProps({
  title: {
    type: String,
@@ -164,7 +156,6 @@
      getSupplyList(),
      getCoalInfoList(),
    ]);
    console.log(supplyRes, coalRes);
    let supplyData = supplyRes.data;
    let coalData = coalRes.data;
    supplyList.value = supplyData.map((item) => ({
@@ -296,7 +287,6 @@
    { required: true, message: "请输入供应商名称", trigger: "blur" },
  ],
  coal: [{ required: true, message: "请输入煤种", trigger: "blur" }],
  unit: [{ required: true, message: "请输入单位", trigger: "blur" }],
  purchaseQuantity: [
    { required: true, message: "请输入采购数量", trigger: "blur" },
    { type: "number", message: "采购数量必须为数字", trigger: "blur" },
src/views/procureMent/index.vue
@@ -18,12 +18,11 @@
      <!-- 操作按钮区 -->
      <el-row :gutter="24" class="table-toolbar">
        <el-button type="primary" :icon="Plus" @click="handleAdd"
          >新建</el-button
        >
          >新建
        </el-button>
        <el-button type="danger" :icon="Delete" @click="handleDelete"
          >删除</el-button
        >
        <!-- <el-button type="info" :icon="Download" @click="handleExport">导出</el-button> -->
          >删除
        </el-button>
      </el-row>
      <!-- 表格组件 -->
      <data-table
@@ -66,7 +65,12 @@
import DataTable from "@/components/Table/ETable.vue";
import Pagination from "@/components/Pagination";
import ProductionDialog from "./components/ProductionDialog.vue";
import { purchaseRegistration } from "@/api/procureMent";
import {
  purchaseRegistration,
  getSupplyList,
  getCoalInfoList,
} from "@/api/procureMent";
import useUserStore from "@/store/modules/user";
// 引入字典数据
const { proxy } = getCurrentInstance();
@@ -117,9 +121,22 @@
// supplier 供应商数据
const columns = ref([
  { prop: "supplierName", label: "供应商名称", minWidth: 200 },
  { prop: "coal", label: "煤种类型", minWidth: 120 },
  { prop: "unit", label: "单位", minWidth: 150 },
  {
    prop: "supplierId",
    label: "供应商名称",
    minWidth: 200,
    formatter: (row) => {
      return MatchQuery(row.supplierId, "supplyRes") || "未知供应商";
    },
  },
  {
    prop: "coalId",
    label: "煤种类型",
    minWidth: 120,
    formatter: (row) => {
      return MatchQuery(row.coalId, "coalRes") || "未知煤种";
    },
  },
  { prop: "purchaseQuantity", label: "采购数量", minWidth: 100 },
  { prop: "priceIncludingTax", label: "单价(含税)", minWidth: 150 },
  { prop: "totalPriceIncludingTax", label: "总价(含税)", minWidth: 100 },
@@ -128,6 +145,16 @@
  { prop: "registrantId", label: "登记人", minWidth: 100 },
  { prop: "registrationDate", label: "登记日期", minWidth: 100 },
]);
// 匹配查询字段
const MatchQuery = (data, name) => {
  const list = name === "supplyRes" ? supplyRes.value.data : coalRes.value.data;
  const item = list.find((items) => items.id == data);
  return item ? item.coal || item.supplierName  : "";
};
// 获取供应商列表
const supplyRes = ref([]);
const coalRes = ref([]);
// 重置查询
const resetQuery = () => {
@@ -167,7 +194,7 @@
  form.value = {
    supplierName: "",
    coal: "",
    unit: "",
    unit: "吨",
    purchaseQuantity: "",
    priceExcludingTax: "",
    totalPriceExcludingTax: "",
@@ -227,17 +254,6 @@
const handleDeleteSuccess = (row) => {
  ElMessage.success("删除成功:" + row.supplierName);
};
// 导出
const handleExport = (row) => {
  proxy.download(
    "system/post/export",
    {
      ...queryParams.value,
    },
    `post_${new Date().getTime()}.xlsx`
  );
  ElMessage.success("导出数据:" + row.supplierName);
};
// 成功
const handleSuccess = (val) => {
  tableData.value.push(val);
@@ -248,6 +264,10 @@
const getList = async () => {
  loading.value = true;
  try {
    [supplyRes.value, coalRes.value] = await Promise.all([
      getSupplyList(),
      getCoalInfoList(),
    ]);
    // 传递分页参数
    let res = await purchaseRegistration({
      current: current.value,
@@ -271,6 +291,7 @@
.app-container {
  box-sizing: border-box;
}
.search-form {
  background-color: #fff;
  padding: 20px 20px 0 20px;
@@ -278,6 +299,7 @@
  border-radius: 4px;
  box-shadow: var(--el-box-shadow-light);
}
.search-form :deep(.el-form-item) {
  margin-bottom: 16px;
  width: 100%;
@@ -289,11 +311,13 @@
    width: 50%;
  }
}
@media screen and (min-width: 1200px) {
  .search-form :deep(.el-form-item) {
    width: 18%;
  }
}
.table-toolbar {
  margin-bottom: 20px;
  display: flex;
@@ -306,15 +330,18 @@
  .table-toolbar {
    flex-direction: column;
  }
  .table-toolbar .el-button {
    width: 100%;
  }
}
/* 表格工具栏 */
.table-toolbar,
.table-toolbar > * {
  margin: 0 0 0 0 !important;
}
.table-toolbar {
  margin-bottom: 20px !important;
}
src/views/production/components/ProductionDetailsTable.vue
@@ -151,6 +151,7 @@
import { getCoalFieldList } from "@/api/basicInformation/coalQualityMaintenance";
import { getCoalInfoList } from "@/api/production";
import { userListAll } from "@/api/publicApi";
const props = defineProps({
  modelValue: {
    type: Array,
src/views/production/components/ProductionDialog.vue
@@ -9,7 +9,12 @@
    <el-row :gutter="10" style="margin-bottom: 10px">
      <el-col :span="3">
        <el-button type="primary" @click="handlData"
          ><el-icon> <Plus /> </el-icon>选择数据</el-button
        >
          <el-icon>
            <Plus/>
          </el-icon>
          选择数据
        </el-button
        >
      </el-col>
      <el-col :span="4">
@@ -79,13 +84,15 @@
        <el-button
          @click="handleClose"
          v-if="dialogType === 'add' || dialogType === 'edit'"
          >取 消</el-button
        >取 消
        </el-button
        >
        <!-- <el-button @click="handleReset" v-if="dialogType === 'edit'"
          >重 置</el-button
        > -->
        <el-button type="primary" :loading="loading" @click="handleSubmit"
          >确 定</el-button
        >确 定
        </el-button
        >
      </div>
    </template>
@@ -150,6 +157,7 @@
import {
  getOfficialAll,
  addOrEditPM,
  getCoalInfoList,
  deleteProductionInventory,
} from "@/api/production/index.js";
import { validateFormData, validateNumber, deepClone, createDefaultProductionRow } from "@/utils/production";
@@ -185,9 +193,15 @@
const selectedIds = ref([]);
const currentRow = ref(null);
const copyForm = ref(null);
const coalList = ref([])
const supplierList = ref({});
// 表格列配置
const columns = [
  { label: "煤种", prop: "coal", minwidth: 120 },
  {prop: "coalId", label: "煤种", minwidth: 60,slot:false,
    formatter: (row) => {
      return coalList.value.find(coal => coal.id === row.coalId)?.coal || "--";
    }
  },
  { label: "库存数量", prop: "inventoryQuantity", minwidth: 100 },
  {
    label: "使用数量",
@@ -199,8 +213,18 @@
];
const formalDatabaseColumns = ref([
  { prop: "supplierName", label: "供应商名称", minwidth: 150 },
  { prop: "coal", label: "煤种类型", minwidth: 60 },
  {prop: "supplierName", label: "供应商名称", minwidth: 150
  // ,formatter: (row) => {
  //     console.log(row);
  //     return supplierList.value[row.supplierId] || "--";
  //   }
  },
  {prop: "coalId", label: "煤种", minwidth: 60,
    formatter: (row) => {
      // return coalList.value[row.coalId].coal || "--";
      return coalList.value.find(coal => coal.id === row.coalId)?.coal || "--";
    }
  },
  { prop: "inventoryQuantity", label: "库存数量", minwidth: 80 },
  { prop: "unit", label: "单位", minwidth: 20 },
  { prop: "priceExcludingTax", label: "单价(不含税)", minwidth: 80 },
@@ -222,9 +246,12 @@
// 获取配置数据
const handlData = async () => {
  innerVisible.value = true;
  let res = await getOfficialAll();
  if (res.code === 200) {
    formalDatabaseData.value = res.data;
  let getSupplier = await getOfficialAll();
  let getCoalName = await getCoalInfoList();
  coalList.value = getCoalName.data || [];
  supplierList.value = getSupplier.data || [];
  if (getSupplier.code === 200) {
    formalDatabaseData.value = getSupplier.data;
    const existingOfficialIds = tableData.value
      .map((item) => item.officialId)
      .filter((id) => id);
@@ -484,7 +511,8 @@
      selectedIds.value = [];
      ElMessage.success("已清空所有数据");
    })
    .catch(() => {});
      .catch(() => {
      });
};
// 计算总使用量
@@ -507,6 +535,7 @@
.el-row > .el-col > h1 {
  font-weight: bolder;
}
.empty-table > .el-row {
  margin-bottom: 12px;
}
src/views/production/components/useCoalData.js
src/views/production/components/useDialog.js
src/views/production/components/useTableData.js
src/views/production/index.vue
@@ -38,7 +38,8 @@
        :show-selection="true"
        :border="true"
        :maxHeight="480"
      >        <template #coal="{ row }">
      >
        <template #coal="{ row }">
          <div class="coal-tags">
            <el-tag v-for="coal in parseCoalArray(row.coal)" :key="coal" size="small">
              {{ getCoalNameById(coal) }}
@@ -158,6 +159,7 @@
    width: 20%;
  }
}
.search-form {
  display: flex;
  justify-content: space-between;
@@ -172,6 +174,7 @@
    margin-left: 10px;
  }
}
.coal-tags {
  display: flex;
  flex-wrap: wrap;