mySampleRecord.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="我的请样记录" @clickLeft="back">
  4. </uni-nav-bar>
  5. <view class="top-wrapper">
  6. <uni-section>
  7. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="qualityWorkOrderCode"
  8. placeholder="质检工单编码">
  9. </uni-easyinput>
  10. </uni-section>
  11. <button class="search_btn" @click="doSearch">搜索</button>
  12. </view>
  13. <view class="wrapper">
  14. <u-list @scrolltolower="scrolltolower" class="listContent">
  15. <view v-for="(item, index) in tableList" :key="index" style="position: relative">
  16. <myCard :item="item" :index="index + 1" :btnList="btnList" :columns="columns" @submit="submit(item)"
  17. @view="open('view',item)" @edit="open('edit',item)" @cancel="cancel(item.id)">
  18. </myCard>
  19. </view>
  20. </u-list>
  21. </view>
  22. <view style="margin-top: 20vh" v-if="tableList.length == 0">
  23. <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
  24. </view>
  25. <!-- <view class="add" @click="open('add')">
  26. <u-icon name="plus" color="#fff"></u-icon>
  27. </view> -->
  28. <u-toast ref="uToast"></u-toast>
  29. <addSample ref='addSampleRef' @reload="doSearch"></addSample>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. samplingRecordsPage,
  35. listCancel
  36. } from "@/api/samplingRecords";
  37. import myCard from "@/pages/saleManage/components/myCard.vue";
  38. import {
  39. recordingMethodList
  40. } from "@/utils/utils.js";
  41. import addSample from './addSample.vue'
  42. import {
  43. processInstanceCreateAPI,
  44. processInstancePage
  45. } from '@/api/wt/index.js'
  46. export default {
  47. components: {
  48. myCard,
  49. addSample
  50. },
  51. data() {
  52. return {
  53. btnList: [{
  54. name: "详情",
  55. btnType: "primary",
  56. apiName: 'view',
  57. },
  58. {
  59. name: "编辑",
  60. btnType: "primary",
  61. apiName: 'edit',
  62. judge: [{
  63. key: "approvalStatus",
  64. value: [0, 3],
  65. },
  66. {
  67. key: "status",
  68. value: [0, 1, 2, 4],
  69. },
  70. ],
  71. },
  72. {
  73. name: "提交",
  74. btnType: "success",
  75. apiName: 'submit',
  76. judge: [{
  77. key: "approvalStatus",
  78. value: [0, 3],
  79. },
  80. {
  81. key: "status",
  82. value: [0, 1, 2, 4],
  83. },
  84. ],
  85. },
  86. {
  87. name: "作废",
  88. btnType: "error",
  89. apiName: 'cancel',
  90. judge: [{
  91. key: "approvalStatus",
  92. value: [0, 3],
  93. },
  94. {
  95. key: "status",
  96. value: [0, 1, 2, 4],
  97. },
  98. ],
  99. },
  100. ],
  101. columns: [
  102. [{
  103. label: "请样记录编码:",
  104. prop: "code",
  105. type: "title",
  106. className: "perce100",
  107. }, ],
  108. [{
  109. label: "质检工单编码:",
  110. prop: "qualityWorkOrderCode",
  111. },
  112. {
  113. label: "质检工单名称:",
  114. prop: "qualityWorkOrderName",
  115. },
  116. ],
  117. [{
  118. label: "质检方式:",
  119. prop: "qualityMode",
  120. formatter: (row) => {
  121. return row.qualityMode == 1 ? "全检" : "抽检";
  122. },
  123. },
  124. {
  125. label: "请样类型:",
  126. prop: "conditionType",
  127. formatter: (row) => {
  128. return row.conditionType == 1 ? "整样" : "小样";
  129. },
  130. },
  131. ],
  132. [{
  133. label: "编码:",
  134. prop: "productCode",
  135. },
  136. {
  137. label: "名称:",
  138. prop: "productName",
  139. },
  140. ],
  141. [{
  142. label: "批次号:",
  143. prop: "batchNo",
  144. },
  145. {
  146. label: "规格:",
  147. prop: "specification",
  148. },
  149. ],
  150. [{
  151. label: "请样数量:",
  152. prop: "sampleQuantity",
  153. },
  154. {
  155. label: "单位:",
  156. prop: "measureUnit",
  157. },
  158. ],
  159. [{
  160. label: "状态:",
  161. prop: "status",
  162. formatter: (row) => {
  163. return row.status == 1 ?
  164. "审核中" :
  165. row.status == 2 ?
  166. "已请样" :
  167. row.status == 3 ?
  168. "已作废" :
  169. row.status == 4 ?
  170. "不通过" :
  171. "未提交";
  172. },
  173. },
  174. {
  175. label: "审核状态:",
  176. prop: "approvalStatus",
  177. formatter: (row) => {
  178. const reviewStatus = {
  179. 0: "未提交",
  180. 1: "审核中",
  181. 2: "已审核",
  182. 3: "审核不通过",
  183. };
  184. return reviewStatus[row.approvalStatus];
  185. },
  186. },
  187. ],
  188. [{
  189. label: "创建人:",
  190. prop: "createUserName",
  191. },
  192. {
  193. label: "创建时间:",
  194. prop: "createTime",
  195. },
  196. ],
  197. [{
  198. label: "操作:",
  199. prop: "action",
  200. type: "action",
  201. className: "perce100",
  202. }, ],
  203. ],
  204. tableList: [],
  205. page: 1,
  206. size: 10,
  207. isEnd: false,
  208. qualityWorkOrderCode: "",
  209. };
  210. },
  211. computed: {},
  212. onShow() {
  213. this.isEnd = false;
  214. this.page = 1;
  215. this.getList();
  216. },
  217. methods: {
  218. async listSubmit(item) {
  219. try {
  220. //后台不提供接口
  221. let list = await processInstancePage({
  222. pageNo: 1,
  223. pageSize: 1,
  224. reset: true,
  225. key: 'sampling_approval_process'
  226. })
  227. let params = {
  228. businessId: item.id,
  229. businessKey: 'sampling_approval_process',
  230. formCreateUserId: item.createUserId,
  231. processDefinitionId: list?.list[0]?.processDefinition.id,
  232. variables: {
  233. businessCode: item.code,
  234. businessName: '请样',
  235. businessType: item.conditionType == 1 ? '整样' : '小样'
  236. },
  237. }
  238. await processInstanceCreateAPI(params)
  239. uni.showModal({
  240. title: `提交成功`,
  241. content: '',
  242. confirmText: '确认',
  243. showCancel: false, // 是否显示取消按钮,默认为 true
  244. success: () => {
  245. this.doSearch()
  246. }
  247. })
  248. } catch {
  249. }
  250. },
  251. open(type, row) {
  252. console.log(1212)
  253. this.$refs.addSampleRef.open(type, row);
  254. },
  255. doSearch() {
  256. this.isEnd = false;
  257. this.page = 1;
  258. this.getList();
  259. },
  260. getList() {
  261. let userInfo = uni.getStorageSync('userInfo')
  262. if (this.isEnd) {
  263. return;
  264. }
  265. uni.showLoading({
  266. title: "加载中",
  267. });
  268. let data = {
  269. pageNum: this.page,
  270. size: this.size,
  271. currentLoginUserId: userInfo.userId,
  272. qualityWorkOrderCode: this.qualityWorkOrderCode,
  273. };
  274. samplingRecordsPage(data)
  275. .then((res) => {
  276. if (this.page === 1) {
  277. this.tableList = res.list;
  278. } else {
  279. this.tableList.push(...res.list);
  280. }
  281. this.page += 1;
  282. this.isEnd = this.tableList.length >= res.count;
  283. })
  284. .then(() => {
  285. uni.hideLoading();
  286. });
  287. },
  288. cancel(id) {
  289. uni.showModal({
  290. title: "提示",
  291. content: "确定要作废此信息吗?",
  292. success: (res) => {
  293. if (res.confirm) {
  294. listCancel({
  295. id
  296. }).then((res) => {
  297. this.isEnd = false;
  298. this.page = 1;
  299. this.$refs.uToast.show({
  300. type: "success",
  301. message: "操作成功",
  302. });
  303. this.getList();
  304. });
  305. }
  306. },
  307. });
  308. },
  309. add() {
  310. uni.navigateTo({
  311. url: "/pages/qms/inspectionWork/list",
  312. });
  313. },
  314. scrolltolower() {
  315. if (this.isEnd) {
  316. return;
  317. }
  318. this.getList();
  319. },
  320. back() {
  321. uni.navigateBack();
  322. },
  323. submit(row) {
  324. // 提交逻辑,需要根据实际业务实现
  325. uni.showToast({
  326. title: "提交功能待实现",
  327. icon: "none",
  328. });
  329. },
  330. },
  331. };
  332. </script>
  333. <style lang="scss" scoped>
  334. .add {
  335. width: 96rpx;
  336. height: 96rpx;
  337. border-radius: 48rpx;
  338. background: #3c9cff;
  339. position: fixed;
  340. bottom: 100rpx;
  341. right: 24rpx;
  342. display: flex;
  343. align-items: center;
  344. justify-content: center;
  345. }
  346. .top-wrapper {
  347. background-color: #fff;
  348. display: flex;
  349. width: 750rpx;
  350. height: 88rpx;
  351. padding: 16rpx 32rpx;
  352. align-items: center;
  353. gap: 16rpx;
  354. /deep/.uni-section {
  355. margin-top: 0px;
  356. }
  357. /deep/.uni-section-header {
  358. padding: 0px;
  359. }
  360. .search_btn {
  361. width: 120rpx;
  362. height: 70rpx;
  363. line-height: 70rpx;
  364. padding: 0 24rpx;
  365. background: $theme-color;
  366. font-size: 32rpx;
  367. color: #fff;
  368. margin: 0;
  369. margin-left: 26rpx;
  370. }
  371. }
  372. </style>