hyingbo
2025-07-01 fcf38da448bb0c5e9dcaca1141ddb423b7a96a77
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
<template>
  <div>
    <slot name="function"/>
 
    <div class="content-container">
      <a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
        <a-row>
          <a-col :span="24">
            <a-form-model-item prop="equipmentIdList" label="设备组">
              <a-select v-model="model.equipmentIdList" mode="multiple" placeholder="请选择设备" :maxTagCount="3"
                        allow-clear>
                <a-select-option v-for="item in equipmentList" :key="item.equipmentId">
                  {{item.equipmentId+`[${item.equipmentName}]`}}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
 
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="呼叫原因" prop="callReason">
              <a-textarea placeholder="请输入呼叫原因" v-model="model.callReason" allowClear/>
            </a-form-model-item>
          </a-col>
        </a-row>
 
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="呼叫用户" prop="operator">
              <a-select v-model="model.operator" placeholder="请选择呼叫用户">
                <a-select-option v-for="item in userList" :key="item.id">{{item.realname+`[${item.username}]`}}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
 
 
        <div style="text-align: center">
          <a-button @click="handleSubmit" icon="phone" :loading="loading" type="primary">呼叫</a-button>
        </div>
      </a-form-model>
    </div>
  </div>
</template>
 
<script>
  import { getAction, postAction } from '@/api/manage'
 
  export default {
    name: 'ProcedureCall',
    components: {},
    data() {
      return {
        model: {},
        equipmentList: [],
        userList: [],
        labelCol: {
          xs: { span: 24 },
          sm: { span: 8 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 8 }
        },
        validateRules: {
          equipmentIdList: [
            { required: true, message: '请选择设备!', trigger: 'change' }
          ],
          callReason: [
            { required: true, message: '请输入呼叫原因!', trigger: 'change' }
          ],
          operator: [
            { required: true, message: '请选择呼叫用户!', trigger: 'change' }
          ]
        },
        loading: false,
        url: {
          equipmentList: '/mdc/mdcEquipment/getEquipmentList',
          userList: '/sys/user/list',
          submit: '/mdc/andonOrder/procedureCall'
        }
      }
    },
    created() {
      this.getEquipmentListByApi()
      this.getUserListByApi()
    },
    methods: {
      // 获取设备列表
      getEquipmentListByApi() {
        const that = this
        getAction(this.url.equipmentList)
          .then(res => {
            if (res.success) that.equipmentList = res.result
          })
      },
 
      // 获取用户列表
      getUserListByApi() {
        const that = this
        getAction(this.url.userList, { pageNo: 1, pageSize: 9999 })
          .then(res => {
            console.log('res', res)
            if (res.success) that.userList = res.result.records
          })
      },
 
      // 提交表单
      handleSubmit() {
        const that = this
        this.$refs.form.validate(valid => {
          if (valid) {
            that.loading = true
            that.model.equipmentId = that.model.equipmentIdList.join()
            postAction(that.url.submit, that.model)
              .then(res => {
                if (res.success) {
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                } else {
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .finally(() => {
                that.loading = false
              })
          } else {
            return false
          }
        })
      }
    }
  }
</script>
 
<style scoped lang="less">
  .content-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
 
    /deep/ .ant-form {
      width: 75%;
    }
  }
</style>