guoshilong
2022-11-23 998b75f0d4aaed03001ec4246cd4f3b4b0743b7e
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
<!--派单弹窗页面-->
<template>
  <el-dialog
    :title="title"
    :modal-append-to-body="false"
    :append-to-body="true"
    :close-on-click-modal="false"
    width="60%"
    :visible.sync="visible"
  >
    <avue-form ref="form" v-model="form" :option="option" @submit="submit">
    </avue-form>
  </el-dialog>
</template>
 
<script>
import {update} from "@/api/repairsorder/repairsorder";
import {add} from "@/api/repairsorder/repairsorderRecord";
 
export default {
  data() {
    return {
      title:"事件处置",
      form: {},
      repairsorder: {},
      visible: false,
      ids: null,
      option: {
        emptyBtn: false,
        submitText: "保存",
        gutter: 30,
        column: [
          {
            label: "维修人员",
            prop: "toUserId",
            type: "select",
            dicUrl: "/api/blade-user/user-list",
            props: {
              label: "name",
              value: "id"
            },
            hide: true,
            rules: [{
              required: true,
              message: "请选择维修人员",
              trigger: "blur"
            }]
          },
          {
            label: "备注",
            prop: "remark",
            type: "textarea",
            span: 24
          }
        ]
      }
    }
  },
  methods: {
    init(data) {
      this.visible = true
      this.form.no = data.no
      this.form.state = 1 //设置为已派单
 
      this.repairsorder.id = data.id
      this.repairsorder.state = 1
    },
    // 表单提交
    submit(row,done) {
      this.repairsorder.toUserId = row.toUserId
      // row.repairPerson = this.form.$repairPerson
      if (!row.remark){
        row.remark = "已派单"
      }
      update(this.repairsorder).then(() => {
        add(row).then(() => {
          this.$refs.form.resetFields()
          this.$emit("refreshOnLoad")
          this.visible = false
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          done();
          console.log(error);
        });
      })
 
    }
  }
}
</script>
 
<style scoped>
 
</style>