This commit is contained in:
zmj 2024-03-23 14:54:49 +08:00
parent 3c5db877b6
commit 8da1402b3b
4 changed files with 59 additions and 163 deletions

View File

@ -0,0 +1,31 @@
const detailConfig = {
title: "项目成员详情",
config: [
{
label: "项目名称",
value: "project_name"
},
{
label: "项目编号",
value: "project_code"
},
{
label: "角色名称",
value: "project_role_name"
},
{
label: "人员名称",
value: "admin_name"
},
{
label: "人工单价",
value: "working_unit_price"
},
{
label: "备注",
value: "remark",
}
]
}
export default detailConfig;

View File

@ -1,140 +0,0 @@
<template>
<div class="detail-popup">
<popup ref="popupRef" title="项目成员详情" :async="true" width="80%" @confirm="handleSubmit" @close="handleClose">
<el-form ref="formRef" :model="formData" label-width="160px">
<el-card class="mb-2">
<el-row>
<el-col :span="12">
<el-form-item label="项目">
{{ formData.project_name }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目编码">
{{ formData.project_code }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="角色名称">
{{ formData.project_role_name
}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="人员名称">
{{ formData.admin_name
}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="人工单价">
{{ formData.working_unit_price }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注">
{{ formData.remark
}}
</el-form-item>
</el-col>
</el-row>
</el-card>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="customdetail">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCustomDetail } from '@/api/custom'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const datas = reactive({
provinceOptions: [],
cityOptions: [],
areaOptions: [],
});
//
const formData = reactive({
})
//
const setFormData = async (data: Record<any, any>) => {
Object.assign(formData, data)
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiCustomDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
popupRef.value?.close()
}
//
const open = () => {
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>
<style lang="scss" scoped>
.tit {
font-size: 1.2em;
margin-bottom: 10px;
}
:deep(.my-label) {
width: 150px;
}
</style>

View File

@ -6,8 +6,7 @@
<el-input class="w-[280px]" v-model="queryParams.project_name" clearable placeholder="请输入项目名称" />
</el-form-item>
<el-form-item label="角色名称" prop="project_role_name">
<el-input class="w-[280px]" v-model="queryParams.project_role_name" clearable
placeholder="请输入角色名称" />
<el-input class="w-[280px]" v-model="queryParams.project_role_name" clearable placeholder="请输入角色名称" />
</el-form-item>
<el-form-item label="人员名称" prop="admin_name">
<el-input class="w-[280px]" v-model="queryParams.admin_name" clearable placeholder="请输入人员名称" />
@ -37,16 +36,12 @@
<el-table-column type="selection" width="55" />
<el-table-column label="序号" type="index" width="55" />
<el-table-column label="项目名称" prop="project_name" show-overflow-tooltip />
<el-table-column label="项目编码" prop="project_code" show-overflow-tooltip />
<el-table-column label="角色名称" prop="project_role_name" show-overflow-tooltip />
<el-table-column label="人员" prop="admin_name" show-overflow-tooltip />
<el-table-column label="工时单价" prop="working_unit_price" show-overflow-tooltip />
<el-table-column label="备注" prop="remark" show-overflow-tooltip />
<el-table-column label="操作" width="150" fixed="right">
<template #default="{ row }">
<el-button v-perms="['project.project/edit']" type="primary" link @click="handleEdit(row)">
编辑
@ -55,10 +50,11 @@
@click="handleDelete(row.id)">
删除
</el-button>
<el-button v-perms="['project.project/detail']" link @click="handledetail(row)">
<el-button v-perms="['project.project/detail']" link @click="handleDetail(row.id)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
@ -68,7 +64,8 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<detail-popup v-if="showDtail" ref="detailRef" :dict-data="dictData" @close="showDtail = false" />
<detailPage v-if="showDetail" ref="detailRef" @close="showDetail = false" :detailConfig="detailConfig" :column="1"
width="550px" />
</div>
</template>
@ -81,13 +78,13 @@ import { getAllProjectTypes } from '@/api/projecttype'
const protype = reactive([])
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import DetailPopup from './detail.vue'
const detailRef = shallowRef<InstanceType<typeof DetailPopup>>()
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
import detailConfig from './detail'
//
const showEdit = ref(false)
const showDtail = ref(false)
const showDetail = ref(false)
//
const queryParams = reactive({
project_role_name: '',
@ -137,9 +134,10 @@ const handleDelete = async (id: number | any[]) => {
await apiProjectmemberDelete({ id })
getLists()
}
const handledetail = async (data: any) => {
let res = await apiProjectmemberDetail({ id: data.id })
showDtail.value = true
//
const handleDetail = async (id: any) => {
let res = await apiProjectmemberDetail({ id })
showDetail.value = true
await nextTick()
detailRef.value?.open()
detailRef.value?.setFormData(res)

View File

@ -4,16 +4,19 @@
<el-form ref="formRef" :model="formData" label-width="160px" :rules="formRules">
<el-row>
<el-col :span="8">
<el-form-item label="项目" prop="project_id" @click="showDialog = true" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
<el-form-item label="项目" prop="project_id" @click="showDialog = true"
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
<el-input v-model="project_name" readonly clearable placeholder="请选择项目" />
</el-form-item> </el-col>
<el-col :span="8">
<el-form-item label="项目编码" prop="project_id" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
<el-form-item label="项目编码" prop="project_id"
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
<el-input v-model="project_code" readonly clearable placeholder="请选择项目" />
</el-form-item> </el-col>
<el-col :span="8">
<el-form-item label="姓名" prop="name" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
<el-form-item label="姓名" prop="name"
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
<el-input v-model="formData.name" clearable placeholder="请输入姓名" />
</el-form-item> </el-col>
<el-col :span="8">
@ -29,16 +32,18 @@
<el-input v-model="formData.station" clearable placeholder="请输入岗位" />
</el-form-item> </el-col>
<el-col :span="24">
<el-form-item label="身份" prop="identity" :rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
<el-form-item label="身份" prop="identity"
:rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
<el-radio-group v-model="formData.identity" placeholder="请选择身份">
<el-radio v-for="(item, index) in dictData.identity" :key="index" :label="parseInt(item.value)">
<el-radio v-for="(item, index) in dictData.identity" :key="index"
:label="parseInt(item.value)">
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="电话" prop="phone" :rules="[{ required: true, validator: checkPhone, trigger: 'blur' }]">
<el-form-item label="电话" prop="phone">
<el-input v-model="formData.phone" clearable placeholder="请输入电话" />
</el-form-item> </el-col>
<el-col :span="8">
@ -49,7 +54,8 @@
<el-col :span="24">
<el-form-item label="对我方态度" prop="email">
<el-radio-group v-model="formData.attitude" placeholder="请选择对我方态度">
<el-radio v-for="(item, index) in dictData.attitude_status" :key="index" :label="parseInt(item.value)">
<el-radio v-for="(item, index) in dictData.attitude_status" :key="index"
:label="parseInt(item.value)">
{{ item.name }}
</el-radio>
</el-radio-group>
@ -58,14 +64,15 @@
<el-col :span="24">
<el-form-item label="工作配合度" prop="email">
<el-radio-group v-model="formData.degree_adaptability" placeholder="请选择工作配合度">
<el-radio v-for="(item, index) in dictData.degree_adaptability" :key="index" :label="parseInt(item.value)">
<el-radio v-for="(item, index) in dictData.degree_adaptability" :key="index"
:label="parseInt(item.value)">
{{ item.name }}
</el-radio>
</el-radio-group>
</el-form-item> </el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" clearable placeholder="请输入备注" />
<el-input v-model="formData.remark" clearable placeholder="请输入备注" type="textarea" />
</el-form-item> </el-col>
</el-row>