index.vue 8.3 KB

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