index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <view class="order-v">
  3. <view class="head-warp com-dropdown">
  4. <u-dropdown class="u-dropdown" ref="uDropdown">
  5. <u-dropdown-item :title="$t('app.apply.sort')" :options="sortOptions">
  6. <view class="dropdown-slot-content">
  7. <view class="dropdown-slot-content-main">
  8. <u-cell-group>
  9. <u-cell-item @click="cellClick(item.value)" :arrow="false" :title="item.label"
  10. v-for="(item, index) in sortOptions" :key="index" :title-style="{
  11. color: sortValue == item.value ? '#2979ff' : '#606266' }">
  12. <u-icon v-if="sortValue == item.value" name="checkbox-mark" color="#2979ff"
  13. size="32"></u-icon>
  14. </u-cell-item>
  15. </u-cell-group>
  16. </view>
  17. <view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
  18. </view>
  19. </u-dropdown-item>
  20. <u-dropdown-item :title="$t('app.apply.screen')">
  21. <view class="dropdown-slot-content">
  22. <view class="dropdown-slot-content-main">
  23. <view class="u-p-l-32 u-p-r-32">
  24. <u-form label-position="left" label-width="150" label-align="left">
  25. <u-form-item :label="$t('component.jnpf.dateRange.startPlaceholder')" prop="startTime">
  26. <JnpfDatePicker v-model="listQuery.startTime" />
  27. </u-form-item>
  28. <u-form-item :label="$t('component.jnpf.dateRange.endPlaceholder')" prop="endTime">
  29. <JnpfDatePicker v-model="listQuery.endTime" />
  30. </u-form-item>
  31. </u-form>
  32. </view>
  33. <view class="buttom-actions">
  34. <u-button class="buttom-btn" @click="reset">{{$t('component.cropper.btn_reset')}}</u-button>
  35. <u-button class="buttom-btn" type="primary" @click="closeDropdown">{{$t('common.queryText')}}</u-button>
  36. </view>
  37. </view>
  38. <view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
  39. </view>
  40. </u-dropdown-item>
  41. </u-dropdown>
  42. </view>
  43. <view class="list-warp">
  44. <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" top="100"
  45. :up="upOption">
  46. <view class="flow-list">
  47. <uni-swipe-action ref="swipeAction">
  48. <uni-swipe-action-item v-for="(item, index) in list" :key="item.id" :right-options="options"
  49. @click="handleClick(index)">
  50. <view class="order-item" @click="goDetail(item.id,item.currentState,item.flowId)"
  51. :id="'item'+index">
  52. <view class="order-item-title u-border-bottom">
  53. <text class="order-title u-line-1">{{item.customerName}}</text>
  54. </view>
  55. <view class="order-item-down">
  56. <view class="order-item-cell u-flex">
  57. <text class="time">{{item.orderCode}}</text>
  58. <text :class="'status '+getFlowStatus(item.currentState).statusCss">
  59. {{getFlowStatus(item.currentState).text}}
  60. </text>
  61. </view>
  62. <view class="order-item-cell u-flex">
  63. <text class="time">{{item.salesmanName}}</text>
  64. <text class="time">{{$u.timeFormat(item.orderDate,'yyyy-mm-dd')}}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </uni-swipe-action-item>
  69. </uni-swipe-action>
  70. </view>
  71. </mescroll-uni>
  72. </view>
  73. <view class="com-addBtn" @click="addPage()" v-if="showAddBtn">
  74. <u-icon name="plus" size="48" color="#fff" />
  75. </view>
  76. <u-picker mode="selector" v-model="show" :default-selector="[0]" title="请选择流程" :range="selector"
  77. range-key="fullName" @confirm="confirm"></u-picker>
  78. </view>
  79. </template>
  80. <script>
  81. import resources from '@/libs/resources.js'
  82. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  83. import {
  84. getOrderList,
  85. Delete
  86. } from '@/api/apply/order'
  87. import {
  88. getFlowStartFormId
  89. } from '@/api/workFlow/flowEngine'
  90. export default {
  91. mixins: [MescrollMixin],
  92. data() {
  93. return {
  94. templateId: '',
  95. selector: [],
  96. show: false,
  97. sortValue: 0,
  98. sortOptions: [{
  99. label: '单据升序',
  100. value: 1,
  101. },
  102. {
  103. label: '单据降序',
  104. value: 2,
  105. },
  106. {
  107. label: '日期升序',
  108. value: 3,
  109. },
  110. {
  111. label: '日期降序',
  112. value: 4,
  113. }
  114. ],
  115. upOption: {
  116. page: {
  117. num: 0,
  118. size: 20,
  119. time: null
  120. },
  121. empty: {
  122. icon: resources.message.nodata,
  123. tip: this.$t('common.noData'),
  124. top: "300rpx"
  125. },
  126. textNoMore: this.$t('app.apply.noMoreData'),
  127. toTop: {
  128. bottom: 250
  129. }
  130. },
  131. list: [],
  132. listQuery: {
  133. sort: 'desc',
  134. sidx: '',
  135. keyword: '',
  136. startTime: '',
  137. endTime: ''
  138. },
  139. options: [{
  140. text: '删除',
  141. style: {
  142. backgroundColor: '#dd524d'
  143. }
  144. }],
  145. menuId: '',
  146. flowId: '585361795057715206',
  147. key: +new Date()
  148. }
  149. },
  150. computed: {
  151. showAddBtn() {
  152. return this.$permission.hasBtnP('btn_add', this.menuId)
  153. }
  154. },
  155. onLoad(e) {
  156. this.menuId = e.menuId
  157. },
  158. onShow() {
  159. this.$nextTick(() => {
  160. this.list = [];
  161. this.mescroll.resetUpScroll();
  162. })
  163. },
  164. onUnload() {
  165. uni.$off('refresh')
  166. },
  167. methods: {
  168. confirm(e) {
  169. this.jumPage()
  170. },
  171. upCallback(page) {
  172. let query = {
  173. currentPage: page.num,
  174. pageSize: page.size,
  175. flowId: this.flowId,
  176. ...this.listQuery
  177. }
  178. getOrderList(query, {
  179. load: page.num == 1
  180. }).then(res => {
  181. if (page.num == 1) this.list = [];
  182. this.mescroll.endSuccess(res.data.list.length);
  183. const list = res.data.list.map(o => ({
  184. show: false,
  185. ...o
  186. }));
  187. this.list = this.list.concat(list);
  188. this.$nextTick(() => {
  189. this.key = +new Date()
  190. })
  191. }).catch(() => {
  192. this.mescroll.endErr();
  193. })
  194. },
  195. handleClick(index, index1) {
  196. const item = this.list[index]
  197. if ([1, 2, 3, 5].includes(item.currentState)) {
  198. this.$u.toast("流程正在审核,请勿删除")
  199. this.list[index].show = false
  200. return
  201. }
  202. if (!this.$permission.hasBtnP('btn_remove', this.menuId)) return this.$u.toast("未开启删除权限")
  203. Delete(item.id).then(res => {
  204. this.$u.toast(res.msg)
  205. this.list.splice(index, 1)
  206. if (!this.list.length) this.mescroll.resetUpScroll()
  207. })
  208. this.$nextTick(() => {
  209. this.key = +new Date()
  210. })
  211. },
  212. open(index) {
  213. this.list[index].show = true;
  214. this.list.map((val, idx) => {
  215. if (index != idx) this.list[idx].show = false;
  216. })
  217. },
  218. search() {
  219. this.searchTimer && clearTimeout(this.searchTimer)
  220. this.searchTimer = setTimeout(() => {
  221. this.list = [];
  222. this.mescroll.resetUpScroll();
  223. }, 300)
  224. },
  225. addPage() {
  226. this.jumPage()
  227. },
  228. jumPage(id, status) {
  229. let opType = '-1'
  230. if ([1, 2, 4, 5, 6].includes(status)) opType = 0
  231. const config = {
  232. id: id,
  233. flowId: this.flowId,
  234. opType: opType,
  235. status: status,
  236. }
  237. uni.navigateTo({
  238. url: '/pages/workFlow/flowBefore/index?config=' +
  239. this.jnpf.base64.encode(JSON.stringify(config))
  240. })
  241. },
  242. goDetail(id, status, flowId) {
  243. if (!this.$permission.hasBtnP('btn_edit', this.menuId) && status == 3) return
  244. if (!this.$permission.hasBtnP('btn_detail', this.menuId) && [1, 2, 4, 5, 6].includes(status)) return
  245. this.jumPage(id, status)
  246. },
  247. getFlowStatus(val) {
  248. let status
  249. switch (val) {
  250. case 0:
  251. status = {
  252. text: '等待提交',
  253. statusCss: 'u-type-info'
  254. }
  255. break;
  256. case 1:
  257. status = {
  258. text: '等待审核',
  259. statusCss: 'u-type-primary'
  260. }
  261. break;
  262. case 2:
  263. status = {
  264. text: '审核通过',
  265. statusCss: 'u-type-success'
  266. }
  267. break;
  268. case 3:
  269. status = {
  270. text: '审核退回',
  271. statusCss: 'u-type-error'
  272. }
  273. break;
  274. case 4:
  275. case 7:
  276. status = {
  277. text: '流程撤回',
  278. statusCss: 'u-type-warning'
  279. }
  280. break;
  281. case 5:
  282. status = {
  283. text: '审核终止',
  284. statusCss: 'u-type-info'
  285. }
  286. break;
  287. default:
  288. status = {
  289. text: '等待提交',
  290. statusCss: 'u-type-info'
  291. }
  292. break;
  293. }
  294. return status
  295. },
  296. cellClick(val) {
  297. this.listQuery.sort = val == 1 || val == 3 ? 'asc' : 'desc'
  298. this.listQuery.sidx = val == 1 || val == 2 ? 'orderCode' : 'orderDate'
  299. this.sortValue = val
  300. this.$refs.uDropdown.close();
  301. this.$nextTick(() => {
  302. this.list = [];
  303. this.mescroll.resetUpScroll();
  304. })
  305. },
  306. reset() {
  307. this.listQuery.startTime = ''
  308. this.listQuery.endTime = ''
  309. },
  310. closeDropdown() {
  311. this.$refs.uDropdown.close();
  312. this.$nextTick(() => {
  313. this.list = [];
  314. this.mescroll.resetUpScroll();
  315. })
  316. }
  317. }
  318. }
  319. </script>
  320. <style lang="scss">
  321. page {
  322. background-color: #f0f2f6;
  323. height: 100%;
  324. /* #ifdef MP-ALIPAY */
  325. position: absolute;
  326. top: 0;
  327. left: 0;
  328. width: 100%;
  329. /* #endif */
  330. }
  331. .order-v {
  332. height: 100%;
  333. display: flex;
  334. flex-direction: column;
  335. .mescroll-empty {
  336. padding: 211px 27px
  337. }
  338. .head-warp {
  339. background-color: #fff;
  340. }
  341. .list-warp {
  342. flex: 1;
  343. min-width: 0;
  344. min-height: 0;
  345. .flow-list {
  346. margin: 0 20rpx;
  347. :deep(.uni-swipe) {
  348. border-radius: 10rpx;
  349. }
  350. .order-item {
  351. background-color: #fff;
  352. padding: 0 32rpx;
  353. .order-item-down {
  354. .order-item-cell {
  355. font-size: 28rpx;
  356. color: #333333;
  357. justify-content: space-between;
  358. padding: 10rpx 0;
  359. }
  360. }
  361. .order-item-title {
  362. height: 90rpx;
  363. line-height: 90rpx;
  364. width: 100%;
  365. font-size: 30rpx;
  366. .order-title {
  367. display: block;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. }
  374. </style>