增加功能

This commit is contained in:
duxp 2023-08-31 17:11:28 +08:00
parent 6cc3be56ce
commit f6b9dec0f8
11 changed files with 593 additions and 12 deletions

View File

@ -1,14 +1,15 @@
{
"pages": [
"pages/evaluation/evaluation",
"pages/loading/loading",
"pages/work/work",
"pages/loading/loading",
"pages/mine/mine",
"pages/bind/bind",
"pages/evaluation/evaluation",
"pages/queryList/queryList",
"pages/approvalWarning/approvalWarning",
"pages/taskWarning/taskWarning",
"pages/approvalWarning/approvalForm/approvalForm"
"pages/approvalWarning/approvalForm/approvalForm",
"pages/workReport/workReport"
],
"window": {
"backgroundTextStyle": "light",

View File

@ -42,7 +42,6 @@ Page({
//预览图片或文件
handlePreView(e){
let _url = e.currentTarget.dataset.url;
console.log(_url,'ddd');
if(_url.indexOf('.jpg') > -1 || _url.indexOf('.png') > -1){ //预览图片
wx.previewImage({
urls:[_url],
@ -114,7 +113,8 @@ Page({
}else{
wx.showToast({
title:res.msg,
duration:1500
duration:1500,
icon:'none'
});
}
})
@ -142,7 +142,8 @@ Page({
}else{
wx.showToast({
title:res.msg,
duration:1500
duration:1500,
icon:'none'
});
}
})

View File

@ -29,6 +29,7 @@
<view>部门:{{item.deptName?item.deptName:'暂无'}}</view>
<view>考核类型:{{item.type?item.type:'暂无'}}</view>
<view>考核指标:{{item.target?item.target:'暂无'}}</view>
<view>指标明细:{{item.detailed?item.detailed:'暂无'}}</view>
<view>标准分:{{item.score?item.score:'暂无'}}</view>
<view>当前分数:{{item.nowScore?item.nowScore:'暂无'}}</view>
<view>当前分数:{{item.point}}</view>

View File

@ -42,7 +42,9 @@ Page({
//上传资料
handleSubmitFile(e){
let _data = e.currentTarget.dataset.item;
console.log(_data,'打印_data');
wx.navigateTo({
url:'../workReport/workReport?type='+_data.type+'&isRadio=true'+'&data='+JSON.stringify(_data)
})
},
/**

View File

@ -6,7 +6,7 @@ Page({
* 页面的初始数据
*/
data: {
typeOpt:['党务及意识形态','党风廉政建设','日常考核指标','年度考核指标']
},
/**
@ -16,6 +16,15 @@ Page({
},
//跳转页面
handleSwitch(e){
let _type = e.currentTarget.dataset.type;
let typeName = this.data.typeOpt[Number(_type)];
wx.navigateTo({
url:'../workReport/workReport?type='+typeName
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,18 +1,18 @@
<view class="work_wrap">
<view class="work_content">
<view class="work_item_row">
<view class="work_item_row" data-type="0" bindtap="handleSwitch">
<image class="item_img" src="/asset/img/index/dwysxt.png" />
<view class="item_label">党务意识形态汇报</view>
</view>
<view class="work_item_row">
<view class="work_item_row" data-type="1" bindtap="handleSwitch">
<image class="item_img" src="/asset/img/index/dflzjs.png" />
<view class="item_label">党风廉政建设汇报</view>
</view>
<view class="work_item_row">
<view class="work_item_row" data-type="2" bindtap="handleSwitch">
<image class="item_img" src="/asset/img/index/day.png" />
<view class="item_label">日常考核汇报</view>
</view>
<view class="work_item_row">
<view class="work_item_row" data-type="3" bindtap="handleSwitch">
<image class="item_img" src="/asset/img/index/year.png" />
<view class="item_label">年度考核汇报</view>
</view>

View File

@ -0,0 +1,355 @@
// pages/workReport/workReport.js
const {API: $api} = require("../../utils/api");
import {base_url} from '../../utils/http';
Page({
/**
* 页面的初始数据
*/
data: {
searchForm:{
type:'',
target:'',
targetId:''
},
//搜索
typeOpt:[
{text:'请选择类型',value:''},
{text:'党务及意识形态',value:'党务及意识形态'},
{text:'党风廉政建设',value:'党风廉政建设'},
{text:'日常考核指标',value:'日常考核指标'},
{text:'年度考核指标',value:'年度考核指标'},
],
typeShow:false,
targetOpt:[],
targetShow:false,
mainActiveIndex:0,
activeId:null,
detailData:null,
fileList:[],
isRadio:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if(options && JSON.stringify(options) !== '{}'){
this.setData({
"searchForm.type":options.type,
isRadio:options.isRadio?options.isRadio:false
})
if(this.data.isRadio){
this.setData({
detailData:JSON.parse(options.data)
})
}else{
this.loadTargetData({type:options.type});
}
}
},
//类型搜索
handleTypeOpen(){
this.setData({
typeShow:true
})
},
handleTypeClose(){
this.setData({
typeShow:false
})
},
handleTypeChange(e){
this.setData({
"searchForm.type": e.detail,
typeShow:false,
targetOpt:[],
mainActiveIndex:0,
activeId:null,
detailData:null,
"searchForm.target":""
});
this.loadTargetData({type:this.data.searchForm.type});
},
handleTypeClick(event) {
const { name } = event.currentTarget.dataset;
this.setData({
"searchForm.type": name,
typeShow:false,
targetOpt:[],
mainActiveIndex:0,
activeId:null,
detailData:null,
"searchForm.target":""
});
this.loadTargetData({type:this.data.searchForm.type});
},
//指标搜索
handleTargetOpen(){
this.setData({
targetShow:true
})
},
handleTargetClose(){
this.setData({
targetShow:false
})
},
handleTargetNav(e){
this.setData({
mainActiveIndex:e.detail.index
})
},
handleTargettem(e){
this.setData({
"searchForm.target":e.detail.text,
"searchForm.targetId":e.detail.id,
activeId:e.detail.id,
targetShow:false,
})
this.loadDetailData();
},
//上传之前
handleBeforeUpload(e){
const { file, callback } = e.detail;
if(file.url.indexOf('.jpg') > -1 || file.url.indexOf('.png') > -1 || file.url.indexOf('.pdf') > -1 ||
file.url.indexOf('.jpg') > -1 || file.url.indexOf(".doc")>-1 || file.url.indexOf(".docx")>-1 || file.url.indexOf(".xlsx")>-1 ||
file.url.indexOf(".xls")>-1){
callback(true);
}else{
wx.showToast({
title:'支持jpg,png,pdf,doc,docx,xlsx,xls格式的文件',
duration:2000,
icon:'none'
})
callback(false);
}
},
//上传数据
handleUploadFile(e){
const { file } = e.detail;
console.log(file,'file');
let _fileList = this.data.fileList;
_fileList.push({
name:file.name,
url:file.url,
index:_fileList.length
});
this.setData({
fileList:_fileList
})
},
//预览文件
handlePreView(e){
let _url = e.currentTarget.dataset.url;
if(_url.indexOf('.jpg') > -1 || _url.indexOf('.png') > -1){ //预览图片
wx.previewImage({
urls:[_url],
current:_url
})
}else{ //下载文件
wx.downloadFile({
url: _url, //仅为示例,并非真实的资源
success (res) {
if(res.statusCode === 200){
wx.openDocument({
filePath: res.tempFilePath,
success: function (res) {
console.log(res,'打开文档成功')
}
})
}
}
})
}
},
//删除文件
handleDelFile(e){
let _index = e.currentTarget.dataset.index;
let _fileList = this.data.fileList;
_fileList.forEach((val,idx) => {
if(val.index === _index){
_fileList.splice(idx,1);
}
});
_fileList.forEach((val,idx) => {
val.index = idx;
})
this.setData({
fileList:_fileList
})
},
//封装单个上传的方法
uploadFile(params){
return new Promise((resolve, reject) => {
wx.uploadFile({
url: base_url+"/common/upload",
filePath: params.url,
name: 'file',
success: function(data){
resolve(data);
},
fail(data) {
reject(data);
}
})
})
},
//批量上传多个文件的方法
uploadFiles(fileList){
let promises = fileList.map(item => this.uploadFile(item));
return Promise.all(promises);
},
//保存数据
handleSubmit(){
let _this = this;
if(!_this.data.detailData){
wx.showToast({
title:'请先查询上方汇报数据!',
duration:1500,
icon:'none'
})
return false;
}
if(_this.data.fileList.length === 0){
wx.showToast({
title:'请上传附件!',
duration:1500,
icon:'none'
})
return false;
}
let _data = _this.data.detailData;
let _files = [];
let _fileList = _this.data.fileList;
_this.uploadFiles(_fileList).then(obj => {
obj.forEach(item => {
let _data = JSON.parse(item.data);
_files.push(_data.fileName);
})
let _submitForm = {
header:_data.header,
deptName:_data.deptName,
shotName:_data.shotName,
remark:_data.remark,
id:_data.id,
files:_files.join(',')
};
$api.commit(_submitForm).then(res => {
if(res.code === 0){
wx.showToast({
title:'保存成功',
duration:1500
});
setTimeout(function () {
_this.setData({
"searchForm.target":'',
"searchForm.targetId":'',
targetOpt:[],
mainActiveIndex:0,
activeId:null,
detailData:null,
fileList:[]
})
},1500)
}else{
wx.showToast({
title:res.msg,
duration:1500,
icon:'none'
});
}
})
})
},
//加载指标
loadTargetData(param){
let _this = this;
$api.queryTree(param).then(res => {
if(res.code === 0){
res.data.forEach((item,index) => {
item.index = index;
})
_this.setData({
targetOpt:res.data
})
}
})
},
//加载详情数据
loadDetailData(){
let _this = this;
$api.queryList({
pageNum:1,
pageSize:10,
type:_this.data.searchForm.type,
id:_this.data.searchForm.targetId
}).then(res => {
if(res.code === 0){
let _data = null;
if(res.rows.length>0){
_data = res.rows[0];
}
_this.setData({
detailData:_data
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "工作汇报"
}

View File

@ -0,0 +1,99 @@
<!--pages/workReport/workReport.wxml-->
<view class="report_wrap">
<view class="search_list">
<van-cell-group wx:if="{{!isRadio}}">
<van-field
label="类型"
value="{{ searchForm.type }}"
placeholder="请选择类型"
border="{{ true }}"
readonly="{{true}}"
bindtap="handleTypeOpen"
/>
</van-cell-group>
<van-cell-group wx:if="{{!isRadio}}">
<van-field
label="指标"
value="{{ searchForm.target }}"
placeholder="请选择指标"
border="{{ true }}"
readonly="{{true}}"
bindtap="handleTargetOpen"
/>
</van-cell-group>
<view class="report_detail">
<view wx:if="{{isRadio}}">考核类型:{{detailData.type?detailData.type:'暂无'}}</view>
<view wx:if="{{isRadio}}">考核指标:{{detailData.target?detailData.target:'暂无'}}</view>
<view>提交人:{{detailData.head?detailData.head:'暂无'}}</view>
<view>提交时间:{{detailData.updateTime?detailData.updateTime:'暂无'}}</view>
<view>考核要求:{{detailData.method?detailData.method:'暂无'}}</view>
<view>督办科室:{{detailData.deptName?detailData.deptName:'暂无'}}</view>
<view>评分办法:{{detailData.detailed?detailData.detailed:'暂无'}}</view>
</view>
</view>
<view class="upload_file_wrap">
<view class="file_title">
<view>附件上传</view>
<view class="file_btn">
<van-uploader
accept="all"
use-before-read="{{true}}"
bind:before-read="handleBeforeUpload"
bind:after-read="handleUploadFile"
>
<van-button icon="plus" size="small" type="info">上传附件</van-button>
</van-uploader>
</view>
</view>
<view class="file_list">
<view class="file_list_content" hidden="{{fileList.length === 0}}">
<view
wx:for="{{fileList}}"
wx:key="id"
class="list_item"
data-url="{{item.url}}"
bindtap="handlePreView"
>
<view class="list_item_left">({{item.index+1}}). {{item.name}}</view>
<view class="list_item_right" data-index="{{item.index}}" catchtap="handleDelFile">删除</view>
</view>
</view>
<view hidden="{{fileList.length !== 0}}" class="file_no_data">暂无数据</view>
</view>
<view class="submit_btn">
<van-button custom-style="width:80%" type="info" bindtap="handleSubmit">保存</van-button>
</view>
</view>
</view>
<!--类型选择-->
<van-popup
show="{{ typeShow }}"
position="bottom"
bind:close="handleTypeClose"
>
<van-radio-group value="{{ searchForm.type }}" bind:change="handleTypeChange">
<van-cell-group>
<van-cell wx:for="{{typeOpt}}" wx:key="id" title="{{item.text}}" clickable data-name="{{item.text}}" bind:click="handleTypeClick">
<van-radio slot="right-icon" name="{{item.text}}" />
</van-cell>
</van-cell-group>
</van-radio-group>
</van-popup>
<!--指标选择-->
<van-popup
show="{{ targetShow }}"
position="bottom"
bind:close="handleTargetClose"
>
<view class="target_wrap" wx:if="{{targetOpt.length > 0}}">
<van-tree-select
items="{{ targetOpt }}"
main-active-index="{{ mainActiveIndex }}"
active-id="{{ activeId }}"
bind:click-nav="handleTargetNav"
bind:click-item="handleTargettem"
/>
</view>
<view class="no_data" wx:else>暂无数据(请先选择类型)</view>
</van-popup>

View File

@ -0,0 +1,107 @@
/* pages/workReport/workReport.wxss */
.report_wrap{
width: 100%;
height: 100vh;
overflow-y: auto;
box-sizing: border-box;
padding: 10px;
background-color: #e8e8e8;
}
.search_list{
width: 100%;
background-color: #fff;
border-radius: 8px;
box-sizing: border-box;
padding: 10px;
}
.report_detail{
width: 100%;
border-radius: 8px;
box-sizing: border-box;
padding: 10px;
margin-top: 10px;
font-size: 30rpx;
color: #5d5d5d;
}
.upload_file_wrap{
width: 100%;
background-color: #fff;
border-radius: 8px;
box-sizing: border-box;
padding: 10px;
margin-top: 10px;
font-size: 30rpx;
color: #5d5d5d;
}
.file_title{
font-size: 34rpx;
display: flex;
flex-direction: row;
align-items: center;
}
.file_btn{
margin-left: 20px;
}
.file_list{
width: 100%;
height: 40vh;
overflow-y: auto;
box-sizing: border-box;
padding: 10px;
border-radius: 4px;
border:1px solid silver;
margin-top: 20px;
}
.file_list_content{
width: 100%;
height: 36vh;
overflow-y: auto;
}
.list_item{
color: #5199ff;
font-size: 30rpx;
display: flex;
flex-direction: row;
align-items: center;
margin: 5px 0;
}
.list_item_left{
width: 80%;
word-break: break-all;
}
.list_item_right{
width: 15%;
margin-left: 5%;
height: 25px;
line-height: 25px;
text-align: center;
background-color: #f82222;
color: #fff;
border-radius: 4px;
}
.target_wrap{
width: 100%;
height: 40vh;
overflow-y: auto;
}
.file_no_data{
width: 100%;
margin-top: 10px;
text-align: center;
font-size: 30rpx;
color: #8d8d8d;
}
.no_data{
width: 100%;
height: 40vh;
overflow-y: auto;
margin-top: 10px;
text-align: center;
font-size: 30rpx;
color: #8d8d8d;
}
.submit_btn{
margin-top: 20px;
width: 100%;
text-align: center;
}

View File

@ -28,6 +28,8 @@ const API = {
deptList:data => http.request("POST","/wx/index/deptList",data,true),
//人员数据
personList:data => http.request("POST","/wx/index/personList",data,true),
//上传
upload:data => http.request("POST","/common/uploads",data,true)
}
module.exports = {
API:API