index.vue 1.86 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/**
* @Description:  新增项目维护生成按钮
* @author xioln
* @date 2023-09-12
* @FilePath: applications/dee-mes/src/privateComponents/components/GenerateCreateOrproductionButton/index.vue
*/
<template>
  <div class="className">
    <dee-as-com
      ref="oRProduction"
      :lay-config="{
        typeName: 'ORProduction',
        layKey: 'create_orproduction'
      }"
      :basic-data="basicData"
      @on-createGenerate="createGenerate"
    />
  </div>
</template>
<script>
21
import { post, get } from '@/utils/http'
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

export default {
  componentName: '新增项目维护生成按钮',
  name: 'GenerateCreateOrproductionButton',
  components: {},
  props: {
    basicData: {
      type: Object,
      default: () => null
    },
    form: {
      type: Object,
      default: () => null
    }
  },
  data() {
    return {
    }
  },
  computed: {},
42 43 44 45
  mounted() {
    this.$bus.$on('closeDrawer', () => {
      this.$emit('cancel')
    })
46 47 48 49 50 51 52 53 54 55 56 57
  },
  methods: {
    createGenerate(v) {
      const form = this.$refs.oRProduction.$children[0].form
      const params = {
        operator: 'ADD',
        'isValid': 'Y',
        'subTypeName': 'ORProduction',
        'oRProductionUpdateRecords': [],
        'assemblyStartTime': form.assemblyTime[0],
        'assemblyEndTime': form.assemblyTime[1],
        'jobNo': form.jobNo,
58
        'soritesTypeId': form.soritesType,
59
        'aircraftTypeId': form.aircraftTypeId,
60
        'aircraftSortiesId': form.aircraftSorties
61 62 63
      }
      post(`/ORProduction/create`, params).then(res => {
        const id = res.items.id
64
        get(`/MilestonePlan/generate?orProductionId=${id}`).then(res => {
65 66 67 68 69 70 71 72 73 74 75 76 77 78
          this.$util.showMessageSuccess(res.message)
          this.$emit('cancel')
        }).catch((err) => {
          console.log(err)
        })
      }).catch((err) => {
        console.log(err)
      })
    }
  }
}
</script>
<style lang='scss'>
</style>