feat:查询条件调整
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<u-popup :show="showAuncelSelector" closeable @close="close" @open="open" mode="right">
|
||||
<view class="p10">天平选择</view>
|
||||
<scroll-view scroll-y="true" class="content">
|
||||
<u-grid border :col="3" @click="doSelect">
|
||||
<u-grid :col="3" @click="doSelect" style="gap: 20px">
|
||||
<u-grid-item v-for="(auncel, index) in auncelList" :index="index" :key="index">
|
||||
<view class="auncel-item">
|
||||
<view class="auncel-name">
|
||||
@@ -18,6 +18,7 @@
|
||||
<view v-if="auncel.isConnected === 1" class="weight-unit">{{ auncel.weightUnit }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="auncel.isConnected != 1" class="shade">天平断开</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</scroll-view>
|
||||
@@ -164,7 +165,7 @@ const handleDeviceStatus = res => {
|
||||
if (item.id === res.deviceId) {
|
||||
item.isConnected = res.connected
|
||||
if (res.connected == 0) {
|
||||
item.weightData = '天平断开'
|
||||
item.weightData = ''
|
||||
item.weightUnit = ''
|
||||
item.weightStable = 0
|
||||
}
|
||||
@@ -199,7 +200,7 @@ onUnmounted(() => {
|
||||
})
|
||||
function getWeightText(auncel) {
|
||||
if (auncel.isConnected !== 1) {
|
||||
return '天平断开'
|
||||
return ''
|
||||
}
|
||||
return auncel.weightData || ''
|
||||
}
|
||||
@@ -227,8 +228,9 @@ function getWeightStyle(auncel) {
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
width: 80vw;
|
||||
width: 60vw;
|
||||
height: 90vh;
|
||||
padding: 0 20px 40px 20px;
|
||||
}
|
||||
.auncel-item {
|
||||
height: 180px;
|
||||
@@ -239,6 +241,22 @@ function getWeightStyle(auncel) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.shade {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #000;
|
||||
opacity: 0.6;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
z-index: 10;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.auncel-name {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
|
||||
@@ -330,28 +330,36 @@ function accAdd(arg1, arg2) {
|
||||
// 通过配置项分组
|
||||
export function groupByField(list, cupNumFieldIndex, groupKey = 'groupDictionaryBusinessKey') {
|
||||
const groupMap = new Map()
|
||||
|
||||
// 插入“全部”项
|
||||
list.unshift({ groupDictionaryBusinessKey: 'all', groupDictionaryBusinessName: '全部' })
|
||||
|
||||
for (const item of list) {
|
||||
// 赋值杯号fieldindex
|
||||
// 赋值杯号 fieldIndex
|
||||
if (item.title === '杯号') {
|
||||
cupNumFieldIndex.value = item.fieldIndex
|
||||
}
|
||||
const key = item[groupKey]
|
||||
if (!key) continue // 跳过没有 group 的项(可选)
|
||||
|
||||
let key = item[groupKey]
|
||||
|
||||
// 如果没有有效 key,统一归入自定义分组
|
||||
if (!key) {
|
||||
key = 'customParameter' // 使用固定字符串作为无 key 项的分组标识
|
||||
}
|
||||
|
||||
// 如果该分组不存在,初始化
|
||||
if (!groupMap.has(key)) {
|
||||
groupMap.set(key, {
|
||||
value: key,
|
||||
label: item.groupDictionaryBusinessName, // 假设 title 在每个 item 中,且同组相同
|
||||
label: key === 'customParameter' ? '分析项目' : item.groupDictionaryBusinessName || '未知分组',
|
||||
fields: []
|
||||
})
|
||||
}
|
||||
|
||||
// 把当前项(或仅需要的部分)推入 fields
|
||||
// 将当前项加入对应分组
|
||||
groupMap.get(key).fields.push(item)
|
||||
}
|
||||
|
||||
// 转为数组
|
||||
return Array.from(groupMap.values())
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
import Request from 'luch-request'
|
||||
import { getBaseUrl, getTenantId } from '@/defaultBaseUrl'
|
||||
import $store from '@/nx/store'
|
||||
import { ApiEncryption } from '@/nx/utils/crypto.js'
|
||||
|
||||
const apiEncryption = new ApiEncryption()
|
||||
import qs from 'qs'
|
||||
|
||||
const options = {
|
||||
// 显示操作成功消息 默认不显示
|
||||
@@ -62,7 +60,10 @@ const http = new Request({
|
||||
// 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+)
|
||||
withCredentials: false,
|
||||
// #endif
|
||||
custom: options
|
||||
custom: options,
|
||||
paramsSerializer(params) {
|
||||
return qs.stringify(params, { arrayFormat: 'indices' })
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
247
package-lock.json
generated
247
package-lock.json
generated
@@ -17,7 +17,8 @@
|
||||
"mathjs": "^13.0.3",
|
||||
"md5": "^2.3.0",
|
||||
"pinia": "^2.0.24",
|
||||
"pinia-plugin-persist-uni": "^1.2.0"
|
||||
"pinia-plugin-persist-uni": "^1.2.0",
|
||||
"qs": "^6.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.7.1",
|
||||
@@ -87,6 +88,33 @@
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/charenc": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/charenc/-/charenc-0.0.2.tgz",
|
||||
@@ -168,6 +196,46 @@
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/delegate/-/delegate-3.2.0.tgz",
|
||||
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-latex": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/escape-latex/-/escape-latex-1.2.0.tgz",
|
||||
@@ -185,6 +253,49 @@
|
||||
"url": "https://github.com/sponsors/rawify"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gm-crypto": {
|
||||
"version": "0.1.12",
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/gm-crypto/-/gm-crypto-0.1.12.tgz",
|
||||
@@ -203,6 +314,39 @@
|
||||
"delegate": "^3.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/ieee754/-/ieee754-1.2.1.tgz",
|
||||
@@ -250,6 +394,14 @@
|
||||
"@dcloudio/types": "^2.0.16"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/mathjs": {
|
||||
"version": "13.2.3",
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/mathjs/-/mathjs-13.2.3.tgz",
|
||||
@@ -288,6 +440,17 @@
|
||||
"integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/pinia": {
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.2.6.tgz",
|
||||
@@ -371,6 +534,20 @@
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmmirror.com/qs/-/qs-6.14.0.tgz",
|
||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.14.1",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
|
||||
@@ -386,6 +563,74 @@
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/select/-/select-1.1.2.tgz",
|
||||
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz",
|
||||
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-list": "^1.0.0",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
||||
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-emitter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "http://nexus.ctjsoft.com:8081/nexus/content/groups/npm-group/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
"gm-crypto": "^0.1.12",
|
||||
"lodash": "^4.17.21",
|
||||
"luch-request": "^3.0.8",
|
||||
"mathjs": "^13.0.3",
|
||||
"md5": "^2.3.0",
|
||||
"pinia": "^2.0.24",
|
||||
"pinia-plugin-persist-uni": "^1.2.0",
|
||||
"mathjs": "^13.0.3"
|
||||
"qs": "^6.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.7.1",
|
||||
"vconsole": "^3.15.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view>
|
||||
<navbar-back title="任务单预览"></navbar-back>
|
||||
<view></view>
|
||||
<!-- #ifdef H5 -->
|
||||
<web-view :src="pdfUrlH5"></web-view>
|
||||
<u-button v-if="showConfirmBtn" class="confirm-btn" type="success" @click="handleConfirm()">数据确认</u-button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
@@ -21,9 +21,21 @@ const reportKey = ref('')
|
||||
const hideResultFlag = ref('')
|
||||
const viewerUrl = '/hybrid/html/web/viewer.html?file='
|
||||
const pdfUrlH5 = ref('')
|
||||
const showConfirmBtn = ref(false)
|
||||
let confirmButtonRef = null // 用于保存按钮实
|
||||
|
||||
let wv = null // 计划创建的 webview
|
||||
|
||||
function handleConfirm() {
|
||||
const params = {
|
||||
businessAssayTaskId: businessAssayTaskId.value
|
||||
}
|
||||
nx.$api.assayTask.submitTask(params).then(res => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/analysis/sample/sample-work-list'
|
||||
})
|
||||
})
|
||||
}
|
||||
// 方法:下载 PDF
|
||||
const downloadPdf = (pdfUrl, retryCount = 0) => {
|
||||
const MAX_RETRY = 3 // 最多重试 3 次
|
||||
@@ -79,10 +91,59 @@ const loadPdfOnAndroid = async pdfUrl => {
|
||||
bottom: 0
|
||||
})
|
||||
wv.loadURL(allUrl)
|
||||
|
||||
confirmButtonRef = createConfirmButton()
|
||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
||||
currentWebview.append(wv)
|
||||
currentWebview.append(confirmButtonRef)
|
||||
|
||||
if (!showConfirmBtn.value) {
|
||||
hideNativeButton()
|
||||
}
|
||||
}
|
||||
const createConfirmButton = () => {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
const btnWidth = 100
|
||||
const btnHeight = 40
|
||||
const margin = 10
|
||||
const left = sysInfo.windowWidth - btnWidth - margin
|
||||
const top = sysInfo.windowHeight - btnHeight - margin
|
||||
|
||||
const buttonView = new plus.nativeObj.View('confirm-btn-native', {
|
||||
left: left,
|
||||
top: top,
|
||||
width: btnWidth,
|
||||
height: btnHeight
|
||||
})
|
||||
|
||||
buttonView.drawRect({ color: '#5ac725', radius: '4px' }, { top: 0, left: 0, width: btnWidth, height: btnHeight })
|
||||
|
||||
buttonView.drawText(
|
||||
'确认上报',
|
||||
{ top: 11, left: 0, width: btnWidth, height: 18 },
|
||||
{ size: '14px', color: '#ffffff', align: 'center' }
|
||||
)
|
||||
|
||||
buttonView.interceptTouchEvent(true)
|
||||
buttonView.addEventListener('click', () => {
|
||||
handleConfirm()
|
||||
})
|
||||
|
||||
return buttonView
|
||||
}
|
||||
|
||||
// 隐藏按钮
|
||||
function hideNativeButton() {
|
||||
if (confirmButtonRef) {
|
||||
confirmButtonRef.hide()
|
||||
}
|
||||
}
|
||||
function destroyNativeButton() {
|
||||
if (confirmButtonRef) {
|
||||
confirmButtonRef.close() // 或 remove()
|
||||
confirmButtonRef = null
|
||||
}
|
||||
}
|
||||
// 获取 PDF 预览 URL
|
||||
const getPdf = async () => {
|
||||
const printBaseUrl = getBaseUrl()
|
||||
@@ -128,6 +189,9 @@ onLoad(param => {
|
||||
reportKey.value = param.reportKey
|
||||
hideResultFlag.value = param.hideResultFlag
|
||||
}
|
||||
if (param.showConfirmBtn && param.showConfirmBtn === 'true') {
|
||||
showConfirmBtn.value = true
|
||||
}
|
||||
getPdf()
|
||||
})
|
||||
|
||||
@@ -137,7 +201,16 @@ onHide(() => {
|
||||
|
||||
onUnload(() => {
|
||||
deleteTmpFile()
|
||||
destroyNativeButton()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
.confirm-btn {
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
width: 10%;
|
||||
z-index: 9999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<u-button class="btn-operation" type="primary" @click="submitTask()">提交任务单</u-button>
|
||||
<u-button class="btn-operation" type="primary" @click="submitTask()">数据上报</u-button>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<view class="field-name" v-html="selectedField.title" />
|
||||
@@ -248,6 +248,7 @@ const { proxy } = getCurrentInstance()
|
||||
|
||||
// 响应式数据定义
|
||||
const taskId = ref('')
|
||||
const configReportTemplateKey = ref('')
|
||||
const elId = nx.$helper.uuid()
|
||||
const scrollTop = ref(0) //tab标题的滚动条位置
|
||||
const menuHeight = ref(0) // 左边菜单的高度
|
||||
@@ -270,7 +271,6 @@ const currentAuncel = ref({
|
||||
})
|
||||
let selectedField = ref({})
|
||||
const groupFieldIndex = ref('') //分组的索引
|
||||
const curSample = ref({})
|
||||
const curParameterTitle = ref('选择字段分类')
|
||||
const curParameterKey = ref('all')
|
||||
const conAssayTaskId = ref('')
|
||||
@@ -546,36 +546,6 @@ const fitUpValues = () => {
|
||||
return val
|
||||
}
|
||||
|
||||
const clearFieldVal = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '清空当前字段的值,是否继续?',
|
||||
cancelColor: '#0055A2',
|
||||
confirmColor: '#0055A2',
|
||||
success: res => {
|
||||
if (res.cancel) {
|
||||
return
|
||||
}
|
||||
selectedField.value.value = ''
|
||||
//重新计算
|
||||
calcAnalysisValue(fieldGroup.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//自动填写筛上杯号
|
||||
const autoFillBhUp = val => {
|
||||
const bh = Number(val) + 1
|
||||
for (const g of fieldGroup.value) {
|
||||
for (const f of g.fields) {
|
||||
if (f.dicKey && f.dicKey === 'bh_up') {
|
||||
f.value = bh + ''
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const checkBh = () => {
|
||||
//检查杯号
|
||||
let hasHb = true
|
||||
@@ -625,36 +595,7 @@ const saveAuncelData = () => {
|
||||
}
|
||||
//获取当前重量
|
||||
let weight = currentAuncel.value.weightData
|
||||
|
||||
selectedField.value.value = weight
|
||||
const curFieldDicKey = selectedField.dicKey
|
||||
let upDownFlag = ''
|
||||
if (curFieldDicKey && curFieldDicKey !== '' && curFieldDicKey.indexOf('_') > 0) {
|
||||
upDownFlag = curFieldDicKey.substring(curFieldDicKey.lastIndexOf('_') + 1)
|
||||
}
|
||||
|
||||
//这里不修改weightDataIsToZero,在切换样品是修改
|
||||
// weightDataIsToZero.value = false;
|
||||
|
||||
//保存天平编号、天平名称、称重时间。支持筛上、筛下
|
||||
if (curFieldDicKey && curFieldDicKey.indexOf('sampleWeight') >= 0) {
|
||||
let auncelNoFieldKey = 'auncelNo'
|
||||
let measureTimeFieldKey = 'measureTime'
|
||||
if (upDownFlag && upDownFlag !== '') {
|
||||
auncelNoFieldKey += '_' + upDownFlag
|
||||
measureTimeFieldKey += '_' + upDownFlag
|
||||
}
|
||||
const auncelNoField = getFieldByKey(auncelNoFieldKey)
|
||||
if (auncelNoField !== null) {
|
||||
auncelNoField.value = currentAuncel.value.code
|
||||
}
|
||||
const measureTimeField = getFieldByKey(measureTimeFieldKey)
|
||||
if (measureTimeField !== null) {
|
||||
measureTimeField.value = nx.$dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
}
|
||||
//指派单明细上的称重时间
|
||||
curSample.value.measureTime = nx.$dayjs().format('YYYY-MM-DD HH:mm:ss')
|
||||
//计算
|
||||
try {
|
||||
calcAnalysisValue(fieldGroup.value)
|
||||
@@ -760,29 +701,6 @@ function setValueToSample() {
|
||||
})
|
||||
}
|
||||
|
||||
//提交任务单
|
||||
const submitTask = () => {
|
||||
const params = {
|
||||
businessAssayTaskId: taskId.value
|
||||
}
|
||||
const msg = '请确认所有样品数据都已保存,然后再提交指派单!是否继续?'
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: msg,
|
||||
cancelColor: '#0055A2',
|
||||
confirmColor: '#0055A2',
|
||||
success: res => {
|
||||
if (res.cancel) return
|
||||
|
||||
nx.$api.assayTask.submitTask(params).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/analysis/sample/sample-report-search'
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//自动生成杯号(仅顺序称重):第一杯:手填,后续杯 = 上一杯 + 1
|
||||
const autoGenerateCupNum = () => {
|
||||
let cupNum = 0
|
||||
@@ -809,33 +727,6 @@ const putCupNum = (cupNum, sampleIndex, lastCupNum) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
//处理筛上筛下
|
||||
// if (lastCupNum && lastCupNum === sampleIndex) {
|
||||
// //上一个杯号 == 默认杯号
|
||||
// cupNum = sampleIndex * 2 + 1
|
||||
// }
|
||||
// for (const fields of fieldGroup.value) {
|
||||
// if (typeof fields === 'undefined') continue
|
||||
// //杯号-筛下
|
||||
// for (const field of fields.fields) {
|
||||
// if (field.dicKey === cupNumKey + '_down') {
|
||||
// if (typeof field.value === 'undefined' || field.value === null || field.value === '') {
|
||||
// field.value = cupNum
|
||||
// cupNum++
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //杯号-筛上
|
||||
// for (const field of fields.fields) {
|
||||
// if (field.dicKey === cupNumKey + '_up') {
|
||||
// if (typeof field.value === 'undefined' || field.value === null || field.value === '') {
|
||||
// field.value = cupNum
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
const loadConRecoveryList = () => {
|
||||
@@ -1127,10 +1018,6 @@ const listenNumKeyboard = () => {
|
||||
const decimalPosition = selectedField.value.decimalPosition || 0
|
||||
let val = res.val
|
||||
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition)
|
||||
const dicKey = selectedField.value.dicKey
|
||||
if (dicKey && dicKey === 'bh_down') {
|
||||
autoFillBhUp(val)
|
||||
}
|
||||
calcAnalysisValue(fieldGroup.value)
|
||||
//自动跳转下一个字段
|
||||
setTimeout(() => {
|
||||
@@ -1138,6 +1025,22 @@ const listenNumKeyboard = () => {
|
||||
}, 60)
|
||||
})
|
||||
}
|
||||
const clearFieldVal = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '清空当前字段的值,是否继续?',
|
||||
cancelColor: '#0055A2',
|
||||
confirmColor: '#0055A2',
|
||||
success: res => {
|
||||
if (res.cancel) {
|
||||
return
|
||||
}
|
||||
selectedField.value.value = ''
|
||||
//重新计算
|
||||
calcAnalysisValue(fieldGroup.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
const closeNumKeyBoardListener = () => {
|
||||
uni.$off('keyboardOK')
|
||||
}
|
||||
@@ -1178,6 +1081,31 @@ const auncelDoSelect = res => {
|
||||
}
|
||||
}
|
||||
|
||||
//提交任务单
|
||||
const submitTask = () => {
|
||||
// const params = {
|
||||
// businessAssayTaskId: taskId.value
|
||||
// }
|
||||
// const msg = '请确认所有样品数据都已保存,然后再提交指派单!是否继续?'
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: msg,
|
||||
// cancelColor: '#0055A2',
|
||||
// confirmColor: '#0055A2',
|
||||
// success: res => {
|
||||
// if (res.cancel) return
|
||||
|
||||
// nx.$api.assayTask.submitTask(params).then(res => {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/analysis/sample/sample-report-search'
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
|
||||
const url = `/pages/analysis/sample/pdf-preview?businessAssayTaskId=${taskId.value}&reportKey=${configReportTemplateKey.value}&showConfirmBtn=true`
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
// 生命周期
|
||||
const { lockOrientation } = useScreenOrientation()
|
||||
|
||||
@@ -1185,6 +1113,7 @@ onLoad(param => {
|
||||
lockOrientation('landscape')
|
||||
if (param.currentTaskId) {
|
||||
taskId.value = param.currentTaskId
|
||||
configReportTemplateKey.value = param.configReportTemplateKey
|
||||
getSampleAnalysisByTaskId()
|
||||
}
|
||||
loadFieldApiData(fieldGroup.value)
|
||||
|
||||
@@ -188,7 +188,7 @@ const checkWork = () => {
|
||||
const startWork = () => {
|
||||
// if (!checkWork()) return
|
||||
uni.navigateTo({
|
||||
url: `/pages/analysis/sample/sample-work-detail?currentTaskId=${currentTask.value.id}`
|
||||
url: `/pages/analysis/sample/sample-work-detail?currentTaskId=${currentTask.value.id}&configReportTemplateKey=${currentTask.value.configReportTemplateKey}`
|
||||
})
|
||||
}
|
||||
|
||||
@@ -205,7 +205,8 @@ const switchTask = async index => {
|
||||
const getAssayTask = () => {
|
||||
rollbackContent.value = ''
|
||||
const param = {
|
||||
taskStatus: 'submit'
|
||||
taskAssignStatus: 'submitted',
|
||||
taskAssayStatusList: ['not_start', 'saved']
|
||||
// assayOper: userInfo.value.nickname
|
||||
}
|
||||
nx.$api.assayTask.getAssayTaskList(param).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user