Commit 4a2efd83c6ce8dbcfde0f5791ed9abe4c2e43c5e
1 parent
32c92352
生产进度看板
Showing
3 changed files
with
282 additions
and
12 deletions
src/api/schedulerApi.js
1 | 1 | import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage' |
2 | 2 | import Vue from 'vue' |
3 | -import {UI_CACHE_DB_DICT_DATA } from "@/store/mutation-types" | |
3 | +import { UI_CACHE_DB_DICT_DATA } from '@/store/mutation-types' | |
4 | 4 | |
5 | 5 | //生产计划主表 |
6 | -export const projectName = (params)=>getAction("/scheduler/schedulerHeader/getProjectName", params); | |
7 | -export const addHeader = (params)=>postAction("/scheduler/schedulerHeader/add",params); | |
8 | -export const editHeader = (params)=>putAction("/scheduler/schedulerHeader/edit",params); | |
6 | +export const projectName = params => getAction('/scheduler/schedulerHeader/getProjectName', params) | |
7 | +export const addHeader = params => postAction('/scheduler/schedulerHeader/add', params) | |
8 | +export const editHeader = params => putAction('/scheduler/schedulerHeader/edit', params) | |
9 | 9 | |
10 | 10 | //生产计划明细 |
11 | -export const addDetail = (params) => postAction("/scheduler/schedulerDetail/add", params); | |
11 | +export const addDetail = params => postAction('/scheduler/schedulerDetail/add', params) | |
12 | 12 | //生产计划明细 |
13 | -export const addFromDetail = (params) => postAction("/scheduler/schedulerDetail/addForm", params); | |
14 | -export const editDetail = (params) => putAction("/scheduler/schedulerDetail/edit", params); | |
15 | -export const queryDetailList = (params) => getAction("/scheduler/schedulerDetail/queryDetailList", params) | |
13 | +export const addFromDetail = params => postAction('/scheduler/schedulerDetail/addForm', params) | |
14 | +export const editDetail = params => putAction('/scheduler/schedulerDetail/edit', params) | |
15 | +export const queryDetailList = params => getAction('/scheduler/schedulerDetail/queryDetailList', params) | |
16 | 16 | //生产交易表 |
17 | -export const addTransaction = (params) => postAction("/scheduler/schedulerTransaction/add", params); | |
18 | -export const editTransaction = (params) => putAction("/scheduler/schedulerTransaction/edit", params); | |
17 | +export const addTransaction = params => postAction('/scheduler/schedulerTransaction/add', params) | |
18 | +export const editTransaction = params => putAction('/scheduler/schedulerTransaction/edit', params) | |
19 | 19 | |
20 | 20 | //进度看板 |
21 | -export const queryTask = (params) => getAction("scheduler/progressRate/query", params); | |
22 | 21 | \ No newline at end of file |
22 | +export const queryTask = params => getAction('scheduler/progressRate/query', params) | |
23 | + | |
24 | +//工程看板 | |
25 | +export const getKanbanInfo = params => getAction('oa/projectc/getKanbanInfo', params) | |
... | ... |
src/views/scheduler/progressRate.vue
src/views/scheduler/progressRateCopy.vue
0 → 100644
1 | +<template> | |
2 | + <div> | |
3 | + <div class="table-page-search-wrapper"> | |
4 | + <a-form layout="inline"> | |
5 | + <a-row :gutter="10"> | |
6 | + | |
7 | + <a-col :md="4" :sm="24"> | |
8 | + <a-form-item> | |
9 | + <a-input v-model="queryParam.keyword" placeholder="关键字" /> | |
10 | + </a-form-item> | |
11 | + </a-col> | |
12 | + <a-col :md="6" :sm="24"> | |
13 | + <a-button type="primary" @click="getTask(queryParam.keyword)">查询</a-button> | |
14 | + <a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button> | |
15 | + </a-col> | |
16 | + </a-row> | |
17 | + </a-form> | |
18 | + </div> | |
19 | + | |
20 | + <gantt-elastic | |
21 | + :options="options" | |
22 | + :tasks="tasks" | |
23 | + @tasks-changed="tasksUpdate" | |
24 | + @options-changed="optionsUpdate" | |
25 | + @dynamic-style-changed="styleUpdate" | |
26 | + > | |
27 | + <gantt-header slot="header" :options="options"></gantt-header> | |
28 | + </gantt-elastic> | |
29 | + <div class="q-mt-md" /> | |
30 | + </div> | |
31 | + | |
32 | +</template> | |
33 | + | |
34 | +<script> | |
35 | +import GanttElastic from 'gantt-elastic' | |
36 | +import GanttHeader from 'gantt-elastic-header' | |
37 | +import moment from 'moment' | |
38 | +import dayjs from 'dayjs' | |
39 | +import { projectName, getKanbanInfo } from '../../api/schedulerApi' | |
40 | + | |
41 | + | |
42 | +function getDate(hours) { | |
43 | + const currentDate = new Date() | |
44 | + const currentYear = currentDate.getFullYear() | |
45 | + const currentMonth = currentDate.getMonth() | |
46 | + const currentDay = currentDate.getDate() | |
47 | + const timeStamp = new Date( | |
48 | + currentYear, | |
49 | + currentMonth, | |
50 | + currentDay, | |
51 | + 0, | |
52 | + 0, | |
53 | + 0 | |
54 | + ).getTime() | |
55 | + return new Date(timeStamp + hours * 60 * 60 * 1000).getTime() | |
56 | +} | |
57 | + | |
58 | +let that | |
59 | +let tasks = [ | |
60 | + { | |
61 | + "duration": 15267159000, | |
62 | + "end": 1616575959000, | |
63 | + "id": "1", | |
64 | + "isOnTime": "否", | |
65 | + "start": 1601308800000, | |
66 | + "taskPoint": "测试项目", | |
67 | + "type": "task", | |
68 | + "style": { | |
69 | + "base": { | |
70 | + "fill": "#BABABA", | |
71 | + "stroke": "#BABABA" | |
72 | + } | |
73 | + } | |
74 | + }, | |
75 | + { | |
76 | + "duration": 15180759000, | |
77 | + "end": 1616575959000, | |
78 | + "id": "2", | |
79 | + "isOnTime": false, | |
80 | + "opinion": "", | |
81 | + "parentId": "HHCS-L-2020-0123", | |
82 | + "principal": "", | |
83 | + "responsible": "", | |
84 | + "start": 1601395200000, | |
85 | + "taskPoint": "测试项目", | |
86 | + "type": "task", | |
87 | + "style": { | |
88 | + "base": { | |
89 | + "fill": "#1EBC61", | |
90 | + "stroke": "#0EAC51" | |
91 | + } | |
92 | + } | |
93 | + } | |
94 | +]; | |
95 | +let options = { | |
96 | + taskMapping: { | |
97 | + progress: "percent" | |
98 | + }, | |
99 | + maxRows: 100, | |
100 | + maxHeight: 500, | |
101 | + title: { | |
102 | + label: "生产进度看板", | |
103 | + html: false | |
104 | + }, | |
105 | + row: { | |
106 | + height: 24 | |
107 | + }, | |
108 | + calendar: { | |
109 | + hour: { | |
110 | + display: false | |
111 | + } | |
112 | + }, | |
113 | + chart: { | |
114 | + progress: { | |
115 | + bar: false | |
116 | + }, | |
117 | + expander: { | |
118 | + display: false | |
119 | + } | |
120 | + }, | |
121 | + taskList: { | |
122 | + expander: { | |
123 | + straight: false | |
124 | + }, | |
125 | + columns: [ | |
126 | + { | |
127 | + id: 1, | |
128 | + label: "ID", | |
129 | + value: "id", | |
130 | + width: 50 | |
131 | + }, | |
132 | + { | |
133 | + id: 2, | |
134 | + label: "名称", | |
135 | + value: "taskPoint", | |
136 | + width: 150, | |
137 | + expander: true | |
138 | + }, | |
139 | + { | |
140 | + id: 3, | |
141 | + label: "开始时间", | |
142 | + value: task => dayjs(task.start).format("YYYY-MM-DD"), | |
143 | + width: 130 | |
144 | + }, | |
145 | + { | |
146 | + id: 4, | |
147 | + label: "完成日期", | |
148 | + value: task => dayjs(task.end).format("YYYY-MM-DD"), | |
149 | + width: 100, | |
150 | + }, | |
151 | + { | |
152 | + id: 9, | |
153 | + label: "意见", | |
154 | + value: "opinion", | |
155 | + width: 60 | |
156 | + }, | |
157 | + { | |
158 | + id: 9, | |
159 | + label: "按时完成", | |
160 | + value: "isOnTime", | |
161 | + width: 60 | |
162 | + } | |
163 | + ] | |
164 | + }, | |
165 | + locale: { | |
166 | + name: "zh-cn", | |
167 | + Now: "Now", | |
168 | + "X-Scale": "Zoom-X", | |
169 | + "Y-Scale": "Zoom-Y", | |
170 | + "Task list width": "列头宽度", | |
171 | + "Before/After": "Expand", | |
172 | + "Display task list": "Task list", | |
173 | + weekdays:["周日","周一","周二","周三","周四","周五","周六"], | |
174 | + months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"], | |
175 | + }, | |
176 | +}; | |
177 | + | |
178 | +let doingStyle = { | |
179 | + base: { | |
180 | + fill: '#BFEFFF', | |
181 | + stroke: '#BFEFFF' | |
182 | + } | |
183 | +} | |
184 | +let warnStyle = { | |
185 | + base: { | |
186 | + fill: '#FF6A6A', | |
187 | + stroke: '#FF6A6A' | |
188 | + } | |
189 | +} | |
190 | +let finishStyle = { | |
191 | + base: { | |
192 | + fill: '#C1FFC1', | |
193 | + stroke: '#C1FFC1' | |
194 | + } | |
195 | +} | |
196 | +let cancelStyle = { | |
197 | + base: { | |
198 | + fill: '#BABABA', | |
199 | + stroke: '#BABABA' | |
200 | + } | |
201 | +} | |
202 | + | |
203 | +export default { | |
204 | + name: 'ProjectRate', | |
205 | + components: { | |
206 | + GanttElastic, | |
207 | + GanttHeader | |
208 | + }, | |
209 | + mounted() { | |
210 | + that = this | |
211 | + }, | |
212 | + data() { | |
213 | + return { | |
214 | + tasks, | |
215 | + options, | |
216 | + dynamicStyle: {}, | |
217 | + lastId: 16, | |
218 | + queryParam: [] | |
219 | + } | |
220 | + }, | |
221 | + methods: { | |
222 | + moment, | |
223 | + addTask() { | |
224 | + this.tasks.push({ | |
225 | + id: this.lastId++, | |
226 | + label: | |
227 | + '<a href="https://images.pexels.com/photos/423364/pexels-photo-423364.jpeg?auto=compress&cs=tinysrgb&h=650&w=940" target="_blank" style="color:#0077c0;">Yeaahh! you have added a task bro!</a>', | |
228 | + projectCode: | |
229 | + '<a href="https://images.pexels.com/photos/423364/pexels-photo-423364.jpeg?auto=compress&cs=tinysrgb&h=650&w=940" target="_blank" style="color:#0077c0;">Awesome!</a>', | |
230 | + start: getDate(24 * 3), | |
231 | + duration: 1 * 24 * 60 * 60 * 1000, | |
232 | + percent: 50, | |
233 | + type: 'project' | |
234 | + }) | |
235 | + }, | |
236 | + tasksUpdate(tasks) { | |
237 | + this.tasks = tasks | |
238 | + }, | |
239 | + optionsUpdate(options) { | |
240 | + this.options = options | |
241 | + }, | |
242 | + styleUpdate(style) { | |
243 | + this.dynamicStyle = style | |
244 | + }, | |
245 | + getTask(workno) { | |
246 | + if (workno == null || workno === "") { | |
247 | + return; | |
248 | + } | |
249 | + let params = { | |
250 | + "workno": workno | |
251 | + }; | |
252 | + getKanbanInfo(params).then((res)=> { | |
253 | + console.log(res) | |
254 | + if (res.success) { | |
255 | + this.tasks = res.result | |
256 | + }else{ | |
257 | + this.$message.error("请输入正确的工作令!"); | |
258 | + } | |
259 | + }) | |
260 | + } | |
261 | + } | |
262 | +} | |
263 | +</script> | |
264 | + | |
265 | +<style scoped> | |
266 | + | |
267 | +</style> | |
0 | 268 | \ No newline at end of file |
... | ... |