双奇点
1.编辑采购台账时,删除产品时,弹出两个提示需修改下
2.采购台账添加附件操作按钮和页面
已添加2个文件
已修改1个文件
124 ■■■■■ 文件已修改
src/api/publicApi/commonFile.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/fileList.vue 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/index.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/publicApi/commonFile.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
// å…¬å…±æ–‡ä»¶ç®¡ç†æŽ¥å£
import request from '@/utils/request'
// åˆ é™¤å…¬å…±æ–‡ä»¶
export function delCommonFile(ids) {
  return request({
    url: '/commonFile/delCommonFile',
    method: 'delete',
    data: ids
  })
}
// å¼€ç¥¨å°è´¦æ–‡ä»¶åˆ é™¤
export function delCommonFileInvoiceLedger(ids) {
  return request({
    url: '/invoiceLedger/delFile',
    method: 'delete',
    data: ids
  })
}
src/views/procurementManagement/procurementLedger/fileList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
<template>
  <el-dialog v-model="dialogVisible" title="附件" width="40%" :before-close="handleClose">
    <el-table :data="tableData" border height="40vh">
      <el-table-column label="附件名称" prop="name" min-width="400" show-overflow-tooltip />
      <el-table-column fixed="right" label="操作" width="150" align="center">
        <template #default="scope">
          <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">下载</el-button>
          <el-button link type="primary" size="small" @click="lookFile(scope.row)">预览</el-button>
          <el-button link type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
  <filePreview ref="filePreviewRef" />
</template>
<script setup>
import { ref } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import filePreview from '@/components/filePreview/index.vue'
import { delCommonFile } from '@/api/publicApi/commonFile.js'
const dialogVisible = ref(false)
const tableData = ref([])
const { proxy } = getCurrentInstance();
const filePreviewRef = ref()
const handleClose = () => {
  dialogVisible.value = false
}
const open = (list) => {
  dialogVisible.value = true
  tableData.value = list
}
const downLoadFile = (row) => {
  proxy.$download.name(row.url);
}
const lookFile = (row) => {
  filePreviewRef.value.open(row.url)
}
// åˆ é™¤é™„ä»¶
const handleDelete = (row) => {
  ElMessageBox.confirm(`确认删除附件"${row.name}"吗?`, '删除确认', {
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    type: 'warning',
  }).then(() => {
    delCommonFile([row.id]).then(() => {
      ElMessage.success('删除成功')
      // ä»Žåˆ—表中移除已删除的附件
      const index = tableData.value.findIndex(item => item.id === row.id)
      if (index !== -1) {
        tableData.value.splice(index, 1)
      }
    }).catch(() => {
      ElMessage.error('删除失败')
    })
  }).catch(() => {
    proxy.$modal.msg('已取消删除')
  })
}
defineExpose({
  open
})
</script>
<style></style>
src/views/procurementManagement/procurementLedger/index.vue
@@ -53,7 +53,7 @@
        show-summary
        :summary-method="summarizeMainTable"
        @expand-change="expandChange"
        height="calc(100vh - 18.5em)"
        height="calc(100vh - 19em)"
      >
        <el-table-column align="center" type="selection" width="55" />
        <el-table-column type="expand">
@@ -103,12 +103,10 @@
        <el-table-column
          label="销售合同号"
          prop="salesContractNo"
          width="200"
          show-overflow-tooltip
        />
        <el-table-column
          label="供应商名称"
          width="240"
          prop="supplierName"
          show-overflow-tooltip
        />
@@ -155,16 +153,15 @@
              type="primary"
              size="small"
              @click="openForm('edit', scope.row)"
                            :disabled="scope.row.receiptPaymentAmount>0 || scope.row.recorderName !== userStore.nickName"
              >编辑</el-button
            >
<!--            <el-button-->
<!--              link-->
<!--              type="success"-->
<!--              size="small"-->
<!--              @click="showQRCode(scope.row)"-->
<!--              >生成二维码</el-button-->
<!--            >-->
            <el-button
              link
              type="primary"
              size="small"
              @click="downLoadFile(scope.row)"
              >附件</el-button
            >
          </template>
        </el-table-column>
@@ -206,6 +203,7 @@
              <el-select
                v-model="form.salesLedgerId"
                placeholder="请选择"
                                filterable
                clearable
                @change="salesLedgerChange"
              >
@@ -225,6 +223,7 @@
              <el-select
                v-model="form.supplierId"
                placeholder="请选择"
                                filterable
                clearable
              >
                <el-option
@@ -278,6 +277,7 @@
                placeholder="请选择"
                clearable
                disabled
                                filterable
              >
                <el-option
                  v-for="item in userList"
@@ -787,6 +787,7 @@
        </div>
      </template>
    </el-dialog>
        <FileList ref="fileListRef" />
  </div>
</template>
@@ -797,6 +798,7 @@
import { Search } from "@element-plus/icons-vue";
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
import FileList from "./fileList.vue";
import {
  getSalesLedgerWithProducts,
  addOrUpdateSalesLedgerProduct,
@@ -1238,6 +1240,13 @@
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  // ä¿è¯è‡³å°‘保留一条产品信息
  const remainingCount =
    productData.value.length - productSelectedRows.value.length;
  if (remainingCount < 1) {
    proxy.$modal.msgWarning("至少保留一条产品信息,无法全部删除");
    return;
  }
  if (operationType.value === "add") {
    productSelectedRows.value.forEach((selectedRow) => {
      const index = productData.value.findIndex(
@@ -1261,7 +1270,7 @@
        delProduct(ids).then((res) => {
          proxy.$modal.msgSuccess("删除成功");
          closeProductDia();
          getSalesLedgerWithProducts({ id: currentId.value, type: 2 }).then(
                    getPurchaseById({ id: currentId.value, type: 2 }).then(
            (res) => {
              productData.value = res.productData;
            }
@@ -1413,6 +1422,11 @@
  }
};
const fileListRef = ref(null)
const downLoadFile = (row) => {
    fileListRef.value.open(row.salesLedgerFiles)
}
// æ˜¾ç¤ºäºŒç»´ç 
const showQRCode = async (row) => {
  try {