1. 修改除了管理员外 其他人使用不了 导航版皮肤的 问题 • 小程序增加功能: 1. 借阅信息 2. 校长信箱 3. 社团管理 • 修复框架关于小程序代码生成问题: 修改表单会新建一条数据大厂分支
@@ -43,7 +43,7 @@ | |||
callback(data.rows, parseInt(data.records)); | |||
} | |||
else { | |||
callback([], 0); | |||
callback([], 2); | |||
} | |||
}); | |||
}, | |||
@@ -57,15 +57,15 @@ | |||
_$item.append($('<p class="lr-ellipsis"><span>考核学期:</span></p>').dataFormatter({ value: _item.Semester })); | |||
_$item.append($('<p class="lr-ellipsis"><span>考核评分:</span></p>').dataFormatter({ value: _item.TotalScore })); | |||
_$item.append($('<p class="lr-ellipsis"><span>提交时间:</span></p>').dataFormatter({ value: _item.CreateDate })); | |||
_$item.append($('<p class="lr-ellipsis"><span>是否交卷:</span></p>').dataFormatter({ value: (_item.IsAnswer != undefined && _item.IsAnswer ===true) ? "已交" : "未交" })); | |||
_$item.append($('<p class="lr-ellipsis"><span>是否交卷:</span></p>').dataFormatter({ value: (_item.IsAnswer != undefined && _item.IsAnswer === true) ? "已交" : "未交" })); | |||
return ''; | |||
}, | |||
rowClick: function (item, $item, $page) {// 列表行点击触发方法 | |||
if (item.IsAnswer === true || item.IsAnswer==='true') { | |||
if (item.IsAnswer === true || item.IsAnswer === 'true') { | |||
learun.layer.warning("当前项目已交卷!"); | |||
return; | |||
} | |||
learun.nav.go({ path: 'Ask/AskPaper', title: '开始答卷', type: 'right', param: { VID: item.VID} }); | |||
learun.nav.go({ path: 'Ask/AskPaper', title: '开始答卷', type: 'right', param: { VID: item.VID } }); | |||
}, | |||
btnClick: function (item, $item, $page) {// 左滑按钮点击事件 | |||
if (item.IsAnswer === false || item.IsAnswer === 'false') { | |||
@@ -64,7 +64,7 @@ | |||
if (param.begin && param.end) { | |||
_postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end }); | |||
} | |||
learun.httpget(config.webapi + 'learun/EducationalAdministration/BookBorrow/pagelist', _postParam, (data) => { | |||
learun.httpget(config.webapi + 'learun/adms/EducationalAdministration/BookBorrow/pagelist', _postParam, (data) => { | |||
$page.find('.lr-badge').text('0'); | |||
if (data) { | |||
$page.find('.lr-badge').text(data.records); | |||
@@ -98,7 +98,7 @@ | |||
// learun.layer.confirm('确定要删除该笔数据吗?', function (_index) { | |||
// if (_index === '1') { | |||
// learun.layer.loading(true, '正在删除该笔数据'); | |||
// learun.httppost(config.webapi + 'learun/EducationalAdministration/BookBorrow/delete', item.ID, (data) => { | |||
// learun.httppost(config.webapi + 'learun/adms/EducationalAdministration/BookBorrow/delete', item.ID, (data) => { | |||
// if (data) {// 删除数据成功 | |||
// page.grid.reload(); | |||
// } |
@@ -63,7 +63,7 @@ | |||
if (param.begin && param.end) { | |||
_postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end }); | |||
} | |||
learun.httpget(config.webapi + 'learun/EducationalAdministration/StuMail/pagelistByUserId', _postParam, (data) => { | |||
learun.httpget(config.webapi + 'learun/adms/EducationalAdministration/StuMail/pagelistByUserId', _postParam, (data) => { | |||
$page.find('.lr-badge').text('0'); | |||
if (data) { | |||
$page.find('.lr-badge').text(data.records); | |||
@@ -90,7 +90,7 @@ | |||
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) { | |||
if (_index === '1') { | |||
learun.layer.loading(true, '正在删除该笔数据'); | |||
learun.httppost(config.webapi + 'learun/EducationalAdministration/StuMail/delete', item.Id , (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/EducationalAdministration/StuMail/delete', item.Id , (data) => { | |||
if (data) {// 删除数据成功 | |||
page.grid.reload(); | |||
} | |||
@@ -61,7 +61,7 @@ | |||
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) { | |||
if (_index === '1') { | |||
learun.layer.loading(true, '正在删除该笔数据'); | |||
learun.httppost(config.webapi + 'learun/EducationalAdministration/StuMail/delete', keyValue, (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/EducationalAdministration/StuMail/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/EducationalAdministration/StuMail/save', _postData, (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/EducationalAdministration/StuMail/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/EducationalAdministration/StuMail/form', keyValue, (data) => { | |||
learun.httpget(config.webapi + 'learun/adms/EducationalAdministration/StuMail/form', keyValue, (data) => { | |||
if (data) { | |||
for (var id in data) { | |||
if (data[id].length) { | |||
@@ -67,7 +67,7 @@ | |||
if (param.begin && param.end) { | |||
_postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end }); | |||
} | |||
learun.httpget(config.webapi + 'learun/PersonnelManagement/CommunityInfo/pagelist', _postParam, (data) => { | |||
learun.httpget(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/pagelist', _postParam, (data) => { | |||
$page.find('.lr-badge').text('0'); | |||
if (data) { | |||
$page.find('.lr-badge').text(data.records); | |||
@@ -92,7 +92,7 @@ | |||
// learun.layer.confirm('确定要删除该笔数据吗?', function (_index) { | |||
// if (_index === '1') { | |||
// learun.layer.loading(true, '正在删除该笔数据'); | |||
// learun.httppost(config.webapi + 'learun/PersonnelManagement/CommunityInfo/delete', item.Id, (data) => { | |||
// learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/delete', item.Id, (data) => { | |||
// if (data) {// 删除数据成功 | |||
// page.grid.reload(); | |||
// } | |||
@@ -105,7 +105,7 @@ | |||
learun.layer.confirm('确定要申请加入该社团吗?', function (_index) { | |||
if (_index === '1') { | |||
//learun.layer.loading(true, '正在申请加入该社团'); | |||
learun.httppost(config.webapi + 'learun/PersonnelManagement/CommunityInfo/join', item.Id, (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/join', item.Id, (data) => { | |||
if (data) { | |||
page.grid.reload(); | |||
} | |||
@@ -61,7 +61,7 @@ | |||
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) { | |||
if (_index === '1') { | |||
learun.layer.loading(true, '正在删除该笔数据'); | |||
learun.httppost(config.webapi + 'learun/PersonnelManagement/CommunityInfo/delete', keyValue, (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/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/PersonnelManagement/CommunityInfo/save', _postData, (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/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/PersonnelManagement/CommunityInfo/form', keyValue, (data) => { | |||
learun.httpget(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/form', keyValue, (data) => { | |||
if (data) { | |||
for (var id in data) { | |||
if (data[id].length) { | |||
@@ -20,7 +20,7 @@ namespace Learun.Application.WebApi.Modules | |||
/// 注册接口 | |||
/// <summary> | |||
public BookBorrowApi() | |||
: base("/Learun/EducationalAdministration/BookBorrow") | |||
: base("/Learun/adms/EducationalAdministration/BookBorrow") | |||
{ | |||
Get["/pagelist"] = GetPageList; | |||
} | |||
@@ -22,7 +22,7 @@ namespace Learun.Application.WebApi | |||
/// 注册接口 | |||
/// <summary> | |||
public CommunityInfoApi() | |||
: base("/Learun/PersonnelManagement/CommunityInfo") | |||
: base("/Learun/adms/PersonnelManagement/CommunityInfo") | |||
{ | |||
Get["/pagelist"] = GetPageList; | |||
Get["/list"] = GetList; | |||
@@ -20,7 +20,7 @@ namespace Learun.Application.WebApi.Modules | |||
/// 注册接口 | |||
/// <summary> | |||
public StuMailApi() | |||
: base("/Learun/EducationalAdministration/StuMail") | |||
: base("/Learun/adms/EducationalAdministration/StuMail") | |||
{ | |||
Get["/pagelist"] = GetPageList; | |||
Get["/pagelistByUserId"] = GetPageListByUserId; | |||
@@ -3952,7 +3952,7 @@ namespace Learun.Application.Base.CodeGeneratorModule | |||
add(" </view>"); | |||
add(""); | |||
add(" <view v-if=\"ready\" class=\"bg-white margin-tb padding\" style=\"padding-top: 0; overflow: hidden;\">"); | |||
add(" <view v-if=\"ready\" class=\"bg-white margin-tb padding\" style=\"padding-top: 0; overflow: hidden;\">"); | |||
add(" <l-button v-if=\"edit\" @click=\"action('save')\" size=\"lg\" color=\"green\" class=\"block margin-top\" block>"); | |||
add(" 提交保存"); | |||
add(" </l-button>"); | |||
@@ -4260,7 +4260,7 @@ namespace Learun.Application.Base.CodeGeneratorModule | |||
add(" }"); | |||
add(""); | |||
add(" this.LOADING('正在提交...')"); | |||
add(" const postData = await this.getPostData()"); | |||
add(" const postData = await this.getPostData(this.id)"); | |||
add(""); | |||
add(" this.HTTP_POST('" + apiPath + "/save', postData, '表单提交保存失败').then(success => {"); | |||
add(" this.HIDE_LOADING()"); | |||
@@ -1,5 +1,14 @@ | |||
<template> | |||
<view class="customlist-banner-action"> | |||
<view | |||
v-if="showButton" | |||
@click="$emit('join')" | |||
class="customlist-banner-action-btn line-yellow text-sm" | |||
style="border: currentColor 1px solid" | |||
> | |||
<l-icon :type="icontype" /> | |||
{{ buttonText }} | |||
</view> | |||
<view | |||
v-if="showDelete" | |||
@click="$emit('delete')" | |||
@@ -9,6 +18,7 @@ | |||
<l-icon type="delete" /> | |||
删除 | |||
</view> | |||
<view | |||
v-if="showEdit" | |||
@click="$emit('edit')" | |||
@@ -21,7 +31,7 @@ | |||
<view | |||
@click="$emit('view')" | |||
class="customlist-banner-action-btn line-blue text-sm" | |||
style="border: currentColor 1px solid;min-width: 160rpx;" | |||
style="border: currentColor 1px solid; min-width: 160rpx" | |||
> | |||
查看 | |||
<l-icon type="right" /> | |||
@@ -31,13 +41,16 @@ | |||
<script> | |||
export default { | |||
name: 'l-customlist-banner', | |||
name: "l-customlist-banner", | |||
props: { | |||
showDelete: {}, | |||
showEdit: {} | |||
} | |||
} | |||
showEdit: {}, | |||
showButton: {}, | |||
buttonText: "", | |||
icontype: "", | |||
}, | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@@ -133,8 +133,17 @@ | |||
// 考勤记录 | |||
{ "path": "pages/LogisticsManagement/ADR_Record/list", "style": { "navigationBarTitleText": "考勤里列表" } }, | |||
{ "path": "pages/LogisticsManagement/ADR_Record/single", "style": { "navigationBarTitleText": "考勤详情" } }, | |||
//班级自诊打卡 | |||
{ "path": "pages/EducationalAdministration/Thermography/list", "style": { "navigationBarTitleText": "列表" } }, | |||
{ "path": "pages/EducationalAdministration/Thermography/single", "style": { "navigationBarTitleText": "详情" } } | |||
{ "path": "pages/EducationalAdministration/Thermography/single", "style": { "navigationBarTitleText": "详情" } }, | |||
//借阅信息 | |||
{ "path": "pages/EducationalAdministration/BookBorrow/list", "style": { "navigationBarTitleText": "借阅信息" } }, | |||
//校长信箱 | |||
{ "path": "pages/EducationalAdministration/StuMail/list", "style": { "navigationBarTitleText": "校长信箱" } }, | |||
{ "path": "pages/EducationalAdministration/StuMail/single", "style": { "navigationBarTitleText": "详细" } }, | |||
//社团管理 | |||
{ "path": "pages/PersonnelManagement/CommunityInfo/list", "style": { "navigationBarTitleText": "社团列表" } }, | |||
{ "path": "pages/PersonnelManagement/CommunityInfo/single", "style": { "navigationBarTitleText": "社团详情" } } | |||
], | |||
// 全局样式 | |||
@@ -0,0 +1,304 @@ | |||
<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, 'BorrowTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">还书时间:</text> | |||
{{ displayListItem(item, 'ReturnTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">借书证:</text> | |||
{{ displayListItem(item, 'LibraryCard') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">图书编号:</text> | |||
{{ displayListItem(item, 'BookID') }} | |||
</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.LibraryCard" | |||
@change="searchChange" | |||
title ="借书证" | |||
placeholder="按借书证查询" | |||
/> | |||
<l-input | |||
v-model="queryData.BookID" | |||
@change="searchChange" | |||
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-14 11:43 | |||
* 描 述:1111 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/BookBorrow/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: { | |||
BorrowTime: { type: 'text' }, | |||
ReturnTime: { type: 'text' }, | |||
LibraryCard: { type: 'text' }, | |||
BookID: { type: 'text' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
LibraryCard: '', | |||
BookID: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationBookBorrow-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationBookBorrow-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( | |||
'/EducationalAdministration/BookBorrow/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('/EducationalAdministration/BookBorrow/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> |
@@ -0,0 +1,296 @@ | |||
<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, 'Title') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">内容:</text> | |||
{{ displayListItem(item, 'Content') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">创建时间:</text> | |||
{{ displayListItem(item, 'CreateTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">回复时间:</text> | |||
{{ displayListItem(item, 'ReplyTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">回复内容:</text> | |||
{{ displayListItem(item, 'ReplyContent') }} | |||
</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" | |||
/> | |||
<!-- 重置查询条件按钮 --> | |||
<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-14 12:15 | |||
* 描 述:校长信箱 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuMail/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: { | |||
Title: { type: 'text' }, | |||
Content: { type: 'textarea' }, | |||
CreateTime: { type: 'datetime', dateformat: '0' }, | |||
ReplyTime: { type: 'datetime', dateformat: '0' }, | |||
ReplyContent: { type: 'textarea' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationStuMail-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationStuMail-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( | |||
'/EducationalAdministration/StuMail/pagelistByUserId', | |||
{ | |||
// 这里 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('/EducationalAdministration/StuMail/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> |
@@ -0,0 +1,209 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('StuMail.Title', $event)" | |||
:value="getValue('StuMail.Title')" | |||
:disabled="!edit" | |||
title="主题" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuMail.Content', $event)" | |||
:value="getValue('StuMail.Content')" | |||
:readonly="!edit" | |||
title="内容" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuMail.ReplyContent', $event)" | |||
:value="getValue('StuMail.ReplyContent')" | |||
:readonly="true" | |||
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-14 12:15 | |||
* 描 述:校长信箱 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuMail/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: { | |||
StuMail: { | |||
Title: { type: 'text', title: '主题' }, | |||
Content: { type: 'textarea', title: '内容' }, | |||
CreateTime: { type: 'datetime', title: '创建时间', dateformat: '0' }, | |||
ReplyTime: { type: 'datetime', title: '回复时间', dateformat: '0' }, | |||
ReplyContent: { type: 'textarea', title: '回复内容' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
StuMail: { | |||
}, | |||
} | |||
} | |||
}, | |||
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('/EducationalAdministration/StuMail/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('/EducationalAdministration/StuMail/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuMail-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/EducationalAdministration/StuMail/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuMail-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> |
@@ -217,7 +217,7 @@ export default { | |||
} | |||
this.LOADING('正在提交...') | |||
const postData = await this.getPostData() | |||
const postData = await this.getPostData(this.id) | |||
this.HTTP_POST('/EducationalAdministration/Thermography/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
@@ -0,0 +1,276 @@ | |||
<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, 'CommunityCode') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">社团名称:</text> | |||
{{ displayListItem(item, 'CommunityName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">排序号:</text> | |||
{{ displayListItem(item, 'Sort') }} | |||
</view> | |||
<l-customlist-action showButton icontype='friendaddfill' buttonText='申请加入' @join="action('join',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"> | |||
<!-- 重置查询条件按钮 --> | |||
<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-14 16:08 | |||
* 描 述:社团管理 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/CommunityInfo/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: { | |||
CommunityCode: { type: 'text' }, | |||
CommunityName: { type: 'text' }, | |||
Sort: { type: 'text' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('PersonnelManagementCommunityCode-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('PersonnelManagementCommunityCode-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/CommunityInfo/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 = {} | |||
// 将其他查询项添加到查询 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.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 'join': | |||
if (!(await this.CONFIRM('申请加入', '确定要申请加入该社团吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('/PersonnelManagement/CommunityInfo/join', id, '加入失败').then(success => { | |||
if(!success) { return } | |||
this.TOAST('加入成功', 'success') | |||
this.refreshList() | |||
}) | |||
return | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('/PersonnelManagement/CommunityInfo/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> |
@@ -0,0 +1,206 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('CommunityInfo.CommunityCode', $event)" | |||
:value="getValue('CommunityInfo.CommunityCode')" | |||
:disabled="!edit" | |||
title="社团编号" | |||
/> | |||
<l-input | |||
@input="setValue('CommunityInfo.CommunityName', $event)" | |||
:value="getValue('CommunityInfo.CommunityName')" | |||
:disabled="!edit" | |||
title="社团名称" | |||
/> | |||
<l-input | |||
@input="setValue('CommunityInfo.Sort', $event)" | |||
:value="getValue('CommunityInfo.Sort')" | |||
:disabled="!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-14 16:08 | |||
* 描 述:社团管理 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/CommunityCode/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: { | |||
CommunityInfo: { | |||
CommunityCode: { type: 'text', title: '社团编号' }, | |||
CommunityName: { type: 'text', title: '社团名称' }, | |||
Sort: { type: 'text', title: '排序号' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
CommunityInfo: { | |||
}, | |||
} | |||
} | |||
}, | |||
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/CommunityInfo/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/CommunityInfo/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('PersonnelManagementCommunityCode-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/PersonnelManagement/CommunityInfo/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('PersonnelManagementCommunityCode-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> |