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.
 
 
 
 
 
 

429 lines
15 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.Id">
  12. <view class="customlist-item-field">
  13. <text class="customlist-item-field-title">调度类型:</text>
  14. {{ displayListItem(item, 'AttemperType') }}
  15. </view>
  16. <view class="customlist-item-field">
  17. <text class="customlist-item-field-title">调度时限:</text>
  18. {{ displayListItem(item, 'AttemperTimeType') }}
  19. </view>
  20. <view class="customlist-item-field">
  21. <text class="customlist-item-field-title">调度时间:</text>
  22. {{ showField(item, 'AttemperStartTime') }}
  23. </view>
  24. <view class="customlist-item-field">
  25. <text class="customlist-item-field-title">学年学期:</text>
  26. {{ showField(item, 'AcademicYearNo') }}
  27. </view>
  28. <view class="customlist-item-field">
  29. <text class="customlist-item-field-title">系部:</text>
  30. {{ displayListItem(item, 'DeptNo') }}
  31. </view>
  32. <view class="customlist-item-field">
  33. <text class="customlist-item-field-title">专业:</text>
  34. {{ displayListItem(item, 'MajorNo') }}
  35. </view>
  36. <view class="customlist-item-field">
  37. <text class="customlist-item-field-title">课程:</text>
  38. {{ displayListItem(item, 'LessonNo') }}
  39. </view>
  40. <view class="customlist-item-field">
  41. <text class="customlist-item-field-title">班级信息:</text>
  42. {{ displayListItem(item, 'TeachClassNo') }}
  43. </view>
  44. <view class="customlist-item-field">
  45. <text class="customlist-item-field-title">教师:</text>
  46. {{ displayListItem(item, 'EmpNo') }}
  47. </view>
  48. <view class="customlist-item-field">
  49. <text class="customlist-item-field-title">教室:</text>
  50. {{ displayListItem(item, 'ClassroomNo') }}
  51. </view>
  52. <view v-show="item.AttemperType != '02'">
  53. <view class="customlist-item-field">
  54. <text class="customlist-item-field-title">新系部:</text>
  55. {{ displayListItem(item, 'NewDeptNo') }}
  56. </view>
  57. <view class="customlist-item-field">
  58. <text class="customlist-item-field-title">新专业:</text>
  59. {{ displayListItem(item, 'NewMajorNo') }}
  60. </view>
  61. <view class="customlist-item-field">
  62. <text class="customlist-item-field-title">新课程:</text>
  63. {{ displayListItem(item, 'NewLessonNo') }}
  64. </view>
  65. <view class="customlist-item-field">
  66. <text class="customlist-item-field-title">新班级:</text>
  67. {{ displayListItem(item, 'NewTeachClassNo') }}
  68. </view>
  69. <view class="customlist-item-field">
  70. <text class="customlist-item-field-title">新教师:</text>
  71. {{ displayListItem(item, 'NewEmpNo') }}
  72. </view>
  73. <view class="customlist-item-field">
  74. <text class="customlist-item-field-title">新教室:</text>
  75. {{ displayListItem(item, 'NewClassroomNo') }}
  76. </view>
  77. </view>
  78. </view>
  79. </l-customlist>
  80. </l-scroll-list>
  81. </view>
  82. <!-- 关闭侧边抽屉按钮 -->
  83. <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose"><l-icon type="pullright" color="blue" /></view>
  84. <!-- 侧边栏,用于设置查询条件 -->
  85. <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
  86. <view v-if="ready" class="padding">
  87. <l-customlist-sidepage-datefilter v-model="dateRange" @change="searchChange" title="按时间日期查询: " ref="datefilter" class="margin-bottom" />
  88. <l-select v-model="queryData.AttemperType" @change="searchChange" :range="dataSource.AttemperType" title="调度类型" placeholder="按调度类型查询" />
  89. <l-input v-model="queryData.AcademicYearNo" @change="searchChange" title="学年学期" placeholder="按学年学期查询" />
  90. <l-select v-model="queryData.DeptNo" @change="searchChange" :range="dataSource.DeptNo" title="系部" placeholder="按系部查询" />
  91. <l-select v-model="queryData.MajorNo" @change="searchChange" :range="dataSource.MajorNo" title="专业" placeholder="按专业查询" />
  92. <l-select v-model="queryData.LessonNo" @change="searchChange" :range="dataSource.LessonNo" title="课程" placeholder="按课程查询" />
  93. <l-select v-model="queryData.TeachClassNo" @change="searchChange" :range="dataSource.TeachClassNo" title="班级信息" placeholder="按班级信息查询" />
  94. <l-select v-model="queryData.EmpNo" @change="searchChange" :range="dataSource.EmpNo" title="教师" placeholder="按教师查询" />
  95. <!-- 重置查询条件按钮 -->
  96. <view class="padding-tb"><l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button></view>
  97. </view>
  98. </scroll-view>
  99. </view>
  100. </template>
  101. <script>
  102. /*
  103. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  104. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  105. * 创建人:超级管理员
  106. * 日 期:2020-10-20 14:32
  107. * 描 述:调度信息
  108. */
  109. /**
  110. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  111. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  112. * { "path": "pages/EducationalAdministration/ArrangeLessonTermAttemper/list", "style": { "navigationBarTitleText": "表单列表页" } }
  113. *
  114. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  115. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  116. */
  117. import moment from 'moment';
  118. import get from 'lodash/get';
  119. import set from 'lodash/set';
  120. import pickBy from 'lodash/pickBy';
  121. import mapValues from 'lodash/mapValues';
  122. export default {
  123. data() {
  124. return {
  125. // 数据项的数据类型、结构
  126. scheme: {
  127. AttemperType: { type: 'select', itemCode: 'AttemperType', dataSource: '0' },
  128. AttemperTimeType: { type: 'select', itemCode: 'AttemperTimeType', dataSource: '0' },
  129. AttemperStartTime: { type: 'text' },
  130. AcademicYearNo: { type: 'text' },
  131. DeptNo: { type: 'select', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno' },
  132. MajorNo: { type: 'select', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' }, //code name id
  133. LessonNo: { type: 'select', dataSource: '1', dataSourceId: 'LessonInfo,lessonname,lessonno' },
  134. TeachClassNo: { type: 'select', dataSource: '1', dataSourceId: 'bjsj,classname,classno' },
  135. EmpNo: { type: 'select', dataSource: '1', dataSourceId: 'EmpInfo,empname,empno' },
  136. ClassroomNo: { type: 'select', dataSource: '1', dataSourceId: 'ClassRoomInfo,classroomname,classroomno' },
  137. NewDeptNo: { type: 'select', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno' },
  138. NewMajorNo: { type: 'select', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' },
  139. NewLessonNo: { type: 'select', dataSource: '1', dataSourceId: 'LessonInfo,lessonname,lessonno' },
  140. NewTeachClassNo: { type: 'select', dataSource: '1', dataSourceId: 'bjsj,classname,classno' },
  141. NewEmpNo: { type: 'select', dataSource: '1', dataSourceId: 'EmpInfo,empname,empno' },
  142. NewClassroomNo: { type: 'select', dataSource: '1', dataSourceId: 'ClassRoomInfo,classroomname,classroomno' }
  143. },
  144. // 查询条件
  145. searchData: {},
  146. defaultQueryData: {},
  147. queryData: {
  148. AttemperType: '',
  149. AcademicYearNo: '',
  150. DeptNo: '',
  151. MajorNo: '',
  152. LessonNo: '',
  153. TeachClassNo: '',
  154. EmpNo: ''
  155. },
  156. // 数据源
  157. dataSource: {
  158. AttemperType: Object.values(this.GET_GLOBAL('dataDictionary').AttemperType).map(t => ({ value: t.value, text: t.text })),
  159. AttemperTimeType: Object.values(this.GET_GLOBAL('dataDictionary').AttemperTimeType).map(t => ({ value: t.value, text: t.text })),
  160. DeptNo: [],
  161. MajorNo: [],
  162. LessonNo: [],
  163. TeachClassNo: [],
  164. EmpNo: [],
  165. ClassroomNo: [],
  166. NewDeptNo: [],
  167. NewMajorNo: [],
  168. NewLessonNo: [],
  169. NewTeachClassNo: [],
  170. NewEmpNo: [],
  171. NewClassroomNo: []
  172. },
  173. // 时间查询参数
  174. dateRange: null,
  175. // 页面相关参数
  176. ready: false,
  177. tips: '加载中...',
  178. loadState: '向下翻以加载更多',
  179. sideOpen: false,
  180. // 列表与分页信息
  181. page: 1,
  182. total: 2,
  183. list: []
  184. };
  185. },
  186. async onLoad() {
  187. await this.init();
  188. },
  189. onUnload() {
  190. this.OFF('EducationalAdministrationArrangeLessonTermAttemper-list-change');
  191. },
  192. methods: {
  193. // 页面初始化
  194. async init() {
  195. this.ON('EducationalAdministrationArrangeLessonTermAttemper-list-change', this.refreshList);
  196. // 拉取加载列表和数据源
  197. await Promise.all([
  198. this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
  199. this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno }));
  200. }),
  201. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  202. this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno }));
  203. }),
  204. this.FETCH_DATASOURCE('LessonInfo').then(result => {
  205. this.dataSource.LessonNo = result.data.map(t => ({ text: t.lessonname, value: t.lessonno }));
  206. }),
  207. this.FETCH_DATASOURCE('bjsj').then(result => {
  208. this.dataSource.TeachClassNo = result.data.map(t => ({ text: t.classname, value: t.classno }));
  209. }),
  210. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  211. this.dataSource.EmpNo = result.data.map(t => ({ text: t.empname, value: t.empno }));
  212. }),
  213. this.FETCH_DATASOURCE('ClassRoomInfo').then(result => {
  214. this.dataSource.ClassroomNo = result.data.map(t => ({ text: t.classroomname, value: t.classroomno }));
  215. }),
  216. this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
  217. this.dataSource.NewDeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno }));
  218. }),
  219. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  220. this.dataSource.NewMajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno }));
  221. }),
  222. this.FETCH_DATASOURCE('LessonInfo').then(result => {
  223. this.dataSource.NewLessonNo = result.data.map(t => ({ text: t.lessonname, value: t.lessonno }));
  224. }),
  225. this.FETCH_DATASOURCE('bjsj').then(result => {
  226. this.dataSource.NewTeachClassNo = result.data.map(t => ({ text: t.classname, value: t.classno }));
  227. }),
  228. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  229. this.dataSource.NewEmpNo = result.data.map(t => ({ text: t.empname, value: t.empno }));
  230. }),
  231. this.FETCH_DATASOURCE('ClassRoomInfo').then(result => {
  232. this.dataSource.NewClassroomNo = result.data.map(t => ({ text: t.classroomname, value: t.classroomno }));
  233. }),
  234. () => {}
  235. ]);
  236. await this.fetchList();
  237. // 初始化查询条件
  238. this.defaultQueryData = this.COPY(this.queryData);
  239. this.ready = true;
  240. },
  241. // 拉取列表
  242. async fetchList() {
  243. if (this.page > this.total) {
  244. return;
  245. }
  246. const result = await this.HTTP_GET(
  247. 'learun/adms/EducationalAdministration/ArrangeLessonTermAttemper/pagelist',
  248. {
  249. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  250. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  251. pagination: { rows: 10, page: this.page, sidx: 'Id', sord: 'DESC' },
  252. queryJson: JSON.stringify(this.searchData)
  253. },
  254. '加载数据时出错'
  255. );
  256. if (!result) {
  257. return;
  258. }
  259. this.total = result.total;
  260. this.page = result.page + 1;
  261. this.list = this.list.concat(result.rows);
  262. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`;
  263. this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多';
  264. },
  265. // 刷新清空列表
  266. async refreshList() {
  267. this.page = 1;
  268. this.total = 2;
  269. this.list = [];
  270. await this.fetchList();
  271. },
  272. // 列表下拉
  273. pullDown() {
  274. this.refreshList().then(() => {
  275. this.$refs.list.stopPullDown();
  276. });
  277. },
  278. // 设置搜索条件
  279. async searchChange() {
  280. const result = {};
  281. // 时间查询相关参数
  282. if (this.dateRange) {
  283. result.StartTime = this.dateRange.start;
  284. result.EndTime = this.dateRange.end;
  285. }
  286. // 将其他查询项添加到查询 JSON 中
  287. const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t));
  288. Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)));
  289. this.searchData = result;
  290. await this.refreshList();
  291. },
  292. // 点击「清空查询条件」按钮
  293. reset() {
  294. this.$refs.datefilter.changeDateRange('all');
  295. this.queryData = this.COPY(this.defaultQueryData);
  296. this.searchChange();
  297. },
  298. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  299. async action(type, id = '') {
  300. switch (type) {
  301. case 'view':
  302. this.NAV_TO(`./single?type=view&id=${id}`);
  303. return;
  304. case 'add':
  305. this.NAV_TO('./single?type=create');
  306. return;
  307. case 'edit':
  308. this.NAV_TO(`./single?type=edit&id=${id}`);
  309. return;
  310. case 'delete':
  311. if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
  312. return;
  313. }
  314. this.HTTP_POST('learun/adms/EducationalAdministration/ArrangeLessonTermAttemper/delete', id, '删除失败').then(success => {
  315. if (!success) {
  316. return;
  317. }
  318. this.TOAST('删除成功', 'success');
  319. this.refreshList();
  320. });
  321. return;
  322. default:
  323. return;
  324. }
  325. },
  326. // 显示列表中的标题项
  327. displayListItem(item, field) {
  328. const fieldItem = this.scheme[field];
  329. const value = item[field];
  330. switch (fieldItem.type) {
  331. case 'currentInfo':
  332. case 'organize':
  333. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '');
  334. case 'radio':
  335. case 'select':
  336. const selectItem = this.dataSource[field].find(t => t.value === String(value));
  337. return get(selectItem, 'text', '');
  338. case 'checkbox':
  339. if (!value || value.split(',').length <= 0) {
  340. return '';
  341. }
  342. const checkboxItems = value.split(',');
  343. return this.dataSource[field]
  344. .filter(t => checkboxItems.includes(t.value))
  345. .map(t => t.text)
  346. .join(',');
  347. case 'datetime':
  348. if (!value) {
  349. return '';
  350. }
  351. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm');
  352. default:
  353. return value === null || value === undefined ? '' : value;
  354. }
  355. },
  356. showField(item, field) {
  357. switch (field) {
  358. case 'AttemperStartTime':
  359. return (item.AttemperStartTime == null ? '-' : item.AttemperStartTime) + '到' + (item.AttemperEndTime == null ? '-' : item.AttemperEndTime);
  360. case 'AcademicYearNo':
  361. return item.AcademicYearNo + '学年第' + item.Semester + '学期';
  362. }
  363. }
  364. }
  365. };
  366. </script>
  367. <style lang="less" scoped>
  368. @import '~@/common/css/sidepage.less';
  369. @import '~@/common/css/customlist.less';
  370. </style>