Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 立即刷新 bms_product / bms_product_country 的 status 字段
|
||||
*
|
||||
* 日常由后端定时任务 BmsStatusRefreshTask 每天 02:00 自动跑,
|
||||
* 此接口用于运维/测试手动触发。返回 success msg 形如:
|
||||
* 「状态刷新完成:bms_product 更新 X 行,bms_product_country 更新 Y 行」
|
||||
*/
|
||||
export function refreshStatus() {
|
||||
return request({
|
||||
url: '/price/status/refresh',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
@@ -63,6 +63,7 @@
|
||||
|
||||
<template #col-status="{ row }">
|
||||
<el-switch
|
||||
v-if="row.jobId != null"
|
||||
v-model="row.status"
|
||||
active-value="0"
|
||||
inactive-value="1"
|
||||
@@ -308,8 +309,14 @@ function handleDelete(jobIds) {
|
||||
|
||||
// 任务状态修改
|
||||
function handleStatusChange(row) {
|
||||
// 行数据不完整(jobId 缺失,常见于加载瞬间/新增未刷新),把开关拨回并拦截,避免弹 "undefined" 确认框
|
||||
if (!row || row.jobId == null) {
|
||||
if (row) row.status = row.status === "0" ? "1" : "0"
|
||||
proxy.$modal.msgWarning("任务数据无效,请刷新列表后重试")
|
||||
return
|
||||
}
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
proxy.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function () {
|
||||
proxy.$modal.confirm('确认要"' + text + '""' + (row.jobName || row.jobId) + '"任务吗?').then(function () {
|
||||
return changeJobStatus(row.jobId, row.status)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess(text + "成功")
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user