index.vue 8.4 KB

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