| | |
| | | VITE_APP_PORT = 4096 |
| | | |
| | | # API åºç¡è·¯å¾ï¼å¼åç¯å¢ä¸ç请æ±åç¼ |
| | | VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes' |
| | | # VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes' |
| | | # VITE_APP_BASE_API = 'http://192.168.0.206:7002/mes' # é¹è£ |
| | | VITE_APP_BASE_API = 'http://192.168.0.244:8893/mes' # |
| | | |
| | | # API æå¡å¨ç URL |
| | | VITE_APP_API_URL = 'http://114.132.189.42:7002/mes' |
| | | # VITE_APP_API_URL = 'http://114.132.189.42:7002/mes' |
| | | VITE_APP_API_URL = 'http://192.168.0.244:8893/mes' # |
| | |
| | | |
| | | |
| | | # API åºç¡è·¯å¾ï¼å¼åç¯å¢ä¸ç请æ±åç¼ |
| | | VITE_APP_BASE_API = '/prod-api' |
| | | # VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes' |
| | | # API æå¡å¨ç URL |
| | | # VITE_APP_API_URL = 'http://114.132.189.42:7002/mes' |
| | | # å±±ä¸ |
| | | VITE_APP_API_URL = 'http://192.168.100.131:7002/mes' |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | import { BaseResult } from "@/models/base"; |
| | | |
| | | const HomeApi = { |
| | | getIndex() { |
| | | return request<BaseResult<any>>({ |
| | | url: "/app/getIndex", |
| | | method: "GET", |
| | | }); |
| | | }, |
| | | }; |
| | | |
| | | export default HomeApi; |
| | |
| | | data: data, |
| | | }); |
| | | }, |
| | | |
| | | saveAge(data: any) { |
| | | return request<BaseResult<any>>({ |
| | | url: "/app/ageing", |
| | | method: "POST", |
| | | data: data, |
| | | }); |
| | | }, |
| | | }; |
| | | |
| | | export default TwistApi; |
| | |
| | | </view> |
| | | <text class="text-[#646874] mx-2"> |
| | | æ»éæ±æ°é: |
| | | <text class="text-[#252525]">{{ data[map.totalAmount] }}m</text> |
| | | <text class="text-[#252525]">{{ data[map.totalAmount] }}{{ data[map.unit] }}</text> |
| | | </text> |
| | | </view> |
| | | </wd-col> |
| | |
| | | </view> |
| | | <text class="text-[#646874] mx-2"> |
| | | å·²ç产æ°é: |
| | | <text class="text-[#252525]">{{ data[map.amount] }}m</text> |
| | | <text class="text-[#252525]">{{ data[map.amount] }}{{ data[map.unit] }}</text> |
| | | </text> |
| | | </view> |
| | | </wd-col> |
| | |
| | | </view> |
| | | <text class="text-[#646874] mx-2"> |
| | | å¾
æäº§æ°é: |
| | | <text class="text-[#252525]">{{ data[map.unAmount] }}m</text> |
| | | <text class="text-[#252525]">{{ data[map.unAmount] }}{{ data[map.unit] }}</text> |
| | | </text> |
| | | </view> |
| | | </wd-col> |
| | |
| | | <view class="content"></view> |
| | | </view> |
| | | </template> |
| | | <!-- æ¿å
æ«ç ï¼å¹¿ææ¨¡å¼ --> |
| | | <script> |
| | | var main, receiver, filter; |
| | | var codeQueryTag = false; |
| | | export default { |
| | | data() { |
| | | return { |
| | | scanCode: "", |
| | | }; |
| | | <script lang="ts" setup> |
| | | const main = ref(); |
| | | const receiver = ref(); |
| | | const filter = ref(); |
| | | const codeQueryTag = ref(false); |
| | | const props = defineProps({ |
| | | emitName: { |
| | | type: String, |
| | | default: "scan", |
| | | }, |
| | | created() { |
| | | // åå§å |
| | | this.initScan(); |
| | | // å¯å¨å¹¿æ |
| | | this.startScan(); |
| | | }, |
| | | onHide() { |
| | | // ç»æå¹¿æ |
| | | this.stopScan(); |
| | | }, |
| | | destroyed() { |
| | | // ç»æå¹¿æ |
| | | this.stopScan(); |
| | | }, |
| | | methods: { |
| | | // åå§å |
| | | initScan() { |
| | | // #ifdef APP |
| | | // console.log('initScan:æ«ç åå§å'); |
| | | let that = this; |
| | | main = plus.android.runtimeMainActivity(); //è·åactivity |
| | | //var context = plus.android.importClass('android.content.Context'); //ä¸ä¸æ |
| | | var IntentFilter = plus.android.importClass("android.content.IntentFilter"); |
| | | filter = new IntentFilter(); |
| | | //ä¸é¢çaddAction æ¹ä¸ºèªå·± pad 设å¤ç广æå¨ä½ï¼å¨æ«æè®¾ç½®æè
ååé带çapp éé¢è®¾ç½®ä¸ºå¹¿ææ¨¡å¼ï¼ç¶åæ¥çç¸åºåæ°ï¼ |
| | | filter.addAction("com.dwexample.ACTION"); |
| | | receiver = plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver", { |
| | | onReceive: (context, intent) => { |
| | | console.log("---onReceiveï¼", context, intent); |
| | | plus.android.importClass(intent); |
| | | //ä¸é¢çgetStringExtraå
æ¹ä¸ºèªå·±çå¹¿ææ ç¾ï¼é®å¼/keyï¼ï¼ data |
| | | //æé©¬ TC20 |
| | | var banMaSacanInfo = intent.getStringExtra( |
| | | "com.motorolasolutions.emdk.datawedge.data_string" |
| | | ); |
| | | // callback(intent.getStringExtra('com.motorolasolutions.emdk.datawedge.data_string')); |
| | | console.log("æé©¬æ«æç»æ", banMaSacanInfo); |
| | | // ä¼ å
¥æ¥æ¶å°çåæ° |
| | | that.queryCode(banMaSacanInfo); |
| | | }, |
| | | }); |
| | | // #endif |
| | | }); |
| | | |
| | | const initScan = () => { |
| | | main.value = plus.android.runtimeMainActivity(); //è·åactivity |
| | | let IntentFilter: any = plus.android.importClass("android.content.IntentFilter"); |
| | | filter.value = new IntentFilter(); |
| | | //ä¸é¢çaddAction æ¹ä¸ºèªå·± pad 设å¤ç广æå¨ä½ï¼å¨æ«æè®¾ç½®æè
ååé带çapp éé¢è®¾ç½®ä¸ºå¹¿ææ¨¡å¼ï¼ç¶åæ¥çç¸åºåæ°ï¼ |
| | | filter.value.addAction("com.dwexample.ACTION"); |
| | | receiver.value = plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver", { |
| | | onReceive: (context: any, intent: any) => { |
| | | console.log("---onReceiveï¼", context, intent); |
| | | plus.android.importClass(intent); |
| | | //ä¸é¢çgetStringExtraå
æ¹ä¸ºèªå·±çå¹¿ææ ç¾ï¼é®å¼/keyï¼ï¼ data |
| | | //æé©¬ TC20 |
| | | var banMaSacanInfo = intent.getStringExtra( |
| | | "com.motorolasolutions.emdk.datawedge.data_string" |
| | | ); |
| | | // callback(intent.getStringExtra('com.motorolasolutions.emdk.datawedge.data_string')); |
| | | console.log("æé©¬æ«æç»æ", banMaSacanInfo); |
| | | // ä¼ å
¥æ¥æ¶å°çåæ° |
| | | queryCode(banMaSacanInfo); |
| | | }, |
| | | // å¼å¯å¹¿æ |
| | | startScan() { |
| | | // #ifdef APP |
| | | console.log("startScan,å¼å¯å¹¿ææ¥æ¶"); |
| | | main.registerReceiver(receiver, filter); |
| | | // #endif |
| | | }, |
| | | // å
³é广æ |
| | | stopScan() { |
| | | // #ifdef APP |
| | | console.log("stopScanç»æ"); |
| | | main.unregisterReceiver(receiver); |
| | | // #endif |
| | | }, |
| | | // é¿å
é夿«ç |
| | | queryCode: function (code) { |
| | | // #ifdef APP |
| | | if (codeQueryTag) return false; |
| | | codeQueryTag = true; |
| | | setTimeout(function () { |
| | | codeQueryTag = false; |
| | | }, 150); |
| | | // console.log('-****--æ«ç codeï¼ ', code); |
| | | let data = code; |
| | | uni.$emit("scan", { |
| | | code: data, |
| | | }); |
| | | // #endif |
| | | }, |
| | | triggerScan() { |
| | | console.log("è§¦åæ«æ"); |
| | | // è·åAndroidæå¾ç±» |
| | | let Intent = plus.android.importClass("android.content.Intent"); |
| | | // å®ä¾åæå¾ |
| | | let intent = new Intent(); |
| | | // å®ä¹æå¾ï¼ç±ååæä¾(æ¤å¤è®¾ç½®ä¸ºä¸å¤§çï¼ å¼å§æ«æå¹¿æcom.scan.onStartScanï¼å¯¹åºçåæ¢æ«æå¹¿æä¸ºcom.scan.onEndScan) |
| | | intent.setAction("com.symbol.datawedge.api.ACTION"); |
| | | intent.putExtra("com.symbol.datawedge.api.SOFT_SCAN_TRIGGER", "START_SCANNING"); |
| | | // 广æè¿ä¸ªæå¾ |
| | | main.sendBroadcast(intent); |
| | | }, |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | // å¼å¯å¹¿æ |
| | | const startScan = () => { |
| | | // #ifdef APP |
| | | console.log("startScan,å¼å¯å¹¿ææ¥æ¶"); |
| | | main.value.registerReceiver(receiver.value, filter.value); |
| | | // #endif |
| | | }; |
| | | // å
³é广æ |
| | | const stopScan = () => { |
| | | // #ifdef APP |
| | | console.log("stopScanç»æ"); |
| | | main.value.unregisterReceiver(receiver.value); |
| | | // #endif |
| | | }; |
| | | |
| | | const queryCode = (code: any) => { |
| | | // #ifdef APP |
| | | if (codeQueryTag.value) return false; |
| | | codeQueryTag.value = true; |
| | | setTimeout(function () { |
| | | codeQueryTag.value = false; |
| | | }, 150); |
| | | // console.log('-****--æ«ç codeï¼ ', code); |
| | | let data = code; |
| | | uni.$emit(props.emitName, { |
| | | code: data, |
| | | }); |
| | | // #endif |
| | | }; |
| | | |
| | | const triggerScan = () => { |
| | | console.log("è§¦åæ«æ"); |
| | | // è·åAndroidæå¾ç±» |
| | | let Intent = plus.android.importClass("android.content.Intent"); |
| | | // å®ä¾åæå¾ |
| | | let intent = new Intent(); |
| | | // å®ä¹æå¾ï¼ç±ååæä¾(æ¤å¤è®¾ç½®ä¸ºä¸å¤§çï¼ å¼å§æ«æå¹¿æcom.scan.onStartScanï¼å¯¹åºçåæ¢æ«æå¹¿æä¸ºcom.scan.onEndScan) |
| | | intent.setAction("com.symbol.datawedge.api.ACTION"); |
| | | intent.putExtra("com.symbol.datawedge.api.SOFT_SCAN_TRIGGER", "START_SCANNING"); |
| | | // 广æè¿ä¸ªæå¾ |
| | | main.value.sendBroadcast(intent); |
| | | }; |
| | | |
| | | onLoad(() => { |
| | | console.log("åå§å"); |
| | | // åå§å |
| | | initScan(); |
| | | // å¯å¨å¹¿æ |
| | | startScan(); |
| | | }); |
| | | |
| | | onHide(() => { |
| | | stopScan(); |
| | | }); |
| | | |
| | | onUnmounted(() => { |
| | | stopScan(); |
| | | }); |
| | | |
| | | defineExpose({ |
| | | triggerScan, |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <view class="content"></view> |
| | | </view> |
| | | </template> |
| | | <!-- æ¿å
æ«ç ï¼å¹¿ææ¨¡å¼ --> |
| | | <script> |
| | | var main, receiver, filter; |
| | | var codeQueryTag = false; |
| | | export default { |
| | | data() { |
| | | return { |
| | | scanCode: "", |
| | | }; |
| | | }, |
| | | |
| | | onLoad() { |
| | | console.log("åå§å"); |
| | | // åå§å |
| | | this.initScan(); |
| | | // å¯å¨å¹¿æ |
| | | this.startScan(); |
| | | }, |
| | | onHide() { |
| | | // ç»æå¹¿æ |
| | | this.stopScan(); |
| | | }, |
| | | destroyed() { |
| | | // ç»æå¹¿æ |
| | | this.stopScan(); |
| | | }, |
| | | methods: { |
| | | // åå§å |
| | | initScan() { |
| | | // #ifdef APP |
| | | // console.log('initScan:æ«ç åå§å'); |
| | | let that = this; |
| | | main = plus.android.runtimeMainActivity(); //è·åactivity |
| | | //var context = plus.android.importClass('android.content.Context'); //ä¸ä¸æ |
| | | var IntentFilter = plus.android.importClass("android.content.IntentFilter"); |
| | | filter = new IntentFilter(); |
| | | //ä¸é¢çaddAction æ¹ä¸ºèªå·± pad 设å¤ç广æå¨ä½ï¼å¨æ«æè®¾ç½®æè
ååé带çapp éé¢è®¾ç½®ä¸ºå¹¿ææ¨¡å¼ï¼ç¶åæ¥çç¸åºåæ°ï¼ |
| | | filter.addAction("com.dwexample.ACTION"); |
| | | receiver = plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver", { |
| | | onReceive: (context, intent) => { |
| | | console.log("---onReceiveï¼", context, intent); |
| | | plus.android.importClass(intent); |
| | | //ä¸é¢çgetStringExtraå
æ¹ä¸ºèªå·±çå¹¿ææ ç¾ï¼é®å¼/keyï¼ï¼ data |
| | | //æé©¬ TC20 |
| | | var banMaSacanInfo = intent.getStringExtra( |
| | | "com.motorolasolutions.emdk.datawedge.data_string" |
| | | ); |
| | | // callback(intent.getStringExtra('com.motorolasolutions.emdk.datawedge.data_string')); |
| | | console.log("æé©¬æ«æç»æ", banMaSacanInfo); |
| | | // ä¼ å
¥æ¥æ¶å°çåæ° |
| | | that.queryCode(banMaSacanInfo); |
| | | }, |
| | | }); |
| | | // #endif |
| | | }, |
| | | // å¼å¯å¹¿æ |
| | | startScan() { |
| | | // #ifdef APP |
| | | console.log("startScan,å¼å¯å¹¿ææ¥æ¶"); |
| | | main.registerReceiver(receiver, filter); |
| | | // #endif |
| | | }, |
| | | // å
³é广æ |
| | | stopScan() { |
| | | // #ifdef APP |
| | | console.log("stopScanç»æ"); |
| | | main.unregisterReceiver(receiver); |
| | | // #endif |
| | | }, |
| | | // é¿å
é夿«ç |
| | | queryCode: function (code) { |
| | | // #ifdef APP |
| | | if (codeQueryTag) return false; |
| | | codeQueryTag = true; |
| | | setTimeout(function () { |
| | | codeQueryTag = false; |
| | | }, 150); |
| | | // console.log('-****--æ«ç codeï¼ ', code); |
| | | let data = code; |
| | | uni.$emit(this.emitName, { |
| | | code: data, |
| | | }); |
| | | // #endif |
| | | }, |
| | | triggerScan() { |
| | | console.log("è§¦åæ«æ"); |
| | | // è·åAndroidæå¾ç±» |
| | | let Intent = plus.android.importClass("android.content.Intent"); |
| | | // å®ä¾åæå¾ |
| | | let intent = new Intent(); |
| | | // å®ä¹æå¾ï¼ç±ååæä¾(æ¤å¤è®¾ç½®ä¸ºä¸å¤§çï¼ å¼å§æ«æå¹¿æcom.scan.onStartScanï¼å¯¹åºçåæ¢æ«æå¹¿æä¸ºcom.scan.onEndScan) |
| | | intent.setAction("com.symbol.datawedge.api.ACTION"); |
| | | intent.putExtra("com.symbol.datawedge.api.SOFT_SCAN_TRIGGER", "START_SCANNING"); |
| | | // 广æè¿ä¸ªæå¾ |
| | | main.sendBroadcast(intent); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | "style": { |
| | | "navigationBarTitleText": "ç»çº¿æå·¥ç¼è¾" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/timely/index", |
| | | "style": { |
| | | "navigationBarTitleText": "æ¶ææ¥å·¥" |
| | | } |
| | | } |
| | | ], |
| | | "globalStyle": { |
| | |
| | | <view class="text-[#0D867F] font-medium py-2 text-lg"> |
| | | <text>亨æºç¹å¯¼çº¿ç¼ä¸æ¥ç³»ç»</text> |
| | | </view> |
| | | <view> |
| | | <ReportWorkTime /> |
| | | </view> |
| | | </view> |
| | | <WorkerCallingCard /> |
| | | |
| | |
| | | </template> |
| | | </wd-notice-bar> |
| | | <!-- å¿«æ·å¯¼èª --> |
| | | <wd-grid clickable :column="4" class="mt-2"> |
| | | <wd-grid-item |
| | | v-for="(item, index) in navList" |
| | | :key="index" |
| | | use-slot |
| | | link-type="navigateTo" |
| | | :url="item.url" |
| | | > |
| | | <view class="p-2"> |
| | | <image class="w-72rpx h-72rpx rounded-8rpx" :src="item.icon" /> |
| | | </view> |
| | | <view class="text">{{ item.title }}</view> |
| | | </wd-grid-item> |
| | | <wd-grid clickable :column="1" class="mt-2"> |
| | | <view v-for="(item, index) in navList"> |
| | | <wd-grid-item v-if="item.show" :key="index" use-slot link-type="navigateTo" :url="item.url"> |
| | | <view class="p-2"> |
| | | <image class="w-72rpx h-72rpx rounded-8rpx" :src="item.icon" /> |
| | | </view> |
| | | <view class="text">{{ item.title }}</view> |
| | | </wd-grid-item> |
| | | </view> |
| | | </wd-grid> |
| | | |
| | | <!-- æ°æ®ç»è®¡ --> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { reactive } from "vue"; |
| | | import { dayjs } from "wot-design-uni"; |
| | | import LogAPI, { VisitStatsVO } from "@/api/system/log"; |
| | | import WorkerCallingCard from "@/components/worker-calling-card/index.vue"; |
| | | import ReportWorkTime from "./components/ReportWorkTime.vue"; |
| | | import HomeApi from "@/api/home"; |
| | | |
| | | const visitStatsData = ref<VisitStatsVO>({ |
| | | todayUvCount: 0, |
| | |
| | | icon: "/static/icons/user.png", |
| | | title: "ç产管ç", |
| | | url: "/pages/production/index", |
| | | show: false, |
| | | }, |
| | | // { |
| | | // icon: "/static/icons/role.png", |
| | | // title: "è§è²ç®¡ç", |
| | | // url: "/pages/work/role/index", |
| | | // prem: "sys:role:query", |
| | | // }, |
| | | // { |
| | | // icon: "/static/icons/notice.png", |
| | | // title: "éç¥å
Œ", |
| | | // url: "/pages/work/notice/index", |
| | | // prem: "sys:notice:query", |
| | | // }, |
| | | // { |
| | | // icon: "/static/icons/setting.png", |
| | | // title: "ç³»ç»é
ç½®", |
| | | // url: "/pages/work/config/index", |
| | | // prem: "sys:config:query", |
| | | // }, |
| | | { |
| | | icon: "/static/icons/role.png", |
| | | title: "è§è²ç®¡ç", |
| | | url: "/pages/work/role/index", |
| | | prem: "sys:role:query", |
| | | }, |
| | | { |
| | | icon: "/static/icons/notice.png", |
| | | title: "éç¥å
Œ", |
| | | url: "/pages/work/notice/index", |
| | | prem: "sys:notice:query", |
| | | }, |
| | | { |
| | | icon: "/static/icons/setting.png", |
| | | title: "ç³»ç»é
ç½®", |
| | | url: "/pages/work/config/index", |
| | | prem: "sys:config:query", |
| | | icon: "/static/icons/log.png", |
| | | title: "æ¶ææ¥å·¥", |
| | | url: "/pages/timely/index", |
| | | show: false, |
| | | }, |
| | | ]); |
| | | |
| | |
| | | loadVisitTrendData(); |
| | | }; |
| | | |
| | | onReady(() => { |
| | | // loadVisitStatsData(); |
| | | // loadVisitTrendData(); |
| | | const init = async () => { |
| | | const { data } = await HomeApi.getIndex(); |
| | | if (data.deviceGroupName == "æ¶æç»") { |
| | | navList[1].show = true; |
| | | } else { |
| | | navList[0].show = true; |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | init(); |
| | | }); |
| | | </script> |
| | | |
| | |
| | | <wd-search placeholder-left hide-cancel></wd-search> |
| | | </wd-col> |
| | | <wd-col :span="3"> |
| | | <view class="scan_box"> |
| | | <view class="scan_box" @click="openScan"> |
| | | <wd-icon name="scan" size="24px" color="#0D867F"></wd-icon> |
| | | </view> |
| | | </wd-col> |
| | |
| | | /> |
| | | </wd-tab> |
| | | </wd-tabs> |
| | | <Scan ref="scanRef" emitName="scan" /> |
| | | <wd-toast /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import ManageApi from "@/api/product/manage"; |
| | | import { ref } from "vue"; |
| | | import ProductList from "./list/index.vue"; |
| | | import Scan from "@/components/scan/index.vue"; |
| | | import { useUserStore } from "@/store/modules/user"; |
| | | import reportApi from "@/api/work/report"; |
| | | import { useToast } from "wot-design-uni"; |
| | | |
| | | const scanRef = ref(); |
| | | const userStore = useUserStore(); |
| | | const userInfo: any = computed(() => userStore.userInfo); |
| | | const toast = useToast(); |
| | | |
| | | const waitRef = ref(); |
| | | const alreadyRef = ref(); |
| | |
| | | const changeAlready = (num: number) => { |
| | | total.already = num; |
| | | }; |
| | | |
| | | const openScan = () => { |
| | | scanRef.value.triggerScan(); |
| | | }; |
| | | |
| | | const getScanCode = async () => { |
| | | console.log("çäº§ç®¡çæ«ç åè°"); |
| | | const { code } = await reportApi.sendWorkTime({ |
| | | userName: userInfo.value.userName, |
| | | }); |
| | | if (code == 200) { |
| | | toast.success("æ«ç æå"); |
| | | } |
| | | }; |
| | | |
| | | // ç¡®ä¿å
ç§»é¤åæ·»å çå¬ |
| | | const setupScanListener = () => { |
| | | uni.$off("scan", getScanCode); // å
ç§»é¤æ§ç |
| | | uni.$on("scan", getScanCode); // åæ·»å æ°ç |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | // å¼å¯å¹¿æçå¬äºä»¶ |
| | | setupScanListener(); |
| | | console.log("æ¾ç¤º1"); |
| | | }); |
| | | onUnmounted(() => { |
| | | // å¼å¯å¹¿æçå¬äºä»¶ |
| | | uni.$off("scan", getScanCode); |
| | | console.log("离å¼1"); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | totalAmount: "totalAmount", |
| | | amount: "amount", |
| | | unAmount: "unAmount", |
| | | unit: "unit", |
| | | }); |
| | | const props = defineProps({ |
| | | api: { |
| | |
| | | </view> |
| | | </template> |
| | | </z-paging> |
| | | <Scan ref="scanRef" /> |
| | | <Scan ref="scanRef" emitName="scanMono" /> |
| | | <wd-toast /> |
| | | </view> |
| | | </template> |
| | |
| | | |
| | | onLoad((options: any) => { |
| | | // å¼å¯å¹¿æçå¬äºä»¶ |
| | | uni.$on("scan", getScanCode); |
| | | uni.$on("scanMono", getScanCode); |
| | | paramsId.value = options.id; |
| | | }); |
| | | onUnload(() => { |
| | | // å¼å¯å¹¿æçå¬äºä»¶ |
| | | uni.$off("scan", getScanCode); |
| | | uni.$off("scanMono", getScanCode); |
| | | }); |
| | | </script> |
| | | |
| | |
| | | clearable |
| | | placeholder="请è¾å
¥æå
å·" |
| | | > |
| | | <template #label> |
| | | <span style="color: #F56C6C">æå
å·</span> |
| | | </template> |
| | | <template #label> |
| | | <span style="color: #f56c6c">æå
å·</span> |
| | | </template> |
| | | </wd-input> |
| | | <wd-input |
| | | v-model="model.dishModel" |
| | |
| | | clearable |
| | | placeholder="请è¾å
¥çåå·" |
| | | > |
| | | <template #label> |
| | | <span style="color: #F56C6C">çåå·</span> |
| | | </template> |
| | | <template #label> |
| | | <span style="color: #f56c6c">çåå·</span> |
| | | </template> |
| | | </wd-input> |
| | | <wd-input |
| | | v-model="model.actuallyLength" |
| | |
| | | clearable |
| | | placeholder="请è¾å
¥å®é
é¿åº¦" |
| | | > |
| | | <template #label> |
| | | <span style="color: #F56C6C">å®é
é¿åº¦(m)</span> |
| | | </template> |
| | | <template #label> |
| | | <span style="color: #f56c6c">å®é
é¿åº¦(m)</span> |
| | | </template> |
| | | </wd-input> |
| | | <wd-input |
| | | v-model="model.actuallyWeight" |
| | |
| | | clearable |
| | | placeholder="请è¾å
¥å®é
éé" |
| | | > |
| | | <template #label> |
| | | <span style="color: #F56C6C">å®é
éé(kg)</span> |
| | | </template> |
| | | <template #label> |
| | | <span style="color: #f56c6c">å®é
éé(kg)</span> |
| | | </template> |
| | | </wd-input> |
| | | </wd-cell-group> |
| | | <wd-toast /> |
| | |
| | | }); |
| | | if (code == 200) { |
| | | toast.success("æäº¤æå"); |
| | | resetForm() |
| | | resetForm(); |
| | | return true; |
| | | } else { |
| | | toast.error("æäº¤å¤±è´¥"); |
| | |
| | | const arr = code.code.split(","); |
| | | model.poleNumber = arr[3]; // é¢ç¨æå· |
| | | model.poleWeight = arr[4]; // æé |
| | | model.poleModel = 'Φ' + arr[1].slice(2); // æåå· |
| | | model.poleModel = arr[2]; // æåå· |
| | | }; |
| | | |
| | | onLoad((options: any) => { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="list_box"> |
| | | <z-paging ref="pagingRef" v-model="cardList" :fixed="false" :auto-show-back-to-top="true"> |
| | | <template #top> |
| | | <CardTitle title="æ¶ææ¥å·¥" :hideAction="false"> |
| | | <template #action> |
| | | <wd-button type="icon" icon="scan" color="#0D867F" @click="openScan"></wd-button> |
| | | </template> |
| | | </CardTitle> |
| | | </template> |
| | | <MonofilCard v-for="(item, index) in cardList" :key="index" :data="item" /> |
| | | <template #bottom> |
| | | <view class="flex justify-center items-center"> |
| | | <wd-button block @click="save"> |
| | | <text class="text-[#fff]">ä¿å</text> |
| | | </wd-button> |
| | | </view> |
| | | </template> |
| | | </z-paging> |
| | | <Scan ref="scanRef" emitName="scanTime" /> |
| | | <wd-toast /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import CardTitle from "@/components/card-title/index.vue"; |
| | | import zPaging from "@/components/z-paging/z-paging.vue"; |
| | | import Scan from "@/components/scan/index.vue"; |
| | | import MonofilCard from "../production/twist/components/MonofilCard.vue"; |
| | | import TwistApi from "@/api/product/twist"; |
| | | import { useToast } from "wot-design-uni"; |
| | | |
| | | const pagingRef = ref(); |
| | | const scanRef = ref(); |
| | | const toast = useToast(); |
| | | const cardList = ref<any>([]); |
| | | |
| | | const getScanCode = async (code: any) => { |
| | | console.log("æ¶ææ«ç åè°:", code); |
| | | console.log("json:", JSON.parse(code.code)); |
| | | console.log("id:=============", JSON.parse(code.code).id); |
| | | const { data } = await TwistApi.getScarn({ |
| | | outPutId: JSON.parse(code.code).id, |
| | | }); |
| | | console.log("=======请æ±========", data); |
| | | const exists = cardList.value.some( |
| | | (item: any) => item.monofilamentNumber === data.monofilamentNumber |
| | | ); |
| | | if (!exists) { |
| | | const { id, outPutId, wireId, oneLength, ...rest } = data; |
| | | console.log("sb", { |
| | | outputId: id, |
| | | amount: oneLength, |
| | | ongLength: oneLength, |
| | | ...rest, |
| | | }); |
| | | cardList.value.push({ |
| | | outputId: id, |
| | | amount: oneLength, |
| | | ongLength: oneLength, |
| | | ...rest, |
| | | }); |
| | | pagingRef.value.complete(cardList.value); |
| | | } else { |
| | | toast.error("该åä¸å·²é¢ç¨ï¼è¯·å¿é夿«ç "); |
| | | } |
| | | }; |
| | | const save = async () => { |
| | | const { code } = await TwistApi.saveAge(cardList.value); |
| | | if (code == 200) { |
| | | toast.success("ä¿åæå"); |
| | | pagingRef.value.refresh(); |
| | | } else { |
| | | toast.error("ä¿å失败"); |
| | | } |
| | | }; |
| | | |
| | | const openScan = () => { |
| | | scanRef.value.triggerScan(); |
| | | }; |
| | | |
| | | // ç¡®ä¿å
ç§»é¤åæ·»å çå¬ |
| | | const setupScanListener = () => { |
| | | uni.$off("scanTime", getScanCode); // å
ç§»é¤æ§ç |
| | | uni.$on("scanTime", getScanCode); // åæ·»å æ°ç |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | setupScanListener(); |
| | | console.log("页颿¾ç¤º - æ«ç çå¬å·²è®¾ç½®"); |
| | | }); |
| | | |
| | | onUnmounted(() => { |
| | | // å¼å¯å¹¿æçå¬äºä»¶ |
| | | uni.$off("scanTime", getScanCode); |
| | | console.log("页é¢å¸è½½ - æ«ç çå¬å·²ç§»é¤"); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .list_box { |
| | | height: calc(100vh - 100px); |
| | | background: #f3f9f8; |
| | | } |
| | | :deep(.wd-button__content) { |
| | | color: #0d867f; |
| | | } |
| | | </style> |