src/views/inventoryManagement/stockWarningLedger/index.vue
@@ -85,6 +85,14 @@
            <span v-else>-</span>
          </template>
        </el-table-column>
        <el-table-column label="建议类型" prop="suggestionType" width="110" show-overflow-tooltip />
        <el-table-column label="建议内容" prop="suggestionContent" show-overflow-tooltip />
        <el-table-column fixed="right" label="操作" width="210" align="center">
          <template #default="scope">
            <el-button link type="primary" size="small" @click="handleSuggestion(scope.row, '采购建议')">采购建议</el-button>
            <el-button link type="warning" size="small" @click="handleSuggestion(scope.row, '滞销处理')">滞销提示</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
@@ -104,7 +112,8 @@
import { ElMessage } from 'element-plus'
import pagination from '@/components/PIMTable/Pagination.vue'
import {
  getStockWarningLedgerPage
  getStockWarningLedgerPage,
  generateSuggestion
} from '@/api/inventoryManagement/stockWarningLedger.js'
// 响应式数据
@@ -273,6 +282,16 @@
}
// 页面加载
// 生成采购建议 / 滞销处理提示
const handleSuggestion = (row, type) => {
  generateSuggestion({ id: row.id, type }).then((res) => {
    ElMessage({ message: res.msg || res.data || '已生成', type: 'success', duration: 6000, showClose: true })
    getList()
  }).catch(() => {
    ElMessage.error('生成失败')
  })
}
onMounted(() => {
  getList()
})