You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

381 lines
13 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 主列表页 -->
  4. <view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
  5. <!-- 顶部条目/分页信息栏 -->
  6. <l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner>
  7. <!-- 滚动列表,跨端支持上拉/下拉 -->
  8. <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
  9. <l-customlist :tips="loadState" showTips>
  10. <!-- 单条记录 -->
  11. <view class="customlist-item" v-for="item of list" :key="item.SID">
  12. <view class="customlist-item-field">
  13. <text class="customlist-item-field-title">记录序号:</text>
  14. {{ displayListItem(item, 'ID') }}
  15. </view>
  16. <view class="customlist-item-field">
  17. <text class="customlist-item-field-title">企业代码:</text>
  18. {{ displayListItem(item, 'ECODE') }}
  19. </view>
  20. <view class="customlist-item-field">
  21. <text class="customlist-item-field-title">钱包类型:</text>
  22. {{ displayListItem(item, 'NOTECASE') }}
  23. </view>
  24. <view class="customlist-item-field">
  25. <text class="customlist-item-field-title">一卡通账号:</text>
  26. {{ displayListItem(item, 'CUSTOMERID') }}
  27. </view>
  28. <view class="customlist-item-field">
  29. <text class="customlist-item-field-title">学工号:</text>
  30. {{ displayListItem(item, 'OUTID') }}
  31. </view>
  32. <view class="customlist-item-field">
  33. <text class="customlist-item-field-title">持卡序号:</text>
  34. {{ displayListItem(item, 'CARDSN') }}
  35. </view>
  36. <view class="customlist-item-field">
  37. <text class="customlist-item-field-title">消费卡操作计数:</text>
  38. {{ displayListItem(item, 'OPCOUNT') }}
  39. </view>
  40. <view class="customlist-item-field">
  41. <text class="customlist-item-field-title">操作时间:</text>
  42. {{ displayListItem(item, 'OPDT') }}
  43. </view>
  44. <view class="customlist-item-field">
  45. <text class="customlist-item-field-title">余额:</text>
  46. {{ displayListItem(item, 'ODDFARE') }}
  47. </view>
  48. <view class="customlist-item-field">
  49. <text class="customlist-item-field-title">操作额:</text>
  50. {{ displayListItem(item, 'OPFARE') }}
  51. </view>
  52. <view class="customlist-item-field">
  53. <text class="customlist-item-field-title">管理费:</text>
  54. {{ displayListItem(item, 'MNGFARE') }}
  55. </view>
  56. <view class="customlist-item-field">
  57. <text class="customlist-item-field-title">科目代码:</text>
  58. {{ displayListItem(item, 'ACCCODE') }}
  59. </view>
  60. <view class="customlist-item-field">
  61. <text class="customlist-item-field-title">科目描述:</text>
  62. {{ displayListItem(item, 'DSCRP') }}
  63. </view>
  64. <view class="customlist-item-field">
  65. <text class="customlist-item-field-title">终端编号:</text>
  66. {{ displayListItem(item, 'TERMID') }}
  67. </view>
  68. <view class="customlist-item-field">
  69. <text class="customlist-item-field-title">终端记录流水号:</text>
  70. {{ displayListItem(item, 'RECNO') }}
  71. </view>
  72. <view class="customlist-item-field">
  73. <text class="customlist-item-field-title">上传时间:</text>
  74. {{ displayListItem(item, 'UPLOADDATE') }}
  75. </view>
  76. <view class="customlist-item-field">
  77. <text class="customlist-item-field-title">SAM卡号:</text>
  78. {{ displayListItem(item, 'SAMCARDNO') }}
  79. </view>
  80. <view class="customlist-item-field">
  81. <text class="customlist-item-field-title">SAM卡交易流水号:</text>
  82. {{ displayListItem(item, 'SAMTRADENO') }}
  83. </view>
  84. <view class="customlist-item-field">
  85. <text class="customlist-item-field-title">交易卡类型:</text>
  86. {{ displayListItem(item, 'TRADECARDTYPE') }}
  87. </view>
  88. <view class="customlist-item-field">
  89. <text class="customlist-item-field-title">验证码:</text>
  90. {{ displayListItem(item, 'TAC') }}
  91. </view>
  92. <view class="customlist-item-field">
  93. <text class="customlist-item-field-title">卡应用序列号:</text>
  94. {{ displayListItem(item, 'ASN') }}
  95. </view>
  96. <l-customlist-action showEdit @edit="action('edit', item.SID)" showDelete @delete="action('delete', item.SID)" @view="action('view', item.SID)" />
  97. </view>
  98. </l-customlist>
  99. </l-scroll-list>
  100. </view>
  101. <!-- 关闭侧边抽屉按钮 -->
  102. <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
  103. <l-icon type="pullright" color="blue" />
  104. </view>
  105. <!-- 侧边栏,用于设置查询条件 -->
  106. <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
  107. <view v-if="ready" class="padding">
  108. <l-input
  109. v-model="queryData.OUTID"
  110. @change="searchChange"
  111. title ="学工号"
  112. placeholder="按学工号查询"
  113. />
  114. <!-- 重置查询条件按钮 -->
  115. <view class="padding-tb">
  116. <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
  117. </view>
  118. </view>
  119. </scroll-view>
  120. <l-customlist-add v-if="!sideOpen" @click="action('add')" />
  121. </view>
  122. </template>
  123. <script>
  124. /*
  125. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  126. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  127. * 创建人:超级管理员
  128. * 日 期:2020-10-16 15:16
  129. * 描 述:学生消费信息
  130. */
  131. /**
  132. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  133. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  134. * { "path": "pages/EducationalAdministration/StuConsumption/list", "style": { "navigationBarTitleText": "表单列表页" } }
  135. *
  136. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  137. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  138. */
  139. import moment from 'moment'
  140. import get from 'lodash/get'
  141. import set from 'lodash/set'
  142. import pickBy from 'lodash/pickBy'
  143. import mapValues from 'lodash/mapValues'
  144. export default {
  145. data() {
  146. return {
  147. // 数据项的数据类型、结构
  148. scheme: {
  149. ID: { type: 'text' },
  150. ECODE: { type: 'text' },
  151. NOTECASE: { type: 'text' },
  152. CUSTOMERID: { type: 'text' },
  153. OUTID: { type: 'text' },
  154. CARDSN: { type: 'text' },
  155. OPCOUNT: { type: 'text' },
  156. OPDT: { type: 'datetime', dateformat: '0' },
  157. ODDFARE: { type: 'text' },
  158. OPFARE: { type: 'text' },
  159. MNGFARE: { type: 'text' },
  160. ACCCODE: { type: 'text' },
  161. DSCRP: { type: 'text' },
  162. TERMID: { type: 'text' },
  163. RECNO: { type: 'text' },
  164. UPLOADDATE: { type: 'text' },
  165. SAMCARDNO: { type: 'text' },
  166. SAMTRADENO: { type: 'text' },
  167. TRADECARDTYPE: { type: 'text' },
  168. TAC: { type: 'text' },
  169. ASN: { type: 'text' },
  170. },
  171. // 查询条件
  172. searchData: {},
  173. defaultQueryData: {},
  174. queryData: {
  175. OUTID: '',
  176. },
  177. // 数据源
  178. dataSource: {
  179. },
  180. // 页面相关参数
  181. ready: false,
  182. tips: '加载中...',
  183. loadState: '向下翻以加载更多',
  184. sideOpen: false,
  185. // 列表与分页信息
  186. page: 1,
  187. total: 2,
  188. list: []
  189. }
  190. },
  191. async onLoad() {
  192. await this.init()
  193. },
  194. onUnload() {
  195. this.OFF('EducationalAdministrationStuConsumption-list-change')
  196. },
  197. methods: {
  198. // 页面初始化
  199. async init() {
  200. this.ON('EducationalAdministrationStuConsumption-list-change', this.refreshList)
  201. // 拉取加载列表和数据源
  202. await Promise.all([
  203. () => {}
  204. ])
  205. await this.fetchList()
  206. // 初始化查询条件
  207. this.defaultQueryData = this.COPY(this.queryData)
  208. this.ready = true
  209. },
  210. // 拉取列表
  211. async fetchList() {
  212. if (this.page > this.total) { return }
  213. const result = await this.HTTP_GET(
  214. 'learun/adms/EducationalAdministration/StuConsumption/pagelist',
  215. {
  216. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  217. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  218. pagination: { rows: 10, page: this.page, sidx: 'SID', sord: 'DESC' },
  219. queryJson: JSON.stringify(this.searchData)
  220. },
  221. '加载数据时出错'
  222. )
  223. if (!result) { return }
  224. this.total = result.total
  225. this.page = result.page + 1
  226. this.list = this.list.concat(result.rows)
  227. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
  228. this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
  229. },
  230. // 刷新清空列表
  231. async refreshList() {
  232. this.page = 1
  233. this.total = 2
  234. this.list = []
  235. await this.fetchList()
  236. },
  237. // 列表下拉
  238. pullDown() {
  239. this.refreshList().then(() => {
  240. this.$refs.list.stopPullDown()
  241. })
  242. },
  243. // 设置搜索条件
  244. async searchChange() {
  245. const result = {}
  246. // 将其他查询项添加到查询 JSON 中
  247. const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
  248. Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  249. this.searchData = result
  250. await this.refreshList()
  251. },
  252. // 点击「清空查询条件」按钮
  253. reset() {
  254. this.queryData = this.COPY(this.defaultQueryData)
  255. this.searchChange()
  256. },
  257. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  258. async action(type, id = '') {
  259. switch (type) {
  260. case 'view':
  261. this.NAV_TO(`./single?type=view&id=${id}`)
  262. return
  263. case 'add':
  264. this.NAV_TO('./single?type=create')
  265. return
  266. case 'edit':
  267. this.NAV_TO(`./single?type=edit&id=${id}`)
  268. return
  269. case 'delete':
  270. if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
  271. return
  272. }
  273. this.HTTP_POST('learun/adms/EducationalAdministration/StuConsumption/delete', id, '删除失败').then(success => {
  274. if(!success) { return }
  275. this.TOAST('删除成功', 'success')
  276. this.refreshList()
  277. })
  278. return
  279. default:
  280. return
  281. }
  282. },
  283. // 显示列表中的标题项
  284. displayListItem(item, field) {
  285. const fieldItem = this.scheme[field]
  286. const value = item[field]
  287. switch (fieldItem.type) {
  288. case 'currentInfo':
  289. case 'organize':
  290. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
  291. case 'radio':
  292. case 'select':
  293. const selectItem = this.dataSource[field].find(t => t.value === String(value))
  294. return get(selectItem, 'text', '')
  295. case 'checkbox':
  296. if (!value || value.split(',').length <= 0) { return '' }
  297. const checkboxItems = value.split(',')
  298. return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
  299. case 'datetime':
  300. if (!value) { return '' }
  301. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm')
  302. default: return value === null || value === undefined ? '' : value
  303. }
  304. }
  305. }
  306. }
  307. </script>
  308. <style lang="less" scoped>
  309. @import '~@/common/css/sidepage.less';
  310. @import '~@/common/css/customlist.less';
  311. </style>