From d29d649933262e7e7f85763c1637d3825e432828 Mon Sep 17 00:00:00 2001 From: TimSpan <cat20201314@163.com> Date: Thu, 28 Nov 2024 14:50:55 +0800 Subject: [PATCH 01/10] Update publicUnit.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 小修改 按钮颜色 --- .../src/views/query/publicUnit.vue | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index 71f5794..9ad450f 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -1,7 +1,5 @@ <template> <div> - <!-- expand-column-widt 展开按钮宽度--> - <!-- :expandRowByClick="true" 点击行展开 --> <TableProMax :expandedRowRender="expandedRowRender" :expand-column-width="50" @@ -17,9 +15,6 @@ <a-button type="primary" @click="saveOrUpdateEnterprisesUnit">新增企事业单位</a-button> </a-space> </template> - <!-- <template #expandedRowRender="{ record }"> - <p>{{ record }}</p> - </template> --> </TableProMax> <a-modal v-model:open="visible" :title="serviceTitle" @ok="submit" @cancel="closeModal"> <FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions" /> @@ -179,8 +174,6 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { initMarker(_mapRef.value?.mapInstance) }} onSearch={debounce((val: string) => { - console.log('onSearch___________________', val) - //@ts-ignore const auto = new AMap.AutoComplete({ city: city, @@ -188,7 +181,6 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { citylimit: true, }) auto.search(val, (status, result) => { - console.log('🚀 ~ auto.search ~ status, result:', status, result) if (status === 'complete') { // 生成组件需要数据 autoAddress.value = result.tips?.map((e) => { @@ -480,8 +472,6 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null) const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => { - console.log('🚀 ~ record:', record) - const _columns: _TableProps['columns'] = [ { dataIndex: 'name', @@ -567,18 +557,12 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => return ( <a-space> <a-button - type='primary' + class='btn-warn' onClick={async () => { - console.log('🚀 ~ customRender ~ record:编辑回显参数', record) visible.value = true serviceTitle.value = '编辑服务项目' idNumberDisabled.value = record.twoType.value !== 'outsource' - { - /* */ - } - formParams.value.securityUnitId = record.securityUnitId //企事业单位id - formParams.value.enterprisesUnitId = record.enterprisesUnitId //企事业单位id formParams.value.snowFlakeId = record.snowFlakeId //id formParams.value.projectManagerMiniProgramUserId = record.projectManagerMiniProgramUserId //项目经理小程序用户id @@ -594,10 +578,6 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => formParams.value.houseTotal = record.houseTotal //户数 formParams.value.staffTotal = record.staffTotal //工作人员数量 formParams.value.securityUserTotal = record.securityUserTotal //保安人员数量 - - { - /* formParams.value.administrativeDivisionCodes = record.enterprisesUnitAdministrativeDivisionCodes */ - } }} > 编辑 @@ -619,8 +599,7 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => }, }, ] - const _reqApi: _TableProps['requestApi'] = async (params) => { - console.log('🚀 ~ params:', params) + const _reqApi: _TableProps['requestApi'] = async () => { // @ts-ignore return await api.get('/m2/eu/listSp', { enterprisesUnitId: record?.snowFlakeId }) } @@ -635,7 +614,7 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => tableHeader: (_) => { return ( <Space> - <Button class='btn-success' onClick={() => addService(record)}> + <Button type={'primary'} onClick={() => addService(record)}> 新增服务项目 </Button> </Space> @@ -669,12 +648,8 @@ const closeModal = async () => { } const submit = async () => { - console.log('formParams.value____________________', formParams.value) - await formRef.value.validate() - const serviceProjectSaveOrUpdateParams = { ...formParams.value } - const resp = await api.post('/m2/eu/add_upd_sp', serviceProjectSaveOrUpdateParams) message.success(resp.message) await _tableRef.value.requestGetTableData() @@ -686,7 +661,6 @@ onMounted(async () => { securityUnitIdList.value = res.data }) const addService = function (record) { - console.log('🚀 ~ addService ~ record:', record) formParams.value.enterprisesUnitId = record.snowFlakeId //企事业单位Id visible.value = true } From f5f9212a88212b3a40ba6bacbb5da177d59c832a Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Thu, 28 Nov 2024 16:00:50 +0800 Subject: [PATCH 02/10] =?UTF-8?q?feat(module):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=85=AC=E5=AE=89=E5=90=8E=E5=8F=B0=E4=BC=81=E4=BA=8B=E4=B8=9A?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增企事业单位下服务项目列表接口 - 实现服务项目新增、编辑和删除功能 - 添加保安人员新增、编辑和删除功能 -集成保安协会接口,实现身份证查询保安证功能 - 优化单位和用户选择接口 --- .../common/pojo/vo/CreateOrUpdateUser.java | 4 + .../changhu/controller/CommonController.java | 7 ++ .../controller/ManagementController.java | 23 +++++- .../controller/UserController.java | 18 ++--- ...va => SecurityUserSaveOrUpdateParams.java} | 8 +- .../miniProgram/service/UserService.java | 16 ++-- .../service/impl/UserServiceImpl.java | 38 ++++----- .../controller/EnterprisesUnitController.java | 79 ++++++++++++++++++ .../mapper/PoliceEnterprisesUnitMapper.java | 22 +++++ .../ServiceProjectSaveOrUpdateParams.java | 68 ++++++++++++++++ .../pojo/vo/ServiceProjectListVo.java | 63 +++++++++++++++ .../service/PoliceEnterprisesUnitService.java | 46 +++++++++++ .../PoliceEnterprisesUnitServiceImpl.java | 63 +++++++++++++++ .../com/changhu/pojo/entity/SecurityUser.java | 10 +++ .../com/changhu/service/CommonService.java | 6 ++ .../changhu/service/ManagementService.java | 13 +++ .../service/impl/CommonServiceImpl.java | 10 +++ .../service/impl/ManagementServiceImpl.java | 48 +++++++++++ .../json/CreateOrUpdateUserTypeHandler.java | 34 ++++++++ ...SecurityAssociationDockingServiceTask.java | 81 +++++++++++++++++++ .../PoliceEnterprisesUnitMapper.xml | 17 ++++ 21 files changed, 631 insertions(+), 43 deletions(-) rename policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/{SaveOrUpdateSecurityUserParams.java => SecurityUserSaveOrUpdateParams.java} (89%) create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/policeManagement/controller/EnterprisesUnitController.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/policeManagement/mapper/PoliceEnterprisesUnitMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/params/ServiceProjectSaveOrUpdateParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/vo/ServiceProjectListVo.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/PoliceEnterprisesUnitService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/impl/PoliceEnterprisesUnitServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/json/CreateOrUpdateUserTypeHandler.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java create mode 100644 policeSecurityServer/src/main/resources/mapper/policeManagement/PoliceEnterprisesUnitMapper.xml diff --git a/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/CreateOrUpdateUser.java b/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/CreateOrUpdateUser.java index e6dd8fe..5780d34 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/CreateOrUpdateUser.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/pojo/vo/CreateOrUpdateUser.java @@ -17,4 +17,8 @@ public class CreateOrUpdateUser { private String name; @Schema(description = "用户类型") private UserType type; + @Schema(description = "单位id") + private Long unitId; + @Schema(description = "单位名字") + private String unitName; } diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java index 8523678..a070440 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/CommonController.java @@ -1,5 +1,6 @@ package com.changhu.controller; +import com.alibaba.fastjson2.JSONObject; import com.changhu.common.annotation.IsWhiteList; import com.changhu.common.annotation.JsonBody; import com.changhu.common.cache.GlobalCacheManager; @@ -94,4 +95,10 @@ public class CommonController { return enumsResult; } + @Operation(summary = "根据身份证查询保安证") + @GetMapping("/querySecurityNumberByIdCard") + public JSONObject querySecurityNumberByIdCard(@RequestParam @Schema(description = "身份证") String idCard) { + return commonService.querySecurityNumberByIdCard(idCard); + } + } diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/ManagementController.java b/policeSecurityServer/src/main/java/com/changhu/controller/ManagementController.java index 12e9ad6..857b65f 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/ManagementController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/ManagementController.java @@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.IsWhiteList; import com.changhu.common.annotation.JsonBody; +import com.changhu.common.db.enums.MiniProgramUserIdentity; import com.changhu.common.db.enums.UserType; +import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.params.CheckStatusParams; import com.changhu.pojo.params.UnitDisableOrEnableParams; import com.changhu.pojo.vo.UnitCheckStatusVo; @@ -13,13 +15,13 @@ import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo; import com.changhu.service.ManagementService; import com.changhu.support.mybatisplus.pojo.params.PageParams; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * @author 20252 @@ -61,4 +63,17 @@ public class ManagementController { public void disableOrEnableMiniProgramUser(@RequestBody @Valid UnitDisableOrEnableParams params) { managementService.disableOrEnableMiniProgramUser(params); } + + @Operation(summary = "所有的保安单位列表") + @GetMapping("/listSecurityUnit") + public List<SelectNodeVo<Long>> listSecurityUnit() { + return managementService.listSecurityUnit(); + } + + @Operation(summary = "保安单位下的项目经理") + @GetMapping("/listMinUserByUnitId") + public List<SelectNodeVo<Long>> listMinUserByUnitId(@RequestParam @Schema(description = "保安单位id") Long securityUnitId, + @RequestParam @Schema(description = "身份类型") MiniProgramUserIdentity identity) { + return managementService.listMinUserByUnitId(securityUnitId, identity); + } } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/UserController.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/UserController.java index 92263cf..a97500a 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/UserController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/UserController.java @@ -3,7 +3,7 @@ package com.changhu.module.miniProgram.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.changhu.common.annotation.IsWhiteList; import com.changhu.common.annotation.JsonBody; -import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; +import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams; import com.changhu.module.miniProgram.pojo.params.UserRegisterParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; @@ -39,20 +39,14 @@ public class UserController { @Operation(summary = "保存或更新保安人员") @PostMapping("/add_security_user_upd") - public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) { + public void saveOrUpdateSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) { userService.saveOrUpdateSecurityUser(params); } - @Operation(summary = "根据id删除保安人员") - @DeleteMapping("/del_security_user_id") - public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) { - userService.deleteSecurityUserByServiceProjectId(securityUserId); - } - @Operation(summary = "二维码表单录入保安人员") @PostMapping("/qrCodeFormInputSecurityUser") @IsWhiteList - public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) { + public void qrCodeFormInputSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) { userService.qrCodeFormInputSecurityUser(params); } @@ -61,4 +55,10 @@ public class UserController { public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) { return userService.securityUserPager(queryParams); } + + @Operation(summary = "根据id删除保安人员") + @DeleteMapping("/del_security_user_id") + public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) { + userService.deleteSecurityUserById(securityUserId); + } } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/SaveOrUpdateSecurityUserParams.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/SecurityUserSaveOrUpdateParams.java similarity index 89% rename from policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/SaveOrUpdateSecurityUserParams.java rename to policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/SecurityUserSaveOrUpdateParams.java index 0b4dc16..3969f4a 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/SaveOrUpdateSecurityUserParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/params/SecurityUserSaveOrUpdateParams.java @@ -15,7 +15,7 @@ import lombok.Data; * @desc SaveOrUpdateSecurityUserParams... */ @Data -public class SaveOrUpdateSecurityUserParams { +public class SecurityUserSaveOrUpdateParams { @Schema(description = "id") private Long snowFlakeId; @@ -27,6 +27,9 @@ public class SaveOrUpdateSecurityUserParams { @Schema(description = "保安单位id") private Long securityUnitId; + @Schema(description = "照片") + private String photo; + @NotBlank(message = "名字不能为空") @Schema(description = "名称") private String name; @@ -57,6 +60,9 @@ public class SaveOrUpdateSecurityUserParams { @Schema(description = "保安证号") private String securityNumber; + @Schema(description = "无证说明") + private String noSecurityNumberDesc; + @Schema(description = "家庭住址") private String homeAddress; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/UserService.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/UserService.java index e5a2080..dcf084e 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/UserService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/UserService.java @@ -1,7 +1,7 @@ package com.changhu.module.miniProgram.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; +import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams; import com.changhu.module.miniProgram.pojo.params.UserRegisterParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; @@ -25,14 +25,14 @@ public interface UserService { * * @param params 保安人员参数 */ - void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params); + void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params); /** - * 根据id删除保安人员 + * 二维码表单录入保安人员 * - * @param securityUserId 保安人员id + * @param params 参数 */ - void deleteSecurityUserByServiceProjectId(Long securityUserId); + void qrCodeFormInputSecurityUser(SecurityUserSaveOrUpdateParams params); /** * 服务项目内的保安人员分页 @@ -43,9 +43,9 @@ public interface UserService { Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams); /** - * 二维码表单录入保安人员 + * 根据id删除保安人员 * - * @param params 参数 + * @param securityUserId 保安人员id */ - void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params); + void deleteSecurityUserById(Long securityUserId); } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/UserServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/UserServiceImpl.java index 2b719bb..b40f924 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/UserServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/UserServiceImpl.java @@ -3,12 +3,14 @@ package com.changhu.module.miniProgram.service.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; import com.changhu.common.utils.SnowFlakeIdUtil; import com.changhu.mapper.SecurityUserMapper; -import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; +import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams; import com.changhu.module.miniProgram.pojo.params.UserRegisterParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; @@ -56,17 +58,7 @@ public class UserServiceImpl implements UserService { } @Override - public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) { - return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams()); - } - - @Override - public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) { - this.saveOrUpdateSecurityUser(params); - } - - @Override - public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) { + public void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params) { SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class); //新增的情况 Long snowFlakeId = securityUser.getSnowFlakeId(); @@ -92,17 +84,21 @@ public class UserServiceImpl implements UserService { } } } - boolean b = Db.saveOrUpdate(securityUser); - if (!b) { - throw new MessageException(); - } + Assert.isTrue(Db.saveOrUpdate(securityUser), ResultCode.ERROR.getMessage()); } @Override - public void deleteSecurityUserByServiceProjectId(Long securityUserId) { - boolean b = Db.removeById(securityUserId, SecurityUser.class); - if (!b) { - throw new MessageException(); - } + public void qrCodeFormInputSecurityUser(SecurityUserSaveOrUpdateParams params) { + this.saveOrUpdateSecurityUser(params); + } + + @Override + public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) { + return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams()); + } + + @Override + public void deleteSecurityUserById(Long securityUserId) { + Assert.isTrue(Db.removeById(securityUserId, SecurityUser.class), ResultCode.ERROR.getMessage()); } } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/controller/EnterprisesUnitController.java b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/controller/EnterprisesUnitController.java new file mode 100644 index 0000000..19b2b0c --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/controller/EnterprisesUnitController.java @@ -0,0 +1,79 @@ +package com.changhu.module.policeManagement.controller; + +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.annotation.CheckUserType; +import com.changhu.common.annotation.JsonBody; +import com.changhu.common.db.enums.UserType; +import com.changhu.common.enums.ResultCode; +import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams; +import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; +import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; +import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams; +import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo; +import com.changhu.module.policeManagement.service.PoliceEnterprisesUnitService; +import com.changhu.pojo.entity.ServiceProject; +import com.changhu.support.mybatisplus.pojo.params.PageParams; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/27 下午2:37 + * @desc EnterprisesUnitController... + */ +@Tag(name = "公安后台-企事业单位") +@JsonBody +@RequestMapping("/m2/eu") +@RestController("policeManagementEnterprisesUnit") +@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE) +public class EnterprisesUnitController { + + @Autowired + private PoliceEnterprisesUnitService policeEnterprisesUnitService; + + @Operation(summary = "事业单位下服务项目列表") + @GetMapping("/listSp") + public List<ServiceProjectListVo> listSp(@RequestParam @Schema(description = "事业单位id") Long enterprisesUnitId) { + return policeEnterprisesUnitService.listSp(enterprisesUnitId); + } + + @Operation(summary = "新增或保存服务项目") + @PostMapping("/add_upd_sp") + public void saveOrUpdateSp(@RequestBody @Valid ServiceProjectSaveOrUpdateParams params) { + policeEnterprisesUnitService.saveOrUpdateSp(params); + } + + @Operation(summary = "根据id删除服务项目") + @DeleteMapping("/deleteSpById") + public void deleteSpById(@RequestParam Long serviceProjectId) { + Assert.isTrue(Db.removeById(serviceProjectId, ServiceProject.class), ResultCode.ERROR.getMessage()); + } + + @Operation(summary = "新增或修改保安人员") + @PostMapping("/add_upd_sec_user") + public void saveOrUpdateSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) { + policeEnterprisesUnitService.saveOrUpdateSecurityUser(params); + } + + @Operation(summary = "服务项目保安人员分页") + @PostMapping("/sec_user_pager") + public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) { + return policeEnterprisesUnitService.securityUserPager(queryParams); + } + + @Operation(summary = "根据id删除保安人员") + @DeleteMapping("/del_security_user_id") + public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) { + policeEnterprisesUnitService.deleteSecurityUserById(securityUserId); + } + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/mapper/PoliceEnterprisesUnitMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/mapper/PoliceEnterprisesUnitMapper.java new file mode 100644 index 0000000..1fc544e --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/mapper/PoliceEnterprisesUnitMapper.java @@ -0,0 +1,22 @@ +package com.changhu.module.policeManagement.mapper; + +import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/27 下午2:39 + * @desc PoliceEnterprisesUnitMapper... + */ +@Mapper +public interface PoliceEnterprisesUnitMapper { + + /** + * 事业单位下的服务项目 + */ + List<ServiceProjectListVo> listSp(@Param("unitId") Long unitId, + @Param("enterprisesUnitId") Long enterprisesUnitId); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/params/ServiceProjectSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/params/ServiceProjectSaveOrUpdateParams.java new file mode 100644 index 0000000..a381c70 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/params/ServiceProjectSaveOrUpdateParams.java @@ -0,0 +1,68 @@ +package com.changhu.module.policeManagement.pojo.params; + +import com.changhu.common.db.enums.IsOrNot; +import com.changhu.common.db.enums.ServiceProjectTwoType; +import com.changhu.common.db.enums.ServiceProjectType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/27 下午3:24 + * @desc ServiceProjectSaveOrUpdateParams... + */ +@Data +public class ServiceProjectSaveOrUpdateParams { + @Schema(description = "id") + private Long snowFlakeId; + + @Schema(description = "企事业单位id") + @NotNull(message = "企事业单位不能为空") + private Long enterprisesUnitId; + + @Schema(description = "保安单位id") + @NotNull(message = "保安单位不能为空") + private Long securityUnitId; + + @Schema(description = "项目经理小程序用户id") + private Long projectManagerMiniProgramUserId; + + @Schema(description = "名称") + @NotNull(message = "名称不能为空") + private String name; + + @Schema(description = "服务类型") + @NotNull(message = "服务类型不能为空") + private ServiceProjectType type; + + @Schema(description = "二级类型") + private ServiceProjectTwoType twoType; + + @Schema(description = "外包公司名称") + private String outsourceName; + + @Schema(description = "是否备案") + private IsOrNot isFiling; + + @Schema(description = "证件号(保安服务许可证/备案证)") + private String idNumber; + + @Schema(description = "服务区域面积") + private Double serviceArea; + + @Schema(description = "楼栋数量") + private Integer buildingTotal; + + @Schema(description = "户数") + private Integer houseTotal; + + @Schema(description = "工作人员数量") + private Integer staffTotal; + + @Schema(description = "保安人员数量") + private Integer securityUserTotal; + + @Schema(description = "备注") + private String remark; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/vo/ServiceProjectListVo.java b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/vo/ServiceProjectListVo.java new file mode 100644 index 0000000..569fcc4 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/pojo/vo/ServiceProjectListVo.java @@ -0,0 +1,63 @@ +package com.changhu.module.policeManagement.pojo.vo; + +import com.changhu.common.db.enums.IsOrNot; +import com.changhu.common.db.enums.ServiceProjectTwoType; +import com.changhu.common.db.enums.ServiceProjectType; +import com.changhu.common.pojo.vo.CreateOrUpdateUser; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author 20252 + * @createTime 2024/11/27 下午2:42 + * @desc ServiceProjectListVo... + */ +@Data +public class ServiceProjectListVo { + @Schema(description = "id") + private Long snowFlakeId; + + @Schema(description = "企事业单位id") + private Long enterprisesUnitId; + @Schema(description = "保安单位id") + private Long securityUnitId; + + @Schema(description = "项目经理小程序用户id") + private Long projectManagerMiniProgramUserId; + @Schema(description = "项目经理小程序用户名称") + private String projectManagerMiniProgramUserName; + + @Schema(description = "服务项目名称") + private String name; + + @Schema(description = "服务类型") + private ServiceProjectType type; + @Schema(description = "二级类型") + private ServiceProjectTwoType twoType; + @Schema(description = "外包公司名称") + private String outsourceName; + + @Schema(description = "是否备案") + private IsOrNot isFiling; + @Schema(description = "证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)") + private String idNumber; + + @Schema(description = "服务区域面积") + private Double serviceArea; + @Schema(description = "楼栋数量") + private Integer buildingTotal; + @Schema(description = "户数") + private Integer houseTotal; + @Schema(description = "工作人员数量") + private Integer staffTotal; + @Schema(description = "保安人员数量") + private Integer securityUserTotal; + @Schema(description = "备注") + private String remark; + @Schema(description = "创建人") + private CreateOrUpdateUser createUserInfo; + @Schema(description = "创建时间") + private LocalDateTime createTime; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/PoliceEnterprisesUnitService.java b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/PoliceEnterprisesUnitService.java new file mode 100644 index 0000000..f4434d7 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/PoliceEnterprisesUnitService.java @@ -0,0 +1,46 @@ +package com.changhu.module.policeManagement.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams; +import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; +import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; +import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams; +import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo; +import com.changhu.support.mybatisplus.pojo.params.PageParams; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/27 下午2:38 + * @desc PoliceEnterprisesUnitService... + */ +public interface PoliceEnterprisesUnitService { + /** + * 事业单位下服务项目列表 + * + * @param enterprisesUnitId 事业单位id + * @return 服务项目列表 + */ + List<ServiceProjectListVo> listSp(Long enterprisesUnitId); + + /** + * 新增或者保存服务项目 + */ + void saveOrUpdateSp(ServiceProjectSaveOrUpdateParams params); + + /** + * 保险人员新增或者保存 + */ + void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params); + + /** + * 服务项目下的保安人员分页 + */ + Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams); + + /** + * 根据保安人员id删除人员 + */ + void deleteSecurityUserById(Long securityUserId); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/impl/PoliceEnterprisesUnitServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/impl/PoliceEnterprisesUnitServiceImpl.java new file mode 100644 index 0000000..4e6e9f9 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/policeManagement/service/impl/PoliceEnterprisesUnitServiceImpl.java @@ -0,0 +1,63 @@ +package com.changhu.module.policeManagement.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.enums.ResultCode; +import com.changhu.common.utils.UserUtil; +import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams; +import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; +import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; +import com.changhu.module.miniProgram.service.UserService; +import com.changhu.module.policeManagement.mapper.PoliceEnterprisesUnitMapper; +import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams; +import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo; +import com.changhu.module.policeManagement.service.PoliceEnterprisesUnitService; +import com.changhu.pojo.entity.ServiceProject; +import com.changhu.support.mybatisplus.pojo.params.PageParams; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/27 下午2:38 + * @desc PoliceEnterprisesUnitServiceImpl... + */ +@Service +public class PoliceEnterprisesUnitServiceImpl implements PoliceEnterprisesUnitService { + + @Autowired + private PoliceEnterprisesUnitMapper policeEnterprisesUnitMapper; + + @Autowired + private UserService userService; + + @Override + public List<ServiceProjectListVo> listSp(Long enterprisesUnitId) { + return policeEnterprisesUnitMapper.listSp(UserUtil.getUnitId(), enterprisesUnitId); + } + + @Override + public void saveOrUpdateSp(ServiceProjectSaveOrUpdateParams params) { + ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class); + Assert.isTrue(Db.saveOrUpdate(serviceProject), ResultCode.ERROR.getMessage()); + } + + @Override + public void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params) { + userService.saveOrUpdateSecurityUser(params); + } + + @Override + public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) { + return userService.securityUserPager(queryParams); + } + + @Override + public void deleteSecurityUserById(Long securityUserId) { + userService.deleteSecurityUserById(securityUserId); + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/entity/SecurityUser.java b/policeSecurityServer/src/main/java/com/changhu/pojo/entity/SecurityUser.java index 6874347..9b64cfc 100644 --- a/policeSecurityServer/src/main/java/com/changhu/pojo/entity/SecurityUser.java +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/entity/SecurityUser.java @@ -39,6 +39,11 @@ public class SecurityUser extends BaseEntity implements Serializable { */ private Long serviceProjectId; + /** + * 本人照片 + */ + private String photo; + /** * 名称 */ @@ -79,6 +84,11 @@ public class SecurityUser extends BaseEntity implements Serializable { */ private String securityNumber; + /** + * 无证说明 + */ + private String noSecurityNumberDesc; + /** * 家庭住址 */ diff --git a/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java b/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java index 12dbb2d..2eea0d9 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/CommonService.java @@ -1,5 +1,6 @@ package com.changhu.service; +import com.alibaba.fastjson2.JSONObject; import com.changhu.common.pojo.model.JsonResult; import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.params.PoliceUnitRegisterParams; @@ -36,4 +37,9 @@ public interface CommonService { * @return 结果 */ List<SelectNodeVo<Long>> queryUnitListByIdentity(QueryUnitListByIdentityQueryParams queryParams); + + /** + * 根据身份证查询保安证 + */ + JSONObject querySecurityNumberByIdCard(String idCard); } diff --git a/policeSecurityServer/src/main/java/com/changhu/service/ManagementService.java b/policeSecurityServer/src/main/java/com/changhu/service/ManagementService.java index 44fce48..ec597e5 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/ManagementService.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/ManagementService.java @@ -1,6 +1,8 @@ package com.changhu.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.common.db.enums.MiniProgramUserIdentity; +import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.params.CheckStatusParams; import com.changhu.pojo.params.UnitDisableOrEnableParams; import com.changhu.pojo.vo.UnitCheckStatusVo; @@ -8,6 +10,8 @@ import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams; import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo; import com.changhu.support.mybatisplus.pojo.params.PageParams; +import java.util.List; + /** * @author 20252 * @createTime 2024/9/2 上午9:49 @@ -45,4 +49,13 @@ public interface ManagementService { */ void disableOrEnableMiniProgramUser(UnitDisableOrEnableParams params); + /** + * 所有保安单位列表 + */ + List<SelectNodeVo<Long>> listSecurityUnit(); + + /** + * 保安单位下的项目经理 + */ + List<SelectNodeVo<Long>> listMinUserByUnitId(Long securityUnitId, MiniProgramUserIdentity identity); } diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java index 1ed2b22..7600851 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/CommonServiceImpl.java @@ -1,6 +1,7 @@ package com.changhu.service.impl; import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.changhu.common.db.enums.CheckStatus; import com.changhu.common.db.enums.IsEnable; @@ -16,6 +17,7 @@ import com.changhu.pojo.params.PoliceUnitRegisterParams; import com.changhu.pojo.params.SecurityUnitRegisterParams; import com.changhu.pojo.queryParams.QueryUnitListByIdentityQueryParams; import com.changhu.service.CommonService; +import com.changhu.task.SecurityAssociationDockingServiceTask; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,6 +38,9 @@ public class CommonServiceImpl implements CommonService { @Autowired private PoliceUnitMapper policeUnitMapper; + @Autowired + private SecurityAssociationDockingServiceTask securityAssociationDockingServiceTask; + @Override public JsonResult<Void> securityUnitRegister(SecurityUnitRegisterParams params) { @@ -131,4 +136,9 @@ public class CommonServiceImpl implements CommonService { .toList(); }; } + + @Override + public JSONObject querySecurityNumberByIdCard(String idCard) { + return securityAssociationDockingServiceTask.querySecurityNumberByIdCard(idCard); + } } diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/ManagementServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/ManagementServiceImpl.java index a0c74a4..e56662e 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/ManagementServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/ManagementServiceImpl.java @@ -1,11 +1,18 @@ package com.changhu.service.impl; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.lang.func.LambdaUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.MiniProgramUserIdentity; import com.changhu.common.db.enums.UserType; import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.utils.UserUtil; import com.changhu.mapper.ManagementMapper; +import com.changhu.pojo.entity.MiniProgramUser; +import com.changhu.pojo.entity.SecurityUnit; import com.changhu.pojo.params.CheckStatusParams; import com.changhu.pojo.params.UnitDisableOrEnableParams; import com.changhu.pojo.vo.UnitCheckStatusVo; @@ -16,6 +23,8 @@ import com.changhu.support.mybatisplus.pojo.params.PageParams; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; +import java.util.List; + /** * @author 20252 * @createTime 2024/9/2 上午9:49 @@ -58,4 +67,43 @@ public class ManagementServiceImpl implements ManagementService { .getHandler() .disableOrEnableMiniProgramUser(params.getDataId()); } + + @Override + public List<SelectNodeVo<Long>> listSecurityUnit() { + String addressName = LambdaUtil.getFieldName(SecurityUnit::getAddress); + String legalPersonInfoName = LambdaUtil.getFieldName(SecurityUnit::getLegalPersonInfo); + return Db.lambdaQuery(SecurityUnit.class) + .eq(SecurityUnit::getIsEnable, IsEnable.TRUE) + .list() + .stream() + .map(unit -> SelectNodeVo.<Long>builder() + .value(unit.getSnowFlakeId()) + .label(unit.getName()) + .extData(Dict.of( + addressName, unit.getAddress(), + legalPersonInfoName, unit.getLegalPersonInfo())) + .build()) + .toList(); + } + + @Override + public List<SelectNodeVo<Long>> listMinUserByUnitId(Long securityUnitId, MiniProgramUserIdentity identity) { + String tel = LambdaUtil.getFieldName(MiniProgramUser::getTelephone); + String sex = LambdaUtil.getFieldName(MiniProgramUser::getSex); + return Db.lambdaQuery(MiniProgramUser.class) + .eq(MiniProgramUser::getIsEnable, IsEnable.TRUE) + .eq(MiniProgramUser::getIdentity, identity) + .eq(MiniProgramUser::getUnitId, securityUnitId) + .list() + .stream() + .map(item -> SelectNodeVo.<Long>builder() + .value(item.getSnowFlakeId()) + .label(item.getName()) + .extData(Dict.of( + tel, item.getTelephone(), + sex, item.getSex() + )) + .build()) + .toList(); + } } diff --git a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/json/CreateOrUpdateUserTypeHandler.java b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/json/CreateOrUpdateUserTypeHandler.java new file mode 100644 index 0000000..4511790 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/json/CreateOrUpdateUserTypeHandler.java @@ -0,0 +1,34 @@ +package com.changhu.support.mybatisplus.handler.global.json; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler; +import com.changhu.common.pojo.vo.CreateOrUpdateUser; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +/** + * @author 20252 + * @createTime 2024/11/27 下午3:09 + * @desc CreateOrUpdateUserTypeHandler... + */ +@MappedJdbcTypes(JdbcType.VARCHAR) +@MappedTypes({CreateOrUpdateUser.class}) +public class CreateOrUpdateUserTypeHandler extends AbstractJsonTypeHandler<CreateOrUpdateUser> { + public CreateOrUpdateUserTypeHandler(Class<?> type) { + super(type); + } + + @Override + public CreateOrUpdateUser parse(String json) { + if (!JSON.isValid(json)) { + return null; + } + return JSON.parseObject(json, CreateOrUpdateUser.class); + } + + @Override + public String toJson(CreateOrUpdateUser obj) { + return JSON.toJSONString(obj); + } +} \ No newline at end of file diff --git a/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java new file mode 100644 index 0000000..1235704 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java @@ -0,0 +1,81 @@ +package com.changhu.task; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import jakarta.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + + +/** + * @author 20252 + * @createTime 2024/11/27 下午4:59 + * @desc SecurityAssociationDockingServiceTask... + */ +@Slf4j +@Component +public class SecurityAssociationDockingServiceTask { + + private static final String BASE_HOST = "http://tkgl.3589hn.cn"; + + private static String TOKEN; + + /** + * 每小时续一次token + */ + @PostConstruct + @Scheduled(cron = "0 0 * * * *") + public void getToken() { + JSONObject params = new JSONObject(); + params.put("appid", "anfang"); + params.put("appkey", "fcfefda716dc4760af44973bcf157a01"); + //创建请求 + HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/get_token"); + //设置参数 + request.body(params.toJSONString()); + try (HttpResponse response = request.execute()) { + int status = response.getStatus(); + if (!(status == 200)) { + log.error("保安协会 获取token接口出错 status={} msg={}", status, response.body()); + return; + } + String body = response.body(); + log.info("getToken 接收到值:{}", body); + if (!JSON.isValid(body)) { + log.warn("返回数据不是json格式"); + return; + } + JSONObject jsonObject = JSON.parseObject(body); + JSONObject data = jsonObject.getJSONObject("data"); + TOKEN = data.getString("token"); + } + } + + public JSONObject querySecurityNumberByIdCard(String idCard) { + HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/query"); + //请求头参数 + request.form("token", TOKEN); + //请求体参数 + request.body(JSONObject.of("idcard", idCard).toJSONString()); + try (HttpResponse response = request.execute()) { + int status = response.getStatus(); + if (!(status == 200)) { + log.error("保安协会 身份证查保安证接口出错 status={} msg={}", status, response.body()); + return null; + } + String body = response.body(); + log.info("querySecurityNumberByIdCard 接收到返回值:{}", body); + if (!JSON.isValid(body)) { + log.warn("返回数据不是json格式"); + return null; + } + JSONObject jsonObject = JSON.parseObject(body); + return jsonObject.getJSONObject("data"); + } + } + +} diff --git a/policeSecurityServer/src/main/resources/mapper/policeManagement/PoliceEnterprisesUnitMapper.xml b/policeSecurityServer/src/main/resources/mapper/policeManagement/PoliceEnterprisesUnitMapper.xml new file mode 100644 index 0000000..6436cb8 --- /dev/null +++ b/policeSecurityServer/src/main/resources/mapper/policeManagement/PoliceEnterprisesUnitMapper.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="com.changhu.module.policeManagement.mapper.PoliceEnterprisesUnitMapper"> + <select id="listSp" resultType="com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo"> + select sp.*, + JSON_OBJECT('snowFlakeId', psu.snow_flake_id, 'name', psu.name, 'type', psu.type, 'unitId', psu.unitId, + 'unitName', psu.unitName) as 'createUserInfo' + from enterprises_unit eu + join service_project sp on eu.snow_flake_id = sp.enterprises_unit_id and sp.delete_flag = 0 + left join mini_program_user mpu on sp.project_manager_mini_program_user_id = mpu.snow_flake_id + left join police_security_users psu on sp.create_by = psu.snow_flake_id + where eu.delete_flag = 0 + and eu.snow_flake_id = #{enterprisesUnitId} + and eu.police_unit_id = #{unitId} + order by sp.create_time desc + </select> +</mapper> \ No newline at end of file From 2e210d5435025c55fc21c249c2d8fd2492a03bd9 Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Thu, 28 Nov 2024 17:12:52 +0800 Subject: [PATCH 03/10] =?UTF-8?q?feat(task):=20=E6=B7=BB=E5=8A=A0=20token?= =?UTF-8?q?=20=E7=BB=AD=E6=9C=9F=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 SecurityAssociationDockingServiceTask 类中,续期 token 后增加日志输出 - 通过 log.info 方法打印续期后的 token 信息 --- .../com/changhu/task/SecurityAssociationDockingServiceTask.java | 1 + 1 file changed, 1 insertion(+) diff --git a/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java index 1235704..ca7bd6c 100644 --- a/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java +++ b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java @@ -52,6 +52,7 @@ public class SecurityAssociationDockingServiceTask { JSONObject jsonObject = JSON.parseObject(body); JSONObject data = jsonObject.getJSONObject("data"); TOKEN = data.getString("token"); + log.info("续期后的 token:{}", TOKEN); } } From f88e3b9709a9915f3104ef2b48025b650637e23a Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Thu, 28 Nov 2024 17:22:57 +0800 Subject: [PATCH 04/10] =?UTF-8?q?refactor(task):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=20Security=20=E5=85=B3=E8=81=94=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -将 token 参数从请求头移至 URL 中 - 简化了请求构建过程,提高了代码可读性 --- .../changhu/task/SecurityAssociationDockingServiceTask.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java index ca7bd6c..05b797b 100644 --- a/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java +++ b/policeSecurityServer/src/main/java/com/changhu/task/SecurityAssociationDockingServiceTask.java @@ -57,9 +57,7 @@ public class SecurityAssociationDockingServiceTask { } public JSONObject querySecurityNumberByIdCard(String idCard) { - HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/query"); - //请求头参数 - request.form("token", TOKEN); + HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/query?token=" + TOKEN); //请求体参数 request.body(JSONObject.of("idcard", idCard).toJSONString()); try (HttpResponse response = request.execute()) { From 918b6b54684c215d264a0a387043d27592521909 Mon Sep 17 00:00:00 2001 From: TimSpan <cat20201314@163.com> Date: Fri, 29 Nov 2024 14:10:18 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E4=BA=BA=E5=91=98=20=E4=BA=BA=E5=91=98=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E5=A2=9E=E5=88=A0=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- collect_information/.env.development | 4 +- .../views/unitManage/police/policeUnit.ts | 50 +++ .../src/views/query/assessmentRecord.vue.bak | 148 --------- policeManagement/src/views/query/index.tsx | 311 ++++++++++++++++++ .../src/views/query/publicUnit.vue | 71 ++-- policeManagement/src/views/user/user.vue | 2 +- 6 files changed, 416 insertions(+), 170 deletions(-) delete mode 100644 policeManagement/src/views/query/assessmentRecord.vue.bak create mode 100644 policeManagement/src/views/query/index.tsx diff --git a/collect_information/.env.development b/collect_information/.env.development index 4e393f7..d7a068a 100644 --- a/collect_information/.env.development +++ b/collect_information/.env.development @@ -1,7 +1,7 @@ # 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config TARO_APP_ID="wx0acd1c4fcf94bdd3" -# TARO_APP_BASE_API="http://172.10.10.93:8765" -TARO_APP_BASE_API="https://www.hnjinglian.cn:5678" +TARO_APP_BASE_API="http://172.10.10.93:8765" +# TARO_APP_BASE_API="https://www.hnjinglian.cn:5678" diff --git a/policeManagement/src/types/views/unitManage/police/policeUnit.ts b/policeManagement/src/types/views/unitManage/police/policeUnit.ts index e444489..0804615 100644 --- a/policeManagement/src/types/views/unitManage/police/policeUnit.ts +++ b/policeManagement/src/types/views/unitManage/police/policeUnit.ts @@ -14,6 +14,8 @@ export interface PoliceUnitPagerQueryParams { } export interface PoliceUnitPagerVo extends BaseTableRowRecord { + + sex: { label: string } /** 名称 **/ name?: string; /** 代码 **/ @@ -53,6 +55,7 @@ export interface EnterprisesUnitPagerQueryParams { } export interface EnterprisesUnitPagerVo extends BaseTableRowRecord { + sex: { label: string } /** 名字 **/ name?: string; type: BaseEnum<string> @@ -86,9 +89,12 @@ export interface EnterprisesUnitPagerVo extends BaseTableRowRecord { remark?: string; } + + export interface EnterprisesUnitSaveOrUpdateParams { /** id **/ snowFlakeId?: string; + /** 公安单位id **/ policeUnitId: string; /** 名称 **/ @@ -108,3 +114,47 @@ export interface EnterprisesUnitSaveOrUpdateParams { /** 备注 **/ remark?: string; } + +export interface securityUnitIdListParams { + snowFlakeId?: string; + serviceProjectId?: string; + securityUnitId?: string; + name?: string; + remark?: string; + photo?: string; + telephone?: string; + workPost?: string; + sex?: string; + nativePlace?: string; + idCard?: string; + dateOfBirth?: string; + securityNumber?: string; + noSecurityNumberDesc?: string; + homeAddress?: string; +} +export interface securityUnitIdListPagerVo { + snowFlakeId?: string; + serviceProjectId?: string; + securityUnitId?: string; + name?: string; + remark?: string; + photo?: string; + telephone?: { + desensitizedValue?: string; + originalValue?: string; + }; + workPost?: string; + sex?: { + label?: string; + value: number | string + }; + nativePlace?: string; + idCard?: { + desensitizedValue?: string; + originalValue?: string; + }; + dateOfBirth?: string; + securityNumber?: string; + noSecurityNumberDesc?: string; + homeAddress?: string; +} diff --git a/policeManagement/src/views/query/assessmentRecord.vue.bak b/policeManagement/src/views/query/assessmentRecord.vue.bak deleted file mode 100644 index 3fc71eb..0000000 --- a/policeManagement/src/views/query/assessmentRecord.vue.bak +++ /dev/null @@ -1,148 +0,0 @@ -<template> - <div> - <TableProMax ref="tableRef" :request-api="reqApi" :columns="columns"> - </TableProMax> - <div> - <a-modal v-model:open="open" title="扣分项" @ok="open = false" width="80%"> - <a-table :columns="TableColumns" :data-source="dataSource" :pagination="false" bordered> - <template #bodyCell="{ column, record }"> - <template v-if="column.key === 'itemName'"> - <ul> - <li v-for="(item, index) in record.itemName" :key="index"> - {{ item.itemName }} - </li> - </ul> - </template> - <template v-if="column.key === 'deductionStandards'"> - <ul> - <li v-for="(item, index) in record.itemName" :key="index"> - <ul> - <li v-for="(standard, standardIndex) in item.standards" :key="standardIndex"> - {{ standard.standardName }} - </li> - </ul> - </li> - </ul> - </template> - </template> - </a-table> - </a-modal>> - </div> - </div> -</template> - -<script setup lang="tsx"> - -import TableProMax from "@/components/table/TableProMax.vue"; -import api from "@/axios"; -import {TableProMaxProps} from "@/types/components/table"; -import { - AssessmentRecordPagerQueryParams, - AssessmentRecordPagerVo, -} from "@/types/views/assessmentRecord.ts"; -import {ComponentExposed} from "vue-component-type-helpers"; -import {computed, ref} from "vue"; -import {Modal} from "ant-design-vue"; -const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!) -type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams> - -const open = ref<boolean>(false); -const reqApi: TableProps['requestApi'] = (params) => api.post('/assessmentRecord/pager', params) //分页 -const columns: TableProps['columns'] = [ - { - dataIndex: 'enterprisesUnitName', - title: '单位名称' - }, { - dataIndex: 'type', - title: '类型', - customRender: ({text}) => text?.label - }, { - dataIndex: 'ckProjectName', - title: '考核项目' - }, { - dataIndex: 'totalScore', - title: '总分' - }, { - dataIndex: 'deductionPointsTotal', - title: '扣分', - customRender:({record})=>{ - if (!record.deductionPointsTotal) { - return <a-tag color="green">0</a-tag> - } - return <a-tag class="pointer" color="red" onClick={()=>deductionPointsTotalTable(record)}>{record.deductionPointsTotal}</a-tag> - } - }, { - dataIndex: 'result', - title: '得分', - customRender: ({record}) => record.totalScore - record.deductionPointsTotal - }, { - dataIndex: 'policeUnitName', - title: '考核单位' - }, { - dataIndex: 'createUserName', - title: '考核人' - }, { - dataIndex: 'createTime', - title: '考核时间' - }, { - dataIndex: 'remark', - title: '考核备注' - }, { - dataIndex: 'signature', - title: '签字', - customRender:({record})=>{ - return <a-button onClick={()=>{ - Modal.info({ - title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`, - content: () => <> - <div>审核人签字: <a-image src={record.assessmentUserSignature}/> - </div> - <div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div> - </> - }) - }}>查看</a-button> - }, - } -] -const groupRow = ref({}) -const TableColumns = [ - { title: '考核分组', dataIndex: 'groupName', key: 'groupName' }, - { title: '考核项', dataIndex: 'itemName', key: 'itemName', slots: { customRender: 'bodyCell' } }, - { title: '扣分标准', dataIndex: 'deductionStandards', key: 'deductionStandards', slots: { customRender: 'bodyCell' } } -]; - -const dataSource = computed(() => { - return Object.keys(groupRow.value).map(groupName => ({ - key: groupName, - groupName: groupName, - itemName: Object.values(groupRow.value[groupName]) - })); -}); - - -const deductionPointsTotalTable =async(record:AssessmentRecordPagerVo)=>{ - const resp = await api.get('/assessmentRecord/deductedDetail',{assessmentRecordId:record.snowFlakeId}) - resp.data.forEach((item,index)=>{ - if (!groupRow.value[item.groupName]) { - groupRow.value[item.groupName] = {}; - } - if (!groupRow.value[item.groupName][item.ckItemId]) { - groupRow.value[item.groupName][item.ckItemId] = { - itemName: item.itemName, - standards: [] - }; - } - groupRow.value[item.groupName][item.ckItemId].standards.push(item); - }) - open.value = true - -} - - - - -</script> - -<style scoped lang="scss"> - -</style> \ No newline at end of file diff --git a/policeManagement/src/views/query/index.tsx b/policeManagement/src/views/query/index.tsx new file mode 100644 index 0000000..6178a6a --- /dev/null +++ b/policeManagement/src/views/query/index.tsx @@ -0,0 +1,311 @@ +import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table' +import { EnterprisesUnitPagerQueryParams, securityUnitIdListPagerVo, securityUnitIdListParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts' +import { reactive, ref } from 'vue' +import { FormExpose } from 'ant-design-vue/es/form/Form' +import { ComponentExposed } from 'vue-component-type-helpers' +import { FormProMaxItemOptions } from '@/types/components/form' +import { dictSelectNodes } from '@/config/dict.ts' +import { Button, message, Modal, Space, Tag } from 'ant-design-vue' +import api from '@/axios' +import TableProMax from '@/components/table/TableProMax.vue' +import { deleteDataModal } from '@/components/tsx/ModalPro.tsx' +import { PageParams } from '@/types/hooks/useTableProMax.ts' +import FormProMax from '@/components/form/FormProMax.vue' + +type _TableProps = TableProMaxProps<securityUnitIdListPagerVo, EnterprisesUnitPagerQueryParams> + +const _formParams = reactive<securityUnitIdListParams>({ + snowFlakeId: '', // + serviceProjectId: '', // 服务项目id + securityUnitId: '', // 保安单位id + name: '', // + photo: '', + telephone: '', + workPost: '', + sex: '', + nativePlace: '', + idCard: '', + dateOfBirth: '', + securityNumber: '', + noSecurityNumberDesc: '', + homeAddress: '', + remark: '', +}) +const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => { + console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params) + if (type === 'add') { + _formParams.serviceProjectId = params.snowFlakeId + _formParams.securityUnitId = params.securityUnitId + } else { + _formParams.snowFlakeId = params.snowFlakeId + _formParams.serviceProjectId = params.serviceProjectId + _formParams.securityUnitId = params.securityUnitId + _formParams.name = params.name + _formParams.photo = params?.photo + _formParams.telephone = params.telephone.originalValue + _formParams.workPost = params.workPost + _formParams.sex = params.sex.value + _formParams.nativePlace = params.nativePlace + _formParams.idCard = params.idCard.originalValue + _formParams.dateOfBirth = params.dateOfBirth + _formParams.securityNumber = params.securityNumber + _formParams.noSecurityNumberDesc = params?.noSecurityNumberDesc + _formParams.homeAddress = params.homeAddress + _formParams.remark = params.remark + } + + const _formRef = ref<FormExpose>(null) + + const _formOptions = ref<FormProMaxItemOptions<any>>({ + name: { + type: 'input', + label: '姓名', + required: true, + }, + idCard: { + type: 'input', + label: '身份证', + required: true, + }, + telephone: { + type: 'input', + label: '手机号', + required: true, + }, + sex: { + type: 'radioGroup', + label: '性别', + required: true, + options: [...dictSelectNodes('Sex')], + }, + securityNumber: { + type: 'input', + label: '保安证号', + required: true, + }, + dateOfBirth: { + type: 'datePicker', + label: '出生日期', + componentsProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + required: true, + }, + + workPost: { + type: 'input', + label: '工作岗位', + }, + nativePlace: { + type: 'input', + label: '籍贯', + }, + homeAddress: { + type: 'input', + label: '家庭住址', + }, + noSecurityNumberDesc: { + type: 'input', + label: '无证说明', + }, + + remark: { + type: 'inputTextArea', + label: '备注', + }, + }) + Modal.confirm({ + title: params.name ? `【${params.name}】 编辑保安信息` : '新增保安人员', + width: 600, + icon: ' ', + centered: true, + content: () => <FormProMax ref={_formRef} v-model:value={_formParams} formItemOptions={_formOptions.value} />, + onOk: async () => { + await _formRef.value?.validate() + + const resp = await api.post('/m2/eu/add_upd_sec_user', { + ..._formParams, + }) + message.success(resp.message) + callback && callback() + }, + onCancel: async () => { + console.log('onCancel') + + _formParams.snowFlakeId = '' + _formParams.serviceProjectId = '' + _formParams.securityUnitId = '' + _formParams.name = '' + _formParams.photo = '' + _formParams.telephone = '' + _formParams.workPost = '' + _formParams.sex = '' + _formParams.nativePlace = '' + _formParams.idCard = '' + _formParams.dateOfBirth = '' + _formParams.securityNumber = '' + _formParams.noSecurityNumberDesc = '' + _formParams.homeAddress = '' + _formParams.remark = '' + }, + }) +} +// record_ +export const showEnterprisesUnit = (record_) => { + console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_) + const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null) + const _columns: _TableProps['columns'] = [ + { + dataIndex: 'name', + title: '姓名', + width: 100, + ellipsis: true, + }, + + { + dataIndex: 'idCard', + title: '身份证', + customRender: ({ text }) => { + return text.desensitizedValue + }, + width: 160, + ellipsis: true, + }, + + { + dataIndex: 'sex', + title: '性别', + width: 60, + customRender: ({ record }) => { + return <Tag color={'success'}>{record.sex.label}</Tag> + }, + }, + { + dataIndex: 'dateOfBirth', + title: '出生日期', + width: 100, + ellipsis: true, + }, + { + dataIndex: 'telephone', + title: '手机号', + width: 120, + ellipsis: true, + customRender: ({ text }) => text?.originalValue, + }, + { + dataIndex: 'securityNumber', + title: '保安证号', + width: 120, + ellipsis: true, + }, + { + dataIndex: 'nativePlace', + title: '籍贯', + width: 120, + ellipsis: true, + }, + { + dataIndex: 'workPost', + title: '工作岗位', + width: 120, + ellipsis: true, + }, + + { + dataIndex: 'homeAddress', + title: '家庭住址', + width: 120, + ellipsis: true, + }, + { + dataIndex: 'remark', + title: '备注', + width: 120, + }, + { + dataIndex: 'createTime', + title: '创建时间', + width: 120, + ellipsis: true, + }, + + { + dataIndex: 'opt', + title: '操作', + width: 200, + fixed: 'right', + customRender: ({ record }) => ( + <Space> + <Button class='btn-warn' onClick={() => saveOrUpdateEnterprisesUnit(_tableRef.value?.requestGetTableData, record, 'edit')}> + 编辑 + </Button> + <Button + class='btn-danger' + onClick={() => + deleteDataModal(record.name, async () => { + const resp = await api.delete('/m2/eu/del_security_user_id', { + enterprisesUnitId: record.snowFlakeId, + }) + message.success(resp.message) + await _tableRef.value?.requestGetTableData() + }) + } + > + 删除 + </Button> + </Space> + ), + }, + ] + const x: number = _columns.reduce((a, b) => a + (b.width as number), 0) + const _reqApi: _TableProps['requestApi'] = (params) => { + // console.log(record_); + + ;(params as PageParams<EnterprisesUnitPagerQueryParams>).params.serviceProjectId = record_.snowFlakeId + return api.post('/m2/eu/sec_user_pager', params) + } + Modal.info({ + title: `【${record_.name}】 管理保安人员`, + width: '80%', + centered: true, + maskClosable: true, + content: () => ( + <TableProMax + scroll={{ x: x }} + ref={_tableRef} + size='small' + columns={_columns} + requestApi={_reqApi} + searchFormOptions={{ + name: { + type: 'input', + label: '姓名', + }, + securityNumber: { + type: 'input', + label: '保安证号', + }, + telephone: { + type: 'input', + label: '手机号', + }, + }} + v-slots={ + { + tableHeader: (_) => { + return ( + <Space> + <Button class='btn-success' onClick={() => saveOrUpdateEnterprisesUnit(_tableRef.value?.requestGetTableData, record_, 'add')}> + 新增 + </Button> + <Button disabled>导入</Button> + </Space> + ) + }, + } as TableProMaxSlots<PoliceUnitPagerVo> + } + /> + ), + }) +} diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index 9ad450f..11c4b15 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -1,6 +1,7 @@ <template> <div> <TableProMax + style="width: 100%" :expandedRowRender="expandedRowRender" :expand-column-width="50" :defaultExpandAllRows="false" @@ -39,6 +40,7 @@ import { publicUnitPagerQueryParams } from '@/types/views/publicUnit.ts' import { FormProMaxItemOptions } from '@/types/components/form//index.ts' import { FormExpose } from 'ant-design-vue/es/form/Form' import { serviceProjectSaveOrUpdateParams_ } from '@/types/views/serviceManagement' +import { showEnterprisesUnit } from './index.tsx' type _FormType = EnterprisesUnitSaveOrUpdateParams & { contactPersonInfoName?: string contactPersonInfoTelephone?: string @@ -476,16 +478,19 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => { dataIndex: 'name', title: '服务项目名称', + width: 120, }, { dataIndex: 'type', title: '服务类型', customRender: ({ text }) => <a-tag>{text?.label}</a-tag>, + width: 120, }, { dataIndex: 'twoType', title: '二级类型', customRender: ({ text }) => <a-tag>{text?.label}</a-tag>, + width: 120, }, { dataIndex: 'outsourceName', @@ -495,45 +500,63 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => return record.outsourceName } }, + width: 120, + ellipsis: true, }, { dataIndex: 'isFiling', title: '是否备案', customRender: ({ text }) => <a-tag>{text?.label}</a-tag>, + width: 120, }, { dataIndex: 'idNumber', title: '保安服务许可证', + width: 200, + ellipsis: true, }, { dataIndex: 'serviceArea', title: '服务区域面积', + width: 60, + ellipsis: true, }, { dataIndex: 'buildingTotal', title: '楼栋数量', + width: 60, + ellipsis: true, }, { dataIndex: 'houseTotal', title: '户数', + width: 60, + ellipsis: true, }, { dataIndex: 'staffTotal', title: '工作人员数量', + width: 60, + ellipsis: true, }, { dataIndex: 'securityUserTotal', title: '保安人员数量', + width: 60, + ellipsis: true, }, { dataIndex: 'remark', title: '备注', + width: 120, }, { dataIndex: 'createUserInfo', title: '创建人', + width: 200, + ellipsis: true, customRender: ({ record }) => { return ( <div> @@ -547,15 +570,20 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => { dataIndex: 'createTime', title: '创建时间', + width: 120, + ellipsis: true, }, { dataIndex: 'opt', title: '操作', fixed: 'right', - + width: 300, customRender({ record }) { return ( <a-space> + <a-button class='btn-success' onClick={() => showEnterprisesUnit(record)}> + 保安人员 + </a-button> <a-button class='btn-warn' onClick={async () => { @@ -599,29 +627,34 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => }, }, ] + // const x2: number = _columns.reduce((a, b) => a + (b.width as number), 0) const _reqApi: _TableProps['requestApi'] = async () => { // @ts-ignore return await api.get('/m2/eu/listSp', { enterprisesUnitId: record?.snowFlakeId }) } return ( - <TableProMax - ref={_tableRef} - size='small' - columns={_columns} - requestApi={_reqApi} - isPagination={false} - v-slots={{ - tableHeader: (_) => { - return ( - <Space> - <Button type={'primary'} onClick={() => addService(record)}> - 新增服务项目 - </Button> - </Space> - ) - }, - }} - /> + <div style={{ width: '100%' }}> + <TableProMax + style={{ width: '1500px' }} + scroll={{ x: '1500px' }} + ref={_tableRef} + size='small' + columns={_columns} + requestApi={_reqApi} + isPagination={false} + v-slots={{ + tableHeader: () => { + return ( + <Space> + <Button type={'primary'} onClick={() => addService(record)}> + 新增服务项目 + </Button> + </Space> + ) + }, + }} + /> + </div> ) } diff --git a/policeManagement/src/views/user/user.vue b/policeManagement/src/views/user/user.vue index c043684..c331651 100644 --- a/policeManagement/src/views/user/user.vue +++ b/policeManagement/src/views/user/user.vue @@ -29,7 +29,7 @@ import FormProMax from '@/components/form/FormProMax.vue' import { FormProMaxItemOptions } from '@/types/components/form' import { FormExpose } from 'ant-design-vue/es/form/Form' import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.ts' - +import { ComponentExposed } from 'vue-component-type-helpers' const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!) const formRef = ref<FormExpose>(null) type TableProps = TableProMaxProps<publicUnitPagerQueryParams> From 87c9c7b0536218a555212889dff49343d0d1cd24 Mon Sep 17 00:00:00 2001 From: TimSpan <cat20201314@163.com> Date: Fri, 29 Nov 2024 15:37:53 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=BF=9D=E5=AE=89?= =?UTF-8?q?=E8=AF=81=E4=BB=B6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- policeManagement/src/views/query/index.tsx | 53 ++++++++++++++----- .../src/views/query/publicUnit.vue | 4 +- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/policeManagement/src/views/query/index.tsx b/policeManagement/src/views/query/index.tsx index 6178a6a..43e5a76 100644 --- a/policeManagement/src/views/query/index.tsx +++ b/policeManagement/src/views/query/index.tsx @@ -1,17 +1,19 @@ import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table' import { EnterprisesUnitPagerQueryParams, securityUnitIdListPagerVo, securityUnitIdListParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts' -import { reactive, ref } from 'vue' +import { reactive, ref, h } from 'vue' import { FormExpose } from 'ant-design-vue/es/form/Form' import { ComponentExposed } from 'vue-component-type-helpers' import { FormProMaxItemOptions } from '@/types/components/form' import { dictSelectNodes } from '@/config/dict.ts' -import { Button, message, Modal, Space, Tag } from 'ant-design-vue' +import { Button, message, Modal, Space, Tag, Input } from 'ant-design-vue' import api from '@/axios' import TableProMax from '@/components/table/TableProMax.vue' import { deleteDataModal } from '@/components/tsx/ModalPro.tsx' import { PageParams } from '@/types/hooks/useTableProMax.ts' import FormProMax from '@/components/form/FormProMax.vue' - +import { debounce } from 'lodash-es' +import { SearchOutlined } from '@ant-design/icons-vue' +import axios from 'axios' type _TableProps = TableProMaxProps<securityUnitIdListPagerVo, EnterprisesUnitPagerQueryParams> const _formParams = reactive<securityUnitIdListParams>({ @@ -31,8 +33,29 @@ const _formParams = reactive<securityUnitIdListParams>({ homeAddress: '', remark: '', }) + +const searchSecurityUnitId = debounce(async () => { + if (process.env.NODE_ENV === 'development') { + console.log('process.env.NODE_ENV === development') + const res = await axios.get(`https://www.hnjinglian.cn:5678/common/querySecurityNumberByIdCard?idCard=${_formParams.idCard}`) + if (res.data?.data?.hasOwnProperty('bayzh')) { + _formParams.securityNumber = res.data.data.bayzh + message.success(res.data.message) + } else { + message.error('未查询到保安证件号') + } + } else { + const res = await api.get<any>('/common/querySecurityNumberByIdCard', { idCard: _formParams.idCard }) + if (res.data?.data?.hasOwnProperty('bayzh')) { + _formParams.securityNumber = res.data.data.bayzh + message.success(res.data.message) + } else { + message.error('未查询到保安证件号') + } + } +}, 300) const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => { - console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params) + // console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params) if (type === 'add') { _formParams.serviceProjectId = params.snowFlakeId _formParams.securityUnitId = params.securityUnitId @@ -56,17 +79,26 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) = const _formRef = ref<FormExpose>(null) - const _formOptions = ref<FormProMaxItemOptions<any>>({ + const _formOptions = ref<FormProMaxItemOptions<securityUnitIdListParams>>({ name: { type: 'input', label: '姓名', required: true, }, idCard: { - type: 'input', + type: 'custom', label: '身份证', required: true, + customRender: () => ( + <Space> + <Input allow-clear v-model:value={_formParams.idCard} placeholder={'请输入身份证号'} /> + <Button type={'primary'} icon={h(SearchOutlined)} onClick={() => searchSecurityUnitId()}> + 搜索保安证号 + </Button> + </Space> + ), }, + telephone: { type: 'input', label: '手机号', @@ -122,7 +154,6 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) = content: () => <FormProMax ref={_formRef} v-model:value={_formParams} formItemOptions={_formOptions.value} />, onOk: async () => { await _formRef.value?.validate() - const resp = await api.post('/m2/eu/add_upd_sec_user', { ..._formParams, }) @@ -130,8 +161,6 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) = callback && callback() }, onCancel: async () => { - console.log('onCancel') - _formParams.snowFlakeId = '' _formParams.serviceProjectId = '' _formParams.securityUnitId = '' @@ -150,9 +179,9 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) = }, }) } -// record_ + export const showEnterprisesUnit = (record_) => { - console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_) + // console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_) const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null) const _columns: _TableProps['columns'] = [ { @@ -245,7 +274,7 @@ export const showEnterprisesUnit = (record_) => { onClick={() => deleteDataModal(record.name, async () => { const resp = await api.delete('/m2/eu/del_security_user_id', { - enterprisesUnitId: record.snowFlakeId, + securityUserId: record?.securityUnitId, }) message.success(resp.message) await _tableRef.value?.requestGetTableData() diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index 11c4b15..1b50c6a 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -635,8 +635,8 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => return ( <div style={{ width: '100%' }}> <TableProMax - style={{ width: '1500px' }} - scroll={{ x: '1500px' }} + style={{ width: '1600px' }} + scroll={{ x: '1600px' }} ref={_tableRef} size='small' columns={_columns} From 59b58cf6f70dbba4e4612f5aae01a98b1a3cf622 Mon Sep 17 00:00:00 2001 From: TimSpan <cat20201314@163.com> Date: Fri, 29 Nov 2024 16:39:30 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?=E5=85=AC=E5=AE=89=E5=90=8E=E5=8F=B0=20=E4=BF=9D=E5=AE=89?= =?UTF-8?q?=E4=BA=BA=E5=91=98=20=E5=A4=B4=E5=83=8F=E4=B8=8A=E4=BC=A0=20?= =?UTF-8?q?=E5=BE=85=E5=A4=8D=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- policeManagement/.env.development | 6 +++++- policeManagement/.env.production | 6 +++++- policeManagement/components.d.ts | 1 + policeManagement/index.html | 17 ++++++++++------- .../components/upload/SingleImageFileUpload.vue | 5 +++-- policeManagement/src/views/query/index.tsx | 11 +++++++++-- 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/policeManagement/.env.development b/policeManagement/.env.development index 6b84780..ee79f73 100644 --- a/policeManagement/.env.development +++ b/policeManagement/.env.development @@ -21,4 +21,8 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R # 高德 lz VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 VITE_APP_GAODE_VERSION=2.0 -VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f \ No newline at end of file +VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f + +# minio +VITE_APP_MINIO_URL=http://118.253.177.137:9000 +VITE_APP_MINIO_BUCKET=police-security-dev \ No newline at end of file diff --git a/policeManagement/.env.production b/policeManagement/.env.production index 3d56736..1b3fd28 100644 --- a/policeManagement/.env.production +++ b/policeManagement/.env.production @@ -12,4 +12,8 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpu1C3JHZ+Ng/eVVCZ # 高德 VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 VITE_APP_GAODE_VERSION=2.0 -VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f \ No newline at end of file +VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f + +# minio +VITE_APP_MINIO_URL=https://www.hnjinglian.cn:9002 +VITE_APP_MINIO_BUCKET=police-security \ No newline at end of file diff --git a/policeManagement/components.d.ts b/policeManagement/components.d.ts index f757bec..2a4c0ca 100644 --- a/policeManagement/components.d.ts +++ b/policeManagement/components.d.ts @@ -34,6 +34,7 @@ declare module 'vue' { APagination: typeof import('ant-design-vue/es')['Pagination'] APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] APopover: typeof import('ant-design-vue/es')['Popover'] + AProgress: typeof import('ant-design-vue/es')['Progress'] ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup'] ARangePicker: typeof import('ant-design-vue/es')['RangePicker'] ARow: typeof import('ant-design-vue/es')['Row'] diff --git a/policeManagement/index.html b/policeManagement/index.html index d821b0d..99cdddc 100644 --- a/policeManagement/index.html +++ b/policeManagement/index.html @@ -1,15 +1,18 @@ <!doctype html> <html lang="en"> + <head> - <meta charset="UTF-8"/> - <link rel="icon" type="image/svg+xml" href="/vite.svg"/> - <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + <meta charset="UTF-8" /> + <link rel="icon" type="image/svg+xml" href="/vite.svg" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script type="module" src="/src/assets/iconfont/iconfont.js"></script> - <title>Vite + Vue + TS</title> + <title>公安后台</title> </head> + <body> -<div id="app"></div> -<script type="module" src="/src/main.ts"></script> + <div id="app"></div> + <script type="module" src="/src/main.ts"></script> </body> -</html> + +</html> \ No newline at end of file diff --git a/policeManagement/src/components/upload/SingleImageFileUpload.vue b/policeManagement/src/components/upload/SingleImageFileUpload.vue index da2f465..e15f0a6 100644 --- a/policeManagement/src/components/upload/SingleImageFileUpload.vue +++ b/policeManagement/src/components/upload/SingleImageFileUpload.vue @@ -1,8 +1,9 @@ <template> <div class="simpleUploadDiv"> <a-progress v-if="uploading" type="circle" :percent="percent" /> - <a-image height="80%" v-else :src="minioBaseUrl + modelValue" alt="avatar" /> - <a-button class="btn-success" @click="selectFile">{{ btnLabel }}</a-button> + <!-- height="80%" width="80%" --> + <a-image v-else :src="minioBaseUrl + modelValue" alt="avatar" /> + <a-button style="margin-top: 4px" class="btn-success" @click="selectFile">{{ btnLabel }}</a-button> <input id="myFileInput" type="file" style="display: none" /> </div> </template> diff --git a/policeManagement/src/views/query/index.tsx b/policeManagement/src/views/query/index.tsx index 43e5a76..2815e23 100644 --- a/policeManagement/src/views/query/index.tsx +++ b/policeManagement/src/views/query/index.tsx @@ -14,6 +14,7 @@ import FormProMax from '@/components/form/FormProMax.vue' import { debounce } from 'lodash-es' import { SearchOutlined } from '@ant-design/icons-vue' import axios from 'axios' +import SingleImageFileUpload from '@/components/upload/SingleImageFileUpload.vue' type _TableProps = TableProMaxProps<securityUnitIdListPagerVo, EnterprisesUnitPagerQueryParams> const _formParams = reactive<securityUnitIdListParams>({ @@ -78,8 +79,14 @@ const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) = } const _formRef = ref<FormExpose>(null) - + const uploadFileRef = ref(null) const _formOptions = ref<FormProMaxItemOptions<securityUnitIdListParams>>({ + photo: { + type: 'custom', + label: '头像', + customRender: () => <SingleImageFileUpload height={200} v-model:value={_formParams.photo} ref={uploadFileRef} />, + }, + name: { type: 'input', label: '姓名', @@ -274,7 +281,7 @@ export const showEnterprisesUnit = (record_) => { onClick={() => deleteDataModal(record.name, async () => { const resp = await api.delete('/m2/eu/del_security_user_id', { - securityUserId: record?.securityUnitId, + securityUserId: record?.snowFlakeId, }) message.success(resp.message) await _tableRef.value?.requestGetTableData() From edff88dd0c8388b85e5aa25174540fc9cacca8eb Mon Sep 17 00:00:00 2001 From: TimSpan <cat20201314@163.com> Date: Fri, 29 Nov 2024 17:09:34 +0800 Subject: [PATCH 08/10] Update publicUnit.vue --- .../src/views/query/publicUnit.vue | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index 1b50c6a..62cb0da 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -9,7 +9,7 @@ :request-api="reqApi" :columns="columns" :searchFormOptions="searchFormOptions" - :scroll="{ x }" + :scroll="{ x: x }" > <template #tableHeader> <a-space> @@ -53,6 +53,7 @@ const columns: TableProps['columns'] = [ { dataIndex: 'name', title: '单位名称', + width: 200, }, { @@ -61,11 +62,14 @@ const columns: TableProps['columns'] = [ customRender: ({ record }) => { return `${record?.provinceName}/${record?.cityName}/${record?.districtsName}/${record?.streetName}` }, + width: 300, }, { dataIndex: 'address', title: '详细地址', + width: 200, + ellipsis: true, }, { @@ -74,6 +78,7 @@ const columns: TableProps['columns'] = [ customRender: ({ record }) => { return record?.contactPersonInfo?.name }, + width: 200, }, { dataIndex: 'contactPersonInfo', @@ -81,16 +86,21 @@ const columns: TableProps['columns'] = [ customRender: ({ record }) => { return record?.contactPersonInfo?.telephone }, + width: 150, }, { dataIndex: 'createTime', title: '创建时间', + width: 120, + ellipsis: true, }, { dataIndex: 'remark', - title: '备注', + width: 120, + ellipsis: true, }, { + width: 200, dataIndex: 'opt', title: '操作', customRender: ({ record }) => ( @@ -136,7 +146,11 @@ const columns: TableProps['columns'] = [ ), }, ] -const x: number = columns.reduce((a, b) => a + (b.width as number), 0) +// const x: number = columns.reduce((a, b) => a + (b.width as number), 0) +const x: number = columns.reduce((a, b) => { + console.log('x_____________________', a, b, b.width) + return a + (b.width as number) +}, 0) const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { const _formRef = ref<FormExpose>(null) @@ -627,34 +641,31 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => }, }, ] - // const x2: number = _columns.reduce((a, b) => a + (b.width as number), 0) + const x2: number = _columns.reduce((a, b) => a + (b.width as number), 0) const _reqApi: _TableProps['requestApi'] = async () => { // @ts-ignore return await api.get('/m2/eu/listSp', { enterprisesUnitId: record?.snowFlakeId }) } return ( - <div style={{ width: '100%' }}> - <TableProMax - style={{ width: '1600px' }} - scroll={{ x: '1600px' }} - ref={_tableRef} - size='small' - columns={_columns} - requestApi={_reqApi} - isPagination={false} - v-slots={{ - tableHeader: () => { - return ( - <Space> - <Button type={'primary'} onClick={() => addService(record)}> - 新增服务项目 - </Button> - </Space> - ) - }, - }} - /> - </div> + <TableProMax + scroll={{ x: x2 }} + ref={_tableRef} + size='small' + columns={_columns} + requestApi={_reqApi} + isPagination={false} + v-slots={{ + tableHeader: () => { + return ( + <Space> + <Button type={'primary'} onClick={() => addService(record)}> + 新增服务项目 + </Button> + </Space> + ) + }, + }} + /> ) } From 74a97da1ff1df1043ca4f918ae63c99773276b0d Mon Sep 17 00:00:00 2001 From: TimSpan <cat20201314@163.com> Date: Fri, 29 Nov 2024 17:38:02 +0800 Subject: [PATCH 09/10] Update publicUnit.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复删除不刷新bug --- .../src/views/query/publicUnit.vue | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index 62cb0da..8d24796 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -304,7 +304,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { icon: ' ', centered: true, content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />, - onOk: async () => { + onOk: debounce(async () => { await _formRef.value?.validate() const resp = await api.post('/eu/add_upd', { @@ -318,7 +318,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { await tableRef.value?.requestGetTableData() callback && callback() - }, + }, 300), }) } @@ -486,7 +486,15 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara }, }) -const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null) +const _tableRef = ref(null) + +const deleteAccount = async (snowFlakeId) => { + const resp = await api.delete('/m2/eu/deleteSpById', { + serviceProjectId: snowFlakeId, + }) + message.success(resp.message) + await _tableRef.value?.requestGetTableData() +} const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => { const _columns: _TableProps['columns'] = [ { @@ -624,16 +632,7 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => > 编辑 </a-button> - <a-popconfirm - title='确认删除账号吗?' - onConfirm={async () => { - const resp = await api.delete('/m2/eu/deleteSpById', { - serviceProjectId: record.snowFlakeId, - }) - message.success(resp.message) - await _tableRef.value?.requestGetTableData() - }} - > + <a-popconfirm title='确认删除账号吗?' onConfirm={() => deleteAccount(record.snowFlakeId)}> <a-button danger>删除</a-button> </a-popconfirm> </a-space> From cdc1464f9cca6bb41ed11b96f82397df378579d7 Mon Sep 17 00:00:00 2001 From: TimSpan <cat20201314@163.com> Date: Mon, 2 Dec 2024 10:17:32 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E8=87=AA=E6=B5=8B=20=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- policeManagement/src/views/query/index.tsx | 29 +++++++++---------- .../src/views/query/publicUnit.vue | 8 ++++- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/policeManagement/src/views/query/index.tsx b/policeManagement/src/views/query/index.tsx index 2815e23..f5f8125 100644 --- a/policeManagement/src/views/query/index.tsx +++ b/policeManagement/src/views/query/index.tsx @@ -313,20 +313,20 @@ export const showEnterprisesUnit = (record_) => { size='small' columns={_columns} requestApi={_reqApi} - searchFormOptions={{ - name: { - type: 'input', - label: '姓名', - }, - securityNumber: { - type: 'input', - label: '保安证号', - }, - telephone: { - type: 'input', - label: '手机号', - }, - }} + // searchFormOptions={{ + // name: { + // type: 'input', + // label: '姓名', + // }, + // securityNumber: { + // type: 'input', + // label: '保安证号', + // }, + // telephone: { + // type: 'input', + // label: '手机号', + // }, + // }} v-slots={ { tableHeader: (_) => { @@ -335,7 +335,6 @@ export const showEnterprisesUnit = (record_) => { <Button class='btn-success' onClick={() => saveOrUpdateEnterprisesUnit(_tableRef.value?.requestGetTableData, record_, 'add')}> 新增 </Button> - <Button disabled>导入</Button> </Space> ) }, diff --git a/policeManagement/src/views/query/publicUnit.vue b/policeManagement/src/views/query/publicUnit.vue index 8d24796..24fce68 100644 --- a/policeManagement/src/views/query/publicUnit.vue +++ b/policeManagement/src/views/query/publicUnit.vue @@ -528,7 +528,13 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => { dataIndex: 'isFiling', title: '是否备案', - customRender: ({ text }) => <a-tag>{text?.label}</a-tag>, + customRender: ({ text }) => { + if (text?.label === '是') { + return <a-tag color={'success'}>{text?.label}</a-tag> + } else { + return <a-tag color={'error'}>{text?.label}</a-tag> + } + }, width: 120, }, {