lcw
247
src/App.vue
@ -1,48 +1,13 @@
|
||||
<template>
|
||||
<router-view v-slot="{ Component }" v-if="isRouterAlive">
|
||||
|
||||
<keep-alive :include="store.getters.keepLiiveRoute">
|
||||
<Watermark :text="content" :color="'rgba(0, 0, 0, .15)'">
|
||||
<Component :is="Component"></Component>
|
||||
</Watermark>
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
<Fzq />
|
||||
|
||||
|
||||
<Fxq :initial-position="{ x: position.x, y: position.y }">
|
||||
<el-badge value="0" class="item badge-top-left">
|
||||
<div class="badge-container">
|
||||
<!-- :class="{ 'expanded': isExpanded }" -->
|
||||
<div class="badge-content expanded">
|
||||
<div class='fxq fxq1' @click.stop="opneMsg('xtxx')">
|
||||
<div class="title"> <img src="@/assets/images/xtxx.png" /> 系统消息</div>
|
||||
</div>
|
||||
<!-- <div class='fxq fxq2'>
|
||||
<div class="title" @click.stop="opneMsg('tztg')"> <img src="@/assets/images/tztg.png" /> 通知通报</div>
|
||||
</div>
|
||||
<div class='fxq fxq3'>
|
||||
<div class="title"> <img src="@/assets/images/xxxt.png" /> 消息协同</div>
|
||||
</div> -->
|
||||
<div style="margin-bottom: 8px;" title="蜂群"
|
||||
@click.stop="skipIframe('https://fqxt.lz.dsj.xz:9020/index.html?source=other')">
|
||||
<img src="@/assets/images/logo-1.png" alt="" srcset="">
|
||||
</div>
|
||||
<div title="林小警"
|
||||
@click.stop="skipIframe(`https://tyyy.lz.dsj.xz/embed/home?userId=${userId}&clientKey=${clientKey}&avatar=''`)">
|
||||
<img src="@/assets/images/lxj.png" alt="" srcset="" style="width: 34px;height: 38px">
|
||||
</div>
|
||||
<div title="三视图" @click.stop="SwitchSysDialogShow = true">
|
||||
<img src="@/assets/images/sst.png" alt="" srcset="" style="width: 34px;height: 38px">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-badge>
|
||||
</Fxq>
|
||||
<Iframe v-model='showIframe' :src='src' />
|
||||
<Information v-model='showDialog' :title='title'>
|
||||
<systemMessages :dict="{ BD_D_XXLX, BD_D_XXLY }" :idEntityCard='idEntityCard' :xxlx="showMsgLx" />
|
||||
</Information>
|
||||
<SwitchSysDialog v-model="SwitchSysDialogShow"/>
|
||||
</template>
|
||||
<script setup>
|
||||
import * as ocr from "@paddlejs-models/ocr";
|
||||
@ -53,62 +18,9 @@ import { queryXxTj } from '@/api/commit.js'
|
||||
import { getItem, setItem } from "@/utils/storage";
|
||||
import { generateNewStyle, writeNewStyle } from "@/utils/theme";
|
||||
import { timeValidate } from "@/utils/tools";
|
||||
import Information from '@/views/home/model/information.vue'
|
||||
import SwitchSysDialog from '@/components/SwitchSysDialog.vue'
|
||||
import systemMessages from '@/views/home/model/mesgSwitch/systemMessages.vue'
|
||||
import Fxq from '@/views/home/model/fxq.vue'
|
||||
import Iframe from '@/views/home/model/iframe.vue'
|
||||
import { getCookie } from '@/utils/cookie'
|
||||
import Fzq from '@/components/fzq/index.vue'
|
||||
import router from "./router";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const idEntityCard = getItem('idEntityCard')
|
||||
const { BD_D_XXLX, BD_D_XXLY } = proxy.$dict('BD_D_XXLX', 'BD_D_XXLY'); //获取字典数据
|
||||
const SwitchSysDialogShow=ref(false)
|
||||
const userId = getItem('USERID')
|
||||
const clientKey = getCookie('clientKey')
|
||||
const showMsgLx = ref('')
|
||||
const showDialog = ref(false)
|
||||
//消息
|
||||
const position = reactive({
|
||||
x: window.innerWidth - 120,
|
||||
y: window.innerHeight - 140
|
||||
})
|
||||
|
||||
const title = ref('系统消息')
|
||||
const opneMsg = (val) => {
|
||||
showDialog.value = true
|
||||
showMsgLx.value = val
|
||||
switch (val) {
|
||||
case 'xtxx':
|
||||
title.value = '系统消息'
|
||||
break;
|
||||
case 'tztg':
|
||||
title.value = '通知通告'
|
||||
break;
|
||||
case 'xxxt':
|
||||
title.value = '消息协同'
|
||||
break;
|
||||
}
|
||||
}
|
||||
const src = ref()
|
||||
const showIframe = ref(false)
|
||||
const skipIframe = (val) => {
|
||||
src.value = val
|
||||
showIframe.value = true
|
||||
}
|
||||
// 展开收缩状态
|
||||
const isExpanded = ref(false)
|
||||
const toggleExpand = () => {
|
||||
isExpanded.value = !isExpanded.value
|
||||
}
|
||||
const queryXxTjList = () => {
|
||||
queryXxTj({}).then((res) => {
|
||||
console.log(res);
|
||||
}).catch((err) => {
|
||||
|
||||
});
|
||||
}
|
||||
queryXxTjList()
|
||||
|
||||
|
||||
|
||||
const store = useStore();
|
||||
@ -123,48 +35,13 @@ const reload = () => {
|
||||
});
|
||||
};
|
||||
provide("reload", reload);
|
||||
// 处理页面可见性变化的函数
|
||||
const handleVisibilityChange = () => {
|
||||
// 只在页面变得可见时触发
|
||||
if (document.visibilityState === 'visible') {
|
||||
// 获取会话信息 - 带上所有cookies
|
||||
fetch('https://pcs.lz.dsj.xz:9020/getSession', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
// 确保发送所有cookies,包括跨域cookies
|
||||
credentials: 'include',
|
||||
})
|
||||
.then((response) => {
|
||||
// 检查响应状态
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((data) => {
|
||||
console.log('会话信息:', data);
|
||||
// 这里可以根据返回的数据进行后续处理
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('获取会话信息失败:', error);
|
||||
// 可以添加错误通知或重试逻辑
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener("visibilitychange", handleVisibilityChange);
|
||||
document.title = "林芝";
|
||||
document.title = "林芝哨岗系统";
|
||||
frashJs()
|
||||
// initPage()
|
||||
});
|
||||
|
||||
// 在组件卸载前移除事件监听器
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
@ -221,38 +98,6 @@ li {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
//只显示一排内容
|
||||
.one_text_detail {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
//只显示二排内容
|
||||
.two_text_detail {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
//只显示三排内容
|
||||
.text_detail {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
// 不显示滚动条
|
||||
.noScollLine::-webkit-scrollbar {
|
||||
width: 0 !important;
|
||||
}
|
||||
|
||||
v-deep .el-loading-mask {
|
||||
background: rgba(0, 0, 0, 0.5) !important;
|
||||
}
|
||||
@ -292,58 +137,6 @@ v-deep .el-loading-mask {
|
||||
}
|
||||
}
|
||||
|
||||
.fxq {
|
||||
border-radius: 35px;
|
||||
width: 35px;
|
||||
transition: transform 0.5s ease, width 0.5s ease;
|
||||
background-color: rgb(1, 127, 245);
|
||||
transform-origin: left center;
|
||||
overflow: hidden;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
justify-content: center;
|
||||
line-height: 35px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.title {
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
|
||||
img {
|
||||
margin-left: 9.5px;
|
||||
width: 16px;
|
||||
margin-right: 10px;
|
||||
margin-top: -3px;
|
||||
vertical-align: middle;
|
||||
height: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fxq2 {
|
||||
background-color: #9d88f9;
|
||||
}
|
||||
|
||||
.fxq1:hover {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.fxq2:hover {
|
||||
width: 120px;
|
||||
|
||||
// background-color: red;
|
||||
}
|
||||
|
||||
.fxq3:hover {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
::v-deep .badge-top-left .el-badge__content {
|
||||
top: 0;
|
||||
right: auto;
|
||||
@ -351,34 +144,4 @@ v-deep .el-loading-mask {
|
||||
transform: translateY(-50%) translateX(-50%);
|
||||
}
|
||||
|
||||
.badge-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s ease;
|
||||
max-height: 200px;
|
||||
/* 默认展开的最大高度 */
|
||||
min-height: 45px;
|
||||
/* 确保收缩时有足够空间显示第一个图标 */
|
||||
}
|
||||
|
||||
.badge-content:not(.expanded) {
|
||||
max-height: 45px;
|
||||
}
|
||||
|
||||
/* 收缩时只显示第一个图标,隐藏其他内容 */
|
||||
.badge-content:not(.expanded)> :not(:first-child) {
|
||||
opacity: 0;
|
||||
max-height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.badge-container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -50,3 +50,47 @@ export const qbcjimportRyData = (data) => {
|
||||
data
|
||||
});
|
||||
};
|
||||
export const qbcjSelectQbsbPage = (params) => {
|
||||
return request({
|
||||
url: api + "/qbcj/selectQbsbPage",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
// 变更状态
|
||||
export const qbcjCzzt = (data) => {
|
||||
return request({
|
||||
url: api + "/qbcj/qbcjCzzt",
|
||||
method: "POST",
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
// 批量打标
|
||||
export const qbcjPldb = (data) => {
|
||||
return request({
|
||||
url: api + "/qbcj/qbcjPldb",
|
||||
method: "POST",
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
//批量上报
|
||||
export const qbcjPlsb = (data) => {
|
||||
return request({
|
||||
url: api + "/qbcj/qbcjPlsb",
|
||||
method: "POST",
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 查询检查流程
|
||||
export const qbcjSelectCzlcList = (params) => {
|
||||
return request({
|
||||
url: api + "/qbcj/selectCzlcList",
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
@ -187,3 +187,11 @@ export const mxglYjxqSelectList = (params) => {
|
||||
params
|
||||
});
|
||||
}
|
||||
export const mxglJqxqGetPageList = (params) => {
|
||||
return request({
|
||||
url: gsxtApi + `/mxglJqxq/selectList`,
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
12
src/api/qxda.js
Normal file
@ -0,0 +1,12 @@
|
||||
import request from "@/utils/request";
|
||||
const api = "/api";
|
||||
export const ryxxJbxxSave = (params) => {
|
||||
return request({
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
url: api + "/ryxx/jbxx",
|
||||
method: "POST",
|
||||
params
|
||||
});
|
||||
};
|
||||
@ -31,3 +31,34 @@ export const tbJqGetPageList = (params) => {
|
||||
params
|
||||
})
|
||||
}
|
||||
// 预警列表
|
||||
|
||||
export const getPageAllList = (data) => {
|
||||
return request({
|
||||
url: api + `/tbYjxx/getPageAllList`,
|
||||
method: "post",
|
||||
data
|
||||
})
|
||||
}
|
||||
// 行为预警详情
|
||||
export const yjzxXwyjId = (id) => {
|
||||
return request({
|
||||
url: api + `/yjzxXwyj/${id}`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
// 布控预警详情
|
||||
export const tbYjxxGetInfo = (id) => {
|
||||
return request({
|
||||
url: api + `/tbYjxx/getInfo/${id}`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
// 布控预警统计
|
||||
export const tbYjxxGetBmtj = (params) => {
|
||||
return request({
|
||||
url: api + `/tbYjxx/getBmtj`,
|
||||
method: "get",
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@ -180,3 +180,40 @@ export function tbGsxtBqglSelectList(params) {
|
||||
params
|
||||
})
|
||||
}
|
||||
export function tbGsxtZdryselectPage(params) {
|
||||
return request({
|
||||
url: api + '/tbGsxtZdry/selectPage',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 重点人员查询
|
||||
export function tbGsxtZdryzdryBqtj(params) {
|
||||
return request({
|
||||
url: api + '/tbGsxtZdry/zdryBqtj',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export function tbGsxtBkQuash(params) {
|
||||
return request({
|
||||
url: api + '/tbGsxtBk/quash',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function tbGsxtBkSelectList(params) {
|
||||
return request({
|
||||
url: api + '/tbGsxtBk/selectList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export function tbYjxxGetList(params) {
|
||||
return request({
|
||||
url: api + '/tbYjxx/getList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@ -267,4 +267,8 @@
|
||||
|
||||
::v-deep .el-link {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
::v-deep .el-table__cell {
|
||||
z-index: initial !important;
|
||||
}
|
||||
@ -62,7 +62,7 @@
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
z-index: 2;
|
||||
z-index: 1;
|
||||
|
||||
.headBoxBg {
|
||||
width: 100%;
|
||||
|
||||
@ -22,7 +22,7 @@ header {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
z-index: 1999;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
padding-right: 10px;
|
||||
|
||||
@ -197,7 +197,7 @@ header {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
z-index: 1;
|
||||
background: #fff;
|
||||
padding: 0 10px;
|
||||
box-sizing: border-box;
|
||||
|
||||
BIN
src/assets/images/Group427322485.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/assets/images/Group427322486.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/assets/images/icon/fx.png
Normal file
|
After Width: | Height: | Size: 444 B |
BIN
src/assets/images/icon/fz.png
Normal file
|
After Width: | Height: | Size: 819 B |
BIN
src/assets/images/icon/gb.png
Normal file
|
After Width: | Height: | Size: 898 B |
BIN
src/assets/images/icon/glcy.png
Normal file
|
After Width: | Height: | Size: 884 B |
BIN
src/assets/images/icon/hyyq.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
src/assets/images/icon/jt.png
Normal file
|
After Width: | Height: | Size: 750 B |
BIN
src/assets/images/icon/jyy-j.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/assets/images/icon/jyy-k.png
Normal file
|
After Width: | Height: | Size: 757 B |
BIN
src/assets/images/icon/lb-j.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/images/icon/lb-k.png
Normal file
|
After Width: | Height: | Size: 939 B |
BIN
src/assets/images/icon/sp-j.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/images/icon/sp-k.png
Normal file
|
After Width: | Height: | Size: 510 B |
BIN
src/assets/images/icon/yy.png
Normal file
|
After Width: | Height: | Size: 549 B |
BIN
src/assets/images/icon/yyjl.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
src/assets/images/streetBi/fq.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
src/assets/images/streetBi/jiantou1.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
src/assets/images/streetBi/jiantou2.png
Normal file
|
After Width: | Height: | Size: 315 B |
BIN
src/assets/images/streetBi/lxj.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
src/assets/images/streetBi/sst.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/assets/images/streetBi/tztg.png
Normal file
|
After Width: | Height: | Size: 555 B |
BIN
src/assets/images/streetBi/xtxx.png
Normal file
|
After Width: | Height: | Size: 652 B |
BIN
src/assets/images/streetBi/xxxt.png
Normal file
|
After Width: | Height: | Size: 790 B |
BIN
src/assets/images/tmd.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
src/assets/images/y1.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/images/y2.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/images/y3.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/images/y4.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
@ -84,7 +84,8 @@ export function MapUtil(map) {
|
||||
el.style.width = size ? size : "25px";
|
||||
if (flag.includes('jczMap_')) el.style.width = '45px';
|
||||
if (showTitle) _that.makerShowTitle(item, [item.jd, item.wd], flag, '', offset) //展示标题
|
||||
const marker = map.Marker(el, [item.jd, item.wd], { anchor: 'bottom', offset: [0, 0] })
|
||||
// 确保坐标格式正确,使用对象格式传递坐标
|
||||
const marker = map.Marker(el, { lng: item.jd, lat: item.wd }, { anchor: 'bottom', offset: [0, 0] })
|
||||
el.addEventListener("click", () => {
|
||||
_that.openInfoDetail(flag, item) //点击打开详情
|
||||
})
|
||||
@ -131,7 +132,7 @@ export function MapUtil(map) {
|
||||
|
||||
let offset = isShoeCar ? [-10, 0] : [0, 0];
|
||||
if (cllxList.includes('08')) offset = [-12, -10]
|
||||
const marker = map.Marker(el, [item.jd, item.wd], { anchor: 'bottom', offset: offset })
|
||||
const marker = map.Marker(el, { lng: item.jd, lat: item.wd }, { anchor: 'bottom', offset: offset })
|
||||
el.addEventListener("click", () => {
|
||||
_that.openInfoDetail(flag, item) //点击打开详情
|
||||
})
|
||||
@ -140,6 +141,24 @@ export function MapUtil(map) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 信息框展示
|
||||
MapUtil.prototype.makerShowTitle = (item, points, flag, text, offset) => {
|
||||
|
||||
@ -179,7 +198,7 @@ export function MapUtil(map) {
|
||||
|
||||
// 渲染
|
||||
el.innerHTML = textTitle;
|
||||
const marker = map.Marker(el, points, { anchor: 'bottom', offset: offset ? offset : [0, -50] })
|
||||
const marker = map.Marker(el, Array.isArray(points) ? { lng: points[0], lat: points[1] } : points, { anchor: 'bottom', offset: offset ? offset : [0, -50] })
|
||||
_that._self[flagT].push(marker)
|
||||
}
|
||||
|
||||
@ -639,6 +658,9 @@ export function MapUtil(map) {
|
||||
if (!_that._self[flag]) _that._self[flag] = [];
|
||||
if (isClear && _that._self[flag]) _that.removeElement(flag); //destroy 移除,start 播放,pause 暂停
|
||||
let lineString = getUUid().slice(3, 5)
|
||||
|
||||
|
||||
console.log("1");
|
||||
const data = [
|
||||
{
|
||||
position: coords,
|
||||
@ -647,6 +669,9 @@ export function MapUtil(map) {
|
||||
userData: { name: '测试1' }
|
||||
}
|
||||
]
|
||||
console.log("2");
|
||||
console.log(data);
|
||||
// const s=data[0].
|
||||
const track = map.trajectoryRealtime(data, {
|
||||
color: '#28F', //轨迹背景颜色
|
||||
width: 8,
|
||||
@ -658,6 +683,7 @@ export function MapUtil(map) {
|
||||
isAgain: false,//轨迹运动是否重复,
|
||||
traveledColor: '#32b1fb' //运动轨迹颜色
|
||||
})
|
||||
console.log("3");
|
||||
track.start()
|
||||
|
||||
track.on('length', (data) => {
|
||||
@ -790,21 +816,20 @@ export function MapUtil(map) {
|
||||
|
||||
switch (flag) {
|
||||
case 'home_yj_map':
|
||||
console.log(data);
|
||||
emitter.emit("showHomeYJ", data);
|
||||
break;
|
||||
case 'home_yj_detail':
|
||||
console.log(data);
|
||||
emitter.emit("showHomeWarning", data);
|
||||
break;
|
||||
case 'jczMap_hm':
|
||||
console.log(data);
|
||||
emitter.emit("showJcz", data);
|
||||
break;
|
||||
case 'sp':
|
||||
console.log(data);
|
||||
emitter.emit("showGzyInfo", data);
|
||||
break;
|
||||
case 'yj':
|
||||
emitter.emit('yjShow', data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,109 +1,169 @@
|
||||
<template>
|
||||
<div ref="chartRef" :style="{ width: '100%', height: '400px' }"></div>
|
||||
<div ref="chartRef" :style="{ width: '100%', height: '100%' }"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
<script setup>
|
||||
import { defineComponent, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import * as echarts from 'echarts'
|
||||
import 'echarts-gl'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Pie3D',
|
||||
setup() {
|
||||
const chartRef = ref(null)
|
||||
let chart = null
|
||||
|
||||
const initChart = () => {
|
||||
if (!chartRef.value) return
|
||||
|
||||
chart = echarts.init(chartRef.value)
|
||||
const option = {
|
||||
backgroundColor: '#1a213c',
|
||||
tooltip: {
|
||||
formatter: '{b}: {c} ({d}%)',
|
||||
backgroundColor: 'rgba(0,0,0,0.7)',
|
||||
borderColor: '#1a213c',
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
right: '5%',
|
||||
top: 'center',
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
},
|
||||
formatter: function(name) {
|
||||
const data = option.series[0].data
|
||||
const total = data.reduce((sum, item) => sum + item.value, 0)
|
||||
const target = data.find(item => item.name === name)
|
||||
const percentage = ((target.value / total) * 100).toFixed(0)
|
||||
return `${name} ${target.value}`
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
type: 'pie',
|
||||
radius: ['30%', '55%'],
|
||||
center: ['40%', '50%'],
|
||||
roseType: false,
|
||||
zlevel: 10,
|
||||
startAngle: 35,
|
||||
selectedMode: 'single',
|
||||
selectedOffset: 10,
|
||||
data: [
|
||||
{ value: 18, name: '红色', itemStyle: { color: '#ff4d4f' } },
|
||||
{ value: 13, name: '橙色', itemStyle: { color: '#ff7a45' } },
|
||||
{ value: 17, name: '黄色', itemStyle: { color: '#ffc53d' } },
|
||||
{ value: 2, name: '蓝色', itemStyle: { color: '#40a9ff' } }
|
||||
],
|
||||
label: {
|
||||
show: true,
|
||||
formatter: '{d}%',
|
||||
color: '#fff',
|
||||
position: 'outside',
|
||||
fontSize: 14,
|
||||
fontWeight: 'bold'
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'self',
|
||||
scaleSize: 10,
|
||||
itemStyle: {
|
||||
shadowBlur: 20,
|
||||
shadowOffsetX: 5,
|
||||
shadowOffsetY: 5,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
borderRadius: 4,
|
||||
borderColor: '#1a213c',
|
||||
borderWidth: 2
|
||||
},
|
||||
animationType: 'scale',
|
||||
animationEasing: 'elasticOut',
|
||||
animationDelay: function (idx) {
|
||||
return Math.random() * 200;
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
chart.setOption(option)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initChart()
|
||||
window.addEventListener('resize', () => {
|
||||
chart && chart.resize()
|
||||
})
|
||||
})
|
||||
|
||||
return {
|
||||
chartRef
|
||||
}
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
color: {
|
||||
type: Array,
|
||||
default:() => []
|
||||
}
|
||||
})
|
||||
const chartRef = ref(null)
|
||||
let chart = null
|
||||
const initChart = () => {
|
||||
if (!chartRef.value) return
|
||||
chart = echarts.init(chartRef.value)
|
||||
const option = {
|
||||
// backgroundColor: '#1a213c',
|
||||
tooltip: {
|
||||
formatter: '{b}: {c} ({d}%)',
|
||||
backgroundColor: 'rgba(0,0,0,0.7)',
|
||||
borderColor: '#1a213c',
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
right: '0%',
|
||||
top: 'center',
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
},
|
||||
formatter: function (name) {
|
||||
const data = option.series[0].data
|
||||
const total = data.reduce((sum, item) => sum + item.value, 0)
|
||||
const target = data.find(item => item.name === name)
|
||||
const percentage = ((target.value / total) * 100).toFixed(0)
|
||||
return `${name} ${target.value}`
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
type: 'pie',
|
||||
radius: ['30%', '55%'],
|
||||
center: ['40%', '50%'],
|
||||
roseType: false,
|
||||
zlevel: 10,
|
||||
startAngle: 35,
|
||||
selectedMode: 'single',
|
||||
selectedOffset: 10,
|
||||
data:[...props.data],
|
||||
label: {
|
||||
show: true,
|
||||
formatter: '{d}%',
|
||||
color: '#fff',
|
||||
position: 'outside',
|
||||
fontSize: 14,
|
||||
fontWeight: 'bold'
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'self',
|
||||
scaleSize: 10,
|
||||
itemStyle: {
|
||||
shadowBlur: 20,
|
||||
shadowOffsetX: 5,
|
||||
shadowOffsetY: 5,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
borderRadius: 4,
|
||||
borderColor: '#1a213c',
|
||||
borderWidth: 2
|
||||
},
|
||||
// 启用全局动画控制器
|
||||
animation: true,
|
||||
// 关键:设置animationDelayUpdate确保数据更新时也有动画
|
||||
animationDelayUpdate: function (idx) {
|
||||
return idx * 300;
|
||||
},
|
||||
// 逐个显示的动画效果 - 改为从透明到不透明的过渡效果
|
||||
animationType: 'opacity',
|
||||
animationEasing: 'cubicOut',
|
||||
|
||||
// 关键:设置初始样式,让每个扇形从透明状态开始
|
||||
// 使用动画帧序列来控制动画过程
|
||||
animation: true,
|
||||
animationDuration: 1000,
|
||||
animationDelay: function (idx) {
|
||||
// 按照索引顺序依次显示,设置更明显的延迟
|
||||
return idx * 400;
|
||||
},
|
||||
|
||||
// 动画开始前的回调,确保动画效果
|
||||
animationBegin: function() {
|
||||
// 可以在这里进行额外的动画初始化
|
||||
return 0;
|
||||
},
|
||||
|
||||
// 动画帧序列,控制每个关键帧的样式
|
||||
animationFrame: function (idx, percent) {
|
||||
// percent参数是从0到1的动画进度
|
||||
return {
|
||||
opacity: percent,
|
||||
scale: 0.8 + percent * 0.2 // 从0.8放大到1
|
||||
};
|
||||
}
|
||||
}],
|
||||
media: [
|
||||
{
|
||||
query: { minAspectRatio: 1 },
|
||||
option: {
|
||||
series: [
|
||||
{ center: ['36%', '50%'] },
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
chart.setOption(option)
|
||||
}
|
||||
onMounted(() => {
|
||||
initChart()
|
||||
window.addEventListener('resize', () => {
|
||||
chart && chart.resize()
|
||||
})
|
||||
})
|
||||
|
||||
// 监听数据变化,确保动画在数据更新时也能触发
|
||||
watch(
|
||||
() => props.data,
|
||||
(newData) => {
|
||||
if (chart && newData && newData.length > 0) {
|
||||
// 使用clear方法强制重新渲染并触发动画
|
||||
chart.clear()
|
||||
initChart()
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
// 组件卸载时清理资源
|
||||
const cleanup = () => {
|
||||
if (chart) {
|
||||
chart.dispose()
|
||||
chart = null
|
||||
}
|
||||
window.removeEventListener('resize', () => {
|
||||
chart && chart.resize()
|
||||
})
|
||||
}
|
||||
|
||||
// 组件卸载时执行清理
|
||||
onUnmounted(() => {
|
||||
cleanup()
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
||||
@ -160,4 +160,5 @@ function setDefaultChoose() {
|
||||
.tabBoxRadio .el-table__header-wrapper .el-checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@ -87,9 +87,9 @@ const qcckGetCount = () => {
|
||||
if (!getItem('cookie')) {
|
||||
qcckGet({ sfzh: Sfzh }, '/mosty-base/fzmsg/getCokie', true).then(res => {
|
||||
if (res.cookie) {
|
||||
setCookie('clientKey', res.cookie.substring(10, res.length))
|
||||
setCookie('JSRSSIONID', res.cookie.substring(10, res.length))
|
||||
} else {
|
||||
setCookie('clientKey', res.substring(10, res.length))
|
||||
setCookie('JSRSSIONID', res.substring(10, res.length))
|
||||
}
|
||||
|
||||
qcckGetList()
|
||||
@ -107,7 +107,7 @@ const createProcess = ref({})
|
||||
const radioData = ref('')
|
||||
// const InterfaceAddress = 'http://192.168.0.231:8006/mosty-api/mosty-gsxt/'
|
||||
// const InterfaceAddress = 'http://192.168.0.231:8006/mosty-api/mosty-gsxt/'
|
||||
const InterfaceAddress = 'http://155.540.22.30:50037/mosty-api/mosty-gsxt/'
|
||||
const InterfaceAddress = 'http://155.240.22.30:2109/mosty-api/mosty-gsxt/'
|
||||
// const InterfaceAddress = 'http://192.168.1.32:8006/mosty-api/mosty-gsxt/'
|
||||
const changeRadio = (e) => {
|
||||
radioData.value = e
|
||||
@ -119,7 +119,7 @@ const changeRadio = (e) => {
|
||||
processType: 1,
|
||||
processData:
|
||||
{
|
||||
iframe: `#/${props.path.clueVerification}?id=${props.data.id}`,
|
||||
iframe: `${props.path.clueVerification}?id=${props.data.id}`,
|
||||
hostPrefix: "sgxtPath",
|
||||
rwbh: props.data.id,
|
||||
flowType: 'SGSP',
|
||||
|
||||
133
src/components/fzq/SwitchSysDialog.vue
Normal file
@ -0,0 +1,133 @@
|
||||
<!--
|
||||
* @Date: 2025-08-06 14:49:49
|
||||
* @Description: 系统切换窗口
|
||||
-->
|
||||
<template>
|
||||
<!-- append-to-body -->
|
||||
<div class="a">
|
||||
|
||||
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
class="switch-sys-dialog"
|
||||
modal-class="switch-sys-dialog-modal"
|
||||
:show-close="false"
|
||||
width="75%"
|
||||
align-center
|
||||
|
||||
destroy-on-close
|
||||
@close="handleModalClick"
|
||||
>
|
||||
<div class="switch-sys-dialog__content">
|
||||
<div class="carousel">
|
||||
<div
|
||||
:class="['card-item']"
|
||||
v-for="(item, index) in list"
|
||||
:key="item.value"
|
||||
@click="goPage(item, index)"
|
||||
>
|
||||
<img :src="item.icon" class="card-item__img" />
|
||||
<div class="card-item__label">{{ item.label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import fk from '@/assets/images/fk.png'
|
||||
import ty from '@/assets/images/ty.png'
|
||||
import pcs from '@/assets/images/pcs.png'
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const list = [
|
||||
{ label: '俯瞰系统', value: 1, url: `https://tyyy.lz.dsj.xz/overlooking/home`, icon: fk },
|
||||
{ label: '统一门户', value: 2, url: 'https://tyyy.lz.dsj.xz/portal/home', icon: ty },
|
||||
{ label: '智慧派出所', value: 3, url: 'https://pcs.lz.dsj.xz:9020/index.html', icon: pcs },
|
||||
]
|
||||
|
||||
const goPage = (item) => {
|
||||
if (item.url) {
|
||||
window.open(item.url, '_self')
|
||||
}
|
||||
}
|
||||
|
||||
// 处理遮罩点击事件
|
||||
const handleModalClick = () => {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.a{
|
||||
::v-deep(.el-dialog){
|
||||
background-color: transparent !important;
|
||||
}
|
||||
}
|
||||
body .el-overlay .el-overlay-dialog .el-dialog{
|
||||
background-color: transparent !important;
|
||||
}
|
||||
.switch-sys-dialog {
|
||||
|
||||
&__content {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
width: inherit;
|
||||
// height: 335px;
|
||||
align-items: center;
|
||||
.carousel {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 40px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.card-item {
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all 0.25s ease;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
.card-item__label {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 16px;
|
||||
color: var(--theme-text-color);
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
&__img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
&__label {
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
color: var(--text-color-black);
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
188
src/components/fzq/fxq.vue
Normal file
@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<div class="floating-ball" :style="ballStyle" @mousedown="startDrag" @touchstart="startDrag" @click="handleClick">
|
||||
<slot>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
// 初始位置
|
||||
initialPosition: {
|
||||
type: Object,
|
||||
default: () => ({ x: 0, y: 0 })
|
||||
},
|
||||
// 是否可拖动
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 自动吸附边缘的阈值
|
||||
snapThreshold: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
});
|
||||
// watch(() => props.initialPosition, (newVal) => {
|
||||
// position.value = { x: newVal.x, y: newVal.y };
|
||||
// },{deep:true})
|
||||
const emit = defineEmits(['click']);
|
||||
|
||||
const position = ref({ x: props.initialPosition.x, y: props.initialPosition.y });
|
||||
const isDragging = ref(false);
|
||||
const startPos = ref({ x: 0, y: 0 });
|
||||
const startMousePos = ref({ x: 0, y: 0 });
|
||||
|
||||
const ballStyle = ref({
|
||||
left: `${position.value.x}px`,
|
||||
top: `${position.value.y}px`,
|
||||
cursor: props.draggable ? 'move' : 'pointer'
|
||||
});
|
||||
|
||||
// 开始拖动
|
||||
const startDrag = (e) => {
|
||||
if (!props.draggable) return;
|
||||
|
||||
isDragging.value = true;
|
||||
startPos.value = { ...position.value };
|
||||
|
||||
// 处理鼠标和触摸事件
|
||||
if (e.type === 'mousedown') {
|
||||
startMousePos.value = { x: e.clientX, y: e.clientY };
|
||||
} else if (e.type === 'touchstart') {
|
||||
startMousePos.value = { x: e.touches[0].clientX, y: e.touches[0].clientY };
|
||||
}
|
||||
|
||||
// 阻止默认行为和冒泡
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
// 处理移动
|
||||
const handleMove = (e) => {
|
||||
if (!isDragging.value) return;
|
||||
|
||||
let clientX, clientY;
|
||||
if (e.type === 'mousemove') {
|
||||
clientX = e.clientX;
|
||||
clientY = e.clientY;
|
||||
} else if (e.type === 'touchmove') {
|
||||
clientX = e.touches[0].clientX;
|
||||
clientY = e.touches[0].clientY;
|
||||
}
|
||||
|
||||
const dx = clientX - startMousePos.value.x;
|
||||
const dy = clientY - startMousePos.value.y;
|
||||
|
||||
position.value = {
|
||||
x: startPos.value.x + dx,
|
||||
y: startPos.value.y + dy
|
||||
};
|
||||
|
||||
updatePosition();
|
||||
};
|
||||
|
||||
// 结束拖动
|
||||
const endDrag = () => {
|
||||
if (!isDragging.value) return;
|
||||
isDragging.value = false;
|
||||
snapToEdge();
|
||||
};
|
||||
|
||||
// 自动吸附到边缘
|
||||
const snapToEdge = () => {
|
||||
const windowWidth = window.innerWidth;
|
||||
const windowHeight = window.innerHeight;
|
||||
|
||||
// 检查是否靠近左右边缘
|
||||
if (position.value.x < props.snapThreshold) {
|
||||
position.value.x = 0;
|
||||
} else if (position.value.x > windowWidth - props.snapThreshold) {
|
||||
position.value.x = windowWidth;
|
||||
}
|
||||
|
||||
// 检查是否靠近上下边缘
|
||||
if (position.value.y < props.snapThreshold) {
|
||||
position.value.y = 0;
|
||||
} else if (position.value.y > windowHeight - props.snapThreshold) {
|
||||
position.value.y = windowHeight;
|
||||
}
|
||||
|
||||
updatePosition();
|
||||
};
|
||||
|
||||
// 更新位置样式
|
||||
const updatePosition = () => {
|
||||
ballStyle.value = {
|
||||
...ballStyle.value,
|
||||
left: `${position.value.x}px`,
|
||||
top: `${position.value.y}px`
|
||||
};
|
||||
};
|
||||
|
||||
// 点击事件
|
||||
const handleClick = (e) => {
|
||||
if (isDragging.value) {
|
||||
// 如果是拖动结束的点击,不触发点击事件
|
||||
isDragging.value = false;
|
||||
return;
|
||||
}
|
||||
emit('click', e);
|
||||
};
|
||||
|
||||
// 添加事件监听
|
||||
onMounted(() => {
|
||||
window.addEventListener('mousemove', handleMove);
|
||||
window.addEventListener('touchmove', handleMove);
|
||||
window.addEventListener('mouseup', endDrag);
|
||||
window.addEventListener('touchend', endDrag);
|
||||
});
|
||||
|
||||
// 移除事件监听
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('mousemove', handleMove);
|
||||
window.removeEventListener('touchmove', handleMove);
|
||||
window.removeEventListener('mouseup', endDrag);
|
||||
window.removeEventListener('touchend', endDrag);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.floating-ball {
|
||||
position: fixed;
|
||||
cursor: pointer;
|
||||
width: 50px;
|
||||
padding: 10px;
|
||||
/* height: 50px; */
|
||||
/* border-radius: 50%; */
|
||||
/* background-color: #409eff; */
|
||||
color: white;
|
||||
/* display: flex;
|
||||
justify-content: center;
|
||||
align-items: center; */
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||
z-index: 9999;
|
||||
user-select: none;
|
||||
/* transition: all 0.3s ease; */
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.ball-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.floating-ball:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
57
src/components/fzq/iframe.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div class="iframe-container">
|
||||
<el-dialog class="dialog-container" :model-value="modelValue" width="75%" :show-close="false" @close="close">
|
||||
<div style="height: 75vh;">
|
||||
<div class="close" @click="close"><el-icon :size="30"><CircleClose /></el-icon></div>
|
||||
<iframe :src="src" frameborder="0" width="100%" height="100%"></iframe>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}, title: {
|
||||
type: String,
|
||||
default: '提示'
|
||||
}, showFooter: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}, src: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue', 'submit', 'close'])
|
||||
const close = () => {
|
||||
emit('update:modelValue', false)
|
||||
emit('close')
|
||||
}
|
||||
const submit = () => {
|
||||
emit('submit')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iframe-container {
|
||||
::v-deep .el-dialog__header {
|
||||
display: none;
|
||||
}
|
||||
.close{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: -35px;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
}
|
||||
::v-deep .el-dialog__body {
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
256
src/components/fzq/index.vue
Normal file
@ -0,0 +1,256 @@
|
||||
<template>
|
||||
<Fxq :initial-position="{ x: position.x, y: position.y }" v-if="showFxq" :snapThreshold="50">
|
||||
<div class="badge-container">
|
||||
<div>
|
||||
<div>
|
||||
<el-tooltip effect="dark" content="林小警" placement="left-start">
|
||||
<img style="width: 34px;height: 34px;"
|
||||
@click.stop="skipIframe(`https://tyyy.lz.dsj.xz/embed/home?userId=${userId}&clientKey=${clientKey}&avatar=''`)"
|
||||
class="box-item" src="@/assets/images/streetBi/lxj.png" />
|
||||
</el-tooltip>
|
||||
<el-tooltip effect="dark" content="切换门户" placement="left-start">
|
||||
<img style="width: 34px;height: 34px;" @click.stop="SwitchSysDialogShow = true" class="box-item"
|
||||
src="@/assets/images/streetBi/sst.png" />
|
||||
</el-tooltip>
|
||||
<el-tooltip effect="dark" content="蜂群消息" placement="left-start">
|
||||
<img style="width: 34px;height: 34px; margin-bottom: 14px;"
|
||||
@click.stop="skipIframe('https://fqxt.lz.dsj.xz:9020/fqxt/?source=other')" class="box-item"
|
||||
src="@/assets/images/streetBi/fq.png" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-badge :value="xxListData.xtxxNumber" class="item badge-top-left">
|
||||
<div class='fxq fxq1' @click.stop="opneMsg('xtxx')">
|
||||
<div class="title">
|
||||
<img src="@/assets/images/streetBi/xtxx.png" />
|
||||
<span>系统消息</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-badge>
|
||||
<el-badge :value="xxListData.tztgNumber" class="item badge-top-left">
|
||||
<div class='fxq fxq2' @click.stop="opneMsg('tztg')">
|
||||
<div class="title">
|
||||
<img src="@/assets/images/streetBi/tztg.png" />
|
||||
<span>通知通报</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-badge>
|
||||
</div>
|
||||
</div>
|
||||
</Fxq>
|
||||
<Iframe v-model='showIframe' :src='src' />
|
||||
<SwitchSysDialog v-model="SwitchSysDialogShow" />
|
||||
<Information v-model='showDialog' :title='title'>
|
||||
<systemMessages :dict="{ BD_D_XXLX, BD_D_XXLY }" :idEntityCard='idEntityCard' :xxlx="showMsgLx" />
|
||||
</Information>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, nextTick, provide, onMounted, reactive, getCurrentInstance, onUnmounted } from "vue";
|
||||
import { queryWdxxPageList, queryWdxxDetail } from '@/api/commit.js'
|
||||
import SwitchSysDialog from '@/components/fzq/SwitchSysDialog.vue'
|
||||
import systemMessages from '@/components/fzq/systemMessages.vue'
|
||||
import Information from '@/components/fzq/information.vue'
|
||||
import Fxq from '@/components/fzq/fxq.vue'
|
||||
import { getItem } from '@/utils/storage.js'
|
||||
import { getCookie } from '@/utils/cookie'
|
||||
import Iframe from '@/components/fzq/iframe.vue'
|
||||
import emitter from "@/utils/eventBus.js";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { BD_D_XXLX, BD_D_XXLY } = proxy.$dict('BD_D_XXLX', 'BD_D_XXLY'); //获取字典
|
||||
const position = reactive({
|
||||
x: window.innerWidth - 30,
|
||||
y: window.innerHeight - 160
|
||||
})
|
||||
const idEntityCard = ref('')
|
||||
const xxListData = reactive({
|
||||
xtxxNumber: 0,
|
||||
tztgNumber: 0
|
||||
})
|
||||
//请求数据
|
||||
const handleClick = () => {
|
||||
let promes = {
|
||||
page: 1,
|
||||
rows: 1,
|
||||
jsrid: idEntityCard.value,
|
||||
xxlx: ""
|
||||
}
|
||||
queryWdxxPageList({ ...promes, xxlx: 100 }).then((res) => {
|
||||
xxListData.xtxxNumber = res.total
|
||||
});
|
||||
queryWdxxPageList({ ...promes, xxlx: 200 }).then((res) => {
|
||||
xxListData.tztgNumber = res.total
|
||||
});
|
||||
}
|
||||
|
||||
const userId = getItem('USERID')
|
||||
const clientKey = getCookie('clientKey')
|
||||
const SwitchSysDialogShow = ref(false)
|
||||
|
||||
const src = ref()
|
||||
const showIframe = ref(false)
|
||||
const skipIframe = (val) => {
|
||||
src.value = val
|
||||
showIframe.value = true
|
||||
}
|
||||
const title = ref('系统消息')
|
||||
const showDialog = ref(false)
|
||||
const showMsgLx = ref('')
|
||||
const showFxq = ref(true)
|
||||
const opneMsg = (val) => {
|
||||
showDialog.value = true
|
||||
showMsgLx.value = val
|
||||
switch (val) {
|
||||
case 'xtxx':
|
||||
title.value = '系统消息'
|
||||
break;
|
||||
case 'tztg':
|
||||
title.value = '通知通告'
|
||||
break;
|
||||
}
|
||||
}
|
||||
const intTime = ref(null)
|
||||
onMounted(() => {
|
||||
if (window.parent !== window.self) {
|
||||
showFxq.value = false
|
||||
} else {
|
||||
showFxq.value = true
|
||||
}
|
||||
emitter.on("handleClick", () => {
|
||||
idEntityCard.value = getItem('idEntityCard')
|
||||
handleClick()
|
||||
intTime.value = setInterval(() => {
|
||||
handleClick()
|
||||
}, 60000)
|
||||
});
|
||||
|
||||
})
|
||||
onUnmounted(() => {
|
||||
clearInterval(intTime.value)
|
||||
emitter.off("handleClick")
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// 蜂群组件样式
|
||||
.fxqx {
|
||||
border-radius: 34px;
|
||||
width: 34px;
|
||||
background-color: rgb(1, 127, 245);
|
||||
margin-bottom: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.title {
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
|
||||
img {
|
||||
margin-left: 9.5px;
|
||||
width: 16px;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
height: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
span {
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease 0.1s;
|
||||
padding-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fxq {
|
||||
border-radius: 34px;
|
||||
width: 34px;
|
||||
transition: width 0.3s ease;
|
||||
background-color: rgb(1, 127, 245);
|
||||
// overflow: hidden;
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.title {
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
|
||||
img {
|
||||
margin-left: 9.5px;
|
||||
width: 16px;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
height: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
span {
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease 0.1s;
|
||||
padding-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fxq2 {
|
||||
background-color: #9d88f9;
|
||||
}
|
||||
|
||||
.fxq3 {
|
||||
background-color: #00c07f;
|
||||
}
|
||||
|
||||
.fxq:hover {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.fxq:hover .title span {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.box-item {
|
||||
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.badge-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s ease;
|
||||
max-height: 200px;
|
||||
/* 默认展开的最大高度 */
|
||||
min-height: 0;
|
||||
/* 确保收缩时有足够空间显示第一个图标 */
|
||||
}
|
||||
|
||||
.badge-content:not(.expanded) {
|
||||
max-height: 0;
|
||||
}
|
||||
|
||||
/* 收缩时只显示第一个图标,隐藏其他内容 */
|
||||
.badge-content:not(.expanded)> :not(:first-child) {
|
||||
opacity: 0;
|
||||
max-height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
::v-deep .el-badge__content.is-fixed {
|
||||
right: calc(100% + 6px);
|
||||
}
|
||||
</style>
|
||||
53
src/components/fzq/information.vue
Normal file
@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<el-dialog class="dialog-container"
|
||||
:model-value="modelValue"
|
||||
:title="title"
|
||||
:before-close="close" :destroy-on-close="true"
|
||||
|
||||
>
|
||||
|
||||
<slot></slot>
|
||||
<template #footer v-if="showFooter">
|
||||
<div class="dialog-footer" >
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="submit">
|
||||
确认
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref} from 'vue'
|
||||
const props=defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},title:{
|
||||
type:String,
|
||||
default:'提示'
|
||||
},showFooter:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
}
|
||||
|
||||
})
|
||||
const emit=defineEmits(['update:modelValue','submit','close'])
|
||||
const close = () => {
|
||||
emit('update:modelValue',false)
|
||||
emit('close')
|
||||
}
|
||||
const submit=()=>{
|
||||
emit('submit')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// @import "@/assets/css/homeScreen.scss";
|
||||
::v-deep .el-dialog__body{
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
184
src/components/fzq/systemMessages.vue
Normal file
@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<!-- <el-button type="success" style='position: absolute;right:30px;'>一键忽略</el-button> -->
|
||||
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="chageHandle">
|
||||
<el-tab-pane label="未查看" name="first">
|
||||
<MyTable customClass="zdy_peo_table" :tableData="pageData.tableData" :tableColumn="pageData.tableColumn"
|
||||
:tableHeight="pageData.tableHeight" :key="pageData.keyCount" :tableConfiger="pageData.tableConfiger"
|
||||
:controlsWidth="pageData.controlsWidth">
|
||||
<template #xxly="{ row }">
|
||||
<DictTag :tag="false" :value="row.xxly" :options="dict.BD_D_XXLY" />
|
||||
</template>
|
||||
<template #xxlx="{ row }">
|
||||
<DictTag :tag="false" :value="row.xxlx" :options="dict.BD_D_XXLX" />
|
||||
</template>
|
||||
<template #controls="{ row }">
|
||||
<el-button size="small" type="primary" @click="handleDetail(row)">查看</el-button>
|
||||
</template>
|
||||
</MyTable>
|
||||
<Pages @changeNo="changeNo" @changeSize="changeSize" :tableHeight="pageData.tableHeight" :pageConfiger="{
|
||||
...pageData.pageConfiger,
|
||||
total: pageData.total
|
||||
}"></Pages>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="已查看" name="second">
|
||||
<MyTable customClass="zdy_peo_table" :tableData="pageData.tableData" :tableColumn="pageData.tableColumn"
|
||||
:tableHeight="pageData.tableHeight" :key="pageData.keyCount" :tableConfiger="pageData.tableConfiger"
|
||||
:controlsWidth="pageData.controlsWidth">
|
||||
<template #xxly="{ row }">
|
||||
<DictTag :tag="false" :value="row.xxly" :options="dict.BD_D_XXLY" />
|
||||
</template>
|
||||
<template #xxlx="{ row }">
|
||||
<DictTag :tag="false" :value="row.xxlx" :options="dict.BD_D_XXLX" />
|
||||
</template>
|
||||
<template #controls="{ row }">
|
||||
<el-button size="small" type="primary" @click="handleDetail(row)">查看</el-button>
|
||||
</template>
|
||||
</MyTable>
|
||||
<Pages @changeNo="changeNo" @changeSize="changeSize" :tableHeight="pageData.tableHeight" :pageConfiger="{
|
||||
...pageData.pageConfiger,
|
||||
total: pageData.total
|
||||
}"></Pages>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<Information v-model='showDialog' title='消息详情' :showFooter="false">
|
||||
<Xtxi :item="msgDetail" v-if="xxlx == 'xtxx'" :dict="dict" />
|
||||
</Information>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import Pages from "@/components/aboutTable/Pages.vue";
|
||||
import Information from "./information.vue";
|
||||
import { queryYdxxPageList, queryWdxxPageList, queryWdxxDetail, queryYdxxDetail, qsXx } from '@/api/commit.js'
|
||||
import Xtxi from './xtxi.vue'
|
||||
const props = defineProps({
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
}, idEntityCard: {
|
||||
type: String,
|
||||
default: ''
|
||||
}, xxlx: {
|
||||
type: String,
|
||||
default: 'xtxx'
|
||||
}
|
||||
})
|
||||
const activeName = ref('first')
|
||||
const pageData = reactive({
|
||||
tableData: [],
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
loading: false,
|
||||
rowHieght: 40,
|
||||
haveControls: true,
|
||||
},
|
||||
controlsWidth: 160, //操作栏宽度
|
||||
total: 0,
|
||||
pageConfiger: {
|
||||
pageSize: 20,
|
||||
pageCurrent: 1
|
||||
}, //分页
|
||||
tableColumn: [
|
||||
{ label: "消息标题", prop: "xxbt", showOverflowTooltip: true },
|
||||
{ label: "消息来源", prop: "xxly", showOverflowTooltip: true, showSolt: true },
|
||||
{ label: "消息描述", prop: "xxms", showOverflowTooltip: true },
|
||||
{ label: "消息类型", prop: "xxlx", showOverflowTooltip: true, showSolt: true },
|
||||
], tableHeight: "calc(80vh - 350px)",
|
||||
});
|
||||
const chageHandle = () => {
|
||||
pageData.pageConfiger.pageCurrent = 1
|
||||
pageData.pageConfiger.pageSize = 20
|
||||
handleClick()
|
||||
}
|
||||
//请求数据
|
||||
const handleClick = async () => {
|
||||
let promes = {
|
||||
page: pageData.pageConfiger.pageCurrent,
|
||||
rows: pageData.pageConfiger.pageSize,
|
||||
jsrid: props.idEntityCard,
|
||||
xxlx: ""
|
||||
}
|
||||
switch (props.xxlx) {
|
||||
case 'xtxx':
|
||||
promes.xxlx = 100
|
||||
const res = activeName.value == 'first' ? await queryWdxxPageList(promes) : await queryYdxxPageList(promes)
|
||||
pageData.tableData = res.rows
|
||||
pageData.total = res.total
|
||||
break;
|
||||
case 'tztg':
|
||||
promes.xxlx = 200
|
||||
const tztgRes = activeName.value == 'first' ? await queryWdxxPageList(promes) : await queryYdxxPageList(promes)
|
||||
pageData.tableData = tztgRes.rows
|
||||
pageData.total = tztgRes.total
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
const changeNo = (val) => {
|
||||
pageData.pageConfiger.pageCurrent = val
|
||||
handleClick()
|
||||
}
|
||||
const changeSize = (val) => {
|
||||
pageData.pageConfiger.pageSize = val
|
||||
handleClick()
|
||||
}
|
||||
handleClick()
|
||||
// 查看详情
|
||||
const showDialog = ref(false)
|
||||
const msgDetail = ref({})
|
||||
const disposition = (item) => {
|
||||
let arrId = ''
|
||||
if (Array.isArray(item)) {
|
||||
const itemMap = item.map(it => {
|
||||
return it.id
|
||||
})
|
||||
arrId = itemMap.join(',')
|
||||
} else {
|
||||
arrId = item.id
|
||||
}
|
||||
const promes = {
|
||||
xxlx: '100',
|
||||
id: arrId
|
||||
}
|
||||
qsXx(promes).then((result) => {
|
||||
handleClick()
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
|
||||
});
|
||||
}
|
||||
const handleDetail = async (item) => {
|
||||
showDialog.value = true
|
||||
const res = activeName.value == 'first' ? await queryWdxxDetail({ id: item.id }) : await queryYdxxDetail({ id: item.id })
|
||||
if (res) {
|
||||
msgDetail.value = res[0]
|
||||
if (msgDetail.value.qszt == '0') {
|
||||
disposition(item)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// @import "@/assets/css/homeScreen.scss";
|
||||
|
||||
.zdy_peo_table td.el-table__cell {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.zdy_peo_table th.el-table__cell {
|
||||
color: #ffffff !important;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.zdy_peo_table .el-table__body tr.el-table__row--striped td.el-table__cell {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
.zdy_peo_table .table_blue_row {
|
||||
background: linear-gradient(to right, #001D4B 0%, rgba(0, 29, 75, 0.1) 100%) !important;
|
||||
}
|
||||
</style>
|
||||
53
src/components/fzq/xtxi.vue
Normal file
@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div style="height: 300px;overflow: auto;font-size: 16px;">
|
||||
<div>通知标题:{{ item.xxbt }}</div>
|
||||
<div class="mt">通知内容:{{ item.xxms }}</div>
|
||||
<div class="flex align-center just-between mt">
|
||||
<div class="flex align-center">接收类型:
|
||||
<DictTag :tag="false" :value="item.xxlx" :options="dict.BD_D_XXLX" />
|
||||
</div>
|
||||
<div class="flex align-center">消息来源:
|
||||
<DictTag :tag="false" :value="item.xxly" :options="dict.BD_D_XXLY" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import {ref} from 'vue'
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
}, dict: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// @import "@/assets/css/homeScreen.scss";
|
||||
|
||||
.zdy_peo_table td.el-table__cell {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.zdy_peo_table th.el-table__cell {
|
||||
color: #ffffff !important;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.zdy_peo_table .el-table__body tr.el-table__row--striped td.el-table__cell {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
.zdy_peo_table .table_blue_row {
|
||||
background: linear-gradient(to right, #001D4B 0%, rgba(0, 29, 75, 0.1) 100%) !important;
|
||||
}
|
||||
|
||||
.mt {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
@ -12,18 +12,24 @@
|
||||
</div>
|
||||
<el-dropdown :hide-on-click="false">
|
||||
<span class="el-dropdown-link">
|
||||
<el-icon :size="20" color="#fff"> <CaretBottom /> </el-icon>
|
||||
<el-icon :size="20" color="#fff">
|
||||
<CaretBottom />
|
||||
</el-icon>
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="loginOut" @click="goToHome">
|
||||
<el-dropdown-item command="logout">前往前台</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
<el-dropdown-menu class="loginOut" @click="logout">
|
||||
<el-dropdown-item command="logout">退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div @click="goToHome">
|
||||
<!-- <div @click="goToHome">
|
||||
<img src="@/assets/images/meun.png" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
@ -56,7 +62,7 @@ onMounted(() => {
|
||||
active.value = "LZ";
|
||||
});
|
||||
const logout = () => {
|
||||
store.dispatch("user/logout");
|
||||
store.dispatch("user/logout");
|
||||
// window.opener = null;
|
||||
// window.open('', '_self');
|
||||
// window.close();
|
||||
|
||||
@ -72,7 +72,7 @@ const activeMenu = computed(() => {
|
||||
</style>
|
||||
<style>
|
||||
.el-menu-vertical-demo:not(.el-menu--collapse) {
|
||||
width: 281px;
|
||||
width: 240px;
|
||||
min-height: 400px;
|
||||
}
|
||||
</style>
|
||||
|
||||
77
src/plugins/utils/auth.js
Normal file
@ -0,0 +1,77 @@
|
||||
import {
|
||||
getItem,
|
||||
setItem
|
||||
} from '@/utils/storage';
|
||||
import {
|
||||
TOKEN_TIMEOUT_VSLUE,
|
||||
TIME_STAMP
|
||||
} from '@/constant';
|
||||
|
||||
/*
|
||||
* 1.设置时间戳
|
||||
*/
|
||||
export function setTimeStamp() {
|
||||
setItem(TIME_STAMP, Date.now());
|
||||
}
|
||||
|
||||
/*
|
||||
* 2.获取时间戳
|
||||
*/
|
||||
export function getTimeStamp() {
|
||||
return getItem(TIME_STAMP);
|
||||
}
|
||||
|
||||
/*
|
||||
* 1.是否超时 对比当前时间 和登录时间
|
||||
*/
|
||||
export function isCheckTimeout() {
|
||||
const currentTime = Date.now();
|
||||
const timeStamp = getTimeStamp();
|
||||
return currentTime - timeStamp > TOKEN_TIMEOUT_VSLUE;
|
||||
}
|
||||
//格式化时间
|
||||
export function dateFormat(date, fmt = "YY-MM-DD hh:mm:ss") {
|
||||
let ret
|
||||
const opt = {
|
||||
"Y+": date.getFullYear().toString(), // 年
|
||||
"M+": (date.getMonth() + 1).toString(), // 月
|
||||
"D+": date.getDate().toString(), // 日
|
||||
"h+": date.getHours().toString(), // 时
|
||||
"m+": date.getMinutes().toString(), // 分
|
||||
"s+": date.getSeconds().toString() // 秒
|
||||
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
||||
}
|
||||
for (let k in opt) {
|
||||
ret = new RegExp("(" + k + ")").exec(fmt)
|
||||
if (ret) {
|
||||
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
|
||||
}
|
||||
}
|
||||
return fmt
|
||||
}
|
||||
|
||||
// 字符串拼数组
|
||||
export function spliceArray(targetArr) {
|
||||
let currentArr = []
|
||||
if(targetArr.length > 0) {
|
||||
targetArr.forEach((item, index) => {
|
||||
if(index % 2 == 0 && index != targetArr.length){
|
||||
currentArr.push([targetArr[index],targetArr[index+1]])
|
||||
}
|
||||
})
|
||||
}
|
||||
return currentArr
|
||||
}
|
||||
|
||||
// 数组转字符串
|
||||
export function spliceString(targetArr){
|
||||
let tempArr = []
|
||||
let currentStr = ''
|
||||
if(targetArr.length > 0) {
|
||||
targetArr.forEach(item => {
|
||||
tempArr.push(...item)
|
||||
})
|
||||
currentStr = tempArr.toString()
|
||||
}
|
||||
return currentStr
|
||||
}
|
||||
61
src/plugins/utils/cookie.js
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 1.设置cookie
|
||||
* @param {string} key - cookie的名称
|
||||
* @param {string} value - cookie的值
|
||||
* @param {number} days - 过期天数,默认7天
|
||||
*/
|
||||
export const setCookie = (key, value, days = 7) => {
|
||||
const date = new Date();
|
||||
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
||||
const expires = `expires=${date.toGMTString()}`;
|
||||
document.cookie = `${key}=${encodeURIComponent(value)}; ${expires}; path=/`;
|
||||
};
|
||||
|
||||
/*
|
||||
* 2.获取cookie
|
||||
* @param {string} key - cookie的名称
|
||||
* @returns {string|null} - cookie的值,如果不存在则返回null
|
||||
*/
|
||||
export const getCookie = (key) => {
|
||||
const name = `${key}=`;
|
||||
const ca = document.cookie.split(';');
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let c = ca[i].trim();
|
||||
if (c.indexOf(name) === 0) {
|
||||
return decodeURIComponent(c.substring(name.length, c.length));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/*
|
||||
* 3.删除指定cookie
|
||||
* @param {string} key - cookie的名称
|
||||
*/
|
||||
export const removeCookie = (key) => {
|
||||
setCookie(key, '', -1);
|
||||
};
|
||||
|
||||
/*
|
||||
* 4.删除所有cookie
|
||||
*/
|
||||
export const removeAllCookies = () => {
|
||||
const cookies = document.cookie.split(';');
|
||||
for (let i = 0; i < cookies.length; i++) {
|
||||
const cookie = cookies[i];
|
||||
const eqPos = cookie.indexOf('=');
|
||||
const name = eqPos > -1 ? cookie.substr(0, eqPos).trim() : '';
|
||||
if (name) {
|
||||
removeCookie(name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* 5.检查cookie是否存在
|
||||
* @param {string} key - cookie的名称
|
||||
* @returns {boolean} - 是否存在该cookie
|
||||
*/
|
||||
export const hasCookie = (key) => {
|
||||
return getCookie(key) !== null;
|
||||
};
|
||||
119
src/plugins/utils/dict.js
Normal file
@ -0,0 +1,119 @@
|
||||
import { ref, toRefs } from 'vue';
|
||||
import { getSysDictByCode } from '@/api/sysDict' //引入封装数字字典接口
|
||||
/**
|
||||
* 获取字典数据
|
||||
*/
|
||||
let list = []
|
||||
export function getDict(...args) {
|
||||
const res = ref({});
|
||||
return (() => {
|
||||
args.forEach((d, index) => {
|
||||
res.value[d] = [];
|
||||
getSysDictByCode({
|
||||
dictCode: d
|
||||
}).then(result => {
|
||||
result.itemList.forEach(p => {
|
||||
p.label = p.zdmc
|
||||
p.value = p.dm
|
||||
p.id = p.dm
|
||||
p.elTagType = p.dictType
|
||||
if ( p.itemList && p.itemList.length > 0) {
|
||||
getChildren(p)
|
||||
}
|
||||
p.children = p.itemList
|
||||
})
|
||||
res.value[d] = result.itemList
|
||||
})
|
||||
})
|
||||
return toRefs(res.value);
|
||||
})()
|
||||
}
|
||||
|
||||
export function getChildren(item) {
|
||||
item.label = item.zdmc
|
||||
item.value = item.dm
|
||||
item.id = item.dm
|
||||
if (item.itemList && item.itemList.length > 0) {
|
||||
item.itemList.forEach(v => {
|
||||
getChildren(v)
|
||||
})
|
||||
}
|
||||
item.children = item.itemList
|
||||
}
|
||||
/**
|
||||
* 设置级联选择器回显
|
||||
* @param {*} id 选中ID
|
||||
* @param {*} array 级联数据树
|
||||
* @param {*} childDeptList 子集变量
|
||||
*/
|
||||
export function setCascader(id, array, childDeptList = 'childDeptList', fun) {
|
||||
if (array) {
|
||||
array.forEach(item => {
|
||||
if (item.childDeptList && item.id != id) {
|
||||
setCascader(id, item.childDeptList, childDeptList, fun)
|
||||
} else if (item.childDeptList && item.id == id) {
|
||||
fun(item)
|
||||
} else if (!item.childDeptList && item.id == id) {
|
||||
fun(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 当type=1时获取出生日期,type=2时获取性别,type=3时获取年龄 all
|
||||
* @param {*} IdCard
|
||||
* @param {*} type
|
||||
* @returns
|
||||
*/
|
||||
export function IdCard(IdCard, type) {
|
||||
let user = {
|
||||
birthday: '',
|
||||
sex: '',
|
||||
age: ''
|
||||
}
|
||||
if (type === 1 || type == 'all') {
|
||||
//获取出生日期
|
||||
let birthday = IdCard.substring(6, 10) + "-" + IdCard.substring(10, 12) + "-" + IdCard.substring(12, 14)
|
||||
if (type == 'all') {
|
||||
user.birthday = birthday
|
||||
} else {
|
||||
return birthday
|
||||
}
|
||||
}
|
||||
if (type === 2 || type == 'all') {
|
||||
//获取性别
|
||||
if (parseInt(IdCard.substr(16, 1)) % 2 === 1) {
|
||||
if (type == 'all') {
|
||||
user.sex = '男'
|
||||
} else {
|
||||
return "男女"
|
||||
}
|
||||
} else {
|
||||
if (type == 'all') {
|
||||
user.sex = '女'
|
||||
} else {
|
||||
return "女"
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type === 3 || type == 'all') {
|
||||
//获取年龄
|
||||
var ageDate = new Date()
|
||||
var month = ageDate.getMonth() + 1
|
||||
var day = ageDate.getDate()
|
||||
var age = ageDate.getFullYear() - IdCard.substring(6, 10) - 1
|
||||
if (IdCard.substring(10, 12) < month || IdCard.substring(10, 12) === month && IdCard.substring(12, 14) <= day) {
|
||||
age++
|
||||
}
|
||||
if (age <= 0) {
|
||||
age = 1
|
||||
}
|
||||
if (type == 'all') {
|
||||
user.age = age
|
||||
} else {
|
||||
return age
|
||||
}
|
||||
|
||||
}
|
||||
return user
|
||||
}
|
||||
392
src/plugins/utils/dicts.js
Normal file
@ -0,0 +1,392 @@
|
||||
const JWZLXDM = {
|
||||
'1': '街面警务站',
|
||||
'2': '综合治安岗亭',
|
||||
'3': '移动警务车组',
|
||||
'4': '其他'
|
||||
}
|
||||
const GAJGJGDM = {
|
||||
'1': '街面警务站',
|
||||
'2': '综合治安岗亭',
|
||||
'3': '移动警务车组',
|
||||
'4': '其他'
|
||||
}
|
||||
const XLRYLBDM = {
|
||||
'01': '巡警',
|
||||
'02': '特警',
|
||||
'03': '辅警',
|
||||
'04': '派出所民警',
|
||||
'05': '交警',
|
||||
'06': '单位保安',
|
||||
'07': '志愿者',
|
||||
'99': '其他'
|
||||
}
|
||||
|
||||
const XZQHDM = {
|
||||
'510502': '四川省泸州市江阳区(510502)',
|
||||
'510503': '四川省泸州市纳溪区(510503)',
|
||||
'510504': '四川省泸州市龙马潭区(510504)',
|
||||
'510521': '四川省泸县(510521)',
|
||||
'510522': '四川省合江县(510522)',
|
||||
'510524': '四川省叙永县(510524)',
|
||||
'510525': '四川省古蔺县(510525)'
|
||||
}
|
||||
const XQFWLX = {
|
||||
'1': '支队巡区',
|
||||
'2': '大队巡区',
|
||||
'3': '大队巡区网格',
|
||||
'4': '派出所巡区网格',
|
||||
'5': '派出所辖区'
|
||||
}
|
||||
const XQLXDM = {
|
||||
'1': '一般区域',
|
||||
'2': '人员密集场所',
|
||||
'3': '重点核心区',
|
||||
'9': '其他'
|
||||
}
|
||||
const BQMC = {
|
||||
'01': '涉毒',
|
||||
'02': '涉疆'
|
||||
}
|
||||
const PCCLJG = {
|
||||
'1': '移交',
|
||||
'2': '放行'
|
||||
}
|
||||
|
||||
/** 装备 **/
|
||||
const XLZBLXDM = {
|
||||
'01': '移动警务终端',
|
||||
'02': '执法记录仪',
|
||||
'03': '智能化单兵设备',
|
||||
'04': '警犬',
|
||||
'05': '无人机',
|
||||
'97': '武器',
|
||||
'98': '对讲机',
|
||||
'99': '其他'
|
||||
}
|
||||
const ZBZTDM = {
|
||||
'1': '正常',
|
||||
'2': '维修',
|
||||
'3': '报废',
|
||||
'4': '其他'
|
||||
}
|
||||
|
||||
/** 指令 **/
|
||||
const ZLLYDM = {
|
||||
'01': '云墙',
|
||||
'02': '犯罪预测',
|
||||
'03': '警情',
|
||||
'99': '人工下发'
|
||||
}
|
||||
const ZLLXDM = {
|
||||
'01': '核查指定人员',
|
||||
'02': '核查指定车辆',
|
||||
'03': '警情',
|
||||
'04': '巡防',
|
||||
'05': '核查某类人员',
|
||||
'06': '核查某类车辆',
|
||||
'07': '消息',
|
||||
'99': '其它指令'
|
||||
}
|
||||
const ZLGZYYJLX = {
|
||||
'1': '人',
|
||||
'2': '车',
|
||||
'3': '电',
|
||||
'4': '网',
|
||||
'5': '像'
|
||||
}
|
||||
const ZLYJRCBQ = {
|
||||
'01': '在逃',
|
||||
'02': '涉毒',
|
||||
'03': '前科',
|
||||
'04': '肇事',
|
||||
'05': '临控',
|
||||
'80': '被盗抢车辆'
|
||||
}
|
||||
const ZLYJRCBQDM = {
|
||||
'ZT': '在逃',
|
||||
'SD': '涉毒',
|
||||
'QK': '前科',
|
||||
'ZS': '肇事',
|
||||
'LKRY': '临控',
|
||||
'LKCL': '临控',
|
||||
'DQ': '被盗抢'
|
||||
}
|
||||
const PCRCBQ = {
|
||||
'ZTRY': '在逃',
|
||||
'XFDRY': '涉毒',
|
||||
'QKRY': '前科',
|
||||
'ZSRY': '肇事',
|
||||
'LKRY': '临控',
|
||||
'LKJDC': '临控',
|
||||
'BDQJDC': '被盗抢'
|
||||
}
|
||||
const ZLFWDM = {
|
||||
'1': '单人',
|
||||
'2': '多人',
|
||||
'3': '部门'
|
||||
}
|
||||
const ZLJBDM = {
|
||||
'01': '红色',
|
||||
'02': '橙色',
|
||||
'03': '黄色',
|
||||
'04': '蓝色'
|
||||
}
|
||||
const ZLANDYJBM = {
|
||||
'10': '红色',
|
||||
'15': '橙色',
|
||||
'20': '黄色',
|
||||
'30': '蓝色'
|
||||
}
|
||||
const ZLZTDM = {
|
||||
'01': '待签收',
|
||||
'02': '已签收',
|
||||
'03': '到达现场',
|
||||
'04': '已反馈',
|
||||
'05': '处置完成',
|
||||
'99': '归档'
|
||||
}
|
||||
const LOGINTYPE={
|
||||
'0':'电脑',
|
||||
'1':'手机'
|
||||
}
|
||||
|
||||
|
||||
const JQZTDM = {
|
||||
'01': '未处理',
|
||||
'02': '已处理'
|
||||
}
|
||||
const ZLYXQDM = {
|
||||
'01': '一分钟',
|
||||
'02': '五分钟',
|
||||
'03': '十分钟',
|
||||
'04': '三十分钟',
|
||||
'05': '一小时',
|
||||
'06': '当天',
|
||||
'99': '指定结束时间'
|
||||
}
|
||||
|
||||
const ZQLXDM = {
|
||||
'03': '步巡',
|
||||
'04': '车巡',
|
||||
'05': '特殊报备'
|
||||
}
|
||||
|
||||
const D_BZ_XB = {
|
||||
"0":"未知的性别","1":"男","2":"女","9":"未说明的性别"
|
||||
}
|
||||
|
||||
const XLDM = {"11":"博士","14":"硕士","17":"研究生","20":"本科","30":"专科","40":"中职","60":"普通高中","70":"初中","80":"小学","90":"其他"}
|
||||
const HYZKDM = {"10":"未婚","20":"已婚","30":"丧偶","40":"离婚","90":"未说明的婚姻状况"}
|
||||
const ZZMMDM = {"01":"中共党员","02":"中共预备党员","03":"共青团员","12":"无党派民主人士","13":"群众"}
|
||||
const XLMJ_JWYWZJBDM = {"1000":"武装警察","1101":"上将","1102":"中将","1103":"少将","1201":"大校","1202":"上校","1203":"中校","1204":"少校","1301":"上尉","1302":"中尉","1303":"少尉","1411":"文职特级","1412":"文职1级","1413":"文职2级","1421":"文职3级","1422":"文职4级","1423":"文职5级","1424":"文职6级","1431":"文职7级","1432":"文职8级","1433":"文职9级","1501":"一级警士长","1502":"二级警士长","1503":"三级警士长","1514":"四级警士长","1515":"上士","1526":"中士","1527":"下士","1602":"专业技术中将","1603":"专业技术少将","1611":"专业技术大校","1612":"专业技术上校","1613":"专业技术中校","1614":"专业技术少校","1621":"专业技术上尉","1622":"专业技术中尉","1623":"专业技术少尉","1710":"上等兵","1720":"列兵","1880":"学员","1990":"未授武装警察警衔","1999":"其他","2000":"人民警察","2011":"总警监","2012":"副总警监","2101":"一级警监","2102":"二级警监","2103":"三级警监","2201":"一级警督","2202":"二级警督","2203":"三级警督","2301":"一级警司","2302":"二级警司","2303":"三级警司","2401":"一级警员","2402":"二级警员","2601":"专业技术一级警监","2602":"专业技术二级警监","2603":"专业技术三级警监","2701":"专业技术一级警督","2702":"专业技术二级警督","2703":"专业技术三级警督","2801":"专业技术一级警司","2802":"专业技术二级警司","2803":"专业技术三级警司","2901":"专业技术一级警员","2997":"见习人民警察","2998":"警察院校学员","2999":"其他"}
|
||||
|
||||
const D_BZ_MZ={"01":"汉族","02":"蒙古族","03":"回族","04":"藏族","05":"维吾尔族","06":"苗族","07":"彝族","08":"壮族","09":"布依族","10":"朝鲜族","11":"满族","12":"侗族","13":"瑶族","14":"白族","15":"土家族","16":"哈尼族","17":"哈萨克族","18":"傣族","19":"黎族","20":"傈僳族","21":"佤族","22":"畲族","23":"高山族","24":"拉祜族","25":"水族","26":"东乡族","27":"纳西族","28":"景颇族","29":"柯尔克孜族","30":"土族","31":"达斡尔族","32":"仫佬族","33":"羌族","34":"布朗族","35":"撒拉族","36":"毛南族","37":"仡佬族","38":"锡伯族","39":"阿昌族","40":"普米族","41":"塔吉克族","42":"怒族","43":"乌孜别克族","44":"俄罗斯族","45":"鄂温克族","46":"德昂族","47":"保安族","48":"裕固族","49":"京族","50":"塔塔尔族","51":"独龙族","52":"鄂伦春族","53":"赫哲族","54":"门巴族","55":"珞巴族","56":"基诺族","57":"其他","58":"外国血统"};
|
||||
|
||||
const CLLXDM = {
|
||||
'01': '警车机动车',
|
||||
'02': '警用摩托车',
|
||||
'03': '电动巡逻车',
|
||||
'04': '自行车',
|
||||
'05': '助力车',
|
||||
'06': '装甲车',
|
||||
'99': '其他'
|
||||
}
|
||||
const CLZTDM = {
|
||||
'1': '正常',
|
||||
'2': '维修',
|
||||
'3': '报废',
|
||||
'4': '其他'
|
||||
}
|
||||
const CLPPDM={
|
||||
"000":"其他",
|
||||
"001":"大众",
|
||||
"002":"别克",
|
||||
"003":"宝马",
|
||||
"004":"本田",
|
||||
"005":"标致",
|
||||
"006":"丰田",
|
||||
"007":"福特",
|
||||
"008":"日产",
|
||||
"009":"奥迪",
|
||||
"010":"马自达",
|
||||
"011":"雪佛兰",
|
||||
"012":"雪铁龙",
|
||||
"013":"现代",
|
||||
"014":"奇瑞",
|
||||
"015":"起亚",
|
||||
"016":"荣威",
|
||||
"017":"三菱",
|
||||
"018":"斯柯达",
|
||||
"019":"吉利",
|
||||
"020":"中华",
|
||||
"021":"沃尔沃",
|
||||
"022":"雷克萨斯",
|
||||
"023":"菲亚特",
|
||||
"024":"吉利帝豪",
|
||||
"025":"东风",
|
||||
"026":"比亚迪",
|
||||
"027":"铃木",
|
||||
"028":"金杯",
|
||||
"029":"海马",
|
||||
"030":"五菱",
|
||||
"031":"江淮",
|
||||
"032":"斯巴鲁",
|
||||
"033":"英伦",
|
||||
"034":"长城",
|
||||
"035":"哈飞",
|
||||
"036":"庆铃(五十铃)",
|
||||
"037":"东南",
|
||||
"038":"长安",
|
||||
"039":"福田",
|
||||
"040":"夏利",
|
||||
"041":"奔驰",
|
||||
"042":"一汽",
|
||||
"043":"依维柯",
|
||||
"044":"力帆",
|
||||
"045":"一汽奔腾",
|
||||
"046":"皇冠",
|
||||
"047":"雷诺",
|
||||
"048":"JMC",
|
||||
"049":"MG名爵",
|
||||
"050":"凯马",
|
||||
"051":"众泰",
|
||||
"052":"昌河",
|
||||
"053":"厦门金龙",
|
||||
"054":"上海汇众",
|
||||
"055":"苏州金龙",
|
||||
"056":"海格",
|
||||
"057":"宇通",
|
||||
"058":"中国重汽",
|
||||
"059":"北奔重卡",
|
||||
"060":"华菱星马汽车",
|
||||
"061":"跃进汽车",
|
||||
"062":"黄海汽车",
|
||||
"065":"保时捷",
|
||||
"066":"凯迪拉克",
|
||||
"067":"英菲尼迪",
|
||||
"068":"吉利全球鹰",
|
||||
"069":"吉普",
|
||||
"070":"路虎",
|
||||
"071":"长丰猎豹",
|
||||
"073":"时代汽车",
|
||||
"075":"长安轿车",
|
||||
"076":"陕汽重卡",
|
||||
"081":"安凯",
|
||||
"082":"申龙",
|
||||
"083":"大宇",
|
||||
"086":"中通",
|
||||
"087":"宝骏",
|
||||
"088":"北汽威旺",
|
||||
"089":"广汽传祺",
|
||||
"090":"陆风",
|
||||
"092":"北京",
|
||||
"094":"威麟",
|
||||
"095":"欧宝",
|
||||
"096":"开瑞",
|
||||
"097":"华普",
|
||||
"103":"讴歌",
|
||||
"104":"启辰",
|
||||
"107":"北汽制造",
|
||||
"108":"纳智捷",
|
||||
"109":"野马",
|
||||
"110":"中兴",
|
||||
"112":"克莱斯勒",
|
||||
"113":"广汽吉奥",
|
||||
"115":"瑞麟",
|
||||
"117":"捷豹",
|
||||
"119":"唐骏欧铃",
|
||||
"121":"福迪",
|
||||
"122":"莲花",
|
||||
"124":"双环",
|
||||
"128":"永源",
|
||||
"136":"江南",
|
||||
"144":"道奇",
|
||||
"155":"大运汽车",
|
||||
"167":"北方客车",
|
||||
"176":"九龙",
|
||||
"191":"宾利",
|
||||
"201":"舒驰客车",
|
||||
"230":"红旗"
|
||||
}
|
||||
|
||||
/*收缴物品*/
|
||||
const WPLXDM = {
|
||||
"01":"工具类",
|
||||
"02":"交通工具类",
|
||||
"03":"毒物类",
|
||||
"04":"爆炸物品",
|
||||
"05":"工艺首饰及文物",
|
||||
"06":"家用电器",
|
||||
"07":"仪器仪表及计量器材",
|
||||
"08":"农副渔牧产品及野生动物",
|
||||
"09":"食品烟酒",
|
||||
"10":"纺织物品",
|
||||
"11":"服装鞋帽及穿戴品",
|
||||
"12":"文教体育娱乐及办公用品",
|
||||
"13":"家具及日用杂品",
|
||||
"14":"通用设备电工及照明器材类",
|
||||
"15":"橡胶塑料制品",
|
||||
"16":"建筑装潢及金属材料",
|
||||
"17":"石油化工产品",
|
||||
"18":"医疗及医疗器械",
|
||||
"19":"毒品类",
|
||||
"20":"淫秽物品",
|
||||
"21":"计算机设备及产品",
|
||||
"22":"通信设备",
|
||||
"99":"其他"
|
||||
}
|
||||
const YALXDM = {
|
||||
"01":"维护稳定",
|
||||
"02":"诈骗",
|
||||
"03":"刑事治安",
|
||||
"04":"爆炸",
|
||||
"05":"纵火",
|
||||
"06":"劫持",
|
||||
|
||||
}
|
||||
const XLRYLBDM1 = {
|
||||
'01': '巡警',
|
||||
'02': '特警',
|
||||
'04': '派出所民警',
|
||||
'05': '交警',
|
||||
}
|
||||
const JSLX = {}
|
||||
export default {
|
||||
JWZLXDM,
|
||||
XZQHDM,
|
||||
GAJGJGDM,
|
||||
XQFWLX,
|
||||
XQLXDM,
|
||||
BQMC,
|
||||
PCCLJG,
|
||||
XLZBLXDM,
|
||||
ZBZTDM,
|
||||
ZLLYDM,
|
||||
ZLLXDM,
|
||||
ZLGZYYJLX,
|
||||
ZLYJRCBQ,
|
||||
ZLYJRCBQDM,
|
||||
PCRCBQ,
|
||||
ZLFWDM,
|
||||
ZLJBDM,
|
||||
ZLZTDM,
|
||||
JQZTDM,
|
||||
ZLYXQDM,
|
||||
D_BZ_XB,
|
||||
D_BZ_MZ,
|
||||
ZQLXDM,
|
||||
XLRYLBDM,
|
||||
CLLXDM,
|
||||
CLZTDM,
|
||||
CLPPDM,
|
||||
WPLXDM,
|
||||
XLDM,
|
||||
HYZKDM,
|
||||
ZZMMDM,
|
||||
XLMJ_JWYWZJBDM,
|
||||
LOGINTYPE,
|
||||
YALXDM,
|
||||
XLRYLBDM1,
|
||||
JSLX,
|
||||
ZLANDYJBM
|
||||
}
|
||||
5
src/plugins/utils/directive.js
Normal file
@ -0,0 +1,5 @@
|
||||
import elTableInfiniteScroll from 'el-table-infinite-scroll';
|
||||
|
||||
export default function directive(app) {
|
||||
app.directive('elTableInfiniteScroll', elTableInfiniteScroll);
|
||||
}
|
||||
23
src/plugins/utils/document.js
Normal file
@ -0,0 +1,23 @@
|
||||
import axios from 'axios';
|
||||
const baseUrl = "/daglApi";
|
||||
|
||||
export function getInfoPost(url, data = {}, token, fun) {
|
||||
axios.post(`${baseUrl}${url}`, data, {
|
||||
headers: {
|
||||
"founder.authorization": `bearer ${token}`,
|
||||
}
|
||||
}).then(res => {
|
||||
fun(res.data)
|
||||
})
|
||||
}
|
||||
|
||||
export function getInfo(url, params = {}, token, fun) {
|
||||
axios.get(`${baseUrl}${url}`, {
|
||||
params,
|
||||
headers: {
|
||||
"founder.authorization": `bearer ${token}`,
|
||||
},
|
||||
}).then(res => {
|
||||
fun(res.data)
|
||||
})
|
||||
}
|
||||
5
src/plugins/utils/eventBus.js
Normal file
@ -0,0 +1,5 @@
|
||||
import mitt from 'mitt'
|
||||
|
||||
const emitter = mitt();
|
||||
|
||||
export default emitter
|
||||
603
src/plugins/utils/index.js
Normal file
@ -0,0 +1,603 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Created by PanJiaChen on 16/11/18.
|
||||
*/
|
||||
|
||||
// import defaultSettings from '@/settings'
|
||||
import dictData from './dicts'
|
||||
/**
|
||||
* Parse the time to string
|
||||
* @param {(Object|string|number)} time
|
||||
* @param {string} cFormat
|
||||
* @returns {string | null}
|
||||
*/
|
||||
export function parseTime(time, cFormat) {
|
||||
if (arguments.length === 0) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
const value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') {
|
||||
return ['日', '一', '二', '三', '四', '五', '六'][value]
|
||||
}
|
||||
return value.toString().padStart(2, '0')
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} time
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
export function formatTime(time, option) {
|
||||
if (('' + time).length === 10) {
|
||||
time = parseInt(time) * 1000
|
||||
} else {
|
||||
time = +time
|
||||
}
|
||||
const d = new Date(time)
|
||||
const now = Date.now()
|
||||
|
||||
const diff = (now - d) / 1000
|
||||
|
||||
if (diff < 30) {
|
||||
return '刚刚'
|
||||
} else if (diff < 3600) {
|
||||
// less 1 hour
|
||||
return Math.ceil(diff / 60) + '分钟前'
|
||||
} else if (diff < 3600 * 24) {
|
||||
return Math.ceil(diff / 3600) + '小时前'
|
||||
} else if (diff < 3600 * 24 * 2) {
|
||||
return '1天前'
|
||||
}
|
||||
if (option) {
|
||||
return parseTime(time, option)
|
||||
} else {
|
||||
return (
|
||||
d.getMonth() +
|
||||
1 +
|
||||
'月' +
|
||||
d.getDate() +
|
||||
'日' +
|
||||
d.getHours() +
|
||||
'时' +
|
||||
d.getMinutes() +
|
||||
'分'
|
||||
)
|
||||
}
|
||||
}
|
||||
// 毫秒转时长
|
||||
export function formatDuring(mss) {
|
||||
var days = parseInt(mss / (1000 * 60 * 60 * 24));
|
||||
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
|
||||
var seconds = (mss % (1000 * 60)) / 1000;
|
||||
if (days) {
|
||||
return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
|
||||
} else if (hours) {
|
||||
return hours + "小时" + minutes + "分钟" + seconds + "秒";
|
||||
} else if (minutes) {
|
||||
return minutes + "分钟" + seconds + "秒";
|
||||
} else {
|
||||
return seconds + "秒";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function getQueryObject(url) {
|
||||
url = url == null ? window.location.href : url
|
||||
const search = url.substring(url.lastIndexOf('?') + 1)
|
||||
const obj = {}
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g
|
||||
search.replace(reg, (rs, $1, $2) => {
|
||||
const name = decodeURIComponent($1)
|
||||
let val = decodeURIComponent($2)
|
||||
val = String(val)
|
||||
obj[name] = val
|
||||
return rs
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} input value
|
||||
* @returns {number} output value
|
||||
*/
|
||||
export function byteLength(str) {
|
||||
// returns the byte length of an utf8 string
|
||||
let s = str.length
|
||||
for (var i = str.length - 1; i >= 0; i--) {
|
||||
const code = str.charCodeAt(i)
|
||||
if (code > 0x7f && code <= 0x7ff) s++
|
||||
else if (code > 0x7ff && code <= 0xffff) s += 2
|
||||
if (code >= 0xDC00 && code <= 0xDFFF) i--
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} actual
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function cleanArray(actual) {
|
||||
const newArray = []
|
||||
for (let i = 0; i < actual.length; i++) {
|
||||
if (actual[i]) {
|
||||
newArray.push(actual[i])
|
||||
}
|
||||
}
|
||||
return newArray
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} json
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function param(json) {
|
||||
if (!json) return ''
|
||||
return cleanArray(
|
||||
Object.keys(json).map(key => {
|
||||
if (json[key] === undefined) return ''
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
|
||||
})
|
||||
).join('&')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function param2Obj(url) {
|
||||
const search = url.split('?')[1]
|
||||
if (!search) {
|
||||
return {}
|
||||
}
|
||||
return JSON.parse(
|
||||
'{"' +
|
||||
decodeURIComponent(search)
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/&/g, '","')
|
||||
.replace(/=/g, '":"')
|
||||
.replace(/\+/g, ' ') +
|
||||
'"}'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} val
|
||||
* @returns {string}
|
||||
*/
|
||||
export function html2Text(val) {
|
||||
const div = document.createElement('div')
|
||||
div.innerHTML = val
|
||||
return div.textContent || div.innerText
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two objects, giving the last one precedence
|
||||
* @param {Object} target
|
||||
* @param {(Object|Array)} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function objectMerge(target, source) {
|
||||
if (typeof target !== 'object') {
|
||||
target = {}
|
||||
}
|
||||
if (Array.isArray(source)) {
|
||||
return source.slice()
|
||||
}
|
||||
Object.keys(source).forEach(property => {
|
||||
const sourceProperty = source[property]
|
||||
if (typeof sourceProperty === 'object') {
|
||||
target[property] = objectMerge(target[property], sourceProperty)
|
||||
} else {
|
||||
target[property] = sourceProperty
|
||||
}
|
||||
})
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} element
|
||||
* @param {string} className
|
||||
*/
|
||||
export function toggleClass(element, className) {
|
||||
if (!element || !className) {
|
||||
return
|
||||
}
|
||||
let classString = element.className
|
||||
const nameIndex = classString.indexOf(className)
|
||||
if (nameIndex === -1) {
|
||||
classString += '' + className
|
||||
} else {
|
||||
classString =
|
||||
classString.substr(0, nameIndex) +
|
||||
classString.substr(nameIndex + className.length)
|
||||
}
|
||||
element.className = classString
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @returns {Date}
|
||||
*/
|
||||
export function getTime(type) {
|
||||
if (type === 'start') {
|
||||
return new Date().getTime() - 3600 * 1000 * 24 * 90
|
||||
} else {
|
||||
return new Date(new Date().toDateString())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} func
|
||||
* @param {number} wait
|
||||
* @param {boolean} immediate
|
||||
* @return {*}
|
||||
*/
|
||||
export function debounce(func, wait, immediate) {
|
||||
let timeout, args, context, timestamp, result
|
||||
|
||||
const later = function () {
|
||||
// 据上一次触发时间间隔
|
||||
const last = +new Date() - timestamp
|
||||
|
||||
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
|
||||
if (last < wait && last > 0) {
|
||||
timeout = setTimeout(later, wait - last)
|
||||
} else {
|
||||
timeout = null
|
||||
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args)
|
||||
if (!timeout) context = args = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return function (...args) {
|
||||
context = this
|
||||
timestamp = +new Date()
|
||||
const callNow = immediate && !timeout
|
||||
// 如果延时不存在,重新设定延时
|
||||
if (!timeout) timeout = setTimeout(later, wait)
|
||||
if (callNow) {
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just a simple version of deep copy
|
||||
* Has a lot of edge cases bug
|
||||
* If you want to use a perfect deep copy, use lodash's _.cloneDeep
|
||||
* @param {Object} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function deepClone(source) {
|
||||
if (!source && typeof source !== 'object') {
|
||||
throw new Error('error arguments', 'deepClone')
|
||||
}
|
||||
const targetObj = source.constructor === Array ? [] : {}
|
||||
Object.keys(source).forEach(keys => {
|
||||
if (source[keys] && typeof source[keys] === 'object') {
|
||||
targetObj[keys] = deepClone(source[keys])
|
||||
} else {
|
||||
targetObj[keys] = source[keys]
|
||||
}
|
||||
})
|
||||
return targetObj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} arr
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function uniqueArr(arr) {
|
||||
return Array.from(new Set(arr))
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
export function createUniqueString() {
|
||||
const timestamp = +new Date() + ''
|
||||
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
|
||||
return (+(randomNum + timestamp)).toString(32)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an element has a class
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function hasClass(ele, cls) {
|
||||
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class to element
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
*/
|
||||
export function addClass(ele, cls) {
|
||||
if (!hasClass(ele, cls)) ele.className += ' ' + cls
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove class from element
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
*/
|
||||
export function removeClass(ele, cls) {
|
||||
if (hasClass(ele, cls)) {
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
|
||||
ele.className = ele.className.replace(reg, ' ')
|
||||
}
|
||||
}
|
||||
|
||||
// 拖动
|
||||
/**
|
||||
* 拖动div
|
||||
* @param event // mouse event
|
||||
* @param {HTMLElement} selectElement
|
||||
*/
|
||||
export function dargMove(event, selectElement) {
|
||||
var div1 = selectElement
|
||||
selectElement.style.cursor = 'move'
|
||||
// this.isDowm = true
|
||||
var distanceX = event.clientX - selectElement.offsetLeft
|
||||
var distanceY = event.clientY - selectElement.offsetTop
|
||||
document.onmousemove = function (ev) {
|
||||
var oevent = ev || event
|
||||
div1.style.left = oevent.clientX - distanceX + 'px'
|
||||
div1.style.top = oevent.clientY - distanceY + 'px'
|
||||
}
|
||||
document.onmouseup = function () {
|
||||
document.onmousemove = null
|
||||
document.onmouseup = null
|
||||
div1.style.cursor = 'default'
|
||||
}
|
||||
}
|
||||
|
||||
/* 时间戳 转换为 指定格式的日期字符串,默认格式yyyy-mm-dd hh:mi:ss */
|
||||
export function timestampToStr(timestamp, format) {
|
||||
var dateStr = ''
|
||||
// timestamp 为空
|
||||
if (timestamp === null || timestamp === '') {
|
||||
timestamp = new Date().getTime()
|
||||
}
|
||||
// timestamp string类型
|
||||
if (typeof timestamp === 'string') {
|
||||
timestamp = new Date(timestamp.replace(/-/g, '/')).getTime()
|
||||
}
|
||||
var d = new Date(Number(timestamp))
|
||||
var year = d.getFullYear()
|
||||
var month = (d.getMonth() + 1) < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1
|
||||
var date = d.getDate() < 10 ? '0' + (d.getDate()) : d.getDate()
|
||||
var hours = d.getHours() < 10 ? '0' + (d.getHours()) : d.getHours()
|
||||
var minutes = d.getMinutes() < 10 ? '0' + (d.getMinutes()) : d.getMinutes()
|
||||
var seconds = d.getSeconds() < 10 ? '0' + (d.getSeconds()) : d.getSeconds()
|
||||
|
||||
if (format === '' || format === null || format === undefined) {
|
||||
dateStr = year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds
|
||||
}
|
||||
|
||||
if (format === 'yyyy') {
|
||||
dateStr = year
|
||||
} else if (format === 'yyyy-mm') {
|
||||
dateStr = year + '-' + month
|
||||
} else if (format === 'yyyy-mm-dd') {
|
||||
dateStr = year + '-' + month + '-' + date
|
||||
} else if (format === 'mm-dd') {
|
||||
dateStr = month + '-' + date
|
||||
} else if (format === 'hh') {
|
||||
dateStr = hours
|
||||
} else if (format === 'hh:mi') {
|
||||
dateStr = hours + ':' + minutes
|
||||
} else if (format === 'hh:mi:ss') {
|
||||
dateStr = hours + ':' + minutes + ':' + seconds
|
||||
} else if (format === 'yyyy-mm-dd hh:mi') {
|
||||
dateStr = year + '-' + month + '-' + date + ' ' + hours + ':' + minutes
|
||||
} else if (format === 'yyyy-mm-dd hh:mi:ss') {
|
||||
dateStr = year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds
|
||||
} else if (format === 'mm-dd hh:mi') {
|
||||
dateStr = month + '-' + date + ' ' + hours + ':' + minutes
|
||||
}
|
||||
return dateStr
|
||||
}
|
||||
|
||||
export function objectToFormData(obj, form, namespace) {
|
||||
let fd = form || new FormData()
|
||||
let formKey
|
||||
if (obj instanceof Array) {
|
||||
for (let item of obj) {
|
||||
if (typeof item === 'object' && !(item instanceof File)) {
|
||||
this.objectToFormData(item, fd, namespace + '[]')
|
||||
} else {
|
||||
// 若是数组则在关键字后面加上[]
|
||||
fd.append(namespace + '[]', item)
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
for (let property in obj) {
|
||||
if (obj.hasOwnProperty(property) && obj[property]) {
|
||||
|
||||
if (namespace) {
|
||||
// 若是对象,则这样
|
||||
formKey = namespace + '[' + property + ']'
|
||||
} else {
|
||||
formKey = property
|
||||
}
|
||||
|
||||
// if the property is an object, but not a File,
|
||||
// use recursivity.
|
||||
if (typeof obj[property] === 'object' && !(obj[property] instanceof File)) {
|
||||
// 此处将formKey递归下去很重要,因为数据结构会出现嵌套的情况
|
||||
this.objectToFormData(obj[property], fd, formKey)
|
||||
} else {
|
||||
|
||||
// if it's a string or a File object
|
||||
fd.append(formKey, obj[property])
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return fd
|
||||
}
|
||||
|
||||
export function getNextDate(startDate, nextType, nextStep) {
|
||||
var dateStr = "";
|
||||
//startDate string类型
|
||||
if (typeof startDate == 'string') {
|
||||
startDate = new Date(startDate);
|
||||
}
|
||||
|
||||
if (nextType == 'Y') {
|
||||
startDate.setFullYear(startDate.getFullYear() + Number(nextStep));
|
||||
} else if (nextType == 'M') {
|
||||
startDate.setMonth(startDate.getMonth() + Number(nextStep));
|
||||
} else if (nextType == 'D') {
|
||||
startDate.setDate(startDate.getDate() + Number(nextStep));
|
||||
} else if (nextType == 'H') {
|
||||
startDate.setHours(startDate.getHours() + Number(nextStep));
|
||||
} else if (nextType == 'm') {
|
||||
startDate.setMinutes(startDate.getMinutes() + Number(nextStep));
|
||||
} else if (nextType == 'S') {
|
||||
startDate.setSeconds(startDate.getSeconds() + Number(nextStep));
|
||||
}
|
||||
var year = startDate.getFullYear();
|
||||
var month = (startDate.getMonth() + 1) < 10 ? "0" + (startDate.getMonth() + 1) : startDate.getMonth() + 1;
|
||||
var date = startDate.getDate() < 10 ? "0" + (startDate.getDate()) : startDate.getDate();
|
||||
var hours = startDate.getHours() < 10 ? "0" + (startDate.getHours()) : startDate.getHours();
|
||||
var minutes = startDate.getMinutes() < 10 ? "0" + (startDate.getMinutes()) : startDate.getMinutes();
|
||||
var seconds = startDate.getSeconds() < 10 ? "0" + (startDate.getSeconds()) : startDate.getSeconds();
|
||||
|
||||
dateStr = year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds;
|
||||
|
||||
return dateStr;
|
||||
|
||||
}
|
||||
//大数据综合档案
|
||||
export function getZhdaList(data, type) {
|
||||
// if (type === 'RY') window.open(`${defaultSettings.zhdanRd_URL}/${data}`);
|
||||
// if (type === 'CL') window.open(`${defaultSettings.zhdanCd_URL}/${data}`);
|
||||
}
|
||||
|
||||
|
||||
// 加载本地字典格式化
|
||||
export function fromartBqDict(dict, key,yjlyjb) {
|
||||
let html = ''
|
||||
for (const x in dictData[dict]) {
|
||||
if (x === key) {
|
||||
if (dict === 'ZLYJRCBQ') {
|
||||
if (x === '01' || x === '05' || x === '80') {
|
||||
html = `<span class="list-tips tips-zl bg-red">${dictData[dict][x]}</span>`
|
||||
} else {
|
||||
|
||||
let color = "";
|
||||
if (yjlyjb== "10") {
|
||||
color = "bg-red";
|
||||
} else if (yjlyjb == "15") {
|
||||
color = "bg-org";
|
||||
} else if (yjlyjb == "20") {
|
||||
color = "bg-yellow";
|
||||
} else if (yjlyjb == "30") {
|
||||
color = "bg-blue1";
|
||||
} else {
|
||||
color = "bg-yellow";
|
||||
}
|
||||
|
||||
html = `<span class="list-tips tips-zl `+color+`">${dictData[dict][x]}</span>`
|
||||
}
|
||||
} else if (dict === 'ZLYJRCBQDM') {
|
||||
if (x === 'ZT' || x === 'LKRY' || x === 'LKCL' || x === 'DQ') {
|
||||
html = `<span class="list-tips tips-zl bg-red">${dictData[dict][x]}</span>`
|
||||
} else {
|
||||
html = `<span class="list-tips tips-zl bg-yellow">${dictData[dict][x]}</span>`
|
||||
}
|
||||
} else if (dict === 'ZLZTDM') {
|
||||
switch (x) {
|
||||
case '01':
|
||||
html = `<span class="bold blue">${dictData[dict][x]}</span>`
|
||||
break
|
||||
case '02':
|
||||
html = `<span class="bold blue">${dictData[dict][x]}</span>`
|
||||
break
|
||||
case '03':
|
||||
html = `<span class="bold blue">${dictData[dict][x]}</span>`
|
||||
break
|
||||
case '04':
|
||||
html = `<span class="bold blue">${dictData[dict][x]}</span>`
|
||||
break
|
||||
case '05':
|
||||
html = `<span class="bold green">${dictData[dict][x]}</span>`
|
||||
break
|
||||
case '99':
|
||||
html = `<span class="bold gray">${dictData[dict][x]}</span>`
|
||||
break
|
||||
default:
|
||||
html = `<span class="bold white">${dictData[dict][x]}</span>`
|
||||
break
|
||||
}
|
||||
} else if (dict === 'JQZTDM') {
|
||||
switch (x) {
|
||||
case '01':
|
||||
html = `<span class="bold red">${dictData[dict][x]}</span>`
|
||||
break
|
||||
case '02':
|
||||
html = `<span class="bold green">${dictData[dict][x]}</span>`
|
||||
break
|
||||
default:
|
||||
html = `<span class="bold green">${dictData[dict][x]}</span>`
|
||||
break
|
||||
}
|
||||
} else {
|
||||
html = dictData[dict][x]
|
||||
}
|
||||
return html
|
||||
}
|
||||
}
|
||||
}
|
||||
// 格式化地址
|
||||
export function fromartAdress(str) {
|
||||
if (!str) return ''
|
||||
if (str === '四川省泸州市公安局') return '市公安局'
|
||||
let s = str.replace(/四川省/g, '')
|
||||
s = s.replace(/泸州市公安局/g, '... ')
|
||||
s = s.replace(/泸州市/g, '... ')
|
||||
return s
|
||||
}
|
||||
34
src/plugins/utils/lazyLoad.js
Normal file
@ -0,0 +1,34 @@
|
||||
import {
|
||||
getScrollContainer
|
||||
} from "element-plus/lib/utils";
|
||||
|
||||
/**
|
||||
* 自定义懒加载指令
|
||||
*/
|
||||
export default {
|
||||
name:'InfiniteScroll',
|
||||
inserted(el,binding,vnode){
|
||||
//绑定回调函数
|
||||
const cb = binding.value;
|
||||
//当前组件实例引用
|
||||
const vm = vnode.context;
|
||||
const container = getScrollContainer(el,true);
|
||||
const {delay,immediate} =getScrollOptions(el,vm);
|
||||
const onScroll = throttle(delay,handleScroll.bind(el,cb));
|
||||
el[scope] = {el,vm,container ,onScroll};
|
||||
if(container){
|
||||
container.addEventListener('scroll',onScroll);
|
||||
if(immediate){
|
||||
const observer = el[scope].observer = new MutationObserver(onScroll);
|
||||
observer.observe(container,{childList:true,subtree:true});
|
||||
onScroll()
|
||||
}
|
||||
}
|
||||
},
|
||||
unbind(el){
|
||||
const {container,onScroll} = el[scope];
|
||||
if(container){
|
||||
container.removeEventListener('scrrll',onScroll)
|
||||
}
|
||||
}
|
||||
}
|
||||
52
src/plugins/utils/ocrUtils.js
Normal file
@ -0,0 +1,52 @@
|
||||
// utils文件夹下创建 ocrUtils.js
|
||||
export function drawBox(points, imgElement, canvasOutput) {
|
||||
canvasOutput.width = imgElement.width
|
||||
canvasOutput.height = imgElement.height
|
||||
const ratio = imgElement.naturalHeight / imgElement.height
|
||||
|
||||
const ctx = canvasOutput.getContext('2d')
|
||||
ctx.drawImage(imgElement, 0, 0, canvasOutput.width, canvasOutput.height)
|
||||
points.forEach((point) => {
|
||||
// 开始一个新的绘制路径
|
||||
ctx.beginPath()
|
||||
// 设置线条颜色为红色
|
||||
ctx.strokeStyle = 'red'
|
||||
// 设置路径起点坐标
|
||||
ctx.moveTo(point[0][0] / ratio, point[0][1] / ratio)
|
||||
ctx.lineTo(point[1][0] / ratio, point[1][1] / ratio)
|
||||
ctx.lineTo(point[2][0] / ratio, point[2][1] / ratio)
|
||||
ctx.lineTo(point[3][0] / ratio, point[3][1] / ratio)
|
||||
ctx.closePath()
|
||||
ctx.stroke()
|
||||
})
|
||||
}
|
||||
|
||||
export function drawText(text, points, imgElement, canvasOutput) {
|
||||
canvasOutput.width = imgElement.width
|
||||
canvasOutput.height = imgElement.height
|
||||
const ratio = imgElement.naturalHeight / imgElement.height
|
||||
|
||||
const ctx = canvasOutput.getContext('2d')
|
||||
points.forEach((point, index) => {
|
||||
// 开始一个新的绘制路径
|
||||
ctx.beginPath()
|
||||
// 设置线条颜色为红色
|
||||
ctx.strokeStyle = 'red'
|
||||
// 设置路径起点坐标
|
||||
ctx.moveTo(point[0][0] / ratio, point[0][1] / ratio)
|
||||
ctx.lineTo(point[1][0] / ratio, point[1][1] / ratio)
|
||||
ctx.lineTo(point[2][0] / ratio, point[2][1] / ratio)
|
||||
ctx.lineTo(point[3][0] / ratio, point[3][1] / ratio)
|
||||
ctx.closePath()
|
||||
ctx.stroke()
|
||||
|
||||
ctx.font = '30px 黑体'
|
||||
ctx.fillText(
|
||||
text[index],
|
||||
point[3][0] / ratio,
|
||||
point[3][1] / ratio,
|
||||
point[1][0] / ratio - point[0][0] / ratio
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
9
src/plugins/utils/otherRequest.js
Normal file
@ -0,0 +1,9 @@
|
||||
import axios from 'axios';
|
||||
import store from '@/store';
|
||||
import {ElMessage} from 'element-plus';
|
||||
const service = axios.create({
|
||||
baseURL: '',
|
||||
timeout: 100000
|
||||
});
|
||||
|
||||
export default service;
|
||||
100
src/plugins/utils/request.js
Normal file
@ -0,0 +1,100 @@
|
||||
import axios from 'axios';
|
||||
import store from '@/store';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { isCheckTimeout } from '@/utils/auth';
|
||||
import { saveAs } from 'file-saver'
|
||||
import { tansParams, blobValidate } from "@/utils/ruoyi";
|
||||
let downloadLoadingInstance;
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
withCredentials: true,
|
||||
timeout: 100000,
|
||||
});
|
||||
|
||||
// 1.请求拦截器
|
||||
service.interceptors.request.use(
|
||||
(config) => {
|
||||
// 请求接口之前 做些什么
|
||||
//1.统一注入token
|
||||
if (store.getters.token) {
|
||||
if (isCheckTimeout()) {
|
||||
//超时 执行退出
|
||||
store.dispatch('user/logout');
|
||||
return Promise.reject(new Error('token 失效'));
|
||||
}
|
||||
if (!config.url.startsWith("/jcApi")) {
|
||||
config.headers.Authorization = `${store.getters.token}`;
|
||||
}
|
||||
|
||||
}
|
||||
//2.设置headers icode
|
||||
// config.headers.code = '';
|
||||
// 必须返回 config
|
||||
return config;
|
||||
},
|
||||
(error) => {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
// 2.响应拦截器
|
||||
service.interceptors.response.use(
|
||||
// 请求成功的处理
|
||||
(response) => {
|
||||
const { success, code, msg, message, data, model } = response.data;
|
||||
// 需要判断当前请求是否成功
|
||||
if (success && code === 10000) {
|
||||
return data ? data : response.data; // 成功后返回解析后的数据
|
||||
} else if (code === 200 || code == "00000" || code == "10000" || msg == 'success' || model) {
|
||||
return data ? data : response.data; // // 成功后返回解析后的数据
|
||||
} else if (code === 401) {
|
||||
store.dispatch('user/logout');
|
||||
ElMessage.error(message); // 提示错误信息
|
||||
ElMessage({ message: message || msg, grouping: true, type: 'error' })
|
||||
} else {
|
||||
// 失败(请求成功 ,业务失败) 弹出消息提示
|
||||
ElMessage({ message: message || msg, grouping: true, type: 'error' })
|
||||
return Promise.reject(new Error(message + '数据格式错误'));
|
||||
}
|
||||
},
|
||||
// 请求失败处理
|
||||
(error) => {
|
||||
//token过期
|
||||
if (
|
||||
error.response &&
|
||||
error.response.data &&
|
||||
error.response.data.code === 401
|
||||
) {
|
||||
console.log("Xxxxx");
|
||||
|
||||
store.dispatch('user/logout');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
// 通用下载方法
|
||||
export function download(url, params, filename, config) {
|
||||
return service.post(url, params, {
|
||||
transformRequest: [(params) => { return tansParams(params) }],
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
responseType: 'blob',
|
||||
...config
|
||||
}).then(async (data) => {
|
||||
const isBlob = blobValidate(data);
|
||||
if (isBlob) {
|
||||
const blob = new Blob([data])
|
||||
saveAs(blob, filename)
|
||||
} else {
|
||||
const resText = await data.text();
|
||||
const rspObj = JSON.parse(resText);
|
||||
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||
ElMessage.error(errMsg);
|
||||
}
|
||||
}).catch((r) => {
|
||||
ElMessage.error('下载文件出现错误,请联系管理员!')
|
||||
})
|
||||
}
|
||||
|
||||
export default service;
|
||||
75
src/plugins/utils/route.js
Normal file
@ -0,0 +1,75 @@
|
||||
import path from "path";
|
||||
/*
|
||||
*获取所有的子集路由
|
||||
*/
|
||||
const getChildrenRoutes = (routes) => {
|
||||
const result = [];
|
||||
routes.forEach((route) => {
|
||||
if (route.children && route.children.length > 0) {
|
||||
result.push(...route.children);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
/*
|
||||
*处理脱离层级的路由
|
||||
*/
|
||||
export const filterRoutes = (routes) => {
|
||||
//获取到所有的子集路由
|
||||
const childrenRoutes = getChildrenRoutes(routes);
|
||||
//根据子集路由进行查重操作
|
||||
return routes.filter((route) => {
|
||||
//根据route在childrenRoutes中进行查重,把所有重复路由表 剔除
|
||||
return !childrenRoutes.find((childrenRoute) => {
|
||||
return childrenRoute.path === route.path;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function isNull(data) {
|
||||
if (!data) return true;
|
||||
if (JSON.stringify(data) === "{}") return true;
|
||||
if (JSON.stringify(data) === "[]") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
*根据routes(filterRoutes) 数据, 返回对应的menu规则数据
|
||||
*/
|
||||
export function generateMenus(routes, basePath = "") {
|
||||
const result = [];
|
||||
// 遍历路由表
|
||||
routes.forEach((item) => {
|
||||
// 不存在 children && 不存在 meta 直接 return
|
||||
if (isNull(item.meta) && isNull(item.children)) return;
|
||||
// 存在 children 不存在 meta,进入迭代
|
||||
if (isNull(item.meta) && !isNull(item.children)) {
|
||||
result.push(...generateMenus(item.children));
|
||||
return;
|
||||
}
|
||||
|
||||
// 合并 path 作为跳转路径
|
||||
const routePath = path.resolve(basePath, item.path);
|
||||
// 路由分离之后,存在同名父路由的情况,需要单独处理
|
||||
let route = result.find((item) => item.path === routePath);
|
||||
if (!route) {
|
||||
route = {
|
||||
...item,
|
||||
path: routePath,
|
||||
children: []
|
||||
};
|
||||
|
||||
// icon 与 title 必须全部存在
|
||||
if (route.meta.icon && route.meta.title) {
|
||||
// meta 存在生成 route 对象,放入 arr
|
||||
result.push(route);
|
||||
}
|
||||
}
|
||||
// 存在 children 进入迭代到children
|
||||
if (!isNull(item.children)) {
|
||||
route.children.push(...generateMenus(item.children, route.path));
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
310
src/plugins/utils/rules.js
Normal file
@ -0,0 +1,310 @@
|
||||
function isNull(data) {
|
||||
if (!data) return true;
|
||||
if (JSON.stringify(data) === "{}") return true;
|
||||
if (JSON.stringify(data) === "[]") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 1 . 手机校验 */
|
||||
const validatePhone = () => {
|
||||
return (rule, value, callback) => {
|
||||
if (!value) {
|
||||
} else {
|
||||
const reg = /^1[3|4|5|7|8][0-9]\d{8}$/;
|
||||
if (reg.test(value)) {
|
||||
callback();
|
||||
} else {
|
||||
return callback(new Error("请输入正确的手机号"));
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export const phoneRule = (rule,prop = 'phone') => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require, validator } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请输入手机号",
|
||||
trigger: "blur"
|
||||
});
|
||||
}
|
||||
if (validator) {
|
||||
result.push(
|
||||
{
|
||||
min: 11,
|
||||
message: "手机号格式不正确",
|
||||
trigger: "blur"
|
||||
},
|
||||
{
|
||||
trigger: "blur",
|
||||
validator: validatePhone()
|
||||
}
|
||||
);
|
||||
}
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
/* 手机校验end */
|
||||
|
||||
/* 2. 身份证校验 bengin */
|
||||
const validateIdentity = () => {
|
||||
return (rule, value, callback) => {
|
||||
if (!value) {
|
||||
// return callback(new Error('身份证号不能为空'));
|
||||
} else if (!/(^\d{15}$)|(^\d{17}(\d|X|x)$)/.test(value)) {
|
||||
callback(new Error("输入的身份证长度或格式错误"));
|
||||
}
|
||||
|
||||
//身份证城市
|
||||
var aCity = {
|
||||
11: "北京",
|
||||
12: "天津",
|
||||
13: "河北",
|
||||
14: "山西",
|
||||
15: "内蒙古",
|
||||
21: "辽宁",
|
||||
22: "吉林",
|
||||
23: "黑龙江",
|
||||
31: "上海",
|
||||
32: "江苏",
|
||||
33: "浙江",
|
||||
34: "安徽",
|
||||
35: "福建",
|
||||
36: "江西",
|
||||
37: "山东",
|
||||
41: "河南",
|
||||
42: "湖北",
|
||||
43: "湖南",
|
||||
44: "广东",
|
||||
45: "广西",
|
||||
46: "海南",
|
||||
50: "重庆",
|
||||
51: "四川",
|
||||
52: "贵州",
|
||||
53: "云南",
|
||||
54: "西藏",
|
||||
61: "陕西",
|
||||
62: "甘肃",
|
||||
63: "青海",
|
||||
64: "宁夏",
|
||||
65: "新疆",
|
||||
71: "台湾",
|
||||
81: "香港",
|
||||
82: "澳门",
|
||||
91: "国外"
|
||||
};
|
||||
if (!aCity[parseInt(value?.substr(0, 2))]) { callback(new Error("身份证地区非法")); }
|
||||
// 出生日期验证
|
||||
var sBirthday = ( value.substr(6, 4) + "-" + Number(value.substr(10, 2)) + "-" + Number(value.substr(12, 2))).replace(/-/g, "/"),
|
||||
d = new Date(sBirthday);
|
||||
if ( sBirthday !== d.getFullYear() + "/" + (d.getMonth() + 1) + "/" + d.getDate()) {
|
||||
callback(new Error("身份证上的出生日期非法"));
|
||||
}
|
||||
|
||||
// 身份证号码校验
|
||||
var sum = 0,
|
||||
weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2],
|
||||
codes = "10X98765432";
|
||||
for (var i = 0; i < value.length - 1; i++) {
|
||||
sum += value[i] * weights[i];
|
||||
}
|
||||
var last = codes[sum % 11]; //计算出来的最后一位身份证号码
|
||||
if (value[value.length - 1] !== last) {
|
||||
callback(new Error("输入的身份证号非法"));
|
||||
}
|
||||
callback();
|
||||
};
|
||||
};
|
||||
export const identityCardRule = (rule,prop = 'idEntityCard') => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require, validator } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请输入身份证号",
|
||||
trigger: "blur"
|
||||
});
|
||||
}
|
||||
if (validator) {
|
||||
result.push({
|
||||
trigger: "blur",
|
||||
validator: validateIdentity()
|
||||
});
|
||||
}
|
||||
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
/* 身份证校验 end */
|
||||
|
||||
/* 3车牌号校验 */
|
||||
const validateCarnumber = () => {
|
||||
return (rule, value, callback) => {
|
||||
const ptreg =
|
||||
/^[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘桂琼川贵云渝藏陕甘青宁新粤]{1}[ABCDEFGHJKLMNOPQRSTUVWXY]{1}[0-9A-Z]{5}$/u;
|
||||
const xnyreg =
|
||||
/^[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘桂琼川贵云渝藏陕甘青宁新粤]{1}[A-Z]{1}(([0-9]{5}[DABCEFGHJK]$)|([DABCEFGHJK][A-HJ-NP-Z0-9][0-9]{4}$))/; // 2021年新能源车牌不止有DF
|
||||
if (!value) {
|
||||
callback(new Error("请选择车牌号"));
|
||||
} else {
|
||||
if (value.length === 7) {
|
||||
if (!ptreg.test(value)) {
|
||||
callback(new Error("请输入正确的普通车牌号"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else if (value.length === 8) {
|
||||
if (!xnyreg.test(value)) {
|
||||
callback(new Error("请输入正确的新能源车牌号"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
callback(new Error("车牌号错误"));
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export const carNumberRule = (rule,prop = "carnumber") => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require, validator } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请输入车牌号",
|
||||
trigger: "blur"
|
||||
});
|
||||
}
|
||||
if (validator) {
|
||||
result.push({
|
||||
trigger: "blur",
|
||||
validator: validateCarnumber()
|
||||
});
|
||||
}
|
||||
// return {
|
||||
// carnumber: result
|
||||
// };
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
/* 3车牌号校验end */
|
||||
|
||||
/* 4民族校验 */
|
||||
export const nationSelectRule = (rule,prop = 'nation') => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请选择民族",
|
||||
trigger: "change"
|
||||
});
|
||||
}
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
|
||||
/* 5 组织机构 */
|
||||
export const frameWorkRule = (rule,prop = 'frameWork') => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请选择组织机构",
|
||||
trigger: "change"
|
||||
});
|
||||
}
|
||||
// return {
|
||||
// frameWork: result
|
||||
// };
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
|
||||
/* 6 选择地址 */
|
||||
export const addressSelectRule = (rule,prop = 'addredd') => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请选择地址",
|
||||
trigger: "change"
|
||||
});
|
||||
}
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
|
||||
/* 7.Email */
|
||||
const validateEmail = () => {
|
||||
return (rule, value, callback) => {
|
||||
const reg = /^([a-zA-Z0-9]+[-_\.]?)+@[a-zA-Z0-9]+\.[a-z]+$/;
|
||||
if (!value) {
|
||||
} else {
|
||||
if (!reg.test(value)) {
|
||||
return callback(new Error("请输入正确的邮箱地址"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
export const emailRule = (rule,prop = "email") => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require, validator } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请输入邮箱",
|
||||
trigger: "blur"
|
||||
});
|
||||
}
|
||||
if (validator) {
|
||||
result.push({
|
||||
trigger: "change",
|
||||
validator: validateEmail()
|
||||
});
|
||||
}
|
||||
// return {
|
||||
// email: result
|
||||
// };
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
|
||||
/* 5 组织机构 */
|
||||
export const departmentRule = (rule,prop = 'department') => {
|
||||
if (isNull(rule)) return [];
|
||||
const { require } = rule && { ...rule };
|
||||
const result = [];
|
||||
if (require) {
|
||||
result.push({
|
||||
required: true,
|
||||
message: "请选择部门",
|
||||
trigger: "change"
|
||||
});
|
||||
}
|
||||
// return {
|
||||
// frameWork: result
|
||||
// };
|
||||
const resultObj = {};
|
||||
resultObj[prop] = result;
|
||||
return { ...resultObj }
|
||||
};
|
||||
233
src/plugins/utils/ruoyi.js
Normal file
@ -0,0 +1,233 @@
|
||||
|
||||
|
||||
/**
|
||||
* 通用js方法封装处理
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
|
||||
// 日期格式化
|
||||
export function parseTime(time, pattern) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
} else if (typeof time === 'string') {
|
||||
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
export function resetForm(refName) {
|
||||
if (this.$refs[refName]) {
|
||||
this.$refs[refName].resetFields();
|
||||
}
|
||||
}
|
||||
|
||||
// 添加日期范围
|
||||
export function addDateRange(params, dateRange, propName) {
|
||||
let search = params;
|
||||
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : [];
|
||||
if (typeof (propName) === 'undefined') {
|
||||
search.params['beginTime'] = dateRange[0];
|
||||
search.params['endTime'] = dateRange[1];
|
||||
} else {
|
||||
search.params['begin' + propName] = dateRange[0];
|
||||
search.params['end' + propName] = dateRange[1];
|
||||
}
|
||||
return search;
|
||||
}
|
||||
|
||||
// 回显数据字典
|
||||
export function selectDictLabel(datas, value) {
|
||||
if (value === undefined) {
|
||||
return "";
|
||||
}
|
||||
var actions = [];
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].value == ('' + value)) {
|
||||
actions.push(datas[key].label);
|
||||
return true;
|
||||
}
|
||||
})
|
||||
if (actions.length === 0) {
|
||||
actions.push(value);
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
|
||||
// 回显数据字典(字符串、数组)
|
||||
export function selectDictLabels(datas, value, separator) {
|
||||
if (value === undefined || value.length ===0) {
|
||||
return "";
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value = value.join(",");
|
||||
}
|
||||
var actions = [];
|
||||
var currentSeparator = undefined === separator ? "," : separator;
|
||||
var temp = value.split(currentSeparator);
|
||||
Object.keys(value.split(currentSeparator)).some((val) => {
|
||||
var match = false;
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].value == ('' + temp[val])) {
|
||||
actions.push(datas[key].label + currentSeparator);
|
||||
match = true;
|
||||
}
|
||||
})
|
||||
if (!match) {
|
||||
actions.push(temp[val] + currentSeparator);
|
||||
}
|
||||
})
|
||||
return actions.join('').substring(0, actions.join('').length - 1);
|
||||
}
|
||||
|
||||
// 字符串格式化(%s )
|
||||
export function sprintf(str) {
|
||||
var args = arguments, flag = true, i = 1;
|
||||
str = str.replace(/%s/g, function () {
|
||||
var arg = args[i++];
|
||||
if (typeof arg === 'undefined') {
|
||||
flag = false;
|
||||
return '';
|
||||
}
|
||||
return arg;
|
||||
});
|
||||
return flag ? str : '';
|
||||
}
|
||||
|
||||
// 转换字符串,undefined,null等转化为""
|
||||
export function parseStrEmpty(str) {
|
||||
if (!str || str == "undefined" || str == "null") {
|
||||
return "";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// 数据合并
|
||||
export function mergeRecursive(source, target) {
|
||||
for (var p in target) {
|
||||
try {
|
||||
if (target[p].constructor == Object) {
|
||||
source[p] = mergeRecursive(source[p], target[p]);
|
||||
} else {
|
||||
source[p] = target[p];
|
||||
}
|
||||
} catch (e) {
|
||||
source[p] = target[p];
|
||||
}
|
||||
}
|
||||
return source;
|
||||
};
|
||||
|
||||
/**
|
||||
* 构造树型结构数据
|
||||
* @param {*} data 数据源
|
||||
* @param {*} id id字段 默认 'id'
|
||||
* @param {*} parentId 父节点字段 默认 'parentId'
|
||||
* @param {*} children 孩子节点字段 默认 'children'
|
||||
*/
|
||||
export function handleTree(data, id, parentId, children) {
|
||||
let config = {
|
||||
id: id || 'id',
|
||||
parentId: parentId || 'parentId',
|
||||
childrenList: children || 'children'
|
||||
};
|
||||
|
||||
var childrenListMap = {};
|
||||
var nodeIds = {};
|
||||
var tree = [];
|
||||
|
||||
for (let d of data) {
|
||||
let parentId = d[config.parentId];
|
||||
if (childrenListMap[parentId] == null) {
|
||||
childrenListMap[parentId] = [];
|
||||
}
|
||||
nodeIds[d[config.id]] = d;
|
||||
childrenListMap[parentId].push(d);
|
||||
}
|
||||
|
||||
for (let d of data) {
|
||||
let parentId = d[config.parentId];
|
||||
if (nodeIds[parentId] == null) {
|
||||
tree.push(d);
|
||||
}
|
||||
}
|
||||
|
||||
for (let t of tree) {
|
||||
adaptToChildrenList(t);
|
||||
}
|
||||
|
||||
function adaptToChildrenList(o) {
|
||||
if (childrenListMap[o[config.id]] !== null) {
|
||||
o[config.childrenList] = childrenListMap[o[config.id]];
|
||||
}
|
||||
if (o[config.childrenList]) {
|
||||
for (let c of o[config.childrenList]) {
|
||||
adaptToChildrenList(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数处理
|
||||
* @param {*} params 参数
|
||||
*/
|
||||
export function tansParams(params) {
|
||||
let result = ''
|
||||
for (const propName of Object.keys(params)) {
|
||||
const value = params[propName];
|
||||
var part = encodeURIComponent(propName) + "=";
|
||||
if (value !== null && value !== "" && typeof (value) !== "undefined") {
|
||||
if (typeof value === 'object') {
|
||||
for (const key of Object.keys(value)) {
|
||||
if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
|
||||
let params = propName + '[' + key + ']';
|
||||
var subPart = encodeURIComponent(params) + "=";
|
||||
result += subPart + encodeURIComponent(value[key]) + "&";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result += part + encodeURIComponent(value) + "&";
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// 验证是否为blob格式
|
||||
export function blobValidate(data) {
|
||||
return data.type !== 'application/json'
|
||||
}
|
||||
40
src/plugins/utils/storage.js
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
*1.存储数据
|
||||
*/
|
||||
export const setItem = (key, value) => {
|
||||
// value的两种情况 1. 基本数据类型 2.复杂数据类型
|
||||
if (typeof value === "object") {
|
||||
value = JSON.stringify(value);
|
||||
}
|
||||
window.localStorage.setItem(key, value);
|
||||
};
|
||||
|
||||
/*
|
||||
*2.获取数据
|
||||
*/
|
||||
export const getItem = (key) => {
|
||||
const data = window.localStorage.getItem(key);
|
||||
try {
|
||||
if (typeof data === 'string' && /^\d+$/.test(data) && data.length > 15) {
|
||||
// 如果是长数字字符串,直接返回,不进行 JSON.parse
|
||||
return data;
|
||||
}
|
||||
return JSON.parse(data);
|
||||
} catch (err) {
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
*3.删除指定数据
|
||||
*/
|
||||
export const removeItem = (key) => {
|
||||
window.localStorage.removeItem(key);
|
||||
};
|
||||
|
||||
/*
|
||||
*4.删除所有数据
|
||||
*/
|
||||
export const removeAllItem = () => {
|
||||
window.localStorage.clear();
|
||||
};
|
||||
82
src/plugins/utils/theme.js
Normal file
@ -0,0 +1,82 @@
|
||||
//导入色值表
|
||||
import formula from '@/constant/formula.json';
|
||||
import color from 'css-color-function';
|
||||
import rgbHex from 'rgb-hex';
|
||||
import axios from 'axios';
|
||||
/*
|
||||
*根据主题色 ,生成最新的样式表
|
||||
*/
|
||||
export const generateNewStyle = async (parimaryColor) => {
|
||||
//1.根据主色 生成色值表
|
||||
const colors = generateColors(parimaryColor);
|
||||
//2.获取当前 element-plus 的默认样式表 , 并且把需要进行替换的色值打上标记
|
||||
let cssText = await getOriginalStyle();
|
||||
//3.遍历生成的色值表,在默认样式表 进行全局替换
|
||||
Object.keys(colors).forEach((key) => {
|
||||
// cssText = cssText.replace(
|
||||
// new RegExp('(:|\\s+)' + key, 'g'),
|
||||
// '$1' + colors[key]
|
||||
// );
|
||||
});
|
||||
return cssText;
|
||||
};
|
||||
|
||||
/*
|
||||
*把生成的样式表写入到style中
|
||||
*/
|
||||
export const writeNewStyle = (newStyle) => {
|
||||
const style = document.createElement('style');
|
||||
style.innerText = newStyle;
|
||||
document.head.appendChild(style);
|
||||
};
|
||||
|
||||
export const generateColors = (primary) => {
|
||||
if (!primary) return;
|
||||
const colors = {
|
||||
primary: primary
|
||||
};
|
||||
|
||||
Object.keys(formula).forEach((key) => {
|
||||
const value = formula[key].replace(/primary/g, primary);
|
||||
colors[key] = '#' + rgbHex(color.convert(value));
|
||||
});
|
||||
return colors;
|
||||
};
|
||||
|
||||
/*
|
||||
* 获取当前 element-plus 的默认样式表
|
||||
*/
|
||||
const getOriginalStyle = async () => {
|
||||
const version = require('element-plus/package.json').version;
|
||||
// const url = `https://unpkg.com/element-plus@${version}/dist/index.css`;
|
||||
|
||||
// const { data } = await axios(url);
|
||||
// // 把获取到的数据筛选为原样式模板
|
||||
// return getStyleTemplate(data);
|
||||
};
|
||||
|
||||
/**
|
||||
* 返回 style 的 template
|
||||
*/
|
||||
const getStyleTemplate = (data) => {
|
||||
// element-plus 默认色值
|
||||
const colorMap = {
|
||||
'#3a8ee6': 'shade-1',
|
||||
'#409eff': 'primary',
|
||||
'#53a8ff': 'light-1',
|
||||
'#66b1ff': 'light-2',
|
||||
'#79bbff': 'light-3',
|
||||
'#8cc5ff': 'light-4',
|
||||
'#a0cfff': 'light-5',
|
||||
'#b3d8ff': 'light-6',
|
||||
'#c6e2ff': 'light-7',
|
||||
'#d9ecff': 'light-8',
|
||||
'#ecf5ff': 'light-9'
|
||||
};
|
||||
// 根据默认色值为要替换的色值打上标记
|
||||
Object.keys(colorMap).forEach((key) => {
|
||||
const value = colorMap[key];
|
||||
data = data.replace(new RegExp(key, 'ig'), value);
|
||||
});
|
||||
return data;
|
||||
};
|
||||
65
src/plugins/utils/time.js
Normal file
@ -0,0 +1,65 @@
|
||||
// 日历数据时间段处理
|
||||
export function handleTime(start, end) {
|
||||
//补0
|
||||
function zeeo(num) {
|
||||
let data = num;
|
||||
if (num * 1 < 10) {
|
||||
data = "0" + num;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
let arr = [];
|
||||
let kssj = new Date(start).getTime();
|
||||
let jssj = new Date(end).getTime();
|
||||
let dayTimes = 24 * 60 * 60 * 1000;
|
||||
//天数
|
||||
let n = Math.floor((jssj - kssj) / dayTimes);
|
||||
for (var i = 0; i <= n; i++) {
|
||||
let mytime = kssj + i * dayTimes;
|
||||
arr.push({
|
||||
start:
|
||||
new Date(mytime).getFullYear() +
|
||||
"-" +
|
||||
zeeo(new Date(mytime).getMonth() + 1) +
|
||||
"-" +
|
||||
zeeo(new Date(mytime).getDate()),
|
||||
end:
|
||||
new Date(mytime).getFullYear() +
|
||||
"-" +
|
||||
zeeo(new Date(mytime).getMonth() + 1) +
|
||||
"-" +
|
||||
zeeo(new Date(mytime).getDate())
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
export function timeValidate(date, type) {
|
||||
const time = date ? new Date(date) : new Date();
|
||||
const yyyy = time.getFullYear();
|
||||
const MM = (time.getMonth() + 1).toString().padStart(2, "0");
|
||||
const dd = time.getDate().toString().padStart(2, "0");
|
||||
const hh = time.getHours().toString().padStart(2, "0");
|
||||
const mm = time.getMinutes().toString().padStart(2, "0");
|
||||
const ss = time.getSeconds().toString().padStart(2, "0");
|
||||
if (type == "ymd") {
|
||||
return `${yyyy}-${MM}-${dd}`;
|
||||
}
|
||||
return `${yyyy}-${MM}-${dd} ${hh}:${mm}:${ss}`;
|
||||
}
|
||||
|
||||
//获取n天前或n天后的日期
|
||||
export function getTime(n) {
|
||||
var currentDate = new Date();
|
||||
var preDate = new Date(currentDate.getTime() + n * 24 * 3600 * 1000);
|
||||
let year = preDate.getFullYear();
|
||||
let mon = preDate.getMonth() + 1;
|
||||
let day = preDate.getDate();
|
||||
let s =
|
||||
year +
|
||||
"-" +
|
||||
(mon < 10 ? "0" + mon : mon) +
|
||||
"-" +
|
||||
(day < 10 ? "0" + day : day);
|
||||
return s;
|
||||
}
|
||||
364
src/plugins/utils/tools.js
Normal file
@ -0,0 +1,364 @@
|
||||
|
||||
|
||||
import ImageCompressor from "image-compressor.js";
|
||||
|
||||
// 生成10位数的随机数
|
||||
export function generateRandom10Digits() {
|
||||
// 生成范围在1000000000到9999999999之间的随机整数
|
||||
const min = 1000000000;
|
||||
const max = 9999999999;
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
// 随机颜色 - 把16进制的颜色换成rgba格式
|
||||
export function choseRbgb(color, opcity) {
|
||||
if (color) {
|
||||
return 'rgba(' + parseInt('0x' + color.slice(1, 3)) + ',' + parseInt('0x' + color.slice(3, 5)) + ',' + parseInt('0x' + color.slice(5, 7)) + ',' + opcity + ')'
|
||||
} else {
|
||||
let r = Math.floor(Math.random() * 256)
|
||||
let g = Math.floor(Math.random() * 256)
|
||||
let b = Math.floor(Math.random() * 256)
|
||||
let a = opcity ? opcity : 1
|
||||
return `rgba(${r},${g},${b},${a})`
|
||||
}
|
||||
}
|
||||
|
||||
// 随机十六进制颜色
|
||||
export function randomHexColor() { // 随机生成十六进制颜色
|
||||
var hex = Math.floor(Math.random() * 16777216).toString(16);
|
||||
while (hex.length < 6) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
return '#' + hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 压缩图片
|
||||
* @param {*} file
|
||||
* @param {*} quality 压缩比
|
||||
*/
|
||||
export function compressImage(file, quality = 0.6) {
|
||||
return new Promise((resolve, reject) => {
|
||||
new ImageCompressor(file, {
|
||||
quality, //压缩质量
|
||||
success(res) {
|
||||
let fileData = new File([res], res.name, { type: res.type });
|
||||
resolve(fileData);
|
||||
},
|
||||
error(e) {
|
||||
reject("图片压缩失败,请稍后再试");
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 今天周几
|
||||
export function weekValidate() {
|
||||
let week = new Date().getDay()
|
||||
let weekenday = ''
|
||||
switch (week) {
|
||||
case 0: return weekenday = '星期日'
|
||||
case 1: return weekenday = '星期一'
|
||||
case 2: return weekenday = '星期二'
|
||||
case 3: return weekenday = '星期三'
|
||||
case 4: return weekenday = '星期四'
|
||||
case 5: return weekenday = '星期五'
|
||||
case 6: return weekenday = '星期六'
|
||||
}
|
||||
}
|
||||
|
||||
// 毫秒转时长
|
||||
export function formatDuring(mss) {
|
||||
var days = parseInt(mss / (1000 * 60 * 60 * 24));
|
||||
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
|
||||
var seconds = (mss % (1000 * 60)) / 1000;
|
||||
if (days) {
|
||||
return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
|
||||
} else if (hours) {
|
||||
return hours + "小时" + minutes + "分钟" + seconds + "秒";
|
||||
} else if (minutes) {
|
||||
return minutes + "分钟" + seconds + "秒";
|
||||
} else {
|
||||
return seconds + "秒";
|
||||
}
|
||||
}
|
||||
|
||||
// 转换时间格式
|
||||
export function timeValidate(date, type) {
|
||||
const time = date ? new Date(date) : new Date()
|
||||
const yyyy = time.getFullYear()
|
||||
const MM = (time.getMonth() + 1).toString().padStart(2, 0)
|
||||
const dd = time.getDate().toString().padStart(2, '0')
|
||||
const hh = time.getHours().toString().padStart(2, '0')
|
||||
const mm = time.getMinutes().toString().padStart(2, '0')
|
||||
const ss = time.getSeconds().toString().padStart(2, '0')
|
||||
if (type == 'ymd') {
|
||||
return `${yyyy}-${MM}-${dd}`;
|
||||
}
|
||||
if (type == 'md') {
|
||||
return `${MM}.${dd}`
|
||||
}
|
||||
if (type == 'td') {
|
||||
return `${yyyy}年${MM}月${dd}日`
|
||||
}
|
||||
if (type == 'yd') {
|
||||
return `${yyyy}`
|
||||
}
|
||||
if (type == 'ym') {
|
||||
return MM
|
||||
}
|
||||
if (type == 'rm') {
|
||||
return dd
|
||||
}
|
||||
if (type == 'mm') {
|
||||
return `${yyyy}${MM}${dd}${hh}${mm}${ss}`
|
||||
}
|
||||
if (type == 'ydm') {
|
||||
return `${yyyy}年${MM}月${dd}日${hh}时${mm}分${ss}秒`
|
||||
}
|
||||
return `${yyyy}-${MM}-${dd} ${hh}:${mm}:${ss}`
|
||||
}
|
||||
|
||||
|
||||
export function timeSlotChange(val) {
|
||||
let startTime, endTime;
|
||||
let now = new Date(); //当前日期
|
||||
let nowDayOfWeek = now.getDay(); //今天本周的第几天
|
||||
let nowDay = now.getDate(); //当前日
|
||||
let nowMonth = now.getMonth(); //当前月
|
||||
let nowYear = now.getFullYear(); //当前年
|
||||
let jd = Math.ceil((nowMonth + 1) / 3)
|
||||
switch (val) {
|
||||
case '天':
|
||||
case '日':
|
||||
startTime = timeValidate(new Date(), 'ymd')
|
||||
endTime = timeValidate(new Date(), 'ymd')
|
||||
break;
|
||||
case "本周":
|
||||
case "周":
|
||||
startTime = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek)
|
||||
endTime = new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek)
|
||||
break;
|
||||
case "本月":
|
||||
case "月":
|
||||
startTime = new Date(nowYear, nowMonth, 1)
|
||||
endTime = new Date(nowYear, nowMonth + 1, 0)
|
||||
break;
|
||||
case "本季度":
|
||||
case "季度":
|
||||
startTime = new Date(nowYear, (jd - 1) * 3, 1)
|
||||
endTime = new Date(nowYear, jd * 3, 0)
|
||||
break
|
||||
case "本年":
|
||||
case "年":
|
||||
startTime = new Date(nowYear, 0, 1)
|
||||
endTime = new Date(nowYear, 11, 31)
|
||||
break
|
||||
}
|
||||
return [timeValidate(startTime, 'ymd'), timeValidate(endTime, 'ymd')]
|
||||
}
|
||||
|
||||
|
||||
// 获取当前近多少天 7后7天 -7 前五天
|
||||
export function getRecentDay(n) {
|
||||
var currentDate = new Date();
|
||||
var preDate = new Date(currentDate.getTime() + n * 24 * 3600 * 1000)
|
||||
let year = preDate.getFullYear()
|
||||
let mon = preDate.getMonth() + 1
|
||||
let day = preDate.getDate()
|
||||
let s = year + '-' + (mon < 10 ? ('0' + mon) : mon) + '-' + (day < 10 ? ('0' + day) : day)
|
||||
return s
|
||||
}
|
||||
|
||||
// 获取n近7月 7后7 -7 前
|
||||
export function getnRencebtMonth(n) {
|
||||
let date = new Date();
|
||||
date.setMonth(date.getMonth() - n)
|
||||
date.toLocaleDateString()
|
||||
let y = date.getFullYear()
|
||||
let m = date.getMonth() + 1
|
||||
m = m < 10 ? ('0' + m) : m + ''
|
||||
return y + m
|
||||
}
|
||||
/**
|
||||
* 数据去重 相同数据值累加
|
||||
* @param {Object} array 数据
|
||||
*/
|
||||
export function setArray(array) {
|
||||
let newArr = []
|
||||
array.forEach(item => {
|
||||
const res = newArr.findIndex(ol => {
|
||||
//组织机构代码相同 并且报警类别相同
|
||||
return item.ssbmdm == ol.ssbmdm && item.bjlb == ol.bjlb
|
||||
})
|
||||
if (res !== -1) {
|
||||
newArr[res].sl = newArr[res].sl + item.sl
|
||||
} else {
|
||||
newArr.push(item)
|
||||
}
|
||||
})
|
||||
|
||||
return newArr
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并数据
|
||||
* @param {Object} array 数据
|
||||
*/
|
||||
export function hbArray(array, item1, item2, item3) {
|
||||
let newArr = []
|
||||
array.forEach(item => {
|
||||
const res = newArr.findIndex(ol => {
|
||||
//组织机构代码相同 并且报警类别相同
|
||||
return item.product == ol.product
|
||||
})
|
||||
if (res !== -1) {
|
||||
newArr[res][item1] = newArr[res][item1] + item[item1]
|
||||
newArr[res][item2] = newArr[res][item2] + item[item2]
|
||||
newArr[res][item3] = newArr[res][item3] + item[item3]
|
||||
} else {
|
||||
newArr.push(item)
|
||||
}
|
||||
})
|
||||
|
||||
return newArr
|
||||
}
|
||||
//时间格式
|
||||
export function dateFormat(type, time) {
|
||||
let date
|
||||
if (time) {
|
||||
date = new Date(time);
|
||||
} else {
|
||||
date = new Date();
|
||||
}
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
||||
let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
||||
let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
||||
let day
|
||||
|
||||
if (type == 'z') {
|
||||
//前一天日期
|
||||
day = date.getDate() - 1;
|
||||
day = day < 10 ? "0" + day : day;
|
||||
return `${year}-${month}-${day}`;
|
||||
} else if (type == 'all') {
|
||||
//格式化日期时间
|
||||
day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
} else {
|
||||
//当天日期
|
||||
day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
return day
|
||||
}
|
||||
|
||||
//数字超长处理
|
||||
export function handleNum(num) {
|
||||
var data = 0
|
||||
if (num) {
|
||||
try {
|
||||
if (num * 1 > 100000) {
|
||||
data = (num / 10000).toFixed(0) + '万'
|
||||
} else {
|
||||
data = (num * 1).toFixed(0)
|
||||
}
|
||||
} catch (error) {
|
||||
data = 0
|
||||
}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
/**
|
||||
* 文件是否是图片
|
||||
* @param {*} val
|
||||
*/
|
||||
export function IS_PNG(val) {
|
||||
return ['bmp', 'jpg', 'png', 'tif', 'gif', 'pcx', 'tga', 'exif', 'fpx', 'svg', 'psd', 'cdr', 'pcd', 'dxf', 'ufo',
|
||||
'eps', 'ai', 'raw', 'wmf', 'webp', 'avif', 'apng'
|
||||
].indexOf(val.toLowerCase()) !== -1
|
||||
}
|
||||
/**
|
||||
* 文件是否是音频
|
||||
* @param {*} val
|
||||
*/
|
||||
export function IS_MP3(val) {
|
||||
return ['mp3', 'wav', 'wma', 'mp2', 'flac', 'midi', 'ra', 'ape', 'aac', 'cda', 'mov'].indexOf(val.toLowerCase()) !==
|
||||
-1
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件是否是视频
|
||||
* @param {*} val
|
||||
*/
|
||||
export function IS_MP4(val) {
|
||||
return ['avi', 'wmv', 'mpeg', 'mp4', 'm4v', 'mov', 'asf', 'fiv', 'f4v', 'mvb', 'rm', '3gp', 'vob'].indexOf(val
|
||||
.toLowerCase()) !== -1
|
||||
}
|
||||
|
||||
|
||||
function handelArr(arr) {
|
||||
let brr = []
|
||||
if (arr && arr.length > 0) {
|
||||
let obj = {}
|
||||
let coords = "";
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
coords += arr[i] + ","
|
||||
}
|
||||
obj.coords = coords
|
||||
brr.push(obj)
|
||||
}
|
||||
return brr
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 时间 天数
|
||||
* @param {*} val
|
||||
*/
|
||||
export function setEchartTime(val) {
|
||||
let date = new Date();
|
||||
let arrTime = [];
|
||||
if (val == 0) {
|
||||
for (let i = 0; i < 24; i++) {
|
||||
arrTime.push(i)
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < val; i++) {
|
||||
let date1 = new Date(date.getTime() - i * 24 * 60 * 60 * 1000)
|
||||
arrTime.push(_setTime(date1))
|
||||
}
|
||||
arrTime.reverse()
|
||||
}
|
||||
return arrTime
|
||||
}
|
||||
//设置时间
|
||||
function _setTime(date) {
|
||||
let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
||||
let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
return `${month}-${day}`;
|
||||
}
|
||||
|
||||
|
||||
//拼接地址
|
||||
export function setAddress(val) {
|
||||
const url = '/mosty-api/mosty-base/minio/image/download/'
|
||||
return url + val
|
||||
}
|
||||
export function getUUid() {
|
||||
var list = [];
|
||||
var hexDigits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
for (var i = 0; i < 32; i++) {
|
||||
list[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
||||
}
|
||||
list[14] = "4";
|
||||
list[19] = hexDigits.substr((list[19] & 0x3) | 0x8, 1);
|
||||
list[8] = list[13] = list[18] = list[23];
|
||||
let uuid = list.join("");
|
||||
return uuid;
|
||||
}
|
||||
68
src/plugins/utils/validate.js
Normal file
@ -0,0 +1,68 @@
|
||||
/**
|
||||
* 判断是否为外部资源
|
||||
*/
|
||||
export function isExternal(path) {
|
||||
return /^(https?:|mailto:|tel:)/.test(path)
|
||||
}
|
||||
export function validateCarnumber(rule, value, callback) {
|
||||
const ptreg = /^[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘桂琼川贵云渝藏陕甘青宁新粤]{1}[ABCDEFGHJKLMNOPQRSTUVWXY]{1}[0-9A-Z]{5}$/u;
|
||||
const xnyreg = /^[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘桂琼川贵云渝藏陕甘青宁新粤]{1}[A-Z]{1}(([0-9]{5}[DABCEFGHJK]$)|([DABCEFGHJK][A-HJ-NP-Z0-9][0-9]{4}$))/; // 2021年新能源车牌不止有DF
|
||||
if (!value) {
|
||||
callback(new Error('请选择车牌号'))
|
||||
} else {
|
||||
if (value.length === 7) {
|
||||
if (!ptreg.test(value)) {
|
||||
callback(new Error('请输入正确的普通车牌号'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else if (value.length === 8) {
|
||||
if (!xnyreg.test(value)) {
|
||||
callback(new Error('请输入正确的新能源车牌号'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
callback(new Error('车牌号错误'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
export function resetForm(refName) {
|
||||
if (this.$refs[refName]) {
|
||||
this.$refs[refName].resetFields();
|
||||
}
|
||||
}
|
||||
|
||||
//当type=1时获取出生日期,type=2时获取性别,type=3时获取年龄
|
||||
export function IdCard(IdCard, type) {
|
||||
//获取出生日期
|
||||
if(!IdCard) return;
|
||||
if (type === 1) {
|
||||
return IdCard.substring(6, 10) + "-" + IdCard.substring(10, 12) + "-" + IdCard.substring(12, 14)
|
||||
}
|
||||
if (type === 2) {
|
||||
//获取性别
|
||||
if (parseInt(IdCard.substr(16, 1)) % 2 === 1) {
|
||||
return "男"
|
||||
} else {
|
||||
return "女"
|
||||
}
|
||||
}
|
||||
if (type === 3) {
|
||||
//获取年龄
|
||||
var ageDate = new Date()
|
||||
var month = ageDate.getMonth() + 1
|
||||
var day = ageDate.getDate()
|
||||
var age = ageDate.getFullYear() - IdCard.substring(6, 10) - 1
|
||||
if (IdCard.substring(10, 12) < month || IdCard.substring(10, 12) === month && IdCard.substring(12, 14) <= day) {
|
||||
age++
|
||||
}
|
||||
if (age <= 0) {
|
||||
age = 1
|
||||
}
|
||||
return age
|
||||
}
|
||||
}
|
||||
|
||||
75
src/plugins/utils/webSocket.js
Normal file
@ -0,0 +1,75 @@
|
||||
const url = "ws://80.155.0.82:8006/mosty-api/mosty-websocket/socket/"; //线上
|
||||
import {
|
||||
getItem
|
||||
} from "@/utils/storage";
|
||||
import {
|
||||
getUserInfoToId
|
||||
} from "@/api/user-manage";
|
||||
class WebSoketClass {
|
||||
constructor(props) {}
|
||||
ws = null;
|
||||
static getInstance() {
|
||||
if (!this.ws) this.ws = new WebSoketClass();
|
||||
return this.ws;
|
||||
}
|
||||
//关闭连接
|
||||
static close() {
|
||||
this.ws.ws.close();
|
||||
}
|
||||
// 创建连接
|
||||
connect(fun) {
|
||||
let uuid = this.getUUid()
|
||||
let id = getItem("USERID");
|
||||
getUserInfoToId(id).then((res) => {
|
||||
let sfzh = res.idEntityCard
|
||||
this.ws = new WebSocket(url + sfzh + '/' + uuid);
|
||||
this.ws.onopen = (e) => { fun(true);};
|
||||
});
|
||||
}
|
||||
// 心跳机制
|
||||
heartCheck() {
|
||||
const _that = this;
|
||||
this.state = setInterval(() => {
|
||||
if (this.ws.readyState === 1) {
|
||||
this.ws.send("/heart");
|
||||
} else {
|
||||
this.closeHandle(); //重新连接
|
||||
}
|
||||
}, 6e3);
|
||||
}
|
||||
|
||||
// 获取uuid
|
||||
getUUid() {
|
||||
var s = [];
|
||||
var hexDigits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
for (var i = 0; i < 32; i++) {
|
||||
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
||||
}
|
||||
s[14] = "4";
|
||||
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
|
||||
s[8] = s[13] = s[18] = s[23];
|
||||
let uuid = s.join("");
|
||||
return uuid
|
||||
}
|
||||
|
||||
closeHandle() {
|
||||
if (this.state) {
|
||||
clearInterval(this.state);
|
||||
this.connect();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
// 接收发送消息
|
||||
getMessage() {
|
||||
this.ws.onmessage = (e) => {
|
||||
if (e.data) {
|
||||
let newsDate = JSON.parse(e.data);
|
||||
this.newVal = newsDate;
|
||||
//接收的数据
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
export default WebSoketClass;
|
||||
@ -234,7 +234,7 @@ export const publicRoutes = [
|
||||
{
|
||||
path: "/FourColorWarning",
|
||||
name: "FourColorWarning",
|
||||
meta: { title: "四色预警管理", icon: "article" },
|
||||
meta: { title: "四色预警", icon: "article" },
|
||||
children: [
|
||||
{
|
||||
path: "/warningControl",
|
||||
@ -242,12 +242,12 @@ export const publicRoutes = [
|
||||
meta: { title: "预警中心", icon: "article" },
|
||||
redirect: "/warningControl/centerHome",
|
||||
children: [
|
||||
{
|
||||
path: "/centerHome",
|
||||
name: "centerHome",
|
||||
component: () => import("@/views/backOfficeSystem/fourColorManage/warningControl/centerHome/index"),
|
||||
meta: { title: "预警中心大屏", icon: "article" },
|
||||
},
|
||||
// {
|
||||
// path: "/centerHome",
|
||||
// name: "centerHome",
|
||||
// component: () => import("@/views/backOfficeSystem/fourColorManage/warningControl/centerHome/index"),
|
||||
// meta: { title: "预警中心大屏", icon: "article" },
|
||||
// },
|
||||
// {
|
||||
// path: "/warningBk",
|
||||
// name: "warningBk",
|
||||
@ -367,34 +367,129 @@ export const publicRoutes = [
|
||||
name: "myControl",
|
||||
component: () => import("@/views/backOfficeSystem/IntelligentControl/myControl/index"),
|
||||
meta: {
|
||||
title: "我的布控",
|
||||
title: "常态布控",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/DeploymentAudit",
|
||||
name: "DeploymentAudit",
|
||||
component: () => import("@/views/backOfficeSystem/IntelligentControl/DeploymentAudit/index"),
|
||||
path: "/PrivateSurveillance",
|
||||
name: "PrivateSurveillance",
|
||||
component: () => import("@/views/backOfficeSystem/IntelligentControl/myControl/index"),
|
||||
meta: {
|
||||
title: "我的审核",
|
||||
title: "临时布控",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
// {
|
||||
// path: "/DeploymentAudit",
|
||||
// name: "DeploymentAudit",
|
||||
// component: () => import("@/views/backOfficeSystem/IntelligentControl/DeploymentAudit/index"),
|
||||
// meta: {
|
||||
// title: "我的审核",
|
||||
// icon: "article"
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// path: "/ControlApproval",
|
||||
// name: "ControlApproval",
|
||||
// component: () => import("@/views/backOfficeSystem/IntelligentControl/ControlApproval/index"),
|
||||
// meta: {
|
||||
// title: "我的审批",
|
||||
// icon: "article"
|
||||
// }
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/HumanIntelligence",
|
||||
name: "HumanIntelligence",
|
||||
meta: { title: "信息汇聚支撑", icon: "article" },
|
||||
children: [
|
||||
{
|
||||
path: "/CollectCrculate",
|
||||
name: "CollectCrculate",
|
||||
// component: () => import("@/views/backOfficeSystem/HumanIntelligence/CollectCrculate/index"),
|
||||
meta: { title: "上报信息", icon: "article" },
|
||||
// meta: { title: "人力情报信息报送", icon: "article" },
|
||||
redirect: "/CollectCrculate",
|
||||
children: [
|
||||
{
|
||||
path: "/CollectCrculate",
|
||||
name: "CollectCrculate",
|
||||
component: () => import("@/views/backOfficeSystem/HumanIntelligence/CollectCrculate/index"),
|
||||
meta: { title: "警务工作报送", icon: "article" },
|
||||
},
|
||||
{
|
||||
path: "/socialInformationCrculate",
|
||||
name: "socialInformationCrculate",
|
||||
component: () => import("@/views/backOfficeSystem/HumanIntelligence/SocialInformationCrculate/index"),
|
||||
meta: { title: "信息", icon: "article" },
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
path: "/RlStatisticalAnalysis",
|
||||
name: "RlStatisticalAnalysis",
|
||||
component: () =>
|
||||
import(
|
||||
"@/views/backOfficeSystem/HumanIntelligence/RlStatisticalAnalysis/index"
|
||||
),
|
||||
meta: {
|
||||
title: "上报统计分析",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
path: "/TaskScheduling",
|
||||
name: "TaskScheduling",
|
||||
component: () =>
|
||||
import(
|
||||
"@/views/backOfficeSystem/HumanIntelligence/TaskScheduling/index"
|
||||
),
|
||||
meta: {
|
||||
title: "上报任务调度",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/ControlApproval",
|
||||
name: "ControlApproval",
|
||||
component: () => import("@/views/backOfficeSystem/IntelligentControl/ControlApproval/index"),
|
||||
path: "/ConstructionManagement",
|
||||
name: "ConstructionManagement",
|
||||
component: () =>
|
||||
import(
|
||||
"@/views/backOfficeSystem/HumanIntelligence/ConstructionManagement/index"
|
||||
),
|
||||
meta: {
|
||||
title: "我的审批",
|
||||
title: "力量建设管理",
|
||||
icon: "article"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/JobAppraisal",
|
||||
name: "JobAppraisal",
|
||||
component: () => import("@/views/backOfficeSystem/HumanIntelligence/JobAppraisal/index"),
|
||||
meta: {
|
||||
title: "工作考核",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
// {
|
||||
// path: "/MakeAcomment",
|
||||
// name: "MakeAcomment",
|
||||
// component: () => import("@/views/backOfficeSystem/MakeAcomment/index"),
|
||||
// meta: {
|
||||
// title: "情报评一评",
|
||||
// icon: "article"
|
||||
// }
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/ResearchJudgment",
|
||||
name: "ResearchJudgment",
|
||||
meta: { title: "线索研判盯办系统", icon: "article" },
|
||||
meta: { title: "线索落核盯办", icon: "article" },
|
||||
children: [
|
||||
{
|
||||
path: "/DatAcquisition",
|
||||
@ -470,99 +565,11 @@ export const publicRoutes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/HumanIntelligence",
|
||||
name: "HumanIntelligence",
|
||||
meta: { title: "人力情报采集管理系统", icon: "article" },
|
||||
children: [
|
||||
{
|
||||
path: "/CollectCrculate",
|
||||
name: "CollectCrculate",
|
||||
meta: { title: "人力情报信息报送", icon: "article" },
|
||||
redirect: "/CollectCrculate",
|
||||
children: [
|
||||
{
|
||||
path: "/CollectCrculate",
|
||||
name: "CollectCrculate",
|
||||
component: () => import("@/views/backOfficeSystem/HumanIntelligence/CollectCrculate/index"),
|
||||
meta: { title: "警务工作报送", icon: "article" },
|
||||
},
|
||||
{
|
||||
path: "/socialInformationCrculate",
|
||||
name: "socialInformationCrculate",
|
||||
component: () => import("@/views/backOfficeSystem/HumanIntelligence/CollectCrculate/index"),
|
||||
meta: { title: "社会信息员报送", icon: "article" },
|
||||
},
|
||||
{
|
||||
path: "/lamCrculate",
|
||||
name: "lamCrculate",
|
||||
component: () => import("@/views/backOfficeSystem/HumanIntelligence/CollectCrculate/index"),
|
||||
meta: { title: "林安码报送", icon: "article" },
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
path: "/RlStatisticalAnalysis",
|
||||
name: "RlStatisticalAnalysis",
|
||||
component: () =>
|
||||
import(
|
||||
"@/views/backOfficeSystem/HumanIntelligence/RlStatisticalAnalysis/index"
|
||||
),
|
||||
meta: {
|
||||
title: "人力情报统计分析",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
path: "/TaskScheduling",
|
||||
name: "TaskScheduling",
|
||||
component: () =>
|
||||
import(
|
||||
"@/views/backOfficeSystem/HumanIntelligence/TaskScheduling/index"
|
||||
),
|
||||
meta: {
|
||||
title: "人力情报信息收集任务调度",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/ConstructionManagement",
|
||||
name: "ConstructionManagement",
|
||||
component: () =>
|
||||
import(
|
||||
"@/views/backOfficeSystem/HumanIntelligence/ConstructionManagement/index"
|
||||
),
|
||||
meta: {
|
||||
title: "力量建设管理",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/JobAppraisal",
|
||||
name: "JobAppraisal",
|
||||
component: () => import("@/views/backOfficeSystem/HumanIntelligence/JobAppraisal/index"),
|
||||
meta: {
|
||||
title: "社会员工工作信息考核",
|
||||
icon: "article"
|
||||
}
|
||||
},
|
||||
// {
|
||||
// path: "/MakeAcomment",
|
||||
// name: "MakeAcomment",
|
||||
// component: () => import("@/views/backOfficeSystem/MakeAcomment/index"),
|
||||
// meta: {
|
||||
// title: "情报评一评",
|
||||
// icon: "article"
|
||||
// }
|
||||
// }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/ExcavationResearch",
|
||||
name: "ExcavationResearch",
|
||||
meta: { title: "重点人发掘系统", icon: "article" },
|
||||
meta: { title: "重点人发掘", icon: "article" },
|
||||
children: [
|
||||
|
||||
{
|
||||
@ -608,7 +615,7 @@ export const publicRoutes = [
|
||||
name: "JudgmentHome",
|
||||
redirect: "/ResearchHome",
|
||||
meta: {
|
||||
title: "研判首页",
|
||||
title: "会商研判",
|
||||
icon: "article"
|
||||
},
|
||||
children: [
|
||||
@ -656,7 +663,7 @@ export const publicRoutes = [
|
||||
name: "DeploymentDisposal",
|
||||
redirect: "/ResearchHome",
|
||||
meta: {
|
||||
title: "全域布控处置",
|
||||
title: "全域管控",
|
||||
icon: "article"
|
||||
},
|
||||
children: [
|
||||
@ -787,6 +794,8 @@ const router = createRouter({
|
||||
//初始化路由表
|
||||
export function resetRouter() {
|
||||
if (store.getters?.routeReady && store.getters?.userInfo?.permission?.menus) {
|
||||
|
||||
|
||||
const menus = store.getters.userInfo.permission.menus;
|
||||
menus.forEach((menu) => {
|
||||
router.removeRoute(menu);
|
||||
|
||||
1096
src/utils/index.js
@ -45,7 +45,7 @@ service.interceptors.response.use(
|
||||
// 需要判断当前请求是否成功
|
||||
if (success && code === 10000) {
|
||||
return data ? data : response.data; // 成功后返回解析后的数据
|
||||
} else if (code === 200 || code == "00000" || code == "10000" || msg == 'success' || model) {
|
||||
} else if (code === 200 || code == "00000" || code == "10000" || msg == 'success' || model || response.data.success == true) {
|
||||
return data ? data : response.data; // // 成功后返回解析后的数据
|
||||
} else if (code === 401) {
|
||||
store.dispatch('user/logout');
|
||||
|
||||
@ -1,14 +1,27 @@
|
||||
import path from "path";
|
||||
import { getItem } from '@/utils/storage'
|
||||
/*
|
||||
*获取所有的子集路由
|
||||
*/
|
||||
const getChildrenRoutes = (routes) => {
|
||||
const result = [];
|
||||
const { deptBizType, deptLevel } = getItem('deptId')[0]
|
||||
routes.forEach((route) => {
|
||||
if (route.children && route.children.length > 0) {
|
||||
result.push(...route.children);
|
||||
if (deptBizType == '23') {
|
||||
result.push(...route.children);
|
||||
} else {
|
||||
if (route.path == '/HumanIntelligence') {
|
||||
route.children.splice(0, 1);
|
||||
result.push(...route.children);
|
||||
} else {
|
||||
result.push(...route.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(result);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
@ -34,8 +34,9 @@
|
||||
</h3>
|
||||
</template>
|
||||
<div class="grid-container">
|
||||
|
||||
<div v-for="(item,index) in listQuery.ossList" class="grid-item" :key="index">
|
||||
<el-image :src="setAddress(item.id)" :zoom-rate="1.2" :max-scale="7" :min-scale="0.2" :preview-src-list="srcList"
|
||||
<el-image :src="setAddress(item.fjZp)" :zoom-rate="1.2" :max-scale="7" :min-scale="0.2" :preview-src-list="srcList"
|
||||
show-progress :initial-index="4" fit="cover">
|
||||
<template #error>
|
||||
<div class="image-slot">
|
||||
@ -102,6 +103,8 @@ const listQuery = ref({})
|
||||
const srcList = ref([])
|
||||
const getDataById = (id) => {
|
||||
qcckGet({}, '/mosty-gsxt/tbGsxtBk/selectVoById/' + id).then(res => {
|
||||
console.log(res);
|
||||
|
||||
listQuery.value=res
|
||||
srcList.value=res.ossList.map(v=>setAddress(v.id))
|
||||
})
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="重点车辆管理">
|
||||
<el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<!-- <el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-button type="primary" @click="(visible = !visible), (visiblefp = false)" size="small">布控申请</el-button>
|
||||
</template>
|
||||
@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</el-popover>
|
||||
<el-button size="small" type="primary" @click="handleZxs">转线索</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button> -->
|
||||
<el-button type="primary" size="small" @click="addEdit('add', '')">
|
||||
<el-icon style="vertical-align: middle"><CirclePlus /></el-icon>
|
||||
<span style="vertical-align: middle">新增</span>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="重点群体管理">
|
||||
<el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<!-- <el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-button type="primary" @click="(visible = !visible), (visiblefp = false)" size="small">布控申请
|
||||
</el-button>
|
||||
@ -25,8 +25,8 @@
|
||||
</el-popover>
|
||||
|
||||
<el-button size="small" type="primary" @click="handleZxs">转线索</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button>
|
||||
<el-button size="small" type="primary">导入</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button> -->
|
||||
<!-- <el-button size="small" type="primary">导入</el-button> -->
|
||||
<el-button type="primary" size="small" @click="addEdit('add', null)">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="重点群体管理">
|
||||
<el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<!-- <el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-button type="primary" @click="(visible = !visible), (visiblefp = false)" size="small">布控申请
|
||||
</el-button>
|
||||
@ -26,8 +26,8 @@
|
||||
</el-popover>
|
||||
|
||||
<el-button size="small" type="primary" @click="handleZxs">转线索</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button>
|
||||
<el-button size="small" type="primary" >导入</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button> -->
|
||||
<!-- <el-button size="small" type="primary" >导入</el-button> -->
|
||||
<el-button type="primary" size="small" @click="addEdit('add', null)">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="重点群体审核">
|
||||
<el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<!-- <el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-button type="primary" @click="(visible = !visible), (visiblefp = false)" size="small">布控申请
|
||||
</el-button>
|
||||
@ -24,7 +24,7 @@
|
||||
</div>
|
||||
</el-popover>
|
||||
<el-button size="small" type="primary" @click="handleZxs">转线索</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button> -->
|
||||
<el-button type="primary" size="small" @click="addEdit('add', null)">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
@ -39,12 +39,12 @@
|
||||
</div>
|
||||
<!-- 表格 -->
|
||||
<div class="tabBox">
|
||||
<MyTable
|
||||
:tableData="pageData.tableData"
|
||||
:tableColumn="pageData.tableColumn"
|
||||
<MyTable
|
||||
:tableData="pageData.tableData"
|
||||
:tableColumn="pageData.tableColumn"
|
||||
:tableHeight="pageData.tableHeight"
|
||||
:key="pageData.keyCount"
|
||||
:tableConfiger="pageData.tableConfiger"
|
||||
:key="pageData.keyCount"
|
||||
:tableConfiger="pageData.tableConfiger"
|
||||
:controlsWidth="pageData.controlsWidth"
|
||||
@chooseData="chooseData"
|
||||
>
|
||||
@ -60,13 +60,13 @@
|
||||
<li class="one_text_detail">创建时间:{{ row.xtCjsj }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<template #bqList="{ row }">
|
||||
<ul >
|
||||
<ul >
|
||||
<li class="one_text_detail marks mb4" :key="index" v-for="(item, index) in row.bqList">{{ item.bqMc }}({{ item.bqFz || 0 }} 分) </li>
|
||||
<li class="one_text_detail marks mb4" :key="index" v-for="(item, index) in row.bqList">{{ item.bqMc }}({{ item.bqFz || 0 }} 分) </li>
|
||||
</ul>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
@ -100,7 +100,10 @@ import VisitRecord from '../model/visitRecord.vue'
|
||||
import CaseInfo from '../model/caseInfo.vue'
|
||||
import ActualPerformance from '../model/actualPerformance.vue'
|
||||
import CzModel from '../model/czModel.vue'
|
||||
import { ref, onUnmounted ,getCurrentInstance} from "vue";
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { ref, onUnmounted, getCurrentInstance } from "vue";
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { proxy } = getCurrentInstance();
|
||||
const emit = defineEmits(["updateDate"]);
|
||||
const chooseMarksVisible = ref(false);
|
||||
@ -218,8 +221,15 @@ const submit = async () => {
|
||||
|
||||
// 关闭
|
||||
const close = () => {
|
||||
if (route.query.id) {
|
||||
const query = { ...route.query };
|
||||
delete query.id;
|
||||
router.replace({ query });
|
||||
}
|
||||
|
||||
dialogForm.value = false;
|
||||
loading.value = false;
|
||||
emit('updateDate')
|
||||
};
|
||||
|
||||
defineExpose({ init });
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="重点人管理">
|
||||
<el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<!-- <el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-button type="primary" @click="(visible = !visible), (visiblefp = false)" size="small">布控申请</el-button>
|
||||
</template>
|
||||
<div class="flex just-center">
|
||||
<el-button size="small" type="primary" v-for="it in D_GS_BK_SQLX" :key="it.dm"
|
||||
@click="handleApplication(it)">{{it.zdmc }}</el-button>
|
||||
@click="handleApplication(it)">{{ it.zdmc }}</el-button>
|
||||
</div>
|
||||
</el-popover>
|
||||
<el-popover placement="bottom" :visible="visiblefp" :width="400" trigger="click">
|
||||
</el-popover> -->
|
||||
<!-- <el-popover placement="bottom" :visible="visiblefp" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-button size="small" type="primary" @click="(visiblefp = !visiblefp), (visible = false)">指定分配</el-button>
|
||||
</template>
|
||||
@ -22,10 +22,10 @@
|
||||
<el-button type="primary" @click="handlefp" size="small">分配</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
<el-button size="small" type="primary" @click="handleZxs">转线索</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button>
|
||||
<el-button size="small" type="primary" >导入</el-button>
|
||||
</el-popover> -->
|
||||
<!-- <el-button size="small" type="primary" @click="handleZxs">转线索</el-button> -->
|
||||
<!-- <el-button size="small" type="primary" @click="handleMove">移交管控</el-button> -->
|
||||
<!-- <el-button size="small" type="primary">导入</el-button> -->
|
||||
<el-button type="primary" size="small" @click="addEdit('add', '')">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
@ -81,8 +81,10 @@
|
||||
<!-- 操作 -->
|
||||
<template #controls="{ row }">
|
||||
<el-link size="small" type="success" @click="handleremove(row.id)">移除</el-link>
|
||||
<el-link size="small" type="success" v-if="row.zdrZt == '01'||row.zdrZt == '03'" @click="handleSend(row.id)">送审</el-link>
|
||||
<el-link size="small" type="primary" v-if="row.zdrZt == '01'||row.zdrZt == '03'" @click="addEdit('edit', row)">编辑</el-link>
|
||||
<el-link size="small" type="success" v-if="row.zdrZt == '01' || row.zdrZt == '03'"
|
||||
@click="handleSend(row.id)">送审</el-link>
|
||||
<el-link size="small" type="primary" v-if="row.zdrZt == '01' || row.zdrZt == '03'"
|
||||
@click="addEdit('edit', row)">编辑</el-link>
|
||||
<el-link size="small" type="primary" @click="addEdit('detail', row)">详情</el-link>
|
||||
<el-link size="small" type="danger" @click="deleteRow(row.id)">删除</el-link>
|
||||
</template>
|
||||
@ -114,6 +116,9 @@ import Search from "@/components/aboutTable/Search.vue";
|
||||
import AddForm from "./components/addForm.vue";
|
||||
import { qcckGet, qcckPost, qcckDelete } from "@/api/qcckApi.js";
|
||||
import { reactive, ref, onMounted, getCurrentInstance, nextTick } from "vue";
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { D_GS_ZDQT_ZT, D_GS_ZDR_RYJB, D_BZ_XB, D_BZ_MZ, D_BZ_XZQHDM, D_GS_ZDR_BK_ZT, D_GS_ZDR_CZZT, D_GS_BQ_ZL, D_GS_BQ_LB, D_GS_BQ_LX, D_GS_ZDR_YJDJ, D_GS_BK_SSJZ, D_GS_BK_SQLX, D_BZ_SF, D_GS_XS_LY, D_BZ_SSZT, D_GS_XS_LX, D_GS_XS_QTLX } =
|
||||
proxy.$dict("D_GS_ZDQT_ZT", "D_GS_ZDR_RYJB", "D_BZ_XB", "D_BZ_MZ", "D_BZ_XZQHDM", "D_GS_ZDR_BK_ZT", "D_GS_ZDR_CZZT", "D_GS_BQ_ZL", "D_GS_BQ_LB", "D_GS_BQ_LX", "D_GS_ZDR_YJDJ", "D_GS_BK_SSJZ", "D_GS_BK_SQLX", "D_BZ_SF", "D_GS_XS_LY", "D_BZ_SSZT", "D_GS_XS_LX", "D_GS_XS_QTLX");
|
||||
@ -191,8 +196,14 @@ const pageData = reactive({
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
tabHeightFn();
|
||||
tabHeightFn();
|
||||
if (route.query.id) {
|
||||
addEdit('x', {
|
||||
id: route.query.id
|
||||
})
|
||||
}else{
|
||||
getList();
|
||||
}
|
||||
});
|
||||
|
||||
// 搜索
|
||||
@ -215,7 +226,8 @@ const changeSize = (val) => {
|
||||
const getList = () => {
|
||||
pageData.tableConfiger.loading = true;
|
||||
// 人员类型D_ZDRY_RYLX(01 重点 02 普通〉
|
||||
let data = { rylx: '01', ...pageData.pageConfiger, ...queryFrom.value };
|
||||
// rylx: '01',
|
||||
let data = {...pageData.pageConfiger, ...queryFrom.value };
|
||||
qcckGet(data, "/mosty-gsxt/tbGsxtZdry/selectPage").then((res) => {
|
||||
pageData.tableData = res.records || [];
|
||||
pageData.total = res.total;
|
||||
|
||||
@ -69,7 +69,7 @@ const rules = reactive({
|
||||
ryJg: [{ required: true, message: "请选择籍贯", trigger: "change" }],
|
||||
zdrRyjb: [{ required: true, message: "请选择人员级别", trigger: "change" }],
|
||||
zdrYjdj: [{ required: true, message: "请选择预警等级", trigger: "change" }],
|
||||
rylx: [{ required: true, message: "请选择人员类型", trigger: "change" }]
|
||||
// rylx: [{ required: true, message: "请选择人员类型", trigger: "change" }]
|
||||
});
|
||||
const listQuery = ref({ ryLxdh: [""] }); //表单
|
||||
const chooseMarksVisible = ref(false); // 控制标签选择弹窗显示
|
||||
@ -90,19 +90,19 @@ const formData = ref([
|
||||
{ label: "出生日期", prop: "ryCsrq", type: "date" },
|
||||
{ label: "户籍地区划", prop: "hjdQh", type: "select", options: D_BZ_XZQHDM },
|
||||
{ label: "户籍地详址", prop: "hjdXz", type: "input" },
|
||||
{ label: "户籍地派出所", prop: "hjdPcsdm", type: "department" },
|
||||
{ label: "户籍地派出所", prop: "hjdPcsdm",depMc:"hjdPcsmc" ,type: "department" },
|
||||
{ label: "现住地区划", prop: "xzdQh", type: "select", options: D_BZ_XZQHDM },
|
||||
{ label: "现住地详址", prop: "xzdXz", type: "input" },
|
||||
{ label: "现住地派出所", prop: "xzdPcsdm", type: "department" },
|
||||
{ label: "现住地派出所", prop: "xzdPcsdm",depMc:"xzdPcsmc" ,type: "department" },
|
||||
{ label: "管辖单位", prop: "gxSsbmdm", depMc: 'gxSsbmmc', type: "department" },
|
||||
{ label: "诉求单位", prop: "sqSsbmdm", depMc: 'sqSsbmmc', type: "department" },
|
||||
{ label: "责任单位", prop: "zrSsbmdm", depMc: 'zrSsbmmc', type: "department" },
|
||||
{ label: "所属警种", prop: "zdrSsjz", type: "select", options: D_GS_BK_SSJZ },
|
||||
{ label: "涉及警种", prop: "zdrSjjz", type: "select", options: D_GS_BK_SSJZ, multiple: true },
|
||||
{ label: "婚姻状态", prop: "hyzk", type: "select", options: D_BZ_HYZK },
|
||||
{ label: "处置状态", prop: "zdrCzzt", type: "select", options: D_GS_ZDR_CZZT },
|
||||
{ label: "布控状态", prop: "zdrBkZt", type: "select", options: D_BZ_RCBKZT },
|
||||
{ label: "人员类型", prop: "rylx", type: "select", options: D_ZDRY_RYLX },
|
||||
// { label: "处置状态", prop: "zdrCzzt", type: "select", options: D_GS_ZDR_CZZT },
|
||||
// { label: "布控状态", prop: "zdrBkZt", type: "select", options: D_BZ_RCBKZT },
|
||||
// { label: "人员类型", prop: "rylx", type: "select", options: D_ZDRY_RYLX },
|
||||
{ label: "入库开始时间", prop: "zdrRkkssj", type: "datetime" },
|
||||
{ label: "入库结束时间", prop: "zdrRkjssj", type: "datetime" },
|
||||
{ label: "Mac地址", prop: "macDz", type: "input" },
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="重点人审批">
|
||||
<el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<!-- <el-popover placement="bottom" :visible="visible" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-button type="primary" @click="(visible = !visible), (visiblefp = false)" size="small">布控申请</el-button>
|
||||
</template>
|
||||
@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</el-popover>
|
||||
<el-button size="small" type="primary" @click="handleZxs">转线索</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button>
|
||||
<el-button size="small" type="primary" @click="handleMove">移交管控</el-button> -->
|
||||
</PageTitle>
|
||||
</div>
|
||||
<!-- 搜索 -->
|
||||
@ -56,7 +56,7 @@
|
||||
</template>
|
||||
<template #bqList="{ row }">
|
||||
<ul >
|
||||
<li class="one_text_detail marks mb4" :key="index" v-for="(item, index) in row.bqList">{{ item.bqMc }}({{ item.bqFz || 0 }} 分) </li>
|
||||
<li class="one_text_detail marks mb4" :key="index" v-for="(item, index) in row.bqList">{{ item.bqMc }}({{ item.bqFz || 0 }} 分) </li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
|
||||
@ -138,13 +138,11 @@ const init = (row) => {
|
||||
listQuery.value = res
|
||||
})
|
||||
};
|
||||
|
||||
watch(() => approvalEcho.value, (val) => {
|
||||
if (val) {
|
||||
approvalEcho.value.getWorkflow(listQuery.value.gzlid)
|
||||
}
|
||||
}, { deep: true })
|
||||
|
||||
// 关闭
|
||||
const close = () => {
|
||||
dialogForm.value = false;
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
<template>
|
||||
<div class="dialog" v-if="dialogForm">
|
||||
<div class="head_box">
|
||||
<span class="title">警务工作{{ title }}</span>
|
||||
<span class="title">{{ titleData }}{{ title }}</span>
|
||||
<div>
|
||||
<el-button @click="submitForm()" type="primary">保存</el-button>
|
||||
<el-button @click="close">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;width: 100%;" v-loading="loading">
|
||||
<div style="display: flex;width: 100%;" v-loading="loading">
|
||||
<div class="form_cnt">
|
||||
<FormMessage :disabled="disabled" v-model="listQuery" :formList="formData" ref="elform" :rules="rules">
|
||||
<template #gapdive>
|
||||
|
||||
<div style="width: 100%;height: 10px;" class="mb20">
|
||||
<el-divider content-position="left">基础信息</el-divider>
|
||||
</div>
|
||||
@ -30,15 +31,15 @@
|
||||
</template>
|
||||
</FormMessage>
|
||||
<el-divider content-position="left"><span class="mr20">活跃人员</span> </el-divider>
|
||||
<Personnel :dict="props.dict" ref="personnel" :perList="listQuery.ryList"/>
|
||||
<Personnel :dict="props.dict" ref="personnel" :perList="listQuery.ryList" />
|
||||
<el-divider content-position="left"><span class="mr20">车辆信息</span> </el-divider>
|
||||
<VehicleCar :dict="props.dict" ref="vehicleCar" :clList="listQuery.clList"/>
|
||||
<VehicleCar :dict="props.dict" ref="vehicleCar" :clList="listQuery.clList" />
|
||||
<el-divider content-position="left"><span class="mr20">关联群体</span> </el-divider>
|
||||
<Group :dict="props.dict" ref="group" :qtList="listQuery.qtList" />
|
||||
</div>
|
||||
<div class="person" v-if="showPj">
|
||||
<!-- <div class="person" v-if="showPj&&listQuery.qbjb!='00'">
|
||||
<AddForm ref="addForm" :dict="props.dict" :msgeDat="msgeDat" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -50,14 +51,18 @@ import VehicleCar from '../components/vehicleCar/index.vue'
|
||||
import Group from '../components/group/index.vue'
|
||||
import FormMessage from "@/components/aboutTable/FormMessage.vue";
|
||||
import { qbcjAdd, qbcjUpdate, qbcjSelectByid } from "@/api/Intelligence.js";
|
||||
import { ref, defineExpose, onMounted, defineEmits, watch } from "vue";
|
||||
import { ref, defineExpose, onMounted, defineEmits, watch } from "vue";
|
||||
import AddForm from '@/views/backOfficeSystem/MakeAcomment/components/a/addForm.vue'
|
||||
|
||||
import {useRoute,useRouter} from 'vue-router'
|
||||
const emit = defineEmits(["getList"]);
|
||||
const props = defineProps({
|
||||
dict: Object
|
||||
dict: Object,
|
||||
titleData: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
});
|
||||
const loading=ref(false)
|
||||
const loading = ref(false)
|
||||
const dialogForm = ref(false); //弹窗
|
||||
const formData = ref();
|
||||
watch(() => dialogForm.value, (val) => {
|
||||
@ -66,8 +71,8 @@ watch(() => dialogForm.value, (val) => {
|
||||
{ prop: "gapdive", type: "slot", width: '100%' },
|
||||
{ label: "情报标题", prop: "qbmc", type: "input", width: '45%' },
|
||||
{ label: "情报类型", prop: "qblx", type: "select", options: props.dict.D_GS_XS_LX, width: '45%' },
|
||||
{ label: "情报密级", prop: "qbmj", type: "select", options: props.dict.D_BZ_BMJB, width: '45%' },
|
||||
{ label: "情报来源", prop: "qbly", type: "select", options: props.dict.D_GS_XS_LY, width: '45%' },
|
||||
{ label: "情报等级", prop: "qbmj", type: "select", options: props.dict.D_BZ_BMJB, width: '45%' },
|
||||
// { label: "情报来源", prop: "qbly", type: "select", options: props.dict.D_GS_XS_LY, width: '45%' },
|
||||
{ label: "情报上报时间", prop: "sxsbsj", type: "datetime", width: '45%' },
|
||||
{ label: "指向时间", prop: "zxkssj", type: "datetime", width: '45%' },
|
||||
{ label: "指向地址", prop: "zxdz", type: "input", width: '45%' },
|
||||
@ -118,12 +123,16 @@ const submitForm = () => {
|
||||
loading.value = true
|
||||
elform.value.submit(valid => {
|
||||
if (valid) {
|
||||
|
||||
|
||||
const promes = {
|
||||
...listQuery.value,
|
||||
fjdz: fjdz.value.length > 0 ? fjdz.value.join(',') : '',
|
||||
ryList: personnel.value.listData() || [],
|
||||
clList: vehicleCar.value.listData() || [],
|
||||
qtList:group.value.listData() || [],
|
||||
qtList: group.value.listData() || [],
|
||||
cjLx: 0
|
||||
|
||||
}
|
||||
if (title.value == '新增') {
|
||||
qbcjAdd(promes).then((res) => {
|
||||
@ -143,8 +152,15 @@ const submitForm = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
// 关闭
|
||||
const close = () => {
|
||||
if (route.query.id) {
|
||||
const query = { ...route.query };
|
||||
delete query.id;
|
||||
router.replace({ query });
|
||||
}
|
||||
fjdz.value = []
|
||||
listQuery.value = {};
|
||||
dialogForm.value = false;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="警务工作管理">
|
||||
<PageTitle :title="titleData">
|
||||
<el-button type="primary" @click="addEdit('add')">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
@ -14,6 +14,18 @@
|
||||
</el-icon>
|
||||
<span style="vertical-align: middle">导出</span>
|
||||
</el-button>
|
||||
<el-button type="primary" :disabled="ids.length === 0" @click="batchMark(ids)" v-if="qxkz.deptLevel == '01'">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
</el-icon>
|
||||
<span style="vertical-align: middle" >批量打标</span>
|
||||
</el-button>
|
||||
<el-button type="primary" :disabled="ids.length === 0" @click="handleSumbit(ids)" v-if="qxkz.deptLevel != '01'">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
</el-icon>
|
||||
<span style="vertical-align: middle">批量上报</span>
|
||||
</el-button>
|
||||
<el-button type="primary" :disabled="ids.length === 0" @click="delDictItem(ids)">
|
||||
<el-icon style="vertical-align: middle">
|
||||
<CirclePlus />
|
||||
@ -35,63 +47,34 @@
|
||||
<template #qblx="{ row }">
|
||||
<DictTag :tag="false" :value="row.qblx" :options="D_GS_XS_LX" />
|
||||
</template>
|
||||
<template #qbly="{ row }">
|
||||
<DictTag :tag="false" :value="row.qbly" :options="D_GS_XS_LY" />
|
||||
<template #cjlx="{ row }">
|
||||
<DictTag :tag="false" :value="row.cjLx" :options="D_BZ_CJLX" />
|
||||
</template>
|
||||
<!-- <template #czzt="{row}">
|
||||
<DictTag :tag="false" :value="row.czzt" :options="D_GS_XS_CZZT" />
|
||||
</template> -->
|
||||
<template #shzt="{ row }">
|
||||
<!-- 采纳(将这条信息推送到情报管理),退回! -->
|
||||
<DictTag :tag="false" :value="row.shzt" :options="D_BZ_XSSHZT" @clickTag="clickTag(row.shzt)" />
|
||||
<template #czzt="{ row }">
|
||||
<DictTag :tag="false" :value="row.czzt" :options="D_BZ_QBCZZT" />
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #controls="{ row }">
|
||||
<!-- (01 提交 02 上报 03 采纳 04 退回 05 打标签)v-if="qxkz.deptLevel == '01'" -->
|
||||
<el-link size="small" type="primary" v-if="row.czzt == '02'&&qxkz.deptLevel == '01'" @click="cnMsg(row)">采纳</el-link>
|
||||
<el-link size="small" type="primary" v-if="row.czzt == '03'&&qxkz.deptLevel == '01'" @click="opneMsg(row)">打标签</el-link>
|
||||
<el-link size="small" type="primary" @click="rollbackNewspapers(row)"
|
||||
v-if="row.czzt == '02' && row.qbjb == '00'" >回退</el-link>
|
||||
<el-link size="small" type="primary" @click="checkProcess(row)">查看流程</el-link>
|
||||
<el-link size="small" type="primary" @click="appearNewspapers(row)"
|
||||
v-if="row.czzt == '01' || row.czzt == '04' && row.qbjb == '00'&&qxkz.deptLevel != '01'">上报</el-link>
|
||||
<el-link size="small" type="primary" @click="addEdit('info', row)">详情</el-link>
|
||||
<el-link size="small" type="primary" @click="addEdit('edit', row)">修改</el-link>
|
||||
<!-- <el-link size="small" type="primary" @click="addEdit('edit', row)">下发指令</el-link> -->
|
||||
<el-popconfirm title="是否进行发布?" @confirm="confirm(row)">
|
||||
<template #reference>
|
||||
<el-link size="small" type="primary">发布</el-link>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<el-popover placement="left" :visible="row.visible" :width="400" trigger="click">
|
||||
<template #reference>
|
||||
<el-link size="small" type="primary" @click.stop="handleSh(row)">转线索</el-link>
|
||||
</template>
|
||||
|
||||
<div class="flex mb10 align-center">
|
||||
<div class="w70 label-pop">状态 :</div>
|
||||
<div style="flex:1">
|
||||
<el-radio-group v-model="chooseRow.shzt" @change="rules.bhyy = false">
|
||||
<el-radio v-for="obj in D_BZ_XSSHZT" :key="obj.value" :label="obj.value">{{ obj.zdmc }}</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex" v-if="chooseRow.shzt == '01'">
|
||||
<div class="w70 label-pop">驳回原因 :</div>
|
||||
<div style="flex:1">
|
||||
<MOSTY.Other filterable style="width: 100%;" v-model="chooseRow.bhyy" type="textarea" rows="3" clearable
|
||||
placeholder="请输入审核原因" />
|
||||
<div class="f12" style="color: red;" v-if="rules.bhyy">请输入驳回原因</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt10 flex just-center">
|
||||
<el-button size="small" @click.stop="cancel(row)">取消</el-button>
|
||||
<el-button size="small" type="primary" @click.stop="handleSumbit(row)">确定</el-button>
|
||||
</div>
|
||||
</el-popover>
|
||||
<el-link size="small" type="danger" @click="delDictItem(row.id)">删除</el-link>
|
||||
</template>
|
||||
</MyTable>
|
||||
</MyTable>checkProcess
|
||||
<Pages @changeNo="changeNo" @changeSize="changeSize" :tableHeight="pageData.tableHeight" :pageConfiger="{
|
||||
...pageData.pageConfiger,
|
||||
total: pageData.total
|
||||
}"></Pages>
|
||||
</div>
|
||||
<!-- 新增 -->
|
||||
<AddForm ref="detailDiloag" @getList="getList" :dict="{
|
||||
<AddForm ref="detailDiloag" @getList="getList" :titleData="titleData" :dict="{
|
||||
D_BZ_SF,
|
||||
D_GS_XS_LY,
|
||||
D_BZ_SSZT,
|
||||
@ -105,7 +88,11 @@
|
||||
D_BZ_XZQHDM
|
||||
}" />
|
||||
</div>
|
||||
<ExportFile v-model="exportFileModel" :tableColumn="tableColumn" :dict="{ D_GS_XS_LY ,D_GS_XS_LX}" :dataModel="pageData.tableData"/>
|
||||
<ExportFile v-model="exportFileModel" :tableColumn="tableColumn" :dict="{ D_GS_XS_LY, D_GS_XS_LX, D_GS_XS_LX }"
|
||||
:dataModel="pageData.tableData" />
|
||||
<MakeTag v-model="chooseRow" :dataList="dataList" :dict="{ D_BZ_CJLX, D_BZ_QBCZZT, D_GS_XS_LX, D_BZ_BQJB }"
|
||||
@getList="getList" />
|
||||
<CheckProcess v-model="checkProcessModel" :dataList="dataList" :dict="{ D_BZ_QBCZZT}"/>
|
||||
|
||||
</template>
|
||||
|
||||
@ -116,43 +103,46 @@ import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import Pages from "@/components/aboutTable/Pages.vue";
|
||||
import Search from "@/components/aboutTable/Search.vue";
|
||||
import AddForm from "./components/addForm.vue";
|
||||
import { qcckGet, qcckPost } from "@/api/qcckApi.js";
|
||||
import { qbcjSelectPage, qbcjDeletes } from "@/api/Intelligence.js";
|
||||
import { reactive, ref, onMounted, getCurrentInstance, nextTick, watch } from "vue";
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { qbcjSelectQbsbPage, qbcjDeletes, qbcjCzzt,qbcjPlsb } from "@/api/Intelligence.js";
|
||||
import { reactive, ref, onMounted, getCurrentInstance } from "vue";
|
||||
import MakeTag from '../components/maketag.vue'
|
||||
import ExportFile from './components/exportFile.vue'
|
||||
import CheckProcess from '../components/checkProcess.vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { getItem } from '@//utils/storage.js'
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { D_GS_XS_LY, D_BZ_SSZT, D_BZ_SF, D_GS_XS_LX,
|
||||
D_GS_XS_QTLX, D_BZ_XSSHZT, D_GS_ZDQT_LB,
|
||||
D_BZ_BMJB, D_BZ_CLPP, D_BZ_CLYS, D_BZ_CLLX, D_BZ_XZQHDM, D_GS_XS_CZZT } =
|
||||
proxy.$dict("D_BZ_BMJB", "D_GS_XS_CZZT", "D_GS_XS_LY",
|
||||
const { D_GS_XS_LY, D_BZ_SSZT, D_BZ_SF, D_GS_XS_LX, D_BZ_BQJB,
|
||||
D_GS_XS_QTLX, D_GS_ZDQT_LB,
|
||||
D_BZ_BMJB, D_BZ_CLPP, D_BZ_CLYS, D_BZ_CLLX, D_BZ_XZQHDM, D_BZ_QBCZZT, D_BZ_CJLX } =
|
||||
proxy.$dict("D_BZ_BMJB", "D_GS_XS_LY",
|
||||
"D_BZ_SSZT", "D_BZ_SF", "D_GS_XS_LX", "D_GS_XS_QTLX",
|
||||
"D_BZ_XSSHZT", "D_GS_ZDQT_LB", "D_BZ_CLPP", "D_BZ_CLYS", "D_BZ_CLLX", "D_BZ_XZQHDM", "D_GS_XS_CZZT"); //获取字典数据
|
||||
"D_GS_ZDQT_LB", "D_BZ_CLPP", "D_BZ_CLYS", "D_BZ_CLLX", "D_BZ_XZQHDM", "D_BZ_QBCZZT", "D_BZ_CJLX", "D_BZ_BQJB"); //获取字典数据
|
||||
const detailDiloag = ref();
|
||||
const searchBox = ref(); //搜索框
|
||||
const chooseRow = ref({})
|
||||
const rules = reactive({
|
||||
bhyy: false,
|
||||
shzt: false,
|
||||
})
|
||||
const ids = ref([])
|
||||
const tableList = ref([]);
|
||||
const chooseData = (val) => {
|
||||
ids.value = val.map(item => {
|
||||
return item.id
|
||||
})
|
||||
tableList.value=val
|
||||
}
|
||||
|
||||
|
||||
const isShow = ref(false)
|
||||
const searchConfiger = ref([
|
||||
{ label: "情报标题", prop: 'qbmc', placeholder: "请输入情报标题", showType: "input" },
|
||||
{ label: "姓名", prop: 'sjryxm', placeholder: "请输入姓名", showType: "input" },
|
||||
{ label: "身份证号", prop: 'sjrysfzh', placeholder: "请输入身份证号", showType: "input" },
|
||||
{ label: "姓名", prop: 'xssbr', placeholder: "请输入姓名", showType: "input" },
|
||||
{ label: "身份证号", prop: 'sfzh', placeholder: "请输入身份证号", showType: "input" },
|
||||
{ label: "群体名称", prop: 'qtmc', placeholder: "请输入群体名称", showType: "input" },
|
||||
{ label: "指向地点", prop: 'zxdz', placeholder: "请输入指向地点", showType: "input" },
|
||||
{ label: "指向时间", prop: 'zxkssj', placeholder: "请选择开始时间", showType: "datetimerange" },
|
||||
{ label: "录入时间", prop: 'lrkssj', placeholder: "请选择开始时间", showType: "datetimerange" },
|
||||
{ label: "情报类型", prop: 'qblx', placeholder: "请选择情报类型", showType: "select", options: D_GS_XS_LX },
|
||||
{ label: "情报来源", prop: 'qbly', placeholder: "请选择情报来源", showType: "select", options: D_GS_XS_LY },
|
||||
{ label: "情报处置状态", prop: 'czzt', placeholder: "请选择处置状态", showType: "select", options: D_GS_XS_CZZT },
|
||||
{ label: "来源单位", prop: 'gxdwdm', placeholder: "请选择来源单位", showType: "department" },
|
||||
{ label: "情报来源", prop: 'cjLx', placeholder: "请选择情报来源", showType: "select", options: D_BZ_CJLX },
|
||||
{ label: "情报处置状态", prop: 'czzt', placeholder: "请选择处置状态", showType: "select", options: D_BZ_QBCZZT },
|
||||
{ label: "来源单位", prop: 'ssbmdm', placeholder: "请选择来源单位", showType: "department" },
|
||||
{ label: "关键字", prop: 'keyword', placeholder: "请输入关键字", showType: "input" },
|
||||
]);
|
||||
const pageData = reactive({
|
||||
@ -174,52 +164,99 @@ const pageData = reactive({
|
||||
{ label: "情报编号", prop: "xsBh" },
|
||||
{ label: "情报标题", prop: "qbmc" },
|
||||
{ label: "情报类型", prop: "qblx", showSolt: true },
|
||||
{ label: "情报来源", prop: "qbly", showSolt: true },
|
||||
{ label: "情报来源", prop: "cjlx", showSolt: true },
|
||||
{ label: "情报上报时间", prop: "sxsbsj" },
|
||||
{ label: "指向地点", prop: "zxdz" },
|
||||
{ label: "消息状态", prop: "czzt", showSolt: true },
|
||||
{ label: "情报内容", prop: "qbnr" },
|
||||
]
|
||||
});
|
||||
const queryFrom = ref({});
|
||||
|
||||
|
||||
// 上报
|
||||
const appearNewspapers = (item) => {
|
||||
proxy.$confirm("确定要上报", "警告", { type: "warning" }).then(() => {
|
||||
qbcjCzzt({ id: item.id, czzt: '02', qbjb: '00' }).then(res => {
|
||||
proxy.$message({ type: "success", message: "上报成功" });
|
||||
getList();
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
tabHeightFn()
|
||||
|
||||
});
|
||||
|
||||
|
||||
const handleSh = (val) => {
|
||||
chooseRow.value = { id: val.id, shzt: '01' }
|
||||
val.visible = !val.visible;
|
||||
}).catch(() => { });
|
||||
}
|
||||
const cancel = (row) => {
|
||||
row.visible = false;
|
||||
rules.bhyy = false;
|
||||
chooseRow.value = {}
|
||||
}
|
||||
const handleSumbit = (row) => {
|
||||
rules.bhyy = !chooseRow.value.bhyy ? true : false;
|
||||
if (chooseRow.value.shzt == '01' && rules.bhyy) return false;
|
||||
let data = { ...chooseRow.value }
|
||||
qcckPost(data, '/mosty-gsxt/qbcj/updateByXssh').then(res => {
|
||||
row.visible = false;
|
||||
proxy.$message({ type: "success", message: "审核成功" });
|
||||
getList();
|
||||
|
||||
|
||||
// 回退
|
||||
const rollbackNewspapers = (item) => {
|
||||
ElMessageBox.prompt('请输入回退原因', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
.then(({ value }) => {
|
||||
qbcjCzzt({ id: item.id, czzt: '04', qbjb: '00', czthyy: value }).then(res => {
|
||||
proxy.$message({ type: "success", message: "回退成功" });
|
||||
getList();
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
}
|
||||
|
||||
const chooseRow = ref(false)
|
||||
const dataList = ref()
|
||||
const opneMsg = (item) => {
|
||||
chooseRow.value = true
|
||||
dataList.value = [item]
|
||||
}
|
||||
const cnMsg = (item) => {
|
||||
proxy.$confirm("确定要采纳", "警告", { type: "warning" }).then(() => {
|
||||
qbcjCzzt({ id: item.id, czzt: '03', qbjb: '00' }).then(res => {
|
||||
proxy.$message({ type: "success", message: "采纳成功" });
|
||||
getList();
|
||||
})
|
||||
|
||||
}).catch(() => { });
|
||||
}
|
||||
// 批量打标
|
||||
const batchMark = () => {
|
||||
const listDb= tableList.value.filter(item => item.czzt != '03')
|
||||
if (listDb.length == 0) {
|
||||
chooseRow.value = true
|
||||
dataList.value = tableList.value
|
||||
} else {
|
||||
proxy.$message({
|
||||
message: '还有情报未审批',
|
||||
type: 'warning',
|
||||
showClose: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
const handleSumbit = () => {
|
||||
const listDb = tableList.value.filter(item => item.czzt != '01' && item.czzt != '04')
|
||||
if (listDb.length == 0) {
|
||||
proxy.$confirm("确定要上报", "警告", { type: "warning" }).then(() => {
|
||||
qbcjPlsb({ ids: ids.value, qbjb: '00' }).then(res => {
|
||||
proxy.$message({ type: "success", message: "上报成功" });
|
||||
getList();
|
||||
})
|
||||
}).catch(() => { });
|
||||
} else {
|
||||
proxy.$message({
|
||||
message: '请选择正确数据',
|
||||
type: 'warning',
|
||||
showClose: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 搜索
|
||||
const onSearch = (val) => {
|
||||
const { lrkssj, zxkssj } = val
|
||||
console.log(lrkssj, zxkssj);
|
||||
const promes = {
|
||||
...pageData.pageConfiger,
|
||||
...pageData.pageConfiger,
|
||||
...val,
|
||||
lrkssj: lrkssj ? lrkssj[0] : '',
|
||||
lrjssj: lrkssj ? lrkssj[1] : '',
|
||||
zxkssj: zxkssj ? zxkssj[0] : '',
|
||||
@ -244,7 +281,7 @@ const changeSize = (val) => {
|
||||
const getList = () => {
|
||||
pageData.tableConfiger.loading = true;
|
||||
let data = { ...pageData.pageConfiger, ...queryFrom.value };
|
||||
qbcjSelectPage(data).then(res => {
|
||||
qbcjSelectQbsbPage(data).then(res => {
|
||||
pageData.tableData = res.records || [];
|
||||
pageData.total = res.total;
|
||||
pageData.tableConfiger.loading = false;
|
||||
@ -257,22 +294,20 @@ const delDictItem = (id) => {
|
||||
proxy.$message({ type: "success", message: "删除成功" });
|
||||
getList();
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
}).catch(() => { });
|
||||
}
|
||||
// 导出数据
|
||||
const tableColumn = reactive([
|
||||
{ label: "上报人姓名", prop: "xssbr" },
|
||||
{ label: "情报编号", prop: "xsBh" },
|
||||
{ label: "情报标题", prop: "qbmc" },
|
||||
{ label: "情报类型", prop: "qblx", showSolt: true,zd:'D_GS_XS_LX' },
|
||||
{ label: "情报来源", prop: "qbly", showSolt: true,zd:'D_GS_XS_LY' },
|
||||
{ label: "情报上报时间", prop: "sxsbsj" },
|
||||
{ label: "指向地点", prop: "zxdz" },
|
||||
{ label: "情报内容", prop: "qbnr",showOverflowTooltip: true },
|
||||
{ label: "上报人姓名", prop: "xssbr" },
|
||||
{ label: "情报编号", prop: "xsBh" },
|
||||
{ label: "情报标题", prop: "qbmc" },
|
||||
{ label: "情报类型", prop: "qblx", showSolt: true, zd: 'D_GS_XS_LX' },
|
||||
{ label: "情报来源", prop: "cjLx", showSolt: true, zd: 'D_BZ_CJLX' },
|
||||
{ label: "情报上报时间", prop: "sxsbsj" },
|
||||
{ label: "指向地点", prop: "zxdz" },
|
||||
{ label: "情报内容", prop: "qbnr", showOverflowTooltip: true },
|
||||
])
|
||||
|
||||
// 详情
|
||||
const addEdit = (type, row) => {
|
||||
isShow.value = true;
|
||||
@ -280,14 +315,6 @@ const addEdit = (type, row) => {
|
||||
detailDiloag.value.init(type, row);
|
||||
}, 500)
|
||||
};
|
||||
//发布
|
||||
const confirm = (item) => {
|
||||
qcckPost({ id: item.id, sffb: 1 }, '/mosty-gsxt/qbcj/qbfb').then(res => {
|
||||
proxy.$message({ type: "success", message: "发布成功" });
|
||||
getList();
|
||||
})
|
||||
|
||||
}
|
||||
// 表格高度计算
|
||||
const tabHeightFn = () => {
|
||||
pageData.tableHeight = window.innerHeight - searchBox.value.offsetHeight - 250;
|
||||
@ -295,10 +322,42 @@ const tabHeightFn = () => {
|
||||
tabHeightFn();
|
||||
};
|
||||
};
|
||||
const route = useRoute()
|
||||
const titleData = ref()
|
||||
const qxkz = reactive({
|
||||
deptBizType: '',
|
||||
deptLevel: '',
|
||||
});
|
||||
onMounted(() => {
|
||||
const { deptBizType, deptLevel } = getItem('deptId')[0]
|
||||
const Jb = deptLevel[0] == '2' ? '01' : deptLevel[0] == '3' ? '02' : '03'
|
||||
qxkz.deptBizType = deptBizType
|
||||
qxkz.deptLevel = Jb
|
||||
getRouter()
|
||||
tabHeightFn()
|
||||
if (route.query.id) {
|
||||
detailDiloag.value.init('edit', {
|
||||
id: route.query.id
|
||||
});
|
||||
return
|
||||
}
|
||||
getList()
|
||||
|
||||
|
||||
});
|
||||
const getRouter = () => {
|
||||
titleData.value = route.meta.title
|
||||
|
||||
}
|
||||
const exportFileModel = ref(false)
|
||||
const dologCancel = () => {
|
||||
exportFileModel.value = true;
|
||||
}
|
||||
// 流程
|
||||
const checkProcessModel=ref()
|
||||
const checkProcess = (item) => {
|
||||
checkProcessModel.value = true
|
||||
dataList.value = item
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="dialog" v-if="dialogForm">
|
||||
<div class="head_box">
|
||||
<span class="title">社会信息员工工作考核{{ title }} </span>
|
||||
<span class="title">工作考核{{ title }} </span>
|
||||
<div>
|
||||
<el-button type="primary" size="small" :loading="loading" @click="submit" >保存</el-button>
|
||||
<el-button size="small" @click="close">关闭</el-button>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="titleBox">
|
||||
<PageTitle title="社会信息员工工作考核">
|
||||
<PageTitle title="工作考核">
|
||||
<el-button type="primary" @click="addEdit('add', '')">
|
||||
<el-icon style="vertical-align: middle"><CirclePlus /></el-icon>
|
||||
<span style="vertical-align: middle">新增</span>
|
||||
|
||||
@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<div class="dialog" v-if="dialogForm">
|
||||
<div class="head_box">
|
||||
<span class="title">{{ titleData }}{{ title }}</span>
|
||||
<div>
|
||||
<!-- <el-button @click="submitForm()" type="primary">保存</el-button> -->
|
||||
<el-button @click="close">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;width: 100%;" v-loading="loading">
|
||||
<div class="form_cnt">
|
||||
<FormMessage :disabled="disabled" v-model="listQuery" :formList="formData" ref="elform" :rules="rules">
|
||||
<template #gapdive>
|
||||
|
||||
<div style="width: 100%;height: 10px;" class="mb20">
|
||||
<el-divider content-position="left">基础信息</el-divider>
|
||||
</div>
|
||||
</template>
|
||||
<template #gapline>
|
||||
<div style="width: 100%;height: 10px;" class="mb20">
|
||||
<el-divider content-position="left">情报内容</el-divider>
|
||||
</div>
|
||||
</template>
|
||||
<template #scfj>
|
||||
<div style="width: 100%;padding-left: 50px;">
|
||||
<div>上传附件:<span class="f12">(可附电子表格、Word文档、图像、音视频文件)</span> </div>
|
||||
<div>
|
||||
<MOSTY.Upload :showBtn="true" :isAll="true" :isImg="true" disabled :limit="10" v-model="fjdz" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</FormMessage>
|
||||
<el-divider content-position="left"><span class="mr20">活跃人员</span> </el-divider>
|
||||
<Personnel :dict="props.dict" ref="personnel" :perList="listQuery.ryList" />
|
||||
<el-divider content-position="left"><span class="mr20">车辆信息</span> </el-divider>
|
||||
<VehicleCar :dict="props.dict" ref="vehicleCar" :clList="listQuery.clList" />
|
||||
<el-divider content-position="left"><span class="mr20">关联群体</span> </el-divider>
|
||||
<Group :dict="props.dict" ref="group" :qtList="listQuery.qtList" />
|
||||
</div>
|
||||
<div class="person" v-if="showPj&&listQuery.qbjb!='00'">
|
||||
<AddForm ref="addForm" :dict="props.dict" :msgeDat="msgeDat" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as MOSTY from "@/components/MyComponents/index";
|
||||
import Personnel from '../components/personnel/index.vue'
|
||||
import VehicleCar from '../components/vehicleCar/index.vue'
|
||||
import Group from '../components/group/index.vue'
|
||||
import FormMessage from "@/components/aboutTable/FormMessage.vue";
|
||||
import { qbcjAdd, qbcjUpdate, qbcjSelectByid } from "@/api/Intelligence.js";
|
||||
import { ref, defineExpose, onMounted, defineEmits, watch } from "vue";
|
||||
import AddForm from '@/views/backOfficeSystem/MakeAcomment/components/a/addForm.vue'
|
||||
import {useRoute,useRouter} from 'vue-router'
|
||||
const emit = defineEmits(["getList"]);
|
||||
const props = defineProps({
|
||||
dict: Object,
|
||||
titleData: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
});
|
||||
const loading = ref(false)
|
||||
const dialogForm = ref(false); //弹窗
|
||||
const formData = ref();
|
||||
watch(() => dialogForm.value, (val) => {
|
||||
if (val) {
|
||||
formData.value = [
|
||||
{ prop: "gapdive", type: "slot", width: '100%' },
|
||||
{ label: "情报标题", prop: "qbmc", type: "input", width: '45%' },
|
||||
{ label: "情报类型", prop: "qblx", type: "select", options: props.dict.D_GS_XS_LX, width: '45%' },
|
||||
{ label: "情报等级", prop: "qbmj", type: "select", options: props.dict.D_BZ_BMJB, width: '45%' },
|
||||
// { label: "情报来源", prop: "qbly", type: "select", options: props.dict.D_GS_XS_LY, width: '45%' },
|
||||
{ label: "情报上报时间", prop: "sxsbsj", type: "datetime", width: '45%' },
|
||||
{ label: "指向时间", prop: "zxkssj", type: "datetime", width: '45%' },
|
||||
{ label: "指向地址", prop: "zxdz", type: "input", width: '45%' },
|
||||
{ label: "附件上传", prop: "fjdz", type: "upload", width: '100%' },
|
||||
{ label: "情报内容", prop: "qbnr", type: "textarea", width: '100%' },
|
||||
]
|
||||
}
|
||||
}, { deep: true })
|
||||
const fjdz = ref()
|
||||
const listQuery = ref({}); //表单
|
||||
const elform = ref();
|
||||
onMounted(() => {
|
||||
})
|
||||
const addForm = ref()
|
||||
const msgeDat = ref()
|
||||
const title = ref("")
|
||||
const showPj = ref(false)
|
||||
const disabled = ref(false)
|
||||
// 初始化数据
|
||||
const init = (type, row) => {
|
||||
title.value = type == "add" ? "新增" : type == "info" ? "详情" : "编辑"
|
||||
disabled.value = type == 'info' ? true : false
|
||||
fjdz.value = []
|
||||
dialogForm.value = true;
|
||||
if (type == 'info' || type == 'edit') {
|
||||
showPj.value = true
|
||||
msgeDat.value = row
|
||||
// 初始化表单数据,并根据详情页设置禁用状态
|
||||
if (row) getDataById(row.id);
|
||||
} else {
|
||||
showPj.value = false
|
||||
}
|
||||
};
|
||||
// 根据id查询详情
|
||||
const getDataById = (id) => {
|
||||
qbcjSelectByid({ id }).then((res) => {
|
||||
fjdz.value = res.ossList || [];
|
||||
listQuery.value = res;
|
||||
});
|
||||
};
|
||||
|
||||
// 获取人员信息
|
||||
const personnel = ref(null)
|
||||
const vehicleCar = ref(null)
|
||||
const group = ref(null)
|
||||
// 新增
|
||||
const submitForm = () => {
|
||||
loading.value = true
|
||||
elform.value.submit(valid => {
|
||||
if (valid) {
|
||||
|
||||
|
||||
const promes = {
|
||||
...listQuery.value,
|
||||
fjdz: fjdz.value.length > 0 ? fjdz.value.join(',') : '',
|
||||
ryList: personnel.value.listData() || [],
|
||||
clList: vehicleCar.value.listData() || [],
|
||||
qtList: group.value.listData() || [],
|
||||
cjLx: 0
|
||||
|
||||
}
|
||||
if (title.value == '新增') {
|
||||
qbcjAdd(promes).then((res) => {
|
||||
emit("getList")
|
||||
close()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else if (title.value == '编辑') {
|
||||
qbcjUpdate(promes).then((res) => {
|
||||
emit("getList")
|
||||
close()
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
// 关闭
|
||||
const close = () => {
|
||||
if (route.query.id) {
|
||||
const query = { ...route.query };
|
||||
delete query.id;
|
||||
router.replace({ query });
|
||||
}
|
||||
fjdz.value = []
|
||||
listQuery.value = {};
|
||||
dialogForm.value = false;
|
||||
loading.value = false;
|
||||
};
|
||||
defineExpose({ init });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/assets/css/layout.scss";
|
||||
@import "~@/assets/css/element-plus.scss";
|
||||
|
||||
::v-deep .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
|
||||
color: #0072ff;
|
||||
background: rgba(0, 114, 255, 0.3);
|
||||
}
|
||||
|
||||
.boxlist {
|
||||
width: 99%;
|
||||
height: 225px;
|
||||
margin-top: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
::v-deep .avatar-uploader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .el-upload-list {
|
||||
margin-left: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .el-upload-list__item-name .el-icon {
|
||||
top: 3px;
|
||||
}
|
||||
|
||||
.form_cnt {
|
||||
// width: 75%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.person {
|
||||
padding-left: 20px;
|
||||
width: 25%;
|
||||
// height: 100vh;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,8 @@
|
||||
<!-- 批量导入 -->
|
||||
<template>
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@ -0,0 +1,159 @@
|
||||
<!--文件导出 -->
|
||||
<template>
|
||||
<el-dialog v-model="modelValue" :title="title" :width="width" top="5vh" @close="close" append-to-body>
|
||||
<div style="height: 70vh;">
|
||||
|
||||
<MyTable ref="tableData" :tableData="pageForm.tableData" :tableColumn="pageForm.tableColumn"
|
||||
:tableHeight="pageForm.tableHeight" :key="pageForm.keyCount" :tableConfiger="pageForm.tableConfiger"
|
||||
:controlsWidth="pageForm.controlsWidth">
|
||||
<template #[item.prop]="{ row }" v-for="(item, index) in soltData">
|
||||
<template v-if="item.zd">
|
||||
<DictTag :tag="false" :value="row[item.prop]" :options="props.dict[item.zd]" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<slot :name="item.prop" :row="row"></slot>
|
||||
</template>
|
||||
</template>
|
||||
</MyTable>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="exportCurrentTable">导出 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import * as XLSX from 'xlsx'
|
||||
import { onMounted, reactive, watch, ref } from 'vue'
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import { template } from 'lodash';
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '50%'
|
||||
}, tableColumn: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}, dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '导出数据'
|
||||
}, dataModel: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
}
|
||||
})
|
||||
onMounted(() => {
|
||||
{ { props.dict } }
|
||||
})
|
||||
watch(() => props.modelValue, (newVal, oldVal) => {
|
||||
if(newVal){
|
||||
pageForm.tableData = props.dataModel
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const pageForm = reactive({
|
||||
tableData: [],
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
rowHieght: 61,
|
||||
showSelectType: "null",
|
||||
loading: false,
|
||||
haveControls: false
|
||||
},
|
||||
controlsWidth: 220,
|
||||
tableColumn: [
|
||||
],
|
||||
});
|
||||
const soltData = ref([])
|
||||
// 当对话框显示时处理表格列配置
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
if (newVal) {
|
||||
pageForm.tableColumn = props.tableColumn.map(item => ({
|
||||
...item,
|
||||
showSolt: item.showSolt || false,
|
||||
showOverflowTooltip: item.showOverflowTooltip || false,
|
||||
prop: item.prop || item.key,
|
||||
label: item.title || item.label || item.name,
|
||||
zd: item.zd
|
||||
}))
|
||||
soltData.value = props.tableColumn.filter(item => item.showSolt)
|
||||
}
|
||||
}, { deep: true })
|
||||
|
||||
|
||||
const close = () => {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
const tableData = ref(null)
|
||||
// 导出当前表格的数据
|
||||
const exportCurrentTable = () => {
|
||||
try {
|
||||
// 创建工作簿
|
||||
const wb = XLSX.utils.book_new();
|
||||
// 检查表格列配置是否存在
|
||||
if (pageForm.tableColumn && pageForm.tableColumn.length > 0) {
|
||||
// 准备导出数据,使用表格列配置中的label作为表头
|
||||
const exportData = pageForm.tableData.map(row => {
|
||||
const formattedRow = {};
|
||||
// 遍历表格列配置
|
||||
pageForm.tableColumn.forEach(col => {
|
||||
// 使用列的label作为Excel的表头,对应的值为行中该属性的值
|
||||
if (col.prop && row.hasOwnProperty(col.prop)) {
|
||||
// 处理带字典的列
|
||||
let cellValue = row[col.prop];
|
||||
if (col.zd && props.dict[col.zd] && cellValue !== undefined) {
|
||||
// 查找字典中的对应文本值
|
||||
const dictItem = props.dict[col.zd].find(d => d.value === cellValue);
|
||||
if (dictItem) {
|
||||
cellValue = dictItem.zdmc || dictItem.label || cellValue;
|
||||
}
|
||||
}
|
||||
formattedRow[col.label || col.prop] = cellValue;
|
||||
}
|
||||
});
|
||||
return formattedRow;
|
||||
});
|
||||
|
||||
// 使用格式化后的数据创建工作表
|
||||
const ws = XLSX.utils.json_to_sheet(exportData);
|
||||
|
||||
// 添加工作表到工作簿
|
||||
XLSX.utils.book_append_sheet(wb, ws, props.title);
|
||||
// 导出文件
|
||||
XLSX.writeFile(wb, props.title + '.xlsx');
|
||||
} else {
|
||||
// 如果没有表格列配置,使用原始数据
|
||||
const exportData = pageForm.tableData.map(row => {
|
||||
const exportRow = { ...row };
|
||||
// 处理带字典的列
|
||||
soltData.value.forEach(item => {
|
||||
if (item.zd && props.dict[item.zd] && exportRow[item.prop] !== undefined) {
|
||||
// 查找字典中的对应文本值
|
||||
const dictItem = props.dict[item.zd].find(d => d.value === exportRow[item.prop]);
|
||||
if (dictItem) {
|
||||
exportRow[item.prop] = dictItem.zdmc || dictItem.label || exportRow[item.prop];
|
||||
}
|
||||
}
|
||||
});
|
||||
return exportRow;
|
||||
});
|
||||
const ws = XLSX.utils.json_to_sheet(exportData);
|
||||
XLSX.utils.book_append_sheet(wb, ws, props.title);
|
||||
XLSX.writeFile(wb, props.title + '.xlsx');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('导出文件失败:', error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-dialog v-model="modelValue" :destroy-on-close="true" title="新增群体" @close="close" :close-on-click-modal="false">
|
||||
<FormMessage v-model="listQuery" :formList="formData" labelWidth="120px" ref="elform">
|
||||
</FormMessage>
|
||||
<template #footer>
|
||||
<div class="flex just-center">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import FormMessage from "@/components/aboutTable/FormMessage.vue";
|
||||
import { ref, watch } from 'vue';
|
||||
import { getUUid } from '@/utils/tools'
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
dialogValue: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
watch(() => props.dialogValue, (val) => {
|
||||
if (val) {
|
||||
listQuery.value = { ...props.dialogValue }
|
||||
}
|
||||
})
|
||||
const elform = ref()
|
||||
const emit = defineEmits(['update:modelValue', 'changePersonnel'])
|
||||
const listQuery = ref({})
|
||||
const formData = ref()
|
||||
watch(() => props.dict, () => {
|
||||
formData.value=[
|
||||
{ label: "群体名称", prop: "qtmc", type: "input", width: "45%" },
|
||||
{
|
||||
label: "群体类别",
|
||||
prop: "qtlb",
|
||||
type: "select",
|
||||
options: props.dict.D_GS_ZDQT_LB, width: "45%"
|
||||
},
|
||||
{ label: "预警规模", prop: "yjgm", type: "input", width: "45%" },
|
||||
{ label: "活跃人数", prop: "hyrs", type: "number", width: "45%" },
|
||||
{ label: "备注", prop: "bz", type: "textarea", width: "100%" },
|
||||
]
|
||||
},{deep:true,immediate:true})
|
||||
const submitForm = () => {
|
||||
if (listQuery.value.id) {
|
||||
emit('changePersonnel', listQuery.value)
|
||||
} else {
|
||||
const promes = {
|
||||
id: getUUid(),
|
||||
...listQuery.value
|
||||
}
|
||||
emit('changePersonnel', promes)
|
||||
}
|
||||
close()
|
||||
}
|
||||
const close = () => {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.marks {
|
||||
width: 100%;
|
||||
min-height: 32px;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="controls">
|
||||
<el-button type="primary" @click="addEdit()">
|
||||
<el-icon class="icon">
|
||||
<CirclePlus />
|
||||
</el-icon>
|
||||
<span class="icon" >新增</span>
|
||||
</el-button>
|
||||
</div>
|
||||
<MyTable :tableData="pageForm.tableData" :tableColumn="pageForm.tableColumn" :tableHeight="pageForm.tableHeight"
|
||||
:key="pageForm.keyCount" :tableConfiger="pageForm.tableConfiger" :controlsWidth="pageForm.controlsWidth">
|
||||
<!-- 操作 -->
|
||||
<template #qtlb="{ row}">
|
||||
<DictTag :tag="false" :value="row.qtlb" :options="props.dict.D_GS_ZDQT_LB" />
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #controls="{ row }">
|
||||
<el-link size="small" type="success" @click="addEdit(row)">修改</el-link>
|
||||
<el-link size="small" type="danger" @click="del(row)">删除</el-link>
|
||||
</template>
|
||||
</MyTable>
|
||||
</div>
|
||||
<AddPersonnel :dialogValue="dialogValue" v-model="showDialog" :dict="props.dict" @changePersonnel="changePersonnel" />
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive ,ref,watch} from "vue";
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import AddPersonnel from "./addPersonnel.vue";
|
||||
const props = defineProps({
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
qtList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
});
|
||||
watch(() => props.qtList, val => {
|
||||
pageForm.value.tableData=val
|
||||
},{deep:true})
|
||||
const showDialog = ref(false)
|
||||
const pageForm = ref({
|
||||
tableData: [],
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
rowHieght: 61,
|
||||
showSelectType: "null",
|
||||
loading: false
|
||||
},
|
||||
controlsWidth: 220,
|
||||
tableColumn: [
|
||||
{ label: "群体名称", prop: "qtmc",showOverflowTooltip:true },
|
||||
{ label: "群体类别", prop: "qtlb",showOverflowTooltip:true ,showSolt: true},
|
||||
{ label: "预警规模", prop: "yjgm",showOverflowTooltip:true },
|
||||
{ label: "活跃人数", prop: "hyrs",showOverflowTooltip:true },
|
||||
{ label: "备注", prop: "bz" ,showOverflowTooltip:true},
|
||||
]
|
||||
});
|
||||
watch(() => props.perList, (val) => {
|
||||
pageForm.value.tableData=val
|
||||
},{deep:true})
|
||||
const changePersonnel = (val) => {
|
||||
const index = pageForm.value.tableData.findIndex(it => it.id == val.id)
|
||||
if (index != -1) {
|
||||
pageForm.value.tableData[index] = val
|
||||
} else {
|
||||
pageForm.value.tableData.push(val)
|
||||
}
|
||||
}
|
||||
const dialogValue=ref()
|
||||
const addEdit = (val) => {
|
||||
showDialog.value = true
|
||||
dialogValue.value=val
|
||||
}
|
||||
const listData = () => {
|
||||
return pageForm.value.tableData
|
||||
}
|
||||
const del = (val) => {
|
||||
const index = pageForm.value.tableData.findIndex(it => it.id == val.id)
|
||||
if (index != -1) {
|
||||
pageForm.value.tableData.splice(index, 1)
|
||||
ElMessage.success('删除成功')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
defineExpose({ listData });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/assets/css/layout.scss";
|
||||
@import "~@/assets/css/element-plus.scss";
|
||||
|
||||
.controls {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
margin-bottom: 10px;
|
||||
padding: 0 20px;
|
||||
.icon {
|
||||
vertical-align: middle
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
|
||||
color: #0072ff;
|
||||
background: rgba(0, 114, 255, 0.3);
|
||||
}
|
||||
|
||||
|
||||
::v-deep .avatar-uploader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .el-upload-list {
|
||||
margin-left: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .el-upload-list__item-name .el-icon {
|
||||
top: 3px;
|
||||
}
|
||||
|
||||
.form_cnt {
|
||||
// width: 75%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.person {
|
||||
padding-left: 20px;
|
||||
width: 25%;
|
||||
// height: 100vh;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,54 @@
|
||||
<!-- 使用示例:在父组件中集成文件导入组件 -->
|
||||
|
||||
<script setup>
|
||||
// 导入刚才创建的文件导入组件
|
||||
import ToChannel from './components/toChannel.vue'
|
||||
|
||||
// 响应式数据
|
||||
const importDialogVisible = ref(false)
|
||||
|
||||
// 表格列配置(用于导入预览和模板生成)
|
||||
const tableColumns = ref([
|
||||
{ label: '姓名', prop: 'xm' },
|
||||
{ label: '身份证号', prop: 'sfzh' },
|
||||
{ label: '手机号', prop: 'sjhm' },
|
||||
{ label: '地址', prop: 'dz' },
|
||||
{ label: '群体类别', prop: 'qtlb' }
|
||||
])
|
||||
|
||||
// 打开导入对话框
|
||||
const openImportDialog = () => {
|
||||
importDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 处理导入成功
|
||||
const handleImportSuccess = (result) => {
|
||||
console.log('导入成功的数据:', result)
|
||||
}
|
||||
|
||||
// 处理导入失败
|
||||
const handleImportError = (error) => {
|
||||
console.error('导入失败:', error)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<!-- 导入按钮 -->
|
||||
<el-button type="primary" @click="openImportDialog">
|
||||
<el-icon><upload-filled /></el-icon>
|
||||
导入数据
|
||||
</el-button>
|
||||
<!-- 文件导入组件 -->
|
||||
<ToChannel
|
||||
v-model="importDialogVisible"
|
||||
:title="'导入人员数据'"
|
||||
:table-columns="tableColumns"
|
||||
:upload-action="'/api/upload/excel'"
|
||||
:template-url="'/api/download/template'"
|
||||
:file-size-limit="5"
|
||||
@import-success="handleImportSuccess"
|
||||
@import-error="handleImportError"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<el-dialog v-model="modelValue" :destroy-on-close="true" title="新增人员" @close="close" :close-on-click-modal="false">
|
||||
<FormMessage v-model="listQuery" :formList="formData" labelWidth="120px" ref="elform">
|
||||
|
||||
</FormMessage>
|
||||
<template #footer>
|
||||
<div class="flex just-center">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import FormMessage from "@/components/aboutTable/FormMessage.vue";
|
||||
import { ref, watch } from 'vue';
|
||||
import { getUUid } from '@/utils/tools'
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
dialogValue: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const listQuery = ref({})
|
||||
|
||||
watch(() => props.dialogValue, (val) => {
|
||||
if (val) {
|
||||
listQuery.value = { ...props.dialogValue }
|
||||
}
|
||||
})
|
||||
const elform = ref()
|
||||
const emit = defineEmits(['update:modelValue', 'changePersonnel'])
|
||||
const formData = ref([
|
||||
{ label: "姓名", prop: "xm", type: "input", width: "45%" },
|
||||
{ label: "身份证号", prop: "sfzh", type: "input", width: "45%" },
|
||||
{ label: "角色", prop: "js", type: "input", width: "45%" },
|
||||
{ label: "手机号", prop: "sjh", type: "input", width: "45%" },
|
||||
{ label: "管辖单位", prop: "gxdwdm",depMc:"gxdw", type: "department", width: "45%" },
|
||||
{ label: "人员属地", prop: "rysd", type: "select", width: "45%",options:props.dict.D_BZ_XZQHDM },
|
||||
{ label: "居住地址", prop: "jzdz", type: "input", width: "100%" },
|
||||
{ label: "备注", prop: "bz", type: "textarea", width: "100%" },
|
||||
])
|
||||
const submitForm = (val) => {
|
||||
if (listQuery.value.id) {
|
||||
emit('changePersonnel', listQuery.value)
|
||||
} else {
|
||||
const promes = {
|
||||
id: getUUid(),
|
||||
...listQuery.value
|
||||
}
|
||||
emit('changePersonnel', promes)
|
||||
}
|
||||
close()
|
||||
}
|
||||
const close = () => {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.marks {
|
||||
width: 100%;
|
||||
min-height: 32px;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,226 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="controls">
|
||||
<div>
|
||||
<div>
|
||||
录入总数:{{ dataStatistics.TotalNumber }}
|
||||
异常次数:{{ dataStatistics.ExceptionNumber }}
|
||||
<span @click="repeatingDataShow()">异常数据:{{ dataStatistics.ExceptionDataNumber }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" @click="addEdit()">
|
||||
<el-icon class="icon">
|
||||
<CirclePlus />
|
||||
</el-icon>
|
||||
<span class="icon">新增</span>
|
||||
</el-button>
|
||||
<el-button type="primary" @click="openImportDialog">
|
||||
<el-icon class="icon">
|
||||
<Edit />
|
||||
</el-icon>
|
||||
<span class="icon">批量导入</span>
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<MyTable :tableData="pageForm.tableData" :tableColumn="pageForm.tableColumn" :tableHeight="pageForm.tableHeight"
|
||||
:key="pageForm.keyCount" :tableConfiger="pageForm.tableConfiger" :controlsWidth="pageForm.controlsWidth">
|
||||
<template #rysd="{ row }">
|
||||
<DictTag :tag="false" :value="row.rysd" :options="props.dict.D_BZ_XZQHDM" />
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #controls="{ row, index }">
|
||||
<el-link size="small" type="success" @click="addEdit(row)">修改</el-link>
|
||||
<el-link size="small" type="danger" @click="del(row)">删除</el-link>
|
||||
</template>
|
||||
</MyTable>
|
||||
</div>
|
||||
<AddPersonnel :dialogValue="dialogValue" v-model="showDialog" :dict="props.dict" @changePersonnel="changePersonnel" />
|
||||
<ToChannel @import-success="pushqbcjimportRyData" v-model="importDialogVisible" :title="'导入人员数据'"
|
||||
aiconUrl="/mosty-gsxt/qbcj/importRyData" :file-size-limit="5" :isUrl="true" />
|
||||
<RepeatingData v-model="repeatingDataVisible" :dict="props.dict" :dialogValue="repeatingData" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import AddPersonnel from "./addPersonnel.vue";
|
||||
import ToChannel from '../toChannel.vue'
|
||||
import { ElMessage } from "element-plus";
|
||||
import RepeatingData from "../personnel/repeatingData.vue";
|
||||
const props = defineProps({
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}, perList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
});
|
||||
watch(() => props.perList, val => {
|
||||
pageForm.value.tableData = val
|
||||
dataStatistics.value.TotalNumber = val.length
|
||||
}, { deep: true })
|
||||
const showDialog = ref(false)
|
||||
const pageForm = ref({
|
||||
tableData: [],
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
rowHeight: 61, // 修正拼写错误
|
||||
showSelectType: 'null', // 设置为false以隐藏所有选择框
|
||||
loading: false
|
||||
},
|
||||
controlsWidth: 220,
|
||||
tableColumn: [
|
||||
{ label: "姓名", prop: "xm", showOverflowTooltip: true },
|
||||
{ label: "身份证", prop: "sfzh", showOverflowTooltip: true },
|
||||
{ label: "角色", prop: "js", showOverflowTooltip: true },
|
||||
{ label: "手机号码", prop: "sjh", showOverflowTooltip: true },
|
||||
{ label: "居住地址", prop: "jzdz", showOverflowTooltip: true },
|
||||
{ label: "管辖单位", prop: "gxdw", showOverflowTooltip: true },
|
||||
{ label: "人员属地", prop: "rysd", showOverflowTooltip: true, showSolt: true },
|
||||
{ label: "备注", prop: "bz", showOverflowTooltip: true },
|
||||
]
|
||||
});
|
||||
const changePersonnel = (val) => {
|
||||
const index = pageForm.value.tableData.findIndex(it => it.id == val.id)
|
||||
if (index != -1) {
|
||||
pageForm.value.tableData[index] = val
|
||||
} else {
|
||||
pageForm.value.tableData.push(val)
|
||||
}
|
||||
dataStatistics.value.TotalNumber = pageForm.value.tableData.length
|
||||
}
|
||||
const dataStatistics = ref({
|
||||
TotalNumber: 0,
|
||||
ExceptionNumber: 0,
|
||||
ExceptionDataNumber: 0,
|
||||
})
|
||||
const dialogValue = ref()
|
||||
const addEdit = (val) => {
|
||||
showDialog.value = true
|
||||
dialogValue.value = val
|
||||
}
|
||||
const del = (val) => {
|
||||
const index = pageForm.value.tableData.findIndex(it => it.id == val.id)
|
||||
if (index != -1) {
|
||||
pageForm.value.tableData.splice(index, 1)
|
||||
ElMessage.success('删除成功')
|
||||
}
|
||||
}
|
||||
const listData = () => {
|
||||
return pageForm.value.tableData
|
||||
}
|
||||
const repeatingData=ref([])
|
||||
// 导入
|
||||
const importDialogVisible = ref(false)
|
||||
const openImportDialog = () => {
|
||||
importDialogVisible.value = true
|
||||
}
|
||||
const pushqbcjimportRyData = (val) => {
|
||||
|
||||
if (!val) {
|
||||
dataStatistics.value.ExceptionNumber++
|
||||
ElMessage.error('请求异常,导入失败,重新导入')
|
||||
return
|
||||
}
|
||||
if (val.length == 0) {
|
||||
dataStatistics.value.ExceptionNumber++
|
||||
ElMessage.error('导入数据不能为空')
|
||||
return
|
||||
} else {
|
||||
|
||||
const transformedData = val.map(item => {
|
||||
return {
|
||||
...item,
|
||||
rysd: props.dict.D_BZ_XZQHDM.filter(items => item.rysd == items.zdmc)[0]?.dm || '',
|
||||
}
|
||||
})
|
||||
const existingChpSet = new Set(pageForm.value.tableData.map(item => item.sfzh))
|
||||
const filteredData = transformedData.filter(item => {
|
||||
if (!existingChpSet.has(item.sfzh)) {
|
||||
return item
|
||||
} else {
|
||||
repeatingData.value.push(item)
|
||||
}
|
||||
}
|
||||
)
|
||||
// 更新数据统计
|
||||
const duplicateCount = transformedData.length - filteredData.length
|
||||
if (duplicateCount > 0) {
|
||||
dataStatistics.value.ExceptionNumber++
|
||||
dataStatistics.value.ExceptionDataNumber += duplicateCount
|
||||
ElMessage.warning(`成功导入${filteredData.length}条数据,发现${duplicateCount}条车牌号重复的数据已跳过`)
|
||||
} else {
|
||||
ElMessage.success(`成功导入${filteredData.length}条数据`)
|
||||
}
|
||||
// 添加过滤后的数据
|
||||
if (filteredData.length > 0) {
|
||||
if (pageForm.value.tableData.length > 0) {
|
||||
pageForm.value.tableData = [...pageForm.value.tableData, ...filteredData]
|
||||
} else {
|
||||
pageForm.value.tableData = filteredData
|
||||
}
|
||||
}
|
||||
dataStatistics.value.TotalNumber = pageForm.value.tableData.length
|
||||
}
|
||||
|
||||
}
|
||||
// 重复数据
|
||||
const repeatingDataVisible = ref(false)
|
||||
const repeatingDataShow = () => {
|
||||
repeatingDataVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
defineExpose({ listData });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/assets/css/layout.scss";
|
||||
@import "~@/assets/css/element-plus.scss";
|
||||
|
||||
.controls {
|
||||
padding: 0 20px;
|
||||
display: flex;
|
||||
justify-content:space-between;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.icon {
|
||||
vertical-align: middle
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
|
||||
color: #0072ff;
|
||||
background: rgba(0, 114, 255, 0.3);
|
||||
}
|
||||
|
||||
|
||||
::v-deep .avatar-uploader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .el-upload-list {
|
||||
margin-left: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .el-upload-list__item-name .el-icon {
|
||||
top: 3px;
|
||||
}
|
||||
|
||||
.form_cnt {
|
||||
// width: 75%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.person {
|
||||
padding-left: 20px;
|
||||
width: 25%;
|
||||
// height: 100vh;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-dialog v-model="modelValue" :destroy-on-close="true" title="人员异常数据" @close="close" :close-on-click-modal="false">
|
||||
<MyTable :tableData="pageForm.tableData" :tableColumn="pageForm.tableColumn" tableHeight="50vh"
|
||||
:key="pageForm.keyCount" :tableConfiger="pageForm.tableConfiger" :controlsWidth="pageForm.controlsWidth">
|
||||
<template #rysd="{ row }">
|
||||
<DictTag :tag="false" :value="row.rysd" :options="props.dict.D_BZ_XZQHDM" />
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #controls="{ row, index }">
|
||||
<el-link size="small" type="success" @click="addEdit(row)">修改</el-link>
|
||||
<el-link size="small" type="danger" @click="del(row)">删除</el-link>
|
||||
</template>
|
||||
</MyTable>
|
||||
<template #footer>
|
||||
<div class="flex just-center">
|
||||
<el-button @click="close">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dict: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
dialogValue: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
watch(() => props.modelValue, (val) => {
|
||||
if (val) {
|
||||
pageForm.value.tableData =props.dialogValue
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const pageForm = ref({
|
||||
tableData: [],
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
rowHieght: 61,
|
||||
showSelectType: "null",
|
||||
loading: false,
|
||||
haveControls: false
|
||||
},
|
||||
controlsWidth: 220,
|
||||
tableColumn: [
|
||||
{ label: "姓名", prop: "xm", showOverflowTooltip: true },
|
||||
{ label: "身份证", prop: "sfzh", showOverflowTooltip: true },
|
||||
{ label: "角色", prop: "js", showOverflowTooltip: true },
|
||||
{ label: "手机号码", prop: "sjh", showOverflowTooltip: true },
|
||||
{ label: "居住地址", prop: "jzdz", showOverflowTooltip: true },
|
||||
{ label: "管辖单位", prop: "gxdw", showOverflowTooltip: true },
|
||||
{ label: "人员属地", prop: "rysd", showOverflowTooltip: true, showSolt: true },
|
||||
{ label: "备注", prop: "bz", showOverflowTooltip: true },
|
||||
]
|
||||
});
|
||||
|
||||
const close = () => {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.marks {
|
||||
width: 100%;
|
||||
min-height: 32px;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,298 @@
|
||||
<!-- 文件上传导入组件 -->
|
||||
<template>
|
||||
<el-dialog v-model="modelValue" :title="title" :width="width" top="5vh" @close="close" append-to-body>
|
||||
|
||||
<!-- 上传区域 -->
|
||||
<div class="upload-section">
|
||||
<el-upload class="upload-demo" drag :auto-upload="false" :limit="1" :file-list="fileList"
|
||||
:before-upload="beforeUpload" :on-change="handleFileChange" :on-exceed="handleExceed">
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">
|
||||
<em>点击或拖拽文件到此处上传</em>
|
||||
</div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
只能上传 xlsx/xls 文件,且不超过 {{ fileSizeLimit }}MB
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="upload-actions">
|
||||
<el-button type="primary" @click="handleImport" :disabled="!canImport">导入数据</el-button>
|
||||
<el-button @click="handleTemplate">下载模板</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据预览区域 -->
|
||||
<div v-if="previewData.length > 0" class="preview-section">
|
||||
<h4 style="margin-bottom: 16px;">数据预览</h4>
|
||||
<el-table :data="previewData" style="width: 100%;" :max-height="300">
|
||||
<el-table-column v-for="col in tableColumns" :key="col.prop" :prop="col.prop" :label="col.label"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<!-- <el-dialog v-model="loadingVisible" title="导入中" :show-close="false">
|
||||
<div style="text-align: center; padding: 20px;">
|
||||
<el-loading :fullscreen="false" text="正在处理数据,请稍候..." :visible="true"></el-loading>
|
||||
</div>
|
||||
</el-dialog> -->
|
||||
|
||||
<!-- <template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close">关闭</el-button>
|
||||
</div>
|
||||
</template> -->
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as XLSX from 'xlsx'
|
||||
import { ref, computed, defineProps, defineEmits } from 'vue'
|
||||
import { UploadFilled } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { qcckPost } from '@/api/qcckApi'
|
||||
// Props 定义
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '30%'
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '导入数据'
|
||||
},
|
||||
|
||||
// 文件大小限制(MB)
|
||||
fileSizeLimit: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
// 表格列配置
|
||||
tableColumns: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
// 模板下载地址
|
||||
templateUrl: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 图标地址
|
||||
aiconUrl: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
isUrl: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
// Emits 定义
|
||||
const emit = defineEmits(['update:modelValue', 'import-success', 'import-error', 'vSocial'])
|
||||
|
||||
// 响应式数据
|
||||
const fileList = ref([])
|
||||
const previewData = ref([])
|
||||
const loadingVisible = ref(false)
|
||||
|
||||
// 计算属性:是否可以导入
|
||||
const canImport = computed(() => {
|
||||
return fileList.value.length > 0 && !loadingVisible.value
|
||||
})
|
||||
|
||||
// 关闭对话框
|
||||
const close = () => {
|
||||
resetState()
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
// 重置状态
|
||||
const resetState = () => {
|
||||
fileList.value = []
|
||||
previewData.value = []
|
||||
loadingVisible.value = false
|
||||
}
|
||||
|
||||
// 处理文件选择变化
|
||||
const handleFileChange = (file) => {
|
||||
// 清空之前的预览数据
|
||||
previewData.value = []
|
||||
// 只保留最后一个文件
|
||||
fileList.value = [file]
|
||||
|
||||
// 读取文件内容进行预览
|
||||
const reader = new FileReader()
|
||||
reader.onload = (e) => {
|
||||
try {
|
||||
const data = e.target.result
|
||||
const workbook = XLSX.read(data, { type: 'binary' })
|
||||
const firstSheetName = workbook.SheetNames[0]
|
||||
const worksheet = workbook.Sheets[firstSheetName]
|
||||
// 转换为JSON数据
|
||||
const jsonData = XLSX.utils.sheet_to_json(worksheet)
|
||||
// 如果有表格列配置,过滤和格式化数据
|
||||
if (props.tableColumns && props.tableColumns.length > 0) {
|
||||
previewData.value = jsonData.slice(0, 10).map(row => {
|
||||
const formattedRow = {}
|
||||
props.tableColumns.forEach(col => {
|
||||
formattedRow[col.prop] = row[col.label] !== undefined ? row[col.label] : row[col.prop]
|
||||
})
|
||||
return formattedRow
|
||||
})
|
||||
} else {
|
||||
// 否则直接使用前10条数据作为预览
|
||||
previewData.value = jsonData.slice(0, 10)
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('文件解析失败,请检查文件格式')
|
||||
console.error('文件解析错误:', error)
|
||||
}
|
||||
}
|
||||
reader.readAsBinaryString(file.raw)
|
||||
}
|
||||
|
||||
// 上传前校验
|
||||
const beforeUpload = (file) => {
|
||||
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
||||
file.type === 'application/vnd.ms-excel'
|
||||
const isLtLimit = file.size / 1024 / 1024 < props.fileSizeLimit
|
||||
|
||||
if (!isExcel) {
|
||||
ElMessage.error('只能上传 Excel 文件!')
|
||||
return false
|
||||
}
|
||||
if (!isLtLimit) {
|
||||
ElMessage.error(`文件大小不能超过 ${props.fileSizeLimit}MB!`)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 处理文件超出限制
|
||||
const handleExceed = () => {
|
||||
ElMessage.error('只能上传一个文件')
|
||||
}
|
||||
|
||||
// 处理导入
|
||||
const handleImport = async () => {
|
||||
if (!fileList.value[0]) {
|
||||
ElMessage.warning('请先选择文件')
|
||||
return
|
||||
}
|
||||
loadingVisible.value = true
|
||||
try {
|
||||
// 创建FormData对象
|
||||
const formData = new FormData()
|
||||
formData.append('file', fileList.value[0].raw)
|
||||
if (props.isUrl && props.aiconUrl) {
|
||||
// 调用上传接口
|
||||
qcckPost(formData, props.aiconUrl).then(res => {
|
||||
emit('import-success', res)
|
||||
close()
|
||||
}).catch(error => {
|
||||
ElMessage.error(error.message || '文件上传失败')
|
||||
emit('import-success', null)
|
||||
loadingVisible.value = false
|
||||
})
|
||||
|
||||
} else {
|
||||
// 如果没有配置上传接口,只解析文件并返回数据
|
||||
const reader = new FileReader()
|
||||
reader.onload = (e) => {
|
||||
try {
|
||||
const data = e.target.result
|
||||
const workbook = XLSX.read(data, { type: 'binary' })
|
||||
const firstSheetName = workbook.SheetNames[0]
|
||||
const worksheet = workbook.Sheets[firstSheetName]
|
||||
const jsonData = XLSX.utils.sheet_to_json(worksheet)
|
||||
emit('import-success', { data: jsonData })
|
||||
close()
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
reader.readAsBinaryString(fileList.value[0].raw)
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error.message || '导入失败')
|
||||
emit('import-error', error)
|
||||
loadingVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 处理模板下载
|
||||
const handleTemplate = () => {
|
||||
if (props.templateUrl) {
|
||||
window.open(props.templateUrl, '_blank')
|
||||
} else {
|
||||
// 如果没有提供模板下载地址,根据列配置生成简单模板
|
||||
try {
|
||||
const wb = XLSX.utils.book_new()
|
||||
|
||||
// 创建表头数据
|
||||
const headerData = []
|
||||
if (props.tableColumns && props.tableColumns.length > 0) {
|
||||
const headerRow = {}
|
||||
props.tableColumns.forEach(col => {
|
||||
headerRow[col.prop] = col.label
|
||||
})
|
||||
headerData.push(headerRow)
|
||||
}
|
||||
|
||||
const ws = XLSX.utils.json_to_sheet(headerData)
|
||||
XLSX.utils.book_append_sheet(wb, ws, '模板')
|
||||
|
||||
// 下载模板
|
||||
XLSX.writeFile(wb, '导入模板.xlsx')
|
||||
} catch (error) {
|
||||
ElMessage.error('模板生成失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.upload-section {
|
||||
padding: 20px 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.upload-demo {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.upload-actions {
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.upload-actions .el-button {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.preview-section {
|
||||
margin-top: 20px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
padding-top: 20px;
|
||||
width: 100%;
|
||||
max-width: 1000px;
|
||||
align-self: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||