This commit is contained in:
shijing 2025-11-18 13:41:27 +08:00
commit 9ed081e5be
3 changed files with 69 additions and 10 deletions

View File

@ -10,6 +10,13 @@ export default {
return await http.get(this.url, data);
}
},
cates: {
url: `${config.API_URL}/wf/workflow/cates/`,
name: "工作流分类",
req: async function(data){
return await http.get(this.url, data);
}
},
item: {
name: "工作流详情",
req: async function(id){

View File

@ -15,13 +15,19 @@
@change="handleQuery"
clearable
style="margin-left: 2px"
>
<el-option-group
v-for="group in wfOptions"
:key="group.category"
:label="group.category"
>
<el-option
v-for="item in wfOptions"
v-for="item in group.items"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-option-group>
</el-select>
<el-select
v-model="query.script_run_last_result"
@ -136,14 +142,19 @@
</el-drawer>
</el-container>
<el-dialog v-model="dialogVisible" title="选择流程">
<el-card
v-for="item in wfOptions"
:key="item.id"
:body-style="{ padding: '10px', cursor: 'pointer' }"
style="width: 200px; display: inline-block; margin: 4px; background-color: #f5f7fa;"
shadow="hover"
@click="startTicket(item)"
>{{ item.name }}</el-card>
<div v-for="group in wfOptions" :key="group.category" class="category-group">
<h3 style="margin: 16px 0 8px 0; color: #606266;">{{ group.category }}</h3>
<el-card
v-for="item in group.items"
:key="item.id"
:body-style="{ padding: '10px', cursor: 'pointer' }"
style="width: 180px; display: inline-block; margin: 4px; background-color: #f5f7fa;"
shadow="hover"
@click="startTicket(item)"
>
{{ item.name }}
</el-card>
</div>
</el-dialog>
</template>
@ -208,8 +219,24 @@ export default {
},
methods: {
getWfOptions() {
let permissions = this.$TOOL.data.get("PERMISSIONS");
const groups = {};
this.$API.wf.workflow.list.req({ page: 0 }).then((res) => {
this.wfOptions = res;
res.forEach((item) => {
if(item.key && permissions.includes(item.key)) {
let cate = item.cate;
if (!cate){cate="未分组"}
if (!groups[cate]) {
groups[cate] = [];
}
groups[cate].push(item);
}
})
// 便
this.wfOptions = Object.keys(groups).map(category => ({
category,
items: groups[category]
}));
});
},
reStart(row) {

View File

@ -12,6 +12,15 @@
@click="batch_del" v-auth="'workflow.delete'"></el-button> -->
</div>
<div class="right-panel">
<el-select v-model="query.cate" placeholder="工作流分组" clearable style="width: 220px;"
@change="handleQuery">
<el-option
v-for="item in wfCateOptions"
:key="item"
:label="item"
:value="item"
/>
</el-select>
<el-input
v-model="query.search"
placeholder="工作流名称"
@ -38,6 +47,11 @@
prop="name"
width="220"
></el-table-column>
<el-table-column
label="分类"
prop="cate"
width="80"
></el-table-column>
<el-table-column
label="标识"
prop="key"
@ -136,6 +150,9 @@
<el-form-item label="名称" prop="name">
<el-input v-model="addForm.name" clearable></el-input>
</el-form-item>
<el-form-item label="分类" prop="cate">
<el-input v-model="addForm.cate" clearable></el-input>
</el-form-item>
<el-form-item label="标识" prop="key">
<el-input v-model="addForm.key" clearable></el-input>
</el-form-item>
@ -214,6 +231,7 @@ export default {
edit: "编辑",
show: "查看",
},
wfCateOptions: [],
//
addForm: {
name: "",
@ -240,6 +258,7 @@ export default {
},
mounted() {
// this.getGroup();
this.getWfCates();
},
methods: {
//
@ -248,6 +267,12 @@ export default {
this.limitedVisible = true;
},
getWfCates() {
this.$API.wf.workflow.cates.req().then(res=>{
this.wfCateOptions = res
})
},
submitHandle() {
let that = this;
this.$refs.addForm.validate((valid) => {