InspectionList.uvue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <view class="record-card flex-row">
  3. <!-- <uni-tag class="tag-circle" v-for="(tag,index) in 6" :key="index" :text="tag+''" size="medium" type="primary" circle
  4. @click="tabsClick(tag)"></uni-tag> -->
  5. <view class="tag-circle" v-for="(tag,index) in maxcount" :key="index" @click="tabsClick(tag)"
  6. :class="{'checked-tag' : tag === current}">
  7. <text class="circle" :class="{
  8. 'bg-green': tag<=2,
  9. 'bg-yellow': tag%3 === 0,
  10. 'bg-red': tag%2 === 0,
  11. 'bg-black': tag>=4
  12. }">{{tag}}</text>
  13. </view>
  14. </view>
  15. <!-- #ifdef APP -->
  16. <scroll-view style="flex:1">
  17. <!-- #endif -->
  18. <!-- <view class="card-list" style="flex-direction: row;">
  19. <uni-tag v-for="(tag,index) in 6" :key="index" :text="tag+''" size="medium" type="primary" circle
  20. @click="tabsClick(tag)" style="width:40rpx;margin: 0 10rpx;"></uni-tag>
  21. </view> -->
  22. <!-- 检查报告卡片列表 -->
  23. <view v-if="reportList.length" class="card-list">
  24. <view class="card" v-for="item in reportList" :key="item.no" v-show="current == item.no as number">
  25. <view class="info-row">
  26. <text class="label">序号</text>
  27. <view class="value">
  28. <uni-number-box v-model="item.no" disabled></uni-number-box>
  29. </view>
  30. </view>
  31. <view class="info-row">
  32. <text class="label">产品码</text>
  33. <view class="value">
  34. <input v-model="item.prodno" disabled></input>
  35. </view>
  36. </view>
  37. <view class="info-row">
  38. <text class="label">检测项目</text>
  39. <view class="value">
  40. <input v-model="item.invname" disabled></input>
  41. </view>
  42. </view>
  43. <view class="info-row">
  44. <text class="label">性质</text>
  45. <view class="value">
  46. <input v-model="item.nature" disabled></input>
  47. </view>
  48. </view>
  49. <view class="info-row">
  50. <text class="label">上限要求</text>
  51. <view class="value">
  52. <uni-number-box v-model="item.minNum" :step="0.1" :min="0.5" disabled></uni-number-box>
  53. </view>
  54. </view>
  55. <view class="info-row">
  56. <text class="label">下限要求</text>
  57. <view class="value">
  58. <uni-number-box v-model="item.maxNum" :min="0" disabled></uni-number-box>
  59. </view>
  60. </view>
  61. <!--
  62. <view class="btn-group">
  63. <button class="main-btn" @click="viewReport(item.id)">查看报告</button>
  64. </view>-->
  65. <view class="divider"></view>
  66. <view class="info-row">
  67. <text class="label">实测值小</text>
  68. <view class="value">
  69. <uni-number-box v-model="item.measuredvalue" :min="0"></uni-number-box>
  70. </view>
  71. </view>
  72. <view class="info-row">
  73. <text class="label">实测值大</text>
  74. <view class="value">
  75. <uni-number-box v-model="item.measuredvaluemax" :min="0"></uni-number-box>
  76. </view>
  77. </view>
  78. <view class="info-row">
  79. <text class="label">结论</text>
  80. <view class="value">
  81. <input v-model="item.result" class="surround uni-input"></input>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 空状态 -->
  87. <view v-else class="empty-card">
  88. <image src="/static/image/empty.png" class="empty-img" />
  89. <text class="empty-text">暂无检查检验记录</text>
  90. </view>
  91. <view class="info-row btn-panel">
  92. <button class="btn btn-first" @click="tabsClick(current-1)" v-if="current > 1">
  93. 前一项
  94. </button>
  95. <button class="btn btn-second" @click="tabsClick(current+1)" v-if="current < maxcount">
  96. 下一项
  97. </button>
  98. </view>
  99. <!-- #ifdef APP -->
  100. </scroll-view>
  101. <!-- #endif -->
  102. </template>
  103. <script setup>
  104. import {
  105. ref
  106. } from 'vue'
  107. import { getJoinList, QcRecord, recordStatusDict, updateData } from '@/api/work';
  108. // 存储页面参数
  109. let pdid = "";
  110. let senum = "";
  111. //检查项目最大数量
  112. var maxcount = 5
  113. var current = ref(1)
  114. var reportList = ref<QcRecord[]>([])
  115. var initRecords = [] as QcRecord[]
  116. const initReportList = [] as QcRecord[];
  117. reportList.value = initReportList.filter(item => item.no == current.value)
  118. const tabsClick = (obj : number) => {
  119. current.value = obj
  120. console.log(initRecords)
  121. reportList.value = initReportList.filter(item => parseInt(item.no) == current.value)
  122. console.log(reportList.value)
  123. }
  124. const refreshRecords = (index : number) => {
  125. // 清空现有数据
  126. initRecords = [];
  127. // #ifdef APP-ANDROID
  128. getJoinList('app_task_record as r', 'app_task_record_item as i', 'r.*,i.*', 'r.sxid=i.psxid', 'pdid', pdid, null).then((res : UTSJSONObject) => {
  129. let dataList = res?.['data'] as UTSJSONObject[] ?? Array<UTSJSONObject>()
  130. console.log(dataList)
  131. if (dataList != null && dataList.length > 0) {
  132. console.log(dataList);
  133. dataList.forEach(item => {
  134. if (item != null) {
  135. let record = JSON.parse<QcRecord>(item.toJSONString());
  136. if (record != null) {
  137. initRecords.push(record)
  138. let noValue = parseInt(record['no'])
  139. if (noValue > maxcount) {
  140. maxcount = noValue;
  141. }
  142. }
  143. }
  144. });
  145. }
  146. if (initRecords.length > 0) {
  147. if (index > 0) {
  148. current.value = index
  149. } else {
  150. current.value = parseInt(initRecords[0].no)
  151. }
  152. reportList.value = initRecords.filter(item => parseInt(item.no) == current.value)
  153. console.log(initRecords)
  154. }
  155. });
  156. // #endif
  157. }
  158. onLoad((options) => {
  159. pdid = options?.pdid ?? "1"
  160. senum = options?.senum ?? "1"
  161. // 加载初始数据
  162. refreshRecords(parseInt(senum))
  163. });
  164. </script>
  165. <style scoped>
  166. .container {
  167. padding: 20px;
  168. background-color: #f5f7fa;
  169. flex: 1;
  170. box-sizing: border-box;
  171. }
  172. .banner {
  173. background: linear-gradient(135deg, #6dd5ed, #2193b0);
  174. border-radius: 12px;
  175. padding: 20px 15px;
  176. margin-bottom: 20px;
  177. box-shadow: 0 4px 8px rgba(33, 147, 176, 0.3);
  178. }
  179. .banner-title {
  180. color: white;
  181. font-size: 18px;
  182. font-weight: bold;
  183. text-align: center;
  184. }
  185. .box {
  186. width: 20px;
  187. background-color: #909193;
  188. border-radius: 7.5px;
  189. }
  190. .card-list {
  191. display: flex;
  192. flex-direction: column;
  193. }
  194. .card-list>.card {
  195. margin-bottom: 15px;
  196. }
  197. /* #ifndef APP-ANDROID */
  198. .card-list>.card:last-child {
  199. margin-bottom: 0;
  200. }
  201. /* #endif */
  202. .card {
  203. background-color: white;
  204. border-radius: 10px;
  205. padding: 15px;
  206. box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  207. display: flex;
  208. flex-direction: column;
  209. }
  210. .card-header {
  211. display: flex;
  212. align-items: center;
  213. margin-bottom: 20rpx;
  214. }
  215. .card-icon {
  216. width: 64rpx;
  217. height: 64rpx;
  218. margin-right: 20rpx;
  219. border-radius: 12rpx;
  220. background-color: #eef5ff;
  221. padding: 10rpx;
  222. }
  223. .info-row {
  224. display: flex;
  225. flex-direction: row;
  226. font-size: 14px;
  227. color: #33475b;
  228. align-items: center;
  229. padding: 10px;
  230. }
  231. .label {
  232. font-weight: bold;
  233. color: #102a43;
  234. min-width: 75px;
  235. }
  236. .value {
  237. flex: 1;
  238. white-space: nowrap;
  239. overflow: hidden;
  240. text-overflow: ellipsis;
  241. }
  242. .divider {
  243. height: 1px;
  244. background-color: #eee;
  245. margin: 10px 0;
  246. }
  247. .card-info {
  248. font-size: 28rpx;
  249. color: #666;
  250. line-height: 1.6;
  251. display: flex;
  252. flex-direction: column;
  253. }
  254. .card-info>.card-info-item {
  255. margin-bottom: 10rpx;
  256. }
  257. /* #ifndef APP-ANDROID */
  258. .card-info>.card-info-item:last-child {
  259. margin-bottom: 0;
  260. }
  261. /* #endif */
  262. .btn-group {
  263. display: flex;
  264. justify-content: flex-end;
  265. margin-top: 20rpx;
  266. }
  267. .main-btn {
  268. font-size: 28rpx;
  269. color: white;
  270. border: none;
  271. border-radius: 100rpx;
  272. background: linear-gradient(to right, #36d1dc, #5b86e5);
  273. box-shadow: 0 6rpx 16rpx rgba(91, 134, 229, 0.3);
  274. /* #ifndef APP-ANDROID */
  275. transition: all 0.2s ease-in-out;
  276. /* #endif */
  277. }
  278. /* #ifndef APP-ANDROID */
  279. .main-btn:active {
  280. opacity: 0.9;
  281. transform: scale(0.98);
  282. }
  283. /* #endif */
  284. .empty-card {
  285. background-color: white;
  286. border-radius: 20rpx;
  287. padding: 60rpx 30rpx;
  288. box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
  289. text-align: center;
  290. margin-top: 100rpx;
  291. }
  292. .empty-img {
  293. width: 180rpx;
  294. height: 180rpx;
  295. margin-bottom: 30rpx;
  296. opacity: 0.8;
  297. }
  298. .empty-text {
  299. font-size: 30rpx;
  300. color: #999;
  301. }
  302. .surround {
  303. border: 1px solid silver;
  304. border-radius: 10rpx;
  305. }
  306. .record-card {
  307. background: #ffffff;
  308. border-radius: 20rpx;
  309. padding: 24rpx 32rpx;
  310. box-shadow: 0 8rpx 15rpx rgba(0, 43, 92, 0.1);
  311. display: flex;
  312. flex-direction: column;
  313. margin-bottom: 20rpx;
  314. margin-top: 20rpx;
  315. }
  316. .flex-row {
  317. flex-direction: row;
  318. }
  319. .tag-circle {
  320. width: 60rpx;
  321. height: 60rpx;
  322. margin: 0 10rpx;
  323. display: flex;
  324. justify-content: center;
  325. align-items: center;
  326. }
  327. .circle {
  328. height: 50rpx;
  329. width: 50rpx;
  330. background-color: #004a99;
  331. text-align: center;
  332. color: #fff;
  333. line-height: 50rpx;
  334. border-radius: 50rpx;
  335. }
  336. .checked-tag {
  337. height: 60rpx;
  338. width: 60rpx;
  339. line-height: 60rpx;
  340. border: 2rpx solid #ffffff;
  341. box-shadow: 0 0 0 2rpx #007aff;
  342. position: relative;
  343. z-index: 10;
  344. }
  345. .bg-green {
  346. background-color: seagreen;
  347. }
  348. .bg-yellow {
  349. background-color: yellow;
  350. }
  351. .bg-black {
  352. background-color: #102a43;
  353. }
  354. .bg-red {
  355. background-color: red;
  356. }
  357. .btn-panel {
  358. position: relative;
  359. width: 100%;
  360. height: 90rpx;
  361. overflow: visible;
  362. }
  363. .btn {
  364. position: absolute;
  365. height: 70rpx;
  366. line-height: 70rpx;
  367. padding: 0 20rpx;
  368. top: 50%;
  369. transform: translateY(-50%);
  370. background-color: #00aaff;
  371. color: #fff;
  372. border: 0 none;
  373. border-radius: 25rpx;
  374. }
  375. .btn-first {
  376. left: 15rpx;
  377. }
  378. .btn-second {
  379. right: 15rpx;
  380. }
  381. </style>