Commit 2024115a by yuzhenWang

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

parent c4d51c41
<template> <template>
<div class="app-container"> <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-button>
<el-card class="box-card"> <el-card class="box-card">
...@@ -8,11 +13,20 @@ ...@@ -8,11 +13,20 @@
<span>公共信息</span> <span>公共信息</span>
</div> </div>
<div class="text item"> <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-form-item label="标题:" prop="title" style="margin-bottom: 13px">
<el-input v-model="ruleForm.title" size="small" /> <el-input v-model="ruleForm.title" size="small" />
</el-form-item> </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-group v-model="ruleForm.priority" size="small">
<el-radio :label="1">一般</el-radio> <el-radio :label="1">一般</el-radio>
<el-radio :label="2">紧急</el-radio> <el-radio :label="2">紧急</el-radio>
...@@ -30,27 +44,37 @@ ...@@ -30,27 +44,37 @@
<div class="text item"> <div class="text item">
<template v-for="(tplItem, tplIndex) in processStructureValue.tpls"> <template v-for="(tplItem, tplIndex) in processStructureValue.tpls">
<fm-generate-form <fm-generate-form
v-show="currentNode.hideTpls===undefined || v-show="
currentNode.hideTpls===null || currentNode.hideTpls === undefined ||
currentNode.hideTpls.indexOf(tplItem.id)===-1" currentNode.hideTpls === null ||
currentNode.hideTpls.indexOf(tplItem.id) === -1
"
:key="tplIndex" :key="tplIndex"
:ref="'generateForm-'+tplItem.id" :ref="'generateForm-' + tplItem.id"
:preview="currentNode.hideTpls===undefined || :preview="
currentNode.hideTpls===null || currentNode.hideTpls === undefined ||
currentNode.hideTpls.indexOf(tplItem.id)===-1?false:true" currentNode.hideTpls === null ||
currentNode.hideTpls.indexOf(tplItem.id) === -1
? false
: true
"
:remote="remoteFunc" :remote="remoteFunc"
:data="tplItem.form_structure" :data="tplItem.form_structure"
:disabled="currentNode.readonlyTpls===undefined || :disabled="
currentNode.readonlyTpls===null || currentNode.readonlyTpls === undefined ||
currentNode.readonlyTpls.indexOf(tplItem.id)===-1?null:true" currentNode.readonlyTpls === null ||
currentNode.readonlyTpls.indexOf(tplItem.id) === -1
? null
: true
"
/> />
</template> </template>
</div> </div>
<hr style="background-color: #d9d9d9; border:0; height:1px;"> <hr style="background-color: #d9d9d9; border: 0; height: 1px">
<div class="text item" style="text-align: center;margin-top:18px"> <div class="text item" style="text-align: center; margin-top: 18px">
<el-button <el-button
v-for="(item, index) in processStructureValue.edges" 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" :key="index"
type="primary" type="primary"
:disabled="submitDisabled" :disabled="submitDisabled"
...@@ -64,18 +88,12 @@ ...@@ -64,18 +88,12 @@
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { import { GenerateForm } from '@/components/VueFormMaking'
GenerateForm
} from '@/components/VueFormMaking'
import 'form-making/dist/FormMaking.css' import 'form-making/dist/FormMaking.css'
Vue.component(GenerateForm.name, GenerateForm) Vue.component(GenerateForm.name, GenerateForm)
import { import { processStructure, createWorkOrder } from '@/api/process/work-order'
processStructure,
createWorkOrder
} from '@/api/process/work-order'
import { listUser } from '@/api/system/sysuser' import { listUser } from '@/api/system/sysuser'
import { getDeptList } from '@/api/system/dept' import { getDeptList } from '@/api/system/dept'
export default { export default {
...@@ -95,15 +113,13 @@ export default { ...@@ -95,15 +113,13 @@ export default {
source_state: '', source_state: '',
process_method: '', process_method: '',
tpls: { tpls: {
'form_structure': [], form_structure: [],
'form_data': [] form_data: []
}, },
tasks: [] tasks: []
}, },
rules: { rules: {
title: [ title: [{ required: true, message: '请输入工单标题', trigger: 'blur' }],
{ required: true, message: '请输入工单标题', trigger: 'blur' }
],
priority: [ priority: [
{ required: true, message: '请选择工单优先级', trigger: 'blur' } { required: true, message: '请选择工单优先级', trigger: 'blur' }
] ]
...@@ -139,7 +155,7 @@ export default { ...@@ -139,7 +155,7 @@ export default {
getProcessNodeList() { getProcessNodeList() {
processStructure({ processStructure({
processId: this.$route.query.processId processId: this.$route.query.processId
}).then(response => { }).then((response) => {
this.processStructureValue = response.data this.processStructureValue = response.data
this.currentNode = this.processStructureValue.nodes[0] this.currentNode = this.processStructureValue.nodes[0]
}) })
...@@ -152,7 +168,8 @@ export default { ...@@ -152,7 +168,8 @@ export default {
this.ruleForm.process = parseInt(this.$route.query.processId) this.ruleForm.process = parseInt(this.$route.query.processId)
this.ruleForm.classify = this.processStructureValue.process.classify this.ruleForm.classify = this.processStructureValue.process.classify
stateMap['id'] = item.target 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) { for (var v of this.processStructureValue.nodes) {
if (v.id === item.target) { if (v.id === item.target) {
if (v.assignType !== undefined) { if (v.assignType !== undefined) {
...@@ -168,14 +185,21 @@ export default { ...@@ -168,14 +185,21 @@ export default {
this.ruleForm.state = [stateMap] this.ruleForm.state = [stateMap]
this.ruleForm.tpls = { this.ruleForm.tpls = {
'form_structure': [], form_structure: [],
'form_data': [] 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) { if (
for (var task of this.processStructureValue.nodes[this.active].task) { 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) { if (this.ruleForm.tasks.indexOf(task) === -1) {
this.ruleForm.tasks.push(task) this.ruleForm.tasks.push(task)
} }
...@@ -188,20 +212,43 @@ export default { ...@@ -188,20 +212,43 @@ export default {
this.ruleForm.tpls.form_structure.push(tpl.form_structure) this.ruleForm.tpls.form_structure.push(tpl.form_structure)
promiseList.push(this.$refs['generateForm-' + tpl.id][0].getData()) promiseList.push(this.$refs['generateForm-' + tpl.id][0].getData())
} }
Promise.all(promiseList).then(values => { Promise.all(promiseList)
this.ruleForm.source = this.processStructureValue.nodes[this.active].id .then((values) => {
this.ruleForm.tpls.form_data = values this.ruleForm.source =
this.ruleForm.is_exec_task = item.isExecuteTask this.processStructureValue.nodes[this.active].id
createWorkOrder(this.ruleForm).then(response => { this.ruleForm.tpls.form_data = values
if (response.code === 200) { this.ruleForm.is_exec_task = item.isExecuteTask
this.$router.push({ path: '/process/upcoming' }) createWorkOrder(this.ruleForm)
} .then((response) => {
}).catch(() => { 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 this.submitDisabled = false
}) })
}).catch(() => {
this.submitDisabled = false
})
} }
}) })
} }
......
...@@ -343,7 +343,10 @@ export default { ...@@ -343,7 +343,10 @@ export default {
if (response.code === 200) { if (response.code === 200) {
// this.$router.push({ name: 'upcoming' }) // this.$router.push({ name: 'upcoming' })
// window.location.reload() // 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