Browse Source

价格表

master
常熟吴彦祖 3 weeks ago
parent
commit
809b6b6204
  1. 40
      src/views/modules/sys/initialImport.vue

40
src/views/modules/sys/initialImport.vue

@ -128,6 +128,12 @@ import {
} from '@/api/initialImport' } from '@/api/initialImport'
import ComPoOrderCustomerPicker from '@/views/modules/order/com_poOrder_CustomerPicker.vue' import ComPoOrderCustomerPicker from '@/views/modules/order/com_poOrder_CustomerPicker.vue'
/**
* 期初导入可用截止日(含当天)。本地日历日晚于该日期后,三个导入入口均禁止使用。
*/
const INITIAL_IMPORT_DEADLINE = '2026-10-08'
const INITIAL_IMPORT_EXPIRED_MSG = '期初导入功能已超过可用日期'
export default { export default {
name: 'SysInitialImport', name: 'SysInitialImport',
components: { components: {
@ -233,7 +239,31 @@ export default {
} }
}, },
methods: { 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) { openImportDialog (type) {
if (!this.ensureInitialImportAvailable()) {
return
}
if (type !== 'supplierPrice' && type !== 'partSku' && type !== 'poOrder') { if (type !== 'supplierPrice' && type !== 'partSku' && type !== 'poOrder') {
return return
} }
@ -242,6 +272,10 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
handleFileChange (file) { handleFileChange (file) {
if (!this.ensureInitialImportAvailable()) {
this.clearSelectedFile()
return
}
const rawFile = file && file.raw const rawFile = file && file.raw
if (!rawFile) { if (!rawFile) {
return return
@ -331,6 +365,9 @@ export default {
this.handleFileChange({ raw: files[0], name: files[0].name }) this.handleFileChange({ raw: files[0], name: files[0].name })
}, },
handleDownloadTemplate () { handleDownloadTemplate () {
if (!this.ensureInitialImportAvailable()) {
return
}
const site = this.currentSite const site = this.currentSite
if (!site) { if (!site) {
this.$message.error('当前登录用户没有Site') this.$message.error('当前登录用户没有Site')
@ -378,6 +415,9 @@ export default {
: '供应商价格期初导入模板.xlsx' : '供应商价格期初导入模板.xlsx'
}, },
handleSave () { handleSave () {
if (!this.ensureInitialImportAvailable()) {
return
}
if (this.isPoOrderImport) { if (this.isPoOrderImport) {
const invalidRows = this.previewRows.filter(row => !row || row.valid === false) const invalidRows = this.previewRows.filter(row => !row || row.valid === false)
if (invalidRows.length) { if (invalidRows.length) {

Loading…
Cancel
Save