张诺
6 天以前 8e6c6bec574c0515bb82d686b713d447b688fd50
src/views/production/components/ProductionDialog.vue
@@ -1,4 +1,4 @@
<template>
div<template>
  <el-dialog
    v-model="dialogVisible"
    :title="dialogType === 'add' ? '新增生产加工' : '编辑生产加工'"
@@ -7,8 +7,7 @@
    @close="handleClose"
  >
    <el-button type="primary" @click="handlData">选择数据</el-button>
    <ETable
      v-if="tableData.length > 0"
    <ETableModify
      :columns="columns"
      height="200"
      @cell-edit="handleCellEdit"
@@ -17,7 +16,7 @@
      @row-click="handleRowClick"
      :editableColumns="['used']"
    />
    <div v-if="tableData.length > 0" class="empty-table">
    <div class="empty-table">
    <h1>生产明细</h1>
      <el-row :gutter="10">
      <el-col :span="2">
@@ -52,8 +51,8 @@
      @input-change="handleDetailsChange"
      @delete-row="handleDeleteRow"
    />
    </div>
      <div style="margin-top: 20px;" v-else>暂无数据,请选择配置数据</div>
    <template #footer>
      <div class="dialog-footer">
@@ -68,12 +67,13 @@
    v-model="innerVisible"
    width="1000"
    title="选择配置数据"
    center
    append-to-body
  >
    <ETable
      @selection-change="handleSelectionChange"
      :showOperations="false"
      :columns="formalDatabaseDataColumns"
      :columns="formalDatabaseColumns"
      :tableData="formalDatabaseData"
      height="400"
      @cell-edit="handleCellEdit"
@@ -89,10 +89,12 @@
<script setup>
import { ref, reactive, watch } from "vue";
import ETable from "@/components/Table/EtableModify.vue";
import ETable from "@/components/Table/ETable.vue";
import ETableModify from "@/components/Table/EtableModify.vue";
import ProductionDetailsTable from "./ProductionDetailsTable.vue";
import { ElMessage } from "element-plus";
import { Delete, Warning, Plus } from "@element-plus/icons-vue";
import { getOfficialAll } from "@/api/production/index.js";
const props = defineProps({
  visible: {
@@ -121,37 +123,24 @@
const tableData = ref([]);
const currentRow = ref(null);
const columns = [
  { label: "煤种", prop: "category" },
  { label: "热值", prop: "Calorific" },
  { label: "库存数量", prop: "stock" },
  { label: "本次使用数量", prop: "used" },
  { label: "供应商名称", prop: "supplierName" },
  { label: "煤种", prop: "coal" },
];
const detailsTableData = ref([
  {
    coalType: "",
    calorificValue: "",
    productionQuantity: "",
    laborCost: "",
    energyCost: "",
    equipmentDepreciation: "",
    purchasePrice: "",
    totalCost: "",
  },
]);
const handleRowClick = (row) => {
  currentRow.value = row;
};
const formalDatabaseDataColumns = ref([
  { prop: "name", label: "供应商名称", width: 150 },
  { prop: "type", label: "煤种类型", width: 120 },
const formalDatabaseColumns = ref([
  { prop: "supplierName", label: "供应商名称", width: 150 },
  { prop: "coal", label: "煤种类型", width: 120 },
  { prop: "unit", label: "单位", width: 100 },
  { prop: "number", label: "采购数量", width: 100 },
  { prop: "money", label: "单价(含税)", width: 120 },
  { prop: "money1", label: "总价(含税)", width: 120 },
  { prop: "money2", label: "税率", width: 80 },
  { prop: "money3", label: "不含税单价", width: 120 },
  { prop: "createUser", label: "登记人", width: 100 },
  { prop: "createTime", label: "登记日期", width: 150 },
  { prop: "inventoryQuantity", label: "库存数量", width: 100 },
  { prop: "priceIncludingTax", label: "单价(含税)", width: 120 },
  { prop: "totalPriceIncludingTax", label: "总价(含税)", width: 120 },
  { prop: "priceExcludingTax", label: "单价(不含税)", width: 120 },
  { prop: "totalPriceExcludingTax", label: "总价(不含税)", width: 120 },
]);
// 表单数据
const formData = reactive({
@@ -167,8 +156,15 @@
  reviewer: "",
  date: "",
});
const handlData = () => {
const handlData =async () => {
  innerVisible.value = true;
  let res = await getOfficialAll();
  console.log("获取配置数据", res);
  if (res.code === 200) {
    formalDatabaseData.value = res.data;
  } else {
    ElMessage.error("获取配置数据失败");
  }
};
const formalDatabaseData = ref([]);
const formalDatabaseSelectedData = ref([]);
@@ -342,16 +338,13 @@
      (row) => row.id === item.id
    );
    if (!existingItem) {
      tableData.value.push({
        id: item.id,
        category: item.type,
        Calorific: item.money4,
        stock: item.number,
        used: 0, // 初始使用数量为0
      });
      tableData.value.push([item, {
        used: 0, // 添加默认的使用数量
      }]);
    }
  });
  innerVisible.value = false;
  console.log("选中的数据:", tableData.value);
};
const handleSelectionChange = (selection) => {
  formalDatabaseSelectedData.value = selection;
@@ -452,4 +445,7 @@
.el-row > .el-col > h1 {
  font-weight: bolder;
}
.empty-table > .el-row{
  margin-bottom: 12px;
}
</style>