pending.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view class="content pending">
  3. <u-sticky bgColor="#fff">
  4. <view class="search-wrap">
  5. <view class="input-wrap">
  6. <u-search
  7. bgColor='#fff'
  8. :showAction='false'
  9. :placeholder="$t('base.list.inputPlaceholder')"
  10. @search="searchList"
  11. @clear='searchList'
  12. v-model="keyword">
  13. </u-search>
  14. <view class="search-btn" @click="searchList">{{$t("customer_meter.search")}}</view>
  15. </view>
  16. <!-- <uni-icons type="settings-filled" size='24' @click="onClickRight"></uni-icons> -->
  17. </view>
  18. </u-sticky>
  19. <view class="swiper-box">
  20. <template v-if="allPendingList.length">
  21. <u-list @scrolltolower="scrolltolower" :preLoadScreen="1.5">
  22. <u-list-item v-for="(item, index) in allPendingList" :key="index">
  23. <view class="order-card">
  24. <view class="order-card-title">
  25. {{$t('approval.approvalTitle')}}:{{item.fullName}}
  26. <u-tag v-if="item.status == 1" size="mini" plain borderColor="#4680F9" color="#4680F9" :text="$t('approval.examLoading')"></u-tag>
  27. <u-tag v-if="item.status == 2" size="mini" plain borderColor="#4680F9" color="#4680F9" :text="$t('approval.examPass')"></u-tag>
  28. <u-tag v-if="item.status == 3" size="mini" plain borderColor="#4680F9" color="#4680F9" :text="$t('approval.examReject')"></u-tag>
  29. <u-tag v-if="item.status == 4" size="mini" plain borderColor="#4680F9" color="#4680F9" :text="$t('approval.processReject')"></u-tag>
  30. <u-tag v-if="item.status == 5" size="mini" plain borderColor="#4680F9" color="#4680F9" :text="$t('approval.examStop')"></u-tag>
  31. </view>
  32. <view class="order-info">
  33. <p class="info-line">
  34. <text class="label">{{$t('approval.process')}}:</text>
  35. <text class="info">{{item.flowName || ''}}</text>
  36. </p>
  37. <p class="info-line">
  38. <text class="label">{{$t('approval.originatingTime')}}:</text>
  39. <text class="info">{{formatTime(item.startTime) || ''}}</text>
  40. </p>
  41. <p class="info-line">
  42. <text class="label">{{$t('approval.originator')}}:</text>
  43. <text class="info">{{item.userName || ''}}</text>
  44. </p>
  45. <p class="info-line">
  46. <text class="label">{{$t('approval.currentNode')}}:</text>
  47. <text class="info">{{item.thisStep || item.currentNodeName || ''}}</text>
  48. </p>
  49. <!-- <p class="info-line">
  50. <text class="label">{{$t('approval.urgency')}}</text>
  51. <text class="info" v-if="item.flowUrgent == 1">{{$t('approval.ordinary')}}</text>
  52. <text class="info" v-if="item.flowUrgent == 2">{{$t('approval.important')}}</text>
  53. <text class="info" v-if="item.flowUrgent == 3">{{$t('approval.urgent')}}</text>
  54. </p> -->
  55. <p class="info-line">
  56. <text class="label">{{$t('approval.timeReceipt')}}:</text>
  57. <text class="info">{{item.claimTime || ''}}</text>
  58. </p>
  59. <p class="info-line">
  60. <text class="label">{{$t('approval.expirationTime')}}:</text>
  61. <text class="info">{{item.dueDate || ''}}</text>
  62. </p>
  63. </view>
  64. <view>
  65. <view class="card-oper">
  66. <view class="btn">
  67. <button class="oper-btn bule" @click="audit(item)">{{$t('approval.adopt')}}</button>
  68. </view>
  69. <view class="btn">
  70. <button class="oper-btn red" @click="reject(item)">{{$t('approval.refuse')}}</button>
  71. </view>
  72. <view class="btn">
  73. <button class="oper-btn info" @click="checkView(item)">{{$t('approval.details')}}</button>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </u-list-item>
  79. </u-list>
  80. </template>
  81. <template v-else>
  82. <u-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png">
  83. </u-empty>
  84. </template>
  85. </view>
  86. <u-loading-page
  87. color="#666"
  88. loading-mode="semicircle"
  89. :loading="loading">
  90. </u-loading-page>
  91. <u-modal :show="showReject" @confirm="confirm('reject')" ref="addModal" showCancelButton closeOnClickOverlay @cancel="showReject=false" @close="showReject=false">
  92. <view class="invite-box">
  93. <view class="invite-box-title">{{$t('approval.approvalComments')}}</view>
  94. <u--input :placeholder="$t('base.common.placeholderII')+$t('approval.approvalComments')" border="surround" v-model="handleOpinion"></u--input>
  95. </view>
  96. </u-modal>
  97. <u-modal :show="showAudit" @confirm="confirm('audit')" ref="addModal" showCancelButton closeOnClickOverlay @cancel="showAudit=false" @close="showAudit=false">
  98. <view class="invite-box">
  99. <view class="invite-box-title">{{$t('approval.approvalComments')}}</view>
  100. <u--input :placeholder="$t('base.common.placeholderII')+$t('approval.approvalComments')" border="surround" v-model="handleOpinion"></u--input>
  101. </view>
  102. </u-modal>
  103. <u-toast ref="loadingToast" />
  104. </view>
  105. </template>
  106. <script>
  107. import dayjs from 'dayjs'
  108. import {
  109. getPendingList,
  110. audit, //通过
  111. reject, //拒绝
  112. getApprovalInfo,
  113. } from "../../api/approval"
  114. import uniAgreementsVue from '../../components/uni-agreements/uni-agreements.vue'
  115. export default {
  116. data(){
  117. return{
  118. handleOpinion:'',
  119. showAudit:false,
  120. showReject:false,
  121. dayjs,
  122. page: {
  123. pages: 1,
  124. size: 10,
  125. },
  126. hasMore:false,
  127. allPendingList:[],
  128. keyword:'',
  129. loading:true,
  130. currentItem:undefined,
  131. currentId:undefined,
  132. enCode:undefined,
  133. }
  134. },
  135. onLoad(options) {
  136. this.getPendingList()
  137. },
  138. methods:{
  139. getPendingList(){
  140. this.loading=true
  141. let data={
  142. currentPage:this.page.pages,
  143. pageSize:this.page.size,
  144. keyword:this.keyword || '',
  145. }
  146. getPendingList(1,data).then(res=>{
  147. if (res.data.code == 200) {
  148. if (this.hasMore) {
  149. this.allPendingList = [
  150. ...this.allPendingList,
  151. ...res.data.data.list,
  152. ];
  153. } else {
  154. this.allPendingList = res.data.data.list;
  155. }
  156. console.log(this.allPendingList);
  157. this.total = res.data.data.pagination.total
  158. if (this.allPendingList.length >= this.total) {
  159. this.hasMore = false;
  160. } else {
  161. this.hasMore = true;
  162. }
  163. this.loading = false
  164. }
  165. })
  166. },
  167. audit(item){
  168. let encode = item.flowCode[0].toUpperCase()+item.flowCode.slice(1)
  169. getApprovalInfo(encode,item.processId).then(res=>{
  170. if(res.data.code == 200){
  171. this.currentItem = res.data.data
  172. this.showAudit = true
  173. this.currentId = item.id
  174. this.enCode=item.flowCode
  175. }
  176. })
  177. },
  178. reject(item){
  179. let encode = item.flowCode[0].toUpperCase()+item.flowCode.slice(1)
  180. getApprovalInfo(encode,item.processId).then(res=>{
  181. if(res.data.code == 200){
  182. this.currentItem = res.data.data
  183. this.showReject = true
  184. this.currentId = item.id
  185. this.enCode=item.flowCode
  186. }
  187. })
  188. },
  189. //确定
  190. confirm(value){
  191. let _this = this
  192. let data = {
  193. enCode:this.enCode,
  194. formData:this.currentItem,
  195. handleOpinion:this.handleOpinion,
  196. copyIds: "",
  197. signImg: ""
  198. }
  199. this.showReject=false
  200. this.showAudit=false
  201. this.$refs.loadingToast.show({
  202. type:"loading",
  203. message: _this.$t('base.common.loading'),
  204. duration:'100000',
  205. })
  206. if(value == 'audit'){
  207. audit(this.currentId,data).then(res=>{
  208. this.$refs.loadingToast.hide()
  209. if(res.data.code == 200){
  210. uni.showToast({
  211. title: _this.$t('approval.approved'),
  212. icon: 'success',
  213. })
  214. this.searchList()
  215. }else{
  216. uni.showToast({
  217. title: res.data.msg || _this.$t('base.common.equestFailed'),
  218. icon: 'none',
  219. })
  220. }
  221. })
  222. }else{
  223. reject(this.currentId,data).then(res=>{
  224. this.$refs.loadingToast.hide()
  225. if(res.data.code == 200){
  226. uni.showToast({
  227. title: _this.$t('approval.approvalRejection'),
  228. icon: 'success',
  229. })
  230. this.searchList()
  231. }else{
  232. uni.showToast({
  233. title: res.data.msg || _this.$t('base.common.equestFailed'),
  234. icon: 'none',
  235. })
  236. }
  237. })
  238. }
  239. },
  240. //加载更多
  241. scrolltolower() {
  242. console.log("1111111111111111");
  243. if (this.hasMore) {
  244. this.page.pages += 1;
  245. this.getPendingList();
  246. }
  247. },
  248. checkView(item){
  249. console.log(item);
  250. uni.navigateTo({ url: '/subpages/approvalform/'+item.flowCode+'?id='+item.processId })
  251. },
  252. //搜索列表
  253. searchList(){
  254. this.page.pages = 1
  255. this.hasMore = false
  256. this.getPendingList()
  257. },
  258. //转化时间
  259. formatTime(time){
  260. let str =''
  261. if(time){
  262. time = Number(time)
  263. str=dayjs(time).format('YYYY-MM-DD HH:mm:ss')
  264. }else{
  265. str =''
  266. }
  267. return str
  268. }
  269. }
  270. }
  271. </script>
  272. <style>
  273. /* #ifndef APP-NVUE */
  274. view {
  275. /* display: flex; */
  276. box-sizing: border-box;
  277. /* flex-direction: column; */
  278. }
  279. page {
  280. box-sizing: border-box;
  281. /* padding: 40rpx 40rpx 80rpx; */
  282. height: 100%;
  283. }
  284. /* #endif*/
  285. </style>
  286. <style lang="scss" scoped>
  287. @import '../../common/css/approval.scss';
  288. /deep/ .u-modal__content{
  289. flex-direction: column;
  290. }
  291. </style>