@@ -673,6 +673,22 @@ export default { | |||
return null | |||
} | |||
//dyy 2020-03-09 14:50 | |||
//请求成功后,返回数据状态码不等于200,请求数据失败 | |||
if(result.data && result.data.code !== 200){ | |||
uni.hideLoading() | |||
if (tips) { | |||
const errInfo = (result.data && result.data.info) || '(未知原因)' | |||
const errTips = typeof tips === 'string' ? tips : '请求数据时发生错误' | |||
uni.showToast({ | |||
title: `${errTips}: ${errInfo}`, | |||
icon: 'none' | |||
}) | |||
} | |||
return null | |||
} | |||
return result.data.data | |||
}, | |||
@@ -130,7 +130,7 @@ export default { | |||
dataSource: { | |||
EmpInfo: { | |||
PartyFaceNo: [], | |||
NationalityNo: [], | |||
NationalityNo: Object.values(this.GET_GLOBAL('dataDictionary').National).map(t => ({ value: t.value, text: t.text })), | |||
}, | |||
}, | |||
}; | |||
@@ -150,7 +150,13 @@ export default { | |||
this.id = id; | |||
this.mode = type; | |||
this.edit = ["create", "edit"].includes(this.mode); // 拉取表单数据,同时拉取所有来自数据源的选单数据 | |||
await Promise.all([() => {}]); | |||
await Promise.all([ | |||
this.FETCH_DATASOURCE('BCdPartyFace').then(result => { | |||
this.dataSource.EmpInfo.PartyFaceNo = result.data.map(t => ({ text: t.partyface, value: t.partyfaceno })) | |||
}), | |||
() => {}, | |||
]); | |||
await this.fetchForm(); | |||
this.ready = true; | |||
this.HIDE_LOADING(); | |||
@@ -164,7 +170,7 @@ export default { | |||
this.id | |||
); | |||
this.id=result.EmpInfo.EmpId; | |||
console.log(result); | |||
// console.log(result); | |||
this.origin = await this.formatFormData(result); | |||
} | |||
this.current = this.COPY(this.origin); | |||
@@ -1,304 +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.MESSAGEID"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">发件人:</text> | |||
{{ displayListItem(item, 'SENDER') }} | |||
</view> | |||
<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> | |||
{{ showStatus(item) }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">收件时间:</text> | |||
{{ displayListItem(item, 'SENDTIME') }} | |||
</view> | |||
<l-customlist-action @view="action('view', item.MESSAGEID)" /> | |||
</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.SENDER" | |||
@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> | |||
<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.MESSAGEID"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">发件人:</text> | |||
{{ displayListItem(item, 'SENDER') }} | |||
</view> | |||
<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> | |||
{{ showStatus(item) }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">收件时间:</text> | |||
{{ displayListItem(item, 'SENDTIME') }} | |||
</view> | |||
<l-customlist-action @view="action('view', item.MESSAGEID)" /> | |||
</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.SENDER" | |||
@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-19 17:58 | |||
* 描 述:收件箱 | |||
*/ | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-19 17:58 | |||
* 描 述:收件箱 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/SYS_ReceiveMessage/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/SYS_ReceiveMessage/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: { | |||
SENDER: { type: 'text' }, | |||
TITLE: { type: 'text' }, | |||
READFLAG: { type: 'select', dataSource: '0' }, | |||
SENDTIME: { type: 'datetime', dateformat: '0' }, | |||
URL: { type: 'upload' }, | |||
CONTENTS: { type: 'textarea' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
SENDER: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
READFLAG: [], | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationSYS_ReceiveMessage-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationSYS_ReceiveMessage-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 } | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
SENDER: { type: 'text' }, | |||
TITLE: { type: 'text' }, | |||
READFLAG: { type: 'select', dataSource: '0' }, | |||
SENDTIME: { type: 'datetime', dateformat: '0' }, | |||
URL: { type: 'upload' }, | |||
CONTENTS: { type: 'textarea' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
SENDER: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
READFLAG: [], | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationSYS_ReceiveMessage-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationSYS_ReceiveMessage-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 } | |||
this.searchData.userId=this.GET_GLOBAL('loginUser').userId; | |||
const result = await this.HTTP_GET( | |||
'/EducationalAdministration/SYS_ReceiveMessage/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'MESSAGEID', 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/SYS_ReceiveMessage/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 | |||
} | |||
}, | |||
const result = await this.HTTP_GET( | |||
'learun/adms/EducationalAdministration/SYS_ReceiveMessage/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'MESSAGEID', 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('learun/adms/EducationalAdministration/SYS_ReceiveMessage/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 | |||
} | |||
}, | |||
showStatus(item){ | |||
return item.READFLAG==1?'已读':'未读'; | |||
} | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; |
@@ -1,321 +1,321 @@ | |||
<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, 'AcademicYearNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学期:</text> | |||
{{ displayListItem(item, 'Semester') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学号:</text> | |||
{{ displayListItem(item, 'StuNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">姓名:</text> | |||
{{ displayListItem(item, 'StuName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">年级:</text> | |||
{{ displayListItem(item, 'Grade') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">系所码:</text> | |||
{{ displayListItem(item, 'DeptNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">系名:</text> | |||
{{ displayListItem(item, 'DeptName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">专业码:</text> | |||
{{ displayListItem(item, 'MajorNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">专业名:</text> | |||
{{ displayListItem(item, 'MajorName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">所在行政班号:</text> | |||
{{ displayListItem(item, 'ClassNo') }} | |||
</view> | |||
<l-customlist-action showButton buttonText="审核" @join="action('check',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-input | |||
v-model="queryData.StuNo" | |||
@change="searchChange" | |||
title ="学号" | |||
placeholder="按学号查询" | |||
/> | |||
<l-input | |||
v-model="queryData.StuName" | |||
@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> | |||
<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, 'AcademicYearNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学期:</text> | |||
{{ displayListItem(item, 'Semester') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学号:</text> | |||
{{ displayListItem(item, 'StuNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">姓名:</text> | |||
{{ displayListItem(item, 'StuName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">年级:</text> | |||
{{ displayListItem(item, 'Grade') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">系所码:</text> | |||
{{ displayListItem(item, 'DeptNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">系名:</text> | |||
{{ displayListItem(item, 'DeptName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">专业码:</text> | |||
{{ displayListItem(item, 'MajorNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">专业名:</text> | |||
{{ displayListItem(item, 'MajorName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">所在行政班号:</text> | |||
{{ displayListItem(item, 'ClassNo') }} | |||
</view> | |||
<l-customlist-action showButton buttonText="审核" @join="action('check',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-input | |||
v-model="queryData.StuNo" | |||
@change="searchChange" | |||
title ="学号" | |||
placeholder="按学号查询" | |||
/> | |||
<l-input | |||
v-model="queryData.StuName" | |||
@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-20 15:22 | |||
* 描 述:aaa | |||
*/ | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-20 15:22 | |||
* 描 述:aaa | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuAttendanceLeave/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuAttendanceLeave/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: { | |||
AcademicYearNo: { type: 'text' }, | |||
Semester: { type: 'text' }, | |||
StuNo: { type: 'text' }, | |||
StuName: { type: 'text' }, | |||
Grade: { type: 'text' }, | |||
DeptNo: { type: 'text' }, | |||
DeptName: { type: 'text' }, | |||
MajorNo: { type: 'text' }, | |||
MajorName: { type: 'text' }, | |||
ClassNo: { type: 'text' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
StuNo: '', | |||
StuName: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationStuAttendanceLeave-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationStuAttendanceLeave-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/StuAttendanceLeave/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 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('/EducationalAdministration/StuAttendanceLeave/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 | |||
} | |||
} | |||
} | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
AcademicYearNo: { type: 'text' }, | |||
Semester: { type: 'text' }, | |||
StuNo: { type: 'text' }, | |||
StuName: { type: 'text' }, | |||
Grade: { type: 'text' }, | |||
DeptNo: { type: 'text' }, | |||
DeptName: { type: 'text' }, | |||
MajorNo: { type: 'text' }, | |||
MajorName: { type: 'text' }, | |||
ClassNo: { type: 'text' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
StuNo: '', | |||
StuName: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationStuAttendanceLeave-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationStuAttendanceLeave-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( | |||
'learun/adms/EducationalAdministration/StuAttendanceLeave/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 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/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'; |
@@ -1,311 +1,311 @@ | |||
<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.RFileId"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">发送人:</text> | |||
{{ displayListItem(item, 'Sender') }} | |||
</view> | |||
<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, 'SendTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">接收对象:</text> | |||
{{ displayListItem(item, 'SendType') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">状态:</text> | |||
{{ showStatus(item) }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">查阅时间:</text> | |||
{{ displayListItem(item, 'ReadTime') }} | |||
</view> | |||
<l-customlist-action showEdit @edit="action('edit', item.RFileId)" showDelete @delete="action('delete', item.RFileId)" @view="action('view', item.RFileId)" /> | |||
</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.Sender" | |||
@change="searchChange" | |||
title ="发送人" | |||
placeholder="按发送人查询" | |||
/> | |||
<l-input | |||
v-model="queryData.Title" | |||
@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> | |||
<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.RFileId"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">发送人:</text> | |||
{{ displayListItem(item, 'Sender') }} | |||
</view> | |||
<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, 'SendTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">接收对象:</text> | |||
{{ displayListItem(item, 'SendType') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">状态:</text> | |||
{{ showStatus(item) }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">查阅时间:</text> | |||
{{ displayListItem(item, 'ReadTime') }} | |||
</view> | |||
<l-customlist-action showEdit @edit="action('edit', item.RFileId)" showDelete @delete="action('delete', item.RFileId)" @view="action('view', item.RFileId)" /> | |||
</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.Sender" | |||
@change="searchChange" | |||
title ="发送人" | |||
placeholder="按发送人查询" | |||
/> | |||
<l-input | |||
v-model="queryData.Title" | |||
@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-19 09:24 | |||
* 描 述:公文查看 | |||
*/ | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-19 09:24 | |||
* 描 述:公文查看 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/Sys_ReceiveFile/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/Sys_ReceiveFile/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: { | |||
Sender: { type: 'text' }, | |||
Title: { type: 'text' }, | |||
SendTime: { type: 'datetime', dateformat: '0' }, | |||
SendType: { type: 'select', itemCode: 'FileSendType', dataSource: '0' }, | |||
ReadFlag: { type: 'select', dataSource: '0' }, | |||
ReadTime: { type: 'datetime', dateformat: '0' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
Sender: '', | |||
Title: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
SendType: Object.values(this.GET_GLOBAL('dataDictionary').FileSendType).map(t => ({ value: t.value, text: t.text })), | |||
ReadFlag: [], | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationSys_ReceiveFile-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationSys_ReceiveFile-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 } | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
Sender: { type: 'text' }, | |||
Title: { type: 'text' }, | |||
SendTime: { type: 'datetime', dateformat: '0' }, | |||
SendType: { type: 'select', itemCode: 'FileSendType', dataSource: '0' }, | |||
ReadFlag: { type: 'select', dataSource: '0' }, | |||
ReadTime: { type: 'datetime', dateformat: '0' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
Sender: '', | |||
Title: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
SendType: Object.values(this.GET_GLOBAL('dataDictionary').FileSendType).map(t => ({ value: t.value, text: t.text })), | |||
ReadFlag: [], | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationSys_ReceiveFile-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationSys_ReceiveFile-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 } | |||
this.searchData.ReceiverId=this.GET_GLOBAL('loginUser').userId; | |||
const result = await this.HTTP_GET( | |||
'/EducationalAdministration/Sys_ReceiveFile/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'RFileId', 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/Sys_ReceiveFile/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 | |||
} | |||
}, | |||
const result = await this.HTTP_GET( | |||
'learun/adms/EducationalAdministration/Sys_ReceiveFile/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'RFileId', 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('learun/adms/EducationalAdministration/Sys_ReceiveFile/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 | |||
} | |||
}, | |||
showStatus(item){ | |||
console.log(item); | |||
if(item.SendStatus==true){ | |||
@@ -314,12 +314,12 @@ showStatus(item){ | |||
return "未查阅" | |||
} | |||
} | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; |
@@ -1,146 +1,88 @@ | |||
<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, "ClassNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">测温人:</text> | |||
{{ displayListItem(item, "MeasurerID") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">被测温人:</text> | |||
{{ displayListItem(item, "PersonBeingMeasured") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">测量时间:</text> | |||
{{ displayListItem(item, "MeasureDate") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">测温时间段:</text> | |||
{{ displayListItem(item, "MeasureTime") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">状态:</text> | |||
{{ displayListItem(item, "Status") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">温度:</text> | |||
{{ displayListItem(item, "Temperature") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">处理结果:</text> | |||
{{ displayListItem(item, "ProcessingResult") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">备注:</text> | |||
{{ displayListItem(item, "Remark") }} | |||
</view> | |||
<l-customlist-action | |||
showEdit | |||
@edit="action('edit', item.ID)" | |||
showDelete | |||
@delete="action('delete', item.ID)" | |||
@view="action('view', item.ID)" | |||
/> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
<!-- 关闭侧边抽屉按钮 --> | |||
<view | |||
@click="sideOpen = false" | |||
:class="sideOpen ? 'show' : ''" | |||
class="sideclose" | |||
> | |||
<l-icon type="pullright" color="blue" /> | |||
</view> | |||
<!-- 侧边栏,用于设置查询条件 --> | |||
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y> | |||
<view v-if="ready" class="padding"> | |||
<l-customlist-sidepage-datefilter | |||
v-model="dateRange" | |||
@change="searchChange" | |||
title="按时间日期查询: " | |||
ref="datefilter" | |||
class="margin-bottom" | |||
/> | |||
<l-select | |||
v-model="queryData.ClassNo" | |||
@change="searchChange" | |||
:range="dataSource.ClassNo" | |||
title="班级" | |||
placeholder="按班级查询" | |||
/> | |||
<l-select | |||
v-model="queryData.PersonBeingMeasured" | |||
@change="searchChange" | |||
:range="dataSource.PersonBeingMeasured" | |||
title="被测温人" | |||
placeholder="按被测温人查询" | |||
/> | |||
<l-select | |||
v-model="queryData.MeasureTime" | |||
@change="searchChange" | |||
:range="dataSource.MeasureTime" | |||
title="测温时间段" | |||
placeholder="按测温时间段查询" | |||
/> | |||
<l-select | |||
v-model="queryData.Status" | |||
@change="searchChange" | |||
:range="dataSource.Status" | |||
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> | |||
<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, 'ClassNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">测温人:</text> | |||
{{ displayListItem(item, 'MeasurerID') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">被测温人:</text> | |||
{{ displayListItem(item, 'PersonBeingMeasured') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">测量时间:</text> | |||
{{ displayListItem(item, 'MeasureDate') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">测温时间段:</text> | |||
{{ displayListItem(item, 'MeasureTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">状态:</text> | |||
{{ displayListItem(item, 'Status') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">温度:</text> | |||
{{ displayListItem(item, 'Temperature') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">处理结果:</text> | |||
{{ displayListItem(item, 'ProcessingResult') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">备注:</text> | |||
{{ displayListItem(item, 'Remark') }} | |||
</view> | |||
<l-customlist-action showEdit @edit="action('edit', item.ID)" showDelete @delete="action('delete', item.ID)" @view="action('view', item.ID)" /> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
<!-- 关闭侧边抽屉按钮 --> | |||
<view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose"><l-icon type="pullright" color="blue" /></view> | |||
<!-- 侧边栏,用于设置查询条件 --> | |||
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y> | |||
<view v-if="ready" class="padding"> | |||
<l-customlist-sidepage-datefilter v-model="dateRange" @change="searchChange" title="按时间日期查询: " ref="datefilter" class="margin-bottom" /> | |||
<l-select v-model="queryData.ClassNo" @change="searchChange" :range="dataSource.ClassNo" title="班级" placeholder="按班级查询" /> | |||
<l-select v-model="queryData.PersonBeingMeasured" @change="searchChange" :range="dataSource.PersonBeingMeasured" title="被测温人" placeholder="按被测温人查询" /> | |||
<l-select v-model="queryData.MeasureTime" @change="searchChange" :range="dataSource.MeasureTime" title="测温时间段" placeholder="按测温时间段查询" /> | |||
<l-select v-model="queryData.Status" @change="searchChange" :range="dataSource.Status" 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) | |||
@@ -158,299 +100,271 @@ | |||
* (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"; | |||
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: { | |||
ClassNo: { | |||
type: "select", | |||
dataSource: "1", | |||
dataSourceId: "bjsj,classname,classno", | |||
}, | |||
MeasurerID: { | |||
type: "select", | |||
dataSource: "1", | |||
dataSourceId: "BaseUser,f_realname,f_account", | |||
}, | |||
PersonBeingMeasured: { | |||
type: "select", | |||
dataSource: "1", | |||
dataSourceId: "StuInfoBasic,stuname,stuno", | |||
}, | |||
MeasureDate: { type: "datetime", dateformat: "0" }, | |||
MeasureTime: { | |||
type: "select", | |||
itemCode: "MeasureTime", | |||
dataSource: "0", | |||
}, | |||
Status: { | |||
type: "select", | |||
itemCode: "TemperatureMeasure", | |||
dataSource: "0", | |||
}, | |||
Temperature: { type: "text" }, | |||
ProcessingResult: { type: "textarea" }, | |||
Remark: { type: "textarea" }, | |||
}, | |||
// 查询条件 | |||
searchData: { | |||
MeasurerID: this.GET_GLOBAL("loginUser").account, | |||
}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
ClassNo: "", | |||
PersonBeingMeasured: "", | |||
MeasureTime: "", | |||
Status: "", | |||
MeasurerID: this.GET_GLOBAL("loginUser").account, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
ClassNo: [], | |||
MeasurerID: [], | |||
PersonBeingMeasured: [], | |||
MeasureTime: Object.values( | |||
this.GET_GLOBAL("dataDictionary").MeasureTime | |||
).map((t) => ({ value: t.value, text: t.text })), | |||
Status: Object.values( | |||
this.GET_GLOBAL("dataDictionary").TemperatureMeasure | |||
).map((t) => ({ value: t.value, text: t.text })), | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: "加载中...", | |||
loadState: "向下翻以加载更多", | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [], | |||
}; | |||
}, | |||
async onLoad() { | |||
await this.init(); | |||
}, | |||
onUnload() { | |||
this.OFF("EducationalAdministrationThermography-list-change"); | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON( | |||
"EducationalAdministrationThermography-list-change", | |||
this.refreshList | |||
); | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
this.FETCH_DATASOURCE("bjsj").then((data) => { | |||
this.dataSource.ClassNo = data.data.map((t) => ({ | |||
text: t.classname, | |||
value: t.classno, | |||
})); | |||
}), | |||
this.FETCH_DATASOURCE("BaseUser").then((data) => { | |||
this.dataSource.MeasurerID = data.data.map((t) => ({ | |||
text: t.f_realname, | |||
value: t.f_account, | |||
})); | |||
}), | |||
this.FETCH_DATASOURCE("StuInfoBasic").then((data) => { | |||
this.dataSource.PersonBeingMeasured = data.data.map((t) => ({ | |||
text: t.stuname, | |||
value: t.stuno, | |||
})); | |||
}), | |||
() => {}, | |||
]); | |||
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/Thermography/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/Thermography/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; | |||
} | |||
}, | |||
}, | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
ClassNo: { | |||
type: 'select', | |||
dataSource: '1', | |||
dataSourceId: 'bjsj,classname,classno' | |||
}, | |||
MeasurerID: { | |||
type: 'select', | |||
dataSource: '1', | |||
dataSourceId: 'BaseUser,f_realname,f_account' | |||
}, | |||
PersonBeingMeasured: { | |||
type: 'select', | |||
dataSource: '1', | |||
dataSourceId: 'StuInfoBasic,stuname,stuno' | |||
}, | |||
MeasureDate: { type: 'datetime', dateformat: '0' }, | |||
MeasureTime: { | |||
type: 'select', | |||
itemCode: 'MeasureTime', | |||
dataSource: '0' | |||
}, | |||
Status: { | |||
type: 'select', | |||
itemCode: 'TemperatureMeasure', | |||
dataSource: '0' | |||
}, | |||
Temperature: { type: 'text' }, | |||
ProcessingResult: { type: 'textarea' }, | |||
Remark: { type: 'textarea' } | |||
}, | |||
// 查询条件 | |||
searchData: { | |||
MeasurerID: this.GET_GLOBAL('loginUser').account | |||
}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
ClassNo: '', | |||
PersonBeingMeasured: '', | |||
MeasureTime: '', | |||
Status: '', | |||
MeasurerID: this.GET_GLOBAL('loginUser').account | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
ClassNo: [], | |||
MeasurerID: [], | |||
PersonBeingMeasured: [], | |||
MeasureTime: Object.values(this.GET_GLOBAL('dataDictionary').MeasureTime).map(t => ({ value: t.value, text: t.text })), | |||
Status: Object.values(this.GET_GLOBAL('dataDictionary').TemperatureMeasure).map(t => ({ value: t.value, text: t.text })) | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
}; | |||
}, | |||
async onLoad() { | |||
await this.init(); | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationThermography-list-change'); | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationThermography-list-change', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
this.FETCH_DATASOURCE('bjsj').then(data => { | |||
this.dataSource.ClassNo = data.data.map(t => ({ | |||
text: t.classname, | |||
value: t.classno | |||
})); | |||
}), | |||
this.FETCH_DATASOURCE('BaseUser').then(data => { | |||
this.dataSource.MeasurerID = data.data.map(t => ({ | |||
text: t.f_realname, | |||
value: t.f_account | |||
})); | |||
}), | |||
this.FETCH_DATASOURCE('StuInfoBasic').then(data => { | |||
this.dataSource.PersonBeingMeasured = data.data.map(t => ({ | |||
text: t.stuname, | |||
value: t.stuno | |||
})); | |||
}), | |||
() => {} | |||
]); | |||
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( | |||
'learun/adms/EducationalAdministration/Thermography/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('learun/adms/EducationalAdministration/Thermography/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"; | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
</style> |
@@ -1,265 +1,265 @@ | |||
<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, 'Date') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">值班人:</text> | |||
{{ displayListItem(item, 'Person') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">备注:</text> | |||
{{ displayListItem(item, 'Remark') }} | |||
</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"> | |||
<!-- 重置查询条件按钮 --> | |||
<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> | |||
<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, 'Date') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">值班人:</text> | |||
{{ displayListItem(item, 'Person') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">备注:</text> | |||
{{ displayListItem(item, 'Remark') }} | |||
</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"> | |||
<!-- 重置查询条件按钮 --> | |||
<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-20 09:55 | |||
* 描 述:值班安排 | |||
*/ | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-20 09:55 | |||
* 描 述:值班安排 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/DutySchedule/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/DutySchedule/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: { | |||
Date: { type: 'datetime', dateformat: '0' }, | |||
Person: { type: 'text' }, | |||
Remark: { type: 'textarea' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('PersonnelManagementDutySchedule-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('PersonnelManagementDutySchedule-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/DutySchedule/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 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('/PersonnelManagement/DutySchedule/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 | |||
} | |||
} | |||
} | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
Date: { type: 'datetime', dateformat: '0' }, | |||
Person: { type: 'text' }, | |||
Remark: { type: 'textarea' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('PersonnelManagementDutySchedule-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('PersonnelManagementDutySchedule-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( | |||
'learun/adms/PersonnelManagement/DutySchedule/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 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('learun/adms/PersonnelManagement/DutySchedule/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'; |
@@ -24,8 +24,8 @@ export default { | |||
// 计算出用户公司、岗位等信息 | |||
info() { | |||
const company = this.currentUser.companyId ? this.GET_GLOBAL('company')[this.currentUser.companyId].name : '' | |||
const dep = this.currentUser.departmentId ? this.GET_GLOBAL('department')[this.currentUser.departmentId].name : '' | |||
const company = this.currentUser.companyId ? this.GET_GLOBAL('company')[this.currentUser.companyId]?.name : '' | |||
const dep = this.currentUser.departmentId ? this.GET_GLOBAL('department')[this.currentUser.departmentId]?.name : '' | |||
const role = (this.currentUser.role || []).map(t => t.F_FullName).join(' · ') | |||
const job = (this.currentUser.post || []).map(t => t.F_Name).join(' · ') | |||
@@ -41,8 +41,8 @@ export default { | |||
const success = await this.HTTP_POST( | |||
'/user/modifypw', | |||
{ | |||
newpassword: this.md5(newPwd), | |||
oldpassword: this.md5(oldPwd) | |||
newpassword: this.MD5(newPwd), | |||
oldpassword: this.MD5(oldPwd) | |||
}, | |||
'未能成功修改密码' | |||
) | |||