|
@@ -46,14 +46,16 @@
|
|
<el-table-column prop="guid" label="序号" />
|
|
<el-table-column prop="guid" label="序号" />
|
|
<el-table-column prop="type" label="部件类型" >
|
|
<el-table-column prop="type" label="部件类型" >
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
- {{getComponentType(row.type)}}
|
|
|
|
|
|
+ {{row.type}}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="bomName" label="部件名称" />
|
|
<el-table-column prop="bomName" label="部件名称" />
|
|
<el-table-column prop="bomNo" label="物料号" />
|
|
<el-table-column prop="bomNo" label="物料号" />
|
|
<el-table-column prop="status" label="状态" >
|
|
<el-table-column prop="status" label="状态" >
|
|
- <template #default="{ row }">
|
|
|
|
- {{getComponentState(row.status)}}
|
|
|
|
|
|
+ <template #default="{ row }" >
|
|
|
|
+ <div :style="{color: row.status.color}" class="bold-font">
|
|
|
|
+ {{row.status.name}}
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="remark" label="备注" />
|
|
<el-table-column prop="remark" label="备注" />
|
|
@@ -67,7 +69,7 @@
|
|
:lazy="true"
|
|
:lazy="true"
|
|
class="img"
|
|
class="img"
|
|
:hide-on-click-modal="true"
|
|
:hide-on-click-modal="true"
|
|
- fit="scale-down"
|
|
|
|
|
|
+ fit="contain"
|
|
preview-teleported
|
|
preview-teleported
|
|
>
|
|
>
|
|
<template #error>
|
|
<template #error>
|
|
@@ -154,23 +156,23 @@
|
|
|
|
|
|
<script lang="ts" setup name="admin/product/bom">
|
|
<script lang="ts" setup name="admin/product/bom">
|
|
import {ref, reactive, onMounted, onBeforeMount, computed, defineAsyncComponent} from 'vue'
|
|
import {ref, reactive, onMounted, onBeforeMount, computed, defineAsyncComponent} from 'vue'
|
|
-import { ComponentTypeApi } from '/@/api/admin/productionManagement/ComponentType'
|
|
|
|
|
|
+import { ComponentTypeApi } from '/src/api/admin/productionManagement/ComponentType'
|
|
// import dayjs from 'dayjs'
|
|
// import dayjs from 'dayjs'
|
|
-import eventBus from '/@/utils/mitt'
|
|
|
|
-import { isImage } from '/@/utils/test'
|
|
|
|
-import {FileGetPageOutput} from "/@/api/admin/data-contracts";
|
|
|
|
-import {PageInputFileGetPageDto} from "/@/api/admin/productionManagement/ComopnentDto";
|
|
|
|
-import {ComponentGetPageDto} from "/@/api/admin/productionManagement/ComponentTypeDto";
|
|
|
|
|
|
+import eventBus from '/src/utils/mitt'
|
|
|
|
+import { isImage } from '/src/utils/test'
|
|
|
|
+import {FileGetPageOutput} from "/src/api/admin/data-contracts";
|
|
|
|
+import {PageInputFileGetPageDto} from "/src/api/admin/productionManagement/ComopnentDto";
|
|
|
|
+import {ComponentGetPageDto} from "/src/api/admin/productionManagement/ComponentTypeDto";
|
|
import { Picture as IconPicture } from '@element-plus/icons-vue'
|
|
import { Picture as IconPicture } from '@element-plus/icons-vue'
|
|
-import {localStorageSet} from "/@/utils/localStorageSet";
|
|
|
|
-import {DictApi} from "/@/api/admin/Dict";
|
|
|
|
|
|
+import {sessionStorageSet} from "/src/utils/sessionStorageSet";
|
|
|
|
+import {DictApi} from "/src/api/admin/Dict";
|
|
//import commonFunction from '/@/utils/commonFunction'
|
|
//import commonFunction from '/@/utils/commonFunction'
|
|
|
|
|
|
// const { proxy } = getCurrentInstance() as any
|
|
// const { proxy } = getCurrentInstance() as any
|
|
|
|
|
|
/**引入组件*/
|
|
/**引入组件*/
|
|
-const EditDialog = defineAsyncComponent(() => import('./components/form-edit.vue'))
|
|
|
|
-const MySelectRequest = defineAsyncComponent(() => import('/@/components/my-select-request/index.vue'))
|
|
|
|
|
|
+const EditDialog = defineAsyncComponent(() => import('../components/form-edit.vue'))
|
|
|
|
+const MySelectRequest = defineAsyncComponent(() => import('/src/components/my-select-request/index.vue'))
|
|
/**
|
|
/**
|
|
* 向子组件传值,
|
|
* 向子组件传值,
|
|
* code 字段编码
|
|
* code 字段编码
|
|
@@ -256,32 +258,32 @@ const showBigPic = (val) => {
|
|
state.showBig = true
|
|
state.showBig = true
|
|
}
|
|
}
|
|
|
|
|
|
-/**返回部件类型*/
|
|
|
|
-const getComponentType = (type) =>{
|
|
|
|
- if(mapType.value?.has(type)){
|
|
|
|
- return mapType.value.get(type)
|
|
|
|
- }else {
|
|
|
|
- return type
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const getComponentState = (state) => {
|
|
|
|
- if(mapState.value.has(state)){
|
|
|
|
- return mapState.value.get(state)
|
|
|
|
- }else {
|
|
|
|
- return state
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// /**返回部件类型*/
|
|
|
|
+// const getComponentType = (type) =>{
|
|
|
|
+// if(mapType.value?.has(type)){
|
|
|
|
+// return mapType.value.get(type)
|
|
|
|
+// }else {
|
|
|
|
+// return type
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// const getComponentState = (state) => {
|
|
|
|
+// if(mapState.value.has(state)){
|
|
|
|
+// return mapState.value.get(state).name
|
|
|
|
+// }else {
|
|
|
|
+// return state
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
//获取部件类型map
|
|
//获取部件类型map
|
|
const initLocalType = async () => {
|
|
const initLocalType = async () => {
|
|
- let localType = localStorageSet.getItemWithExpiration(propsType.code)
|
|
|
|
|
|
+ let localType = sessionStorageSet.getItemWithExpiration(propsType.code)
|
|
|
|
|
|
if(!localType){
|
|
if(!localType){
|
|
const res = await new DictApi().getList([propsType.code] as string[])
|
|
const res = await new DictApi().getList([propsType.code] as string[])
|
|
/**存一天的缓存*/
|
|
/**存一天的缓存*/
|
|
- localStorageSet.setItemWithExpiration(propsType.code as string, res?.data,1)
|
|
|
|
- localType = localStorageSet.getItemWithExpiration(propsType.code as string)
|
|
|
|
|
|
+ sessionStorageSet.setItemWithExpiration(propsType.code as string, res?.data,1)
|
|
|
|
+ localType = sessionStorageSet.getItemWithExpiration(propsType.code as string)
|
|
}
|
|
}
|
|
|
|
|
|
mapType.value = localType?.reduce((map, obj) => {
|
|
mapType.value = localType?.reduce((map, obj) => {
|
|
@@ -292,22 +294,24 @@ const initLocalType = async () => {
|
|
|
|
|
|
//获取部件状态map
|
|
//获取部件状态map
|
|
const initLocalState = async () => {
|
|
const initLocalState = async () => {
|
|
- let localState = localStorageSet.getItemWithExpiration(propsState.code)
|
|
|
|
|
|
+ let sessionState = sessionStorageSet.getItemWithExpiration(propsState.code)
|
|
|
|
|
|
- if(!localState){
|
|
|
|
|
|
+ if(!sessionState){
|
|
const res = await new DictApi().getList([propsState.code] as string[])
|
|
const res = await new DictApi().getList([propsState.code] as string[])
|
|
/**存一天的缓存*/
|
|
/**存一天的缓存*/
|
|
- localStorageSet.setItemWithExpiration(propsState.code as string, res?.data,1)
|
|
|
|
- localState = localStorageSet.getItemWithExpiration(propsState.code as string)
|
|
|
|
|
|
+ sessionStorageSet.setItemWithExpiration(propsState.code as string, res?.data,1)
|
|
|
|
+ sessionState = sessionStorageSet.getItemWithExpiration(propsState.code as string)
|
|
}
|
|
}
|
|
-
|
|
|
|
- mapState.value = localState?.reduce((map, obj) => {
|
|
|
|
- map.set(Number(obj.value), obj.name);
|
|
|
|
|
|
+ mapState.value =sessionState?.reduce((map, obj) => {
|
|
|
|
+ obj.color = obj.code.split("_")[1]
|
|
|
|
+ map.set(Number(obj.value), {...obj});
|
|
return map;
|
|
return map;
|
|
},new Map());
|
|
},new Map());
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
+ initLocalType()
|
|
|
|
+ initLocalState()
|
|
onQuery()
|
|
onQuery()
|
|
eventBus.off('refreshView')
|
|
eventBus.off('refreshView')
|
|
eventBus.on('refreshView', async () => {
|
|
eventBus.on('refreshView', async () => {
|
|
@@ -329,15 +333,17 @@ const getInitialIndex = (imgUrl: string) => {
|
|
|
|
|
|
/**查询*/
|
|
/**查询*/
|
|
const onQuery = async () => {
|
|
const onQuery = async () => {
|
|
- await initLocalType()
|
|
|
|
- await initLocalState()
|
|
|
|
state.loading = true
|
|
state.loading = true
|
|
- const res = await new ComponentTypeApi().getPage({ ...state.pageInput, filter: state.filterModel }).catch(() => {
|
|
|
|
|
|
+ const {data} = await new ComponentTypeApi().getPage({ ...state.pageInput, filter: state.filterModel }).catch(() => {
|
|
state.loading = false
|
|
state.loading = false
|
|
})
|
|
})
|
|
-
|
|
|
|
- state.bomListData = res?.data?.list ?? []
|
|
|
|
- state.total = res?.data?.total ?? 0
|
|
|
|
|
|
+ const arr = data?.list ?? []
|
|
|
|
+ state.bomListData = arr.map(item => ({
|
|
|
|
+ ...item,
|
|
|
|
+ type: mapType.value.get(item.type),
|
|
|
|
+ status: mapState.value.get(item.status),
|
|
|
|
+ }))
|
|
|
|
+ state.total = data?.total ?? 0
|
|
state.loading = false
|
|
state.loading = false
|
|
}
|
|
}
|
|
|
|
|
|
@@ -424,4 +430,7 @@ const onCurrentChange = (val: number) => {
|
|
.el-input {
|
|
.el-input {
|
|
width: 240px;
|
|
width: 240px;
|
|
}
|
|
}
|
|
|
|
+.bold-font {
|
|
|
|
+ font-weight: bold;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|