riku
2024-10-10 46566d05cb156d40323078133191595d2a2f11c4
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<template>
  <BaseContentLayout>
    <template #header>
      <FYSearchBar @search="search">
        <template #options>
          <!-- 区县 -->
          <FYOptionLocation
            :allOption="true"
            :level="3"
            :checkStrictly="false"
            v-model:value="formSearch.locations"
          ></FYOptionLocation>
        </template>
        <!-- <template #buttons>
          <slot name="buttons"></slot>
        </template> -->
      </FYSearchBar>
    </template>
    <template #aside>
      <SideList :items="tasks" :loading="sideLoading" @item-click="chooseTask"></SideList>
    </template>
    <template #main>
      <ToolBar
        :title="curTask.title"
        :descriptions="taskStatus"
        :buttons="buttons"
        :loading="mainLoading"
      ></ToolBar>
      <el-scrollbar
        v-if="curMonitorObjList.length > 0"
        class="el-scrollbar"
        v-loading="mainLoading"
      >
        <div><el-text>监管计划</el-text></div>
        <el-divider></el-divider>
        <el-button type="primary" size="small" @click="editTask">场景调整</el-button>
        <div><el-text>监管场景</el-text></div>
        <CompMonitorObj :data="curMonitorObjList"></CompMonitorObj>
        <!-- <div><el-text>监管场景</el-text></div>
        <div>
          <el-space wrap>
            <ItemMonitorObj
              v-for="item in curMonitorObjList"
              :key="item.movid"
              :item="item"
            ></ItemMonitorObj>
          </el-space>
        </div> -->
      </el-scrollbar>
      <el-empty v-else description="暂无记录" v-loading="mainLoading" />
    </template>
  </BaseContentLayout>
</template>
 
<script>
import taskApi from '@/api/fysp/taskApi';
import CompMonitorObj from './components/CompMonitorObj.vue';
export default {
  components: { CompMonitorObj },
  data() {
    return {
      formSearch: {
        _locations: {},
        searchText: '',
        _scenetype: {},
        online: {}
      },
      // 左侧菜单栏加载状态
      sideLoading: false,
      // 右侧内容栏加载状态
      mainLoading: false,
      // 任务列表
      tasks: [],
      // 当前任务的监管对象
      curMonitorObjList: [],
      //当前选中的任务
      curTask: {},
      //操作按钮
      buttons: [
        {
          name: '计划调整',
          color: 'success'
        },
        {
          name: '场景调整',
          color: 'warning'
        }
      ]
    };
  },
  computed: {
    // 总任务状态统计
    taskStatus() {
      return [
        { name: '场景数', value: 100 },
        { name: '未巡查', value: 0 },
        { name: '已巡查', value: 0 }
      ];
    }
  },
  methods: {
    search(formSearch) {
      this.sideLoading = true;
      this.mainLoading = true;
      this.curMonitorObjList = [];
      this.curTask = {};
      taskApi.getTopTask().then((res) => {
        const list = res.map((r) => {
          const t = this.getTaskType(r);
          return {
            type: t,
            title: r.name,
            categoly: this.$fm.formatYM(r.starttime),
            data: r
          };
        });
        this.tasks = list;
        if (list.length == 0) {
          this.sideLoading = false;
          this.mainLoading = false;
        }
      });
    },
    //获取任务的完成情况
    getTaskType(s) {
      let type = 0;
      switch (s.runingstatus) {
        case '未执行':
          type = 0;
          break;
        case '正在执行':
          type = 1;
          break;
        case '已结束':
          type = 2;
          break;
        default:
          type = 0;
          break;
      }
      return type;
    },
    chooseTask(task) {
      this.sideLoading = false;
      this.mainLoading = true;
      taskApi
        .fetchMonitorObjectVersion(task.data.tguid)
        .then((res) => {
          this.curMonitorObjList = res;
          this.curTask = task;
        })
        .finally(() => {
          this.mainLoading = false;
        });
    },
    editTask() {
      this.$router.push({
        name: 'monitorObjEdit',
        query: {
          data: encodeURIComponent(JSON.stringify(this.curMonitorObjList)),
          task: encodeURIComponent(JSON.stringify(this.curTask.data))
        }
      });
    }
  },
  mounted() {
    this.search();
  }
};
</script>
 
<style scoped>
.select-box {
  /* border: 1px solid var(--el-border-color);
  border-radius: var(--el-border-radius-base);
  padding: 0 8px; */
}
 
.el-scrollbar {
  height: calc((100vh - 60px * 2 - 20px * 2 - var(--height-toolbar)));
}
</style>