|
|
@ -1,6 +1,63 @@ |
|
|
|
<!-- 导入组件 --> |
|
|
|
<template> |
|
|
|
<Dialog v-model="dialogVisible" title="导入" width="600"> |
|
|
|
<el-form |
|
|
|
:inline="true" |
|
|
|
:model="queryParams" |
|
|
|
class="demo-form-inline" |
|
|
|
style="margin-bottom: -17px" |
|
|
|
label-width="100px" |
|
|
|
> |
|
|
|
<el-form-item label="项目" style="width: calc(20% - 32px)"> |
|
|
|
<el-select |
|
|
|
v-model="queryParams.proCode" |
|
|
|
placeholder="请选择项目" |
|
|
|
clearable |
|
|
|
style="width: 100%" |
|
|
|
> |
|
|
|
<el-option v-for=" (item) in projectList" :key="item" :label="item.name" :value="item.code" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="物料" style="width: calc(20% - 32px)"> |
|
|
|
<el-select |
|
|
|
v-model="queryParams.itemCode" |
|
|
|
placeholder="请选择物料" |
|
|
|
clearable |
|
|
|
style="width: 100%" |
|
|
|
@change="detectionItemChange" |
|
|
|
> |
|
|
|
<el-option v-for=" (item) in itemList" :key="item" :label="item.name" :value="item.code" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="物料类型" style="width: calc(20% - 32px)"> |
|
|
|
<el-select |
|
|
|
v-model="queryParams.detectionType" |
|
|
|
placeholder="请选择检测类型" |
|
|
|
clearable |
|
|
|
style="width: 100%" |
|
|
|
@change="detectionItemChange" |
|
|
|
> |
|
|
|
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.ITEMBASIC_TYPE)" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="检测项" style="width: calc(20% - 32px)"> |
|
|
|
<el-select |
|
|
|
v-model="queryParams.detectionItemContentId" |
|
|
|
placeholder="请选择检测项" |
|
|
|
clearable |
|
|
|
style="width: 100%" |
|
|
|
@change="deItemChange" |
|
|
|
> |
|
|
|
<el-option v-for=" (item) in detectionItemList" :key="item" :label="item.name" :value="item.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<!-- <el-form-item> |
|
|
|
<el-button type="info" plain @click="handleQuery"> |
|
|
|
<Icon class="mr-5px" icon="ep:search" /> |
|
|
|
搜索 |
|
|
|
</el-button> |
|
|
|
</el-form-item> --> |
|
|
|
</el-form> |
|
|
|
<el-upload ref="uploadRef" v-model:file-list="fileList" :action="importUrl + '?mode=' + mode + '&file=' + file + '&updatePart=' + updatePart + '&outFile=' + outFile" |
|
|
|
:auto-upload="false" :disabled="formLoading" :headers="uploadHeaders" :limit="1" :on-error="submitFormError" |
|
|
|
:on-exceed="handleExceed" :on-success="submitFormSuccess" :accept="accept" drag |
|
|
@ -69,6 +126,12 @@ import { getAccessToken, getTenantId } from '@/utils/auth' |
|
|
|
import download from '@/utils/download' |
|
|
|
|
|
|
|
defineOptions({ name: 'ImportForm' }) |
|
|
|
import * as ZlnalysisAPI from '@/api/tjanalysis/zlanalysis' |
|
|
|
import * as ProjecAPI from '@/api/spc/project' |
|
|
|
import * as ItembasicApi from '@/api/spc/itembasic' |
|
|
|
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails' |
|
|
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
|
|
|
import {formatDate} from '@/utils/formatTime' |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
|
|
|
@ -79,6 +142,13 @@ const uploadHeaders = ref() // 上传 Header 头 |
|
|
|
const fileList = ref([]) // 文件列表 |
|
|
|
const file = ref('') |
|
|
|
|
|
|
|
const queryParams = reactive({ |
|
|
|
proCode: '', |
|
|
|
itemCode: '', |
|
|
|
detectionType: '', |
|
|
|
detectionItemContentId: null, |
|
|
|
ecTab: '1' |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
@ -147,11 +217,53 @@ const coverIsDisable = ref(props.coverIsDisable)//覆盖是否禁用,默认值 |
|
|
|
const updatePart = ref(props.updatePart)//是否部门保存 |
|
|
|
const outFile = ref(props.outFile)//是否引入外部资源 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 项目列表 |
|
|
|
const projectList = ref() |
|
|
|
// 物料列表 |
|
|
|
const itemList = ref() |
|
|
|
// 检测项列表 |
|
|
|
const detectionItemList = ref() |
|
|
|
const pnaLoading = ref(true) |
|
|
|
const tabLoading = ref(true) |
|
|
|
const ec1Loading = ref(true) |
|
|
|
const ec2Loading = ref(true) |
|
|
|
const ec3Loading = ref(true) |
|
|
|
const ec4Loading = ref(true) |
|
|
|
const ec5Loading = ref(true) |
|
|
|
const initQuerys = async () => { |
|
|
|
const dictOptions = await getIntDictOptions(DICT_TYPE.ITEMBASIC_TYPE) |
|
|
|
if (dictOptions != null && dictOptions.length != 0) { |
|
|
|
queryParams.detectionType = dictOptions[0].value + '' |
|
|
|
} |
|
|
|
const _projectList = await ProjecAPI.selectAllPros() |
|
|
|
if (_projectList != null && _projectList.length != 0) { |
|
|
|
projectList.value = _projectList |
|
|
|
} |
|
|
|
const _itemList = await ItembasicApi.selectItems() |
|
|
|
if (_itemList != null && _itemList.length != 0) { |
|
|
|
itemList.value = _itemList |
|
|
|
queryParams.itemCode = _itemList[0].code |
|
|
|
} |
|
|
|
const _detectionItemList = await TemplateItemDetailsApi.selectDetectionItems(queryParams.itemCode , queryParams.detectionType) |
|
|
|
if (_detectionItemList != null && _detectionItemList.lenght != 0) { |
|
|
|
detectionItemList.value = _detectionItemList |
|
|
|
queryParams.detectionItemContentId = _detectionItemList[0].value |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
onMounted(()=>{ |
|
|
|
initQuerys() |
|
|
|
}) |
|
|
|
|
|
|
|
const importUrl = |
|
|
|
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + props.url |
|
|
|
|
|
|
|
/** 打开弹窗 */ |
|
|
|
const open = () => { |
|
|
|
console.log(111) |
|
|
|
dialogVisible.value = true |
|
|
|
resetForm() |
|
|
|
} |
|
|
|