loulijun2021
2022-10-17 d3129c5d9af88192c43e7d2a529adf68f7433d9e
src/components/DatePicker/index.vue
@@ -127,6 +127,7 @@
  CapacityPlanningOnclickSelect,
  CapacityPlanningSetupSearch
} from '@/api/scgl'
var time = null
export default {
  directives: {
@@ -168,6 +169,7 @@
      type: Function,
      default: null
    }
  },
  data() {
@@ -198,6 +200,7 @@
        page: 1
      },
      projectDef: []
    }
  },
  computed: {
@@ -218,7 +221,8 @@
      return `${year}-${month + 1}-${day}`
    }
  },
  mounted() {},
  mounted() {
  },
  methods: {
    getDblTime() {
      const { year, month, day } = funsdates.getYearMonthDay(this.dblDate)
@@ -297,7 +301,7 @@
    focus() {
      this.isVisible = true
      this.CapacityPlanningCalendar()
      this.getCapacityPlanningCalendar()
      this.getHeight()
      this.CapacityPlanningSetupSearch()
      this.CapacityPlanningSearch()
@@ -332,6 +336,9 @@
        // 可以点击的日期
        if (!this.isPastDue(date)) {
          if ((this.value.indexOf(this.handleDatetime(date)) < 0 && this.value !== '') || this.value === '') { // 数组添加
            if (typeof this.value === 'string') {
              this.value = this.value.split(',')
            }
            this.value.push(this.handleDatetime(date)) // 新增到input里
            const data = {
              name: this.handleDatetime(date),
@@ -340,6 +347,9 @@
            this.defArr.push(data) // 新增到 默认数组里
          } else if (this.value.indexOf(this.handleDatetime(date)) >= 0) { // 数组减去
            const indexV = this.value.indexOf(this.handleDatetime(date))
            if (typeof this.value === 'string') {
              this.value = this.value.split(',')
            }
            this.value.splice(indexV, 1)
            for (const i in this.defArr) {
              if (this.defArr[i].name === this.handleDatetime(date)) {
@@ -358,7 +368,11 @@
        this.isDbl = true
        this.changeTime = this.handleDatetime(date)
        this.CapacityPlanningOnclickSelect({ CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode, captplanid: this.rowData.CaptPlanId, datetime: this.handleDatetime(date) })
        this.CapacityPlanningOnclickSelect({
          CaptPlanWorkShiftCode: this.rowData.CaptPlanWorkShiftCode,
          captplanid: this.rowData.CaptPlanId,
          datetime: this.handleDatetime(date)
        })
        this.getDblTime()
      }
    },
@@ -443,19 +457,15 @@
    // 工作日历提交
    CapacityPlanningGivePlanSubmit() {
      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)
      }
      formData.append('wkshopcode', this.rowData.CaptPlanWorkShopid)// 车间编码
      formData.append('capunitcode', this.rowData.CaptPlanDeviceTypeid)// 生产单元编码(产线编码)
      formData.append('captplanid', this.rowData.CaptPlanId)// 产能资源id
      formData.append('capsetupcode', this.rowData.CaptPlanWorkShiftCode) // 默认方案编码
      formData.append('captplantype', this.rowData.CaptPlanType)// 资源类型
      formData.append('worklist', JSON.stringify(this.defArr))// 工作日历数据集
      // for (const [a, b] of formData.entries()) {
      //   console.log(a, ':', b)
      // }
      CapacityPlanningGivePlanSubmit(formData).then(res => {
        if (res.code === '200') {
          this.$message.success('保存成功!')
@@ -464,15 +474,9 @@
        }
      })
    },
    CapacityPlanningCalendar() {
      // const temp = JSON.parse(this.rowData)
    getCapacityPlanningCalendar() {
      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
        this.defArr = res.data
      })
    },
    closeCapacityPlanningCalendar() {