优化
This commit is contained in:
		| @ -42,17 +42,10 @@ | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table | ||||
|         v-loading="loading" | ||||
|         :data="machineryList" | ||||
|         @selection-change="handleSelectionChange" | ||||
|         :row-key="getRowKey" | ||||
|         :expand-row-keys="expandedRowKeys" | ||||
|         @expand-change="handleExpandChange" | ||||
|       > | ||||
|       <el-table v-loading="loading" :data="machineryList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="expand"> | ||||
|           <template #default=""> | ||||
|             <machinery-detail-table :machinery-id="expandedRowKeys[0]" /> | ||||
|           <template #default="{ row }"> | ||||
|             <machinery-detail-table :machinery-id="row.id" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
| @ -262,21 +255,6 @@ const handleExport = () => { | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| // 存储当前展开行的 key 数组(只允许一个展开) | ||||
| const expandedRowKeys = ref([]); | ||||
| // row-key 函数:返回每一行的唯一标识 | ||||
| const getRowKey = (row: any) => row.id; | ||||
| /** 展开选中数据 */ | ||||
| const handleExpandChange = async (selection: MachineryVO, expanded: any) => { | ||||
|   if (expanded) { | ||||
|     // 展开当前行时,将其他展开行关闭,只保留当前行 id | ||||
|     expandedRowKeys.value = [selection.id]; | ||||
|   } else { | ||||
|     // 收起当前行时,从 expandedRowKeys 中移除 | ||||
|     expandedRowKeys.value = expandedRowKeys.value.filter((key) => key !== selection.id); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| const dialogRef = ref(); | ||||
| const currentMachineryId = ref<number | string>(0); | ||||
| /** 添加机械出入场详情 */ | ||||
|  | ||||
| @ -44,17 +44,10 @@ | ||||
|         </el-row> | ||||
|       </template> | ||||
|  | ||||
|       <el-table | ||||
|         v-loading="loading" | ||||
|         :data="materialsList" | ||||
|         @selection-change="handleSelectionChange" | ||||
|         :row-key="getRowKey" | ||||
|         :expand-row-keys="expandedRowKeys" | ||||
|         @expand-change="handleExpandChange" | ||||
|       > | ||||
|       <el-table v-loading="loading" :data="materialsList" @selection-change="handleSelectionChange"> | ||||
|         <el-table-column type="expand"> | ||||
|           <template #default=""> | ||||
|             <materials-inventory-table :materials-id="expandedRowKeys[0]" :project-id="currentProject.id" /> | ||||
|           <template #default="{ row }"> | ||||
|             <materials-inventory-table :materials-id="row.id" :project-id="currentProject.id" /> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column type="selection" width="55" align="center" /> | ||||
| @ -268,21 +261,6 @@ const handleSelectionChange = (selection: MaterialsVO[]) => { | ||||
|   multiple.value = !selection.length; | ||||
| }; | ||||
|  | ||||
| // 存储当前展开行的 key 数组(只允许一个展开) | ||||
| const expandedRowKeys = ref([]); | ||||
| // row-key 函数:返回每一行的唯一标识 | ||||
| const getRowKey = (row: any) => row.id; | ||||
| /** 展开选中数据 */ | ||||
| const handleExpandChange = async (selection: MaterialsVO, expanded: any) => { | ||||
|   if (expanded) { | ||||
|     // 展开当前行时,将其他展开行关闭,只保留当前行 id | ||||
|     expandedRowKeys.value = [selection.id]; | ||||
|   } else { | ||||
|     // 收起当前行时,从 expandedRowKeys 中移除 | ||||
|     expandedRowKeys.value = expandedRowKeys.value.filter((key) => key !== selection.id); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| /** 新增按钮操作 */ | ||||
| const handleAdd = () => { | ||||
|   reset(); | ||||
|  | ||||
| @ -0,0 +1,87 @@ | ||||
| <template> | ||||
|   <div> | ||||
|     <el-descriptions v-loading="loading" title="用户信息" direction="vertical" border> | ||||
|       <el-descriptions-item :rowspan="3" :width="200" label="人脸照"> | ||||
|         <el-image :src="userDetail?.facePicUrl" style="width: 150px; height: 150px" /> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="姓名">{{ userDetail?.userName }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="联系电话">{{ userDetail?.phone }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="性别"> | ||||
|         <dict-tag :options="user_sex_type" :value="userDetail?.sex" /> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="年龄">{{ dayjs().diff(dayjs(userDetail?.sfzBirth), 'year') }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="民族">{{ userDetail?.nation }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="籍贯">{{ userDetail?.nativePlace }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="身份证号码">{{ userDetail?.sfzNumber }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="身份证有效期"> | ||||
|         {{ dayjs(userDetail?.sfzStart).format('YYYY 年 MM 月 DD 日') }} | ||||
|         —— {{ dayjs(userDetail?.sfzEnd).format('YYYY 年 MM 月 DD 日') }} | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="身份证地址">{{ userDetail?.sfzSite }}</el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|     <br /> | ||||
|     <el-descriptions v-loading="loading" title="银行卡" direction="vertical" border> | ||||
|       <el-descriptions-item label="银行卡号">{{ userDetail?.yhkNumber }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="银行开户行">{{ userDetail?.yhkOpeningBank }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="持卡人">{{ userDetail?.yhkCardholder }}</el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|     <br /> | ||||
|     <el-descriptions v-loading="loading" title="单位信息" direction="vertical" border> | ||||
|       <el-descriptions-item label="施工单位">{{ userDetail?.contractorVo?.name }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="工种"> | ||||
|         <dict-tag :options="type_of_work" :value="userDetail?.typeOfWork" /> | ||||
|       </el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|     <br /> | ||||
|     <el-descriptions :column="2" v-loading="loading" title="其他信息" direction="vertical" border> | ||||
|       <el-descriptions-item label="班组">{{ userDetail?.teamVo?.teamName }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="打卡状态"> | ||||
|         <dict-tag :options="user_clock_type" :value="userDetail?.clock" /> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="入场时间"> | ||||
|         {{ userDetail?.entryDate ? dayjs(userDetail?.entryDate).format('YYYY 年 MM 月 DD 日 HH:mm:ss') : '' }} | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="离场时间"> | ||||
|         {{ userDetail?.leaveDate ? dayjs(userDetail?.leaveDate).format('YYYY 年 MM 月 DD 日 HH:mm:ss') : '' }} | ||||
|       </el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup lang="ts"> | ||||
| import { getConstructionUser } from '@/api/project/constructionUser'; | ||||
| import { ConstructionUserVO } from '@/api/project/constructionUser/types'; | ||||
| import dayjs from 'dayjs'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { type_of_work, user_sex_type, user_clock_type } = toRefs<any>(proxy?.useDict('type_of_work', 'user_sex_type', 'user_clock_type')); | ||||
|  | ||||
| interface Props { | ||||
|   userId?: string | number; | ||||
| } | ||||
|  | ||||
| const props = defineProps<Props>(); | ||||
| const loading = ref<boolean>(false); | ||||
| const userDetail = ref<ConstructionUserVO>(); | ||||
| const getUserDetail = async () => { | ||||
|   loading.value = true; | ||||
|   const res = await getConstructionUser(props.userId); | ||||
|   if (res.data && res.code === 200) { | ||||
|     userDetail.value = res.data; | ||||
|   } | ||||
|   loading.value = false; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getUserDetail(); | ||||
| }); | ||||
|  | ||||
| watch( | ||||
|   () => props.userId, | ||||
|   (newId, oldId) => { | ||||
|     if (newId !== oldId) { | ||||
|       getUserDetail(); | ||||
|     } | ||||
|   } | ||||
| ); | ||||
| </script> | ||||
| @ -97,6 +97,9 @@ | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope"> | ||||
|             <el-space wrap> | ||||
|               <el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['project:constructionUser:query']"> | ||||
|                 详情 | ||||
|               </el-button> | ||||
|               <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:constructionUser:edit']"> | ||||
|                 修改 | ||||
|               </el-button> | ||||
| @ -190,6 +193,9 @@ | ||||
|         </div> | ||||
|       </template> | ||||
|     </el-dialog> | ||||
|     <el-drawer title="施工人员详情" v-model="showDetailDrawer" :size="'45%'"> | ||||
|       <construction-user-detail :user-id="currentUserId" /> | ||||
|     </el-drawer> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| @ -207,6 +213,7 @@ import { listContractor } from '@/api/project/contractor'; | ||||
| import { listProjectTeam } from '@/api/project/projectTeam'; | ||||
| import { ContractorVO } from '@/api/project/contractor/types'; | ||||
| import { ProjectTeamVO } from '@/api/project/projectTeam/types'; | ||||
| import ConstructionUserDetail from '@/views/project/constructionUser/component/ConstructionUserDetail.vue'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| const { type_of_work, user_sex_type, user_clock_type } = toRefs<any>(proxy?.useDict('type_of_work', 'user_sex_type', 'user_clock_type')); | ||||
| @ -407,6 +414,14 @@ const handleUpdate = async (row?: ConstructionUserVO) => { | ||||
|   dialog.title = '修改施工人员'; | ||||
| }; | ||||
|  | ||||
| /** 展开用户详情抽屉操作 */ | ||||
| const currentUserId = ref<string | number>(); | ||||
| const showDetailDrawer = ref<boolean>(false); | ||||
| const handleShowDrawer = (row?: ConstructionUserVO) => { | ||||
|   currentUserId.value = row.id; | ||||
|   showDetailDrawer.value = true; | ||||
| }; | ||||
|  | ||||
| /** 提交按钮 */ | ||||
| const submitForm = () => { | ||||
|   constructionUserFormRef.value?.validate(async (valid: boolean) => { | ||||
|  | ||||
| @ -51,7 +51,7 @@ | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||
|           <template #default="scope"> | ||||
|             <el-space wrap> | ||||
|               <el-button link type="primary" icon="Plus" @click="handleContractorFile(scope.row)">文件</el-button> | ||||
|               <el-button link type="primary" icon="View" @click="handleContractorFile(scope.row)">文件</el-button> | ||||
|               <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:contractor:edit']">修改 </el-button> | ||||
|               <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:contractor:remove']"> | ||||
|                 删除 | ||||
|  | ||||
| @ -68,9 +68,9 @@ | ||||
|         <el-table-column label="打卡范围" align="center" prop="punchRange" /> | ||||
|         <el-table-column label="设计总量" align="center" prop="designTotal" /> | ||||
|         <el-table-column label="备注" align="center" prop="remark" /> | ||||
|         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="260"> | ||||
|         <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="260"> | ||||
|           <template #default="scope"> | ||||
|             <el-space wrap> | ||||
|             <el-space> | ||||
|               <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:project:edit']">修改 </el-button> | ||||
|               <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:project:remove']">删除 </el-button> | ||||
|             </el-space> | ||||
|  | ||||
| @ -50,7 +50,7 @@ | ||||
|         </el-button> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <el-table v-loading="loading" :data="projectTeamMemberList" @selection-change="handleSelectionChange"> | ||||
|     <el-table size="small" v-loading="loading" :data="projectTeamMemberList" @selection-change="handleSelectionChange"> | ||||
|       <el-table-column type="selection" width="55" align="center" /> | ||||
|       <el-table-column label="序号" type="index" width="60" align="center" /> | ||||
|       <el-table-column label="施工人员" align="center" prop="memberName" /> | ||||
| @ -73,7 +73,14 @@ | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|     <pagination v-show="total > 0" :total="total" v-model:page="queryParams.current" v-model:limit="queryParams.pageSize" @pagination="getList" /> | ||||
|     <pagination | ||||
|       size="small" | ||||
|       v-show="total > 0" | ||||
|       :total="total" | ||||
|       v-model:page="queryParams.current" | ||||
|       v-model:limit="queryParams.pageSize" | ||||
|       @pagination="getList" | ||||
|     /> | ||||
|  | ||||
|     <!-- 添加或修改项目班组下的成员对话框 --> | ||||
|     <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> | ||||
| @ -82,7 +89,8 @@ | ||||
|           <el-select v-model="form.memberId" clearable placeholder="请选择人员"> | ||||
|             <el-option v-for="item in userNotInTeamOpt" :key="item.value" :label="item.label" :value="item.value" /> | ||||
|             <pagination | ||||
|               v-show="total > 0" | ||||
|               size="small" | ||||
|               v-show="userNotInTeamTotal > 0" | ||||
|               :total="userNotInTeamTotal" | ||||
|               v-model:page="userQueryParams.current" | ||||
|               v-model:limit="userQueryParams.pageSize" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user