lyh
6 天以前 2de735967d33dba5da5fc87191dee543b000afaf
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
<template>
  <j-modal :visible="visible" title="指派报修" :width="500" @ok="handleSubmit" @cancel="handleCancel"
           :confirmLoading="confirmLoading">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="{span:4}" :wrapperCol="{span:18}">
        <a-form-model-item label="维修工" prop="repairer">
          <j-search-select-tag v-model="model.repairer" placeholder="请选择维修工"
                               dict="sys_user,realname, username, del_flag=0 and post='PCR0002' and status=1"/>
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
 
<script>
  import { postAction } from '@/api/manage'
 
  export default {
    name: 'AssignRepairReportModal',
    data() {
      return {
        visible: false,
        confirmLoading: false,
        model: {},
        validateRules: {
          repairer: [
            { required: true, message: '请选择维修工' }
          ]
        },
        url: {
          assign: '/eam/eamRepairOrder/assign'
        }
      }
    },
    methods: {
      handleSubmit() {
        const that = this
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true
            postAction(that.url.assign, that.model)
              .then(res => {
                if (res.success) {
                  that.$message.success(res.message)
                  that.handleCancel()
                  that.$emit('ok')
                } else {
                  that.$message.warning(res.message)
                }
              })
              .finally(() => {
                that.confirmLoading = false
              })
          } else {
            return false
          }
        })
      },
 
      handleCancel() {
        this.visible = false
      }
    }
  }
</script>
 
<style scoped>
  .container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-content: center;
  }
</style>