Blame view

antis-ncc-admin/src/views/attendance-setting/components/late-rule-table.vue 3.8 KB
f075068f   “wangming”   对考勤这块功能进行开发
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
  <template>
    <el-card class="setting-card" shadow="never">
      <div slot="header" class="card-header">
        <span>迟到 / 早退扣款规则</span>
        <el-button type="primary" size="mini" icon="el-icon-plus" @click="addRow">新增规则</el-button>
      </div>
      <NCC-table :data="value" border size="mini" height="340">
        <el-table-column label="最小分钟(含)" min-width="120" align="left">
          <template slot-scope="scope">
            <el-input-number v-model="scope.row.minMinutes" :min="0" :precision="0" controls-position="right" style="width: 100%" />
          </template>
        </el-table-column>
        <el-table-column label="最大分钟(不含)" min-width="130" align="left">
          <template slot-scope="scope">
            <el-input-number v-model="scope.row.maxMinutes" :min="0" :precision="0" controls-position="right" style="width: 100%" />
          </template>
        </el-table-column>
        <el-table-column label="扣款方式" min-width="140" align="left">
          <template slot-scope="scope">
            <el-select v-model="scope.row.deductMode" placeholder="请选择" style="width: 100%">
              <el-option v-for="item in deductModeOptions" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="扣款值" min-width="110" align="left">
          <template slot-scope="scope">
            <el-input-number v-model="scope.row.deductValue" :min="0" :precision="2" controls-position="right" style="width: 100%" />
          </template>
        </el-table-column>
        <el-table-column label="展示说明" min-width="220" align="left">
          <template slot-scope="scope">
            <el-input v-model="scope.row.expressionText" placeholder="例如:≥60分钟迟到/早退,扣日薪/2" />
          </template>
        </el-table-column>
        <el-table-column label="备注" min-width="180" align="left">
          <template slot-scope="scope">
            <el-input v-model="scope.row.remark" placeholder="无" />
          </template>
        </el-table-column>
        <el-table-column label="操作" width="110" align="left">
          <template slot-scope="scope">
            <el-popconfirm
              title="确认删除当前配置吗?"
              confirm-button-text="确认删除"
              cancel-button-text="取消"
              @confirm="removeRow(scope.$index)"
            >
              <el-button slot="reference" type="text" class="danger-text">删除</el-button>
            </el-popconfirm>
          </template>
        </el-table-column>
      </NCC-table>
      <div class="table-tip">提示:最大分钟留空表示无上限,区间按“最小值包含、最大值不包含”处理。</div>
      <el-empty v-if="!value.length" :image-size="56" description="暂无迟到 / 早退扣款规则" />
    </el-card>
  </template>
  
  <script>
  export default {
    name: 'LateRuleTable',
    props: {
      value: {
        type: Array,
        default: () => []
      },
      deductModeOptions: {
        type: Array,
        default: () => []
      }
    },
    methods: {
      addRow() {
        this.$emit('input', [
          ...this.value,
          {
            minMinutes: 0,
            maxMinutes: null,
            deductMode: 1,
            deductValue: 0,
            expressionText: '',
            remark: ''
          }
        ])
      },
      removeRow(index) {
        const list = this.value.slice()
        list.splice(index, 1)
        this.$emit('input', list)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .setting-card {
    border-radius: 12px;
  }
  
  .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
  }
  
  .table-tip {
    margin-top: 8px;
    color: #909399;
    font-size: 12px;
  }
  
  .danger-text {
    color: #f56c6c;
  }
  
  ::v-deep .el-card__header {
    padding: 12px 16px;
  }
  
  ::v-deep .el-card__body {
    padding: 12px 14px;
  }
  </style>