<template>
|
<el-dialog :close-on-click-modal="false" :visible.sync="islook" width="40rem" class="add-event-dialog"
|
@close="cancelMethod">
|
<div slot="title" class="tac drawerHeader">详情</div>
|
<div class="dialog-content-box">
|
<el-form class="form-box" ref="form" :rules="rules" :model="form" label-width="140px" label-position="right">
|
<el-form-item label="员工姓名:" prop="id">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="员工ID:" prop="isCore">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="工种:" prop="id">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="考勤日期:" prop="isCore">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="状态:" prop="id">
|
<template v-if="!isEditOne">
|
<i class="el-icon-circle-check cursor_pointer font_size_20 color_67c23a"></i>
|
{{ form.name }}
|
<i @click="editOneClick" class="el-icon-edit-outline cursor_pointer font_size_20"></i>
|
</template>
|
<template v-else>
|
<el-select v-model="form.phoneNum" filterable placeholder="请选择" class="margin_right_15px" style="width: calc(100% - 80px)">
|
<el-option v-for="item in DeviceList" :key="item.id" :label="item.name" :value="item.id">
|
</el-option>
|
</el-select>
|
<el-button type="text" @click="submitEditOneClick('form')">确定</el-button>
|
</template>
|
</el-form-item>
|
<el-form-item label="上班打卡时间:" prop="isCore">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="下班打卡时间:" prop="id">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="班次:" prop="isCore">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="班次开始时间:" prop="id">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="班次结束时间:" prop="isCore">
|
{{ form.name }}
|
</el-form-item>
|
<el-form-item label="工作日加班时长:" prop="id">
|
<template v-if="!isEditTwo">
|
{{ form.name }}
|
<i @click="editTwoClick" class="el-icon-edit-outline cursor_pointer font_size_20"></i>
|
</template>
|
<template v-else>
|
<el-input
|
v-model.number="form.produceAheadDay"
|
maxlength="20"
|
style="width: calc(100% - 80px)"
|
clearable
|
placeholder="请输入"
|
class="margin_right_15px"
|
></el-input>
|
<el-button type="text" @click="submitEditTwoClick('form')">确定</el-button>
|
</template>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div slot="footer" class="dialog-footer tac">
|
<el-button type="cancel" @click="cancelMethod()">取消</el-button>
|
<el-button type="primary" @click="submitForm('form')">确定</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
|
<script>
|
import { getDeleteFollowRecord } from "@/api/employeeManage/employeeInfo.js"
|
export default {
|
props: {
|
editRow: {
|
type: Object,
|
}
|
},
|
data() {
|
return {
|
islook: false,
|
form: {
|
id: '',
|
isCore: '',
|
phoneNum: '',
|
},
|
isEditOne:false,
|
isEditTwo:false,
|
DeviceList:[],
|
rules: {
|
id: [
|
{
|
required: true,
|
message: "请输入人员姓名",
|
trigger: ["blur", "change"],
|
},
|
],
|
name: [
|
{
|
required: true,
|
message: "请输入员工编码",
|
trigger: ["blur", "change"],
|
},
|
],
|
produceAheadDay: [
|
{
|
required: false,
|
message: "请输入",
|
trigger: "blur",
|
},
|
{
|
validator: this.validatorNum,
|
trigger: "blur",
|
},
|
],
|
},
|
};
|
},
|
created() {
|
},
|
watch: {
|
islook(newVal) {
|
if (newVal) {
|
this.formInfo()
|
}
|
},
|
editRow() {
|
this.formInfo()
|
},
|
},
|
methods: {
|
editOneClick(){
|
this.isEditOne=true
|
},
|
submitEditOneClick(){
|
this.isEditOne=false
|
},
|
editTwoClick(){
|
this.isEditTwo=true
|
},
|
submitEditTwoClick(){
|
this.isEditTwo=false
|
},
|
formInfo() {
|
if (this.islook) {
|
this.form = {
|
isCore: "",
|
id: "",
|
};
|
this.$nextTick(()=>{
|
this.$refs["form"].resetFields();
|
if (this.editRow.id) {
|
this.form = JSON.parse(JSON.stringify(this.editRow));
|
}
|
})
|
}
|
},
|
validatorNum(rule, value, callback) {
|
if (value) {
|
if (value == undefined || value == null) {
|
callback(new Error("请输入有效数字"));
|
} else {
|
var reg = /^\+?[0-9]\d*$/;
|
if (!reg.test(value)) {
|
callback(new Error("请填写不小于0的数字"));
|
} else {
|
callback();
|
}
|
}
|
} else {
|
callback();
|
}
|
},
|
cancelMethod() {
|
this.$refs["form"].resetFields();
|
this.islook = false;
|
},
|
submitForm(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
let form = JSON.parse(JSON.stringify(this.form));
|
if (this.editRow.type == "add") {
|
getDeleteFollowRecord(form).then((res) => {
|
if (res.code == 200) {
|
this.$message({
|
message: "添加成功!",
|
type: "success",
|
});
|
this.cancelMethod();
|
}
|
});
|
} else {
|
getDeleteFollowRecord(form).then((res) => {
|
if (res.code == 200) {
|
this.$message({
|
message: "编辑成功!",
|
type: "success",
|
});
|
this.cancelMethod();
|
}
|
});
|
}
|
} else {
|
console.log('error submit!!');
|
return false;
|
}
|
});
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.dialog-content-box {
|
height: 28rem;
|
|
.form-box {
|
width: 90%;
|
padding: 0 5%;
|
height: 100%;
|
overflow-y: auto;
|
|
}
|
}
|
</style>
|