Commit 80757fb6e2ea7160685399586ea9b78f691c4e9b

Authored by “wangming”
1 parent 75c8f709

revert: 回退 ReplaceKeywords 关键字替换功能,恢复代码到稳定状态

antis-ncc-admin/src/views/lqInventory/export-usage-dialog.vue 0 → 100644
  1 +<template>
  2 + <el-dialog title="导出仓库使用记录" :close-on-click-modal="false" :visible.sync="visible"
  3 + class="NCC-dialog NCC-dialog_center" lock-scroll width="700px">
  4 + <el-form label-position="right" label-width="120px">
  5 + <el-form-item label="门店">
  6 + <el-select v-model="exportQuery.storeId" placeholder="请选择门店(可选)" clearable filterable style="width: 100%">
  7 + <el-option v-for="store in storeOptions" :key="store.id" :label="store.dm" :value="store.id" />
  8 + </el-select>
  9 + </el-form-item>
  10 + <el-form-item label="产品ID">
  11 + <el-input v-model="exportQuery.productId" placeholder="请输入产品ID(可选)" clearable />
  12 + </el-form-item>
  13 + <el-form-item label="批次号">
  14 + <el-input v-model="exportQuery.usageBatchId" placeholder="请输入批次号(可选)" clearable />
  15 + </el-form-item>
  16 + <el-form-item label="使用时间">
  17 + <el-date-picker v-model="usageTimeRange" type="datetimerange" range-separator="至"
  18 + start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss"
  19 + format="yyyy-MM-dd HH:mm:ss" style="width: 100%" />
  20 + </el-form-item>
  21 + <el-form-item label="审批状态">
  22 + <el-select v-model="exportQuery.isApproved" placeholder="请选择审批状态(可选)" clearable style="width: 100%">
  23 + <el-option label="全部" :value="null" />
  24 + <el-option label="已通过" :value="true" />
  25 + <el-option label="未通过" :value="false" />
  26 + </el-select>
  27 + </el-form-item>
  28 + <el-form-item label="是否已领取">
  29 + <el-select v-model="exportQuery.isReceived" placeholder="请选择(可选)" clearable style="width: 100%">
  30 + <el-option label="全部" :value="null" />
  31 + <el-option label="已领取" :value="true" />
  32 + <el-option label="未领取" :value="false" />
  33 + </el-select>
  34 + </el-form-item>
  35 + <el-form-item label="是否有效">
  36 + <el-select v-model="exportQuery.isEffective" placeholder="请选择(可选)" clearable style="width: 100%">
  37 + <el-option label="全部" :value="null" />
  38 + <el-option label="有效" :value="true" />
  39 + <el-option label="无效" :value="false" />
  40 + </el-select>
  41 + </el-form-item>
  42 + <el-form-item label="导出说明">
  43 + <div class="export-info">
  44 + <p>• 导出包含11个字段:批次号、产品名称、门店名称、使用数量、单价、总金额、使用时间、归属仓库、审批状态、是否已领取、是否有效</p>
  45 + <p>• 所有字段都会显示中文名称,无需手动选择</p>
  46 + <p>• 支持按门店、产品、批次号、使用时间、审批状态、是否已领取、是否有效进行筛选</p>
  47 + </div>
  48 + </el-form-item>
  49 + </el-form>
  50 + <span slot="footer" class="dialog-footer">
  51 + <el-button @click="visible = false">取 消</el-button>
  52 + <el-button type="primary" @click="handleExport" :loading="btnLoading">导 出</el-button>
  53 + </span>
  54 + </el-dialog>
  55 +</template>
  56 +
  57 +<script>
  58 +import request from '@/utils/request'
  59 +
  60 +export default {
  61 + name: 'ExportUsageDialog',
  62 + props: {
  63 + storeOptions: {
  64 + type: Array,
  65 + default: () => []
  66 + }
  67 + },
  68 + data() {
  69 + return {
  70 + visible: false,
  71 + btnLoading: false,
  72 + exportQuery: {
  73 + storeId: undefined,
  74 + productId: undefined,
  75 + usageBatchId: undefined,
  76 + usageStartTime: undefined,
  77 + usageEndTime: undefined,
  78 + isApproved: undefined,
  79 + isReceived: undefined,
  80 + isEffective: undefined
  81 + },
  82 + usageTimeRange: null
  83 + }
  84 + },
  85 + methods: {
  86 + init() {
  87 + this.visible = true
  88 + // 重置表单
  89 + this.exportQuery = {
  90 + storeId: undefined,
  91 + productId: undefined,
  92 + usageBatchId: undefined,
  93 + usageStartTime: undefined,
  94 + usageEndTime: undefined,
  95 + isApproved: undefined,
  96 + isReceived: undefined,
  97 + isEffective: undefined
  98 + }
  99 + this.usageTimeRange = null
  100 + },
  101 + handleExport() {
  102 + this.btnLoading = true
  103 + // 构建导出查询参数
  104 + let exportParams = { ...this.exportQuery }
  105 +
  106 + // 处理时间范围
  107 + if (this.usageTimeRange && this.usageTimeRange.length === 2) {
  108 + exportParams.usageStartTime = this.usageTimeRange[0]
  109 + exportParams.usageEndTime = this.usageTimeRange[1]
  110 + }
  111 +
  112 + // 移除空值
  113 + Object.keys(exportParams).forEach(key => {
  114 + if (exportParams[key] === undefined || exportParams[key] === null || exportParams[key] === '') {
  115 + delete exportParams[key]
  116 + }
  117 + })
  118 +
  119 + // 构建查询字符串
  120 + const queryString = Object.keys(exportParams)
  121 + .map(key => `${key}=${encodeURIComponent(exportParams[key])}`)
  122 + .join('&')
  123 +
  124 + // 调用导出接口
  125 + const url = `/api/Extend/LqInventoryUsage/ExportExcel${queryString ? '?' + queryString : ''}`
  126 +
  127 + request({
  128 + url: url,
  129 + method: 'GET'
  130 + }).then(res => {
  131 + this.btnLoading = false
  132 + if (res.code === 200 && res.data) {
  133 + // 如果返回的是下载链接
  134 + if (res.data.url) {
  135 + // 构建完整URL
  136 + const baseUrl = window.location.origin
  137 + const downloadUrl = baseUrl + res.data.url
  138 + window.open(downloadUrl, '_blank')
  139 + this.$message.success('导出成功')
  140 + this.visible = false
  141 + } else {
  142 + this.$message.error('导出失败:未返回下载链接')
  143 + }
  144 + } else {
  145 + this.$message.error(res.msg || '导出失败')
  146 + }
  147 + }).catch(err => {
  148 + this.btnLoading = false
  149 + console.error('导出失败:', err)
  150 + this.$message.error('导出失败,请稍后重试')
  151 + })
  152 + }
  153 + }
  154 +}
  155 +</script>
  156 +
  157 +<style lang="scss" scoped>
  158 +.export-info {
  159 + padding: 10px;
  160 + background-color: #f5f7fa;
  161 + border-radius: 4px;
  162 +
  163 + p {
  164 + margin: 5px 0;
  165 + font-size: 13px;
  166 + color: #606266;
  167 + line-height: 1.6;
  168 + }
  169 +}
  170 +</style>
  171 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqInventoryUsage/LqInventoryUsageExportInput.cs 0 → 100644
  1 +using System;
  2 +
  3 +namespace NCC.Extend.Entitys.Dto.LqInventoryUsage
  4 +{
  5 + /// <summary>
  6 + /// 仓库使用记录导出Excel查询参数
  7 + /// </summary>
  8 + public class LqInventoryUsageExportInput
  9 + {
  10 + /// <summary>
  11 + /// 门店ID(可选)
  12 + /// </summary>
  13 + public string StoreId { get; set; }
  14 +
  15 + /// <summary>
  16 + /// 产品ID(可选)
  17 + /// </summary>
  18 + public string ProductId { get; set; }
  19 +
  20 + /// <summary>
  21 + /// 批次号(可选)
  22 + /// </summary>
  23 + public string UsageBatchId { get; set; }
  24 +
  25 + /// <summary>
  26 + /// 使用开始时间(可选)
  27 + /// </summary>
  28 + public DateTime? UsageStartTime { get; set; }
  29 +
  30 + /// <summary>
  31 + /// 使用结束时间(可选)
  32 + /// </summary>
  33 + public DateTime? UsageEndTime { get; set; }
  34 +
  35 + /// <summary>
  36 + /// 是否审核通过(可选,true-已通过,false-未通过,null-全部)
  37 + /// </summary>
  38 + public bool? IsApproved { get; set; }
  39 +
  40 + /// <summary>
  41 + /// 是否已领取(可选,true-已领取,false-未领取,null-全部)
  42 + /// </summary>
  43 + public bool? IsReceived { get; set; }
  44 +
  45 + /// <summary>
  46 + /// 是否有效(可选,true-有效,false-无效,null-全部)
  47 + /// </summary>
  48 + public bool? IsEffective { get; set; }
  49 + }
  50 +}
  51 +
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqInventoryUsage/LqInventoryUsageExportOutput.cs 0 → 100644
  1 +using System;
  2 +
  3 +namespace NCC.Extend.Entitys.Dto.LqInventoryUsage
  4 +{
  5 + /// <summary>
  6 + /// 仓库使用记录导出Excel输出
  7 + /// </summary>
  8 + public class LqInventoryUsageExportOutput
  9 + {
  10 + /// <summary>
  11 + /// 批次号
  12 + /// </summary>
  13 + public string BatchId { get; set; }
  14 +
  15 + /// <summary>
  16 + /// 产品名称
  17 + /// </summary>
  18 + public string ProductName { get; set; }
  19 +
  20 + /// <summary>
  21 + /// 门店名称
  22 + /// </summary>
  23 + public string StoreName { get; set; }
  24 +
  25 + /// <summary>
  26 + /// 使用数量
  27 + /// </summary>
  28 + public int UsageQuantity { get; set; }
  29 +
  30 + /// <summary>
  31 + /// 单价
  32 + /// </summary>
  33 + public decimal UnitPrice { get; set; }
  34 +
  35 + /// <summary>
  36 + /// 总金额
  37 + /// </summary>
  38 + public decimal TotalAmount { get; set; }
  39 +
  40 + /// <summary>
  41 + /// 使用时间
  42 + /// </summary>
  43 + public DateTime UsageTime { get; set; }
  44 +
  45 + /// <summary>
  46 + /// 归属仓库
  47 + /// </summary>
  48 + public string Warehouse { get; set; }
  49 +
  50 + /// <summary>
  51 + /// 审批状态
  52 + /// </summary>
  53 + public string ApprovalStatus { get; set; }
  54 +
  55 + /// <summary>
  56 + /// 是否已领取
  57 + /// </summary>
  58 + public string IsReceived { get; set; }
  59 +
  60 + /// <summary>
  61 + /// 是否有效
  62 + /// </summary>
  63 + public string IsEffective { get; set; }
  64 + }
  65 +}
  66 +
... ...