index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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. uni.navigateTo({
  163. url: `/pages/pda/nonconforming/detail/detail?id=${item.id}&qualityType=${item.qualityType}&workOrderCode=${item.workOrderCode || ""}`,
  164. });
  165. },
  166. async getDisposeList(code) {
  167. let res = await getByCode(code);
  168. if (res.length != 0) {
  169. let list = res.map((item) => {
  170. let key = Object.keys(item)[0];
  171. return { value: Number(key), label: item[key] };
  172. });
  173. this.disposeList = list;
  174. }
  175. },
  176. async getQualityList(code) {
  177. let res = await getByCode(code);
  178. if (res.length != 0) {
  179. let list = res.map((item) => {
  180. let key = Object.keys(item)[0];
  181. return { value: Number(key), label: item[key] };
  182. });
  183. this.qualityList = list;
  184. }
  185. },
  186. getDispose(item) {
  187. const data = this.disposeList.find((it) => it.value == item.status);
  188. return data ? data.label : "";
  189. },
  190. getQuality(item) {
  191. const data = this.qualityList.find((it) => it.value == item.qualityType);
  192. return data ? data.label : "";
  193. },
  194. },
  195. };
  196. </script>
  197. <style lang="scss" scoped>
  198. .content-box {
  199. height: 100vh;
  200. overflow: hidden;
  201. display: flex;
  202. flex-direction: column;
  203. background-color: $page-bg;
  204. }
  205. .top-wrapper {
  206. background-color: #fff;
  207. display: flex;
  208. width: 750rpx;
  209. height: 88rpx;
  210. padding: 16rpx 32rpx;
  211. align-items: center;
  212. gap: 16rpx;
  213. /deep/.uni-section {
  214. margin-top: 0px;
  215. }
  216. /deep/.uni-section-header {
  217. padding: 0px;
  218. }
  219. .search_btn {
  220. width: 110rpx;
  221. height: 60rpx;
  222. line-height: 60rpx;
  223. padding: 0 10rpx;
  224. background: $theme-color;
  225. font-size: 24rpx;
  226. color: #fff;
  227. margin: 0;
  228. margin-left: 16rpx;
  229. }
  230. .menu_icon {
  231. width: 44rpx;
  232. height: 44rpx;
  233. margin-left: 14rpx;
  234. }
  235. }
  236. .list_box {
  237. flex: 1;
  238. overflow: hidden;
  239. padding: 16rpx 0;
  240. .u-list {
  241. height: 100% !important;
  242. }
  243. .card_box {
  244. width: 686rpx;
  245. margin: 0 auto 24rpx;
  246. background: #fff;
  247. border-radius: 18rpx;
  248. padding: 26rpx 30rpx;
  249. box-shadow: 0 6rpx 28rpx rgba(0, 0, 0, 0.06);
  250. box-sizing: border-box;
  251. transition: transform 0.15s ease-out;
  252. .header {
  253. margin-bottom: 18rpx;
  254. .round {
  255. width: 40rpx;
  256. height: 40rpx;
  257. line-height: 40rpx;
  258. border-radius: 50%;
  259. background: $theme-color;
  260. color: #fff;
  261. text-align: center;
  262. font-size: 22rpx;
  263. }
  264. .orderId {
  265. margin-left: 14rpx;
  266. font-size: 28rpx;
  267. font-weight: 600;
  268. color: #333;
  269. }
  270. }
  271. &:active {
  272. transform: scale(0.96);
  273. }
  274. .row {
  275. display: flex;
  276. justify-content: space-between;
  277. margin-bottom: 12rpx;
  278. font-size: 26rpx;
  279. color: #333;
  280. .label {
  281. color: #888;
  282. min-width: 160rpx;
  283. font-weight: 400;
  284. }
  285. .value {
  286. flex: 1;
  287. font-weight: 500;
  288. text-align: right;
  289. word-break: break-all;
  290. }
  291. }
  292. .tag-row {
  293. display: flex;
  294. gap: 16rpx;
  295. margin: 14rpx 0;
  296. .tag {
  297. font-size: 22rpx;
  298. padding: 6rpx 18rpx;
  299. border-radius: 32rpx;
  300. line-height: 1;
  301. font-weight: 500;
  302. }
  303. .green {
  304. background: #e8f6ec;
  305. color: #157a2c;
  306. }
  307. .blue {
  308. background: #eaf3ff;
  309. color: #2a68ff;
  310. }
  311. }
  312. .time {
  313. font-size: 24rpx;
  314. color: #999;
  315. margin-top: 8rpx;
  316. text-align: right;
  317. }
  318. }
  319. }
  320. </style>