@@ -76,7 +76,7 @@ | |||
learun.layer.confirm('确定要删除该笔数据吗?', function (_index) { | |||
if (_index === '1') { | |||
learun.layer.loading(true, '正在删除该笔数据'); | |||
learun.httppost(config.webapi + 'learun/EducationalAdministration/StuInfoBasic/delete', keyValue, (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/EducationalAdministration/StuInfoBasic/delete', keyValue, (data) => { | |||
learun.layer.loading(false); | |||
if (data) {// 删除数据成功 | |||
learun.nav.closeCurrent(); | |||
@@ -103,7 +103,7 @@ | |||
_postData.keyValue = keyValue; | |||
_postData.strEntity = JSON.stringify($page.find('.lr-form-container').lrformGet()); | |||
learun.layer.loading(true, '正在提交数据'); | |||
learun.httppost(config.webapi + 'learun/EducationalAdministration/StuInfoBasic/save', _postData, (data) => { | |||
learun.httppost(config.webapi + 'learun/adms/EducationalAdministration/StuInfoBasic/save', _postData, (data) => { | |||
learun.layer.loading(false); | |||
if (data) {// 表单数据保存成功 | |||
if (keyValue) { | |||
@@ -131,7 +131,7 @@ | |||
$header.find('.lr-form-header-btnlist').show(); | |||
// 获取表单数据 | |||
learun.layer.loading(true, '获取表单数据'); | |||
learun.httpget(config.webapi + 'learun/EducationalAdministration/StuInfoBasic/form', keyValue, (data) => { | |||
learun.httpget(config.webapi + 'learun/adms/EducationalAdministration/StuInfoBasic/form', keyValue, (data) => { | |||
if (data) { | |||
for (var id in data) { | |||
if (data[id].length) { |
@@ -61,7 +61,7 @@ | |||
if (param.begin && param.end) { | |||
_postParam.queryJson = JSON.stringify({ StartTime: param.begin, EndTime: param.end }); | |||
} | |||
learun.httpget(config.webapi + 'learun/PersonnelManagement/CommunityInfo/communityMemberpagelist', _postParam, (data) => { | |||
learun.httpget(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/communityMemberpagelist', _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/PersonnelManagement/CommunityInfo/delete', item.Id, (data) => { | |||
// learun.httppost(config.webapi + 'learun/adms/PersonnelManagement/CommunityInfo/delete', item.Id, (data) => { | |||
// if (data) {// 删除数据成功 | |||
// page.grid.reload(); | |||
// } | |||
@@ -190,6 +190,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Bootstraper.cs" /> | |||
<Compile Include="Modules\AnnexesApiWx.cs" /> | |||
<Compile Include="Modules\BaseNoLoginApi.cs" /> | |||
<Compile Include="Modules\ArrangeLessonTermAttemperApi.cs" /> | |||
<Compile Include="Modules\DataSourceNoLoginApi.cs" /> | |||
@@ -0,0 +1,142 @@ | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Util; | |||
using Nancy; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
namespace Learun.Application.WebApi.Modules | |||
{ | |||
public class AnnexesApiWx : BaseApi | |||
{ | |||
public AnnexesApiWx() | |||
: base("/learun/adms/annexes") | |||
{ | |||
Get["/wxlist"] = WxGetList; | |||
Get["/wxdown"] = WxDownload; | |||
Get["/wxfileinfo"] = WxFileInfo; | |||
Post["/wxupload"] = WxUpload; | |||
Post["/wxdelete"] = WxDeleteFile; | |||
} | |||
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); | |||
/// <summary> | |||
/// 获取附件列表 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response WxGetList(dynamic _) | |||
{ | |||
var keyValue = this.GetReqData(); | |||
var list = annexesFileIBLL.GetList(keyValue); | |||
return Success(list); | |||
} | |||
/// <summary> | |||
/// 上传附件图片文件 | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response WxUpload(dynamic _) | |||
{ | |||
var files = (List<HttpFile>)this.Context.Request.Files; | |||
var folderId = this.GetReqData(); | |||
string filePath = Config.GetValue("AnnexesFile"); | |||
string uploadDate = DateTime.Now.ToString("yyyyMMdd"); | |||
string fileEextension = Path.GetExtension(files[0].Name); | |||
string fileType = fileEextension.Replace(".", ""); | |||
string fileGuid = Guid.NewGuid().ToString(); | |||
string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, userInfo.userId, uploadDate, fileGuid, fileEextension); | |||
//创建文件夹 | |||
string path = Path.GetDirectoryName(virtualPath); | |||
Directory.CreateDirectory(path); | |||
AnnexesFileEntity fileAnnexesEntity = new AnnexesFileEntity(); | |||
if (!System.IO.File.Exists(virtualPath)) | |||
{ | |||
byte[] bytes = new byte[files[0].Value.Length]; | |||
files[0].Value.Read(bytes, 0, bytes.Length); | |||
FileInfo file = new FileInfo(virtualPath); | |||
FileStream fs = file.Create(); | |||
fs.Write(bytes, 0, bytes.Length); | |||
fs.Close(); | |||
//文件信息写入数据库 | |||
fileAnnexesEntity.F_Id = fileGuid; | |||
fileAnnexesEntity.F_FileName = files[0].Name; | |||
fileAnnexesEntity.F_FilePath = virtualPath; | |||
fileAnnexesEntity.F_FileSize = files[0].Value.Length.ToString(); | |||
fileAnnexesEntity.F_FileExtensions = fileEextension; | |||
fileAnnexesEntity.F_FileType = fileType; | |||
fileAnnexesEntity.F_CreateUserId = userInfo.userId; | |||
fileAnnexesEntity.F_CreateUserName = userInfo.realName; | |||
annexesFileIBLL.SaveEntity(folderId, fileAnnexesEntity); | |||
} | |||
return SuccessString(fileGuid); | |||
} | |||
/// <summary> | |||
/// 获取文件信息 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response WxFileInfo(dynamic _) | |||
{ | |||
var fileId = this.GetReqData(); | |||
var fileEntity = annexesFileIBLL.GetEntity(fileId); | |||
return Success(fileEntity); | |||
} | |||
/// <summary> | |||
/// 删除文件 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response WxDeleteFile(dynamic _) | |||
{ | |||
var fileId = this.GetReqData(); | |||
AnnexesFileEntity fileInfoEntity = annexesFileIBLL.GetEntity(fileId); | |||
annexesFileIBLL.DeleteEntity(fileId); | |||
//删除文件 | |||
if (System.IO.File.Exists(fileInfoEntity.F_FilePath)) | |||
{ | |||
System.IO.File.Delete(fileInfoEntity.F_FilePath); | |||
} | |||
return Success("删除成功"); | |||
} | |||
/// <summary> | |||
/// 下载文件,微信小程序用 | |||
/// | |||
/// 微信小程序可以预览图片、文档 | |||
/// 支持的图片格式:.jpg .png .webp .gif | |||
/// 支持的文档格式:.doc(x) .xls(x) .ppt(x) .pdf | |||
/// | |||
/// 对于其他格式的文件,微信小程序官方未提供打开或预览的 API,文件对用户来说不可访问 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response WxDownload(dynamic _) | |||
{ | |||
string name = this.GetReqData(); | |||
string fileId = name.Split('.')[0]; | |||
var fileEntity = annexesFileIBLL.GetEntity(fileId); | |||
string filepath = fileEntity.F_FilePath; | |||
if (!FileDownHelper.FileExists(filepath)) | |||
{ | |||
return 404; | |||
} | |||
FileDownHelper.DownLoadWx(filepath, fileEntity.F_FileType); | |||
return Success(""); | |||
} | |||
} | |||
} |
@@ -19,7 +19,7 @@ namespace Learun.Application.WebApi | |||
/// 注册接口 | |||
/// <summary> | |||
public StuConsumptionApi() | |||
: base("/Learun/EducationalAdministration/StuConsumption") | |||
: base("/Learun/adms/EducationalAdministration/StuConsumption") | |||
{ | |||
Get["/pagelist"] = GetPageList; | |||
Get["/list"] = GetList; | |||
@@ -25,7 +25,7 @@ namespace Learun.Application.WebApi | |||
/// 注册接口 | |||
/// <summary> | |||
public JournalApi() | |||
: base("/Learun/EducationalAdministration/Journal") | |||
: base("/Learun/adms/EducationalAdministration/Journal") | |||
{ | |||
Get["/pagelist"] = GetPageList; | |||
Get["/list"] = GetList; | |||
@@ -36,7 +36,7 @@ namespace Learun.Application.WebApi | |||
/// 注册接口 | |||
/// <summary> | |||
public StuInfoBasicApi() | |||
: base("/Learun/EducationalAdministration/StuInfoBasic") | |||
: base("/Learun/adms/EducationalAdministration/StuInfoBasic") | |||
{ | |||
Get["/pagelist"] = GetPageList; | |||
Get["/form"] = GetForm; | |||
@@ -315,5 +315,69 @@ namespace Learun.Util | |||
} | |||
return true; | |||
} | |||
/// <summary> | |||
/// 小程序下载文件,对图片采取内联形式 | |||
/// </summary> | |||
/// <param name="filePath">物理地址</param> | |||
/// <param name="fileExt">文件扩展名</param> | |||
public static void DownLoadWx(string filePath, string fileExt = null) | |||
{ | |||
long chunkSize = 204800; //指定块大小 | |||
byte[] buffer = new byte[chunkSize]; //建立一个200K的缓冲区 | |||
long dataToRead = 0; //已读的字节数 | |||
FileStream stream = null; | |||
try | |||
{ | |||
//打开文件 | |||
stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); | |||
dataToRead = stream.Length; | |||
switch (fileExt?.ToLower()) | |||
{ | |||
case "jpg": | |||
case "jpeg": | |||
case "bmp": | |||
case "gif": | |||
case "png": | |||
case "webp": | |||
HttpContext.Current.Response.ContentType = "application/" + fileExt.ToLower(); | |||
break; | |||
default: | |||
HttpContext.Current.Response.ContentType = "application/octet-stream"; | |||
break; | |||
} | |||
//添加Http头 | |||
HttpContext.Current.Response.AddHeader("Content-Length", dataToRead.ToString()); | |||
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachement;filename=" + HttpUtility.UrlEncode(Path.GetFileName(filePath))); | |||
while (dataToRead > 0) | |||
{ | |||
if (HttpContext.Current.Response.IsClientConnected) | |||
{ | |||
int length = stream.Read(buffer, 0, Convert.ToInt32(chunkSize)); | |||
HttpContext.Current.Response.OutputStream.Write(buffer, 0, length); | |||
HttpContext.Current.Response.Flush(); | |||
HttpContext.Current.Response.Clear(); | |||
dataToRead -= length; | |||
} | |||
else | |||
{ | |||
dataToRead = -1; //防止client失去连接 | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
HttpContext.Current.Response.Write("Error:" + ex.Message); | |||
} | |||
finally | |||
{ | |||
if (stream != null) stream.Close(); | |||
HttpContext.Current.Response.Close(); | |||
} | |||
} | |||
} | |||
} |
@@ -192,16 +192,18 @@ export default { | |||
case 'upload': | |||
const uploadUid = [] | |||
for (const { path, uid } of val) { | |||
if (uid) { | |||
uploadUid.push(uid) | |||
for (const entity of val) { | |||
if (entity.uid) { | |||
uploadUid.push(entity.uid) | |||
continue | |||
} | |||
} else { | |||
const fileId = await this.HTTP_UPLOAD(path) | |||
if (fileId) { | |||
uploadUid.push(fileId) | |||
const fileId = await this.HTTP_UPLOAD(entity) | |||
if (fileId) { | |||
uploadUid.push(fileId) | |||
} | |||
} | |||
} | |||
return uploadUid.join(',') | |||
@@ -275,8 +277,8 @@ export default { | |||
if (!val) { return '' } | |||
return moment(val).format( | |||
Number(scheme.dateformat) === 0 || scheme.datetime === 'date' ? | |||
'YYYY-MM-DD' : | |||
'YYYY-MM-DD HH:mm:ss' | |||
'YYYY-MM-DD' : | |||
'YYYY-MM-DD HH:mm:ss' | |||
) | |||
default: | |||
@@ -318,28 +318,28 @@ export default { | |||
} | |||
// #ifdef MP-DINGTALK | |||
return new Promise((res, rej) => { | |||
dd.uploadFile({ | |||
url: uploadUrl, | |||
filePath, | |||
fileName: 'file', | |||
fileType: 'image', | |||
formData: query, | |||
success: dt => { | |||
dt.data = JSON.parse(dt.data) | |||
res([null, dt]) | |||
}, | |||
fail: rs => { | |||
rej([rs, null]) | |||
} | |||
}) | |||
}) | |||
// return new Promise((res, rej) => { | |||
// dd.uploadFile({ | |||
// url: uploadUrl, | |||
// filePath, | |||
// fileName: 'file', | |||
// fileType: 'image', | |||
// formData: query, | |||
// success: dt => { | |||
// dt.data = JSON.parse(dt.data) | |||
// res([null, dt]) | |||
// }, | |||
// fail: rs => { | |||
// rej([rs, null]) | |||
// } | |||
// }) | |||
// }) | |||
// #endif | |||
// #ifndef MP-DINGTALK | |||
return uni.uploadFile({ | |||
url: uploadUrl, | |||
filePath, | |||
filePath:filePath, | |||
name: 'file', | |||
fileType: 'image', | |||
formData: query | |||
@@ -13,7 +13,7 @@ | |||
<image | |||
v-if="isImgFile(file.type)" | |||
@click="fileClick(index)" | |||
:src="file.path" | |||
:src="file.path?file.path:file" | |||
:webp="file.type === 'webp'" | |||
mode="aspectFill" | |||
></image> | |||
@@ -54,7 +54,8 @@ export default { | |||
isImgFile(type) { | |||
const typeString = (type || '').toLowerCase() | |||
return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'image'].includes(typeString) | |||
//return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'image'].includes(typeString) | |||
return true; | |||
}, | |||
isDocFile(type) { | |||
@@ -72,19 +73,19 @@ export default { | |||
chooseFile() { | |||
// #ifdef MP-DINGTALK | |||
dd.chooseImage({ | |||
count: Number(this.number), | |||
success: ({ filePaths }) => { | |||
if (filePaths) { | |||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | |||
filePaths.map(t => ({ path: t, type: this.getFileExt(t) })) | |||
) | |||
this.$emit('input', newList) | |||
this.$emit('change', newList) | |||
this.$emit('add') | |||
} | |||
} | |||
}) | |||
// dd.chooseImage({ | |||
// count: Number(this.number), | |||
// success: ({ filePaths }) => { | |||
// if (filePaths) { | |||
// const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | |||
// filePaths.map(t => ({ path: t, type: this.getFileExt(t) })) | |||
// ) | |||
// this.$emit('input', newList) | |||
// this.$emit('change', newList) | |||
// this.$emit('add') | |||
// } | |||
// } | |||
// }) | |||
// #endif | |||
// #ifndef MP-DINGTALK | |||
@@ -94,7 +95,7 @@ export default { | |||
sourceType: ['album', 'camera'], | |||
success: ({ tempFilePaths }) => { | |||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | |||
tempFilePaths.map(t => ({ path: t, type: this.getFileExt(t) })) | |||
tempFilePaths//.map(t => ({ path: t, type: this.getFileExt(t) })) | |||
) | |||
this.$emit('input', newList) | |||
this.$emit('change', newList) | |||
@@ -1,14 +1,31 @@ | |||
<template> | |||
<view :class="className" :style="style" class="cu-form-group"> | |||
<view class="grid col-4 grid-square flex-sub"> | |||
<view v-for="(path, index) in value" @tap="viewImg" :key="index" class="bg-img"> | |||
<view | |||
v-for="(path, index) in value" | |||
@tap="viewImg" | |||
:key="index" | |||
class="bg-img" | |||
> | |||
<image :src="path" mode="aspectFill"></image> | |||
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red" style="height: 24px; width: 24px;"> | |||
<l-icon type="close" style="width: 18px;height: 24px;font-size: 24px;" /> | |||
<view | |||
v-if="!readonly" | |||
@tap.stop="delImg(index)" | |||
class="cu-tag bg-red" | |||
style="height: 24px; width: 24px" | |||
> | |||
<l-icon | |||
type="close" | |||
style="width: 18px; height: 24px; font-size: 24px" | |||
/> | |||
</view> | |||
</view> | |||
<view v-if="!readonly && value.length < Number(number)" @tap="chooseImg" class="solids"> | |||
<view | |||
v-if="!readonly && value.length < Number(number)" | |||
@tap="chooseImg" | |||
class="solids" | |||
> | |||
<l-icon type="cameraadd" /> | |||
</view> | |||
</view> | |||
@@ -17,43 +34,45 @@ | |||
<script> | |||
export default { | |||
name: 'l-upload', | |||
name: "l-upload", | |||
props: { | |||
number: { default: 1 }, | |||
readonly: {}, | |||
value: { default: () => [] } | |||
value: { default: () => [] }, | |||
}, | |||
methods: { | |||
delImg(index) { | |||
const newList = JSON.parse(JSON.stringify(this.value)) | |||
newList.splice(index, 1) | |||
this.$emit('input', newList) | |||
this.$emit('change') | |||
this.$emit('del') | |||
const newList = JSON.parse(JSON.stringify(this.value)); | |||
newList.splice(index, 1); | |||
this.$emit("input", newList); | |||
this.$emit("change"); | |||
this.$emit("del"); | |||
}, | |||
chooseImg() { | |||
uni.chooseImage({ | |||
count: Number(this.number), | |||
sizeType: ['original', 'compressed'], | |||
sourceType: ['album', 'camera'], | |||
sizeType: ["original", "compressed"], | |||
sourceType: ["album", "camera"], | |||
success: ({ tempFilePaths }) => { | |||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat(tempFilePaths) | |||
this.$emit('input', newList) | |||
this.$emit('change') | |||
this.$emit('add') | |||
} | |||
}) | |||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | |||
tempFilePaths | |||
); | |||
this.$emit("input", newList); | |||
this.$emit("change"); | |||
this.$emit("add"); | |||
}, | |||
}); | |||
}, | |||
viewImg(index) { | |||
uni.previewImage({ | |||
urls: this.value, | |||
current: this.value[index] | |||
}) | |||
} | |||
} | |||
} | |||
current: this.value[index], | |||
}); | |||
}, | |||
}, | |||
}; | |||
</script> |
@@ -1,14 +1,30 @@ | |||
<template> | |||
<view class="cu-form-group"> | |||
<view class="grid col-4 grid-square flex-sub"> | |||
<view v-for="(path, index) in value" @tap="viewImg" :key="index" class="bg-img"> | |||
<image :src="path" mode="aspectFill"></image> | |||
<view | |||
v-for="(path, index) in value" | |||
@tap="viewImg" | |||
:key="index" | |||
class="bg-img" | |||
> | |||
<image | |||
v-if="showfile()" | |||
:src="path.path ? path.path : path" | |||
mode="aspectFill" | |||
></image> | |||
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red"> | |||
<l-icon type="close" style="width: 18px;height: 24px;font-size: 24px;" /> | |||
<l-icon | |||
type="close" | |||
style="width: 18px; height: 24px; font-size: 24px" | |||
/> | |||
</view> | |||
</view> | |||
<view v-if="!readonly && value.length < Number(number)" @tap="chooseImg" class="solids"> | |||
<view | |||
v-if="!readonly && value.length < Number(number)" | |||
@tap="chooseImg" | |||
class="solids" | |||
> | |||
<l-icon type="cameraadd" /> | |||
</view> | |||
</view> | |||
@@ -17,43 +33,51 @@ | |||
<script> | |||
export default { | |||
name: 'l-upload', | |||
name: "l-upload", | |||
props: { | |||
number: { default: 1 }, | |||
readonly: {}, | |||
value: { default: () => [] } | |||
value: { default: () => [] }, | |||
}, | |||
methods: { | |||
delImg(index) { | |||
const newList = JSON.parse(JSON.stringify(this.value)) | |||
newList.splice(index, 1) | |||
this.$emit('input', newList) | |||
this.$emit('change') | |||
this.$emit('del') | |||
const newList = JSON.parse(JSON.stringify(this.value)); | |||
newList.splice(index, 1); | |||
this.$emit("input", newList); | |||
this.$emit("change"); | |||
this.$emit("del"); | |||
}, | |||
showfile() { | |||
console.log(this.value); | |||
return true; | |||
}, | |||
chooseImg() { | |||
uni.chooseImage({ | |||
count: Number(this.number), | |||
sizeType: ['original', 'compressed'], | |||
sourceType: ['album', 'camera'], | |||
sizeType: ["original", "compressed"], | |||
sourceType: ["album", "camera"], | |||
success: ({ tempFilePaths }) => { | |||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat(tempFilePaths) | |||
this.$emit('input', newList) | |||
this.$emit('change') | |||
this.$emit('add') | |||
} | |||
}) | |||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | |||
tempFilePaths | |||
); | |||
//this.$parent.HTTP_UPLOAD(tempFilePaths[0]); | |||
this.$emit("input", newList); | |||
this.$emit("change"); | |||
this.$emit("add"); | |||
}, | |||
}); | |||
}, | |||
viewImg(index) { | |||
uni.previewImage({ | |||
urls: this.value, | |||
current: this.value[index] | |||
}) | |||
} | |||
} | |||
} | |||
current: this.value[index], | |||
}); | |||
}, | |||
}, | |||
}; | |||
</script> |
@@ -143,7 +143,17 @@ | |||
{ "path": "pages/EducationalAdministration/StuMail/single", "style": { "navigationBarTitleText": "详细" } }, | |||
//社团管理 | |||
{ "path": "pages/PersonnelManagement/CommunityInfo/list", "style": { "navigationBarTitleText": "社团列表" } }, | |||
{ "path": "pages/PersonnelManagement/CommunityInfo/single", "style": { "navigationBarTitleText": "社团详情" } } | |||
{ "path": "pages/PersonnelManagement/CommunityInfo/single", "style": { "navigationBarTitleText": "社团详情" } }, | |||
{ "path": "pages/PersonnelManagement/CommunityMember/list", "style": { "navigationBarTitleText": "我的社团" } }, | |||
//个人信息 | |||
{ "path": "pages/EducationalAdministration/StuInfoBasic/list", "style": { "navigationBarTitleText": "个人信息" } }, | |||
//学生消费记录 | |||
{ "path": "pages/EducationalAdministration/StuConsumption/list", "style": { "navigationBarTitleText": "个人信息" } }, | |||
{ "path": "pages/EducationalAdministration/StuConsumption/single", "style": { "navigationBarTitleText": "个人信息" } }, | |||
//工作日志 | |||
{ "path": "pages/EducationalAdministration/JournalSend/list", "style": { "navigationBarTitleText": "个人信息" } }, | |||
{ "path": "pages/EducationalAdministration/JournalSend/single", "style": { "navigationBarTitleText": "个人信息" } } | |||
], | |||
// 全局样式 | |||
@@ -0,0 +1,273 @@ | |||
<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.JournalSendId"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">日志主题:</text> | |||
{{ displayListItem(item, 'JTitle') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">日志类型:</text> | |||
{{ displayListItem(item, 'JTypeId') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">接收人:</text> | |||
{{ displayListItem(item, 'JReceiveId') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">日志内容:</text> | |||
{{ displayListItem(item, 'JContent') }} | |||
</view> | |||
<l-customlist-action showEdit @edit="action('edit', item.JournalSendId)" showDelete @delete="action('delete', item.JournalSendId)" @view="action('view', item.JournalSendId)" /> | |||
</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-16 15:39 | |||
* 描 述:工作日志 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/JournalSend/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: { | |||
JTitle: { type: 'text' }, | |||
JTypeId: { type: 'select', dataSource: '0' }, | |||
JReceiveId: { type: 'organize', dataType: 'user' }, | |||
JContent: { type: 'textarea' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
JTypeId: [], | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationJournalSend-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationJournalSend-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/JournalSend/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'JournalSendId', 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 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('/EducationalAdministration/JournalSend/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,216 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('JournalSend.JTitle', $event)" | |||
:value="getValue('JournalSend.JTitle')" | |||
:disabled="!edit" | |||
title="日志主题" | |||
/> | |||
<l-select | |||
@input="setValue('JournalSend.JTypeId', $event)" | |||
:value="getValue('JournalSend.JTypeId')" | |||
:disabled="!edit" | |||
:range="dataSource.JournalSend.JTypeId" | |||
title="日志类型" | |||
/> | |||
<l-organize-picker | |||
@input="setValue('JournalSend.JReceiveId', $event)" | |||
:value="getValue('JournalSend.JReceiveId')" | |||
:readonly="!edit" | |||
type="user" | |||
title="接收人" | |||
/> | |||
<l-textarea | |||
@input="setValue('JournalSend.JContent', $event)" | |||
:value="getValue('JournalSend.JContent')" | |||
: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-16 15:39 | |||
* 描 述:工作日志 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/JournalSend/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: { | |||
JournalSend: { | |||
JTitle: { type: 'text', title: '日志主题' }, | |||
JTypeId: { type: 'select', title: '日志类型', dataSource: '0' }, | |||
JReceiveId: { type: 'organize', title: '接收人', dataType: 'user' }, | |||
JContent: { type: 'textarea', title: '日志内容' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
JournalSend: { | |||
JTypeId: [], | |||
}, | |||
} | |||
} | |||
}, | |||
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/JournalSend/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/JournalSend/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationJournalSend-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/EducationalAdministration/JournalSend/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationJournalSend-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> |
@@ -0,0 +1,381 @@ | |||
<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.SID"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">记录序号:</text> | |||
{{ displayListItem(item, 'ID') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">企业代码:</text> | |||
{{ displayListItem(item, 'ECODE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">钱包类型:</text> | |||
{{ displayListItem(item, 'NOTECASE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">一卡通账号:</text> | |||
{{ displayListItem(item, 'CUSTOMERID') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学工号:</text> | |||
{{ displayListItem(item, 'OUTID') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">持卡序号:</text> | |||
{{ displayListItem(item, 'CARDSN') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">消费卡操作计数:</text> | |||
{{ displayListItem(item, 'OPCOUNT') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">操作时间:</text> | |||
{{ displayListItem(item, 'OPDT') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">余额:</text> | |||
{{ displayListItem(item, 'ODDFARE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">操作额:</text> | |||
{{ displayListItem(item, 'OPFARE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">管理费:</text> | |||
{{ displayListItem(item, 'MNGFARE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">科目代码:</text> | |||
{{ displayListItem(item, 'ACCCODE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">科目描述:</text> | |||
{{ displayListItem(item, 'DSCRP') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">终端编号:</text> | |||
{{ displayListItem(item, 'TERMID') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">终端记录流水号:</text> | |||
{{ displayListItem(item, 'RECNO') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">上传时间:</text> | |||
{{ displayListItem(item, 'UPLOADDATE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">SAM卡号:</text> | |||
{{ displayListItem(item, 'SAMCARDNO') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">SAM卡交易流水号:</text> | |||
{{ displayListItem(item, 'SAMTRADENO') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">交易卡类型:</text> | |||
{{ displayListItem(item, 'TRADECARDTYPE') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">验证码:</text> | |||
{{ displayListItem(item, 'TAC') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">卡应用序列号:</text> | |||
{{ displayListItem(item, 'ASN') }} | |||
</view> | |||
<l-customlist-action showEdit @edit="action('edit', item.SID)" showDelete @delete="action('delete', item.SID)" @view="action('view', item.SID)" /> | |||
</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-input | |||
v-model="queryData.OUTID" | |||
@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-16 15:16 | |||
* 描 述:学生消费信息 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuConsumption/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: { | |||
ID: { type: 'text' }, | |||
ECODE: { type: 'text' }, | |||
NOTECASE: { type: 'text' }, | |||
CUSTOMERID: { type: 'text' }, | |||
OUTID: { type: 'text' }, | |||
CARDSN: { type: 'text' }, | |||
OPCOUNT: { type: 'text' }, | |||
OPDT: { type: 'datetime', dateformat: '0' }, | |||
ODDFARE: { type: 'text' }, | |||
OPFARE: { type: 'text' }, | |||
MNGFARE: { type: 'text' }, | |||
ACCCODE: { type: 'text' }, | |||
DSCRP: { type: 'text' }, | |||
TERMID: { type: 'text' }, | |||
RECNO: { type: 'text' }, | |||
UPLOADDATE: { type: 'text' }, | |||
SAMCARDNO: { type: 'text' }, | |||
SAMTRADENO: { type: 'text' }, | |||
TRADECARDTYPE: { type: 'text' }, | |||
TAC: { type: 'text' }, | |||
ASN: { type: 'text' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
OUTID: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationStuConsumption-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationStuConsumption-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/StuConsumption/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'SID', 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 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('/EducationalAdministration/StuConsumption/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,332 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('StuConsumption.ID', $event)" | |||
:value="getValue('StuConsumption.ID')" | |||
:disabled="!edit" | |||
title="记录序号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.ECODE', $event)" | |||
:value="getValue('StuConsumption.ECODE')" | |||
:disabled="!edit" | |||
title="企业代码" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.NOTECASE', $event)" | |||
:value="getValue('StuConsumption.NOTECASE')" | |||
:disabled="!edit" | |||
title="钱包类型" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.CUSTOMERID', $event)" | |||
:value="getValue('StuConsumption.CUSTOMERID')" | |||
:disabled="!edit" | |||
title="一卡通账号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.OUTID', $event)" | |||
:value="getValue('StuConsumption.OUTID')" | |||
:disabled="!edit" | |||
title="学工号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.CARDSN', $event)" | |||
:value="getValue('StuConsumption.CARDSN')" | |||
:disabled="!edit" | |||
title="持卡序号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.OPCOUNT', $event)" | |||
:value="getValue('StuConsumption.OPCOUNT')" | |||
:disabled="!edit" | |||
title="消费卡操作计数" | |||
/> | |||
<l-date-picker | |||
@input="setValue('StuConsumption.OPDT', $event)" | |||
:value="getValue('StuConsumption.OPDT')" | |||
:disabled="!edit" | |||
title="操作时间" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.ODDFARE', $event)" | |||
:value="getValue('StuConsumption.ODDFARE')" | |||
:disabled="!edit" | |||
title="余额" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.OPFARE', $event)" | |||
:value="getValue('StuConsumption.OPFARE')" | |||
:disabled="!edit" | |||
title="操作额" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.MNGFARE', $event)" | |||
:value="getValue('StuConsumption.MNGFARE')" | |||
:disabled="!edit" | |||
title="管理费" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.ACCCODE', $event)" | |||
:value="getValue('StuConsumption.ACCCODE')" | |||
:disabled="!edit" | |||
title="科目代码" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.DSCRP', $event)" | |||
:value="getValue('StuConsumption.DSCRP')" | |||
:disabled="!edit" | |||
title="科目描述" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.TERMID', $event)" | |||
:value="getValue('StuConsumption.TERMID')" | |||
:disabled="!edit" | |||
title="终端编号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.RECNO', $event)" | |||
:value="getValue('StuConsumption.RECNO')" | |||
:disabled="!edit" | |||
title="终端记录流水号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.UPLOADDATE', $event)" | |||
:value="getValue('StuConsumption.UPLOADDATE')" | |||
:disabled="!edit" | |||
title="上传时间" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.SAMCARDNO', $event)" | |||
:value="getValue('StuConsumption.SAMCARDNO')" | |||
:disabled="!edit" | |||
title="SAM卡号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.SAMTRADENO', $event)" | |||
:value="getValue('StuConsumption.SAMTRADENO')" | |||
:disabled="!edit" | |||
title="SAM卡交易流水号" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.TRADECARDTYPE', $event)" | |||
:value="getValue('StuConsumption.TRADECARDTYPE')" | |||
:disabled="!edit" | |||
title="交易卡类型" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.TAC', $event)" | |||
:value="getValue('StuConsumption.TAC')" | |||
:disabled="!edit" | |||
title="验证码" | |||
/> | |||
<l-input | |||
@input="setValue('StuConsumption.ASN', $event)" | |||
:value="getValue('StuConsumption.ASN')" | |||
: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-16 15:16 | |||
* 描 述:学生消费信息 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuConsumption/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: { | |||
StuConsumption: { | |||
ID: { type: 'text', title: '记录序号' }, | |||
ECODE: { type: 'text', title: '企业代码' }, | |||
NOTECASE: { type: 'text', title: '钱包类型' }, | |||
CUSTOMERID: { type: 'text', title: '一卡通账号' }, | |||
OUTID: { type: 'text', title: '学工号' }, | |||
CARDSN: { type: 'text', title: '持卡序号' }, | |||
OPCOUNT: { type: 'text', title: '消费卡操作计数' }, | |||
OPDT: { type: 'datetime', title: '操作时间', dateformat: '0' }, | |||
ODDFARE: { type: 'text', title: '余额' }, | |||
OPFARE: { type: 'text', title: '操作额' }, | |||
MNGFARE: { type: 'text', title: '管理费' }, | |||
ACCCODE: { type: 'text', title: '科目代码' }, | |||
DSCRP: { type: 'text', title: '科目描述' }, | |||
TERMID: { type: 'text', title: '终端编号' }, | |||
RECNO: { type: 'text', title: '终端记录流水号' }, | |||
UPLOADDATE: { type: 'text', title: '上传时间' }, | |||
SAMCARDNO: { type: 'text', title: 'SAM卡号' }, | |||
SAMTRADENO: { type: 'text', title: 'SAM卡交易流水号' }, | |||
TRADECARDTYPE: { type: 'text', title: '交易卡类型' }, | |||
TAC: { type: 'text', title: '验证码' }, | |||
ASN: { type: 'text', title: '卡应用序列号' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
StuConsumption: { | |||
}, | |||
} | |||
} | |||
}, | |||
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/StuConsumption/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/StuConsumption/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuConsumption-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/EducationalAdministration/StuConsumption/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuConsumption-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> |
@@ -0,0 +1,367 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-date-picker | |||
@input="setValue('StuInfoBasic.Birthday', $event)" | |||
:value="getValue('StuInfoBasic.Birthday')" | |||
:disabled="!edit" | |||
title="出生日期" | |||
/> | |||
<l-select | |||
@input="setValue('StuInfoBasic.PartyFaceNo', $event)" | |||
:value="getValue('StuInfoBasic.PartyFaceNo')" | |||
:disabled="!edit" | |||
:range="dataSource.StuInfoBasic.PartyFaceNo" | |||
title="政治面貌" | |||
/> | |||
<l-select | |||
@input="setValue('StuInfoBasic.NationalityNo', $event)" | |||
:value="getValue('StuInfoBasic.NationalityNo')" | |||
:disabled="!edit" | |||
:range="dataSource.StuInfoBasic.NationalityNo" | |||
title="民族" | |||
/> | |||
<l-select | |||
@input="setValue('StuInfoBasic.ResidenceNo', $event)" | |||
:value="getValue('StuInfoBasic.ResidenceNo')" | |||
:disabled="!edit" | |||
:range="dataSource.StuInfoBasic.ResidenceNo" | |||
title="户口分类" | |||
/> | |||
<l-upload-file | |||
@input="setValue('StuInfoBasic.Photo', $event)" | |||
:value="getValue('StuInfoBasic.Photo')" | |||
:readonly="!edit" | |||
:number="3" | |||
title="照片" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.mobile', $event)" | |||
:value="getValue('StuInfoBasic.mobile')" | |||
:disabled="!edit" | |||
title="联系电话" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.EMail', $event)" | |||
:value="getValue('StuInfoBasic.EMail')" | |||
:disabled="!edit" | |||
title="邮箱" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.MailAddress', $event)" | |||
:value="getValue('StuInfoBasic.MailAddress')" | |||
:disabled="!edit" | |||
title="通信地址" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.PostalCode', $event)" | |||
:value="getValue('StuInfoBasic.PostalCode')" | |||
:disabled="!edit" | |||
title="邮政编码" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.FatherUnit', $event)" | |||
:value="getValue('StuInfoBasic.FatherUnit')" | |||
:disabled="!edit" | |||
title="户口所在地" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.MatherUnit', $event)" | |||
:value="getValue('StuInfoBasic.MatherUnit')" | |||
:disabled="!edit" | |||
title="档案所在地" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.FatherName', $event)" | |||
:value="getValue('StuInfoBasic.FatherName')" | |||
:disabled="!edit" | |||
title="父亲名字" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.FatherPhone', $event)" | |||
:value="getValue('StuInfoBasic.FatherPhone')" | |||
:disabled="!edit" | |||
title="父亲电话" | |||
required | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.MatherName', $event)" | |||
:value="getValue('StuInfoBasic.MatherName')" | |||
:disabled="!edit" | |||
title="母亲名字" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.MatherPhone', $event)" | |||
:value="getValue('StuInfoBasic.MatherPhone')" | |||
:disabled="!edit" | |||
title="母亲电话" | |||
/> | |||
<l-select | |||
@input="setValue('StuInfoBasic.FamilyOriginNo', $event)" | |||
:value="getValue('StuInfoBasic.FamilyOriginNo')" | |||
:disabled="!edit" | |||
:range="dataSource.StuInfoBasic.FamilyOriginNo" | |||
title="家庭出生" | |||
/> | |||
<l-select | |||
@input="setValue('StuInfoBasic.OverseasChineseNo', $event)" | |||
:value="getValue('StuInfoBasic.OverseasChineseNo')" | |||
:disabled="!edit" | |||
:range="dataSource.StuInfoBasic.OverseasChineseNo" | |||
title="港澳台侨" | |||
/> | |||
<l-select | |||
@input="setValue('StuInfoBasic.GraduateNo', $event)" | |||
:value="getValue('StuInfoBasic.GraduateNo')" | |||
:disabled="!edit" | |||
:range="dataSource.StuInfoBasic.GraduateNo" | |||
title="本专科" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.InSchoolAddress', $event)" | |||
:value="getValue('StuInfoBasic.InSchoolAddress')" | |||
:disabled="!edit" | |||
title="校内地址" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.InSchoolTelephone', $event)" | |||
:value="getValue('StuInfoBasic.InSchoolTelephone')" | |||
:disabled="!edit" | |||
title="校内电话" | |||
/> | |||
<l-input | |||
@input="setValue('StuInfoBasic.QQ', $event)" | |||
:value="getValue('StuInfoBasic.QQ')" | |||
:disabled="!edit" | |||
title="QQ" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuInfoBasic.GoodAt', $event)" | |||
:value="getValue('StuInfoBasic.GoodAt')" | |||
: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-15 10:16 | |||
* 描 述:个人信息 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuInfoBasic/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: { | |||
StuInfoBasic: { | |||
Birthday: { type: 'text', title: '出生日期', dateformat: '0' }, | |||
PartyFaceNo: { type: 'select', title: '政治面貌', dataSource: '1', dataSourceId: 'BCdPartyFace,partyface,partyfaceno' }, | |||
NationalityNo: { type: 'select', title: '民族', itemCode: 'National', dataSource: '0' }, | |||
ResidenceNo: { type: 'select', title: '户口分类', itemCode: 'ResidenceNo', dataSource: '0' }, | |||
Photo: { type: 'upload', title: '照片' }, | |||
mobile: { type: 'text', title: '联系电话' }, | |||
EMail: { type: 'text', title: '邮箱' }, | |||
MailAddress: { type: 'text', title: '通信地址' }, | |||
PostalCode: { type: 'text', title: '邮政编码' }, | |||
FatherUnit: { type: 'text', title: '户口所在地' }, | |||
MatherUnit: { type: 'text', title: '档案所在地' }, | |||
FatherName: { type: 'text', title: '父亲名字' }, | |||
FatherPhone: { type: 'text', title: '父亲电话', verify: 'PhoneOrNull' }, | |||
MatherName: { type: 'text', title: '母亲名字' }, | |||
MatherPhone: { type: 'text', title: '母亲电话' }, | |||
FamilyOriginNo: { type: 'select', title: '家庭出生', dataSource: '1', dataSourceId: 'BCdFamilyOrigin,familyorigin,familyoriginno' }, | |||
OverseasChineseNo: { type: 'select', title: '港澳台侨', dataSource: '1', dataSourceId: 'BCdOverseasChinese,overseaschinesename,overseaschineseno' }, | |||
GraduateNo: { type: 'select', title: '本专科', itemCode: 'CollegeType', dataSource: '0' }, | |||
InSchoolAddress: { type: 'text', title: '校内地址' }, | |||
InSchoolTelephone: { type: 'text', title: '校内电话' }, | |||
QQ: { type: 'text', title: 'QQ' }, | |||
GoodAt: { type: 'textarea', title: '特长' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
StuInfoBasic: { | |||
PartyFaceNo: [], | |||
NationalityNo: Object.values(this.GET_GLOBAL('dataDictionary').National).map(t => ({ value: t.value, text: t.text })), | |||
ResidenceNo: Object.values(this.GET_GLOBAL('dataDictionary').ResidenceNo).map(t => ({ value: t.value, text: t.text })), | |||
FamilyOriginNo: [], | |||
OverseasChineseNo: [], | |||
GraduateNo: Object.values(this.GET_GLOBAL('dataDictionary').CollegeType).map(t => ({ value: t.value, text: t.text })), | |||
}, | |||
} | |||
} | |||
}, | |||
async onLoad({ type, id }) { | |||
let account=this.GET_GLOBAL('loginUser').account; | |||
console.log(this.GET_GLOBAL('loginUser')); | |||
let stuInfo = await this.HTTP_GET('/EducationalAdministration/StuInfoBasic/stuinfo', account) | |||
id=stuInfo.StuId; | |||
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('BCdPartyFace').then(result => { | |||
this.dataSource.StuInfoBasic.PartyFaceNo = result.data.map(t => ({ text: t.partyface, value: t.partyfaceno })) | |||
}), | |||
this.FETCH_DATASOURCE('BCdFamilyOrigin').then(result => { | |||
this.dataSource.StuInfoBasic.FamilyOriginNo = result.data.map(t => ({ text: t.familyorigin, value: t.familyoriginno })) | |||
}), | |||
this.FETCH_DATASOURCE('BCdOverseasChinese').then(result => { | |||
this.dataSource.StuInfoBasic.OverseasChineseNo = result.data.map(t => ({ text: t.overseaschinesename, value: t.overseaschineseno })) | |||
}), | |||
() => {} | |||
]) | |||
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/StuInfoBasic/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/StuInfoBasic/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuInfoBasic-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/EducationalAdministration/StuInfoBasic/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuInfoBasic-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> |
@@ -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, 'JoinTime') }} | |||
</view> | |||
<l-customlist-action @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/communityMemberpagelist', | |||
{ | |||
// 这里 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> |
@@ -179,12 +179,12 @@ export default { | |||
const company = this.GET_GLOBAL('company') | |||
const dep = this.GET_GLOBAL('department') | |||
const companyName = company[companyId].name | |||
if (!dep) { | |||
return companyName | |||
} | |||
// const companyName = company[companyId].name | |||
// if (!dep) { | |||
// return companyName | |||
// } | |||
return `${companyName} / ${dep[departmentId].name}` | |||
// return `${companyName} / ${dep[departmentId].name}` | |||
}, | |||
// 头像圆形/方形显示参数 | |||