gaoluyang
7 天以前 644f9b827ac28d39f32c626712d5c574fe9acbf1
src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -63,13 +63,6 @@
            <el-button link :icon="Files" type="danger"> 附件 </el-button>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item
                  v-if="row.commonFiles.length !== 0"
                  :icon="Download"
                  command="download"
                >
                  下载
                </el-dropdown-item>
                <el-dropdown-item :icon="Upload" command="upload">
                  上传
                </el-dropdown-item>
@@ -80,16 +73,15 @@
        <template #operation="{ row }">
          <el-button
            type="primary"
            text
                  link
            @click="openEdit(row)"
                  :disabled="row.issUerId !== userStore.id"
          >
            编辑
          </el-button>
               <el-button link type="primary" size="small" @click="downLoadFile(row)">附件</el-button>
          <el-button
            type="primary"
            text
                  :disabled="row.issUerId !== userStore.id"
                  link
            @click="handleDelete(row)"
          >
            删除
@@ -97,6 +89,7 @@
        </template>
      </PIMTable>
    </div>
      <FileList ref="fileListRef" />
    <UploadModal ref="modalRef" @uploadSuccess="uploadSuccess"></UploadModal>
    <EditModal ref="editmodalRef" @success="getTableData"></EditModal>
  </div>
@@ -111,19 +104,21 @@
  Search,
  Upload,
  EditPen,
  Delete,
} from "@element-plus/icons-vue";
import {
   delRegistration,
   productRecordPage,
   productUploadFile,
} from "@/api/procurementManagement/procurementInvoiceLedger.js";
import { delCommonFile } from "@/api/publicApi/commonFile.js";
import { onMounted } from "vue";
import { ElMessageBox } from "element-plus";
import { ElMessageBox, ElMessage } from "element-plus";
import UploadModal from "./Modal/UploadModal.vue";
import EditModal from "./Modal/EditModal.vue";
import useUserStore from "@/store/modules/user.js";
import {delInvoiceLedgerByRegProductId} from "@/api/salesManagement/invoiceLedger.js";
const userStore = useUserStore();
import dayjs from "dayjs";
import FileList from "./fileList.vue";
defineOptions({
  name: "来票台账",
@@ -148,7 +143,8 @@
  {
    purchaseContractNumber: undefined, // 采购合同号
    supplierName: undefined, // 供应商
    createdAt: [], // 来票日期
    // 设置来票日期范围为当天
    createdAt: [dayjs().startOf('day').format('YYYY-MM-DD'), dayjs().endOf('day').format('YYYY-MM-DD')], // 来票日期
  },
  [
    {
@@ -162,19 +158,9 @@
      width: 150,
    },
    {
      label: "项目名称",
      prop: "projectName",
      width: 240,
    },
    {
      label: "供应商名称",
      prop: "supplierName",
      width: 240,
    },
    {
      label: "产品大类",
      prop: "productCategory",
      width: 150,
    },
    {
      label: "规格型号",
@@ -195,17 +181,12 @@
      },
    },
    {
      label: "本次来票数",
      prop: "ticketsNum",
      width: 110,
    },
    {
      label: "来票日期",
      label: "开票日期",
      prop: "createdAt",
      width: 110,
    },
    {
      label: "来票金额(元)",
      label: "开票金额",
      prop: "ticketsAmount",
      width: 200,
      formatData: (cell) => {
@@ -241,7 +222,7 @@
    },
    {
      fixed: "right",
      width: 150,
      width: 190,
      label: "操作",
      dataType: "slot",
      slot: "operation",
@@ -277,7 +258,12 @@
const handleSelectionChange = (val) => {
  multipleVal.value = val;
};
//附件相关
const fileListRef = ref(null)
//查看附件
const downLoadFile = (row) => {
   fileListRef.value.open(row.commonFiles, row.id)
}
// 导出
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
@@ -314,6 +300,29 @@
      console.log(row.commonFiles);
      openUoload(row.ticketRegistrationId);
      break;
    case "delete":
      // 删除所有附件
      if (row.commonFiles.length > 0) {
        ElMessageBox.confirm(`确认删除该记录的所有附件吗?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          // 获取所有附件的ID
          const fileIds = row.commonFiles.map(file => file.id);
          delCommonFile(fileIds).then(() => {
            ElMessage.success('删除成功')
            // 刷新数据
            getTableData();
          }).catch(() => {
            ElMessage.error('删除失败')
          })
        }).catch(() => {
          ElMessage.info('已取消删除')
        })
      }
      break;
  }
};