张诺
4 天以前 94152361e48cf51597fc1760a03f9610f9664340
src/views/production/components/ProductionDialog.vue
@@ -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"
@@ -19,7 +18,7 @@
    />
    <div class="empty-table">
    <h1>生产明细</h1>
      <el-row :gutter="10" v-if="tableData.length > 0">
      <el-row :gutter="10">
      <el-col :span="2">
        <el-button type="primary" @click="addNewRow">
          <el-icon>
@@ -45,7 +44,6 @@
      </el-col> -->
    </el-row>
    <ProductionDetailsTable
     v-if="tableData.length > 0"
      v-model="detailsTableData"
      :border="false"
      :show-operations="true"
@@ -53,7 +51,6 @@
      @input-change="handleDetailsChange"
      @delete-row="handleDeleteRow"
    />
      <div style="margin-top: 20px;" v-else>暂无数据,请选择配置数据</div>
    </div>
@@ -70,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"
@@ -91,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: {
@@ -123,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({
@@ -169,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([]);
@@ -344,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;