feat:页面修改
This commit is contained in:
@@ -49,7 +49,7 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:showAuncelSelector'])
|
||||
const emit = defineEmits(['update:showAuncelSelector', 'doSelect'])
|
||||
|
||||
// 响应式数据
|
||||
const auncelList = ref([])
|
||||
@@ -64,15 +64,12 @@ const open = () => {
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
console.log('auncel-selector close触发')
|
||||
auncelList.value = []
|
||||
uni.$emit('auncelSelector_close')
|
||||
closeDeviceListener()
|
||||
emit('update:showAuncelSelector', false)
|
||||
}
|
||||
|
||||
const getPageData = () => {
|
||||
uni.showLoading({ title: '加载中...' })
|
||||
nx.$api.laboratory
|
||||
.getDeviceLaboratoryListBy({
|
||||
deviceType: 'auncel',
|
||||
@@ -93,11 +90,6 @@ const getPageData = () => {
|
||||
controlRealName: ''
|
||||
}))
|
||||
auncelList.value = dataList
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('加载天平列表失败:', err)
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -109,7 +101,7 @@ const doSelect = index => {
|
||||
return
|
||||
}
|
||||
|
||||
if (currentAuncel.controlRealName && currentAuncel.controlRealName !== userInfo.value.realname) {
|
||||
if (currentAuncel.controlRealName && currentAuncel.controlRealName !== userInfo.value.nickname) {
|
||||
uni.showToast({
|
||||
title: `当前天平正被“${currentAuncel.controlRealName}”使用,请选择其他天平!`,
|
||||
icon: 'none'
|
||||
@@ -132,15 +124,15 @@ const doSelect = index => {
|
||||
deviceCode: currentAuncel.code,
|
||||
deviceName: currentAuncel.name,
|
||||
isControl: true,
|
||||
controlRealName: userInfo.value.realname
|
||||
controlRealName: userInfo.value.nickname
|
||||
}
|
||||
}
|
||||
|
||||
const sendControl = () => {
|
||||
const controlData = JSON.stringify(controlDevice)
|
||||
nx.$measure.send(controlData)
|
||||
console.log('controlDevice', controlData)
|
||||
uni.$emit('auncelSelector_doSelect', controlDevice)
|
||||
emit('update:showAuncelSelector', false)
|
||||
emit('doSelect', controlDevice)
|
||||
}
|
||||
|
||||
if (delayFlag) {
|
||||
@@ -159,7 +151,7 @@ const releaseDeviceControl = deviceId => {
|
||||
data: {
|
||||
deviceId,
|
||||
isControl: false,
|
||||
controlRealName: userInfo.value.realname
|
||||
controlRealName: userInfo.value.nickname
|
||||
}
|
||||
}
|
||||
nx.$measure.send(JSON.stringify(controlDevice))
|
||||
|
||||
@@ -54,7 +54,10 @@ const execSendSample = data => {
|
||||
return request({
|
||||
url: '/qms/bus/qmsBusAssayTask/sendSample',
|
||||
method: 'POST',
|
||||
data: data
|
||||
data: data,
|
||||
custom: {
|
||||
showSuccess: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
42
pages.json
42
pages.json
@@ -160,13 +160,6 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-look",
|
||||
"style": {
|
||||
"navigationBarTitleText": "找样理样",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-receive",
|
||||
"style": {
|
||||
@@ -174,13 +167,6 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-weigh",
|
||||
"style": {
|
||||
"navigationBarTitleText": "样品称重",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-work-list",
|
||||
"style": {
|
||||
@@ -209,20 +195,6 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/auncel/auncel-weigh",
|
||||
"style": {
|
||||
"navigationBarTitleText": "样品称重",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/auncel/auncel-select",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选择天平",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-report",
|
||||
"style": {
|
||||
@@ -237,20 +209,6 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-send",
|
||||
"style": {
|
||||
"navigationBarTitleText": "送样",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-review",
|
||||
"style": {
|
||||
"navigationBarTitleText": "样重复核",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/analysis/sample/sample-print",
|
||||
"style": {
|
||||
|
||||
@@ -1,839 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-navbar
|
||||
title-color="#fff"
|
||||
title-width="360"
|
||||
back-icon-color="#ffffff"
|
||||
:back-text-style="{ color: '#fff' }"
|
||||
back-text="返回"
|
||||
title="样品称重"
|
||||
:border-bottom="false"
|
||||
:custom-back="customBack"
|
||||
:background="{ 'background-color': '#0055A2' }"
|
||||
></u-navbar>
|
||||
|
||||
<u-row class="content-title" gutter="16">
|
||||
<u-col span="3">
|
||||
<view class="content-title-name">
|
||||
<text>待称重样品</text>
|
||||
</view>
|
||||
<u-gap height="10" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<view class="content-title-name">
|
||||
<text>{{ currentAuncel.code === '' ? '电子天平' : currentAuncel.code }}</text>
|
||||
</view>
|
||||
<u-gap height="10" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="3">
|
||||
<view class="content-title-name">
|
||||
<text>已称重样品</text>
|
||||
</view>
|
||||
<u-gap height="10" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
</u-row>
|
||||
|
||||
<u-row gutter="16" class="content-main-height" align="top">
|
||||
<u-col span="3">
|
||||
<scroll-view scroll-y scroll-with-animation class="content-main-left" :scroll-top="scrollTop">
|
||||
<view
|
||||
v-for="(sample, index) in notWeighSampleList"
|
||||
:key="index"
|
||||
class="u-tab-item"
|
||||
:class="[current == index ? 'u-tab-item-active' : '']"
|
||||
:data-current="index"
|
||||
@tap.stop="swichSample(index)"
|
||||
>
|
||||
<u-row gutter="20" style="width: 100%">
|
||||
<u-col span="3" style="padding: 0rpx">
|
||||
<view>
|
||||
<text>【{{ sample.sort }}】</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="9">
|
||||
<view>
|
||||
<text>{{ sample.sampleCode }}</text>
|
||||
</view>
|
||||
<view style="padding-top: 20rpx">
|
||||
<text>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.goodsName }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="content-main-left-operation">
|
||||
<u-row>
|
||||
<u-col span="2"></u-col>
|
||||
<u-col span="8">
|
||||
<view>
|
||||
<view style="padding: 20rpx; text-align: right">
|
||||
<text style="font-size: 30rpx; height: 50rpx">顺序称重:</text>
|
||||
<u-switch
|
||||
v-model="orderWeighChecked"
|
||||
active-color="#19be6b"
|
||||
inactive-color="#eee"
|
||||
@change="orderWeighChange"
|
||||
></u-switch>
|
||||
</view>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="2"></u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<view class="content-main-height">
|
||||
<view class="auncel-container">
|
||||
<view class="auncel">
|
||||
<view class="auncel-title">
|
||||
<view style="padding-top: 40rpx; height: 100rpx; width: 100%; text-align: center">
|
||||
<text style="font-size: 44rpx; font-weight: 300"
|
||||
>【{{ currentSample.sort }}】 {{ currentSample.dataSourceType | getDataSourceTypeShow }}</text
|
||||
>
|
||||
</view>
|
||||
|
||||
<view style="padding-top: 30rpx; height: 100rpx; width: 100%; text-align: center">
|
||||
<text style="font-size: 44rpx; font-weight: 300">{{ currentSample.sampleCode }}</text>
|
||||
</view>
|
||||
<view
|
||||
style="
|
||||
padding-top: 20rpx;
|
||||
padding-left: 140rpx;
|
||||
padding-right: 140rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
"
|
||||
>
|
||||
<block v-if="currentSample.dataSourceType">
|
||||
<u-row v-if="currentSample.dataSourceType == 2 || currentSample.dataSourceType == 3">
|
||||
<u-col span="1"></u-col>
|
||||
<u-col span="3">
|
||||
<u-input
|
||||
style="color: #3b4144; background-color: #ffffff"
|
||||
v-model="currentCupNum"
|
||||
type="number"
|
||||
border="border"
|
||||
:disabled="checkCupNumReadonly"
|
||||
placeholder="杯号"
|
||||
/>
|
||||
</u-col>
|
||||
<u-col span="2">
|
||||
<text style="width: 100%; text-align: left">号杯</text>
|
||||
</u-col>
|
||||
<u-col span="4">
|
||||
<u-input
|
||||
style="color: #3b4144; background-color: #ffffff"
|
||||
v-model="currentSample.remarks"
|
||||
type="number"
|
||||
border="border"
|
||||
placeholder="样重比例"
|
||||
/>
|
||||
</u-col>
|
||||
<u-col span="2">
|
||||
<text style="width: 100%; text-align: left">%</text>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-row v-else>
|
||||
<u-col span="2"></u-col>
|
||||
<u-col span="7">
|
||||
<u-input
|
||||
style="color: #3b4144; background-color: #ffffff"
|
||||
v-model="currentCupNum"
|
||||
type="number"
|
||||
border="border"
|
||||
:disabled="checkCupNumReadonly"
|
||||
placeholder="杯号"
|
||||
/>
|
||||
</u-col>
|
||||
<u-col span="3">
|
||||
<text style="width: 100%; text-align: left">号杯</text>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="auncel-weight">
|
||||
<view class="weight">
|
||||
<view
|
||||
:class="
|
||||
currentAuncel.weightStable == 0
|
||||
? 'weight-data-yellow'
|
||||
: currentAuncel.weightStable == 1
|
||||
? 'weight-data'
|
||||
: 'weight-data-warning'
|
||||
"
|
||||
@click="selectAuncel"
|
||||
>
|
||||
{{ currentAuncel.weightData }}
|
||||
</view>
|
||||
<view class="weight-unit">{{ currentAuncel.weightUnit }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view style="padding: 0rpx 60rpx 10rpx 60rpx">
|
||||
<block v-if="currentAuncel.code !== ''">
|
||||
<u-button
|
||||
style="height: 140rpx; font-size: 80rpx"
|
||||
type="success"
|
||||
:disabled="confirmWeightDisabled"
|
||||
shape="circle"
|
||||
@click="confirm"
|
||||
>确认采集</u-button
|
||||
>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="3">
|
||||
<view class="content-main-height">
|
||||
<scroll-view scroll-y scroll-with-animation class="content-main-right" :scroll-top="scrollTop">
|
||||
<view
|
||||
v-for="(sample, index) in finishWeighSampleList"
|
||||
:key="index"
|
||||
class="u-tab-item"
|
||||
style="height: 240rpx"
|
||||
>
|
||||
<u-row gutter="20" style="width: 100%">
|
||||
<u-col span="3" style="padding: 0rpx">
|
||||
<view>
|
||||
<text>【{{ sample.sort }}】</text>
|
||||
</view>
|
||||
<view style="padding-top: 20rpx">
|
||||
<text>{{ sample.cupNum }}号杯</text>
|
||||
</view>
|
||||
<view v-if="sample.remarks" style="padding-top: 20rpx">
|
||||
<text>{{ sample.remarks }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="9">
|
||||
<view>
|
||||
<text>{{ sample.sampleCode }}</text>
|
||||
</view>
|
||||
<view style="padding-top: 20rpx">
|
||||
<text>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.goodsName }}</text>
|
||||
</view>
|
||||
<view style="padding-top: 20rpx">
|
||||
<text style="padding-left: 20rpx">{{ sample.sampleWeight }} g</text>
|
||||
<u-button style="margin-left: 20rpx" size="mini" type="error" @click="weighRevoke(sample.id)"
|
||||
>撤销</u-button
|
||||
>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="content-main-right-operation">
|
||||
<u-row>
|
||||
<u-col span="2"></u-col>
|
||||
<u-col span="8">
|
||||
<u-button
|
||||
:disabled="finishWeighSampleList.length == 0"
|
||||
class="btn-operation"
|
||||
type="success"
|
||||
@click="submit"
|
||||
>立即提交</u-button
|
||||
>
|
||||
</u-col>
|
||||
<u-col span="2"></u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: 0, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
orderWeighChecked: true, //顺序称重
|
||||
weightDataIsToZero: false, //重量数据是否归零
|
||||
currentCupNum: '',
|
||||
currentSample: {}, //当前样品
|
||||
currentTaskNo: '', //当前任务样品
|
||||
currentTaskType: '', //当前任务类型
|
||||
currentAuncel: {
|
||||
id: '',
|
||||
name: '',
|
||||
code: '',
|
||||
weightStable: 0,
|
||||
weightData: '请选天平',
|
||||
weightUnit: ''
|
||||
},
|
||||
allWeighSampleCount: 0,
|
||||
notWeighSampleList: [],
|
||||
finishWeighSampleList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
confirmWeightDisabled() {
|
||||
if (
|
||||
this.currentSample.sampleCode &&
|
||||
this.currentAuncel.weightStable == 1 &&
|
||||
Number(this.currentAuncel.weightData) > 0
|
||||
) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
checkCupNumReadonly() {
|
||||
if (!this.currentAuncel || this.currentAuncel.id == '') return true
|
||||
return false
|
||||
}
|
||||
},
|
||||
onLoad(param) {
|
||||
//console.log(param);
|
||||
if (param.currentTaskNo) {
|
||||
this.currentTaskNo = param.currentTaskNo
|
||||
this.currentTaskType = param.currentTaskType
|
||||
}
|
||||
if (param.currentAuncelId) {
|
||||
this.currentAuncel.id = param.currentAuncelId
|
||||
this.currentAuncel.weightData = ''
|
||||
}
|
||||
if (param.currentAuncelName) {
|
||||
this.currentAuncel.name = param.currentAuncelName
|
||||
}
|
||||
if (param.currentAuncelCode) {
|
||||
this.currentAuncel.code = param.currentAuncelCode
|
||||
}
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
},
|
||||
onShow() {
|
||||
console.log('onShow')
|
||||
|
||||
//注册websocket
|
||||
let regData = {
|
||||
msgId: this.$helper.uuid(),
|
||||
cmd: 'register',
|
||||
clientType: 'caaClient',
|
||||
data: {
|
||||
userId: this.userInfo.user_id,
|
||||
tenantId: this.userInfo.tenant_id,
|
||||
userRealName: this.userInfo.real_name
|
||||
}
|
||||
}
|
||||
this.$measure.setRegData(JSON.stringify(regData))
|
||||
this.$measure.reOpen()
|
||||
|
||||
//监听websocket返回来的数据
|
||||
//设备数据
|
||||
uni.$on('deviceData', res => {
|
||||
switch (res.deviceType) {
|
||||
case 'auncel':
|
||||
//console.log(res);
|
||||
if (this.currentAuncel.id === res.deviceId) {
|
||||
this.currentAuncel.weightData = res.weightData
|
||||
this.currentAuncel.weightUnit = res.weightUnit
|
||||
this.currentAuncel.weightStable = res.weightStable
|
||||
this.currentAuncel.isConnected = 1
|
||||
if (Number(res.weightData) == 0) {
|
||||
this.weightDataIsToZero = true
|
||||
}
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
//设备状态
|
||||
uni.$on('deviceStatus', res => {
|
||||
if (this.currentAuncel.id === res.deviceId) {
|
||||
console.log(res)
|
||||
if (res.connected == 0) {
|
||||
this.currentAuncel.weightStable = 0
|
||||
this.currentAuncel.weightData = '天平断开'
|
||||
this.currentAuncel.weightUnit = ''
|
||||
}
|
||||
}
|
||||
this.currentAuncel.isConnected = res.connected
|
||||
})
|
||||
//控制设备状态
|
||||
uni.$on('controlDevice', res => {
|
||||
if (this.currentAuncel.id === res.deviceId) {
|
||||
console.log(res)
|
||||
|
||||
this.currentAuncel.id = ''
|
||||
this.currentAuncel.name = ''
|
||||
this.currentAuncel.code = ''
|
||||
this.currentAuncel.weightStable = 0
|
||||
this.currentAuncel.weightData = '请选天平'
|
||||
this.currentAuncel.weightUnit = ''
|
||||
}
|
||||
})
|
||||
//连接断开
|
||||
uni.$on('connClose', res => {
|
||||
//重置
|
||||
this.currentAuncel.weightData = ''
|
||||
this.currentAuncel.weightUnit = ''
|
||||
this.currentAuncel.weightStable = 0
|
||||
this.currentAuncel.controlUserName = ''
|
||||
this.currentAuncel.isConnected = 0
|
||||
})
|
||||
},
|
||||
onHide() {
|
||||
console.log('onHide')
|
||||
//移除监听websocket返回来的数据
|
||||
uni.$off('deviceData')
|
||||
uni.$off('deviceStatus')
|
||||
uni.$off('controlDevice')
|
||||
uni.$off('connClose')
|
||||
},
|
||||
onUnload() {
|
||||
//取消控制
|
||||
//发送控制请求
|
||||
let controlDevice = {
|
||||
msgId: this.currentAuncel.id,
|
||||
cmd: 'controlDevice',
|
||||
clientType: 'caaClient',
|
||||
data: {
|
||||
deviceId: this.currentAuncel.id,
|
||||
isControl: false,
|
||||
controlRealName: this.userInfo.username
|
||||
}
|
||||
}
|
||||
//发送控制数据
|
||||
this.$measure.send(JSON.stringify(controlDevice))
|
||||
},
|
||||
methods: {
|
||||
//返回上一页
|
||||
customBack() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/sample/sample-weigh'
|
||||
})
|
||||
},
|
||||
//切换样品
|
||||
async swichSample(index) {
|
||||
if (index == this.current) return
|
||||
if (this.orderWeighChecked) return //顺序称重不允许选中
|
||||
this.current = index
|
||||
// 如果为0,意味着尚未初始化
|
||||
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||||
await this.getElRect('menu-scroll-view', 'menuHeight')
|
||||
await this.getElRect('u-tab-item', 'menuItemHeight')
|
||||
}
|
||||
// 将菜单菜单活动item垂直居中
|
||||
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
|
||||
this.currentSample = this.notWeighSampleList[index]
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
getElRect(elClass, dataVal) {
|
||||
new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.' + elClass)
|
||||
.fields({ size: true }, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
this.getElRect(elClass)
|
||||
}, 10)
|
||||
return
|
||||
}
|
||||
this[dataVal] = res.height
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
//保存数据
|
||||
if (!this.weightDataIsToZero) {
|
||||
this.$helper.showToast({
|
||||
title: '天平必须先回零!'
|
||||
})
|
||||
return
|
||||
}
|
||||
//获取当前重量
|
||||
let weight = this.currentAuncel.weightData
|
||||
//获取当前样品
|
||||
let sample = this.notWeighSampleList[this.current]
|
||||
//判断杯号
|
||||
if (this.currentCupNum == null || typeof this.currentCupNum == 'undefined') this.currentCupNum = ''
|
||||
if (this.currentCupNum === '') {
|
||||
this.$helper.showToast({
|
||||
title: '杯号不允许为空!'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (this.current < this.notWeighSampleList.length - 1) {
|
||||
this.currentSample = this.notWeighSampleList[this.current + 1]
|
||||
}
|
||||
//杯号
|
||||
sample.cupNum = this.currentCupNum
|
||||
//删除当前样品
|
||||
this.notWeighSampleList.splice(this.current, 1)
|
||||
//样品重量赋值
|
||||
sample.sampleWeight = weight
|
||||
//天平编号赋值
|
||||
sample.auncelNo = this.currentAuncel.code
|
||||
if (sample.remarks) {
|
||||
sample.remarks = sample.remarks + '%'
|
||||
}
|
||||
this.$u.api
|
||||
.auncelWeigh(sample)
|
||||
.then(res => {
|
||||
//this.finishWeighSampleList.push(sample);
|
||||
//确认采集重量后,归零设为false
|
||||
this.weightDataIsToZero = false
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
if (this.orderWeighChecked) {
|
||||
this.current = 0
|
||||
} else {
|
||||
this.current = -1
|
||||
this.currentSample = {}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
if (this.notWeighSampleList.length != 0) {
|
||||
this.$helper.showToast({
|
||||
title: '当前任务“' + this.currentTaskNo + '”尚未完成称重!'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定提交数据?',
|
||||
cancelColor: '#0055A2',
|
||||
confirmColor: '#0055A2',
|
||||
success: res => {
|
||||
if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
return
|
||||
}
|
||||
//显示loading
|
||||
uni.showLoading({
|
||||
title: '正在提交...'
|
||||
})
|
||||
this.$u.api
|
||||
.weighBatchSubmitByTaskNo(this.currentTaskNo)
|
||||
.then(res => {
|
||||
this.$helper.showToast({
|
||||
title: '提交成功!'
|
||||
})
|
||||
uni.redirectTo({
|
||||
url: '/pages/sample/sample-weigh'
|
||||
})
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading()
|
||||
this.$helper.showToast({
|
||||
title: '提交失败!'
|
||||
})
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
/**
|
||||
if(this.currentTaskType == 4) { //临时样
|
||||
let ids = [];
|
||||
this.finishWeighSampleList.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
|
||||
this.$u.api
|
||||
.weighBatchSubmitByIds(ids.join(","))
|
||||
.then(res => {
|
||||
this.$helper.showToast({
|
||||
title: '提交成功!'
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false;
|
||||
console.log(err);
|
||||
});
|
||||
} else {//其他批量秤完提交
|
||||
//if(this.allWeighSampleCount == this.finishWeighSampleList.length) {
|
||||
console.log(this.notWeighSampleList)
|
||||
if(this.notWeighSampleList.length == 0) {
|
||||
this.$u.api
|
||||
.weighBatchSubmitByTaskNo(this.currentTaskNo)
|
||||
.then(res => {
|
||||
this.$helper.showToast({
|
||||
title: '提交成功!'
|
||||
});
|
||||
uni.redirectTo({
|
||||
url: '/pages/sample/sample-weigh'
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false;
|
||||
console.log(err);
|
||||
});
|
||||
} else {
|
||||
this.$helper.showToast({
|
||||
title: '当前任务“'+this.currentTaskNo+'”尚未完成称重!'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
**/
|
||||
},
|
||||
weighRevoke(id) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定撤销当前数据?',
|
||||
cancelColor: '#0055A2',
|
||||
confirmColor: '#0055A2',
|
||||
success: res => {
|
||||
if (!res.confirm) {
|
||||
console.log('用户点击取消')
|
||||
return
|
||||
}
|
||||
this.$u.api
|
||||
.auncelWeighRevoke(id)
|
||||
.then(res => {
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
if (this.orderWeighChecked) {
|
||||
this.current = 0
|
||||
} else {
|
||||
this.current = -1
|
||||
this.currentSample = {}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//自动生成杯号(仅顺序称重):第一杯:手填,后续杯 = 上一杯 + 1
|
||||
autoGenerateCupNum() {
|
||||
if (!this.orderWeighChecked) return
|
||||
//取上一杯
|
||||
this.currentCupNum = ''
|
||||
let preSample = null
|
||||
if (this.finishWeighSampleList && this.finishWeighSampleList.length > 0) preSample = this.finishWeighSampleList[0]
|
||||
if (preSample == null) {
|
||||
return
|
||||
}
|
||||
const cupNum = preSample.cupNum
|
||||
if (!isNaN(cupNum)) this.currentCupNum = Number(cupNum) + 1
|
||||
},
|
||||
getAssayTaskDetail(taskNo) {
|
||||
this.notWeighSampleList = []
|
||||
this.finishWeighSampleList = []
|
||||
this.$u.api
|
||||
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
|
||||
.then(res => {
|
||||
let dataList = res.result
|
||||
this.allWeighSampleCount = dataList.length
|
||||
dataList.forEach((item, index) => {
|
||||
if (item.weightSubmitStatus == 0) {
|
||||
this.notWeighSampleList.push(item)
|
||||
} else if (item.weightSubmitStatus == 1) {
|
||||
this.finishWeighSampleList.unshift(item)
|
||||
//this.finishWeighSampleList.push(item);
|
||||
}
|
||||
})
|
||||
this.showLoading = false
|
||||
//console.log(this.currentSample);
|
||||
if (this.notWeighSampleList[0]) {
|
||||
if (this.orderWeighChecked) {
|
||||
this.current = 0
|
||||
this.currentSample = this.notWeighSampleList[0]
|
||||
} else {
|
||||
this.current = -1
|
||||
this.currentSample = {}
|
||||
}
|
||||
}
|
||||
this.autoGenerateCupNum() //计算生成当前杯号
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
selectAuncel() {
|
||||
if (this.currentAuncel.weightData === '请选天平') {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/auncel/auncel-select?currentTaskNo=' +
|
||||
this.currentTaskNo +
|
||||
'¤tTaskType=' +
|
||||
this.currentTaskType
|
||||
})
|
||||
}
|
||||
},
|
||||
orderWeighChange(e) {
|
||||
if (e && this.notWeighSampleList.length > 0) {
|
||||
//this.current = 0;
|
||||
//this.currentSample = this.notWeighSampleList[0];
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
return
|
||||
}
|
||||
this.current = -1
|
||||
this.currentSample = {}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
getDataSourceTypeShow(val) {
|
||||
if (val == 2) return '【筛上】'
|
||||
if (val == 3) return '【筛下】'
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content-title {
|
||||
height: 110rpx;
|
||||
width: 100%;
|
||||
font-size: 46rpx;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.content-title-name {
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content-main-height {
|
||||
height: calc(100vh - 250rpx);
|
||||
}
|
||||
|
||||
.content-main-left {
|
||||
height: calc(100vh - 410rpx);
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
height: 160rpx;
|
||||
background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
border-width: 4rpx;
|
||||
border-bottom: dotted;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #0055a2;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
|
||||
height: 32rpx;
|
||||
left: 0;
|
||||
top: 39rpx;
|
||||
}
|
||||
|
||||
.content-main-left-operation {
|
||||
height: 160rpx;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.content-main-right {
|
||||
height: calc(100vh - 410rpx);
|
||||
}
|
||||
|
||||
.content-main-right-operation {
|
||||
height: 160rpx;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.btn-operation {
|
||||
height: 100rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.auncel-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.auncel {
|
||||
width: 800rpx;
|
||||
height: 800rpx;
|
||||
background-image: url(../../static/images/auncel.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100%;
|
||||
}
|
||||
|
||||
.auncel-title {
|
||||
width: 100%;
|
||||
height: 420rpx;
|
||||
}
|
||||
|
||||
.auncel-weight {
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.weight {
|
||||
width: 100%;
|
||||
min-width: 200px;
|
||||
height: 200rpx;
|
||||
padding: 0 30rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
//background-color: #2c405a;
|
||||
}
|
||||
|
||||
.weight-data {
|
||||
flex-grow: 1;
|
||||
height: 100%;
|
||||
color: #4cd964;
|
||||
text-align: right;
|
||||
line-height: 200rpx;
|
||||
letter-spacing: 4rpx;
|
||||
font-size: 150rpx;
|
||||
font-family: zzjc-lcd;
|
||||
}
|
||||
|
||||
.weight-data-yellow {
|
||||
flex-grow: 1;
|
||||
height: 100%;
|
||||
color: #ffff00;
|
||||
text-align: right;
|
||||
line-height: 200rpx;
|
||||
letter-spacing: 4rpx;
|
||||
font-size: 150rpx;
|
||||
font-family: zzjc-lcd;
|
||||
}
|
||||
|
||||
.weight-data-warning {
|
||||
flex-grow: 1;
|
||||
height: 100%;
|
||||
color: #ff3333;
|
||||
text-align: right;
|
||||
line-height: 200rpx;
|
||||
font-size: 150rpx;
|
||||
font-family: zzjc-lcd;
|
||||
}
|
||||
|
||||
.weight-unit {
|
||||
color: #ffffff;
|
||||
font-size: 130rpx;
|
||||
line-height: 200rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,237 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<navbar-back :autoBack="false" title="任 务 单" @leftClick="customBack"></navbar-back>
|
||||
<u-row class="content-title" gutter="16">
|
||||
<u-col span="4">
|
||||
<view class="content-title-name">
|
||||
<text>任务列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-title-name">
|
||||
<text>样品列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-row class="content-main-height" gutter="16" align="top">
|
||||
<u-col span="4">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
scroll-with-animation
|
||||
class="content-main-height content-main-left"
|
||||
:scroll-top="scrollTop"
|
||||
>
|
||||
<view
|
||||
v-for="(task, index) in taskList"
|
||||
:key="index"
|
||||
class="u-tab-item"
|
||||
:class="[current == index ? 'u-tab-item-active' : '']"
|
||||
:data-current="index"
|
||||
@tap.stop="swichTask(index)"
|
||||
>
|
||||
<u-row style="width: 100%">
|
||||
<u-col span="2" style="text-align: center">
|
||||
<u-icon name="tags-fill" size="34"></u-icon>
|
||||
</u-col>
|
||||
<u-col span="10">
|
||||
<view>
|
||||
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
|
||||
</view>
|
||||
<view style="margin-top: 20rpx">
|
||||
<text>{{ task.taskName }}</text>
|
||||
</view>
|
||||
<view class="x-f" style="margin-top: 20rpx">
|
||||
<u-icon color="" name="clock"></u-icon>
|
||||
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-main-height">
|
||||
<scroll-view scroll-y scroll-with-animation class="content-main-height">
|
||||
<block v-for="(sample, index) in sampleList" :key="index">
|
||||
<view
|
||||
v-if="index == 0 || (index > 0 && sampleList[index].sort != sampleList[index - 1].sort)"
|
||||
style="padding: 10rpx; font-size: 36rpx"
|
||||
>
|
||||
<u-row>
|
||||
<u-col span="2" style="text-align: center">
|
||||
<view>
|
||||
<text>【{{ sample.sort }}】</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="10">
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.sampleName }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-line style="padding: 10rpx" color="#bbb" />
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: 0, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
taskList: [],
|
||||
sampleList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
//获取任务列表
|
||||
this.getAssayTask()
|
||||
},
|
||||
methods: {
|
||||
//返回首页
|
||||
customBack() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/analysis/index/index'
|
||||
})
|
||||
},
|
||||
//切换任务
|
||||
async swichTask(index) {
|
||||
if (index == this.current) return
|
||||
this.current = index
|
||||
// 如果为0,意味着尚未初始化
|
||||
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||||
await this.getElRect('menu-scroll-view', 'menuHeight')
|
||||
await this.getElRect('u-tab-item', 'menuItemHeight')
|
||||
}
|
||||
// 将菜单菜单活动item垂直居中
|
||||
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
|
||||
|
||||
//获取任务详情
|
||||
this.getAssayTaskDetail(this.taskList[index].taskNo)
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
getElRect(elClass, dataVal) {
|
||||
new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.' + elClass)
|
||||
.fields({ size: true }, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
this.getElRect(elClass)
|
||||
}, 10)
|
||||
return
|
||||
}
|
||||
this[dataVal] = res.height
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
},
|
||||
getAssayTask() {
|
||||
//显示loading
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
const param = {
|
||||
assayOper: this.userInfo.realname,
|
||||
operateType: 'task'
|
||||
}
|
||||
this.$u.api
|
||||
.getAssayTaskList(param)
|
||||
.then(res => {
|
||||
this.taskList = res.result
|
||||
if (this.taskList && this.taskList.length > 0) {
|
||||
this.getAssayTaskDetail(this.taskList[0].taskNo)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
getAssayTaskDetail(taskNo) {
|
||||
this.$u.api
|
||||
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
|
||||
.then(res => {
|
||||
this.sampleList = res.result
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-title {
|
||||
height: 110rpx;
|
||||
width: 100%;
|
||||
font-size: 46rpx;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.content-title-name {
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content-main-height {
|
||||
height: calc(100vh - 250rpx);
|
||||
}
|
||||
|
||||
.content-main-left {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
padding: 10rpx;
|
||||
height: 200rpx;
|
||||
background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
border-width: 4rpx;
|
||||
border-bottom: dotted;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #0055a2;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
|
||||
height: 32rpx;
|
||||
left: 0;
|
||||
top: 39rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,423 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<navbar-back :autoBack="false" title="样重复核" @leftClick="customBack"></navbar-back>
|
||||
<u-row class="content-title" gutter="16">
|
||||
<u-col span="4">
|
||||
<view class="content-title-name">
|
||||
<text>任务列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-title-name">
|
||||
<text>样品列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-row class="content-main-height" gutter="16" align="top">
|
||||
<u-col span="4">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
scroll-with-animation
|
||||
class="content-main-height content-main-left"
|
||||
:scroll-top="scrollTop"
|
||||
>
|
||||
<view
|
||||
v-for="(task, index) in taskList"
|
||||
:key="index"
|
||||
class="u-tab-item"
|
||||
:class="[current == index ? 'u-tab-item-active' : '']"
|
||||
:data-current="index"
|
||||
@tap.stop="swichTask(index)"
|
||||
>
|
||||
<u-row style="width: 100%">
|
||||
<u-col span="2" style="text-align: center">
|
||||
<u-icon name="tags-fill" size="34"></u-icon>
|
||||
</u-col>
|
||||
<u-col span="10">
|
||||
<view>
|
||||
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
|
||||
</view>
|
||||
<view style="margin-top: 20rpx">
|
||||
<text>{{ task.taskName }}</text>
|
||||
</view>
|
||||
<view class="x-f" style="margin-top: 20rpx">
|
||||
<u-icon name="clock"></u-icon>
|
||||
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-main-height">
|
||||
<scroll-view scroll-y scroll-with-animation class="content-main-right">
|
||||
<u-checkbox-group @change="checkboxGroupChange" style="width: 100%">
|
||||
<block v-for="(sample, index) in sampleList" :key="index">
|
||||
<view style="width: 100%; padding: 10rpx; font-size: 36rpx">
|
||||
<u-row>
|
||||
<u-col span="2" style="text-align: center">
|
||||
<view>
|
||||
<text>【{{ sample.sort }}】</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="4">
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text style="padding-left: 20rpx"
|
||||
>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.sampleName }}</text
|
||||
>
|
||||
</view>
|
||||
<view>
|
||||
<text v-if="sample.sampleWeight" style="padding-left: 20rpx">{{ sample.sampleWeight }} g</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="4">
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.cupNum }}号杯</text>
|
||||
</view>
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.remarks }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.measureTime | getWeightTimeShow }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="2">
|
||||
<view>
|
||||
<u-checkbox
|
||||
@change="checkboxChange"
|
||||
v-model="sample.checked"
|
||||
:label="sample.id"
|
||||
:name="sample.id"
|
||||
>
|
||||
</u-checkbox>
|
||||
<!-- <block v-if="sample.reviewCount > 0 && sample.weightSubmitStatus == 0">
|
||||
<u-button
|
||||
type="warning"
|
||||
@click="recovery(sample.id)"
|
||||
>恢复</u-button>
|
||||
</block>
|
||||
<block v-else>
|
||||
<u-button
|
||||
type="default"
|
||||
@click="review(sample.id)"
|
||||
>复核</u-button>
|
||||
</block> -->
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-line style="padding: 10rpx" color="#bbb" />
|
||||
</view>
|
||||
</block>
|
||||
</u-checkbox-group>
|
||||
</scroll-view>
|
||||
<view class="content-main-right-operation">
|
||||
<u-row>
|
||||
<u-col span="4"><!-- <u-button class="btn-operation" type="primary">原始记录单打印</u-button> --></u-col>
|
||||
<u-col span="4"
|
||||
><!-- <u-button class="btn-operation" :disabled="reviewNum > 0" type="success" >数据上报</u-button> --></u-col
|
||||
>
|
||||
<u-col span="4">
|
||||
<!-- <u-button class="btn-operation" :disabled="reviewNum == 0" type="warning" @click="taskReview">任务单退回复核</u-button> -->
|
||||
<u-button class="btn-operation" :disabled="reviewList.length <= 0" type="warning" @click="taskReviewAll"
|
||||
>任务单退回复核</u-button
|
||||
>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: 0, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
currentTaskId: '', //当前选择的任务单id
|
||||
currentTaskNo: '', //当前选中的任务编号
|
||||
reviewNum: 0, //复核数
|
||||
reviewList: [],
|
||||
taskList: [],
|
||||
sampleList: []
|
||||
}
|
||||
},
|
||||
onLoad(param) {
|
||||
if (param.currentTaskNo) {
|
||||
this.currentTaskNo = param.currentTaskNo
|
||||
}
|
||||
//获取任务列表
|
||||
this.getAssayTask()
|
||||
},
|
||||
methods: {
|
||||
//返回上一页
|
||||
customBack() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/analysis/sample/sample-report'
|
||||
})
|
||||
},
|
||||
//开始秤样
|
||||
startWeighSample() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/auncel/auncel-weigh'
|
||||
})
|
||||
},
|
||||
//切换任务
|
||||
async swichTask(index) {
|
||||
if (index == this.current) return
|
||||
this.current = index
|
||||
// 如果为0,意味着尚未初始化
|
||||
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||||
await this.getElRect('menu-scroll-view', 'menuHeight')
|
||||
await this.getElRect('u-tab-item', 'menuItemHeight')
|
||||
}
|
||||
// 将菜单菜单活动item垂直居中
|
||||
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
|
||||
|
||||
//获取任务详情
|
||||
this.currentTaskNo = this.taskList[index].taskNo
|
||||
this.currentTaskId = this.taskList[index].id
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
getElRect(elClass, dataVal) {
|
||||
new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.' + elClass)
|
||||
.fields({ size: true }, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
this.getElRect(elClass)
|
||||
}, 10)
|
||||
return
|
||||
}
|
||||
this[dataVal] = res.height
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
},
|
||||
getAssayTask() {
|
||||
//显示loading
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
// this.$u.api
|
||||
// .getAssayTaskListBy({taskStatus:2})
|
||||
const param = {
|
||||
operateType: 'review',
|
||||
taskNo: this.currentTaskNo
|
||||
}
|
||||
this.$u.api
|
||||
.getAssayTaskList(param)
|
||||
.then(res => {
|
||||
this.taskList = res.result
|
||||
this.currentTaskNo = this.taskList[0].taskNo
|
||||
this.currentTaskId = this.taskList[0].id
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
getAssayTaskDetail(taskNo) {
|
||||
this.reviewNum = 0
|
||||
this.$u.api
|
||||
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
|
||||
.then(res => {
|
||||
this.sampleList = res.result
|
||||
this.showLoading = false
|
||||
|
||||
//统计需要复核的数量
|
||||
this.sampleList.forEach(item => {
|
||||
if (item.reviewCount > 0 && item.weightSubmitStatus == 0) {
|
||||
item.checked = true
|
||||
this.reviewNum += 1
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
review(id) {
|
||||
this.$u.api
|
||||
.assayTaskDetailReview(id)
|
||||
.then(res => {
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
this.showLoading = false
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
recovery(id) {
|
||||
this.$u.api
|
||||
.assayTaskDetailRecovery(id)
|
||||
.then(res => {
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
this.showLoading = false
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
//任务单退回复核
|
||||
taskReview() {
|
||||
this.$u.api
|
||||
.assayTaskReview(this.currentTaskId)
|
||||
.then(res => {
|
||||
this.showLoading = false
|
||||
|
||||
uni.redirectTo({
|
||||
url: '/pages/sample/sample-report'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
//任务单及样品退回复核
|
||||
taskReviewAll() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定复核当前选中的样品?',
|
||||
cancelColor: '#0055A2',
|
||||
confirmColor: '#0055A2',
|
||||
success: res => {
|
||||
if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
return
|
||||
}
|
||||
console.log('确定。。。')
|
||||
//显示loading
|
||||
uni.showLoading({
|
||||
title: '退回中...'
|
||||
})
|
||||
this.$u.api
|
||||
.reviewWeightTaskByTaskIdAndSampleIds(this.currentTaskId, this.reviewList.join(','))
|
||||
.then(res => {
|
||||
uni.hideLoading()
|
||||
uni.redirectTo({
|
||||
url: '/pages/sample/sample-report'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
checkboxGroupChange(v) {
|
||||
this.reviewList = v
|
||||
this.reviewNum = v.length
|
||||
//console.log('group change', v);
|
||||
},
|
||||
checkboxChange(e) {
|
||||
/* if(e.value) {
|
||||
this.review(e.name);
|
||||
} else {
|
||||
this.recovery(e.name);
|
||||
} */
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
getWeightTimeShow(time) {
|
||||
if (time == null) return ''
|
||||
return time.split(' ')[1]
|
||||
},
|
||||
getDataSourceTypeShow(val) {
|
||||
if (val == 2) return '【筛上】'
|
||||
if (val == 3) return '【筛下】'
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-title {
|
||||
height: 110rpx;
|
||||
width: 100%;
|
||||
font-size: 46rpx;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.content-title-name {
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content-main-height {
|
||||
height: calc(100vh - 250rpx);
|
||||
}
|
||||
|
||||
.content-main-left {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
padding: 10rpx;
|
||||
height: 200rpx;
|
||||
background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
border-width: 4rpx;
|
||||
border-bottom: dotted;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #0055a2;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
|
||||
height: 32rpx;
|
||||
left: 0;
|
||||
top: 39rpx;
|
||||
}
|
||||
|
||||
.content-main-right {
|
||||
height: calc(100vh - 410rpx);
|
||||
}
|
||||
|
||||
.content-main-right-operation {
|
||||
height: 160rpx;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.btn-operation {
|
||||
height: 100rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,425 +0,0 @@
|
||||
<!--送样-->
|
||||
<template>
|
||||
<view class="page">
|
||||
<navbar-back :autoBack="false" title="样品分析-送样" @leftClick="customBack"></navbar-back>
|
||||
<u-row class="content-title" gutter="16">
|
||||
<u-col span="4">
|
||||
<view class="content-title-name">
|
||||
<text>任务列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-title-name">
|
||||
<text>样品列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-row class="content-main-height" gutter="16" align="top">
|
||||
<u-col span="4">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
scroll-with-animation
|
||||
class="content-main-height content-main-left"
|
||||
:scroll-top="scrollTop"
|
||||
>
|
||||
<view
|
||||
v-for="(task, index) in taskList"
|
||||
:key="index"
|
||||
class="u-tab-item"
|
||||
:class="[current == index ? 'u-tab-item-active' : '']"
|
||||
:data-current="index"
|
||||
@tap.stop="swichTask(index)"
|
||||
>
|
||||
<u-row style="width: 100%">
|
||||
<u-col span="2" style="text-align: center">
|
||||
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
|
||||
</u-col>
|
||||
<u-col span="10">
|
||||
<view>
|
||||
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
|
||||
</view>
|
||||
<view style="margin-top: 20rpx">
|
||||
<text>{{ task.taskName }}</text>
|
||||
</view>
|
||||
<view class="x-f" style="margin-top: 20rpx">
|
||||
<u-icon color="" name="clock"></u-icon>
|
||||
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-main-height">
|
||||
<scroll-view scroll-y scroll-with-animation class="content-main-right">
|
||||
<block v-for="(sample, index) in sampleList" :key="index">
|
||||
<view style="padding: 10rpx; font-size: 36rpx">
|
||||
<u-row>
|
||||
<u-col span="3" style="text-align: center">
|
||||
<view>
|
||||
<text>【{{ sample.sort }}】</text>
|
||||
</view>
|
||||
<!-- <u-row>-->
|
||||
<!-- <u-col span="6" style="text-align: center;">-->
|
||||
<!-- <u-checkbox v-model="sample.checked" v-if="sample.sampleProcessNo == 'F39'" @change="selectSample(sample)"></u-checkbox>-->
|
||||
<!-- </u-col>-->
|
||||
<!-- <u-col span="6" style="text-align: center;">-->
|
||||
<!-- -->
|
||||
<!-- </u-col>-->
|
||||
<!-- </u-row>-->
|
||||
</u-col>
|
||||
<u-col span="9" class="sample_desc">
|
||||
<view>
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text style="padding-left: 20rpx"
|
||||
>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.sampleName }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sample_desc_warn" v-if="sample.sampleProcessNo != 'F39'">
|
||||
状态异常:{{ sample.sampleProcessNo }}
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-line style="padding: 10rpx" color="#bbb" />
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
<view class="content-main-right-operation">
|
||||
<u-row>
|
||||
<u-col span="4"></u-col>
|
||||
<u-col span="4"></u-col>
|
||||
<u-col span="4">
|
||||
<u-button
|
||||
class="btn-operation"
|
||||
:disabled="this.taskList.length <= 0"
|
||||
type="success"
|
||||
@click="confirmReceipt"
|
||||
>确认送样</u-button
|
||||
>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: 0, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
currentTask: '', //当前选中任务
|
||||
currentTaskNo: '', //当前选中的任务编号
|
||||
currentTaskType: '', //当前任务类型
|
||||
taskList: [],
|
||||
sampleList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
//获取任务列表
|
||||
this.getAssayTask()
|
||||
},
|
||||
methods: {
|
||||
//返回首页
|
||||
customBack() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/analysis/index/index'
|
||||
})
|
||||
},
|
||||
selectSample(sample) {
|
||||
if (sample.checked) sample.checked = false
|
||||
else sample.checked = true
|
||||
},
|
||||
taskStyle(task) {
|
||||
if (task.weightTaskStatus == 0 && task.reviewCount > 0) {
|
||||
return 'red'
|
||||
}
|
||||
if (task.weightTaskStatus == 1 && task.reviewCount > 0) {
|
||||
return 'red'
|
||||
}
|
||||
if (task.weightTaskStatus == 2 && task.reviewCount > 0) {
|
||||
return 'green'
|
||||
}
|
||||
return ''
|
||||
},
|
||||
sampleStyle(sample) {
|
||||
//console.log(sample);
|
||||
if (sample.weightSubmitStatus == 0 && sample.reviewCount > 0) {
|
||||
return 'color: red'
|
||||
}
|
||||
if (sample.weightSubmitStatus == 1 && sample.reviewCount > 0) {
|
||||
//return 'color: #e0861a';
|
||||
return 'color: green'
|
||||
}
|
||||
if (sample.weightSubmitStatus == 2 && sample.reviewCount > 0) {
|
||||
return 'color: green'
|
||||
}
|
||||
return ''
|
||||
},
|
||||
//确认送样
|
||||
confirmReceipt() {
|
||||
//检查是否选中所有
|
||||
// let checkedSampleList = this.sampleList.filter(item => item.checked);
|
||||
// if (checkedSampleList.length != this.sampleList.length) {
|
||||
// this.$helper.showToast({
|
||||
// title: '样品未全部勾选,请检查!'
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
//检查是否所有样品都在F39
|
||||
const checkList = this.sampleList.filter(item => item.sampleProcessNo != 'F39')
|
||||
if (checkList.length > 0) {
|
||||
this.$helper.showToast({
|
||||
title: '部分样品状态异常,请联系技术支持人员处理!'
|
||||
})
|
||||
return
|
||||
}
|
||||
const checkedSampleList = this.sampleList
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认送样?',
|
||||
cancelColor: '#0055A2',
|
||||
confirmColor: '#0055A2',
|
||||
success: res => {
|
||||
if (res.cancel) {
|
||||
return
|
||||
}
|
||||
const sampleIdList = checkedSampleList.map(item => item.busSubCsampleId)
|
||||
const data = {
|
||||
busAssayTaskId: this.currentTask.id,
|
||||
sampleSourceType: 2,
|
||||
sampleProcessNo: 'F39',
|
||||
isGenSampleHandover: false,
|
||||
sampleIdList: sampleIdList
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '正在提交...'
|
||||
})
|
||||
this.$u.api
|
||||
.execSendSample(data)
|
||||
.then(res => {
|
||||
let msg = '发生错误,请稍后再试!'
|
||||
if (!res.success) {
|
||||
if (res.message) {
|
||||
msg = res.message
|
||||
}
|
||||
this.$helper.showToast({
|
||||
title: msg
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$helper.showToast({
|
||||
title: '操作成功!'
|
||||
})
|
||||
this.getAssayTask()
|
||||
})
|
||||
.catch(err => {
|
||||
this.$helper.showToast({
|
||||
title: '提交失败!'
|
||||
})
|
||||
console.log(err)
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//切换任务
|
||||
async swichTask(index) {
|
||||
if (index == this.current) return
|
||||
this.current = index
|
||||
// 如果为0,意味着尚未初始化
|
||||
// if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||||
// await this.getElRect('menu-scroll-view', 'menuHeight');
|
||||
// await this.getElRect('u-tab-item', 'menuItemHeight');
|
||||
// }
|
||||
// // 将菜单菜单活动item垂直居中
|
||||
// this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
|
||||
|
||||
//获取任务详情
|
||||
this.currentTask = this.taskList[index]
|
||||
this.currentTaskNo = this.taskList[index].taskNo
|
||||
this.currentTaskType = this.taskList[index].taskType
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
getElRect(elClass, dataVal) {
|
||||
new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.' + elClass)
|
||||
.fields({ size: true }, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
this.getElRect(elClass)
|
||||
}, 10)
|
||||
return
|
||||
}
|
||||
this[dataVal] = res.height
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
},
|
||||
getAssayTask() {
|
||||
//显示loading
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
const param = {
|
||||
operateType: 'send',
|
||||
assayOper: this.userInfo.realname
|
||||
}
|
||||
this.$u.api
|
||||
.getAssayTaskList(param)
|
||||
.then(res => {
|
||||
this.taskList = res.result
|
||||
if (!this.taskList || this.taskList.length == 0) {
|
||||
this.sampleList = []
|
||||
return
|
||||
}
|
||||
if (this.taskList && this.taskList.length > 0) {
|
||||
this.current = 0
|
||||
this.currentTask = this.taskList[0]
|
||||
this.currentTaskNo = this.taskList[0].taskNo
|
||||
this.currentTaskType = this.taskList[0].taskType
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
getAssayTaskDetail(taskNo) {
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
const param = {
|
||||
taskNo: taskNo,
|
||||
waiting_receive: '1' //标记是收样
|
||||
}
|
||||
this.$u.api
|
||||
.getAssayTaskDetailListByTaskNo(param)
|
||||
.then(res => {
|
||||
const list = res.result
|
||||
list.forEach(item => {
|
||||
item.checked = false
|
||||
})
|
||||
this.sampleList = list
|
||||
this.showLoading = false
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
getDataSourceTypeShow(val) {
|
||||
if (val == 2) return '【筛上】'
|
||||
if (val == 3) return '【筛下】'
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-title {
|
||||
height: 110rpx;
|
||||
width: 100%;
|
||||
font-size: 46rpx;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.content-title-name {
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content-main-height {
|
||||
height: calc(100vh - 250rpx);
|
||||
}
|
||||
|
||||
.content-main-left {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
padding: 10rpx;
|
||||
height: 200rpx;
|
||||
background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
border-width: 4rpx;
|
||||
border-bottom: dotted;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #0055a2;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
|
||||
height: 32rpx;
|
||||
left: 0;
|
||||
top: 39rpx;
|
||||
}
|
||||
|
||||
.content-main-right {
|
||||
height: calc(100vh - 410rpx);
|
||||
}
|
||||
|
||||
.content-main-right-operation {
|
||||
height: 160rpx;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.btn-operation {
|
||||
height: 100rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.sample_desc {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: nowrap; /* 禁止换行 */
|
||||
justify-content: space-between !important;
|
||||
padding-right: 15px !important;
|
||||
}
|
||||
|
||||
.sample_desc_warn {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@@ -1,319 +0,0 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<navbar-back :autoBack="false" title="样品称重" @leftClick="customBack"></navbar-back>
|
||||
<u-row class="content-title" gutter="16">
|
||||
<u-col span="4">
|
||||
<view class="content-title-name">
|
||||
<text>任务列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-title-name">
|
||||
<text>样品列表</text>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-row class="content-main-height" gutter="16" align="top">
|
||||
<u-col span="4">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
scroll-with-animation
|
||||
class="content-main-height content-main-left"
|
||||
:scroll-top="scrollTop"
|
||||
>
|
||||
<view
|
||||
v-for="(task, index) in taskList"
|
||||
:key="index"
|
||||
class="u-tab-item"
|
||||
:class="[current == index ? 'u-tab-item-active' : '']"
|
||||
:data-current="index"
|
||||
@tap.stop="swichTask(index)"
|
||||
>
|
||||
<u-row style="width: 100%">
|
||||
<u-col span="2" style="text-align: center">
|
||||
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
|
||||
</u-col>
|
||||
<u-col span="10">
|
||||
<view>
|
||||
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
|
||||
</view>
|
||||
<view style="margin-top: 20rpx">
|
||||
<text>{{ task.taskName }}</text>
|
||||
</view>
|
||||
<view class="x-f" style="margin-top: 20rpx">
|
||||
<u-icon name="clock"></u-icon>
|
||||
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
<view class="content-main-height">
|
||||
<scroll-view scroll-y scroll-with-animation class="content-main-right">
|
||||
<block v-for="(sample, index) in sampleList" :key="index">
|
||||
<view v-if="currentTask.reviewCount == sample.reviewCount" style="padding: 10rpx; font-size: 36rpx">
|
||||
<u-row>
|
||||
<u-col span="2" style="text-align: center">
|
||||
<view>
|
||||
<text>【{{ sample.sort }}】</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="10">
|
||||
<view>
|
||||
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text style="padding-left: 20rpx"
|
||||
>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.sampleName }}</text
|
||||
>
|
||||
</view>
|
||||
<block v-if="sample.sampleWeight && sample.weightSubmitStatus != 0">
|
||||
<view>
|
||||
<text v-if="sample.sampleWeight" style="padding-left: 20rpx">{{ sample.sampleWeight }} g</text>
|
||||
</view>
|
||||
</block>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-line style="padding: 10rpx" color="#bbb" />
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
<view class="content-main-right-operation">
|
||||
<u-row>
|
||||
<u-col span="4"></u-col>
|
||||
<u-col span="4"></u-col>
|
||||
<u-col span="4">
|
||||
<u-button
|
||||
class="btn-operation"
|
||||
:disabled="this.taskList.length <= 0"
|
||||
type="success"
|
||||
@click="startWeighSample"
|
||||
>开始秤样</u-button
|
||||
>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: 0, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
menuItemHeight: 0, // 左边菜单item的高度
|
||||
currentTask: '', //当前选中任务
|
||||
currentTaskNo: '', //当前选中的任务编号
|
||||
currentTaskType: '', //当前任务类型
|
||||
taskList: [],
|
||||
sampleList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
//获取任务列表
|
||||
this.getAssayTask()
|
||||
},
|
||||
methods: {
|
||||
//返回首页
|
||||
customBack() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/analysis/index/index'
|
||||
})
|
||||
},
|
||||
taskStyle(task) {
|
||||
if (task.weightTaskStatus == 0 && task.reviewCount > 0) {
|
||||
return 'red'
|
||||
}
|
||||
if (task.weightTaskStatus == 1 && task.reviewCount > 0) {
|
||||
return 'red'
|
||||
}
|
||||
if (task.weightTaskStatus == 2 && task.reviewCount > 0) {
|
||||
return 'green'
|
||||
}
|
||||
return ''
|
||||
},
|
||||
sampleStyle(sample) {
|
||||
//console.log(sample);
|
||||
if (sample.weightSubmitStatus == 0 && sample.reviewCount > 0) {
|
||||
return 'color: red'
|
||||
}
|
||||
if (sample.weightSubmitStatus == 1 && sample.reviewCount > 0) {
|
||||
//return 'color: #e0861a';
|
||||
return 'color: green'
|
||||
}
|
||||
if (sample.weightSubmitStatus == 2 && sample.reviewCount > 0) {
|
||||
return 'color: green'
|
||||
}
|
||||
return ''
|
||||
},
|
||||
//开始秤样
|
||||
startWeighSample() {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/auncel/auncel-weigh?currentTaskNo=' + this.currentTaskNo + '¤tTaskType=' + this.currentTaskType
|
||||
})
|
||||
},
|
||||
//切换任务
|
||||
async swichTask(index) {
|
||||
if (index == this.current) return
|
||||
this.current = index
|
||||
// 如果为0,意味着尚未初始化
|
||||
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||||
await this.getElRect('menu-scroll-view', 'menuHeight')
|
||||
await this.getElRect('u-tab-item', 'menuItemHeight')
|
||||
}
|
||||
// 将菜单菜单活动item垂直居中
|
||||
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
|
||||
|
||||
//获取任务详情
|
||||
this.currentTask = this.taskList[index]
|
||||
this.currentTaskNo = this.taskList[index].taskNo
|
||||
this.currentTaskType = this.taskList[index].taskType
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
},
|
||||
// 获取一个目标元素的高度
|
||||
getElRect(elClass, dataVal) {
|
||||
new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.' + elClass)
|
||||
.fields({ size: true }, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
this.getElRect(elClass)
|
||||
}, 10)
|
||||
return
|
||||
}
|
||||
this[dataVal] = res.height
|
||||
})
|
||||
.exec()
|
||||
})
|
||||
},
|
||||
getAssayTask() {
|
||||
//显示loading
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
const param = {
|
||||
operateType: 'weight',
|
||||
assayOper: this.userInfo.realname
|
||||
}
|
||||
this.$u.api
|
||||
.getAssayTaskList(param)
|
||||
.then(res => {
|
||||
this.taskList = res.result
|
||||
|
||||
if (this.taskList && this.taskList.length > 0) {
|
||||
this.currentTask = this.taskList[0]
|
||||
this.currentTaskNo = this.taskList[0].taskNo
|
||||
this.currentTaskType = this.taskList[0].taskType
|
||||
this.getAssayTaskDetail(this.currentTaskNo)
|
||||
}
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
getAssayTaskDetail(taskNo) {
|
||||
this.$u.api
|
||||
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
|
||||
.then(res => {
|
||||
this.sampleList = res.result
|
||||
this.showLoading = false
|
||||
})
|
||||
.catch(err => {
|
||||
this.showLoading = false
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
getDataSourceTypeShow(val) {
|
||||
if (val == 2) return '【筛上】'
|
||||
if (val == 3) return '【筛下】'
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-title {
|
||||
height: 110rpx;
|
||||
width: 100%;
|
||||
font-size: 46rpx;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.content-title-name {
|
||||
padding: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content-main-height {
|
||||
height: calc(100vh - 250rpx);
|
||||
}
|
||||
|
||||
.content-main-left {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
padding: 10rpx;
|
||||
height: 200rpx;
|
||||
background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
border-width: 4rpx;
|
||||
border-bottom: dotted;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
position: relative;
|
||||
color: #0055a2;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.u-tab-item-active::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
|
||||
height: 32rpx;
|
||||
left: 0;
|
||||
top: 39rpx;
|
||||
}
|
||||
|
||||
.content-main-right {
|
||||
height: calc(100vh - 410rpx);
|
||||
}
|
||||
|
||||
.content-main-right-operation {
|
||||
height: 160rpx;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.btn-operation {
|
||||
height: 100rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@
|
||||
<u-input
|
||||
v-if="
|
||||
field.type == 'input' &&
|
||||
(field.decimalCount == null || field.decimalCount == '' || Number(field.decimalCount == null) < 0)
|
||||
(field.decimalCount == null || field.decimalCount == '' || Number(field.decimalCount) < 0)
|
||||
"
|
||||
v-model="field.value"
|
||||
clearable
|
||||
@@ -29,7 +29,7 @@
|
||||
/>
|
||||
<!--数字,限制小数位数-->
|
||||
<u-input
|
||||
v-if="field.type == 'input' && field.decimalCount != null && Number(field.decimalCount == null) >= 0"
|
||||
v-if="field.type == 'input' && field.decimalCount != null && Number(field.decimalCount) >= 0"
|
||||
type="number"
|
||||
clearable
|
||||
@blur="event => checkDecimal(event, field)"
|
||||
@@ -77,44 +77,54 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import request from '@/nx/request'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { calcAnalysisValue } from '@/nx/helper/calcAnalysisValue'
|
||||
import nx from '@/nx'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
title: '编辑指派单',
|
||||
taskInstance: {},
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
currentTaskNo: '', //当前任务样品
|
||||
showDicPicker: false,
|
||||
curDate: Number(new Date()),
|
||||
//字段值对象
|
||||
formValue: {},
|
||||
//后端返回的字段结构
|
||||
sourceFormFields: [],
|
||||
//处理后的字段结构
|
||||
formFields: [],
|
||||
sampleList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dynamicFieldPlaceholder(field) {
|
||||
return '请输入'
|
||||
}
|
||||
},
|
||||
onLoad(param) {
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
// ========== data ==========
|
||||
|
||||
// 标题
|
||||
const title = ref('编辑指派单')
|
||||
// 表单模型
|
||||
const taskInstance = ref({})
|
||||
// tab标题的滚动条位置
|
||||
const scrollTop = ref(0)
|
||||
// 当前任务样品
|
||||
const currentTaskNo = ref('')
|
||||
// 字典选择器显示
|
||||
const showDicPicker = ref(false)
|
||||
// 当前日期(用于日期选择器)
|
||||
const curDate = ref(Number(new Date()))
|
||||
// 字段值对象
|
||||
const formValue = ref({})
|
||||
// 后端返回的字段结构
|
||||
const sourceFormFields = ref([])
|
||||
// 处理后的字段结构
|
||||
const formFields = ref([])
|
||||
// 样品列表
|
||||
const sampleList = ref([])
|
||||
|
||||
// 表单引用
|
||||
const uForm = ref(null)
|
||||
|
||||
// 页面加载
|
||||
onLoad(param => {
|
||||
if (param.currentTaskNo) {
|
||||
this.currentTaskNo = param.currentTaskNo
|
||||
currentTaskNo.value = param.currentTaskNo
|
||||
}
|
||||
this.title = '样品分析-任务指派单:' + this.currentTaskNo
|
||||
this.loadHeadFieldsAndValueByTaskNo()
|
||||
this.getSampleList(this.currentTaskNo)
|
||||
},
|
||||
methods: {
|
||||
handleFieldClick(field) {
|
||||
title.value = '样品分析-任务指派单:' + currentTaskNo.value
|
||||
loadHeadFieldsAndValueByTaskNo()
|
||||
getSampleList(currentTaskNo.value)
|
||||
})
|
||||
|
||||
// ========== methods ==========
|
||||
|
||||
// 点击字段(打开选择器)
|
||||
function handleFieldClick(field) {
|
||||
if (field.type == 'date') {
|
||||
if (field.fillingWay == '1') {
|
||||
field.showPicker = true
|
||||
@@ -122,33 +132,41 @@ export default {
|
||||
return
|
||||
}
|
||||
field.showPicker = true
|
||||
},
|
||||
checkFeadToDetailField(headToDetailField) {
|
||||
}
|
||||
|
||||
// 判断是否需要同步到明细字段(加粗显示)
|
||||
function checkFeadToDetailField(headToDetailField) {
|
||||
if (headToDetailField && headToDetailField.trim() != '') {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
getSampleList(taskNo) {
|
||||
this.$u.api
|
||||
}
|
||||
|
||||
// 获取样品列表
|
||||
function getSampleList(taskNo) {
|
||||
nx.$api.assayTask
|
||||
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
|
||||
.then(res => {
|
||||
this.sampleList = res.result
|
||||
sampleList.value = res.result
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
},
|
||||
//返回上一页
|
||||
// customBack() {
|
||||
// uni.redirectTo({
|
||||
// url: "/pages/sample/sample-work-detail"
|
||||
// });
|
||||
// },
|
||||
navRightClick() {},
|
||||
//处理小数位数:补0或去除多余位数
|
||||
checkDecimal(e, field) {
|
||||
}
|
||||
|
||||
// 返回上一页(原注释保留,未启用)
|
||||
// function customBack() {
|
||||
// uni.redirectTo({
|
||||
// url: "/pages/sample/sample-work-detail"
|
||||
// });
|
||||
// }
|
||||
|
||||
// 右上角导航点击(空实现)
|
||||
function navRightClick() {}
|
||||
|
||||
// 处理小数位数:补0或去除多余位数
|
||||
function checkDecimal(e, field) {
|
||||
if (e == '') return
|
||||
const decimalCount = field.decimalCount
|
||||
if (decimalCount == null || decimalCount == '' || isNaN(decimalCount)) return
|
||||
@@ -169,45 +187,36 @@ export default {
|
||||
} else if (length > count) {
|
||||
field.value = field.value.substring(0, pos + count)
|
||||
}
|
||||
},
|
||||
updateFieldValue(name, val) {
|
||||
for (const field of this.formFields) {
|
||||
if (field.prop == name) {
|
||||
field.value = val
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
assembleFields() {
|
||||
const me = this
|
||||
const formFields = []
|
||||
for (const field of this.sourceFormFields) {
|
||||
}
|
||||
|
||||
// 组装字段(处理默认值、初始化 picker 状态)
|
||||
function assembleFields() {
|
||||
const formFieldsArr = []
|
||||
for (const field of sourceFormFields.value) {
|
||||
//日期类型的默认值
|
||||
if (field.type == 'date') {
|
||||
const value = field.value
|
||||
field.showPicker = false
|
||||
if (value == 'curDate') {
|
||||
field.value = me.$helper.dateFormat(new Date(), 'yyyy-MM-dd')
|
||||
field.value = nx.$dayjs.format('yyyy-MM-dd')
|
||||
}
|
||||
}
|
||||
if (field.type == 'select') {
|
||||
field.showPicker = false
|
||||
}
|
||||
formFields.push(field)
|
||||
formFieldsArr.push(field)
|
||||
}
|
||||
//先序列化再转json,避免json里定义的方法丢失
|
||||
this.formFields = JSON.parse(JSON.stringify(formFields, replacer), reviver)
|
||||
formFields.value = JSON.parse(JSON.stringify(formFieldsArr, replacer), reviver)
|
||||
}
|
||||
|
||||
// this.formFields = formFields;
|
||||
},
|
||||
//绑定数据
|
||||
bindFormValue() {
|
||||
const me = this
|
||||
// 绑定数据(将 formValue 填入字段)
|
||||
function bindFormValue() {
|
||||
//formValue
|
||||
for (const field of me.formFields) {
|
||||
for (const field of formFields.value) {
|
||||
const prop = field.prop
|
||||
if (prop) {
|
||||
const value = me.formValue[prop]
|
||||
const value = formValue.value[prop]
|
||||
if (value) {
|
||||
field.value = value
|
||||
if (field.type == 'select') {
|
||||
@@ -216,52 +225,44 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//获取表单字段和值(老数据)
|
||||
loadHeadFieldsAndValueByTaskNo() {
|
||||
const me = this
|
||||
const currentTaskNo = me.currentTaskNo
|
||||
this.$u.api
|
||||
.queryHeadValueByTaskNo({ taskNo: currentTaskNo })
|
||||
}
|
||||
|
||||
// 获取表单字段和值(老数据)
|
||||
function loadHeadFieldsAndValueByTaskNo() {
|
||||
nx.$api.assayTask
|
||||
.queryHeadValueByTaskNo({ taskNo: currentTaskNo.value })
|
||||
.then(res => {
|
||||
const result = res.result
|
||||
const formConf = result.formConf
|
||||
me.sourceFormFields = eval(formConf)
|
||||
me.formValue = JSON.parse(result.formValue)
|
||||
sourceFormFields.value = eval(formConf)
|
||||
formValue.value = JSON.parse(result.formValue)
|
||||
//加载和处理表单字段
|
||||
me.assembleFields()
|
||||
assembleFields()
|
||||
//绑定数据
|
||||
me.bindFormValue()
|
||||
bindFormValue()
|
||||
//读取字段里的动态选项
|
||||
me.loadFieldApiData()
|
||||
console.log('formFields', this.formFields)
|
||||
loadFieldApiData()
|
||||
console.log('formFields', formFields.value)
|
||||
})
|
||||
.catch(err => {
|
||||
//如果没有查到数据,按配置读取新的表单字段
|
||||
me.getHeadFields()
|
||||
getHeadFields()
|
||||
})
|
||||
},
|
||||
// 获取表单字段(新数据)
|
||||
getHeadFields() {
|
||||
const me = this
|
||||
const currentTaskNo = this.currentTaskNo
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
this.$u.api
|
||||
.queryHeadFieldsByTaskNo({ taskNo: currentTaskNo })
|
||||
.then(res => {
|
||||
me.sourceFormFields = me.analysisFormAndFields(res)
|
||||
}
|
||||
|
||||
// 获取表单字段(新数据)
|
||||
function getHeadFields() {
|
||||
nx.$api.assayTask.queryHeadFieldsByTaskNo({ taskNo: currentTaskNoVal }).then(res => {
|
||||
sourceFormFields.value = analysisFormAndFields(res)
|
||||
//加载和处理表单字段
|
||||
me.assembleFields()
|
||||
assembleFields()
|
||||
//读取字段里的动态选项
|
||||
me.loadFieldApiData()
|
||||
loadFieldApiData()
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
analysisFormAndFields(formRet) {
|
||||
}
|
||||
|
||||
// 解析表单结构
|
||||
function analysisFormAndFields(formRet) {
|
||||
const fieldsArray = []
|
||||
for (const form of formRet) {
|
||||
let content = cloneDeep(form.content)
|
||||
@@ -272,12 +273,13 @@ export default {
|
||||
}
|
||||
}
|
||||
return fieldsArray
|
||||
},
|
||||
//将抬头字段值同步保存到明细字段
|
||||
saveHeadValueToDetail(onComplete) {
|
||||
}
|
||||
|
||||
// 将抬头字段值同步保存到明细字段
|
||||
function saveHeadValueToDetail(onComplete) {
|
||||
//循环抬头字段,提取需哟保存到明细的字段
|
||||
const conf = []
|
||||
for (const field of this.formFields) {
|
||||
for (const field of formFields.value) {
|
||||
const prop = field.prop
|
||||
const headToDetailField = field.headToDetailField
|
||||
if (prop && headToDetailField && headToDetailField.trim() != '') {
|
||||
@@ -291,85 +293,76 @@ export default {
|
||||
}
|
||||
}
|
||||
const data = {
|
||||
taskNo: this.currentTaskNo,
|
||||
taskNo: currentTaskNo.value,
|
||||
conf: conf
|
||||
}
|
||||
this.$u.api.saveHeadValueToDetail(data).then(res => {
|
||||
nx.$api.assayTask.saveHeadValueToDetail(data).then(res => {
|
||||
if (onComplete) onComplete()
|
||||
})
|
||||
},
|
||||
handleSave() {
|
||||
//显示loading
|
||||
uni.showLoading({
|
||||
title: '正在保存...'
|
||||
})
|
||||
}
|
||||
|
||||
// 实际保存逻辑
|
||||
function handleSave() {
|
||||
//组装数据
|
||||
const formValue = {}
|
||||
for (const field of this.formFields) {
|
||||
const formValueObj = {}
|
||||
for (const field of formFields.value) {
|
||||
const prop = field.prop
|
||||
if (prop) {
|
||||
formValue[prop] = field.value
|
||||
formValueObj[prop] = field.value
|
||||
}
|
||||
}
|
||||
const value = {
|
||||
taskNo: this.currentTaskNo,
|
||||
formValue: JSON.stringify(formValue),
|
||||
formConf: JSON.stringify(this.sourceFormFields, replacer)
|
||||
taskNo: currentTaskNo.value,
|
||||
formValue: JSON.stringify(formValueObj),
|
||||
formConf: JSON.stringify(sourceFormFields.value, replacer)
|
||||
}
|
||||
this.$u.api
|
||||
.saveHeadValue(value)
|
||||
.then(async res => {
|
||||
await this.saveHeadValueToDetail(async () => {
|
||||
if (this.checkPropertyEquality()) {
|
||||
await this.processIds(this.sampleList, 100)
|
||||
nx.$api.assayTask.saveHeadValue(value).then(async res => {
|
||||
await saveHeadValueToDetail(async () => {
|
||||
if (checkPropertyEquality()) {
|
||||
await processIds(sampleList.value, 100)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
// this.$helper.showToast({
|
||||
// title: '保存成功!'
|
||||
// });
|
||||
uni.redirectTo({
|
||||
url: '/pages/analysis/sample/sample-work-detail?currentTaskNo=' + this.currentTaskNo
|
||||
url: '/pages/analysis/sample/sample-work-detail?currentTaskNo=' + currentTaskNo.value
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
uni.hideLoading()
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
// 检查字段修改前和修改后字段值是否相等
|
||||
checkPropertyEquality() {
|
||||
for (const field of this.formFields) {
|
||||
}
|
||||
|
||||
// 检查字段修改前和修改后字段值是否相等
|
||||
function checkPropertyEquality() {
|
||||
for (const field of formFields.value) {
|
||||
const prop = field.prop
|
||||
if (prop && field['headToDetailField'] && field['headToDetailField'].trim() !== '') {
|
||||
const flag = this.formValue[prop] !== field.value ? true : false
|
||||
const flag = formValue.value[prop] !== field.value ? true : false
|
||||
if (flag) return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
//保存抬头字段
|
||||
saveHeadData() {
|
||||
if (this.checkPropertyEquality()) {
|
||||
}
|
||||
|
||||
// 保存抬头字段(带确认弹窗)
|
||||
function saveHeadData() {
|
||||
if (checkPropertyEquality()) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您修改的字段将影响样品分析结果,系统将重新计算',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
this.handleSave()
|
||||
handleSave()
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.handleSave()
|
||||
handleSave()
|
||||
}
|
||||
},
|
||||
// 通过样品id查询明细
|
||||
async getSampleDataById(taskDetailId) {
|
||||
}
|
||||
|
||||
// 通过样品id查询明细
|
||||
async function getSampleDataById(taskDetailId) {
|
||||
let fieldGroup = []
|
||||
const { result, additionalProperties } = await this.$u.api.queryFieldsByTaskDetail({
|
||||
const { result, additionalProperties } = await nx.$api.assayTask.queryFieldsByTaskDetail({
|
||||
taskDetailId,
|
||||
isSearchSRange: '0'
|
||||
})
|
||||
@@ -378,7 +371,7 @@ export default {
|
||||
const busSubCSampleId = additionalProperties.busSubCSampleId
|
||||
const detail = additionalProperties.taskDetail
|
||||
//处理硫值、硫量:未保存过的数据,读取接口返回的硫值、硫量
|
||||
// this.loadSValue(detail);
|
||||
// loadSValue(detail);
|
||||
//按公式计算值,并检查原数据与计算后的数据是否一致
|
||||
try {
|
||||
calcAnalysisValue(fieldGroup)
|
||||
@@ -411,52 +404,54 @@ export default {
|
||||
params.cupNum = cupNum
|
||||
}
|
||||
return params
|
||||
},
|
||||
// 提交样品
|
||||
async submitData(data) {
|
||||
}
|
||||
|
||||
// 提交样品
|
||||
async function submitData(data) {
|
||||
try {
|
||||
await this.$u.api.saveDetailValue(data)
|
||||
await nx.$api.assayTask.saveDetailValue(data)
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
},
|
||||
async processIds(list, interval) {
|
||||
}
|
||||
|
||||
// 批量处理样品(带间隔)
|
||||
async function processIds(list, interval) {
|
||||
let index = 0
|
||||
const intervalId = setInterval(async () => {
|
||||
if (index < list.length) {
|
||||
const item = list[index]
|
||||
index++
|
||||
const params = await this.getSampleDataById(item['id'])
|
||||
await this.submitData(params)
|
||||
const params = await getSampleDataById(item['id'])
|
||||
await submitData(params)
|
||||
} else {
|
||||
clearInterval(intervalId) // 所有任务完成后清除定时器
|
||||
uni.redirectTo({
|
||||
url: '/pages/analysis/sample/sample-work-detail?currentTaskNo=' + this.currentTaskNo
|
||||
url: '/pages/analysis/sample/sample-work-detail?currentTaskNo=' + currentTaskNo.value
|
||||
})
|
||||
}
|
||||
}, interval)
|
||||
},
|
||||
}
|
||||
|
||||
async apiRequest(url) {
|
||||
// 通用 API 请求
|
||||
async function apiRequest(url) {
|
||||
return request({
|
||||
url: url,
|
||||
method: 'GET',
|
||||
custom: {
|
||||
isApiEncryption: true
|
||||
}
|
||||
method: 'GET'
|
||||
})
|
||||
},
|
||||
//读取字段里的API选项
|
||||
async loadFieldApiData() {
|
||||
const formFields = this.formFields
|
||||
}
|
||||
|
||||
// 读取字段里的API选项
|
||||
async function loadFieldApiData() {
|
||||
const formFieldsVal = formFields.value
|
||||
let changeFlag = false
|
||||
for (const field of formFields) {
|
||||
for (const field of formFieldsVal) {
|
||||
const dicUrl = field.dicUrl
|
||||
const type = field.type
|
||||
if (dicUrl && dicUrl != '') {
|
||||
//读取API选项
|
||||
try {
|
||||
const res = await this.apiRequest(dicUrl)
|
||||
const res = await apiRequest(dicUrl)
|
||||
|
||||
const data = res
|
||||
const confLabel = field.props.label
|
||||
@@ -477,12 +472,12 @@ export default {
|
||||
}
|
||||
}
|
||||
if (changeFlag) {
|
||||
const formFields = this.formFields
|
||||
// this.formFields = JSON.parse(JSON.stringify(formFields));
|
||||
this.formFields = JSON.parse(JSON.stringify(formFields, replacer), reviver)
|
||||
// 重新序列化以触发响应式更新(保留函数)
|
||||
formFields.value = JSON.parse(JSON.stringify(formFieldsVal, replacer), reviver)
|
||||
}
|
||||
},
|
||||
/*
|
||||
}
|
||||
|
||||
/*
|
||||
* 选择器组件确认事件
|
||||
* event: 事件默认参数
|
||||
* field: 当前字段
|
||||
@@ -491,8 +486,7 @@ export default {
|
||||
* field.valueText = 选中的文本
|
||||
* todo: 关联字段在动态字段的change事件处理
|
||||
* */
|
||||
pickerConfirm(event, field) {
|
||||
const me = this
|
||||
function pickerConfirm(event, field) {
|
||||
if (field.type == 'date') {
|
||||
field.value = nx.$dayjs(event.value).format(field.format)
|
||||
field.showPicker = false
|
||||
@@ -506,53 +500,60 @@ export default {
|
||||
field.value = value
|
||||
field.valueText = displayName
|
||||
if (typeof field.change == 'function') {
|
||||
field.change({ value }, selected, me)
|
||||
field.change({ value }, selected, { formFields: formFields.value })
|
||||
}
|
||||
field.showPicker = false
|
||||
},
|
||||
checkLoadSValue() {
|
||||
}
|
||||
|
||||
// 检查是否需要加载硫值(原逻辑保留)
|
||||
function checkLoadSValue() {
|
||||
const vKey = 'sRange'
|
||||
const vF = this.getFieldByKey(vKey)
|
||||
const vF = getFieldByKey(vKey)
|
||||
if (vF == null) return false
|
||||
const v = vF.value
|
||||
if (v == null || v == '') return true
|
||||
try {
|
||||
if (v == 0 || number(v) == 0) return true
|
||||
if (v == 0 || Number(v) == 0) return true
|
||||
} catch (e) {}
|
||||
return false
|
||||
},
|
||||
//读取硫值、硫量
|
||||
loadSValue(detail) {
|
||||
let flag = this.checkLoadSValue()
|
||||
if (!flag) return
|
||||
const vKey = 'sValue'
|
||||
const rKey = 'sRange'
|
||||
const vF = this.getFieldByKey(vKey)
|
||||
if (vF != null) {
|
||||
vF.value = detail.svalue
|
||||
}
|
||||
const rF = this.getFieldByKey(rKey)
|
||||
if (rF != null) {
|
||||
rF.value = detail.srange
|
||||
}
|
||||
},
|
||||
getFieldByKey(key) {
|
||||
const group = this.fieldGroup
|
||||
let field = null
|
||||
for (let g of group) {
|
||||
for (let f of g.fields) {
|
||||
const dicKey = f.dicKey
|
||||
if (dicKey && dicKey == key) {
|
||||
field = f
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log('field', JSON.stringify(field));
|
||||
return field
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 读取硫值、硫量(原逻辑保留,未启用)
|
||||
// function loadSValue(detail) {
|
||||
// let flag = checkLoadSValue()
|
||||
// if (!flag) return
|
||||
// const vKey = 'sValue'
|
||||
// const rKey = 'sRange'
|
||||
// const vF = getFieldByKey(vKey)
|
||||
// if (vF != null) {
|
||||
// vF.value = detail.svalue
|
||||
// }
|
||||
// const rF = getFieldByKey(rKey)
|
||||
// if (rF != null) {
|
||||
// rF.value = detail.srange
|
||||
// }
|
||||
// }
|
||||
|
||||
// 根据 key 获取字段(依赖 fieldGroup,但当前无 fieldGroup,保留原逻辑结构)
|
||||
function getFieldByKey(key) {
|
||||
// 注意:原代码中 this.fieldGroup 未定义,此处无法实现,保留函数结构
|
||||
// const group = this.fieldGroup
|
||||
// let field = null
|
||||
// for (let g of group) {
|
||||
// for (let f of g.fields) {
|
||||
// const dicKey = f.dicKey
|
||||
// if (dicKey && dicKey == key) {
|
||||
// field = f
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return field
|
||||
return null
|
||||
}
|
||||
|
||||
// ========== 工具函数(保留原位置) ==========
|
||||
|
||||
// 自定义 replacer,将函数转换为字符串。json序列化和反序列化时避免函数丢失
|
||||
function replacer(key, value) {
|
||||
if (typeof value === 'function') {
|
||||
@@ -571,6 +572,7 @@ function reviver(key, value) {
|
||||
return value
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.navbar-right {
|
||||
font-size: 16px;
|
||||
|
||||
@@ -17,32 +17,32 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl: '',
|
||||
tenantId: '',
|
||||
upgradeBaseUrl: '',
|
||||
clickCount: 0, // 初始化点击次数为0
|
||||
threshold: 5, //设置点击次数的阈值
|
||||
thresholdTime: 2, // 设置连续点击的时间阈值(秒)
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showContent() {
|
||||
return this.clickCount >= this.threshold
|
||||
}
|
||||
},
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
|
||||
mounted() {
|
||||
this.baseUrl = uni.getStorageSync('base_url')
|
||||
this.tenantId = uni.getStorageSync('tenant_id')
|
||||
this.upgradeBaseUrl = uni.getStorageSync('upgradeBaseUrl')
|
||||
},
|
||||
methods: {
|
||||
clearCache() {
|
||||
// 响应式数据
|
||||
const baseUrl = ref('')
|
||||
const tenantId = ref('')
|
||||
const upgradeBaseUrl = ref('')
|
||||
const clickCount = ref(0) // 初始化点击次数为0
|
||||
const threshold = 5 // 设置点击次数的阈值
|
||||
const thresholdTime = 2 // 设置连续点击的时间阈值(秒)
|
||||
let timer = null
|
||||
|
||||
// 计算属性:根据点击次数决定是否显示隐藏内容
|
||||
const showContent = computed(() => {
|
||||
return clickCount.value >= threshold
|
||||
})
|
||||
|
||||
// 页面加载时从缓存中读取已保存的配置
|
||||
onMounted(() => {
|
||||
baseUrl.value = uni.getStorageSync('base_url')
|
||||
tenantId.value = uni.getStorageSync('tenant_id')
|
||||
upgradeBaseUrl.value = uni.getStorageSync('upgradeBaseUrl')
|
||||
})
|
||||
|
||||
// 清除缓存方法
|
||||
function clearCache() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要清空缓存?',
|
||||
@@ -55,50 +55,50 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
if (!this.baseUrl) {
|
||||
}
|
||||
|
||||
// 提交表单:保存配置到缓存
|
||||
function submitForm() {
|
||||
if (!baseUrl.value) {
|
||||
uni.showToast({
|
||||
title: '请输入地址和租户',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.setStorageSync('base_url', this.baseUrl)
|
||||
uni.setStorageSync('tenant_id', this.tenantId)
|
||||
uni.setStorageSync('upgradeBaseUrl', this.upgradeBaseUrl)
|
||||
uni.setStorageSync('base_url', baseUrl.value)
|
||||
uni.setStorageSync('tenant_id', tenantId.value)
|
||||
uni.setStorageSync('upgradeBaseUrl', upgradeBaseUrl.value)
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.navigateBack()
|
||||
},
|
||||
handleClick() {
|
||||
// 如果达到阈值,显示内容并重置计数
|
||||
if (this.showContent) {
|
||||
clearTimeout(this.timer)
|
||||
}
|
||||
|
||||
// 点击标题区域的处理逻辑:用于触发隐藏内容的显示
|
||||
function handleClick() {
|
||||
// 如果已经达到阈值,显示内容后不再响应点击
|
||||
if (showContent.value) {
|
||||
clearTimeout(timer)
|
||||
return
|
||||
}
|
||||
// 增加点击次数
|
||||
this.clickCount++
|
||||
clickCount.value++
|
||||
uni.showToast({
|
||||
title: `再点击${this.threshold - this.clickCount}次可显示内容`,
|
||||
title: `再点击${threshold - clickCount.value}次可显示内容`,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
|
||||
clearTimeout(this.timer)
|
||||
// 清除之前的定时器(如果有),设置新的定时器
|
||||
this.timer = setTimeout(() => {
|
||||
this.resetClickCount()
|
||||
}, this.thresholdTime * 1000)
|
||||
},
|
||||
resetClickCount() {
|
||||
if (!this.showContent) {
|
||||
this.clickCount = 0
|
||||
}
|
||||
}
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
// 如果还没达到阈值,则重置点击次数
|
||||
if (!showContent.value) {
|
||||
clickCount.value = 0
|
||||
}
|
||||
}, thresholdTime * 1000)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user