gaoluyang
4 天以前 624faa46fb237709a40db1567e3b708ec24c4222
src/views/salesOutbound/index.vue
@@ -1,33 +1,27 @@
<template>
  <div class="app-container">
    <el-form :inline="true" :model="queryParams" class="search-form">
      <el-form-item label="搜索">
        <el-input
            v-model="queryParams.searchText"
            placeholder="请输入关键词"
      <el-form-item label="销售日期">
        <el-date-picker
            v-model="queryParams.saleDate"
            type="date"
            placeholder="请选择"
            value-format="YYYY-MM-DD"
            format="YYYY-MM-DD"
            clearable
            :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-form-item label="供应商名称">
      <el-form-item label="客户">
        <el-input
            v-model="queryParams.supplierName"
            v-model="queryParams.customer"
            placeholder="请输入"
            clearable
            :style="{ width: '100%' }"
        />
      </el-form-item>
      <el-form-item label="统一人识别号">
      <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"
            v-model="queryParams.coal"
            placeholder="请输入"
            clearable
            :style="{ width: '100%' }"
@@ -50,7 +44,7 @@
      </el-tabs>
      <!-- 操作按钮区 -->
      <el-space>
        <el-button type="primary" :icon="Plus" @click="openDia('add')">新建</el-button>
        <el-button type="primary" :icon="Plus" @click="openDia()">新建</el-button>
        <el-button type="danger" :icon="Delete" @click="handleDelete">删除</el-button>
        <el-button type="info" plain :icon="Download" @click="handleExport">导出</el-button>
      </el-space>
@@ -79,12 +73,13 @@
</template>
<script setup>
import {ref, reactive} from "vue";
import {ref, reactive, onMounted} from "vue";
const { proxy } = getCurrentInstance()
import {Delete, Download, Plus} from "@element-plus/icons-vue";
import ETable from "@/components/Table/ETable.vue";
import Pagination from "@/components/Pagination/index.vue";
import FormDia from "@/views/salesOutbound/components/formDia.vue";
import {delSalesRecord, salesRecordList} from "../../api/salesOutbound/index.js";
const formDia = ref()
const activeTab = ref("out");
@@ -96,17 +91,22 @@
const tableLoading = ref(false);
const tableData = ref([]);
const columns = ref([
  { prop: "supplierName", label: "销售日期", minWidth: 160 },
  { prop: "identifyNumber", label: "客户", minWidth: 120 },
  { prop: "address", label: "煤种", minWidth: 150 },
  { prop: "saleDate", label: "销售日期", minWidth: 160 },
  { prop: "customer", label: "客户", minWidth: 120 },
  { prop: "coal", label: "煤种", minWidth: 150 },
  { prop: "unit", label: "单位", minWidth: 150 },
  { prop: "bank", label: "库存数量", minWidth: 120 },
  { prop: "bankAccount", label: "销售单价(含税)", minWidth: 150 },
  { prop: "contacts", label: "销售总价(含税)", minWidth: 120 },
  { prop: "contacts", label: "利润", minWidth: 90 },
  { prop: "contactAddress", label: "热值", minWidth: 150 },
  { prop: "maintainer", label: "维护人", minWidth: 100 },
  { prop: "maintainDate", label: "维护日期", minWidth: 100 },
  { prop: "priceIncludingTax", label: "单价(含税)", minWidth: 150 },
  { prop: "inventoryQuantity", label: "库存数量", minWidth: 120 },
  { prop: "saleQuantity", label: "销售数量", minWidth: 120 },
  { prop: "salePrice", label: "销售单价(含税)", minWidth: 150 },
  { prop: "totalAmount", label: "销售总价(含税)", minWidth: 120 },
  { prop: "freight", label: "运费", minWidth: 90 },
  { prop: "taxCoal", label: "购销煤税率(%)", minWidth: 120 },
  { prop: "taxTrans", label: "运输税率(%)", minWidth: 120 },
  { prop: "grossProfit", label: "毛利润", minWidth: 90 },
  { prop: "netProfit", label: "净利润", minWidth: 90 },
  { prop: "registrant", label: "登记人", minWidth: 100 },
  { prop: "registrationDate", label: "登记日期", minWidth: 100 },
]);
const selectedRows = ref([]);
const total = ref(0);
@@ -114,18 +114,26 @@
const pageSize = ref(10);
// 查询参数
const queryParams = reactive({
  searchText: "",
  supplierName: "",
  identifyNumber: "",
  address: "",
  saleDate: "",
  customer: "",
  coal: "",
})
onMounted(() => {
  handleQuery()
});
// 点击查询
const handleQuery = () => {
  pageNum.value = 1
  pageSize.value = 10
  getList()
}
const getList = () => {
  tableLoading.value = true;
  setTimeout(() => {
  salesRecordList({...queryParams, current: pageNum.value, size: pageSize.value}).then(res => {
    tableLoading.value = false;
  }, 500);
    tableData.value = res.data.records;
    total.value = res.data.total;
  })
}
// 重置查询
const resetQuery = () => {
@@ -137,14 +145,26 @@
  handleQuery();
};
// 新增出库
const openDia = (type, row) => {
const openDia = (row) => {
  console.log(row)
  const type = row === undefined ? 'add' : 'edit'
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
};
// 删除出库
const handleDelete = () => {
  if (selectedRows.value.length === 0) {
    proxy.$modal.msgWarning("请选择要删除的数据");
    return;
  }
  const deleteIds = selectedRows.value.map(item => item.id);
  proxy.$modal.confirm('是否确认删除所选数据项?').then(function() {
    return delSalesRecord(deleteIds)
  }).then(() => {
    handleQuery()
    proxy.$modal.msgSuccess("删除成功")
  }).catch(() => {})
};
// 导出出库
const handleExport = () => {