优化图纸预览和编辑功能
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
<!-- 发布图纸 -->
|
||||
<div class="ma-auto mt-[30px] w-[1440px] flex">
|
||||
<div class="w-[1016px]">
|
||||
<el-form ref="formRef" :model="form" label-width="120px">
|
||||
<el-form ref="formRef" :model="form" label-width="120px" :disabled="type === 'preview'">
|
||||
<!-- 图纸分类 -->
|
||||
<DrawType ref="drawTypeRef" v-model="form" />
|
||||
<div class="mt-[24px] box-border border border-[#EEEEEE] rounded-[12px] border-solid bg-[#FFFFFF] px-[33px] py-[22px]">
|
||||
@ -13,7 +13,7 @@
|
||||
<DrawForm v-if="form.draws[index]" v-model="form.draws[index]" :vaild-rules="'draws.' + index" :form-ref="formRef" @preview="handlePreview" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-form-item label-width="110px">
|
||||
<el-form-item label-width="110px" v-if="type !== 'preview'">
|
||||
<!-- <el-button class="w-121px h-37px!" :loading="loading" @click="handleSubmit">预览</el-button> -->
|
||||
<el-button type="primary" class="w-[121px] h-[37px]!" :loading="loading" @click="handleSubmit">发布</el-button>
|
||||
</el-form-item>
|
||||
@ -32,8 +32,18 @@
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
|
||||
import type { TcreateReq } from '~/api/upnew/types'
|
||||
import { create } from '~/api/upnew/index'
|
||||
const router = useRouter() // 导入路由实例,用于跳转页面
|
||||
import { create, view } from '~/api/upnew/index'
|
||||
const route = useRoute() // 导入路由实例,用于跳转页面
|
||||
const id = computed(() => {
|
||||
return route.query.id as string
|
||||
})
|
||||
const projectId = computed(() => {
|
||||
return route.query.projectId as string
|
||||
})
|
||||
|
||||
const type = computed(() => {
|
||||
return route.query.type || 'add'
|
||||
})
|
||||
|
||||
const form = reactive<TcreateReq>({
|
||||
activeName: 1, // 标签
|
||||
@ -123,6 +133,37 @@
|
||||
// previewForm.name = val.name
|
||||
}
|
||||
|
||||
/** 组装回显的数据 */
|
||||
const getDetail = () => {
|
||||
view({ id: id.value, projectId: projectId.value }).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code === 0) {
|
||||
form.isDomestic = data.isDomestic
|
||||
form.province = data.province
|
||||
form.city = data.city
|
||||
form.county = data.county
|
||||
form.activeName = form.type = data.draws[0].type
|
||||
form.draws = data.draws.map((c) => {
|
||||
return {
|
||||
...c,
|
||||
coverImages: c.coverImages.map((d) => {
|
||||
return {
|
||||
...d,
|
||||
name: d.title,
|
||||
}
|
||||
}),
|
||||
otherFiles: c.otherFiles.map((d) => {
|
||||
return {
|
||||
...d,
|
||||
name: d.title,
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 图纸类型
|
||||
const drawTypeRef = ref<InstanceType<typeof DrawType>>()
|
||||
onMounted(() => {
|
||||
@ -130,6 +171,10 @@
|
||||
drawTypeRef.value?.handleTypeChange(1)
|
||||
// 初始化图纸类型
|
||||
form.type = 1
|
||||
|
||||
if (type.value !== 'add') {
|
||||
getDetail()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user