hejianhao
2025-04-24 c76e6648647e6174f4070313887d353a36e6d17c
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
<template>
  <el-dialog
    :visible.sync="dialogVisible"
    :title="dialogTitle"
    width="79.17%"
    @close="handleClose"
  >
    <EvaluateTable ref="evaluateTable" />
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="handleSubmit" class="submit-btn">确认评定结果</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
const EVALUATION_TYPES = ['labTechnician', 'experimenter'];
 
export default {
  name: "EvaluationDialog",
  props: {
    modelValue: {
      type: Boolean,
      default: false,
    },
    type: {
      type: String,
      default: 'labTechnician'
    },
  },
  data() {
    return {
      dialogVisible: false,
    };
  },
  computed: {
    dialogTitle() {
      return this.type === 'labTechnician' ? '化验师工作评定' : '实验员工作评定';
    }
  },
  watch: {
    modelValue: {
      handler(val) {
        this.dialogVisible = val;
      },
      immediate: true,
    },
    dialogVisible(val) {
      if (!val) {
        this.$emit('update:modelValue', false);
      }
    }
  },
  methods: {
    handleClose() {
      this.$emit('update:modelValue', false);
    },
    handleSubmit() {
      const evaluateTable = this.$refs.evaluateTable;
      if (!evaluateTable) {
        this.$message.warning('评价表格未加载完成');
        return;
      }
 
      const evaluateData = {
        type: this.type,
        activeIndex: evaluateTable.activeIndex
      };
      
      this.$emit('submit', evaluateData);
    },
  },
};
</script>
 
<style lang="less" scoped>
.dialog-footer {
  padding: 20px;
  border-top: 1px solid #eee;
 
  .submit-btn {
    min-width: 80px;
  }
}
</style>