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.
 
 
 
 
 
 

404 lines
14 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 主列表页 -->
  4. <view class="mainpage" style="padding-top: 80rpx;">
  5. <!-- 顶部条目/分页信息栏 -->
  6. <view class="customlist-banner-header">
  7. <view class="customlist-banner-content">
  8. <slot>{{tips}}</slot>
  9. </view>
  10. </view>
  11. <!-- 滚动列表,跨端支持上拉/下拉 -->
  12. <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
  13. <l-customlist :tips="loadState" showTips>
  14. <!-- 单条记录 -->
  15. <view class="customlist-item" v-for="item of list" :key="item.Id">
  16. <view class="customlist-item-field">
  17. <text class="customlist-item-field-title">学生编码:</text>
  18. {{ displayListItem(item, 'StuNo') }}
  19. </view>
  20. <view class="customlist-item-field">
  21. <text class="customlist-item-field-title">姓名:</text>
  22. {{ displayListItem(item, 'StuName') }}
  23. </view>
  24. <view class="customlist-item-field">
  25. <text class="customlist-item-field-title">性别:</text>
  26. {{ displayListItem(item, 'GenderNo') }}
  27. </view>
  28. <view class="customlist-item-field">
  29. <text class="customlist-item-field-title">身份证号:</text>
  30. {{ displayListItem(item, 'IdentityCardNo') }}
  31. </view>
  32. <view class="customlist-item-field">
  33. <text class="customlist-item-field-title">学籍号:</text>
  34. {{ displayListItem(item, 'StuCode') }}
  35. </view>
  36. <view class="customlist-item-field">
  37. <text class="customlist-item-field-title">学号:</text>
  38. {{ displayListItem(item, 'ProvinceCode') }}
  39. </view>
  40. <view class="customlist-item-field">
  41. <text class="customlist-item-field-title">专业:</text>
  42. {{ displayListItem(item, 'MajorNo') }}
  43. </view>
  44. <view class="customlist-item-field">
  45. <text class="customlist-item-field-title">学制:</text>
  46. {{ displayListItem(item, 'EduSystem') }}
  47. </view>
  48. <view class="customlist-item-field">
  49. <text class="customlist-item-field-title">班级:</text>
  50. {{ displayListItem(item, 'ClassNo') }}
  51. </view>
  52. <view class="customlist-item-field">
  53. <text class="customlist-item-field-title">联系电话:</text>
  54. {{ displayListItem(item, 'mobile') }}
  55. </view>
  56. <view class="customlist-item-field">
  57. <text class="customlist-item-field-title">毕业去向:</text>
  58. {{ displayListItem(item, 'GraduateGo') }}
  59. </view>
  60. <view class="customlist-item-field">
  61. <text class="customlist-item-field-title">升入高校名称:</text>
  62. {{ displayListItem(item, 'EnterUniversityName') }}
  63. </view>
  64. <view class="customlist-item-field">
  65. <text class="customlist-item-field-title">大学层次:</text>
  66. {{ displayListItem(item, 'UniversityLevel') }}
  67. </view>
  68. <view class="customlist-item-field">
  69. <text class="customlist-item-field-title">就业单位名称:</text>
  70. {{ displayListItem(item, 'EmployerName') }}
  71. </view>
  72. <view class="customlist-item-field">
  73. <text class="customlist-item-field-title">就业单位所属省:</text>
  74. {{ displayListItem(item, 'EmployerProvince') }}
  75. </view>
  76. <view class="customlist-item-field">
  77. <text class="customlist-item-field-title">就业单位所属市:</text>
  78. {{ displayListItem(item, 'EmployerCity') }}
  79. </view>
  80. <view class="customlist-item-field">
  81. <text class="customlist-item-field-title">就业单位所属县(区):</text>
  82. {{ displayListItem(item, 'EmployerCountry') }}
  83. </view>
  84. <view class="customlist-item-field">
  85. <text class="customlist-item-field-title">备注:</text>
  86. {{ displayListItem(item, 'Remark') }}
  87. </view>
  88. <l-customlist-action showEdit @edit="action('edit', item.Id)" showDelete @delete="action('delete', item.Id)" @view="action('view', item.Id)" />
  89. </view>
  90. </l-customlist>
  91. </l-scroll-list>
  92. </view>
  93. <l-customlist-add @click="action('add')" />
  94. </view>
  95. </template>
  96. <script>
  97. /*
  98. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  99. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  100. * 创建人:超级管理员
  101. * 日 期:2022-09-23 15:16
  102. * 描 述:毕业信息统计
  103. */
  104. /**
  105. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  106. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  107. * { "path": "pages/EducationalAdministration/StuGraduateStatistic/list", "style": { "navigationBarTitleText": "表单列表页" } }
  108. *
  109. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  110. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  111. */
  112. import moment from 'moment'
  113. import get from 'lodash/get'
  114. import set from 'lodash/set'
  115. import pickBy from 'lodash/pickBy'
  116. import mapValues from 'lodash/mapValues'
  117. export default {
  118. data() {
  119. return {
  120. // 数据项的数据类型、结构
  121. scheme: {
  122. StuNo: { type: 'text', title: '学生编码' },
  123. StuName: { type: 'text', title: '姓名' },
  124. GenderNo: { type: 'select', title: '性别' },
  125. IdentityCardNo: { type: 'text' , title: '身份证号'},
  126. StuCode: { type: 'text', title: '学籍号' },
  127. ProvinceCode: { type: 'text', title: '学号' },
  128. MajorNo: { type: 'select', title: '专业', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' },
  129. EduSystem: { type: 'select', title: '学制', itemCode: 'EduSystem', dataSource: '0' },
  130. ClassNo: { type: 'select', title: '班级', dataSource: '1', dataSourceId: 'bjsj,classname,classno' },
  131. mobile: { type: 'text', title: '联系电话' },
  132. GraduateGo: { type: 'select', title: '毕业去向', itemCode: 'GraduateGo', dataSource: '0' },
  133. EnterUniversityName: { type: 'text', title: '升入高校名称' },
  134. UniversityLevel: { type: 'select', title: '大学层次', itemCode: 'UniversityLevel', dataSource: '0' },
  135. EmployerName: { type: 'text', title: '就业单位名称' },
  136. EmployerProvince: { type: 'select', title: '就业单位所属省', dataSource: '1', dataSourceId: 'DIC_PROVINCE,pname,pcode' },
  137. EmployerCity: { type: 'select', title: '就业单位所属市', dataSource: '1', dataSourceId: 'DIC_CITY,cname,ccode' },
  138. EmployerCountry: { type: 'select', title: '就业单位所属县(区)', dataSource: '1', dataSourceId: 'DIC_AREA,aname,acode' },
  139. Remark: { type: 'textarea' , title: '备注'},
  140. },
  141. // 查询条件
  142. searchData: {},
  143. defaultQueryData: {},
  144. queryData: {
  145. },
  146. // 数据源
  147. dataSource: {
  148. GenderNo: [
  149. { text: '男', value: 'true' },
  150. { text: '女', value: 'false' }
  151. ],
  152. MajorNo: [],
  153. EduSystem: Object.values(this.GET_GLOBAL('dataDictionary').EduSystem).map(t => ({ value: t.value, text: t.text })),
  154. ClassNo: [],
  155. GraduateGo: Object.values(this.GET_GLOBAL('dataDictionary').GraduateGo).map(t => ({ value: t.value, text: t.text })),
  156. UniversityLevel: Object.values(this.GET_GLOBAL('dataDictionary').GraduateLevel).map(t => ({ value: t.value, text: t.text })),
  157. EmployerProvince: [],
  158. EmployerCity: [],
  159. EmployerCountry: [],
  160. },
  161. // 页面相关参数
  162. ready: false,
  163. tips: '加载中...',
  164. loadState: '向下翻以加载更多',
  165. sideOpen: false,
  166. // 列表与分页信息
  167. page: 1,
  168. total: 2,
  169. list: []
  170. }
  171. },
  172. async onLoad() {
  173. await this.init()
  174. },
  175. onUnload() {
  176. this.OFF('EducationalAdministrationStuGraduateStatistic-list-change')
  177. },
  178. methods: {
  179. // 页面初始化
  180. async init() {
  181. this.ON('EducationalAdministrationStuGraduateStatistic-list-change', this.refreshList)
  182. // 拉取加载列表和数据源
  183. await Promise.all([
  184. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  185. this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno }))
  186. }),
  187. this.FETCH_DATASOURCE('bjsj').then(result => {
  188. this.dataSource.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
  189. }),
  190. this.FETCH_DATASOURCE('DIC_PROVINCE').then(result => {
  191. this.dataSource.EmployerProvince = result.data.map(t => ({ text: t.pname, value: t.pcode }))
  192. }),
  193. this.FETCH_DATASOURCE('DIC_CITY').then(result => {
  194. this.dataSource.EmployerCity = result.data.map(t => ({ text: t.cname, value: t.ccode }))
  195. }),
  196. this.FETCH_DATASOURCE('DIC_AREA').then(result => {
  197. this.dataSource.EmployerCountry = result.data.map(t => ({ text: t.aname, value: t.acode }))
  198. }),
  199. () => {}
  200. ])
  201. await this.fetchList()
  202. // 初始化查询条件
  203. this.defaultQueryData = this.COPY(this.queryData)
  204. this.ready = true
  205. },
  206. // 拉取列表
  207. async fetchList() {
  208. if (this.page > this.total) { return }
  209. const sobj = {
  210. StuNo:this.GET_GLOBAL('loginUser').account,
  211. };
  212. Object.assign(this.searchData,sobj);
  213. const result = await this.HTTP_GET(
  214. 'learun/adms/EducationalAdministration/StuGraduateStatistic/pagelist',
  215. {
  216. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  217. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  218. pagination: { rows: 10, page: this.page, sidx: 'Id', sord: 'DESC' },
  219. queryJson: JSON.stringify(this.searchData)
  220. },
  221. '加载数据时出错'
  222. )
  223. if (!result) { return }
  224. this.total = result.total
  225. this.page = result.page + 1
  226. this.list = this.list.concat(result.rows)
  227. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
  228. this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
  229. },
  230. // 刷新清空列表
  231. async refreshList() {
  232. this.page = 1
  233. this.total = 2
  234. this.list = []
  235. await this.fetchList()
  236. },
  237. // 列表下拉
  238. pullDown() {
  239. this.refreshList().then(() => {
  240. this.$refs.list.stopPullDown()
  241. })
  242. },
  243. // 设置搜索条件
  244. async searchChange() {
  245. const result = {}
  246. // 将其他查询项添加到查询 JSON 中
  247. const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
  248. Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  249. this.searchData = result
  250. await this.refreshList()
  251. },
  252. // 点击「清空查询条件」按钮
  253. reset() {
  254. this.queryData = this.COPY(this.defaultQueryData)
  255. this.searchChange()
  256. },
  257. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  258. async action(type, id = '') {
  259. switch (type) {
  260. case 'view':
  261. this.NAV_TO(`./single?type=view&id=${id}`)
  262. return
  263. case 'add':
  264. this.NAV_TO('./single?type=create')
  265. return
  266. case 'edit':
  267. this.NAV_TO(`./single?type=edit&id=${id}`)
  268. return
  269. case 'delete':
  270. if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
  271. return
  272. }
  273. this.HTTP_POST('learun/adms/EducationalAdministration/StuGraduateStatistic/delete', id, '删除失败').then(success => {
  274. if(!success) { return }
  275. this.TOAST('删除成功', 'success')
  276. this.refreshList()
  277. })
  278. return
  279. default:
  280. return
  281. }
  282. },
  283. // 显示列表中的标题项
  284. displayListItem(item, field) {
  285. const fieldItem = this.scheme[field]
  286. const value = item[field]
  287. switch (fieldItem.type) {
  288. case 'currentInfo':
  289. case 'organize':
  290. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
  291. case 'radio':
  292. case 'select':
  293. const selectItem = this.dataSource[field].find(t => t.value === String(value))
  294. return get(selectItem, 'text', '')
  295. case 'checkbox':
  296. if (!value || value.split(',').length <= 0) { return '' }
  297. const checkboxItems = value.split(',')
  298. return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
  299. case 'datetime':
  300. if (!value) { return '' }
  301. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm')
  302. default: return value === null || value === undefined ? '' : value
  303. }
  304. }
  305. }
  306. }
  307. </script>
  308. <style lang="less" scoped>
  309. @import '~@/common/css/sidepage.less';
  310. @import '~@/common/css/customlist.less';
  311. </style>
  312. <style lang="less" scoped>
  313. .customlist-banner-header {
  314. position: fixed;
  315. top: var(--window-top);
  316. z-index: 1024;
  317. border-bottom: 1rpx solid #ddd;
  318. height: 80rpx;
  319. width: 100%;
  320. box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1);
  321. background: #f1f1f1;
  322. .customlist-banner-content {
  323. color: #8f8f94;
  324. background: #ffffff;
  325. padding: 20rpx 25rpx;
  326. width: 100%;
  327. vertical-align: middle;
  328. border-bottom: 1rpx solid #ddd;
  329. .customlist-banner-action {
  330. position: absolute;
  331. right: 20rpx;
  332. top: 20rpx;
  333. }
  334. }
  335. }
  336. </style>