Browse Source

pages mycomponents 文件迁移Vue2升级Vue3 8/2-10/25

pull/1/head
test 3 months ago
parent
commit
c1e7fcd245
  1. 257
      src/mycomponents/scan/winComScanBalance.vue
  2. 842
      src/pages/issue/record/directIssue2.vue
  3. 132
      src/pages/point/index.vue
  4. 7
      src/pages/productPutaway/job/semiProductPutawayJob.vue

257
src/mycomponents/scan/winComScanBalance.vue

@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<uni-popup ref="popup" :mask-click="false"> <u-popup v-model="show" mode="bottom">
<view class="popup_box"> <view class="popup_box">
<view class="pop_title uni-flex space-between"> <view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;"> <view class="" style="font-size: 35rpx;">
@ -19,13 +19,13 @@
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </u-popup>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> <balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
</view> </view>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</template> </template>
<script> <script setup lang="ts">
import winComScan from '@/mycomponents/scan/winComScan.vue' import winComScan from '@/mycomponents/scan/winComScan.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import { import {
@ -47,14 +47,10 @@ import {
getListItemTypeDesc, getListItemTypeDesc,
getItemTypeInfo getItemTypeInfo
} from '@/common/directory.js'; } from '@/common/directory.js';
export default {
name: 'winScanPack', import { ref, onMounted, watch } from 'vue'
emits: ["getBalance"],
components: { const props = defineProps({
winComScan,
balanceSelect
},
props: {
title: { title: {
type: String, type: String,
default: '箱标签' default: '箱标签'
@ -67,7 +63,7 @@ export default {
type: String, type: String,
default: "HPQ,HMQ" default: "HPQ,HMQ"
}, },
balanceFromInventoryStatuses: { //fromInventoryStatuses balanceFromInventoryStatuses: { // fromInventoryStatuses
type: Boolean, type: Boolean,
default: true default: true
}, },
@ -83,71 +79,65 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
} }
}, })
data() {
return {
scanResult: {},
show: false,
scanList: [],
expand: false,
showScanResult: {},
expendIcon: 'arrow-down',
fromLocationCode: '',
fromLocation: '',
fromLocationList: [],
fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
locationOnFocus: false,
businessType: {},
inventoryStatus: [],
managementPrecision: '',
fromInventoryStatuses: [],
itemTypesList: [],
isCheck: false,
resultData: {}
}
},
created() {
}, const scanResult = ref({})
methods: { const show = ref(false)
openScanPopup(businessType) { const scanList = ref([])
this.businessType = businessType const expand = ref(false)
this.fromInventoryStatuses = getDirectoryItemArray(businessType.outInventoryStatuses) const expendIcon = ref('arrow-down')
this.fromLocationAreaTypeList = getDirectoryItemArray(businessType.outAreaTypes) const fromLocationCode = ref('')
this.toLocationAreaTypeList = getDirectoryItemArray(businessType.inAreaTypes) const fromLocation = ref('')
this.itemTypesList = getDirectoryItemArray(businessType.itemTypes) const fromLocationList = ref([])
this.$refs.popup.open('bottom') const fromLocationAreaTypeList = ref([])
setTimeout(res=>{ const toLocationAreaTypeList = ref([])
this.getfocus() const businessType = ref({})
},500) const inventoryStatus = ref([])
}, const fromInventoryStatuses = ref([])
const itemTypesList = ref([])
const resultData = ref({})
const popup = ref(null)
const comMessage = ref(null)
const comscan = ref(null)
const balanceSelect = ref(null)
//
const openScanPopup = (businessTypeValue) => {
businessType.value = businessTypeValue
fromInventoryStatuses.value = getDirectoryItemArray(businessTypeValue.outInventoryStatuses)
fromLocationAreaTypeList.value = getDirectoryItemArray(businessTypeValue.outAreaTypes)
toLocationAreaTypeList.value = getDirectoryItemArray(businessTypeValue.inAreaTypes)
itemTypesList.value = getDirectoryItemArray(businessTypeValue.itemTypes)
show.value = true
setTimeout(() => {
getfocus()
}, 500)
}
getScanResult(result) { const getScanResult = (result) => {
this.resultData = result; resultData.value = result
if (!result.package) { if (!result.package) {
this.showErrorMessage(result.label.code + "包装信息为空") showErrorMessage(result.label.code + "包装信息为空")
return; return
} }
this.getItemCodeType(result.package.itemCode, callBack => { getItemCodeType(result.package.itemCode, () => {
if(this.isCheckLocationBalance){ if (props.isCheckLocationBalance) {
this.queryBalance(this.resultData); queryBalance(resultData.value)
}else { } else {
this.queryBalance(this.resultData) queryBalance(resultData.value)
} }
//this.queryBalance(this.resultData)
}) })
}, }
// const getToLocationBalance = (result) => {
getToLocationBalance(result) {
uni.showLoading({ uni.showLoading({
title: '查询中', title: '查询中',
mask: true mask: true
}) })
var filters = [] const filters = []
if (result.package.parentNumber) { if (result.package.parentNumber) {
var packingNumber = result.package.parentNumber + "," + result.package.number; const packingNumber = result.package.parentNumber + "," + result.package.number
filters.push({ filters.push({
column: "packingNumber", column: "packingNumber",
action: "in", action: "in",
@ -171,15 +161,13 @@ export default {
action: "==", action: "==",
value: result.package.batch value: result.package.batch
}) })
filters.push({ filters.push({
column: "areaType", column: "areaType",
action: "in", action: "in",
value: this.toLocationAreaTypeList.join(',') value: toLocationAreaTypeList.value.join(',')
}) })
const params = {
var params = {
filters: filters, filters: filters,
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
@ -187,25 +175,24 @@ export default {
getBalanceByFilter(params).then(res => { getBalanceByFilter(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额")
} else { } else {
this.queryBalance(this.resultData); queryBalance(resultData.value)
} }
// callback(res.data)
}).catch(err => { }).catch(err => {
this.showErrorMessage(err.message); showErrorMessage(err.message)
}) })
}, }
queryBalance(result) { const queryBalance = (result) => {
var params = { const params = {
itemCode: result.package.itemCode, itemCode: result.package.itemCode,
batch: result.label.batch, batch: result.label.batch,
packingNumber: result.label.packingNumber, packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber, parentPackingNumber: result.package.parentNumber,
inventoryStatus: this.fromInventoryStatuses, inventoryStatus: fromInventoryStatuses.value,
areaType: this.fromLocationAreaTypeList, areaType: fromLocationAreaTypeList.value,
bussinessCode: this.bussinessCode bussinessCode: props.bussinessCode
} }
uni.showLoading({ uni.showLoading({
title: '查询中', title: '查询中',
@ -213,109 +200,107 @@ export default {
}) })
getBalanceByParams(params).then(res => { getBalanceByParams(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data.length == 0) { if (res.data.length === 0) {
var status = getInventoryStatusDesc(params.inventoryStatus) const status = getInventoryStatusDesc(params.inventoryStatus)
var areaType = getListLocationAreaTypeDesc(params.areaType) const areaType = getListLocationAreaTypeDesc(params.areaType)
var hint = const hint =
"按物料号 [" + params.itemCode + "] \n" + "按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] \n" + "包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] \n" + "批次 [" + params.batch + "] \n" +
"状态 [" + status + "] \n" + "状态 [" + status + "] \n" +
"库区 [" + areaType + "] \n" + "库区 [" + areaType + "] \n" +
"未查找到库存余额" "未查找到库存余额"
this.showErrorMessage(hint) showErrorMessage(hint)
} else if (res.data.length == 1) { } else if (res.data.length === 1) {
result.balance = res.data[0] result.balance = res.data[0]
if (result.label.packingNumber != result.balance.packingNumber) { if (result.label.packingNumber !== result.balance.packingNumber) {
result.balance.lableQty = result.label.qty result.balance.lableQty = result.label.qty
} }
this.$emit("getBalance", result) emit('getBalance', result)
// this.closeScanPopup()
} else { } else {
// balanceSelect.value.openPopup(res.data)
this.$refs.balanceSelect.openPopup(res.data);
} }
}).catch(error => { }).catch(error => {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(error) showErrorMessage(error)
}) })
}, }
getItemCodeType(itemCode, callBack) { const getItemCodeType = (itemCode, callBack) => {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
mask: true mask: true
}) })
getBasicItemByCode(itemCode).then(res => { getBasicItemByCode(itemCode).then(res => {
if (res.data != null && res.data.list.length > 0) { if (res.data && res.data.list.length > 0) {
var result = res.data.list[0]; const result = res.data.list[0]
var status = result.available; const status = result.available
var type = result.type; const type = result.type
if (status == "TRUE") { if (status === "TRUE") {
if (checkDirectoryItemExist(this.itemTypesList, type)) { if (checkDirectoryItemExist(itemTypesList.value, type)) {
if (this.verifyCategory) { if (props.verifyCategory) {
if (result.category == 'LCJ' || result.category == 'BJ') { if (result.category === 'LCJ' || result.category === 'BJ') {
callBack() callBack()
} else { } else {
this.showErrorMessage("扫描物料的种类不是【量产件】或者【备件】") showErrorMessage("扫描物料的种类不是【量产件】或者【备件】")
} }
} else { } else {
callBack() callBack()
} }
} else { } else {
var hint = getListItemTypeDesc(this.itemTypesList); const hint = getListItemTypeDesc(itemTypesList.value)
uni.hideLoading() uni.hideLoading()
this.showErrorMessage("扫描物料[" + itemCode + "]是[" + showErrorMessage("扫描物料[" + itemCode + "]是[" +
getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]") getItemTypeInfo(type).label + "],需要的物料类型是[" + hint + "]")
} }
} else { } else {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage('物料【' + itemCode + '】不可用'); showErrorMessage('物料【' + itemCode + '】不可用')
} }
} else { } else {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage('未查找到物料【' + itemCode + '】'); showErrorMessage('未查找到物料【' + itemCode + '】')
} }
}).catch(error => { }).catch(error => {
uni.hideLoading(); uni.hideLoading()
this.showErrorMessage(error) showErrorMessage(error)
}) })
}, }
showErrorMessage(message) { const showErrorMessage = (message) => {
this.losefocus() losefocus()
this.$refs.comMessage.showErrorMessage(message, res => { comMessage.value.showErrorMessage(message, res => {
if (res) { if (res) {
if (this.$refs.comscan) { if (comscan.value) {
this.$refs.comscan.getfocus() comscan.value.getfocus()
} }
} }
}); })
}, }
selectBalanceItem(item) { const selectBalanceItem = (item) => {
this.resultData.balance = item resultData.value.balance = item
this.$emit("getBalance", this.resultData) emit('getBalance', resultData.value)
// this.closeScanPopup() }
},
closeScanPopup() { const closeScanPopup = () => {
this.losefocus(); losefocus()
this.$refs.popup.close() show.value = false
}, }
getfocus() {
if (this.$refs.comscan) { const getfocus = () => {
this.$refs.comscan.getfocus() if (comscan.value) {
} comscan.value.getfocus()
},
losefocus() {
if (this.$refs.comscan) {
this.$refs.comscan.losefocus()
}
} }
}
const losefocus = () => {
if (comscan.value) {
comscan.value.losefocus()
} }
} }
const emit = defineEmits(['getBalance'])
</script> </script>
<style lang="scss"> <style lang="scss">

842
src/pages/issue/record/directIssue2.vue

File diff suppressed because it is too large

132
src/pages/point/index.vue

@ -77,56 +77,51 @@
</view> </view>
</template> </template>
<script> <script setup>
// //
const htmlFileUrl = '/hybrid/html/point.html'; const htmlFileUrl = '/hybrid/html/point.html';
import { import {
pathToBase64 pathToBase64
} from "../../api/img-to-base64.js" //js } from "../../api/img-to-base64.js" //js
// #ifdef APP // #ifdef APP
var testModule = uni.requireNativePlugin("TestModule") let testModule = uni.requireNativePlugin("TestModule")
// #endif // #endif
import { ref, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
export default { const timer = ref(null)
name: 'point', const originData = ref([])
data() { const data = ref([])
return { const newHtmlContent = ref('')
timer: null, const isLoadFinish = ref(false)
originData: [], const picIndex = ref(0)
data: [], const picUrl = ref([])
newHtmlContent: '', //html
isLoadFinish: false,
picIndex: 0,
picUrl: []
}
},
methods: { const success = (img, item) => {
success(img, item) {
item.barcodeBase641 = img item.barcodeBase641 = img
uni.hideLoading() uni.hideLoading()
this.isLoadFinish = true isLoadFinish.value = true
// #ifdef APP // #ifdef APP
plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => { plus.io.resolveLocalFileSystemURL(item.barcodeBase641, (entry) => {
// entrytest.html
entry.file((file) => { entry.file((file) => {
let fileReader = new plus.io.FileReader(); const fileReader = new plus.io.FileReader()
fileReader.onloadend = (evt) => { fileReader.onloadend = (evt) => {
console.log("文件路径" + evt.target.result) console.log("文件路径" + evt.target.result)
item.barcodeBase64 = evt.target.result item.barcodeBase64 = evt.target.result
} }
fileReader.readAsDataURL(file); fileReader.readAsDataURL(file)
});
}, (e) => { }, (e) => {
console.log("失败" + e) console.log("失败" + e)
}); })
})
// #endif // #endif
}, }
setHtmlData() {
const setHtmlData = () => {
let str = '' let str = ''
this.readFile(htmlFileUrl, (htmlContent) => { readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent newHtmlContent.value = htmlContent
this.data.forEach(item => { data.value.forEach(item => {
str += `<div class="box" style="page-break-before:always;"><br /> str += `<div class="box" style="page-break-before:always;"><br />
<div class="left"> <div class="left">
<div class="left-item"> <div class="left-item">
@ -199,7 +194,6 @@ export default {
` `
} }
str += ` str += `
<div class="left-item"> <div class="left-item">
<div class="label">打印时间</div> <div class="label">打印时间</div>
<div class="value font-20">${item.printTimes}</div> <div class="value font-20">${item.printTimes}</div>
@ -214,82 +208,64 @@ export default {
</div> </div>
</div>` </div>`
} }
}) })
console.log('str', str) console.log('str', str)
this.newHtmlContent = this.newHtmlContent.replace( newHtmlContent.value = newHtmlContent.value.replace("mainBody", str) //
"mainBody", str); // })
}); }
},
printImage() { const printImage = () => {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
mask: true mask: true
}) })
this.setHtmlData() setHtmlData()
let clearInt = setInterval(() => { let clearInt = setInterval(() => {
if (!this.newHtmlContent.mainBody) { if (newHtmlContent.value && newHtmlContent.value.mainBody) {
// #ifdef APP // #ifdef APP
testModule.doHTMLPrint(this.newHtmlContent) testModule.doHTMLPrint(newHtmlContent.value)
// #endif // #endif
clearInterval(clearInt) clearInterval(clearInt)
uni.hideLoading() uni.hideLoading()
} }
}, 1000) }, 1000)
}, }
// #ifdef APP // #ifdef APP
// html // html
readFile(path, callback) { const readFile = (path, callback) => {
plus.io.resolveLocalFileSystemURL(path, function (entry) { plus.io.resolveLocalFileSystemURL(path, function (entry) {
entry.file(function (file) { entry.file(function (file) {
var reader = new plus.io.FileReader(); const reader = new plus.io.FileReader()
reader.onloadend = function (e) { reader.onloadend = function (e) {
callback(e.target.result); callback(e.target.result)
}; }
reader.readAsText(file); reader.readAsText(file)
}, function (e) { }, function (e) {
console.log("读取文件失败:" + e.message); console.log("读取文件失败:" + e.message)
}); })
}, function (e) { }, function (e) {
console.log("获取图片资源失败:" + e.message); console.log("获取图片资源失败:" + e.message)
}); })
} }
// #endif // #endif
},
onLoad(option) { onLoad((option) => {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
mask: true mask: true
}); })
if (option.points) { if (option.points) {
this.originData = JSON.parse(option.points); originData.value = JSON.parse(option.points)
} }
this.data = this.originData data.value = originData.value
})
// this.data = [ watch(isLoadFinish, (newVal, oldVal) => {
// { if (newVal === true) {
// "itemCode": "250.832-02", }
// "itemName": "线1ZH", }, { immediate: true })
// "packName": "",
// "packageCode": "PN20240906-0000000001",
// "batch": "20240719",
// "parentNumber": null,
// "itemType": "",
// "asnNumber": "ASNS20240731-0002",
// "supplierCode": "49000599",
// "qty": 90,
// "printTimes": "2024-09-06+09:29:37",
// "productionLineCode": null,
// "fromLocationCode": "C01-190-10",
// "barcodeString": "HPQ;V1.0;B20240719;AASNS20240731-0002;Q90.000000;I250.832-02;L;PPN20240906-0000000001;S49000599;O49000599;L12;E;UPC;",
// "barcodeBase64": ""
// }
// ]
},
}
</script> </script>
<style> <style>

7
src/pages/productPutaway/job/semiProductPutawayJob.vue

@ -5,13 +5,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue' import { ref, nextTick } from 'vue'
import { import {
onLoad, onLoad,
onShow, onShow,
onNavigationBarButtonTap, onNavigationBarButtonTap,
onReady,
onBackPress,
onReachBottom, onReachBottom,
onPullDownRefresh, onPullDownRefresh,
onHide, onUnload onHide, onUnload
@ -35,9 +33,6 @@ onHide(()=>{
productPutawayJobRef.value.stopRefresh() productPutawayJobRef.value.stopRefresh()
} }
}) })
const onReachBottom = ()=> {
productPutawayJobRef.value.onReach();
}
onUnload(()=>{ onUnload(()=>{
if (productPutawayJobRef.value) { if (productPutawayJobRef.value) {
productPutawayJobRef.value.stopRefresh() productPutawayJobRef.value.stopRefresh()

Loading…
Cancel
Save