From 163b9c5dd25189bd45e332a28a4b888eb6a4092c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BF=97=E5=9B=BD?= <854933521@qq.com> Date: Tue, 12 Nov 2024 14:23:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AC=AC=E4=B8=80=E7=89=88=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=96=87=E4=BB=B6=E4=BF=AE=E6=94=B9=20Vue2=E5=8D=87?= =?UTF-8?q?=E7=BA=A7Vue3=2011/12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 9 +- .env.production | 10 +- package.json | 24 +-- src/api/img-to-base64.js | 196 ++++++++++++++++++ src/api/login.js | 2 +- src/common/utils/storage.js | 31 +-- src/mycomponents/detail/comJobDetailCard.vue | 2 +- src/mycomponents/qty/stdUom.vue | 18 +- src/mycomponents/query/balanceQuery.vue | 4 +- .../record/containerUnBindRecord.vue | 26 +-- src/pages/count/job/countBlindDetail.vue | 8 +- src/pages/count/job/fuzzyCountDetail.vue | 6 +- .../customerReturn/record/recordList.vue | 4 +- .../record/recordListDetail.vue | 2 +- src/pages/fg/coms/comNoReceiptPopup.vue | 8 +- src/pages/fg/coms/comReceiptPopup.vue | 2 +- src/pages/fg/receiptByPlan.vue | 1 - src/pages/fg/receiptNoPlan.vue | 2 +- src/pages/itemHold/record/recordList.vue | 6 +- src/pages/login/index.vue | 2 +- src/pages/package/coms/comScanPackagePack.vue | 3 +- src/pages/package/job/overPackageJob.vue | 4 +- src/pages/pointProductReceipt/index.vue | 10 +- .../record/productPutawayRecord.vue | 28 --- .../job/ccProductReceiptJob.vue | 16 +- .../job/productionReceiptJob.vue | 15 +- .../productionReturn/record/returnToStore.vue | 8 +- .../coms/comReturnDetailCard.vue | 2 +- src/pages/purchaseReturn/job/returnDetail.vue | 1 - src/pages/putaway/job/quantityPutawayJob.vue | 4 +- .../coms/comRepleishDetailCardBatch.vue | 2 +- src/pages/repleinsh/job/repleinshJob.vue | 1 - .../scrap/coms/comScrapDetailCardBatch.vue | 2 +- src/pages/scrap/job/scrapJobDetail.vue | 1 - .../stockUp/coms/comScanStockUpPackBatch.vue | 2 +- src/pages/stockUp/job/stockUpJobDetail.vue | 6 +- src/plugins/storage.js | 4 +- vite.config.ts | 42 +++- 38 files changed, 344 insertions(+), 170 deletions(-) create mode 100644 src/api/img-to-base64.js diff --git a/.env.development b/.env.development index baddd93b..c6f3f082 100644 --- a/.env.development +++ b/.env.development @@ -1,11 +1,12 @@ -VITE_BASE_URL=http://172.22.32.9:81/api/admin-api -VITE_BASE_URL_IMAGE=http://172.22.32.9:81/admin-api +VITE_BASE_URL=http://dev.ccwin-in.com:26800/admin-api + +VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:26800/admin-api # 租户配置 -VITE_TENANT='[{"text":"成都","value":2}]' +VITE_TENANT='[{"text":"长春1379","value":1}]' # 是否是测试环境 -VITE_isDevelopment=false +VITE_isDevelopment = true # 积木报表请求路径 VITE_JMREPORT_BASE_URL='http://172.22.32.9:90' \ No newline at end of file diff --git a/.env.production b/.env.production index 9175d1cc..007375a0 100644 --- a/.env.production +++ b/.env.production @@ -1,7 +1,11 @@ -VITE_BASE_URL=http://172.21.32.14:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.14:81/admin-api # 租户配置 VITE_TENANT='[{"text":"长春","value":1},{"text":"成都","value":2}]' +VITE_BASE_URL=http://dev.ccwin-in.com:26800/admin-api +VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:26800/admin-api -# 是否是测试环境 +# 租户配置 +VITE_TENANT='[{"text":"长春1379","value":1}]' + +# 是否是测试环境 VITE_isDevelopment=false # 积木报表请求路径 -VITE_JMREPORT_BASE_URL='http://172.21.32.14:90' +VITE_JMREPORT_BASE_URL='http://dev.ccwin-in.com:26800' diff --git a/package.json b/package.json index 58fe94ff..c163293e 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,14 @@ "test:custom": "uni build -p", "prod:mp-weixin": "uni build -p mp-weixin --mode production", "prod:app": "uni build -p app --mode production", - "prod:custom": "uni build -p --mode production", - "prod": "uni build --mode production", - "hella8": "uni build --mode hella8", - "hella9": "uni build --mode hella9", - "hella13": "uni build --mode hella13", - "hella14": "uni build --mode hella14", - "hella15": "uni build --mode hella15", - "hella16": "uni build --mode hella16" + "prod:custom": "uni build --mode production", + "prod": "uni build --mode production", + "hella8": "uni build --mode hella8", + "hella9": "uni build --mode hella9", + "hella13": "uni build --mode hella13", + "hella14": "uni build --mode hella14", + "hella15": "uni build --mode hella15", + "hella16": "uni build --mode hella16" }, "dependencies": { "@dcloudio/uni-app": "3.0.0-alpha-3060920221114001", @@ -39,9 +39,9 @@ "cz-git": "^1.4.1", "decimal.js": "^10.4.3", "or": "^0.2.0", - "pinia": "^2.0.35", + "pinia": "^2.0.17", "vk-uview-ui": "^1.3.7", - "vue": "^3.2.41", + "vue": "3.2.47", "vue-demi": "latest", "vue-i18n": "^9.1.9", "vuex": "^4.0.2" @@ -71,12 +71,12 @@ "jsdom": "^24.0.0", "less": "^4.1.3", "prettier": "^2.7.1", - "sass": "^1.53.0", + "sass": "1.53.0", "simple-git-hooks": "^2.8.1", "typescript": "^4.7.4", "unocss": "^0.46.4", "unocss-preset-weapp": "^0.2.1", - "vite": "^3.1.8", + "vite": "^4.0.3", "vite-plugin-eslint": "^1.6.1", "vitest": "^0.16.0" }, diff --git a/src/api/img-to-base64.js b/src/api/img-to-base64.js new file mode 100644 index 00000000..699109ff --- /dev/null +++ b/src/api/img-to-base64.js @@ -0,0 +1,196 @@ +function getLocalFilePath(path) { + if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) { + return path + } + if (path.indexOf('file://') === 0) { + return path + } + if (path.indexOf('/storage/emulated/0/') === 0) { + return path + } + if (path.indexOf('/') === 0) { + var localFilePath = plus.io.convertAbsoluteFileSystem(path) + if (localFilePath !== path) { + return localFilePath + } else { + path = path.substr(1) + } + } + return '_www/' + path +} + +function dataUrlToBase64(str) { + var array = str.split(',') + return array[array.length - 1] +} + +var index = 0 +function getNewFileId() { + return Date.now() + String(index++) +} + +function biggerThan(v1, v2) { + var v1Array = v1.split('.') + var v2Array = v2.split('.') + var update = false + for (var index = 0; index < v2Array.length; index++) { + var diff = v1Array[index] - v2Array[index] + if (diff !== 0) { + update = diff > 0 + break + } + } + return update +} + +export async function pathToBase64(path) { + return await new Promise(async function(resolve, reject) { + if (typeof window === 'object' && 'document' in window) { + if (typeof FileReader === 'function') { + var xhr =await new XMLHttpRequest() + xhr.open('GET', path, true) + xhr.responseType = 'blob' + xhr.onload = function() { + if (this.status === 200) { + let fileReader = new FileReader() + fileReader.onload = function(e) { + resolve(e.target.result) + } + fileReader.onerror = reject + fileReader.readAsDataURL(this.response) + } + } + xhr.onerror = reject + xhr.send() + return + } + var canvas = document.createElement('canvas') + var c2x = canvas.getContext('2d') + var img = new Image + img.onload = function() { + canvas.width = img.width + canvas.height = img.height + c2x.drawImage(img, 0, 0) + resolve(canvas.toDataURL()) + canvas.height = canvas.width = 0 + } + img.onerror = reject + img.src = path + return + } + if (typeof plus === 'object') { + plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) { + entry.file(function(file) { + var fileReader = new plus.io.FileReader() + fileReader.onload = function(data) { + resolve(data.target.result) + } + fileReader.onerror = function(error) { + reject(error) + } + fileReader.readAsDataURL(file) + }, function(error) { + reject(error) + }) + }, function(error) { + reject(error) + }) + return + } + if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) { + wx.getFileSystemManager().readFile({ + filePath: path, + encoding: 'base64', + success: function(res) { + resolve('data:image/png;base64,' + res.data) + }, + fail: function(error) { + reject(error) + } + }) + return + } + reject(new Error('not support')) + }) +} + +export function base64ToPath(base64) { + return new Promise(function(resolve, reject) { + if (typeof window === 'object' && 'document' in window) { + base64 = base64.split(',') + var type = base64[0].match(/:(.*?);/)[1] + var str = atob(base64[1]) + var n = str.length + var array = new Uint8Array(n) + while (n--) { + array[n] = str.charCodeAt(n) + } + return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], { type: type }))) + } + var extName = base64.split(',')[0].match(/data\:\S+\/(\S+);/) + if (extName) { + extName = extName[1] + } else { + reject(new Error('base64 error')) + } + var fileName = getNewFileId() + '.' + extName + if (typeof plus === 'object') { + var basePath = '_doc' + var dirPath = 'uniapp_temp' + var filePath = basePath + '/' + dirPath + '/' + fileName + if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime.innerVersion)) { + plus.io.resolveLocalFileSystemURL(basePath, function(entry) { + entry.getDirectory(dirPath, { + create: true, + exclusive: false, + }, function(entry) { + entry.getFile(fileName, { + create: true, + exclusive: false, + }, function(entry) { + entry.createWriter(function(writer) { + writer.onwrite = function() { + resolve(filePath) + } + writer.onerror = reject + writer.seek(0) + writer.writeAsBinary(dataUrlToBase64(base64)) + }, reject) + }, reject) + }, reject) + }, reject) + return + } + var bitmap = new plus.nativeObj.Bitmap(fileName) + bitmap.loadBase64Data(base64, function() { + bitmap.save(filePath, {}, function() { + bitmap.clear() + resolve(filePath) + }, function(error) { + bitmap.clear() + reject(error) + }) + }, function(error) { + bitmap.clear() + reject(error) + }) + return + } + if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) { + var filePath = wx.env.USER_DATA_PATH + '/' + fileName + wx.getFileSystemManager().writeFile({ + filePath: filePath, + data: dataUrlToBase64(base64), + encoding: 'base64', + success: function() { + resolve(filePath) + }, + fail: function(error) { + reject(error) + } + }) + return + } + reject(new Error('not support')) + }) +} \ No newline at end of file diff --git a/src/api/login.js b/src/api/login.js index c34828f3..cdae3094 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -11,7 +11,7 @@ export function login(username, password, captchaVerification, tenantName, remem code, uuid, } - return http.post('/system/auth/loginNoCode', data) + return http.post('/system/auth/login', data) } // 获取用户详细信息 diff --git a/src/common/utils/storage.js b/src/common/utils/storage.js index d4c6f93e..586ec87a 100644 --- a/src/common/utils/storage.js +++ b/src/common/utils/storage.js @@ -10,21 +10,22 @@ const setStorage = (key,value)=>{ // 清除全部本地存储 const clearStorage = ()=>{ - const overPackageRecordPointParams = '' - if( uni.getStorageSync('overPackageRecordPointParams')){ - overPackageRecordPointParams = uni.getStorageSync('overPackageRecordPointParams') - } - const overPackageJobDetailPointParams = '' - if( uni.getStorageSync('overPackageJobDetailPointParams')){ - overPackageJobDetailPointParams = uni.getStorageSync('overPackageJobDetailPointParams') - } - uni.clearStorageSync(); - if(overPackageRecordPointParams){ - uni.setStorageSync('overPackageRecordPointParams',overPackageRecordPointParams) - } - if(overPackageJobDetailPointParams){ - uni.setStorageSync('overPackageJobDetailPointParams',overPackageJobDetailPointParams) - } + let overPackageRecordPointParams = '' + if( uni.getStorageSync('overPackageRecordPointParams')){ + overPackageRecordPointParams = uni.getStorageSync('overPackageRecordPointParams') + } + let overPackageJobDetailPointParams = '' + if( uni.getStorageSync('overPackageJobDetailPointParams')){ + overPackageJobDetailPointParams = uni.getStorageSync('overPackageJobDetailPointParams') + } + uni.clearStorageSync(); + if(overPackageRecordPointParams){ + uni.setStorageSync('overPackageRecordPointParams',overPackageRecordPointParams) + } + if(overPackageJobDetailPointParams){ + uni.setStorageSync('overPackageJobDetailPointParams',overPackageJobDetailPointParams) + } + } // 清除指定key本地存储 diff --git a/src/mycomponents/detail/comJobDetailCard.vue b/src/mycomponents/detail/comJobDetailCard.vue index a3ddcac5..b62848cb 100644 --- a/src/mycomponents/detail/comJobDetailCard.vue +++ b/src/mycomponents/detail/comJobDetailCard.vue @@ -112,7 +112,7 @@ const swipeClick = (e, item) => { } } const edit = (item) => { - editItem = item + editItem.value = item receiptEdit.value.openTaskEditPopup(item.qty, item.handleQty, item.labelQty) } const remove = (item) => { diff --git a/src/mycomponents/qty/stdUom.vue b/src/mycomponents/qty/stdUom.vue index f5e7ae79..031e516f 100644 --- a/src/mycomponents/qty/stdUom.vue +++ b/src/mycomponents/qty/stdUom.vue @@ -1,11 +1,10 @@ - - - \ No newline at end of file diff --git a/src/mycomponents/query/balanceQuery.vue b/src/mycomponents/query/balanceQuery.vue index 4179efa8..81309c07 100644 --- a/src/mycomponents/query/balanceQuery.vue +++ b/src/mycomponents/query/balanceQuery.vue @@ -1,6 +1,6 @@ @@ -37,7 +37,7 @@ import comOverPackJobCard from '@/pages/package/coms/comOverPackJobCard.vue' import jobInfoPopup from '@/pages/issue/coms/jobInfoPopup.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' -import jobList from '@/mycomponents/jobList/jobList.vue' +import JobList from '@/mycomponents/jobList/jobList.vue' const { proxy } = getCurrentInstance() const jobList = ref([]) diff --git a/src/pages/pointProductReceipt/index.vue b/src/pages/pointProductReceipt/index.vue index b6ca2845..81523bc8 100644 --- a/src/pages/pointProductReceipt/index.vue +++ b/src/pages/pointProductReceipt/index.vue @@ -61,7 +61,7 @@ const htmlFileUrl = '/hybrid/html/point.html'; import { pathToBase64 - } from "../../api/img-to-base64.js" //引入解压后的js文件,这里我重新命名了文件名 + } from "@/api/img-to-base64.js" //引入解压后的js文件,这里我重新命名了文件名 // #ifdef APP var testModule = uni.requireNativePlugin("TestModule") // #endif @@ -156,15 +156,15 @@ } } ) - onLoad(option) { + onLoad((option)=> { if (option.points) { data.value = JSON.parse(option.points); } - } - onsShow(()=>{ + }) + onShow(()=>{ nextTick(async () => { // 获取二维码图片临时路径 - const el = qrcodeRef.value + let el = qrcodeRef.value const str = '' el.forEach(async (item, index) => { await item.canvasToTempFilePath({ diff --git a/src/pages/productPutaway/record/productPutawayRecord.vue b/src/pages/productPutaway/record/productPutawayRecord.vue index 3864c1c1..9cc7501a 100644 --- a/src/pages/productPutaway/record/productPutawayRecord.vue +++ b/src/pages/productPutaway/record/productPutawayRecord.vue @@ -268,34 +268,6 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' showErrorMessage(error); }) } -const getRecommendLocation = async (balance,result)=> { - uni.showLoading({ - title: '扫描中...', - mask: true - }) - - let param = { - expectinNumber: balance.packingNumber + "-" + Date.now(), - itemCode: balance.itemCode, - inventoryStatus: balance.inventoryStatus, - batch: balance.batch - }; - console.log(JSON.stringify(param)) - await getrecommendLocationExpectin(param).then(async result1 => { - uni.hideLoading(); - let item = detailSource.value.find(res => { - if (res.itemCode == balance.itemCode) { - return res - } - }) - item.toLocationCode = result1.data.code; - item.expectinNumber = result1.data.expectinNumber; - await getToLocationBalance(item.toLocationCode,result) - }).catch(error => { - uni.hideLoading() - showErrorMessage(error); - }) -} //查询到目标库位的库存余额 const getToLocationBalance = async (toLocationCode,result)=> { uni.showLoading({ diff --git a/src/pages/productReceipt/job/ccProductReceiptJob.vue b/src/pages/productReceipt/job/ccProductReceiptJob.vue index 36f1265c..5b50b0ec 100644 --- a/src/pages/productReceipt/job/ccProductReceiptJob.vue +++ b/src/pages/productReceipt/job/ccProductReceiptJob.vue @@ -21,7 +21,7 @@ - + @@ -37,12 +37,12 @@ import { getDetailOption, getDetailGiveupOption } from '@/common/array.js' import comEmptyView from '@/mycomponents/common/comEmptyView.vue' - import jobFilter from '@/mycomponents/job/jobFilter.vue' + import JobFilter from '@/mycomponents/job/jobFilter.vue' import comProductJobCard from '@/pages/productReceipt/coms/comProductJobCard.vue' - import jobListPopup from '@/pages/productReceipt/coms/jobListPopup.vue' - import jobInfoPopup from '@/pages/productReceipt/coms/jobInfoPopup.vue' - import jobList from '@/mycomponents/jobList/jobList.vue' + import JobListPopup from '@/pages/productReceipt/coms/jobListPopup.vue' + import JobInfoPopup from '@/pages/productReceipt/coms/jobInfoPopup.vue' + import JobList from '@/mycomponents/jobList/jobList.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPackJob from '@/mycomponents/scan/winScanPackJob.vue' @@ -300,12 +300,6 @@ const toHome = () => { goHome() } - const onReach = () => { - if loadingType.value == 'loading' || loadingType.valu == 'noMore') { - return - } - getList('more') - } const openScanPopup = () => { scanPopup.value.openScanPopup() } diff --git a/src/pages/productionReceipt/job/productionReceiptJob.vue b/src/pages/productionReceipt/job/productionReceiptJob.vue index d748d320..07f86b0f 100644 --- a/src/pages/productionReceipt/job/productionReceiptJob.vue +++ b/src/pages/productionReceipt/job/productionReceiptJob.vue @@ -72,7 +72,7 @@ import jobListPopup from '@/pages/productionReceipt/coms/jobListPopup.vue' import jobInfoPopup from '@/pages/productionReceipt/coms/jobInfoPopup.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPackJob from '@/mycomponents/scan/winScanPackJob.vue' -import jobList from '@/mycomponents/jobList/jobList.vue' +import JobList from '@/mycomponents/jobList/jobList.vue' import {useCountStore} from '@/store' // 获取自定义的store @@ -145,18 +145,7 @@ onNavigationBarButtonTap((e) => { filter.value.openFilterParams(uni.getStorageSync(productionReceiptJobFilter)); } }) -const productionLineCodeConfirm = (productionLineCode) => { - var params = uni.getStorageSync(productionReceiptJobFilter) - productionLineCode.value = e; - //第一次没有值,需要赋值 - if (!params) { - params = { - productionLineCode: "", - itemCode: "" - } - } - getListByFilter(params) -} + const getProductionReceiptJobByProductionline = () => { uni.showLoading({ title: "获取生产线", diff --git a/src/pages/productionReturn/record/returnToStore.vue b/src/pages/productionReturn/record/returnToStore.vue index fd78e1af..864d44ef 100644 --- a/src/pages/productionReturn/record/returnToStore.vue +++ b/src/pages/productionReturn/record/returnToStore.vue @@ -88,10 +88,10 @@ const toManagementList = ref([]) const scanPopup = ref() const comMessageRef = ref() const toWarehouseCode = ref() -onLoad(option) { - uni.setNavigationBarTitle({ - title: option.title - }) +onLoad((option) =>{ + uni.setNavigationBarTitle({ + title: option.title + }) getBusinessType(businessTypeCode.value, (res) => { if (res.success) { businessType.value = res.businessType diff --git a/src/pages/purchaseReturn/coms/comReturnDetailCard.vue b/src/pages/purchaseReturn/coms/comReturnDetailCard.vue index 907a29a3..1c7628ab 100644 --- a/src/pages/purchaseReturn/coms/comReturnDetailCard.vue +++ b/src/pages/purchaseReturn/coms/comReturnDetailCard.vue @@ -60,7 +60,7 @@ import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' import requiredLocation from '@/mycomponents/location/requiredLocation.vue' - import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' + import BalanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' import location from '@/mycomponents/balance/location.vue' import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' diff --git a/src/pages/purchaseReturn/job/returnDetail.vue b/src/pages/purchaseReturn/job/returnDetail.vue index 2fb89c2f..3c2454d9 100644 --- a/src/pages/purchaseReturn/job/returnDetail.vue +++ b/src/pages/purchaseReturn/job/returnDetail.vue @@ -95,7 +95,6 @@ const comMessageRef = ref() const jobDetailPopup = ref() const poNumber = ref('') const fromLocationCode = ref('') -const managementList = ref('') const comIssueDetailCard = ref() const comScanIssuePack = ref(null) onLoad((option) => { diff --git a/src/pages/putaway/job/quantityPutawayJob.vue b/src/pages/putaway/job/quantityPutawayJob.vue index 3584b614..63de5e63 100644 --- a/src/pages/putaway/job/quantityPutawayJob.vue +++ b/src/pages/putaway/job/quantityPutawayJob.vue @@ -64,7 +64,7 @@ - + @@ -73,7 +73,7 @@