<template>
  <el-container style="border: #000000;height: 100%;" v-if="visible">
    <avue-form ref="form" v-model="jobSolve" :option="option" @submit="submit">
    </avue-form>
  </el-container>
</template>

<script>
import {
  update
} from "@/api/order/deviceorder";
export default {
  props: {
    visible: "",
    jobSolve: {},
  },
  data() {
    return {
      option: {
        emptyBtn: true,
        submitBtn: true,
        group: [{
          icon: 'el-icon-discover',
          label: '告警设备',
          prop: 'group1',
          column: [{
            label: '设备类型',
            prop: 'deviceType',
            span: 10,
            type: "select",
            dataType: "number",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=device_type",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            disabled: true
          }, {
            label: '设备名称',
            prop: 'deviceName',
            span: 14,
            disabled: true
          }, {
            label: '安装位置',
            prop: 'alarmPosition',
            row: true,
            span: 20,
            disabled: true
          }]
        }, {
          icon: 'el-icon-edit-outline',
          label: '工单处理',
          prop: 'group2',
          column: [{
            label: '告警时间',
            prop: 'alarmTime',
            row: true,
            span: 12,
            disabled: true
          }, {
            label: '处理人',
            prop: 'handler',
            span: 12,

          }, {
            label: '联系方式',
            prop: 'phone',
            row: true,
            span: 12
          }, {
            label: '处理状态',
            prop: 'jobStatus',
            type: "select",
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=job_status",
            dataType: "number",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            span: 12
          },
            {
              label: '处理备注',
              prop: 'remark',
              type: "textarea",
              span: 20
            }
          ]
        }]
      },


    }
  },
  mounted() {
    console.log(this.jobSolve.jobStatus)
    if (this.jobSolve.jobStatus == 2) {
      this.option.submitBtn = false;
      this.option.emptyBtn = false;
    } else {
      this.option.submitBtn = true;
      this.option.emptyBtn = true;
    }
  },
  methods: {
    init() {
      this.option.submitBtn = true;
      this.option.emptyBtn = true;
    },
    submit() {
      update(this.jobSolve).then(() => {
        this.$message({
          type: "success",
          message: "操作成功!"
        });
        this.$emit("close-dialog", "取消");
      })
    },
    handleCancel() {
      this.$emit("close-dialog", "取消");
    }
  }
}
</script>

<style>
</style>
