gaoluyang
3 天以前 ecb800b7af57ecf5d14c41a6cf54a16c3be61094
Merge remote-tracking branch 'origin/dev' into dev
已修改10个文件
128 ■■■■ 文件已修改
src/api/production/index.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/production.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/archiveManagement/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/archiveManagement/mould/archiveDialog.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procureMent/index.vue 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/ProductionDetailsTable.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/ProductionDialog.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/useCoalData.js 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/components/useTableData.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/production/index.js
@@ -67,4 +67,14 @@
        method: 'delete',
        data: data
    })
}
// /coalInfo/coalInfoList
// 查询煤种列表
export function getCoalInfoList(query) {
    return request({
        url: '/coalInfo/coalInfoList',
        method: 'get',
        params: query
    })
}
src/utils/production.js
@@ -61,6 +61,7 @@
  }
  for (let i = 0; i < data.length; i++) {
    console.log(data[i])
    const item = data[i];
    for (const field of requiredFields) {
      if (item[field] === '' || item[field] === null || item[field] === undefined) {
@@ -128,7 +129,7 @@
 */
export function createDefaultProductionRow(userData = {}, extraData = {}) {
  return {
    coal: "",
    coalId: "",
    productionQuantity: "",
    laborCost: "",
    energyConsumptionCost: "",
src/views/archiveManagement/index.vue
@@ -176,7 +176,7 @@
  selectedRows.splice(0, selectedRows.length, ...selection);
};
const queryParams = reactive({
  searchText: "",
  searchAll: "",
  current: 1,
  pageSize: 10, // 固定每页10条
  treeId: null, // 当前树节点ID
src/views/archiveManagement/mould/archiveDialog.vue
@@ -36,11 +36,12 @@
      </el-row>
    </template>
    <fileUpload
    ref="fileUploadRef"
    :fileSize="1024"
    :fileType="['pdf', 'docx', 'txt', 'xlsx', 'pptx....']"
    :limit="10"
    v-model:modelValue="modelValue"
      ref="fileUploadRef"
      :fileSize="1024"
      :fileType="['pdf', 'docx', 'txt', 'xlsx', 'pptx....']"
      :limit="10"
      :drag="false"
      v-model:modelValue="modelValue"
    />
  </el-dialog>
</template>
@@ -98,14 +99,13 @@
};
const fileUploadRef = ref(null);
const initForm = () => {
  ruleForm.value = {}
  fileUploadRef.value.init()
  ruleForm.value = {};
  fileUploadRef.value.init();
};
const editForm = (val) => {
  ruleForm.value = copyForm.value;
  nextTick(() => {
  fileUploadRef.value.editInit(val);
    fileUploadRef.value.editInit(val);
  });
};
defineExpose({
@@ -145,7 +145,7 @@
      return;
    }
    // 发送 emit 事件
    // 关闭对话框
    centerDialogVisible.value = false;
  } catch (error) {
src/views/procureMent/index.vue
@@ -3,32 +3,8 @@
    <el-form :inline="true" :model="queryParams" class="search-form">
      <el-form-item label="搜索">
        <el-input
          v-model="queryParams.searchText"
          placeholder="请输入关键词"
          clearable
          :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-form-item label="供应商名称">
        <el-input
          v-model="queryParams.supplierName"
          placeholder="请输入"
          clearable
          :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-form-item label="统一人识别号">
        <el-input
          v-model="queryParams.identifyNumber"
          placeholder="请输入"
          clearable
          :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-form-item label="经营地址">
        <el-input
          v-model="queryParams.address"
          placeholder="请输入"
          v-model="queryParams.searchAll"
          placeholder="请输入供应商/煤种"
          clearable
          :style="{ width: '100%' }"
        />
@@ -56,6 +32,7 @@
        :columns="columns"
        @selection-change="handleSelectionChange"
        @edit="handleEdit"
        :showOverflowTooltip="false"
        @delete="handleDeleteSuccess"
        :show-selection="true"
        :border="true"
@@ -105,7 +82,7 @@
const copyForm = ref({});
// 查询参数
const queryParams = reactive({
  searchText: "",
  searchAll: "",
  supplierName: "",
  identifyNumber: "",
  address: "",
@@ -154,11 +131,15 @@
// 重置查询
const resetQuery = () => {
  Object.keys(queryParams).forEach((key) => {
    if (key !== "current" && key !== "pageSize") {
      queryParams[key] = "";
    }
  });
  queryParams.searchAll = "";
  queryParams.supplierName = "";
  queryParams.identifyNumber = "";
  queryParams.address = "";
  current.value = 1;
  pageSize.value = 10;
  queryParams.current = current.value;
  queryParams.pageSize = pageSize.value;
  getList();
};
// 新增
const handleAdd = () => {
src/views/production/components/ProductionDetailsTable.vue
@@ -4,11 +4,11 @@
      <template #default="{ row, $index }">
        <el-select 
          clearable 
          :model-value="getCoalNameById(row.coal) || row.coal"
          :model-value="getCoalNameById(row.coalId) || row.coalId"
          placeholder="请选择煤种"
          @change="(value) => handleCoalSelectChange(row, value)"
          filterable
          :key="`coal-select-${$index}-${weekList.length}`"
          :key="`coalId-select-${$index}-${weekList.length}`"
        >
          <el-option
            v-for="(item, index) of weekList"
@@ -149,6 +149,7 @@
import { ref, computed, watch, onMounted, nextTick } from "vue";
import { Delete } from "@element-plus/icons-vue";
import { getCoalFieldList } from "@/api/basicInformation/coalQualityMaintenance";
import { getCoalInfoList } from "@/api/production";
import { userListAll } from "@/api/publicApi";
const props = defineProps({
  modelValue: {
@@ -233,16 +234,16 @@
  // 根据选择的名称找到对应的ID
  const coalItem = weekList.value.find(item => item.value === selectedName);
  if (coalItem) {
    row.coal = coalItem.key; // 设置为ID
    row.coalId = coalItem.key; // 设置为ID
  } else {
    row.coal = ''; // 如果没找到,清空
    row.coalId = ''; // 如果没找到,清空
  }
};
// 根据ID获取煤种名称(用于显示)
const getCoalNameById = (id) => {
  const coal = weekList.value.find(item => item.key == id);
  return coal ? coal.value : id;
  const coalId = weekList.value.find(item => item.key == id);
  return coalId ? coalId.value : id;
};
const weekList = ref([]);
@@ -268,10 +269,11 @@
}, { deep: true });
onMounted(async()=>{
  let res = await getCoalFieldList()
  let res = await getCoalInfoList()
  console.log(res);
  res.data.forEach(item => {
    let obj = {};
    obj.value = item.fieldName;
    obj.value = item.coal;
    obj.key = item.id;
    weekList.value.push(obj); 
  });
@@ -292,7 +294,7 @@
  let res = await getCoalFieldList();
  if (res.code === 200) {
    dropdownList.value = res.data.map((item) => ({
      value: item.fieldName,
      value: item.coal,
      key: item.id,
    }));
  } else {
@@ -348,11 +350,12 @@
defineExpose({
  calculateTotalCost,
  getDropdownData,
  getUserList,
  getCoalNameById, // 暴露获取煤种名称的方法
  weekList, // 暴露weekList让父组件可以访问
  addRow: (rowData = {}) => {
    const defaultRow = {
      coal: "",
      coalId: "",
      calorificValue: "",
      productionQuantity: "",
      laborCost: "",
src/views/production/components/ProductionDialog.vue
@@ -347,7 +347,7 @@
const handleSubmit = async () => {
  // 验证生产明细数据
  const detailsValidation = validateFormData(detailsTableData.value, [
    "coal",
    "coalId",
    "productionQuantity", 
    "laborCost",
    "energyConsumptionCost",
src/views/production/components/useCoalData.js
@@ -3,7 +3,7 @@
 * 提供煤种数据的获取、缓存、转换等功能
 */
import { ref, computed, watch } from 'vue';
import { getCoalFieldList } from '@/api/basicInformation/coalQualityMaintenance';
import { getCoalInfoList } from "@/api/production";
import { ElMessage } from 'element-plus';
// 全局煤种数据缓存
@@ -33,7 +33,7 @@
    isLoading.value = true;
    try {
      const res = await getCoalFieldList();
      const res = await getCoalInfoList();
      if (res.code === 200) {
        coalData.value = res.data;
        isLoaded.value = true;
@@ -55,21 +55,21 @@
  const getCoalNameById = (id) => {
    if (!id || coalData.value.length === 0) return id;
    const coal = coalData.value.find(item => item.id == id);
    return coal ? coal.fieldName : id;
    return coal ? coal.coal : id;
  };
  // 根据名称获取煤种ID
  const getCoalIdByName = (name) => {
    if (!name || coalData.value.length === 0) return '';
    const coal = coalData.value.find(item => item.fieldName === name);
    const coal = coalData.value.find(item => item.coal === name);
    return coal ? coal.id : '';
  };
  // 生成下拉选项
  const coalOptions = computed(() => {
    return coalData.value.map(item => ({
      label: item.fieldName,
      value: item.fieldName,
      label: item.coal,
      value: item.coal,
      key: item.id
    }));
  });
@@ -78,7 +78,7 @@
  const coalMap = computed(() => {
    const map = {};
    coalData.value.forEach(item => {
      map[item.id] = item.fieldName;
      map[item.id] = item.coal;
    });
    return map;
  });
src/views/production/components/useTableData.js
@@ -32,13 +32,8 @@
        [searchField]: queryParams[searchField],
        current: queryParams.current,
        size: queryParams.size,
        page: queryParams.current,
        pageSize: queryParams.size,
        pageNum: queryParams.current,
        limit: queryParams.size,
        offset: (queryParams.current - 1) * queryParams.size
      };
      console.log('查询参数:', params);
      const res = await apiFunction(params);
      tableData.value = res.data.records || [];
      total.value = res.data.total || 0;
@@ -59,6 +54,7 @@
  // 重置搜索
  const handleReset = () => {
    queryParams[searchField] = '';
    console.log('重置搜索参数:', queryParams);
    handleSearch();
  };
src/views/production/index.vue
@@ -89,7 +89,6 @@
  { prop: "energyConsumptionCost", label: "能耗成本", minWidth: 120 },
  { prop: "equipmentDepreciation", label: "设备折旧", minWidth: 143 },
  { prop: "totalCost", label: "总成本", minWidth: 150 },
  { prop: "producer", label: "生产人", minWidth: 150 },
];
// 使用表格数据组合式函数