Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

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