|
|
@@ -68,8 +68,8 @@
|
|
|
<div class="dialog-intro">
|
|
|
<div class="intro-icon"><i class="el-icon-time"></i></div>
|
|
|
<div>
|
|
|
- <strong>{{ dialogTitle === '编辑打卡规则' ? '维护打卡规则' : '创建新的打卡规则' }}</strong>
|
|
|
- <p>配置打卡方式、上下班时间、节假日、加班与补卡等规则,保存后同步到考勤策略。</p>
|
|
|
+ <strong>{{ dialogIntroTitle }}</strong>
|
|
|
+ <p>{{ dialogIntroDesc }}</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="rule-dialog-tabs">
|
|
|
@@ -87,6 +87,7 @@
|
|
|
:timezone-options="timezoneOptions"
|
|
|
:reminder-options="reminderOptions"
|
|
|
:rules="rules"
|
|
|
+ :readonly="dialogReadonly"
|
|
|
@add-location="addLocation"
|
|
|
@add-wifi="addWifi"
|
|
|
@add-device="openDeviceCard"
|
|
|
@@ -100,8 +101,8 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<span slot="footer">
|
|
|
- <el-button @click="dialogVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="save">保存规则</el-button>
|
|
|
+ <el-button @click="dialogVisible = false">{{ dialogReadonly ? '关闭' : '取消' }}</el-button>
|
|
|
+ <el-button v-if="!dialogReadonly" type="primary" @click="save">保存规则</el-button>
|
|
|
</span>
|
|
|
</ele-modal>
|
|
|
|
|
|
@@ -204,33 +205,6 @@
|
|
|
<el-button @click="viewDialogVisible = false">关闭</el-button>
|
|
|
</span>
|
|
|
</ele-modal>
|
|
|
-
|
|
|
- <el-drawer custom-class="rule-drawer" :title="detailRow ? '打卡规则详情 - ' + detailRow.name : ''" :visible.sync="detailVisible" direction="rtl"
|
|
|
- size="640px" append-to-body>
|
|
|
- <div v-if="detailRow" style="padding:0 18px 18px;">
|
|
|
- <div class="employee-summary">
|
|
|
- <span><i class="el-icon-time"></i></span>
|
|
|
- <div>
|
|
|
- <h3>{{ detailRow.name }}</h3>
|
|
|
- <p>{{ detailRow.id }} · {{ scopeLabel(detailRow.scope) }} · {{ ruleTypeLabel(detailRow.type) }}</p>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="info-grid info-grid--two">
|
|
|
- <div><span>上下班时间</span><strong>{{ detailRow.workTime }}</strong></div>
|
|
|
- <div><span>节假日与特殊日期</span><strong>{{ detailRow.holiday }}</strong></div>
|
|
|
- <div><span>休息日</span><strong>{{ detailRow.restDays.join("、") }}</strong></div>
|
|
|
- <div><span>打卡方式</span><strong>{{ detailRow.methods.map(methodLabel).join("、") }}</strong></div>
|
|
|
- <div><span>打卡位置</span><strong>{{ detailRow.location }}</strong></div>
|
|
|
- <div><span>打卡WiFi</span><strong>{{ detailRow.wifi }}</strong></div>
|
|
|
- <div><span>考勤机</span><strong>{{ detailRow.devices }}</strong></div>
|
|
|
- <div><span>加班规则</span><strong>{{ detailRow.overtime }}</strong></div>
|
|
|
- <div><span>加班时长设置</span><strong>{{ detailRow.overtimeDuration }}</strong></div>
|
|
|
- <div><span>补卡设置</span><strong>{{ detailRow.makeup }}</strong></div>
|
|
|
- <div><span>请假时补卡设置</span><strong>{{ detailRow.leaveMakeup }}</strong></div>
|
|
|
- <div><span>最近更新</span><strong>{{ detailRow.updatedAt }}</strong></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </el-drawer>
|
|
|
</main>
|
|
|
</template>
|
|
|
|
|
|
@@ -249,8 +223,6 @@ export default {
|
|
|
ruleTypes: RULE_TYPES,
|
|
|
filter: { keyword: '', method: '', scope: '', type: '' },
|
|
|
records: PUNCH_RULES.map(r => ({ ...r })),
|
|
|
- detailRow: null,
|
|
|
- detailVisible: false,
|
|
|
locationDialogVisible: false,
|
|
|
wifiDialogVisible: false,
|
|
|
locationForm: { name: '', range: '300米' },
|
|
|
@@ -274,6 +246,7 @@ export default {
|
|
|
departmentOptions: ['总部', '研发中心', '市场部', '运营部', '人事行政部', '财务部'],
|
|
|
dialogVisible: false,
|
|
|
dialogTitle: '新增打卡规则',
|
|
|
+ dialogReadonly: false,
|
|
|
activeTab: 'method',
|
|
|
dialogTabs: [
|
|
|
{ key: 'method', label: '打卡方式' },
|
|
|
@@ -361,6 +334,14 @@ export default {
|
|
|
enabledCount() {
|
|
|
return this.records.filter(r => r.enabled).length;
|
|
|
},
|
|
|
+ dialogIntroTitle() {
|
|
|
+ if (this.dialogReadonly) return '查看打卡规则详情';
|
|
|
+ return this.dialogTitle === '编辑打卡规则' ? '维护打卡规则' : '创建新的打卡规则';
|
|
|
+ },
|
|
|
+ dialogIntroDesc() {
|
|
|
+ if (this.dialogReadonly) return '查看打卡方式、上下班时间、节假日、加班与补卡等规则配置。';
|
|
|
+ return '配置打卡方式、上下班时间、节假日、加班与补卡等规则,保存后同步到考勤策略。';
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
ruleTypeLabel,
|
|
|
@@ -477,6 +458,7 @@ export default {
|
|
|
this.form = this.empty();
|
|
|
this.activeTab = 'method';
|
|
|
this.dialogTitle = '新增打卡规则';
|
|
|
+ this.dialogReadonly = false;
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
openEdit(row) {
|
|
|
@@ -498,6 +480,7 @@ export default {
|
|
|
this.form = formData;
|
|
|
this.activeTab = 'method';
|
|
|
this.dialogTitle = '编辑打卡规则';
|
|
|
+ this.dialogReadonly = false;
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
toggle(row) {
|
|
|
@@ -649,8 +632,26 @@ export default {
|
|
|
return h + '小时' + mi + '分钟';
|
|
|
},
|
|
|
viewDetail(row) {
|
|
|
- this.detailRow = row;
|
|
|
- this.detailVisible = true;
|
|
|
+ // 复用编辑弹窗,仅以只读模式打开,不显示保存按钮
|
|
|
+ const base = this.empty();
|
|
|
+ const formData = {
|
|
|
+ ...base,
|
|
|
+ ...row,
|
|
|
+ overtimeOn: row.overtime === '开启',
|
|
|
+ locations: row.location ? [{ name: row.location, range: '300米' }] : [],
|
|
|
+ wifis: row.wifi ? [{ ssid: row.wifi, bssid: '-' }] : []
|
|
|
+ };
|
|
|
+ if (!formData.workShifts && row.workTime) {
|
|
|
+ const m = row.workTime.match(/(\d{2}:\d{2})\s*-\s*(\d{2}:\d{2})/);
|
|
|
+ if (m) {
|
|
|
+ formData.workShifts = [{ key: 'WS1', start: m[1], end: m[2], startOpen: '是', endOpen: '是', lunchBreaks: [{ key: 'L1', start: '12:00', end: '13:00' }] }];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form = formData;
|
|
|
+ this.activeTab = 'method';
|
|
|
+ this.dialogTitle = '查看打卡规则';
|
|
|
+ this.dialogReadonly = true;
|
|
|
+ this.dialogVisible = true;
|
|
|
},
|
|
|
save() {
|
|
|
const data = { ...this.form };
|
|
|
@@ -999,61 +1000,6 @@ export default {
|
|
|
font-size: 11px
|
|
|
}
|
|
|
|
|
|
-/* ===== drawer(el-drawer custom-class="rule-drawer")===== */
|
|
|
-.rule-drawer .employee-summary {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- gap: 11px;
|
|
|
- padding: 14px;
|
|
|
- border: 1px solid #dfe7f0;
|
|
|
- border-radius: 10px;
|
|
|
- background: #f8faff;
|
|
|
- margin-bottom: 18px
|
|
|
-}
|
|
|
-
|
|
|
-.rule-drawer .employee-summary > span {
|
|
|
- width: 46px;
|
|
|
- height: 46px;
|
|
|
- display: grid;
|
|
|
- place-items: center;
|
|
|
- border-radius: 50%;
|
|
|
- color: #1768e5;
|
|
|
- background: #e6efff;
|
|
|
- font-size: 18px
|
|
|
-}
|
|
|
-
|
|
|
-.rule-drawer .employee-summary h3 {
|
|
|
- margin: 0;
|
|
|
- font-size: 15px
|
|
|
-}
|
|
|
-
|
|
|
-.rule-drawer .employee-summary p {
|
|
|
- margin: 5px 0 0;
|
|
|
- color: #8390a2;
|
|
|
- font-size: 11px
|
|
|
-}
|
|
|
-
|
|
|
-.rule-drawer .employee-summary > div:nth-child(3) {
|
|
|
- margin-left: auto;
|
|
|
- text-align: right
|
|
|
-}
|
|
|
-
|
|
|
-.rule-drawer .employee-summary > div:nth-child(3) small,
|
|
|
-.rule-drawer .employee-summary > div:nth-child(3) strong {
|
|
|
- display: block
|
|
|
-}
|
|
|
-
|
|
|
-.rule-drawer .employee-summary > div:nth-child(3) small {
|
|
|
- color: #8995a5;
|
|
|
- font-size: 10px
|
|
|
-}
|
|
|
-
|
|
|
-.rule-drawer .employee-summary > div:nth-child(3) strong {
|
|
|
- margin-top: 3px;
|
|
|
- color: #1768e5;
|
|
|
- font-size: 13px
|
|
|
-}
|
|
|
-
|
|
|
/* ===== 上下班时间 Tab 附加样式 ===== */
|
|
|
.rule-dialog .tab-panel .week-chip-wrap {
|
|
|
display: flex;
|