zhaowei
2 天以前 80a8050560fdd4cc18aee57c3ed176a9019dec2a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
135
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
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :okButtonProps="{ class:{'jee-hidden': tableRowRecord.inspectionStatus!=='WAIT_CONFIRM'} }"
    @ok="submitForm"
    @cancel="handleCancel"
    :mask-closable="false"
    :confirmLoading="confirmLoading"
    switchFullscreen
    centered
  >
    <a-spin :spinning="spinning">
      <a-tabs>
        <a-tab-pane key='1' tab='流程图'>
          <img :src="imageSrc" alt="流程图获取中..."/>
        </a-tab-pane>
      </a-tabs>
 
 
      <a-form-model ref='form' :model='tableRowRecord' :labelCol="labelCol" :wrapperCol="wrapperCol"
                    :rules="validatorRules" v-if="tableRowRecord.inspectionStatus==='WAIT_CONFIRM'">
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 管理员确认信息
        </a-divider>
 
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item prop="confirmDealType" label="处理类型">
              <j-dict-select-tag type='radio' v-model='tableRowRecord.confirmDealType' dictCode='approved_rejected'/>
            </a-form-model-item>
          </a-col>
 
          <a-col :span="12">
            <a-form-model-item prop="confirmComment" label="处理意见">
              <a-textarea placeholder="请输入处理意见" v-model="tableRowRecord.confirmComment"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
 
<script>
  import { getAction, downFile, httpAction } from '@api/manage'
 
  export default {
    name: 'InspectionOrderBatchHandle',
    props: {
      taskList: {
        type: Array
      }
    },
    data() {
      return {
        confirmLoading: false,
        spinning: false,
        tableRowRecord: {},
        hitaskDataSource: [],
        validatorRules: {
          confirmDealType: [
            { required: true, message: '请选择处理类型' }
          ],
          confirmComment: [
            { required: true, message: '请输入处理意见' }
          ]
        },
        imageSrc: null,
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 30 },
          sm: { span: 16 }
        },
        visible: false,
        // 表头
        url: {
          diagramView: '/assign/flow/diagramView',
          batchApprove: '/eam/eamInspectionOrder/batchApproval',
          queryById: '/eam/eamInspectionOrder/queryById'
        },
        title: ''
      }
    },
    methods: {
      /**
       * 获取流程图
       * @param record 待办记录信息
       */
      getAllApproveData(record) {
        if (record.procInstId) {
          const { processDefinitionId, processInstanceId, processDefinitionKey, procInstId } = record
          const param = { procInstId }
          const imageParam = { processDefinitionId, processInstanceId, TaskDefinitionKey: processDefinitionKey }
          const that = this
 
          downFile(this.url.diagramView, imageParam, 'get')
            .then((res => {
              const urlObject = window.URL.createObjectURL(new Blob([res]))
              that.imageSrc = urlObject
            }))
            .catch(err => {
              that.$notification.error({
                message: '消息',
                description: res.message
              })
            })
        }
      },
 
      /**
       * 获取待办记录的基本信息
       * @param record 待办记录信息
       */
      async getBasicInformation(record) {
        this.spinning = true
        const param = { id: record.dataId }
        let res = await getAction(this.url.queryById, param)
        this.tableRowRecord = Object.assign({}, res.result)
        this.spinning = false
      },
 
      async submitForm() {
        this.$refs.form.validate(valid => {
          if (valid) {
            this.confirmLoading = this.spinning = true
            const flowTaskVo = {}
            flowTaskVo.confirmDealType = this.tableRowRecord.confirmDealType
            flowTaskVo.confirmComment = this.tableRowRecord.confirmComment
            flowTaskVo.taskList = this.taskList
            const that = this
            console.log('表单提交数据', flowTaskVo)
            httpAction(this.url.batchApprove, flowTaskVo, 'post')
              .then((res) => {
                if (res.success) {
                  that.$message.success(res.message)
                  //刷新表格
                  that.$emit('searchReset')
                  that.handleCancel()
                } else {
                  that.$message.warning(res.message)
                }
              })
              .finally(() => {
                that.confirmLoading = that.spinning = false
              })
          } else {
            return false
          }
        })
      },
 
      handleCancel() {
        this.visible = false
      }
    }
  }
</script>