index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="采购需求"
  4. @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 v-for="(item, index) in tableList" :key="index" style="position: relative;">
  15. <myCard @del="del(item)" :item="item" :index="index+1" :columns="columns" :btnList="btnList"></myCard>
  16. </view> -->
  17. <view class="wrapper">
  18. <u-list @scrolltolower="scrolltolower" class="listContent">
  19. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  20. <myCard @del="del(item)" :item="item" :index="index+1" :columns="columns" :btnList="btnList">
  21. </myCard>
  22. </view>
  23. </u-list>
  24. </view>
  25. <view style='margin-top: 20vh;' v-if="tableList.length==0">
  26. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  27. </u-empty>
  28. </view>
  29. <view class="add" @click="add">
  30. <u-icon name="plus" color="#fff"></u-icon>
  31. </view>
  32. <u-toast ref="uToast"></u-toast>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getTableList,
  38. deleteInformation
  39. } from '@/api/purchasingManage/purchaseNeedManage.js'
  40. import myCard from '../components/myCard.vue'
  41. import { reviewStatusEnum } from "@/enum/dict";
  42. export default {
  43. components: {
  44. myCard,
  45. },
  46. data() {
  47. return {
  48. tableList: [],
  49. searchVal: '',
  50. page: 1,
  51. size: 10,
  52. isEnd: false,
  53. current: {},
  54. btnList: [{
  55. name: '详情',
  56. apiName: '',
  57. btnType: 'primary',
  58. type: '1',
  59. pageUrl: '/pages/purchasingManage/purchaseNeedManage/components/drawer',
  60. },
  61. {
  62. name: '修改',
  63. apiName: '',
  64. btnType: 'primary',
  65. type: '1',
  66. pageUrl: '/pages/saleManage/businessOpportunity/add',
  67. judge: [{
  68. authorities: '',
  69. }, {
  70. key: 'status',
  71. value: [0, 3],
  72. }],
  73. },
  74. {
  75. name: '提交',
  76. apiName: '',
  77. btnType: 'primary',
  78. type: '1',
  79. pageUrl: '/pages/saleManage/businessOpportunity/followList',
  80. judge: [{
  81. authorities: '',
  82. }, {
  83. key: 'status',
  84. value: [0, 3],
  85. }],
  86. },
  87. {
  88. name: '删除',
  89. apiName: 'del',
  90. btnType: 'error',
  91. type: '2',
  92. pageUrl: '',
  93. judge: [{
  94. }, {
  95. key: 'status',
  96. value: [0, 3]
  97. }],
  98. }],
  99. columns: [
  100. [{
  101. label: '名称:',
  102. prop: 'requirementName',
  103. type: 'title',
  104. className: 'perce100',
  105. }],
  106. [{
  107. label: '编码:',
  108. prop: 'requirementCode'
  109. }, {
  110. label: '产品名称:',
  111. prop: 'productNames'
  112. }],
  113. [{
  114. label: '需求类型:',
  115. prop: 'sourceTypeName'
  116. }, {
  117. label: '需求部门:',
  118. prop: 'requireDeptName'
  119. }],
  120. [{
  121. label: '需求人:',
  122. prop: 'requireUserName'
  123. }, {
  124. label: '创建时间:',
  125. prop: 'createTime'
  126. }],
  127. [{
  128. label: '状态:',
  129. prop: 'status',
  130. formatter: (row) => {
  131. return reviewStatusEnum.find(item => item.value === row.status)?.label || '';
  132. }
  133. }],
  134. [{
  135. label: '操作:',
  136. prop: 'action',
  137. type: 'action',
  138. className: 'perce100',
  139. }],
  140. ]
  141. }
  142. },
  143. computed: {
  144. },
  145. onShow() {
  146. this.isEnd = false
  147. this.page = 1
  148. this.getList()
  149. },
  150. methods: {
  151. doSearch() {
  152. this.isEnd = false
  153. this.page = 1
  154. this.getList()
  155. },
  156. //获取列表信息
  157. getList() {
  158. if (this.isEnd) {
  159. return
  160. }
  161. uni.showLoading({
  162. title: '加载中'
  163. })
  164. let data = {
  165. pageNum: this.page,
  166. size: this.size,
  167. type: 1,
  168. searchName: this.searchVal
  169. }
  170. getTableList(data).then(res => {
  171. if (this.page === 1) {
  172. this.tableList = res.list
  173. } else {
  174. this.tableList.push(...res.list)
  175. }
  176. this.page += 1
  177. this.isEnd = this.tableList.length >= res.count
  178. }).then(() => {
  179. uni.hideLoading()
  180. })
  181. },
  182. add() {
  183. uni.navigateTo({
  184. url: '/pages/purchasingManage/purchaseNeedManage/add'
  185. })
  186. },
  187. view() {
  188. },
  189. del(item) {
  190. uni.showModal({
  191. title: '提示',
  192. content: '确定删除吗?',
  193. success: (res) => {
  194. if (res.confirm) {
  195. deleteInformation([item.id]).then(res => {
  196. this.isEnd = false
  197. this.page = 1
  198. this.$refs.uToast.show({
  199. type: "success",
  200. message: "操作成功",
  201. })
  202. this.getList(this.where)
  203. }).catch(() => {
  204. // this.$refs.uToast.show({
  205. // type: "error",
  206. // message: "操作失败",
  207. // })
  208. })
  209. }
  210. }
  211. })
  212. },
  213. scrolltolower() {
  214. if (this.isEnd) {
  215. return
  216. }
  217. this.getList();
  218. },
  219. }
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .add {
  224. width: 96rpx;
  225. height: 96rpx;
  226. border-radius: 48rpx;
  227. background: #3c9cff;
  228. position: fixed;
  229. bottom: 100rpx;
  230. right: 24rpx;
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. }
  235. .top-wrapper {
  236. background-color: #fff;
  237. display: flex;
  238. width: 750rpx;
  239. height: 88rpx;
  240. padding: 16rpx 32rpx;
  241. align-items: center;
  242. gap: 16rpx;
  243. /deep/.uni-section {
  244. margin-top: 0px;
  245. }
  246. /deep/.uni-section-header {
  247. padding: 0px;
  248. }
  249. .search_btn {
  250. width: 120rpx;
  251. height: 70rpx;
  252. line-height: 70rpx;
  253. padding: 0 24rpx;
  254. background: $theme-color;
  255. font-size: 32rpx;
  256. color: #fff;
  257. margin: 0;
  258. margin-left: 26rpx;
  259. }
  260. .menu_icon {
  261. width: 44rpx;
  262. height: 44rpx;
  263. margin-left: 14rpx;
  264. }
  265. }
  266. </style>