refactor(物料管理): 重构物料分类名称获取接口并优化代码格式

- 将接口函数名称从getMmMaterialCategoryName改为getMmMaterialCategoryOptions以更准确描述功能
- 修改接口请求方式从get到post并更新对应路径
- 优化Vue组件中选项列表的代码格式
- 更新组件中调用新接口函数
This commit is contained in:
2025-12-26 15:03:43 +08:00
committed by Tom
parent 05c185eec5
commit 3f34fd0de2
2 changed files with 36 additions and 23 deletions

View File

@@ -58,11 +58,11 @@ export function delMmMaterial(pid) {
/**
* 获取物料分类名称下拉列表
*/
export function getMmMaterialCategoryName(query) {
*/
export function getMmMaterialCategoryOptions(query) {
return request({
url: 'mes/productionMaterial/MmMaterialCategoryName/list',
method: 'get',
params: query
url: 'mes/productionMaterial/MmMaterial/GetMmMaterialCategoryOptions',
method: 'post',
data: query
})
}

View File

@@ -200,7 +200,14 @@
</template>
<script setup name="mmmaterial">
import { listMmMaterial, addMmMaterial, delMmMaterial, updateMmMaterial, getMmMaterial, getMmMaterialCategoryName } from '@/api/materialManagement/productionMaterial/mmmaterial.js'
import {
listMmMaterial,
addMmMaterial,
delMmMaterial,
updateMmMaterial,
getMmMaterial,
getMmMaterialCategoryOptions
} from '@/api/materialManagement/productionMaterial/mmmaterial.js'
const { proxy } = getCurrentInstance()
const ids = ref([])
const loading = ref(false)
@@ -292,22 +299,28 @@ const state = reactive({
},
options: {
// 物料类型(原材料/半成品/产成品/打包材料/辅料) 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
typeOptions: [{
dictValue: '0',
dictLabel: '原材料'
},{
dictValue: '1',
dictLabel: '半成品'
},{
dictValue: '2',
dictLabel: '产成品'
},{
dictValue: '3',
dictLabel: '打包材料'
},{
dictValue: '4',
dictLabel: '辅料'
}]
typeOptions: [
{
dictValue: '0',
dictLabel: '原材料'
},
{
dictValue: '1',
dictLabel: '半成品'
},
{
dictValue: '2',
dictLabel: '产成品'
},
{
dictValue: '3',
dictLabel: '打包材料'
},
{
dictValue: '4',
dictLabel: '辅料'
}
]
}
})
@@ -411,7 +424,7 @@ const categoryNameOptions = reactive([])
// 物料分类名称下拉列表 可见性变化时触发
function handleCategoryNameChange(visible) {
if (visible) {
getMmMaterialCategoryName().then((res) => {
getMmMaterialCategoryOptions().then((res) => {
const { code, data } = res
if (code == 200) {
categoryNameOptions.value = data