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