228 lines
5.1 KiB
Vue
228 lines
5.1 KiB
Vue
<template>
|
|
<view>
|
|
<view class="top_required">
|
|
只展示<span style="color:#f00">必填</span>字段<switch :checked="isRequired" color="#008EFF" @change="changeRequired" />
|
|
</view>
|
|
<form-item
|
|
v-for="(item,index) in listForm"
|
|
:key="index"
|
|
:index="index"
|
|
:objInfo="item"
|
|
:isNotRequired="isRequired"
|
|
@changeData="changeData"
|
|
></form-item>
|
|
<!-- 固定审批 -->
|
|
<fixed-approval v-if="approvalPro.status == 1" :list="approvalPro.stepList"></fixed-approval>
|
|
<!-- 审核信息 -->
|
|
<examine-template v-if="approvalPro.status == 0" :remindPeople="remindPeople" @delExamine="delRemind"></examine-template>
|
|
<view class="btn_g bg-blue button-hover round" @click="$noMultipleClicks(subSave)">
|
|
保存
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import formItem from '@/components/form/formitem.vue'
|
|
import { netWorkExamineForm, netCreateWorkExamine, netApprovalProcess } from '@/api/index'
|
|
import { BASE_IMG_URL } from '@/util/api.js'
|
|
import { commonJS } from '@/components/copy/copy.js'
|
|
import fixedApproval from '@/components/fixedApproval.vue'
|
|
export default{
|
|
mixins:[commonJS],
|
|
components:{
|
|
formItem,
|
|
fixedApproval
|
|
},
|
|
data() {
|
|
return{
|
|
BASE_IMG_URL:BASE_IMG_URL,
|
|
noClick:true, //防止 重复点击
|
|
id:'',
|
|
listForm:[],
|
|
remindPeople: [], //审批人
|
|
copyList:[], //抄送人
|
|
approvalPro:{}, //审批流程
|
|
isRequired:false, //是否只展示必填字段
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.id = options.id
|
|
uni.setNavigationBarTitle({
|
|
title: options.name
|
|
})
|
|
this.getForm()
|
|
},
|
|
onShow() {
|
|
//获取审批流程
|
|
this.getProcess()
|
|
},
|
|
onUnload() {
|
|
uni.removeStorageSync('remindlist')
|
|
},
|
|
methods:{
|
|
//切换是否只展示必填字段
|
|
changeRequired(e) {
|
|
this.isRequired = e.detail.value
|
|
},
|
|
//审批流程
|
|
getProcess() {
|
|
netApprovalProcess({type:'approval_'+this.id}).then(res=>{
|
|
this.approvalPro = res.data
|
|
if(res.data.status == 0){
|
|
//获取 默认审核人
|
|
this.getDefaultRemind()
|
|
}
|
|
})
|
|
},
|
|
getDefaultRemind() {
|
|
netWorkExamineForm({id:this.id}).then(res=>{
|
|
res = res.data.staff
|
|
let arr = uni.getStorageSync('remindlist')?uni.getStorageSync('remindlist'):[]
|
|
arr.forEach((item,index)=>{
|
|
res.forEach(ele=>{
|
|
if(item.id == ele.id){
|
|
item.isDel = false
|
|
}
|
|
})
|
|
})
|
|
this.remindPeople = this.checkReport([...res,...uni.getStorageSync('remindlist')])
|
|
})
|
|
},
|
|
getForm() {
|
|
netWorkExamineForm({id:this.id}).then(res=>{
|
|
let data = res.data.data
|
|
data.forEach(ele=>{
|
|
ele.value = ''
|
|
})
|
|
this.listForm = data
|
|
})
|
|
},
|
|
// 选择审批人
|
|
moreClick() {
|
|
uni.navigateTo({
|
|
url: '/pagesA/crm/selectMember/selectMember'
|
|
})
|
|
},
|
|
delRemind(index) {
|
|
this.remindPeople.splice(index,1)
|
|
uni.setStorageSync('remindlist',this.remindPeople)
|
|
},
|
|
changeData(name,value,obj) {
|
|
let arr = this.listForm
|
|
arr.forEach((ele,index) => {
|
|
if(ele.id == obj.id){
|
|
ele.value = value
|
|
this.$set(this.listForm,index,ele)
|
|
}
|
|
})
|
|
},
|
|
subSave() {
|
|
let arrlist = []
|
|
let data = this.checkCommonForm(this.listForm)
|
|
if(!data){
|
|
return
|
|
}
|
|
if(this.remindPeople.length == 0 && this.approvalPro.status == 0){
|
|
uni.showToast({
|
|
title:'请选择审批人',
|
|
icon:'none'
|
|
})
|
|
return
|
|
}
|
|
//流程审批人
|
|
let remarr = []
|
|
this.remindPeople.forEach(ele=>{
|
|
remarr.push(ele.id)
|
|
})
|
|
//抄送人
|
|
let copyarr = []
|
|
this.copyList.forEach(ele=>{
|
|
copyarr.push(ele.id)
|
|
})
|
|
let reminds_id = copyarr.join(',')
|
|
let params = {
|
|
formapproval_id:this.id,
|
|
flow_staff_ids:this.approvalPro.status == 0 ? remarr.join(',') : '',
|
|
reminds_id,
|
|
relation_type:'approval',
|
|
data,
|
|
}
|
|
netCreateWorkExamine(params).then(res=>{
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon:'none'
|
|
})
|
|
setTimeout(()=>{
|
|
uni.redirectTo({
|
|
url:'/pagesA/work/approve/index'
|
|
})
|
|
},2000)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.affiliation {
|
|
background-color: #fff;
|
|
margin-bottom: 20rpx;
|
|
padding-bottom: 40rpx;
|
|
.aff_head {
|
|
padding:30rpx 0 30rpx 47rpx;
|
|
font-size: 32rpx;
|
|
color: #999;
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
.order{
|
|
font-size:20rpx;
|
|
color:$uni-text-color;
|
|
padding:3rpx;
|
|
border:2rpx solid $uni-text-color;
|
|
border-radius: 5rpx;
|
|
margin-left:8rpx;
|
|
}
|
|
}
|
|
.aff_con {
|
|
display: flex;
|
|
text-align: center;
|
|
flex-wrap: wrap;
|
|
|
|
.aff_item {
|
|
width: 100rpx;
|
|
margin-right: 15rpx;
|
|
margin-bottom:15rpx;
|
|
image {
|
|
margin-bottom: 15rpx;
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
border-radius: 50%;
|
|
}
|
|
}
|
|
|
|
.affbox {
|
|
position: relative;
|
|
|
|
.delremind {
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
right: -16rpx;
|
|
top: -16rpx;
|
|
background: rgba(0, 0, 0, 0.5);
|
|
z-index: 2;
|
|
}
|
|
}
|
|
|
|
.aff_last {
|
|
image {
|
|
margin-bottom: 15rpx;
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|