Browse Source

优化表单验证逻辑,调整类型声明,修复样式问题

master
parent
commit
e83afaf476
  1. 37
      src/views/enterprises/update.vue

37
src/views/enterprises/update.vue

@ -88,7 +88,7 @@
v-for="(p, index) in formData.photo" v-for="(p, index) in formData.photo"
:src="p.url" :src="p.url"
:key="index" :key="index"
:preview-src-list="formData.photo.map((i) => i.url)" :preview-src-list="formData.photo.map((i: any) => i.url)"
:initial-index="index" :initial-index="index"
fit="contain" fit="contain"
class="w-148px h-148px border-solid border-1 border-color-#ccc border-rounded-8px" class="w-148px h-148px border-solid border-1 border-color-#ccc border-rounded-8px"
@ -211,8 +211,8 @@
<el-table-column label="结果反馈" width="100" align="center"> <el-table-column label="结果反馈" width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<span v-if="row.status === 1">-</span> <span v-if="row.status === 1">-</span>
<el-link type="primary" v-else @click="showInspection(row.inspectionsId)" <el-link type="primary" v-else @click="showInspection(row.inspectionsId)">
>详情 详情
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -287,7 +287,22 @@ const formRules = reactive({
enterprisesName: [{ required: true, message: '企业名称不能为空', trigger: 'blur' }], enterprisesName: [{ required: true, message: '企业名称不能为空', trigger: 'blur' }],
contactName: [{ required: true, message: '负责人不能为空', trigger: 'blur' }], contactName: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
environmentalContactPhone: [ environmentalContactPhone: [
{ required: true, message: '企业环保负责人联系电话不能为空', trigger: 'blur' } { required: true, message: '企业环保负责人联系电话不能为空', trigger: 'blur' },
{
validator: (rule: any, value: any, callback) => {
if (
value &&
!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(
value
)
) {
callback(new Error('请输入正确的手机号'))
} else {
callback()
}
},
trigger: 'blur'
}
], ],
userId: [ userId: [
{ {
@ -448,7 +463,7 @@ const getDetail = () => {
formData.value.region = getDictLabel(DICT_TYPE.ENTERPRISES_AREA, formData.value.region) formData.value.region = getDictLabel(DICT_TYPE.ENTERPRISES_AREA, formData.value.region)
formData.value.tagIds = res.tagObjList.map((i) => i.tagName).join(',') formData.value.tagIds = res.tagObjList.map((i) => i.tagName).join(',')
} }
console.log(formData.value.tagIds) console.log(formData.value.tagIds)
}) })
} }
@ -457,7 +472,7 @@ const getProveList = () => {
pageSize: -1, pageSize: -1,
enterpriseId: formData.value.id enterpriseId: formData.value.id
}).then((res) => { }).then((res) => {
proveList.value = res.list.map((i) => { proveList.value = res.list.map((i:any) => {
return { return {
...i, ...i,
files: i.qualificationFiles files: i.qualificationFiles
@ -466,7 +481,7 @@ const getProveList = () => {
}) })
} }
const deleteProve = (params) => { const deleteProve = (params:any) => {
if (params.id) { if (params.id) {
EnterpriseQualificationApi.deleteEnterpriseQualification(params.id).then(() => { EnterpriseQualificationApi.deleteEnterpriseQualification(params.id).then(() => {
message.success('删除成功') message.success('删除成功')
@ -474,7 +489,7 @@ const deleteProve = (params) => {
}) })
} else { } else {
proveList.value.splice(params.index, 1) proveList.value.splice(params.index, 1)
message.success('删除成功') message.success('删除成功')
} }
} }
@ -504,15 +519,15 @@ const logSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
} }
} }
const showInspection = (id) => { const showInspection = (id:any) => {
unref(inspectionRef).open({ id }) unref(inspectionRef).open({ id })
} }
const getSpanArr = (data) => { const getSpanArr = (data:any) => {
logSpanArr.value = [] logSpanArr.value = []
let pos = 0 let pos = 0
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (i === 0) { if (i === 0) {
logSpanArr.value.push(1) logSpanArr.value.push(1)
pos = 0 pos = 0

Loading…
Cancel
Save