73 lines
1.2 KiB
TypeScript
73 lines
1.2 KiB
TypeScript
import request from "/@/utils/request"
|
|
|
|
const BASE_URL = '/purchase/purchasingruleconfig'
|
|
|
|
export function fetchList(query?: Object) {
|
|
return request({
|
|
url: `${BASE_URL}/page`,
|
|
method: 'get',
|
|
params: query
|
|
})
|
|
}
|
|
|
|
export function getObj(id: string) {
|
|
return request({
|
|
url: `${BASE_URL}/${id}`,
|
|
method: 'get'
|
|
})
|
|
}
|
|
|
|
export function addObj(obj: Object) {
|
|
return request({
|
|
url: BASE_URL,
|
|
method: 'post',
|
|
data: obj
|
|
})
|
|
}
|
|
|
|
export function putObj(obj: Object) {
|
|
return request({
|
|
url: `${BASE_URL}/edit`,
|
|
method: 'post',
|
|
data: obj
|
|
})
|
|
}
|
|
|
|
export function delObjs(ids: string[]) {
|
|
return request({
|
|
url: `${BASE_URL}/delete`,
|
|
method: 'post',
|
|
data: ids
|
|
})
|
|
}
|
|
|
|
export function getRuleTypes() {
|
|
return request({
|
|
url: `${BASE_URL}/rule-types`,
|
|
method: 'get'
|
|
})
|
|
}
|
|
|
|
export function getEnabledRules() {
|
|
return request({
|
|
url: `${BASE_URL}/enabled`,
|
|
method: 'get'
|
|
})
|
|
}
|
|
|
|
export interface RuleEvaluateParams {
|
|
budget: number
|
|
isCentralized?: string
|
|
isSpecial?: string
|
|
hasSupplier?: string
|
|
projectType?: string
|
|
ruleType?: string
|
|
}
|
|
|
|
export function evaluateRules(params: RuleEvaluateParams) {
|
|
return request({
|
|
url: `${BASE_URL}/evaluate`,
|
|
method: 'post',
|
|
data: params
|
|
})
|
|
} |