Commit e2c592e2 authored by xfxmcy's avatar xfxmcy

test v0.0.1

parent 3cc2769a
......@@ -189,6 +189,20 @@ export function getInventoryPdDetail(query) {
})
}
export function getALl(query) {
return request({
url: '/insstrumentinfo/findInventoryPdAll', method: 'get', params: query
})
}
export function pdSubmit(data) {
data = Qs.stringify(data)
return request({
url: '/insstrumentinfo/pdSubmit', method: 'post', data: data
})
}
export function delInventoryPd(query) {
return request({
url: '/insstrumentinfo/deleteInventoryPd', method: 'get', params: query
......
import request from '@/utils/request'
// 查询仪器管理详细信息
export function getInsStrumentInfo(businessId) {
export function getInsStrumentInfo(query) {
return request({
url: '/insstrumentinfo/detail/' + businessId, method: 'get'
url: '/insstrumentinfo/pdaQuery',
params: query,
method: 'get'
})
}
......@@ -8,6 +8,56 @@ export const openCamera = (params) => {
})
})
}
// 开始识别
export const startPower = (params) => {
return new Promise(resolve => {
DS_BRIDGE.call('startPower', params, res => {
resolve(res)
})
})
}
// 停止识别
export const stopPower = (params) => {
return new Promise(resolve => {
DS_BRIDGE.call('stopPower', params, res => {
resolve(res)
})
})
}
// 设置功率
export const setPower = (params) => {
return new Promise(resolve => {
DS_BRIDGE.call('setPower', params, res => {
resolve(res)
})
})
}
// 设置功率
export const clearPower = (params) => {
return new Promise(resolve => {
DS_BRIDGE.call('clearPower', params, res => {
resolve(res)
})
})
}
// 设置声音
// 分5档, 0-5
// 传过去的对象里面volumeValue设置系统音量值
export const addVolume = (params) => {
return new Promise(resolve => {
DS_BRIDGE.call('addVolume', params, res => {
resolve(res)
})
})
}
// 减小声音
export const reduceVolume = (params) => {
return new Promise(resolve => {
DS_BRIDGE.call('reduceVolume', params, res => {
resolve(res)
})
})
}
// 拍照取相册 实现调用存储功能(带相册,文件资源功能)
export const openCameraStorage = (params) => {
return new Promise(resolve => {
......@@ -35,7 +85,14 @@ export const openScan = (params) => {
export const WebView = {
openCamera,
startPower,
stopPower,
clearPower,
setPower,
addVolume,
reduceVolume,
openCameraStorage,
openCameraAll,
openScan
openScan,
DS_BRIDGE
}
......@@ -182,27 +182,33 @@ export function includePermission(accessName) {
if (!store.getters.permissions) { return false }
return (store.getters.permissions.includes(accessName) || store.getters.permissions.includes('*:*:*'))
}
// 控制音频启用状态
const isAudioAble = false
const isSuccessAudioAble = false
const errorSound = new Audio(require('../assets/audio/y1840.mp3'))
const successSound = new Audio(require('../assets/audio/8858.mp3'))
const isAudioAble = true
const isSuccessAudioAble = true
// const errorSound = new Audio(require('../assets/audio/y1840.mp3'))
// const successSound = new Audio(require('../assets/audio/8858.mp3'))
export function playAudio(start) {
if (!isAudioAble) {
return
}
if (start) {
const errorSound = new Audio(require('../assets/audio/y1840.mp3'))
errorSound.play()
/*setTimeout(() => {
errorSound.play()
}, 500)*/
} else {
// errorSound.pause()
//errorSound.pause()
}
}
export function successAudio(start) {
if (!isSuccessAudioAble) {
return
}
if (start) {
const successSound = new Audio(require('../assets/audio/8858.mp3'))
successSound.play()
} else {
// successSound.pause()
......@@ -211,9 +217,9 @@ export function successAudio(start) {
// 自定义转换成大写的
export function customUpperCase(sourceStr) {
return sourceStr && sourceStr !== '' ? sourceStr.toUpperCase().trim() : sourceStr
return sourceStr && sourceStr !== '' ? sourceStr.toUpperCase() : sourceStr
}
export function UpperCaseStr(sourceStr) {
return sourceStr && sourceStr !== '' ? sourceStr.replace(/\s+/g, '').toUpperCase() : sourceStr
export function trimAndUpperCaseStr(sourceStr) {
return sourceStr && sourceStr !== '' ? sourceStr.trim().toUpperCase() : sourceStr
}
......@@ -3,12 +3,12 @@
<div>
<el-row :gutter="20" type="flex" justify="center">
<el-col :span="12">
<el-button class="submitBtn" type="primary" :loading="isStarting" @click="startInventory">
<el-button class="submitBtn" type="primary" :loading="!ready" @click="handleStartPower">
<span>开始盘点</span>
</el-button>
</el-col>
<el-col :span="6">
<el-button class="submitBtn" type="primary" :loading="isEnding" @click="endInventory">
<el-button class="submitBtn" type="primary" @click="handleStopPower">
<span>结束盘点</span>
</el-button>
</el-col>
......@@ -16,14 +16,19 @@
<!-- 新增统计数据展示 -->
<div class="padding">
<el-row style="margin-top: 20px;">
<el-col :span="24">
<el-col :span="24" style="text-align: center">
<span style="margin-right: 10px" :class="statusClass">{{ this.statusText }}</span>
</el-col>
</el-row>
<el-row style="margin-top: 20px;">
<el-col :span="12">
<div class="statistics">
<p>合计: {{ this.count }}</p>
<p>合计: <span style="margin-left: 10px">{{ this.count }}</span></p>
</div>
</el-col>
<el-col :span="24">
<el-col :span="12">
<div class="statistics">
<p>已盘:{{ this.completedCount }}</p>
<p>已盘: <span style="color: red;margin-left: 10px">{{ this.completedCount }}</span></p>
</div>
</el-col>
</el-row>
......@@ -61,8 +66,8 @@
<pagination
v-show="total>0"
:total="total"
:page.sync="detailQueryParams.page"
:limit.sync="detailQueryParams.rows"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
layout="total, prev, pager, next"
@pagination="getInventoryPdDetail(id)"
/>
......@@ -71,9 +76,11 @@
</template>
<script>
import { getInventoryPdDetail } from '@/api/instrument/instrument'
import { getInventoryPdDetail,getALl, pdSubmit } from '@/api/instrument/instrument'
import commonField from '@/utils/commonField'
import deviceField from '@/utils/device/deviceField'
import { getToken } from '@/utils/auth'
import { playAudio, successAudio } from '@/utils/common'
export default {
name: 'Instrument',
......@@ -96,14 +103,12 @@ export default {
// 盘点弹出层标题
inventoryTitle: '',
inventoryOpen: false,
// 管理字典
insManageList: {},
completedCount:0,
count:0,
// 类型字典
insTypeList: {},
// 日期范围
dateRange: [],
statusClass: 'status_b',
statusText: '进行中',
id: '',
// 查询参数
queryParams: {
......@@ -112,19 +117,22 @@ export default {
pdCode: undefined,
userName: undefined
},
detailQueryParams: {
page: 1,
rows: 10,
pdId: undefined,
insCode: undefined
},
ready: false,
// 表单参数
form: {},
// 表单校验
fileFakeList: [],
fileList: [],
dialogImageUrl: '',
dialogVisible: false
dialogVisible: false,
// 所有集合
allList: [],
completedCount:0,
count:0,
// 精简数组, {id, insRfid, status, sync } sync 1 已同步数据库 0 未同步
sampleList:[],
timer: undefined
}
},
computed: {
......@@ -140,25 +148,149 @@ export default {
},
created() {
this.id = this.$route.query.businessId;
this.getInventoryPdDetail(this.id)
this.reloadAll(this.id)
let _that = this
let sampleListCache = this.sampleList
// 接受扫描结果, resultInfo ,android返回的key
this.$WebView.DS_BRIDGE.register('resultInfo', args => {
// 根据resultInfo的key拿到Android实时推送的数据解析后赋值回显
// [{rssi: '-75.60', typeId: 'Exxxxxxx' }]
let resList = JSON.parse(args)
resList.forEach(x => {
_that.sampleList.forEach(y => {
if(x.typeId == y.insRfid && y.status != '1') {
y.status = '1'
}
})
})
_that.completedCount = sampleListCache.filter(x => x.status == '1').length
})
this.timer = setInterval(() => {
let _that = this
let ids = []
this.sampleList.forEach(y => {
if(y.status == '1' && y.sync == '0') {
ids.push(y.id)
}
})
if(ids.length == 0 ) {
return
}
let param = {
businessId : this.id,
ids: ids.join(',')
}
pdSubmit(param).then(response => {
if(response.code == 200){
ids.forEach(x => {
_that.sampleList.forEach(y => {
if(y.status == '1' && y.sync == '0' && x == y.id) {
y.sync = '1'
}
})
})
setTimeout(() => {
// successAudio(true)
}, 500); // 2000毫秒 = 2秒
if(response.data.lastCount === 0) {
// successAudio(true)
this.$message({ message: "盘点已完成!", type: 'success' })
this.statusClass = 'status_e'
this.statusText = '盘点完成'
this.handleClearPower()
// 停止
this.handleStopPower()
clearInterval(this.timer)
}
}
else {
this.$message({ message: response.message, type: 'error' })
// playAudio(true)
// 停止
this.handleClearPower()
this.handleStopPower()
clearInterval(this.timer)
}
})
}, 2500);
},
beforeDestroy() {
this.handleClearPower()
this.handleStopPower()
clearInterval(this.timer) // 清除定时器
},
methods: {
/** 开始识别按钮*/
handleStartPower() {
let selectList = []
this.sampleList.forEach(x => {
if(x.status != '1') {
selectList.push(x.insRfid)
}
})
this.startState = true
const params = {
flag: 'startPower',
//selectValue: selectList,
selectValue: [],
tokenMsg: getToken()
}
// 补充逻辑:如果设置筛选有值就调筛选逻辑,传id过去,筛选没值就不传id过去
this.$WebView.startPower(params).then(res => {
})
},
/** 清空数据按钮*/
handleClearPower() {
const params = {
flag: 'clearPower',
tokenMsg: getToken()
}
this.$WebView.clearPower(params).then(res => {
})
},
/** 停止识别按钮*/
handleStopPower() {
this.startState = false
const params = {
flag: 'stopPower',
tokenMsg: getToken()
}
this.$WebView.stopPower(params).then(res => {
this.imgUrlForm = JSON.parse(res)
})
},
// 详情窗口关闭
infoWinCancel() {
this.infoOpen = false
},
/** 详情按钮操作 */
handleInfo() {
this.infoOpen = true
this.getInventoryPdDetail(this.id)
},
getInventoryPdDetail(id) {
this.detailQueryParams.pdId = id
getInventoryPdDetail(this.detailQueryParams).then(response => {
getInventoryPdDetail({pdId : id}).then(response => {
this.detailList = response.rows
this.total = response.total
this.detailQueryParams.page = response.pageNu
this.detailQueryParams.rows = response.pageSize
this.countStatus()
this.infoOpen = true
})
},
reloadAll(id) {
getALl({pdId : id}).then(response => {
this.allList = response.data
this.ready = true
this.count = this.allList.length
this.completedCount = this.allList.filter(x => x.pdStatus == '1').length
this.allList.forEach(x => {
if(x.insRfid) {
this.sampleList.push({
id : x.businessId,
insRfid: x.insRfid,
status: x.pdStatus,
sync : x.pdStatus == '1' ? 1 : 0
})
}
})
})
},
endInventory(){
......@@ -170,10 +302,6 @@ export default {
this.$router.back()
})
},
countStatus() {
this.completedCount = this.detailList.filter(item => item.pdStatus === '1').length;
this.count = this.total;
},
// 根据状态控制当前行的颜色
changeColor({ row, rowIndex }) {
if (row.pdStatus === '1') {
......@@ -222,4 +350,11 @@ export default {
padding-left: 50px; /* 设置左边的间距 */
padding-top: 50px;
}
.status_b {
color: red;
}
.status_e {
color: green;
}
</style>
<template>
<div class="app-container">
<div v-if="themeType === '8'" class="tableTitle">设备盘点</div>
<div v-if="themeType === '8'" class="tableTitle">仪器盘点</div>
<div style="padding:5px 10px">
<el-table v-loading="loading" border :data="insStrumentInfoList">
<el-table-column type="index" label="序号" width="50" align="center" />
......@@ -9,9 +9,9 @@
{{ scope.row.pdCode || '-' }}
</template>
</el-table-column>
<el-table-column label="创建时间" width="150" prop="insJdrq" :show-overflow-tooltip="true">
<el-table-column label="日期" prop="insJdrq" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm' ) }}</span>
<span>{{ scope.row.createDate | transformDateByFormat('MM-DD' ) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" width="50px">
......
<template>
<div @keyup.enter="handleQuery" style="display: flex; flex-direction: column; height: 78vh;">
<el-form ref="queryForm" :model="queryParams" :inline="true"
@submit.native.prevent
style="border-bottom: 1px solid #dcdcdc;">
<el-form-item label="编号" prop="insCode" style="padding-left: 10px">
<el-form-item label="" prop="insCode" style="padding-left: 10px">
<el-input
v-model="queryParams.businessId"
placeholder="请输入编号"
......@@ -10,10 +11,10 @@
autofocus
:maxlength="30"
size="small"
style="width: 120px;"
style="width: 140px;"
/>
<el-button
style="width: 75px;margin-left: 0"
style="width: 70px;margin-left: 0"
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.queryIcon"
......@@ -22,7 +23,7 @@
>查询
</el-button>
<el-button
style="width: 75px;margin-left: 0"
style="width: 70px;margin-left: 0"
:class="commonField.resetClass"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
......@@ -104,7 +105,7 @@
</el-row>
<el-row :span="24">
<el-form-item label="实物:" prop="insImplementation">
<div class="photo-wall" v-if="fileFakeList.length > 0">
<!--<div class="photo-wall" v-if="fileFakeList.length > 0">
<el-carousel height="150px" style="width: 150px;" indicator-position="none">
<el-carousel-item v-for="(item, index) in fileFakeList" >
<el-image
......@@ -117,24 +118,52 @@
/>
</el-carousel-item>
</el-carousel>
</div>-->
<el-button
style="width: 70px;margin-left: 0px; margin-bottom: 5px"
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.importIcon"
:size="commonField.smallSize"
@click="handlePpenCameraAll1"
>拍照
</el-button>
<div class="photo-wall" style="display: flex" v-if="fileFakeList.length > 0" v-for="(item, index) in fileFakeList">
<el-image
@click="handlePreview(item)"
:key="index"
:src="item.url"
:teleported="true"
style="width: 150px; height: 150px;margin-top: 5%"
fit="cover"
/>
<el-button type="danger" icon="el-icon-delete" circle style="height: 40px;margin-left: 5%;margin-top: 10%"></el-button>
</div>
</el-form-item>
</el-row>
<el-row :span="24">
<el-form-item label="参照物:" prop="file">
<div class="photo-wall" v-if="fileList.length > 0">
<el-carousel height="150px" style="width: 150px;" indicator-position="none">
<el-carousel-item v-for="(item, index) in fileList">
<el-image
@click="handlePreview(item)"
:key="index"
:src="item.url"
z-index="2000"
style="width: 150px; height: 150px;"
fit="cover"
/>
</el-carousel-item>
</el-carousel>
<el-form-item label="铭牌:" prop="file">
<el-button
style="width: 70px;margin-left: 0px; margin-bottom: 5px"
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.importIcon"
:size="commonField.smallSize"
@click="handlePpenCameraAll2"
>拍照
</el-button>
<div class="photo-wall" style="display: flex" v-if="fileList.length > 0" v-for="(item, index) in fileList">
<el-image
@click="handlePreview(item)"
:key="index"
:src="item.url"
:teleported="true"
style="width: 150px; height: 150px;margin-top: 5%"
fit="cover"
/>
<el-button type="danger" icon="el-icon-delete" circle style="height: 40px;margin-left: 5%;margin-top: 10%"></el-button>
</div>
</el-form-item>
</el-row>
......@@ -192,16 +221,29 @@
</el-row>
</el-form>
</div>
<div style="margin-top: 20px;">
<el-button
style="width: 120px;margin-left: 5%"
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.addIcon"
:size="commonField.smallSize"
@click="handleQuery"
>打印标签
</el-button>
</div>
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="true">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script>
import commonField from "@/utils/commonField";
import {getInsStrumentInfo} from "@/api/query/query";
import {getDict} from "@/api/system/dict/data";
import deviceField from "@/utils/device/deviceField";
import commonField from "@/utils/commonField"
import { getToken } from '@/utils/auth'
import {getInsStrumentInfo} from "@/api/query/query"
import {getDict} from "@/api/system/dict/data"
import deviceField from "@/utils/device/deviceField"
import { openCameraAll, openCameraStorage } from '@/utils/WebViewContact'
export default {
name: "index",
......@@ -270,6 +312,28 @@ export default {
this.getInsType()// 获取类型字典
},
methods: {
/** 全部实现功能(带相机,相册,文件资源功能)*/
handlePpenCameraAll1() {
const params = {
subPath: 'shiwu',
tokenMsg: getToken()
}
this.$WebView.openCameraAll(params).then(res => {
this.imgUrlForm = JSON.parse(res)
console.info(imgUrlForm)
this.fileList.push(imgUrlForm)
})
},
handlePpenCameraAll2() {
const params = {
subPath: 'mp',
tokenMsg: getToken()
}
this.$WebView.openCameraAll(params).then(res => {
this.imgUrlForm = JSON.parse(res)
this.fileFakeList.push(imgUrlForm)
})
},
handlePreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
......@@ -278,7 +342,7 @@ export default {
if (this.queryParams.businessId === '') {
return
}
getInsStrumentInfo(this.queryParams.businessId).then(response => {
getInsStrumentInfo({code : this.queryParams.businessId}).then(response => {
this.form = response.data
this.fileList = response.data.filelist.filter(fileItem => {
return fileItem.insFileType === '2'
......@@ -292,6 +356,15 @@ export default {
this.fileFakeList.forEach(fileItem => {
fileItem.instrumentId = this.form.businessId
})
// 临时调试
/*this.fileFakeList.forEach(fileItem => {
fileItem.url = 'https://gips0.baidu.com/it/u=2539703269,1031275508&fm=3042&app=3042&f=JPEG&wm=1,huayi,0,0,13,9&wmo=0,0&w=1280&h=960'
})
this.fileList.forEach(fileItem => {
fileItem.url = 'https://gips0.baidu.com/it/u=2539703269,1031275508&fm=3042&app=3042&f=JPEG&wm=1,huayi,0,0,13,9&wmo=0,0&w=1280&h=960'
})*/
})
},
/** 查询按钮操作 */
......
......@@ -74,7 +74,6 @@ export default {
tokenMsg: getToken()
}
this.$WebView.openCameraStorage(params).then(res => {
console.log('拍照2', res)
this.imgUrlForm = JSON.parse(res)
})
},
......
<template>
<!-- uhf扫码枪按钮操控 -->
<div class="setup_module">
<div class="button_row" style="display: flex;">
<el-button class="button_rowBtn" type="primary" @click="handleStartPower">开始识别</el-button>
<el-button class="button_rowBtn" type="primary" @click="handleStopPower">停止识别</el-button>
</div>
<div class="button_row" style="display: flex;">
<el-button class="button_rowBtn" type="primary" @click="handleClearPower">清空数据</el-button>
<el-button class="button_rowBtn" type="primary" @click="handleSetPower">设置功率</el-button>
</div>
<div class="button_row" style="display: flex;">
<el-button class="button_rowBtn" type="primary" @click="handleSelect">设置筛选</el-button>
</div>
<!-- <div class="button_row">-->
<!-- <el-button class="button_rowBtn" type="primary" @click="handleAddVolume">音量+</el-button>-->
<!-- </div>-->
<!-- <div class="button_row">-->
<!-- <el-button class="button_rowBtn" type="primary" @click="handleReduceVolume">音量-</el-button>-->
<!-- </div>-->
<!--展示页-->
<div class="" style="margin-bottom: 10px;font-size: 60px">{{ resultInfo.length }}</div>
<el-table :data="tableList" style="width: 100%">
<el-table-column prop="typeId" label="ID" min-width="220" />
<el-table-column prop="rssi" label="RSSI" min-width="60" />
<el-table-column label="操作" min-width="100">
<template slot-scope="scope">
<el-button @click="handleFilter(scope.row)">筛选</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
style="width: 100%"
:page-size.sync="pageInfo.pageSize"
:total="resultInfo.length"
:pager-count="5"
hide-on-single-page
layout="prev,next"
:current-page.sync="pageInfo.pageNum"
/>
<!-- <div v-for="(item, index) in resultInfo" :key="index">-->
<!-- <div class="">{{ item.typeId }}</div>-->
<!-- <div class="">{{ item.rssi }}</div>-->
<!-- </div>-->
<!-- 对话框 -->
<el-form ref="formRef" :model="form" :rules="rules" class="dialog-form">
<el-dialog
:visible.sync="dialogVisible"
title="功率设置"
width="30%"
:before-close="handleClose"
>
<el-form-item prop="inputValue">
<!-- 数量限制1-30-->
<el-input
v-model="form.inputValue"
placeholder="请输入功率值"
clearable
oninput="value=value.replace(/[^0-9.]/g,'')"
style="margin-bottom: 20px;"
type="number"
:min="1"
:max="30"
:step="1"
@input="validateInput"
@change="watchInput"
@clear="clearInput"
/>
</el-form-item>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmInput">确认</el-button>
</span>
</el-dialog>
</el-form>
<!-- 设置筛选弹出框 -->
<el-dialog
:visible.sync="dialogVisibleSelect"
title="筛选设置"
width="30%"
:before-close="handleCloseSelect"
>
<el-input
v-model="selectValue"
placeholder="-"
clearable
style="margin-bottom: 20px;"
disabled
/>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleSelect = false">取消</el-button>
<el-button @click="clearSelect">清除</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getToken } from '@/utils/auth'
export default {
name: 'Index',
data() {
return {
// 假数据
selectValue: '',
selectValueList: [],
dialogVisible: false, // 控制对话框显示与隐藏
dialogVisibleSelect: false, // 控制设置筛选对话框显示与隐藏
startState: false, // 是否正在开启开始识别
form: {
inputValue: ''
},
rules: {
inputValue: [
{ required: true, message: '功率值不能为空!', trigger: 'blur' }
]
},
// 设置特定音量
volumeSValue: 0,
resultInfo: [],
pageInfo: {
pageNum: 1,
pageSize: 50
}
}
},
computed: {
tableList() {
const start = (this.pageInfo.pageNum - 1) * this.pageInfo.pageSize
const end = start + this.pageInfo.pageSize
return this.resultInfo.slice(start, end)
}
},
created() {
this.startState = false
// 组件创建时,也可以从缓存中读取值
const storedValue = localStorage.getItem('inputValue')
if (storedValue !== null) {
this.form.inputValue = storedValue
} else {
this.form.inputValue = 30
}
// 扫描结果
this.$WebView.DS_BRIDGE.register('resultInfo', args => {
console.log('扫出来的结果啊:', args)
this.resultInfo = JSON.parse(args)
})
},
methods: {
// 清除筛选值
clearSelect() {
this.dialogVisibleSelect = false
this.selectValue = ''
this.selectValueList = []
},
// 点击当条筛选值
handleFilter(row) {
console.log('当前行的typeId值:', row.typeId)
// 检查元素是否已经存在于数组中
if (!this.selectValueList.includes(row.typeId)) {
// 如果不存在,则添加到数组中
this.selectValueList.push(row.typeId)
// 给筛选设置设置默认值,将数组中的元素用逗号拼接
this.selectValue = this.selectValueList.join(',')
console.log('打印selectValueList值:', this.selectValueList)
console.log('打印selectValue值:', this.selectValue)
} else {
// 如果已存在,可以在这里添加一些逻辑,比如打印一条消息或者什么都不做
console.log('该typeId值已存在,不再添加。')
console.log('打印selectValueList值:', this.selectValueList)
console.log('打印selectValue值:', this.selectValue)
}
},
// 设置筛选弹窗
handleSelect() {
console.log('打开了设置筛选', '')
console.log('selectValue的值啊啊啊', this.selectValue)
this.dialogVisibleSelect = true // 显示对话框
},
// 输入效率值校验
validateInput(value) {
if (value === '' || value === null) {
this.form.inputValue = '' // 允许清空输入
} else if (!Number.isInteger(+value) || value < 1 || value > 30) {
this.form.inputValue = 1 // 如果输入不合法或包含小数,重置为1或其他默认值
} else {
this.form.inputValue = value // 合法输入,更新formData
}
},
watchInput(event) {
const value = event.target.value
const numberValue = +value // 尝试将输入转换为数字
if (!Number.isInteger(numberValue) || numberValue < 1 || numberValue > 9) {
// 如果输入包含小数或不在这个范围内,重置输入框
event.target.value = this.form.inputValue
}
},
/** 开始识别按钮*/
handleStartPower() {
this.startState = true
const params = {
flag: 'startPower',
selectValue: this.selectValueList,
tokenMsg: getToken()
}
// 补充逻辑:如果设置筛选有值就调筛选逻辑,传id过去,筛选没值就不传id过去
this.$WebView.startPower(params).then(res => {
this.imgUrlForm = JSON.parse(res)
})
},
/** 清空数据按钮*/
handleClearPower() {
const params = {
flag: 'clearPower',
tokenMsg: getToken()
}
this.$WebView.clearPower(params).then(res => {
this.imgUrlForm = JSON.parse(res)
})
},
/** 停止识别按钮*/
handleStopPower() {
this.startState = false
console.log('调用前', getToken())
const params = {
flag: 'stopPower',
tokenMsg: getToken()
}
this.$WebView.stopPower(params).then(res => {
this.imgUrlForm = JSON.parse(res)
})
},
// clear按钮
clearInput() {
this.form.inputValue = '' // 清除输入框内容
this.$nextTick(() => {
// 手动触发表单验证,但忽略错误提示
this.$refs.formRef.validateField('inputValue', valid => {
// 这里不进行任何操作,只是为了避免自动验证
})
})
},
// clear筛选按钮
clearSelectInput() {
this.selectValue = '' // 清除输入框内容
},
/** 确认按钮*/
confirmInput() {
this.$refs.formRef.validate((valid) => {
if (valid) {
// 表单验证通过
this.dialogVisible = false
// 存储值到localStorage
localStorage.setItem('inputValue', this.form.inputValue)
// 未开启
const paramsNone = {
flag: 'setPowerNone',
// 设置的功率值
msg: this.form.inputValue,
tokenMsg: getToken()
}
// 开启中
const paramsScand = {
flag: 'setPowerScand',
// 设置的功率值
msg: this.form.inputValue,
tokenMsg: getToken()
}
if (this.startState) {
this.$WebView.setPower(paramsScand).then(res => {
this.imgUrlForm = JSON.parse(res)
})
} else {
// 没开
this.$WebView.setPower(paramsNone).then(res => {
this.imgUrlForm = JSON.parse(res)
})
}
} else {
// 表单验证失败
console.error('功率值不能为空!')
return false
}
})
},
/** 关闭弹窗*/
handleClose() {
console.log('对话框被关闭')
this.dialogVisible = false // 关闭对话框
},
/** 关闭筛选设置弹窗*/
handleCloseSelect() {
console.log('筛选设置对话框被关闭')
this.dialogVisibleSelect = false // 关闭对话框
},
/** 设置功率按钮*/
handleSetPower() {
this.dialogVisible = true // 显示对话框
// 从localStorage中读取值
const storedValue = localStorage.getItem('inputValue')
if (storedValue !== null) {
this.form.inputValue = storedValue
}
this.dialogVisible = true // 显示对话框
},
/** 增加音量按钮*/
handleAddVolume() {
console.log('调用前', getToken())
const params = {
flag: 'addVolume',
// 设置的系统音量值,传0,1,2,3,4五个档位
volumeValue: this.volumeSValue,
tokenMsg: getToken()
}
this.$WebView.addVolume(params).then(res => {
console.log('addVolume', res)
console.log('addVolume', JSON.parse(res))
this.imgUrlForm = JSON.parse(res)
})
},
/** 减小音量按钮*/
handleReduceVolume() {
console.log('调用前', getToken())
const params = {
flag: 'reduceVolume',
tokenMsg: getToken()
}
this.$WebView.reduceVolume(params).then(res => {
console.log('reduceVolume', res)
console.log('reduceVolume', JSON.parse(res))
this.imgUrlForm = JSON.parse(res)
})
}
}
}
</script>
<style scoped lang="scss">
.setup_module {
padding: 0px 20px 20px 20px;
.button_row {
margin: 0px 20px 20px 20px;
.button_rowBtn {
font-size: 17px;
width: 160px;
}
.button_rowText {
margin-top: 10px;
}
}
}
</style>
<template>
<div @keyup.enter="handleQuery" style="display: flex; flex-direction: column; height: 78vh;">
<el-form ref="queryForm" :model="queryParams" :inline="true"
@submit.native.prevent
style="border-bottom: 1px solid #dcdcdc;">
<el-form-item label="编号" prop="insCode" style="padding-left: 10px">
<el-form-item label="" prop="insCode" style="padding-left: 10px">
<el-input
v-model="queryParams.businessId"
placeholder="请输入编号"
......@@ -10,10 +11,10 @@
autofocus
:maxlength="30"
size="small"
style="width: 120px;"
style="width: 140px;"
/>
<el-button
style="width: 75px;margin-left: 0"
style="width: 70px;margin-left: 0"
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.queryIcon"
......@@ -22,7 +23,7 @@
>查询
</el-button>
<el-button
style="width: 75px;margin-left: 0"
style="width: 70px;margin-left: 0"
:class="commonField.resetClass"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
......@@ -104,37 +105,31 @@
</el-row>
<el-row :span="24">
<el-form-item label="实物:" prop="insImplementation">
<div class="photo-wall" v-if="fileFakeList.length > 0">
<el-carousel height="150px" style="width: 150px;" indicator-position="none">
<el-carousel-item v-for="(item, index) in fileFakeList" >
<el-image
@click="handlePreview(item)"
:key="index"
:src="item.url"
:teleported="true"
style="width: 150px; height: 150px;"
fit="cover"
/>
</el-carousel-item>
</el-carousel>
<div class="photo-wall" style="display: flex" v-if="fileFakeList.length > 0" v-for="(item, index) in fileFakeList">
<el-image
@click="handlePreview(item)"
:key="index"
:src="item.url"
:teleported="true"
style="width: 150px; height: 150px;margin-top: 5%"
fit="cover"
/>
<el-button type="danger" icon="el-icon-delete" circle style="height: 40px;margin-left: 5%;margin-top: 10%"></el-button>
</div>
</el-form-item>
</el-row>
<el-row :span="24">
<el-form-item label="参照物:" prop="file">
<div class="photo-wall" v-if="fileList.length > 0">
<el-carousel height="150px" style="width: 150px;" indicator-position="none">
<el-carousel-item v-for="(item, index) in fileList">
<el-image
@click="handlePreview(item)"
:key="index"
:src="item.url"
z-index="2000"
style="width: 150px; height: 150px;"
fit="cover"
/>
</el-carousel-item>
</el-carousel>
<el-form-item label="铭牌:" prop="file">
<div class="photo-wall" style="display: flex" v-if="fileList.length > 0" v-for="(item, index) in fileList">
<el-image
@click="handlePreview(item)"
:key="index"
:src="item.url"
:teleported="true"
style="width: 150px; height: 150px;margin-top: 5%"
fit="cover"
/>
<el-button type="danger" icon="el-icon-delete" circle style="height: 40px;margin-left: 5%;margin-top: 10%"></el-button>
</div>
</el-form-item>
</el-row>
......@@ -192,16 +187,74 @@
</el-row>
</el-form>
</div>
<div style="margin-top: 20px;">
<el-row :gutter="24" type="flex" justify="center">
<el-col :span="4">
<el-button class="submitBtn" type="primary" @click="locat">
<span>仪器定位</span>
</el-button>
</el-col>
<el-col :span="2">
</el-col>
<el-col :span="4">
<el-button class="submitBtn" type="primary" @click="cancel">
<span>取消定位</span>
</el-button>
</el-col>
<el-col :span="2">
</el-col>
<el-col :span="4">
<el-button class="submitBtn" type="primary" @click="googlv">
<span>设置功率</span>
</el-button>
</el-col>
</el-row>
</div>
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="true">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<!-- 对话框 -->
<el-form ref="formRef" :model="form" :rules="rules" class="dialog-form">
<el-dialog
:visible.sync="dialogVisibleGL"
title="功率设置"
width="30%"
:before-close="handleClose"
>
<el-form-item prop="inputValue">
<!-- 数量限制1-30-->
<el-input
v-model="form.inputValue"
placeholder="请输入功率值"
clearable
oninput="value=value.replace(/[^0-9.]/g,'')"
style="margin-bottom: 20px;"
type="number"
:min="1"
:max="30"
:step="1"
@input="validateInput"
@change="watchInput"
@clear="clearInput"
/>
</el-form-item>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleGL = false">取消</el-button>
<el-button type="primary" @click="confirmInput">确认</el-button>
</span>
</el-dialog>
</el-form>
</div>
</template>
<script>
import commonField from "@/utils/commonField";
import {getInsStrumentInfo} from "@/api/query/query";
import {getDict} from "@/api/system/dict/data";
import deviceField from "@/utils/device/deviceField";
import commonField from "@/utils/commonField"
import { getToken } from '@/utils/auth'
import {getInsStrumentInfo} from "@/api/query/query"
import {getDict} from "@/api/system/dict/data"
import deviceField from "@/utils/device/deviceField"
import { openCameraAll, openCameraStorage } from '@/utils/WebViewContact'
export default {
name: "index",
......@@ -221,8 +274,10 @@ export default {
queryParams: {
businessId: '',
},
dialogVisibleGL: false, // 控制对话框显示与隐藏
// 表单参数
form: {
inputValue: '',
businessId: '',
insCode: '',
insType: '',
......@@ -250,11 +305,18 @@ export default {
insSureRemark: '',
insManage: '',
insDeptId: '',
insRfid: '',
deptName: '',
createDate: '',
createUsername: '',
flag: '1'
}
},
startState: false, // 是否正在开启开始识别
rules: {
inputValue: [
{ required: true, message: '功率值不能为空!', trigger: 'blur' }
]
},
}
},
computed: {
......@@ -268,8 +330,84 @@ export default {
created() {
this.getInsManageList()
this.getInsType()// 获取类型字典
this.$WebView.DS_BRIDGE.register('resultInfo', args => {
// 根据resultInfo的key拿到Android实时推送的数据解析后赋值回显
// [{rssi: '-75.60', typeId: 'Exxxxxxx' }]
let resList = JSON.parse(args)
})
},
methods: {
// 输入效率值校验
validateInput(value) {
if (value === '' || value === null) {
this.form.inputValue = '' // 允许清空输入
} else if (!Number.isInteger(+value) || value < 1 || value > 30) {
this.form.inputValue = 1 // 如果输入不合法或包含小数,重置为1或其他默认值
} else {
this.form.inputValue = value // 合法输入,更新formData
}
},
watchInput(event) {
const value = event.target.value
const numberValue = +value // 尝试将输入转换为数字
if (!Number.isInteger(numberValue) || numberValue < 1 || numberValue > 9) {
// 如果输入包含小数或不在这个范围内,重置输入框
event.target.value = this.form.inputValue
}
},
// clear按钮
clearInput() {
this.form.inputValue = '' // 清除输入框内容
this.$nextTick(() => {
// 手动触发表单验证,但忽略错误提示
this.$refs.formRef.validateField('inputValue', valid => {
// 这里不进行任何操作,只是为了避免自动验证
})
})
},
/** 确认按钮*/
confirmInput() {
this.$refs.formRef.validate((valid) => {
if (valid) {
// 表单验证通过
this.dialogVisibleGL = false
// 存储值到localStorage
localStorage.setItem('inputValue', this.form.inputValue)
// 未开启
const paramsNone = {
flag: 'setPowerNone',
// 设置的功率值
msg: this.form.inputValue,
tokenMsg: getToken()
}
// 开启中
const paramsScand = {
flag: 'setPowerScand',
// 设置的功率值
msg: this.form.inputValue,
tokenMsg: getToken()
}
if (this.startState) {
this.$WebView.setPower(paramsScand).then(res => {
this.imgUrlForm = JSON.parse(res)
})
} else {
// 没开
this.$WebView.setPower(paramsNone).then(res => {
this.imgUrlForm = JSON.parse(res)
})
}
} else {
// 表单验证失败
console.error('功率值不能为空!')
return false
}
})
},
/** 关闭弹窗*/
handleClose() {
this.dialogVisibleGL = false // 关闭对话框
},
handlePreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
......@@ -278,7 +416,7 @@ export default {
if (this.queryParams.businessId === '') {
return
}
getInsStrumentInfo(this.queryParams.businessId).then(response => {
getInsStrumentInfo({code : this.queryParams.businessId}).then(response => {
this.form = response.data
this.fileList = response.data.filelist.filter(fileItem => {
return fileItem.insFileType === '2'
......@@ -292,6 +430,15 @@ export default {
this.fileFakeList.forEach(fileItem => {
fileItem.instrumentId = this.form.businessId
})
// 临时调试
/*this.fileFakeList.forEach(fileItem => {
fileItem.url = 'https://gips0.baidu.com/it/u=2539703269,1031275508&fm=3042&app=3042&f=JPEG&wm=1,huayi,0,0,13,9&wmo=0,0&w=1280&h=960'
})
this.fileList.forEach(fileItem => {
fileItem.url = 'https://gips0.baidu.com/it/u=2539703269,1031275508&fm=3042&app=3042&f=JPEG&wm=1,huayi,0,0,13,9&wmo=0,0&w=1280&h=960'
})*/
})
},
/** 查询按钮操作 */
......@@ -321,6 +468,54 @@ export default {
this.insTypeList = result.data
})
},
locat() {
if(!this.form.insRfid) {
this.$message({ message: "设备无RFID!", type: 'error' })
return ;
}
let selectList = [this.form.insRfid]
this.startState = true
const params = {
flag: 'startPower',
selectValue: selectList,
tokenMsg: getToken()
}
// 补充逻辑:如果设置筛选有值就调筛选逻辑,传id过去,筛选没值就不传id过去
this.$WebView.startPower(params).then(res => {
})
},
/** 清空数据按钮*/
handleClearPower() {
const params = {
flag: 'clearPower',
tokenMsg: getToken()
}
this.$WebView.clearPower(params).then(res => {
})
},
/** 停止识别按钮*/
handleStopPower() {
this.startState = false
const params = {
flag: 'stopPower',
tokenMsg: getToken()
}
this.$WebView.stopPower(params).then(res => {
this.imgUrlForm = JSON.parse(res)
})
},
cancel() {
this.handleClearPower()
this.handleStopPower()
},
googlv() {
// 从localStorage中读取值
const storedValue = localStorage.getItem('inputValue')
if (storedValue !== null) {
this.form.inputValue = storedValue
}
this.dialogVisibleGL = true // 显示对话框
}
}
}
......
......@@ -91,8 +91,8 @@ module.exports = {
// target: `http://192.168.1.12:8082/`, // 孙浩
// target: `http://192.168.1.41:8082/`,
// target: `http://49.232.167.247:20014/`, // 线上
// target: `http://192.168.1.30:8082/`,
target: `http://192.168.0.3:8092/`,
target: `http://106.3.99.36:20101/`,
// target: `http://192.168.0.3:8092/`,
// target: `http://localhost:8092/`,
// target: `http://49.232.167.247:20014/`,
// changeOrigin: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment