feat: base ticketd_b调整样式

This commit is contained in:
caoqianming 2025-12-01 11:31:54 +08:00
parent 8d9a066d8c
commit d2754d3b0c
1 changed files with 18 additions and 16 deletions

View File

@ -1,5 +1,4 @@
<template>
<span v-if="actionShow">
<button
v-for="item in transitions"
:key="item.id"
@ -7,10 +6,8 @@
:loading="isSaveing"
:disabled="isSaveing"
@click="handleTransition(item)"
style="margin-right: 2px"
size="mini"
>{{ item.name }}</button>
</span>
</template>
<script setup>
import { ref, reactive, onMounted, defineEmits, watch } from 'vue'
@ -27,8 +24,9 @@ const props = defineProps({
const workflow = ref(null);
const transitions = ref([]);
const currentUser = ref(uni.getStorageSync("userInfo").id);
onMounted(async () => {
setTimeout(()=>{init()}, 2000)
setTimeout(()=>{init()}, 1000)
// await init();
// watch(
// () => props.ticket_,
@ -40,24 +38,22 @@ onMounted(async () => {
// { deep: true }
// )
})
const actionShow = ref(false);
const suggestion = ref("")
const isOwn = ref(false)
const ticketId = ref(null)
const init = async () => {
transitions.value = [];
actionShow.value = false;
if (props.ticket_ && props.ticket_.id) {
isOwn.value = props.ticket_.create_by === currentUser.value;
ticketId.value = props.ticket_.id;
const isParticipant =
(props.ticket_.participant_type === 1 && props.ticket_.participant === currentUser.value) ||
(props.ticket_.participant_type === 2 && props.ticket_.participant.includes(currentUser.value))
if (isParticipant) {
actionShow.value = true;
transitions.value = await API.getTransition(props.ticket_.id);
}
}else if (props.workflow_key) {
let res = await API.workflowInitkey(props.workflow_key);
actionShow.value = true
transitions.value = res.transitions;
workflow.value = res.workflow
}else{
@ -81,7 +77,7 @@ const submit = async (transition_id) => {
return;
}
}
if (props.ticket_?.id) {
if (ticketId.value) {
console.log('props.ticket_data',props.ticket_data)
let params = new Object();
params.transition = transition_id;
@ -120,15 +116,21 @@ const submit = async (transition_id) => {
return;
}
ticket.transition = transition_id;
try {
let res = await API.ticketCreate(ticket);
isSaveing.value = false;
uni.showToast({
title: '提交成功',
icon: 'success'
});
emit("success", res.id)
ticketId.value = res.id;
try{
await API.ticketHandle(ticketId.value, {transition: transition_id, ticket_data: props.ticket_data});
isSaveing.value = false;
uni.showToast({
title: '提交成功',
icon: 'success'
});
emit("success", res.id)
}catch (e) {
isSaveing.value = false;
return;
}
} catch (e) {
isSaveing.value = false;
return;