This commit is contained in:
2026-07-02 19:36:49 +08:00
parent bc80e297d5
commit cc4b55ed8e
13 changed files with 1327 additions and 93 deletions
-7
View File
@@ -1,7 +0,0 @@
{
"permissions": {
"allow": [
"Bash(git checkout *)"
]
}
}
+19
View File
@@ -167,3 +167,22 @@ export const reqGetGrooveTypeList = ()=>get(`BaseInfo/GetGrooveType`)
*
*/
export const reqSaveFitupCheck = (data)=>post(`PreWeldInspection/SaveFitupCheck`, data)
/**
* 获取防腐等级
* @returns
*/
export const reqPaintCodeList = ()=>get(`/AntiCorrosionCheck/GetPaintCodeList`)
/**
* 保存防腐填报记录
* @param {Object} data
*/
export const reqSaveAntiCorrosionCheck = (data={})=>post(`/AntiCorrosionCheck/SaveRecord`,data)
/**
* 获取防腐填报记录
* @param {String} materialCode
*/
export const reqGetAntiCorrosionCheck = (params) => get(`/AntiCorrosionCheck/GetRecordsByMaterialCode?materialCode=${params.materialCode}&projectId=${params.projectId}`)
+8 -4
View File
@@ -1,8 +1,8 @@
@font-face {
font-family: "nbd-icon"; /* Project id 5193086 */
src: url('//at.alicdn.com/t/c/font_5193086_0r8nbjxfoygi.woff2?t=1781694668587') format('woff2'),
url('//at.alicdn.com/t/c/font_5193086_0r8nbjxfoygi.woff?t=1781694668587') format('woff'),
url('//at.alicdn.com/t/c/font_5193086_0r8nbjxfoygi.ttf?t=1781694668587') format('truetype');
src: url('//at.alicdn.com/t/c/font_5193086_mkaqbwmfan.woff2?t=1782898376381') format('woff2'),
url('//at.alicdn.com/t/c/font_5193086_mkaqbwmfan.woff?t=1782898376381') format('woff'),
url('//at.alicdn.com/t/c/font_5193086_mkaqbwmfan.ttf?t=1782898376381') format('truetype');
}
.nbd-icon {
@@ -13,8 +13,12 @@
-moz-osx-font-smoothing: grayscale;
}
.nbd-icon-chuxiufangfu:before {
content: "\e65a";
}
.nbd-icon-zudui:before {
content: "\e619";
content: "\ebf6";
}
.nbd-icon-xialiaochoujianjilu:before {
+359
View File
@@ -0,0 +1,359 @@
<template>
<view class="anti-record">
<!-- 加载中 -->
<view v-if="loading" class="anti-record__loading">
<text class="anti-record__loading-text">加载中...</text>
</view>
<!-- 无记录 -->
<view v-else-if="!loading && list.length === 0" class="anti-record__empty">
<text class="anti-record__empty-text">暂无防腐记录</text>
</view>
<!-- 有记录 -->
<template v-else>
<view class="anti-record__section">
<view class="anti-record__header">
<view class="anti-record__bar"></view>
<text class="anti-record__title">防腐记录</text>
<text
v-if="list.length > 1"
class="anti-record__more"
@click="showPopup = true"
>查看全部({{ list.length }})</text>
</view>
<!-- 最新一条记录 -->
<view class="anti-record__card" v-if="latest">
<view class="anti-record__row">
<text class="anti-record__label">检查结果</text>
<view class="anti-record__tag" :class="latest.CheckResult === '合格' ? 'anti-record__tag--pass' : 'anti-record__tag--fail'">
<text class="anti-record__tag-icon">{{ latest.CheckResult === '合格' ? '\u2713' : '\u2717' }}</text>
<text class="anti-record__tag-text">{{ latest.CheckResult || '--' }}</text>
</view>
</view>
<view class="anti-record__row">
<text class="anti-record__label">防腐等级</text>
<text class="anti-record__value">{{ latest.AnticorrosionLevel || '--' }}</text>
</view>
<view class="anti-record__row">
<text class="anti-record__label">检查时间</text>
<text class="anti-record__value">{{ latest.CheckTime || '--' }}</text>
</view>
<view v-if="latest.CheckResult === '不合格' && latest.UnqualifiedReason" class="anti-record__row anti-record__row--stack">
<text class="anti-record__label">不合格原因</text>
<text class="anti-record__value anti-record__value--fail">{{ latest.UnqualifiedReason }}</text>
</view>
</view>
</view>
<!-- 弹窗全部记录 -->
<view class="anti-record__overlay" v-if="showPopup" @click="showPopup = false">
<view class="anti-record__popup" @click.stop>
<view class="anti-record__popup-hd">
<text class="anti-record__popup-title">全部防腐记录</text>
<text class="anti-record__popup-close" @click="showPopup = false"></text>
</view>
<scroll-view class="anti-record__popup-bd" scroll-y>
<view
v-for="(item, index) in list"
:key="index"
class="anti-record__card anti-record__card--popup"
:class="item.CheckResult === '合格' ? 'anti-record__card--pass' : 'anti-record__card--fail'"
>
<view class="anti-record__row">
<text class="anti-record__label">检查结果</text>
<view class="anti-record__tag" :class="item.CheckResult === '合格' ? 'anti-record__tag--pass' : 'anti-record__tag--fail'">
<text class="anti-record__tag-icon">{{ item.CheckResult === '合格' ? '\u2713' : '\u2717' }}</text>
<text class="anti-record__tag-text">{{ item.CheckResult || '--' }}</text>
</view>
</view>
<view class="anti-record__row">
<text class="anti-record__label">防腐等级</text>
<text class="anti-record__value">{{ item.AnticorrosionLevel || '--' }}</text>
</view>
<view class="anti-record__row">
<text class="anti-record__label">检查时间</text>
<text class="anti-record__value">{{ item.CheckTime || '--' }}</text>
</view>
<view v-if="item.CheckResult === '不合格' && item.UnqualifiedReason" class="anti-record__row anti-record__row--stack">
<text class="anti-record__label">不合格原因</text>
<text class="anti-record__value anti-record__value--fail">{{ item.UnqualifiedReason }}</text>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
</view>
</template>
<script setup>
import { ref, computed, watch } from 'vue'
import { reqGetAntiCorrosionCheck } from '@/api/hj.js'
const props = defineProps({
params: { type: Object, default: () => ({}) }
})
const list = ref([])
const loading = ref(false)
const showPopup = ref(false)
const latest = computed(() => list.value[0] || null)
const fetchRecords = async () => {
const { materialCode, projectId } = props.params
if (!materialCode || !projectId) return
loading.value = true
try {
const res = await reqGetAntiCorrosionCheck(props.params)
if (res.code === 1 && res.data) {
list.value = res.data
}
} catch (err) {
console.error('获取防腐记录失败:', err)
} finally {
loading.value = false
}
}
const materialCode = computed(() => props.params?.materialCode)
const projectId = computed(() => props.params?.projectId)
watch([materialCode, projectId], fetchRecords, { immediate: true })
</script>
<style lang="scss" scoped>
$primary: #2979ff;
$bg: #f4f2ee;
$card-bg: #fff;
$card-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.06);
$text: #1a1a2e;
$text-secondary: #8e99a4;
.anti-record {
&__loading,
&__empty {
padding: 40rpx 24rpx;
text-align: center;
}
&__loading-text,
&__empty-text {
font-size: 26rpx;
color: $text-secondary;
}
&__section {
margin: 0 24rpx 20rpx;
}
&__header {
display: flex;
align-items: center;
margin-bottom: 12rpx;
}
&__bar {
width: 6rpx;
height: 32rpx;
border-radius: 3rpx;
background: $primary;
margin-right: 14rpx;
}
&__title {
font-size: 30rpx;
font-weight: 700;
color: $text;
flex: 1;
}
&__more {
font-size: 24rpx;
color: $primary;
padding: 6rpx 16rpx;
background: rgba($primary, 0.08);
border-radius: 20rpx;
}
&__card {
position: relative;
box-sizing: border-box;
width: 100%;
background: $card-bg;
border-radius: 12rpx;
padding: 20rpx;
box-shadow: $card-shadow;
overflow: hidden;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 6rpx;
transition: background 0.3s;
}
&--pass::before {
background: #22c55e;
}
&--fail::before {
background: #ef4444;
}
}
&__row {
display: flex;
align-items: center;
padding: 8rpx 0;
& + & {
border-top: 1rpx solid #f0f0f0;
}
&--stack {
flex-direction: column;
align-items: flex-start;
.anti-record__value {
margin-top: 8rpx;
width: 100%;
}
}
}
&__label {
font-size: 26rpx;
color: $text-secondary;
flex-shrink: 0;
margin-right: 24rpx;
width: 140rpx;
}
&__value {
font-size: 26rpx;
color: $text;
flex: 1;
text-align: left;
&--fail {
color: #dc2626;
font-size: 24rpx;
}
}
&__tag {
display: inline-flex;
align-items: center;
gap: 6rpx;
padding: 6rpx 16rpx;
border-radius: 8rpx;
min-width: 100rpx;
justify-content: center;
&--pass {
background: #ebf9f0;
}
&--fail {
background: #fef2f2;
}
&-icon {
font-size: 22rpx;
font-weight: 700;
}
&--pass &-icon {
color: #22c55e;
}
&--fail &-icon {
color: #ef4444;
}
&-text {
font-size: 24rpx;
font-weight: 600;
}
&--pass &-text {
color: #16a34a;
}
&--fail &-text {
color: #dc2626;
}
}
// ===== 弹窗 =====
&__overlay {
position: fixed;
inset: 0;
z-index: 999;
background: rgba(0, 0, 0, 0.45);
display: flex;
align-items: flex-end;
justify-content: center;
}
&__popup {
width: 100%;
height: 70vh;
background: #fff;
border-radius: 24rpx 24rpx 0 0;
display: flex;
flex-direction: column;
animation: slideUp 0.3s ease-out;
}
&__popup-hd {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 28rpx 12rpx;
border-bottom: 1rpx solid #f0f0f0;
}
&__popup-title {
font-size: 30rpx;
font-weight: 700;
color: $text;
}
&__popup-close {
font-size: 32rpx;
color: $text-secondary;
padding: 8rpx;
}
&__popup-bd {
flex: 1;
box-sizing: border-box;
overflow-y: auto;
background: #f5f5f5;
padding: 12rpx 28rpx 36rpx;
}
&__card--popup {
box-sizing: border-box;
width: 100%;
margin-bottom: 12rpx;
box-shadow: $card-shadow;
}
&__card--popup:last-child {
margin-bottom: 0;
}
}
@keyframes slideUp {
0% { transform: translateY(100%); }
100% { transform: translateY(0); }
}
</style>
+118
View File
@@ -0,0 +1,118 @@
<template>
<view class="check-seg">
<view
class="check-seg__item"
:class="{ 'check-seg__item--active': isPass, 'is-active-anim': isPass && animKey === 'pass' }"
@click="select(passKey)"
>
<text class="check-seg__icon">{{ '\u2713' }}</text>
<text class="check-seg__text">{{ passText }}</text>
</view>
<view
class="check-seg__item"
:class="{ 'check-seg__item--active': isFail, 'is-active-anim': isFail && animKey === 'fail' }"
@click="select(failKey)"
>
<text class="check-seg__icon">{{ '\u2717' }}</text>
<text class="check-seg__text">{{ failText }}</text>
</view>
</view>
</template>
<script setup>
import { computed, ref, watch, nextTick } from 'vue'
const props = defineProps({
modelValue: { type: [Boolean, Object], default: null },
passKey: { type: String, default: 'pass' },
failKey: { type: String, default: 'fail' },
passText: { type: String, default: '通过' },
failText: { type: String, default: '不通过' }
})
const emit = defineEmits(['update:modelValue'])
const isPass = computed(() => props.modelValue === props.passKey)
const isFail = computed(() => props.modelValue === props.failKey)
const animKey = ref('')
watch(() => props.modelValue, async () => {
animKey.value = ''
await nextTick()
animKey.value = isPass.value ? 'pass' : 'fail'
})
const select = (key) => {
emit('update:modelValue', key)
}
</script>
<style lang="scss" scoped>
.check-seg {
display: inline-flex;
border-radius: 12rpx;
overflow: hidden;
border: 1rpx solid #e5e7eb;
&__item {
display: flex;
align-items: center;
gap: 6rpx;
padding: 12rpx 24rpx;
transition: all 0.25s ease;
background: #f9fafb;
&:first-child {
border-right: 1rpx solid #e5e7eb;
}
&:active {
transform: scale(0.96);
}
&--active {
background: #ebf9f0;
.check-seg__icon { color: #22c55e; }
.check-seg__text { color: #16a34a; font-weight: 600; }
&:first-child {
border-right-color: #b7ebc6;
}
}
&--active:not(:first-child) {
background: #fef2f2;
.check-seg__icon { color: #ef4444; }
.check-seg__text { color: #dc2626; font-weight: 600; }
}
}
&__icon {
font-size: 24rpx;
color: #9ca3af;
font-weight: 700;
transition: color 0.25s ease;
}
&__text {
font-size: 24rpx;
color: #6b7280;
font-weight: 500;
transition: color 0.25s ease;
}
}
// ===== 激活动画(双选分段) =====
@keyframes popIn {
0% { transform: scale(0.5); opacity: 0; }
60% { transform: scale(1.15); }
100% { transform: scale(1); opacity: 1; }
}
.check-seg__item.is-active-anim .check-seg__icon {
animation: popIn 0.3s ease-out;
}
</style>
+91
View File
@@ -0,0 +1,91 @@
<template>
<view class="submit-bar">
<view
class="submit-btn"
:class="{ 'submit-btn--loading': loading }"
:style="btnStyle"
@click="handleClick"
>
<text v-if="icon" class="submit-btn__icon">{{ icon }}</text>
<text class="submit-btn__text">{{ loading ? '提交中...' : text }}</text>
</view>
</view>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
text: { type: String, default: '提交' },
icon: { type: String, default: '' },
color: { type: String, default: '#2979ff' },
loading: { type: Boolean, default: false }
})
const emit = defineEmits(['click'])
const lighten = (hex, amount = 0.25) => {
const c = hex.replace('#', '')
const r = Math.round(parseInt(c.substring(0, 2), 16) * (1 - amount) + 255 * amount)
const g = Math.round(parseInt(c.substring(2, 4), 16) * (1 - amount) + 255 * amount)
const b = Math.round(parseInt(c.substring(4, 6), 16) * (1 - amount) + 255 * amount)
return `rgb(${r},${g},${b})`
}
const btnStyle = computed(() => ({
background: `linear-gradient(135deg, ${props.color}, ${lighten(props.color)})`,
boxShadow: `0 6rpx 24rpx ${props.color}4d`
}))
const handleClick = () => {
if (!props.loading) emit('click')
}
</script>
<style lang="scss" scoped>
$primary: #2979ff;
$bg: #f4f2ee;
.submit-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
padding: 20rpx 24rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
background: linear-gradient(180deg, rgba($bg, 0) 0%, $bg 20%);
}
.submit-btn {
display: flex;
align-items: center;
justify-content: center;
padding: 24rpx;
border-radius: 14rpx;
transition: opacity 0.2s ease, transform 0.2s ease;
&:active {
opacity: 0.9;
transform: scale(0.98);
}
&--loading {
opacity: 0.7;
pointer-events: none;
}
&__icon {
font-size: 30rpx;
color: #fff;
margin-right: 10rpx;
}
&__text {
font-size: 30rpx;
font-weight: 600;
color: #fff;
letter-spacing: 2rpx;
}
}
</style>
+1
View File
@@ -21,6 +21,7 @@
})()
import App from './App'
import './utils/formatTime'
// #ifndef VUE3
import Vue from 'vue'
+6
View File
@@ -145,6 +145,12 @@
"style": {
"navigationBarTitleText": "焊接日报"
}
},
{
"path": "hj/do_anti_rust",
"style": {
"navigationBarTitleText": "防腐处理"
}
}
]
}
+4
View File
@@ -267,6 +267,10 @@
* 菜单扫一扫
*/
const handleMenuScan = (path) => {
uni.navigateTo({
url: path + `?id=PPA031S03-25607419-2511410009`
})
return
wx.scanCode({
scanType: ['datamatrix', 'barCode', 'qrCode', 'wxCode', 'pdf417'],
success(res) {
+670
View File
@@ -0,0 +1,670 @@
<template>
<view class="detail-page">
<!-- 焊口主标识 -->
<view class="joint-hero">
<text class="joint-hero__code">{{ form.MaterialCode || '--' }}</text>
<view class="joint-hero__meta">
<view class="joint-hero__pill">
<text class="pill-label">材料编码</text>
<text class="pill-value">{{ form.Code || '--' }}</text>
</view>
<view class="joint-hero__pill">
<text class="pill-label">材料名称</text>
<text class="pill-value">{{ form.MaterialName }}</text>
</view>
</view>
</view>
<!-- 材料信息 -->
<view class="section">
<view class="section__header">
<view class="section__bar"></view>
<text class="section__title">材料信息</text>
</view>
<view class="card">
<view class="card__row">
<text class="card__label">炉号</text>
<text class="card__value">
{{ form.HeatNo || '--' }}
</text>
</view>
<view class="card__row">
<text class="card__label">批号</text>
<text class="card__value">{{ form.BatchNo || '--' }}</text>
</view>
<view class="card__row">
<text class="card__label">规格</text>
<text class="card__value">{{ form.MaterialSpec || '--' }}</text>
</view>
<view class="card__row">
<text class="card__label">单位</text>
<text class="card__value">{{ form.MaterialUnit || '--' }}</text>
</view>
<view class="card__row card__row--stack">
<text class="card__label">材料描述</text>
<text class="card__value">{{ form.MaterialDef || '--' }}</text>
</view>
</view>
</view>
<!-- 防腐记录 -->
<nbd-anti-record :params="{ materialCode: form.MaterialCode, projectId: currentProject.ProjectId }" />
<!-- 防腐填报 -->
<view class="section">
<view class="section__header">
<view class="section__bar"></view>
<text class="section__title">防腐填报</text>
</view>
<view class="card">
<!-- 防腐等级/涂漆代码下拉选择 -->
<view class="card__row" @click="showPaintCodePicker = true">
<text class="card__label">防腐等级</text>
<view class="card__value-wrap card__value-wrap--clickable">
<text class="card__value" :class="{ 'card__value--placeholder': !antiForm.AnticorrosionLevel }">
{{ antiForm.AnticorrosionLevel || '请选择防腐等级' }}
</text>
<u-icon name="arrow-down" :size="24" color="#bbb" />
</view>
</view>
<!-- 中间漆 -->
<view class="card__row">
<text class="card__label">中间漆</text>
<view class="card__value-wrap">
{{ antiForm.IntermediatePaint || '--' }}
</view>
</view>
<!-- 面漆 -->
<view class="card__row">
<text class="card__label">面漆</text>
<view class="card__value">
{{ antiForm.Topcoat || '--' }}
</view>
</view>
<!-- 漆膜厚度 -->
<view class="card__row">
<text class="card__label">漆膜厚度</text>
<view class="card__value-wrap">
<input class="card__input" v-model="antiForm.FilmThickness" type="digit"
placeholder="请输入漆膜厚度" />
<text class="card__unit">μm</text>
</view>
</view>
<!-- 喷砂情况 -->
<view class="card__row card__row--stack">
<text class="card__label">喷砂情况</text>
<view class="card__value-wrap">
<textarea class="remark-input" v-model="antiForm.SandBlasting" placeholder="请输入"
:maxlength="200" auto-height />
</view>
</view>
<!-- 除锈喷砂情况 -->
<view class="card__row card__row--stack">
<text class="card__label">除锈喷砂情况</text>
<view class="card__value-wrap">
<textarea class="remark-input" v-model="antiForm.RustSandBlasting" placeholder="请输入"
:maxlength="200" auto-height />
</view>
</view>
</view>
</view>
<!-- 自检 -->
<view class="section">
<view class="section__header">
<view class="section__bar"></view>
<text class="section__title">自检信息</text>
</view>
<view class="card">
<!-- 自检结果 -->
<view class="card__row">
<text class="card__label">自检结果</text>
<view class="card__value-wrap card__value-wrap--clickable">
<nbd-check-btn v-model="antiForm.CheckResult" passKey="合格" failKey="不合格" passText="合格" failText="不合格" />
</view>
</view>
<view
class="fail-section"
:class="{ 'is-visible': failVisible, 'is-enter': failAnimating, 'is-leave': failLeaving }"
>
<!-- 不合格原因 -->
<view class="card__row card__row--stack">
<text class="card__label">不合格原因</text>
<view class="card__value-wrap">
<textarea class="remark-input" v-model="antiForm.UnqualifiedReason" placeholder="请输入"
:maxlength="200" auto-height />
</view>
</view>
<!-- 整改要求 -->
<view class="card__row card__row--stack">
<text class="card__label">整改要求</text>
<view class="card__value-wrap">
<textarea class="remark-input" v-model="antiForm.RectifyRequirement" placeholder="请输入"
:maxlength="200" auto-height />
</view>
</view>
</view>
<!-- 备注 -->
<view class="card__row card__row--stack">
<text class="card__label">备注</text>
<view class="card__value-wrap">
<textarea class="remark-input" v-model="antiForm.Remark" placeholder="请输入备注信息(选填)"
:maxlength="200" auto-height />
</view>
</view>
<!-- 照片 -->
<view class="card__row card__row--stack">
<text class="card__label">照片</text>
<view class="card__value-wrap">
<nbd-photo-upload ref="photoRef" v-model:attachUrl="files" typeName="AntiRust" />
</view>
</view>
</view>
</view>
<nbd-submit-bar text="提交" :loading="submitting" @click="handleSubmit" />
</view>
<nbd-select v-model="showPaintCodePicker" title="选择防腐等级" :list="paintCodeList" label-key="PaintCode" value-key="Id"
@confirm="selectPaintCode" />
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { storeToRefs } from 'pinia'
import { watch, nextTick } from 'vue'
import { useUserStore } from '@/store'
import { reqMaterialInfoByMaterialCode, reqPaintCodeList, reqSaveAntiCorrosionCheck } from '@/api/hj.js'
const userStore = useUserStore()
const { userInfo, currentProject } = storeToRefs(userStore)
const form = ref({})
const showPaintCodePicker = ref(false)
const paintCodeList = ref([])
const files = ref('')
// 防腐填报
const antiForm = ref({
AnticorrosionLevel: '', // 防腐等级(显示用)
PaintId: '', // 防腐代码字典ID
IntermediatePaint: '', // 中间漆
Topcoat: '', // 面漆
FilmThickness: '', // 漆膜厚度 (两位小数,单位μm)
RustSandBlasting: '', // 除锈喷砂信息
SandBlasting: '', // 喷砂信息
Remark: '', // 备注
CheckResult: '合格', // 检查结果
UnqualifiedReason: '', // 不合格原因
RectifyRequirement: '', // 整改要求
})
const photoRef = ref(null)
const submitting = ref(false)
const failVisible = ref(antiForm.value.CheckResult === '不合格')
const failAnimating = ref(false)
const failLeaving = ref(false)
watch(() => antiForm.value.CheckResult, async (val) => {
if (val === '不合格') {
failVisible.value = true
await nextTick()
failAnimating.value = true
failLeaving.value = false
} else {
failLeaving.value = true
failAnimating.value = false
setTimeout(() => {
failVisible.value = false
failLeaving.value = false
}, 250)
}
})
const fetchPaintCodes = async () => {
try {
const res = await reqPaintCodeList()
if (res.code === 1 && res.data) {
paintCodeList.value = res.data
}
} catch (err) {
console.error('获取防腐等级列表失败:', err)
}
}
const selectPaintCode = (item) => {
antiForm.value.PaintId = item.Id
antiForm.value.AnticorrosionLevel = item.PaintCode
antiForm.value.IntermediatePaint = item.IntermediatePaint
antiForm.value.Topcoat = item.Topcoat
showPaintCodePicker.value = false
}
onLoad((opt) => {
fetchPaintCodes()
if (opt?.id) {
loadData(opt.id)
}
})
const loadData = async (id) => {
try {
uni.showLoading({ title: '加载中...', mask: true })
const res = await reqMaterialInfoByMaterialCode(encodeURIComponent(id))
if (res.code === 1 && res.data) {
form.value = res.data
}
} catch (err) {
console.error('加载焊口数据失败:', err)
uni.showToast({ title: '加载失败', icon: 'none' })
} finally {
uni.hideLoading()
}
}
const handleSubmit = async () => {
// if (!antiForm.value.PaintId) {
// uni.showToast({ title: '请选择防腐等级', icon: 'none' })
// return
// }
if( !antiForm.value.UnqualifiedReason && antiForm.value.CheckResult === '不合格') {
uni.showToast({ title: '请输入不合格原因', icon: 'none' })
return
}
if( !antiForm.value.RectifyRequirement && antiForm.value.CheckResult === '不合格') {
uni.showToast({ title: '请输入整改要求', icon: 'none' })
return
}
uni.showModal({
title: '确认提交',
content: '确定提交防腐处理结果吗?',
success: async (res) => {
if (res.confirm) {
submitting.value = true
if (photoRef.value?.hasPending()) {
uni.showLoading({ title: '上传照片中...', mask: true })
await photoRef.value.uploadAll()
uni.hideLoading()
}
let data = {
ProjectId: currentProject.value.ProjectId, // 项目ID
MaterialCode: form.value.MaterialCode, // 材料编码
AnticorrosionLevel: antiForm.value.AnticorrosionLevel, // 防腐等级
PaintId: antiForm.value.PaintId, // 防腐代码字典ID
FilmThickness: antiForm.value.FilmThickness, // 漆膜厚度
SandBlasting: antiForm.value.SandBlasting, // 喷砂信息
RustSandBlasting: antiForm.value.RustSandBlasting, // 除锈喷砂信息
Remark: antiForm.value.Remark, // 备注
CheckResult: antiForm.value.CheckResult, // 检查结果
UnqualifiedReason: antiForm.value.UnqualifiedReason, // 不合格原因
RectifyRequirement: antiForm.value.RectifyRequirement, // 整改要求
CheckPerson: userInfo.value.PersonId, // 检查人员
CheckTime: uni.formatTime(new Date().getTime(), 'YYYY-MM-DD HH:mm'), // 检查时间
CreateUser: userInfo.PersonId, // 创建人员
AttachUrl1: files.value, // 照片
}
console.log("提交数据==============>",data)
try {
const res = await reqSaveAntiCorrosionCheck(data)
if (res.code === 1) {
uni.showToast({ title: '提交成功', icon: 'success' })
setTimeout(() => uni.navigateBack(), 1500)
} else {
uni.showToast({ title: res.msg || '提交失败', icon: 'none' })
}
} catch (err) {
console.error('提交防腐填报失败:', err)
uni.showToast({ title: '提交失败', icon: 'none' })
} finally {
submitting.value = false
}
}
}
})
}
</script>
<style lang="scss" scoped>
$primary: #2979ff;
$primary-light: #e8f0fe;
$primary-mid: #d0ddff;
$primary-dark: #1a56cc;
$bg: #f4f2ee;
$text: #0f1724;
$text-secondary: #6b7c93;
$border: #e8ecf1;
$card-bg: #fefdfb;
$radius: 16rpx;
$shadow-md: 0 2rpx 12rpx rgba(0, 0, 0, 0.04), 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
.detail-page {
min-height: 100vh;
background: $bg;
padding-bottom: 180rpx;
}
// ===== 焊口主标识 =====
.joint-hero {
position: relative;
margin: 24rpx;
padding: 36rpx 32rpx 28rpx;
background: $card-bg;
border-radius: $radius;
box-shadow: $shadow-md;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4rpx;
background: linear-gradient(90deg, $primary, #6ba3ff, $primary);
background-size: 200% 100%;
animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
0%,
100% {
background-position: 0% 0;
}
50% {
background-position: 100% 0;
}
}
&__code {
display: block;
font-size: 52rpx;
font-weight: 800;
color: $text;
line-height: 1.2;
word-break: break-all;
font-family: monospace;
letter-spacing: 2rpx;
margin-bottom: 28rpx;
position: relative;
padding-left: 24rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 6rpx;
bottom: 6rpx;
width: 4rpx;
background: $primary;
border-radius: 2rpx;
}
}
&__meta {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
&__pill {
display: inline-flex;
width: 100%;
align-items: center;
gap: 8rpx;
background: $primary-light;
padding: 10rpx 18rpx;
border-radius: 10rpx;
border: 1rpx solid $primary-mid;
.pill-label {
font-size: 22rpx;
color: $text-secondary;
width: 60rpx;
}
.pill-value {
font-size: 24rpx;
font-weight: 600;
color: $primary-dark;
font-family: monospace;
}
}
}
// ===== 动效关键帧 =====
@keyframes fadeUp {
from {
opacity: 0;
transform: translateY(24rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes breathe {
0%, 100% {
opacity: 0.6;
}
50% {
opacity: 1;
}
}
// ===== 区块标题 =====
.section {
margin: 0 24rpx 20rpx;
animation: fadeUp 0.5s ease-out both;
&:nth-child(2) { animation-delay: 0.05s; }
&:nth-child(3) { animation-delay: 0.15s; }
&__header {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 14rpx;
padding: 0 6rpx;
}
&__bar {
width: 6rpx;
height: 26rpx;
background: linear-gradient(180deg, $primary, #6ba3ff);
border-radius: 3rpx;
flex-shrink: 0;
animation: breathe 2.5s ease-in-out infinite;
}
&__title {
font-size: 28rpx;
font-weight: 600;
color: $text;
letter-spacing: 0.5rpx;
}
.img-box {
padding: 20rpx;
border-radius: 16rpx;
background-color: #ffffff;
}
}
// ===== 信息卡片 =====
.card {
background: $card-bg;
border-radius: $radius;
overflow: hidden;
box-shadow: $shadow-md;
&__row {
display: flex;
align-items: center;
padding: 22rpx 28rpx;
border-bottom: 1rpx solid $border;
transition: background 0.25s ease;
&:last-child {
border-bottom: none;
}
&:active {
background: #f5f4f1;
}
&--stack {
flex-direction: column;
align-items: flex-start;
.card__label {
width: auto;
padding-left: 16rpx;
margin-bottom: 12rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 4rpx;
height: 16rpx;
background: $primary-mid;
border-radius: 2rpx;
}
}
.card__value {
width: 100%;
text-align: left;
}
.card__value-wrap {
width: 100%;
justify-content: flex-start;
}
.card__input {
text-align: left;
min-height: 132rpx;
}
.remark-input {
width: 100%;
text-align: left;
font-size: 28rpx;
color: $text;
padding: 20rpx 24rpx;
background: #f7f8fa;
border-radius: 12rpx;
line-height: 1.6;
min-height: 140rpx;
box-sizing: border-box;
&::placeholder {
color: #b0bec5;
}
}
}
}
&__label {
width: 180rpx;
font-size: 26rpx;
color: $text-secondary;
flex-shrink: 0;
position: relative;
padding-left: 16rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 4rpx;
height: 16rpx;
background: $primary-mid;
border-radius: 2rpx;
}
}
&__value {
flex: 1;
font-size: 28rpx;
color: $text;
font-weight: 500;
text-align: left;
&--placeholder {
color: #888888;
font-weight: 400;
}
}
&__value-wrap {
flex: 1;
display: flex;
align-items: center;
justify-content: flex-start;
gap: 8rpx;
&--clickable {
min-height: 48rpx;
justify-content: flex-end;
}
}
&__unit {
font-size: 24rpx;
color: $text-secondary;
flex-shrink: 0;
}
&__input {
flex: 1;
font-size: 28rpx;
color: $text;
text-align: left;
height: 48rpx;
&::placeholder {
color: #b0bec5;
}
}
}
// ===== 不合格区域切换动画 =====
.fail-section {
max-height: 0;
overflow: hidden;
opacity: 0;
transform: translateY(-20rpx);
transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease;
&.is-visible {
max-height: 600rpx;
}
&.is-enter {
opacity: 1;
transform: translateY(0);
}
&.is-leave {
max-height: 0;
opacity: 0;
transform: translateY(-20rpx);
}
}
</style>
+4 -82
View File
@@ -90,20 +90,8 @@
<text class="check-item__label">材料编码及炉批号校验</text>
<text class="check-item__desc">核对实物编码与批次信息</text>
</view>
<view class="check-item__action" @click="toggleCheck('CodeBatch')">
<view class="check-btn" :class="{
'check-btn--pass': check.CodeBatch === true,
'check-btn--fail': check.CodeBatch === false
}">
<template v-if="check.CodeBatch === true">
<text class="check-btn__icon">&#10003;</text>
<text class="check-btn__text">通过</text>
</template>
<template v-else>
<text class="check-btn__icon">&#10007;</text>
<text class="check-btn__text">不通过</text>
</template>
</view>
<view class="check-item__action">
<nbd-check-btn v-model="check.CodeBatch" :passKey="true" :failKey="false" passText="通过" failText="不通过" />
</view>
</view>
<view class="check-item">
@@ -111,20 +99,8 @@
<text class="check-item__label">材料数量校验</text>
<text class="check-item__desc">核对实物数量与单据一致</text>
</view>
<view class="check-item__action" @click="toggleCheck('Quantity')">
<view class="check-btn" :class="{
'check-btn--pass': check.Quantity === true,
'check-btn--fail': check.Quantity === false
}">
<template v-if="check.Quantity === true">
<text class="check-btn__icon">&#10003;</text>
<text class="check-btn__text">通过</text>
</template>
<template v-else>
<text class="check-btn__icon">&#10007;</text>
<text class="check-btn__text">不通过</text>
</template>
</view>
<view class="check-item__action">
<nbd-check-btn v-model="check.Quantity" :passKey="true" :failKey="false" passText="通过" failText="不通过" />
</view>
</view>
</view>
@@ -192,11 +168,6 @@
// 照片组件引用
const photoRef = ref(null)
const toggleCheck = (key) => {
const val = check.value[key]
check.value[key] = val === true ? false : true
}
const handleSubmit = () => {
uni.showModal({
title: '确认提交',
@@ -581,55 +552,6 @@
}
}
.check-btn {
display: inline-flex;
align-items: center;
gap: 8rpx;
padding: 12rpx 24rpx;
border-radius: 12rpx;
transition: all 0.25s ease;
min-width: 120rpx;
justify-content: center;
&--pass {
background: #ebf9f0;
border: 1rpx solid #b7ebc6;
.check-btn__icon {
font-size: 26rpx;
color: #22c55e;
font-weight: 700;
}
.check-btn__text {
font-size: 24rpx;
color: #16a34a;
font-weight: 600;
}
}
&--fail {
background: #fef2f2;
border: 1rpx solid #fecaca;
.check-btn__icon {
font-size: 26rpx;
color: #ef4444;
font-weight: 700;
}
.check-btn__text {
font-size: 24rpx;
color: #dc2626;
font-weight: 600;
}
}
&:active {
transform: scale(0.96);
}
}
// ===== 提交栏(悬浮底部) =====
.submit-bar {
position: fixed;
+9
View File
@@ -67,5 +67,14 @@ export const defaultApps = [{
isScan: true,
prefix: 'nbd-icon',
selected: false
},
{
name: '防腐处理',
icon: 'chuxiufangfu',
menuId: "",
path: "/scanpages/hj/do_anti_rust",
isScan: true,
prefix: 'nbd-icon',
selected: false
}
]
+38
View File
@@ -0,0 +1,38 @@
/**
* 时间格式化工具
* 挂载到 uni.formatTime,支持以下格式:
* uni.formatTime(date, 'YYYY-MM-DD HH:mm:ss')
* uni.formatTime(timestamp, 'YYYY/MM/DD')
*/
const pad = (n) => String(n).padStart(2, '0')
const formatTime = (date, fmt = 'YYYY-MM-DD HH:mm:ss') => {
if (!date) return ''
const d = date instanceof Date ? date : new Date(date)
if (isNaN(d.getTime())) return ''
const tokens = {
'Y+': d.getFullYear(),
'M+': d.getMonth() + 1,
'D+': d.getDate(),
'H+': d.getHours(),
'm+': d.getMinutes(),
's+': d.getSeconds(),
}
for (const [key, val] of Object.entries(tokens)) {
const match = fmt.match(new RegExp(key))
if (match) {
const len = match[0].length
const str = key === 'Y+' ? String(val).slice(-len) : len === 1 ? String(val) : pad(val)
fmt = fmt.replace(match[0], str)
}
}
return fmt
}
uni.formatTime = formatTime
export default formatTime