loulijun2021
2022-10-15 b11d41acf7ba2449cac04982af7e4e58bc3080f1
1.产能规划功能开发基本实现2.维修记录列表静态页面开发完成
已修改8个文件
1401 ■■■■ 文件已修改
src/api/sbgl.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/scgl.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/DatePicker/index.vue 198 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/global.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sbgl/wxjl.vue 654 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/scgl/cngh.vue 473 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/zzmx/wlqd.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/sbgl.js
@@ -315,3 +315,27 @@
    params: data
  })
}
// 设备维修记录查询
export function DeviceUpdateSearch(data) {
  return request({
    url: 'DeviceManager/DeviceUpdateSearch',
    method: 'get',
    params: data
  })
}
// 设备维修记录明细查询
export function DeviceUpdateSubSearch(data) {
  return request({
    url: 'DeviceManager/DeviceUpdateSubSearch',
    method: 'get',
    params: data
  })
}
// 设备维修记录下载
export function DeviceUpdateOutExcel(data) {
  return request({
    url: 'DeviceManager/DeviceUpdateOutExcel',
    method: 'get',
    params: data
  })
}
src/api/scgl.js
@@ -308,3 +308,11 @@
    params: data
  })
}
// 产能规划工作日历选择提交
export function CapacityPlanningGivePlanSubmit(data) {
  return request({
    url: 'ProductionManagement/CapacityPlanningGivePlanSubmit',
    method: 'post',
    data
  })
}
src/components/DatePicker/index.vue
@@ -1,5 +1,5 @@
<template>
  <div v-click-outside onselectstart="return false" style="-moz-user-select : none">
  <div v-click-outside onselectstart="return false" style="-moz-user-select : none;">
    <input type="text" :value="value" :rowData="rowData" class="input__inner">
    <div v-if="isVisible" :class="[{pannel:true},{top_yes:topStyle}]">
      <div class="pannel-nav">
@@ -64,6 +64,7 @@
        }}年{{ dblTime.month + 1 }}月</span><span class="samllText">星期{{ getweekday(handleDatetime(dblDate)) }}</span>
        </div>
        <div class="pannelTo_nav">
          <el-select v-model="schemeDate" size="small" style="width:240px;" @change="changeScheme">
            <el-option v-for="item in projectList" :key="item.CapCode" :value="item.CapCode" :label="item.CapName" />
          </el-select>
@@ -120,7 +121,12 @@
</template>
<script>
import * as funsdates from '@/utils/funsdate'
// import capacityPlanning from '@/api/capacityPlanning'
import {
  CapacityPlanningCalendar,
  CapacityPlanningGivePlanSubmit,
  CapacityPlanningOnclickSelect,
  CapacityPlanningSetupSearch
} from '@/api/scgl'
var time = null
export default {
  directives: {
@@ -147,13 +153,15 @@
  },
  props: {
    value: {
      // type:Date,
      // default:()=> new Date
      type: String,
      type: Array,
      default: null
    },
    defArr: {
      type: Array,
      default: Array
    },
    rowData: {
      type: String,
      type: Object,
      default: null
    },
    CapacityPlanningSearch: {
@@ -161,6 +169,7 @@
      default: null
    }
  },
  data() {
    const { year, month } = funsdates.getYearMonthDay(new Date())
    return {
@@ -181,11 +190,11 @@
      weekDays: ['日', '一', '二', '三', '四', '五', '六'],
      changeTime: '',
      changeTimeArr: [],
      defArr: [],
      // defArr: [],
      dm_top: '',
      topStyle: false,
      form: {
        rows: 100,
        rows: 1000,
        page: 1
      },
      projectDef: []
@@ -209,9 +218,7 @@
      return `${year}-${month + 1}-${day}`
    }
  },
  mounted() {
  },
  mounted() {},
  methods: {
    getDblTime() {
      const { year, month, day } = funsdates.getYearMonthDay(this.dblDate)
@@ -227,13 +234,13 @@
      let name = ''
      if (this.isDblDate(date)) {
        for (const i in this.defArr) {
          if (this.defArr[i].name == this.handleDatetime(date)) {
          if (this.defArr[i].name === this.handleDatetime(date)) {
            code = this.defArr[i].key
          }
        }
      }
      for (const i in this.projectDef) {
        if (this.projectDef[i].CapSetupCode == code) {
        if (this.projectDef[i].CapSetupCode === code) {
          name = this.projectDef[i].CapSetupName
        }
      }
@@ -249,6 +256,7 @@
      }
      const e = event || window.event
      // console.log(e.clientY, 7)
      const nowHeigth = e.clientY
      if (nowHeigth >= 500) {
        this.topStyle = true
@@ -273,13 +281,13 @@
    changeScheme() {
      let toList = []
      for (const i in this.projectList) {
        if (this.schemeDate == this.projectList[i].CapCode) {
        if (this.schemeDate === this.projectList[i].CapCode) {
          toList = this.projectList[i].list
        }
      }
      for (const i in this.defArr) {
        if (this.defArr[i].name == this.changeTime) {
        if (this.defArr[i].name === this.changeTime) {
          this.defArr[i].key = this.schemeDate
        }
      }
@@ -288,13 +296,16 @@
    },
    focus() {
      this.isVisible = true
      this.CapacityPlanningCalendar()
      this.getHeight()
      this.CapacityPlanningSetupSearch()
      this.CapacityPlanningSearch()
    },
    blur() {
      this.isVisible = false
      this.isDbl = false // 右侧面板关闭
      this.isVisible = false// 主面板关闭
      this.$emit('over', true)// 给父组件发出请求,告诉他已经完成操作,可调用获取列表接口
    },
    isCurrentMonth(date) {
      const { year, month } = funsdates.getYearMonthDay(new Date(this.time.year,
@@ -310,33 +321,28 @@
    // 过期时间
    isPastDue(date) {
      const newDate = this.handleDatetime(new Date())
      if (new Date(newDate) > date && this.handleDatetime(date) != newDate) {
        return true
      } else {
        return false
      }
      return new Date(newDate) > date && this.handleDatetime(date) !== newDate
    },
    chooseDate(date) {
      clearTimeout(time) // 首先清除计时器
      time = setTimeout(() => {
        this.time = funsdates.getYearMonthDay(date)
        const timeDate = ''
        // const timeDate = ''
        this.isDbl = false
        // 可以点击的日期
        if (!this.isPastDue(date)) {
          if ((this.value.indexOf(this.handleDatetime(date)) < 0 && this.value != '') || this.value == '') { // 数组添加
          if ((this.value.indexOf(this.handleDatetime(date)) < 0 && this.value !== '') || this.value === '') { // 数组添加
            this.value.push(this.handleDatetime(date)) // 新增到input里
            const data = {
              name: this.handleDatetime(date),
              key: this.rowData.CaptPlanWorkShiftCode
            }
            this.defArr.push(data) // 新增到 默认数组里
          } else if (this.value.indexOf(this.handleDatetime(date)) >= 0) { // 数组减去
            const indexV = this.value.indexOf(this.handleDatetime(date))
            this.value.splice(indexV, 1)
            for (const i in this.defArr) {
              if (this.defArr[i].name == this.handleDatetime(date)) {
              if (this.defArr[i].name === this.handleDatetime(date)) {
                this.defArr.splice(i, 1)
              }
            }
@@ -351,14 +357,15 @@
        this.dblDate = date
        this.isDbl = true
        this.changeTime = this.handleDatetime(date)
        this.CapacityPlanningOnclickSelect({ CaptPlanId: this.rowData.CaptPlanId, DateTime: this.handleDatetime(date) })
        this.CapacityPlanningOnclickSelect({ CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode, captplanid: this.rowData.CaptPlanId, datetime: this.handleDatetime(date) })
        this.getDblTime()
      }
    },
    isDblDate(date) {
      for (const i in this.defArr) {
        if (this.defArr[i].key != '') {
          if (this.defArr[i].name == this.handleDatetime(date) && this.defArr[i].key != this.rowData.CaptPlanWorkShiftCode) {
        if (this.defArr[i].key !== '') {
          if (this.defArr[i].name === this.handleDatetime(date) && this.defArr[i].key !== this.rowData.CaptPlanWorkShiftCode) {
            return true
          }
        }
@@ -418,75 +425,75 @@
    // },
    // 双击请求数据
    CapacityPlanningOnclickSelect(data) {
      // capacityPlanning.CapacityPlanningOnclickSelect(data).then((res) =>{
      //     this.projectList = res.List
      //     for(let i in this.defArr){
      //         if(this.defArr[i].name == data.DateTime){
      //             this.schemeDate = this.defArr[i].key
      //         }
      //     }
      //     this.changeScheme()
      // })
      CapacityPlanningOnclickSelect(data).then((res) => {
        this.projectList = res.data
        // for (const i in this.defArr) {
        //   console.log(this.defArr[i].name === data.DateTime, 6)
        //   if (this.defArr[i].name === data.DateTime) {
        //     this.schemeDate = this.defArr[i].key
        //   }
        // }
        this.schemeDate = data.CaptPlanWorkShiftCode
        this.changeScheme()
      })
    },
    // 工作日历提交
    CapacityPlanningGivePlanSubmit() {
      const data = {
        CaptPlanId: this.rowData.CaptPlanId,
        WkshopCode: this.rowData.CaptPlanWorkShopid,
        CapUnitCode: this.rowData.CaptPlanDeviceTypeid,
        CapSetupCode: this.rowData.CaptPlanWorkShiftCode,
        CaptPlanType: this.rowData.CaptPlanType,
        WorkList: JSON.stringify(this.defArr)
      const formData = new FormData()
      formData.append('CaptPlanId', this.rowData.CaptPlanId)// 产能资源id
      formData.append('WkshopCode', this.rowData.CaptPlanWorkShopid)// 车间编码
      formData.append('CapUnitCode', this.rowData.CaptPlanDeviceTypeid)// 生产单元(产线编码)
      formData.append('CaptSetupCode', '')
      formData.append('CaptPlanType', this.rowData.CaptPlanType)// 产能类型
      console.log(this.defArr, 555)
      formData.append('WorkList', JSON.stringify(this.defArr))
      console.log(formData, 666)
      for (const [a, b] of formData.entries()) {
        console.log(a, ':', b)
      }
      // capacityPlanning.CapacityPlanningGivePlanSubmit(data).then((res) =>{
      //      if (res.statusCode == 300) {
      //         this.$message({
      //        showClose:true,
      //             message: res.message,
      //             type: "error"
      //         });
      //         } else {
      //         this.$message({
      //        showClose:true,
      //             message: res.message,
      //             type: "success"
      //         });
      //         this.blur()
      //         this.CapacityPlanningSearch()
      //         }
      // })
      CapacityPlanningGivePlanSubmit(formData).then(res => {
        if (res.code === '200') {
          this.$message.success('保存成功!')
          this.blur()
          this.CapacityPlanningSearch()
        }
      })
    },
    CapacityPlanningCalendar() {
      // capacityPlanning.CapacityPlanningCalendar({CaptPlanId:this.rowData.CaptPlanId}).then((res) =>{
      //
      //     for(let i in res.List){
      //
      //         if(res.List[i].key == ''){
      //             res.List[i].key = this.rowData.CaptPlanWorkShiftCode
      //         }
      //     }
      //     this.defArr = res.List
      // })
      // const temp = JSON.parse(this.rowData)
      CapacityPlanningCalendar({ captplanid: this.rowData.CaptPlanId }).then((res) => {
        for (const i in res.List) {
          if (res.List[i].key === '') {
            res.List[i].key = this.rowData.CaptPlanWorkShiftCode
          }
        }
        this.defArr = res.List
      })
    },
    closeCapacityPlanningCalendar() {
      // capacityPlanning.CapacityPlanningCalendar({CaptPlanId:this.rowData.CaptPlanId}).then((res) =>{
      //     let nameList = []
      //     for(let i in res.List){
      //          nameList.push(res.List[i].name)
      //         if(res.List[i].key == ''){
      //             res.List[i].key = this.rowData.CaptPlanWorkShiftCode
      //         }
      //     }
      //     for(let i in this.defArr){
      //         for(let j in res.List){
      //         if(this.defArr[i].name == this.changeTime && res.List[j].name == this.changeTime){
      //             this.defArr[i].key = res.List[j].key
      //         } else if(this.defArr[i].name == this.changeTime && nameList.indexOf(this.changeTime)==-1){
      //             this.defArr[i].key = this.rowData.CaptPlanWorkShiftCode
      //         }
      //         }
      //
      //     }
      // })
      CapacityPlanningCalendar({ captplanid: this.rowData.CaptPlanId }).then((res) => {
        const nameList = []
        for (const i in res.List) {
          nameList.push(res.List[i].name)
          if (res.List[i].key === '') {
            res.List[i].key = this.rowData.CaptPlanWorkShiftCode
          }
        }
        for (const i in this.defArr) {
          for (const j in res.List) {
            if (this.defArr[i].name === this.changeTime && res.List[j].name === this.changeTime) {
              this.defArr[i].key = res.List[j].key
            } else if (this.defArr[i].name === this.changeTime && nameList.indexOf(this.changeTime) === -1) {
              this.defArr[i].key = this.rowData.CaptPlanWorkShiftCode
            }
          }
        }
      })
    },
    close() {
      setTimeout(() => {
@@ -495,9 +502,9 @@
      }, 300)
    },
    CapacityPlanningSetupSearch() {
      // capacityPlanning.CapacityPlanningSetupSearch(this.form).then((res) => {
      //   this.projectDef = res.rows
      // })
      CapacityPlanningSetupSearch(this.form).then((res) => {
        this.projectDef = res.rows
      })
    }
  }
@@ -572,6 +579,8 @@
  border-radius: 4px;
  line-height: 30px;
  margin: 5px 0;
  //overflow: visible !important;
  //box-sizing: border-box;
  .pannel-nav {
    position: relative;
@@ -643,7 +652,8 @@
    border-top: 1px solid #E7E7EA;
    padding: 10px;
    overflow: hidden;
    height: 58px;;
    height: 58px;
  }
}
src/router/index.js
@@ -235,6 +235,13 @@
        code: '1028',
        component: () => import('@/views/sbgl/byjl'),
        meta: { code: '1028', title: '保养记录', icon: '', keepAlive: true }
      },
      {
        path: 'wxjl',
        name: 'WXJLCancel',
        code: '1029',
        component: () => import('@/views/sbgl/wxjl'),
        meta: { code: '1029', title: '设备维修记录', icon: '', keepAlive: true }
      }
    ]
  },
src/utils/global.js
@@ -50,6 +50,13 @@
  // return `${y}-${m}-${d}  ${hh}:${mm}:${ss}   ${week}`
  return `${y}-${m}-${d}  ${hh}:${mm}:${ss}`
}
// 时间处理函数   返回 时分
export function handleDatetime3(value) {
  const dt = new Date(value)
  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  return `${hh}:${mm}`
}
// 获取规则生成的编码
export async function getNewEncodingRules(encode) {
src/views/sbgl/wxjl.vue
@@ -1,11 +1,659 @@
<template />
<template>
  <div>
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <!--        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>-->
        <!--        <el-button icon="el-icon-download" @click="upload">导入</el-button>-->
        <el-button type="primary" icon="el-icon-download" @click="download">导出</el-button>
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="100px"
          inline
          style="display: flex;justify-content: space-between"
        >
          <div class="elForm">
            <el-form-item label="设备编码" label-width="70px" style=" display: flex;">
              <el-input v-model="form.eqpcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="设备名称" style=" display: flex;">
              <el-input v-model="form.eqpname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="生产车间" style=" display: flex;">
              <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in wkshopSelectArr"
                  :key="item.org_code"
                  :label="item.org_name"
                  :value="item.org_code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="报修人员" style=" display: flex;">
              <el-input v-model="form.reportuser" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label-width="70px" label="报修时间" style=" display: flex;">
              <el-input v-model="form.repairuser" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="维修人员" style=" display: flex;">
              <el-input v-model="form.vrifcatuser" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="维修时间" style=" display: flex;">
              <el-input v-model="form.reportdate" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="验证人员" style=" display: flex;">
              <el-input v-model="form.repairdate" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item
              v-show="isExpandForm"
              label-width="70px"
              label="验证时间"
              style=" display: flex;align-items: center"
            >
              <el-date-picker
                v-model="form.vrifcatdate"
                type="daterange"
                :clearable="false"
                class="timeMini"
                range-separator="~"
                start-placeholder="开始日期"
                style="width: 200px;display: flex;line-height: 34px ;height: 34px ;"
                end-placeholder="结束日期"
                size="mini"
              />
            </el-form-item>
          </div>
          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened?'5%':'10%'}">
            <el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
        <div
          class="bodyTopFormExpand"
        >
          <svg-icon
            v-show="mouseHoverType==='mouseout'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
            @mouseenter="mouseHoverType=$event.type"
          />
          <svg-icon
            v-show="mouseHoverType==='mouseenter'"
            style="cursor: pointer"
            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
            @click="isExpandForm=!isExpandForm"
            @mouseout="mouseHoverType=$event.type"
          />
        </div>
      </div>
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="isExpandForm?tableHeight:(tableHeight+80)+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+80)+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
        >
          <el-table-column
            prop="RowNum"
            width="50"
            fixed
            label="序号"
          />
          <el-table-column
            prop="repair_code"
            label="维修单号"
            min-width="160"
            sortable="custom"
          />
          <el-table-column
            prop="wksp_name"
            label="所属车间"
            show-tooltip-when-overflow
            min-width="120"
            sortable="custom"
          />
          <el-table-column
            prop="eqp_code"
            width="120"
            label="设备编码"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="eqp_name"
            label="设备名称"
            width="120"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="request_person"
            label="报修人"
            sortable="custom"
            width="100"
          />
          <el-table-column
            prop="request_date"
            label="报修时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            prop="repair_person"
            label="维修人"
            width="100"
            sortable="custom"
          />
          <el-table-column
            prop="repair_date"
            label="维修完成时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            prop="cycleDate"
            label="维修时长"
            width="120"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div>{{ row.cycleDate }} 小时</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="verify_person"
            label="验证人"
            width="100"
            sortable="custom"
          />
          <el-table-column
            prop="verify_date"
            label="验证时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            prop="verify_result"
            label="验证结果"
            width="120"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.verify_result==='通过'" style="display: flex;align-items: center">
                <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: #42b983" />
                通过
              </div>
              <div v-if="row.verify_result==='不通过'" style="display: flex;align-items: center">
                <div style="margin-right: 5px;width:10px;height: 10px;border-radius: 50%;background-color: red" />
                不通过
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="查看记录"
            width="80"
            fixed="right"
          >
            <template slot-scope="{row}">
              <i
                class="el-icon-tickets"
                style="cursor: pointer;color: #42b983;margin-right: 15px"
                @click="edit('edit',row)"
              />
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--分页-->
      <pagination
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="total,prev, pager, next,sizes"
        popper-class="select_bottom"
        @pagination="getDeviceUpdateSearch"
      />
    </div>
    <el-dialog
      :title="operation==='add'?'新增':'维修明细'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="10vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <div style="font-size:16px;">
        <div style="margin-bottom: 20px">
          <i class="el-icon-s-operation" style="color:#42b983;" /> 设备报修信息:
        </div>
        <div style="display: flex;flex-direction: column;margin-left: 40px">
          <div style="margin-bottom: 10px">故障来源:{{ dialogData1.faultsource }}</div>
          <div style="margin-bottom: 10px">故障描述:{{ dialogData1.faultdescr }}</div>
          <div v-if="dialogData1.faultimage" style="display: flex;margin-bottom: 10px">故障图片:
            <div v-for="item in dialogData1.faultimage">
              <img
                style="width: 100px;margin-left: 10px"
                :src="baseUrl+item.img1url"
                alt=""
                @click="handlePictureCardPreview(baseUrl+item.img1url)"
              >
            </div>
          </div>
        </div>
        <div style="margin-bottom: 20px">
          <i class="el-icon-s-operation" style="color:#42b983;" /> 设备维修信息:
        </div>
        <div style="display: flex;flex-direction: column;margin-left: 40px">
          <div style="margin-bottom: 10px">故障描述:{{ dialogData2.faultdescr }}</div>
          <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">故障图片:
            <div v-for="item in dialogData2.repairimage">
              <img
                style="width: 100px;margin-left: 10px"
                :src="baseUrl+item.img1url"
                alt=""
                @click="handlePictureCardPreview(baseUrl+item.img1url)"
              >
            </div>
          </div>
          <div style="margin-bottom: 10px">停机维修:{{ dialogData2.isstoprepair === 'N' ? '否' : '是' }}</div>
          <div v-if="dialogData2.repaircontent" style="margin-bottom: 10px">维修内容:{{ dialogData2.repaircontent }}</div>
          <div v-if="dialogData2.repairpart" style="margin-bottom: 10px">更换备件:{{ dialogData2.repairpart }}</div>
          <div v-if="dialogData2.repairimage" style="display: flex;margin-bottom: 10px">备件图片:
            <div v-for="item in dialogData2.repairimage">
              <img
                style="width: 100px;margin-left: 10px"
                :src="baseUrl+item.img2url"
                alt=""
                @click="handlePictureCardPreview(baseUrl+item.img2url)"
              >
            </div>
          </div>
        </div>
        <div style="margin-bottom: 20px">
          <i class="el-icon-s-operation" style="color:#42b983;" /> 设备维修验证信息:
        </div>
        <div style="display: flex;flex-direction: column;margin-left: 40px">
          <div style="margin-bottom: 10px">验证结果:xxx</div>
        </div>
      </div>
      <!--      图片预览对话框-->
      <el-dialog
        title="图片预览"
        :visible.sync="pictureVisible"
        width="800px"
        append-to-body
        @close="pictureHandleClose"
      >
        <img width="100%" :src="pictureUrl" alt="">
        <span slot="footer" class="dialog-footer">
          <div class="footerButton">
            <el-button @click="pictureVisible=false">返 回</el-button>
          </div>
        </span>
      </el-dialog>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">返 回</el-button>
          <!--          <el-button type="primary" @click="dialogVisibleConfirm">确 定</el-button>-->
        </div>
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker
      ref="importPickerFunc"
      class="importPickerClass"
      :shows.sync="shows"
      :title="title_value"
      :colos="colos"
      :code="code"
    />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import ImportPicker from '@/components/ImportPicker'
import { handleDatetime, validateCode } from '@/utils/global'
import { DeviceRepairTakeOutExcel, DeviceUpdateSearch, DeviceUpdateSubSearch } from '@/api/sbgl'
import { ShopSearch } from '@/api/dzkb'
export default {
  name: 'Wxjl'
  name: 'Zzjg',
  components: {
    Pagination, ImportPicker
  },
  data() {
    return {
      mouseHoverType: 'mouseout',
      isExpandForm: false,
      mainHeight: 0,
      tableHeight: 0,
      form: {
        wkshopcode: '', // 车间编码
        eqpcode: '', // 设备编码
        eqpname: '', // 设备名称
        reportuser: '', // 报修人员
        repairuser: '', // 报修时间
        vrifcatuser: '', // 维修人员
        reportdate: '', // 维修时间
        repairdate: '', // 验证人员
        vrifcatdate: '', // 验证时间
        prop: 'repair_code', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      wkshopSelectArr: [],
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogData1: {},
      dialogData2: {},
      operation: '',
      baseUrl: 'http://121.196.36.24:8001/', // 图片预览地址前缀
      pictureVisible: false, // 图片预览对话框
      pictureUrl: '', // 图片预览Url
      title_value: '数据导入 / 点检部位',
      code: '4',
      shows: false
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getDeviceUpdateSearch()
      }
    }
  },
  created() {
    this.handleRequest()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    handleRequest() {
      this.getDeviceUpdateSearch().then(res => {
        if (res.code === '200') {
          this.getShopSearch()
        }
      })
    },
    async getDeviceUpdateSearch() {
      const res = await DeviceUpdateSearch(this.form)
      this.tableData = res.data
      this.total = res.count
      return { code: res.code }
    },
    // 获取执行车间下拉数组
    async getShopSearch() {
      const { data: res } = await ShopSearch()
      this.wkshopSelectArr = res
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.form.order = order
      this.form.prop = prop
      this.getDeviceUpdateSearch()
    },
    // 查询
    search() {
      this.getDeviceUpdateSearch()
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    },
    // 重置
    reset() {
      this.form.wkshopcode = ''
      this.form.eqpcode = ''
      this.form.eqpname = ''
      this.form.reportuser = ''
      this.form.repairuser = ''
      this.form.vrifcatuser = ''
      this.form.reportdate = ''
      this.form.repairdate = ''
      this.form.vrifcatdate = ''
      this.getDeviceUpdateSearch()
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
    },
    // 修改按钮
    async edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      const { data: res } = await DeviceUpdateSubSearch({ repair_code: row.repair_code })
      this.dialogData1 = res.data1
      this.dialogData2 = res.data2
    },
    handlePictureCardPreview(url) {
      this.pictureVisible = true
      this.pictureUrl = url
    },
    pictureHandleClose() {
      this.pictureUrl = ''
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogData1 = {}
      this.dialogData2 = {}
    },
    async download() {
      // let tempDate = this.form.repairdate
      // if (tempDate.length > 0) {
      //   tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      // }
      // const data = {
      //   wkshopcode: this.form.wkshopcode,
      //   eqpcode: this.form.eqpcode,
      //   eqpname: this.form.eqpname,
      //   stanedname: this.form.stanedname,
      //   repairuser: this.form.repairuser,
      //   repairdate: tempDate,
      //   repairresult: this.form.repairresult
      // }
      // const { data: res } = await DeviceUpdateOutExcel(data)
      // window.location.href = res
    },
    // 对话框取消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // 对话框确认
    dialogVisibleConfirm() {
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 295
        this.$refs.tableDataRef.doLayout()
      })
    },
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
    }
  }
}
</script>
<style scoped>
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-range__icon {
  line-height: 28px !important;
}
::v-deep .el-range-separator {
  line-height: 28px !important;
}
::v-deep .el-range-input {
  font-size: 14px;
}
::v-deep .el-range-separator {
  display: flex;
  justify-content: center;
  align-items: center;
}
::v-deep .el-button--text {
  font-size: 14px;
  cursor: pointer;
}
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
  color: $main_color;
  cursor: pointer;
}
.el-icon-edit-outline {
  margin-right: 15px;
}
::v-deep .el-button--primary, .el-button--default, .el-button--info {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 15px;
}
::v-deep .el-button--primary {
  //background-color: $main_color !important;
}
::v-deep .el-button--default {
  background-color: #f8f8fa;
  border: none;
}
::v-deep .el-input__inner {
  height: 34px;
  line-height: 34px;
  //color: #a7a7a7;
}
::v-deep .el-dialog__body {
  //padding: 20px 100px !important;
  padding: 20px !important;
}
::v-deep .dialogVisibleRoles .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .importPickerClass .el-dialog__body {
  padding: 20px 20px !important;
}
::v-deep .el-dialog__footer {
  display: flex;
  justify-content: flex-end;
}
::v-deep .el-table .caret-wrapper {
  transform: scale(0.8);
}
::v-deep .cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
::v-deep .el-table::before {
  height: 0;
}
::v-deep .el-table__body-wrapper {
  background-color: #f8f8fa;
}
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-form--inline .el-form-item__label {
  color: #a7a7a7;
}
.body ::v-deep .el-divider {
  border: 1px solid #eee;
  width: 99%;
  margin: 10px auto;
}
.body ::v-deep .el-form-item {
  margin-bottom: 0;
}
.userDialogVisible ::v-deep .el-form-item {
  margin-bottom: 0;
}
::v-deep .el-select__caret {
  display: flex;
  align-items: center;
  justify-content: center;
}
.tableFixed {
  ::v-deep .el-table__fixed-right {
    height: 100% !important;
  }
  ::v-deep .el-table__fixed {
    height: 100% !important;
  }
}
</style>
<style>
.el-table .custom-row {
  background: #f8f8fa;
}
</style>
src/views/scgl/cngh.vue
@@ -67,7 +67,7 @@
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          class="tableFixed table_only"
          :data="tableData"
          :style="{width: 100+'%',height:tableHeight+'px'}"
          border
@@ -120,6 +120,7 @@
            prop="CaptPlanShopCalendarList"
            label="工作日历"
            sortable="custom"
            min-width="300"
          >
            <template slot-scope="{row}">
              <date-picker
@@ -127,6 +128,7 @@
                :row-data="row"
                style="width: 100%;"
                :capacity-planning-search="CapacityPlanningSearch"
                @over="over"
              />
            </template>
          </el-table-column>
@@ -134,7 +136,7 @@
            prop="CaptPlanUser"
            label="创建人员"
            sortable="custom"
            width="160"
            width="120"
          />
          <el-table-column
            prop="CaptPlanDate"
@@ -145,7 +147,7 @@
          <el-table-column
            prop="CaptPlanStus"
            width="160"
            width="120"
            label="有效状态"
            sortable="custom"
          >
@@ -161,23 +163,6 @@
              <div v-else>/</div>
            </template>
          </el-table-column>
          <!--          <el-table-column-->
          <!--            label="操作"-->
          <!--            width="120"-->
          <!--            fixed="right"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div class="operationClass">-->
          <!--                <el-tooltip class="item" effect="dark" content="编辑" placement="top">-->
          <!--                  <i class="el-icon-edit-outline" @click="edit('edit',row)" />-->
          <!--                </el-tooltip>-->
          <!--                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">-->
          <!--                  <i class="el-icon-delete" @click="del(row)" />-->
          <!--                </el-tooltip>-->
          <!--              </div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
        </el-table>
      </div>
      <!--分页-->
@@ -195,7 +180,7 @@
    <el-dialog
      :title="operation==='setting'?'设置':'默认方案'"
      :visible.sync="dialogVisible"
      width="1280px"
      width="1360px"
      :close-on-click-modal="false"
      top="10vh"
      @closed="handleClose"
@@ -215,7 +200,6 @@
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
        >
          <el-table-column
            v-if="operation!=='setting'"
            width="50"
@@ -223,123 +207,165 @@
          >
            <template slot-scope="{row}">
              <el-radio
                v-model="radioSelectedId"
                :label="row.hx"
                v-model="radioSelectedCode"
                :label="row.code"
                style="padding-left: 10px;"
                @change.native="getCurrentRowSource(row.hx)"
                @change.native="getCurrentRowSource(row.code)"
              />
            </template>
          </el-table-column>
          <el-table-column
            prop="famc"
            prop="code"
            label="方案编码"
            width="100"
            fixed
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">{{ row.code }}</div>
              <el-input v-else v-model="row.code" placeholder="请输入" type="text" />
            </template>
          </el-table-column>
          <el-table-column
            prop="name"
            label="方案名称"
            width="150"
            fixed
            show-tooltip-when-overflow
          >
            <template slot-scope="{row}">
              <el-input v-model="row.famc" :disabled="row.isVisible===0" type="text" />
              <div v-if="row.isVisible===0">{{ row.name }}</div>
              <el-input v-else v-model="row.name" placeholder="请输入" type="text" />
            </template>
          </el-table-column>
          <el-table-column
            prop="gzsc"
            prop="duration"
            label="工作时长"
            width="100"
            show-tooltip-when-overflow
          />
          >
            <template slot-scope="{row}">
              <div>{{ row.duration ? parseFloat(row.duration.toFixed(2)) : '0' }} 小时</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="time1"
            prop="wktme1_start"
            label="工作时间一"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">
                <div v-if="row.wktme1_start">{{ row.wktme1_start }}</div>
                <div v-else>/</div>
              </div>
              <el-time-picker
                v-model="row.time1"
                v-else
                v-model="row.wktme1_start"
                is-range
                :disabled="row.isVisible===0"
                :editable="false"
                :clearable="false"
                range-separator="~"
                start-placeholder="开始"
                end-placeholder="结束"
                format="HH:mm"
                @focus="val=>getTime(val,row,'time1')"
                @focus="val=>getTime(val,row,'wktme1_start')"
              />
            </template>
          </el-table-column>
          <el-table-column
            prop="time2"
            prop="wktme2_start"
            label="工作时间二"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">
                <div v-if="row.wktme2_start">{{ row.wktme2_start }}</div>
                <div v-else>/</div>
              </div>
              <el-time-picker
                v-model="row.time2"
                v-else-if="row.isVisible===1"
                v-model="row.wktme2_start"
                is-range
                :disabled="row.isVisible===0"
                :disabled="row.wktme1_start.length===0"
                :editable="false"
                :clearable="false"
                range-separator="~"
                start-placeholder="开始"
                end-placeholder="结束"
                format="HH:mm"
                @focus="val=>getTime(val,row,'time2')"
                @focus="val=>getTime(val,row,'wktme2_start')"
              />
            </template>
          </el-table-column>
          <el-table-column
            prop="time3"
            prop="wktme3_start"
            label="工作时间三"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">
                <div v-if="row.wktme3_start">{{ row.wktme3_start }}</div>
                <div v-else>/</div>
              </div>
              <el-time-picker
                v-model="row.time3"
                v-else-if="row.isVisible===1"
                v-model="row.wktme3_start"
                is-range
                :disabled="row.wktme2_start.length===0"
                :editable="false"
                :disabled="row.isVisible===0"
                :clearable="false"
                format="HH:mm"
                range-separator="~"
                start-placeholder="开始"
                end-placeholder="结束"
                @focus="val=>getTime(val,row,'time3')"
                @focus="val=>getTime(val,row,'wktme3_start')"
              />
            </template>
          </el-table-column>
          <el-table-column
            prop="time4"
            prop="wktme4_start"
            label="工作时间四"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">
                <div v-if="row.wktme4_start">{{ row.wktme4_start }}</div>
                <div v-else>/</div>
              </div>
              <el-time-picker
                v-model="row.time4"
                v-else-if="row.isVisible===1"
                v-model="row.wktme4_start"
                is-range
                :disabled="row.wktme3_start.length===0"
                format="HH:mm"
                :editable="false"
                :disabled="row.isVisible===0"
                :clearable="false"
                :editable="false"
                range-separator="~"
                start-placeholder="开始"
                end-placeholder="结束"
                @focus="val=>getTime(val,row,'time4')"
                @focus="val=>getTime(val,row,'wktme4_start')"
              />
            </template>
          </el-table-column>
          <el-table-column
            prop="time5"
            prop="wktme5_start"
            label="工作时间五"
          >
            <template slot-scope="{row}">
              <div v-if="row.isVisible===0">
                <div v-if="row.wktme5_start">{{ row.wktme5_start }}</div>
                <div v-else>/</div>
              </div>
              <el-time-picker
                v-model="row.time5"
                :disabled="row.isVisible===0"
                v-else-if="row.isVisible===1"
                v-model="row.wktme5_start"
                is-range
                :disabled="row.wktme4_start.length===0"
                :clearable="false"
                :editable="false"
                format="HH:mm"
                :clearable="false"
                range-separator="~"
                start-placeholder="开始"
                end-placeholder="结束"
                @focus="val=>getTime(val,row,'time5')"
                @focus="val=>getTime(val,row,'wktme5_start')"
              />
            </template>
          </el-table-column>
@@ -351,9 +377,9 @@
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-button v-if="row.isVisible===0" type="text" @click="editRow(row)">编辑</el-button>
                <el-button v-if="row.isVisible===0" type="text" @click="delRow(row)">删除</el-button>
                <el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">保存</el-button>
                <el-button v-if="row.isVisible===1" type="text" @click="cancelRow(row)">取消</el-button>
              </div>
            </template>
          </el-table-column>
@@ -362,39 +388,35 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancel">返 回</el-button>
          <el-button v-if="operation!=='setting'" type="primary" @click="dialogVisibleConfirm">确 定</el-button>
          <el-button
            v-if="operation!=='setting'"
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >确 定</el-button>
        </div>
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker
      ref="importPickerFunc"
      class="importPickerClass"
      :shows.sync="shows"
      :title="title_value"
      :colos="colos"
      :code="code"
    />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import ImportPicker from '@/components/ImportPicker'
import { validateCode } from '@/utils/global'
import $ from 'jquery'
import DatePicker from '@/components/DatePicker'
import { CapacityPlanningSearch } from '@/api/scgl'
import {
  CapacityPlanningSearch,
  CapacityPlanningSetupAddUpdate,
  CapacityPlanningSetupDelete,
  CapacityPlanningSetupSearch, CapacityPlanSubmit
} from '@/api/scgl'
import { DeviceTypeSelect, WorkShopSelect } from '@/api/sbgl'
import { handleDatetime3 } from '@/utils/global'
export default {
  name: 'Zzjg',
  components: {
    Pagination, ImportPicker, DatePicker
    Pagination, DatePicker
  },
  data() {
    return {
@@ -419,14 +441,7 @@
      devicetypeArr: [],
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        // OrgType: '',
        // OrgCode: '',
        // OrgName: '',
        // SupUnit: ''// 上级单位
      },
      operation: '',
      pickerOptions: {
        disabledDate(time) {
@@ -436,82 +451,80 @@
          // return time.getTime() < Date.now(); // 不可选历史天、不可选当前天、可选未来天
        }
      },
      popoverVisible: false,
      available: null,
      nextMonth: null,
      tableDataDialog: [
        // {
        //   famc: '方案一',
        //   gzsc: '8小时',
        //   time1: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
        //   time2: '',
        //   time3: '',
        //   time4: '',
        //   time5: ''
        // }
      ],
      radioSelectedId: '',
      title_value: '数据导入 / 点检部位',
      code: '4',
      shows: false
      tableDataDialog: [],
      radioSelectedCode: '',
      tempObj: {} // 临时对象,默认方案提交时使用
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getCapacityPlanningSearch()
      }
    }
  },
  created() {
    this.handleRequest()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
    this.handleRequest()
    // this.getDialogData()
  },
  methods: {
    getCurrentRowSource() {
    // 子组件失焦时执行
    over(val) {
      if (val) {
        // console.log(val)
        this.getCapacityPlanningSearch()
      }
    },
    getDialogData() {
      let number = Math.random() * Math.random()// 作为删除时的标识符
      number = number === 0 ? (10 + Math.random()) : number
      this.tableDataDialog.push(
        {
          hx: 1,
          famc: '方案一',
          gzsc: '8小时',
          time1: [],
          time2: [],
          time3: [],
          time4: [],
          time5: [],
          number,
          isVisible: 0
        }
      )
    getCurrentRowSource(code) {
      this.radioSelectedCode = code
    },
    async getDialogData() {
      const { data: res } = await CapacityPlanningSetupSearch()
      this.tableDataDialog = res
      this.tableDataDialog.forEach(item => {
        let number = Math.random() * Math.random()// 作为删除时的标识符
        number = number === 0 ? (10 + Math.random()) : number
        item.number = number
        item.isVisible = 0
        item.duration = this.computingTime(item.wktme1_start, item.wktme2_start, item.wktme3_start, item.wktme4_start, item.wktme5_start)
      })
    },
    // 计算时间的方法  返回 多少小时
    computingTime(time1, time2, time3, time4, time5) {
      //   转成分钟计算
      const second1 = time1 ? calcTime(time1) : null
      const second2 = time2 ? calcTime(time2) : null
      const second3 = time3 ? calcTime(time3) : null
      const second4 = time4 ? calcTime(time4) : null
      const second5 = time5 ? calcTime(time5) : null
      return (second1 + second2 + second3 + second4 + second5) / 60
      // 两个时间差值  转化为分钟数
      function calcTime(val) {
        return (parseInt(val.split('~')[1].split(':')[0]) * 60 + parseInt(val.split('~')[1].split(':')[1])) - (parseInt(val.split('~')[0].split(':')[0]) * 60 + parseInt(val.split('~')[0].split(':')[1]))
      }
    },
    getTime(val, row, belong) {
      const res = this.getDt()
      if (belong === 'time1') {
        // row.time1.push(new Date(res.yyyy, res.MM, res.dd, '00', '00'))
        row.time1 = row.time1.length > 0 ? row.time1 : row.time1.push(new Date())
      } else if (belong === 'time2') {
        row.time2 = row.time2.length > 0 ? row.time2 : row.time2.push(new Date())
      } else if (belong === 'time3') {
        row.time3 = row.time3.length > 0 ? row.time3 : row.time3.push(new Date())
      } else if (belong === 'time4') {
        row.time4 = row.time4.length > 0 ? row.time4 : row.time4.push(new Date())
      } else if (belong === 'time5') {
        row.time5 = row.time5.length > 0 ? row.time5 : row.time5.push(new Date())
      // const res = this.getDt()
      if (belong === 'wktme1_start') {
        // row.wktme1_start.push(new Date(res.yyyy, res.MM, res.dd, '00', '00'))
        row.wktme1_start = row.wktme1_start.length > 0 ? row.wktme1_start : row.wktme1_start.push(new Date())
      } else if (belong === 'wktme2_start') {
        row.wktme2_start = row.wktme2_start.length > 0 ? row.wktme2_start : row.wktme2_start.push(new Date())
      } else if (belong === 'wktme3_start') {
        row.wktme3_start = row.wktme3_start.length > 0 ? row.wktme3_start : row.wktme3_start.push(new Date())
      } else if (belong === 'wktme4_start') {
        row.wktme4_start = row.wktme4_start.length > 0 ? row.wktme4_start : row.wktme4_start.push(new Date())
      } else if (belong === 'wktme5_start') {
        row.wktme5_start = row.wktme5_start.length > 0 ? row.wktme5_start : row.wktme5_start.push(new Date())
      }
      const duration = this.computingTime(handleDatetime3(row.wktme1_start[0]) + '~' + handleDatetime3(row.wktme1_start[1]),
        row.wktme2_start.length !== 0 ? handleDatetime3(row.wktme2_start[0]) + '~' + handleDatetime3(row.wktme2_start[1]) : null,
        row.wktme3_start.length !== 0 ? handleDatetime3(row.wktme3_start[0]) + '~' + handleDatetime3(row.wktme3_start[1]) : null,
        row.wktme4_start.length !== 0 ? handleDatetime3(row.wktme4_start[0]) + '~' + handleDatetime3(row.wktme4_start[1]) : null,
        row.wktme5_start.length !== 0 ? handleDatetime3(row.wktme5_start[0]) + '~' + handleDatetime3(row.wktme5_start[1]) : null)
      row.duration = parseFloat(duration.toFixed(2))
      console.log(row.duration)
    },
    getDt() {
      const dt = new Date()
@@ -527,31 +540,94 @@
      return { yyyy: y, MM: m, dd: d, hh, mm }
    },
    addRow() {
      const temp = this.tableDataDialog.find(item => item.isVisible === 1)
      if (temp) {
        return this.$message.info('请先保存上一条记录!')
      }
      let number = Math.random() * Math.random()// 作为删除时的标识符
      number = number === 0 ? (10 + Math.random()) : number
      this.tableDataDialog.push(
        {
          hx: 2,
          famc: '方案xxx',
          gzsc: '8小时',
          time1: [],
          time2: [],
          time3: [],
          time4: [],
          time5: [],
          isVisible: 1
          RowNum: 2,
          code: '',
          name: '',
          duration: '',
          wktme1_start: [],
          wktme2_start: [],
          wktme3_start: [],
          wktme4_start: [],
          wktme5_start: [],
          isVisible: 1,
          number
        }
      )
    },
    editRow(row) {
      console.log(row)
      row.isVisible = 1
    cancelRow(row) {
      this.tableDataDialog.forEach((item, index) => {
        if (row.number === item.number) {
          this.tableDataDialog.splice(index, 1)
        }
      })
    },
    saveRow(row) {
      row.isVisible = 0
    },
    delRow(row) {
    async saveRow(row) {
      if (row.code.trim().toString().length === 0) {
        return this.$message.info('方案编码不能为空!')
      }
      if (row.name.trim().toString().length === 0) {
        return this.$message.info('方案名称不能为空!')
      }
      if (row.wktme1_start.length === 0) {
        return this.$message.info('工作时间不能为空,保存失败!')
      }
      // 保存时需要先判断工作时间后面的不能小于前面的
      // 先取出来存转化成分钟存成数组进行大小对比
      if (calcTime(handleDatetime3(row.wktme1_start[1]), handleDatetime3(row.wktme2_start[0]))) {
        return this.$message.info('工作时间二的开始时间小于了工作时间一的结束时间,保存失败!')
      }
      if (calcTime(handleDatetime3(row.wktme2_start[1]), handleDatetime3(row.wktme3_start[0]))) {
        return this.$message.info('工作时间三的开始时间小于了工作时间二的结束时间,保存失败!')
      }
      if (calcTime(handleDatetime3(row.wktme3_start[1]), handleDatetime3(row.wktme4_start[0]))) {
        return this.$message.info('工作时间四的开始时间小于了工作时间三的结束时间,保存失败!')
      }
      if (calcTime(handleDatetime3(row.wktme4_start[1]), handleDatetime3(row.wktme5_start[0]))) {
        return this.$message.info('工作时间五的开始时间小于了工作时间四的结束时间,保存失败!')
      }
      const Duration = this.computingTime(handleDatetime3(row.wktme1_start[0]) + '~' + handleDatetime3(row.wktme1_start[1]),
        row.wktme2_start.length !== 0 ? handleDatetime3(row.wktme2_start[0]) + '~' + handleDatetime3(row.wktme2_start[1]) : null,
        row.wktme3_start.length !== 0 ? handleDatetime3(row.wktme3_start[0]) + '~' + handleDatetime3(row.wktme3_start[1]) : null,
        row.wktme4_start.length !== 0 ? handleDatetime3(row.wktme4_start[0]) + '~' + handleDatetime3(row.wktme4_start[1]) : null,
        row.wktme5_start.length !== 0 ? handleDatetime3(row.wktme5_start[0]) + '~' + handleDatetime3(row.wktme5_start[1]) : null)
      const data = {
        CapSetupCode: row.code,
        CapSetupName: row.name,
        OneStartDate: row.wktme1_start.length !== 0 ? handleDatetime3(row.wktme1_start[0]) + '~' + handleDatetime3(row.wktme1_start[1]) : '',
        TwoStartDate: row.wktme2_start.length !== 0 ? handleDatetime3(row.wktme2_start[0]) + '~' + handleDatetime3(row.wktme2_start[1]) : '',
        ThreeStartDate: row.wktme3_start.length !== 0 ? handleDatetime3(row.wktme3_start[0]) + '~' + handleDatetime3(row.wktme3_start[1]) : '',
        FourStartDate: row.wktme4_start.length !== 0 ? handleDatetime3(row.wktme4_start[0]) + '~' + handleDatetime3(row.wktme4_start[1]) : '',
        FiveStartDate: row.wktme5_start.length !== 0 ? handleDatetime3(row.wktme5_start[0]) + '~' + handleDatetime3(row.wktme5_start[1]) : '',
        Duration: parseFloat(Duration.toFixed(2))
      }
      const res = await CapacityPlanningSetupAddUpdate({ capacitylist: [data] })
      if (res.code === '200') {
        await this.getDialogData()
      }
      // 如果时间段二的开始时间小于时间段一的结束时间  则返回true,并且提示用户保存不了
      function calcTime(time1, time2) {
        const temp1 = parseInt(time1.split(':')[0]) * 60 + parseInt(time1.split(':')[1])
        const temp2 = parseInt(time2.split(':')[0]) * 60 + parseInt(time2.split(':')[1])
        return temp2 < temp1
      }
    },
    CapacityPlanningSearch() {
    async delRow(row) {
      const res = await CapacityPlanningSetupDelete({ capsetupcode: row.code })
      if (res.code === '200') {
        await this.getDialogData()
      }
    },
    async  CapacityPlanningSearch() {
    },
    handleRequest() {
@@ -581,10 +657,11 @@
      this.devicetypeArr = res
    },
    mrfaSearch(row, operation) {
      console.log(row)
      this.operation = operation
      this.dialogVisible = true
      this.tempObj = row
      this.radioSelectedCode = row.CaptPlanWorkShiftCode
      this.getDialogData()
      this.$nextTick(() => {
        this.$refs.tableDataDialogRef.doLayout()
      })
@@ -606,14 +683,6 @@
    search() {
      this.getCapacityPlanningSearch()
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    },
    // 重置
    reset() {
      this.form.workshop = ''
@@ -624,54 +693,16 @@
    setting(operation) {
      this.operation = operation
      this.dialogVisible = true
      this.getDialogData()
      this.$nextTick(() => {
        this.$refs.tableDataDialogRef.doLayout()
      })
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
    },
    // 修改按钮
    edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      this.$nextTick(() => {
        this.dialogForm.OrgCode = row.org_code
        this.dialogForm.OrgName = row.org_name
        this.dialogForm.SupUnit = row.parent_id
      })
    },
    // 删除按钮
    async del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteOrganization({ orgid: row.code }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
            this.getCapacityPlanningSearch()
          }
        })
      }).catch(() => {
        this.$message.info('已取消删除')
      })
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.OrgType = ''
      this.dialogForm.OrgCode = ''
      this.dialogForm.OrgName = ''
      this.dialogForm.SupUnit = ''
      this.$refs.dialogForm.clearValidate()
      this.radioSelectedCode = ''
      this.tempObj = {}
      this.tableDataDialog = []
    },
    // 对话框取消
    dialogVisibleCancel() {
@@ -679,7 +710,21 @@
    },
    // 对话框确认
    dialogVisibleConfirm() {
      this.dialogVisible = false
      const data = {
        wkshopcode: this.tempObj.CaptPlanWorkShopid,
        capunitcode: this.tempObj.CaptPlanDeviceTypeid,
        captplanid: this.tempObj.CaptPlanId ? this.tempObj.CaptPlanId : '',
        capsetupcode: this.radioSelectedCode,
        captplantype: this.tempObj.CaptPlanType
      }
      this.$store.state.app.buttonIsDisabled = true
      CapacityPlanSubmit(data).then(res => {
        if (res.code === '200') {
          this.dialogVisible = false
          this.$store.state.app.buttonIsDisabled = false
          this.getCapacityPlanningSearch()
        }
      })
    },
    // 获取页面高度
    getHeight() {
@@ -833,4 +878,12 @@
.el-table .custom-row {
  background: #f8f8fa;
}
/*为了让面板在超出区域可显示*/
.el-table__body-wrapper{
  overflow: visible !important
}
.table_only{
overflow: visible !important
}
</style>
src/views/zzmx/wlqd.vue
@@ -15,7 +15,7 @@
          style="display: flex;justify-content: space-between"
        >
          <div class="elForm">
            <el-form-item label-width="70px" label="母件编码" style=" display: flex;">
            <el-form-item label="母件编码" style=" display: flex;">
              <el-input v-model="form.parentpartcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="母件名称" style=" display: flex;">
@@ -34,7 +34,7 @@
                />
              </el-select>
            </el-form-item>
            <el-form-item v-show="isExpandForm" label-width="70px" label="版本编号" style=" display: flex;">
            <el-form-item v-show="isExpandForm" label="版本编号" style=" display: flex;">
              <el-input v-model="form.version" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="创建人员" style=" display: flex;">
@@ -503,7 +503,13 @@
          width="110"
        >
          <template slot-scope="{row}">
            <el-select v-if="row.isVisible===1" v-model="row.PN_TYPE" placeholder="请选择">
            <el-select
              v-if="row.isVisible===1"
              v-model="row.PN_TYPE"
              :disabled="row.PN_TYPE==='Z'"
              placeholder="请选择"
              @change="val=>changeType(val,row)"
            >
              <el-option
                v-for="item in sxArr"
                :key="item.code"
@@ -522,7 +528,7 @@
        >
          <template slot-scope="{row}">
            <div class="operationClass">
              <el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">保存</el-button>
              <el-button v-if="row.isVisible===1" type="text" @click="saveRow(row)">确定</el-button>
              <el-button v-if="row.isVisible===1" type="text" @click="cancelRow(row)">取消</el-button>
              <el-button v-if="row.isVisible===0" type="text" @click="editRow(row)">编辑</el-button>
              <el-button v-if="row.isVisible===0" type="text" @click="delRow(row)">删除</el-button>
@@ -541,7 +547,7 @@
            :disabled="$store.state.app.buttonIsDisabled"
            type="primary"
            @click="dialogVisibleConfirm"
          >确 定</el-button>
          >保存</el-button>
        </div>
      </span>
    </el-dialog>
@@ -858,6 +864,12 @@
      //   this.PartSelectArr.splice(index, 1)
      // })
    },
    // 物料清单属性类型值改变时触发
    changeType(val, row) {
      this.dialogTableDataArr.forEach(item => {
        item.PN_TYPE = item.SMATERIRL_CODE === row.SMATERIRL_CODE ? 'Z' : 'F'
      })
    },
    addDialog() {
      if (this.dialogTableDataArr.find(item => item.isVisible === 1)) {
        return this.$message.info('请先保存本条记录!')
@@ -876,7 +888,7 @@
        BASE_QUANTITY: '',
        LOSS_QUANTITY: '',
        TOTAL_QUANTITY: '',
        PN_TYPE: ''
        PN_TYPE: this.dialogTableDataArr.length === 0 ? 'Z' : 'F'
      })
    },
    saveRow(row) {
@@ -905,6 +917,10 @@
      })
    },
    delRow(row) {
      if (row.PN_TYPE === 'Z') {
        return this.$message.info('主料不可删除!')
      }
      this.PartSelectArrAll.forEach(item => {
        if (item.partcode === row.SMATERIRL_CODE) {
          this.PartSelectArr.unshift(item)
@@ -981,7 +997,7 @@
            worklist: this.dialogTableDataArr,
            opertype: this.operation === 'add' ? 'Add' : 'Update'
          }
          console.log(data, 89)
          this.$store.state.app.buttonIsDisabled = true
          AddUpdateBoIventory(data).then(res => {
            if (res.code === '200') {