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.
 
 
 
 
 
 

332 lines
10 KiB

  1. <template>
  2. <view class="page">
  3. <view v-if="ready">
  4. <l-input
  5. @input="setValue('StuConsumption.ID', $event)"
  6. :value="getValue('StuConsumption.ID')"
  7. :disabled="!edit"
  8. title="记录序号"
  9. />
  10. <l-input
  11. @input="setValue('StuConsumption.ECODE', $event)"
  12. :value="getValue('StuConsumption.ECODE')"
  13. :disabled="!edit"
  14. title="企业代码"
  15. />
  16. <l-input
  17. @input="setValue('StuConsumption.NOTECASE', $event)"
  18. :value="getValue('StuConsumption.NOTECASE')"
  19. :disabled="!edit"
  20. title="钱包类型"
  21. />
  22. <l-input
  23. @input="setValue('StuConsumption.CUSTOMERID', $event)"
  24. :value="getValue('StuConsumption.CUSTOMERID')"
  25. :disabled="!edit"
  26. title="一卡通账号"
  27. />
  28. <l-input
  29. @input="setValue('StuConsumption.OUTID', $event)"
  30. :value="getValue('StuConsumption.OUTID')"
  31. :disabled="!edit"
  32. title="学工号"
  33. />
  34. <l-input
  35. @input="setValue('StuConsumption.CARDSN', $event)"
  36. :value="getValue('StuConsumption.CARDSN')"
  37. :disabled="!edit"
  38. title="持卡序号"
  39. />
  40. <l-input
  41. @input="setValue('StuConsumption.OPCOUNT', $event)"
  42. :value="getValue('StuConsumption.OPCOUNT')"
  43. :disabled="!edit"
  44. title="消费卡操作计数"
  45. />
  46. <l-date-picker
  47. @input="setValue('StuConsumption.OPDT', $event)"
  48. :value="getValue('StuConsumption.OPDT')"
  49. :disabled="!edit"
  50. title="操作时间"
  51. />
  52. <l-input
  53. @input="setValue('StuConsumption.ODDFARE', $event)"
  54. :value="getValue('StuConsumption.ODDFARE')"
  55. :disabled="!edit"
  56. title="余额"
  57. />
  58. <l-input
  59. @input="setValue('StuConsumption.OPFARE', $event)"
  60. :value="getValue('StuConsumption.OPFARE')"
  61. :disabled="!edit"
  62. title="操作额"
  63. />
  64. <l-input
  65. @input="setValue('StuConsumption.MNGFARE', $event)"
  66. :value="getValue('StuConsumption.MNGFARE')"
  67. :disabled="!edit"
  68. title="管理费"
  69. />
  70. <l-input
  71. @input="setValue('StuConsumption.ACCCODE', $event)"
  72. :value="getValue('StuConsumption.ACCCODE')"
  73. :disabled="!edit"
  74. title="科目代码"
  75. />
  76. <l-input
  77. @input="setValue('StuConsumption.DSCRP', $event)"
  78. :value="getValue('StuConsumption.DSCRP')"
  79. :disabled="!edit"
  80. title="科目描述"
  81. />
  82. <l-input
  83. @input="setValue('StuConsumption.TERMID', $event)"
  84. :value="getValue('StuConsumption.TERMID')"
  85. :disabled="!edit"
  86. title="终端编号"
  87. />
  88. <l-input
  89. @input="setValue('StuConsumption.RECNO', $event)"
  90. :value="getValue('StuConsumption.RECNO')"
  91. :disabled="!edit"
  92. title="终端记录流水号"
  93. />
  94. <l-input
  95. @input="setValue('StuConsumption.UPLOADDATE', $event)"
  96. :value="getValue('StuConsumption.UPLOADDATE')"
  97. :disabled="!edit"
  98. title="上传时间"
  99. />
  100. <l-input
  101. @input="setValue('StuConsumption.SAMCARDNO', $event)"
  102. :value="getValue('StuConsumption.SAMCARDNO')"
  103. :disabled="!edit"
  104. title="SAM卡号"
  105. />
  106. <l-input
  107. @input="setValue('StuConsumption.SAMTRADENO', $event)"
  108. :value="getValue('StuConsumption.SAMTRADENO')"
  109. :disabled="!edit"
  110. title="SAM卡交易流水号"
  111. />
  112. <l-input
  113. @input="setValue('StuConsumption.TRADECARDTYPE', $event)"
  114. :value="getValue('StuConsumption.TRADECARDTYPE')"
  115. :disabled="!edit"
  116. title="交易卡类型"
  117. />
  118. <l-input
  119. @input="setValue('StuConsumption.TAC', $event)"
  120. :value="getValue('StuConsumption.TAC')"
  121. :disabled="!edit"
  122. title="验证码"
  123. />
  124. <l-input
  125. @input="setValue('StuConsumption.ASN', $event)"
  126. :value="getValue('StuConsumption.ASN')"
  127. :disabled="!edit"
  128. title="卡应用序列号"
  129. />
  130. </view>
  131. <view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
  132. <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
  133. 提交保存
  134. </l-button>
  135. <l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
  136. 编辑本页
  137. </l-button>
  138. <l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
  139. 取消编辑
  140. </l-button>
  141. <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
  142. 删除
  143. </l-button>
  144. </view>
  145. </view>
  146. </template>
  147. <script>
  148. /*
  149. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  150. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  151. * 创建人:超级管理员
  152. * 日 期:2020-10-16 15:16
  153. * 描 述:学生消费信息
  154. */
  155. /**
  156. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  157. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  158. * { "path": "pages/EducationalAdministration/StuConsumption/single", "style": { "navigationBarTitleText": "表单详情页" } }
  159. *
  160. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  161. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  162. */
  163. import get from 'lodash/get'
  164. import set from 'lodash/set'
  165. import moment from 'moment'
  166. import customPageMixins from '@/common/custompage.js'
  167. export default {
  168. mixins: [customPageMixins],
  169. data() {
  170. return {
  171. // 页面相关参数
  172. id: null,
  173. mode: null,
  174. edit: null,
  175. ready: false,
  176. // 表单数据
  177. current: {},
  178. origin: {},
  179. // 表单项数据结构
  180. scheme: {
  181. StuConsumption: {
  182. ID: { type: 'text', title: '记录序号' },
  183. ECODE: { type: 'text', title: '企业代码' },
  184. NOTECASE: { type: 'text', title: '钱包类型' },
  185. CUSTOMERID: { type: 'text', title: '一卡通账号' },
  186. OUTID: { type: 'text', title: '学工号' },
  187. CARDSN: { type: 'text', title: '持卡序号' },
  188. OPCOUNT: { type: 'text', title: '消费卡操作计数' },
  189. OPDT: { type: 'datetime', title: '操作时间', dateformat: '0' },
  190. ODDFARE: { type: 'text', title: '余额' },
  191. OPFARE: { type: 'text', title: '操作额' },
  192. MNGFARE: { type: 'text', title: '管理费' },
  193. ACCCODE: { type: 'text', title: '科目代码' },
  194. DSCRP: { type: 'text', title: '科目描述' },
  195. TERMID: { type: 'text', title: '终端编号' },
  196. RECNO: { type: 'text', title: '终端记录流水号' },
  197. UPLOADDATE: { type: 'text', title: '上传时间' },
  198. SAMCARDNO: { type: 'text', title: 'SAM卡号' },
  199. SAMTRADENO: { type: 'text', title: 'SAM卡交易流水号' },
  200. TRADECARDTYPE: { type: 'text', title: '交易卡类型' },
  201. TAC: { type: 'text', title: '验证码' },
  202. ASN: { type: 'text', title: '卡应用序列号' },
  203. },
  204. },
  205. // 数据源
  206. dataSource: {
  207. StuConsumption: {
  208. },
  209. }
  210. }
  211. },
  212. async onLoad({ type, id }) {
  213. await this.init(type, id)
  214. },
  215. methods: {
  216. // 页面初始化
  217. async init(type, id) {
  218. this.LOADING('加载数据中...')
  219. this.id = id
  220. this.mode = type
  221. this.edit = ['create', 'edit'].includes(this.mode)
  222. // 拉取表单数据,同时拉取所有来自数据源的选单数据
  223. await Promise.all([
  224. () => {}
  225. ])
  226. await this.fetchForm()
  227. this.ready = true
  228. this.HIDE_LOADING()
  229. },
  230. // 加载表单数据
  231. async fetchForm() {
  232. if (this.mode === 'create') {
  233. this.origin = await this.getDefaultForm()
  234. } else {
  235. const result = await this.HTTP_GET('learun/adms/EducationalAdministration/StuConsumption/form', this.id)
  236. this.origin = await this.formatFormData(result)
  237. }
  238. this.current = this.COPY(this.origin)
  239. },
  240. // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
  241. async action(type) {
  242. switch (type) {
  243. case 'edit':
  244. this.edit = true
  245. break
  246. case 'reset':
  247. this.current = this.COPY(this.origin)
  248. this.edit = false
  249. break
  250. case 'save':
  251. const verifyResult = this.verifyForm()
  252. if (verifyResult.length > 0) {
  253. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  254. return
  255. }
  256. if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
  257. return
  258. }
  259. this.LOADING('正在提交...')
  260. const postData = await this.getPostData(this.id)
  261. this.HTTP_POST('learun/adms/EducationalAdministration/StuConsumption/save', postData, '表单提交保存失败').then(success => {
  262. this.HIDE_LOADING()
  263. if (!success) {
  264. return
  265. }
  266. this.EMIT('EducationalAdministrationStuConsumption-list-change')
  267. this.NAV_BACK()
  268. this.TOAST('提交保存成功')
  269. })
  270. break
  271. case 'delete':
  272. if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
  273. return
  274. }
  275. this.LOADING('提交删除中...')
  276. this.HTTP_POST('learun/adms/EducationalAdministration/StuConsumption/delete', this.id, '删除失败').then(success => {
  277. this.HIDE_LOADING()
  278. if (!success) {
  279. return
  280. }
  281. this.EMIT('EducationalAdministrationStuConsumption-list-change')
  282. this.NAV_BACK()
  283. this.this.TOAST('删除成功', 'success')
  284. })
  285. break
  286. default: break
  287. }
  288. },
  289. // 获取表单值
  290. getValue(path) {
  291. return get(this.current, path)
  292. },
  293. // 设置表单值
  294. setValue(path, val) {
  295. set(this.current, path, val)
  296. }
  297. }
  298. }
  299. </script>