index.vue 7.3 KB

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