yangfeng
2023-11-29 01fe9929805fc9e73b72033f9717fc3f32005b03
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
<template>
  <div class="edit-department">
    <el-dialog
      :title="editDepartmentConfig.title"
      :visible.sync="editConfig.visible"
      :width="dialogWidth"
      :before-close="handleClose"
    >
      <el-form ref="form" :model="editConfig.infomation" :rules="rules" label-width="100px" size="mini">
        <!-- 信息 -->
        <div class="basic-info">
          <el-row>
            <el-col :span="12">
              <el-form-item label="部门名称" prop="departmentName">
                <el-input v-model="editConfig.infomation.departmentName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="部门编号" prop="departmentNumber">
                <el-input v-model="editConfig.infomation.departmentNumber"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="备注" prop="notes">
                <el-input
                  type="textarea"
                  :autosize="{ minRows: 1, maxRows: 4 }"
                  placeholder="请输入内容"
                  v-model="editConfig.infomation.notes"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" size="small" @click="editConfig.visible = false">保 存</el-button>
        <el-button size="small" @click="editConfig.visible = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
export default {
  name: "EditDepartmentDialog",
  props: {
    editDepartmentConfig: {
      type: Object,
      default: () => {
        return {
          visible: false,
          title: "新建",
          infomation: {
            departmentName: "",
            departmentNumber: "",
            notes: ""
          }
        }
      }
    }
  },
  components: {},
  computed: {},
  data() {
    return {
      dialogWidth: "40%",
      editConfig: this.editDepartmentConfig,
      rules: {
        departmentName: [{ required: true, message: "请输入", trigger: "blur" }],
        departmentNumber: [{ required: true, message: "请输入", trigger: "blur" }]
      }
    }
  },
  created() {
    this.isActive = true
  },
  methods: {
    handleClose() {
      this.editConfig.visible = false
    }
  }
}
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.edit-department {
  .basic-info {
    padding: 20px;
  }
  .dialog-footer {
    background-color: #f5f5f5;
    height: 55px;
    line-height: 55px;
  }
}
::v-deep {
  .el-dialog__wrapper {
    margin-top: 20vh;
  }
}
</style>