diff --git a/src/views/modules/sys/initialImport.vue b/src/views/modules/sys/initialImport.vue index e75da9a..4c55d3b 100644 --- a/src/views/modules/sys/initialImport.vue +++ b/src/views/modules/sys/initialImport.vue @@ -128,6 +128,12 @@ import { } from '@/api/initialImport' import ComPoOrderCustomerPicker from '@/views/modules/order/com_poOrder_CustomerPicker.vue' +/** + * 期初导入可用截止日(含当天)。本地日历日晚于该日期后,三个导入入口均禁止使用。 + */ +const INITIAL_IMPORT_DEADLINE = '2026-10-08' +const INITIAL_IMPORT_EXPIRED_MSG = '期初导入功能已超过可用日期' + export default { name: 'SysInitialImport', components: { @@ -233,7 +239,31 @@ export default { } }, methods: { + /** + * 取浏览器本地日历日 YYYY-MM-DD。 + * 不用 toISOString,避免 UTC 把日期提前或推后一天。 + */ + getLocalDateText () { + const now = new Date() + const month = String(now.getMonth() + 1).padStart(2, '0') + const day = String(now.getDate()).padStart(2, '0') + return `${now.getFullYear()}-${month}-${day}` + }, + /** + * 导入按钮点击拦截:超过 2026-10-08 则报错并阻止后续导入。 + * @returns {boolean} true 表示仍在可用期内 + */ + ensureInitialImportAvailable () { + if (this.getLocalDateText() > INITIAL_IMPORT_DEADLINE) { + this.$message.error(INITIAL_IMPORT_EXPIRED_MSG) + return false + } + return true + }, openImportDialog (type) { + if (!this.ensureInitialImportAvailable()) { + return + } if (type !== 'supplierPrice' && type !== 'partSku' && type !== 'poOrder') { return } @@ -242,6 +272,10 @@ export default { this.dialogVisible = true }, handleFileChange (file) { + if (!this.ensureInitialImportAvailable()) { + this.clearSelectedFile() + return + } const rawFile = file && file.raw if (!rawFile) { return @@ -331,6 +365,9 @@ export default { this.handleFileChange({ raw: files[0], name: files[0].name }) }, handleDownloadTemplate () { + if (!this.ensureInitialImportAvailable()) { + return + } const site = this.currentSite if (!site) { this.$message.error('当前登录用户没有Site') @@ -378,6 +415,9 @@ export default { : '供应商价格期初导入模板.xlsx' }, handleSave () { + if (!this.ensureInitialImportAvailable()) { + return + } if (this.isPoOrderImport) { const invalidRows = this.previewRows.filter(row => !row || row.valid === false) if (invalidRows.length) {