Browse Source

fix:1、集访、领导接访导入优化;2、大屏展示数据优化,修复群众集访情况和追责问责情况不准确的问题;3、完成禁闭管理的后端功能开发、前后端对接

main
pengwei 6 months ago
parent
commit
103a640fa9
  1. 10
      src/api/data/petitionComplaint.ts
  2. 53
      src/api/work/confinement.ts
  3. 9
      src/components/data/gab-replenish.vue
  4. 53
      src/utils/util.ts
  5. 2
      src/views/data/Gjxf.vue
  6. 836
      src/views/work/Confinement.vue

10
src/api/data/petitionComplaint.ts

@ -14,6 +14,16 @@ export function replenishExcelGab(body){
})
}
// 补充公安部信访数据
export function replenishLedaoExcelGab(body){
return request.post({
url:"/data/petitionComplaint/gab/replenishLedao",
body
})
}
export function importPetitionComplaintGj(body) {
return request.post({
url: '/data/petitionComplaint/gj/import',

53
src/api/work/confinement.ts

@ -0,0 +1,53 @@
import request from "@/api/request";
//分页查询
export const getConfinementList = (query)=>{
return request.get({
url:'/confinement',
query
})
}
//新增
export const InsertConfinement = (body) =>{
return request.post({
url:'/confinement',
body
})
}
//修改
export const upDateConfinement = (body) =>{
return request.put({
url:'/confinement',
body
})
}
//获取禁闭信息附件
export const getConfinementFiles = (id)=>{
return request.get({
url:'/confinement/files/'+id
})
}
//删除
export const DelConfinementById =(id)=>{
return request.del({
url:'/confinement/'+id
})
}
//获取警员列表
export const getPoliceList = (query)=>{
return request.get({
url: '/police',
query
});
}
//获取看护单位数据
export const getNursingOrgFun = ()=>{
return request.get({
url:'/confinement/getNursingOrgs'
})
}

9
src/components/data/gab-replenish.vue

@ -1,6 +1,6 @@
<script setup>
import { BASE_PATH } from "@/api/request";
import {replenishExcelGab} from "@/api/data/petitionComplaint";
import {replenishExcelGab,replenishLedaoExcelGab} from "@/api/data/petitionComplaint";
import feedback from "@/utils/feedback";
let fileList = ref([])
let loading =ref(false)
@ -32,7 +32,12 @@ const handleNext = async ()=>{
formData.append("file", fileList.value[fileList.value.length - 1].raw);
loading.value = true;
try {
await replenishExcelGab(formData);
if(replenishType == 1){
await replenishExcelGab(formData);
}else{
await replenishLedaoExcelGab(formData);
}
feedback.msgSuccess("操作成功");
emit("success")
} catch (e) {

53
src/utils/util.ts

@ -85,7 +85,60 @@ export function getNormalPath(path: string) {
}
return newPath
}
/**
*
* @param id
* @return "birthTime":, "gender": , "age":
* */
export const extractInfoFromID = (id) => {
let birthDate, gender, age;
const currentDate = new Date();
const currentYear = currentDate.getFullYear();
const currentMonth = currentDate.getMonth() + 1; // 月份从0开始计数
const currentDay = currentDate.getDate();
if (id.length === 18) {
// 提取出生日期
birthDate = id.substring(6, 14); // "YYYYMMDD"
birthDate = birthDate.substring(0, 4) + '-' + birthDate.substring(4, 6) + '-' + birthDate.substring(6) + " " + "00:00"; // "YYYY-MM-DD"
// 提取性别
gender = id.charAt(16) % 2 === 0 ? '0' : '1';
// 计算年龄
const birthYear = parseInt(birthDate.split('-')[0], 10);
age = currentYear - birthYear - ((currentMonth < birthDate.split('-')[1] || (currentMonth === birthDate.split('-')[1] && currentDay < birthDate.split('-')[2])) ? 1 : 0);
} else if (id.length === 15) {
// 提取出生日期,转换为19世纪年份
birthDate = '19' + id.substring(6, 12); // "19YYMMDD"
birthDate = birthDate.substring(0, 4) + '-' + birthDate.substring(4, 6) + '-' + birthDate.substring(6) + " " + "00:00"; // "YYYY-MM-DD"
// 没有性别信息
gender = null; // 或者可以根据需要设置为null或'不适用'
// 计算年龄
const birthYear = parseInt(birthDate.split('-')[0], 10);
age = currentYear - birthYear - ((currentMonth < birthDate.split('-')[1] || (currentMonth === birthDate.split('-')[1] && currentDay < birthDate.split('-')[2])) ? 1 : 0);
} else {
console.error('无效的身份证号码长度');
return null;
}
return {"birthTime": birthDate, "gender": gender, "age": age};
}
/**
*
* birthDate
* */
export const calculateAge=(birthDate) =>{
const today = new Date();
const birth = new Date(birthDate);
let age = today.getFullYear() - birth.getFullYear();
const monthDiff = today.getMonth() - birth.getMonth();
// 如果当前月份小于出生月份,或者同月但日期未到生日
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
age--;
}
return age;
}
/**
* @description
* @param dateTime { number }

2
src/views/data/Gjxf.vue

@ -252,7 +252,7 @@
:replenishType="replenishType"
@close="replenishShow = false" @success="successFun"/>
<data-distrbute
v-model:show="distributeShow"

836
src/views/work/Confinement.vue

@ -0,0 +1,836 @@
<script setup>
//
import {timeFormat, calculateAge,extractInfoFromID} from "@/utils/util";
import {
getConfinementList,
upDateConfinement,
getConfinementFiles,
InsertConfinement,
getPoliceList,
DelConfinementById,
getNursingOrgFun
} from "@/api/work/confinement";
import feedback from "@/utils/feedback";
import {BASE_PATH} from "@/api/request";
//
let query = ref({
current: 1,
size: 10,
departBranch:false,
confinementTime: []
})
//
let PoliceQuery = ref({
current: 1,
size: 10000
})
//(true,false)
let isEdit = ref(false)
//ref
const formRef = ref()
const total = ref(0)
let list = ref([])
//
const formData = ref({})
//
let users = ref()
//
const rules = ref({
name: [
{
required: true,
message: '请输入姓名',
trigger: ['blur'],
}
],
idCode: [
{
required: true,
message: '请输入身份证',
trigger: ['blur'],
}
],
gender: [
{
required: true,
message: '请输入性别',
trigger: ['blur'],
}
],
age: [
{
required: true,
message: '请输入年龄',
trigger: ['blur'],
}
],
joinPartyTime: [
{
required: true,
message: '请输入入党(团)时间',
trigger: ['blur'],
}
],
joinWorkTime: [
{
required: true,
message: '请输入参加工作时间',
trigger: ['blur'],
}
],
joinPoliceTime: [
{
required: true,
message: '请输入参加公安工作时间',
trigger: ['blur'],
}
],
education: [
{
required: true,
message: '请输入文化程度',
trigger: ['blur'],
}
],
job: [
{
required: true,
message: '请输入职务',
trigger: ['blur'],
}
],
orgId: [
{
required: true,
message: '请选择部门',
trigger: ['blur'],
}
],
nursingOrgId: [
{
required: true,
message: '请选择看护单位',
trigger: ['blur'],
}
],
matter: [
{
required: true,
message: '请选择事由',
trigger: ['blur'],
}
],
startTime: [
{
required: true,
message: '请选择开始时间',
trigger: ['blur'],
}
],
endTime: [
{
required: true,
message: '请选择开始时间',
trigger: ['blur'],
}
],
confinementTime: [
{
required: true,
message: '请选择开始时间',
trigger: ['blur'],
}
],
files: [
{
required: true,
message: '请上传相关文件',
trigger: ['blur'],
}
]
})
//
let loading = ref(false)
//
let editShow = ref(false)
//
let detailShow = ref(false)
let NursingOrgList = ref([])
//
const handleExport = () => {
console.log("数据导出")
window.open(`${BASE_PATH}/confinement/export?` + new URLSearchParams(query.value).toString())
}
/**
* 新增禁闭弹窗
* */
const ShowAddForm = () => {
formData.value = {}
isEdit.value = false;
editShow.value = true
}
//
const getList = async () => {
loading.value = true
getConfinementList(query.value).then((res) => {
list.value = res.records;
total.value = res.total;
loading.value = false
})
}
const getNursingOrgList =async ()=>{
const res = await getNursingOrgFun()
NursingOrgList.value = res;
console.log('NursingOrgList',NursingOrgList.value)
this.$nextTick()
}
//
const getConfinementFilesFun = async (id) => {
const res = await getConfinementFiles(id)
formData.value.files = res || []
}
/**
* 获取详情数据
* */
const handleDetail = (row) => {
formData.value = row;
getConfinementFilesFun(row.id)
let {birthTime, gender, age} = extractInfoFromID(row.idCode)
formData.value.gender = gender
formData.value.age = age
formData.value.birthTime = birthTime
detailShow.value=true
}
/**
* 删除数据
* */
const handleDel = async (row) => {
const res = await DelConfinementById(row.id);
getList()
}
/**
* 编辑
* */
const handleUpDate = (row) => {
formData.value = row;
getConfinementFilesFun(row.id)
let {birthTime, gender, age} = extractInfoFromID(row.idCode)
formData.value.gender = gender
formData.value.age = age
formData.value.birthTime = birthTime
isEdit.value = true;
editShow.value = true;
}
/**
* 编辑提交事件
* */
const handleSumbit = async () => {
await formRef.value.validate();
//
if (isEdit.value) {
const res = await upDateConfinement(formData.value);
} else {
const res = await InsertConfinement(formData.value);
}
feedback.msgSuccess("操作成功");
editShow.value = false
getList()
}
//
const getPoliceListFun = async () => {
const res = await getPoliceList(PoliceQuery.value)
users.value = res.records;
}
//
const reset = () => {
query.value = {
current: 1,
size: 10
};
tableRef.value.clearSort();
getList();
//
// router.push("/query");
}
const CopyUserDetail = (row) => {
let obj = users.value.filter(s => s.id == row);
if (obj[0]) {
let rowData = obj[0];
formData.value.name = rowData.name
formData.value.idCode = rowData.idCode
formData.value.job = rowData.job
formData.value.orgId = rowData.orgId
formData.value.empNo = rowData.empNo
let {birthTime, gender, age} = extractInfoFromID(rowData.idCode)
formData.value.birthTime = birthTime
formData.value.gender = gender
formData.value.age = age
}
}
/**
* 禁闭时长的计算
* */
const getConfinementTime = () => {
if (formData.value.startTime && formData.value.endTime) {
formData.value.confinementTime = getDaysBetweenDates(formData.value.startTime, formData.value.endTime)
}
}
/**
* 计算两个日期获取相隔天数
* */
function getDaysBetweenDates(date1, date2) {
var oneDay = 24 * 60 * 60 * 1000; //
var time1 = new Date(date1).getTime(); //
var time2 = new Date(date2).getTime(); //
var diffDays = Math.abs((time1 - time2) / oneDay); //
return diffDays;
}
onMounted(() => {
getList();
getPoliceListFun();
getNursingOrgList();
})
</script>
<template>
<div class="container">
<!--查询条件-->
<header>
<el-form>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="姓名">
<el-input placeholder="请输入姓名"
v-model="query.name"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="部门">
<depart-tree-select
v-model="query.orgId"
placeholder="部门"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="禁闭时间">
<date-time-range-picker-ext
v-model="query.confinementTime"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="事由">
<el-input placeholder="请输入事由"
v-model="query.matter"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="flex between mt-20 mb-26">
<div>
<el-button type="primary" @click="handleExport"
>数据导出
</el-button>
<el-button type="primary" @click="ShowAddForm"
>新增禁闭
</el-button>
</div>
<div>
<el-button type="primary" @click="getList">
<template #icon
>
<icon name="el-icon-Search"
/>
</template>
查询
</el-button
>
<el-button @click="reset">重置</el-button>
</div>
</div>
</header>
<!--表单-->
<main>
<div class="table-container" v-loading="loading">
<el-table
:data="list"
ref="tableRef"
>
<el-table-column type="selection" width="55"/>
<el-table-column
label="姓名"
prop="name"
width="80"
></el-table-column>
<el-table-column
label="警号"
prop="empNo"
width="80"
></el-table-column>
<el-table-column
label="部门"
width="120"
>
<template #default="{row}">
<div class="flex gap-4">
<span v-if="row.parentDepartShortName"
>{{ row.parentDepartShortName }}/</span
><span>{{ row.departShortName }}</span>
</div>
</template>
</el-table-column>
<el-table-column
label="年龄"
width="80"
>
<template #default="{row}">
{{ calculateAge(row.birthTime) || '/' }}
</template>
</el-table-column>
<el-table-column label="职务"
width="80"
prop="job"
/>
<el-table-column
label="事由"
prop="matter"
show-overflow-tooltip
/>
<el-table-column label="禁闭时长(天)"
width="80"
prop="confinementTime"/>
<el-table-column
label="开始日期"
prop="startTime"
>
<template #default="{row}">
{{ timeFormat(row.startTime) }}
</template>
</el-table-column>
<el-table-column
label="结束日期"
prop="endTime"
>
<template #default="{row}">
{{ timeFormat(row.endTime) }}
</template>
</el-table-column>
<el-table-column label="看护单位"
>
<template #default="{row}">
<div class="flex gap-4">
<span>{{ row.nursingShortName }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="160" fixed="right">
<template #default="{ row }">
<div class="flex v-center">
<el-button
type="primary"
text
@click="handleDetail(row)"
>详情
</el-button
>
<el-button
type="primary"
text
@click="handleUpDate(row)"
>
编辑
</el-button>
<el-button
type="danger"
text
@click="handleDel(row)"
>
删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
</main>
<!-- 编辑表单-->
<el-dialog v-model="editShow" :title="isEdit?'编辑禁闭信息':'新增禁闭信息'" width="900px">
<el-form label-width="148" :model="formData" ref="formRef" :rules="rules">
<div style="margin-bottom: 80px">
<el-row>
<el-col :span="12">
<el-form-item label="姓名" prop="name">
<!-- <el-input v-model="formData.name"></el-input>-->
<el-select
v-model="formData.policeId"
filterable
default-first-option
@change="CopyUserDetail"
>
<el-option v-for="(item,key) in users" :key="key"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证" prop="idCode">
<el-input v-model="formData.idCode"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="年龄" prop="age">
<el-input-number v-model="formData.age"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="gender">
<el-radio-group v-model="formData.gender">
<el-radio value="0"></el-radio>
<el-radio value="1"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="出生日期" prop="birthTime">
<el-date-picker
v-model="formData.birthTime"
type="datetime"
placeholder="请选择"
value-format="YYYY-MM-DD HH:mm"
time-format="HH:mm"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入党(团)时间" prop="joinPartyTime">
<el-date-picker
v-model="formData.joinPartyTime"
type="datetime"
placeholder="请选择"
value-format="YYYY-MM-DD HH:mm"
time-format="HH:mm"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="参加工作时间" prop="joinWorkTime">
<el-date-picker
v-model="formData.joinWorkTime"
type="datetime"
placeholder="请选择"
value-format="YYYY-MM-DD HH:mm"
time-format="HH:mm"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12" label="参加公安工作时间" prop="joinPoliceTime">
<el-form-item label="参加公安工作时间" prop="joinPoliceTime">
<el-date-picker
v-model="formData.joinPoliceTime"
type="datetime"
placeholder="请选择"
value-format="YYYY-MM-DD HH:mm"
time-format="HH:mm"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="文化程度" prop="education">
<el-input v-model="formData.education"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="职务" prop="job">
<el-input v-model="formData.job"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="部门" prop="orgId">
<depart-tree-select
v-model="formData.orgId"
placeholder="部门"
/>
</el-form-item>
</el-col>
</el-row>
<hr style="color: #abaaaa;opacity: 0.2"/>
<el-row>
<el-col :span="12">
<el-form-item label="看护单位" prop="nursingOrgId">
<el-select
filterable
default-first-option
v-model ="formData.nursingOrgId">
<el-option v-for="(item,key) in NursingOrgList" :key="key"
:label="item.shortName"
:value="item.id"></el-option>
</el-select>
<!-- <depart-tree-select-->
<!-- v-model="formData.nursingOrgId"-->
<!-- placeholder="看护单位"-->
<!-- />-->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="查处单位" prop="investigateUnit">
<el-input v-model="formData.investigateUnit"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="事由" prop="matter">
<el-input type="textarea" :rows="3" v-model="formData.matter"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="开始日期" prop="startTime">
<el-date-picker
v-model="formData.startTime"
type="datetime"
placeholder="请选择"
value-format="YYYY-MM-DD HH:mm"
time-format="HH:mm"
style="width: 100%"
@change="getConfinementTime"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结束日期" prop="endTime">
<el-date-picker
v-model="formData.endTime"
type="datetime"
placeholder="请选择"
value-format="YYYY-MM-DD HH:mm"
time-format="HH:mm"
style="width: 100%"
@change="getConfinementTime"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="禁闭时长" prop="confinementTime">
<el-input v-model="formData.confinementTime"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否回访" prop="isVisit">
<el-radio-group v-model="formData.isVisit">
<el-radio value="0"></el-radio>
<el-radio value="1"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="附件上传" prop="files">
<file-upload v-model:files="formData.files"/>
</el-form-item>
</el-col>
</el-row>
</div>
</el-form>
<footer class="flex end">
<el-button @click="editShow = false" size="large">取消</el-button>
<el-button type="primary" @click="handleSumbit" size="large"
>确定
</el-button
>
</footer>
</el-dialog>
<!-- 详情-->
<el-dialog v-model="detailShow" title="详情" width="900px">
<el-form label-width="148">
<div style="margin-bottom: 80px">
<el-row>
<el-col :span="12">
<el-form-item label="姓名" prop="name">
{{ formData.name }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证" prop="idCode">
{{ formData.idCode }}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="年龄" prop="age">
{{ formData.age }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="gender">
{{ formData.gender == 0 ? '女' : '男' }}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="出生日期" prop="birthTime">
{{ formData.birthTime }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入党(团)时间" prop="joinPartyTime">
{{formData.joinPartyTime}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="参加工作时间" prop="joinWorkTime">
{{formData.joinWorkTime}}
</el-form-item>
</el-col>
<el-col :span="12" label="参加公安工作时间" prop="joinPoliceTime">
<el-form-item label="参加公安工作时间" prop="joinPoliceTime">
{{formData.joinPoliceTime}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="文化程度" prop="education">
{{formData.education}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="职务" prop="job">
{{formData.job}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="部门" prop="orgId">
<div class="flex gap-4">
<span v-if="formData.parentDepartShortName"
>{{ formData.parentDepartShortName }}/</span
><span>{{ formData.departShortName }}</span>
</div>
</el-form-item>
</el-col>
</el-row>
<hr style="color: #abaaaa;opacity: 0.2"/>
<el-row>
<el-col :span="12">
<el-form-item label="看护单位" prop="nursingOrgId">
<div class="flex gap-4">
<span v-if="formData.parentDepartNursingName"
>{{ formData.parentDepartNursingName }}/</span
><span>{{ formData.nursingShortName }}</span>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="查处单位" prop="investigateUnit">
{{formData.investigateUnit}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="事由" prop="matter">
{{formData.matter}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="开始日期" prop="startTime">
{{formData.startTime}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="结束日期" prop="endTime">
{{formData.endTime}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="禁闭时长" prop="confinementTime">
{{formData.confinementTime}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否回访" prop="isVisit">
{{formData.isVisit== 0?'是':'否'}}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="附件" prop="files">
<file-list
:files="formData.files"
v-if="formData.files"
/>
<el-empty v-else description="无附件" style="--el-empty-image-width: 50px" />
</el-form-item>
</el-col>
</el-row>
</div>
</el-form>
<footer class="flex end">
<el-button @click="detailShow=false" size="large">取消</el-button>
<el-button type="primary" @click="detailShow=false" size="large"
>确定
</el-button
>
</footer>
</el-dialog>
</div>
</template>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save