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