@@ -1,52 +1,65 @@ | |||
<script> | |||
export default { | |||
// 小程序:onLaunch 仅启动时调用一次 | |||
// H5/App:onLaunch 打开网页/用户点刷新/代码热更新时均会调用; | |||
// 考虑到用户刷新网页时会丢失全局数据、页面栈、页面数据等,因此直接跳回首页即可 | |||
export default { | |||
// 小程序:onLaunch 仅启动时调用一次 | |||
// H5/App:onLaunch 打开网页/用户点刷新/代码热更新时均会调用; | |||
// 考虑到用户刷新网页时会丢失全局数据、页面栈、页面数据等,因此直接跳回首页即可 | |||
async onLaunch(param) { | |||
//应用的生命周期 应用启动后触发 | |||
// #ifdef H5 || APP-VUE | |||
// H5 刷新时获取当前页面路径 | |||
const pagePath = "/" + param.path; | |||
// 如果 H5 刷新后访问的不是首页/登录页/注册页,直接跳转回首页 | |||
if (!["/pages/login", "/pages/home", "/pages/signup"].includes(pagePath)) { | |||
this.$nextTick(() => { | |||
this.TAB_TO("/pages/home"); | |||
return; | |||
}); | |||
} | |||
// #endif | |||
async onLaunch(param) { | |||
//应用的生命周期 应用启动后触发 | |||
// #ifdef H5 || APP-VUE | |||
// H5 刷新时获取当前页面路径 | |||
const pagePath = "/" + param.path; | |||
// 如果 H5 刷新后访问的不是首页/登录页/注册页,直接跳转回首页 | |||
if (!["/pages/login", "/pages/home", "/pages/signup"].includes(pagePath)) { | |||
this.$nextTick(() => { | |||
this.TAB_TO("/pages/home"); | |||
return; | |||
}); | |||
} | |||
// #ifdef MP-WEIXIN | |||
// 小程序端,处理更新 (支付宝/钉钉暂不支持) | |||
const updateManager = uni.getUpdateManager(); | |||
updateManager.onUpdateReady(() => { | |||
this.HIDE_LOADING(); | |||
uni.showModal({ | |||
title: "更新提示", | |||
content: "小程序新版本已准备好,是否更新应用?", | |||
success: ({ confirm }) => { | |||
if (confirm) { | |||
updateManager.applyUpdate(); | |||
} | |||
}, | |||
}); | |||
}); | |||
// #endif | |||
}, | |||
onError(error) { | |||
console.log(error); | |||
}, | |||
}; | |||
// #endif | |||
// #ifdef MP-WEIXIN | |||
// 小程序端,处理更新 (支付宝/钉钉暂不支持) | |||
const updateManager = uni.getUpdateManager(); | |||
updateManager.onUpdateReady(() => { | |||
this.HIDE_LOADING(); | |||
uni.showModal({ | |||
title: "更新提示", | |||
content: "小程序新版本已准备好,是否更新应用?", | |||
success: ({ | |||
confirm | |||
}) => { | |||
if (confirm) { | |||
updateManager.applyUpdate(); | |||
} | |||
}, | |||
}); | |||
}); | |||
// #endif | |||
}, | |||
onError(error) { | |||
console.log(error); | |||
}, | |||
}; | |||
</script> | |||
<style lang="less"> | |||
// 现在 CSS 必须在 <style> 中引入,参考:https://ask.dcloud.net.cn/question/86907 | |||
// 后续 uni-app 升级后可能会支持直接 import 样式,到时候可以省略下行代码 | |||
@import "~@/components/learun-mpui/styles/index.css"; | |||
// 现在 CSS 必须在 <style> 中引入,参考:https://ask.dcloud.net.cn/question/86907 | |||
// 后续 uni-app 升级后可能会支持直接 import 样式,到时候可以省略下行代码 | |||
@import "~@/components/learun-mpui/styles/index.css"; | |||
page { | |||
background-color: #f3f3f3; | |||
} | |||
page { | |||
background-color: #f3f3f3; | |||
} | |||
.btn { | |||
width: 50%; | |||
line-height: 34px; | |||
background-color: #0c86d8; | |||
text-align: center; | |||
color: #fff; | |||
border-radius: 4px; | |||
margin: 30px auto; | |||
} | |||
</style> |
@@ -0,0 +1,11 @@ | |||
@pubColor: #0C86D8; | |||
.btn { | |||
width: 50%; | |||
line-height: 34px; | |||
background-color: #0c86d8; | |||
text-align: center; | |||
color: #fff; | |||
border-radius: 4px; | |||
margin: 30px auto; | |||
} |
@@ -0,0 +1,55 @@ | |||
export default { | |||
fmtDate(obj) { | |||
let date =obj? new Date(obj) : new Date(); | |||
let y = 1900+date.getYear(); | |||
let m = "0"+(date.getMonth()+1); | |||
let d = "0"+date.getDate(); | |||
return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length); | |||
}, | |||
judgeDate(obj) { //判断学期 | |||
let date = obj ? new Date(obj) : new Date(); | |||
let y = 1900 + date.getYear(); | |||
let m = date.getMonth() + 1; | |||
if(m >= 2) { | |||
if(m < 7) { | |||
return (y - 1) + '-' + y + '学年第二学期' | |||
} else { | |||
return y + '-' + (y + 1) + '学年第一学期' | |||
} | |||
}else{ | |||
return (y - 1) + '-' + y + '学年第一学期' | |||
} | |||
}, | |||
oneDayTime () { | |||
return 24 * 60 * 60 * 1000 //一天时间 | |||
}, | |||
weekday() { //根据今天得到周一与周日的时间 | |||
var now = new Date(); | |||
var nowTime = now.getTime(); | |||
var day = now.getDay(); | |||
//显示周一 | |||
var MondayTime = nowTime - (day - 1) * this.oneDayTime() ; | |||
//显示周日 | |||
var SundayTime = nowTime + (7 - day) * this.oneDayTime() ; | |||
return { | |||
MondayTime: MondayTime, | |||
Monday: this.fmtDate(MondayTime), | |||
SundayTime: SundayTime, | |||
Sunday: this.fmtDate(SundayTime) | |||
} | |||
}, | |||
compare (key) { | |||
return (obj1, obj2) => { | |||
let value1 = obj1[key] | |||
let value2 = obj2[key] | |||
if (value1 < value2) { | |||
return -1; | |||
} else if (value1 > value2) { | |||
return 1; | |||
} else { | |||
return 0 | |||
} | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,29 @@ | |||
export default { | |||
scanCodeFun() { | |||
const promise = new Promise((resolve, reject) => { | |||
// #ifdef APP-PLUS || MP-WEIXIN | |||
uni.scanCode({ | |||
success: function(res) { | |||
// console.log(res) | |||
// console.log('条码类型:' + res.scanType); | |||
// console.log('条码内容:' + res.result); | |||
resolve(res) | |||
}, | |||
fail: function(res) { | |||
resolve(false) | |||
} | |||
}); | |||
// #endif | |||
// #ifndef APP-PLUS || MP-WEIXIN | |||
resolve(false) | |||
uni.showToast({ | |||
title: '请下载app或者到微信浏览器打开网页', | |||
icon: 'none', | |||
mask: false | |||
}) | |||
// #endif | |||
}) | |||
return promise | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
export default { | |||
fmtDate(obj) { | |||
let date =obj? new Date(obj) : new Date(); | |||
let y = 1900+date.getYear(); | |||
let m = "0"+(date.getMonth()+1); | |||
let d = "0"+date.getDate(); | |||
let h = "0"+date.getHours(); | |||
let min = "0"+date.getMinutes(); | |||
let second = "0"+date.getSeconds(); | |||
return { | |||
ymdhMin:y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length) + ' ' + h.substring(h.length-2,h.length) + ':' + min.substring(min.length-2,min.length), | |||
ymdhMins:y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length) + ' ' + h.substring(h.length-2,h.length) + ':' + min.substring(min.length-2,min.length) + ':' + second.substring(second.length-2,second.length), | |||
ymd:y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length) | |||
}; | |||
} | |||
} | |||
@@ -206,7 +206,7 @@ export default { | |||
return [] | |||
} | |||
return await this.HTTP_GET('/datasource/map', { | |||
return await this.HTTP_GET('learun/adms/datasource/map', { | |||
code, | |||
ver: '' | |||
}) | |||
@@ -218,7 +218,7 @@ export default { | |||
return '' | |||
} | |||
return await this.HTTP_GET('/coderule/code', rulecode) | |||
return await this.HTTP_GET('learun/adms/coderule/code', rulecode) | |||
}, | |||
// 拉取指定 id 的文件信息 | |||
@@ -227,7 +227,7 @@ export default { | |||
return null | |||
} | |||
return await this.HTTP_GET('/annexes/wxfileinfo', fileId) | |||
return await this.HTTP_GET('learun/adms/annexes/wxfileinfo', fileId) | |||
}, | |||
// 封装的 GET 请求,集成了验证信息 | |||
@@ -393,10 +393,10 @@ export default { | |||
// 目前包括了:公司、部门、人员、数据字典 | |||
async FETCH_CLIENTDATA() { | |||
await Promise.all([ | |||
this.HTTP_GET('/company/map').then(res => this.SET_GLOBAL('company', res.data || {})), | |||
this.HTTP_GET('/department/map').then(res => this.SET_GLOBAL('department', res.data || {})), | |||
this.HTTP_GET('/user/map').then(res => this.SET_GLOBAL('user', res.data || {})), | |||
this.HTTP_GET('/dataitem/map').then(res => this.SET_GLOBAL('dataDictionary', res.data || {})) | |||
this.HTTP_GET('learun/adms/company/map').then(res => this.SET_GLOBAL('company', res.data || {})), | |||
this.HTTP_GET('learun/adms/department/map').then(res => this.SET_GLOBAL('department', res.data || {})), | |||
this.HTTP_GET('learun/adms/user/map').then(res => this.SET_GLOBAL('user', res.data || {})), | |||
this.HTTP_GET('learun/adms/dataitem/map').then(res => this.SET_GLOBAL('dataDictionary', res.data || {})) | |||
]) | |||
}, | |||
@@ -76,6 +76,7 @@ | |||
@change="customChange" | |||
title="结束时间" | |||
placeholder="点击来选取" | |||
/> | |||
</view> | |||
</template> | |||
@@ -124,11 +124,21 @@ export default { | |||
// 加载子部门 | |||
if (this.level === 'department' || this.level === 'user') { | |||
children = children.concat( | |||
Object.entries(this.GET_GLOBAL('department')) | |||
.filter(([id, item]) => item.companyId === this.root.id && Number(item.parentId) !== -1) | |||
.map(([id, item]) => ({ ...item, id, type: 'department' })) | |||
) | |||
console.log(this.level,'level') | |||
if(this.root.type == 'company'){ | |||
children = children.concat( | |||
Object.entries(this.GET_GLOBAL('department')) | |||
.filter(([id, item]) => item.companyId === this.root.id && (Number(item.parentId) == -1||Number(item.parentId) == 0)) | |||
.map(([id, item]) => ({ ...item, id, type: 'department' })) | |||
) | |||
} | |||
else{ | |||
children = children.concat( | |||
Object.entries(this.GET_GLOBAL('department')) | |||
.filter(([id, item]) => item.companyId === this.root.companyId && (item.parentId == this.root.id )) | |||
.map(([id, item]) => ({ ...item, id, type: 'department' })) | |||
) | |||
} | |||
} | |||
// 加载子职员 | |||
@@ -81,6 +81,6 @@ export default { | |||
<style lang="less"> | |||
:host { | |||
display: block; | |||
height: 100%; | |||
height: 100vh; | |||
} | |||
</style> |
@@ -38,7 +38,7 @@ | |||
<!-- 子流程草稿/提交按钮 --> | |||
<view | |||
v-if="['child', 'create', 'again'].includes(type)" | |||
v-if="['child', 'create', 'again','draft'].includes(type)" | |||
class="form-action padding bg-white margin-top lr-hidden" | |||
style="padding-top: 0;" | |||
> | |||
@@ -95,7 +95,7 @@ export default { | |||
// 是否显示催办按钮(仅限我的任务,满足以下条件则可以催办:已开始、未结束、未作废) | |||
canUrge() { | |||
if (this.openFrom !== 'my') { | |||
if (this.openFrom !== 'my' || ['child', 'create', 'again','draft'].includes(this.type)) { | |||
return false | |||
} | |||
@@ -104,7 +104,7 @@ export default { | |||
// 是否显示撤销按钮(仅限我的任务,满足以下条件则可以撤销:未开始) | |||
canRevoke() { | |||
if (this.openFrom !== 'my') { | |||
if (this.openFrom !== 'my' || ['child', 'create', 'again','draft'].includes(this.type)) { | |||
return false | |||
} | |||
@@ -113,7 +113,7 @@ export default { | |||
// 是否允许加签(仅限待办任务,流程中配置允许加签则) | |||
canMultipleSign() { | |||
if (this.openFrom !== 'pre') { | |||
if (this.openFrom !== 'pre' || ['child', 'create', 'again','draft'].includes(this.type)) { | |||
return false | |||
} | |||
@@ -36,9 +36,11 @@ | |||
<script> | |||
export default { | |||
name: 'l-workflow-timeline', | |||
props: { | |||
processList: { default: () => [] } | |||
} | |||
processList: { default: () => [] }, | |||
currentTask: { default: () => ({}) }, | |||
}, | |||
} | |||
</script> |
@@ -26,7 +26,9 @@ export default { | |||
required: {}, | |||
value: {} | |||
}, | |||
created() { | |||
console.log(this.end) | |||
}, | |||
methods: { | |||
click(e) { | |||
if (this.disabled) { | |||
@@ -1,5 +1,5 @@ | |||
<template> | |||
<view v-if="type !== 'default'" :class="className" :style="style" class="cu-bar bg-white cu-title"> | |||
<view @click="$emit('click', $event)" v-if="type !== 'default'" :class="className" :style="style" class="cu-bar bg-white cu-title"> | |||
<!-- 下划线标题(普通/变色) --> | |||
<view v-if="type === 'underline' || type === 'colorfulUnderline'" class="action border-title"> | |||
<text :class="['text-' + color, blod ? 'text-blod' : '']" class="text-xl"><slot></slot></text> | |||
@@ -57,6 +57,7 @@ export default { | |||
this.index = e.detail.value | |||
this.$emit('input', this.currentModel) | |||
this.$emit('change', this.currentModel) | |||
//console.log(e) | |||
}, | |||
calcIndex() { | |||
@@ -31,7 +31,7 @@ | |||
</view> | |||
<!-- 普通标题(圆点/长圆点) --> | |||
<view v-else :class="[border ? 'solid-bottom' : '']" class="cu-bar bg-white cu-title"> | |||
<view @click="$emit('click', $event)" v-else :class="[border ? 'solid-bottom' : '']" class="cu-bar bg-white cu-title"> | |||
<view class="action" style="vertical-align: middle;"> | |||
<text | |||
:class="[subColor ? 'text-' + subColor : '', long ? 'cuIcon-titles' : 'cuIcon-title']" | |||
@@ -0,0 +1,106 @@ | |||
<template> | |||
<view class=""> | |||
<l-label :title="title"> | |||
<picker mode="multiSelector" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray" @change="locationChange"> | |||
<view class="picker">{{ multiArray[0][multiIndex[0]] }}-{{ multiArray[1][multiIndex[1]] }}-{{ multiArray[2][multiIndex[2]] }}</view> | |||
</picker> | |||
</l-label> | |||
</view> | |||
</template> | |||
<script> | |||
import city from '@/common/js/city.js'; | |||
export default { | |||
name: 'location-picker', | |||
props: { | |||
multiIndex: { | |||
type: Array, | |||
default() { | |||
return [0, 0, 0] | |||
}, | |||
}, | |||
code:{} | |||
}, | |||
data() { | |||
return { | |||
title: '省市区', | |||
multiArray: [[], [], []], | |||
codeArr: null | |||
}; | |||
}, | |||
methods:{ | |||
init(){ | |||
var _this = this; | |||
//根据code回显 | |||
if(this.code != ''){ | |||
this.codeArr = this.code.split(','); | |||
this.Feedback(city.cityData, 0); | |||
} | |||
this.cityCl(city.cityData, 0); | |||
this.locationChange() | |||
// console.log(this.code) | |||
// console.log(this.codeArr) | |||
// console.log(this.multiIndex) | |||
}, | |||
Feedback(data, num) { | |||
let _this = this; | |||
data.forEach((n, i) => { | |||
if(n.value == _this.codeArr[num]){ | |||
_this.multiIndex[num] = i; | |||
if (n.children) { | |||
let number = num + 1; | |||
_this.Feedback(n.children, number); | |||
} | |||
} | |||
}); | |||
}, | |||
locationChange() { | |||
let province = city.cityData[this.multiIndex[0]]; | |||
let citys = province.children[this.multiIndex[1]]; | |||
let area = citys.children[this.multiIndex[2]]; | |||
// console.log(`province.value , citys.value , area.value`) | |||
this.$emit('input', province.value + ',' + citys.value + ',' + area.value) | |||
this.$emit('change', province.value + ',' + citys.value + ',' + area.value) | |||
}, | |||
bindMultiPickerColumnChange: function(e) { | |||
// console.log(e); | |||
// console.log('修改的列为:' + e.detail.column + ',值为:' + e.detail.value); | |||
let _this = this; | |||
this.multiIndex[e.detail.column] = e.detail.value; | |||
if (e.detail.column == 0) { | |||
_this.multiArray[1].length = 0; | |||
_this.multiArray[2].length = 0; | |||
_this.multiIndex[1] = 0; | |||
_this.multiIndex[2] = 0; | |||
this.cityCl(city.cityData[_this.multiIndex[0]].children, 1); | |||
} else if (e.detail.column == 1) { | |||
_this.multiArray[2].length = 0; | |||
_this.multiIndex[2] = 0; | |||
this.cityCl(city.cityData[_this.multiIndex[0]].children[_this.multiIndex[1]].children, 2); | |||
} | |||
this.$forceUpdate(); | |||
}, | |||
cityCl(data, num) { | |||
let _this = this; | |||
data.forEach((n, i) => { | |||
if (i == _this.multiIndex[num] && n.children) { | |||
let number = num + 1; | |||
_this.cityCl(n.children, number); | |||
} | |||
_this.multiArray[num].push(n.text); | |||
}); | |||
}, | |||
watch: { | |||
value() { | |||
this.locationChange() | |||
} | |||
} | |||
}, | |||
mounted() { | |||
this.init() | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped></style> |
@@ -0,0 +1,546 @@ | |||
/** | |||
* @1900-2100区间内的公历、农历互转 | |||
* @charset UTF-8 | |||
* @github https://github.com/jjonline/calendar.js | |||
* @Author Jea杨(JJonline@JJonline.Cn) | |||
* @Time 2014-7-21 | |||
* @Time 2016-8-13 Fixed 2033hex、Attribution Annals | |||
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug | |||
* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year | |||
* @Version 1.0.3 | |||
* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] | |||
* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] | |||
*/ | |||
/* eslint-disable */ | |||
var calendar = { | |||
/** | |||
* 农历1900-2100的润大小信息表 | |||
* @Array Of Property | |||
* @return Hex | |||
*/ | |||
lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909 | |||
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919 | |||
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929 | |||
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939 | |||
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949 | |||
0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959 | |||
0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969 | |||
0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979 | |||
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989 | |||
0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999 | |||
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009 | |||
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019 | |||
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029 | |||
0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039 | |||
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049 | |||
/** Add By JJonline@JJonline.Cn**/ | |||
0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059 | |||
0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069 | |||
0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079 | |||
0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089 | |||
0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099 | |||
0x0d520], // 2100 | |||
/** | |||
* 公历每个月份的天数普通表 | |||
* @Array Of Property | |||
* @return Number | |||
*/ | |||
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], | |||
/** | |||
* 天干地支之天干速查表 | |||
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] | |||
* @return Cn string | |||
*/ | |||
Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'], | |||
/** | |||
* 天干地支之地支速查表 | |||
* @Array Of Property | |||
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] | |||
* @return Cn string | |||
*/ | |||
Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'], | |||
/** | |||
* 天干地支之地支速查表<=>生肖 | |||
* @Array Of Property | |||
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] | |||
* @return Cn string | |||
*/ | |||
Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'], | |||
/** | |||
* 24节气速查表 | |||
* @Array Of Property | |||
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] | |||
* @return Cn string | |||
*/ | |||
solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'], | |||
/** | |||
* 1900-2100各年的24节气日期速查表 | |||
* @Array Of Property | |||
* @return 0x string For splice | |||
*/ | |||
sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', | |||
'97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |||
'97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', | |||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', | |||
'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', | |||
'97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', | |||
'97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', | |||
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', | |||
'97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |||
'97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', | |||
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', | |||
'97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |||
'97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', | |||
'9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', | |||
'97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | |||
'97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | |||
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', | |||
'7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |||
'97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |||
'97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | |||
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', | |||
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', | |||
'97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |||
'97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | |||
'9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', | |||
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', | |||
'97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', | |||
'9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | |||
'7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | |||
'7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |||
'97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | |||
'9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | |||
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', | |||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', | |||
'97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | |||
'9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | |||
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', | |||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', | |||
'977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', | |||
'7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', | |||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', | |||
'977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | |||
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', | |||
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', | |||
'977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | |||
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', | |||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', | |||
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', | |||
'7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |||
'7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | |||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', | |||
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', | |||
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', | |||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', | |||
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', | |||
'7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', | |||
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', | |||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', | |||
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', | |||
'665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', | |||
'7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', | |||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', | |||
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], | |||
/** | |||
* 数字转中文速查表 | |||
* @Array Of Property | |||
* @trans ['日','一','二','三','四','五','六','七','八','九','十'] | |||
* @return Cn string | |||
*/ | |||
nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'], | |||
/** | |||
* 日期转农历称呼速查表 | |||
* @Array Of Property | |||
* @trans ['初','十','廿','卅'] | |||
* @return Cn string | |||
*/ | |||
nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], | |||
/** | |||
* 月份转农历称呼速查表 | |||
* @Array Of Property | |||
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] | |||
* @return Cn string | |||
*/ | |||
nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'], | |||
/** | |||
* 返回农历y年一整年的总天数 | |||
* @param lunar Year | |||
* @return Number | |||
* @eg:var count = calendar.lYearDays(1987) ;//count=387 | |||
*/ | |||
lYearDays: function (y) { | |||
var i; var sum = 348 | |||
for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 } | |||
return (sum + this.leapDays(y)) | |||
}, | |||
/** | |||
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 | |||
* @param lunar Year | |||
* @return Number (0-12) | |||
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 | |||
*/ | |||
leapMonth: function (y) { // 闰字编码 \u95f0 | |||
return (this.lunarInfo[y - 1900] & 0xf) | |||
}, | |||
/** | |||
* 返回农历y年闰月的天数 若该年没有闰月则返回0 | |||
* @param lunar Year | |||
* @return Number (0、29、30) | |||
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 | |||
*/ | |||
leapDays: function (y) { | |||
if (this.leapMonth(y)) { | |||
return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29) | |||
} | |||
return (0) | |||
}, | |||
/** | |||
* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 | |||
* @param lunar Year | |||
* @return Number (-1、29、30) | |||
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 | |||
*/ | |||
monthDays: function (y, m) { | |||
if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1 | |||
return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29) | |||
}, | |||
/** | |||
* 返回公历(!)y年m月的天数 | |||
* @param solar Year | |||
* @return Number (-1、28、29、30、31) | |||
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 | |||
*/ | |||
solarDays: function (y, m) { | |||
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 | |||
var ms = m - 1 | |||
if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29 | |||
return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28) | |||
} else { | |||
return (this.solarMonth[ms]) | |||
} | |||
}, | |||
/** | |||
* 农历年份转换为干支纪年 | |||
* @param lYear 农历年的年份数 | |||
* @return Cn string | |||
*/ | |||
toGanZhiYear: function (lYear) { | |||
var ganKey = (lYear - 3) % 10 | |||
var zhiKey = (lYear - 3) % 12 | |||
if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干 | |||
if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支 | |||
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1] | |||
}, | |||
/** | |||
* 公历月、日判断所属星座 | |||
* @param cMonth [description] | |||
* @param cDay [description] | |||
* @return Cn string | |||
*/ | |||
toAstro: function (cMonth, cDay) { | |||
var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf' | |||
var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22] | |||
return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座 | |||
}, | |||
/** | |||
* 传入offset偏移量返回干支 | |||
* @param offset 相对甲子的偏移量 | |||
* @return Cn string | |||
*/ | |||
toGanZhi: function (offset) { | |||
return this.Gan[offset % 10] + this.Zhi[offset % 12] | |||
}, | |||
/** | |||
* 传入公历(!)y年获得该年第n个节气的公历日期 | |||
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 | |||
* @return day Number | |||
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 | |||
*/ | |||
getTerm: function (y, n) { | |||
if (y < 1900 || y > 2100) { return -1 } | |||
if (n < 1 || n > 24) { return -1 } | |||
var _table = this.sTermInfo[y - 1900] | |||
var _info = [ | |||
parseInt('0x' + _table.substr(0, 5)).toString(), | |||
parseInt('0x' + _table.substr(5, 5)).toString(), | |||
parseInt('0x' + _table.substr(10, 5)).toString(), | |||
parseInt('0x' + _table.substr(15, 5)).toString(), | |||
parseInt('0x' + _table.substr(20, 5)).toString(), | |||
parseInt('0x' + _table.substr(25, 5)).toString() | |||
] | |||
var _calday = [ | |||
_info[0].substr(0, 1), | |||
_info[0].substr(1, 2), | |||
_info[0].substr(3, 1), | |||
_info[0].substr(4, 2), | |||
_info[1].substr(0, 1), | |||
_info[1].substr(1, 2), | |||
_info[1].substr(3, 1), | |||
_info[1].substr(4, 2), | |||
_info[2].substr(0, 1), | |||
_info[2].substr(1, 2), | |||
_info[2].substr(3, 1), | |||
_info[2].substr(4, 2), | |||
_info[3].substr(0, 1), | |||
_info[3].substr(1, 2), | |||
_info[3].substr(3, 1), | |||
_info[3].substr(4, 2), | |||
_info[4].substr(0, 1), | |||
_info[4].substr(1, 2), | |||
_info[4].substr(3, 1), | |||
_info[4].substr(4, 2), | |||
_info[5].substr(0, 1), | |||
_info[5].substr(1, 2), | |||
_info[5].substr(3, 1), | |||
_info[5].substr(4, 2) | |||
] | |||
return parseInt(_calday[n - 1]) | |||
}, | |||
/** | |||
* 传入农历数字月份返回汉语通俗表示法 | |||
* @param lunar month | |||
* @return Cn string | |||
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' | |||
*/ | |||
toChinaMonth: function (m) { // 月 => \u6708 | |||
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1 | |||
var s = this.nStr3[m - 1] | |||
s += '\u6708'// 加上月字 | |||
return s | |||
}, | |||
/** | |||
* 传入农历日期数字返回汉字表示法 | |||
* @param lunar day | |||
* @return Cn string | |||
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' | |||
*/ | |||
toChinaDay: function (d) { // 日 => \u65e5 | |||
var s | |||
switch (d) { | |||
case 10: | |||
s = '\u521d\u5341'; break | |||
case 20: | |||
s = '\u4e8c\u5341'; break | |||
break | |||
case 30: | |||
s = '\u4e09\u5341'; break | |||
break | |||
default : | |||
s = this.nStr2[Math.floor(d / 10)] | |||
s += this.nStr1[d % 10] | |||
} | |||
return (s) | |||
}, | |||
/** | |||
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” | |||
* @param y year | |||
* @return Cn string | |||
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' | |||
*/ | |||
getAnimal: function (y) { | |||
return this.Animals[(y - 4) % 12] | |||
}, | |||
/** | |||
* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON | |||
* @param y solar year | |||
* @param m solar month | |||
* @param d solar day | |||
* @return JSON object | |||
* @eg:console.log(calendar.solar2lunar(1987,11,01)); | |||
*/ | |||
solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31 | |||
// 年份限定、上限 | |||
if (y < 1900 || y > 2100) { | |||
return -1// undefined转换为数字变为NaN | |||
} | |||
// 公历传参最下限 | |||
if (y == 1900 && m == 1 && d < 31) { | |||
return -1 | |||
} | |||
// 未传参 获得当天 | |||
if (!y) { | |||
var objDate = new Date() | |||
} else { | |||
var objDate = new Date(y, parseInt(m) - 1, d) | |||
} | |||
var i; var leap = 0; var temp = 0 | |||
// 修正ymd参数 | |||
var y = objDate.getFullYear() | |||
var m = objDate.getMonth() + 1 | |||
var d = objDate.getDate() | |||
var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000 | |||
for (i = 1900; i < 2101 && offset > 0; i++) { | |||
temp = this.lYearDays(i) | |||
offset -= temp | |||
} | |||
if (offset < 0) { | |||
offset += temp; i-- | |||
} | |||
// 是否今天 | |||
var isTodayObj = new Date() | |||
var isToday = false | |||
if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { | |||
isToday = true | |||
} | |||
// 星期几 | |||
var nWeek = objDate.getDay() | |||
var cWeek = this.nStr1[nWeek] | |||
// 数字表示周几顺应天朝周一开始的惯例 | |||
if (nWeek == 0) { | |||
nWeek = 7 | |||
} | |||
// 农历年 | |||
var year = i | |||
var leap = this.leapMonth(i) // 闰哪个月 | |||
var isLeap = false | |||
// 效验闰月 | |||
for (i = 1; i < 13 && offset > 0; i++) { | |||
// 闰月 | |||
if (leap > 0 && i == (leap + 1) && isLeap == false) { | |||
--i | |||
isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数 | |||
} else { | |||
temp = this.monthDays(year, i)// 计算农历普通月天数 | |||
} | |||
// 解除闰月 | |||
if (isLeap == true && i == (leap + 1)) { isLeap = false } | |||
offset -= temp | |||
} | |||
// 闰月导致数组下标重叠取反 | |||
if (offset == 0 && leap > 0 && i == leap + 1) { | |||
if (isLeap) { | |||
isLeap = false | |||
} else { | |||
isLeap = true; --i | |||
} | |||
} | |||
if (offset < 0) { | |||
offset += temp; --i | |||
} | |||
// 农历月 | |||
var month = i | |||
// 农历日 | |||
var day = offset + 1 | |||
// 天干地支处理 | |||
var sm = m - 1 | |||
var gzY = this.toGanZhiYear(year) | |||
// 当月的两个节气 | |||
// bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` | |||
var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始 | |||
var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始 | |||
// 依据12节气修正干支月 | |||
var gzM = this.toGanZhi((y - 1900) * 12 + m + 11) | |||
if (d >= firstNode) { | |||
gzM = this.toGanZhi((y - 1900) * 12 + m + 12) | |||
} | |||
// 传入的日期的节气与否 | |||
var isTerm = false | |||
var Term = null | |||
if (firstNode == d) { | |||
isTerm = true | |||
Term = this.solarTerm[m * 2 - 2] | |||
} | |||
if (secondNode == d) { | |||
isTerm = true | |||
Term = this.solarTerm[m * 2 - 1] | |||
} | |||
// 日柱 当月一日与 1900/1/1 相差天数 | |||
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10 | |||
var gzD = this.toGanZhi(dayCyclical + d - 1) | |||
// 该日期所属的星座 | |||
var astro = this.toAstro(m, d) | |||
return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro } | |||
}, | |||
/** | |||
* 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON | |||
* @param y lunar year | |||
* @param m lunar month | |||
* @param d lunar day | |||
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] | |||
* @return JSON object | |||
* @eg:console.log(calendar.lunar2solar(1987,9,10)); | |||
*/ | |||
lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1 | |||
var isLeapMonth = !!isLeapMonth | |||
var leapOffset = 0 | |||
var leapMonth = this.leapMonth(y) | |||
var leapDay = this.leapDays(y) | |||
if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 | |||
if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值 | |||
var day = this.monthDays(y, m) | |||
var _day = day | |||
// bugFix 2016-9-25 | |||
// if month is leap, _day use leapDays method | |||
if (isLeapMonth) { | |||
_day = this.leapDays(y, m) | |||
} | |||
if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验 | |||
// 计算农历的时间差 | |||
var offset = 0 | |||
for (var i = 1900; i < y; i++) { | |||
offset += this.lYearDays(i) | |||
} | |||
var leap = 0; var isAdd = false | |||
for (var i = 1; i < m; i++) { | |||
leap = this.leapMonth(y) | |||
if (!isAdd) { // 处理闰月 | |||
if (leap <= i && leap > 0) { | |||
offset += this.leapDays(y); isAdd = true | |||
} | |||
} | |||
offset += this.monthDays(y, i) | |||
} | |||
// 转换闰月农历 需补充该年闰月的前一个月的时差 | |||
if (isLeapMonth) { offset += day } | |||
// 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) | |||
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0) | |||
var calObj = new Date((offset + d - 31) * 86400000 + stmap) | |||
var cY = calObj.getUTCFullYear() | |||
var cM = calObj.getUTCMonth() + 1 | |||
var cD = calObj.getUTCDate() | |||
return this.solar2lunar(cY, cM, cD) | |||
} | |||
} | |||
export default calendar |
@@ -0,0 +1,170 @@ | |||
<template> | |||
<view class="uni-calendar-item__weeks-box" :class="{ | |||
'uni-calendar-item--disable':weeks.disable, | |||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, | |||
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) , | |||
'uni-calendar-item--before-checked':weeks.beforeMultiple, | |||
'uni-calendar-item--multiple': weeks.multiple, | |||
'uni-calendar-item--after-checked':weeks.afterMultiple, | |||
}" | |||
@click="choiceDate(weeks)"> | |||
<view class="uni-calendar-item__weeks-box-item"> | |||
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text> | |||
<text class="uni-calendar-item__weeks-box-text" :class="{ | |||
'uni-calendar-item--isDay-text': weeks.isDay, | |||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, | |||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, | |||
'uni-calendar-item--before-checked':weeks.beforeMultiple, | |||
'uni-calendar-item--multiple': weeks.multiple, | |||
'uni-calendar-item--after-checked':weeks.afterMultiple, | |||
'uni-calendar-item--disable':weeks.disable, | |||
}">{{weeks.date}}</text> | |||
<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{ | |||
'uni-calendar-item--isDay-text':weeks.isDay, | |||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, | |||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, | |||
'uni-calendar-item--before-checked':weeks.beforeMultiple, | |||
'uni-calendar-item--multiple': weeks.multiple, | |||
'uni-calendar-item--after-checked':weeks.afterMultiple, | |||
}">今天</text> | |||
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{ | |||
'uni-calendar-item--isDay-text':weeks.isDay, | |||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, | |||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, | |||
'uni-calendar-item--before-checked':weeks.beforeMultiple, | |||
'uni-calendar-item--multiple': weeks.multiple, | |||
'uni-calendar-item--after-checked':weeks.afterMultiple, | |||
'uni-calendar-item--disable':weeks.disable, | |||
}">{{weeks.isDay?'今天': (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text> | |||
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{ | |||
'uni-calendar-item--extra':weeks.extraInfo.info, | |||
'uni-calendar-item--isDay-text':weeks.isDay, | |||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, | |||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, | |||
'uni-calendar-item--before-checked':weeks.beforeMultiple, | |||
'uni-calendar-item--multiple': weeks.multiple, | |||
'uni-calendar-item--after-checked':weeks.afterMultiple, | |||
'uni-calendar-item--disable':weeks.disable, | |||
}">{{weeks.extraInfo.info}}</text> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
props: { | |||
weeks: { | |||
type: Object, | |||
default () { | |||
return {} | |||
} | |||
}, | |||
calendar: { | |||
type: Object, | |||
default: () => { | |||
return {} | |||
} | |||
}, | |||
selected: { | |||
type: Array, | |||
default: () => { | |||
return [] | |||
} | |||
}, | |||
lunar: { | |||
type: Boolean, | |||
default: false | |||
} | |||
}, | |||
methods: { | |||
choiceDate(weeks) { | |||
this.$emit('change', weeks) | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="scss" scoped> | |||
.uni-calendar-item__weeks-box { | |||
flex: 1; | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: column; | |||
justify-content: center; | |||
align-items: center; | |||
} | |||
.uni-calendar-item__weeks-box-text { | |||
font-size: $uni-font-size-base; | |||
color: $uni-text-color; | |||
} | |||
.uni-calendar-item__weeks-lunar-text { | |||
font-size: $uni-font-size-sm; | |||
color: $uni-text-color; | |||
} | |||
.uni-calendar-item__weeks-box-item { | |||
position: relative; | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: column; | |||
justify-content: center; | |||
align-items: center; | |||
width: 100rpx; | |||
height: 100rpx; | |||
} | |||
.uni-calendar-item__weeks-box-circle { | |||
position: absolute; | |||
top: 5px; | |||
right: 5px; | |||
width: 8px; | |||
height: 8px; | |||
border-radius: 8px; | |||
background-color: $uni-color-error; | |||
} | |||
.uni-calendar-item--disable { | |||
background-color: rgba(249, 249, 249, $uni-opacity-disabled); | |||
color: $uni-text-color-disable; | |||
} | |||
.uni-calendar-item--isDay-text { | |||
color: $uni-color-primary; | |||
} | |||
.uni-calendar-item--isDay { | |||
background-color: $uni-color-primary; | |||
opacity: 0.8; | |||
color: #fff; | |||
} | |||
.uni-calendar-item--extra { | |||
color: $uni-color-error; | |||
opacity: 0.8; | |||
} | |||
.uni-calendar-item--checked { | |||
background-color: $uni-color-primary; | |||
color: #fff; | |||
opacity: 0.8; | |||
} | |||
.uni-calendar-item--multiple { | |||
background-color: $uni-color-primary; | |||
color: #fff; | |||
opacity: 0.8; | |||
} | |||
.uni-calendar-item--before-checked { | |||
background-color: #ff5a5f; | |||
color: #fff; | |||
} | |||
.uni-calendar-item--after-checked { | |||
background-color: #ff5a5f; | |||
color: #fff; | |||
} | |||
</style> |
@@ -0,0 +1,505 @@ | |||
<template> | |||
<view class="uni-calendar"> | |||
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" @click="clean"></view> | |||
<view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}"> | |||
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top"> | |||
<view class="uni-calendar__header-btn-box" @click="close"> | |||
<text class="uni-calendar__header-text uni-calendar--fixed-width">取消</text> | |||
</view> | |||
<view class="uni-calendar__header-btn-box" @click="confirm"> | |||
<text class="uni-calendar__header-text uni-calendar--fixed-width">确定</text> | |||
</view> | |||
</view> | |||
<view class="uni-calendar__header"> | |||
<view class="uni-calendar__header-btn-box" @click.stop="pre"> | |||
<view class="uni-calendar__header-btn uni-calendar--left"></view> | |||
</view> | |||
<picker mode="date" :value="date" fields="month" @change="bindDateChange"> | |||
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +'年'+( nowDate.month||'') +'月'}}</text> | |||
</picker> | |||
<view class="uni-calendar__header-btn-box" @click.stop="next"> | |||
<view class="uni-calendar__header-btn uni-calendar--right"></view> | |||
</view> | |||
<text class="uni-calendar__backtoday" @click="backtoday">回到今天</text> | |||
</view> | |||
<view class="uni-calendar__box"> | |||
<view v-if="showMonth" class="uni-calendar__box-bg"> | |||
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text> | |||
</view> | |||
<view class="uni-calendar__weeks"> | |||
<view class="uni-calendar__weeks-day"> | |||
<text class="uni-calendar__weeks-day-text">日</text> | |||
</view> | |||
<view class="uni-calendar__weeks-day"> | |||
<text class="uni-calendar__weeks-day-text">一</text> | |||
</view> | |||
<view class="uni-calendar__weeks-day"> | |||
<text class="uni-calendar__weeks-day-text">二</text> | |||
</view> | |||
<view class="uni-calendar__weeks-day"> | |||
<text class="uni-calendar__weeks-day-text">三</text> | |||
</view> | |||
<view class="uni-calendar__weeks-day"> | |||
<text class="uni-calendar__weeks-day-text">四</text> | |||
</view> | |||
<view class="uni-calendar__weeks-day"> | |||
<text class="uni-calendar__weeks-day-text">五</text> | |||
</view> | |||
<view class="uni-calendar__weeks-day"> | |||
<text class="uni-calendar__weeks-day-text">六</text> | |||
</view> | |||
</view> | |||
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex"> | |||
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex"> | |||
<calendar-item :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import Calendar from './util.js'; | |||
import calendarItem from './uni-calendar-item.vue' | |||
/** | |||
* Calendar 日历 | |||
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等 | |||
* @tutorial https://ext.dcloud.net.cn/plugin?id=56 | |||
* @property {String} date 自定义当前时间,默认为今天 | |||
* @property {Boolean} lunar 显示农历 | |||
* @property {String} startDate 日期选择范围-开始日期 | |||
* @property {String} endDate 日期选择范围-结束日期 | |||
* @property {Boolean} range 范围选择 | |||
* @property {Boolean} insert = [true|false] 插入模式,默认为false | |||
* @value true 弹窗模式 | |||
* @value false 插入模式 | |||
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容 | |||
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] | |||
* @property {Boolean} showMonth 是否选择月份为背景 | |||
* @event {Function} change 日期改变,`insert :ture` 时生效 | |||
* @event {Function} confirm 确认选择`insert :false` 时生效 | |||
* @event {Function} monthSwitch 切换月份时触发 | |||
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" /> | |||
*/ | |||
export default { | |||
components: { | |||
calendarItem | |||
}, | |||
props: { | |||
date: { | |||
type: String, | |||
default: '' | |||
}, | |||
selected: { | |||
type: Array, | |||
default () { | |||
return [] | |||
} | |||
}, | |||
lunar: { | |||
type: Boolean, | |||
default: false | |||
}, | |||
startDate: { | |||
type: String, | |||
default: '' | |||
}, | |||
endDate: { | |||
type: String, | |||
default: '' | |||
}, | |||
range: { | |||
type: Boolean, | |||
default: false | |||
}, | |||
insert: { | |||
type: Boolean, | |||
default: true | |||
}, | |||
showMonth: { | |||
type: Boolean, | |||
default: true | |||
}, | |||
clearDate: { | |||
type: Boolean, | |||
default: true | |||
} | |||
}, | |||
data() { | |||
return { | |||
show: false, | |||
weeks: [], | |||
calendar: {}, | |||
nowDate: '', | |||
aniMaskShow: false | |||
} | |||
}, | |||
watch: { | |||
date(newVal) { | |||
this.cale.setDate(newVal) | |||
this.init(this.cale.selectDate.fullDate) | |||
}, | |||
startDate(val){ | |||
this.cale.resetSatrtDate(val) | |||
}, | |||
endDate(val){ | |||
this.cale.resetEndDate(val) | |||
}, | |||
selected(newVal) { | |||
this.cale.setSelectInfo(this.nowDate.fullDate, newVal) | |||
this.weeks = this.cale.weeks | |||
} | |||
}, | |||
created() { | |||
// 获取日历方法实例 | |||
this.cale = new Calendar({ | |||
// date: new Date(), | |||
selected: this.selected, | |||
startDate: this.startDate, | |||
endDate: this.endDate, | |||
range: this.range, | |||
}) | |||
// 选中某一天 | |||
this.cale.setDate(this.date) | |||
this.init(this.cale.selectDate.fullDate) | |||
// this.setDay | |||
}, | |||
methods: { | |||
// 取消穿透 | |||
clean() {}, | |||
bindDateChange(e) { | |||
const value = e.detail.value + '-1' | |||
console.log(this.cale.getDate(value)); | |||
this.cale.setDate(value) | |||
this.init(value) | |||
}, | |||
/** | |||
* 初始化日期显示 | |||
* @param {Object} date | |||
*/ | |||
init(date) { | |||
this.weeks = this.cale.weeks | |||
this.nowDate = this.calendar = this.cale.getInfo(date) | |||
}, | |||
/** | |||
* 打开日历弹窗 | |||
*/ | |||
open() { | |||
// 弹窗模式并且清理数据 | |||
if (this.clearDate && !this.insert) { | |||
this.cale.cleanMultipleStatus() | |||
this.cale.setDate(this.date) | |||
this.init(this.cale.selectDate.fullDate) | |||
} | |||
this.show = true | |||
this.$nextTick(() => { | |||
setTimeout(() => { | |||
this.aniMaskShow = true | |||
}, 50) | |||
}) | |||
}, | |||
/** | |||
* 关闭日历弹窗 | |||
*/ | |||
close() { | |||
this.aniMaskShow = false | |||
this.$nextTick(() => { | |||
setTimeout(() => { | |||
this.show = false | |||
this.$emit('close') | |||
}, 300) | |||
}) | |||
}, | |||
/** | |||
* 确认按钮 | |||
*/ | |||
confirm() { | |||
this.setEmit('confirm') | |||
this.close() | |||
}, | |||
/** | |||
* 变化触发 | |||
*/ | |||
change() { | |||
if (!this.insert) return | |||
this.setEmit('change') | |||
}, | |||
/** | |||
* 选择月份触发 | |||
*/ | |||
monthSwitch() { | |||
let { | |||
year, | |||
month | |||
} = this.nowDate | |||
this.$emit('monthSwitch', { | |||
year, | |||
month: Number(month) | |||
}) | |||
}, | |||
/** | |||
* 派发事件 | |||
* @param {Object} name | |||
*/ | |||
setEmit(name) { | |||
let { | |||
year, | |||
month, | |||
date, | |||
fullDate, | |||
lunar, | |||
extraInfo | |||
} = this.calendar | |||
this.$emit(name, { | |||
range: this.cale.multipleStatus, | |||
year, | |||
month, | |||
date, | |||
fulldate: fullDate, | |||
lunar, | |||
extraInfo: extraInfo || {} | |||
}) | |||
}, | |||
/** | |||
* 选择天触发 | |||
* @param {Object} weeks | |||
*/ | |||
choiceDate(weeks) { | |||
if (weeks.disable) return | |||
this.calendar = weeks | |||
// 设置多选 | |||
this.cale.setMultiple(this.calendar.fullDate) | |||
this.weeks = this.cale.weeks | |||
this.change() | |||
}, | |||
/** | |||
* 回到今天 | |||
*/ | |||
backtoday() { | |||
console.log(this.cale.getDate(new Date()).fullDate); | |||
let date = this.cale.getDate(new Date()).fullDate | |||
this.cale.setDate(date) | |||
this.init(date) | |||
this.change() | |||
}, | |||
/** | |||
* 上个月 | |||
*/ | |||
pre() { | |||
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate | |||
this.setDate(preDate) | |||
this.monthSwitch() | |||
}, | |||
/** | |||
* 下个月 | |||
*/ | |||
next() { | |||
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate | |||
this.setDate(nextDate) | |||
this.monthSwitch() | |||
}, | |||
/** | |||
* 设置日期 | |||
* @param {Object} date | |||
*/ | |||
setDate(date) { | |||
this.cale.setDate(date) | |||
this.weeks = this.cale.weeks | |||
this.nowDate = this.cale.getInfo(date) | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="scss" scoped> | |||
.uni-calendar { | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: column; | |||
} | |||
.uni-calendar__mask { | |||
position: fixed; | |||
bottom: 0; | |||
top: 0; | |||
left: 0; | |||
right: 0; | |||
background-color: $uni-bg-color-mask; | |||
transition-property: opacity; | |||
transition-duration: 0.3s; | |||
opacity: 0; | |||
/* #ifndef APP-NVUE */ | |||
z-index: 99; | |||
/* #endif */ | |||
} | |||
.uni-calendar--mask-show { | |||
opacity: 1 | |||
} | |||
.uni-calendar--fixed { | |||
position: fixed; | |||
bottom: 0; | |||
left: 0; | |||
right: 0; | |||
transition-property: transform; | |||
transition-duration: 0.3s; | |||
transform: translateY(460px); | |||
/* #ifndef APP-NVUE */ | |||
z-index: 99; | |||
/* #endif */ | |||
} | |||
.uni-calendar--ani-show { | |||
transform: translateY(0); | |||
} | |||
.uni-calendar__content { | |||
background-color: #fff; | |||
} | |||
.uni-calendar__header { | |||
position: relative; | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: row; | |||
justify-content: center; | |||
align-items: center; | |||
height: 50px; | |||
border-bottom-color: $uni-border-color; | |||
border-bottom-style: solid; | |||
border-bottom-width: 1px; | |||
} | |||
.uni-calendar--fixed-top { | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: row; | |||
justify-content: space-between; | |||
border-top-color: $uni-border-color; | |||
border-top-style: solid; | |||
border-top-width: 1px; | |||
} | |||
.uni-calendar--fixed-width { | |||
width: 50px; | |||
// padding: 0 15px; | |||
} | |||
.uni-calendar__backtoday { | |||
position: absolute; | |||
right: 0; | |||
top: 25rpx; | |||
padding: 0 5px; | |||
padding-left: 10px; | |||
height: 25px; | |||
line-height: 25px; | |||
font-size: 12px; | |||
border-top-left-radius: 25px; | |||
border-bottom-left-radius: 25px; | |||
color: $uni-text-color; | |||
background-color: $uni-bg-color-hover; | |||
} | |||
.uni-calendar__header-text { | |||
text-align: center; | |||
width: 100px; | |||
font-size: $uni-font-size-base; | |||
color: $uni-text-color; | |||
} | |||
.uni-calendar__header-btn-box { | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: row; | |||
align-items: center; | |||
justify-content: center; | |||
width: 50px; | |||
height: 50px; | |||
} | |||
.uni-calendar__header-btn { | |||
width: 10px; | |||
height: 10px; | |||
border-left-color: $uni-text-color-placeholder; | |||
border-left-style: solid; | |||
border-left-width: 2px; | |||
border-top-color: $uni-color-subtitle; | |||
border-top-style: solid; | |||
border-top-width: 2px; | |||
} | |||
.uni-calendar--left { | |||
transform: rotate(-45deg); | |||
} | |||
.uni-calendar--right { | |||
transform: rotate(135deg); | |||
} | |||
.uni-calendar__weeks { | |||
position: relative; | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: row; | |||
} | |||
.uni-calendar__weeks-item { | |||
flex: 1; | |||
} | |||
.uni-calendar__weeks-day { | |||
flex: 1; | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
flex-direction: column; | |||
justify-content: center; | |||
align-items: center; | |||
height: 45px; | |||
border-bottom-color: #F5F5F5; | |||
border-bottom-style: solid; | |||
border-bottom-width: 1px; | |||
} | |||
.uni-calendar__weeks-day-text { | |||
font-size: 14px; | |||
} | |||
.uni-calendar__box { | |||
position: relative; | |||
} | |||
.uni-calendar__box-bg { | |||
/* #ifndef APP-NVUE */ | |||
display: flex; | |||
/* #endif */ | |||
justify-content: center; | |||
align-items: center; | |||
position: absolute; | |||
top: 0; | |||
left: 0; | |||
right: 0; | |||
bottom: 0; | |||
} | |||
.uni-calendar__box-bg-text { | |||
font-size: 200px; | |||
font-weight: bold; | |||
color: $uni-text-color-grey; | |||
opacity: 0.1; | |||
text-align: center; | |||
/* #ifndef APP-NVUE */ | |||
line-height: 1; | |||
/* #endif */ | |||
} | |||
</style> |
@@ -0,0 +1,352 @@ | |||
import CALENDAR from './calendar.js' | |||
class Calendar { | |||
constructor({ | |||
date, | |||
selected, | |||
startDate, | |||
endDate, | |||
range | |||
} = {}) { | |||
// 当前日期 | |||
this.date = this.getDate(new Date()) // 当前初入日期 | |||
// 打点信息 | |||
this.selected = selected || []; | |||
// 范围开始 | |||
this.startDate = startDate | |||
// 范围结束 | |||
this.endDate = endDate | |||
this.range = range | |||
// 多选状态 | |||
this.cleanMultipleStatus() | |||
// 每周日期 | |||
this.weeks = {} | |||
// this._getWeek(this.date.fullDate) | |||
} | |||
/** | |||
* 设置日期 | |||
* @param {Object} date | |||
*/ | |||
setDate(date) { | |||
this.selectDate = this.getDate(date) | |||
this._getWeek(this.selectDate.fullDate) | |||
} | |||
/** | |||
* 清理多选状态 | |||
*/ | |||
cleanMultipleStatus() { | |||
this.multipleStatus = { | |||
before: '', | |||
after: '', | |||
data: [] | |||
} | |||
} | |||
/** | |||
* 重置开始日期 | |||
*/ | |||
resetSatrtDate(startDate) { | |||
// 范围开始 | |||
this.startDate = startDate | |||
} | |||
/** | |||
* 重置结束日期 | |||
*/ | |||
resetEndDate(endDate) { | |||
// 范围结束 | |||
this.endDate = endDate | |||
} | |||
/** | |||
* 获取任意时间 | |||
*/ | |||
getDate(date, AddDayCount = 0, str = 'day') { | |||
if (!date) { | |||
date = new Date() | |||
} | |||
if (typeof date !== 'object') { | |||
date = date.replace(/-/g, '/') | |||
} | |||
const dd = new Date(date) | |||
switch (str) { | |||
case 'day': | |||
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期 | |||
break | |||
case 'month': | |||
if (dd.getDate() === 31) { | |||
dd.setDate(dd.getDate() + AddDayCount) | |||
} else { | |||
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期 | |||
} | |||
break | |||
case 'year': | |||
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期 | |||
break | |||
} | |||
const y = dd.getFullYear() | |||
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0 | |||
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0 | |||
return { | |||
fullDate: y + '-' + m + '-' + d, | |||
year: y, | |||
month: m, | |||
date: d, | |||
day: dd.getDay() | |||
} | |||
} | |||
/** | |||
* 获取上月剩余天数 | |||
*/ | |||
_getLastMonthDays(firstDay, full) { | |||
let dateArr = [] | |||
for (let i = firstDay; i > 0; i--) { | |||
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() | |||
dateArr.push({ | |||
date: beforeDate, | |||
month: full.month - 1, | |||
lunar: this.getlunar(full.year, full.month - 1, beforeDate), | |||
disable: true | |||
}) | |||
} | |||
return dateArr | |||
} | |||
/** | |||
* 获取本月天数 | |||
*/ | |||
_currentMonthDys(dateData, full) { | |||
let dateArr = [] | |||
let fullDate = this.date.fullDate | |||
for (let i = 1; i <= dateData; i++) { | |||
let isinfo = false | |||
let nowDate = full.year + '-' + (full.month < 10 ? | |||
full.month : full.month) + '-' + (i < 10 ? | |||
'0' + i : i) | |||
// 是否今天 | |||
let isDay = fullDate === nowDate | |||
// 获取打点信息 | |||
let info = this.selected && this.selected.find((item) => { | |||
if (this.dateEqual(nowDate, item.date)) { | |||
return item | |||
} | |||
}) | |||
// 日期禁用 | |||
let disableBefore = true | |||
let disableAfter = true | |||
if (this.startDate) { | |||
let dateCompBefore = this.dateCompare(this.startDate, fullDate) | |||
disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate) | |||
} | |||
if (this.endDate) { | |||
let dateCompAfter = this.dateCompare(fullDate, this.endDate) | |||
disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate) | |||
} | |||
let multiples = this.multipleStatus.data | |||
let checked = false | |||
let multiplesStatus = -1 | |||
if (this.range) { | |||
if (multiples) { | |||
multiplesStatus = multiples.findIndex((item) => { | |||
return this.dateEqual(item, nowDate) | |||
}) | |||
} | |||
if (multiplesStatus !== -1) { | |||
checked = true | |||
} | |||
} | |||
let data = { | |||
fullDate: nowDate, | |||
year: full.year, | |||
date: i, | |||
multiple: this.range ? checked : false, | |||
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate), | |||
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate), | |||
month: full.month, | |||
lunar: this.getlunar(full.year, full.month, i), | |||
disable: !disableBefore || !disableAfter, | |||
isDay | |||
} | |||
if (info) { | |||
data.extraInfo = info | |||
} | |||
dateArr.push(data) | |||
} | |||
return dateArr | |||
} | |||
/** | |||
* 获取下月天数 | |||
*/ | |||
_getNextMonthDays(surplus, full) { | |||
let dateArr = [] | |||
for (let i = 1; i < surplus + 1; i++) { | |||
dateArr.push({ | |||
date: i, | |||
month: Number(full.month) + 1, | |||
lunar: this.getlunar(full.year, Number(full.month) + 1, i), | |||
disable: true | |||
}) | |||
} | |||
return dateArr | |||
} | |||
/** | |||
* 获取当前日期详情 | |||
* @param {Object} date | |||
*/ | |||
getInfo(date) { | |||
if (!date) { | |||
date = new Date() | |||
} | |||
const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) | |||
return dateInfo | |||
} | |||
/** | |||
* 比较时间大小 | |||
*/ | |||
dateCompare(startDate, endDate) { | |||
// 计算截止时间 | |||
startDate = new Date(startDate.replace('-', '/').replace('-', '/')) | |||
// 计算详细项的截止时间 | |||
endDate = new Date(endDate.replace('-', '/').replace('-', '/')) | |||
if (startDate <= endDate) { | |||
return true | |||
} else { | |||
return false | |||
} | |||
} | |||
/** | |||
* 比较时间是否相等 | |||
*/ | |||
dateEqual(before, after) { | |||
// 计算截止时间 | |||
before = new Date(before.replace('-', '/').replace('-', '/')) | |||
// 计算详细项的截止时间 | |||
after = new Date(after.replace('-', '/').replace('-', '/')) | |||
if (before.getTime() - after.getTime() === 0) { | |||
return true | |||
} else { | |||
return false | |||
} | |||
} | |||
/** | |||
* 获取日期范围内所有日期 | |||
* @param {Object} begin | |||
* @param {Object} end | |||
*/ | |||
geDateAll(begin, end) { | |||
var arr = [] | |||
var ab = begin.split('-') | |||
var ae = end.split('-') | |||
var db = new Date() | |||
db.setFullYear(ab[0], ab[1] - 1, ab[2]) | |||
var de = new Date() | |||
de.setFullYear(ae[0], ae[1] - 1, ae[2]) | |||
var unixDb = db.getTime() - 24 * 60 * 60 * 1000 | |||
var unixDe = de.getTime() - 24 * 60 * 60 * 1000 | |||
for (var k = unixDb; k <= unixDe;) { | |||
k = k + 24 * 60 * 60 * 1000 | |||
arr.push(this.getDate(new Date(parseInt(k))).fullDate) | |||
} | |||
return arr | |||
} | |||
/** | |||
* 计算阴历日期显示 | |||
*/ | |||
getlunar(year, month, date) { | |||
return CALENDAR.solar2lunar(year, month, date) | |||
} | |||
/** | |||
* 设置打点 | |||
*/ | |||
setSelectInfo(data, value) { | |||
this.selected = value | |||
this._getWeek(data) | |||
} | |||
/** | |||
* 获取多选状态 | |||
*/ | |||
setMultiple(fullDate) { | |||
let { | |||
before, | |||
after | |||
} = this.multipleStatus | |||
if (!this.range) return | |||
if (before && after) { | |||
this.multipleStatus.before = '' | |||
this.multipleStatus.after = '' | |||
this.multipleStatus.data = [] | |||
} else { | |||
if (!before) { | |||
this.multipleStatus.before = fullDate | |||
} else { | |||
this.multipleStatus.after = fullDate | |||
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { | |||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); | |||
} else { | |||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); | |||
} | |||
} | |||
} | |||
this._getWeek(fullDate) | |||
} | |||
/** | |||
* 获取每周数据 | |||
* @param {Object} dateData | |||
*/ | |||
_getWeek(dateData) { | |||
const { | |||
fullDate, | |||
year, | |||
month, | |||
date, | |||
day | |||
} = this.getDate(dateData) | |||
let firstDay = new Date(year, month - 1, 1).getDay() | |||
let currentDay = new Date(year, month, 0).getDate() | |||
let dates = { | |||
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天 | |||
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数 | |||
nextMonthDays: [], // 下个月开始几天 | |||
weeks: [] | |||
} | |||
let canlender = [] | |||
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) | |||
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) | |||
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) | |||
let weeks = {} | |||
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天 | |||
for (let i = 0; i < canlender.length; i++) { | |||
if (i % 7 === 0) { | |||
weeks[parseInt(i / 7)] = new Array(7) | |||
} | |||
weeks[parseInt(i / 7)][i % 7] = canlender[i] | |||
} | |||
this.canlender = canlender | |||
this.weeks = weeks | |||
} | |||
//静态方法 | |||
// static init(date) { | |||
// if (!this.instance) { | |||
// this.instance = new Calendar(date); | |||
// } | |||
// return this.instance; | |||
// } | |||
} | |||
export default Calendar |
@@ -0,0 +1,11 @@ | |||
import Request from "@/static/xuan-linkAddress/request.js" | |||
//创建Request对象 | |||
let request=new Request(); | |||
export default{ | |||
//data 参数值 | |||
get_linkAddress_api:function(data){ | |||
console.log(data); | |||
return request.http('/api/address/area',data,'GET'); | |||
} | |||
} |
@@ -0,0 +1,408 @@ | |||
<template> | |||
<view class="popup-layout-wrap " :class="popuplayoutClass" > | |||
<view class="popup-layout-content" :class="popupContentClass" :style="[{height:height}]"> | |||
<view class="link-address-wrap"> | |||
<view class="link-adress-content"> | |||
<view class="head-wrap"> | |||
<text class="cancel" @click="btn_cancel">取消</text> | |||
<text class="confirm" @click="btn_confirm">确认</text> | |||
</view> | |||
<view class="head-selected"> | |||
<text class="selected-txt">已选择:{{selected_address}}</text> | |||
</view> | |||
<view class="operation-wrap"> | |||
<view class="operation-container"> | |||
<view class="operation-content" v-for="(base_items,base_index) of linkAddress_area"> | |||
<scroll-view | |||
scroll-y="true" | |||
class="province" | |||
show-scrollbar="false"> | |||
<view | |||
@click="choosefun(base_items.clickfun,items.id)" | |||
v-model="items.id" | |||
v-for="(items , index) of base_items.info" | |||
:class="[index==base_items.current ? 'province-txt-click' : 'province-txt']" | |||
> | |||
{{items.name}} | |||
<view class="pic" v-show="index===base_items.current"> | |||
<image src="../../static/xuan-linkAddress/yes.png"></image> | |||
</view> | |||
</view> | |||
</scroll-view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view v-if="maskShow" class="popup-layout-mask" @tap="close(maskClick)"></view> | |||
</view> | |||
</template> | |||
<script> | |||
import linkAddress_p from '../../static/xuan-linkAddress/get_linkAddress_p.js' | |||
export default{ | |||
data(){ | |||
return{ | |||
newActive:"", | |||
newTransition:true, | |||
//省0市1区2 | |||
linkAddress_area:[ | |||
{ | |||
current:null, | |||
info: [], | |||
clickfun:'province_txt_click' | |||
}, | |||
{ | |||
current:null, | |||
info: [], | |||
clickfun:'city_txt_click' | |||
}, | |||
{ | |||
current:null, | |||
info: [], | |||
clickfun:'district_txt_click' | |||
} | |||
], | |||
/*请求提交的*/ | |||
submission:{ | |||
province:'',//省 | |||
city:'',//市 | |||
county:'',//区 | |||
town:''//镇 | |||
}, | |||
/*用户选择的地址*/ | |||
user_address:{ | |||
province:'',//省 | |||
city:'',//市 | |||
district:''//区 | |||
}, | |||
selected_address:'' | |||
}; | |||
}, | |||
props:{ | |||
/*底部弹窗的属性*/ | |||
active:{ | |||
type:Boolean, | |||
default:false | |||
}, | |||
height:{ | |||
type:[String], | |||
default:"100%" | |||
}, | |||
//遮盖层显示 | |||
maskShow:{ | |||
type:Boolean, | |||
default:true | |||
}, | |||
//遮盖层点击 | |||
maskClick:{ | |||
type:Boolean, | |||
default:true | |||
}, | |||
//回掉 | |||
callback:{ | |||
type:Function, | |||
default:function () { | |||
} | |||
}, | |||
}, | |||
computed:{ | |||
popuplayoutClass:function(){ | |||
let _class=""; | |||
if(this.newActive){ | |||
_class+="popup-layout-active"; | |||
} | |||
_class+=" popup-layout-bottom"; | |||
return _class; | |||
}, | |||
popupContentClass:function () { | |||
let _class = ""; | |||
if (this.newTransition&&this.transition!=='none') { | |||
_class+="popup-layout-transition-slider" | |||
} | |||
return _class; | |||
} | |||
}, | |||
methods: { | |||
//显示弹窗 | |||
show:function () { | |||
//提交的数据置为空 | |||
this.submission={ | |||
province:'', | |||
city:'', | |||
county:'', | |||
town:'' | |||
}, | |||
//请求市数据 | |||
linkAddress_p.get_linkAddress(this,"province",this.submission,(revert)=>{ | |||
this.submission.province='1'; | |||
}); | |||
this.newActive = true; | |||
let _this = this; | |||
setTimeout(function () { | |||
_this.newTransition = false; | |||
},50) | |||
}, | |||
//关闭弹窗 | |||
close:function (v) { | |||
let close = v || true; | |||
if (close) { | |||
this.newTransition = true; | |||
let _this=this; | |||
setTimeout(function () { | |||
_this.newActive = false; | |||
},300) | |||
} | |||
}, | |||
//选择点击事件 | |||
choosefun(targetfun,targetid){ | |||
this[targetfun](targetid); | |||
}, | |||
//省点击选择 | |||
province_txt_click(target){ | |||
//区数据置为空 | |||
this.linkAddress_area[2].info= []; | |||
//市、区的选择计数置为null | |||
this.linkAddress_area[1].current=null; | |||
this.linkAddress_area[2].current=null; | |||
let province; | |||
//得到点击的数据,改变样式 | |||
for (let i = 0; i < this.linkAddress_area[0].info.length; i++) { | |||
if (this.linkAddress_area[0].info[i].id === target) { | |||
this.linkAddress_area[0].current = i; | |||
province=this.linkAddress_area[0].info[i].name; | |||
break; | |||
} | |||
} | |||
//用户选择 | |||
this.user_address={ | |||
province:province, | |||
city:'', | |||
district:'' | |||
} | |||
//请求提交的数据先置为空 | |||
this.submission={ | |||
province:'', | |||
city:'', | |||
county:'', | |||
town:'' | |||
}; | |||
//再赋值 | |||
this.submission.province=target; | |||
this.selected_address=this.user_address.province; | |||
//请求市数据 | |||
linkAddress_p.get_linkAddress(this,"city",this.submission,(revert)=>{ | |||
}); | |||
}, | |||
//市点击选择 | |||
city_txt_click(target){ | |||
//区的选择计数置为null | |||
this.linkAddress_area[2].current=null; | |||
let city; | |||
//得到点击的数据,改变样式 | |||
for (let i = 0; i < this.linkAddress_area[1].info.length; i++) { | |||
if (this.linkAddress_area[1].info[i].id === target) { | |||
this.linkAddress_area[1].current = i; | |||
city=this.linkAddress_area[1].info[i].name; | |||
break; | |||
} | |||
} | |||
//得到市 | |||
this.user_address.city=city; | |||
//把区的信息置为空 | |||
this.user_address.district=''; | |||
this.submission.city=target; | |||
this.selected_address=this.user_address.province+"-"+this.user_address.city; | |||
//请求区数据 | |||
linkAddress_p.get_linkAddress(this,"district",this.submission,(revert)=>{ | |||
}); | |||
}, | |||
//区点击选择 | |||
district_txt_click(target){ | |||
let district; | |||
//得到点击的数据,改变样式 | |||
for (let i = 0; i < this.linkAddress_area[2].info.length; i++) { | |||
if (this.linkAddress_area[2].info[i].id === target) { | |||
// this.district_current = i; | |||
this.linkAddress_area[2].current = i; | |||
district=this.linkAddress_area[2].info[i].name; | |||
break; | |||
} | |||
} | |||
//得到区信息 | |||
this.user_address.district=district; | |||
this.selected_address=this.user_address.province+"-"+this.user_address.city+"-"+this.user_address.district; | |||
}, | |||
//取消按钮 | |||
btn_cancel:function(){ | |||
this.close(); | |||
//全部置为空 | |||
this.submission={ | |||
province:'', | |||
city:'', | |||
county:'', | |||
town:'' | |||
} | |||
this.linkAddress_area[1].info= []; | |||
this.linkAddress_area[2].info= []; | |||
this.linkAddress_area[0].current=null; | |||
this.linkAddress_area[1].current=null; | |||
this.linkAddress_area[2].current=null; | |||
this.selected_address=''; | |||
}, | |||
//确定按钮 | |||
btn_confirm:function(){ | |||
this.close(); | |||
console.log(this.user_address) | |||
//可以使用vuex传值 | |||
this.$store.commit('commit_address',this.user_address); | |||
this.$emit('confirmCallback'); | |||
} | |||
}, | |||
} | |||
</script> | |||
<style lang="scss" scoped> | |||
popup-layout-wrap{ | |||
position: absolute; | |||
} | |||
.popup-layout-wrap{ | |||
position: fixed; | |||
z-index: 998; | |||
left: 0; | |||
right: 0; | |||
top: 0; | |||
bottom: 0; | |||
height: 100%; | |||
width: 100%; | |||
display: flex; | |||
flex-flow: row nowrap; | |||
justify-content: center; | |||
align-items: center; | |||
display: none; | |||
&.popup-layout-active{ | |||
display: flex; | |||
} | |||
&.popup-layout-bottom{ | |||
align-items: flex-end; | |||
.popup-layout-transition-slider{ | |||
transform: translate3d(0,100%,0); | |||
} | |||
} | |||
.popup-layout-content{ | |||
background-color: #fff; | |||
z-index: 2; | |||
height: 100%; | |||
width: 100%; | |||
display: flex; | |||
flex-flow: row nowrap; | |||
justify-content: center; | |||
align-items: center; | |||
transform: translate3d(0,0,0) scale(1); | |||
opacity: 1; | |||
transition: transform .3s ease-in-out,opacity .3s ease-in-out; | |||
&.popup-layout-transition-fade{ | |||
transform: translate3d(0,0,0) scale(0.3); | |||
opacity: 0; | |||
} | |||
} | |||
.popup-layout-mask{ | |||
position: absolute; | |||
transition:all 1s ; | |||
z-index: 1; | |||
left: 0; | |||
right: 0; | |||
top: 0; | |||
bottom: 0; | |||
height: 100%; | |||
width: 100%; | |||
background-color: rgba(#000, 0.6); | |||
} | |||
} | |||
/***省市区选择器***/ | |||
.link-address-wrap{ | |||
height: 100%; | |||
width: 100%; | |||
background: #fff; | |||
} | |||
.link-address-wrap .link-adress-content{ | |||
margin:8px 10px 10px 10px; | |||
.head-wrap{ | |||
padding-bottom: 5px; | |||
display: flex; | |||
flex-direction: row; | |||
position: relative; | |||
.cancel{ | |||
color: #999; | |||
} | |||
.confirm{ | |||
position: absolute; | |||
right: 0px; | |||
} | |||
} | |||
.head-selected{ | |||
text-align: center; | |||
color: #ccc; | |||
font-size: 17px; | |||
} | |||
.operation-wrap{ | |||
.operation-container{ | |||
display: flex; | |||
flex-direction: row; | |||
flex-wrap: wrap; | |||
.operation-content{ | |||
display: flex; | |||
flex-direction: column; | |||
width: 33.333%; | |||
.province{ | |||
//scroll-view区域的固定高度 | |||
height: 420rpx; | |||
font-size: 17px; | |||
.province-txt{ | |||
margin: 18px 12px; | |||
overflow: hidden; | |||
text-overflow:ellipsis; | |||
white-space: nowrap; | |||
} | |||
.province-txt-click{ | |||
margin: 18px 12px; | |||
overflow: hidden; | |||
text-overflow:ellipsis; | |||
white-space: nowrap; | |||
color: red; | |||
font-size: 20px; | |||
display: flex; | |||
flex-direction: row; | |||
.pic{ | |||
padding-left: 15rpx; | |||
width: 30rpx; | |||
height: 30rpx; | |||
display: flex; | |||
justify-content: center; | |||
text-align: center; | |||
margin: auto 0; | |||
image{ | |||
width: 100%; | |||
height: auto; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
</style> |
@@ -5,6 +5,8 @@ import store from '@/common/store.js' | |||
import mixins from '@/common/mixins.js' | |||
import '@/components/learun-mpui' | |||
// import '@/common/css/common.less'; | |||
moment.locale('zh-cn') | |||
Vue.mixin(mixins) | |||
@@ -172,13 +172,14 @@ | |||
"mode" : "hash", | |||
"base" : "" | |||
}, | |||
"title" : "力软敏捷开发框架", | |||
"title" : "数字化智慧校园", | |||
"template" : "index.html", | |||
"optimization" : { | |||
"treeShaking" : { | |||
"enable" : false | |||
} | |||
} | |||
}, | |||
"domain" : "testapp.bjquanjiang.com" | |||
}, | |||
"mp-qq" : { | |||
"uniStatistics" : { | |||
@@ -0,0 +1,352 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="inSecTitle">{{ title }}</view> | |||
<view class="inSecTime">{{ time }}</view> | |||
<view class="index_box"> | |||
<view class="signSec2Box" v-for="(items, i) in dataList" :key="items.QTitle"> | |||
<view v-if="items.QType == 1"> | |||
<view class="shenInput"> | |||
<view class="shenInputBox"> | |||
<view class="signTxt" :class="redEva[i]? 'redEva' : ''">{{ items.QTitle }}</view> | |||
<view class="inputRadioRow"> | |||
<view v-for="(item, j) in items.Ask_QuestionItems" :key="item.IID"> | |||
<view class="inputRadioCol4"> | |||
<view class="inputRadio checkBoxs" :class="answer[i].list.indexOf(j) > -1 ? 'active' : ''" @click="tapRadio(i, j, item.QShowText)"></view> | |||
<text>{{ item.ITitle }}</text> | |||
</view> | |||
</view> | |||
</view> | |||
<view v-show="answer[i].QShowText" class="shenInput3" style="margin-top: 10px;"> | |||
<l-textarea v-model="UText[i]" title="其他" class="" placeholder="请填写备注..." /> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view v-if="items.QType == 2"> | |||
<view class="signTextarea"> | |||
<view class="signTextareaBox"> | |||
<view class="signTxt" :class="redEva[i]? 'redEva' : ''">{{ items.QTitle }}</view> | |||
<view class="inputRadioRow"> | |||
<view v-for="(item, j) in items.Ask_QuestionItems" :key="item.IID"> | |||
<view class="inputRadioCol2"> | |||
<view class="inputCheck checkBoxs" :class="answer[i].list.indexOf(j) > -1 ? 'active' : ''" @click="tapCheck(i, j)"></view> | |||
<text>{{ item.ITitle }}</text> | |||
</view> | |||
</view> | |||
</view> | |||
<view v-show="answer[i].QShowText" class="shenInput3" style="margin-top: 10px;"> | |||
<l-textarea v-model="UText[i]" title="其他" class="" placeholder="请填写备注..." /> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<view class="shenRow"><view class="shenBtn" @click="tapbtn">保 存</view></view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
title: '', | |||
time: '', | |||
dataList: [], | |||
answer: [], | |||
pageInfo: null, | |||
redEva: [], | |||
qmustFlag: false, | |||
redEvaCopy: [], | |||
flag: false, | |||
UText: [] | |||
}; | |||
}, | |||
methods: { | |||
init() { | |||
this.pageInfo = this.GET_PARAM(); //获取页面传递参数 | |||
let _this = this; | |||
_this.LOADING('加载数据中…'); | |||
_this.HTTP_GET( | |||
'/learun/ask/paper', | |||
{ | |||
VID: _this.pageInfo.VID | |||
}, | |||
'加载数据时出错' | |||
) | |||
.then(data => { | |||
this.HIDE_LOADING(); | |||
// console.log(data) | |||
if (data) { | |||
_this.title = data.VTitle; | |||
_this.time = data.VStartTime + '-' + data.VStopTime; | |||
_this.dataList = data.Ask_Questions; | |||
console.log(_this.dataList); | |||
_this.dataList.forEach((n, i) => { | |||
_this.answer.push({ | |||
list: [], | |||
QShowText: false | |||
}); | |||
_this.redEva.push(false); | |||
_this.UText.push(''); | |||
}); | |||
_this.redEvaCopy = this.COPY(this.redEva); | |||
} | |||
}); | |||
}, | |||
tapbtn() { | |||
let _this = this; | |||
_this.redEva = this.COPY(this.redEvaCopy); | |||
_this.qmustFlag = false; | |||
_this.flag = false; | |||
let jsons = { | |||
VID: _this.pageInfo.VID, | |||
LessonNo: _this.pageInfo.LessonNo, | |||
EmpNo: _this.pageInfo.EmpNo, | |||
postarray: [] | |||
}; | |||
_this.dataList.forEach((n, i) => { | |||
let len = _this.answer[i].list.length; | |||
var qmin = n.QMin == null? 0 : n.QMin; | |||
var qmax = n.QMust == null? 1 : n.QMust; | |||
if(n.QMust && len == 0){ | |||
_this.redEva[i] = true; | |||
_this.qmustFlag = true; | |||
} | |||
if((qmin && len < qmin) || (qmax && len > qmax)){ | |||
_this.redEva[i] = true; | |||
_this.flag = true; | |||
} | |||
if(_this.qmustFlag){ | |||
this.TOAST('有必选项未选择', 'success'); | |||
return | |||
} | |||
if(_this.flag){ | |||
this.TOAST('有选择项少选或多选', 'success'); | |||
return | |||
} | |||
_this.answer[i].list.forEach((m, j) => { | |||
jsons.postarray.push({ | |||
QID: n.QID, | |||
IID: n.Ask_QuestionItems[m].IID, | |||
UText: _this.answer[i].QShowText? _this.UText[i] : '' | |||
}) | |||
}) | |||
_this.LOADING('保存数据中…') | |||
// console.log(jsons) | |||
// return | |||
_this.HTTP_GET('/learun/ask/savepaper', jsons, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
console.log(res); | |||
this.TOAST('操作成功', 'success'); | |||
this.EMIT('askList') | |||
this.NAV_BACK() | |||
}); | |||
}) | |||
}, | |||
tapCheck(i, num) { | |||
let ind = this.answer[i].list.indexOf(num); | |||
let len = this.answer[i].list.length; | |||
if (ind > -1) { | |||
let QMin = this.dataList[i].QMin == null ? 0 : this.dataList[i].QMin; | |||
if (len <= QMin) { | |||
this.TOAST(`该选项最少选择 ${QMin} 项`, 'success'); | |||
return; | |||
} | |||
this.answer[i].list.splice(ind, 1); | |||
} else { | |||
let QMax = this.dataList[i].QMax == null ? 1 : this.dataList[i].QMax; | |||
if (len >= QMax) { | |||
this.TOAST(`该选项最多选择 ${QMax} 项`, 'success'); | |||
return; | |||
} | |||
this.answer[i].list.push(num); | |||
} | |||
this.answer[i].QShowText = false; | |||
this.answer[i].list.forEach((n, j) => { | |||
if (this.dataList[i].Ask_QuestionItems[n].QShowText) { | |||
this.answer[i].QShowText = true; | |||
} | |||
}); | |||
}, | |||
tapRadio(i, num, flag) { | |||
this.answer[i].list.length = 0; | |||
this.answer[i].list.push(num); | |||
this.answer[i].QShowText = flag; | |||
} | |||
}, | |||
created() { | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
/deep/ .cu-form-group { | |||
min-height: 30px; | |||
border: 0; | |||
} | |||
/deep/ .cu-form-group uni-textarea { | |||
border: 1px solid #cbcbcb; | |||
padding: 5px 10px; | |||
} | |||
.page { | |||
background-color: #fff; | |||
padding-top: 1px; | |||
padding-bottom: 30px; | |||
padding: 1px 15px 30px; | |||
} | |||
.inSecTitle { | |||
font-size: 20px; | |||
text-align: center; | |||
margin: 20px 0 0px; | |||
} | |||
.inSecTime { | |||
font-size: 12px; | |||
text-align: center; | |||
} | |||
.shenInput { | |||
margin-top: 15px; | |||
font-size: 14px; | |||
line-height: 24px; | |||
} | |||
.shenInput3 { | |||
// display: none; | |||
} | |||
.shenInput:before, | |||
.shenInput:after { | |||
display: table; | |||
content: ' '; | |||
} | |||
.shenInput:after { | |||
clear: both; | |||
} | |||
.signTxt { | |||
line-height: 24px; | |||
font-size: 14px; | |||
position: relative; | |||
} | |||
.shenInputBox { | |||
position: relative; | |||
} | |||
.shenInputBox1 { | |||
margin-left: 60px; | |||
} | |||
.inputRadioRow { | |||
overflow: hidden; | |||
} | |||
.inputRadioCol4 { | |||
margin-top: 8px; | |||
} | |||
.inputRadio { | |||
border-radius: 50%; | |||
} | |||
.inputCheck { | |||
border-radius: 2px; | |||
} | |||
.inputRadio.active:after { | |||
content: ''; | |||
width: 12px; | |||
height: 12px; | |||
background: #0c86d8; | |||
position: absolute; | |||
left: 0; | |||
right: 0; | |||
bottom: 0; | |||
top: 0; | |||
margin: auto; | |||
border-radius: 50%; | |||
} | |||
.inputCheck.active:after { | |||
content: ''; | |||
width: 12px; | |||
height: 12px; | |||
background: #0c86d8; | |||
position: absolute; | |||
left: 0; | |||
right: 0; | |||
bottom: 0; | |||
top: 0; | |||
margin: auto; | |||
border-radius: 2px; | |||
} | |||
.inputRadio, | |||
.inputCheck { | |||
font-style: normal; | |||
display: inline-block; | |||
vertical-align: middle; | |||
width: 20px; | |||
height: 20px; | |||
border: 1px solid #cbcbcb; | |||
margin: 0 10px; | |||
position: relative; | |||
cursor: pointer; | |||
} | |||
.shenInputBox > .span, | |||
.inputRadioCol4 .span, | |||
.inputRadioCol3 .span, | |||
.inputRadioCol2 .span { | |||
display: inline-block; | |||
vertical-align: middle; | |||
} | |||
.shenInput > .span { | |||
display: block; | |||
float: left; | |||
width: 60px; | |||
text-align: right; | |||
padding: 4px 8px 4px 0px; | |||
line-height: 24px; | |||
} | |||
.shenInputBox .inputTxt { | |||
width: 100%; | |||
display: block; | |||
height: 32px; | |||
line-height: 20px; | |||
border: 1px solid #cbcbcb; | |||
padding: 6px 10px; | |||
font-size: 14px; | |||
} | |||
.shenBtnBox .signTxt { | |||
margin-top: 30px; | |||
margin-left: 30px; | |||
} | |||
.shenBtn { | |||
width: 74%; | |||
background: #0c86d8; | |||
text-align: center; | |||
line-height: 40px; | |||
margin: 20px auto 20px; | |||
font-size: 17px; | |||
color: #fff; | |||
border-radius: 2px; | |||
cursor: pointer; | |||
border-radius: 4px; | |||
-webkit-user-select: none; | |||
-moz-user-select: none; | |||
-ms-user-select: none; | |||
user-select: none; | |||
} | |||
.signTextareaBox { | |||
margin-top: 20px; | |||
position: relative; | |||
} | |||
.inputRadioRow { | |||
overflow: hidden; | |||
} | |||
.inputRadioCol2 { | |||
margin-top: 8px; | |||
} | |||
.inputCheck image { | |||
width: 100%; | |||
display: none; | |||
} | |||
.signTextarea { | |||
margin-top: 15px; | |||
font-size: 14px; | |||
line-height: 24px; | |||
} | |||
.redEva { | |||
color: red !important; | |||
} | |||
</style> |
@@ -0,0 +1,179 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;"> | |||
<!-- <l-customlist-banner></l-customlist-banner> --> | |||
<view class="records">共 {{ records }} 条数据</view> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data"> | |||
<l-customlist :tips="loadState" showTips> | |||
<view></view> | |||
<view class="pageBox customlist-item" showDelete="true" v-for="(item, ind) in data" :key="item.MakeDate" @click="tapClick(item)"> | |||
<view class=""> | |||
<text>问卷编号:</text> | |||
{{ item.VSerial }} | |||
</view> | |||
<view class=""> | |||
<text>标题:</text> | |||
{{ item.VTitle }} | |||
</view> | |||
<view class=""> | |||
<text>开始时间:</text> | |||
{{ item.VStartTime }} | |||
</view> | |||
<view class=""> | |||
<text>结束时间:</text> | |||
{{ item.VStopTime }} | |||
</view> | |||
<view class=""> | |||
<text>考核学年:</text> | |||
{{ item.AcademicYearNo }} | |||
</view> | |||
<view class=""> | |||
<text>考核学期:</text> | |||
{{ item.Semester }} | |||
</view> | |||
<view class=""> | |||
<text>考核评分:</text> | |||
{{ item.TotalScore }} | |||
</view> | |||
<view class=""> | |||
<text>提交时间:</text> | |||
{{ item.CreateDate }} | |||
</view> | |||
<view class=""> | |||
<text>是否交卷:</text> | |||
{{ item.IsAnswer != undefined && item.IsAnswer === true ? "已交" : "未交" }} | |||
</view> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
weekChina: ['一', '二', '三', '四', '五', '六', '日'], | |||
user: null, | |||
data: [], | |||
total: 1, | |||
records: 0, | |||
ready: false, | |||
page: 1, | |||
rows: 10, | |||
multipleData: {}, | |||
sideOpen: false, | |||
loadState: '向下翻以加载更多' | |||
}; | |||
}, | |||
onUnload() { | |||
this.OFF('askList'); | |||
}, | |||
methods: { | |||
init() { | |||
this.ON('askList', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
Promise.all([() => {}]); | |||
var _this = this; | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
this.fetchList(); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
let _this = this; | |||
let _postParam = { | |||
pagination: { | |||
rows: _this.rows, | |||
page: _this.page | |||
}, | |||
queryJson: JSON.stringify(_this.multipleData) | |||
}; | |||
_this.LOADING('加载数据中…') | |||
_this.HTTP_GET('/learun/ask/studentlist', _postParam, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
console.log(res); | |||
this.data = this.data.concat(res.rows); | |||
_this.total = res.total; | |||
_this.records = res.records; | |||
this.page = res.page + 1; | |||
this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多'; | |||
// console.log(_this.data); | |||
}); | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.data.stopPullDown(); | |||
}); | |||
}, | |||
async refreshList() { | |||
this.page = 1; | |||
this.total = 1; | |||
this.data = []; | |||
this.fetchList(); | |||
}, | |||
tapClick(item) { | |||
if (item.IsAnswer === true || item.IsAnswer === 'true') { | |||
this.TOAST('当前项目已交卷!', 'success'); | |||
return; | |||
} | |||
this.NAV_TO('./from', { VID: item.VID }, true); | |||
} | |||
}, | |||
computed:{ | |||
}, | |||
created() { | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
.page { | |||
background-color: #fff; | |||
} | |||
.page-content { | |||
margin-top: 39px; | |||
} | |||
.records { | |||
color: #8f8f94; | |||
background: #ffffff; | |||
padding: 10px 12px; | |||
width: 100%; | |||
vertical-align: middle; | |||
border-bottom: 0.5px solid #ddd; | |||
position: fixed; | |||
top: var(--window-top); | |||
z-index: 1024; | |||
border-bottom: 0.5px solid #ddd; | |||
height: 40px; | |||
width: 100%; | |||
box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1); | |||
// background: #f1f1f1; | |||
} | |||
.pageBox { | |||
// margin-top: 34px; | |||
padding: 5px 15px; | |||
line-height: 24px; | |||
border-bottom: 5px solid #f5f5f5; | |||
} | |||
.delbtn { | |||
position: absolute; | |||
right: 15px; | |||
bottom: 7px; | |||
padding: 3px 10px; | |||
background: #dd524d; | |||
color: #fff; | |||
border-radius: 3px; | |||
} | |||
</style> |
@@ -0,0 +1,124 @@ | |||
<template> | |||
<view class=""> | |||
<l-select v-model="queryData.AResult" :range="dataSource.AResult" title="盘点结果" placeholder="请选择" /> | |||
<l-textarea v-model="queryData.ARemark" title="备注" placeholder="输入点什么..." /> | |||
<l-select v-model="queryData.AAddress" :range="dataSource.StorageData" title="现存放地点" placeholder="请选择" /> | |||
<view class="btn" @click="tapBtn">提交</view> | |||
</view> | |||
</template> | |||
<script> | |||
import moment from 'moment'; | |||
import get from 'lodash/get'; | |||
import set from 'lodash/set'; | |||
export default{ | |||
data() { | |||
return { | |||
pageInfo: {}, | |||
scheme: { | |||
StorageData: { | |||
type: 'select', | |||
dataSource: '1', | |||
dataSourceId: 'Ass_StorageData,sname,sid' | |||
} | |||
}, | |||
dataSource: { | |||
StorageData:[], | |||
AResult: Object.values(this.GET_GLOBAL('dataDictionary').InventoryResult).map(t => ({ value: t.value, text: t.text })) | |||
}, | |||
queryData: { | |||
AAddress: '', | |||
ARemark: '', | |||
AResult: '0' | |||
} | |||
} | |||
}, | |||
methods:{ | |||
init() { | |||
var _this = this; | |||
this.pageInfo = _this.GET_PARAM(); //获取页面传递参数 | |||
Promise.all([ | |||
this.FETCH_DATASOURCE('Ass_StorageData').then(data => { | |||
// console.log(data) | |||
this.dataSource.StorageData = data.data.map(t => ({ | |||
text: t.sname, | |||
value: t.sid | |||
})); | |||
}), | |||
() => {} | |||
]); | |||
// console.log(this.dataSource) | |||
// console.log(this.pageInfo) | |||
if(this.pageInfo.acode){ | |||
_this.LOADING('加载数据中…'); | |||
//接口没有带回来初始化需要得到数据 | |||
_this.HTTP_GET('learun/AssetManagementSystem/InventoryItem/formbycode', this.pageInfo.acode, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
// console.log(res); | |||
this.pageInfo.AAIId = res.Ass_InventoryItemApply.AAIId; | |||
}); | |||
} | |||
}, | |||
tapBtn() { | |||
let _this = this; | |||
let _postData = { | |||
keyValue: this.pageInfo.AAIId, | |||
strEntity: JSON.stringify(this.queryData) | |||
} | |||
console.log(_postData) | |||
_this.LOADING('保存数据中…'); | |||
_this.HTTP_POST('learun/AssetManagementSystem/InventoryItem/save', _postData, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
console.log(res); | |||
if(res){ | |||
this.EMIT('Ass_InventoryItemList') | |||
this.NAV_BACK() | |||
} | |||
}); | |||
}, | |||
// 显示列表中的标题项 | |||
displayListItem(item, field) { | |||
// console.log(this.scheme) | |||
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; | |||
} | |||
} | |||
}, | |||
created() { | |||
this.init() | |||
} | |||
} | |||
</script> | |||
<style></style> |
@@ -0,0 +1,267 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;"> | |||
<!-- <l-customlist-banner></l-customlist-banner> --> | |||
<view class="records">共 {{ records }} 条数据</view> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data"> | |||
<l-customlist :tips="loadState" showTips> | |||
<view></view> | |||
<view class="pageBox customlist-item" showDelete="true" v-for="(item, ind) in data" :key="item.MakeDate" @click="tapClick(item)"> | |||
<view class=""> | |||
<text>资产编号:</text> | |||
{{ item.AAICode }} | |||
</view> | |||
<view class=""> | |||
<text>名字:</text> | |||
{{ item.AAIName }} | |||
</view> | |||
<view class=""> | |||
<text>资产类别:</text> | |||
{{ displayListItem(item, 'AAITId') }} | |||
</view> | |||
<view class=""> | |||
<text>资产英文名:</text> | |||
{{ item.AAIEName }} | |||
</view> | |||
<view class=""> | |||
<text>是否盘点:</text> | |||
{{ item.AISCHECK }} | |||
</view> | |||
<view class="delbtn" @click.stop="delTap(item)">删除</view> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
<l-customlist-add v-if="!sideOpen" @click="tapBtn()" /> | |||
</view> | |||
</template> | |||
<script> | |||
import moment from 'moment'; | |||
import get from 'lodash/get'; | |||
import set from 'lodash/set'; | |||
import scanCodeFun from '@/common/js/scanCodeFun.js'; | |||
export default { | |||
data() { | |||
return { | |||
scheme: { | |||
AAITId: { | |||
type: 'select', | |||
dataSource: '1', | |||
dataSourceId: 'Ass_AssetsType,aname,atid' | |||
} | |||
}, | |||
weekChina: ['一', '二', '三', '四', '五', '六', '日'], | |||
user: null, | |||
data: [], | |||
total: 1, | |||
records: 0, | |||
ready: false, | |||
page: 1, | |||
rows: 10, | |||
multipleData: null, | |||
sideOpen: false, | |||
loadState: '向下翻以加载更多', | |||
pageInfo: {}, | |||
dataSource: { | |||
AAITId:[], | |||
} | |||
}; | |||
}, | |||
onUnload() { | |||
this.OFF('Ass_InventoryItemList'); | |||
}, | |||
methods: { | |||
init() { | |||
this.ON('Ass_InventoryItemList', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
var _this = this; | |||
this.pageInfo = _this.GET_PARAM(); //获取页面传递参数 | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
Promise.all([ | |||
this.FETCH_DATASOURCE('Ass_AssetsType').then(data => { | |||
// console.log(data) | |||
this.dataSource.AAITId = data.data.map(t => ({ | |||
text: t.aname, | |||
value: t.atid | |||
})); | |||
}), | |||
() => {} | |||
]); | |||
this.fetchList(); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
let _this = this; | |||
let _postParam = { | |||
pagination: { | |||
rows: _this.rows, | |||
page: _this.page, | |||
sidx: 'AAIId', | |||
sord: 'DESC' | |||
}, | |||
queryJson: '{}' | |||
}; | |||
if (this.pageInfo.ITID) { | |||
_postParam.queryJson = JSON.stringify({ | |||
AAId: this.pageInfo.ITID | |||
}); | |||
} | |||
_this.LOADING('加载数据中…'); | |||
_this.HTTP_GET('learun/AssetManagementSystem/InventoryItem/pagelist', _postParam, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
// console.log(res); | |||
this.data = this.data.concat(res.rows); | |||
_this.total = res.total; | |||
_this.records = res.records; | |||
this.page = res.page + 1; | |||
this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多'; | |||
// console.log(_this.data); | |||
}); | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.data.stopPullDown(); | |||
}); | |||
}, | |||
async refreshList() { | |||
this.page = 1; | |||
this.total = 1; | |||
this.data = []; | |||
this.fetchList(); | |||
}, | |||
tapClick(data) { | |||
this.NAV_TO('./from', data, true); | |||
}, | |||
delTap(item) { | |||
let _this = this; | |||
this.CONFIRM('数字化校园提示', '确定要删除该条数据吗?', true).then(res => { | |||
if (res) { | |||
_this.LOADING('正在删除…'); | |||
_this.HTTP_POST('learun/AssetManagementSystem/InventoryItem/delete', item.AAIId, '加载数据时出错').then(data => { | |||
_this.HIDE_LOADING(); | |||
// console.log(data); | |||
if (data) { | |||
// 成功 | |||
_this.refreshList(); | |||
_this.TOAST(info); | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
tapBtn() { | |||
let _this = this; | |||
scanCodeFun.scanCodeFun().then(res => { | |||
// console.log(res); | |||
if(!res) return | |||
_this.LOADING('请等待…'); | |||
_this.HTTP_GET('learun/AssetManagementSystem/InventoryItem/formbycode', res.result, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
// console.log(res) | |||
if (res.Ass_InventoryItemApply) { | |||
_this.NAV_TO('./from', {acode: res.result}, true); | |||
} else { | |||
_this.TOAST('未匹配'); | |||
} | |||
}) | |||
}) | |||
}, | |||
// 显示列表中的标题项 | |||
displayListItem(item, field) { | |||
// console.log(this.scheme) | |||
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; | |||
} | |||
} | |||
}, | |||
computed: {}, | |||
created() { | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
.page { | |||
background-color: #fff; | |||
} | |||
.page-content { | |||
margin-top: 39px; | |||
} | |||
.records { | |||
color: #8f8f94; | |||
background: #ffffff; | |||
padding: 10px 12px; | |||
width: 100%; | |||
vertical-align: middle; | |||
border-bottom: 0.5px solid #ddd; | |||
position: fixed; | |||
top: var(--window-top); | |||
z-index: 1024; | |||
border-bottom: 0.5px solid #ddd; | |||
height: 40px; | |||
width: 100%; | |||
box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1); | |||
// background: #f1f1f1; | |||
} | |||
.pageBox { | |||
// margin-top: 34px; | |||
padding: 5px 15px; | |||
line-height: 24px; | |||
border-bottom: 5px solid #f5f5f5; | |||
color: #333; | |||
} | |||
.pageBox text { | |||
color: #8f8f94; | |||
margin-right: 5px; | |||
} | |||
.delbtn { | |||
position: absolute; | |||
right: 15px; | |||
bottom: 7px; | |||
padding: 3px 10px; | |||
background: #dd524d; | |||
color: #fff; | |||
border-radius: 3px; | |||
} | |||
</style> |
@@ -0,0 +1,180 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;"> | |||
<!-- <l-customlist-banner></l-customlist-banner> --> | |||
<view class="records">共 {{ records }} 条数据</view> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data"> | |||
<l-customlist :tips="loadState" showTips> | |||
<view></view> | |||
<view class="pageBox customlist-item" showDelete="true" v-for="(item, ind) in data" :key="item.MakeDate" @click="tapClick(item)"> | |||
<view class=""> | |||
<text>盘点单编号:</text> | |||
{{ item.ITNo }} | |||
</view> | |||
<view class=""> | |||
<text>盘点单主题:</text> | |||
{{ item.ITTeame }} | |||
</view> | |||
<view class=""> | |||
<text>状态:</text> | |||
{{ item.ITStatus }} | |||
</view> | |||
<view class=""> | |||
<text>盘点说明:</text> | |||
{{ item.ITExplain }} | |||
</view> | |||
<view class="delbtn" @click.stop="delTap(item)">删除</view> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
weekChina: ['一', '二', '三', '四', '五', '六', '日'], | |||
user: null, | |||
data: [], | |||
total: 1, | |||
records: 0, | |||
ready: false, | |||
page: 1, | |||
rows: 10, | |||
multipleData: null, | |||
sideOpen: false, | |||
loadState: '向下翻以加载更多' | |||
}; | |||
}, | |||
onUnload() { | |||
this.OFF('Ass_InventoryList'); | |||
}, | |||
methods: { | |||
init() { | |||
this.ON('Ass_InventoryList', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
Promise.all([() => {}]); | |||
var _this = this; | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
this.fetchList(); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
let _this = this; | |||
let _postParam = { | |||
pagination: { | |||
rows: _this.rows, | |||
page: _this.page, | |||
sidx: '', | |||
sord: 'DESC' | |||
}, | |||
queryJson: '{}' | |||
}; | |||
_postParam.queryJson = JSON.stringify({ StartTime: '', EndTime: '' }); | |||
_this.LOADING('加载数据中…'); | |||
_this.HTTP_GET('learun/AssetManagementSystem/Inventory/pagelist', _postParam, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
// console.log(res); | |||
this.data = this.data.concat(res.rows); | |||
_this.total = res.total; | |||
_this.records = res.records; | |||
this.page = res.page + 1; | |||
this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多'; | |||
// console.log(_this.data); | |||
}); | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.data.stopPullDown(); | |||
}); | |||
}, | |||
async refreshList() { | |||
this.page = 1; | |||
this.total = 1; | |||
this.data = []; | |||
this.fetchList(); | |||
}, | |||
tapClick(data) { | |||
this.NAV_TO('../Ass_InventoryItemList/list', data, true); | |||
}, | |||
delTap(item) { | |||
// console.log(item) | |||
let _this = this; | |||
this.CONFIRM('数字化校园提示', '确定要删除该条数据吗?', true).then(res => { | |||
if (res) { | |||
_this.LOADING('正在删除…'); | |||
_this.HTTP_POST('learun/AssetManagementSystem/Inventory/delete', item.ITID, '加载数据时出错').then(data => { | |||
_this.HIDE_LOADING(); | |||
console.log(data); | |||
if (data) { | |||
// 成功 | |||
_this.refreshList(); | |||
_this.TOAST(info); | |||
// item.pageType = | |||
} | |||
}); | |||
} | |||
}); | |||
} | |||
}, | |||
computed: {}, | |||
created() { | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
.page { | |||
background-color: #fff; | |||
} | |||
.page-content { | |||
margin-top: 39px; | |||
} | |||
.records { | |||
color: #8f8f94; | |||
background: #ffffff; | |||
padding: 10px 12px; | |||
width: 100%; | |||
vertical-align: middle; | |||
border-bottom: 0.5px solid #ddd; | |||
position: fixed; | |||
top: var(--window-top); | |||
z-index: 1024; | |||
border-bottom: 0.5px solid #ddd; | |||
height: 40px; | |||
width: 100%; | |||
box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1); | |||
// background: #f1f1f1; | |||
} | |||
.pageBox { | |||
// margin-top: 34px; | |||
padding: 5px 15px; | |||
line-height: 24px; | |||
border-bottom: 5px solid #f5f5f5; | |||
color: #333; | |||
} | |||
.pageBox text { | |||
color: #8f8f94; | |||
margin-right: 5px; | |||
} | |||
.delbtn { | |||
position: absolute; | |||
right: 15px; | |||
bottom: 7px; | |||
padding: 3px 10px; | |||
background: #dd524d; | |||
color: #fff; | |||
border-radius: 3px; | |||
} | |||
</style> |
@@ -152,9 +152,9 @@ export default { | |||
async fetchForm() { | |||
// 此处处理旧版无外层表结构的表单格式 | |||
const formData = {} | |||
formData.lr_demo_formleave = await this.HTTP_GET('/demo/wfsys/form', this.processId) | |||
formData.lr_demo_formleave = await this.HTTP_GET('learun/adms/demo/wfsys/form', this.processId) | |||
// 原版: | |||
// const formData = await this.HTTP_GET('/demo/wfsys/form', this.processId) | |||
// const formData = await this.HTTP_GET('learun/adms/demo/wfsys/form', this.processId) | |||
if (['again', 'child', 'create'].includes(this.type)) { | |||
this.origin = await this.getDefaultForm() | |||
@@ -183,7 +183,7 @@ export default { | |||
} | |||
this.LOADING(`提交${actionText}中…`) | |||
this.HTTP_POST(`/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => { | |||
this.HTTP_POST(`learun/adms/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => { | |||
this.HIDE_LOADING() | |||
if (success) { | |||
this.EMIT('task-list-change') | |||
@@ -200,7 +200,7 @@ export default { | |||
this.LOADING('正在提交草稿…') | |||
const draftPostData = await this.getPostData(this.processId) | |||
const pdSuccess = await this.HTTP_POST('/demo/wfsys/save', draftPostData, '提交表单失败') | |||
const pdSuccess = await this.HTTP_POST('learun/adms/demo/wfsys/save', draftPostData, '提交表单失败') | |||
if (!pdSuccess) { | |||
return | |||
} | |||
@@ -210,7 +210,7 @@ export default { | |||
processId: this.processId, | |||
formreq: JSON.stringify({}) | |||
} | |||
const draftSuccess = await this.HTTP_POST('/newwf/draft', draftWorkflowInfo, '提交草稿失败') | |||
const draftSuccess = await this.HTTP_POST('learun/adms/newwf/draft', draftWorkflowInfo, '提交草稿失败') | |||
if (!draftSuccess) { | |||
return | |||
} | |||
@@ -235,7 +235,7 @@ export default { | |||
this.LOADING('正在提交…') | |||
const postKv = ['create'].includes(this.type) ? '' : this.processId | |||
const postData = await this.getPostData(postKv) | |||
const pSuccess = await this.HTTP_POST('/demo/wfsys/save', postData, '表单提交失败') | |||
const pSuccess = await this.HTTP_POST('learun/adms/demo/wfsys/save', postData, '表单提交失败') | |||
if (!pSuccess) { | |||
return | |||
} | |||
@@ -255,10 +255,10 @@ export default { | |||
workflowInfo.parentTaskId = this.currentTask.F_TaskId | |||
} | |||
const postUrl = { | |||
create: '/newwf/create', | |||
draft: '/newwf/draft', | |||
again: '/newwf/againcreate', | |||
child: '/newwf/createchildflow' | |||
create: 'learun/adms/newwf/create', | |||
draft: 'learun/adms/newwf/draft', | |||
again: 'learun/adms/newwf/againcreate', | |||
child: 'learun/adms/newwf/createchildflow' | |||
}[this.type] | |||
const success = await this.HTTP_POST(postUrl, workflowInfo, '流程提交失败') | |||
if (!success) { | |||
@@ -1,475 +1,428 @@ | |||
<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, 'AttemperType') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">调度时限:</text> | |||
{{ displayListItem(item, 'AttemperTimeType') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">调度时间:</text> | |||
{{ showField(item, 'AttemperStartTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学年学期:</text> | |||
{{ showField(item, 'AcademicYearNo') }} | |||
</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, 'MajorNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">课程:</text> | |||
{{ displayListItem(item, 'LessonNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">班级信息:</text> | |||
{{ displayListItem(item, 'TeachClassNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">教师:</text> | |||
{{ displayListItem(item, 'EmpNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">教室:</text> | |||
{{ displayListItem(item, 'ClassroomNo') }} | |||
</view> | |||
<view v-show="item.AttemperType!= '02'"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新系部:</text> | |||
{{ displayListItem(item, 'NewDeptNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新专业:</text> | |||
{{ displayListItem(item, 'NewMajorNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新课程:</text> | |||
{{ displayListItem(item, 'NewLessonNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新班级:</text> | |||
{{ displayListItem(item, 'NewTeachClassNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新教师:</text> | |||
{{ displayListItem(item, 'NewEmpNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新教室:</text> | |||
{{ displayListItem(item, 'NewClassroomNo') }} | |||
</view> | |||
</view> | |||
</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.AttemperType" | |||
@change="searchChange" | |||
:range="dataSource.AttemperType" | |||
title ="调度类型" | |||
placeholder="按调度类型查询" | |||
/> | |||
<l-input | |||
v-model="queryData.AcademicYearNo" | |||
@change="searchChange" | |||
title ="学年学期" | |||
placeholder="按学年学期查询" | |||
/> | |||
<l-select | |||
v-model="queryData.DeptNo" | |||
@change="searchChange" | |||
:range="dataSource.DeptNo" | |||
title ="系部" | |||
placeholder="按系部查询" | |||
/> | |||
<l-select | |||
v-model="queryData.MajorNo" | |||
@change="searchChange" | |||
:range="dataSource.MajorNo" | |||
title ="专业" | |||
placeholder="按专业查询" | |||
/> | |||
<l-select | |||
v-model="queryData.LessonNo" | |||
@change="searchChange" | |||
:range="dataSource.LessonNo" | |||
title ="课程" | |||
placeholder="按课程查询" | |||
/> | |||
<l-select | |||
v-model="queryData.TeachClassNo" | |||
@change="searchChange" | |||
:range="dataSource.TeachClassNo" | |||
title ="班级信息" | |||
placeholder="按班级信息查询" | |||
/> | |||
<l-select | |||
v-model="queryData.EmpNo" | |||
@change="searchChange" | |||
:range="dataSource.EmpNo" | |||
title ="教师" | |||
placeholder="按教师查询" | |||
/> | |||
<!-- 重置查询条件按钮 --> | |||
<view class="padding-tb"> | |||
<l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button> | |||
</view> | |||
</view> | |||
</scroll-view> | |||
</view> | |||
</template> | |||
<script> | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-20 14:32 | |||
* 描 述:调度信息 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/ArrangeLessonTermAttemper/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: { | |||
AttemperType: { type: 'select', itemCode: 'AttemperType', dataSource: '0' }, | |||
AttemperTimeType: { type: 'select', itemCode: 'AttemperTimeType', dataSource: '0' }, | |||
AttemperStartTime: { type: 'text' }, | |||
AcademicYearNo: { type: 'text' }, | |||
DeptNo: { type: 'select', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno' }, | |||
MajorNo: { type: 'select', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' }, | |||
LessonNo: { type: 'select', dataSource: '1', dataSourceId: 'LessonInfo,lessonname,lessonno' }, | |||
TeachClassNo: { type: 'select', dataSource: '1', dataSourceId: 'bjsj,classname,classno' }, | |||
EmpNo: { type: 'select', dataSource: '1', dataSourceId: 'EmpInfo,empname,empno' }, | |||
ClassroomNo: { type: 'select', dataSource: '1', dataSourceId: 'ClassRoomInfo,classroomname,classroomno' }, | |||
NewDeptNo: { type: 'select', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno' }, | |||
NewMajorNo: { type: 'select', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' }, | |||
NewLessonNo: { type: 'select', dataSource: '1', dataSourceId: 'LessonInfo,lessonname,lessonno' }, | |||
NewTeachClassNo: { type: 'select', dataSource: '1', dataSourceId: 'bjsj,classname,classno' }, | |||
NewEmpNo: { type: 'select', dataSource: '1', dataSourceId: 'EmpInfo,empname,empno' }, | |||
NewClassroomNo: { type: 'select', dataSource: '1', dataSourceId: 'ClassRoomInfo,classroomname,classroomno' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
AttemperType: '', | |||
AcademicYearNo: '', | |||
DeptNo: '', | |||
MajorNo: '', | |||
LessonNo: '', | |||
TeachClassNo: '', | |||
EmpNo: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
AttemperType: Object.values(this.GET_GLOBAL('dataDictionary').AttemperType).map(t => ({ value: t.value, text: t.text })), | |||
AttemperTimeType: Object.values(this.GET_GLOBAL('dataDictionary').AttemperTimeType).map(t => ({ value: t.value, text: t.text })), | |||
DeptNo: [], | |||
MajorNo: [], | |||
LessonNo: [], | |||
TeachClassNo: [], | |||
EmpNo: [], | |||
ClassroomNo: [], | |||
NewDeptNo: [], | |||
NewMajorNo: [], | |||
NewLessonNo: [], | |||
NewTeachClassNo: [], | |||
NewEmpNo: [], | |||
NewClassroomNo: [], | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationArrangeLessonTermAttemper-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationArrangeLessonTermAttemper-list-change', this.refreshList) | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })) | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })) | |||
}), | |||
this.FETCH_DATASOURCE('LessonInfo').then(result => { | |||
this.dataSource.LessonNo = result.data.map(t => ({ text: t.lessonname, value: t.lessonno })) | |||
}), | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
this.dataSource.TeachClassNo = result.data.map(t => ({ text: t.classname, value: t.classno })) | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.EmpNo = result.data.map(t => ({ text: t.empname, value: t.empno })) | |||
}), | |||
this.FETCH_DATASOURCE('ClassRoomInfo').then(result => { | |||
this.dataSource.ClassroomNo = result.data.map(t => ({ text: t.classroomname, value: t.classroomno })) | |||
}), | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.NewDeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })) | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
this.dataSource.NewMajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })) | |||
}), | |||
this.FETCH_DATASOURCE('LessonInfo').then(result => { | |||
this.dataSource.NewLessonNo = result.data.map(t => ({ text: t.lessonname, value: t.lessonno })) | |||
}), | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
this.dataSource.NewTeachClassNo = result.data.map(t => ({ text: t.classname, value: t.classno })) | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.NewEmpNo = result.data.map(t => ({ text: t.empname, value: t.empno })) | |||
}), | |||
this.FETCH_DATASOURCE('ClassRoomInfo').then(result => { | |||
this.dataSource.NewClassroomNo = result.data.map(t => ({ text: t.classroomname, value: t.classroomno })) | |||
}), | |||
() => {} | |||
]) | |||
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/ArrangeLessonTermAttemper/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/ArrangeLessonTermAttemper/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 | |||
} | |||
}, | |||
showField(item,field){ | |||
switch(field){ | |||
case 'AttemperStartTime': | |||
return (item.AttemperStartTime == null ? "-" : item.AttemperStartTime) + "到" + (item.AttemperEndTime == null ? "-" : item.AttemperEndTime) | |||
case 'AcademicYearNo': | |||
return item.AcademicYearNo + "学年第" + item.Semester + "学期" | |||
} | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
</style> | |||
<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, 'AttemperType') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">调度时限:</text> | |||
{{ displayListItem(item, 'AttemperTimeType') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">调度时间:</text> | |||
{{ showField(item, 'AttemperStartTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学年学期:</text> | |||
{{ showField(item, 'AcademicYearNo') }} | |||
</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, 'MajorNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">课程:</text> | |||
{{ displayListItem(item, 'LessonNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">班级信息:</text> | |||
{{ displayListItem(item, 'TeachClassNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">教师:</text> | |||
{{ displayListItem(item, 'EmpNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">教室:</text> | |||
{{ displayListItem(item, 'ClassroomNo') }} | |||
</view> | |||
<view v-show="item.AttemperType != '02'"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新系部:</text> | |||
{{ displayListItem(item, 'NewDeptNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新专业:</text> | |||
{{ displayListItem(item, 'NewMajorNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新课程:</text> | |||
{{ displayListItem(item, 'NewLessonNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新班级:</text> | |||
{{ displayListItem(item, 'NewTeachClassNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新教师:</text> | |||
{{ displayListItem(item, 'NewEmpNo') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">新教室:</text> | |||
{{ displayListItem(item, 'NewClassroomNo') }} | |||
</view> | |||
</view> | |||
</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.AttemperType" @change="searchChange" :range="dataSource.AttemperType" title="调度类型" placeholder="按调度类型查询" /> | |||
<l-input v-model="queryData.AcademicYearNo" @change="searchChange" title="学年学期" placeholder="按学年学期查询" /> | |||
<l-select v-model="queryData.DeptNo" @change="searchChange" :range="dataSource.DeptNo" title="系部" placeholder="按系部查询" /> | |||
<l-select v-model="queryData.MajorNo" @change="searchChange" :range="dataSource.MajorNo" title="专业" placeholder="按专业查询" /> | |||
<l-select v-model="queryData.LessonNo" @change="searchChange" :range="dataSource.LessonNo" title="课程" placeholder="按课程查询" /> | |||
<l-select v-model="queryData.TeachClassNo" @change="searchChange" :range="dataSource.TeachClassNo" title="班级信息" placeholder="按班级信息查询" /> | |||
<l-select v-model="queryData.EmpNo" @change="searchChange" :range="dataSource.EmpNo" title="教师" placeholder="按教师查询" /> | |||
<!-- 重置查询条件按钮 --> | |||
<view class="padding-tb"><l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button></view> | |||
</view> | |||
</scroll-view> | |||
</view> | |||
</template> | |||
<script> | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-20 14:32 | |||
* 描 述:调度信息 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/ArrangeLessonTermAttemper/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: { | |||
AttemperType: { type: 'select', itemCode: 'AttemperType', dataSource: '0' }, | |||
AttemperTimeType: { type: 'select', itemCode: 'AttemperTimeType', dataSource: '0' }, | |||
AttemperStartTime: { type: 'text' }, | |||
AcademicYearNo: { type: 'text' }, | |||
DeptNo: { type: 'select', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno' }, | |||
MajorNo: { type: 'select', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' }, //code name id | |||
LessonNo: { type: 'select', dataSource: '1', dataSourceId: 'LessonInfo,lessonname,lessonno' }, | |||
TeachClassNo: { type: 'select', dataSource: '1', dataSourceId: 'bjsj,classname,classno' }, | |||
EmpNo: { type: 'select', dataSource: '1', dataSourceId: 'EmpInfo,empname,empno' }, | |||
ClassroomNo: { type: 'select', dataSource: '1', dataSourceId: 'ClassRoomInfo,classroomname,classroomno' }, | |||
NewDeptNo: { type: 'select', dataSource: '1', dataSourceId: 'CdDeptInfo,deptname,deptno' }, | |||
NewMajorNo: { type: 'select', dataSource: '1', dataSourceId: 'CdMajorInfo,majorname,majorno' }, | |||
NewLessonNo: { type: 'select', dataSource: '1', dataSourceId: 'LessonInfo,lessonname,lessonno' }, | |||
NewTeachClassNo: { type: 'select', dataSource: '1', dataSourceId: 'bjsj,classname,classno' }, | |||
NewEmpNo: { type: 'select', dataSource: '1', dataSourceId: 'EmpInfo,empname,empno' }, | |||
NewClassroomNo: { type: 'select', dataSource: '1', dataSourceId: 'ClassRoomInfo,classroomname,classroomno' } | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
AttemperType: '', | |||
AcademicYearNo: '', | |||
DeptNo: '', | |||
MajorNo: '', | |||
LessonNo: '', | |||
TeachClassNo: '', | |||
EmpNo: '' | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
AttemperType: Object.values(this.GET_GLOBAL('dataDictionary').AttemperType).map(t => ({ value: t.value, text: t.text })), | |||
AttemperTimeType: Object.values(this.GET_GLOBAL('dataDictionary').AttemperTimeType).map(t => ({ value: t.value, text: t.text })), | |||
DeptNo: [], | |||
MajorNo: [], | |||
LessonNo: [], | |||
TeachClassNo: [], | |||
EmpNo: [], | |||
ClassroomNo: [], | |||
NewDeptNo: [], | |||
NewMajorNo: [], | |||
NewLessonNo: [], | |||
NewTeachClassNo: [], | |||
NewEmpNo: [], | |||
NewClassroomNo: [] | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
}; | |||
}, | |||
async onLoad() { | |||
await this.init(); | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationArrangeLessonTermAttemper-list-change'); | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationArrangeLessonTermAttemper-list-change', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })); | |||
}), | |||
this.FETCH_DATASOURCE('LessonInfo').then(result => { | |||
this.dataSource.LessonNo = result.data.map(t => ({ text: t.lessonname, value: t.lessonno })); | |||
}), | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
this.dataSource.TeachClassNo = result.data.map(t => ({ text: t.classname, value: t.classno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.EmpNo = result.data.map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('ClassRoomInfo').then(result => { | |||
this.dataSource.ClassroomNo = result.data.map(t => ({ text: t.classroomname, value: t.classroomno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.NewDeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
this.dataSource.NewMajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })); | |||
}), | |||
this.FETCH_DATASOURCE('LessonInfo').then(result => { | |||
this.dataSource.NewLessonNo = result.data.map(t => ({ text: t.lessonname, value: t.lessonno })); | |||
}), | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
this.dataSource.NewTeachClassNo = result.data.map(t => ({ text: t.classname, value: t.classno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.NewEmpNo = result.data.map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('ClassRoomInfo').then(result => { | |||
this.dataSource.NewClassroomNo = result.data.map(t => ({ text: t.classroomname, value: t.classroomno })); | |||
}), | |||
() => {} | |||
]); | |||
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/ArrangeLessonTermAttemper/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/ArrangeLessonTermAttemper/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; | |||
} | |||
}, | |||
showField(item, field) { | |||
switch (field) { | |||
case 'AttemperStartTime': | |||
return (item.AttemperStartTime == null ? '-' : item.AttemperStartTime) + '到' + (item.AttemperEndTime == null ? '-' : item.AttemperEndTime); | |||
case 'AcademicYearNo': | |||
return item.AcademicYearNo + '学年第' + item.Semester + '学期'; | |||
} | |||
} | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
</style> |
@@ -1,303 +1,303 @@ | |||
<template> | |||
<view class="page"> | |||
<!-- 主列表页 --> | |||
<view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;"> | |||
<!-- 顶部条目/分页信息栏 --> | |||
<l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner> | |||
<!-- 滚动列表,跨端支持上拉/下拉 --> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list"> | |||
<l-customlist :tips="loadState" showTips> | |||
<!-- 单条记录 --> | |||
<view class="customlist-item" v-for="item of list" :key="item.ID"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">借书时间:</text> | |||
{{ displayListItem(item, 'BorrowTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">还书时间:</text> | |||
{{ displayListItem(item, 'ReturnTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">借书证:</text> | |||
{{ displayListItem(item, 'LibraryCard') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">图书编号:</text> | |||
{{ displayListItem(item, 'BookID') }} | |||
</view> | |||
<!-- <l-customlist-action showEdit @edit="action('edit', item.ID)" showDelete @delete="action('delete', item.ID)" @view="action('view', item.ID)" /> --> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
<!-- 关闭侧边抽屉按钮 --> | |||
<view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose"> | |||
<l-icon type="pullright" color="blue" /> | |||
</view> | |||
<!-- 侧边栏,用于设置查询条件 --> | |||
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y> | |||
<view v-if="ready" class="padding"> | |||
<l-customlist-sidepage-datefilter | |||
v-model="dateRange" | |||
@change="searchChange" | |||
title="按时间日期查询: " | |||
ref="datefilter" | |||
class="margin-bottom" | |||
/> | |||
<l-input | |||
v-model="queryData.LibraryCard" | |||
@change="searchChange" | |||
title ="借书证" | |||
placeholder="按借书证查询" | |||
/> | |||
<l-input | |||
v-model="queryData.BookID" | |||
@change="searchChange" | |||
title ="图书编号" | |||
placeholder="按图书编号查询" | |||
/> | |||
<!-- 重置查询条件按钮 --> | |||
<view class="padding-tb"> | |||
<l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button> | |||
</view> | |||
</view> | |||
</scroll-view> | |||
<!-- <l-customlist-add v-if="!sideOpen" @click="action('add')" /> --> | |||
</view> | |||
<view class="page"> | |||
<!-- 主列表页 --> | |||
<view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;"> | |||
<!-- 顶部条目/分页信息栏 --> | |||
<l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner> | |||
<!-- 滚动列表,跨端支持上拉/下拉 --> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list"> | |||
<l-customlist :tips="loadState" showTips> | |||
<!-- 单条记录 --> | |||
<view class="customlist-item" v-for="item of list" :key="item.ID"> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">借书时间:</text> | |||
{{ displayListItem(item, 'BorrowTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">还书时间:</text> | |||
{{ displayListItem(item, 'ReturnTime') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">借书证:</text> | |||
{{ displayListItem(item, 'LibraryCard') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">图书编号:</text> | |||
{{ displayListItem(item, 'BookID') }} | |||
</view> | |||
<!-- <l-customlist-action showEdit @edit="action('edit', item.ID)" showDelete @delete="action('delete', item.ID)" @view="action('view', item.ID)" /> --> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
<!-- 关闭侧边抽屉按钮 --> | |||
<view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose"> | |||
<l-icon type="pullright" color="blue" /> | |||
</view> | |||
<!-- 侧边栏,用于设置查询条件 --> | |||
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y> | |||
<view v-if="ready" class="padding"> | |||
<l-customlist-sidepage-datefilter | |||
v-model="dateRange" | |||
@change="searchChange" | |||
title="按时间日期查询: " | |||
ref="datefilter" | |||
class="margin-bottom" | |||
/> | |||
<l-input | |||
v-model="queryData.LibraryCard" | |||
@change="searchChange" | |||
title ="借书证" | |||
placeholder="按借书证查询" | |||
/> | |||
<l-input | |||
v-model="queryData.BookID" | |||
@change="searchChange" | |||
title ="图书编号" | |||
placeholder="按图书编号查询" | |||
/> | |||
<!-- 重置查询条件按钮 --> | |||
<view class="padding-tb"> | |||
<l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button> | |||
</view> | |||
</view> | |||
</scroll-view> | |||
<!-- <l-customlist-add v-if="!sideOpen" @click="action('add')" /> --> | |||
</view> | |||
</template> | |||
<script> | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-14 11:43 | |||
* 描 述:1111 | |||
*/ | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-14 11:43 | |||
* 描 述:1111 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/BookBorrow/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/BookBorrow/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
import moment from 'moment' | |||
import get from 'lodash/get' | |||
import set from 'lodash/set' | |||
import pickBy from 'lodash/pickBy' | |||
import mapValues from 'lodash/mapValues' | |||
export default { | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
BorrowTime: { type: 'text' }, | |||
ReturnTime: { type: 'text' }, | |||
LibraryCard: { type: 'text' }, | |||
BookID: { type: 'text' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
LibraryCard: '', | |||
BookID: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationBookBorrow-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationBookBorrow-list-change', this.refreshList) | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
() => {} | |||
]) | |||
await this.fetchList() | |||
// 初始化查询条件 | |||
this.defaultQueryData = this.COPY(this.queryData) | |||
this.ready = true | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { return } | |||
const result = await this.HTTP_GET( | |||
'/EducationalAdministration/BookBorrow/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'ID', sord: 'DESC' }, | |||
queryJson: JSON.stringify(this.searchData) | |||
}, | |||
'加载数据时出错' | |||
) | |||
if (!result) { return } | |||
this.total = result.total | |||
this.page = result.page + 1 | |||
this.list = this.list.concat(result.rows) | |||
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项` | |||
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多' | |||
}, | |||
// 刷新清空列表 | |||
async refreshList() { | |||
this.page = 1 | |||
this.total = 2 | |||
this.list = [] | |||
await this.fetchList() | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.list.stopPullDown() | |||
}) | |||
}, | |||
// 设置搜索条件 | |||
async searchChange() { | |||
const result = {} | |||
// 时间查询相关参数 | |||
if (this.dateRange) { | |||
result.StartTime = this.dateRange.start | |||
result.EndTime = this.dateRange.end | |||
} | |||
// 将其他查询项添加到查询 JSON 中 | |||
const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t)) | |||
Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t))) | |||
this.searchData = result | |||
await this.refreshList() | |||
}, | |||
// 点击「清空查询条件」按钮 | |||
reset() { | |||
this.$refs.datefilter.changeDateRange('all') | |||
this.queryData = this.COPY(this.defaultQueryData) | |||
this.searchChange() | |||
}, | |||
// 点击「编辑」、「查看」、「添加」、「删除」按钮 | |||
async action(type, id = '') { | |||
switch (type) { | |||
case 'view': | |||
this.NAV_TO(`./single?type=view&id=${id}`) | |||
return | |||
case 'add': | |||
this.NAV_TO('./single?type=create') | |||
return | |||
case 'edit': | |||
this.NAV_TO(`./single?type=edit&id=${id}`) | |||
return | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('/EducationalAdministration/BookBorrow/delete', id, '删除失败').then(success => { | |||
if(!success) { return } | |||
this.TOAST('删除成功', 'success') | |||
this.refreshList() | |||
}) | |||
return | |||
default: | |||
return | |||
} | |||
}, | |||
// 显示列表中的标题项 | |||
displayListItem(item, field) { | |||
const fieldItem = this.scheme[field] | |||
const value = item[field] | |||
switch (fieldItem.type) { | |||
case 'currentInfo': | |||
case 'organize': | |||
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '') | |||
case 'radio': | |||
case 'select': | |||
const selectItem = this.dataSource[field].find(t => t.value === String(value)) | |||
return get(selectItem, 'text', '') | |||
case 'checkbox': | |||
if (!value || value.split(',').length <= 0) { return '' } | |||
const checkboxItems = value.split(',') | |||
return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',') | |||
case 'datetime': | |||
if (!value) { return '' } | |||
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm') | |||
default: return value === null || value === undefined ? '' : value | |||
} | |||
} | |||
} | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
BorrowTime: { type: 'text' }, | |||
ReturnTime: { type: 'text' }, | |||
LibraryCard: { type: 'text' }, | |||
BookID: { type: 'text' }, | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
LibraryCard: '', | |||
BookID: '', | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
}, | |||
// 时间查询参数 | |||
dateRange: null, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: '加载中...', | |||
loadState: '向下翻以加载更多', | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [] | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationBookBorrow-list-change') | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON('EducationalAdministrationBookBorrow-list-change', this.refreshList) | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
() => {} | |||
]) | |||
await this.fetchList() | |||
// 初始化查询条件 | |||
this.defaultQueryData = this.COPY(this.queryData) | |||
this.ready = true | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { return } | |||
const result = await this.HTTP_GET( | |||
'learun/adms/EducationalAdministration/BookBorrow/pagelist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: 'ID', sord: 'DESC' }, | |||
queryJson: JSON.stringify(this.searchData) | |||
}, | |||
'加载数据时出错' | |||
) | |||
if (!result) { return } | |||
this.total = result.total | |||
this.page = result.page + 1 | |||
this.list = this.list.concat(result.rows) | |||
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项` | |||
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多' | |||
}, | |||
// 刷新清空列表 | |||
async refreshList() { | |||
this.page = 1 | |||
this.total = 2 | |||
this.list = [] | |||
await this.fetchList() | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.list.stopPullDown() | |||
}) | |||
}, | |||
// 设置搜索条件 | |||
async searchChange() { | |||
const result = {} | |||
// 时间查询相关参数 | |||
if (this.dateRange) { | |||
result.StartTime = this.dateRange.start | |||
result.EndTime = this.dateRange.end | |||
} | |||
// 将其他查询项添加到查询 JSON 中 | |||
const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t)) | |||
Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t))) | |||
this.searchData = result | |||
await this.refreshList() | |||
}, | |||
// 点击「清空查询条件」按钮 | |||
reset() { | |||
this.$refs.datefilter.changeDateRange('all') | |||
this.queryData = this.COPY(this.defaultQueryData) | |||
this.searchChange() | |||
}, | |||
// 点击「编辑」、「查看」、「添加」、「删除」按钮 | |||
async action(type, id = '') { | |||
switch (type) { | |||
case 'view': | |||
this.NAV_TO(`./single?type=view&id=${id}`) | |||
return | |||
case 'add': | |||
this.NAV_TO('./single?type=create') | |||
return | |||
case 'edit': | |||
this.NAV_TO(`./single?type=edit&id=${id}`) | |||
return | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||
return | |||
} | |||
this.HTTP_POST('learun/adms/EducationalAdministration/BookBorrow/delete', id, '删除失败').then(success => { | |||
if(!success) { return } | |||
this.TOAST('删除成功', 'success') | |||
this.refreshList() | |||
}) | |||
return | |||
default: | |||
return | |||
} | |||
}, | |||
// 显示列表中的标题项 | |||
displayListItem(item, field) { | |||
const fieldItem = this.scheme[field] | |||
const value = item[field] | |||
switch (fieldItem.type) { | |||
case 'currentInfo': | |||
case 'organize': | |||
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '') | |||
case 'radio': | |||
case 'select': | |||
const selectItem = this.dataSource[field].find(t => t.value === String(value)) | |||
return get(selectItem, 'text', '') | |||
case 'checkbox': | |||
if (!value || value.split(',').length <= 0) { return '' } | |||
const checkboxItems = value.split(',') | |||
return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',') | |||
case 'datetime': | |||
if (!value) { return '' } | |||
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm') | |||
default: return value === null || value === undefined ? '' : value | |||
} | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; |
@@ -1,55 +1,55 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-date-picker | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-date-picker | |||
@input="setValue('EmpInfo.Birthday', $event)" | |||
:value="getValue('EmpInfo.Birthday')" | |||
:disabled="!edit" | |||
title="出生日期" | |||
/> | |||
<l-select | |||
<l-select | |||
@input="setValue('EmpInfo.PartyFaceNo', $event)" | |||
:value="getValue('EmpInfo.PartyFaceNo')" | |||
:disabled="!edit" | |||
:range="dataSource.EmpInfo.PartyFaceNo" | |||
title="政治面貌" | |||
/> | |||
<l-select | |||
<l-select | |||
@input="setValue('EmpInfo.NationalityNo', $event)" | |||
:value="getValue('EmpInfo.NationalityNo')" | |||
:disabled="!edit" | |||
:range="dataSource.EmpInfo.NationalityNo" | |||
title="民族" | |||
/> | |||
<l-upload-file | |||
<l-upload-file | |||
@input="setValue('EmpInfo.Photo', $event)" | |||
:value="getValue('EmpInfo.Photo')" | |||
:readonly="!edit" | |||
:number="1" | |||
title="照片上传" | |||
/> | |||
<l-input | |||
<l-input | |||
@input="setValue('EmpInfo.mobile', $event)" | |||
:value="getValue('EmpInfo.mobile')" | |||
:disabled="!edit" | |||
title="电话" | |||
required | |||
/> | |||
<l-input | |||
<l-input | |||
@input="setValue('EmpInfo.EMail', $event)" | |||
:value="getValue('EmpInfo.EMail')" | |||
:disabled="!edit" | |||
title="邮箱" | |||
required | |||
/> | |||
</view | |||
</view | |||
> | |||
<view | |||
<view | |||
v-if="ready" | |||
class="bg-white margin-tb padding" | |||
style="padding-top: 0; overflow: hidden" | |||
> | |||
<l-button | |||
<l-button | |||
v-if="edit" | |||
@click="action('save')" | |||
size="lg" | |||
@@ -57,9 +57,9 @@ | |||
class="block margin-top" | |||
block | |||
> | |||
提交保存 </l-button | |||
提交保存 </l-button | |||
> | |||
<l-button | |||
<l-button | |||
v-if="!edit && mode !== 'create'" | |||
@click="action('edit')" | |||
size="lg" | |||
@@ -67,9 +67,9 @@ | |||
class="block margin-top" | |||
block | |||
> | |||
编辑本页 </l-button | |||
编辑本页 </l-button | |||
> | |||
<l-button | |||
<l-button | |||
v-if="edit && mode !== 'create'" | |||
@click="action('reset')" | |||
size="lg" | |||
@@ -77,22 +77,22 @@ | |||
class="block margin-top" | |||
block | |||
> | |||
取消编辑 </l-button | |||
取消编辑 </l-button | |||
> | |||
</view | |||
</view | |||
> | |||
</view | |||
</view | |||
> | |||
</template> | |||
<script> | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-19 11:55 | |||
* 描 述:个人信息 | |||
* 日 期:2020-10-19 11:55 | |||
* 描 述:个人信息 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
@@ -166,7 +166,7 @@ export default { | |||
this.origin = await this.getDefaultForm(); | |||
} else { | |||
const result = await this.HTTP_GET( | |||
"/EducationalAdministration/EmpRegister/formForNo", | |||
"learun/adms/EducationalAdministration/EmpRegister/formForNo", | |||
this.id | |||
); | |||
this.id=result.EmpInfo.EmpId; | |||
@@ -202,7 +202,7 @@ export default { | |||
this.LOADING("正在提交..."); | |||
const postData = await this.getPostData(this.id); | |||
this.HTTP_POST( | |||
"/EducationalAdministration/EmpRegister/save", | |||
"learun/adms/EducationalAdministration/EmpRegister/save", | |||
postData, | |||
"表单提交保存失败" | |||
).then((success) => { | |||
@@ -221,7 +221,7 @@ export default { | |||
} | |||
this.LOADING("提交删除中..."); | |||
this.HTTP_POST( | |||
"/EducationalAdministration/EmpRegister/delete", | |||
"learun/adms/EducationalAdministration/EmpRegister/delete", | |||
this.id, | |||
"删除失败" | |||
).then((success) => { | |||
@@ -1,252 +1,252 @@ | |||
<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.VID"> | |||
<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, 'EmpName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">课程名称:</text> | |||
{{ displayListItem(item, 'LessonName') }} | |||
<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.VID"> | |||
<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, 'EmpName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">课程名称:</text> | |||
{{ displayListItem(item, 'LessonName') }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">评教状态:</text> | |||
{{ displayListItem(item, 'UID') }} | |||
</view> | |||
<l-customlist-action @view="action('view', item)" /> | |||
</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> | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">评教状态:</text> | |||
{{ displayListItem(item, 'UID') }} | |||
</view> | |||
<l-customlist-action @view="action('view', item)" /> | |||
</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> | |||
</view> | |||
</template> | |||
<script> | |||
/* | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-16 15:39 | |||
* 描 述:工作日志 | |||
*/ | |||
* 版 本 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/Journal/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/Journal/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'}, | |||
EmpName: { type: 'text'}, | |||
LessonName: { type: 'text' }, | |||
UID: { type: 'bit' }, | |||
}, | |||
// 查询条件 | |||
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( | |||
'/eval/studentlist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: '', 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, item) { | |||
data() { | |||
return { | |||
// 数据项的数据类型、结构 | |||
scheme: { | |||
AcademicYearNo: { type: 'text' }, | |||
Semester: { type: 'text'}, | |||
EmpName: { type: 'text'}, | |||
LessonName: { type: 'text' }, | |||
UID: { type: 'bit' }, | |||
}, | |||
// 查询条件 | |||
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( | |||
'learun/adms/eval/studentlist', | |||
{ | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { rows: 10, page: this.page, sidx: '', 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, item) { | |||
this.NAV_TO(`./single?type=view&id=${item.VID}&EmpNo=${item.EmpNo}&LessonNo=${item.LessonNo}`) | |||
}, | |||
// 显示列表中的标题项 | |||
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') | |||
}, | |||
// 显示列表中的标题项 | |||
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') | |||
case 'bit': | |||
return (value != undefined && value!== '') ? "已评" : "未评" | |||
default: return value === null || value === undefined ? '' : value | |||
} | |||
} | |||
} | |||
default: return value === null || value === undefined ? '' : value | |||
} | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; |
@@ -1,217 +1,217 @@ | |||
<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> | |||
<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 | |||
* 描 述:工作日志 | |||
*/ | |||
* 版 本 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 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 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('/eval/paper', {VID:this.id}) | |||
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('learun/adms/eval/paper', {VID:this.id}) | |||
console.log(result); | |||
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/Journal/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/Journal/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) | |||
} | |||
} | |||
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('learun/adms/EducationalAdministration/Journal/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('learun/adms/EducationalAdministration/Journal/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> |
@@ -1,272 +1,272 @@ | |||
<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> | |||
<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 | |||
* 描 述:工作日志 | |||
*/ | |||
* 版 本 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/Journal/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/Journal/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/Journal/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/Journal/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: { | |||
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( | |||
'learun/adms/EducationalAdministration/Journal/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('learun/adms/EducationalAdministration/Journal/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,216 +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> | |||
<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 | |||
* 描 述:工作日志 | |||
*/ | |||
* 版 本 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 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 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/Journal/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/Journal/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/Journal/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) | |||
} | |||
} | |||
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('learun/adms/EducationalAdministration/Journal/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('learun/adms/EducationalAdministration/Journal/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('learun/adms/EducationalAdministration/Journal/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,111 @@ | |||
<template> | |||
<view class="page"> | |||
<l-input title="学年" placeholder="请填写学年" :value="data.AcademicYearNo" disabled right /> | |||
<l-input title="学期" placeholder="请填写学期" :value="data.Semester" disabled right /> | |||
<l-input title="课程名称" placeholder="请填写课程名称" :value="data.LessonName" disabled right /> | |||
<view class="txt">课程简介:</view> | |||
<view class="remarks"> | |||
<!-- <l-textarea class="remarks" title="课程简介" :value="data.Introduction" placeholder="输入点什么..." readonly="readonly" /> --> | |||
<textarea disabled auto-height='true' :value="data.Introduction" /> | |||
</view> | |||
<l-input title="上课节次" placeholder="请填写上课节次" :value="data.LessonSection" disabled right /> | |||
<l-input title="上课时间" placeholder="请填写上课时间" :value="data.LessonTime" disabled right /> | |||
<l-input title="学分" placeholder="请填写学分" :value="data.StudyScore" disabled right /> | |||
<l-input title="教师姓名" placeholder="请填写教师姓名" :value="data.EmpName" disabled right /> | |||
<!-- <view class="txt">教师简介:</view> | |||
<view class="bg-white"> | |||
<l-textarea :value="data.resume" disabled placeholder="输入点什么..." readonly="readonly" /> | |||
</view> --> | |||
<view class="txt">教师简介:</view> | |||
<view class="remarks"> | |||
<!-- <l-textarea class="remarks" title="课程简介" :value="data.Introduction" placeholder="输入点什么..." readonly="readonly" /> --> | |||
<textarea disabled auto-height='true' :value="data.resume" /> | |||
</view> | |||
<l-input title="教室名称" placeholder="请填写教室名称" :value="data.ClassRoomName" disabled right /> | |||
<!-- <l-input title="姓名" placeholder="请填写姓名" :value="data.AcademicYearNo" disabled right /> --> | |||
<l-input title="人数上限" placeholder="请填写人数上限" :value="data.StuNumMax" disabled right /> | |||
<l-input title="已报名人数" placeholder="请填写已报名人数" :value="data.StuNum" disabled right /> | |||
<view class="btn" @click="fromBtn">报名</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default{ | |||
data() { | |||
return { | |||
weekChina: ["一", "二", "三", "四", "五", "六", "日"], | |||
keyValue: '', | |||
data: {} | |||
} | |||
}, | |||
methods:{ | |||
init() { | |||
this.keyValue = this.GET_PARAM(); //获取页面传递参数 | |||
// console.log(this.keyValue); | |||
let _this = this; | |||
_this.LOADING('加载数据中…'); | |||
_this.HTTP_GET('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/form', _this.keyValue, '加载数据时出错').then(res => { | |||
this.HIDE_LOADING(); | |||
// console.log(res); | |||
_this.data = res.JournalReceive; | |||
}); | |||
}, | |||
fromBtn() { | |||
var _postData = {} | |||
let _this = this; | |||
let user = this.GET_GLOBAL('loginUser');; | |||
_postData.keyValue = this.keyValue; | |||
_postData.StuNo = user.account; | |||
_this.LOADING('正在提交…'); | |||
_this.HTTP_POST('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/SignInByMobile', _postData, '加载数据时出错').then((res,info, code) => { | |||
// this.HIDE_LOADING(); | |||
console.log(res); | |||
// console.log(info); | |||
// console.log(code); | |||
if (res) {// 表单数据保存成功 | |||
//判断队列结果 | |||
let timer = setInterval(function () { | |||
// _this.LOADING('正在提交…'); | |||
_this.HTTP_POST('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/GetApplyResult', _postData, '加载数据时出错').then((dataresult) => { | |||
_this.HIDE_LOADING(); | |||
console.log(dataresult) | |||
clearInterval(timer); | |||
_this.EMIT('OpenLessonPlanOfElectiveStudent') | |||
_this.TOAST(dataresult.msg); | |||
// _this.NAV_BACK() | |||
}); | |||
}, 5000); | |||
} | |||
}); | |||
} | |||
}, | |||
created() { | |||
this.init() | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
.txt{ | |||
line-height: 24px; | |||
font-size: 15px; | |||
background-color: #fff; | |||
padding: 10px 0 10px 15px; | |||
} | |||
.page{ | |||
background-color: #fff; | |||
padding-bottom: 1px; | |||
} | |||
/deep/ .cu-form-group uni-textarea{ | |||
height: auto; | |||
} | |||
.remarks{ | |||
border-bottom: 0.5px solid #eee; | |||
padding-bottom: 10px; | |||
} | |||
.remarks textarea{ | |||
width: 100%; | |||
padding: 0 15px; | |||
} | |||
</style> |
@@ -0,0 +1,237 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;"> | |||
<!-- <l-customlist-banner></l-customlist-banner> --> | |||
<view class="records">共 {{ records }} 条数据</view> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data"> | |||
<l-customlist :tips="loadState" showTips> | |||
<view class="pageBox customlist-item" showDelete="true" v-for="(item, ind) in data" :key="item.MakeDate" @click="tapClick(item)"> | |||
<view class=""> | |||
<text>学年:</text> | |||
{{ item.AcademicYearNo }} | |||
</view> | |||
<view class=""> | |||
<text>学期:</text> | |||
{{ item.Semester }} | |||
</view> | |||
<view class=""> | |||
<text>课程名称:</text> | |||
{{ item.LessonName }} | |||
</view> | |||
<view class=""> | |||
<text>上课节次:</text> | |||
{{ jieci(item.LessonSection) }} | |||
</view> | |||
<view class=""> | |||
<text>上课时间:</text> | |||
{{ item.LessonTime }} | |||
</view> | |||
<view class=""> | |||
<text>学分:</text> | |||
{{ item.StudyScore }} | |||
</view> | |||
<view class=""> | |||
<text>教师姓名:</text> | |||
{{ item.EmpName }} | |||
</view> | |||
<view class=""> | |||
<text>教室名称:</text> | |||
{{ item.ClassRoomNo }} | |||
</view> | |||
<view class=""> | |||
<text>人数上限:</text> | |||
{{ item.StuNumMax }} | |||
</view> | |||
<view class=""> | |||
<text>已报名人数:</text> | |||
{{ item.StuNumOfApplyPre }} | |||
</view> | |||
<view class="pageType">{{ typePd(item.StatusPre) }}</view> | |||
<view class="delbtn" @click.stop="delTap(item)">取消报名</view> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
weekChina: ['一', '二', '三', '四', '五', '六', '日'], | |||
user: null, | |||
data: [], | |||
total: 1, | |||
records: 0, | |||
ready: false, | |||
page: 1, | |||
rows: 10, | |||
multipleData: null, | |||
sideOpen: false, | |||
loadState: '向下翻以加载更多' | |||
}; | |||
}, | |||
onUnload() { | |||
this.OFF('OpenLessonPlanOfElectiveStudent'); | |||
}, | |||
methods: { | |||
init() { | |||
this.ON('OpenLessonPlanOfElectiveStudent', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
Promise.all([() => {}]); | |||
var _this = this; | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
this.fetchList(); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
let _this = this; | |||
let _postParam = { | |||
pagination: { | |||
rows: _this.rows, | |||
page: _this.page, | |||
sidx: 'LessonNo', | |||
sord: 'asc' | |||
}, | |||
queryJson: '{}' | |||
}; | |||
if (true) { | |||
_postParam.queryJson = JSON.stringify({ | |||
StuNo: _this.user.account, | |||
StuMajorNo: _this.user.majorno, | |||
StuGrade: _this.user.grade | |||
}); | |||
} | |||
// console.log(_this.user) | |||
_this.LOADING('加载数据中…') | |||
_this.HTTP_GET('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/pagelist', _postParam, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
// console.log(res); | |||
this.data = this.data.concat(res.rows); | |||
_this.total = res.total; | |||
_this.records = res.records; | |||
this.page = res.page + 1; | |||
this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多'; | |||
// console.log(_this.data); | |||
}); | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.data.stopPullDown(); | |||
}); | |||
}, | |||
async refreshList() { | |||
this.page = 1; | |||
this.total = 1; | |||
this.data = []; | |||
this.fetchList(); | |||
}, | |||
tapClick(data) { | |||
this.NAV_TO('./from', data.Id, true); | |||
}, | |||
delTap (item) { | |||
// console.log(item) | |||
let _this = this; | |||
this.CONFIRM('数字化校园提示', '确定要取消报名吗?', true).then( res => { | |||
if(res){ | |||
let _postData = { | |||
keyValue: item.Id, | |||
StuNo: _this.user.account | |||
} | |||
_this.LOADING('正在取消报名…') | |||
_this.HTTP_POST( | |||
'learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/Cancel', | |||
_postData, | |||
'加载数据时出错' | |||
).then( data => { | |||
_this.HIDE_LOADING() | |||
console.log(data) | |||
if (data) {// 成功 | |||
this.TOAST('取消报名成功!'); | |||
this.refreshList() | |||
} | |||
}) | |||
} | |||
}) | |||
} | |||
}, | |||
computed: { | |||
jieci() { | |||
return str => { | |||
let ls = ''; | |||
if (str.indexOf(',') == -1) ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1) + '节'; | |||
else ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1, 2) + '、' + str.slice(4) + '节'; | |||
return ls; | |||
}; | |||
}, | |||
typePd() { | |||
return num => { | |||
let txt = ''; | |||
if (num == 1) { | |||
txt = '审核中'; | |||
} else if (num == 2) { | |||
txt = '报名成功'; | |||
} else if (num == 3) { | |||
txt = '报名失败'; | |||
} else { | |||
txt = '未报名'; | |||
} | |||
return txt; | |||
}; | |||
} | |||
}, | |||
created() { | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
.page { | |||
background-color: #fff; | |||
} | |||
.page-content { | |||
margin-top: 39px; | |||
} | |||
.records { | |||
color: #8f8f94; | |||
background: #ffffff; | |||
padding: 10px 12px; | |||
width: 100%; | |||
vertical-align: middle; | |||
border-bottom: 0.5px solid #ddd; | |||
position: fixed; | |||
top: var(--window-top); | |||
z-index: 1024; | |||
border-bottom: 0.5px solid #ddd; | |||
height: 40px; | |||
width: 100%; | |||
box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1); | |||
// background: #f1f1f1; | |||
} | |||
.pageBox { | |||
// margin-top: 34px; | |||
padding: 5px 15px; | |||
line-height: 24px; | |||
border-bottom: 5px solid #f5f5f5; | |||
} | |||
.delbtn { | |||
position: absolute; | |||
right: 15px; | |||
bottom: 7px; | |||
padding: 3px 10px; | |||
background: #dd524d; | |||
color: #fff; | |||
border-radius: 3px; | |||
} | |||
</style> |
@@ -0,0 +1,99 @@ | |||
<template> | |||
<view class="page"> | |||
<l-input title="学年" placeholder="请填写学年" :value="data.AcademicYearNo" disabled right /> | |||
<l-input title="学期" placeholder="请填写学期" :value="data.Semester" disabled right /> | |||
<l-input title="课程名称" placeholder="请填写课程名称" :value="data.LessonName" disabled right /> | |||
<view class="txt">课程简介:</view> | |||
<view class="remarks"> | |||
<!-- <l-textarea class="remarks" title="课程简介" :value="data.Introduction" placeholder="输入点什么..." readonly="readonly" /> --> | |||
<textarea disabled auto-height='true' :value="data.Introduction" /> | |||
</view> | |||
<l-input title="上课节次" placeholder="请填写上课节次" :value="data.LessonSection" disabled right /> | |||
<l-input title="上课时间" placeholder="请填写上课时间" :value="data.LessonTime" disabled right /> | |||
<l-input title="学分" placeholder="请填写学分" :value="data.StudyScore" disabled right /> | |||
<l-input title="教师姓名" placeholder="请填写教师姓名" :value="data.EmpName" disabled right /> | |||
<!-- <view class="txt">教师简介:</view> | |||
<view class="bg-white"> | |||
<l-textarea :value="data.resume" disabled placeholder="输入点什么..." readonly="readonly" /> | |||
</view> --> | |||
<view class="txt">教师简介:</view> | |||
<view class="remarks"> | |||
<!-- <l-textarea class="remarks" title="课程简介" :value="data.Introduction" placeholder="输入点什么..." readonly="readonly" /> --> | |||
<textarea disabled auto-height='true' :value="data.resume" /> | |||
</view> | |||
<l-input title="教室名称" placeholder="请填写教室名称" :value="data.ClassRoomName" disabled right /> | |||
<!-- <l-input title="姓名" placeholder="请填写姓名" :value="data.AcademicYearNo" disabled right /> --> | |||
<l-input title="人数上限" placeholder="请填写人数上限" :value="data.StuNumMax" disabled right /> | |||
<l-input title="已报名人数" placeholder="请填写已报名人数" :value="data.StuNum" disabled right /> | |||
<view class="btn" @click="fromBtn">报名</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default{ | |||
data() { | |||
return { | |||
weekChina: ["一", "二", "三", "四", "五", "六", "日"], | |||
keyValue: '', | |||
data: {} | |||
} | |||
}, | |||
methods:{ | |||
init() { | |||
this.keyValue = this.GET_PARAM(); //获取页面传递参数 | |||
console.log(this.keyValue); | |||
let _this = this; | |||
_this.LOADING('加载数据中…'); | |||
_this.HTTP_GET('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/form', _this.keyValue, '加载数据时出错').then(res => { | |||
this.HIDE_LOADING(); | |||
console.log(res); | |||
_this.data = res.JournalReceive; | |||
}); | |||
}, | |||
fromBtn() { | |||
var _postData = {} | |||
let _this = this; | |||
let user = this.GET_GLOBAL('loginUser');; | |||
_postData.keyValue = this.keyValue; | |||
_postData.StuNo = user.account; | |||
_this.LOADING('提交数据中…'); | |||
_this.HTTP_POST('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/SignInPre', _postData, '加载数据时出错').then(res => { | |||
this.HIDE_LOADING(); | |||
console.log(res); | |||
if(res){ | |||
this.TOAST('提交成功'); | |||
this.EMIT('OpenLessonPlanOfElectiveStudentPre') | |||
this.NAV_BACK() | |||
} | |||
}); | |||
} | |||
}, | |||
created() { | |||
this.init() | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
.txt{ | |||
line-height: 24px; | |||
font-size: 15px; | |||
background-color: #fff; | |||
padding: 10px 0 10px 15px; | |||
} | |||
.page{ | |||
background-color: #fff; | |||
padding-bottom: 1px; | |||
} | |||
/deep/ .cu-form-group uni-textarea{ | |||
height: auto; | |||
} | |||
.remarks{ | |||
border-bottom: 0.5px solid #eee; | |||
padding-bottom: 10px; | |||
} | |||
.remarks textarea{ | |||
width: 100%; | |||
padding: 0 15px; | |||
} | |||
</style> |
@@ -0,0 +1,238 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;"> | |||
<!-- <l-customlist-banner></l-customlist-banner> --> | |||
<view class="records">共 {{ records }} 条数据</view> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data"> | |||
<l-customlist :tips="loadState" showTips> | |||
<view class="pageBox customlist-item" showDelete="true" v-for="(item, ind) in data" :key="item.MakeDate" @click="tapClick(item)"> | |||
<view class=""> | |||
<text>学年:</text> | |||
{{ item.AcademicYearNo }} | |||
</view> | |||
<view class=""> | |||
<text>学期:</text> | |||
{{ item.Semester }} | |||
</view> | |||
<view class=""> | |||
<text>课程名称:</text> | |||
{{ item.LessonName }} | |||
</view> | |||
<view class=""> | |||
<text>上课节次:</text> | |||
{{ jieci(item.LessonSection) }} | |||
</view> | |||
<view class=""> | |||
<text>上课时间:</text> | |||
{{ item.LessonTime }} | |||
</view> | |||
<view class=""> | |||
<text>学分:</text> | |||
{{ item.StudyScore }} | |||
</view> | |||
<view class=""> | |||
<text>教师姓名:</text> | |||
{{ item.EmpName }} | |||
</view> | |||
<view class=""> | |||
<text>教室名称:</text> | |||
{{ item.ClassRoomNo }} | |||
</view> | |||
<view class=""> | |||
<text>人数上限:</text> | |||
{{ item.StuNumMax }} | |||
</view> | |||
<view class=""> | |||
<text>已报名人数:</text> | |||
{{ item.StuNumOfApplyPre }} | |||
</view> | |||
<view class="pageType">{{ typePd(item.StatusPre) }}</view> | |||
<view class="delbtn" @click.stop="delTap(item)">取消报名</view> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
weekChina: ['一', '二', '三', '四', '五', '六', '日'], | |||
user: null, | |||
data: [], | |||
total: 1, | |||
records: 0, | |||
ready: false, | |||
page: 1, | |||
rows: 10, | |||
multipleData: null, | |||
sideOpen: false, | |||
loadState: '向下翻以加载更多' | |||
}; | |||
}, | |||
onUnload() { | |||
this.OFF('OpenLessonPlanOfElectiveStudentPre'); | |||
}, | |||
methods: { | |||
init() { | |||
this.ON('OpenLessonPlanOfElectiveStudentPre', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
Promise.all([() => {}]); | |||
var _this = this; | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
this.fetchList(); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
let _this = this; | |||
let _postParam = { | |||
pagination: { | |||
rows: _this.rows, | |||
page: _this.page, | |||
sidx: 'LessonNo', | |||
sord: 'asc' | |||
}, | |||
queryJson: '{}' | |||
}; | |||
if (true) { | |||
_postParam.queryJson = JSON.stringify({ | |||
StuNo: _this.user.account, | |||
StuMajorNo: _this.user.majorno, | |||
StuGrade: _this.user.grade | |||
}); | |||
} | |||
_this.LOADING('加载数据中…') | |||
_this.HTTP_GET('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/pagelist', _postParam, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
// console.log(res); | |||
this.data = this.data.concat(res.rows); | |||
_this.total = res.total; | |||
_this.records = res.records; | |||
this.page = res.page + 1; | |||
this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多'; | |||
// console.log(_this.data); | |||
}); | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.data.stopPullDown(); | |||
}); | |||
}, | |||
async refreshList() { | |||
this.page = 1; | |||
this.total = 1; | |||
this.data = []; | |||
this.fetchList(); | |||
}, | |||
tapClick(data) { | |||
this.NAV_TO('./from', data.Id, true); | |||
}, | |||
delTap (item) { | |||
// console.log(item) | |||
let _this = this; | |||
this.CONFIRM('数字化校园提示', '确定要取消报名吗?', true).then( res => { | |||
if(res){ | |||
let _postData = { | |||
keyValue: item.Id, | |||
StuNo: _this.user.account | |||
} | |||
_this.LOADING('正在取消报名…') | |||
console.log(123); | |||
_this.HTTP_POST( | |||
'learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/CancelPre', | |||
_postData, | |||
'加载数据时出错' | |||
).then( (data) => { | |||
_this.HIDE_LOADING() | |||
console.log(data) | |||
if (data) {// 成功 | |||
_this.TOAST('取消报名成功!'); | |||
this.refreshList() | |||
// item.pageType = | |||
} | |||
}) | |||
} | |||
}) | |||
} | |||
}, | |||
computed: { | |||
jieci() { | |||
return str => { | |||
let ls = ''; | |||
if (str.indexOf(',') == -1) ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1) + '节'; | |||
else ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1, 2) + '、' + str.slice(4) + '节'; | |||
return ls; | |||
}; | |||
}, | |||
typePd() { | |||
return num => { | |||
let txt = ''; | |||
if (num == 1) { | |||
txt = '审核中'; | |||
} else if (num == 2) { | |||
txt = '报名成功'; | |||
} else if (num == 3) { | |||
txt = '报名失败'; | |||
} else { | |||
txt = '未报名'; | |||
} | |||
return txt; | |||
}; | |||
} | |||
}, | |||
created() { | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
.page { | |||
background-color: #fff; | |||
} | |||
.page-content { | |||
margin-top: 39px; | |||
} | |||
.records { | |||
color: #8f8f94; | |||
background: #ffffff; | |||
padding: 10px 12px; | |||
width: 100%; | |||
vertical-align: middle; | |||
border-bottom: 0.5px solid #ddd; | |||
position: fixed; | |||
top: var(--window-top); | |||
z-index: 1024; | |||
border-bottom: 0.5px solid #ddd; | |||
height: 40px; | |||
width: 100%; | |||
box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1); | |||
// background: #f1f1f1; | |||
} | |||
.pageBox { | |||
// margin-top: 34px; | |||
padding: 5px 15px; | |||
line-height: 24px; | |||
border-bottom: 5px solid #f5f5f5; | |||
} | |||
.delbtn { | |||
position: absolute; | |||
right: 15px; | |||
bottom: 7px; | |||
padding: 3px 10px; | |||
background: #dd524d; | |||
color: #fff; | |||
border-radius: 3px; | |||
} | |||
</style> |
@@ -0,0 +1,83 @@ | |||
<template> | |||
<view class="page"> | |||
<l-input title="学年" placeholder="请填写学年" :value="data.AcademicYearNo" disabled right /> | |||
<l-input title="学期" placeholder="请填写学期" :value="data.Semester" disabled right /> | |||
<l-input title="课程名称" placeholder="请填写课程名称" :value="data.LessonName" disabled right /> | |||
<view class="txt">课程简介:</view> | |||
<view class="remarks"> | |||
<!-- <l-textarea class="remarks" title="课程简介" :value="data.Introduction" placeholder="输入点什么..." readonly="readonly" /> --> | |||
<textarea disabled auto-height='true' :value="data.Introduction" /> | |||
</view> | |||
<l-input title="上课节次" placeholder="请填写上课节次" :value="data.LessonSection" disabled right /> | |||
<l-input title="上课时间" placeholder="请填写上课时间" :value="data.LessonTime" disabled right /> | |||
<l-input title="学分" placeholder="请填写学分" :value="data.StudyScore" disabled right /> | |||
<l-input title="教师姓名" placeholder="请填写教师姓名" :value="data.EmpName" disabled right /> | |||
<!-- <view class="txt">教师简介:</view> | |||
<view class="bg-white"> | |||
<l-textarea :value="data.resume" disabled placeholder="输入点什么..." readonly="readonly" /> | |||
</view> --> | |||
<view class="txt">教师简介:</view> | |||
<view class="remarks"> | |||
<!-- <l-textarea class="remarks" title="课程简介" :value="data.Introduction" placeholder="输入点什么..." readonly="readonly" /> --> | |||
<textarea disabled auto-height='true' :value="data.resume" /> | |||
</view> | |||
<l-input title="教室名称" placeholder="请填写教室名称" :value="data.ClassRoomName" disabled right /> | |||
<!-- <l-input title="姓名" placeholder="请填写姓名" :value="data.AcademicYearNo" disabled right /> --> | |||
<l-input title="人数上限" placeholder="请填写人数上限" :value="data.StuNumMax" disabled right /> | |||
<l-input title="已报名人数" placeholder="请填写已报名人数" :value="data.StuNum" disabled right /> | |||
<!-- <view class="btn" @click="fromBtn">报名</view> --> | |||
</view> | |||
</template> | |||
<script> | |||
export default{ | |||
data() { | |||
return { | |||
weekChina: ["一", "二", "三", "四", "五", "六", "日"], | |||
keyValue: '', | |||
data: {} | |||
} | |||
}, | |||
methods:{ | |||
init() { | |||
this.keyValue = this.GET_PARAM(); //获取页面传递参数 | |||
console.log(this.keyValue); | |||
let _this = this; | |||
_this.LOADING('加载数据中…'); | |||
_this.HTTP_GET('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/form', _this.keyValue, '加载数据时出错').then(res => { | |||
this.HIDE_LOADING(); | |||
console.log(res); | |||
_this.data = res.JournalReceive; | |||
}); | |||
}, | |||
}, | |||
created() { | |||
this.init() | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
.txt{ | |||
line-height: 24px; | |||
font-size: 15px; | |||
background-color: #fff; | |||
padding: 10px 0 10px 15px; | |||
} | |||
.page{ | |||
background-color: #fff; | |||
padding-bottom: 1px; | |||
} | |||
/deep/ .cu-form-group uni-textarea{ | |||
height: auto; | |||
} | |||
.remarks{ | |||
border-bottom: 0.5px solid #eee; | |||
padding-bottom: 10px; | |||
} | |||
.remarks textarea{ | |||
width: 100%; | |||
padding: 0 15px; | |||
} | |||
</style> | |||
@@ -0,0 +1,199 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;"> | |||
<!-- <l-customlist-banner></l-customlist-banner> --> | |||
<view class="records">共 {{ records }} 条数据</view> | |||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data"> | |||
<l-customlist :tips="loadState" showTips> | |||
<view></view> | |||
<view class="pageBox customlist-item" v-for="(item, ind) in data" :key="item.MakeDate" @click="tapClick(item)"> | |||
<view class=""> | |||
<text>学年:</text> | |||
{{ item.AcademicYearNo }} | |||
</view> | |||
<view class=""> | |||
<text>学期:</text> | |||
{{ item.Semester }} | |||
</view> | |||
<view class=""> | |||
<text>课程名称:</text> | |||
{{ item.LessonName }} | |||
</view> | |||
<view class=""> | |||
<text>上课节次:</text> | |||
{{ jieci(item.LessonSection) }} | |||
</view> | |||
<view class=""> | |||
<text>上课时间:</text> | |||
{{ item.LessonTime }} | |||
</view> | |||
<view class=""> | |||
<text>学分:</text> | |||
{{ item.StudyScore }} | |||
</view> | |||
<view class=""> | |||
<text>教师姓名:</text> | |||
{{ item.EmpName }} | |||
</view> | |||
<view class=""> | |||
<text>教室名称:</text> | |||
{{ item.ClassRoomNo }} | |||
</view> | |||
<view class=""> | |||
<text>人数上限:</text> | |||
{{ item.StuNumMax }} | |||
</view> | |||
<view class=""> | |||
<text>已报名人数:</text> | |||
{{ item.StuNumOfApplyPre }} | |||
</view> | |||
<view class="pageType">{{ typePd(item.Status) }}</view> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
weekChina: ['一', '二', '三', '四', '五', '六', '日'], | |||
user: null, | |||
data: [], | |||
total: 1, | |||
records: 0, | |||
ready: false, | |||
page: 1, | |||
rows: 10, | |||
multipleData: null, | |||
sideOpen: false, | |||
loadState: '向下翻以加载更多' | |||
}; | |||
}, | |||
onUnload() { | |||
this.OFF('EducationalAdministrationBookBorrow-list-change'); | |||
}, | |||
methods: { | |||
init() { | |||
this.ON('EducationalAdministrationBookBorrow-list-change', this.refreshList); | |||
// 拉取加载列表和数据源 | |||
Promise.all([() => {}]); | |||
var _this = this; | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
this.fetchList(); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList() { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
let _this = this; | |||
let _postParam = { | |||
pagination: { | |||
rows: _this.rows, | |||
page: _this.page, | |||
sidx: 'LessonNo', | |||
sord: 'asc' | |||
}, | |||
queryJson: '{}' | |||
}; | |||
if (true) { | |||
_postParam.queryJson = JSON.stringify({ | |||
StuNo: _this.user.account | |||
}); | |||
} | |||
_this.LOADING('加载数据中…') | |||
_this.HTTP_GET('learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/studentpagelist', _postParam, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
// console.log(res); | |||
this.data = this.data.concat(res.rows); | |||
_this.total = res.total; | |||
_this.records = res.records; | |||
this.page = res.page + 1; | |||
this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多'; | |||
// console.log(_this.data); | |||
}); | |||
}, | |||
// 列表下拉 | |||
pullDown() { | |||
this.refreshList().then(() => { | |||
this.$refs.data.stopPullDown(); | |||
}); | |||
}, | |||
async refreshList() { | |||
this.page = 1; | |||
this.total = 1; | |||
this.data = []; | |||
this.fetchList(); | |||
}, | |||
tapClick(data) { | |||
this.NAV_TO('./from', data.OLPEId, true); | |||
} | |||
}, | |||
computed: { | |||
jieci() { | |||
return str => { | |||
let ls = ''; | |||
if (str.indexOf(',') == -1) ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1) + '节'; | |||
else ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1, 2) + '、' + str.slice(4) + '节'; | |||
return ls; | |||
}; | |||
}, | |||
typePd() { | |||
return num => { | |||
let txt = ''; | |||
if (num == 1) { | |||
txt = '审核中'; | |||
} else if (num == 2) { | |||
txt = '报名成功'; | |||
} else if (num == 3) { | |||
txt = '报名失败'; | |||
} else { | |||
txt = '未报名'; | |||
} | |||
return txt; | |||
}; | |||
} | |||
}, | |||
created() { | |||
this.init(); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import '~@/common/css/sidepage.less'; | |||
@import '~@/common/css/customlist.less'; | |||
.page { | |||
background-color: #fff; | |||
} | |||
.page-content { | |||
margin-top: 39px; | |||
} | |||
.records { | |||
color: #8f8f94; | |||
background: #ffffff; | |||
padding: 10px 12px; | |||
width: 100%; | |||
vertical-align: middle; | |||
border-bottom: 0.5px solid #ddd; | |||
position: fixed; | |||
top: var(--window-top); | |||
z-index: 1024; | |||
border-bottom: 0.5px solid #ddd; | |||
height: 40px; | |||
width: 100%; | |||
box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1); | |||
} | |||
.pageBox { | |||
padding: 5px 15px; | |||
line-height: 24px; | |||
border-bottom: 5px solid #f5f5f5; | |||
background-color: #fff; | |||
} | |||
</style> |
@@ -0,0 +1,8 @@ | |||
<template> | |||
</template> | |||
<script> | |||
</script> | |||
<style> | |||
</style> |
@@ -0,0 +1,50 @@ | |||
<template> | |||
<view class=""><view class="btn" @click="tabCode">扫码</view></view> | |||
</template> | |||
<script> | |||
import scanCodeFun from '@/common/js/scanCodeFun.js'; | |||
export default { | |||
data() { | |||
return {}; | |||
}, | |||
methods: { | |||
init() { | |||
let _this = this; | |||
// 允许从相机和相册扫码 | |||
scanCodeFun.scanCodeFun().then(res => { | |||
console.log(res); | |||
if(!res) return | |||
let param = {}; | |||
param.keyValue = ''; | |||
param.strEntity = JSON.stringify({ | |||
SId: _this.GET_GLOBAL('loginUser').account, | |||
BId: res.result | |||
}); | |||
_this.LOADING('正在提交数据…'); | |||
_this.HTTP_POST('learun/EducationalAdministration/R_EnterBuilding/save', param, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
console.log(res); | |||
if(res){ | |||
_this.TOAST('扫描成功'); | |||
setTimeout(function(){ | |||
_this.NAV_BACK() | |||
}, 500) | |||
} | |||
}) | |||
}) | |||
}, | |||
tabCode() { | |||
this.init(); | |||
} | |||
}, | |||
mounted() { | |||
let _this = this; | |||
setTimeout(function() { | |||
_this.init(); | |||
}, 100); | |||
} | |||
}; | |||
</script> | |||
<style></style> |
@@ -0,0 +1,42 @@ | |||
<template> | |||
<view class=""><view class="btn" @click="tabCode">扫码</view></view> | |||
</template> | |||
<script> | |||
import scanCodeFun from '@/common/js/scanCodeFun.js'; | |||
export default { | |||
data() { | |||
return {}; | |||
}, | |||
methods: { | |||
init() { | |||
let _this = this; | |||
// 允许从相机和相册扫码 | |||
scanCodeFun.scanCodeFun().then(res => { | |||
//console.log(res); | |||
if(!res) return | |||
_this.LOADING('正在提交数据…'); | |||
_this.HTTP_GET('learun/adms/EducationalAdministration/StuInfoBasic/stuinfo', res.result, '加载数据时出错').then(res => { | |||
_this.HIDE_LOADING(); | |||
//console.log(res); | |||
if(res){ | |||
let url = res.HealthStatus == '0'? '../StudentQRCode/Normal/list' : res.HealthStatus == '1'? '../StudentQRCode/AbNormalWeak/list' : res.HealthStatus == '2'? '../StudentQRCode/AbNormalSerious/list' : '../StudentQRCode/Normal/list'; | |||
_this.NAV_TO(url, {stuNo:res.StuNo}, true); | |||
} | |||
}) | |||
}) | |||
}, | |||
tabCode() { | |||
this.init(); | |||
} | |||
}, | |||
mounted() { | |||
let _this = this; | |||
setTimeout(function() { | |||
_this.init(); | |||
}, 100); | |||
} | |||
}; | |||
</script> | |||
<style></style> |
@@ -1,216 +1,216 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('SYS_ReceiveMessage.SENDER', $event)" | |||
:value="getValue('SYS_ReceiveMessage.SENDER')" | |||
:disabled="!edit" | |||
title="发件人" | |||
/> | |||
<l-input | |||
@input="setValue('SYS_ReceiveMessage.TITLE', $event)" | |||
:value="getValue('SYS_ReceiveMessage.TITLE')" | |||
:disabled="!edit" | |||
title="主题" | |||
/> | |||
<l-select | |||
@input="setValue('SYS_ReceiveMessage.READFLAG', $event)" | |||
:value="getValue('SYS_ReceiveMessage.READFLAG')" | |||
:disabled="!edit" | |||
:range="dataSource.SYS_ReceiveMessage.READFLAG" | |||
title="状态" | |||
/> | |||
<l-date-picker | |||
@input="setValue('SYS_ReceiveMessage.SENDTIME', $event)" | |||
:value="getValue('SYS_ReceiveMessage.SENDTIME')" | |||
:disabled="!edit" | |||
title="收件时间" | |||
/> | |||
<l-upload-file | |||
@input="setValue('SYS_ReceiveMessage.URL', $event)" | |||
:value="getValue('SYS_ReceiveMessage.URL')" | |||
:readonly="!edit" | |||
:number="9" | |||
title="附件上传" | |||
/> | |||
<l-textarea | |||
@input="setValue('SYS_ReceiveMessage.CONTENTS', $event)" | |||
:value="getValue('SYS_ReceiveMessage.CONTENTS')" | |||
:readonly="!edit" | |||
title="邮件内容" | |||
/> | |||
</view> | |||
</view> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('SYS_ReceiveMessage.SENDER', $event)" | |||
:value="getValue('SYS_ReceiveMessage.SENDER')" | |||
:disabled="!edit" | |||
title="发件人" | |||
/> | |||
<l-input | |||
@input="setValue('SYS_ReceiveMessage.TITLE', $event)" | |||
:value="getValue('SYS_ReceiveMessage.TITLE')" | |||
:disabled="!edit" | |||
title="主题" | |||
/> | |||
<l-select | |||
@input="setValue('SYS_ReceiveMessage.READFLAG', $event)" | |||
:value="getValue('SYS_ReceiveMessage.READFLAG')" | |||
:disabled="!edit" | |||
:range="dataSource.SYS_ReceiveMessage.READFLAG" | |||
title="状态" | |||
/> | |||
<l-date-picker | |||
@input="setValue('SYS_ReceiveMessage.SENDTIME', $event)" | |||
:value="getValue('SYS_ReceiveMessage.SENDTIME')" | |||
:disabled="!edit" | |||
title="收件时间" | |||
/> | |||
<l-upload-file | |||
@input="setValue('SYS_ReceiveMessage.URL', $event)" | |||
:value="getValue('SYS_ReceiveMessage.URL')" | |||
:readonly="!edit" | |||
:number="9" | |||
title="附件上传" | |||
/> | |||
<l-textarea | |||
@input="setValue('SYS_ReceiveMessage.CONTENTS', $event)" | |||
:value="getValue('SYS_ReceiveMessage.CONTENTS')" | |||
:readonly="!edit" | |||
title="邮件内容" | |||
/> | |||
</view> | |||
</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/single", "style": { "navigationBarTitleText": "表单详情页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/SYS_ReceiveMessage/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: { | |||
SYS_ReceiveMessage: { | |||
SENDER: { type: 'text', title: '发件人' }, | |||
TITLE: { type: 'text', title: '主题' }, | |||
READFLAG: { type: 'select', title: '状态', dataSource: '0' }, | |||
SENDTIME: { type: 'datetime', title: '收件时间', dateformat: '0' }, | |||
URL: { type: 'upload', title: '附件上传' }, | |||
CONTENTS: { type: 'textarea', title: '邮件内容' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
SYS_ReceiveMessage: { | |||
READFLAG: [], | |||
}, | |||
} | |||
} | |||
}, | |||
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/SYS_ReceiveMessage/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/SYS_ReceiveMessage/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationSYS_ReceiveMessage-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/EducationalAdministration/SYS_ReceiveMessage/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationSYS_ReceiveMessage-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) | |||
} | |||
} | |||
mixins: [customPageMixins], | |||
data() { | |||
return { | |||
// 页面相关参数 | |||
id: null, | |||
mode: null, | |||
edit: null, | |||
ready: false, | |||
// 表单数据 | |||
current: {}, | |||
origin: {}, | |||
// 表单项数据结构 | |||
scheme: { | |||
SYS_ReceiveMessage: { | |||
SENDER: { type: 'text', title: '发件人' }, | |||
TITLE: { type: 'text', title: '主题' }, | |||
READFLAG: { type: 'select', title: '状态', dataSource: '0' }, | |||
SENDTIME: { type: 'datetime', title: '收件时间', dateformat: '0' }, | |||
URL: { type: 'upload', title: '附件上传' }, | |||
CONTENTS: { type: 'textarea', title: '邮件内容' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
SYS_ReceiveMessage: { | |||
READFLAG: [], | |||
}, | |||
} | |||
} | |||
}, | |||
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('learun/adms/EducationalAdministration/SYS_ReceiveMessage/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('learun/adms/EducationalAdministration/SYS_ReceiveMessage/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationSYS_ReceiveMessage-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('learun/adms/EducationalAdministration/SYS_ReceiveMessage/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationSYS_ReceiveMessage-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> |
@@ -1,350 +1,350 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.AcademicYearNo', $event)" | |||
:value="getValue('StuAttendanceLeave.AcademicYearNo')" | |||
:disabled="!edit" | |||
title="学年度" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.Semester', $event)" | |||
:value="getValue('StuAttendanceLeave.Semester')" | |||
:disabled="!edit" | |||
title="学期" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.StuNo', $event)" | |||
:value="getValue('StuAttendanceLeave.StuNo')" | |||
:disabled="!edit" | |||
title="学号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.StuName', $event)" | |||
:value="getValue('StuAttendanceLeave.StuName')" | |||
:disabled="!edit" | |||
title="姓名" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.Grade', $event)" | |||
:value="getValue('StuAttendanceLeave.Grade')" | |||
:disabled="!edit" | |||
title="年级" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.EmpNo', $event)" | |||
:value="getValue('StuAttendanceLeave.EmpNo')" | |||
:disabled="!edit" | |||
title="教师号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.DeptNo', $event)" | |||
:value="getValue('StuAttendanceLeave.DeptNo')" | |||
:disabled="!edit" | |||
title="系所码" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.DeptName', $event)" | |||
:value="getValue('StuAttendanceLeave.DeptName')" | |||
:disabled="!edit" | |||
title="系名" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.MajorNo', $event)" | |||
:value="getValue('StuAttendanceLeave.MajorNo')" | |||
:disabled="!edit" | |||
title="专业码" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.MajorName', $event)" | |||
:value="getValue('StuAttendanceLeave.MajorName')" | |||
:disabled="!edit" | |||
title="专业名" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.ClassNo', $event)" | |||
:value="getValue('StuAttendanceLeave.ClassNo')" | |||
:disabled="!edit" | |||
title="所在行政班号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.ClassName', $event)" | |||
:value="getValue('StuAttendanceLeave.ClassName')" | |||
:disabled="!edit" | |||
title="班级名称" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonNo', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonNo')" | |||
:disabled="!edit" | |||
title="课程号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonName', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonName')" | |||
:disabled="!edit" | |||
title="课程名称" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonSortNo', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonSortNo')" | |||
:disabled="!edit" | |||
title="课程类别码" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonSortName', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonSortName')" | |||
:disabled="!edit" | |||
title="课程类别" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonDate', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonDate')" | |||
:disabled="!edit" | |||
title="原上课日期" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonTime', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonTime')" | |||
:disabled="!edit" | |||
title="上课时间" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.PlanWeek', $event)" | |||
:value="getValue('StuAttendanceLeave.PlanWeek')" | |||
:disabled="!edit" | |||
title="教学周次" | |||
/> | |||
<l-select | |||
@input="setValue('StuAttendanceLeave.LeaveType', $event)" | |||
:value="getValue('StuAttendanceLeave.LeaveType')" | |||
:disabled="!edit" | |||
:range="dataSource.StuAttendanceLeave.LeaveType" | |||
title="请假类型" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuAttendanceLeave.Remark', $event)" | |||
:value="getValue('StuAttendanceLeave.Remark')" | |||
:readonly="!edit" | |||
title="备注" | |||
/> | |||
<l-select | |||
@input="setValue('StuAttendanceLeave.IsCheck', $event)" | |||
:value="getValue('StuAttendanceLeave.IsCheck')" | |||
:disabled="!edit" | |||
:range="dataSource.StuAttendanceLeave.IsCheck" | |||
title="下拉框" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuAttendanceLeave.TecRemark', $event)" | |||
:value="getValue('StuAttendanceLeave.TecRemark')" | |||
: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> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.AcademicYearNo', $event)" | |||
:value="getValue('StuAttendanceLeave.AcademicYearNo')" | |||
:disabled="!edit" | |||
title="学年度" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.Semester', $event)" | |||
:value="getValue('StuAttendanceLeave.Semester')" | |||
:disabled="!edit" | |||
title="学期" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.StuNo', $event)" | |||
:value="getValue('StuAttendanceLeave.StuNo')" | |||
:disabled="!edit" | |||
title="学号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.StuName', $event)" | |||
:value="getValue('StuAttendanceLeave.StuName')" | |||
:disabled="!edit" | |||
title="姓名" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.Grade', $event)" | |||
:value="getValue('StuAttendanceLeave.Grade')" | |||
:disabled="!edit" | |||
title="年级" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.EmpNo', $event)" | |||
:value="getValue('StuAttendanceLeave.EmpNo')" | |||
:disabled="!edit" | |||
title="教师号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.DeptNo', $event)" | |||
:value="getValue('StuAttendanceLeave.DeptNo')" | |||
:disabled="!edit" | |||
title="系所码" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.DeptName', $event)" | |||
:value="getValue('StuAttendanceLeave.DeptName')" | |||
:disabled="!edit" | |||
title="系名" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.MajorNo', $event)" | |||
:value="getValue('StuAttendanceLeave.MajorNo')" | |||
:disabled="!edit" | |||
title="专业码" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.MajorName', $event)" | |||
:value="getValue('StuAttendanceLeave.MajorName')" | |||
:disabled="!edit" | |||
title="专业名" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.ClassNo', $event)" | |||
:value="getValue('StuAttendanceLeave.ClassNo')" | |||
:disabled="!edit" | |||
title="所在行政班号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.ClassName', $event)" | |||
:value="getValue('StuAttendanceLeave.ClassName')" | |||
:disabled="!edit" | |||
title="班级名称" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonNo', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonNo')" | |||
:disabled="!edit" | |||
title="课程号" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonName', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonName')" | |||
:disabled="!edit" | |||
title="课程名称" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonSortNo', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonSortNo')" | |||
:disabled="!edit" | |||
title="课程类别码" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonSortName', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonSortName')" | |||
:disabled="!edit" | |||
title="课程类别" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonDate', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonDate')" | |||
:disabled="!edit" | |||
title="原上课日期" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.LessonTime', $event)" | |||
:value="getValue('StuAttendanceLeave.LessonTime')" | |||
:disabled="!edit" | |||
title="上课时间" | |||
/> | |||
<l-input | |||
@input="setValue('StuAttendanceLeave.PlanWeek', $event)" | |||
:value="getValue('StuAttendanceLeave.PlanWeek')" | |||
:disabled="!edit" | |||
title="教学周次" | |||
/> | |||
<l-select | |||
@input="setValue('StuAttendanceLeave.LeaveType', $event)" | |||
:value="getValue('StuAttendanceLeave.LeaveType')" | |||
:disabled="!edit" | |||
:range="dataSource.StuAttendanceLeave.LeaveType" | |||
title="请假类型" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuAttendanceLeave.Remark', $event)" | |||
:value="getValue('StuAttendanceLeave.Remark')" | |||
:readonly="!edit" | |||
title="备注" | |||
/> | |||
<l-select | |||
@input="setValue('StuAttendanceLeave.IsCheck', $event)" | |||
:value="getValue('StuAttendanceLeave.IsCheck')" | |||
:disabled="!edit" | |||
:range="dataSource.StuAttendanceLeave.IsCheck" | |||
title="下拉框" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuAttendanceLeave.TecRemark', $event)" | |||
:value="getValue('StuAttendanceLeave.TecRemark')" | |||
: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-20 15:34 | |||
* 描 述:aaa | |||
*/ | |||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2020-10-20 15:34 | |||
* 描 述:aaa | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuAttendanceLeave/single", "style": { "navigationBarTitleText": "表单详情页" } } | |||
* | |||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/EducationalAdministration/StuAttendanceLeave/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: { | |||
StuAttendanceLeave: { | |||
AcademicYearNo: { type: 'text', title: '学年度' }, | |||
Semester: { type: 'text', title: '学期' }, | |||
StuNo: { type: 'text', title: '学号' }, | |||
StuName: { type: 'text', title: '姓名' }, | |||
Grade: { type: 'text', title: '年级' }, | |||
EmpNo: { type: 'text', title: '教师号' }, | |||
DeptNo: { type: 'text', title: '系所码' }, | |||
DeptName: { type: 'text', title: '系名' }, | |||
MajorNo: { type: 'text', title: '专业码' }, | |||
MajorName: { type: 'text', title: '专业名' }, | |||
ClassNo: { type: 'text', title: '所在行政班号' }, | |||
ClassName: { type: 'text', title: '班级名称' }, | |||
LessonNo: { type: 'text', title: '课程号' }, | |||
LessonName: { type: 'text', title: '课程名称' }, | |||
LessonSortNo: { type: 'text', title: '课程类别码' }, | |||
LessonSortName: { type: 'text', title: '课程类别' }, | |||
LessonDate: { type: 'text', title: '原上课日期' }, | |||
LessonTime: { type: 'text', title: '上课时间' }, | |||
PlanWeek: { type: 'text', title: '教学周次' }, | |||
LeaveType: { type: 'select', title: '请假类型', itemCode: 'LeaveType', dataSource: '0' }, | |||
Remark: { type: 'textarea', title: '备注' }, | |||
IsCheck: { type: 'select', title: '下拉框', itemCode: 'LeaveCheck', dataSource: '0' }, | |||
TecRemark: { type: 'textarea', title: '备注' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
StuAttendanceLeave: { | |||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | |||
IsCheck: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({ value: t.value, text: t.text })), | |||
}, | |||
} | |||
} | |||
}, | |||
async onLoad({ type, id }) { | |||
await this.init(type, id) | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init(type, id) { | |||
this.LOADING('加载数据中...') | |||
this.id = id | |||
this.mode = type | |||
this.edit = ['create', 'edit'].includes(this.mode) | |||
// 拉取表单数据,同时拉取所有来自数据源的选单数据 | |||
await Promise.all([ | |||
() => {} | |||
]) | |||
await this.fetchForm() | |||
this.ready = true | |||
this.HIDE_LOADING() | |||
}, | |||
// 加载表单数据 | |||
async fetchForm() { | |||
if (this.mode === 'create') { | |||
this.origin = await this.getDefaultForm() | |||
} else { | |||
const result = await this.HTTP_GET('/EducationalAdministration/StuAttendanceLeave/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/StuAttendanceLeave/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuAttendanceLeave-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/EducationalAdministration/StuAttendanceLeave/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuAttendanceLeave-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) | |||
} | |||
} | |||
mixins: [customPageMixins], | |||
data() { | |||
return { | |||
// 页面相关参数 | |||
id: null, | |||
mode: null, | |||
edit: null, | |||
ready: false, | |||
// 表单数据 | |||
current: {}, | |||
origin: {}, | |||
// 表单项数据结构 | |||
scheme: { | |||
StuAttendanceLeave: { | |||
AcademicYearNo: { type: 'text', title: '学年度' }, | |||
Semester: { type: 'text', title: '学期' }, | |||
StuNo: { type: 'text', title: '学号' }, | |||
StuName: { type: 'text', title: '姓名' }, | |||
Grade: { type: 'text', title: '年级' }, | |||
EmpNo: { type: 'text', title: '教师号' }, | |||
DeptNo: { type: 'text', title: '系所码' }, | |||
DeptName: { type: 'text', title: '系名' }, | |||
MajorNo: { type: 'text', title: '专业码' }, | |||
MajorName: { type: 'text', title: '专业名' }, | |||
ClassNo: { type: 'text', title: '所在行政班号' }, | |||
ClassName: { type: 'text', title: '班级名称' }, | |||
LessonNo: { type: 'text', title: '课程号' }, | |||
LessonName: { type: 'text', title: '课程名称' }, | |||
LessonSortNo: { type: 'text', title: '课程类别码' }, | |||
LessonSortName: { type: 'text', title: '课程类别' }, | |||
LessonDate: { type: 'text', title: '原上课日期' }, | |||
LessonTime: { type: 'text', title: '上课时间' }, | |||
PlanWeek: { type: 'text', title: '教学周次' }, | |||
LeaveType: { type: 'select', title: '请假类型', itemCode: 'LeaveType', dataSource: '0' }, | |||
Remark: { type: 'textarea', title: '备注' }, | |||
IsCheck: { type: 'select', title: '下拉框', itemCode: 'LeaveCheck', dataSource: '0' }, | |||
TecRemark: { type: 'textarea', title: '备注' }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
StuAttendanceLeave: { | |||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | |||
IsCheck: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({ value: t.value, text: t.text })), | |||
}, | |||
} | |||
} | |||
}, | |||
async onLoad({ type, id }) { | |||
await this.init(type, id) | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init(type, id) { | |||
this.LOADING('加载数据中...') | |||
this.id = id | |||
this.mode = type | |||
this.edit = ['create', 'edit'].includes(this.mode) | |||
// 拉取表单数据,同时拉取所有来自数据源的选单数据 | |||
await Promise.all([ | |||
() => {} | |||
]) | |||
await this.fetchForm() | |||
this.ready = true | |||
this.HIDE_LOADING() | |||
}, | |||
// 加载表单数据 | |||
async fetchForm() { | |||
if (this.mode === 'create') { | |||
this.origin = await this.getDefaultForm() | |||
} else { | |||
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/StuAttendanceLeave/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('learun/adms/EducationalAdministration/StuAttendanceLeave/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuAttendanceLeave-list-change') | |||
this.NAV_BACK() | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuAttendanceLeave-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> |
@@ -1,380 +1,380 @@ | |||
<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> | |||
<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 | |||
* 描 述:学生消费信息 | |||
*/ | |||
* 版 本 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 文件) | |||
*/ | |||
* 本段代码由移动端代码生成器输出,移动端须 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 | |||
} | |||
} | |||
} | |||
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( | |||
'learun/adms/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('learun/adms/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'; |