王震
2023-11-20 540f0fe70b23ddad3ad87cff2be0a29b2eb7115f
Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before
已修改3个文件
320 ■■■■■ 文件已修改
src/api/product/personboard.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/product/workbench/batchproductout-form-new.vue 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/product/workbench/operation-task-pane.vue 266 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/product/personboard.js
@@ -260,6 +260,14 @@
  })
}
export function submitProductMain(obj) {
  return request({
    url: '/mes/product/submitProductMain',
    method: 'post',
    data: obj
  })
}
export function batchSaveProductOutput(obj) {
  return request({
    url: '/mes/product/batchSaveProductOutput',
src/views/product/workbench/batchproductout-form-new.vue
@@ -12,7 +12,7 @@
    title="汇报产出"
    :visible.sync="innerVisible"
    append-to-body
    @close="$emit('update:currshowlist', false)"
    @close="handleClose"
    :show="currshowlist"
    :close-on-click-modal="false"
    class="batch-product-out-form"
@@ -359,6 +359,7 @@
  data() {
    return {
      innerVisible: false,
      staffNameList: [],
      personSelection: [],
      saveDisabled: false,
      currDutyInitproducts: [], // 用于缓存页面中原有的staff产出记录,并且是属于当前班次下的,用于勾选人员时作为原数据参照
@@ -374,6 +375,35 @@
    }
  },
  methods: {
    initProductList(){
      let val = this.personSelection
      //按人员报工
      if(this.groupStatus){
        this.products = []
        this.addProductOutForPerson()
      }else{
        //按组报工
        let nameList = []
        val.forEach(obj=>{
          nameList.push(obj.staffName)
        })
        let staffName = Array.from(new Set(nameList)).join(",")
        if(staffName!=''){
          this.products = this.productList
          this.products.forEach(item=>{
            item.staffName = staffName
          })
        }else{
          this.products = []
        }
      }
    },
    handleClose(){
      this.$emit('update:currshowlist', false)
      this.$nextTick(()=>{
        this.$refs.productOutPersonList.clearSelection()
      })
    },
    isNumber(value) {
      var reg = /^[0-9]+(.[0-9]{1,4})?$/
      if (
@@ -419,6 +449,9 @@
      // 再去与products(此为页面的实时数据,用户有改动即更新)对比,将其中存在的相同人员的生产数量和生产批次同步过来,若products中生产数量或生产批次不存在值,则不进行同步,沿用原来的。
      // 最后,将组装好的选中人员信息,更新到products(按照班次进行),注意更新之后选中人员信息在products位置顺序
      this.personSelection = val
      if(this.currshowlist){
        this.initProductList()
      }
    },
    // 根据选中的人员,生成人员产出信息,并且放在右边列表的最前面
    addProductOutForPerson() {
@@ -502,20 +535,21 @@
        saveProductOuts2() {
            this.clickDateArr.push(new Date().getTime())
            var productOutputList = []
            this.productList.forEach(a=>{
            this.products.forEach(a=>{
                productOutputList.push({
                    partId: a.partId,
                    productQty: a.outNum,
                    outBatchNo: a.outBatchNo,
                    scrapQty: a.scrapQty,
                    remark: a.remark,
          wdr: a.wdr,
                  wdr: a.wdr,
                    staffNo: a.staffNo,
                    staffName: a.staffName,
                    status: a.status,
                    dutyRecordId: a.dutyRecordId,
                    productStaffIds: a.productStaffIds,
                    productStaffs: a.productStaffs
                    productStaffs: a.productStaffs,
                    sortNo: a.sortNo
                })
            })
            var productMains = {
@@ -1055,14 +1089,14 @@
            this.products.push(this.productList[i])
          }
          this.$nextTick(() => {
            this.$refs.productOutPersonList.clearSelection()
            this.$refs.productOutPersonList.toggleAllSelection()
          })
        } else {
          for (let i = 0; i < this.productList.length; i++) {
            this.products.push(this.productList[i])
          }
          this.$nextTick(() => {
            this.$refs.productOutPersonList.clearSelection()
            this.$refs.productOutPersonList.toggleAllSelection()
          })
        }
      }
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)';  // 正常为绿色
//     }
//   }
// },
    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)';  // 正常为绿色
    }
    // 如果不是即将到期或已过期,返回'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 '正常';
    }
  }
},
    // 点击工单,选中工单
    setCheckFlag(item) {
      if (item.checkFlag) {