index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back"
  4. title="配件申请记录" @clickLeft="back">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <uni-section>
  8. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
  9. </uni-easyinput>
  10. </uni-section>
  11. <button class="search_btn" @click="doSearch">搜索</button>
  12. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  13. </view>
  14. <view class="wrapper">
  15. <u-list @scrolltolower="scrolltolower" class="listContent" style="height: auto;">
  16. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  17. <myCard :columns="columns" :btnList="btnList" :item="item" @details="add(item,'view')"
  18. @edit="add(item,'edit')">
  19. </myCard>
  20. </view>
  21. </u-list>
  22. </view>
  23. <view class="add" @click="add('','add')">
  24. <u-icon name="plus" color="#fff"></u-icon>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. accessoryPage,
  31. } from '@/api/salesServiceManagement/accessory/index.js';
  32. import myCard from '@/pages/saleManage/components/myCard.vue';
  33. export default {
  34. components: {
  35. myCard
  36. },
  37. data() {
  38. return {
  39. columns: [
  40. [{
  41. label: '编号:',
  42. prop: 'code',
  43. type: 'title',
  44. className: 'perce100',
  45. }],
  46. [{
  47. label: '工单编码:',
  48. prop: 'orderCode'
  49. }],
  50. [{
  51. label: '物品分类:',
  52. prop: 'categoryLevelName',
  53. formatter: (row) => {
  54. if (!row.details) return '';
  55. let str = '';
  56. row.details.map((el, idx) => {
  57. if (idx + 1 == row.details.length) {
  58. str += el.categoryLevelName;
  59. } else {
  60. str = el.categoryLevelName ?
  61. str + '' + el.categoryLevelName + ',' :
  62. str + '';
  63. }
  64. });
  65. return str;
  66. }
  67. }],
  68. [{
  69. label: '物品名称:',
  70. prop: 'categoryName',
  71. formatter: (row) => {
  72. if (!row.details) return '';
  73. let str = '';
  74. row.details.map((el, idx) => {
  75. if (idx + 1 == row.details.length) {
  76. str += el.categoryName;
  77. } else {
  78. str = str + '' + el.categoryName + ',';
  79. }
  80. });
  81. return str;
  82. }
  83. }],
  84. [{
  85. label: '领用部门:',
  86. prop: 'receivingDeptName',
  87. }, {
  88. label: '领用人:',
  89. prop: 'recipientName',
  90. }],
  91. [{
  92. label: '客户名称:',
  93. prop: 'contactName'
  94. }],
  95. [{
  96. label: '设备名称:',
  97. prop: 'categoryName',
  98. formatter: (row) => {
  99. if (!row.deviceDetails) return '';
  100. let str = '';
  101. row.deviceDetails.map((el, idx) => {
  102. if (idx + 1 == row.deviceDetails.length) {
  103. str += el.categoryName;
  104. } else {
  105. str = str + '' + el.categoryName + ',';
  106. }
  107. });
  108. return str;
  109. }
  110. }],
  111. [{
  112. label: '创建时间:',
  113. prop: 'createTime'
  114. }, {
  115. label: '使用时间:',
  116. prop: 'usageTime',
  117. }],
  118. [{
  119. label: '操作:',
  120. prop: 'action',
  121. type: 'action',
  122. className: 'perce100',
  123. }],
  124. ],
  125. btnList: [{
  126. name: '详情',
  127. apiName: 'details',
  128. btnType: 'primary',
  129. type: '2',
  130. pageUrl: '',
  131. }, {
  132. name: '修改',
  133. apiName: 'edit',
  134. btnType: 'primary',
  135. type: '2',
  136. pageUrl: '',
  137. judge: [{
  138. authorities: '',
  139. }, {
  140. key: 'source',
  141. value: [0],
  142. }],
  143. }],
  144. page: 1,
  145. size: 10,
  146. isEnd: false,
  147. tableList: [],
  148. searchVal: ''
  149. }
  150. },
  151. created() {
  152. },
  153. onShow() {
  154. this.doSearch();
  155. },
  156. methods: {
  157. doSearch() {
  158. this.isEnd = false;
  159. this.page = 1;
  160. this.getList();
  161. },
  162. //获取列表信息
  163. getList() {
  164. if (this.isEnd) {
  165. return;
  166. }
  167. uni.showLoading({
  168. title: '加载中'
  169. })
  170. let data = {
  171. pageNum: this.page,
  172. size: this.size,
  173. }
  174. accessoryPage(data).then(res => {
  175. if (this.page === 1) {
  176. this.tableList = res.list;
  177. } else {
  178. this.tableList.push(...res.list);
  179. }
  180. this.page += 1
  181. this.isEnd = this.tableList.length >= res.count;
  182. uni.hideLoading();
  183. }).catch((e) => {
  184. uni.hideLoading();
  185. })
  186. },
  187. scrolltolower() {
  188. if (this.isEnd) {
  189. return;
  190. }
  191. this.getList();
  192. },
  193. add(item, type) {
  194. console.log(item, 'item ---')
  195. uni.navigateTo({
  196. url: `/pages/salesServiceManagement/accessory/accessoryAdd?type=${type}&id=${item.id}`
  197. })
  198. },
  199. }
  200. }
  201. </script>
  202. <style scoped lang="scss">
  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: 120rpx;
  219. height: 70rpx;
  220. line-height: 70rpx;
  221. padding: 0 24rpx;
  222. background: $theme-color;
  223. font-size: 32rpx;
  224. color: #fff;
  225. margin: 0;
  226. margin-left: 26rpx;
  227. }
  228. .menu_icon {
  229. width: 44rpx;
  230. height: 44rpx;
  231. margin-left: 14rpx;
  232. }
  233. }
  234. .add {
  235. width: 96rpx;
  236. height: 96rpx;
  237. border-radius: 48rpx;
  238. background: #3c9cff;
  239. position: fixed;
  240. bottom: 100rpx;
  241. right: 24rpx;
  242. display: flex;
  243. align-items: center;
  244. justify-content: center;
  245. }
  246. </style>