Commit c4d51c41 by yuzhenWang

添加返回按钮,接受scrm参数

parent 9ca75b12
...@@ -12,10 +12,12 @@ store.dispatch('settings/getSystemSettings') ...@@ -12,10 +12,12 @@ store.dispatch('settings/getSystemSettings')
const whiteList = [ const whiteList = [
'/login', '/login',
'/auth-redirect', '/auth-redirect',
'/process/all', '/process/all', // 所有工单
'/process/my-create', '/process/my-create', // 我创建的
'/process/upcoming', '/process/upcoming', // 我的代办
'/process/apply-process-list' '/process/apply-process-list', // 工单申请
'/process/related', // 相关工单
'/process/handle-ticket' // 处理工单
] // no redirect whitelist ] // no redirect whitelist
router.beforeEach(async(to, from, next) => { router.beforeEach(async(to, from, next) => {
...@@ -32,17 +34,26 @@ router.beforeEach(async(to, from, next) => { ...@@ -32,17 +34,26 @@ router.beforeEach(async(to, from, next) => {
} }
return null return null
} }
const token = getQueryParam('token') // 获取scrm带过来的参数
const token = getQueryParam('token') // 从scrm跳转过来时,是否隐藏侧边栏 1:隐藏侧边栏 2:隐藏返回键
const hiddenSidler = getQueryParam('hiddenSidler') const hiddenSidler = getQueryParam('hiddenSidler')
// 使用你的 getQueryParam 方法获取参数
const scrmParamsStr = decodeURIComponent(getQueryParam('scrmParams'))
if (token) { if (token) {
removeToken() removeToken()
store.dispatch('user/setToken', token) store.dispatch('user/setToken', token)
store.dispatch('user/setHiddenSidler', hiddenSidler) store.dispatch('user/setHiddenSidler', hiddenSidler)
// 解析成对象
if (scrmParamsStr) {
try {
const scrmParams = JSON.parse(scrmParamsStr)
store.dispatch('user/setScrmParams', scrmParams)
} catch (e) {
console.error('解析失败', e)
}
}
setToken(token) setToken(token)
} }
// const newhiddenSidler = store.state.user.hiddenSidler
// console.log(newhiddenSidler)
// start progress bar // start progress bar
NProgress.start() NProgress.start()
......
...@@ -9,7 +9,8 @@ const state = { ...@@ -9,7 +9,8 @@ const state = {
introduction: '', introduction: '',
roles: [], roles: [],
permissions: [], permissions: [],
hiddenSidler: '' hiddenSidler: '', // 是否隐藏侧边栏
scrmParams: { showBack: true } // scrm系统跳转所带参数
} }
const mutations = { const mutations = {
...@@ -40,6 +41,9 @@ const mutations = { ...@@ -40,6 +41,9 @@ const mutations = {
}, },
SET_hiddenSidler: (state, hiddenSidler) => { SET_hiddenSidler: (state, hiddenSidler) => {
state.hiddenSidler = hiddenSidler state.hiddenSidler = hiddenSidler
},
SET_scrmParams: (state, scrmParams) => {
state.scrmParams = scrmParams
} }
} }
...@@ -65,18 +69,15 @@ const actions = { ...@@ -65,18 +69,15 @@ const actions = {
setHiddenSidler({ commit }, hiddenSidler) { setHiddenSidler({ commit }, hiddenSidler) {
commit('SET_hiddenSidler', hiddenSidler) commit('SET_hiddenSidler', hiddenSidler)
}, },
setScrmParams({ commit }, scrmParams) {
commit('SET_scrmParams', scrmParams)
},
// get user info // get user info
getInfo({ commit, state }) { getInfo({ commit, state }) {
console.log('====================================')
console.log('getInfo')
console.log('====================================')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo() getInfo()
.then((response) => { .then((response) => {
console.log('====================================')
console.log('getInfo', response)
console.log('====================================')
if (!response || !response.data) { if (!response || !response.data) {
commit('SET_TOKEN', '') commit('SET_TOKEN', '')
removeToken() removeToken()
......
<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>
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>公共信息</span> <span>公共信息</span>
...@@ -121,10 +124,18 @@ export default { ...@@ -121,10 +124,18 @@ export default {
} }
} }
}, },
computed: {
scrmParams() {
return this.$store.state.user.scrmParams
}
},
created() { created() {
this.getProcessNodeList() this.getProcessNodeList()
}, },
methods: { methods: {
goBack() {
this.$router.go(-1)
},
getProcessNodeList() { getProcessNodeList() {
processStructure({ processStructure({
processId: this.$route.query.processId processId: this.$route.query.processId
......
...@@ -2,15 +2,28 @@ ...@@ -2,15 +2,28 @@
<div class="app-container"> <div class="app-container">
<div v-if="isLoadingStatus" /> <div v-if="isLoadingStatus" />
<div v-else> <div v-else>
<el-button v-if="scrmParams.showBack" style="margin-bottom:16px;" type="primary" @click="goBack">
返回
</el-button>
<el-card class="box-card"> <el-card class="box-card">
<div class="text item"> <div class="text item">
<el-steps v-if="currentNode.clazz !== undefined && currentNode.clazz !== null && currentNode.clazz !== ''" :active="activeIndex" finish-status="success"> <el-steps
v-if="
currentNode.clazz !== undefined &&
currentNode.clazz !== null &&
currentNode.clazz !== ''
"
:active="activeIndex"
finish-status="success"
>
<template v-for="(item, index) in nodeStepList"> <template v-for="(item, index) in nodeStepList">
<el-step <el-step
v-if="item.isHideNode === false || v-if="
item.isHideNode === false ||
item.isHideNode === undefined || item.isHideNode === undefined ||
item.isHideNode == null || item.isHideNode == null ||
item.id === processStructureValue.workOrder.current_state" item.id === processStructureValue.workOrder.current_state
"
:key="index" :key="index"
:title="item.label" :title="item.label"
/> />
...@@ -27,7 +40,10 @@ ...@@ -27,7 +40,10 @@
</el-card> </el-card>
<el-alert <el-alert
v-if="activeIndex !== nodeStepList.length && processStructureValue.workOrder.is_end===1" v-if="
activeIndex !== nodeStepList.length &&
processStructureValue.workOrder.is_end === 1
"
style="margin-top: 15px" style="margin-top: 15px"
:title="alertMessage" :title="alertMessage"
type="error" type="error"
...@@ -48,10 +64,12 @@ ...@@ -48,10 +64,12 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="优先级:" style="margin-bottom: 0"> <el-form-item label="优先级:" style="margin-bottom: 0">
<span v-if="processStructureValue.workOrder.priority===2"> <span v-if="processStructureValue.workOrder.priority === 2">
<el-tag type="warning">紧急</el-tag> <el-tag type="warning">紧急</el-tag>
</span> </span>
<span v-else-if="processStructureValue.workOrder.priority===3"> <span
v-else-if="processStructureValue.workOrder.priority === 3"
>
<el-tag type="danger">非常紧急</el-tag> <el-tag type="danger">非常紧急</el-tag>
</span> </span>
<span v-else> <span v-else>
...@@ -64,25 +82,33 @@ ...@@ -64,25 +82,33 @@
</div> </div>
</el-card> </el-card>
<el-card class="box-card" style="margin-top: 15px;"> <el-card class="box-card" style="margin-top: 15px">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>表单信息</span> <span>表单信息</span>
</div> </div>
<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.form_structure.id)===-1" currentNode.hideTpls === null ||
currentNode.hideTpls.indexOf(tplItem.form_structure.id) === -1
"
:key="tplIndex" :key="tplIndex"
:ref="'generateForm-'+tplItem.id" :ref="'generateForm-' + tplItem.id"
:preview="!!((currentNode.hideTpls!==undefined && :preview="
currentNode.hideTpls!==null && !!(
currentNode.hideTpls.indexOf(tplItem.form_structure.id)!==-1) || (currentNode.hideTpls !== undefined &&
(currentNode.writeTpls===undefined || currentNode.hideTpls !== null &&
currentNode.writeTpls===null || currentNode.hideTpls.indexOf(tplItem.form_structure.id) !==
currentNode.writeTpls.indexOf(tplItem.form_structure.id)===-1)|| -1) ||
(isActiveProcessing && currentNode.activeOrder))" currentNode.writeTpls === undefined ||
currentNode.writeTpls === null ||
currentNode.writeTpls.indexOf(tplItem.form_structure.id) ===
-1 ||
(isActiveProcessing && currentNode.activeOrder)
)
"
:remote="remoteFunc" :remote="remoteFunc"
:value="tplItem.form_data" :value="tplItem.form_data"
:data="tplItem.form_structure" :data="tplItem.form_structure"
...@@ -90,21 +116,26 @@ ...@@ -90,21 +116,26 @@
</template> </template>
</div> </div>
<div v-if="processStructureValue.userAuthority"> <div v-if="processStructureValue.userAuthority">
<hr style="background-color: #d9d9d9; border:0; height:1px; margin-bottom: 15px"> <hr
style="
background-color: #d9d9d9;
border: 0;
height: 1px;
margin-bottom: 15px;
"
>
<div> <div>
<el-input <el-input
v-model="remarks" v-model="remarks"
type="textarea" type="textarea"
placeholder="请输入备注信息" placeholder="请输入备注信息"
maxlength="200" maxlength="200"
:autosize="{ minRows: 3, maxRows: 99}" :autosize="{ minRows: 3, maxRows: 99 }"
show-word-limit show-word-limit
/> />
</div> </div>
<div class="text item" style="text-align: center;margin-top:18px"> <div class="text item" style="text-align: center; margin-top: 18px">
<div <div v-if="isActiveProcessing && currentNode.activeOrder">
v-if="isActiveProcessing && currentNode.activeOrder"
>
<el-button <el-button
v-permisaction="['process:list:handle:active']" v-permisaction="['process:list:handle:active']"
type="primary" type="primary"
...@@ -116,7 +147,10 @@ ...@@ -116,7 +147,10 @@
<div v-else> <div v-else>
<template v-for="(item, index) in processStructureValue.edges"> <template v-for="(item, index) in processStructureValue.edges">
<el-button <el-button
v-if="processStructureValue.workOrder.is_end===0 && item.source===currentNode.id" v-if="
processStructureValue.workOrder.is_end === 0 &&
item.source === currentNode.id
"
:key="index" :key="index"
type="primary" type="primary"
@click="submitAction(item)" @click="submitAction(item)"
...@@ -134,31 +168,12 @@ ...@@ -134,31 +168,12 @@
<span>工单流转历史</span> <span>工单流转历史</span>
</div> </div>
<div class="text item"> <div class="text item">
<el-table <el-table :data="circulationHistoryList" border style="width: 100%">
:data="circulationHistoryList" <el-table-column prop="state" label="节点" />
border <el-table-column prop="circulation" label="流转" />
style="width: 100%" <el-table-column prop="processor" label="处理人" />
> <el-table-column prop="create_time" label="处理时间" />
<el-table-column <el-table-column prop="remarks" label="备注" />
prop="state"
label="节点"
/>
<el-table-column
prop="circulation"
label="流转"
/>
<el-table-column
prop="processor"
label="处理人"
/>
<el-table-column
prop="create_time"
label="处理时间"
/>
<el-table-column
prop="remarks"
label="备注"
/>
</el-table> </el-table>
</div> </div>
</el-card> </el-card>
...@@ -168,9 +183,7 @@ ...@@ -168,9 +183,7 @@
<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)
...@@ -231,27 +244,37 @@ export default { ...@@ -231,27 +244,37 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters([ scrmParams() {
'userId' return this.$store.state.user.scrmParams
]) },
...mapGetters(['userId'])
}, },
created() { created() {
this.getProcessNodeList() this.getProcessNodeList()
}, },
methods: { methods: {
goBack() {
this.$router.go(-1)
},
getProcessNodeList() { getProcessNodeList() {
processStructure({ processStructure({
processId: this.$route.query.processId, processId: this.$route.query.processId || this.scrmParams.processId,
workOrderId: this.$route.query.workOrderId workOrderId:
}).then(response => { this.$route.query.workOrderId || this.scrmParams.workOrderId
}).then((response) => {
this.isActiveProcessing = false this.isActiveProcessing = false
this.processStructureValue = response.data this.processStructureValue = response.data
this.circulationHistoryList = this.processStructureValue.circulationHistory this.circulationHistoryList =
this.processStructureValue.circulationHistory
// 获取当前展示节点列表 // 获取当前展示节点列表
this.nodeStepList = [] this.nodeStepList = []
if (this.processStructureValue.nodes) { if (this.processStructureValue.nodes) {
for (var i = 0; i < this.processStructureValue.nodes.length; i++) { for (var i = 0; i < this.processStructureValue.nodes.length; i++) {
if (this.processStructureValue.nodes[i].id === this.processStructureValue.workOrder.current_state) { if (
this.processStructureValue.nodes[i].id ===
this.processStructureValue.workOrder.current_state
) {
// 当前节点 // 当前节点
this.nodeStepList.push(this.processStructureValue.nodes[i]) this.nodeStepList.push(this.processStructureValue.nodes[i])
this.activeIndex = this.nodeStepList.length - 1 this.activeIndex = this.nodeStepList.length - 1
...@@ -276,7 +299,11 @@ export default { ...@@ -276,7 +299,11 @@ export default {
// 判断是否需要主动处理 // 判断是否需要主动处理
for (var stateValue of this.processStructureValue.workOrder.state) { for (var stateValue of this.processStructureValue.workOrder.state) {
if (this.processStructureValue.workOrder.current_state === stateValue.id && stateValue.processor.length > 1) { if (
this.processStructureValue.workOrder.current_state ===
stateValue.id &&
stateValue.processor.length > 1
) {
this.isActiveProcessing = true this.isActiveProcessing = true
break break
} }
...@@ -295,7 +322,7 @@ export default { ...@@ -295,7 +322,7 @@ export default {
}) })
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).then((values) => {
for (var tplDataIndex in this.tpls) { for (var tplDataIndex in this.tpls) {
this.tpls[tplDataIndex].tplValue = values[tplDataIndex] this.tpls[tplDataIndex].tplValue = values[tplDataIndex]
} }
...@@ -304,12 +331,15 @@ export default { ...@@ -304,12 +331,15 @@ export default {
source_state: this.processStructureValue.workOrder.current_state, source_state: this.processStructureValue.workOrder.current_state,
target_state: item.target, target_state: item.target,
circulation: item.label, circulation: item.label,
flow_properties: item.flowProperties === undefined ? 2 : parseInt(item.flowProperties), flow_properties:
item.flowProperties === undefined
? 2
: parseInt(item.flowProperties),
work_order_id: parseInt(this.$route.query.workOrderId), work_order_id: parseInt(this.$route.query.workOrderId),
remarks: this.remarks, remarks: this.remarks,
is_exec_task: item.isExecuteTask, is_exec_task: item.isExecuteTask,
tpls: this.tpls tpls: this.tpls
}).then(response => { }).then((response) => {
if (response.code === 200) { if (response.code === 200) {
// this.$router.push({ name: 'upcoming' }) // this.$router.push({ name: 'upcoming' })
// window.location.reload() // window.location.reload()
...@@ -325,12 +355,14 @@ export default { ...@@ -325,12 +355,14 @@ export default {
} }
}, },
activeOrderActive() { activeOrderActive() {
var jsonData = [{ var jsonData = [
{
id: this.nodeStepList[this.activeIndex].id, id: this.nodeStepList[this.activeIndex].id,
label: this.nodeStepList[this.activeIndex].label, label: this.nodeStepList[this.activeIndex].label,
process_method: 'person', process_method: 'person',
processor: [this.userId] processor: [this.userId]
}] }
]
activeOrder(jsonData, this.$route.query.workOrderId).then(() => { activeOrder(jsonData, this.$route.query.workOrderId).then(() => {
this.getProcessNodeList() this.getProcessNodeList()
}) })
......
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