diff --git a/web_gantt/static/src/js/gantt_row.js b/web_gantt/static/src/js/gantt_row.js index 420e3ad5..fb7ffab7 100644 --- a/web_gantt/static/src/js/gantt_row.js +++ b/web_gantt/static/src/js/gantt_row.js @@ -592,8 +592,23 @@ var GanttRow = Widget.extend({ }); pill.decorations = pillDecorations; - if (self.colorField) { - pill._color = self._getColor(pill[self.colorField]); + // let isDelay = false + // if(pill.state != 'processing' && pill.state != 'finished') { // 判断待加工 + // isDelay = pill.order_deadline.isBefore(new Date()) + // } + pill.exState = '' + if (self.colorField){ + // console.log(self.colorField, self, pill, '颜色') + // pill._color = self._getColor(pill[self.colorField]); + // 设置pill背景颜色2 修改时间2024年6月25日17:09:43 + let isDelay = false + if(pill.state != 'processing' && pill.state != 'finished') { // 判断待加工 + isDelay = pill.order_deadline.isBefore(new Date()) + } + if(isDelay) { + pill.disableDragdrop = true + } + pill._color = self._getColor2(isDelay ? 'delay' : pill.state); } if (self.progressField) { @@ -613,6 +628,13 @@ var GanttRow = Widget.extend({ } return 0; }, + _getColor2 (state) { + return { + 'finished': 'ccc', + 'delay': 9, + 'processing': 13 // 绿色 + }[state] + }, /** * Get context to evaluate decoration * @@ -867,10 +889,11 @@ var GanttRow = Widget.extend({ if ($pill.hasClass('ui-draggable-dragging')) { return; } - var self = this; var pill = _.findWhere(this.pills, { id: $pill.data('id') }); - + if(pill.state == 'finished'){ // 已完成状态不能拖拽 + return; + } // DRAGGABLE if (this.options.canEdit && !pill.disableStartResize && !pill.disableStopResize && !this.isGroup) { diff --git a/web_gantt/static/src/scss/web_gantt.scss b/web_gantt/static/src/scss/web_gantt.scss index 7dbca3e3..bc48bee5 100644 --- a/web_gantt/static/src/scss/web_gantt.scss +++ b/web_gantt/static/src/scss/web_gantt.scss @@ -754,3 +754,7 @@ left: -0.5 * $o-connector-creator-bullet-diameter; } } + +.o_gantt_view .o_gantt_row_nogroup .o_gantt_pill.o_gantt_color_ccc { + background-color: #ccc; +} \ No newline at end of file