functionBrtton
This commit is contained in:
parent
2fb5240c9a
commit
1c2f425e78
|
@ -39,20 +39,17 @@
|
||||||
width="220px"
|
width="220px"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['customfield_update'])"
|
|
||||||
@click="handleEdit(scope)"
|
@click="handleEdit(scope)"
|
||||||
>编辑
|
|
||||||
</el-link
|
|
||||||
>
|
>
|
||||||
|
编辑
|
||||||
|
</el-link>
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['customfield_delete'])"
|
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDeleteCustomfield(scope)"
|
@click="handleDeleteCustomfield(scope)"
|
||||||
>删除
|
|
||||||
</el-link
|
|
||||||
>
|
>
|
||||||
|
删除
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
|
@ -1,23 +1,26 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
|
<div style="margin-top: 2px">
|
||||||
<div style="margin-top: 2px">
|
<el-button
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
type="primary"
|
||||||
>新增</el-button
|
icon="el-icon-plus"
|
||||||
>
|
@click="handleCreate"
|
||||||
</div>
|
>
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 2px">
|
<el-card style="margin-top: 2px">
|
||||||
<el-table
|
<el-table
|
||||||
:data="wftransitionList"
|
:data="wftransitionList"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50"/>
|
||||||
<el-table-column width="180" label="名称">
|
<el-table-column width="180" label="名称">
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column width="180" label="定时器(单位秒)">
|
<el-table-column width="180" label="定时器(单位秒)">
|
||||||
<template slot-scope="scope">{{ scope.row.timer }}</template>
|
<template slot-scope="scope">{{ scope.row.timer }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -31,32 +34,27 @@
|
||||||
<span v-if="scope.row.destination_state_">{{scope.row.destination_state_.name}}</span>
|
<span v-if="scope.row.destination_state_">{{scope.row.destination_state_.name}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="180" label="创建时间">
|
<el-table-column width="180" label="创建时间">
|
||||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="操作"
|
label="操作"
|
||||||
width="220px"
|
width="220px"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<el-link @click="handleEdit(scope)">
|
||||||
|
编辑
|
||||||
|
</el-link>
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['wftransition_update'])"
|
|
||||||
@click="handleEdit(scope)"
|
|
||||||
>编辑</el-link
|
|
||||||
>
|
|
||||||
<el-link
|
|
||||||
v-if="checkPermission(['wftransition_delete'])"
|
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope)"
|
@click="handleDelete(scope)"
|
||||||
>删除</el-link
|
|
||||||
>
|
>
|
||||||
|
删除
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
|
@ -70,13 +68,12 @@
|
||||||
:rules="rule1"
|
:rules="rule1"
|
||||||
>
|
>
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input v-model="wftransition.name" placeholder="名称" />
|
<el-input v-model="wftransition.name" placeholder="名称"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="定时器(单位秒)" prop="timer">
|
<el-form-item label="定时器(单位秒)" prop="timer">
|
||||||
<el-input v-model="wftransition.timer" type="number" placeholder="0" />
|
<el-input v-model="wftransition.timer" type="number" placeholder="0"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="源状态" prop="source_state">
|
<el-form-item label="源状态" prop="source_state">
|
||||||
|
|
||||||
<el-select v-model="wftransition.source_state" placeholder="请选择" style="width:100%">
|
<el-select v-model="wftransition.source_state" placeholder="请选择" style="width:100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stateoptions"
|
v-for="item in stateoptions"
|
||||||
|
@ -86,8 +83,8 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="目的状态" prop="destination_state">
|
<el-form-item label="目的状态" prop="destination_state">
|
||||||
<el-select v-model="wftransition.destination_state" placeholder="请选择" style="width:100%">
|
<el-select v-model="wftransition.destination_state" placeholder="请选择" style="width:100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stateoptions"
|
v-for="item in stateoptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
@ -104,21 +101,19 @@
|
||||||
lang="zh"
|
lang="zh"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="属性类型" prop="attribute_type">
|
<el-form-item label="属性类型" prop="attribute_type">
|
||||||
<el-select style="width: 100%" v-model="wftransition.attribute_type" placeholder="请选择">
|
<el-select style="width: 100%" v-model="wftransition.attribute_type" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否校验必填" prop="field_require_check">
|
<el-form-item label="是否校验必填" prop="field_require_check">
|
||||||
<el-switch v-model="wftransition.field_require_check"></el-switch>
|
<el-switch v-model="wftransition.field_require_check"></el-switch>
|
||||||
|
|
||||||
</el-form-item>
|
</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>
|
||||||
|
@ -128,28 +123,35 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {getWfStateList, getWfTransitionList, createWfTransition,updateWfTransition,deleteWfTransition } from "@/api/workflow";
|
import {
|
||||||
import checkPermission from "@/utils/permission";
|
getWfStateList,
|
||||||
import vueJsonEditor from 'vue-json-editor'
|
getWfTransitionList,
|
||||||
import { genTree } from "@/utils"
|
createWfTransition,
|
||||||
const defaultwftransition = {
|
updateWfTransition,
|
||||||
name: "",
|
deleteWfTransition
|
||||||
};
|
} from "@/api/workflow";
|
||||||
export default {
|
import checkPermission from "@/utils/permission";
|
||||||
components: { vueJsonEditor },
|
import vueJsonEditor from 'vue-json-editor'
|
||||||
name: "TST",
|
import {genTree} from "@/utils"
|
||||||
props: ["ID"],
|
|
||||||
data() {
|
const defaultwftransition = {
|
||||||
return {
|
name: "",
|
||||||
wftransition: defaultwftransition,
|
};
|
||||||
condition_expression:false,
|
export default {
|
||||||
/*wftransitionList: {
|
components: {vueJsonEditor},
|
||||||
count:0
|
name: "TST",
|
||||||
},*/
|
props: ["ID"],
|
||||||
wftransitionList:[],
|
data() {
|
||||||
lable:'',
|
return {
|
||||||
options_:[],
|
wftransition: defaultwftransition,
|
||||||
options: [{
|
condition_expression: false,
|
||||||
|
/*wftransitionList: {
|
||||||
|
count:0
|
||||||
|
},*/
|
||||||
|
wftransitionList: [],
|
||||||
|
lable: '',
|
||||||
|
options_: [],
|
||||||
|
options: [{
|
||||||
value: 1,
|
value: 1,
|
||||||
label: '同意'
|
label: '同意'
|
||||||
}, {
|
}, {
|
||||||
|
@ -159,109 +161,109 @@ export default {
|
||||||
value: 3,
|
value: 3,
|
||||||
label: '其他'
|
label: '其他'
|
||||||
}],
|
}],
|
||||||
|
|
||||||
stateoptions:[],
|
|
||||||
dialogVisible: false,
|
|
||||||
dialogType: "new",
|
|
||||||
rule1: {
|
|
||||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
|
||||||
|
|
||||||
|
|
||||||
},
|
stateoptions: [],
|
||||||
};
|
dialogVisible: false,
|
||||||
},
|
dialogType: "new",
|
||||||
|
rule1: {
|
||||||
created() {
|
name: [{required: true, message: "请输入", trigger: "blur"}],
|
||||||
|
|
||||||
|
|
||||||
this.getWfStateList();
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
checkPermission,
|
|
||||||
|
|
||||||
getList() {
|
|
||||||
|
|
||||||
getWfTransitionList(this.ID).then((response) => {
|
|
||||||
|
|
||||||
if (response.data) {
|
},
|
||||||
this.wftransitionList = response.data;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
getWfStateList() {
|
|
||||||
|
created() {
|
||||||
getWfStateList(this.ID).then((response) => {
|
|
||||||
|
|
||||||
if (response.data) {
|
this.getWfStateList();
|
||||||
this.stateoptions = genTree(response.data);
|
this.getList();
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
checkPermission,
|
||||||
handleCreate() {
|
|
||||||
this.wftransition = Object.assign({}, defaultwftransition);
|
getList() {
|
||||||
this.dialogType = "new";
|
|
||||||
this.dialogVisible = true;
|
getWfTransitionList(this.ID).then((response) => {
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs["Form"].clearValidate();
|
if (response.data) {
|
||||||
});
|
this.wftransitionList = response.data;
|
||||||
},
|
|
||||||
|
|
||||||
handleEdit(scope) {
|
|
||||||
this.wftransition = Object.assign({}, scope.row); // copy obj
|
|
||||||
this.dialogType = "edit";
|
|
||||||
this.dialogVisible = true;
|
|
||||||
// this.wftransition.condition_expression = JSON.stringify(scope.row.condition_expression)
|
|
||||||
// this.$nextTick(() => {
|
|
||||||
// this.$refs["Form"].clearValidate();
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
async confirm(form) {
|
|
||||||
this.$refs[form].validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
const isEdit = this.dialogType === "edit";
|
|
||||||
if (isEdit) {
|
|
||||||
updateWfTransition(this.wftransition.id, this.wftransition).then((res) => {
|
|
||||||
if (res.code >= 200) {
|
|
||||||
this.getList();
|
|
||||||
this.dialogVisible = false;
|
|
||||||
this.$message.success("成功");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.wftransition.workflow=this.ID;
|
|
||||||
createWfTransition(this.wftransition).then((res) => {
|
|
||||||
if (res.code >= 200) {
|
|
||||||
this.getList();
|
|
||||||
this.dialogVisible = false;
|
|
||||||
this.$message.success("成功");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleDelete(scope) {
|
|
||||||
this.$confirm("确认删除?", "警告", {
|
|
||||||
confirmButtonText: "确认",
|
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "error",
|
|
||||||
})
|
|
||||||
.then(async () => {
|
|
||||||
await deleteWfTransition(scope.row.id);
|
|
||||||
this.getList();
|
|
||||||
this.$message.success("成功");
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error(err);
|
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
getWfStateList() {
|
||||||
|
|
||||||
|
getWfStateList(this.ID).then((response) => {
|
||||||
|
|
||||||
|
if (response.data) {
|
||||||
|
this.stateoptions = genTree(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
handleCreate() {
|
||||||
|
this.wftransition = Object.assign({}, defaultwftransition);
|
||||||
|
this.dialogType = "new";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEdit(scope) {
|
||||||
|
this.wftransition = Object.assign({}, scope.row); // copy obj
|
||||||
|
this.dialogType = "edit";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
// this.wftransition.condition_expression = JSON.stringify(scope.row.condition_expression)
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// this.$refs["Form"].clearValidate();
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
async confirm(form) {
|
||||||
|
this.$refs[form].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const isEdit = this.dialogType === "edit";
|
||||||
|
if (isEdit) {
|
||||||
|
updateWfTransition(this.wftransition.id, this.wftransition).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.wftransition.workflow = this.ID;
|
||||||
|
createWfTransition(this.wftransition).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(scope) {
|
||||||
|
this.$confirm("确认删除?", "警告", {
|
||||||
|
confirmButtonText: "确认",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "error",
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await deleteWfTransition(scope.row.id);
|
||||||
|
this.getList();
|
||||||
|
this.$message.success("成功");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue