index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="不合格品处置"
  8. background-color="#157A2C"
  9. color="#fff"
  10. @clickLeft="back"
  11. ></uni-nav-bar>
  12. <view class="top-wrapper">
  13. <uni-section>
  14. <uni-easyinput
  15. prefixIcon="search"
  16. style="width: 430rpx"
  17. v-model="searchFrom.keyWord"
  18. placeholder="请输入"
  19. >
  20. </uni-easyinput>
  21. </uni-section>
  22. <button class="search_btn" @click="doSearch">搜索</button>
  23. <!-- <button class="search_btn" @click="addMaterial">新增</button> -->
  24. </view>
  25. <view class="list_box">
  26. <u-list
  27. @scrolltolower="scrolltolower"
  28. key="list"
  29. :preLoadScreen="page * 10"
  30. >
  31. <u-list-item v-for="(item, index) in dataList" :key="index">
  32. <view class="card_box" @click="handleDetail(item)">
  33. <view class="header rx-sc">
  34. <view class="round">{{ index + 1 }}</view>
  35. <view class="orderId">{{ item.unqualifiedProductsCode }}</view>
  36. </view>
  37. <view class="row">
  38. <view class="label">编码</view>
  39. <view class="value">{{ item.unqualifiedProductsCode }}</view>
  40. </view>
  41. <view class="row">
  42. <view class="label">工单编号</view>
  43. <view class="value">{{ item.workOrderCode }}</view>
  44. </view>
  45. <view class="row">
  46. <view class="label">批次号</view>
  47. <view class="value">{{ item.batchNo }}</view>
  48. </view>
  49. <view class="row">
  50. <view class="label">来源编码</view>
  51. <view class="value">{{ item.sourceCode }}</view>
  52. </view>
  53. <view class="row">
  54. <view class="label">物品名称</view>
  55. <view class="value"> {{ item.categoryName }}</view>
  56. </view>
  57. <view class="row">
  58. <view class="label">物品编码</view>
  59. <view class="value">{{ item.categoryCode }} </view>
  60. </view>
  61. <view class="row">
  62. <view class="label">型号 </view>
  63. <view class="value">{{ item.modelType }} </view>
  64. </view>
  65. <view class="row">
  66. <view class="label"> 规格</view>
  67. <view class="value"> {{ item.specification }}</view>
  68. </view>
  69. <view class="row">
  70. <view class="label">数量</view>
  71. <view class="value"
  72. >{{ item.quantity }}{{ item.measureUnit }}</view
  73. >
  74. </view>
  75. <view class="tag-row row">
  76. <view class="label">质检类型</view>
  77. <view class="tag green">{{ getQuality(item) }}</view>
  78. </view>
  79. <view class="tag-row row">
  80. <view class="label">状态</view>
  81. <view class="tag blue">{{ getDispose(item) }}</view>
  82. </view>
  83. <!-- <view class="tag-row">
  84. <view class="tag green">{{ getQuality(item) }}</view>
  85. <view class="tag blue">{{ getDispose(item) }}</view>
  86. </view> -->
  87. <view class="row">
  88. <view class="label">处置时间</view>
  89. <view class="value">{{ item.disposeTime }}</view>
  90. </view>
  91. </view>
  92. </u-list-item>
  93. <u-list-item v-if="dataList.length === 0">
  94. <view style="margin-top: 20vh">
  95. <u-empty iconSize="150" textSize="32" text="暂无不良品"> </u-empty>
  96. </view>
  97. </u-list-item>
  98. </u-list>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import { getList } from "@/api/pda/nonconforming.js";
  104. import { getByCode } from "@/api/pda/common.js";
  105. import itemCard from "../components/itemCard.vue";
  106. let [isEnd] = [false];
  107. export default {
  108. components: {
  109. itemCard,
  110. },
  111. data() {
  112. return {
  113. searchFrom: {
  114. keyWord: "",
  115. },
  116. page: 1,
  117. size: 10,
  118. dataList: [],
  119. qualityList: [],
  120. disposeList: [],
  121. };
  122. },
  123. onLoad(option) {
  124. // this.produceFn();
  125. },
  126. onShow() {
  127. this.getDisposeList("dispose_status");
  128. this.getQualityList("inspection_plan_type");
  129. this.getList();
  130. },
  131. created() {
  132. // this.getByCodeFn();
  133. },
  134. methods: {
  135. async getList() {
  136. let params = {
  137. pageNum: this.page,
  138. size: this.size,
  139. ...this.searchFrom,
  140. };
  141. isEnd = false;
  142. const res = await getList(params);
  143. if (params.pageNum === 1) {
  144. this.dataList = [];
  145. }
  146. this.dataList.push(...res.list);
  147. isEnd = this.dataList.length >= res.count;
  148. },
  149. produceFn() {
  150. this.getList();
  151. },
  152. scrolltolower() {
  153. if (isEnd) return;
  154. this.page++;
  155. this.getList();
  156. },
  157. doSearch() {
  158. this.getList();
  159. },
  160. addMaterial() {},
  161. handleDetail(item) {
  162. console.log(item);
  163. },
  164. async getDisposeList(code) {
  165. let res = await getByCode(code);
  166. if (res.length != 0) {
  167. let list = res.map((item) => {
  168. let key = Object.keys(item)[0];
  169. return { value: Number(key), label: item[key] };
  170. });
  171. this.disposeList = list;
  172. }
  173. },
  174. async getQualityList(code) {
  175. let res = await getByCode(code);
  176. if (res.length != 0) {
  177. let list = res.map((item) => {
  178. let key = Object.keys(item)[0];
  179. return { value: Number(key), label: item[key] };
  180. });
  181. this.qualityList = list;
  182. }
  183. },
  184. getDispose(item) {
  185. const data = this.disposeList.find((it) => it.value == item.status);
  186. return data ? data.label : "";
  187. },
  188. getQuality(item) {
  189. const data = this.qualityList.find((it) => it.value == item.qualityType);
  190. return data ? data.label : "";
  191. },
  192. },
  193. };
  194. </script>
  195. <style lang="scss" scoped>
  196. .content-box {
  197. height: 100vh;
  198. overflow: hidden;
  199. display: flex;
  200. flex-direction: column;
  201. background-color: $page-bg;
  202. }
  203. .top-wrapper {
  204. background-color: #fff;
  205. display: flex;
  206. width: 750rpx;
  207. height: 88rpx;
  208. padding: 16rpx 32rpx;
  209. align-items: center;
  210. gap: 16rpx;
  211. /deep/.uni-section {
  212. margin-top: 0px;
  213. }
  214. /deep/.uni-section-header {
  215. padding: 0px;
  216. }
  217. .search_btn {
  218. width: 110rpx;
  219. height: 60rpx;
  220. line-height: 60rpx;
  221. padding: 0 10rpx;
  222. background: $theme-color;
  223. font-size: 24rpx;
  224. color: #fff;
  225. margin: 0;
  226. margin-left: 16rpx;
  227. }
  228. .menu_icon {
  229. width: 44rpx;
  230. height: 44rpx;
  231. margin-left: 14rpx;
  232. }
  233. }
  234. .list_box {
  235. flex: 1;
  236. overflow: hidden;
  237. padding: 16rpx 0;
  238. .u-list {
  239. height: 100% !important;
  240. }
  241. .card_box {
  242. width: 686rpx;
  243. margin: 0 auto 24rpx;
  244. background: #fff;
  245. border-radius: 18rpx;
  246. padding: 26rpx 30rpx;
  247. box-shadow: 0 6rpx 28rpx rgba(0, 0, 0, 0.06);
  248. box-sizing: border-box;
  249. transition: transform 0.15s ease-out;
  250. .header {
  251. margin-bottom: 18rpx;
  252. .round {
  253. width: 40rpx;
  254. height: 40rpx;
  255. line-height: 40rpx;
  256. border-radius: 50%;
  257. background: $theme-color;
  258. color: #fff;
  259. text-align: center;
  260. font-size: 22rpx;
  261. }
  262. .orderId {
  263. margin-left: 14rpx;
  264. font-size: 28rpx;
  265. font-weight: 600;
  266. color: #333;
  267. }
  268. }
  269. &:active {
  270. transform: scale(0.96);
  271. }
  272. .row {
  273. display: flex;
  274. justify-content: space-between;
  275. margin-bottom: 12rpx;
  276. font-size: 26rpx;
  277. color: #333;
  278. .label {
  279. color: #888;
  280. min-width: 160rpx;
  281. font-weight: 400;
  282. }
  283. .value {
  284. flex: 1;
  285. font-weight: 500;
  286. text-align: right;
  287. word-break: break-all;
  288. }
  289. }
  290. .tag-row {
  291. display: flex;
  292. gap: 16rpx;
  293. margin: 14rpx 0;
  294. .tag {
  295. font-size: 22rpx;
  296. padding: 6rpx 18rpx;
  297. border-radius: 32rpx;
  298. line-height: 1;
  299. font-weight: 500;
  300. }
  301. .green {
  302. background: #e8f6ec;
  303. color: #157a2c;
  304. }
  305. .blue {
  306. background: #eaf3ff;
  307. color: #2a68ff;
  308. }
  309. }
  310. .time {
  311. font-size: 24rpx;
  312. color: #999;
  313. margin-top: 8rpx;
  314. text-align: right;
  315. }
  316. }
  317. }
  318. </style>