This commit is contained in:
oneao committed 2025-10-10 16:46:03 +08:00
1 parent 18a0a81c20
commit 5bc05923f2
28 files changed
+834 -237

No files matched your search

@@ -3,7 +3,6 @@ import type { UploadFile, UploadFileItem } from 'sard-uniapp'
import { isImageUrl, isVideoUrl, toast } from 'sard-uniapp'
import { aliyunpluploadApi, delSubRecordApi, searchdataApi } from '@/request/api'
import { downloadFile, formatFileSize, imageCompress, isImage, uploadFileToAliyun } from '@/utils/file'
import { isH5 } from '@/utils/platform'
const fileList = ref<UploadFileItem[]>([])
@@ -50,8 +49,9 @@ async function loadFileData() {
}
function onItemClick(fileItem: UploadFileItem) {
console.log(fileItem)
if (!isImageUrl(fileItem.mx_mapfilename) && !isVideoUrl(fileItem.mx_mapfilename)) {
downloadFile(fileItem.mx_mapfilename)
downloadFile(fileItem.mx_mapfilename,fileItem.name)
}
}
@@ -94,58 +94,52 @@ function onSubmit() {
<view class="form-list">
<sar-form-item-plain name="orgid">
<template #custom="{ fieldId }">
<view class="form-label" :class="fieldId">
<text>机构码</text>
</view>
<view class="form-input">
<sar-input
v-model="formModel.orgid"
placeholder="请输入机构码"
clearable
>
<template #prepend>
<sar-icon family="iconfont" name="company" size="36rpx" />
</template>
</sar-input>
</view>
</template>
<view class="form-label">
<text>机构码</text>
</view>
<view class="form-input">
<sar-input
v-model="formModel.orgid"
placeholder="请输入机构码"
clearable
>
<template #prepend>
<sar-icon family="iconfont" name="company" size="36rpx" />
</template>
</sar-input>
</view>
</sar-form-item-plain>
<sar-form-item-plain name="userid">
<template #custom="{ fieldId }">
<view class="form-label" :class="fieldId">
账号
</view>
<view class="form-input">
<sar-input
v-model="formModel.userid"
placeholder="请输入账号"
clearable
>
<template #prepend>
<sar-icon family="iconfont" name="user" size="36rpx" />
</template>
</sar-input>
</view>
</template>
<view class="form-label">
账号
</view>
<view class="form-input">
<sar-input
v-model="formModel.userid"
placeholder="请输入账号"
clearable
>
<template #prepend>
<sar-icon family="iconfont" name="user" size="36rpx" />
</template>
</sar-input>
</view>
</sar-form-item-plain>
<sar-form-item-plain name="password">
<template #custom="{ fieldId }">
<view class="form-label" :class="fieldId">
密码
</view>
<view class="form-input">
<sar-input
v-model="formModel.password"
placeholder="请输入密码"
clearable
>
<template #prepend>
<sar-icon family="iconfont" name="lock" size="36rpx" />
</template>
</sar-input>
</view>
</template>
<view class="form-label">
密码
</view>
<view class="form-input">
<sar-input
v-model="formModel.password"
placeholder="请输入密码"
clearable
>
<template #prepend>
<sar-icon family="iconfont" name="lock" size="36rpx" />
</template>
</sar-input>
</view>
</sar-form-item-plain>
</view>
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { toast } from 'sard-uniapp'
import { ref } from 'vue'
import { searchdatapageindexApi } from '@/request/api'
import { saveobjtApi, searchdatapageindexApi } from '@/request/api'
import { useUserStore } from '@/store'
import { useCounts } from '@/store/counts'
import { getCurrentDateTimeWithSeconds } from '@/utils/time'
const { taskCounts } = useCounts()
const userStore = useUserStore()
const pagingRef = ref<any>(null)
@@ -11,15 +14,30 @@ const dataList = ref<any[]>([])
// 自定义 tabs
const tabList = computed(() => [
{ name: '未完成', count: 0 },
{ name: '已完成', count: 0 },
{ name: '全部', count: 0 },
{ name: '未完成', count: taskCounts.yx.todo },
{ name: '已完成', count: taskCounts.yx.finished },
{ name: '全部', count: taskCounts.yx.total },
])
const activeTab = ref(tabList.value[0])
// 搜索关键字
const searchValue = ref('')
const confirmDialogVisible = ref(false)
const confirmFormRef = ref()
const confirmFormModel = ref<any>({})
const bconkzOptions = ref([
{
value: '空箱',
label: '空箱',
},
{
value: '重箱',
label: '重箱',
},
])
// 切换 tab
function switchTab(tab: any) {
activeTab.value = tab
@@ -38,19 +56,19 @@ function queryList(pageNo: number, pageSize: number) {
const userid = userStore.userInfo.userid
let searchcondition = `2>1 AND b_kd_finish = '1' AND b_yx_finish = '1' `
let searchcondition = `2>1 AND b_kd_finish = '1' `
if (activeTab.value.name === '未完成') {
searchcondition += ` AND ISNULL(b_dc_finish,'') <> '1' AND ISNULL(b_dcman_id,'') IN ('', '${userid}')`
searchcondition += ` AND ISNULL(b_yx_finish,'') <> '1' AND ISNULL(b_yxman_id,'') IN ('', '${userid}')`
}
else if (activeTab.value.name === '已完成') {
searchcondition += ` AND ISNULL(b_dc_finish,'') = '1' AND ISNULL(b_dcman_id,'') = '${userid}'`
searchcondition += ` AND ISNULL(b_yx_finish,'') = '1' AND ISNULL(b_yxman_id,'') = '${userid}'`
}
else {
searchcondition += ` AND (
(ISNULL(b_dc_finish,'') <> '1' AND ISNULL(b_dcman_id,'') IN ('', '${userid}'))
OR (ISNULL(b_dc_finish,'') = '1' AND ISNULL(b_dcman_id,'') = '${userid}')
)`
(ISNULL(b_yx_finish,'') <> '1' AND ISNULL(b_yxman_id,'') IN ('', '${userid}'))
OR (ISNULL(b_yx_finish,'') = '1' AND ISNULL(b_yxman_id,'') = '${userid}')
)`
}
if (searchValue.value) {
@@ -67,7 +85,14 @@ function queryList(pageNo: number, pageSize: number) {
})
.then((res) => {
const rows = res.data.rows || []
pagingRef.value.complete(rows)
if (rows) {
pagingRef.value.complete(rows)
}
if (activeTab.value.name === '未完成' && res.data.total) {
taskCounts.yx.todo = res.data.total
}
})
.finally(() => {
toast.hide()
@@ -79,9 +104,190 @@ function handleToFile(itemData) {
url: `/pages-sub/file/index?moduleid=xc_conyard_in&father=${itemData.b_id}&cateid=014&edit=1`,
})
}
function showConfirmDialog(itemData: any) {
confirmFormModel.value = JSON.parse(JSON.stringify(itemData))
confirmDialogVisible.value = true
}
async function handleConfirmDialogBeforeClose(type: string) {
if (type !== 'confirm') {
return
}
try {
await confirmFormRef.value?.validate()
}
catch {
return Promise.reject()
}
if (confirmFormModel.value.b_kd_finish !== '1') {
toast.fail('尚未开票,请先开票')
return Promise.reject()
}
if (confirmFormModel.value.b_yx_finish !== '1') {
toast.fail('请先验箱')
return Promise.reject()
}
const obj: any = {
b_id: confirmFormModel.value.b_id,
b_yx_finishdate: getCurrentDateTimeWithSeconds(),
b_yxman_id: userStore.userInfo.userid,
b_yx_finish: '1',
b_conno: confirmFormModel.value.b_conno,
b_conkz: confirmFormModel.value.b_conkz,
b_contype: confirmFormModel.value.b_contype,
b_constate: confirmFormModel.value.b_constate,
b_conxk: confirmFormModel.value.b_conxk,
}
const strmainvalue = `[${JSON.stringify(obj)}]`
const res = await saveobjtApi({
tables: '[xc_consite_in]',
insertValues: '[]',
delValues: '[]',
updateValues: strmainvalue,
keys: '[b_id]',
})
if (res?.data !== 'OK') {
toast.fail(`堆高机验证失败:${res.data}`)
return Promise.reject()
}
const idx = dataList.value.findIndex(i => i.b_id === confirmFormModel.value.b_id)
if (idx !== -1) {
if (activeTab.value.name === '未完成') {
dataList.value.splice(idx, 1)
}
else {
Object.assign(dataList.value[idx], obj)
}
}
if (taskCounts.yx.todo > 0) {
taskCounts.yx.todo -= 1
taskCounts.yx.total -= 1
}
toast.success('验箱成功')
}
function handleConfirmDialogAfterLeave() {
confirmFormModel.value = {}
}
</script>
<template>
<sar-dialog
v-model:visible="confirmDialogVisible"
popup-style="top: 50%"
title="验箱表单"
:confirm-props="{
size: 'small',
theme: 'success',
square: true,
}"
:cancel-props="{
size: 'small',
square: true,
}"
:before-close="handleConfirmDialogBeforeClose"
:after-leave="handleConfirmDialogAfterLeave"
>
<scroll-view
style="max-height: 60vh; margin-top: 1px; margin-bottom: 16rpx"
scroll-y
>
<sar-form ref="confirmFormRef" :model="confirmFormModel" label-width="150rpx" label-align="end">
<sar-form-item
name="b_conno"
label="箱号"
:rules="[{ required: true }]"
>
<sar-input
v-model="confirmFormModel.b_conno"
inlaid
/>
</sar-form-item>
<sar-form-item
name="b_id"
label="进场单号"
>
<sar-input
v-model="confirmFormModel.b_id"
inlaid
readonly
/>
</sar-form-item>
<sar-form-item
name="b_contype"
label="箱型"
>
<picker-select-input
v-model:label="confirmFormModel.b_contype"
v-model:value="confirmFormModel.b_contype"
viewname="b_con_type"
label-field="b_name"
value-field="b_name"
field1="b_name"
field2="b_id"
placeholder="请选择箱型"
/>
</sar-form-item>
<sar-form-item
name="b_conkz"
label="空箱重"
>
<sar-picker-input
v-model="confirmFormModel.b_conkz"
title="请选择空箱重"
placeholder="请选择空箱重"
clearable
:columns="bconkzOptions"
/>
</sar-form-item>
<sar-form-item
name="b_constate"
label="箱态"
>
<picker-select-input
v-model:label="confirmFormModel.b_constate"
v-model:value="confirmFormModel.b_constate"
viewname="b_constate"
label-field="b_name"
value-field="b_name"
field1="b_name"
field2="b_id"
placeholder="请选择箱态"
/>
</sar-form-item>
<sar-form-item
name="b_conxk"
label="箱况"
>
<picker-select-input
v-model:label="confirmFormModel.b_conxk"
v-model:value="confirmFormModel.b_conxk"
viewname="b_conxk"
label-field="b_name"
value-field="b_name"
field1="b_name"
field2="b_id"
placeholder="请选择箱况"
/>
</sar-form-item>
</sar-form>
</scroll-view>
</sar-dialog>
<view>
<z-paging ref="pagingRef" v-model="dataList" @query="queryList">
<template #top>
@@ -99,9 +305,13 @@ function handleToFile(itemData) {
:class="{ 'tabs__item--active': activeTab.name === tab.name }"
@click="switchTab(tab)"
>
<sar-badge :value="tab.count">
<sar-badge v-if="tab.count > 0" :value="tab.count">
{{ tab.name }}
</sar-badge>
<text v-else>
{{ tab.name }}
</text>
</view>
</view>
</template>
@@ -117,10 +327,10 @@ function handleToFile(itemData) {
箱号:{{ item.b_conno }}
</view>
<view class="list-item__extra">
<sar-tag v-if="item.b_dc_finish === '1'" theme="success" size="small">
<sar-tag v-if="item.b_yx_finish === '1'" theme="success" size="small">
已完成
</sar-tag>
<sar-tag v-else>
<sar-tag v-else theme="secondary">
未完成
</sar-tag>
</view>
@@ -138,6 +348,8 @@ function handleToFile(itemData) {
</view>
</view>
</sar-col>
</sar-row>
<sar-row>
<sar-col :span="12">
<view class="list-item__info">
<view class="list-item__label">
@@ -148,6 +360,8 @@ function handleToFile(itemData) {
</view>
</view>
</sar-col>
</sar-row>
<sar-row>
<sar-col :span="6">
<view class="list-item__info">
<view class="list-item__label">
@@ -168,6 +382,8 @@ function handleToFile(itemData) {
</view>
</view>
</sar-col>
</sar-row>
<sar-row>
<sar-col :span="6">
<view class="list-item__info">
<view class="list-item__label">
@@ -188,16 +404,6 @@ function handleToFile(itemData) {
</view>
</view>
</sar-col>
<sar-col :span="6">
<view class="list-item__info">
<view class="list-item__label">
箱位:
</view>
<view class="list-item__value">
{{ item.b_xwt }}
</view>
</view>
</sar-col>
</sar-row>
</view>
@@ -206,12 +412,13 @@ function handleToFile(itemData) {
拍照
</sar-button>
<sar-button
v-if="item.b_dc_finish !== '1'"
v-if="item.b_yx_finish !== '1'"
inline
square
type="default"
theme="success"
size="mini"
@click="showConfirmDialog(item)"
>
确认
</sar-button>
@@ -263,13 +470,16 @@ function handleToFile(itemData) {
}
.list-item__body {
padding: 24rpx 0rpx;
display: flex;
flex-direction: column;
@include flexGap(16rpx, 'column');
.list-item__info {
display: flex;
align-items: start;
width: 100%;
font-size: 26rpx;
line-height: 1;
margin-top: 16rpx;
.list-item__label {
display: block;
@@ -288,7 +498,6 @@ function handleToFile(itemData) {
}
.list-item__footer {
margin-top: 16rpx;
display: flex;
justify-content: flex-end;
@include flexGap(36rpx, '');