transferRecord.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <!-- 调拨记录 -->
  3. <view>
  4. <u-navbar title="调拨记录" autoBack placeholder></u-navbar>
  5. <view class="tabs_card_bg">
  6. <u-tabs :list="list4" :current="belowStandard" lineWidth="20" :scrollable="false" lineHeight="7"
  7. :lineColor="`url(${lineBg}) 100% 100%`" @click="standardClick"
  8. itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;">
  9. </u-tabs>
  10. <u-tabs :current="tabNumber" :list="bottleList" lineWidth="40" :scrollable="false" @click="bottleClick"
  11. itemStyle="padding: 15rpx;"></u-tabs>
  12. </view>
  13. <view style="padding-bottom: 30rpx;" v-if="list.length > 0">
  14. <view class="transfer_card_item" v-for="(item,index) in list" :key="index" @click="recordParticulars(item)">
  15. <view class="title_status" :style="{color:getColor(item.status)}">{{ getstatus(item.status) }}</view>
  16. <view class="item_title_record1" v-if="getFlowStep(item.optType)">
  17. <span>流转步骤:</span>
  18. {{getFlowStep(item.optType)}}
  19. </view>
  20. <view class="item_title_record1">
  21. <span>调拨人:</span>
  22. {{item.allotUser.nickName}}
  23. </view>
  24. <view class="item_title_record">
  25. <span>接收人:</span>
  26. {{item.acceptUser.nickName}}
  27. </view>
  28. <view class="item_title_record">
  29. <span>调拨时间:</span>
  30. {{item.createdAt}}
  31. </view>
  32. <view class="item_title_record">
  33. <span>单位内编号:</span>
  34. <span class="examine_title" @click.stop="clickToView(item)">点击查看</span>
  35. </view>
  36. <view style="margin-top: 20rpx;" @click.stop="cancelAllocation(item)" v-if="item.status == 1">
  37. <u-button type="warning" size="normal" text="取消调拨"></u-button>
  38. </view>
  39. <view style="margin-top: 20rpx;" @click.stop="delAllocation(item)" v-if="item.status == 3">
  40. <u-button type="error" text="删除"></u-button>
  41. </view>
  42. </view>
  43. </view>
  44. <view style="margin-top: 40%;" v-else>
  45. <u-empty mode="list" text="暂无调拨记录"></u-empty>
  46. </view>
  47. <u-popup :show="innerCodeShow" round="10" @close="close">
  48. <view style="display: flex;flex-direction: column;touch-action: none;">
  49. <view class="headlinetitle">
  50. <view class="title_head_code">单位内编号</view>
  51. <span>总数: {{innerCodeData.length}}</span>
  52. </view>
  53. <view style="max-height: 800rpx;overflow-y: auto;overscroll-behavior: none;">
  54. <view class="card_inner_item" v-for="(item,index) in innerCodeData" :key="index">
  55. <view class="title_index_item">{{index + 1}}</view>
  56. <view>{{item}}</view>
  57. </view>
  58. </view>
  59. </view>
  60. </u-popup>
  61. <u-modal :show="hintShow" :content='hintTitle' showCancelButton @confirm="confirmAllocation" @cancel="hintShow = false"></u-modal>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. flowStep
  67. } from '@/static/js/blockSort.js'
  68. export default {
  69. data() {
  70. return {
  71. lineBg: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAOCAYAAABdC15GAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFxSURBVHgBzZNRTsJAEIb/WTW+lpiY+FZPIDew3ABP4GJ8hxsI9zBpOYHeQDwBPQI+mRiRvpLojtPdYhCorQqF/6GdbGd2vvwzBXZcNAt4oj1ANeUoAT5iqkUjbEFLHNmhD1YPEvpZ3ghkGlVDCkc94/BmHMq998I5ONiY1ZBfpKAyuOtgAc5yOEDmYEWNh32BHF91sGHZHmwW4azciN9aQwnz3SJEgOmte+R2tdLprTYoa50mvuomlLpD4Y3oQZnov6D2RzCqI93bWOHaEmAGqQUyRBlZR1WfarcD/EJ2z8DtzDGvsMCwpm8XOCfDUsVOCYhiqRxI/CTQo4UOvjzO7Pow18vfywneuUHHUUxLn55lLw5JFpZ8bEUcY8oXdOLWiHLTxvoGpLqoUmy6dBT15o/ox3znpoycAmxUsiJTbs1cmxeVKp+0zmFIS7bGWiVghC7Vwse8jFKAX9eljh4ggKLLv7uaQvG9/F59Oo2SouxPu7OTCxN/s8wAAAAASUVORK5CYII=',
  72. list4: [{
  73. name: '我调拨的',
  74. }, {
  75. name: '我接收的'
  76. }],
  77. belowStandard: 0,
  78. bottleList: [{
  79. name: '全部',
  80. }, {
  81. name: '调拨中',
  82. }, {
  83. name: '已完成'
  84. }, {
  85. name: '已取消'
  86. }, {
  87. name: '超时取消'
  88. }],
  89. tabNumber: 0,
  90. // allot-我调拨的 accept-我签收的
  91. myType: 'allot',
  92. list: [],
  93. Pagination: {
  94. PageIndex: 1,
  95. PageSize: 20,
  96. Total: 0,
  97. },
  98. loadingMore: true,
  99. innerCodeShow: false,
  100. innerCodeData: [],
  101. hintShow: false,
  102. allotId: null,
  103. hintTitle: '此操作将永久删除该调拨记录, 是否继续?',
  104. }
  105. },
  106. onReachBottom() {
  107. if (!this.loadingMore) {
  108. this.getList()
  109. }
  110. },
  111. onShow() {
  112. this.Pagination.PageIndex = 1
  113. this.list = []
  114. this.getList()
  115. },
  116. methods: {
  117. getList() {
  118. uni.showLoading({
  119. mask: true,
  120. });
  121. let statusNum = ''
  122. if (this.tabNumber != 0) {
  123. statusNum = this.tabNumber
  124. }
  125. this.loadingMore = true
  126. this.$api.get('/api/gas-cylinder-allot', {
  127. my: this.myType,
  128. status: statusNum,
  129. page: this.Pagination.PageIndex,
  130. pageSize: this.Pagination.PageSize,
  131. }).then(res => {
  132. if (res.code == 200) {
  133. const data = res.data.list
  134. if (this.loadingMore == true && data) {
  135. this.list = this.list.concat(data);
  136. }
  137. if (data.length < this.Pagination.PageSize) {
  138. this.loadingMore = true
  139. } else {
  140. this.loadingMore = false
  141. this.Pagination.PageIndex++
  142. }
  143. }
  144. uni.hideLoading();
  145. }).catch(() => {
  146. uni.hideLoading();
  147. })
  148. },
  149. // 点击查看
  150. clickToView(value) {
  151. this.innerCodeShow = true
  152. this.innerCodeData = value.innerCodeList
  153. },
  154. getstatus(value) {
  155. if (value == 1) {
  156. return '调拨中'
  157. } else if (value == 2) {
  158. return '已完成'
  159. } else if (value == 3) {
  160. return '已取消'
  161. } else if (value == 4) {
  162. return '超时取消'
  163. }
  164. },
  165. // 调拨状态
  166. bottleClick(event) {
  167. this.tabNumber = event.index
  168. this.Pagination.PageIndex = 1
  169. this.list = []
  170. this.getList()
  171. },
  172. // 我调拨的/我接收的
  173. standardClick(event) {
  174. console.log(event, 25)
  175. this.belowStandard = event.index
  176. if (event.index == 0) {
  177. this.bottleList[1].name = '调拨中'
  178. this.myType = 'allot'
  179. } else {
  180. this.bottleList[1].name = '接收'
  181. this.myType = 'accept'
  182. }
  183. this.Pagination.PageIndex = 1
  184. this.list = []
  185. this.getList()
  186. },
  187. // 取消调拨
  188. cancelAllocation(event) {
  189. this.$api.post('/api/gas-cylinder-allot/cancel', {
  190. id: event.id,
  191. }).then(res => {
  192. if (res.code == 200) {
  193. this.list = []
  194. uni.$u.toast(res.msg)
  195. this.getList()
  196. }
  197. })
  198. },
  199. // 删除
  200. delAllocation(event) {
  201. this.hintShow = true
  202. this.allotId = event.id
  203. },
  204. // 确定删除
  205. confirmAllocation() {
  206. this.$api.delete('/api/gas-cylinder-allot', {
  207. id: this.allotId,
  208. }).then(res => {
  209. if (res.code == 200) {
  210. this.list = []
  211. uni.$u.toast(res.msg)
  212. this.getList()
  213. }
  214. this.hintShow = false
  215. })
  216. },
  217. // 详情
  218. recordParticulars(value) {
  219. uni.setStorageSync('transferData', JSON.stringify(value));
  220. uni.navigateTo({
  221. url: '/pages/information/transferDetails?type=' + this.belowStandard
  222. });
  223. },
  224. getColor(value) {
  225. if (value == 1) {
  226. return '#3c9cff'
  227. } else if (value == 2) {
  228. return '#5ac725'
  229. } else if (value == 3) {
  230. return '#909399'
  231. } else if (value == 4) {
  232. return '#909399'
  233. }
  234. },
  235. getFlowStep(value) {
  236. let array = flowStep()
  237. const filteredArray = array.filter(item => item.value === value)
  238. if (filteredArray.length > 0) {
  239. return filteredArray[0].label
  240. }
  241. },
  242. close() {
  243. this.innerCodeShow = false
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="scss">
  249. page {
  250. background-color: #f4f4f5;
  251. }
  252. .u-button--normal {
  253. height: 70rpx !important;
  254. }
  255. .tabs_card_bg {
  256. background-color: #fff;
  257. }
  258. .transfer_card_item {
  259. position: relative;
  260. background-color: #fff;
  261. margin: 30rpx;
  262. padding: 30rpx;
  263. border-radius: 10rpx;
  264. }
  265. .title_status {
  266. position: absolute;
  267. right: 20rpx;
  268. top: 20rpx;
  269. display: flex;
  270. justify-content: flex-end;
  271. font-size: 28rpx;
  272. }
  273. .item_title_record1 {
  274. font-size: 30rpx;
  275. span {
  276. font-size: 28rpx;
  277. color: #909399;
  278. }
  279. .examine_title {
  280. cursor: pointer;
  281. color: #2979ff;
  282. }
  283. }
  284. .item_title_record {
  285. font-size: 30rpx;
  286. margin-top: 10rpx;
  287. span {
  288. font-size: 28rpx;
  289. color: #909399;
  290. }
  291. .examine_title {
  292. cursor: pointer;
  293. color: #2979ff;
  294. }
  295. }
  296. .title_index_item {
  297. color: #909399;
  298. margin-right: 20rpx;
  299. }
  300. .headlinetitle {
  301. display: flex;
  302. justify-content: space-between;
  303. align-items: center;
  304. padding: 30rpx;
  305. border-bottom: 1rpx solid #d7d7d7;
  306. span {
  307. color: #2979ff;
  308. }
  309. }
  310. .title_head_code {
  311. font-size: 34rpx;
  312. font-weight: 600;
  313. }
  314. .card_inner_item {
  315. display: flex;
  316. align-items: center;
  317. padding: 30rpx;
  318. border-bottom: 1rpx solid #d7d7d7;
  319. }
  320. </style>