| | |
| | | <el-row justify="space-between"> |
| | | <el-text>单日计划</el-text> |
| | | <el-button |
| | | v-show="create && modelValue && modelValue.length > 0" |
| | | v-show="create && data && data.length > 0" |
| | | type="success" |
| | | size="small" |
| | | @click="add" |
| | |
| | | <div> |
| | | <el-scrollbar v-loading="loading" :height="height"> |
| | | <el-space |
| | | v-if="modelValue && modelValue.length > 0" |
| | | v-if="data && data.length > 0" |
| | | fill |
| | | :fill-ratio="100" |
| | | direction="vertical" |
| | | style="width: 100%" |
| | | > |
| | | <ItemSubTask v-for="s in modelValue" :key="s.guid" :item="s"> |
| | | <ItemSubTask v-for="s in data" :key="s.guid" :item="s"> |
| | | <template #default="{ item }"> |
| | | <el-space direction="vertical"> |
| | | <el-button plain type="primary" size="small" @click="edit(item)" |
| | | <el-button |
| | | :disabled="item.status != '未执行'" |
| | | plain |
| | | type="primary" |
| | | size="small" |
| | | @click="edit(item)" |
| | | >编辑</el-button |
| | | > |
| | | <el-button |
| | |
| | | </el-space> |
| | | <div v-else> |
| | | <el-empty description="无任务记录" /> |
| | | <el-row justify="center"> |
| | | <el-row v-if="create" justify="center"> |
| | | <el-button type="success" size="small" @click="add" |
| | | >添加任务</el-button |
| | | > |
| | |
| | | > |
| | | <CompSubTaskEdit |
| | | v-model="activeItem" |
| | | @submit="dialogVisible = false" |
| | | @submit="onEditSubmit" |
| | | @cancel="dialogVisible = false" |
| | | ></CompSubTaskEdit> |
| | | </el-dialog> |
| | |
| | | loading: Boolean |
| | | }); |
| | | |
| | | const dialogVisible = ref(false) |
| | | const activeItem = ref(null) |
| | | const dialogVisible = ref(false); |
| | | const activeItem = ref(null); |
| | | const data = computed(() => props.modelValue); |
| | | |
| | | const emit = defineEmits(['edit', 'add', 'remove', 'update:modelValue']); |
| | | const emit = defineEmits(['submit', 'add', 'remove', 'update:modelValue']); |
| | | |
| | | function remove(item) { |
| | | if (item.status == '未执行') { |
| | |
| | | } |
| | | |
| | | function edit(item) { |
| | | activeItem.value = item |
| | | dialogVisible.value = true |
| | | emit('edit'); |
| | | activeItem.value = item; |
| | | dialogVisible.value = true; |
| | | } |
| | | |
| | | function onEditSubmit(item) { |
| | | dialogVisible.value = false; |
| | | const index = data.value.findIndex((v) => { |
| | | return item.stguid == v.stguid; |
| | | }); |
| | | data.value.splice(index, 1, item); |
| | | emit('update:modelValue', data.value); |
| | | emit('submit'); |
| | | } |
| | | |
| | | function add() { |
| | |
| | | } |
| | | |
| | | onUnmounted(()=>{ |
| | | dialogVisible.value = false |
| | | }) |
| | | dialogVisible.value = false; |
| | | }); |
| | | </script> |