实现自动脚本修改产品状态

This commit is contained in:
wuweihua
2026-09-09 17:56:53 +08:00
parent db0c5919b0
commit 06294d636a
9 changed files with 191 additions and 2 deletions
@@ -38,6 +38,9 @@
<el-col :span="1.5">
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['price:product:import']">导入 Excel</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Refresh" @click="handleRefreshStatus" v-hasPermi="['price:product:edit']">刷新状态</el-button>
</el-col>
</template>
<template #col-cargoAttr="{ row }">
@@ -76,6 +79,7 @@ import ProductFormDialog from './components/ProductFormDialog.vue'
import ProductCountryDrawer from './components/ProductCountryDrawer.vue'
import ProductSurchargeDrawer from './components/ProductSurchargeDrawer.vue'
import { listProduct, delProduct } from '@/api/price/product'
import { refreshStatus } from '@/api/price/status'
const { proxy } = getCurrentInstance()
const { bms_product_effect_status } = useDict('bms_product_effect_status')
@@ -183,6 +187,19 @@ function handleDelete(ids) {
function handleImport() {
importRef.value.open()
}
/**
* 手动触发 bms_product / bms_product_country 状态刷新
* 日常由后端定时任务每天 02:00 自动跑;此处用于运维即时刷新
*/
function handleRefreshStatus() {
proxy.$modal.confirm('将立即按 effective_date / expire_date 重新计算所有产品及国家明细的状态,是否继续?').then(() => {
return refreshStatus()
}).then(res => {
proxy.$modal.msgSuccess(res.msg || '刷新成功')
tableRef.value && tableRef.value.refresh()
}).catch(() => {})
}
</script>
<style scoped>