chem_mes/jnpf-java-boot/jnpf-web/src/views/example/supplier/supplier.js

65 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import request from '@/utils/request'
// 获取供应商列表
export function getSupplierList(data) {
return request({
url: '/api/scm/supplier/getList',
method: 'post',
data
})
}
// 获取供应商详情
export function getSupplierInfo(id) {
return request({
url: `/api/scm/supplier/${id}`,
method: 'get'
})
}
// 新增供应商
export function createSupplier(data) {
return request({
url: '/api/scm/supplier',
method: 'post',
data
})
}
// 更新供应商
export function updateSupplier(id, data) {
return request({
url: `/api/scm/supplier/${id}`,
method: 'put',
data
})
}
// 删除供应商
export function deleteSupplier(id) {
return request({
url: `/api/scm/supplier/${id}`,
method: 'delete'
})
}
// 供应商管理字典映射配置id -> 名称)
export const supplierMaps = {
supplierType: {'1': '原料', '2': '辅料', '3': '设备', '4': '外协', '5': '服务', '9': '其它'},
supplierStatus: {'1': '正常', '2': '暂停供货', '3': '淘汰'},
supplierReg: {'1': 'A', '2': 'B', '3': 'C', '4': 'D'},
}
// 根据映射自动生成下拉选项
export const supplierOptions = {}
for (const key in supplierMaps) {
const map = supplierMaps[key]
supplierOptions[key] = Object.entries(map).map(([id, fullName]) => ({id, fullName}))
}
// 获取显示名称
export function getLabel(type, value) {
const map = supplierMaps[type]
return map ? (map[value] || value) : value
}