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.
 
 
 
 
 
 

395 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.ID"
  110. @change="searchChange"
  111. title ="记录序号"
  112. placeholder="按记录序号查询"
  113. />
  114. <l-input
  115. v-model="queryData.OUTID"
  116. @change="searchChange"
  117. title ="学工号"
  118. placeholder="按学工号查询"
  119. />
  120. <l-input
  121. v-model="queryData.CARDSN"
  122. @change="searchChange"
  123. title ="持卡序号"
  124. placeholder="按持卡序号查询"
  125. />
  126. <!-- 重置查询条件按钮 -->
  127. <view class="padding-tb">
  128. <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
  129. </view>
  130. </view>
  131. </scroll-view>
  132. <l-customlist-add v-if="!sideOpen" @click="action('add')" />
  133. </view>
  134. </template>
  135. <script>
  136. /*
  137. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  138. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  139. * 创建人:超级管理员
  140. * 日 期:2020-10-16 15:16
  141. * 描 述:学生消费信息
  142. */
  143. /**
  144. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  145. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  146. * { "path": "pages/EducationalAdministration/StuConsumption/list", "style": { "navigationBarTitleText": "表单列表页" } }
  147. *
  148. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  149. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  150. */
  151. import moment from 'moment'
  152. import get from 'lodash/get'
  153. import set from 'lodash/set'
  154. import pickBy from 'lodash/pickBy'
  155. import mapValues from 'lodash/mapValues'
  156. export default {
  157. data() {
  158. return {
  159. // 数据项的数据类型、结构
  160. scheme: {
  161. ID: { type: 'text' },
  162. ECODE: { type: 'text' },
  163. NOTECASE: { type: 'text' },
  164. CUSTOMERID: { type: 'text' },
  165. OUTID: { type: 'text' },
  166. CARDSN: { type: 'text' },
  167. OPCOUNT: { type: 'text' },
  168. OPDT: { type: 'datetime', dateformat: '0' },
  169. ODDFARE: { type: 'text' },
  170. OPFARE: { type: 'text' },
  171. MNGFARE: { type: 'text' },
  172. ACCCODE: { type: 'text' },
  173. DSCRP: { type: 'text' },
  174. TERMID: { type: 'text' },
  175. RECNO: { type: 'text' },
  176. UPLOADDATE: { type: 'text' },
  177. SAMCARDNO: { type: 'text' },
  178. SAMTRADENO: { type: 'text' },
  179. TRADECARDTYPE: { type: 'text' },
  180. TAC: { type: 'text' },
  181. ASN: { type: 'text' },
  182. },
  183. // 查询条件
  184. searchData: {},
  185. defaultQueryData: {},
  186. queryData: {
  187. ID:'',
  188. OUTID: '',
  189. CARDSN: '',
  190. },
  191. // 数据源
  192. dataSource: {
  193. },
  194. // 页面相关参数
  195. ready: false,
  196. tips: '加载中...',
  197. loadState: '向下翻以加载更多',
  198. sideOpen: false,
  199. // 列表与分页信息
  200. page: 1,
  201. total: 2,
  202. list: []
  203. }
  204. },
  205. async onLoad() {
  206. await this.init()
  207. },
  208. onUnload() {
  209. this.OFF('EducationalAdministrationStuConsumption-list-change')
  210. },
  211. methods: {
  212. // 页面初始化
  213. async init() {
  214. this.ON('EducationalAdministrationStuConsumption-list-change', this.refreshList)
  215. // 拉取加载列表和数据源
  216. await Promise.all([
  217. () => {}
  218. ])
  219. await this.fetchList()
  220. // 初始化查询条件
  221. this.defaultQueryData = this.COPY(this.queryData)
  222. this.ready = true
  223. },
  224. // 拉取列表
  225. async fetchList() {
  226. if (this.page > this.total) { return }
  227. const result = await this.HTTP_GET(
  228. 'learun/adms/EducationalAdministration/StuConsumption/pagelist',
  229. {
  230. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  231. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  232. pagination: { rows: 10, page: this.page, sidx: 'SID', sord: 'DESC' },
  233. queryJson: JSON.stringify(this.searchData)
  234. },
  235. '加载数据时出错'
  236. )
  237. if (!result) { return }
  238. this.total = result.total
  239. this.page = result.page + 1
  240. this.list = this.list.concat(result.rows)
  241. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
  242. this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
  243. },
  244. // 刷新清空列表
  245. async refreshList() {
  246. this.page = 1
  247. this.total = 2
  248. this.list = []
  249. await this.fetchList()
  250. },
  251. // 列表下拉
  252. pullDown() {
  253. this.refreshList().then(() => {
  254. this.$refs.list.stopPullDown()
  255. })
  256. },
  257. // 设置搜索条件
  258. async searchChange() {
  259. const result = {}
  260. // 将其他查询项添加到查询 JSON 中
  261. const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
  262. Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  263. this.searchData = result
  264. await this.refreshList()
  265. },
  266. // 点击「清空查询条件」按钮
  267. reset() {
  268. this.queryData = this.COPY(this.defaultQueryData)
  269. this.searchChange()
  270. },
  271. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  272. async action(type, id = '') {
  273. switch (type) {
  274. case 'view':
  275. this.NAV_TO(`./single?type=view&id=${id}`)
  276. return
  277. case 'add':
  278. this.NAV_TO('./single?type=create')
  279. return
  280. case 'edit':
  281. this.NAV_TO(`./single?type=edit&id=${id}`)
  282. return
  283. case 'delete':
  284. if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
  285. return
  286. }
  287. this.HTTP_POST('learun/adms/EducationalAdministration/StuConsumption/delete', id, '删除失败').then(success => {
  288. if(!success) { return }
  289. this.TOAST('删除成功', 'success')
  290. this.refreshList()
  291. })
  292. return
  293. default:
  294. return
  295. }
  296. },
  297. // 显示列表中的标题项
  298. displayListItem(item, field) {
  299. const fieldItem = this.scheme[field]
  300. const value = item[field]
  301. switch (fieldItem.type) {
  302. case 'currentInfo':
  303. case 'organize':
  304. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
  305. case 'radio':
  306. case 'select':
  307. const selectItem = this.dataSource[field].find(t => t.value === String(value))
  308. return get(selectItem, 'text', '')
  309. case 'checkbox':
  310. if (!value || value.split(',').length <= 0) { return '' }
  311. const checkboxItems = value.split(',')
  312. return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
  313. case 'datetime':
  314. if (!value) { return '' }
  315. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm')
  316. default: return value === null || value === undefined ? '' : value
  317. }
  318. }
  319. }
  320. }
  321. </script>
  322. <style lang="less" scoped>
  323. @import '~@/common/css/sidepage.less';
  324. @import '~@/common/css/customlist.less';
  325. </style>