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-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"
z-index="2000"
style="width: 150px; height: 150px;"
:teleported="true"
style="width: 150px; height: 150px;margin-top: 5%"
fit="cover"
/>
</el-carousel-item>
</el-carousel>
<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)
})
},
......
This diff is collapsed.
This diff is collapsed.
......@@ -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