Browse Source

导入添加搜索

master
zhang_li 1 year ago
parent
commit
6e259702a5
  1. 112
      src/components/ImportForm/src/ImportForm.vue

112
src/components/ImportForm/src/ImportForm.vue

@ -1,6 +1,63 @@
<!-- 导入组件 --> <!-- 导入组件 -->
<template> <template>
<Dialog v-model="dialogVisible" title="导入" width="600"> <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" <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" :auto-upload="false" :disabled="formLoading" :headers="uploadHeaders" :limit="1" :on-error="submitFormError"
:on-exceed="handleExceed" :on-success="submitFormSuccess" :accept="accept" drag :on-exceed="handleExceed" :on-success="submitFormSuccess" :accept="accept" drag
@ -69,6 +126,12 @@ import { getAccessToken, getTenantId } from '@/utils/auth'
import download from '@/utils/download' import download from '@/utils/download'
defineOptions({ name: 'ImportForm' }) 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() // const message = useMessage() //
@ -79,6 +142,13 @@ const uploadHeaders = ref() // 上传 Header 头
const fileList = ref([]) // const fileList = ref([]) //
const file = ref('') const file = ref('')
const queryParams = reactive({
proCode: '',
itemCode: '',
detectionType: '',
detectionItemContentId: null,
ecTab: '1'
})
const props = defineProps({ const props = defineProps({
@ -147,11 +217,53 @@ const coverIsDisable = ref(props.coverIsDisable)//覆盖是否禁用,默认值
const updatePart = ref(props.updatePart)// const updatePart = ref(props.updatePart)//
const outFile = ref(props.outFile)// 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 = const importUrl =
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + props.url import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + props.url
/** 打开弹窗 */ /** 打开弹窗 */
const open = () => { const open = () => {
console.log(111)
dialogVisible.value = true dialogVisible.value = true
resetForm() resetForm()
} }

Loading…
Cancel
Save