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.
 
 
 
 
 
 

350 lines
12 KiB

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