|
@@ -23,8 +23,8 @@
|
|
|
|
|
|
<component
|
|
|
:is="formComp"
|
|
|
- v-if="visible"
|
|
|
- :row-data="rowData"
|
|
|
+ v-if="visible && taskData"
|
|
|
+ :row-data="taskData"
|
|
|
@cancel="close"
|
|
|
@modified="modifiedHandle"
|
|
|
></component>
|
|
@@ -34,7 +34,8 @@
|
|
|
<script setup lang="ts">
|
|
|
import { computed, ref } from 'vue';
|
|
|
import useModal from '@/hooks/modal';
|
|
|
- import { TaskItem } from '@/api/types/order';
|
|
|
+ import { TaskItem, TaskItemDetail } from '@/api/types/order';
|
|
|
+ import { taskDetailInfo } from '@/api/order';
|
|
|
|
|
|
import ruleForm from './ruleForm.vue';
|
|
|
import timeForm from './timeForm.vue';
|
|
@@ -65,13 +66,25 @@
|
|
|
const compType = ref('rule');
|
|
|
const formComp = computed(() => comps[compType.value]);
|
|
|
|
|
|
+ const taskData = ref<TaskItemDetail | null>(null);
|
|
|
+ async function getDetail() {
|
|
|
+ taskData.value = await taskDetailInfo(props.rowData.id);
|
|
|
+ }
|
|
|
+
|
|
|
function modifiedHandle() {
|
|
|
+ getDetail();
|
|
|
emit('modified');
|
|
|
if (isEdit.value) return;
|
|
|
close();
|
|
|
}
|
|
|
|
|
|
- function modalBeforeOpen() {
|
|
|
+ async function modalBeforeOpen() {
|
|
|
+ if (props.rowData.id) {
|
|
|
+ taskData.value = null;
|
|
|
+ await getDetail();
|
|
|
+ } else {
|
|
|
+ taskData.value = {};
|
|
|
+ }
|
|
|
compType.value = 'rule';
|
|
|
}
|
|
|
</script>
|