导出excel

This commit is contained in:
曹前明 2022-10-20 09:32:57 +08:00
parent 9dba0cde27
commit cdf60807fa
9 changed files with 120 additions and 46 deletions

View File

@ -7,8 +7,9 @@ VUE_APP_TITLE = '曲阳金隅安全智能管控平台'
# 接口地址
#VUE_APP_API_BASEURL = http://1.203.161.103:2800/api
#VUE_APP_WS_API = 'ws://localhost:8000'
VUE_APP_API_BASEURL = http://222.222.144.147:6013/api
#VUE_APP_API_BASEURL = http://127.0.0.1:8000/api
#VUE_APP_API_BASEURL = http://222.222.144.147:6013/api
#VUE_APP_API_BASEURL = http://10.99.5.79:20309/api
VUE_APP_API_BASEURL = http://127.0.0.1:8000/api
#VUE_APP_BASEURL = http://127.0.0.1:8000

View File

@ -99,5 +99,14 @@ export default {
);
}
},
export_excel: {
name: "导出",
req: async function(data){
return await http.get(
`${config.API_URL}/hrm/clock_record/export_excel/`,
data
);
}
}
}
}

View File

@ -312,7 +312,7 @@ const routes = [
"name": "remployee",
"path": "/rpm/remployee",
"meta": {
"title": "我的人员",
"title": "人员列表",
"icon": "el-icon-user",
"perms": ["remployee"]
},
@ -322,7 +322,7 @@ const routes = [
"name": "rcertificate",
"path": "/rpm/rcertificate",
"meta": {
"title": "我的证书",
"title": "人员证书",
"icon": "el-icon-postcard",
"perms": ["rcertificate"]
},
@ -332,7 +332,7 @@ const routes = [
"name": "rfile",
"path": "/rpm/rfile",
"meta": {
"title": "我的资料",
"title": "企业资料",
"icon": "el-icon-shopping-bag",
"perms": ["rfile"]
},

View File

@ -36,8 +36,8 @@ axios.interceptors.response.use(
if (error.response) {
if (error.response.status == 401) {
if(error.response.data.err_code == 'no_active_account'){
ElNotification.error({
title: '请求错误',
ElNotification.warning({
title: '请求失败',
message: "账户密码错误或已禁用"
});
}else{
@ -52,8 +52,8 @@ axios.interceptors.response.use(
}
} else {
ElNotification.error({
title: '请求错误',
ElNotification.warning({
title: '请求失败',
message: error.response.data.err_msg || `Status:${error.response.status},未知错误!`
});
}

View File

@ -254,6 +254,7 @@ export default {
},
getEmployee(data) {
//
console.log(data)
this.form.employee=data.id;
this.form.employee_name=data.name
},
@ -270,7 +271,6 @@ export default {
// },
//
submitcert() {
this.form.employee = this.$route.query.id;
this.$refs.dialogForm.validate((valid) => {
if (this.form.id == "") {
this.$API.hrm.certificate.create

View File

@ -2,23 +2,20 @@
<el-container>
<el-header>
<div class="left-panel">
<el-cascader v-model="query.employee__belong_dept" :options="deptData" clearable placeholder="部门/单位" @change="handleQuery" :show-all-levels="false" :props="{emitPath:false}"/>
<el-date-picker
v-model="timeRange"
type="datetimerange"
range-separator="至"
start-placeholder="打卡时间始"
end-placeholder="打卡时间止"
style="margin-left: 2px"
value-format="YYYY-MM-DD HH:mm:ss"
v-model="monthV"
type="month"
style="margin-left:4px"
placeholder="选择月份"
@change="handleQuery"
clearable
/>
</div>
<div class="right-panel">
<div class="right-panel-search">
<el-input
v-model="query.search"
placeholder="员工姓名/编号"
placeholder="员工姓名/编号/手机号"
clearable
@keyup.enter="handleQuery"
></el-input>
@ -27,6 +24,12 @@
icon="el-icon-search"
@click="handleQuery"
></el-button>
<el-button
type="primary"
:loading = 'dLoading'
icon="el-icon-download"
@click="exportExcel"
></el-button>
</div>
</div>
</el-header>
@ -39,11 +42,21 @@
stripe
>
<el-table-column label="人员类型" prop="employee">
<template #default="scope">
<span v-if="scope.row.employee">{{epOptions[scope.row.employee_.type]}}</span>
</template>
</el-table-column>
<el-table-column label="人员" prop="employee">
<template #default="scope">
<span v-if="scope.row.employee">{{scope.row.employee_.name}}</span>
</template>
</el-table-column>
<el-table-column label="所属部门" prop="employee">
<template #default="scope">
<span v-if="scope.row.employee">{{scope.row.employee_.belong_dept_name}}</span>
</template>
</el-table-column>
<el-table-column label="打卡类型" prop="number">
<template #default="scope">{{type_[scope.row.type]}}
</template>
@ -54,7 +67,14 @@
</el-table-column>
<el-table-column label="其他信息">
<template #default="scope">
<span v-if="scope.row.detail">{{scope.row.detail.deviceName}}</span>
<span v-if="scope.row.detail">
{{scope.row.detail.deviceName}}
--
<span>
<span v-if="scope.row.detail.isOverTemp" style="color:red;font-weight:bold">{{scope.row.detail.curTemp}}</span>
<span v-else style="color:green;font-weight:bold">{{scope.row.detail.curTemp}}</span>
</span>
</span>
</template>
</el-table-column>
<el-table-column label="打卡时间" prop="create_time"></el-table-column>
@ -63,39 +83,66 @@
</el-container>
</template>
<script>
import { genTree } from "@/utils/verificate";
export default {
name: "clock_record",
components: {},
data() {
return {
timeRange: [],
apiObj: this.$API.hrm.clock_record.list,
deptData: [],
monthV: null,
query: {},
selection: [],
type_:{
10: "上班打卡",
20: "下班打卡"
},
epOptions:{
"employee": "正式员工",
"remployee": "相关方"
},
trigger_:{
"door": "门禁",
"location": "定位"
}
},
dLoading: false,
};
},
mounted() {
this.getDept();
},
methods: {
async getDept() {
let res = await this.$API.system.dept.list.req({ page: 0, type__in: 'dept,rparty' });
this.deptData = genTree(res);
},
handleQuery(){
if (this.timeRange) {
this.query.start_create = this.timeRange[0];
this.query.end_create = this.timeRange[1];
if(this.monthV){
this.query.year = this.monthV.getFullYear();
this.query.month = this.monthV.getMonth() + 1;
}else{
this.query.end_create = null;
this.query.start_create = null;
this.query.year = null;
this.query.month = null;
}
this.$refs.table.queryData(this.query)
},
exportExcel(){
if(this.monthV){
this.query.year = this.monthV.getFullYear();
this.query.month = this.monthV.getMonth() + 1;
}else{
this.query.year = null;
this.query.month = null;
}
this.dLoading = true;
this.$API.hrm.clock_record.export_excel
.req(this.query)
.then(res=>{
window.open(res.path, "_blank");
this.dLoading = false;
}).catch(e=>{this.dLoading = false;})
}
},
};
</script>

View File

@ -2,7 +2,15 @@
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
<el-select v-model="query.rparty" placeholder="所属相关方" @change="handleQuery" clearable filterable>
<el-option
v-for="item in rpartyOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<el-button type="primary" icon="el-icon-plus" @click="add" style="margin-left:4px"></el-button>
<!-- <el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
<el-button type="primary" plain :disabled="selection.length!=1" @click="permission">权限设置</el-button> -->
</div>
@ -88,6 +96,7 @@ export default {
username: "",
},
apiObj: this.$API.rpm.remployee.list,
rpartyOptions:[],
query: {},
selection: [],
search: {
@ -95,7 +104,15 @@ export default {
},
};
},
mounted(){
this.getRpartyOptions();
},
methods: {
getRpartyOptions(){
this.$API.rpm.rparty.list.req({page:0}).then(res=>{
this.rpartyOptions = res
})
},
//
add() {
this.dialog.save = true;

View File

@ -52,10 +52,10 @@
node-key="id"
show-checkbox
:check-strictly="checkStrictly"
:default-expand-all="true"
:data="menu.list"
:props="menu.props"
@check="handleChange"
@check-change="checkChange"
></el-tree>
</div>
</el-form-item>
@ -126,17 +126,17 @@
handleChange(item, check) {
this.menu.checked = check.checkedKeys;
},
checkChange(item, check,node) {
let that = this;
if(check){//
if(item.parent!==null){
if(that.menu.checked.indexOf(item.parent)>-1){}else{
that.menu.checked.push(item.parent)
}
that.$refs.menu.setChecked(item.parent,true,false);
}
}
},
// checkChange(item, check,node) {
// let that = this;
// if(check){//
// if(item.parent!==null){
// if(that.menu.checked.indexOf(item.parent)>-1){}else{
// that.menu.checked.push(item.parent)
// }
// that.$refs.menu.setChecked(item.parent,true,false);
// }
// }
// },
//
async getGroup() {
let res = await this.$API.system.permission.list.req({page: 0});

View File

@ -171,7 +171,7 @@
</el-button>
<el-button
link
type="primary"
type="danger"
size="small"
@click="table_del(scope.row)"
>删除
@ -284,7 +284,7 @@ export default {
.req(row.id)
.then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
})
.catch((err) => {