Przeglądaj źródła

小程序听课记录

大厂分支
zhichao lei 4 lat temu
rodzic
commit
f5efe198f4
12 zmienionych plików z 1354 dodań i 16 usunięć
  1. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/LogisticsManagement/ListenClassRecord/ListenClassRecord.js
  2. +5
    -5
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/LogisticsManagement/ListenClassRecord/form/form.js
  3. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/PersonnelManagement/ContactsDetails/ContactsDetails.js
  4. +3
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/PersonnelManagement/ContactsDetails/form/form.js
  5. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DeptApi.cs
  6. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ListenClassRecordApi.cs
  7. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/ContactsDetailsApi.cs
  8. +7
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json
  9. +352
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ListenClassRecord/list.vue
  10. +401
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ListenClassRecord/single.vue
  11. +332
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/ContactsDetails/list.vue
  12. +247
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/ContactsDetails/single.vue

+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/LogisticsManagement/ListenClassRecord/ListenClassRecord.js Wyświetl plik

@@ -79,7 +79,7 @@
if (param.begin && param.end) {
_postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end });
}
learun.httpget(config.webapi + 'learun/LogisticsManagement/ListenClassRecord/pagelist', _postParam, (data) => {
learun.httpget(config.webapi + 'learun/adms/LogisticsManagement/ListenClassRecord/pagelist', _postParam, (data) => {
$page.find('.lr-badge').text('0');
if (data) {
$page.find('.lr-badge').text(data.records);
@@ -106,7 +106,7 @@
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) {
if (_index === '1') {
learun.layer.loading(true, '正在删除该笔数据');
learun.httppost(config.webapi + 'learun/LogisticsManagement/ListenClassRecord/delete', item.ID , (data) => {
learun.httppost(config.webapi + 'learun/adms/LogisticsManagement/ListenClassRecord/delete', item.ID , (data) => {
if (data) {// 删除数据成功
page.grid.reload();
}


+ 5
- 5
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/LogisticsManagement/ListenClassRecord/form/form.js Wyświetl plik

@@ -61,7 +61,7 @@
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) {
if (_index === '1') {
learun.layer.loading(true, '正在删除该笔数据');
learun.httppost(config.webapi + 'learun/LogisticsManagement/ListenClassRecord/delete', keyValue, (data) => {
learun.httppost(config.webapi + 'learun/adms/LogisticsManagement/ListenClassRecord/delete', keyValue, (data) => {
learun.layer.loading(false);
if (data) {// 删除数据成功
learun.nav.closeCurrent();
@@ -88,7 +88,7 @@
_postData.keyValue = keyValue;
_postData.strEntity = JSON.stringify($page.find('.lr-form-container').lrformGet());
learun.layer.loading(true, '正在提交数据');
learun.httppost(config.webapi + 'learun/LogisticsManagement/ListenClassRecord/save', _postData, (data) => {
learun.httppost(config.webapi + 'learun/adms/LogisticsManagement/ListenClassRecord/save', _postData, (data) => {
learun.layer.loading(false);
if (data) {// 表单数据保存成功
if (keyValue) {
@@ -115,7 +115,7 @@
$header.find('.lr-form-header-btnlist').show();
// 获取表单数据
learun.layer.loading(true, '获取表单数据');
learun.httpget(config.webapi + 'learun/LogisticsManagement/ListenClassRecord/form', keyValue, (data) => {
learun.httpget(config.webapi + 'learun/adms/LogisticsManagement/ListenClassRecord/form', keyValue, (data) => {
if (data) {
for (var id in data) {
if (data[id].length) {
@@ -142,7 +142,7 @@
itext: 'deptname',
change:function(val) {
if (val != null) {
learun.httpget(config.webapi+'dept/majorbydept',val,(data) => {
learun.httpget(config.webapi+'learun/adms/dept/majorbydept',val,(data) => {
if (data) {
$page.find('#MajorNo').lrpickerSetData(data);
}
@@ -155,7 +155,7 @@
itext: 'MajorName',
change:function(val) {
if (val != null) {
learun.httpget(config.webapi+'dept/classbymajor',val,(data) => {
learun.httpget(config.webapi+'learun/adms/dept/classbymajor',val,(data) => {
if (data) {
console.log(data);
$page.find('#ClassNo').lrpickerSetData(data);


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/PersonnelManagement/ContactsDetails/ContactsDetails.js Wyświetl plik

@@ -61,7 +61,7 @@

_postParam.queryJson = JSON.stringify({ EID: EID });
}
learun.httpget(config.webapi + 'learun/PersonnelManagement/ContactsDetails/pagelist', _postParam, (data) => {
learun.httpget(config.webapi + 'learun/adms/PersonnelManagement/ContactsDetails/pagelist', _postParam, (data) => {
$page.find('.lr-badge').text('0');
if (data) {
$page.find('.lr-badge').text(data.records);
@@ -112,7 +112,7 @@
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) {
if (_index === '1') {
learun.layer.loading(true, '正在删除该笔数据');
learun.httppost(config.webapi + 'learun/PersonnelManagement/ContactsDetails/delete', item.ID, (data) => {
learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/ContactsDetails/delete', item.ID, (data) => {
if (data) {// 删除数据成功
page.grid.reload();
}


+ 3
- 3
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/PersonnelManagement/ContactsDetails/form/form.js Wyświetl plik

@@ -62,7 +62,7 @@
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) {
if (_index === '1') {
learun.layer.loading(true, '正在删除该笔数据');
learun.httppost(config.webapi + 'learun/PersonnelManagement/ContactsDetails/delete', keyValue, (data) => {
learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/ContactsDetails/delete', keyValue, (data) => {
learun.layer.loading(false);
if (data) {// 删除数据成功
learun.nav.closeCurrent();
@@ -93,7 +93,7 @@
}
_postData.strEntity = JSON.stringify(bodyForm);
learun.layer.loading(true, '正在提交数据');
learun.httppost(config.webapi + 'learun/PersonnelManagement/ContactsDetails/save', _postData, (data) => {
learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/ContactsDetails/save', _postData, (data) => {
learun.layer.loading(false);
if (data) {// 表单数据保存成功
if (keyValue) {
@@ -120,7 +120,7 @@
$header.find('.lr-form-header-btnlist').show();
// 获取表单数据
learun.layer.loading(true, '获取表单数据');
learun.httpget(config.webapi + 'learun/PersonnelManagement/ContactsDetails/form', keyValue, (data) => {
learun.httpget(config.webapi + 'learun/adms/PersonnelManagement/ContactsDetails/form', keyValue, (data) => {
if (data) {
for (var id in data) {
if (data[id].length) {


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/DeptApi.cs Wyświetl plik

@@ -22,7 +22,7 @@ namespace Learun.Application.WebApi
/// 注册接口
/// <summary>
public DeptApi()
: base("/dept")
: base("/learun/adms/dept")
{
Get["/majorbydept"] = GetMajorByDeptNo;
Get["/classbymajor"] = GetClassByMajorNo;


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/ListenClassRecordApi.cs Wyświetl plik

@@ -19,7 +19,7 @@ namespace Learun.Application.WebApi
/// 注册接口
/// <summary>
public ListenClassRecordApi()
: base("/Learun/LogisticsManagement/ListenClassRecord")
: base("/Learun/adms/LogisticsManagement/ListenClassRecord")
{
Get["/pagelist"] = GetPageList;
Get["/list"] = GetList;


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/PersonnelManagement/ContactsDetailsApi.cs Wyświetl plik

@@ -19,7 +19,7 @@ namespace Learun.Application.WebApi
/// 注册接口
/// <summary>
public ContactsDetailsApi()
: base("/Learun/PersonnelManagement/ContactsDetails")
: base("/Learun/adms/PersonnelManagement/ContactsDetails")
{
Get["/pagelist"] = GetPageList;
Get["/list"] = GetList;


+ 7
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json Wyświetl plik

@@ -180,7 +180,13 @@
{ "path": "pages/EducationalAdministration/ArrangeLessonTermAttemper/list", "style": { "navigationBarTitleText": "调度信息" } },
//请假管理
{ "path": "pages/EducationalAdministration/StuAttendanceLeave/list", "style": { "navigationBarTitleText": "请假管理" } },
{ "path": "pages/EducationalAdministration/StuAttendanceLeave/single", "style": { "navigationBarTitleText": "审核" } }
{ "path": "pages/EducationalAdministration/StuAttendanceLeave/single", "style": { "navigationBarTitleText": "审核" } },
//疫情详细信息
{ "path": "pages/PersonnelManagement/ContactsDetails/list", "style": { "navigationBarTitleText": "疫情详细信息" } },
{ "path": "pages/PersonnelManagement/ContactsDetails/single", "style": { "navigationBarTitleText": "详情" } },
//听课记录
{ "path": "pages/LogisticsManagement/ListenClassRecord/list", "style": { "navigationBarTitleText": "听课记录" } },
{ "path": "pages/LogisticsManagement/ListenClassRecord/single", "style": { "navigationBarTitleText": "详情" } }
],



+ 352
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ListenClassRecord/list.vue Wyświetl plik

@@ -0,0 +1,352 @@
<template>
  <view class="page">
    <!-- 主列表页 -->
    <view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
      <!-- 顶部条目/分页信息栏 -->
      <l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner>
  
      <!-- 滚动列表,跨端支持上拉/下拉 -->
      <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
        <l-customlist :tips="loadState" showTips>
          <!-- 单条记录 -->
          <view class="customlist-item" v-for="item of list" :key="item.ID">
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">讲课老师:</text>
              {{ displayListItem(item, 'EmpNo') }}
            </view>
  
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">课程名称:</text>
              {{ displayListItem(item, 'LessonName') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">记录时间:</text>
              {{ displayListItem(item, 'RecordTime') }}
            </view>
  
  
  
            <l-customlist-action showEdit @edit="action('edit', item.ID)" showDelete @delete="action('delete', item.ID)" @view="action('view', item.ID)" />
          </view>
        </l-customlist>
      </l-scroll-list>
    </view>
  
    <!-- 关闭侧边抽屉按钮 -->
    <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
      <l-icon type="pullright" color="blue" />
    </view>
  
    <!-- 侧边栏,用于设置查询条件 -->
    <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
      <view v-if="ready" class="padding">
  
        <l-customlist-sidepage-datefilter
          v-model="dateRange"
          @change="searchChange"
          title="按时间日期查询: "
          ref="datefilter"
          class="margin-bottom"
        />
  
        <l-select
          v-model="queryData.DeptNo"
          @change="searchChange"
          :range="dataSource.DeptNo"
          title ="系部"
          placeholder="按系部查询"
        />
        <l-select
          v-model="queryData.MajorNo"
          @change="searchChange"
          :range="dataSource.MajorNo"
          title ="专业"
          placeholder="按专业查询"
        />
        <l-select
          v-model="queryData.ClassNo"
          @change="searchChange"
          :range="dataSource.ClassNo"
          title ="班级"
          placeholder="按班级查询"
        />
        <l-organize-picker
          v-model="queryData.EmpNo"
          @change="searchChange"
          type="user"
          title ="讲课老师"
          placeholder="按讲课老师查询"
        />
  
        <!-- 重置查询条件按钮 -->
        <view class="padding-tb">
          <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
        </view>
      </view>
    </scroll-view>
  
    <l-customlist-add v-if="!sideOpen" @click="action('add')" />
  
  </view>
</template>
  
  
<script>
/*
 * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
 * Copyright (c) 2013-2020 上海力软信息技术有限公司
 * 创建人:超级管理员
 * 日  期:2020-10-21 10:15
 * 描  述:听课记录
 */
  
/**
 * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
 * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
 * { "path": "pages/LogisticsManagement/ListenClassRecord/list", "style": { "navigationBarTitleText": "表单列表页" } }
 * 
 * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
 * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
 */
import moment from 'moment'
import get from 'lodash/get'
import set from 'lodash/set'
import pickBy from 'lodash/pickBy'
import mapValues from 'lodash/mapValues'
  
export default {
  data() {
    return {
      // 数据项的数据类型、结构
      scheme: {
        DeptNo: { type: 'select', dataSource: '0' },
        MajorNo: { type: 'select', dataSource: '0' },
        ClassNo: { type: 'select', dataSource: '0' },
        EmpNo: { type: 'organize', dataType: 'user' },
        Address: { type: 'text' },
        LessonName: { type: 'text' },
        RecordTime: { type: 'text' },
        sknryhd: { type: 'textarea' },
        xxmb: { type: 'select', dataSource: '0' },
        xxmbsfkcl: { type: 'select', dataSource: '0' },
        Creater: { type: 'organize', dataType: 'user' },
        xxqjdsj: { type: 'select', dataSource: '0' },
        gzrwdsj: { type: 'select', dataSource: '0' },
        jxhddsj: { type: 'select', dataSource: '0' },
        jxzddfx: { type: 'select', dataSource: '0' },
        gczhdytw: { type: 'select', dataSource: '0' },
        xsdcyhz: { type: 'select', dataSource: '0' },
        xsdsjjn: { type: 'select', dataSource: '0' },
        xsxxxggc: { type: 'select', dataSource: '0' },
        ydyjc: { type: 'textarea' },
        wtyjy: { type: 'textarea' },
        Evaluate: { type: 'select', dataSource: '0' },
        Remark: { type: 'textarea' },
      },
  
      // 查询条件
      searchData: {},
      defaultQueryData: {},
      queryData: {
        DeptNo: '',
        MajorNo: '',
        ClassNo: '',
        EmpNo: '',
      },
  
      // 数据源
      dataSource: {
        DeptNo: [],
        MajorNo: [],
        ClassNo: [],
        xxmb: [],
        xxmbsfkcl: [],
        xxqjdsj: [],
        gzrwdsj: [],
        jxhddsj: [],
        jxzddfx: [],
        gczhdytw: [],
        xsdcyhz: [],
        xsdsjjn: [],
        xsxxxggc: [],
        Evaluate: [],
      },
  
      // 时间查询参数
      dateRange: null,
  
      // 页面相关参数
      ready: false,
      tips: '加载中...',
      loadState: '向下翻以加载更多',
      sideOpen: false,
  
      // 列表与分页信息
      page: 1,
      total: 2,
      list: []
    }
  },
  
  async onLoad() {
    await this.init()
  },
  onUnload() {
    this.OFF('LogisticsManagementListenClassRecord-list-change')
  },
  
  methods: {
    // 页面初始化
    async init() {
      this.ON('LogisticsManagementListenClassRecord-list-change', this.refreshList)
  
      // 拉取加载列表和数据源
      await Promise.all([
  
  
        () => {}
      ])
      await this.fetchList()
      // 初始化查询条件
      this.defaultQueryData = this.COPY(this.queryData)
      this.ready = true
    },
  
    // 拉取列表
    async fetchList() {
      if (this.page > this.total) { return }
  
      const result = await this.HTTP_GET(
        '/LogisticsManagement/ListenClassRecord/pagelist',
        {
          // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
          // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
          pagination: { rows: 10, page: this.page, sidx: 'ID', sord: 'DESC' },
          queryJson: JSON.stringify(this.searchData)
        },
        '加载数据时出错'
      )
  
      if (!result) { return }
  
      this.total = result.total
      this.page = result.page + 1
      this.list = this.list.concat(result.rows)
  
      this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
      this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
    },
  
    // 刷新清空列表
    async refreshList() {
      this.page = 1
      this.total = 2
      this.list = []
  
      await this.fetchList()
    },
  
    // 列表下拉
    pullDown() {
      this.refreshList().then(() => {
        this.$refs.list.stopPullDown()
      })
    },
  
    // 设置搜索条件
    async searchChange() {
      const result = {}
  
      // 时间查询相关参数
      if (this.dateRange) {
        result.StartTime = this.dateRange.start
        result.EndTime = this.dateRange.end
      }
  
      // 将其他查询项添加到查询 JSON 中
      const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
      Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  
      this.searchData = result
      await this.refreshList()
    },
  
    // 点击「清空查询条件」按钮
    reset() {
      this.$refs.datefilter.changeDateRange('all')
      this.queryData = this.COPY(this.defaultQueryData)
      this.searchChange()
    },
  
    // 点击「编辑」、「查看」、「添加」、「删除」按钮
    async action(type, id = '') {
      switch (type) {
        case 'view':
          this.NAV_TO(`./single?type=view&id=${id}`)
          return
  
        case 'add':
          this.NAV_TO('./single?type=create')
          return
  
        case 'edit':
          this.NAV_TO(`./single?type=edit&id=${id}`)
          return
  
        case 'delete':
          if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
            return
          }
  
          this.HTTP_POST('/LogisticsManagement/ListenClassRecord/delete', id, '删除失败').then(success => {
            if(!success) { return }
            this.TOAST('删除成功', 'success')
            this.refreshList()
          })
          return
  
        default:
          return
      }
    },
  
    // 显示列表中的标题项
    displayListItem(item, field) {
      const fieldItem = this.scheme[field]
      const value = item[field]
  
      switch (fieldItem.type) {
        case 'currentInfo':
        case 'organize':
          return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
  
        case 'radio':
        case 'select':
          const selectItem = this.dataSource[field].find(t => t.value === String(value))
          return get(selectItem, 'text', '')
  
        case 'checkbox':
          if (!value || value.split(',').length <= 0) { return '' }
          const checkboxItems = value.split(',')
          return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
  
        case 'datetime':
          if (!value) { return '' }
          return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm')
  
        default: return value === null || value === undefined ? '' : value
      }
    }
  
  }
}
</script>
  
  
<style lang="less" scoped>
@import '~@/common/css/sidepage.less';
@import '~@/common/css/customlist.less';
</style>

+ 401
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ListenClassRecord/single.vue Wyświetl plik

@@ -0,0 +1,401 @@
<template>
  <view class="page">
    <view v-if="ready">
      <l-select
        @input="setValue('ListenClassRecord.DeptNo', $event)"
        :value="getValue('ListenClassRecord.DeptNo')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.DeptNo"
@change="deptChange($event)"
        title="系部"
      />
      <l-select
        @input="setValue('ListenClassRecord.MajorNo', $event)"
        :value="getValue('ListenClassRecord.MajorNo')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.MajorNo"
@change="majorChange($event)"
        title="专业"
      />
      <l-select
        @input="setValue('ListenClassRecord.ClassNo', $event)"
        :value="getValue('ListenClassRecord.ClassNo')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.ClassNo"
        title="班级"
      />
      <l-organize-picker
        @input="setValue('ListenClassRecord.EmpNo', $event)"
        :value="getValue('ListenClassRecord.EmpNo')"
        :readonly="!edit"
        type="user"
        title="讲课老师"
      />
      <l-input
        @input="setValue('ListenClassRecord.Address', $event)"
        :value="getValue('ListenClassRecord.Address')"
        :disabled="!edit"
        title="听课地点"
      />
      <l-input
        @input="setValue('ListenClassRecord.LessonName', $event)"
        :value="getValue('ListenClassRecord.LessonName')"
        :disabled="!edit"
        title="课程名称"
      />
      <l-input
        @input="setValue('ListenClassRecord.RecordTime', $event)"
        :value="getValue('ListenClassRecord.RecordTime')"
        :disabled="!edit"
        title="记录时间"
      />
      <l-textarea
        @input="setValue('ListenClassRecord.sknryhd', $event)"
        :value="getValue('ListenClassRecord.sknryhd')"
        :readonly="!edit"
        title="授课内容与活动"
      />
      <l-select
        @input="setValue('ListenClassRecord.xxmb', $event)"
        :value="getValue('ListenClassRecord.xxmb')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.xxmb"
        title="是否有学习目标?"
      />
      <l-select
        @input="setValue('ListenClassRecord.xxmbsfkcl', $event)"
        :value="getValue('ListenClassRecord.xxmbsfkcl')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.xxmbsfkcl"
        title="学习目标是否清晰,具体,可测量?"
      />
      <l-organize-picker
        @input="setValue('ListenClassRecord.Creater', $event)"
        :value="getValue('ListenClassRecord.Creater')"
        :readonly="!edit"
        type="user"
        title="听客人"
      />
      <l-select
        @input="setValue('ListenClassRecord.xxqjdsj', $event)"
        :value="getValue('ListenClassRecord.xxqjdsj')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.xxqjdsj"
        title="学习情景的设计是否满足教学?"
      />
      <l-select
        @input="setValue('ListenClassRecord.gzrwdsj', $event)"
        :value="getValue('ListenClassRecord.gzrwdsj')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.gzrwdsj"
        title="工作任务(或问题)的设计是否合适?"
      />
      <l-select
        @input="setValue('ListenClassRecord.jxhddsj', $event)"
        :value="getValue('ListenClassRecord.jxhddsj')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.jxhddsj"
        title="教学活动的设计与实施是否合适,有效?"
      />
      <l-select
        @input="setValue('ListenClassRecord.jxzddfx', $event)"
        :value="getValue('ListenClassRecord.jxzddfx')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.jxzddfx"
        title="教学重点的分析与难点的突破?"
      />
      <l-select
        @input="setValue('ListenClassRecord.gczhdytw', $event)"
        :value="getValue('ListenClassRecord.gczhdytw')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.gczhdytw"
        title="过程中互动与提问?"
      />
      <l-select
        @input="setValue('ListenClassRecord.xsdcyhz', $event)"
        :value="getValue('ListenClassRecord.xsdcyhz')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.xsdcyhz"
        title="学生的参与,合作?"
      />
      <l-select
        @input="setValue('ListenClassRecord.xsdsjjn', $event)"
        :value="getValue('ListenClassRecord.xsdsjjn')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.xsdsjjn"
        title="学生的实践技能学习?"
      />
      <l-select
        @input="setValue('ListenClassRecord.xsxxxggc', $event)"
        :value="getValue('ListenClassRecord.xsxxxggc')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.xsxxxggc"
        title="学生学习效果观察?"
      />
      <l-textarea
        @input="setValue('ListenClassRecord.ydyjc', $event)"
        :value="getValue('ListenClassRecord.ydyjc')"
        :readonly="!edit"
        title="优点与精彩"
      />
      <l-textarea
        @input="setValue('ListenClassRecord.wtyjy', $event)"
        :value="getValue('ListenClassRecord.wtyjy')"
        :readonly="!edit"
        title="问题与建议"
      />
      <l-select
        @input="setValue('ListenClassRecord.Evaluate', $event)"
        :value="getValue('ListenClassRecord.Evaluate')"
        :disabled="!edit"
        :range="dataSource.ListenClassRecord.Evaluate"
        title="评价"
      />
      <l-textarea
        @input="setValue('ListenClassRecord.Remark', $event)"
        :value="getValue('ListenClassRecord.Remark')"
        :readonly="!edit"
        title="备注"
      />
    </view>
  
    <view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
      <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
        提交保存
      </l-button>
      <l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
        编辑本页
      </l-button>
      <l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
        取消编辑
      </l-button>
      <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
        删除
      </l-button>
    </view>
  </view>
</template>
  
  
<script>
/*
 * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
 * Copyright (c) 2013-2020 上海力软信息技术有限公司
 * 创建人:超级管理员
 * 日  期:2020-10-21 10:28
 * 描  述:听课记录
 */
  
/**
 * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
 * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
 * { "path": "pages/LogisticsManagement/ListenClassRecord/single", "style": { "navigationBarTitleText": "表单详情页" } }
 * 
 * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
 * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
 */
  
import get from 'lodash/get'
import set from 'lodash/set'
import moment from 'moment'
import customPageMixins from '@/common/custompage.js'
  
export default {
  mixins: [customPageMixins],
  
  data() {
    return {
      // 页面相关参数
      id: null,
      mode: null,
      edit: null,
      ready: false,
  
      // 表单数据
      current: {},
      origin: {},
  
      // 表单项数据结构
      scheme: {
        ListenClassRecord: {
          DeptNo: { type: 'select', title: '系部', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno' },
          MajorNo: { type: 'select', title: '专业', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' },
          ClassNo: { type: 'select', title: '班级', dataSource: '1', dataSourceId: 'bjsj,classname,classno' },
          EmpNo: { type: 'organize', title: '讲课老师', dataType: 'user' },
          Address: { type: 'text', title: '听课地点' },
          LessonName: { type: 'text', title: '课程名称' },
          RecordTime: { type: 'text', title: '记录时间' },
          sknryhd: { type: 'textarea', title: '授课内容与活动' },
          xxmb: { type: 'select', title: '是否有学习目标?', dataSource: '0' },
          xxmbsfkcl: { type: 'select', title: '学习目标是否清晰,具体,可测量?', dataSource: '0' },
          Creater: { type: 'organize', title: '听客人', dataType: 'user' },
          xxqjdsj: { type: 'select', title: '学习情景的设计是否满足教学?', dataSource: '0' },
          gzrwdsj: { type: 'select', title: '工作任务(或问题)的设计是否合适?', dataSource: '0' },
          jxhddsj: { type: 'select', title: '教学活动的设计与实施是否合适,有效?', dataSource: '0' },
          jxzddfx: { type: 'select', title: '教学重点的分析与难点的突破?', dataSource: '0' },
          gczhdytw: { type: 'select', title: '过程中互动与提问?', dataSource: '0' },
          xsdcyhz: { type: 'select', title: '学生的参与,合作?', dataSource: '0' },
          xsdsjjn: { type: 'select', title: '学生的实践技能学习?', dataSource: '0' },
          xsxxxggc: { type: 'select', title: '学生学习效果观察?', dataSource: '0' },
          ydyjc: { type: 'textarea', title: '优点与精彩' },
          wtyjy: { type: 'textarea', title: '问题与建议' },
          Evaluate: { type: 'select', title: '评价', dataSource: '0' },
          Remark: { type: 'textarea', title: '备注' },
        },
  
      },
  
      // 数据源
      dataSource: {
        ListenClassRecord: {
          DeptNo: [],
          MajorNo: [],
          ClassNo: [],
          xxmb: [{ text: '有', value: '1' }, { text: '无', value: '0' }],
          xxmbsfkcl: [{ text: '良好', value: '1' }, { text: '稍作修改', value: '2' }, { text: '较大修改', value: '3' }],
          xxqjdsj: [{ text: '满足', value: '1' }, { text: '基本满足', value: '2' }, { text: '不满足', value: '3' }],
          gzrwdsj: [{ text: '合适', value: '1' }, { text: '基本合适', value: '2' }, { text: '不合适', value: '3' }],
          jxhddsj: [{ text: '好', value: '1' }, { text: '一般', value: '2' }, { text: '较差', value: '3' }],
          jxzddfx: [{ text: '分析清晰', value: '1' }, { text: '需要改进', value: '2' }],
          gczhdytw: [{ text: '方法', value: '1' }, { text: '效果', value: '2' }],
          xsdcyhz: [{ text: '良好', value: '1' }, { text: '一般', value: '2' }, { text: '较差', value: '3' }],
          xsdsjjn: [{ text: '实践内容丰富', value: '1' }, { text: '实践内容较少', value: '2' }],
          xsxxxggc: [{ text: '良好', value: '1' }, { text: '一般', value: '2' }, { text: '较差', value: '3' }],
          Evaluate: [{ text: '优秀,可示范', value: '1' }, { text: '良好,有期待', value: '2' }, { text: '一般,待改进', value: '3' }, { text: '较差,需培训', value: '4' }],
        },
  
      }
    }
  },
  
  async onLoad({ type, id }) {
    await this.init(type, id)
  },
  
  methods: {
    // 页面初始化
    async init(type, id) {
      this.LOADING('加载数据中...')
  
      this.id = id
      this.mode = type
      this.edit = ['create', 'edit'].includes(this.mode)
  
      // 拉取表单数据,同时拉取所有来自数据源的选单数据
      await Promise.all([
        this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
          this.dataSource.ListenClassRecord.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno }))
        }),
        this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
          this.dataSource.ListenClassRecord.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno }))
        }),
        this.FETCH_DATASOURCE('bjsj').then(result => {
          this.dataSource.ListenClassRecord.ClassNo = result.data.map(t => ({ text: t.classname, value: t.classno }))
        }),
  
  
        () => {}
      ])
      await this.fetchForm()
  
      this.ready = true
      this.HIDE_LOADING()
    },
  
    // 加载表单数据
    async fetchForm() {
      if (this.mode === 'create') {
        this.origin = await this.getDefaultForm()
      } else {
        const result = await this.HTTP_GET('/LogisticsManagement/ListenClassRecord/form', this.id)
        this.origin = await this.formatFormData(result)
      }
      this.current = this.COPY(this.origin)
    },
  
    // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
    async action(type) {
      switch (type) {
        case 'edit':
          this.edit = true
          break
  
        case 'reset':
          this.current = this.COPY(this.origin)
          this.edit = false
          break
  
        case 'save':
          const verifyResult = this.verifyForm()
          if (verifyResult.length > 0) {
            this.CONFIRM('表单验证失败', verifyResult.join('\n'))
            return
          }
  
          if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
            return
          }
  
          this.LOADING('正在提交...')
          const postData = await this.getPostData(this.id)
  
          this.HTTP_POST('/LogisticsManagement/ListenClassRecord/save', postData, '表单提交保存失败').then(success => {
            this.HIDE_LOADING()
            if (!success) {
              return
            }
  
            this.EMIT('LogisticsManagementListenClassRecord-list-change')
            this.NAV_BACK()
            this.TOAST('提交保存成功')
          })
          break
  
        case 'delete':
          if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
            return
          }
  
          this.LOADING('提交删除中...')
          this.HTTP_POST('/LogisticsManagement/ListenClassRecord/delete', this.id, '删除失败').then(success => {
            this.HIDE_LOADING()
            if (!success) {
              return
            }
  
            this.EMIT('LogisticsManagementListenClassRecord-list-change')
            this.NAV_BACK()
            this.this.TOAST('删除成功', 'success')
          })
          break
  
        default: break
      }
    },
  
    // 获取表单值
    getValue(path) {
      return get(this.current, path)
    },
  
    // 设置表单值
    setValue(path, val) {
      set(this.current, path, val)
    },
deptChange(val){
console.log(val);
this.GET('/dept/majorbydept', val).then(data => {
this.dataSource.ListenClassRecord.MajorNo=data[1].data.data.map(t=>({value:t.MajorNo,text:t.MajorName}));
  
          })
},
majorChange(val){
console.log(val);
this.GET('/dept/classbymajor', val).then(data => {
this.dataSource.ListenClassRecord.ClassNo=data[1].data.data.map(t=>({value:t.ClassNo,text:t.ClassName}));
  
          })
}
  }
}
</script>

+ 332
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/ContactsDetails/list.vue Wyświetl plik

@@ -0,0 +1,332 @@
<template>
  <view class="page">
    <!-- 主列表页 -->
    <view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
      <!-- 顶部条目/分页信息栏 -->
      <l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner>
  
      <!-- 滚动列表,跨端支持上拉/下拉 -->
      <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
        <l-customlist :tips="loadState" showTips>
          <!-- 单条记录 -->
          <view class="customlist-item" v-for="item of list" :key="item.ID">
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">姓名:</text>
              {{ displayListItem(item, 'Name') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">性别:</text>
              {{ displayListItem(item, 'Gender') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">联系方式:</text>
              {{ displayListItem(item, 'Mobile') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">身份证:</text>
              {{ displayListItem(item, 'IDCard') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">隔离方式:</text>
              {{ displayListItem(item, 'QTType') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">隔离地点:</text>
              {{ displayListItem(item, 'QTAddress') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">隔离时间:</text>
              {{ displayListItem(item, 'QTContactTime') }}
            </view>
  
            <view class="customlist-item-field">
              <text class="customlist-item-field-title">是否发热:</text>
              {{ displayListItem(item, 'Fever') }}
            </view>
  
  
            <l-customlist-action showEdit @edit="action('edit', item.ID)" showDelete @delete="action('delete', item.ID)" @view="action('view', item.ID)" />
          </view>
        </l-customlist>
      </l-scroll-list>
    </view>
  
    <!-- 关闭侧边抽屉按钮 -->
    <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
      <l-icon type="pullright" color="blue" />
    </view>
  
    <!-- 侧边栏,用于设置查询条件 -->
    <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
      <view v-if="ready" class="padding">
  
        <l-customlist-sidepage-datefilter
          v-model="dateRange"
          @change="searchChange"
          title="按时间日期查询: "
          ref="datefilter"
          class="margin-bottom"
        />
  
        <l-input
          v-model="queryData.Name"
          @change="searchChange"
          title ="姓名"
          placeholder="按姓名查询"
        />
        <l-select
          v-model="queryData.Fever"
          @change="searchChange"
          :range="dataSource.Fever"
          title ="是否发热"
          placeholder="按是否发热查询"
        />
  
        <!-- 重置查询条件按钮 -->
        <view class="padding-tb">
          <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
        </view>
      </view>
    </scroll-view>
  
    <l-customlist-add v-if="!sideOpen" @click="action('add')" />
  
  </view>
</template>
  
  
<script>
/*
 * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
 * Copyright (c) 2013-2020 上海力软信息技术有限公司
 * 创建人:超级管理员
 * 日  期:2020-10-21 09:49
 * 描  述:疫情详细信息
 */
  
/**
 * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
 * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
 * { "path": "pages/PersonnelManagement/ContactsDetails/list", "style": { "navigationBarTitleText": "表单列表页" } }
 * 
 * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
 * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
 */
import moment from 'moment'
import get from 'lodash/get'
import set from 'lodash/set'
import pickBy from 'lodash/pickBy'
import mapValues from 'lodash/mapValues'
  
export default {
  data() {
    return {
      // 数据项的数据类型、结构
      scheme: {
        Name: { type: 'text' },
        Gender: { type: 'select', itemCode: 'usersex', dataSource: '0' },
        Mobile: { type: 'text' },
        IDCard: { type: 'text' },
        QTType: { type: 'select', itemCode: 'QuarantineType', dataSource: '0' },
        QTAddress: { type: 'text' },
        QTContactTime: { type: 'datetime', dateformat: '0' },
        Fever: { type: 'select', itemCode: 'YesOrNoInt', dataSource: '0' },
      },
  
      // 查询条件
      searchData: {},
      defaultQueryData: {},
      queryData: {
        Name: '',
        Fever: '',
      },
  
      // 数据源
      dataSource: {
        Gender: Object.values(this.GET_GLOBAL('dataDictionary').usersex).map(t => ({ value: t.value, text: t.text })),
        QTType: Object.values(this.GET_GLOBAL('dataDictionary').QuarantineType).map(t => ({ value: t.value, text: t.text })),
        Fever: Object.values(this.GET_GLOBAL('dataDictionary').YesOrNoInt).map(t => ({ value: t.value, text: t.text })),
      },
  
      // 时间查询参数
      dateRange: null,
  
      // 页面相关参数
      ready: false,
      tips: '加载中...',
      loadState: '向下翻以加载更多',
      sideOpen: false,
  
      // 列表与分页信息
      page: 1,
      total: 2,
      list: []
    }
  },
  
  async onLoad() {
    await this.init()
  },
  onUnload() {
    this.OFF('PersonnelManagementContactsDetails-list-change')
  },
  
  methods: {
    // 页面初始化
    async init() {
      this.ON('PersonnelManagementContactsDetails-list-change', this.refreshList)
  
      // 拉取加载列表和数据源
      await Promise.all([
  
  
        () => {}
      ])
      await this.fetchList()
      // 初始化查询条件
      this.defaultQueryData = this.COPY(this.queryData)
      this.ready = true
    },
  
    // 拉取列表
    async fetchList() {
      if (this.page > this.total) { return }
  
      const result = await this.HTTP_GET(
        '/PersonnelManagement/ContactsDetails/pagelist',
        {
          // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
          // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
          pagination: { rows: 10, page: this.page, sidx: 'ID', sord: 'DESC' },
          queryJson: JSON.stringify(this.searchData)
        },
        '加载数据时出错'
      )
  
      if (!result) { return }
  
      this.total = result.total
      this.page = result.page + 1
      this.list = this.list.concat(result.rows)
  
      this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
      this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
    },
  
    // 刷新清空列表
    async refreshList() {
      this.page = 1
      this.total = 2
      this.list = []
  
      await this.fetchList()
    },
  
    // 列表下拉
    pullDown() {
      this.refreshList().then(() => {
        this.$refs.list.stopPullDown()
      })
    },
  
    // 设置搜索条件
    async searchChange() {
      const result = {}
  
      // 时间查询相关参数
      if (this.dateRange) {
        result.StartTime = this.dateRange.start
        result.EndTime = this.dateRange.end
      }
  
      // 将其他查询项添加到查询 JSON 中
      const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
      Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  
      this.searchData = result
      await this.refreshList()
    },
  
    // 点击「清空查询条件」按钮
    reset() {
      this.$refs.datefilter.changeDateRange('all')
      this.queryData = this.COPY(this.defaultQueryData)
      this.searchChange()
    },
  
    // 点击「编辑」、「查看」、「添加」、「删除」按钮
    async action(type, id = '') {
      switch (type) {
        case 'view':
          this.NAV_TO(`./single?type=view&id=${id}`)
          return
  
        case 'add':
          this.NAV_TO('./single?type=create')
          return
  
        case 'edit':
          this.NAV_TO(`./single?type=edit&id=${id}`)
          return
  
        case 'delete':
          if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
            return
          }
  
          this.HTTP_POST('/PersonnelManagement/ContactsDetails/delete', id, '删除失败').then(success => {
            if(!success) { return }
            this.TOAST('删除成功', 'success')
            this.refreshList()
          })
          return
  
        default:
          return
      }
    },
  
    // 显示列表中的标题项
    displayListItem(item, field) {
      const fieldItem = this.scheme[field]
      const value = item[field]
  
      switch (fieldItem.type) {
        case 'currentInfo':
        case 'organize':
          return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
  
        case 'radio':
        case 'select':
          const selectItem = this.dataSource[field].find(t => t.value === String(value))
          return get(selectItem, 'text', '')
  
        case 'checkbox':
          if (!value || value.split(',').length <= 0) { return '' }
          const checkboxItems = value.split(',')
          return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
  
        case 'datetime':
          if (!value) { return '' }
          return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm')
  
        default: return value === null || value === undefined ? '' : value
      }
    }
  
  }
}
</script>
  
  
<style lang="less" scoped>
@import '~@/common/css/sidepage.less';
@import '~@/common/css/customlist.less';
</style>

+ 247
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/ContactsDetails/single.vue Wyświetl plik

@@ -0,0 +1,247 @@
<template>
  <view class="page">
    <view v-if="ready">
      <l-input
        @input="setValue('ContactsDetails.Name', $event)"
        :value="getValue('ContactsDetails.Name')"
        :disabled="!edit"
        title="姓名"
      />
      <l-select
        @input="setValue('ContactsDetails.Gender', $event)"
        :value="getValue('ContactsDetails.Gender')"
        :disabled="!edit"
        :range="dataSource.ContactsDetails.Gender"
        title="性别"
      />
      <l-input
        @input="setValue('ContactsDetails.Mobile', $event)"
        :value="getValue('ContactsDetails.Mobile')"
        :disabled="!edit"
        title="联系方式"
      />
      <l-input
        @input="setValue('ContactsDetails.IDCard', $event)"
        :value="getValue('ContactsDetails.IDCard')"
        :disabled="!edit"
        title="身份证"
      />
      <l-select
        @input="setValue('ContactsDetails.QTType', $event)"
        :value="getValue('ContactsDetails.QTType')"
        :disabled="!edit"
        :range="dataSource.ContactsDetails.QTType"
        title="隔离方式"
      />
      <l-input
        @input="setValue('ContactsDetails.QTAddress', $event)"
        :value="getValue('ContactsDetails.QTAddress')"
        :disabled="!edit"
        title="隔离地点"
      />
      <l-date-picker
        @input="setValue('ContactsDetails.QTContactTime', $event)"
        :value="getValue('ContactsDetails.QTContactTime')"
        :disabled="!edit"
        title="隔离时间"
      />
      <l-select
        @input="setValue('ContactsDetails.Fever', $event)"
        :value="getValue('ContactsDetails.Fever')"
        :disabled="!edit"
        :range="dataSource.ContactsDetails.Fever"
        title="是否发热"
      />
    </view>
  
    <view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
      <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
        提交保存
      </l-button>
      <l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
        编辑本页
      </l-button>
      <l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
        取消编辑
      </l-button>
      <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
        删除
      </l-button>
    </view>
  </view>
</template>
  
  
<script>
/*
 * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
 * Copyright (c) 2013-2020 上海力软信息技术有限公司
 * 创建人:超级管理员
 * 日  期:2020-10-21 09:49
 * 描  述:疫情详细信息
 */
  
/**
 * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
 * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
 * { "path": "pages/PersonnelManagement/ContactsDetails/single", "style": { "navigationBarTitleText": "表单详情页" } }
 * 
 * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
 * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
 */
  
import get from 'lodash/get'
import set from 'lodash/set'
import moment from 'moment'
import customPageMixins from '@/common/custompage.js'
  
export default {
  mixins: [customPageMixins],
  
  data() {
    return {
      // 页面相关参数
      id: null,
      mode: null,
      edit: null,
      ready: false,
  
      // 表单数据
      current: {},
      origin: {},
  
      // 表单项数据结构
      scheme: {
        ContactsDetails: {
          Name: { type: 'text', title: '姓名' },
          Gender: { type: 'select', title: '性别', itemCode: 'usersex', dataSource: '0' },
          Mobile: { type: 'text', title: '联系方式' },
          IDCard: { type: 'text', title: '身份证' },
          QTType: { type: 'select', title: '隔离方式', itemCode: 'QuarantineType', dataSource: '0' },
          QTAddress: { type: 'text', title: '隔离地点' },
          QTContactTime: { type: 'datetime', title: '隔离时间', dateformat: '0' },
          Fever: { type: 'select', title: '是否发热', itemCode: 'YesOrNoInt', dataSource: '0' },
        },
  
      },
  
      // 数据源
      dataSource: {
        ContactsDetails: {
          Gender: Object.values(this.GET_GLOBAL('dataDictionary').usersex).map(t => ({ value: t.value, text: t.text })),
          QTType: Object.values(this.GET_GLOBAL('dataDictionary').QuarantineType).map(t => ({ value: t.value, text: t.text })),
          Fever: Object.values(this.GET_GLOBAL('dataDictionary').YesOrNoInt).map(t => ({ value: t.value, text: t.text })),
        },
  
      }
    }
  },
  
  async onLoad({ type, id }) {
    await this.init(type, id)
  },
  
  methods: {
    // 页面初始化
    async init(type, id) {
      this.LOADING('加载数据中...')
  
      this.id = id
      this.mode = type
      this.edit = ['create', 'edit'].includes(this.mode)
  
      // 拉取表单数据,同时拉取所有来自数据源的选单数据
      await Promise.all([
  
  
        () => {}
      ])
      await this.fetchForm()
  
      this.ready = true
      this.HIDE_LOADING()
    },
  
    // 加载表单数据
    async fetchForm() {
      if (this.mode === 'create') {
        this.origin = await this.getDefaultForm()
      } else {
        const result = await this.HTTP_GET('/PersonnelManagement/ContactsDetails/form', this.id)
        this.origin = await this.formatFormData(result)
      }
      this.current = this.COPY(this.origin)
    },
  
    // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
    async action(type) {
      switch (type) {
        case 'edit':
          this.edit = true
          break
  
        case 'reset':
          this.current = this.COPY(this.origin)
          this.edit = false
          break
  
        case 'save':
          const verifyResult = this.verifyForm()
          if (verifyResult.length > 0) {
            this.CONFIRM('表单验证失败', verifyResult.join('\n'))
            return
          }
  
          if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
            return
          }
  
          this.LOADING('正在提交...')
          const postData = await this.getPostData(this.id)
  
          this.HTTP_POST('/PersonnelManagement/ContactsDetails/save', postData, '表单提交保存失败').then(success => {
            this.HIDE_LOADING()
            if (!success) {
              return
            }
  
            this.EMIT('PersonnelManagementContactsDetails-list-change')
            this.NAV_BACK()
            this.TOAST('提交保存成功')
          })
          break
  
        case 'delete':
          if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
            return
          }
  
          this.LOADING('提交删除中...')
          this.HTTP_POST('/PersonnelManagement/ContactsDetails/delete', this.id, '删除失败').then(success => {
            this.HIDE_LOADING()
            if (!success) {
              return
            }
  
            this.EMIT('PersonnelManagementContactsDetails-list-change')
            this.NAV_BACK()
            this.this.TOAST('删除成功', 'success')
          })
          break
  
        default: break
      }
    },
  
    // 获取表单值
    getValue(path) {
      return get(this.current, path)
    },
  
    // 设置表单值
    setValue(path, val) {
      set(this.current, path, val)
    }
  }
}
</script>

Ładowanie…
Anuluj
Zapisz