提交 ed8bbafb authored 作者: 刘旭's avatar 刘旭

同步代码

上级 f72cb234
<script setup lang="ts"> <script setup lang="ts">
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'; import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
</script> </script>
<style lang="scss" scoped> <style lang="scss">
@import './static/iconfont/iconfont.css'; @import './static/iconfont/iconfont.css';
@import 'vk-uview-ui/index.scss'; @import 'vk-uview-ui/index.scss';
@import './scss/common.scss';
page {
background-color: #f6f6f6;
}
.uni-tabbar { .uni-tabbar {
max-width: 420px; max-width: 420px;
...@@ -15,4 +12,9 @@ page { ...@@ -15,4 +12,9 @@ page {
border-left: #f6f6f6 solid 1px; border-left: #f6f6f6 solid 1px;
border-right: #f6f6f6 solid 1px; border-right: #f6f6f6 solid 1px;
} }
page {
background: #F7F7F7;
}
</style> </style>
...@@ -14,6 +14,12 @@ export const getMetadataList = () => request('/lowcodeplatform-system/center/met ...@@ -14,6 +14,12 @@ export const getMetadataList = () => request('/lowcodeplatform-system/center/met
export const getMetadata = (formId: string) => export const getMetadata = (formId: string) =>
request('/lowcodeplatform-system/center/metadata/detail', 'GET', { formId }); request('/lowcodeplatform-system/center/metadata/detail', 'GET', { formId });
export const getUserParameter = (formId: string) =>
request('/lowcodeplatform-system/center/business/getUserParameter', 'GET', { formId });
export const saveUserParameter = (data: any) =>
request('/lowcodeplatform-system/center/business/saveUserParameter', 'POST', data);
// 获取序列号扫描数据 // 获取序列号扫描数据
export const getDataBySerialNumber = (data: any) => export const getDataBySerialNumber = (data: any) =>
request('/wms-system/serialNumber/getDataBySerialNumber', 'GET', data); request('/wms-system/serialNumber/getDataBySerialNumber', 'GET', data);
...@@ -25,3 +31,11 @@ export const getPrintData = (data: any) => ...@@ -25,3 +31,11 @@ export const getPrintData = (data: any) =>
// 获取打印信息 // 获取打印信息
export const createBusiness = (data: any) => export const createBusiness = (data: any) =>
request('/lowcodeplatform-system/center/business/createBatch', 'POST', data); request('/lowcodeplatform-system/center/business/createBatch', 'POST', data);
// 获取序列化
export const getByBillNo = (data: any) =>
request('/wms-system/serialNumber/getByBillNo', 'GET', data);
// 获取条码规则
export const getAnalysis = (data: any) =>
request('/wms-system/barcode/analysis', 'GET', data);
\ No newline at end of file
<template> <template>
<u-navbar back-text="" :title="title" :back-icon-name="backIconName" title-color="#000000" <u-navbar back-text="" :title="title" :back-icon-name="backIconName" title-color="#ffffff"
:background="{ background: '#f8f8f8' }" title-width="400"> :background="{ background }" title-width="400" height="48" back-icon-color="#ffffff">
<template #right> <template #right>
<u-icon :name="iconName" :size="44" style="padding: 14rpx 14rpx 14rpx 24rpx;" /> // #ifdef APP-PLUS
<u-icon :name="iconName" :size="22" color="#ffffff"
style="padding: 14rpx 14rpx 14rpx 24rpx; padding-top: 14px;" @tap="handleRight" />
// #endif
// #ifdef H5
<u-icon :name="iconName" :size="44" color="#ffffff" style="padding: 14rpx 14rpx 14rpx 24rpx;"
@tap="handleRight" />
// #endif
</template> </template>
</u-navbar> </u-navbar>
<u-action-sheet :list="sheetList" v-model="sheetShow" @click="onConfirm" />
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { ref } from 'vue' import { ref } from 'vue';
const props = defineProps({ const props = defineProps({
title: { title: {
type: String, type: String,
...@@ -21,19 +30,44 @@ const props = defineProps({ ...@@ -21,19 +30,44 @@ const props = defineProps({
iconName: { iconName: {
type: String, type: String,
default: '' default: ''
},
background: {
type: String,
default: 'f8f8f8'
},
sheetList: {
type: Object,
default: []
} }
}) })
const emits = defineEmits(['handleRight'])
const sheetShow = ref(false)
const handleRight = () => {
sheetShow.value = true
// emits('handleRight')
}
const onConfirm = (index: number) => {
const item = props.sheetList[index]
switch (item.options.operate) {
case 'save':
uni.navigateTo({
url: '/pages/setting/options?data=' + encodeURIComponent(JSON.stringify(item))
})
break;
}
}
</script> </script>
<style lang = "scss" scoped> <style lang = "scss" scoped>
// :deep(.u-line-1) {
// font-weight: normal;
// font-size: 14px;
// }
:deep(.u-line-1) { :deep(.u-line-1) {
font-weight: bold !important; font-weight: bold !important;
font-size: 16px !important; font-size: 16px !important;
} }
// #ifdef APP-PLUS // #ifdef APP-PLUS
:deep(.uicon-nav-back:before) { :deep(.uicon-nav-back:before) {
font-size: 44rpx; font-size: 44rpx;
......
...@@ -10,36 +10,46 @@ ...@@ -10,36 +10,46 @@
{ {
"path": "pages/login/index", "path": "pages/login/index",
"style": { "style": {
"navigationBarTitleText": "登录" "navigationBarTitleText": "登录",
"navigationBarBackgroundColor": "#3cbafd",
"navigationBarTextStyle": "white"
} }
}, },
{ {
"path": "pages/home/index", "path": "pages/home/index",
"style": { "style": {
"navigationBarTitleText": "主页" "navigationBarTitleText": "主页",
"navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/apply/index", "path": "pages/apply/index",
"style": { "style": {
"navigationBarTitleText": "应用" "navigationBarTitleText": "应用",
"navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/setting/index", "path": "pages/setting/index",
"style": { "style": {
"navigationBarTitleText": "设置", "navigationBarTitleText": "个人信息",
"navigationBarBackgroundColor": "#f6f6f6" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/apply/formDataPage", "path": "pages/setting/options",
"style": { "style": {
"navigationBarBackgroundColor": "#f6f6f6",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/apply/formDataPage",
"style": {
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#3cbafd"
}
},
{
"path": "pages/apply/formDetail", "path": "pages/apply/formDetail",
"style": { "style": {
"navigationBarBackgroundColor": "#f6f6f6", "navigationBarBackgroundColor": "#f6f6f6",
...@@ -64,26 +74,26 @@ ...@@ -64,26 +74,26 @@
"tabBar": { "tabBar": {
"selectedColor": "#333", "selectedColor": "#333",
"color": "#707070", "color": "#707070",
"backgroundColor": "#f6f6f6", "backgroundColor": "#FFFFFF",
"borderStyle": "white", "borderStyle": "white",
"height": "50px", "height": "50px",
"list": [ "list": [
{ {
"pagePath": "pages/home/index", "pagePath": "pages/home/index",
"iconPath": "/static/tabbar/home.png", "iconPath": "/static/tabbar/home.png",
"selectedIconPath": "/static/tabbar/home_fill.png", "selectedIconPath": "/static/tabbar/homefill.png",
"text": "主页" "text": "主页"
}, },
{ {
"pagePath": "pages/apply/index", "pagePath": "pages/apply/index",
"iconPath": "/static/tabbar/apply.png", "iconPath": "/static/tabbar/apply.png",
"selectedIconPath": "/static/tabbar/apply_fill.png", "selectedIconPath": "/static/tabbar/applyfill.png",
"text": "应用" "text": "应用"
}, },
{ {
"pagePath": "pages/setting/index", "pagePath": "pages/setting/index",
"iconPath": "/static/tabbar/setting.png", "iconPath": "/static/tabbar/setting.png",
"selectedIconPath": "/static/tabbar/setting_fill.png", "selectedIconPath": "/static/tabbar/settingfill.png",
"text": "设置" "text": "设置"
} }
] ]
...@@ -91,7 +101,7 @@ ...@@ -91,7 +101,7 @@
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#fff",
"backgroundColor": "#F8F8F8" "backgroundColor": "#ccc"
} }
} }
...@@ -2,35 +2,14 @@ ...@@ -2,35 +2,14 @@
<view class="card" v-for="(res, r) in businessList" :key="r"> <view class="card" v-for="(res, r) in businessList" :key="r">
<block v-for="(item, index) of res" :key="index"> <block v-for="(item, index) of res" :key="index">
<view style="padding: 10rpx 0; display: flex; flex-direction: row;"> <view style="padding: 10rpx 0; display: flex; flex-direction: row;">
<text style="margin-right: 5rpx; width: 100rpx;">{{ item.label }}</text> <view style="margin-right: 5rpx; width: 200rpx;">{{ item.label }}</view>
<textl>{{ item.value }}</textl> <view style="flex: 1; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ item.value }}
</view>
</view> </view>
</block> </block>
<u-divider v-show="is_WMS_Receive" color="#fa3534"> <u-divider v-show="is_WMS_Receive" color="#fa3534">
<u-button type="primary" size="mini" @tap="handlePrint">打印</u-button> <u-button type="primary" size="mini" @tap="handlePrint(res)">打印</u-button>
</u-divider> </u-divider>
<!-- <u-row :gutter="12" class="box-list">
<u-col :span="10">
<u-row>
<block v-for="(item, index) of res" :key="index">
<u-col :span="12" class="text-box">
<u-row>
<u-col :span="3" class="label">{{ item.label }}</u-col>
<u-col :span="8" class="value">{{ item.value }}</u-col>
</u-row>
</u-col>
</block>
</u-row>
</u-col>
<u-col :span="1" style="text-align: center;"> -->
<!-- #ifdef APP-PLUS -->
<!-- <u-checkbox @change="checkboxChange" v-model="checked" size="17" /> -->
<!-- #endif -->
<!-- #ifdef H5 -->
<!-- <u-checkbox @change="checkboxChange" v-model="checked" /> -->
<!-- #endif -->
<!-- </u-col>
</u-row> -->
</view> </view>
<view style="margin-top:4%; display: flex; flex-direction: row;"> <view style="margin-top:4%; display: flex; flex-direction: row;">
<canvas canvas-id="edit_area_canvas" <canvas canvas-id="edit_area_canvas"
...@@ -42,9 +21,8 @@ ...@@ -42,9 +21,8 @@
import { ref, computed, reactive } from 'vue' import { ref, computed, reactive } from 'vue'
import { useBlueTooth } from '@/store/modules/bluetooth'; import { useBlueTooth } from '@/store/modules/bluetooth';
import { createNew } from '@/utils/ble/tsc' import { createNew } from '@/utils/ble/tsc'
import { data } from './demo' import { getPrintData, getByBillNo, getAnalysis, getMetadata, getBusinessList } from '@/api/apply'
import { getPrintData } from '@/api/apply' // import { init, receiveLabelPrint } from '@/utils/print'
// import { init, labelTest } from '@/utils/print'
const blueTooth = useBlueTooth() const blueTooth = useBlueTooth()
const props = defineProps({ const props = defineProps({
...@@ -53,7 +31,6 @@ const props = defineProps({ ...@@ -53,7 +31,6 @@ const props = defineProps({
} as any } as any
}) })
const checked = ref(false)
const state: any = reactive({ const state: any = reactive({
looptime: 0, looptime: 0,
currentTime: 1, currentTime: 1,
...@@ -69,10 +46,10 @@ const state: any = reactive({ ...@@ -69,10 +46,10 @@ const state: any = reactive({
isLabelSend: false isLabelSend: false
}) })
const is_WMS_Receive = computed(() => { const is_WMS_Receive = computed(() => {
return JSON.parse(uni.getStorageSync('pageData')).permTag == 'WMS_Receive' ? true : false return ['WMS_Receive', 'BD_Reserve'].indexOf(JSON.parse(uni.getStorageSync('pageData')).permTag) !== -1 ? true : false
}) // 是否收料通知单 }) // 是否收料通知单
const labelData = () => { const labelData = (data: any) => {
let obj: any let obj: any
const config = data.config const config = data.config
const list = data.list const list = data.list
...@@ -102,41 +79,106 @@ const labelData = () => { ...@@ -102,41 +79,106 @@ const labelData = () => {
y: item.options.y y: item.options.y
}) })
}) })
console.log(obj);
return obj return obj
} }
const checkboxChange = (val: boolean) => { const handlePrint = async (row: any) => {
console.log(val); const billNo = row.filter((item: any) => item.label == "单据编码" || item.label == "编码")[0].value
} const formId = JSON.parse(uni.getStorageSync('pageData')).permTag
let metaParams = formId == 'WMS_Receive' ? 'WMS_LableRule' : 'BD_ReserveRule'
const { data: metaList } = await getMetadata(metaParams)
let printData = [] as any[]
if (formId == 'WMS_Receive') {
const { data: serialList } = await getByBillNo({ billNo, formId })
if (serialList.data.length === 0) return uni.showToast({
title: '该编码下无序列号',
icon: 'none'
})
const { data: printList } = await getPrintData(serialList.data)
const { data: analysisList }: any = await getAnalysis({ billNo: printList.data[0].FBarCode.split(',')[0] })
printList.data.map((item: any) => {
let obj = {} as any
analysisList.data.map((res: any, r: number) => {
let arr = item.FBarCode.split(',')
if (arr) {
let newArr = arr.slice(1, arr.length - 1)
obj['FBarCode'] = item.FBarCode
obj[res.name] = newArr[r]
}
})
printData.push(obj)
})
} else {
const { data: businessList } = await getBusinessList({ formId })
row.map((item: any) => {
businessList.data.fieldList.map((filed: any) => {
if (item.label == filed.fieldName) {
console.log(item.label, filed.fieldName);
if (item.label == '编码') item.type = 'qrcode'
else item.type = 'text'
}
})
})
printData = row
}
const labelList = labelData(JSON.parse(metaList.data.formJson))
const handlePrint = async () => { const deviceId = blueTooth.BLEInformation.deviceId
const res: any = await getPrintData(['A021']) if (!deviceId) {
console.log(res); uni.navigateTo({ url: '/pages/blueTooth/index' })
}
uni.createBLEConnection({
deviceId: blueTooth.BLEInformation.deviceId,
success: (result) => {
console.log(result, 'result');
},
fail: (error) => {
console.log(error, 'error');
if (error.code == -1) {
init()
if (formId == 'WMS_Receive') {
printData.map((item: any) => {
labelList.list.map((label: any) => {
if (label.type == "barcode" || label.type == "qrcode") label.value = item.FBarCode
if (label.type == 'text') {
for (const k in item) {
if (k == label.label) label.value = item[k]
}
}
})
receiveLabelPrint(labelList)
})
} else {
let arr = {
list: [] as any,
x: labelList.x,
y: labelList.y
}
printData.map((item: any, i: number) => {
if (item.type === 'qrcode') {
let itemArr = labelList.list.filter((label: any) => label.type === 'qrcode')[0]
itemArr.value = item.value
itemArr.label = item.label
arr.list.push(itemArr)
// const deviceId = blueTooth.BLEInformation.deviceId } else {
// labelTest(labelData()) labelList.list[i].label = item.label
// if (!deviceId) { labelList.list[i].value = item.value
// uni.navigateTo({ url: '/pages/blueTooth/index' }) arr.list.push(labelList.list[i])
// } }
// uni.createBLEConnection({ })
// deviceId: blueTooth.BLEInformation.deviceId, receiveLabelPrint(arr)
// success: (result) => { }
// console.log(result, 'result'); }
// }, }
// fail: async (error) => { })
// console.log(error, 'error');
// if (error.code == -1) {
// // await init()
// // await labelTest(blueTooth, demo)
// labelTest(labelData())
// }
// }
// })
} }
const init = () => { const init = () => {
let list = [] as any[] let list = [] as any[]
let numList = [] let numList = [] as any
let j = 0 let j = 0
for (let i = 20; i < 200; i += 10) { for (let i = 20; i < 200; i += 10) {
list[j] = i; list[j] = i;
...@@ -147,13 +189,13 @@ const init = () => { ...@@ -147,13 +189,13 @@ const init = () => {
} }
state.buffSize = list; state.buffSize = list;
// state.oneTimeData = list[0]; // state.oneTimeData = list[0];
state.oneTimeData = 20; state.oneTimeData = 100;
state.printNum = numList; state.printNum = numList;
state.printerNum = numList[0]; state.printerNum = numList[0];
} }
const labelTest = (printData: any) => { // 标签打印
console.log(printData); const receiveLabelPrint = (printData: any) => {
const { x, y, list } = printData const { x, y, list } = printData
let canvasWidth = state.canvasWidth let canvasWidth = state.canvasWidth
let canvasHeight = state.canvasHeight let canvasHeight = state.canvasHeight
...@@ -171,7 +213,6 @@ const labelTest = (printData: any) => { ...@@ -171,7 +213,6 @@ const labelTest = (printData: any) => {
command.setGap(0); //传感器 command.setCls(); command.setGap(0); //传感器 command.setCls();
command.setCls(); //清除打印机缓存 command.setCls(); //清除打印机缓存
list.map((item: any) => { list.map((item: any) => {
console.log(item);
switch (item.type) { switch (item.type) {
case 'qrcode': case 'qrcode':
console.log(item.value, 'value') console.log(item.value, 'value')
...@@ -186,7 +227,8 @@ const labelTest = (printData: any) => { ...@@ -186,7 +227,8 @@ const labelTest = (printData: any) => {
break; break;
} }
}) })
console.log(command, 'canvasGetImageData');
// console.log(command, 'canvasGetImageData');
setTimeout(() => { setTimeout(() => {
uni.canvasGetImageData({ uni.canvasGetImageData({
canvasId: 'edit_area_canvas', canvasId: 'edit_area_canvas',
...@@ -243,7 +285,7 @@ const Send = (buff: any) => { ...@@ -243,7 +285,7 @@ const Send = (buff: any) => {
dataView.setUint8(i, buff[(currentTime - 1) * onTimeData + i]) dataView.setUint8(i, buff[(currentTime - 1) * onTimeData + i])
} }
} }
console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength) // console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength)
let BLEInformation = blueTooth.BLEInformation let BLEInformation = blueTooth.BLEInformation
plus.bluetooth.writeBLECharacteristicValue({ plus.bluetooth.writeBLECharacteristicValue({
...@@ -252,10 +294,10 @@ const Send = (buff: any) => { ...@@ -252,10 +294,10 @@ const Send = (buff: any) => {
characteristicId: BLEInformation.writeCharaterId, characteristicId: BLEInformation.writeCharaterId,
value: buf, value: buf,
success: function (res) { success: function (res) {
console.log(res) // console.log(res)
}, },
fail: function (e) { fail: function (e) {
console.log(e) // console.log(e)
}, },
complete: function () { complete: function () {
currentTime++ currentTime++
...@@ -265,6 +307,7 @@ const Send = (buff: any) => { ...@@ -265,6 +307,7 @@ const Send = (buff: any) => {
} else { } else {
uni.showToast({ uni.showToast({
title: '已打印第' + currentPrint + '张', title: '已打印第' + currentPrint + '张',
icon: 'none'
}) })
if (currentPrint == printNum) { if (currentPrint == printNum) {
state.looptime = 0; state.looptime = 0;
...@@ -290,37 +333,9 @@ defineExpose({ ...@@ -290,37 +333,9 @@ defineExpose({
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card { .card.box-list {
box-sizing: border-box;
margin: 16rpx;
padding: 16rpx;
border-radius: 8rpx;
border: 1px solid #e4e7ed;
background-color: #ffffff;
overflow: hidden;
color: #303133;
transition: 0.3s;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.05);
.box-list {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
// .text-box {
// box-sizing: border-box;
// display: flex;
// flex-direction: row;
// font-size: 14px;
// margin-bottom: 10rpx;
// // width: 50%;
// .label,
// .value {
// display: inline-block;
// width: 100%;
// }
// }
}
} }
:deep(.u-checkbox__label) { :deep(.u-checkbox__label) {
......
<template> <template>
<vk-header :title="title" back-icon-name="nav-back" /> <headers :title="title" back-icon-name="nav-back" background="#3cbafd"/>
<form-list-item ref="formListRef" :business-list="businessList" /> <form-list-item ref="formListRef" :business-list="businessList" />
</template> </template>
...@@ -9,8 +9,8 @@ import { onLoad, onShow } from '@dcloudio/uni-app'; ...@@ -9,8 +9,8 @@ import { onLoad, onShow } from '@dcloudio/uni-app';
import { getBusinessList } from '@/api/apply' import { getBusinessList } from '@/api/apply'
import { useFormData } from '@/store/modules/formData'; import { useFormData } from '@/store/modules/formData';
import { sLoading, hLoading } from '@/utils/util' import { sLoading, hLoading } from '@/utils/util'
import vkHeader from '@/components/header/index.vue' import headers from '@/components/header/index.vue'
import FormListItem from './component/FormListItem.vue'; import FormListItem from './components/FormListItem.vue';
const title = ref('') const title = ref('')
const store = useFormData() const store = useFormData()
......
<template> <template>
<vk-header :title="title" back-icon-name="nav-back" /> <vk-header :title="title" back-icon-name="nav-back" background="#3cbafd" />
<!-- <view style="display: flex;"> <!-- <view style="display: flex;"> -->
<button @tap="initSerialNumberData({ serialNumber: 'A031', curFormId: 'WMS_InStock' })">A3031</button> <!-- <button @tap="initSerialNumberData({ serialNumber: 'A043', curFormId: 'WMS_UpStock' })">A3031</button> -->
<button @tap="initSerialNumberData({ serialNumber: 'A033', curFormId: 'WMS_InStock' })">A3033</button> <!-- <button @tap="initSerialNumberData({ serialNumber: 'A033', curFormId: 'WMS_InStock' })">A3033</button>
<button @tap="initSerialNumberData({ serialNumber: 'A035', curFormId: 'WMS_InStock' })">A3035</button> <button @tap="initSerialNumberData({ serialNumber: 'A035', curFormId: 'WMS_InStock' })">A3035</button>
<button @tap="initSerialNumberData({ serialNumber: 'A037', curFormId: 'WMS_InStock' })">A3037</button> <button @tap="initSerialNumberData({ serialNumber: 'A037', curFormId: 'WMS_InStock' })">A3037</button> -->
</view> --> <!-- </view> -->
<view class="header"> <view class="header">
<view class="scan-input"> <view class="scan-input">
...@@ -89,10 +89,10 @@ ...@@ -89,10 +89,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, ref } from 'vue'; import { nextTick, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { getMetadata, getDataBySerialNumber, createBusiness } from '@/api/apply'; import { getMetadata, getDataBySerialNumber, createBusiness, getAnalysis } from '@/api/apply';
import vkHeader from '@/components/header/index.vue'; import vkHeader from '@/components/header/index.vue';
import detailForm from './component/detailForm.vue'; import detailForm from './components/detailForm.vue';
import scanInput from './component/scanInput.vue'; import scanInput from './components/scanInput.vue';
const pageData = ref(); const pageData = ref();
const title = ref(); const title = ref();
...@@ -111,12 +111,35 @@ const list = ref([] as any); ...@@ -111,12 +111,35 @@ const list = ref([] as any);
const saveList = ref([] as any) const saveList = ref([] as any)
const handleInput = async (e: any) => { const handleInput = async (e: any) => {
console.log(e, 'e'); let barcodeList = uni.getStorageSync('barcodeList')
if (!barcodeList) {
barcodeList = []
const { data: res } = await getAnalysis({ billNo: e.split(',')[0] })
barcodeList.push({ list: res.data, number: e.split(',')[0] })
uni.setStorageSync('barcodeList', JSON.stringify(barcodeList));
} else {
barcodeList = JSON.parse(barcodeList)
if (!barcodeList.some((item: any) => item.number == e.split(',')[0])) {
const { data: res } = await getAnalysis({ billNo: e.split(',')[0] })
barcodeList.push({ list: res.data, number: e.split(',')[0] })
uni.setStorageSync('barcodeList', JSON.stringify(barcodeList));
}
}
// console.log(barcodeList, 'barcodeList');
let serialNumber = ''
barcodeList.map((item: any) => {
if (item.number == e.split(',')[0]) {
const index = item.list.filter((filt: any) => filt.field == 'FSerialID')[0]?.seq
if (index) serialNumber = e.split(',')[index]
}
})
nextTick(() => { nextTick(() => {
inputValue.value = e; inputValue.value = e;
}); });
const { permTag: curFormId } = JSON.parse(uni.getStorageSync('pageData')); const { permTag: curFormId } = JSON.parse(uni.getStorageSync('pageData'));
const data = { serialNumber: e, curFormId } let data = { serialNumber, curFormId }
initSerialNumberData(data) initSerialNumberData(data)
}; };
...@@ -210,6 +233,7 @@ const metadata = ref(); ...@@ -210,6 +233,7 @@ const metadata = ref();
const metadataList = ref([] as any); const metadataList = ref([] as any);
const initSerialNumberData = async (data: any) => { const initSerialNumberData = async (data: any) => {
console.log(data, 'sss');
// let data = { serialNumber: 'A031', curFormId: 'WMS_InStock' } // let data = { serialNumber: 'A031', curFormId: 'WMS_InStock' }
if (list.value.some((item: any) => item.serialNumber === data.serialNumber)) return uni.showToast({ if (list.value.some((item: any) => item.serialNumber === data.serialNumber)) return uni.showToast({
title: '已存在该扫描记录', title: '已存在该扫描记录',
......
<template> <template>
<headers title='WMS工作台' background="#3cbafd"/>
<block v-for="res in menuList" :key="res.path"> <block v-for="res in menuList" :key="res.path">
<view class="card" v-show="res.children?.length"> <view class="card" v-show="res.children?.length">
<h3 class="card-text">{{ res.title }}</h3> <h4 class="card-text">{{ res.title }}</h4>
<u-grid :col="4" :border="false"> <u-grid :col="4" :border="false">
<u-grid-item v-for="item in res.children" :custom-style="{ 'text-align': 'center' }" <u-grid-item v-for="item in res.children" :custom-style="{ 'text-align': 'center' }"
@tap="tapGridItem(item)"> @tap="tapGridItem(item)">
...@@ -14,8 +15,9 @@ ...@@ -14,8 +15,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import { getMenuTree } from '@/api/apply'; import { getMenuTree } from '@/api/apply';
import headers from '@/components/header/index.vue'
const menuList = ref(); const menuList = ref();
const tapGridItem = (row: any) => { const tapGridItem = (row: any) => {
...@@ -25,6 +27,7 @@ const tapGridItem = (row: any) => { ...@@ -25,6 +27,7 @@ const tapGridItem = (row: any) => {
}); });
}; };
// 过滤未发布的菜单 // 过滤未发布的菜单
const handleMenuTree = (list: any[]) => { const handleMenuTree = (list: any[]) => {
let newList: any[] = []; let newList: any[] = [];
...@@ -45,33 +48,11 @@ const init = async () => { ...@@ -45,33 +48,11 @@ const init = async () => {
menuList.value = handleMenuTree(res.data); menuList.value = handleMenuTree(res.data);
} }
}; };
init();
onMounted(() => {
init();
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card {
box-sizing: border-box;
margin: 16rpx;
border-radius: 8rpx;
border: 1px solid #e4e7ed;
background-color: #ffffff;
overflow: hidden;
color: #303133;
transition: 0.3s;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.05);
.card-text {
padding: 20rpx;
}
.grid-text {
font-size: 28rpx;
margin-top: 4rpx;
color: #303133;
padding: 0 10rpx;
white-space: 'nowrap';
text-overflow: 'ellipsis';
overflow: 'hidden';
}
}
</style> </style>
...@@ -221,7 +221,7 @@ const getCharacteristics = async () => { ...@@ -221,7 +221,7 @@ const getCharacteristics = async () => {
// 遍历特征值列表,获取写、读、通知特征值ID和服务ID // 遍历特征值列表,获取写、读、通知特征值ID和服务ID
for (let i = 0; i < characteristics.length; i++) { for (let i = 0; i < characteristics.length; i++) {
const { uuid, properties } = characteristics[i]; const { uuid, properties } = characteristics[i];
console.log(uuid, properties, 'characteristics[i]'); // console.log(uuid, properties, 'characteristics[i]');
if (!notifyCharacter.value && properties.notify) { if (!notifyCharacter.value && properties.notify) {
blueTooth.BLEInformation.notifyCharaterId = uuid; blueTooth.BLEInformation.notifyCharaterId = uuid;
......
<template> <template>
<headers title='首页' background="#3cbafd" />
<view class="wrap"> <view class="wrap">
<u-swiper :list="list" :height="swiperHeight"></u-swiper> <u-swiper :list="list" :height="swiperHeight"></u-swiper>
</view> </view>
<u-button type="primary" @tap="toBlueTooth">连接蓝牙</u-button> <!-- <u-button type="primary" @tap="toBlueTooth">连接蓝牙</u-button> -->
<u-grid :col="4" :border="true">
<u-grid-item v-for="item in menuList" @tap="tapGridItem(item)">
<u-icon :name="item.icon" :size="46"></u-icon>
<view class="grid-text">{{ item.title }}</view>
</u-grid-item>
</u-grid>
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { getMenuTree } from '@/api/apply';
import headers from '@/components/header/index.vue'
const list = [{ const list = [{
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg', image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
...@@ -20,10 +29,35 @@ const list = [{ ...@@ -20,10 +29,35 @@ const list = [{
image: 'https://cdn.uviewui.com/uview/swiper/3.jpg', image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳' title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
}] }]
const menuList = ref()
const toBlueTooth = () => uni.navigateTo({ url: '/pages/blueTooth/index' }) const toBlueTooth = () => uni.navigateTo({ url: '/pages/blueTooth/index' })
let swiperHeight = ref('250') let swiperHeight = ref('250')
const tapGridItem = (row: any) => {
console.log(row);
uni.setStorageSync('pageData', JSON.stringify(row));
uni.navigateTo({
url: '/pages/apply/formDetail'
});
};
// 过滤常用菜单
const handleMenuTree = (list: any[]) => {
let newList: any[] = [];
list.map((item: any) => {
item.children.map((item: any) => {
if (item.publish && item.often) {
newList.push(item);
}
})
});
return newList;
};
const init = async () => {
const { data: res } = await getMenuTree();
if (res.code === 200) {
menuList.value = handleMenuTree(res.data);
}
};
onMounted(() => { onMounted(() => {
// #ifdef APP-PLUS // #ifdef APP-PLUS
...@@ -33,6 +67,7 @@ onMounted(() => { ...@@ -33,6 +67,7 @@ onMounted(() => {
// #ifdef H5 // #ifdef H5
swiperHeight.value = '500' swiperHeight.value = '500'
// #endif // #endif
init();
}) })
</script> </script>
...@@ -41,4 +76,10 @@ onMounted(() => { ...@@ -41,4 +76,10 @@ onMounted(() => {
.wrap { .wrap {
margin-bottom: 20px; margin-bottom: 20px;
} }
.grid-text {
font-size: 28rpx;
margin-top: 4rpx;
color: #303133;
}
</style> </style>
\ No newline at end of file
...@@ -64,7 +64,7 @@ onMounted(() => loginFormRef.value?.setRules(loginFormRules)) ...@@ -64,7 +64,7 @@ onMounted(() => loginFormRef.value?.setRules(loginFormRules))
<style lang="scss" scoped> <style lang="scss" scoped>
.getCaptcha { .getCaptcha {
width: 400rpx; width: 500rpx;
background-color: rgb(253, 243, 208); background-color: rgb(253, 243, 208);
color: $u-tips-color; color: $u-tips-color;
border: none; border: none;
......
...@@ -23,8 +23,7 @@ import loginForm from './components/loginForm.vue'; ...@@ -23,8 +23,7 @@ import loginForm from './components/loginForm.vue';
.login-container { .login-container {
box-sizing: border-box; box-sizing: border-box;
margin: 20% auto 0; padding-top: 20%;
padding: 0 10%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
<template>
<u-popup v-model="props.show" mode="bottom" height="90%" @close="handleClose">
<view>出淤泥而不染,濯清涟而不妖</view>
</u-popup>
</template>
<script setup lang='ts'>
import { ref } from 'vue'
const props = defineProps({
show: {
type: Boolean,
default: false
},
list: {
type: Array,
default: []
}
})
const emits = defineEmits(['update:show'])
const handleClose = () => {
emits('update:show', false)
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template> <template>
<u-button type="primary" @click="logout">退出登录</u-button> <headers title='个人信息' background="#3cbafd" iconName="setting" :sheetList="menuList" />
<view class="logout">
<view class="card">
<u-cell-group :border="false">
<u-cell-item v-for="(item, index) in metaList" :key="item.key" icon="" :title="item.label"
:border-bottom="index === metaList.length - 1 ? false : true" />
</u-cell-group>
</view>
<u-button type="primary" @click="setUserInfo" size="mini">修改信息</u-button>
<u-button type="primary" @click="logout" size="mini">退出登录</u-button>
</view>
<setForm v-model:show="show" :list="metaList" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useGlobalStore } from '@/store/useStore'; import { useGlobalStore } from '@/store/useStore';
import { useUserParams } from '@/store/modules/userParameter';
import { getMetadata, getUserParameter } from '@/api/apply';
import setForm from './components/setForm.vue';
import headers from '../../components/header/index.vue'
const golbalStore = useGlobalStore() const golbalStore = useGlobalStore()
const userParams = useUserParams()
const metaList = ref([] as any[])
const menuList = ref()
const show = ref(false)
const setUserInfo = () => {
show.value = true
}
const logout = () => { const logout = () => {
uni.reLaunch({ uni.reLaunch({
...@@ -15,7 +39,45 @@ const logout = () => { ...@@ -15,7 +39,45 @@ const logout = () => {
} }
}) })
} }
const init = async () => {
const { data: res } = await getMetadata('BAS_UserParam')
if (res.code === 200) {
const list = JSON.parse(res.data.formJson).list.filter((item: any) => item.type === 'menu_bar')[0]
list.options.list.map((item: any) => item.text = item.label)
menuList.value = list.options.list
metaList.value = JSON.parse(res.data.formJson).list.filter((item: any) => item.type !== 'menu_bar')
userParams.setMetaList(JSON.parse(res.data.formJson))
console.log(menuList.value);
const { data: params } = await getUserParameter(JSON.parse(res.data.formJson).config.formId)
console.log(params);
}
}
onMounted(() => {
init()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.logout {
width: 100%;
text-align: center;
// padding: 20px 0;
display: flex;
flex-direction: column;
.u-btn {
width: 240rpx;
margin-bottom: 20rpx;
}
}
</style>
<style>
.u-status-bar {
height: var(--status-bar-height);
width: 100%;
}
</style> </style>
<template>
<headers :title='title' background="#3cbafd" back-icon-name="nav-back" />
<u-form label-width="180" style="padding: 20rpx;">
<block v-for="item in list">
<u-form-item v-if="item.type === 'input'" :label="item.label">
<u-input v-model="item.options.defaultValue" />
</u-form-item>
<u-form-item v-if="item.type === 'basic_data'" :label="item.label" @tap="handleSelect(item)">
{{ item.options.defaultValue ? item.options.defaultValue : '请选择' }}
<u-select v-model="item.show" :list="selectOptions" @confirm="onConfirm($event, item)" />
</u-form-item>
</block>
</u-form>
<u-button @tap="save" type="primary">{{ title }}</u-button>
</template>
<script setup lang='ts'>
import { onLoad } from '@dcloudio/uni-app';
import { computed, ref } from 'vue'
import { useUserParams } from '@/store/modules/userParameter';
import { saveUserParameter, getBusinessList } from '@/api/apply'
import headers from '@/components/header/index.vue'
const title = ref('')
const userParams = useUserParams()
const metaList: any = computed(() => userParams.metaDataGet)
const list = ref()
const selectOptions = ref([] as any[])
onLoad((options: any) => {
const data = JSON.parse(options.data)
title.value = data.label
list.value = metaList.value.list
})
const onConfirm = (e: any, row: any) => {
row.options.defaultValue = JSON.parse(JSON.stringify(e[0].value))
}
const handleSelect = (row: any) => {
if (row.options.filterCriteria) filterCriteria(row)
setTimeout(() => {
row.show = true
}, 100);
}
const filterCriteria = (element: any) => {
let params = JSON.parse(element.options.filterCriteria)
const obj = {
formId: element.options.remoteFunc,
filters: [params]
}
initStructureData(obj, element)
}
const initStructureData = async (obj: object, element: any) => {
const { data: res } = await getBusinessList(obj)
if (res.code === 200) {
let label: any = element.options.props.label;
let value: any = element.options.props.value;
selectOptions.value = []
res.data.dataList.map((item: any) => {
let labelStr = "";
if (item[label])
labelStr = item[label]
if (item[value])
if (item[label])
labelStr += " | " + item[value]
else labelStr = item[value]
let obj = { label: labelStr, value: item["id"] }
selectOptions.value.push(obj)
})
}
}
const save = async () => {
let list = {} as any
metaList.value.list.map((item: any) => {
if (item.type !== 'menu_bar') {
list[item.model] = item.options.defaultValue
}
})
let obj = {
formId: metaList.value.config.formId,
list
}
const { data: res } = await saveUserParameter(obj)
if (res.code === 200) {
uni.showToast({
title: title + '成功!',
icon: 'none'
})
}
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
.card {
box-sizing: border-box;
margin: 16rpx;
padding: 16rpx;
border-radius: 8rpx;
border: 1px solid #e4e7ed;
background-color: #ffffff;
overflow: hidden;
color: #303133;
transition: 0.3s;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.05);
.card-text {
padding: 20rpx;
}
.grid-text {
font-size: 28rpx;
margin-top: 4rpx;
color: #303133;
padding: 0 10rpx;
white-space: 'nowrap';
text-overflow: 'ellipsis';
overflow: 'hidden';
}
}
\ No newline at end of file
import { defineStore } from "pinia";
export const useUserParams = defineStore({
id: 'userParams',
state: () => ({
metaData: []
}),
getters: {
metaDataGet: (state) => state.metaData
},
actions: {
setMetaList(metaData: any) {
this.metaData = metaData
}
}
})
\ No newline at end of file
...@@ -7,15 +7,23 @@ export const useGlobalStore = defineStore({ ...@@ -7,15 +7,23 @@ export const useGlobalStore = defineStore({
state() { state() {
return { return {
token: '', token: '',
statusBarHeight: 0
} }
}, },
getters: { getters: {
}, },
actions: { actions: {
setToken(token: string) { setToken(token: string) {
this.token = token this.token = token
}, },
async setStatusBarHeight() {
let that = this
await uni.getSystemInfo({
success(res: any) {
that.statusBarHeight = res.statusBarHeight || 0;
}
});
}
}, },
persist: piniaPersistOption('globalStore') persist: piniaPersistOption('globalStore')
}) })
......
/**
* 根据system提取对应的formID
*/
\ No newline at end of file
...@@ -8,7 +8,6 @@ export const createNew = () => { ...@@ -8,7 +8,6 @@ export const createNew = () => {
jpPrinter.name = '蓝牙打印机' jpPrinter.name = '蓝牙打印机'
jpPrinter.init = function () { } jpPrinter.init = function () { }
jpPrinter.
jpPrinter.addCommand = function (content: any) { jpPrinter.addCommand = function (content: any) {
//将指令转成数组装起 //将指令转成数组装起
var code = new TextEncoder('gb18030', { var code = new TextEncoder('gb18030', {
......
...@@ -45,11 +45,11 @@ export default defineConfig({ ...@@ -45,11 +45,11 @@ export default defineConfig({
https: false, // 默认用http方式 https: false, // 默认用http方式
proxy: { proxy: {
'/lowcodeplatform-system': { '/lowcodeplatform-system': {
target: 'http://192.168.0.46', target: 'http://192.168.0.58',
// target: 'http://192.168.0.8', // target: 'http://192.168.0.8',
}, },
'/wms-system': { '/wms-system': {
target: 'http://192.168.0.46', target: 'http://192.168.0.58',
// target: 'http://192.168.0.8', // target: 'http://192.168.0.8',
}, },
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论