Browse Source

执法监督码-执法端统计分析页面

master
chenrui 3 years ago
parent
commit
c5d6ae4ed4
  1. 2
      package-lock.json
  2. 4
      src/components/footer-enforcement-nav/index.vue
  3. 9
      src/router/enforceHome.js
  4. 9
      src/store/Common.js
  5. 81
      src/views/common/analyse.vue
  6. 4
      src/views/enforce/earlyWarning.vue
  7. 4
      src/views/enforce/enforcementPlan.vue
  8. 290
      src/views/enforce/scanPage.vue
  9. 10
      src/views/enforce/sign.vue
  10. 2
      src/views/enforceHome.vue
  11. 2
      src/views/enterprise/complaint.vue
  12. 2
      src/views/enterprise/enterpriseInspectionList.vue
  13. 19
      src/views/enterprise/qrCode.vue

2
package-lock.json

@ -9513,7 +9513,7 @@
},
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"resolved": "https:/registry/.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"peer": true

4
src/components/footer-enforcement-nav/index.vue

@ -4,14 +4,14 @@
<van-tabbar-item name="Home" replace icon="wap-home-o" to="/enforceHome">{{
$t("common.lang_home")
}}</van-tabbar-item>
<van-tabbar-item name="Classify" replace icon="shop-o" to="/classify">
<van-tabbar-item name="Classify" replace icon="shop-o" to="/earlyWarning">
预警
</van-tabbar-item>
<van-tabbar-item
name="Shop"
replace
icon="cart-o"
to="/shop"
to="/appointmentList"
:dot="data.dot"
:badge="goodsNum"
>预约</van-tabbar-item

9
src/router/enforceHome.js

@ -47,6 +47,15 @@ const routes = [
isKeepAlive: true,
},
},
//统计分析页面
{
path: "/analyse",
name: "analyse",
component: () => import("@/views/common/analyse.vue"),
meta: {
isKeepAlive: true,
},
},
]
export {routes}

9
src/store/Common.js

@ -7,8 +7,13 @@ export default defineStore('useCommon', {
goods_card_num: 0,
is_reload_card: false,
id:"",
//企业统一信用代码
enterpriseNumber:"",
//企业名称
enterpriseName:"",
//当前登录用户ID
userId:"",
//当前登录用户的手机号
phonenumber:""
}),
getters: {},
@ -28,6 +33,10 @@ export default defineStore('useCommon', {
//修改用户关联的企业纳税识别号
SET_USER_ENTERPRISE_NUMBER(data){
this.enterpriseNumber = data;
},
//修改用户关联的企业纳税识别号
SET_USER_ENTERPRISE_NAME(data){
this.enterpriseName = data;
},
//设置用户ID
SET_USER_ID(data){

81
src/views/common/analyse.vue

@ -0,0 +1,81 @@
<template>
<div class="address_edit">
<!-- 导航栏 -->
<div class="header_body">
<header-nav
:slefBack="true"
@goBack="goBack"
:titelText="`统计分析`"
>
</header-nav>
</div>
<!-- 中间 -->
<div class="warp_body">
</div>
</div>
</template>
<script setup name="addressEdit">
import util from "@/util/area";
const { useMy } = $globalStore
const router = useRouter();
const route = useRoute();
let queryaddressId = ref("");
const data = reactive({
searchResult: [],
areaList: util.areaList,
addressInfo: {},
areaColumns: ["请选择", "请选择", "请选择"],
});
// 返回
const goBack = () => {
router.go(-1);
};
// 保存地址操作
const onSave = () => {
router.replace({ name: "addressList" });
};
// 删除地址操作
const onDelete = () => {
router.replace({ name: "addressList" });
};
// 修改详细地址
const onChangeDetail = () => {};
// 获取编辑地址数据
const getEditdata = async (addressId) => {
const res = await useMy.getAddressedit({ addressId: addressId });
if (res.code === 20000) {
data.addressInfo = res?.data;
data.areaColumns = [res?.data?.province, res?.data?.city, res?.data?.area];
}
};
watchEffect(() => {
if (route?.query?.addressId) {
queryaddressId = route?.query?.addressId;
}
});
onMounted(() => {
route?.query?.addressId && getEditdata(route?.query?.addressId);
nextTick(() => {
if (!route?.query?.addressId) {
data.addressInfo = {};
}
});
});
</script>
<style lang="less" scoped>
.address_edit {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
background-color: #f4f4f4;
}
</style>

4
src/views/enforce/earlyWarning.vue

@ -147,7 +147,9 @@
// 返回
const goBack = () => {
router.go(-1);
router.push({
path:"/enforceHome"
});
};
let resetScroll = ref(0); // 滚动记录

4
src/views/enforce/enforcementPlan.vue

@ -54,9 +54,7 @@
<van-swipe-cell class="swipe_cell">
<div class="card_box">
<div class="card_box_span">
<p>发布时间:{{ item.createTime }} <span class="card_box_action">
<van-button @click="toComplaintView(item.id,item.lawEnforcementIncident)" type="primary" size="mini">投诉</van-button>
</span></p>
<p>发布时间:{{ item.createTime }} <span class="card_box_action"></span></p>
</div>
<!-- <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa',padding: '0 5px' }" /> -->
<div style="border-color: aqua; border: 2px;" class="van-hairline--bottom"></div>

290
src/views/enforce/scanPage.vue

@ -1,119 +1,211 @@
<template>
<div class="scan-page">
<!-- 返回导航栏 -->
<!-- left-text="取消" -->
<van-nav-bar title="扫描二维码/条形码" left-arrow
fixed class="scan-index-bar" @click-left="clickIndexLeft()"
></van-nav-bar>
<!-- 扫码区域 -->
<video ref="video" id="video" class="scan-video" autoplay></video>
<!-- 提示语 -->
<div v-show="tipShow" class="scan-tip">{{ tipMsg }}</div>
<div class="page bgc-f4f4f4">
<header-nav
:slefBack="true"
@goBack="goBack"
>
</header-nav>
<div class="video-show" />
<video id="video" ref="video" class="video vjs-fluid" autoplay />
<span class="change" @click="change">
<i class="el-icon-refresh" />
</span>
</div>
</template>
<script>
import { BrowserMultiFormatReader } from '@zxing/library';
import { Toast, Dialog, Notify } from 'vant';
export default {
name: 'ScanCodePage', // 扫码页面
data() {
return {
codeReader: null,
tipShow: false, // 是否展示提示
tipMsg: '', // 提示文本内容
scanText: '', // 扫码结果文本内容
}
},
created() {
this.openScan();
},
watch: {
'$route'(to, from) {
if(to.path == '/ScanCodePage'){ // 当处于该页面时
this.openScan();
}
}
},
destroyed(){
this.codeReader.reset();
this.codeReader = null;
},
methods: {
async openScan() { // 初始化摄像头
this.codeReader = await new BrowserMultiFormatReader();
this.codeReader.getVideoInputDevices().then(videoDevices => {
this.tipMsg = '正在调用摄像头...';
this.tipShow = true;
console.log('get-videoDevices', videoDevices);
// 默认获取摄像头列表里的最后一个设备id,通过几部测试机发现一般前置摄像头位于列表里的前面几位,所以一般获取最后一个的是后置摄像头
let firstDeviceId = videoDevices[videoDevices.length - 1].deviceId;
// 一般获取了手机的摄像头列表里不止一个,有的手机摄像头高级多层,会有变焦摄像头等情况,需要做处理
if (videoDevices.length > 1) {
// 一般通过判断摄像头列表项里的 label 字段,'camera2 0, facing back' 字符串含有 'back' 和 '0',大部分机型是这样,如果有些机型没有,那就还是默认获取最后一个
firstDeviceId = videoDevices.find(el => { return el.label.indexOf('back') > -1 && el.label.indexOf('0') > -1 }) ?
videoDevices.find(el => { return el.label.indexOf('back') > -1 && el.label.indexOf('0') > -1 }).deviceId :
videoDevices[videoDevices.length - 1].deviceId;
}
console.log('get-firstDeviceId', firstDeviceId);
this.decodeFromInputVideoFunc(firstDeviceId);
}).catch(err => {
this.tipShow = false;
// 看到这个没,这个是一个小插件,能在手机上打开控制台,你打印的控制台信息和报错都能在这显示,具体方法自己百度
// import Vconsole from "vconsole";
import { BrowserMultiFormatReader } from "@zxing/library";
export default {
name: "QrCodeSearch",
components: {},
data() {
return {
loadingShow: false,
// 这个就是从@zxing/library导出来的方法,new一个实例
codeReader: new BrowserMultiFormatReader(),
// 这个,用来储存扫码得到的结果
textContent: null,
// 这个,就是当前调用的摄像头的索引,为什么是6,我会在后面说的
num: 0,
// 这个就是扫描到的摄像头的数量
videoLength: ""
};
},
created() {
// const vconsole = new Vconsole();
// vconsole;
// 让我们调用这个方法尝试打开摄像头
this.openScan();
},
methods: {
// 开打开打
async openScan() {
const that = this;
// 这个就是data里的哪个new出来的玩意,调用里面的方法
that.codeReader
.getVideoInputDevices()
.then(videoInputDevices => {
// 记录一下扫描到的摄像头数量,这个videoInputDevices是个数组,里面有扫描到的摄像头数据
this.videoLength = videoInputDevices.length;
console.log(JSON.stringify(videoInputDevices));
console.log(videoInputDevices.length);
that.num = videoInputDevices.length
// 这步我们来决定一下调用第几个摄像头,看到这个num没,这就是data里的
const firstDeviceId = videoInputDevices[this.videoLength -1].deviceId;
// 这调用另一个方法
that.decodeFromInputVideoFunc(
firstDeviceId,
videoInputDevices.length
);
})
// 失败回调,为什么这里的失败回调这么写,后面会说的
.catch(err => {
this.num = 1;
that.openScan();
console.error(err);
});
},
decodeFromInputVideoFunc(firstDeviceId) { // 使用摄像头扫描
this.codeReader.reset(); // 重置
this.codeReader.decodeFromInputVideoDeviceContinuously(firstDeviceId, 'video', (result, err) => {
this.tipMsg = '正在尝试识别...';
},
//这就是在openScan里调的另一个方法,传入想调用的摄像头id和摄像头数量
decodeFromInputVideoFunc(firstDeviceId, length) {
const that = this;
that.codeReader.reset(); // 重置
that.textContent = null; // 重置
// 看不懂不重要,打印出来自己琢磨琢磨
that.codeReader.decodeFromInputVideoDeviceContinuously(
firstDeviceId,
"video",
(result, err) => {
that.textContent = null;
// 扫描成功 这个result就是扫描结果,长啥样自己打印出来看看
if (result) {
console.log('扫码结果', result);
this.scanText = result.text;
if (this.scanText) {
this.tipShow = false;
Dialog.confirm({ // 获取到扫码结果进行弹窗提示,这部分接下去的代码根据需要,读者自行编写了
title: '扫码结果',
message: this.scanText,
}).then(() => { // 点击确认
}).catch(() => { // 点击取消
});
that.textContent = result;
// 这里写你要对扫描结果做什么,我这里扫描出来的是个网址,写的页面跳转
if (that.textContent) {
setTimeout(() => {
// 跳转页面至登录页面
router.push({
path: "/sign",
query: {
enterpriseNumber: that.textContent,
}
});
// 记得重置,不然在微信里用会有问题
that.textContent = null;
that.codeReader && that.codeReader.reset();
}, 100);
}
}
});
},
clickIndexLeft(){ // 返回上一页
// this.$destroy();
this.$router.go(-1);
// window.location.href = document.referrer;
// 扫描失败,我这里是直接找下一个摄像头,其实可以不写
if (err && !err) {
this.num++;
setTimeout(() => {
that.tipShow = false;
}, 2000);
if (this.num <= length) {
that.openScan();
}
console.error(err);
}
}
);
},
// 点击切换前后摄像头
change() {
const that = this;
if (this.videoLength > 2) {
if (this.num < 2) {
this.num = 6;
} else {
this.num = 1;
}
that.textContent = null;
that.codeReader && that.codeReader.reset();
that.openScan();
} else {
if (that.num === 0) {
that.num = 1;
} else {
that.num = 0;
}
that.textContent = null;
that.codeReader && that.codeReader.reset();
that.openScan();
}
}
}
}
// 返回
const goBack = () => {
router.go(-1);
};
</script>
<style lang="scss">
.scan-index-bar{
background-image: linear-gradient( -45deg, #42a5ff ,#59cfff);
.van-nav-bar__title, .van-nav-bar__arrow, .van-nav-bar__text{
color: #fff !important;
}
.video {
width: 100vw;
height: 100vh;
z-index: 1;
}
.video-show {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 70vw;
height: 70vw;
z-index: 2;
background: linear-gradient(to left, #fff, #fff) left top no-repeat,
linear-gradient(to bottom, #fff, #fff) left top no-repeat,
linear-gradient(to left, #fff, #fff) right top no-repeat,
linear-gradient(to bottom, #fff, #fff) right top no-repeat,
linear-gradient(to left, #fff, #fff) left bottom no-repeat,
linear-gradient(to bottom, #fff, #fff) left bottom no-repeat,
linear-gradient(to left, #fff, #fff) right bottom no-repeat,
linear-gradient(to left, #fff, #fff) right bottom no-repeat;
background-size: 2px 20px, 20px 2px, 2px 20px, 20px 2px;
}
.scan-page{
min-height: 100vh;
.tip {
width: 10vw;
height: 10vw;
background-color: rgb(45, 236, 45);
border: 1px solid #ffffff;
border-radius: 50%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 10;
}
.bgc-f4f4f4 {
background-color: #363636;
overflow-y: hidden;
.scan-video{
height: 85vh;
}
.scan-tip{
width: 100vw;
text-align: center;
color: white;
font-size: 5vw;
}
}
.page {
position: relative;
overflow-y: auto;
position: relative;
height: 100vh;
}
.change {
z-index: 100;
position: fixed;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
color: #fff;
text-align: center;
background-color: #fff;
width: 50px;
height: 50px;
border-radius: 50%;
line-height: 60px;
/* align-content: center; */
}
.el-icon-refresh {
color: #000;
font-size: 25px;
}
</style>

10
src/views/enforce/sign.vue

@ -134,6 +134,8 @@ import {uploadFile} from "../../util/fileUpload";
const { useMy } = $globalStore
const router = useRouter();
//路由参数
const route = useRoute();
let queryaddressId = ref("");
const data = reactive({
showLawEnforcerFlag:false,
@ -178,12 +180,18 @@ const tapBad = () => {
data.bad = "#7FFFD4";
submitData.reslut = 1;
}
//初始化参数,获取扫码的企业统一信用编码
const created = () =>{
console.log(route?.query?.enterpriseNumber);
},
// 返回
const goBack = () => {
router.go(-1);
};
const uploadFiles = (file) =>{
uploadFile(file,(res) =>{
console.log(res);
@ -212,7 +220,7 @@ const deleteFile = (file,index) =>{
const submit = () =>{
addEnforcementRegistration(submitData,success =>{
//重新设置本地存储
useCommon.SET_USER_ENTERPRISE_NUMBER(submitData.enterpriseNumber);
// useCommon.SET_USER_ENTERPRISE_NUMBER(submitData.enterpriseNumber);
console.log(success)
//跳转企业二维码地址
if(success.success){

2
src/views/enforceHome.vue

@ -87,7 +87,7 @@ const toScanCodeView = async() =>{
const toRegistrationListView = async() =>{
router.push({
path: "/enterprise/registrationList",
path: "/historyCheck",
});
}
const toComplaintView = async() =>{

2
src/views/enterprise/complaint.vue

@ -94,6 +94,7 @@ const data = reactive({
showPicker: false,
columns: [],
selectTypeValue : ref[0],
isSelect: false,
});
//保存参数
const submitData = reactive({
@ -204,6 +205,7 @@ onMounted(() => {
console.log(route?.query?.lawEnforcementIncident);
submitData.relId = route?.query?.id;
submitData.lawEnforcementIncident = route?.query?.lawEnforcementIncident;
data.isSelect = route?.query?.isSelect;
getDict({"dictType": "caseType"},success =>{
console.log(success);
success.data.forEach(res =>{

2
src/views/enterprise/enterpriseInspectionList.vue

@ -69,7 +69,7 @@
<!-- <van-divider :style="{ color: '#1989fa', borderColor: '#1989fa',padding: '0 5px' }" /> -->
<div style="border-color: aqua; border: 2px;" class="van-hairline--bottom"></div>
<div class="card_box_span">
<p style="font-size: 16px;font-weight: bold;">{{ item.lawEnforcementItem }}</p>
<p style="font-size: 16px;font-weight: bold;">{{ item.checkItem }}</p>
</div>
<div class="card_box_span">

19
src/views/enterprise/qrCode.vue

@ -11,8 +11,10 @@
</div>
<!-- 中间 -->
<div class="warp_body">
<div class="qr_code">
<div class="qr_name">
<span>{{ data.enterpriseName }}</span>
</div>
<div class="qr_code_img">
<van-image
width="100%"
@ -40,7 +42,8 @@ const { useMy } = $globalStore
const router = useRouter();
const route = useRoute();
const data = reactive({
qrCodeUrl:""
qrCodeUrl:"",
enterpriseName:""
});
@ -58,6 +61,7 @@ onMounted(() => {
console.log(success)
if(success.success){
data.qrCodeUrl = baseUrl + success.data.qrCodeUrl;
data.enterpriseName = success.data.enterpriseName;
console.log(data.qrCodeUrl)
}
},error =>{
@ -88,12 +92,11 @@ const downloadFile = (url) => {
.qr_code{
width: 100%;
height: 60%;
background-color:azure;
background-color:white;
position: relative;
.qr_code_img{
width: 80%;
height: 70%;
background-color:black;
top: 8%;
left: 10%;
position: absolute;
@ -105,6 +108,14 @@ const downloadFile = (url) => {
bottom: 4%;
left: 20%;
}
.qr_name{
position: absolute;
width: 100%;
height: 10%;
top: 3%;
text-align: center;
font-size: 16px;
}
}
}
</style>

Loading…
Cancel
Save