From 8d662f5d78fd590f6da9b0fce9bd5204f6dff370 Mon Sep 17 00:00:00 2001 From: 86134 <aa> Date: 星期六, 18 十一月 2023 17:27:58 +0800 Subject: [PATCH] 11 --- src/views/product/workbench/operation-task-pane.vue | 266 +++++++++++++++++++++++++++++----------------------- 1 files changed, 147 insertions(+), 119 deletions(-) diff --git a/src/views/product/workbench/operation-task-pane.vue b/src/views/product/workbench/operation-task-pane.vue index e0a5772..d559810 100644 --- a/src/views/product/workbench/operation-task-pane.vue +++ b/src/views/product/workbench/operation-task-pane.vue @@ -1,6 +1,6 @@ <template> <div> - <el-alert + <el-alert v-if="!operationTasks || operationTasks.length == 0" title="杩樻病鏈夊伐鍗曚笅鍙戝埌姝ゆ満鍙帮紒" type="warning" @@ -9,76 +9,79 @@ </el-alert> <el-card v-for="(item, index) in operationTasks" - @click.native="setCheckFlag(item)" + @click.native="setCheckFlag(item)" shadow="hover" :key="index" :class="['task-item', item.checkFlag ? 'card-checked' : 'card-unchecked']" - :style="{ backgroundColor: getBackgroundColor(item.planFinishDay) }" -> - <!-- <img class="selectedImg" /> --> - <div class="header" > - <div>宸ュ崟鍙凤細{{ item.taskNo }}</div> - <!-- <div>璁″垝鍙凤細{{ item.mpsNo }}</div> --> - <div - :class="[ - 'status-change-div', - item.checkFlag ? 'card-checked-status' : 'card-status' - ]" - > - <el-select - v-if="permissions.product_operationTask_state" - v-model="item.statusAction" - placeholder="鍔熻兘鑿滃崟" - @change=" - changeTaskState(item.statusAction, item.status, item.id, item) - " - > - <el-option - v-for="ele in statusActions" - :key="ele.value" - :label="ele.label" - :value="ele.value" - :disabled="ele.disabled" - > - </el-option> - </el-select> - </div> - </div> - <div class="body"> - <div class="row"> - <div class="l">闆朵欢鍚嶇О锛�</div> - <div class="r">{{ item.partName }}</div> - </div> - <div class="row"> - <div class="l">闆朵欢鍙凤細</div> - <div class="r">{{ item.partNo }}</div> - </div> - <!-- <div class="row"> - <div class="l">鎴愬搧锛�</div> - <div class="r">{{ item.productName }}</div> - </div> --> - <div class="row"> - <div class="l">璁″垝瀹屾垚鏃堕棿锛�</div> - <div class="r">{{ item.planFinishDay }}</div> - </div> - </div> - <el-progress - class="task-progress" - :text-inside="true" - :stroke-width="20" - :percentage=" - Number((item.completedQuantity / item.plannedQuantity).toFixed(2)) * - 100 > - 100 - ? 100 - : Number( - (item.completedQuantity / item.plannedQuantity).toFixed(2) - ) * 100 - " - :format="formatPercentage(item.completedQuantity, item.plannedQuantity)" - ></el-progress> -</el-card> +> + <img class="selectedImg" src="/img/workbench/icon_selected.png" /> + <div class="header"> + <div>宸ュ崟鍙凤細{{ item.taskNo }}</div> + <div class="tag" :style="{ backgroundColor: getTagColor(item.planFinishDay) }"> + {{ getTagText(item.planFinishDay) }} + </div> + <!-- <div>璁″垝鍙凤細{{ item.mpsNo }}</div> --> + <div + :class="[ + 'status-change-div', + item.checkFlag ? 'card-checked-status' : 'card-status' + ]" + > + <el-select + v-if="permissions.product_operationTask_state" + v-model="item.statusAction" + placeholder="鍔熻兘鑿滃崟" + @change=" + changeTaskState(item.statusAction, item.status, item.id, item) + " + > + <el-option + v-for="ele in statusActions" + :key="ele.value" + :label="ele.label" + :value="ele.value" + :disabled="ele.disabled" + > + </el-option> + </el-select> + </div> + </div> + <div class="body"> + <div class="row"> + <div class="l">闆朵欢鍚嶇О锛�</div> + <div class="r">{{ item.partName }}</div> + </div> + <div class="row"> + <div class="l">闆朵欢鍙凤細</div> + <div class="r">{{ item.partNo }}</div> + </div> + <!-- <div class="row"> + <div class="l">鎴愬搧锛�</div> + <div class="r">{{ item.productName }}</div> + </div> --> + <div class="row"> + <div class="l">璁″垝瀹屾垚鏃堕棿锛�</div> + <div class="r">{{ item.planFinishDay }}</div> + </div> + </div> + + <el-progress + class="task-progress" + :text-inside="true" + :stroke-width="20" + :percentage=" + Number((item.completedQuantity / item.plannedQuantity).toFixed(2)) * + 100 > + 100 + ? 100 + : Number( + (item.completedQuantity / item.plannedQuantity).toFixed(2) + ) * 100 + " + :format="formatPercentage(item.completedQuantity, item.plannedQuantity)" + ></el-progress> + </el-card> </div> </template> <style lang="scss" scoped> @@ -92,42 +95,52 @@ flex-direction: column; align-items: center; } + +.tag{ +width: 80px; +height: 30px; +border-radius:15% ; +text-align: center; +text-size:8px; +color:white; +align-content: 30px; + +} + + .task-item { width: 100%; border-radius: 12px; cursor: pointer; position: relative; -background:none; box-shadow: 1px 2px 24px 1px rgba(4, 0, 0, 0.14); - & + .task-item { margin-top: 10px; } - &.card-checked { // color: white; - // background-image: -webkit-linear-gradient( - // 90deg, - // rgba(12, 149, 255, 0.7) 0%, - // rgba(38, 176, 254, 0.8) 34%, - // rgba(12, 149, 255, 0.8) 100% - // ), - // -webkit-linear-gradient(#5a97fa, #5a97fa); - // background-image: -moz-linear-gradient( - // 90deg, - // rgba(12, 149, 255, 0.7) 0%, - // rgba(38, 176, 254, 0.8) 34%, - // rgba(12, 149, 255, 0.8) 100% - // ), - // -moz-linear-gradient(#5a97fa, #5a97fa); - // background-image: linear-gradient( - // 90deg, - // rgba(12, 149, 255, 0.7) 0%, - // rgba(38, 176, 254, 0.8) 34%, - // rgba(12, 149, 255, 0.8) 100% - // ), - // linear-gradient(#5a97fa, #5a97fa); - // background-blend-mode: normal, normal; + background-image: -webkit-linear-gradient( + 90deg, + rgba(12, 149, 255, 0.7) 0%, + rgba(38, 176, 254, 0.8) 34%, + rgba(12, 149, 255, 0.8) 100% + ), + -webkit-linear-gradient(#5a97fa, #5a97fa); + background-image: -moz-linear-gradient( + 90deg, + rgba(12, 149, 255, 0.7) 0%, + rgba(38, 176, 254, 0.8) 34%, + rgba(12, 149, 255, 0.8) 100% + ), + -moz-linear-gradient(#5a97fa, #5a97fa); + background-image: linear-gradient( + 90deg, + rgba(12, 149, 255, 0.7) 0%, + rgba(38, 176, 254, 0.8) 34%, + rgba(12, 149, 255, 0.8) 100% + ), + linear-gradient(#5a97fa, #5a97fa); + background-blend-mode: normal, normal; } .selectedImg { position: absolute; @@ -349,38 +362,53 @@ }, methods: { - setCheckFlag(item) { - this.$nextTick(() => { - this.changeBackgroundColor(item.planFinishDay); - }); - }, - getBackgroundColor(planFinishDay) { - const currentDate = new Date(); - currentDate.setHours(0, 0, 0, 0); // 璁剧疆鏃堕棿涓哄綋澶╃殑寮�濮嬶紝蹇界暐鏃跺垎绉掓绉� - const planFinishDayObj = new Date(planFinishDay); - planFinishDayObj.setHours(0, 0, 0, 0); // 鍚屾牱璁剧疆鏃堕棿涓鸿鍒掑畬鎴愭棩鐨勫紑濮� +// getBackgroundColor(planFinishDay) { +// const today = new Date(); +// const planDate = new Date(planFinishDay); +// if (planDate < today) { +// return 'rgba( 255,0,0,1)'; // 瓒呮湡涓虹孩鑹� +// } else { +// const timeDiff = planDate.getTime() - today.getTime(); +// const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24)); +// if (daysDiff <= 3) { +// return 'rgba(255,204,62, 1)'; // 涓存湡涓洪粍鑹� +// } else { +// return 'rgba(86,219, 25,1)'; // 姝e父涓虹豢鑹� +// } +// } +// }, - if (planFinishDayObj < currentDate) { - // 濡傛灉璁″垝瀹屾垚鏃ュ湪褰撳墠鏃ヤ箣鍓嶏紝杩斿洖'rgba(0, 0, 255, 0.3)'琛ㄧず杩囨湡锛岃繖閲岀殑 0.3 鎺у埗浜嗛�忔槑搴� - return 'rgba(255, 0, 0, 0.5)'; +getTagColor(planFinishDay) { + const today = new Date(); + const planDate = new Date(planFinishDay); + if (planDate < today) { + return 'rgba( 255,0,0,1)'; // 瓒呮湡涓虹孩鑹� + } else { + const timeDiff = planDate.getTime() - today.getTime(); + const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24)); + if (daysDiff <= 3) { + return 'rgba(255,204,62, 1)'; // 涓存湡涓洪粍鑹� } else { - const timeDifference = currentDate - planFinishDayObj; - const daysDifference = Math.ceil(timeDifference / (1000 * 60 * 60 * 24)); - - if (daysDifference < 0) { - // 濡傛灉璁″垝瀹屾垚鏃ュ湪鏈潵锛岃绠楀畠鏄惁鍦�10澶╁唴 - const daysUntilDue = Math.abs(daysDifference); - if (daysUntilDue <= 10) { - // 濡傛灉鍦�10澶╁唴锛岃繑鍥�'rgba(255, 255, 0, 0.3)'琛ㄧず鍗冲皢鍒版湡锛岃繖閲岀殑 0.3 鎺у埗浜嗛�忔槑搴� - return 'rgba(219, 219, 54, 0.7)'; - } - return 'rgba(28, 62, 222, 0.8)'; - } + return 'rgba(86,219, 25,1)'; // 姝e父涓虹豢鑹� } - // 濡傛灉涓嶆槸鍗冲皢鍒版湡鎴栧凡杩囨湡锛岃繑鍥�'rgba(255, 0, 0, 0.3)'琛ㄧず宸插埌鏈燂紝杩欓噷鐨� 0.3 鎺у埗浜嗛�忔槑搴� - return 'rgba(255, 0, 0, 0.5)'; + } }, +getTagText(planFinishDay) { + const today = new Date(); + const planDate = new Date(planFinishDay); + if (planDate < today) { + return '瓒呮湡'; + } else { + const timeDiff = planDate.getTime() - today.getTime(); + const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24)); + if (daysDiff <= 3) { + return '涓存湡'; + } else { + return '姝e父'; + } + } +}, // 鐐瑰嚮宸ュ崟锛岄�変腑宸ュ崟 setCheckFlag(item) { if (item.checkFlag) { -- Gitblit v1.9.3