Browse Source

移动端2.0:党小组长评分-打分;

yanshi
dyy 2 years ago
parent
commit
93e47761c1
7 changed files with 951 additions and 221 deletions
  1. +19
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json
  2. +189
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/AnswerTotalXZ.vue
  3. +103
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/PartyevaluatQuestionsXZ.vue
  4. +468
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/PartyevaluateTopicXZ.vue
  5. +169
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/SucceedXZ.vue
  6. +3
    -2
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/list.vue
  7. +0
    -218
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/single.vue

+ 19
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json View File

@@ -1038,7 +1038,25 @@
}
},
{
"path": "pages/partyevaluatxz/single",
"path": "pages/partyevaluatxz/PartyevaluatQuestionsXZ",
"style": {
"navigationBarTitleText": "党员评价"
}
},
{
"path": "pages/partyevaluatxz/PartyevaluateTopicXZ",
"style": {
"navigationBarTitleText": "党员评价"
}
},
{
"path": "pages/partyevaluatxz/AnswerTotalXZ",
"style": {
"navigationBarTitleText": "党员评价"
}
},
{
"path": "pages/partyevaluatxz/SucceedXZ",
"style": {
"navigationBarTitleText": "党员评价"
}


+ 189
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/AnswerTotalXZ.vue View File

@@ -0,0 +1,189 @@
<template>
<view v-if="ready" class="box" style="padding-top: 0; ">
<view class="answertotalContent">
<view class="progress">
</view>
<view class="answertotalTopic">
<view class="answertotaScore">
<span>评价总分</span>
<p id="cpageTitle">{{this.sumScore}}</p>
</view>
</view>
<view class="answertotalLookButton" >
<p class="confirm" @click="action('confirm')" >确认分数,并保存</p>
<p class="backs" @click="action('back')" >返回重测</p>
</view>
</view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-20 09:37
* 描 述:班级工作记事
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/partyevaluatzp/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,
sumScore: null,
data:[],
ready: false,
}
},
async onLoad({ Id,sumScore, data }) {
await this.init(Id,sumScore, data)
},
methods: {
// 页面初始化
async init(Id,sumScore, data) {
this.LOADING('加载数据中...')
this.Id=Id
this.sumScore = Number(sumScore).toFixed(2)
this.data = JSON.parse(data)
console.log(this.data)
this.ready = true
this.HIDE_LOADING()
},
// 点击 「确认分数」、「返回重测」、 按钮
async action(type) {
switch (type) {
case 'confirm':
if (!(await this.CONFIRM('保存项目', '确定保存吗?', true))) {
return
}
this.HTTP_POST('learun/adms/evaluatingindicator/savelist', { strEntity: JSON.stringify(this.data)}, '保存失败').then(success => {
if(!success) { return }
this.TOAST('保存成功', 'success')
this.NAV_TO(`./SucceedXZ`)
})
return
case 'back':
this.NAV_TO(`./PartyevaluatQuestionsXZ?Id=${this.Id}`)
break
default: break
}
},
}
}
</script>

<style lang="less">
uni-page-body{
height: 100%;
}
.box{
height: 100%;
width: 100%;
background: url(../../common/images/content.png);
background-repeat: no-repeat;
background-size: 100% 100%;
/* position: relative; */
}
.answertotalContent{
position: relative;
background-color: #FFFFFF;
height: 70%;
top: 25%;
width: 93%;
margin: 0 auto;
border-radius: 10px;
}
.answertotalTopic{
width: 350rpx;
height: 350rpx;
box-shadow: #e8e7e7 0rpx 0rpx 8rpx 4rpx ;
border-radius: 50%;
position: relative;
top: 35%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
justify-content: center;
align-items: center;
}
.answertotaScore{
width: 290rpx;
height: 290rpx;
border: 6rpx solid #f5e285;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
flex-direction:column;
}
.answertotaScore span{
color: #b0afaf;
font-size: 30rpx;
}
.answertotaScore p{
color: #404040;
font-size: 70rpx;
font-weight: 800;
}
.answertotalLookButton{
width: 80%;
float: none;
position: absolute;
bottom: 0%;
left: 50%;
transform: translate(-50%,-50%);
}
.answertotalLookButton p{
background-color: #e1bb53;
margin: 0 auto;
color: #FFFFFF;
border-radius: 50rpx;
font-size: 36rpx;
color: #FFFFFF;
width: 80%;
height: 72rpx;
text-align: center;
line-height: 72rpx;
margin-bottom: 20rpx;
}
.answertotalLookButton p:last-child{
border: 2rpx solid #e1bb53;
background-color: #FFFFFF;
color: #e1bb53;
}
</style>

+ 103
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/PartyevaluatQuestionsXZ.vue View File

@@ -0,0 +1,103 @@
<template>
<view v-if="ready" class="box" style="padding-top: 0; overflow: hidden;">
<l-button @click="action('start')" class="button">
开始评价
</l-button>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-20 09:37
* 描 述:班级工作记事
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/partyevaluatzp/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,
ready: false,
}
},
async onLoad({ Id }) {
await this.init(Id)
},
methods: {
// 页面初始化
async init(Id) {
this.LOADING('加载数据中...')
this.Id = Id
this.ready = true
this.HIDE_LOADING()
},
// 点击 「开始评价」、 按钮
async action(type) {
switch (type) {
case 'start':
this.NAV_TO(`./PartyevaluateTopicXZ?Id=${this.Id}`)
break
default: break
}
},
}
}
</script>

<style lang="less">
uni-page-body{
height: 100%;
}
.box{
height: 100%;
width: 100%;
background: url(../../common/images/partyHome.png);
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
}
.button{
height: 90rpx;
width: 72%;
background: #FFFFFF;
border-radius:100rpx;
text-align: center;
line-height: 90rpx;
position: absolute;
left: 50%;
bottom: 165rpx;
transform:translate(-50%,-50%);
color: #921c1a;
font-size: 36rpx;
font-weight: 800;
}
</style>

+ 468
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/PartyevaluateTopicXZ.vue View File

@@ -0,0 +1,468 @@
<template>
<view v-if="ready" class="box" style="padding-top: 0; ">
<view class="contents">
<view class="progress">
<view class="shade" :style="{width:100/total*(num+1)+'%'}"></view>
<p></p>
<b>{{total}}</b>
</view>
<view class="topic">
<view class="title">
<p><span>{{num+1}}</span></p>
<div> {{ data[num].Assessment }} <span> ( {{data[num].scorePre}}分 ) </span></div>
</view>
<view class="topicCon">
<h1>{{data[num].ConductRequirements}}</h1>
<p>{{data[num].CRRemark}}</p>
<ul>
<li><b>{{data[num].gradetitle}}</b><span>({{data[num].gradenum}})</span></li>
<p>{{data[num].ScoringCriteria}}</p>
</ul>
</view>
<view class="footer">
<ol>
<li>分值:<span class="scorenum">{{data[num].MaxScore}}</span></li>
<li>
<!-- <input type="text" class="inputvalue" id="inputvalue" value=""+{{data[num].Score}}+""> -->
<l-input
@input="setValue('', $event)"
:value="getValue('')"
class="inputvalue"
id="inputvalue"
style="min-height: 48rpx;text-align: center;border-bottom: none;padding-right: 45%;"
type="number"
/>
</li>
</ol>
<view class="buttons">
<p class="last" @click="action('last')" v-if="lastIf">上一题</p>
<view style="width: 10px;"></view>
<p class="next" @click="action('next')" v-if="nextIf">下一题</p>
</view>
<view class="lookButton" >
<p @click="action('seeTotal')" v-if="seeTotalIf">查看总分</p>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-20 09:37
* 描 述:班级工作记事
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/partyevaluatzp/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,
ready: false,
seeTotalIf:false,
lastIf:true,
nextIf:true,
//题目数据
data:[],
//题目分值数据
valList:[],
//题目总数量
total:0,
//当前题目
num:0,
}
},
async onLoad({ Id }) {
await this.init(Id)
},
methods: {
// 页面初始化
async init(Id) {
this.LOADING('加载数据中...')
this.Id = Id
//请求题目数据
const result = await this.HTTP_GET(
'learun/adms/evaluatingindicator/getevaluationdataforxz',
{
Id:this.Id,
Assessed: this.GET_GLOBAL('loginUser').account
},
'加载数据时出错'
)
if (!result) { return }
this.data=result
this.total=result.length
result.forEach((item)=>{this.valList.push(item.Score)})
//计算显示按钮
await this.calcShowBtn()
this.ready = true
this.HIDE_LOADING()
},
//计算显示按钮
async calcShowBtn(){
if(this.num < this.total-1){
this.nextIf=true;
this.seeTotalIf=false;
}else{
this.nextIf=false;
this.seeTotalIf=true;
}
if(this.num <= 0){
this.lastIf=false;
}else{
this.lastIf=true;
}
},
// 点击 「查看总分」、「上一题」、「下一题」、 按钮
async action(type) {
switch (type) {
case 'seeTotal':
if(this.getValue() == ""){
this.TOAST("分数不能为空!");
return
}
if(this.getValue() > this.data[this.num].MaxScore){
this.TOAST("分数不能大于最大值!");
return
}
this.NAV_TO(`./AnswerTotalXZ?Id=${this.Id}&sumScore=${this.sum(this.valList)}&data=${JSON.stringify(this.data)}`)
break
case 'last':
this.num--
await this.calcShowBtn()
break
case 'next':
if(this.getValue() == ""){
this.TOAST("分数不能为空!");
return
}
if(this.getValue() > this.data[this.num].MaxScore){
this.TOAST("分数不能大于最大值!");
return
}
this.num++
await this.calcShowBtn()
break
default: break
}
},
// 获取表单值
getValue(path) {
return this.data[this.num].Score;
}, // 设置表单值
setValue(path, val) {
this.data[this.num].Score=val;
this.valList[this.num]=val;
// console.log(this.data);
// console.log(this.valList);
},
// 计算数组和
sum(arr) {
var s = 0;
for (var i=arr.length-1; i>=0; i--) {
s += Number(arr[i]);
}
return s;
},
}
}
</script>

<style lang="less">
uni-page-body{
height: 100%;
}
ul,
ol,
li {
list-style: none;
padding: 0;
margin: 0;
}
.box{
height: 100%;
width: 100%;
background: url(../../common/images/content.png);
background-repeat: no-repeat;
background-size: 100% 100%;
}
.contents {
position: relative;
top: 300rpx;
width: 93%;
margin: 0 auto;
}
.progress {
height: 65rpx;
position: relative;
}
.progress p {
height: 15rpx;
width: 100%;
background-color: #EFEFEF;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: .3;
}

.progress .shade {
height: 25rpx;
width: 10%;
position: absolute;
top: 50%;
left: 0%;
transform: translate(0%, -50%);
background: url(../../common/images/jd.png);
background-size: 100% 100%;
border-radius: 100rpx;
}

.progress b {
position: absolute;
width: 95rpx;
height: 60rpx;
border-top-left-radius: 100rpx;
border-bottom-left-radius: 100rpx;
background-color: #f4df81;
background-image: linear-gradient(#f4df81, #d19f31);
top: 0;
right: -3.7%;
display: flex;
justify-content: center;
align-items: center;
color: #FFFFFF;
font-size: 36rpx;
}
.topic {
position: relative;
background-color: #FFFFFF;
border-radius: 50rpx;
margin-top: 70rpx;
}

.title>div {
height: 75rpx;
width: 75%;
margin: 0 auto;
background: #FFFFFF;
border-radius: 40rpx;
line-height: 75rpx;
font-size: 24rpx;
color: #404040;
text-align: center;
font-weight: 800;
position: absolute;
top: -4%;
left: 52%;
transform: translate(-50%, 0%);
box-shadow: #d6d4d4 0rpx 12rpx 40rpx 10rpx; //边框阴影
}

.title>div span {
color: #a6a6a6;
}

.title>p {
background-color: #FFFFFF;
height: 115rpx;
width: 115rpx;
border-radius: 50%;
position: absolute;
top: -7%;
left: 70rpx;
z-index: 90;
display: flex;
justify-content: center;
align-items: center;
box-shadow: #d6d4d4 0rpx 12rpx 40rpx 10rpx; //边框阴影
}

.title>p span {
display: flex;
justify-content: center;
align-items: center;
height: 80rpx;
width: 80rpx;
border: 12rpx solid #e17465;
border-radius: 50%;
font-size: 40rpx;
}

.topicCon {
padding-top: 90rpx;
margin-bottom: 20rpx;
padding: 0 50rpx;
padding-top: 100rpx;
}

.topicCon h1 {
font-size: 36rpx;
color: #404040;
}

.topicCon p {
font-size: 28rpx;
color: #404040;
line-height: 2;
}

.topicCon ul {
background: #efefef;
border-radius: 16rpx;
padding: 30rpx;
margin-top: 40rpx;
}

.topicCon ul li b {
font-size: 24rpx;
color: #404040;
font-weight: 800;
margin-right: 20rpx;
}

.topicCon ul li span {
font-size: 28rpx;
color: #404040;
}

.topicCon ul p {
font-size: 24rpx;
color: #404040;
}

.footer {
border-top: 4rpx solid #efefef;
padding: 50rpx;

}

.footer ol {
border: 2rpx solid #c8c8c8;
border-radius: 16rpx;
display: flex;
justify-content: flex-start;
align-items: center;
height: 80rpx;
color: #404040;
font-size: 24rpx;
margin-bottom: 40rpx;
}

.footer ol li {
height: 50rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}

.footer ol li span {
color: #be1211;
}

.footer ol li:first-child {
width: 30%;
border-right: 2rpx solid #c8c8c8;
}

.footer ol li input {
width: 100%;
height: 40rpx;
border: none;
font-size: 32rpx;
text-align: center;
outline: none;
padding: 0;
margin: 0;
}

.buttons {
display: flex;
justify-content: space-around;
align-items: center;
height: 80rpx;
margin-top: 35rpx;
margin-bottom: 20rpx;
}

.buttons p {
border: 4rpx solid #e1bb53;
border-radius: 50rpx;
font-size: 36rpx;
color: #FFFFFF;
width: 40%;
height: 72rpx;
display: flex;
justify-content: space-around;
align-items: center;
color: #e1bb53;
flex: 1;
}

.buttons p:hover {
background-color: #e1bb53;
color: #FFFFFF;
}

.lookButton p {
background-color: #e1bb53;
margin: 0 auto;
color: #FFFFFF;
border-radius: 50rpx;
font-size: 36rpx;
color: #FFFFFF;
//width: 80%;
height: 80rpx;
text-align: center;
line-height: 80rpx;
// display: none;

}

.homebuttom {
background-color: #e1bb53;
color: #FFFFFF !important;
}
</style>

+ 169
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/SucceedXZ.vue View File

@@ -0,0 +1,169 @@
<template>
<view v-if="ready" class="box" style="padding-top: 0; ">
<view class="succeedcontent">
<view class="succeedtopic">
<view class="succeedscore">
</view>
</view>
<p class="texts">提交成功</p>
<p class="backList" @click="action('backList')" >返回列表</p>
</view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-20 09:37
* 描 述:班级工作记事
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/partyevaluatzp/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 {
// 页面相关参数
ready: false,
}
},
async onLoad() {
await this.init()
},
methods: {
// 页面初始化
async init() {
this.ready = true
},
// 点击 「返回列表」、 按钮
async action(type) {
switch (type) {
case 'backList':
this.NAV_TO(`./list`)
break
default: break
}
},
}
}
</script>

<style lang="less">
uni-page-body{
height: 100%;
}
.box {
height: 100%;
width: 100%;
background: url(../../common/images/content.png);
background-repeat: no-repeat;
background-size: 100% 100%;
/* position: relative; */
}

.succeedcontent {
position: relative;
background-color: #FFFFFF;
height: 70%;
top: 20%;
width: 93%;
margin: 0 auto;
border-radius: 20rpx;
}

.succeedtopic {
height: 500rpx;
}

.succeedscore {
width: 350rpx;
height: 350rpx;
background: url(../../common/images/succeed.png);
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
top: 58%;
left: 50%;
transform: translate(-50%, -50%);
}

.texts {
height: 60rpx;
/* background-color: red; */
text-align: center;
}

.succeedlookButton {
width: 80%;
float: none;
position: absolute;
bottom: 0%;
left: 50%;
transform: translate(-50%, -50%);
}

.succeedlookButton p {
background-color: #e1bb53;
margin: 0 auto;
color: #FFFFFF;
border-radius: 50rpx;
font-size: 36rpx;
color: #FFFFFF;
width: 80%;
height: 72rpx;
text-align: center;
line-height: 72rpx;
margin-bottom: 20rpx;
}

.backList{
width: 80%;
float: none;
position: absolute;
bottom: 15%;
left: 50%;
transform: translate(-50%,-50%);
background-color: #e1bb53;
margin: 0 auto;
color: #FFFFFF;
border-radius: 50rpx;
font-size: 36rpx;
color: #FFFFFF;
width: 80%;
height: 72rpx;
text-align: center;
line-height: 72rpx;
margin-bottom: 20rpx;
}

</style>

+ 3
- 2
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/list.vue View File

@@ -269,8 +269,9 @@ export default {
this.TOAST("当前项目已提交!");
return;
}
//todo:进入党员评价页面
//、、、、
//进入党员评价页面
this.NAV_TO(`./PartyevaluatQuestionsXZ?Id=${item.Id}`)
// this.NAV_TO(`./single?type=edit&id=${id}`)
return


+ 0
- 218
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/partyevaluatxz/single.vue View File

@@ -1,218 +0,0 @@
<template>
<view class="page">
<view v-if="ready">
<l-select
@input="setValue('ClassWork.ClassNo', $event)"
:value="getValue('ClassWork.ClassNo')"
:disabled="!edit"
:range="dataSource.ClassWork.ClassNo"
title="班级"
/>
<l-date-picker
@input="setValue('ClassWork.Date', $event)"
:value="getValue('ClassWork.Date')"
:disabled="!edit"
title="日期"
/>
<l-input
@input="setValue('ClassWork.Title', $event)"
:value="getValue('ClassWork.Title')"
:disabled="!edit"
title="标题"
/>
<l-textarea
@input="setValue('ClassWork.Content', $event)"
:value="getValue('ClassWork.Content')"
: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 09:37
* 描 述:班级工作记事
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/partyevaluatxz/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: {
ClassWork: {
ClassNo: { type: 'select', title: '班级', dataSource: '1', dataSourceId: 'bjsj,classname,classno' },
Date: { type: 'datetime', title: '日期', dateformat: '0' },
Title: { type: 'text', title: '标题' },
Content: { type: 'textarea', title: '工作内容' },
},
},
// 数据源
dataSource: {
ClassWork: {
ClassNo: [],
},
}
}
},
async onLoad({ type, id }) {
await this.init(type, id)
},
methods: {
// 页面初始化
async init(type, id) {
this.LOADING('加载数据中...')
this.id = id
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
this.FETCH_DATASOURCE('bjsj').then(result => {
this.dataSource.ClassWork.ClassNo = result.data.map(t => ({ text: t.classname, value: t.classno }))
}),
() => {}
])
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
} else {
const result = await this.HTTP_GET('learun/adms/PersonnelManagement/ClassWork/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/PersonnelManagement/ClassWork/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('PersonnelManagementClassWork-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
break
case 'delete':
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
return
}
this.LOADING('提交删除中...')
this.HTTP_POST('learun/adms/PersonnelManagement/ClassWork/delete', this.id, '删除失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('PersonnelManagementClassWork-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>

Loading…
Cancel
Save