workflowTrans
This commit is contained in:
parent
3a07876bce
commit
cdc0d30244
|
@ -30,6 +30,14 @@ export function getUserList(query) {
|
|||
})
|
||||
}
|
||||
|
||||
export function getOrganizationList(query) {
|
||||
return request({
|
||||
url: '/system/organization/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getUser(id) {
|
||||
return request({
|
||||
url: `/system/user/${id}/`,
|
||||
|
|
|
@ -148,9 +148,10 @@ export default {
|
|||
hasJsonFlag:true, // json是否验证通过
|
||||
hasJsonFlag1:true, // json是否验证通过
|
||||
hasJsonFlag2:true, // json是否验证通过
|
||||
customfieldList: {
|
||||
count:0
|
||||
},
|
||||
// customfieldList: {
|
||||
// count:0
|
||||
// },
|
||||
customfieldList:[],
|
||||
options: [{
|
||||
value: 'string',
|
||||
label: '文本'
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<el-form
|
||||
ref="Form"
|
||||
:model="wfstate"
|
||||
label-width="80px"
|
||||
label-width="100px"
|
||||
label-position="right"
|
||||
:rules="rule1"
|
||||
>
|
||||
|
@ -113,8 +113,7 @@
|
|||
<el-switch v-model="wfstate.enable_retreat"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="参与者类型" prop="participant_type">
|
||||
|
||||
<el-select style="width: 100%" v-model="wfstate.participant_type" placeholder="请选择">
|
||||
<el-select style="width: 100%" v-model="wfstate.participant_type" placeholder="请选择" @change="typeChange">
|
||||
<el-option
|
||||
v-for="item in typeoptions"
|
||||
:key="item.value"
|
||||
|
@ -123,6 +122,24 @@
|
|||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="参与者" prop="participant" v-if="wfstate.participant_type==1">
|
||||
<el-select style="width: 100%" v-model="participant" placeholder="请选择参与者">
|
||||
<el-option v-for="item in staffs" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="参与者" prop="participant" v-if="wfstate.participant_type==2">
|
||||
<el-select style="width: 100%" v-model="participants" multiple placeholder="请选择参与者">
|
||||
<el-option v-for="item in staffs" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门" prop="participant" v-if="wfstate.participant_type==3">
|
||||
<el-select style="width: 100%" v-model="participant" placeholder="请选择部门">
|
||||
<el-option v-for="item in departments" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||
|
@ -133,6 +150,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import { getWfStateList, createWfState,updateWfState,deleteWfState } from "@/api/workflow";
|
||||
import { getOrganizationList,getUserList } from "@/api/user";
|
||||
import checkPermission from "@/utils/permission";
|
||||
const defaultwfstate = {
|
||||
name: "",
|
||||
|
@ -143,12 +161,25 @@ export default {
|
|||
props: ["ID"],
|
||||
data() {
|
||||
return {
|
||||
wfstate: defaultwfstate,
|
||||
wfstate: {
|
||||
name:'',
|
||||
is_hidden:'',
|
||||
sort:'',
|
||||
type:'',
|
||||
enable_retreat:'',
|
||||
participant_type:'',
|
||||
participant:'',
|
||||
},
|
||||
participant:'',
|
||||
participants:[],
|
||||
is_hidden:false,
|
||||
enable_retreat:false,
|
||||
wfstateList: {
|
||||
staffs:[],
|
||||
departments:[],
|
||||
/*wfstateList: {
|
||||
count:0
|
||||
},
|
||||
},*/
|
||||
wfstateList:[],
|
||||
options_:{
|
||||
"0":'无处理',
|
||||
"1":'个人',
|
||||
|
@ -157,8 +188,8 @@ export default {
|
|||
"4":'角色',
|
||||
"5":'变量',
|
||||
"6":'普通类型',
|
||||
"5":'工单字段',
|
||||
"6":'父工单字段',
|
||||
"7":'工单字段',
|
||||
"8":'父工单字段',
|
||||
},
|
||||
options: [{
|
||||
value: 0,
|
||||
|
@ -170,7 +201,7 @@ export default {
|
|||
value: 2,
|
||||
label: '结束状态'
|
||||
}],
|
||||
typeoptions: [{
|
||||
typeoptions: [{
|
||||
value: 0,
|
||||
label: '无处理'
|
||||
}, {
|
||||
|
@ -216,6 +247,8 @@ export default {
|
|||
created() {
|
||||
|
||||
this.getList();
|
||||
this.getUser();
|
||||
this.getDepartment();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
@ -230,9 +263,26 @@ export default {
|
|||
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
getUser(){
|
||||
getUserList({}).then(res=>{
|
||||
if(res.data){
|
||||
this.staffs = res.data.results;
|
||||
}
|
||||
})
|
||||
},
|
||||
getDepartment(){
|
||||
getOrganizationList().then(res=>{
|
||||
if(res.data){
|
||||
this.departments = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
//参与者类型变化
|
||||
typeChange(){
|
||||
this.participant = '';
|
||||
this.participants = [];
|
||||
},
|
||||
//打开新建
|
||||
handleCreate() {
|
||||
this.wfstate = Object.assign({}, defaultwfstate);
|
||||
this.dialogType = "new";
|
||||
|
@ -241,28 +291,31 @@ export default {
|
|||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
//打开编辑
|
||||
handleEdit(scope) {
|
||||
this.wfstate = Object.assign({}, scope.row); // copy obj
|
||||
this.participants = this.wfstate.participant;
|
||||
this.participant = this.wfstate.participant;
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
//编辑新建
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
// this.wfstate.participant = 1;
|
||||
this.wfstate.participant = this.participant!==''?this.participant:this.participants;
|
||||
if (isEdit) {
|
||||
updateWfState(this.wfstate.id, this.wfstate).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -271,6 +324,7 @@ export default {
|
|||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
<div class="svgMark" v-if="dialogVisible" @click="closeMark">
|
||||
<div class="svgWrapper">
|
||||
<div class="svgItem">工单流程图<i class="el-dialog__close el-icon el-icon-close" @click="closeMark"></i></div>
|
||||
<el-steps :active="actives" spac="400px" align-center="" style="padding-top: 20px;">
|
||||
<el-step :title="item.name" v-for="item in flowSteps " :key="item.id">
|
||||
</el-step>
|
||||
</el-steps>
|
||||
<svg height=600 id="svg">
|
||||
<g id="svgG"/>
|
||||
<rect/>
|
||||
|
@ -81,6 +85,7 @@
|
|||
inject:['reload'],
|
||||
data(){
|
||||
return{
|
||||
step:4,
|
||||
total:0,
|
||||
actives:4,
|
||||
ticketId:0,
|
||||
|
@ -104,6 +109,25 @@
|
|||
operationBtn:[],
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
this.workflow = this.$route.params.workflow;
|
||||
let workflow = localStorage.getItem('workflow');
|
||||
if(this.workflow){
|
||||
this.pageForm.workflow = parseInt(this.workflow);
|
||||
if(workflow){
|
||||
localStorage.removeItem('workflow');
|
||||
localStorage.setItem('workflow',this.pageForm.workflow)
|
||||
}else{
|
||||
localStorage.setItem('workflow',this.pageForm.workflow)
|
||||
}
|
||||
}else{
|
||||
this.workflow =workflow ;
|
||||
this.pageForm.workflow =workflow ;
|
||||
}
|
||||
debugger;
|
||||
this.getList();
|
||||
this.getStates();
|
||||
},
|
||||
activated(){
|
||||
this.workflow = this.$route.params.workflow;
|
||||
let workflow = localStorage.getItem('workflow');
|
||||
|
@ -119,6 +143,7 @@
|
|||
this.workflow =workflow ;
|
||||
this.pageForm.workflow =workflow ;
|
||||
}
|
||||
debugger;
|
||||
this.getList();
|
||||
this.getStates();
|
||||
},
|
||||
|
@ -162,7 +187,31 @@
|
|||
this.edges = edge;
|
||||
},
|
||||
handleFilter(){},
|
||||
handlePicture(){
|
||||
handlePicture(scope){
|
||||
let that = this;
|
||||
getWfFlowSteps( scope.row.id).then((res)=>{
|
||||
if(res.data){
|
||||
that.flowSteps = res.data;
|
||||
getTicketDetail( ticketId).then((res)=>{
|
||||
if(res.data){
|
||||
that.ticketDetail = res.data;
|
||||
let state = res.data.state;
|
||||
debugger;
|
||||
console.log(state)
|
||||
console.log(that.flowSteps)
|
||||
debugger;
|
||||
let dat = that.flowSteps.filter((item)=>{
|
||||
return item.id==state;
|
||||
})
|
||||
console.log(dat)
|
||||
console.log(that.flowSteps.indexOf(dat[0]))
|
||||
debugger;
|
||||
this.actives = that.flowSteps.indexOf(dat[0]);
|
||||
that.limitedStep = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// this.$router.push({name:"test"})
|
||||
this.dialogVisible = true;
|
||||
//获取D3
|
||||
|
@ -220,27 +269,44 @@
|
|||
},
|
||||
handleDetail(scope){
|
||||
// this.limitedStep = true;
|
||||
this.ticketId = scope.row.id;
|
||||
let that = this;
|
||||
that.ticketId = scope.row.id;
|
||||
let ticketId = scope.row.id;
|
||||
getWfFlowSteps( scope.row.id).then((res)=>{
|
||||
if(res.data){
|
||||
this.flowSteps = res.data;
|
||||
}
|
||||
});
|
||||
getTicketDetail( scope.row.id).then((res)=>{
|
||||
if(res.data){
|
||||
this.ticketDetail = res.data;
|
||||
this.actives = res.data.act_state;
|
||||
this.limitedStep = true;
|
||||
that.flowSteps = res.data;
|
||||
getTicketDetail( ticketId).then((res)=>{
|
||||
if(res.data){
|
||||
that.ticketDetail = res.data;
|
||||
let state = res.data.state;
|
||||
debugger;
|
||||
console.log(state)
|
||||
console.log(that.flowSteps)
|
||||
debugger;
|
||||
let dat = that.flowSteps.filter((item)=>{
|
||||
return item.id==state;
|
||||
})
|
||||
console.log(dat)
|
||||
console.log(that.flowSteps.indexOf(dat[0]))
|
||||
debugger;
|
||||
this.actives = that.flowSteps.indexOf(dat[0]);
|
||||
that.limitedStep = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
getTicketTransitions(scope.row.id).then(res=>{
|
||||
this.operationBtn = res.data;
|
||||
})
|
||||
},
|
||||
operationSubmit(){
|
||||
// let transition = {transition:this.operationBtn[0].id};
|
||||
// ticketHandle(this.ticketId,transition).then(res=>{
|
||||
// })
|
||||
let transition = {transition:this.operationBtn[0].id,ticket_data:this.ticketDetail.ticket_data};
|
||||
ticketHandle(this.ticketId,transition).then(res=>{
|
||||
if (res.data){
|
||||
this.limitedStep = false;
|
||||
}
|
||||
})
|
||||
},
|
||||
stepclick(){},
|
||||
closeMark(){
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column width="180" label="源状态">
|
||||
|
||||
<template slot-scope="scope">
|
||||
<template>
|
||||
<span v-for="item in stateoptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
|
@ -97,7 +97,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="条件表达式" prop="condition_expression">
|
||||
<el-input v-model="wftransition.condition_expression" placeholder="[]" />
|
||||
<el-input v-model="wftransition.condition_expression"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性类型" prop="attribute_type">
|
||||
|
||||
|
@ -139,9 +139,11 @@ export default {
|
|||
return {
|
||||
wftransition: defaultwftransition,
|
||||
condition_expression:false,
|
||||
wftransitionList: {
|
||||
/*wftransitionList: {
|
||||
count:0
|
||||
},
|
||||
},*/
|
||||
wftransitionList:[],
|
||||
lable:'',
|
||||
options_:[],
|
||||
options: [{
|
||||
value: 1,
|
||||
|
|
Loading…
Reference in New Issue