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.

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