ECR-workflow.vue 6.13 KB
Newer Older
wangdanlei's avatar
wangdanlei committed
1 2 3
<template>
  <div ref="ECR-workflow" class="ECR-workflow-com">
    <!-- ECA技术影响评估 -->
wangdanlei's avatar
wangdanlei committed
4
    <div v-if="workflowNode === 'ECA技术影响评估'" class="workflownode">
wangdanlei's avatar
wangdanlei committed
5 6 7 8
      <span>更改规划:</span>
      <span class="link-style" @click="handleEditECR()">{{ workflowname }}</span>
    </div>
    <!-- ECR确定更改类型 -->
wangdanlei's avatar
wangdanlei committed
9
    <div v-else-if="workflowNode === '确定更改类型'" style="margin-top: 22px;width:100%">
wangdanlei's avatar
wangdanlei committed
10 11 12 13 14 15 16 17
      <dee-form
        ref="form"
        :form="form"
        :form-data="propFormData"
        :rules="rules"
      />
    </div>
    <!-- ECR审核 -->
wangdanlei's avatar
wangdanlei committed
18
    <div v-else-if="workflowNode === 'ECR审核'" class="workflownode">
wangdanlei's avatar
wangdanlei committed
19 20 21 22
      <span>确定受影响对象:</span>
      <span class="link-style" @click="handleEditECR()">{{ workflowname }}</span>
    </div>
    <!-- ECR提交签审 -->
wangdanlei's avatar
wangdanlei committed
23
    <div v-else-if="workflowNode === 'ECR提交审核'" class="workflownode">
wangdanlei's avatar
wangdanlei committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
      <span>编辑ECR:</span>
      <span class="link-style" @click="handleEditECR()">{{ workflowname }}</span>
    </div>
  </div>
</template>

<script>
import { saveModel } from '@/api/workflow/config'
export default {
  name: 'ECRWorkflow',
  components: { },
  props: {
    basicData: {
      type: Object,
      default: null
    }
  },
  data() {
    return {
      form: {
        changeType: '',
        // ChangeType1: '',
        nonrecurringCost: '',
        recurringCost: ''
      },
      rules: {
        nonrecurringCost: [
          { required: true, message: '请输入非经常性成本估算', trigger: 'change' }
        ],
        recurringCost: [
          { required: true, message: '请输入经常性成本估算', trigger: 'change' }
        ]
      },
      prOptions: [],
      problemOptions: [],
      tableColums: [
        { title: 'CA编号', key: 'number', align: 'center', component: {
          render: (h, params) => {
            return h('div', [
              h('span', {
                class: 'link-style',
                on: {
                  click: () => {
                    this.$emit('handleFlow', params)
                  }
                }
              }, params.number)
            ])
          }
        }},
        { title: 'CA名称', key: 'name', align: 'center' },
        { title: 'CA负责人', key: 'name', align: 'center' },
        { title: '状态', key: 'status', align: 'center' },
        { title: '上次修改时间', key: 'status', align: 'center' }
      ],
      tableData: [],
      indexRow: {
        title: '序号',
        align: 'center',
        width: '70'
      }
    }
  },
  computed: {
    propFormData: function() {
      const _this = this
      return [
        {
          split: 3,
          data: [
            {
              key: 'changeType',
              title: '更改类型',
              width: 1,
              component: {
                name: 'el-select',
                options: _this.prOptions
              }
            },
            // {
            //   key: 'ChangeType1',
            //   title: '更改类型(适航)',
            //   width: 1,
            //   component: {
            //     name: 'el-select',
            //     options: _this.prOptions
            //   }
            // },
            {
              key: 'nonrecurringCost',
              title: '非经常性成本估算',
              width: 1,
              component: {
                name: 'el-input',
                type: 'textarea'
              }
            },
            {
              key: 'recurringCost',
              title: '经常性成本估算',
              width: 1,
              component: {
                name: 'el-input',
                type: 'textarea'
              }
            }
          ]
        }
      ]
    },
    workflowNode() {
wangdanlei's avatar
wangdanlei committed
135
      return this.basicData.basicInfo && this.basicData.basicInfo.name
wangdanlei's avatar
wangdanlei committed
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
    },
    workflowname() {
      return `ECR_${this.basicData.businessObject.number}_${this.basicData.businessObject.name}`
    }
  },
  watch: {
    basicData: {
      deep: true,
      handler: function(val) {
        this.getDetail()
      },
      immediate: true
    }
  },
  mounted() {
    this.getContextList()
    this.getDetail()
  },
  methods: {
    // 获取字典
    async getContextList() {
      const arr = this.$store.state.dictionaries && this.$store.state.dictionaries.ChangeType ? this.$store.state.dictionaries.ChangeType.default : await this.$utils.getDicListByCode('ChangeType')
      this.prOptions = arr
    },
    // 跳转ECR编辑详情页面
    handleEditECR() {
      this.$router.push({
wangdanlei's avatar
wangdanlei committed
163
        path: '/dee-cmt/cc/edit',
wangdanlei's avatar
wangdanlei committed
164 165 166
        query: {
          id: this.basicData.businessObject.id,
          type: 'DxChangeRequest',
wangdanlei's avatar
wangdanlei committed
167 168
          number: this.basicData.businessObject.number,
          title: '编辑'
wangdanlei's avatar
wangdanlei committed
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
        }
      })
    },
    getDetail() {
      if (this.basicData.businessObject && this.basicData.businessObject.dynamicAttrs) {
        for (const key in this.form) {
          this.$set(this.form, key, this.basicData.businessObject.dynamicAttrs[key])
        }
      }
    },
    validate() {
      return new Promise((resolve, reject) => {
        const _this = this
        if (this.$refs['form']) {
          this.$refs['form'].$refs.form.validate().then((valid) => {
            if (valid) {
              const form = JSON.parse(JSON.stringify(this.form))
              const ecrForm = {
                id: _this.basicData.businessObject.id,
                dynamicAttrs: form
              }
              saveModel('DxChangeRequest', ecrForm).then(res => {
                resolve(true)
              }).catch((res) => {
                resolve(false)
              })
            } else {
              resolve(false)
            }
          })
        } else {
          resolve(true)
        }
      })
    }
  }
}
</script>

<style lang="scss">
@import "../styles/variables.scss";
.ECR-workflow-com{
  display:flex;
  justify-content: flex-start;
  flex-wrap:wrap;
  font-size: 13px;
  padding-left: 20px;
  .dee-form2{
    width:100%;
    box-sizing: border-box;
  }
  .el-button{
    margin: 10px auto;
  }
  .link-style{
    color: $link-color;
    cursor:pointer;
  }
  .workflownode {
    font-size: 14px;
    padding: 10px 0 22px 20px;
    color: #212121
  }
}
</style>