Browse Source

企业资质

master
赵鹏 1 month ago
parent
commit
0febad00e3
  1. 5
      src/api/qualification/index.ts
  2. 22
      src/components/UploadFile/src/UploadImgs.vue
  3. 98
      src/views/enterprises/update.vue
  4. 25
      src/views/qualification/EnterpriseQualificationForm.vue
  5. 2
      src/views/qualification/index.vue

5
src/api/qualification/index.ts

@ -20,6 +20,11 @@ export const EnterpriseQualificationApi = {
return await request.get({ url: `/system/enterprise-qualification/page`, params })
},
// 查询企业资质分页
getEnterpriseQualificationPageEnterprise: async (params: any) => {
return await request.get({ url: `/system/enterprise-qualification/pageEnterprise`, params })
},
// 查询企业资质详情
getEnterpriseQualification: async (id: number) => {
return await request.get({ url: `/system/enterprise-qualification/get?id=` + id })

22
src/components/UploadFile/src/UploadImgs.vue

@ -16,15 +16,17 @@
:on-success="uploadSuccess"
list-type="picture-card"
>
<div class="upload-empty">
<slot name="empty">
<Icon icon="ep:plus" />
<!-- <span>请上传图片</span> -->
</slot>
</div>
<div class="upload-empty" v-if="!disabled">
<slot name="empty">
<Icon icon="ep:plus" />
<!-- <span>请上传图片</span> -->
</slot>
</div>
<template #file="{ file }">
<img :src="file.url" class="upload-image" />
<div class="upload-handle" @click.stop>
<div class="handle-icon" @click="imagePreview(file.url!)">
<Icon icon="ep:zoom-in" />
<span>查看</span>
@ -120,7 +122,6 @@ 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)
@ -190,11 +191,12 @@ const handleExceed = () => {
}
}
:deep(.disabled) {
:deep(.is-disabled) {
.el-upload--picture-card,
.el-upload-dragger {
display: none !important;
cursor: not-allowed;
background: var(--el-disabled-bg-color) !important;
background: var(--el-disabled-bg-color);
border: 1px dashed var(--el-border-color-darker);
&:hover {
@ -203,6 +205,8 @@ const handleExceed = () => {
}
}
.upload-box {
.no-border {
:deep(.el-upload--picture-card) {

98
src/views/enterprises/update.vue

@ -75,7 +75,7 @@
<el-input v-model="formData.introduction" type="textarea" placeholder="请输入企业介绍" />
</el-form-item>
<el-form-item label="企业照片" prop="fileIds">
<UploadImgs v-model="formData.fileIds" :limit="3" height="100px" width="100px" />
<UploadImgs v-model="fileList" :limit="3" height="100px" width="100px" />
</el-form-item>
@ -136,21 +136,59 @@
<SelectUser ref="selectUserRef" @select-user="echoUser" />
</ContentWrap>
<ContentWrap title="资质记录" v-if="formType === 'update'">
<el-card title="资质记录" v-if="formType === 'update'">
<template #header>
<div class="flex items-center justify-between">
<span class="text-16px font-700">资质记录</span>
<el-button type="primary" @click="openQualForm('create')">新增</el-button>
</div>
</template>
<el-table v-loading="loading" :data="qualificationlist" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="资质图片" align="center" fixed="left" prop="files" >
<template #default="scope">
<UploadImgs :disabled="true" v-model="scope.row.files" :limit="3" height="100px" width="100px" />
</template>
</el-table-column>
<el-table-column label="资质编号" align="center" fixed="left" prop="enterpriseAuth" />
<el-table-column label="资质名称" align="center" fixed="left" prop="qualificationName" />
<el-table-column label="资质描述" align="center" fixed="left" prop="qualificationDescription" />
<el-table-column label="资质名称" align="center" fixed="left" 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"
:formatter="dateFormatter"
:formatter="dateFormatter2"
width="180px"
/>
</el-table>
</ContentWrap>
<el-table-column label="操作" align="center" min-width="120px">
<template #default="scope">
<el-button
link
type="primary"
@click="openQualForm('update', scope.row.id)"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handQualDelete(scope.row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 表单弹窗添加/修改 -->
<EnterpriseQualificationForm ref="formQualRef" @success="getQualificationList" />
<ContentWrap title="执法记录" v-if="formType === 'update'">
<div class="demo-collapse">
<el-collapse v-model="activeNames" @change="handleChange">
@ -199,6 +237,7 @@ import { getStrDictOptions, DICT_TYPE } from '@/utils/dict'
import { EnterprisesApi, EnterprisesVO } from '@/api/enterprises'
import { EnterpriseQualificationApi, EnterpriseQualificationVO } from '@/api/qualification'
import { UserVO, getSimpleUserListByUserType } from '@/api/system/user'
import EnterpriseQualificationForm from '@/views/qualification/EnterpriseQualificationForm.vue'
import { EnterpriseInspectionsApi, EnterpriseInspectionsVO } from '@/api/enterpriseinspections'
@ -208,7 +247,7 @@ import { ElMessage } from 'element-plus'
import SelectUser from './components/SelectUser.vue'
import * as UserApi from '@/api/system/user'
import {useTagsViewStore} from "@/store/modules/tagsView";
import {dateFormatter, formatDate} from "@/utils/formatTime";
import {dateFormatter,dateFormatter2, formatDate} from "@/utils/formatTime";
/** 企业 表单 */
defineOptions({ name: 'UpdateEnterprises' })
@ -247,10 +286,12 @@ const formData = ref({
managerDeptId: undefined,
ides: undefined,
startUserSelectAssignees:undefined,
enterpriseUserId: undefined,
fileIds:[]
enterpriseUserId: undefined
})
const fileList=ref([])
const getEnterpriseUserList = async () => {
const type:number = 2
const data = await getSimpleUserListByUserType(type)
@ -275,8 +316,8 @@ function init() {
EnterprisesApi.getEnterprises(query.id).then((res) => {
selectedUser.value=res.inviterName;
// formData.value.startUserSelectAssignees=res.userId;
fileList.value=res.files;
formData.value = res
formData.value.fileIds=res.files;
})
}else{formType.value = 'create'}
}
@ -362,6 +403,26 @@ const handleSearch = () => {
}
}
/** 添加/修改操作 */
const formQualRef = ref()
const openQualForm = (type: string, id?: number) => {
formQualRef.value.open(type, id, formData.value.id)
}
/** 删除按钮操作 */
const handQualDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await EnterpriseQualificationApi.deleteEnterpriseQualification(id)
message.success(t('common.delSuccess'))
//
await getQualificationList()
} catch {}
}
onMounted(() => {
init()
//
@ -410,13 +471,15 @@ const submitForm = async () => {
//console.log(formData.value)
//
await formRef.value.validate()
formData.value.enterprisesStatus=1;
debugger
formData.value.fileIds= formData.value.fileIds.map((item) => item.id);
//
loading.value = true
try {
const data = formData.value
let data = formData.value
// 1
data.enterprisesStatus = 1 as number;
data.fileIds = (fileList.value || []).map((item: any) => item.id);
if (formType.value == 'create') {
await EnterprisesApi.pccreateEnterprises(data)
message.success(t('common.createSuccess'))
@ -432,6 +495,9 @@ const submitForm = async () => {
emit('success')
} finally {
loading.value = false
//
tagView.delView(route)
router.go(-1)
}
}
@ -494,7 +560,7 @@ async function uploadSuccess(res) {
const getQualificationList = async () => {
loading.value = true
try {
const data = await EnterpriseQualificationApi.getEnterpriseQualificationPage({"enterpriseId":query.id})
const data = await EnterpriseQualificationApi.getEnterpriseQualificationPageEnterprise({"enterpriseId":query.id})
qualificationlist.value = data.list
} finally {
loading.value = false

25
src/views/qualification/EnterpriseQualificationForm.vue

@ -44,24 +44,24 @@
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> -->
<el-form-item label="办理日期" prop="handleDate">
<!-- <el-form-item label="办理日期" prop="handleDate">
<el-date-picker
v-model="formData.handleDate"
type="date"
value-format="x"
placeholder="选择办理日期"
/>
</el-form-item>
</el-form-item> -->
<el-form-item label="资质编号" prop="enterpriseAuth">
<el-input v-model="formData.enterpriseAuth" placeholder="请输入资质编号" />
<el-input v-model="formData.enterpriseAuth" placeholder="请输入资质编号" />
</el-form-item>
</el-form>
<el-form-item label="资质图片" prop="files">
<UploadImgs v-model="fileIds" :limit="3" />
<UploadImgs v-model="fileIds" :limit="1" />
</el-form-item>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
@ -128,11 +128,12 @@ const remoteSearchEnterprise = async (query: string) => {
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
const open = async (type: string, id?: number,enterpriseId?:number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
fileIds.value=[]
//
if (id) {
formLoading.value = true
@ -144,14 +145,16 @@ const open = async (type: string, id?: number) => {
fileIds.value = res1.files
// ID
//
if (formData.value.enterpriseId) {
const res = await EnterprisesApi.getEnterprises(formData.value.enterpriseId)
enterpriseOptions.value = [res]
}
} finally {
formLoading.value = false
}
}
if (formData.value.enterpriseId || enterpriseId) {
formData.value.enterpriseId = formData.value.enterpriseId || enterpriseId
const res = await EnterprisesApi.getEnterprises(formData.value.enterpriseId)
enterpriseOptions.value = [res]
}
}
defineExpose({ open }) // open

2
src/views/qualification/index.vue

@ -84,7 +84,7 @@
</template>
</el-table-column>
<el-table-column label="资质到期日期" :formatter="dateFormatter2" align="center" prop="expiryDate" />
<el-table-column label="办理日期" :formatter="dateFormatter2" align="center" prop="handleDate" />
<!-- <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">

Loading…
Cancel
Save