diff --git a/CHANGELOG.md b/CHANGELOG.md
index 340cf12..99eaffc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,6 +50,7 @@
- | 定期任务接口 | [aa4981c](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/aa4981c)
- | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e9fdd71)
- | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/19228d6)
+ - | 日常任务html数据查验 | [880ce5c](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/880ce5c)
- | 上下滚动时间轴 | [d533a01](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/d533a01)
- | 上下滑动加载定期任务 | [4090d89](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4090d89)
- | 时间轴上下滚动数据加载bug修改 | [e82ede4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e82ede4)
diff --git a/src/components/Globals/Globals.vue b/src/components/Globals/Globals.vue
index b545046..211b85e 100644
--- a/src/components/Globals/Globals.vue
+++ b/src/components/Globals/Globals.vue
@@ -3,16 +3,22 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -28,12 +34,10 @@ import Skeleton from '@/components/Skeleton/Skeleton';
export default {
name: 'Global',
components: { Skeleton },
- props: { plugins: { type: Array, default: () => [] } },
+ props: { tasks: { type: Array, default: () => [] } },
data() {
return {
// loading: true,
- pluginId: 0,
- styleType: 0,
task: null,
};
},
diff --git a/src/components/Plugin/Plugin.vue b/src/components/Plugin/Plugin.vue
index f65b078..5b1f411 100644
--- a/src/components/Plugin/Plugin.vue
+++ b/src/components/Plugin/Plugin.vue
@@ -1,16 +1,22 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -23,21 +29,26 @@ export default {
type: Object,
},
pluginId: {
- default: '0',
+ default: '1',
type: String,
},
styleType: {
default: 0,
type: Number,
},
+ pluginTaskId: {
+ default: '0',
+ type: String,
+ },
},
data() {
return { pluginContent: null };
},
async created() {
await this.getPlugin();
- console.log(this.pluginContent.js);
- if (this.pluginContent.js) {
+ let domList = Array.from(document.getElementsByTagName('script'));
+ const index = domList.findIndex(item => item.id === `p${this.pluginContent.pluginId}`);
+ if (this.pluginContent.js && index === -1) {
var scriptDom = document.createElement('script');
scriptDom.id = `p${this.pluginContent.pluginId}`;
scriptDom.innerHTML = this.pluginContent.js;
@@ -51,8 +62,8 @@ export default {
pluginId,
styleType,
});
+ this.$emit('changeLoading', false);
this.pluginContent = res;
- console.log(this.pluginContent);
},
},
};
diff --git a/src/components/Roles/Roles.vue b/src/components/Roles/Roles.vue
index ba8a2b8..42d646a 100644
--- a/src/components/Roles/Roles.vue
+++ b/src/components/Roles/Roles.vue
@@ -93,7 +93,7 @@ export default {
//改变index 即手动点击切换 我在此时将当前元素赋值给左边距 实现自动滚动
this.setCurrentRole(index);
// 清空定期任务数据
- this.setTasks([]);
+ this.setTasks();
// 根据时间基准点和角色查找定期任务
await this.$emit('getTasksByRole');
} catch (error) {
diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue
index c581fed..c751c7c 100644
--- a/src/components/TimeLine/component/TimeBox.vue
+++ b/src/components/TimeLine/component/TimeBox.vue
@@ -4,7 +4,9 @@
- {{ $moment(+item.planStart).format('MM-DD HH:mm') }} {{ $t.time.formatDuration(item.planDuration) }}
+
+ {{ $moment(+item.planStart).format('MM-DD HH:mm') }}
+
@@ -23,33 +25,28 @@
@click="changeTimeNode(item.planStart)"
class="h-16"
margin="0"
+ v-if="item.plugins && item.plugins.length"
>
-
-
-
-
-
+
+
-
+
@@ -68,7 +65,7 @@ export default {
name: 'TimeBox',
components: { TimeStatus, Skeleton },
data() {
- return { currentComponent: '', styleType: 0 };
+ return { currentComponent: '', styleType: 0, taskLoading: true };
},
computed: mapState('home', ['roleId', 'timeNode', 'timeUnit', 'tasks']),
@@ -92,6 +89,7 @@ export default {
this.setTimeNode(time);
},
+ // 设置网格布局
getClass(col, row) {
return [`row-span-${row}`, `col-span-${col}`];
},
diff --git a/src/pages/project/project.vue b/src/pages/project/project.vue
index 21d188b..b1d4ccd 100644
--- a/src/pages/project/project.vue
+++ b/src/pages/project/project.vue
@@ -3,7 +3,7 @@
-
+
@@ -136,9 +136,12 @@ export default {
try {
this.allPlugins = [];
const res = await this.$u.api.getPermanent({ roleId: this.roleId });
- for (let item of res) {
- this.allPlugins = this.allPlugins.concat(item.plugins);
- }
+ // for (let item of res) {
+ // if (item.plugins) {
+ // this.allPlugins = this.allPlugins.concat(item.plugins);
+ // }
+ // }
+ this.allPlugins = res;
console.log('allPlugins', this.allPlugins);
} catch (error) {
console.log('error: ', error);
@@ -157,11 +160,12 @@ export default {
const { roleId, timeNode, timeUnit } = this;
const params = { roleId, timeNode, timeUnit };
const res = await this.$u.api.getGlobal(params);
- for (let task of res) {
- for (let item of task.plugins) {
- this.timePlugins.push(...item);
- }
- }
+ // for (let task of res) {
+ // for (let item of task.plugins) {
+ // this.timePlugins.push(...item);
+ // }
+ // }
+ this.timePlugins = res;
this.setDailyTasks(res);
} catch (error) {
console.log('error: ', error);
@@ -173,15 +177,20 @@ export default {
try {
await this.getTasks({ queryType: 0 });
await this.getTasks({ queryType: 1 });
- // 查上下的任务
+ // 查上页的任务
const upQuery = {
timeNode: +this.tasks[0].planStart,
queryType: 0,
queryNum: 6,
};
await this.getTasks(upQuery);
+
+ // 查下页的任务
+ // 时间基准点=最后一个任务的开始时间+当前时间颗粒度
+ const cycle = this.$t.time.computeCycle('天');
+ const timeNode = this.$t.time.add(+this.tasks[this.tasks.length - 1].planStart, 1, cycle).valueOf();
const downQuery = {
- timeNode: +this.tasks[this.tasks.length - 1].planStart,
+ timeNode,
queryType: 1,
queryNum: 6,
};
diff --git a/src/store/home/mutations.js b/src/store/home/mutations.js
index ec844a5..c44dd92 100644
--- a/src/store/home/mutations.js
+++ b/src/store/home/mutations.js
@@ -125,7 +125,12 @@ const mutations = {
if (!data || !data.length) {
state.topEnd = true;
}
- state.tasks = [...data.concat(state.tasks)] || [];
+ console.log('!state.tasks.plugins.length: ', !state.tasks[0].name);
+ if (!state.tasks[0].name) {
+ state.tasks = [...data];
+ } else {
+ state.tasks = [...data.concat(state.tasks)];
+ }
},
/**
@@ -137,16 +142,36 @@ const mutations = {
if (!data || !data.length) {
state.bottomEnd = true;
}
- state.tasks = [...state.tasks.concat(data)] || [];
+ if (!state.tasks[0].name) {
+ state.tasks = [...data];
+ } else {
+ state.tasks = [...state.tasks.concat(data)];
+ }
},
/**
* 清空定期任务数据
* @param {Object} state
- * @param {Array} data 服务端返回的模板数组
*/
- setTasks(state, data) {
- state.tasks = data || [];
+ setTasks(state) {
+ const data = [
+ {
+ panel: {},
+ plugins: [],
+ planStart: new Date().getTime(),
+ },
+ {
+ panel: {},
+ plugins: [],
+ planStart: new Date().getTime(),
+ },
+ {
+ panel: {},
+ plugins: [],
+ planStart: new Date().getTime(),
+ },
+ ];
+ state.tasks = data;
},
/**
diff --git a/src/store/home/state.js b/src/store/home/state.js
index 9b2d85d..553a3c1 100644
--- a/src/store/home/state.js
+++ b/src/store/home/state.js
@@ -14,7 +14,23 @@ const state = {
roleId: '', // 当前展示查看的角色id
timeNode: new Date().getTime(), // 时间基准点
timeUnit: 4, // // 时间颗粒度
- tasks: [], // 定期任务
+ tasks: [
+ {
+ panel: {},
+ plugins: [],
+ planStart: new Date().getTime(),
+ },
+ {
+ panel: {},
+ plugins: [],
+ planStart: new Date().getTime(),
+ },
+ {
+ panel: {},
+ plugins: [],
+ planStart: new Date().getTime(),
+ },
+ ], // 定期任务
topEnd: false, // 时间轴向上查任务到顶了
bottomEnd: false, // 时间轴向下查任务到底了
dailyTasks: [], // 日常任务