Commit 71b72590 by 董晓奇

工艺路线

列表中产品类型字段显示id不显示对应名称BUG修复
parent 26e920b6
......@@ -11,6 +11,7 @@ enum Api {
List = '/jcsj/gylx/list',
Info = '/jcsj/gylx/info',
RokeRouting = '/jcsj/gylx',
getAllCplx = '/magic-api/jcxx/cplx/getAllCPLX',
}
/**
......@@ -90,3 +91,14 @@ export async function deleteRokeRouting(ids: string[], mode: ErrorMessageMode =
},
);
}
export async function getAllCPLX(mode: ErrorMessageMode = 'modal') {
return defHttp.get<Array<{ value: string; label: string }>>(
{
url: Api.getAllCplx,
},
{
errorMessageMode: mode,
},
);
}
......@@ -31,6 +31,10 @@
/>
</template>
<template v-else-if="column.dataIndex === 'productType'">
{{ getProductTypeName(record.productType) }}
</template>
<template v-else-if="column.dataIndex && column?.listStyle">
<span :style="executeListStyle(getValue(record, column, 'style'), column?.listStyle)">{{
getValue(record, column, 'value')
......@@ -44,7 +48,7 @@
</ResizePageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed, provide, Ref, createVNode } from 'vue';
import { ref, computed, provide, Ref, createVNode, onMounted } from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
......@@ -70,6 +74,10 @@
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
import { getAllCPLX } from '/@/api/jcsj/gylx/index';
const productTypeMap = ref<Record<string, string>>({});
const pageParamsInfo = ref<any>({});
const {
enableLockeData,
......@@ -305,6 +313,25 @@
});
return actionsList;
}
onMounted(async () => {
try {
const res = await getAllCPLX();
// 假设返回格式为 [{ value: 'id', label: '名称' }, ...]
const map: Record<string, string> = {};
res.forEach((item) => {
map[item.value] = item.label;
});
productTypeMap.value = map;
} catch (error) {
console.error('获取产品类型列表失败', error);
}
});
function getProductTypeName(id: string | number): string {
if (!id) return '';
return productTypeMap.value[id] || String(id);
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment