Commit 2024115a by yuzhenWang

在处理工单和申请工单页面加返回路径

parent c4d51c41
<template>
<div class="app-container">
<el-button v-if="scrmParams.showBack" style="margin-bottom:16px;" type="primary" @click="goBack">
<el-button
v-if="scrmParams.showBack"
style="margin-bottom: 16px"
type="primary"
@click="goBack"
>
返回
</el-button>
<el-card class="box-card">
......@@ -8,11 +13,20 @@
<span>公共信息</span>
</div>
<div class="text item">
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px">
<el-form
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="100px"
>
<el-form-item label="标题:" prop="title" style="margin-bottom: 13px">
<el-input v-model="ruleForm.title" size="small" />
</el-form-item>
<el-form-item label="优先级:" prop="priority" style="margin-bottom: 0">
<el-form-item
label="优先级:"
prop="priority"
style="margin-bottom: 0"
>
<el-radio-group v-model="ruleForm.priority" size="small">
<el-radio :label="1">一般</el-radio>
<el-radio :label="2">紧急</el-radio>
......@@ -30,27 +44,37 @@
<div class="text item">
<template v-for="(tplItem, tplIndex) in processStructureValue.tpls">
<fm-generate-form
v-show="currentNode.hideTpls===undefined ||
currentNode.hideTpls===null ||
currentNode.hideTpls.indexOf(tplItem.id)===-1"
v-show="
currentNode.hideTpls === undefined ||
currentNode.hideTpls === null ||
currentNode.hideTpls.indexOf(tplItem.id) === -1
"
:key="tplIndex"
:ref="'generateForm-'+tplItem.id"
:preview="currentNode.hideTpls===undefined ||
currentNode.hideTpls===null ||
currentNode.hideTpls.indexOf(tplItem.id)===-1?false:true"
:ref="'generateForm-' + tplItem.id"
:preview="
currentNode.hideTpls === undefined ||
currentNode.hideTpls === null ||
currentNode.hideTpls.indexOf(tplItem.id) === -1
? false
: true
"
:remote="remoteFunc"
:data="tplItem.form_structure"
:disabled="currentNode.readonlyTpls===undefined ||
currentNode.readonlyTpls===null ||
currentNode.readonlyTpls.indexOf(tplItem.id)===-1?null:true"
:disabled="
currentNode.readonlyTpls === undefined ||
currentNode.readonlyTpls === null ||
currentNode.readonlyTpls.indexOf(tplItem.id) === -1
? null
: true
"
/>
</template>
</div>
<hr style="background-color: #d9d9d9; border:0; height:1px;">
<div class="text item" style="text-align: center;margin-top:18px">
<hr style="background-color: #d9d9d9; border: 0; height: 1px">
<div class="text item" style="text-align: center; margin-top: 18px">
<el-button
v-for="(item, index) in processStructureValue.edges"
v-show="item.source===processStructureValue.nodes[active].id"
v-show="item.source === processStructureValue.nodes[active].id"
:key="index"
type="primary"
:disabled="submitDisabled"
......@@ -64,18 +88,12 @@
</template>
<script>
import Vue from 'vue'
import {
GenerateForm
} from '@/components/VueFormMaking'
import { GenerateForm } from '@/components/VueFormMaking'
import 'form-making/dist/FormMaking.css'
Vue.component(GenerateForm.name, GenerateForm)
import {
processStructure,
createWorkOrder
} from '@/api/process/work-order'
import { processStructure, createWorkOrder } from '@/api/process/work-order'
import { listUser } from '@/api/system/sysuser'
import { getDeptList } from '@/api/system/dept'
export default {
......@@ -95,15 +113,13 @@ export default {
source_state: '',
process_method: '',
tpls: {
'form_structure': [],
'form_data': []
form_structure: [],
form_data: []
},
tasks: []
},
rules: {
title: [
{ required: true, message: '请输入工单标题', trigger: 'blur' }
],
title: [{ required: true, message: '请输入工单标题', trigger: 'blur' }],
priority: [
{ required: true, message: '请选择工单优先级', trigger: 'blur' }
]
......@@ -139,7 +155,7 @@ export default {
getProcessNodeList() {
processStructure({
processId: this.$route.query.processId
}).then(response => {
}).then((response) => {
this.processStructureValue = response.data
this.currentNode = this.processStructureValue.nodes[0]
})
......@@ -152,7 +168,8 @@ export default {
this.ruleForm.process = parseInt(this.$route.query.processId)
this.ruleForm.classify = this.processStructureValue.process.classify
stateMap['id'] = item.target
this.ruleForm.source_state = this.processStructureValue.nodes[this.active].label
this.ruleForm.source_state =
this.processStructureValue.nodes[this.active].label
for (var v of this.processStructureValue.nodes) {
if (v.id === item.target) {
if (v.assignType !== undefined) {
......@@ -168,14 +185,21 @@ export default {
this.ruleForm.state = [stateMap]
this.ruleForm.tpls = {
'form_structure': [],
'form_data': []
form_structure: [],
form_data: []
}
// 绑定流程任务
this.ruleForm.tasks = this.processStructureValue.process.task === undefined ? [] : this.processStructureValue.process.task
this.ruleForm.tasks =
this.processStructureValue.process.task === undefined
? []
: this.processStructureValue.process.task
// 追加节点任务
if (this.processStructureValue.nodes[this.active].task !== undefined && this.processStructureValue.nodes[this.active].task.length > 0) {
for (var task of this.processStructureValue.nodes[this.active].task) {
if (
this.processStructureValue.nodes[this.active].task !== undefined &&
this.processStructureValue.nodes[this.active].task.length > 0
) {
for (var task of this.processStructureValue.nodes[this.active]
.task) {
if (this.ruleForm.tasks.indexOf(task) === -1) {
this.ruleForm.tasks.push(task)
}
......@@ -188,20 +212,43 @@ export default {
this.ruleForm.tpls.form_structure.push(tpl.form_structure)
promiseList.push(this.$refs['generateForm-' + tpl.id][0].getData())
}
Promise.all(promiseList).then(values => {
this.ruleForm.source = this.processStructureValue.nodes[this.active].id
this.ruleForm.tpls.form_data = values
this.ruleForm.is_exec_task = item.isExecuteTask
createWorkOrder(this.ruleForm).then(response => {
if (response.code === 200) {
this.$router.push({ path: '/process/upcoming' })
}
}).catch(() => {
Promise.all(promiseList)
.then((values) => {
this.ruleForm.source =
this.processStructureValue.nodes[this.active].id
this.ruleForm.tpls.form_data = values
this.ruleForm.is_exec_task = item.isExecuteTask
createWorkOrder(this.ruleForm)
.then((response) => {
if (response.code === 200) {
// this.$router.push({ path: '/process/upcoming' })
if (window.parent) {
const returnTarget =
this.scrmParams?.returnTarget || '/process/upcoming'
// 发送消息给父窗口
window.parent.postMessage(
{
type: 'redirect',
path: returnTarget
// 可以附加其他数据,如新创建的工单ID
// workOrderId: response.data.id
},
this.scrmParams?.baseUrl
)
} else {
// 备用方案
this.$router.push('/process/upcoming')
}
}
})
.catch(() => {
this.submitDisabled = false
})
})
.catch(() => {
this.submitDisabled = false
})
}).catch(() => {
this.submitDisabled = false
})
}
})
}
......
......@@ -343,7 +343,10 @@ export default {
if (response.code === 200) {
// this.$router.push({ name: 'upcoming' })
// window.location.reload()
this.getProcessNodeList()
// this.getProcessNodeList()
if (window.parent.goBackScrmCustomerServiceInfo) {
window.parent.goBackScrmCustomerServiceInfo()
}
}
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment