riku
2024-10-22 3908a403cb3a852bee96414a8bb82b88371e7b5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<template>
  <el-row justify="space-between">
    <el-text>单日计划</el-text>
    <el-button
      v-show="create && data && data.length > 0"
      type="success"
      size="small"
      @click="add"
      >任务调整</el-button
    >
  </el-row>
  <el-divider />
  <div>
    <el-scrollbar v-loading="loading" :height="height">
      <el-space
        v-if="data && data.length > 0"
        fill
        :fill-ratio="100"
        direction="vertical"
        style="width: 100%"
      >
        <ItemSubTask v-for="s in data" :key="s.guid" :item="s">
          <template #default="{ item }">
            <el-button type="danger" size="small" @click="remove(item)"
              >移除</el-button
            >
          </template>
        </ItemSubTask>
      </el-space>
      <div v-else>
        <el-empty description="无任务记录" />
        <el-row justify="center">
          <el-button type="success" size="small" @click="add"
            >添加任务</el-button
          >
        </el-row>
      </div>
    </el-scrollbar>
  </div>
</template>
<script setup>
import { ref, watch, onMounted } from 'vue';
 
const props = defineProps({
  data: Array,
  height: {
    type: String,
    default: '70vh'
  },
  // 是否显示添加任务按钮
  create: Boolean,
  loading: Boolean
});
const curSubTaskList = ref([]);
 
const emit = defineEmits(['add', 'remove']);
 
function remove(item) {
  emit('remove', item);
}
 
function add() {
  emit('add');
}
</script>