|
|
@ -3,6 +3,7 @@ |
|
|
<q-btn v-for="action in actionsRef" :key="action.name" :label="action.title" color="primary" @click="buttonClick(action)"></q-btn> |
|
|
<q-btn v-for="action in actionsRef" :key="action.name" :label="action.title" color="primary" @click="buttonClick(action)"></q-btn> |
|
|
</div> |
|
|
</div> |
|
|
<WSelectAssigneeDialog ref="selectAssigneeDialogRef" @assignee-selected="assigneeSelected"></WSelectAssigneeDialog> |
|
|
<WSelectAssigneeDialog ref="selectAssigneeDialogRef" @assignee-selected="assigneeSelected"></WSelectAssigneeDialog> |
|
|
|
|
|
<w-loading-dialog ref="loadingDialogRef"></w-loading-dialog> |
|
|
</template> |
|
|
</template> |
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, onMounted } from 'vue'; |
|
|
import { ref, onMounted } from 'vue'; |
|
|
@ -66,6 +67,7 @@ const { t } = useI18n(); |
|
|
const actionsRef = ref([]); |
|
|
const actionsRef = ref([]); |
|
|
const selectAssigneeDialogRef = ref(); |
|
|
const selectAssigneeDialogRef = ref(); |
|
|
const currentActionRef = ref(null); |
|
|
const currentActionRef = ref(null); |
|
|
|
|
|
const loadingDialogRef = ref(); |
|
|
|
|
|
|
|
|
const buildActions = (taskId: string) => { |
|
|
const buildActions = (taskId: string) => { |
|
|
axios.get(Environment.apiContextPath(props.gobackActionUrl + '/' + taskId)).then((data) => { |
|
|
axios.get(Environment.apiContextPath(props.gobackActionUrl + '/' + taskId)).then((data) => { |
|
|
@ -122,32 +124,52 @@ const buildButtons = (gobacks) => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const buttonClick = (action) => { |
|
|
const buttonClick = (action) => { |
|
|
emit('beforeSubmit', action, (value) => { |
|
|
emit('beforeSubmit', action, (value, message_) => { |
|
|
if (value) { |
|
|
if (value) { |
|
|
DialogManager.confirm(t('lcdp.bpm.completeTask.action.tip', { action: action.title }), () => { |
|
|
let msg = t('lcdp.bpm.completeTask.action.tip', { action: action.title }); |
|
|
|
|
|
if (message_) { |
|
|
|
|
|
msg = message_; |
|
|
|
|
|
} |
|
|
|
|
|
DialogManager.confirm(msg, () => { |
|
|
|
|
|
loadingDialogRef.value.show(); |
|
|
currentActionRef.value = action; |
|
|
currentActionRef.value = action; |
|
|
axios.post(props.actionUrl + '/' + props.taskId, getSubmitData(action)).then((response) => { |
|
|
axios |
|
|
if (response.data.code === 0) { |
|
|
.post(props.actionUrl + '/' + props.taskId, getSubmitData(action)) |
|
|
// 操作成功 |
|
|
.then((response) => { |
|
|
emit('afterSubmit'); |
|
|
if (response.data.code === 0) { |
|
|
} else if (response.data.code === 1) { |
|
|
// 操作成功 |
|
|
// 需要选择处理人 |
|
|
emit('afterSubmit'); |
|
|
selectAssigneeDialogRef.value.open(response.data); |
|
|
} else if (response.data.code === 1) { |
|
|
} |
|
|
// 需要选择处理人 |
|
|
}); |
|
|
selectAssigneeDialogRef.value.open(response.data); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.finally(() => { |
|
|
|
|
|
if (loadingDialogRef.value) { |
|
|
|
|
|
loadingDialogRef.value.hide(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const assigneeSelected = (assignee) => { |
|
|
const assigneeSelected = (assignee) => { |
|
|
axios.post(props.actionUrl + '/' + props.taskId, getSubmitData(currentActionRef.value, assignee)).then((response) => { |
|
|
loadingDialogRef.value.show(); |
|
|
const rawData = response.data; |
|
|
axios |
|
|
if (rawData.code === 0) { |
|
|
.post(props.actionUrl + '/' + props.taskId, getSubmitData(currentActionRef.value, assignee)) |
|
|
// 操作成功 |
|
|
.then((response) => { |
|
|
emit('afterSubmit'); |
|
|
const rawData = response.data; |
|
|
} |
|
|
if (rawData.code === 0) { |
|
|
}); |
|
|
// 操作成功 |
|
|
|
|
|
emit('afterSubmit'); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.finally(() => { |
|
|
|
|
|
if (loadingDialogRef.value) { |
|
|
|
|
|
loadingDialogRef.value.hide(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const getSubmitData = (action, assignee = undefined) => { |
|
|
const getSubmitData = (action, assignee = undefined) => { |
|
|
|