Browse Source

资质上传

master
赵鹏 1 month ago
parent
commit
8093524502
  1. 2
      .env.local
  2. 94
      src/api/qualification/index.ts
  3. 3
      src/components/UploadFile/src/UploadImgs.vue
  4. 1
      src/views/Home/Index.vue
  5. 16
      src/views/enterprises/update.vue
  6. 74
      src/views/qualification/EnterpriseQualificationForm.vue
  7. 59
      src/views/qualification/index.vue

2
.env.local

@ -4,7 +4,7 @@ NODE_ENV=development
VITE_DEV=true
# 请求路径
VITE_BASE_URL='http://188.188.3.232:48080'
VITE_BASE_URL='http://localhost:48080'
#VITE_BASE_URL='http://188.188.4.176:48080'
#VITE_BASE_URL='http://192.168.2.63:48080'

94
src/api/qualification/index.ts

@ -1,47 +1,47 @@
import request from '@/config/axios'
// 企业资质 VO
export interface EnterpriseQualificationVO {
id: number // 主键
enterpriseId: number // 企业ID
qualificationName: number // 资质名称,例如:排污许可证、环保合格证
expiryDate: Date // 资质到期日期
qualificationDescription: string // 资质描述,详细说明资质信息
updateBy: string // 修改人
createBy: string // 创建人
handleDate: Date // 办理日期
enterpriseAuth: string // 资质编号
}
// 企业资质 API
export const EnterpriseQualificationApi = {
// 查询企业资质分页
getEnterpriseQualificationPage: async (params: any) => {
return await request.get({ url: `/system/enterprise-qualification/page`, params })
},
// 查询企业资质详情
getEnterpriseQualification: async (id: number) => {
return await request.get({ url: `/system/enterprise-qualification/get?id=` + id })
},
// 新增企业资质
createEnterpriseQualification: async (data: EnterpriseQualificationVO) => {
return await request.post({ url: `/system/enterprise-qualification/create`, data })
},
// 修改企业资质
updateEnterpriseQualification: async (data: EnterpriseQualificationVO) => {
return await request.put({ url: `/system/enterprise-qualification/update`, data })
},
// 删除企业资质
deleteEnterpriseQualification: async (id: number) => {
return await request.delete({ url: `/system/enterprise-qualification/delete?id=` + id })
},
// 导出企业资质 Excel
exportEnterpriseQualification: async (params) => {
return await request.download({ url: `/system/enterprise-qualification/export-excel`, params })
},
}
import request from '@/config/axios'
// 企业资质 VO
export interface EnterpriseQualificationVO {
id: number // 主键
enterpriseId: number // 企业ID
qualificationName: number // 资质名称,例如:排污许可证、环保合格证
expiryDate: Date // 资质到期日期
qualificationDescription: string // 资质描述,详细说明资质信息
updateBy: string // 修改人
createBy: string // 创建人
handleDate: Date // 办理日期
enterpriseAuth: string // 资质编号
}
// 企业资质 API
export const EnterpriseQualificationApi = {
// 查询企业资质分页
getEnterpriseQualificationPage: async (params: any) => {
return await request.get({ url: `/system/enterprise-qualification/page`, params })
},
// 查询企业资质详情
getEnterpriseQualification: async (id: number) => {
return await request.get({ url: `/system/enterprise-qualification/get?id=` + id })
},
// 新增企业资质
createEnterpriseQualification: async (data: EnterpriseQualificationVO) => {
return await request.post({ url: `/system/enterprise-qualification/create`, data })
},
// 修改企业资质
updateEnterpriseQualification: async (data: EnterpriseQualificationVO) => {
return await request.put({ url: `/system/enterprise-qualification/update`, data })
},
// 删除企业资质
deleteEnterpriseQualification: async (id: number) => {
return await request.delete({ url: `/system/enterprise-qualification/delete?id=` + id })
},
// 导出企业资质 Excel
exportEnterpriseQualification: async (params) => {
return await request.download({ url: `/system/enterprise-qualification/export-excel`, params })
},
}

3
src/components/UploadFile/src/UploadImgs.vue

@ -120,10 +120,11 @@ interface UploadEmits {
const emit = defineEmits<UploadEmits>()
const uploadSuccess: UploadProps['onSuccess'] = (res: any): void => {
message.success('上传成功')
debugger
//
const index = fileList.value.findIndex((item) => item.response?.data === res.data)
fileList.value.splice(index, 1)
uploadList.value.push({ id: res.data.file_id, url: res.data.url })
uploadList.value.push({ id: res.data.id, url: res.data.url })
if (uploadList.value.length == uploadNumber.value) {
fileList.value.push(...uploadList.value)
uploadList.value = []

1
src/views/Home/Index.vue

@ -22,7 +22,6 @@
</el-card>
</el-col>
<el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24">
<el-card shadow="hover" class="mb-8px">
<template #header>
月任务概况

16
src/views/enterprises/update.vue

@ -76,11 +76,7 @@
</el-form-item>
<el-form-item label="企业照片" prop="fileIds">
<UploadImgs v-model="formData.fileIds" :limit="3" height="100px" width="100px" />
</el-form-item>
<el-form-item label="企业资质" prop="fileIds">
<UploadImgs v-model="formData.fileIds" :limit="3" height="100px" width="100px" />
</el-form-item>
</el-form-item>
@ -280,6 +276,7 @@ function init() {
selectedUser.value=res.inviterName;
// formData.value.startUserSelectAssignees=res.userId;
formData.value = res
formData.value.fileIds=res.files;
})
}else{formType.value = 'create'}
}
@ -414,6 +411,8 @@ const submitForm = async () => {
//
await formRef.value.validate()
formData.value.enterprisesStatus=1;
debugger
formData.value.fileIds= formData.value.fileIds.map((item) => item.id);
//
loading.value = true
try {
@ -469,7 +468,6 @@ const resetForm = () => {
const uploadList: any = ref([])
async function uploadSuccess(res) {
console.log('1111111111111111111');
console.log(res.data.file_id)
fileIds.value.push(res.data.file_id);
if (res) {
@ -537,12 +535,6 @@ const getInspectionsLogList = async (insprctionsId) => {
}
}
</script>
<style lang="scss" scoped>

74
src/views/qualification/EnterpriseQualificationForm.vue

@ -8,7 +8,22 @@
v-loading="formLoading"
>
<el-form-item label="选择企业" prop="enterpriseId">
<el-input v-model="formData.enterpriseId" placeholder="请输入企业ID" />
<el-select
v-model="formData.enterpriseId"
filterable
remote
reserve-keyword
placeholder="请输入企业名称搜索"
:remote-method="remoteSearchEnterprise"
:loading="enterpriseLoading"
>
<el-option
v-for="item in enterpriseOptions"
:key="item.id"
:label="item.enterprisesName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="资质名称" prop="qualificationName">
<el-select v-model="formData.qualificationName" placeholder="请选择资质名称">
@ -29,15 +44,10 @@
placeholder="选择资质到期日期"
/>
</el-form-item>
<el-form-item label="资质描述,详细说明资质信息" prop="qualificationDescription">
<el-form-item label="资质描述" prop="qualificationDescription">
<Editor v-model="formData.qualificationDescription" height="150px" />
</el-form-item>
<el-form-item label="修改人" prop="updateBy">
<el-input v-model="formData.updateBy" placeholder="请输入修改人" />
</el-form-item>
<el-form-item label="创建人" prop="createBy">
<el-input v-model="formData.createBy" placeholder="请输入创建人" />
</el-form-item>
<el-form-item label="办理日期" prop="handleDate">
<el-date-picker
v-model="formData.handleDate"
@ -50,6 +60,9 @@
<el-input v-model="formData.enterpriseAuth" placeholder="请输入资质编号" />
</el-form-item>
</el-form>
<el-form-item label="资质图片" prop="files">
<UploadImgs v-model="fileIds" :limit="3" />
</el-form-item>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
@ -58,13 +71,15 @@
</template>
<script setup lang="ts">
import { EnterpriseQualificationApi, EnterpriseQualificationVO } from '@/api/qualification'
import { EnterprisesApi } from '@/api/enterprises'
/** 企业资质 表单 */
defineOptions({ name: 'EnterpriseQualificationForm' })
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
@ -79,11 +94,38 @@ const formData = ref({
createBy: undefined,
handleDate: undefined,
enterpriseAuth: undefined,
files: [] as any[],
})
const formRules = reactive({
qualificationName: [{ required: true, message: '资质名称,例如:排污许可证、环保合格证不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
const fileIds=ref([])
//
const enterpriseLoading = ref(false)
const enterpriseOptions = ref([])
//
const remoteSearchEnterprise = async (query: string) => {
if (query === '') {
enterpriseOptions.value = []
return
}
enterpriseLoading.value = true
try {
const res = await EnterprisesApi.getEnterprisesPage({
pageNo: 1,
pageSize: 5,
enterprisesName: query
})
enterpriseOptions.value = res.list
} finally {
enterpriseLoading.value = false
}
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
@ -95,7 +137,17 @@ const open = async (type: string, id?: number) => {
if (id) {
formLoading.value = true
try {
formData.value = await EnterpriseQualificationApi.getEnterpriseQualification(id)
let res1 = await EnterpriseQualificationApi.getEnterpriseQualification(id)
formData.value = res1;
//
formData.value.qualificationName = parseInt(formData.value.qualificationName)
fileIds.value = res1.files
// ID
//
if (formData.value.enterpriseId) {
const res = await EnterprisesApi.getEnterprises(formData.value.enterpriseId)
enterpriseOptions.value = [res]
}
} finally {
formLoading.value = false
}
@ -111,7 +163,9 @@ const submitForm = async () => {
//
formLoading.value = true
try {
formData.value.files = fileIds.value.map(f => ( f.id ))
const data = formData.value as unknown as EnterpriseQualificationVO
if (formType.value === 'create') {
await EnterpriseQualificationApi.createEnterpriseQualification(data)
message.success(t('common.createSuccess'))

59
src/views/qualification/index.vue

@ -8,15 +8,7 @@
:inline="true"
label-width="98px"
>
<el-form-item label="企业ID" prop="enterpriseId">
<el-input
v-model="queryParams.enterpriseId"
placeholder="请输入企业ID"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="资质名称" prop="qualificationName">
<el-input
v-model="queryParams.qualificationName"
@ -37,35 +29,7 @@
class="!w-220px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-220px"
/>
</el-form-item>
<el-form-item label="修改人" prop="updateBy">
<el-input
v-model="queryParams.updateBy"
placeholder="请输入修改人"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建人" prop="createBy">
<el-input
v-model="queryParams.createBy"
placeholder="请输入创建人"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="办理日期" prop="handleDate">
<el-date-picker
v-model="queryParams.handleDate"
@ -113,27 +77,14 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="企业名称" align="center" prop="enterpriseName" />
<el-table-column label="资质名称" align="center" prop="qualificationName" >
<template #default="scope">
<dict-tag :type="DICT_TYPE.ENTERPRISES_QUA" :value="scope.row.qualificationName" />
</template>
</el-table-column>
<el-table-column label="资质到期日期" align="center" prop="expiryDate" />
<el-table-column label="资质描述,详细说明资质信息" align="center" prop="qualificationDescription" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="修改人" align="center" prop="updateBy" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="办理日期" align="center" prop="handleDate" />
<el-table-column label="资质到期日期" :formatter="dateFormatter2" align="center" prop="expiryDate" />
<el-table-column label="办理日期" :formatter="dateFormatter2" align="center" prop="handleDate" />
<el-table-column label="资质编号" align="center" prop="enterpriseAuth" />
<el-table-column label="操作" align="center" min-width="120px">
<template #default="scope">
@ -170,7 +121,7 @@
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download'
import { EnterpriseQualificationApi, EnterpriseQualificationVO } from '@/api/qualification'
import EnterpriseQualificationForm from './EnterpriseQualificationForm.vue'

Loading…
Cancel
Save