|
@@ -47,9 +47,10 @@
|
|
|
<span class="method-description">手工输入货号</span>
|
|
<span class="method-description">手工输入货号</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="input-container flex-row">
|
|
<div class="input-container flex-row">
|
|
|
- <el-input class="input-item" v-model="goods_art_no" placeholder="请输入货号">
|
|
|
|
|
|
|
+ <el-input class="input-item" v-model="goods_art_no_tpl" placeholder="请输入货号">
|
|
|
<template #append>
|
|
<template #append>
|
|
|
- <el-button class="input-button" type="primary" @click="runGoods">确认</el-button>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-button class="input-button" type="primary" @click="saveGoodsArtNo">确认</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-input>
|
|
</el-input>
|
|
|
|
|
|
|
@@ -84,28 +85,34 @@
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<div class="history-section flex-col">
|
|
<div class="history-section flex-col">
|
|
|
- <span class="history-title">拍摄记录</span>
|
|
|
|
|
|
|
+ <span class="history-title flex between">
|
|
|
|
|
+ <div>拍摄记录</div>
|
|
|
|
|
+ <div class="c-666 fs-12" v-if="goodsList.length">
|
|
|
|
|
+ <el-button @click="delAll" class="input-button" type="primary" size="mini">一键删除</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </span>
|
|
|
<img class="divider-line" referrerpolicy="no-referrer" src="@/assets/images/Photography/divider-line.png" />
|
|
<img class="divider-line" referrerpolicy="no-referrer" src="@/assets/images/Photography/divider-line.png" />
|
|
|
<div class="history-warp">
|
|
<div class="history-warp">
|
|
|
|
|
|
|
|
- <div class="history-item clearfix" v-for="item in goodsList" style="padding:10px;">
|
|
|
|
|
|
|
+ <div class="history-item clearfix" v-for="item,index in goodsList" style="padding:10px;">
|
|
|
<div class="flex between flex-item c-333">
|
|
<div class="flex between flex-item c-333">
|
|
|
<div class="chaochu flex-item flex left">货号:{{ item.goods_art_no }}</div>
|
|
<div class="chaochu flex-item flex left">货号:{{ item.goods_art_no }}</div>
|
|
|
- <div class="c-666 fs-12">{{ item.time }}</div>
|
|
|
|
|
|
|
+ <div class="c-666 fs-12">{{ getTime(item.action_time) }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="mar-top-10" style="width: 100%" >
|
|
<div class="mar-top-10" style="width: 100%" >
|
|
|
<component class="history-item_image"
|
|
<component class="history-item_image"
|
|
|
- v-loading="!src"
|
|
|
|
|
- v-for="src in item.images"
|
|
|
|
|
- :is="src ? 'div' : 'p'"
|
|
|
|
|
|
|
+ v-loading="!image.image_path && runAction.goods_art_no == item.goods_art_no"
|
|
|
|
|
+ v-for="image in item.items"
|
|
|
|
|
+ :is="image.image_path ? 'div' : 'p'"
|
|
|
|
|
+
|
|
|
>
|
|
>
|
|
|
<el-popover
|
|
<el-popover
|
|
|
popper-class="shot-image-popper"
|
|
popper-class="shot-image-popper"
|
|
|
placement="left"
|
|
placement="left"
|
|
|
- v-if="src"
|
|
|
|
|
|
|
+ v-if="image.image_path"
|
|
|
>
|
|
>
|
|
|
<template #reference>
|
|
<template #reference>
|
|
|
- <el-image :src="src" fit="contain" >
|
|
|
|
|
|
|
+ <el-image :src="getFilePath(image.image_path)" fit="contain" >
|
|
|
<template #error>
|
|
<template #error>
|
|
|
<div class="image-slot"></div>
|
|
<div class="image-slot"></div>
|
|
|
</template>
|
|
</template>
|
|
@@ -113,7 +120,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <el-image :src="src" fit="contain" >
|
|
|
|
|
|
|
+ <el-image :src="getFilePath(image.image_path)" fit="contain" >
|
|
|
<template #error>
|
|
<template #error>
|
|
|
<div class="image-slot"></div>
|
|
<div class="image-slot"></div>
|
|
|
</template>
|
|
</template>
|
|
@@ -121,7 +128,7 @@
|
|
|
</el-popover>
|
|
</el-popover>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <el-image :src="src" fit="contain" v-else>
|
|
|
|
|
|
|
+ <el-image :src="getFilePath(image.image_path)" fit="contain" v-else>
|
|
|
<template #error>
|
|
<template #error>
|
|
|
<div class="image-slot"></div>
|
|
<div class="image-slot"></div>
|
|
|
</template>
|
|
</template>
|
|
@@ -151,98 +158,150 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import headerBar from '@/components/header-bar/index.vue'
|
|
import headerBar from '@/components/header-bar/index.vue'
|
|
|
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
|
|
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
|
|
|
-import { ossResize } from '@/utils/appfun'
|
|
|
|
|
import icpList from '@/utils/ipc'
|
|
import icpList from '@/utils/ipc'
|
|
|
import client from "@/stores/modules/client";
|
|
import client from "@/stores/modules/client";
|
|
|
import socket from "@/stores/modules/socket";
|
|
import socket from "@/stores/modules/socket";
|
|
|
|
|
+import { ElMessage ,ElMessageBox } from 'element-plus'
|
|
|
|
|
+import { getFilePath } from '@/utils/appfun'
|
|
|
|
|
|
|
|
-const goods_art_no = ref('')
|
|
|
|
|
-const loading = ref(true)
|
|
|
|
|
-const test_image_url = ref('https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png')
|
|
|
|
|
|
|
|
|
|
const clientStore = client();
|
|
const clientStore = client();
|
|
|
|
|
+
|
|
|
|
|
+const goods_art_no_tpl = ref('')
|
|
|
|
|
+const goods_art_no = ref('')
|
|
|
const runAction = ref({
|
|
const runAction = ref({
|
|
|
"action": "",
|
|
"action": "",
|
|
|
"goods_art_no": ""
|
|
"goods_art_no": ""
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+// 初始化 WebSocket 状态管理
|
|
|
|
|
+const socketStore = socket()
|
|
|
|
|
|
|
|
-const goodsList = reactive(
|
|
|
|
|
- [
|
|
|
|
|
- {
|
|
|
|
|
- goods_art_no:"123456789123456789123456789",
|
|
|
|
|
- image_counts:6,
|
|
|
|
|
- images:['file:\\\C:\\Users\\Administrator\\Desktop\\图片\\已扣图\\123.png','','','','','','',''],
|
|
|
|
|
- time:"03/20 14:45"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- goods_art_no:"123456789",
|
|
|
|
|
- image_counts:6,
|
|
|
|
|
- images:['','','','','','','',''],
|
|
|
|
|
- time:"25/03/20 14:45"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- goods_art_no:"123456789",
|
|
|
|
|
- image_counts:6,
|
|
|
|
|
- images:['','','','','','','',''],
|
|
|
|
|
- time:"25/03/20 14:45"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- goods_art_no:"123456789",
|
|
|
|
|
- image_counts:6,
|
|
|
|
|
- images:['','','','','','','',''],
|
|
|
|
|
- time:"25/03/20 14:45"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- goods_art_no:"123456789",
|
|
|
|
|
- image_counts:6,
|
|
|
|
|
- images:['','','','','','','',''],
|
|
|
|
|
- time:"25/03/20 14:45"
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
-)
|
|
|
|
|
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
- clientStore.ipc.on(icpList.socket.message + '_blue_tooth_scan', (event, result) => {
|
|
|
|
|
- if (result.code === 0 && result.data?.data) {
|
|
|
|
|
- runGoods(result.data?.data)
|
|
|
|
|
|
|
+function saveGoodsArtNo(){
|
|
|
|
|
+ if(goods_art_no_tpl.value) goods_art_no.value = goods_art_no_tpl.value
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+//获取拍照记录
|
|
|
|
|
+async function getPhotoRecords(params?:{}) {
|
|
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
|
|
|
|
|
+ clientStore.ipc.send(icpList.takePhoto.getPhotoRecords,{
|
|
|
|
|
+ ...params,
|
|
|
|
|
+ page:1,
|
|
|
|
|
+ size:100,
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log({
|
|
|
|
|
+ ...params,
|
|
|
|
|
+ page:1,
|
|
|
|
|
+ size:100,
|
|
|
|
|
+ })
|
|
|
|
|
+ clientStore.ipc.on(icpList.takePhoto.getPhotoRecords, (event, result) => {
|
|
|
|
|
+
|
|
|
|
|
+ console.log('getPhotoRecords');
|
|
|
|
|
+ console.log(result);
|
|
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
|
|
|
|
|
+ if(result.code === 0){
|
|
|
|
|
+ goodsList.value = result.data.list
|
|
|
|
|
+ }else if(result.msg) {
|
|
|
|
|
+ ElMessage.error(result.msg)
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- clientStore.ipc.on(icpList.socket.message + '_mcu', (event, result) => {
|
|
|
|
|
- console.log('mcu')
|
|
|
|
|
- console.log(result)
|
|
|
|
|
|
|
+//执行拍照 扫了货号,点击遥控器
|
|
|
|
|
+async function runGoods(data) {
|
|
|
|
|
+ await socketStore.connectSocket();
|
|
|
|
|
+ socketStore.sendMessage({
|
|
|
|
|
+ type: 'run_mcu',
|
|
|
|
|
+ data,
|
|
|
})
|
|
})
|
|
|
|
|
+ runAction.value = data
|
|
|
|
|
+ goods_art_no.value = ''
|
|
|
|
|
+ goods_art_no_tpl.value = ''
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const goodsList = ref([])
|
|
|
|
|
+
|
|
|
|
|
+const getTime = function(time){
|
|
|
|
|
+ if(!time) return null
|
|
|
|
|
+ return time.replace('T',' ').substr(5,11)
|
|
|
|
|
+}
|
|
|
|
|
+async function delAll(){
|
|
|
|
|
+ let params = goodsList.value.map(item=>item.goods_art_no)
|
|
|
|
|
+ await ElMessageBox.confirm('确定要删除当下的历史记录吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ })
|
|
|
|
|
+ del({goods_art_nos:params})
|
|
|
|
|
+}
|
|
|
|
|
+const del = async function(params){
|
|
|
|
|
+
|
|
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.takePhoto.delectGoodsArts);
|
|
|
|
|
+ clientStore.ipc.send(icpList.takePhoto.delectGoodsArts,params);
|
|
|
|
|
+ clientStore.ipc.on(icpList.takePhoto.delectGoodsArts, (event, result) => {
|
|
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.takePhoto.delectGoodsArts);
|
|
|
|
|
+ if(result.code === 0){
|
|
|
|
|
+ ElMessage.info('货号删除成功')
|
|
|
|
|
+ getPhotoRecords()
|
|
|
|
|
+ }else if(result.msg) {
|
|
|
|
|
+ ElMessage.error(result.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ //扫货号
|
|
|
|
|
+ clientStore.ipc.on(icpList.socket.message + '_blue_tooth_scan', (event, result) => {
|
|
|
|
|
+
|
|
|
|
|
+ console.log('_blue_tooth_scan')
|
|
|
|
|
+ if (result.code === 0 && result.data?.data) {
|
|
|
|
|
+ if(result.data?.data.goods_art_no) runGoods(result.data?.data)
|
|
|
|
|
+ if(!result.data?.data.goods_art_no && goods_art_no.value){
|
|
|
|
|
+ console.log('手工')
|
|
|
|
|
+ console.log({
|
|
|
|
|
+ ...result.data?.data,
|
|
|
|
|
+ goods_art_no: goods_art_no.value
|
|
|
|
|
+ })
|
|
|
|
|
+ runGoods({
|
|
|
|
|
+ ...result.data?.data,
|
|
|
|
|
+ goods_art_no: goods_art_no.value
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- clientStore.ipc.on(icpList.socket.message + '_image_process', (event, result) => {
|
|
|
|
|
- if(result.msg === 'MCU 命令已发送完成'){
|
|
|
|
|
- result.image_counts //拍照数量
|
|
|
|
|
- result.goods_art_no //货号
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ await getPhotoRecords();
|
|
|
|
|
+ // 扫码后 货号入库
|
|
|
|
|
+ clientStore.ipc.on(icpList.socket.message + '_image_process', (event, result) => {
|
|
|
console.log('_image_process')
|
|
console.log('_image_process')
|
|
|
console.log(result)
|
|
console.log(result)
|
|
|
|
|
+ getPhotoRecords()
|
|
|
|
|
+ })
|
|
|
|
|
+ clientStore.ipc.on(icpList.socket.message + '_photo_take', (event, result) => {
|
|
|
|
|
+ console.log('_photo_take')
|
|
|
|
|
+ console.log(result)
|
|
|
|
|
+ if(result.status === 2 && result.msg.includes('执行完成')) getPhotoRecords()
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
//关闭页面 去掉监听
|
|
//关闭页面 去掉监听
|
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message + '_blue_tooth_scan');
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message + '_blue_tooth_scan');
|
|
|
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_mcu');
|
|
|
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message + '_image_process');
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message + '_image_process');
|
|
|
|
|
+ clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take');
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-// 初始化 WebSocket 状态管理
|
|
|
|
|
-const socketStore = socket()
|
|
|
|
|
-
|
|
|
|
|
-async function runGoods(data) {
|
|
|
|
|
- await socketStore.connectSocket();
|
|
|
|
|
- socketStore.sendMessage({
|
|
|
|
|
- type: 'run_mcu',
|
|
|
|
|
- data,
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- runAction.value = data
|
|
|
|
|
-}
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
@@ -665,7 +724,7 @@ async function runGoods(data) {
|
|
|
padding-top: 30px;
|
|
padding-top: 30px;
|
|
|
|
|
|
|
|
.history-title {
|
|
.history-title {
|
|
|
- width: 64px;
|
|
|
|
|
|
|
+ width: calc(100% - 20px);
|
|
|
height: 22px;
|
|
height: 22px;
|
|
|
overflow-wrap: break-word;
|
|
overflow-wrap: break-word;
|
|
|
color: rgba(51, 51, 51, 1);
|
|
color: rgba(51, 51, 51, 1);
|