| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <template>
- <view class="record-card flex-row">
- <!-- <uni-tag class="tag-circle" v-for="(tag,index) in 6" :key="index" :text="tag+''" size="medium" type="primary" circle
- @click="tabsClick(tag)"></uni-tag> -->
- <view class="tag-circle" v-for="(tag,index) in maxcount" :key="index" @click="tabsClick(tag)"
- :class="{'checked-tag' : tag === current}">
- <text class="circle" :class="{
- 'bg-green': tag<=2,
- 'bg-yellow': tag%3 === 0,
- 'bg-red': tag%2 === 0,
- 'bg-black': tag>=4
- }">{{tag}}</text>
- </view>
- </view>
- <!-- #ifdef APP -->
- <scroll-view style="flex:1">
- <!-- #endif -->
- <!-- <view class="card-list" style="flex-direction: row;">
- <uni-tag v-for="(tag,index) in 6" :key="index" :text="tag+''" size="medium" type="primary" circle
- @click="tabsClick(tag)" style="width:40rpx;margin: 0 10rpx;"></uni-tag>
- </view> -->
- <!-- 检查报告卡片列表 -->
- <view v-if="reportList.length" class="card-list">
- <view class="card" v-for="item in reportList" :key="item.no" v-show="current == item.no as number">
- <view class="info-row">
- <text class="label">序号</text>
- <view class="value">
- <uni-number-box v-model="item.no" disabled></uni-number-box>
- </view>
- </view>
- <view class="info-row">
- <text class="label">产品码</text>
- <view class="value">
- <input v-model="item.prodno" disabled></input>
- </view>
- </view>
- <view class="info-row">
- <text class="label">检测项目</text>
- <view class="value">
- <input v-model="item.invname" disabled></input>
- </view>
- </view>
- <view class="info-row">
- <text class="label">性质</text>
- <view class="value">
- <input v-model="item.nature" disabled></input>
- </view>
- </view>
- <view class="info-row">
- <text class="label">上限要求</text>
- <view class="value">
- <uni-number-box v-model="item.minNum" :step="0.1" :min="0.5" disabled></uni-number-box>
- </view>
- </view>
- <view class="info-row">
- <text class="label">下限要求</text>
- <view class="value">
- <uni-number-box v-model="item.maxNum" :min="0" disabled></uni-number-box>
- </view>
- </view>
- <!--
- <view class="btn-group">
- <button class="main-btn" @click="viewReport(item.id)">查看报告</button>
- </view>-->
- <view class="divider"></view>
- <view class="info-row">
- <text class="label">实测值小</text>
- <view class="value">
- <uni-number-box v-model="item.measuredvalue" :min="0"></uni-number-box>
- </view>
- </view>
- <view class="info-row">
- <text class="label">实测值大</text>
- <view class="value">
- <uni-number-box v-model="item.measuredvaluemax" :min="0"></uni-number-box>
- </view>
- </view>
- <view class="info-row">
- <text class="label">结论</text>
- <view class="value">
- <input v-model="item.result" class="surround uni-input"></input>
- </view>
- </view>
- </view>
- </view>
- <!-- 空状态 -->
- <view v-else class="empty-card">
- <image src="/static/image/empty.png" class="empty-img" />
- <text class="empty-text">暂无检查检验记录</text>
- </view>
-
- <view class="info-row btn-panel">
- <button class="btn btn-first" @click="tabsClick(current-1)" v-if="current > 1">
- 前一项
- </button>
- <button class="btn btn-second" @click="tabsClick(current+1)" v-if="current < maxcount">
- 下一项
- </button>
- </view>
- <!-- #ifdef APP -->
- </scroll-view>
- <!-- #endif -->
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import { getJoinList, QcRecord, recordStatusDict, updateData } from '@/api/work';
-
- // 存储页面参数
- let pdid = "";
- let senum = "";
- //检查项目最大数量
- var maxcount = 5
- var current = ref(1)
- var reportList = ref<QcRecord[]>([])
- var initRecords = [] as QcRecord[]
- const initReportList = [] as QcRecord[];
-
- reportList.value = initReportList.filter(item => item.no == current.value)
-
- const tabsClick = (obj : number) => {
- current.value = obj
- console.log(initRecords)
- reportList.value = initReportList.filter(item => parseInt(item.no) == current.value)
- console.log(reportList.value)
- }
-
- const refreshRecords = (index : number) => {
- // 清空现有数据
- initRecords = [];
- // #ifdef APP-ANDROID
- getJoinList('app_task_record as r', 'app_task_record_item as i', 'r.*,i.*', 'r.sxid=i.psxid', 'pdid', pdid, null).then((res : UTSJSONObject) => {
- let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
- console.log(dataList)
- if (dataList != null && dataList.length > 0) {
- console.log(dataList);
- dataList.forEach(item => {
- if (item != null) {
- let record = JSON.parse<QcRecord>(item.toJSONString());
- if (record != null) {
- initRecords.push(record)
- let noValue = parseInt(record['no'])
- if (noValue > maxcount) {
- maxcount = noValue;
- }
- }
- }
- });
- }
- if (initRecords.length > 0) {
- if (index > 0) {
- current.value = index
- } else {
- current.value = parseInt(initRecords[0].no)
- }
- reportList.value = initRecords.filter(item => parseInt(item.no) == current.value)
- console.log(initRecords)
- }
- });
- // #endif
- }
-
- onLoad((options) => {
- pdid = options?.pdid ?? "1"
- senum = options?.senum ?? "1"
-
- // 加载初始数据
- refreshRecords(parseInt(senum))
- });
-
-
- </script>
- <style scoped>
- .container {
- padding: 20px;
- background-color: #f5f7fa;
- flex: 1;
- box-sizing: border-box;
- }
- .banner {
- background: linear-gradient(135deg, #6dd5ed, #2193b0);
- border-radius: 12px;
- padding: 20px 15px;
- margin-bottom: 20px;
- box-shadow: 0 4px 8px rgba(33, 147, 176, 0.3);
- }
- .banner-title {
- color: white;
- font-size: 18px;
- font-weight: bold;
- text-align: center;
- }
- .box {
- width: 20px;
- background-color: #909193;
- border-radius: 7.5px;
- }
- .card-list {
- display: flex;
- flex-direction: column;
- }
- .card-list>.card {
- margin-bottom: 15px;
- }
- /* #ifndef APP-ANDROID */
- .card-list>.card:last-child {
- margin-bottom: 0;
- }
- /* #endif */
- .card {
- background-color: white;
- border-radius: 10px;
- padding: 15px;
- box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
- display: flex;
- flex-direction: column;
- }
- .card-header {
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .card-icon {
- width: 64rpx;
- height: 64rpx;
- margin-right: 20rpx;
- border-radius: 12rpx;
- background-color: #eef5ff;
- padding: 10rpx;
- }
- .info-row {
- display: flex;
- flex-direction: row;
- font-size: 14px;
- color: #33475b;
- align-items: center;
- padding: 10px;
- }
- .label {
- font-weight: bold;
- color: #102a43;
- min-width: 75px;
- }
- .value {
- flex: 1;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .divider {
- height: 1px;
- background-color: #eee;
- margin: 10px 0;
- }
- .card-info {
- font-size: 28rpx;
- color: #666;
- line-height: 1.6;
- display: flex;
- flex-direction: column;
- }
- .card-info>.card-info-item {
- margin-bottom: 10rpx;
- }
- /* #ifndef APP-ANDROID */
- .card-info>.card-info-item:last-child {
- margin-bottom: 0;
- }
- /* #endif */
- .btn-group {
- display: flex;
- justify-content: flex-end;
- margin-top: 20rpx;
- }
- .main-btn {
- font-size: 28rpx;
- color: white;
- border: none;
- border-radius: 100rpx;
- background: linear-gradient(to right, #36d1dc, #5b86e5);
- box-shadow: 0 6rpx 16rpx rgba(91, 134, 229, 0.3);
- /* #ifndef APP-ANDROID */
- transition: all 0.2s ease-in-out;
- /* #endif */
- }
- /* #ifndef APP-ANDROID */
- .main-btn:active {
- opacity: 0.9;
- transform: scale(0.98);
- }
- /* #endif */
- .empty-card {
- background-color: white;
- border-radius: 20rpx;
- padding: 60rpx 30rpx;
- box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
- text-align: center;
- margin-top: 100rpx;
- }
- .empty-img {
- width: 180rpx;
- height: 180rpx;
- margin-bottom: 30rpx;
- opacity: 0.8;
- }
- .empty-text {
- font-size: 30rpx;
- color: #999;
- }
- .surround {
- border: 1px solid silver;
- border-radius: 10rpx;
- }
-
- .record-card {
- background: #ffffff;
- border-radius: 20rpx;
- padding: 24rpx 32rpx;
- box-shadow: 0 8rpx 15rpx rgba(0, 43, 92, 0.1);
- display: flex;
- flex-direction: column;
- margin-bottom: 20rpx;
- margin-top: 20rpx;
- }
-
- .flex-row {
- flex-direction: row;
- }
-
- .tag-circle {
- width: 60rpx;
- height: 60rpx;
- margin: 0 10rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- .circle {
- height: 50rpx;
- width: 50rpx;
- background-color: #004a99;
- text-align: center;
- color: #fff;
- line-height: 50rpx;
- border-radius: 50rpx;
- }
-
- .checked-tag {
- height: 60rpx;
- width: 60rpx;
- line-height: 60rpx;
- border: 2rpx solid #ffffff;
- box-shadow: 0 0 0 2rpx #007aff;
- position: relative;
- z-index: 10;
- }
-
- .bg-green {
- background-color: seagreen;
- }
-
- .bg-yellow {
- background-color: yellow;
- }
-
- .bg-black {
- background-color: #102a43;
- }
-
- .bg-red {
- background-color: red;
- }
-
- .btn-panel {
- position: relative;
- width: 100%;
- height: 90rpx;
- overflow: visible;
- }
-
- .btn {
- position: absolute;
- height: 70rpx;
- line-height: 70rpx;
- padding: 0 20rpx;
- top: 50%;
- transform: translateY(-50%);
- background-color: #00aaff;
- color: #fff;
- border: 0 none;
- border-radius: 25rpx;
- }
-
- .btn-first {
- left: 15rpx;
- }
-
- .btn-second {
- right: 15rpx;
- }
- </style>
|