| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451 |
- <template>
- <headerBar
- :title="configInfoStore.appModel === 1 ? '拍摄商品' : '处理图像'"
- showUser
- :menu="menu"
- />
- <hardware-check/>
- <div class="photography-page flex-col">
- <div class="main-container">
- <template v-if="configInfoStore.appModel === 1 ">
- <div class="content-wrapper flex-row">
- <!-- <img class="camera-image" referrerpolicy="no-referrer" src="@/assets/images/Photography/camera-icon.png" />-->
- <div class="step-number flex-col"><span class="text_22">1</span></div>
- <div class="step-one flex-col justify-between">
- <div class="step-header flex-row">
- <span class="step-title">第一步:获取商品货号</span>
- <img class="step-icon" referrerpolicy="no-referrer" src="@/assets/images/Photography/step1-icon.png" />
- <img class="step-divider" referrerpolicy="no-referrer"
- src="@/assets/images/Photography/step-divider-line.png" />
- </div>
- <div class="step-content flex-row justify-between">
- <div class="method-container flex-col">
- <div class="input-container flex-row">
- <el-input class="input-item" v-model="goods_art_no" placeholder="请输入货号"> </el-input>
- </div>
- <div class="auto-method flex-row justify-between">
- <div class="text-method-tag flex-col"><span class="text_4">自动获取</span></div>
- <span class="method-description">用遥控器扫描商品资料二维码</span>
- </div>
- <div class="scan-method flex-row justify-between">
- <div class="remote-control flex-col">
- </div>
- <!-- <span class="scan-label">遥控器扫描键</span>-->
- </div>
- </div>
- <img class="remote-image" referrerpolicy="no-referrer"
- src="@/assets/images/Photography/remote-control.png" />
- </div>
- </div>
- <div class="step-number flex-col"><span class="text_22">2</span></div>
- <div class="step-two flex-col justify-between">
- <span class="step-title">第二步:启动拍摄(根据按遥控器左右键启动)</span>
- <div class="shooting-container flex-col">
- <div class="shooting-tips flex-row justify-between">
- <img class="info-icon" referrerpolicy="no-referrer" src="@/assets/images/Photography/info-icon.png" />
- <span class="tips-text">遥控左右按键可启动拍摄,中间按钮可在拍摄5张主图后解锁,用于拍摄自定义图</span>
- </div>
- <div class="wifi mar-top-20">
- <img referrerpolicy="no-referrer"
- src="@/assets/images/Photography/wifi.png" style="width: 60px" />
- </div>
- <div class="remote-control-wrap">
- <RemoteControl
- @onRemoteControl="onRemoteControl"
- />
- </div>
- </div>
- </div>
- </div>
- <div class="last-photo" v-show="showlastPhoto" v-key="lastPhoto.file_path">
- <div>{{lastPhoto.action_name || ''}}</div>
- <el-image :src="getFilePath(lastPhoto.file_path)" fit="contain" ></el-image>
- </div>
- </template>
- <div class="history-section flex-col"
- :class="configInfoStore.appModel === 2 ? 'koutu-section' : ''"
- >
- <span class="history-title flex between">
- <div>拍摄记录</div>
- <div class="c-666 fs-12" v-if="goodsList.length" >
- <el-button :disabled="!(runLoading || takePictureLoading)" @click="oneClickStop" v-if="configInfoStore.appModel === 1" class="input-button" type="primary" size="mini">一键停止</el-button>
- <el-button :disabled="runLoading || takePictureLoading" @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" />
- <div class="history-warp">
- <div v-if="!goodsList.length" class="fs-14 c-666 mar-top-50">
- {{ loading ? '数据正在加载中,请稍候...' : '暂无数据,请先进行拍摄'}}
- </div>
- <div v-else class="history-item clearfix" v-for="item,index in goodsList" style="padding:10px;">
- <div class="flex between flex-item c-333">
- <div class="chaochu flex-item flex left">货号:{{ item.goods_art_no }}</div>
- <div >
- <!--
- <el-button :disabled="runLoading || takePictureLoading" size="small" plain >高级生成</el-button>
- -->
- <el-dropdown @command="handleGenerateCommand" :disabled="runLoading || takePictureLoading" >
- <el-button :disabled="runLoading || takePictureLoading" size="small" plain style="margin-right: 5px" >高级生成</el-button>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item
- v-for="menu in generate.children"
- @click.native="onGenerateCLick(menu,item)">{{ menu.name }}</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- <el-button size="small" :disabled="runLoading || takePictureLoading" type="primary" @click="reTakePictureNos(item.goods_art_no,item)" plain v-if="configInfoStore.appModel === 1">重拍</el-button>
- <el-button size="small" :disabled="runLoading || takePictureLoading" @click="delGoods({goods_art_nos:[item.goods_art_no]})">删除</el-button>
- </div>
- </div>
- <div class="flex between flex-item c-333">
- <div class="c-999 fs-12">{{ getTime(item.action_time) }}</div>
- </div>
- <div class="mar-top-10 clearfix history-item_image_wrap" style="width: 100%" >
- <component class="history-item_image"
- v-for="image,index in item.items"
- v-loading="!image.PhotoRecord.image_path && runAction.goods_art_no == item.goods_art_no"
- :is="image.PhotoRecord.image_path ? 'div' : 'p'"
- >
- <span class="tag">{{ image.action_name }}</span>
- <el-popover
- :popper-class="configInfoStore.appModel === 1 ? 'shot-image-popper' : 'koutu-image-popper'"
- :placement=" configInfoStore.appModel === 1 ? 'left' : 'right'"
- :hide-after="0"
- width="50%"
- offset="20"
- v-if="image.PhotoRecord.image_path"
- >
- <template #reference>
- <div class="flex el-image_view">
- <el-image :src="getFilePath(image.PhotoRecord.image_path)" fit="contain" >
- <template #error>
- <div class="image-slot"></div>
- </template>
- </el-image>
- <el-button :disabled="runLoading || takePictureLoading" class="reset-button" @click="reTakePicture(image.PhotoRecord)">重拍</el-button>
- </div>
- </template>
- <el-image :src="getFilePath(image.PhotoRecord.image_path)" fit="contain" >
- <template #error>
- <div class="image-slot"></div>
- </template>
- </el-image>
- </el-popover>
- <div class="flex el-image_view" v-else>
- <el-image :src="getFilePath(image.PhotoRecord.image_path)" fit="contain">
- <template #error>
- <div class="image-slot"></div>
- <el-button :disabled="runLoading || takePictureLoading" class="reset-button" @click="reTakePicture(image.PhotoRecord)">重拍</el-button>
- </template>
- </el-image>
- </div>
- </component>
- <div v-if="item.items.length < 5"
- v-for="item in (5 - item.items.length)"
- class="history-item_image"
- >
- <span class="tag" style="font-size: 12px;">暂未配置</span>
- </div>
- </div>
- </div>
- </div>
- <!-- 无数据 -->
- <!-- <div class="empty-state flex-col justify-between">
- <img
- class="empty-icon"
- referrerpolicy="no-referrer"
- src="@/assets/images/Photography/empty-state-icon.png"
- />
- <span class="empty-text">暂无数据</span>
- </div>-->
- <div v-if="goodsList.length" class="next-step button--primary1 flex-col" @click="openPhotographyDetail"><span
- class="next-step-text">{{ configInfoStore.appModel === 1 ? '开始生成' : '开始生成'}}</span></div>
- </div>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import headerBar from '@/components/header-bar/index.vue'
- import { ref, reactive, onMounted, onBeforeUnmount,watchEffect, computed} from 'vue'
- import icpList from '@/utils/ipc'
- import client from "@/stores/modules/client";
- import socket from "@/stores/modules/socket";
- import { ElMessage ,ElMessageBox } from 'element-plus'
- import { getFilePath,getRouterUrl } from '@/utils/appfun'
- import {useRouter} from "vue-router";
- import HardwareCheck from '@/components/check/index.vue'
- import checkInfo from "@/stores/modules/check";
- import RemoteControl from '@/views/RemoteControl/index'
- import generate from '@/utils/menus/generate'
- const loading = ref(false)
- const runLoading = ref(false)
- const takePictureLoading = ref(false)
- import useUserInfo from "@/stores/modules/user";
- const useUserInfoStore = useUserInfo();
- import configInfo from '@/stores/modules/config';
- const configInfoStore = configInfo();
- import qiehuan from '@/components/header-bar/assets/qiehuan.svg'
- const menu = computed(()=>{
- if(configInfoStore.appModel === 2){
- return [
- {
- type:'setting'
- },
- {
- name:'切换模式',
- click(){
- configInfoStore.updateAppModel(1)
- Router.push({
- name:'PhotographyCheck'
- })
- }
- },
- {
- ...generate
- },
- {
- type:'ota'
- }
- ]
- }
- if(useUserInfoStore.userInfo.brand_company_code === '1300'){
- return [
- {
- type:'setting'
- },
- {
- type:'developer'
- },
- {
- ...generate,
- },
- {
- type:'ota'
- }
- ]
- }
- return [
- {
- type:'setting'
- },
- {
- ...generate
- },
- {
- type:'ota'
- }
- ]
- })
- const clientStore = client();
- const Router = useRouter()
- /*const goodsList = ref([
- {
- "goods_art_no": "123456789",
- "items": [
- {
- "record_id":1,
- "image_deal_mode":0,
- "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0001.jpg",
- },
- {
- "record_id":2,
- "image_deal_mode":0,
- "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0002.jpg",
- },
- {
- "record_id":3,
- "image_deal_mode":0,
- "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0003.jpg",
- },
- {
- "record_id":4,
- "image_deal_mode":0,
- "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0004.jpg",
- },
- {
- "record_id":5,
- "image_deal_mode":0,
- "image_path": "C:\\Users\\Administrator\\Pictures\\digiCamControl\\Session1\\DSC_0005.jpg",
- }
- ]
- }
- ])*/
- const goodsList = ref([])
- const goods_art_no_tpl = ref('')
- const goods_art_no = ref('')
- const runAction = ref({
- "action": "",
- "goods_art_no": ""
- })
- // 初始化 WebSocket 状态管理
- const socketStore = socket()
- /**
- * 保存货号模板到货号变量中。
- */
- function saveGoodsArtNo(){
- if(goods_art_no_tpl.value){
- goods_art_no.value = goods_art_no_tpl.value
- ElMessage.success('商品货号'+goods_art_no.value+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
- }
- }
- /**
- * 获取拍照记录。
- * @param params - 可选参数,用于分页或其他筛选条件。
- */
- async function getPhotoRecords(params?:{}) {
- if(loading.value) return;
- loading.value = true;
- clientStore.ipc.send(icpList.takePhoto.getPhotoRecords,{
- ...params,
- page:1,
- size:100,
- });
- clientStore.ipc.on(icpList.takePhoto.getPhotoRecords, (event, result) => {
- loading.value = false;
- if(result.code === 0){
- clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
- console.log('getPhotoRecords print_time:'+new Date().toLocaleString()) // 打印当前时间
- console.log('getPhotoRecords print_time:'+JSON.stringify(result.data.list)) // 打印当前时间
- goodsList.value = result.data.list
- if(isDelGoodsGetList.value){
- isDelGoodsGetList.value = false;
- return;
- }
- getLastPhotoRecord()
- }else if(result.msg) {
- ElMessage.error(result.msg)
- }
- });
- }
- /**
- * 执行拍照操作。
- * @param data - 包含拍摄所需的数据对象。
- */
- async function runGoods(data) {
- if(runLoading.value || takePictureLoading.value){
- ElMessage.error('拍摄程序正在运行,请稍候')
- return
- }
- await socketStore.connectSocket();
- socketStore.sendMessage({
- type: 'run_mcu',
- data,
- })
- ElMessage.success('开始拍摄,请稍后')
- runLoading.value = true;
- runAction.value.action = data.action
- runAction.value.goods_art_no = data.goods_art_no
- goods_art_no.value = ''
- goods_art_no_tpl.value = ''
- reNosObj.value.goods_art_no = null;
- reNosObj.value.action = null;
- clientStore.ipc.on(icpList.socket.message + '_run_mcu', (event, result) => {
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
- console.log('_run_mcu');
- console.log(result);
- if(result.code !== 0 && result.msg){
- ElMessage.error(result.msg)
- runLoading.value = false
- return;
- }
- })
- }
- /**
- * 格式化时间字符串。
- * @param time - 原始时间字符串。
- * @returns 格式化后的时间字符串,若输入为空则返回 null。
- */
- 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})
- }
- /**
- * 删除指定的商品货号。
- * @param params - 包含需要删除的货号列表的对象。
- */
- const delGoods = async function(params){
- await ElMessageBox.confirm('确定要删除货号:'+params.goods_art_nos[0]+'的拍摄数据吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- })
- del(params)
- }
- /**
- * 删除指定的商品货号。
- * @param params - 包含需要删除的货号列表的对象。
- */
- const isDelGoodsGetList = ref(false)
- 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){
- isDelGoodsGetList.value =true
- ElMessage.info('货号删除成功')
- getPhotoRecords()
- if(reNosObj.value.goods_art_no){
- runGoods(reNosObj.value)
- }
- }else if(result.msg) {
- ElMessage.error(result.msg)
- }
- });
- }
- //单个重拍
- const reTakePicture = async (img)=>{
- if(!img.id) return;
- await ElMessageBox.confirm('此操作会先删除此数据,需要继续吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- })
- socketStore.sendMessage({
- type: 're_take_picture',
- "data":{"record_id":img.id},
- })
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
- clientStore.ipc.on(icpList.socket.message + '_re_take_picture', (event, result) => {
- console.log('_re_take_picture')
- console.log(result)
- if(result.code === 0){
- getPhotoRecords()
- setTimeout(()=>{
- showlastPhoto.value = false
- },6000)
- }else if(result.msg) {
- ElMessage.error(result.msg)
- }
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
- })
- }
- const reNosObj = ref({
- goods_art_no:null,
- action:null,
- })
- //货号重拍
- const reTakePictureNos = async (goods_art_no,item)=>{
- await ElMessageBox.confirm('此操作会先删除删除货号:'+goods_art_no+'的拍摄数据吗,需要继续吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- })
- reNosObj.value.goods_art_no = goods_art_no
- reNosObj.value.action = '执行左脚程序'
- if(item.items && typeof item.items === 'object' && item.items[0].image_deal_mode){
- reNosObj.value.action = '执行右脚程序'
- }
- del({goods_art_nos:[goods_art_no]})
- }
- /**
- * 检查是否可以进入下一步操作。
- */
- const next = async function(){
- if(runLoading.value){
- ElMessage.error('正在拍摄中,请稍候')
- return;
- }
- if(goodsList.length){
- ElMessage.error('请先拍摄商品。')
- return;
- }
- }
- const oneClickStop = ()=>{
- if(!(runLoading.value || takePictureLoading.value)){
- ElMessage.error('拍摄程序已结束,不需要单独停止!')
- return
- }else{
- socketStore.sendMessage({
- type: 'stop_action',
- })
- }
- }
- /**
- * 页面挂载时初始化事件监听器并获取初始数据。
- */
- 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) {
- console.log(goods_art_no.value);
- if(!goods_art_no.value){
- ElMessage.error('请先扫描货号或者手动输入货号!')
- return;
- }
- runGoods({
- ...result.data?.data,
- goods_art_no: goods_art_no.value
- })
- }
- });
- /* window.addEventListener('storage', handleStorageEvent);*/
- await getPhotoRecords();
- // 监听图片处理完成事件
- clientStore.ipc.on(icpList.socket.message + '_image_process', (event, result) => {
- console.log('_image_process')
- console.log(result)
- getPhotoRecords()
- // 延迟两秒再获取一遍数据
- setTimeout(()=>{
- getPhotoRecords()
- },3000)
- })
- // 监听拍照完成事件
- 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()
- // 延迟两秒再获取一遍数据
- setTimeout(()=>{
- getPhotoRecords()
- },3000)
- takePictureLoading.value = false;
- return;
- }
- if(result.code !== 0 && result.msg){
- ElMessage.error(result.msg)
- takePictureLoading.value = false;
- }
- })
- // 监听一键停止
- clientStore.ipc.on(icpList.socket.message + '_stop_action', (event, result) => {
- console.log('_stop_action')
- console.log(result)
- oneClickStop()
- })
- // 监听拍照完成后的最终状态事件
- clientStore.ipc.on(icpList.socket.message + '_photo_take_finish', (event, result) => {
- console.log('_photo_take_finish')
- console.log(result)
- if(result.code === 0) {
- runLoading.value = false;
- runAction.value.goods_art_no = '';
- runAction.value.action = '';
- setTimeout(()=>{
- showlastPhoto.value = false
- },5000)
- }
- })
- // 监听手动触发拍照事件
- clientStore.ipc.on(icpList.socket.message + '_handler_take_picture', async (event, result) => {
- console.log('_handler_take_picture')
- console.log(result)
- if(result.code === 0){
- if(runLoading.value || takePictureLoading.value){
- ElMessage.error('拍摄程序正在运行,请稍候')
- return
- }
- ElMessage.success('正在拍摄中,请稍候')
- takePictureLoading.value = true;
- /* setTimeout(()=>{
- takePictureLoading.value = false;
- },3000)*/
- await socketStore.connectSocket();
- socketStore.sendMessage(result.data)
- getPhotoRecords()
- // 延迟两秒再获取一遍数据
- setTimeout(()=>{
- getPhotoRecords()
- },3000)
- }
- })
- })
- const onRemoteControl = (type)=>{
- if(type == 'take_picture'){
- if(runLoading.value || takePictureLoading.value){
- ElMessage.error('拍摄程序正在运行,请稍候')
- return
- }
- ElMessage.success('正在拍摄中,请稍候')
- socketStore.sendMessage({
- type: 'handler_take_picture',
- })
- return;
- }
- if(!goods_art_no.value){
- ElMessage.error('请先扫描货号或者手动输入货号!')
- return;
- }
- let action = '执行左脚程序'
- if(type === 'right') action = '执行右脚程序'
- runGoods({
- "action": action,
- "goods_art_no": goods_art_no.value,
- })
- }
- /*const handleStorageEvent = (e) => {
- if(e.key === 'run_mcu' && e.newValue){
- if(!goods_art_no.value){
- ElMessage.error('请先扫描货号或者手动输入货号!')
- localStorage.setItem('run_mcu','')
- return;
- }
- let action = '执行左脚程序'
- if(e.newValue === 'right') action = '执行右脚程序'
- runGoods({
- "action": action,
- "goods_art_no": goods_art_no.value,
- })
- localStorage.setItem('run_mcu','')
- }
- };*/
- const checkInfoStore = checkInfo()
- checkInfoStore.set_blue_tooth_scan_NO('')
- watchEffect(async ()=>{
- if(checkInfoStore.blue_tooth_scan_NO){
- ElMessage.success('商品货号'+checkInfoStore.blue_tooth_scan_NO+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
- goods_art_no.value = checkInfoStore.blue_tooth_scan_NO
- checkInfoStore.set_blue_tooth_scan_NO('')
- }
- })
- /**
- * 页面卸载时移除所有事件监听器。
- */
- onBeforeUnmount(() => {
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_blue_tooth_scan');
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_image_process');
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take');
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take_finish');
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu_update');
- clientStore.ipc.removeAllListeners(icpList.socket.message + '_stop_action');
- /* window.removeEventListener('storage', handleStorageEvent);*/
- })
- /*
- * 打开最近一张拍摄图
- * */
- const lastPhoto = ref({})
- const showlastPhoto = ref(false)
- const getLastPhotoRecord = async ()=>{
- return;
- if(goodsList.value && goodsList.value.length === 0) return;
- clientStore.ipc.removeAllListeners(icpList.takePhoto.getLastPhotoRecord);
- clientStore.ipc.send(icpList.takePhoto.getLastPhotoRecord,);
- clientStore.ipc.on(icpList.takePhoto.getLastPhotoRecord, (event, result) => {
- console.log('getLastPhotoRecord')
- console.log(result)
- console.log(runAction.value)
- clientStore.ipc.removeAllListeners(icpList.takePhoto.getLastPhotoRecord);
- if(result.code === 0){
- if(lastPhoto.value?.image_path){
- if( lastPhoto.value?.image_path == result.data?.image_path) return;
- if(runAction.value.goods_art_no === result.data?.goods_art_no){
- showlastPhoto.value = true
- }
- }
- lastPhoto.value = result.data
- }else if(result.msg) {
- ElMessage.error(result.msg)
- }
- });
- }
- // 监听拍照完成后的最终状态事件
- clientStore.ipc.on(icpList.socket.message + '_run_mcu_update', (event, result) => {
- console.log('run_mcu_updat print_time:'+new Date().toLocaleString()) // 打印当前时间
- console.log('run_mcu_update print_time:'+JSON.stringify(result))
- if(result.code === 0){
- if(result.data?.file_path){
- if( lastPhoto.value?.file_path == result.data?.file_path) return;
- if(runAction.value.goods_art_no === result.data?.goods_art_no){
- showlastPhoto.value = true
- goodsList.value.map(item=>{
- if(item.goods_art_no === result.data?.goods_art_no){
- console.log('========item');
- console.log(item);
- item.items[result.data.image_index].PhotoRecord.image_path = result.data?.file_path
- result.data.action_name = item.items[result.data.image_index].action_name
- setTimeout(()=>{
- item.items[result.data.image_index].PhotoRecord.image_path = result.data?.file_path
- },1000)
- console.log(item);
- console.log( goodsList.value);
- }
- })
- // getPhotoRecords()
- setTimeout(()=>{
- getPhotoRecords()
- },2000)
- }
- lastPhoto.value = result.data
- }
- }else if(result.msg) {
- ElMessage.error(result.msg)
- }
- })
- /**
- * 打开主图详情页面。
- */
- function openPhotographyDetail() {
- if(runLoading.value || takePictureLoading.value){
- ElMessage.error('正在拍摄中,请稍候')
- return;
- }
- const { href } = Router.resolve({
- name: 'PhotographyDetail',
- query:{
- goods_art_nos:goodsList.value.map(item=>item.goods_art_no),
- }
- })
- clientStore.ipc.removeAllListeners(icpList.utils.openMain);
- let params = {
- title: '主图与详情生成',
- width: 1000,
- height: 630,
- frame: true,
- id: "PhotographyDetail",
- url: getRouterUrl(href)
- }
- clientStore.ipc.send(icpList.utils.openMain, params);
- }
- /*高级生成*/
- const onGenerateCLick = (menu,item)=>{
- if(menu.name === '历史记录'){
- menu.click()
- return
- }
- const firstWithImagePath = item.items.find(
- (image) => image.PhotoRecord.image_path
- );
- if (firstWithImagePath) {
- menu.click({
- query:{
- image_path:firstWithImagePath.PhotoRecord.image_path
- }
- })
- } else {
- menu.click()
- }
- }
- </script>
- <style lang="scss">
- .shot-image-popper {
- width: calc(100vw - 370px) !important;
- left: 20px !important;
- top: 50px !important;
- height: calc(100vh - 70px) !important;
- transform: translate(0px, 0px) !important;
- .el-image {
- width: 100%;
- height:100%;
- display: block;
- .el-image__inner {
- width: 100%;
- height:100%;
- display: block;
- }
- }
- }
- </style>
- <style scoped lang="scss">
- .photography-page {
- background-color: rgba(255, 255, 255, 1);
- position: relative;
- .main-container {
- position: relative;
- display: flex;
- .content-wrapper {
- flex-grow: 1 ;
- position: relative;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- margin: auto;
- justify-content: center;
- .step-number {
- background-color: rgba(22, 119, 255, 1);
- border-radius: 50%;
- height: 32px;
- margin-top: 51px;
- width: 32px;
- .text_22 {
- width: 6px;
- height: 22px;
- overflow-wrap: break-word;
- color: rgba(255, 255, 255, 1);
- font-size: 14px;
- font-weight: NaN;
- text-align: right;
- white-space: nowrap;
- line-height: 22px;
- margin: 5px 0 0 13px;
- }
- }
- .step-one {
- width: 426px;
- height: 521px;
- margin: 55px 0 0 5px;
- .step-header {
- width: 391px;
- height: 24px;
- margin-left: 3px;
- .step-title {
- width: 160px;
- height: 24px;
- overflow-wrap: break-word;
- color: rgba(0, 0, 0, 0.85);
- font-size: 16px;
- font-family: PingFangSC-Medium;
- font-weight: 500;
- text-align: left;
- white-space: nowrap;
- line-height: 24px;
- }
- .step-icon {
- width: 32px;
- height: 20px;
- margin-top: 4px;
- }
- .step-divider {
- width: 191px;
- height: 1px;
- margin: 13px 0 0 8px;
- }
- }
- .step-content {
- width: 426px;
- height: 469px;
- margin-top: 28px;
- .method-container {
- background-color: rgba(247, 247, 247, 1);
- height: 484px;
- width: 353px;
- .auto-method {
- width: 253px;
- height: 24px;
- margin: 28px 0 0 14px;
- .text-method-tag {
- background-color: rgba(0, 174, 30, 1);
- height: 24px;
- width: 65px;
- .text_4 {
- width: 56px;
- height: 20px;
- overflow-wrap: break-word;
- color: rgba(255, 255, 255, 1);
- font-size: 14px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: left;
- white-space: nowrap;
- line-height: 20px;
- margin: 2px 0 0 4px;
- }
- }
- .method-description {
- width: 182px;
- height: 20px;
- overflow-wrap: break-word;
- color: rgba(71, 71, 71, 1);
- font-size: 14px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: left;
- white-space: nowrap;
- line-height: 20px;
- margin-top: 2px;
- }
- }
- .scan-method {
- width: 350px;
- height: 350px;
- margin: 10px;
- .remote-control {
- width: 350px;
- height: 350px;
- background: url(@/assets/images/Photography/left.png) 0px 0px no-repeat;
- background-size: 300px 300px;
- position: relative;
- .scan-button {
- background-color: rgba(0, 174, 30, 1);
- border-radius: 50%;
- width: 27px;
- height: 27px;
- margin: 27px 0 0 34px;
- }
- .scan-line {
- position: absolute;
- left: 52px;
- top: 40px;
- width: 112px;
- height: 1px;
- }
- }
- .scan-label {
- width: 96px;
- height: 22px;
- overflow-wrap: break-word;
- color: rgba(0, 174, 30, 1);
- font-size: 16px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: left;
- white-space: nowrap;
- line-height: 22px;
- margin-top: 30px;
- }
- }
- .manual-method {
- width: 155px;
- height: 24px;
- margin: 53px 0 0 14px;
- .method-tag {
- background-color: rgba(0, 148, 174, 1);
- height: 24px;
- width: 65px;
- .text_7 {
- width: 56px;
- height: 20px;
- overflow-wrap: break-word;
- color: rgba(255, 255, 255, 1);
- font-size: 14px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: left;
- white-space: nowrap;
- line-height: 20px;
- margin: 2px 0 0 4px;
- }
- }
- .method-description {
- width: 84px;
- height: 20px;
- overflow-wrap: break-word;
- color: rgba(71, 71, 71, 1);
- font-size: 14px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: left;
- white-space: nowrap;
- line-height: 20px;
- margin-top: 2px;
- }
- }
- .input-container {
- width: calc(100% - 20px );
- height: 36px;
- margin: 20px 10px 0;
- .input-item {
- :deep(.el-input__inner){
- height: 36px;
- line-height: 36px;
- }
- }
- }
- }
- .remote-image {
- width: 61px;
- height: 38px;
- margin-top: 216px;
- }
- }
- }
- .step-two {
- width: 384px;
- height: 521px;
- margin: 55px 0 0 7px;
- .step-title {
- width: 384px;
- height: 24px;
- overflow-wrap: break-word;
- color: rgba(0, 0, 0, 0.85);
- font-size: 16px;
- font-family: PingFangSC-Medium;
- font-weight: 500;
- text-align: left;
- white-space: nowrap;
- line-height: 24px;
- }
- .shooting-container {
- background-color: rgba(247, 247, 247, 1);
- width: 353px;
- height: 484px;
- margin: 28px 0 0 2px;
- .remote-control-wrap {
- width: 353px;
- height: 300px;
- }
- .shooting-tips {
- width: 325px;
- height: 40px;
- margin: 12px 0 0 15px;
- .info-icon {
- width: 16px;
- height: 16px;
- margin-top: 2px;
- }
- .tips-text {
- width: 302px;
- height: 40px;
- overflow-wrap: break-word;
- color: rgba(255, 76, 0, 1);
- font-size: 14px;
- font-weight: NaN;
- text-align: left;
- line-height: 20px;
- }
- }
- .left-foot-text {
- width: 240px;
- height: 22px;
- overflow-wrap: break-word;
- color: rgba(0, 174, 30, 1);
- font-size: 16px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: left;
- white-space: nowrap;
- line-height: 22px;
- margin: 36px 0 0 9px;
- }
- .remote-control-container {
- position: relative;
- width: 280px;
- height: 298px;
- margin: 9px 0 0 35px;
- .remote-buttons {
- width: 206px;
- height: 233px;
- background: url(@/assets/images/Photography/right-button.png) 100% no-repeat;
- background-size: 100% 100%;
- margin: 30px 0 0 37px;
- .left-button {
- background-color: rgba(0, 174, 30, 1);
- border-radius: 50%;
- width: 55px;
- height: 55px;
- margin: 91px 0 0 1px;
- }
- .right-button {
- background-color: rgba(0, 148, 174, 1);
- border-radius: 50%;
- width: 55px;
- height: 55px;
- margin: 91px 2px 0 93px;
- }
- }
- .left-button-image {
- width: 40px;
- height: 148px;
- margin: 150px 0 0 -3px;
- }
- .right-button-image {
- position: absolute;
- left: 0;
- top: 0;
- width: 40px;
- height: 148px;
- }
- }
- .right-foot-text {
- width: 240px;
- height: 22px;
- overflow-wrap: break-word;
- color: rgba(0, 148, 174, 1);
- font-size: 16px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: left;
- white-space: nowrap;
- line-height: 22px;
- margin: 12px 0 18px 98px;
- }
- }
- }
- }
- .camera-image {
- position: absolute;
- left: 620px;
- top: 220px;
- width: 111px;
- height: 111px;
- }
- .step-number-two {
- background-color: rgba(22, 119, 255, 1);
- border-radius: 50%;
- height: 32px;
- width: 32px;
- position: absolute;
- left: 450px;
- top: 51px;
- .step-text {
- width: 9px;
- height: 22px;
- overflow-wrap: break-word;
- color: rgba(255, 255, 255, 1);
- font-size: 14px;
- font-weight: NaN;
- text-align: right;
- white-space: nowrap;
- line-height: 22px;
- margin: 5px 0 0 12px;
- }
- }
- }
- }
- .history-section {
- background-color: rgba(234, 236, 237, 1);
- width: 332px;
- height: calc(100vh - 30px);
- &.koutu-section {
- width: 100%;
- .reset-button {
- display: none !important;
- }
- }
- .history-title {
- width: calc(100% - 20px);
- height: 22px;
- overflow-wrap: break-word;
- color: rgba(51, 51, 51, 1);
- font-size: 16px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- text-align: center;
- white-space: nowrap;
- line-height: 22px;
- margin: 9px 0 0 10px;
- }
- .divider-line {
- width: 100%;
- height: 1px;
- margin-top: 9px;
- }
- .history-warp {
- flex-grow: 1;
- overflow: auto;
- height: calc(100% - 125px);
- .history-item {
- .history-item_image_wrap {
- padding-bottom: 20px;
- border-bottom: 1px solid #CCCCCC;
- }
- .history-item_image {
- .tag {
- color: #bbb;
- position: absolute;
- left: 0;
- right: 0;
- top:50%;
- margin-top: -15px;
- line-height: 20px;
- }
- /* &:nth-child(1)::before{
- content:"俯视图";
- }
- &:nth-child(2)::before{
- content:"侧视图";
- }
- &:nth-child(3)::before{
- content:"后视图";
- }
- &:nth-child(4)::before{
- content:"鞋底";
- }
- &:nth-child(5)::before{
- content:"内里";
- }*/
- position: relative;
- width: 70px;
- height: 70px;
- float: left;
- margin: 6px 0 0 6px;
- background: #F7F7F7;
- .el-image {
- display: block;
- width:100%;
- height: 100%;
- }
- &:first-child {
- width: 146px;
- height: 146px;
- }
- &.el-loading-parent--relative{
- ::v-deep {
- .el-loading-mask { display: none}
- }
- }
- }
- .el-image_view {
- display: flex;
- width: 100%;
- height: 100%;
- .reset-button {
- width: 40px;
- text-align: center;
- height: 20px;
- position: absolute;
- left:50%;
- top:50%;
- padding: 0px;
- margin-left:-20px;
- margin-top:-10px;
- color: #ffffff;
- font-size: 14px;
- background: rgba(0,0,0,0.6);
- border-radius: 12px;
- display: none;
- cursor: pointer;
- }
- &:hover {
- .reset-button {
- display: block;
- }
- }
- }
- p:first-of-type {
- ::v-deep {
- .el-loading-mask { display: block !important;}
- }
- }
- }
- }
- .empty-state {
- width: 56px;
- height: 48px;
- .empty-icon {
- width: 32px;
- height: 18px;
- margin-left: 12px;
- }
- .empty-text {
- width: 56px;
- height: 20px;
- overflow-wrap: break-word;
- color: rgba(153, 153, 153, 1);
- font-size: 14px;
- font-weight: NaN;
- text-align: left;
- white-space: nowrap;
- line-height: 20px;
- margin-top: 10px;
- }
- }
- .next-step {
- height: 50px;
- background-size: 100% 100%;
- width: 100%;
- line-height: 50px;
- .next-step-text {
- width: 100%;
- overflow-wrap: break-word;
- color: rgba(255, 255, 255, 1);
- font-weight: NaN;
- text-align: center;
- white-space: nowrap;
- }
- }
- }
- .last-photo{
- position: fixed;
- left: 20px;
- top: 50px;
- bottom: 20px;
- right: 350px;
- z-index: 10;
- }
- </style>
|