You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

462 lines
15 KiB

<template>
<div class="app-container">
<div>
<!--标题按钮部分开始-->
<div class="tab-header webtop">
<!--标题-->
<div>{{ viewTitle }}</div>
<!--start 添加修改按钮-->
<div>
<el-button type="primary" @click="openAgree"> </el-button>
<el-button type="danger" @click="openReject"> </el-button>
<el-button type="danger" @click="openStop"> </el-button>
</div>
<!--end 添加修改按钮-->
<!--end 详情按钮-->
</div>
<!--标题按钮部分结束-->
<!--Start 新增修改部分-->
<div ><!-- -->
<el-form ref="form_obj" :model="formobj" :rules="rules" :inline="true" label-width="120px">
<div>
<!--第一行-->
<el-row>
<el-col :span="8">
<el-form-item label="申请编号:">{{ formobj.applicationCode }}</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="申请人:">{{ formobj.name }}</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="申请日期:">{{ formobj.createTime }}</el-form-item>
</el-col>
</el-row>
</div>
<div class="invoiceadd" style="margin-top: 5px;">
<el-row>
<el-col :span="12">
<el-form-item prop="reason" label="退库原因">
<span>{{ formobj.reason }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item prop="money" label="退库费用">
<span>{{ formobj.money }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="remarks" label="费用说明">
<span>{{ formobj.remarks }}</span>
</el-form-item>
</el-col>
</el-row>
</div>
<div class="addtable">
<div class="tabletitle">
<div class="titlename">
货物明细
</div>
</div>
<template class="tablelist">
<el-table :data="formobj.voList" border style="width: 100%" :index="index">
<el-table-column align="center" label="序号" type="index" width="50"/>
<el-table-column label="车架号" align="center">
<template slot-scope="scope">
<span>{{scope.row.vinNo}}</span>
</template>
</el-table-column>
<el-table-column label="车型名称" align="center">
<template slot-scope="scope">
<span>{{scope.row.modelName}}</span>
</template>
</el-table-column>
<el-table-column label="常用配置" align="center">
<template slot-scope="scope">
<span>{{scope.row.configName}}</span>
</template>
</el-table-column>
<el-table-column label="入库日期" align="center">
<template slot-scope="scope">
<span>{{scope.row.inboundDate}}</span>
</template>
</el-table-column>
</el-table>
</template>
</div>
</el-form>
</div>
<!--End 添加修改部分-->
</div>
<!-- 选择待办人 的弹出框-->
<el-dialog title="填写审批意见" :visible.sync="nodeDialogVisible" width="80%">
<el-form label-position="right" class="formadd" >
<el-row>
<el-col :span="4" class="tleftb">当前环节</el-col>
<el-col :span="20" class="trightb">
<el-form-item prop="purchasingUnitName"><span>{{ formobj.taskName }}->{{ nextNode.name }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="tleftb">意见</el-col>
<el-col :span="20" class="trightb">
<el-input size="small" v-model="formobj.comment" class="addinputw" clearable ></el-input>
</el-col>
</el-row>
<div style="text-align:center;margin-top: 20px;">
<el-button type="primary" size="mini" @click="agree">确 定</el-button>
<el-button type="info " size="mini" @click="closeNodeDialog">取 消</el-button>
</div>
</el-form>
</el-dialog>
<!-- 选择待办人 的弹出框-->
<el-dialog title="填写审批意见" :visible.sync="nodeDialogVisibleForReject" width="80%">
<el-form label-position="right" class="formadd" >
<el-row>
<el-col :span="4" class="tleftb">当前环节</el-col>
<el-col :span="20" class="trightb">
<el-form-item prop="purchasingUnitName"><span>{{ formobj.taskName }}->{{ nextNode.name }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="tleftb">意见</el-col>
<el-col :span="20" class="trightb">
<el-input size="small" v-model="formobj.comment" placeholder="审批意见" class="addinputw" clearable ></el-input>
</el-col>
</el-row>
<div style="text-align:center;margin-top: 20px;">
<el-button type="primary" size="mini" @click="reject">确 定</el-button>
<el-button type="info " size="mini" @click="closeNodeDialog"> </el-button>
</div>
</el-form>
</el-dialog>
</div>
</template>
<script>
import req from '@/api/supplychain/purchasereturntowarehouse'
import request from '@/api/flow/vehicleReturn'
export default {
name: 'caigoutuiku',
data() {
return {
nodeDialogVisibleForReject:false,
nodeDialogVisible:false,
isXuanche: false,
viewTitle: '',
dialogStatus: '',
index: 0,
list: [],
//下一环节
nextNode:{},
// 表单数据
formobj: {
orgSidPath: window.sessionStorage.getItem('orgSidPath'),
userSid: window.sessionStorage.getItem('userSid'),
sid: '', // 一条数据的sid
applicationCode: '',
name: window.sessionStorage.getItem('name'),
createTime: '',
voList: [],
businessSid: '',
comment: '',
instanceId: '',
taskId: '',
taskDefKey:'',
taskName:''
},
agreeList: { //同意办理列表
businessSid: '',
comment: '',
instanceId: '',
taskId: '',
userSid: window.sessionStorage.getItem('userSid')
},
regectList: { // 驳回列表
businessSid: '',
comment: '',
instanceId: '',
taskId: '',
userSid: window.sessionStorage.getItem('userSid')
},
stopList: { // 终止列表
businessSid: '',
comment: '',
instanceId: '',
taskId: '',
userSid: window.sessionStorage.getItem('userSid')
},
obj:{},
rules: {},
disabled: false
}
},
created() {
var one = window.location.href.indexOf('&data') + 6
const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用
const obj = JSON.parse(decodeURIComponent(data))
this.obj=obj;
console.log('iframe页面获取的obj:', obj)
// ===获取sid
console.log('iframe页面获取到的url:' + window.location.href)
this.showInfo(obj.businessSid)
// 同意列表
this.agreeList.businessSid = obj.businessSid
this.agreeList.instanceId = obj.instanceId
this.agreeList.taskId = obj.taskId
this.agreeList.taskDefKey = obj.taskDefKey
this.agreeList.taskName = obj.taskName
// 驳回列表
this.regectList.businessSid = obj.businessSid
this.regectList.instanceId = obj.instanceId
this.regectList.taskId = obj.taskId
// 终止列表
this.stopList.businessSid = obj.businessSid
this.stopList.instanceId = obj.instanceId
this.stopList.taskId = obj.taskId
window.parent.postMessage({
cmd: 'returnHeight',
params: {
//告诉父级页面,子页面的弹框高度。
code: 2,
data: 600 + 'px'
}
}, '*')
},
methods: {
reject(){
if(this.formobj.comment==''){
alert('请填写审批意见!');
return false;
}
this.handleReject();
},
//关闭弹出框 选择待办人弹框
closeNodeDialog(){
this.nodeDialogVisible = false
this.nodeDialogVisibleForReject=false
},
// 返回(===既判断又赋值)
handleReturn() {
this.formobj.sid = ''
this.$refs['form_obj'].resetFields()
this.$emit('doback')
},
showInfo(sid, nodeState) {
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.dialogStatus = 'edit'
this.viewTitle = '【编辑】车辆采购退库申请'
req.detailsInfo({'sid':sid}).then(resp => {
const data = resp.data
this.formobj = data
}).catch(e => {
this.submitdisabled = false
})
if (nodeState == '' || nodeState == '发起订单') {
this.disabled = false
} else {
this.disabled = true
}
},
// 同意
openAgree() {
this.$set(this.formobj, "comment", "同意")//this.obj 对象,name 设置的属性, 99 设置的值
// this.formobj.comment = '同意'
//查验下一环节要用到,流程定义的id
this.formobj.businessSid = this.obj.businessSid
this.formobj.instanceId = this.obj.instanceId
this.formobj.taskId = this.obj.taskId
this.formobj.taskDefKey = this.obj.taskDefKey
this.formobj.taskName = this.obj.taskName
this.formobj.userSid = window.sessionStorage.getItem('userSid')
this.formobj.orgSidPath = window.sessionStorage.getItem('orgSidPath')
request.getNextNodesForSubmit(this.formobj).then(resp=>{
if (resp.success) {
var arr= resp.data;
this.nextNode=arr[0]
this.nodeDialogVisible = true
}
this.submitdisabled = false
});
},
//同意任务
agree() {
if(this.formobj.comment == ''){
alert('请填写审批意见!');
return;
}
//意见
//下一环节的用户sid
//调用后台接口流转
request.agreeTask(this.formobj).then((response) => {
if (response.code === '200') {
this.nodeDialogVisible=false;
//子页面向父级页面传递值
window.parent.postMessage({
cmd: 'returnHeight',
params: {
//操作成功,告诉父级页面关闭弹框
code: 1
}
}, '*')
} else {
this.$notify({
title: '提示',
message: '执行失败',
type: 'error',
duration: 2000
})
}
})
},
/** 同意任务 */
handleAgree() {
this.agreeList.comment = this.comment
request.agreeTask(this.agreeList).then((response) => {
if (response.code === '200') {
this.$notify({
title: '提示',
message: '执行成功',
type: 'success',
duration: 2000
})
// this.refreshIt()
} else {
this.$notify({
title: '提示',
message: '执行失败',
type: 'error',
duration: 2000
})
}
})
},
// 驳回
openReject() {
this.formobj.comment = ''
/* this.$confirm('是否确认执行驳回操作', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.handleReject()
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消驳回'
})
})*/
this.formobj.businessSid = this.obj.businessSid
this.formobj.instanceId = this.obj.instanceId
this.formobj.taskId = this.obj.taskId
this.formobj.taskDefKey = this.obj.taskDefKey
this.formobj.taskName = this.obj.taskName
this.formobj.userSid = window.sessionStorage.getItem('userSid')
this.formobj.orgSidPath = window.sessionStorage.getItem('orgSidPath')
request.getPreviousNodesForReject(this.formobj).then(resp=>{
if (resp.success) {
var arr= resp.data;
//循环获取当前环节的下一个环节信息
var startTask=arr[0].startTask;
if(startTask){
alert('当前环节不能驳回!');
return;
}
this.nextNode=arr[0]
this.nodeDialogVisibleForReject = true
}
});
},
/** 驳回任务 */
handleReject() {
this.regectList.comment = this.formobj.comment
request.rejectTask(this.regectList).then((response) => {
if (response.code === '200') {
this.$notify({
title: '提示',
message: '执行成功',
type: 'success',
duration: 2000
})
// this.refreshIt()
this.nodeDialogVisible=false;
window.parent.postMessage({
cmd: 'returnHeight',
params: {
code: 1
}
}, '*')
} else {
this.$notify({
title: '提示',
message: '执行失败',
type: 'error',
duration: 2000
})
}
})
},
// 终止
openStop() {
this.$confirm('是否确认执行终止操作', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.handleStop()
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消终止'
})
})
},
/** 终止任务 */
handleStop() {
this.stopList.comment = this.comment
request.breakTask(this.stopList).then((response) => {
if (response.code === '200') {
/*this.$notify({
title: '提示',
message: '执行成功',
type: 'success',
duration: 2000
})*/
window.parent.postMessage({
cmd: 'returnHeight',
params: {
code: 1
}
}, '*')
// this.refreshIt()
} else {
this.$notify({
title: '提示',
message: '执行失败',
type: 'error',
duration: 2000
})
}
})
}
}
}
</script>
<style scoped>
.title {
padding: 28px 0;
}
</style>