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.
 
 
 
 
 
 

264 lines
8.0 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 主列表页 -->
  4. <view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
  5. <!-- 顶部条目/分页信息栏 -->
  6. <!-- @buttonClick="sideOpen = true" -->
  7. <l-customlist-banner>{{ tips }}</l-customlist-banner>
  8. <!-- 滚动列表,跨端支持上拉/下拉 -->
  9. <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
  10. <l-customlist :tips="loadState" showTips>
  11. <!-- 单条记录 -->
  12. <view class="customlist-item" v-for="(item,index) of list" :key="index+item.VID+item.EmpName">
  13. <view class="customlist-item-field">
  14. <text class="customlist-item-field-title">学年:</text>
  15. {{ displayListItem(item, 'AcademicYearNo') }}
  16. </view>
  17. <view class="customlist-item-field">
  18. <text class="customlist-item-field-title">学期:</text>
  19. {{ displayListItem(item, 'Semester') }}
  20. </view>
  21. <view class="customlist-item-field">
  22. <text class="customlist-item-field-title">教师姓名:</text>
  23. {{ displayListItem(item, 'EmpName') }}
  24. </view>
  25. <view class="customlist-item-field">
  26. <text class="customlist-item-field-title">课程名称:</text>
  27. {{ displayListItem(item, 'LessonName') }}
  28. </view>
  29. <view class="customlist-item-field">
  30. <text class="customlist-item-field-title">评教状态:</text>
  31. {{ displayListItem(item, 'UID') }}
  32. </view>
  33. <l-customlist-action @view="action('view', item)" />
  34. </view>
  35. </l-customlist>
  36. </l-scroll-list>
  37. </view>
  38. <!-- 关闭侧边抽屉按钮 -->
  39. <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
  40. <l-icon type="pullright" color="blue" />
  41. </view>
  42. <!-- 侧边栏,用于设置查询条件 -->
  43. <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
  44. <view v-if="ready" class="padding">
  45. <!-- 重置查询条件按钮 -->
  46. <view class="padding-tb">
  47. <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
  48. </view>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. </template>
  53. <script>
  54. /*
  55. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  56. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  57. * 创建人:超级管理员
  58. * 日 期:2020-10-16 15:39
  59. * 描 述:工作日志
  60. */
  61. /**
  62. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  63. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  64. * { "path": "pages/EducationalAdministration/Journal/list", "style": { "navigationBarTitleText": "表单列表页" } }
  65. *
  66. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  67. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  68. */
  69. import moment from 'moment'
  70. import get from 'lodash/get'
  71. import set from 'lodash/set'
  72. import pickBy from 'lodash/pickBy'
  73. import mapValues from 'lodash/mapValues'
  74. export default {
  75. data() {
  76. return {
  77. // 数据项的数据类型、结构
  78. scheme: {
  79. AcademicYearNo: { type: 'text' },
  80. Semester: { type: 'text'},
  81. EmpName: { type: 'text'},
  82. LessonName: { type: 'text' },
  83. UID: { type: 'bit' },
  84. },
  85. // 查询条件
  86. searchData: {},
  87. defaultQueryData: {},
  88. queryData: {
  89. },
  90. // 数据源
  91. dataSource: {
  92. JTypeId: [],
  93. },
  94. // 页面相关参数
  95. ready: false,
  96. tips: '加载中...',
  97. loadState: '向下翻以加载更多',
  98. sideOpen: false,
  99. // 列表与分页信息
  100. page: 1,
  101. total: 2,
  102. list: []
  103. }
  104. },
  105. async onLoad() {
  106. await this.init()
  107. },
  108. async onShow() {
  109. if(this.ready){
  110. this.ready = false
  111. await this.refreshList()
  112. this.ready = true
  113. }
  114. },
  115. onUnload() {
  116. this.OFF('EducationalAdministrationJournalSend-list-change')
  117. },
  118. methods: {
  119. // 页面初始化
  120. async init() {
  121. this.ON('EducationalAdministrationJournalSend-list-change', this.refreshList)
  122. // 拉取加载列表和数据源
  123. await Promise.all([
  124. () => {}
  125. ])
  126. await this.fetchList()
  127. // 初始化查询条件
  128. this.defaultQueryData = this.COPY(this.queryData)
  129. this.ready = true
  130. },
  131. // 拉取列表
  132. async fetchList() {
  133. if (this.page > this.total) { return }
  134. const result = await this.HTTP_GET(
  135. 'learun/adms/eval/studentlist',
  136. {
  137. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  138. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  139. pagination: { rows: 10, page: this.page, sidx: '', sord: 'DESC' },
  140. queryJson: JSON.stringify(this.searchData)
  141. },
  142. '加载数据时出错'
  143. )
  144. if (!result) { return }
  145. this.total = result.total
  146. this.page = result.page + 1
  147. this.list = this.list.concat(result.rows)
  148. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
  149. this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
  150. },
  151. // 刷新清空列表
  152. async refreshList() {
  153. this.page = 1
  154. this.total = 2
  155. this.list = []
  156. await this.fetchList()
  157. },
  158. // 列表下拉
  159. pullDown() {
  160. this.refreshList().then(() => {
  161. this.$refs.list.stopPullDown()
  162. })
  163. },
  164. // 设置搜索条件
  165. async searchChange() {
  166. const result = {}
  167. // 将其他查询项添加到查询 JSON 中
  168. const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
  169. Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  170. this.searchData = result
  171. await this.refreshList()
  172. },
  173. // 点击「清空查询条件」按钮
  174. reset() {
  175. this.queryData = this.COPY(this.defaultQueryData)
  176. this.searchChange()
  177. },
  178. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  179. async action(type, item) {
  180. if (item.UID) {
  181. this.TOAST('当前项已评价!')
  182. return
  183. }
  184. this.NAV_TO(`./single?type=view&id=${item.VID}&EmpNo=${item.EmpNo}&LessonNo=${item.LessonNo}`)
  185. },
  186. // 显示列表中的标题项
  187. displayListItem(item, field) {
  188. const fieldItem = this.scheme[field]
  189. const value = item[field]
  190. switch (fieldItem.type) {
  191. case 'currentInfo':
  192. case 'organize':
  193. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
  194. case 'radio':
  195. case 'select':
  196. const selectItem = this.dataSource[field].find(t => t.value === String(value))
  197. return get(selectItem, 'text', '')
  198. case 'checkbox':
  199. if (!value || value.split(',').length <= 0) { return '' }
  200. const checkboxItems = value.split(',')
  201. return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
  202. case 'datetime':
  203. if (!value) { return '' }
  204. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm')
  205. case 'bit':
  206. return (value != undefined && value!== '') ? "已评" : "未评"
  207. default: return value === null || value === undefined ? '' : value
  208. }
  209. }
  210. }
  211. }
  212. </script>
  213. <style lang="less" scoped>
  214. @import '~@/common/css/sidepage.less';
  215. @import '~@/common/css/customlist.less';
  216. </style>