This commit is contained in:
zmj 2024-03-17 22:23:52 +08:00
parent 7fdd62d497
commit eaa590066a
7 changed files with 259 additions and 27 deletions

View File

@ -3,22 +3,36 @@
<popup ref="popupRef" :async="true" width="80%" @close="handleClose" :showFootBtn="false"> <popup ref="popupRef" :async="true" width="80%" @close="handleClose" :showFootBtn="false">
<el-form ref="formRef" :model="formData" label-width="100px"> <el-form ref="formRef" :model="formData" label-width="100px">
<el-descriptions :column="3" :title="detailConfig?.title || '详情'" border> <el-descriptions :column="3" :title="detailConfig?.title || '详情'" border>
<el-descriptions-item :label="item.label" label-align="left" align="left" <el-descriptions-item :label="item.label" label-align="left" align="left"
v-for="(item, index) in detailConfig?.config" :key="index"> v-for="(item, index) in detailConfig?.config.filter(item => !item.column)" :key="index">
{{ formData[item.value] }} {{ formData[item.value] }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-descriptions :column="1" border v-if="formData.annex"> <el-descriptions :column="1" border
<el-descriptions-item label="附件" label-align="left" align="left" v-show="formData.annex"> v-for="(item, index) in detailConfig?.config.filter(item => item.column == 1)" :key="index">
<el-link :href="item.uri" type="primary" target="_blank" v-for="item in formData.annex" <el-descriptions-item :label="item.label" label-align="left" align="left"
v-if="Array.isArray(formData[item.value])">
<el-link :href="item.uri" type="primary" target="_blank" v-for="items in formData[item.value]"
class="mr-5"> class="mr-5">
{{ item.name }} {{ items.name }}
</el-link> </el-link>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :label="item.label" label-align="left" align="left" v-else>
{{ formData[item.value] }}
</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-form> </el-form>
<el-card class="mt-5">
<template #header>
{{ detailConfig.table.title }}列表
</template>
<el-table :data="tableLists" v-if="detailConfig?.table">
<el-table-column :label="item.label" :prop="item.value" show-overflow-tooltip
v-for="(item, index) in detailConfig.table.tableConfig" :key="index" />
</el-table>
</el-card>
</popup> </popup>
</div> </div>
</template> </template>
@ -26,11 +40,9 @@
<script lang="ts" setup name="customdetail"> <script lang="ts" setup name="customdetail">
import Popup from '@/components/popup/index.vue' import Popup from '@/components/popup/index.vue'
import { defineProps, ref, defineExpose } from "vue"
import { defineProps, ref, reactive, defineExpose } from "vue" const props = defineProps({
defineProps({
detailConfig: { detailConfig: {
type: Object, type: Object,
require: true require: true
@ -39,18 +51,22 @@ defineProps({
}) })
const emit = defineEmits(['success', 'close']) const emit = defineEmits(['success', 'close'])
const popupRef = shallowRef<InstanceType<typeof Popup>>() const popupRef = shallowRef<InstanceType<typeof Popup>>()
const tableLists = ref('')
// //
const formData = ref({}) const formData = ref({})
// //
const setFormData = async (data: Record<any, any>) => { const setFormData = async (data: Record<any, any>) => {
formData.value = data formData.value = data
console.log(formData.value, 'formData')
if (props.detailConfig?.table) {
let res = await props.detailConfig.table.fetchFun({ [props.detailConfig.table.query]: formData.value.id })
tableLists.value = res.lists
}
} }
@ -69,7 +85,6 @@ const handleClose = () => {
defineExpose({ defineExpose({
open, open,
setFormData, setFormData,

View File

@ -0,0 +1,67 @@
import { apimanage_company_contacts } from '@/api/manage_company'
const detailConfig = {
title: "项目管理--参建单位",
config: [
{
label: "项目名称",
value: "project_name"
},
{
label: "单位名称",
value: "name"
},
{
label: "单位类别",
value: "type"
},
{
label: "资质等级",
value: "qualification_grade"
},
{
label: "联系电话",
value: "telephone"
},
{
label: "责任范围",
value: "duty"
},
],
table: {
title: "联系人",
tableConfig: [
{
label: "姓名",
value: 'name',
},
{
label: "职务",
value: 'duties'
},
{
label: "办公电话",
value: 'telephone',
},
{
label: "手机号码",
value: 'mobile',
},
{
label: "电子邮箱",
value: 'email',
},
{
label: "传真",
value: 'fax',
},
],
query: 'company_id',
fetchFun: apimanage_company_contacts,
}
}
export default detailConfig;

View File

@ -54,6 +54,10 @@
@click="handleDelete(row.id)"> @click="handleDelete(row.id)">
删除 删除
</el-button> </el-button>
<el-button v-perms="['manage_basic.manage_project/detail']" type="danger" link
@click="handleDetail(row.id)">
详情
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -63,6 +67,8 @@
</div> </div>
</el-card> </el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<detailPage v-if="showDetail" ref="detailRef" @close="showEdit = false" :detailConfig="detailConfig" />
</div> </div>
</template> </template>
@ -70,13 +76,15 @@
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiManageCompanyLists, apiManageCompanyDelete, apiManageCompanyDetail } from '@/api/manage_company' import { apiManageCompanyLists, apiManageCompanyDelete, apiManageCompanyDetail } from '@/api/manage_company'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './edit.vue' import EditPopup from './edit.vue'
import detailConfig from './detail'
const editRef = shallowRef<InstanceType<typeof EditPopup>>() const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = ref('')
// //
const showEdit = ref(false) const showEdit = ref(false)
const showDetail = ref(false)
// //
@ -127,6 +135,15 @@ const handleDelete = async (id: number | any[]) => {
await apiManageCompanyDelete({ id }) await apiManageCompanyDelete({ id })
getLists() getLists()
} }
//
const handleDetail = async (id: any) => {
let res = await apiManageCompanyDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open()
detailRef.value?.setFormData(res)
}
getLists() getLists()
</script> </script>

View File

@ -0,0 +1,118 @@
const detailConfig = {
title: "项目管理--项目信息",
config: [
{
label: "项目名称",
value: "project_name"
},
{
label: "性质",
value: "nature"
},
{
label: "行业",
value: "industry"
},
{
label: "建设单位",
value: "build_unit"
},
{
label: "建设区域",
value: "build_area"
},
{
label: "项目地址",
value: "address"
},
{
label: "项目级别",
value: "project_level"
},
{
label: "总投资(万元)",
value: "total_investment"
},
{
label: "工程状态",
value: "engineering_status"
},
{
label: "合同服务内容",
value: "contract_content"
},
{
label: "项目概况",
value: "project_overview"
},
{
label: "项目要求",
value: "project_requirements"
},
{
label: "计划开工日期",
value: "planned_start_date"
},
{
label: "计划竣工日期",
value: "planned_end_date"
}, {
label: "实际开工日期",
value: "actual_start_date"
}, {
label: "实际竣工日期",
value: "actual_end_date"
}, {
label: "实施部门",
value: "implementation_department"
},
{
label: "监管部门",
value: "supervision_department",
},
{
label: "项目经理",
value: "project_manager"
},
{
label: "立项日期",
value: "initiation_date"
},
{
label: "项目负责人",
value: "project_leader"
},
{
label: "项目部",
value: "project_department"
},
{
label: "关联合同",
value: "contract"
},
{
label: "甲方单位",
value: "part_a_unit"
},
{
label: "创建人",
value: "create_user"
},
{
label: "创建时间",
value: "create_time"
},
{
label: "备注",
value: "remark",
column: 1
},
{
label: "附件",
value: "annex",
column: 1
},
]
}
export default detailConfig;

View File

@ -208,14 +208,6 @@ const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>() const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add') const mode = ref('add')
const handleAvatarSuccess_four = (response: any) => {
formData.annex ||= []
// @ts-ignore
response.code != 0 ? formData.annex.push({ uri: response.data.uri, name: response.data.name }) : ElMessage.error(response.msg);
};
//
const delFileFn = (index: number) => { formData.annex.splice(index, 1) }
// //

View File

@ -101,6 +101,10 @@
@click="handleDelete(row.id)"> @click="handleDelete(row.id)">
删除 删除
</el-button> </el-button>
<el-button v-perms="['manage_basic.manage_project/detail']" type="danger" link
@click="handleDetail(row.id)">
详情
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -110,6 +114,8 @@
</div> </div>
</el-card> </el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<detailPage v-if="showDetail" ref="detailRef" @close="showEdit = false" :detailConfig="detailConfig" />
</div> </div>
</template> </template>
@ -117,13 +123,15 @@
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { apiManageProjectLists, apiManageProjectDelete, apiManageProjectDetail } from '@/api/manage_project' import { apiManageProjectLists, apiManageProjectDelete, apiManageProjectDetail } from '@/api/manage_project'
import { timeFormat } from '@/utils/util' import detailConfig from './detail'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './edit.vue' import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>() const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const detailRef = ref('')
// //
const showEdit = ref(false) const showEdit = ref(false)
const showDetail = ref(false)
// //
@ -177,5 +185,15 @@ const handleDelete = async (id: number | any[]) => {
getLists() getLists()
} }
//
const handleDetail = async (id: any) => {
let res = await apiManageProjectDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open()
detailRef.value?.setFormData(res)
}
getLists() getLists()
</script> </script>

View File

@ -71,7 +71,8 @@ const detailConfig = {
}, },
{ {
label: "备注", label: "备注",
value: "remark" value: "remark",
column: 1
}, },
{ {
label: "监管部门", label: "监管部门",
@ -105,7 +106,11 @@ const detailConfig = {
label: "创建时间", label: "创建时间",
value: "create_time" value: "create_time"
}, },
{
label: "附件",
value: "annex",
column: 1
},
] ]
} }