增加功能

This commit is contained in:
duxp 2023-08-31 11:12:54 +08:00
parent 2224075e9b
commit 6cc3be56ce
4 changed files with 140 additions and 12 deletions

View File

@ -1,5 +1,6 @@
// pages/approvalWarning/approvalForm/approvalForm.js
import {base_url} from '../../../utils/http'
import {base_url} from '../../../utils/http';
import {API} from "../../../utils/api";
Page({
/**
@ -8,7 +9,12 @@ Page({
data: {
//父组件数据
fData:null,
fileList:[]
fileList:[],
submit_form:{
nowScore:'',
remark:''
},
scoreMsg:''
},
/**
@ -59,6 +65,92 @@ Page({
}
},
//公共输入方法
handlePublicInput(e){
let _type = e.currentTarget.dataset.type;
switch (_type) {
case "score":
let _tips = e.detail?'':'请输入评定分数';
this.setData({
'submit_form.nowScore':e.detail,
scoreMsg:_tips
})
break;
case "remark":
this.setData({
'submit_form.remark':e.detail
})
break;
}
},
//审核
handleApproval(){
let _this = this;
if(!_this.data.submit_form.nowScore){
_this.setData({
scoreMsg:'请输入评定分数'
});
return false;
}else{
_this.setData({
scoreMsg:''
})
}
API.reviewedSave({
id:_this.data.fData.id,
reviewer:_this.data.fData.reviewer,
nowScore:_this.data.submit_form.nowScore,
remark:_this.data.submit_form.remark
}).then(res => {
if(res.code === 0){
wx.showToast({
title:'审核成功!',
duration:1500
});
setTimeout(function () {
wx.navigateBack();
},1500)
}else{
wx.showToast({
title:res.msg,
duration:1500
});
}
})
},
//驳回
handleOverrule(){
let _this = this;
wx.showModal({
title: '温馨提示',
content: '是否驳回?',
success (res) {
if (res.confirm) {
API.reback({
id:_this.data.fData.id
}).then(res => {
if(res.code === 0){
wx.showToast({
title:'驳回成功!',
duration:1500
});
setTimeout(function () {
wx.navigateBack();
},1500)
}else{
wx.showToast({
title:res.msg,
duration:1500
});
}
})
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -7,7 +7,7 @@
</view>
<view class="public_content">
<view class="public_title">附件信息</view>
<view class="file_list">
<view class="file_list" wx:if="{{fileList.length> 0}}">
<view
wx:for="{{fileList}}"
wx:key="id"
@ -18,17 +18,36 @@
({{index+1}})、{{item.name}}
</view>
</view>
<view wx:else class="no_data">暂无数据</view>
</view>
<view class="public_content">
<view class="public_title">审批</view>
<van-cell-group>
<van-field
label="1"
value="{{ value }}"
placeholder="请输入用户名"
border="{{ false }}"
bind:change="onChange"
label="评定分数"
required="{{true}}"
value="{{ submit_form.nowScore }}"
placeholder="请输入评定分数"
error-message="{{scoreMsg}}"
border="{{ true }}"
data-type="score"
bind:change="handlePublicInput"
/>
</van-cell-group>
<van-cell-group>
<van-field
label="批注"
value="{{ submit_form.remark }}"
placeholder="请输入批注"
border="{{ true }}"
data-type="remark"
bind:change="handlePublicInput"
/>
</van-cell-group>
<view class="footer_wrap">审批人:{{fData.reviewer || '暂无'}}</view>
<view class="submit_btn">
<van-button type="info" custom-style="width:40%" bindtap="handleApproval">审批</van-button>
<van-button type="danger" custom-style="width:40%" bindtap="handleOverrule">驳回</van-button>
</view>
</view>
</view>

View File

@ -16,7 +16,7 @@
}
.public_content{
box-sizing: border-box;
padding: 5px 10px;
padding: 10px;
background-color: #fff;
border-radius: 8px;
margin-top: 10px;
@ -35,4 +35,21 @@
text-decoration: underline;
color: #5199ff;
font-size: 30rpx;
}
.footer_wrap{
color: #8d8d8d;
font-size: 30rpx;
margin-top: 5px;
}
.submit_btn{
width: 100%;
text-align: center;
margin-top: 20px;
}
.no_data{
width: 100%;
color: #8d8d8d;
font-size: 30rpx;
text-align: center;
margin-top: 10px;
}

View File

@ -22,8 +22,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.loadListData();
this.loadPersonData();
},
//人员查询
@ -141,7 +140,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.loadListData();
this.loadPersonData();
},
/**