张诺
2 天以前 0f4dc4ea8a7de1ffdf34a640c79c29d55b79321c
src/views/production/components/ProductionDialog.vue
@@ -125,6 +125,16 @@
const columns = [
  { label: "供应商名称", prop: "supplierName" },
  { label: "煤种", prop: "coal" },
  { label: "单价(不含税)", prop: "priceExcludingTax" },
  { label: "库存数量", prop: "inventoryQuantity" },
  {
    label: "使用数量",
    prop: "used",
    editable: true,
    width: 120,
    editType: "number",
  },
];
const detailsTableData = ref([
  
@@ -133,14 +143,12 @@
  currentRow.value = row;
};
const formalDatabaseColumns = ref([
  { prop: "supplierName", label: "供应商名称", width: 150 },
  { prop: "coal", label: "煤种类型", width: 120 },
  { prop: "unit", label: "单位", width: 100 },
  { 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 },
  { prop: "supplierName", label: "供应商名称", minwidth: 150 },
  { prop: "coal", label: "煤种类型", minwidth: 60 },
  { prop: "inventoryQuantity", label: "库存数量", minwidth: 80 },
  { prop: "unit", label: "单位", minwidth: 100 },
  { prop: "priceExcludingTax", label: "单价(不含税)", minwidth: 80 },
  { prop: "createTime", label: "登记日期", minwidth: 400 },
]);
// 表单数据
const formData = reactive({
@@ -169,156 +177,9 @@
const formalDatabaseData = ref([]);
const formalDatabaseSelectedData = ref([]);
formalDatabaseData.value = [
  {
    id: 1,
    name: "供应商A",
    type: "动力煤",
    unit: "吨",
    number: 120,
    money: 500,
    money1: 200,
    money2: 200,
    money3: 300,
    money4: "高位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 2,
    name: "供应商A",
    type: "动力煤",
    unit: "吨",
    number: 100,
    money: 600,
    money1: 300,
    money2: 300,
    money3: 300,
    money4: "低位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 3,
    name: "供应商B",
    type: "焦煤",
    unit: "吨",
    number: 300,
    money: 789,
    money1: 400,
    money2: 400,
    money3: 400,
    money4: "高位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 4,
    name: "供应商B",
    type: "焦煤",
    unit: "吨",
    number: 256,
    money: 800,
    money1: 420,
    money2: 420,
    money3: 420,
    money4: "低位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 5,
    name: "供应商C",
    type: "无烟煤",
    unit: "吨",
    number: 256,
    money: 700,
    money1: 300,
    money2: 300,
    money3: 300,
    money4: "高位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 6,
    name: "供应商A",
    type: "动力煤",
    unit: "吨",
    number: 120,
    money: 500,
    money1: 200,
    money2: 200,
    money3: 300,
    money4: "高位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 7,
    name: "供应商A",
    type: "动力煤",
    unit: "吨",
    number: 100,
    money: 600,
    money1: 300,
    money2: 300,
    money3: 300,
    money4: "低位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 8,
    name: "供应商B",
    type: "焦煤",
    unit: "吨",
    number: 300,
    money: 789,
    money1: 400,
    money2: 400,
    money3: 400,
    money4: "高位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 9,
    name: "供应商B",
    type: "焦煤",
    unit: "吨",
    number: 256,
    money: 800,
    money1: 420,
    money2: 420,
    money3: 420,
    money4: "低位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
  {
    id: 10,
    name: "供应商C",
    type: "无烟煤",
    unit: "吨",
    number: 256,
    money: 700,
    money1: 300,
    money2: 300,
    money3: 300,
    money4: "高位",
    createUser: "admin",
    createTime: "2025-06-01",
  },
];
// 表单验证规则
const rules = {
  category: [{ required: true, message: "请选择煤种", trigger: "change" }],
};
// 初始化
const Initialization = () => {
  console.log("初始化数据");
  tableData.value = [];
};
defineExpose({
@@ -338,13 +199,14 @@
      (row) => row.id === item.id
    );
    if (!existingItem) {
      tableData.value.push([item, {
        used: 0, // 添加默认的使用数量
      }]);
      tableData.value.push(
        Object.assign({}, item, {
          used: 0, // 初始使用数量为0
        })
      );
    }
  });
  innerVisible.value = false;
  console.log("选中的数据:", tableData.value);
};
const handleSelectionChange = (selection) => {
  formalDatabaseSelectedData.value = selection;
@@ -358,7 +220,13 @@
// 提交表单
const handleSubmit = async () => {
  console.log("提交表单数据:", tableData.value);
  console.log(detailsTableData.value);
  let data = {
    productionList: detailsTableData.value,
    productionInventoryList: tableData.value,
  };
  console.log("提交数据", data);
  // dialogVisible.value = false;
};
@@ -393,13 +261,13 @@
const addNewRow = () => {
  detailsTableData.value.push({
    coalType: "",
    calorificValue: "",
    productionQuantity: "",
    laborCost: "",
    energyCost: "",
    energyConsumptionCost: "",
    equipmentDepreciation: "",
    purchasePrice: "",
    totalCost: "",
    autoCalculate: "0.00",
    producer:"",
  });
};