|
@@ -30,6 +30,7 @@
|
|
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb20">
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
|
|
|
+ <el-button type="primary" icon="ele-Delete" @click="onReset"> 重置 </el-button>
|
|
|
<el-button v-auth="'api:admin:file:upload-file'" type="primary" icon="ele-Upload" @click="onUpload"> 上传 </el-button>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -137,6 +138,8 @@ import eventBus from '/@/utils/mitt'
|
|
|
import {PageInputFileGetPageDto} from "/@/api/admin/productionManagement/ComopnentDto";
|
|
|
import {ComponentGetPageOutPut} from "/@/api/admin/productionManagement/CommunalDto";
|
|
|
import router from "/@/router";
|
|
|
+import {localStorageSet} from "/@/utils/localStorageSet";
|
|
|
+import {DictApi} from "/@/api/admin/Dict";
|
|
|
//import { isImage } from '/@/utils/test'
|
|
|
//import commonFunction from '/@/utils/commonFunction'
|
|
|
|
|
@@ -152,8 +155,17 @@ const props = reactive({
|
|
|
select:'',
|
|
|
textPla:'请选择部件类型'
|
|
|
})
|
|
|
+
|
|
|
+//设置获取部件状态的编码
|
|
|
+const componentStatusCode = reactive({
|
|
|
+ code:'componentStatus'
|
|
|
+})
|
|
|
+//部件状态对象
|
|
|
+const componentStatus = ref()
|
|
|
+
|
|
|
const search = (val) => {
|
|
|
bomModel.filterModel.bomType = val.value
|
|
|
+ props.select = val.value
|
|
|
}
|
|
|
|
|
|
|
|
@@ -179,6 +191,7 @@ const bomModel = reactive({
|
|
|
bomLogsTitle: '',
|
|
|
})
|
|
|
|
|
|
+
|
|
|
//const { copyText } = commonFunction()
|
|
|
|
|
|
//const previewImglist = computed(() => {
|
|
@@ -188,8 +201,29 @@ const bomModel = reactive({
|
|
|
//})
|
|
|
// return imgList
|
|
|
//})
|
|
|
+/**
|
|
|
+ * 初始化,获取缓存部件状态
|
|
|
+ */
|
|
|
+const init = async () => {
|
|
|
+ let localStatus;
|
|
|
+ localStatus = localStorageSet.getItemWithExpiration(componentStatusCode.code as string)
|
|
|
+ if (!localStatus){
|
|
|
+ const res = await new DictApi().getList([componentStatusCode.code] as string[])
|
|
|
+ /**存一天的缓存*/
|
|
|
+ localStorageSet.setItemWithExpiration(componentStatusCode.code as string, res?.data,1)
|
|
|
+ localStatus = localStorageSet.getItemWithExpiration(componentStatusCode.code as string as string)
|
|
|
+ }
|
|
|
+
|
|
|
+ /**将状态转化为map的形式*/
|
|
|
+ componentStatus.value = localStatus.reduce((map, obj) => {
|
|
|
+ map.set(Number(obj.value), obj.name);
|
|
|
+ return map;
|
|
|
+ },new Map());
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ init()
|
|
|
onQuery()
|
|
|
eventBus.off('refreshFile')
|
|
|
eventBus.on('refreshFile', async () => {
|
|
@@ -214,11 +248,31 @@ const onQuery = async () => {
|
|
|
const res = await new ComponentApi().getPage({ ...bomModel.pageInput, filter: bomModel.filterModel }).catch(() => {
|
|
|
bomModel.loading = false
|
|
|
})
|
|
|
- bomModel.bomListData = res?.data?.list ?? []
|
|
|
+ const arr = res?.data?.list
|
|
|
+ bomModel.bomListData = arr.map(item => ({
|
|
|
+ ...item,
|
|
|
+ key_name:componentStatus.value.get(item.key_name),
|
|
|
+ stand_name:componentStatus.value.get(item.stand_name),
|
|
|
+ status:componentStatus.value.get(item.status)
|
|
|
+ }))
|
|
|
bomModel.total = res?.data?.total ?? 0
|
|
|
bomModel.loading = false
|
|
|
}
|
|
|
|
|
|
+/**重置表单*/
|
|
|
+const onReset = () => {
|
|
|
+ resetSearchForm()
|
|
|
+ onQuery()
|
|
|
+}
|
|
|
+
|
|
|
+const resetSearchForm = () => {
|
|
|
+ bomModel.filterModel.bomType = ''
|
|
|
+ bomModel.filterModel.bomName = ''
|
|
|
+ bomModel.filterModel.bomProNo = ''
|
|
|
+ bomModel.filterModel.bomMateNo = ''
|
|
|
+ props.select = ''
|
|
|
+}
|
|
|
+
|
|
|
const onSizeChange = (val: number) => {
|
|
|
bomModel.pageInput.pageSize = val
|
|
|
onQuery()
|