Bläddra i källkod

审批模板

master
yujk 3 år sedan
förälder
incheckning
64d37b5940
7 ändrade filer med 475 tillägg och 71 borttagningar
  1. +396
    -7
      pages/apply/approval/approval.js
  2. +21
    -60
      pages/apply/approval/approval.wxml
  3. +1
    -1
      pages/apply/approval/approval.wxss
  4. +2
    -0
      pages/apply/index.js
  5. +22
    -1
      pages/apply/paymentTemplate/add/add.js
  6. +32
    -1
      utils/API.js
  7. +1
    -1
      utils/util.js

+ 396
- 7
pages/apply/approval/approval.js Visa fil

@@ -1,4 +1,6 @@
// pages/apply/approval/approval.js
import * as UTIL from '../../../utils/util.js';
import * as API from '../../../utils/API.js';
const app = getApp();
Page({

@@ -40,22 +42,406 @@ Page({
comment: '同意'
},
],
//事务总表对象
item:{},
itemId:13,
active:0,
result:[],
show:false,
showPopup:false,
templateList:[],
templateDetailList:[],
groups:[],
villages:[],
towns:[],
temName:"",
temId:""
},

/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {

//this.getApprovalItemList();
this.groupList();
this.townList();
this.villageList();
this.getApprovalItemsById();
// this.getApprovalItemList();
},
getApprovalItemsById(){
let _this = this
let url = API.URL_GET_APPROVALITEMSBYID+this.data.itemId
wx.request({
url,
method:"GET",
timeout: 60000,
header: {
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
success: function (response) {
_this.setData({item:response.data.data})
if(_this.data.item.templateId!=""&&_this.data.item.templateId!=null){
_this.setData({item:response.data.data,temId:_this.data.itemId})
let d = {
templateId : _this.data.item.templateId,
orderByColumn:"id",
isAsc:"asc"
}
UTIL.httpRequest(API.URL_GET_TEMPLATEDETAIL, d, {
success: (r) => {
if (r.code == API.SUCCESS_CODE) {
_this.setData({templateDetailList:r.rows});
let list = []
r.rows.map(rr => {
list.push(rr.userId+"")
})
_this.setData({result:list})
}
}
})
}else {
_this.getApprovalItemList()
}
}
})
},
inputTem:function(e){
this.setData({temName:e.detail.value})
},
confirmTem:function(e){
let data={
approvalTemplate:{
name:this.data.temName,
type:1,
dataType:0
},
approvalTemplateDetailList:this.data.templateDetailList,
method:"POST"
}
UTIL.httpRequest(API.URL_POST_MOBILEADD,data,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
let list = this.data.templateList
list.push(res.data)
this.setData({
temId:res.data.id,
templateList:list,
temName:"",
showPopup:false
});
}
}
})
},
cancelTem:function(e){
this.setData({temName:"",showPopup:false});
},
upItem:function(e){
let index = e.currentTarget.dataset.id
let item = this.data.templateDetailList[index]
let list = this.data.templateDetailList
if(index>0&&index<=list.length){
list.splice(index,1)
list.splice(index-1,0,item)
for(let i = 0;i< list.length;i++){
list[i].name = i+1
}
this.setData({templateDetailList:list});
}
},
downItem:function(e){
let index = e.currentTarget.dataset.id
let item = this.data.templateDetailList[index]
let list = this.data.templateDetailList
if(index>=0&&index<list.length){
list.splice(index,1)
list.splice(index+1,0,item)
for(let i = 0;i< list.length;i++){
list[i].name = i+1
}
this.setData({templateDetailList:list});
}
},
getApprovalItemList:function(){
let data={
dataType:0,
pageNum:1,
pageSize:50
}
UTIL.httpRequest(API.URL_GET_TEMPLATELIST, data, {
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
this.setData({templateList:res.rows});
if(res.total>0){
let d = {
templateId : res.rows[0].id,
orderByColumn:"id",
isAsc:"asc"
}
UTIL.httpRequest(API.URL_GET_TEMPLATEDETAIL, d, {
success: (r) => {
if (r.code == API.SUCCESS_CODE) {
this.setData({templateDetailList:r.rows});
let list = []
r.rows.map(rr => {
list.push(rr.userId+"")
})
this.setData({result:list})
}
}
})
}
}
}
})
},
chooseTemplate:function(e){
let data = {
templateId : e.currentTarget.dataset.id,
orderByColumn:"id",
isAsc:"asc"
}
UTIL.httpRequest(API.URL_GET_TEMPLATEDETAIL, data, {
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
this.setData({templateDetailList:res.rows});
this.closeBox();
}
}
})
},
deleteTemplate:function(e){
let ids = [e.currentTarget.dataset.id]
let url = API.URL_GET_MOBILEREMOVE+ids
let _this = this
wx.request({
url,
method:"GET",
timeout: 60000,
header: {
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
success: function (response) {
_this.getApprovalItemList()
}
})
},
townList:function(){
let _this = this
let url = API.URL_GET_TOWNINFOBYDEPTID+0
wx.request({
url,
method:"GET",
timeout: 60000,
header: {
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
success: function (response) {
let d = {
deptId:response.data.data.deptId,
deptLevel:3
}
UTIL.httpRequest(API.URL_GET_USERLIST,d,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
console.log(res);
_this.setData({towns:res.rows});
}
}
})
}
})
},
groupList:function(){
let data = {
deptId : 187,
deptLevel:1
}
UTIL.httpRequest(API.URL_GET_USERLIST,data ,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
this.setData({groups:res.rows});
}
}
})
},
villageList:function(){
let data = {
deptId : 187,
deptLevel:2
}
UTIL.httpRequest(API.URL_GET_USERLIST,data ,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
this.setData({villages:res.rows});
}
}
})
},
onChange(event) {
this.setData({
result: event.detail,
});
let _this = this
this.setData({result:event.detail})
this.setData({templateDetailList:[]})
let list = _this.data.templateDetailList
for (let j in event.detail){
let str = event.detail[j]
for(let i in _this.data.groups){
if(_this.data.groups[i].userId == str){
let sin = _this.data.groups[i]
list.push(sin)
_this.setData({templateDetailList:list})
}
}
for(let i in _this.data.villages){
if(_this.data.villages[i].userId == str){
let sin = _this.data.villages[i]
list.push(sin)
_this.setData({templateDetailList:list})
}
}
for(let i in _this.data.towns){
if(_this.data.towns[i].userId == str){
let sin = _this.data.towns[i]
list.push(sin)
_this.setData({templateDetailList:list})
}
}
}
},
save:function(){
let _this = this
let list = this.data.templateDetailList
list = list.filter(function(e,i,s){
s[i].name = i+1
return true
})
if(this.data.temId==""||this.data.temId==null){
let data={
approvalTemplate:{
name:this.data.temName,
type:1,
dataType:1
},
approvalTemplateDetailList:list,
method:"POST"
}
UTIL.httpRequest(API.URL_POST_MOBILEADD,data,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
let list = this.data.templateList
list.push(res.data)
this.setData({
temId:res.data.id,
templateList:list,
temName:""
});
let item_ = this.data.item
item_.templateId = res.data.id
item_.method = "POST"
UTIL.httpRequest(API.URL_POST_APPROVALITEMSEDIT,item_,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
wx.showToast({
title: "暂存成功!",
duration: 2000,
icon:"success"
})
}
}
})
}
}
})
}else{
let url = API.URL_POST_TEMPLATEEDIT
wx.request({
url,
data: list,
method:"POST",
timeout: 60000,
header: {
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
success: function (response) {
wx.showToast({
title: "暂存成功!",
duration: 2000,
icon:"success"
})
},
})
}
},
submit:function(){
let _this = this
if(this.data.temId==""||this.data.temId==null){
let data={
approvalTemplate:{
name:this.data.temName,
type:1,
dataType:1
},
approvalTemplateDetailList:this.data.templateDetailList,
method:"POST"
}
UTIL.httpRequest(API.URL_POST_MOBILEADD,data,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
let list = this.data.templateList
list.push(res.data)
this.setData({
temId:res.data.id,
templateList:list,
temName:""
});
let item_ = this.data.item
item_.templateId = res.data.id
item_.method = "POST"
UTIL.httpRequest(API.URL_POST_APPROVALITEMSEDIT,item_,{
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
_this.requestSubmit()
}
}
})
}
}
})
}else{
let url = API.URL_POST_TEMPLATEEDIT
wx.request({
url,
data: _this.data.templateDetailList,
method:"POST",
timeout: 60000,
header: {
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
success: function (response) {
_this.requestSubmit()
},
})
}
},
requestSubmit:function(){
let url = API.URL_POST_APPROVALITEMSSUBMIT+this.data.item.id+"/"+this.data.item.templateId
wx.request({
url,
method:"POST",
timeout: 60000,
header: {
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
success: function (r) {
wx.showToast({
title: "提交成功!",
duration: 2000,
icon:"success"
})
},
})
},
openBox:function(){
var that = this ;
@@ -66,15 +452,18 @@ Page({
closeBox:function(){
var that = this ;
that.setData({
show: false,
show: false
})
},
showPopup() {
this.setData({ showPopup: true });
this.setData({
showPopup: true,
temName:""
});
},

onClose() {
this.setData({ showPopup: false });
this.setData({ showPopup: false});
},
/**
* 生命周期函数--监听页面初次渲染完成


+ 21
- 60
pages/apply/approval/approval.wxml Visa fil

@@ -6,7 +6,7 @@
<view class="pure_top" style="top:{{isIPX?'88px':'64px'}};"></view>
<view class="main-box top-box steps-box" style="margin-top:{{isIPX?'100px':'75px'}};">
<text class="box-title">审批事项</text>
<van-row wx:for="{{steps}}" wx:key="index">
<van-row wx:for="{{templateDetailList}}" wx:key="index">
<van-col span="3">
<view class="index">{{index+1}}</view>
<!-- :class="{'indexCenter':index==0 ? false : true}" -->
@@ -28,11 +28,11 @@
<van-col span="21">
<van-cell center="{{true}}" border="{{false}}">
<view slot="title">
{{item.activityName}}<text style="display: inline-block;margin-left: 10px;">村级主任审批</text>
{{item.name?item.name:index+1}}级审批<text style="display: inline-block;margin-left: 10px;">{{item.nickName}}</text>
</view>
<view style="display: flex;align-items: center;justify-content:flex-end;">
<image src="/image/apply/icon_up.png" style="width: 20px;height: 20px;"></image>
<image src="/image/apply/icon_down.png" style="width: 20px;height: 20px;margin-left: 10px;"></image>
<image src="/image/apply/icon_up.png" style="width: 20px;height: 20px;" bindtap="upItem" data-id="{{index}}"></image>
<image src="/image/apply/icon_down.png" style="width: 20px;height: 20px;margin-left: 10px;" bindtap="downItem" data-id="{{index}}"></image>
</view>
</van-cell>
</van-col>
@@ -40,33 +40,18 @@
<view class="check_box">
<van-checkbox-group value="{{ result }}" bind:change="onChange">
<van-row>
<van-col span="12">
<van-checkbox name="a" shape="square" checked-color="#2C8E68">董事长:张三</van-checkbox>
<van-checkbox name="b" shape="square" checked-color="#2C8E68">董事长:张三</van-checkbox>
</van-col>
<van-col span="12">
<van-checkbox name="c" shape="square" checked-color="#2C8E68">董事长:张三</van-checkbox>
<van-checkbox name="d" shape="square" checked-color="#2C8E68">董事长:张三</van-checkbox>
<van-col span="24" >
<van-checkbox wx:for="{{groups}}" wx:for-item="item" name="{{item.userId}}" shape="square" checked-color="#2C8E68">{{item.roles[0].roleName}}:{{item.nickName}}</van-checkbox>
</van-col>
</van-row>
<van-row>
<van-col span="12">
<van-checkbox name="a" shape="square" checked-color="#2C8E68">村长:张三</van-checkbox>
<van-checkbox name="b" shape="square" checked-color="#2C8E68">村书记:张三</van-checkbox>
</van-col>
<van-col span="12">
<van-checkbox name="c" shape="square" checked-color="#2C8E68">村主任:张三</van-checkbox>
<van-checkbox name="d" shape="square" checked-color="#2C8E68">村党委:张三</van-checkbox>
<van-col span="24" >
<van-checkbox wx:for="{{villages}}" wx:for-item="item" name="{{item.userId}}" shape="square" checked-color="#2C8E68">{{item.roles[0].roleName}}:{{item.nickName}}</van-checkbox>
</van-col>
</van-row>
<van-row>
<van-col span="12">
<van-checkbox name="a" shape="square" checked-color="#2C8E68">镇长:张三</van-checkbox>
<van-checkbox name="b" shape="square" checked-color="#2C8E68">镇书记:张三</van-checkbox>
</van-col>
<van-col span="12">
<van-checkbox name="c" shape="square" checked-color="#2C8E68">镇主任:张三</van-checkbox>
<van-checkbox name="d" shape="square" checked-color="#2C8E68">镇党委:张三</van-checkbox>
<van-col span="24">
<van-checkbox wx:for="{{towns}}" wx:for-item="item" name="{{item.userId}}" shape="square" checked-color="#2C8E68">{{item.roles[0].roleName}}:{{item.nickName}}</van-checkbox>
</van-col>
</van-row>
</van-checkbox-group>
@@ -79,12 +64,12 @@
</view>

<view class="bottom">
<view class="btn1" bindtap="openBox">保存</view>
<view class="btn2" bindtap="goApproval">保存并提交</view>
<view class="btn1" bindtap="save">暂存</view>
<view class="btn2" bindtap="submit">提交</view>
</view>

<van-action-sheet show="{{show}}" title="选择审批模板" bind:close="closeBox">
<van-swipe-cell right-width="{{ 65 }}">
<!-- <van-swipe-cell right-width="{{ 65 }}">
<van-cell label="支付水电、网费、房租" bindtap="goTemplate" >
<view slot="title">
<view class="van-cell-text">日常支付水电模板<van-tag plain type="danger" color="#FC9A55" style="margin-left:10px;">默认</van-tag></view>
@@ -94,41 +79,17 @@
<view slot="right" class="deleteBox">
<image src="/image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;"></image>
</view>
</van-swipe-cell>
<van-swipe-cell right-width="{{ 65 }}">
<van-cell title="日常支付水电模板" label="支付水电、网费、房租" >
</van-swipe-cell> -->
<van-swipe-cell right-width="{{ 65 }}" wx:for="{{templateList}}" wx:for-item="item" >
<van-cell title="{{item.name}}" bindtap='chooseTemplate' data-id="{{item.id}}">
<van-icon slot="icon" name="https://636c-cloud1-8gya17a31667774d-1310628902.tcb.qcloud.la/icon_mb.png?sign=2a8bbe2cb4d4e0f28a99fddbe042d26c&t=1648620032" class="custom-icon" size="40" style="margin-right: 10px;" />
</van-cell>
<view slot="right" class="deleteBox">
<view slot="right" class="deleteBox" bindtap='deleteTemplate' data-id="{{item.id}}">
<image src="/image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;"></image>
</view>
</van-swipe-cell>
<van-swipe-cell right-width="{{ 65 }}">
<van-cell title="日常支付水电模板" label="支付水电、网费、房租" >
<van-icon slot="icon" name="https://636c-cloud1-8gya17a31667774d-1310628902.tcb.qcloud.la/icon_mb.png?sign=2a8bbe2cb4d4e0f28a99fddbe042d26c&t=1648620032" class="custom-icon" size="40" style="margin-right: 10px;" />
</van-cell>
<view slot="right" class="deleteBox">
<image src="/image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;"></image>
</view>
</van-swipe-cell>
<van-swipe-cell right-width="{{ 65 }}">
<van-cell title="日常支付水电模板" label="支付水电、网费、房租" >
<van-icon slot="icon" name="https://636c-cloud1-8gya17a31667774d-1310628902.tcb.qcloud.la/icon_mb.png?sign=2a8bbe2cb4d4e0f28a99fddbe042d26c&t=1648620032" class="custom-icon" size="40" style="margin-right: 10px;" />
</van-cell>
<view slot="right" class="deleteBox">
<image src="/image/apply/icon_delete.png" style="width: 25px;height: 25px;margin: 0 auto;"></image>
</view>
</van-swipe-cell>
</van-action-sheet>

<van-dialog
use-slot
title="审批模板"
show="{{ showPopup }}"
bind:close="onClose"
theme='round-button'
confirmButtonText="保存"
closeOnClickOverlay="{{ true }}"
>
<input class="input_tit" placeholder="请输入模板名称" style="width: 90%;margin: 0 auto;margin-top: 15px;margin-bottom: 10px;text-align: center;"/>
</van-dialog>
</van-action-sheet>
<modal hidden="{{!showPopup}}" title="审批模板" confirm-text="保存" cancel-text="取消" bindcancel="cancelTem" bindconfirm="confirmTem">
<input type='text' placeholder="请输入模板名称" bindinput="inputTem" auto-focus/>
</modal>

+ 1
- 1
pages/apply/approval/approval.wxss Visa fil

@@ -143,7 +143,7 @@ text{display: block;}
.check_box .van-col{
height: auto;
}
.check_box van-checkbox:nth-child(2n) .van-checkbox {
.check_box van-checkbox:nth-child(n) .van-checkbox {
margin-top: 15px;
}
.van-checkbox__icon-wrap {


+ 2
- 0
pages/apply/index.js Visa fil

@@ -1,4 +1,6 @@
// pages/apply/index.js
import * as UTIL from '../../utils/util.js';
import * as API from '../../utils/API.js';
const app = getApp();
Page({



+ 22
- 1
pages/apply/paymentTemplate/add/add.js Visa fil

@@ -1,4 +1,6 @@
// pages/apply/paymentTemplate/add/add.js
import * as UTIL from '../../../../utils/util.js';
import * as API from '../../../../utils/API.js';
const app = getApp();
Page({

@@ -50,7 +52,26 @@ Page({
onLoad(options) {

},

back:function(){
wx.navigateBack({
delta: 1
})
},
//跳转支出申请
goApproval:function(e){
console.log(e.currentTarget.dataset.current);
// let cur = e.currentTarget.dataset.current;
// if (this.data.currentTaB == cur) {
// return false;
// }else{
// wx.navigateTo({
// url: '../inCome/index?id=' + id,
// })
// }
wx.navigateTo({
url: '/pages/apply/approval/approval',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/


+ 32
- 1
utils/API.js Visa fil

@@ -71,6 +71,27 @@ const URL_GET_SELECTLIST = `${URL_PREFIX}/yinnong/payee/selectList`;

//查询收款账号列表
const URL_GET_SELECTACCOUNTLIST = `${URL_PREFIX}/cashier/account/accountList`;
//查询审批流模板列表
const URL_GET_TEMPLATELIST = `${URL_PREFIX}/service/template/list`;

//查询审批流模板列表
const URL_GET_TEMPLATEDETAIL = `${URL_PREFIX}/service/templateDetail/list`;
//根据系统组织机构id查询所在乡镇
const URL_GET_TOWNINFOBYDEPTID = `${URL_PREFIX}/system/dept/getTownInfoByDeptId/`;
//根据条件查询用户信息
const URL_GET_USERLIST = `${URL_PREFIX}/system/user/list`;
//新增模板
const URL_POST_MOBILEADD = `${URL_PREFIX}/service/template/mobileAdd`;
//删除模板
const URL_GET_MOBILEREMOVE = `${URL_PREFIX}/service/template/remove/`;
//通过审批事项id查询审批事项
const URL_GET_APPROVALITEMSBYID = `${URL_PREFIX}/yinnong/approvalItems/get/`;
//审批流id保存到事项审批
const URL_POST_APPROVALITEMSEDIT = `${URL_PREFIX}/yinnong/approvalItems/edit`;
//修改审批流数据
const URL_POST_TEMPLATEEDIT = `${URL_PREFIX}/service/templateDetail/editBatch`;
//审核事项申请
const URL_POST_APPROVALITEMSSUBMIT = `${URL_PREFIX}/yinnong/approvalItems/approvalItemsSubmit/`;
/****************接口地址end****************/

export {
@@ -104,5 +125,15 @@ export {
URL_GET_GETPROJECTLIST,
URL_GET_CONTRACTIONLIST,
URL_GET_SELECTLIST,
URL_GET_SELECTACCOUNTLIST
URL_GET_SELECTACCOUNTLIST,
URL_GET_TEMPLATELIST,
URL_GET_TEMPLATEDETAIL,
URL_GET_TOWNINFOBYDEPTID,
URL_GET_USERLIST,
URL_POST_MOBILEADD,
URL_GET_MOBILEREMOVE,
URL_GET_APPROVALITEMSBYID,
URL_POST_APPROVALITEMSEDIT,
URL_POST_TEMPLATEEDIT,
URL_POST_APPROVALITEMSSUBMIT
}

+ 1
- 1
utils/util.js Visa fil

@@ -117,7 +117,7 @@ function httpRequest(url, data, {
finalData.token = getApp().globalData.userInfo.token;
wx.request({
url,
data: finalData,
data: finalData,
method:data.method,
timeout: 60000,
header: {


Laddar…
Avbryt
Spara