导出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_API_BASEURL = http://1.203.161.103:2800/api
#VUE_APP_WS_API = 'ws://localhost:8000' #VUE_APP_WS_API = 'ws://localhost:8000'
VUE_APP_API_BASEURL = http://222.222.144.147:6013/api #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://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 #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", "name": "remployee",
"path": "/rpm/remployee", "path": "/rpm/remployee",
"meta": { "meta": {
"title": "我的人员", "title": "人员列表",
"icon": "el-icon-user", "icon": "el-icon-user",
"perms": ["remployee"] "perms": ["remployee"]
}, },
@ -322,7 +322,7 @@ const routes = [
"name": "rcertificate", "name": "rcertificate",
"path": "/rpm/rcertificate", "path": "/rpm/rcertificate",
"meta": { "meta": {
"title": "我的证书", "title": "人员证书",
"icon": "el-icon-postcard", "icon": "el-icon-postcard",
"perms": ["rcertificate"] "perms": ["rcertificate"]
}, },
@ -332,7 +332,7 @@ const routes = [
"name": "rfile", "name": "rfile",
"path": "/rpm/rfile", "path": "/rpm/rfile",
"meta": { "meta": {
"title": "我的资料", "title": "企业资料",
"icon": "el-icon-shopping-bag", "icon": "el-icon-shopping-bag",
"perms": ["rfile"] "perms": ["rfile"]
}, },

View File

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

View File

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

View File

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

View File

@ -2,7 +2,15 @@
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <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="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> --> <el-button type="primary" plain :disabled="selection.length!=1" @click="permission">权限设置</el-button> -->
</div> </div>
@ -88,6 +96,7 @@ export default {
username: "", username: "",
}, },
apiObj: this.$API.rpm.remployee.list, apiObj: this.$API.rpm.remployee.list,
rpartyOptions:[],
query: {}, query: {},
selection: [], selection: [],
search: { search: {
@ -95,7 +104,15 @@ export default {
}, },
}; };
}, },
mounted(){
this.getRpartyOptions();
},
methods: { methods: {
getRpartyOptions(){
this.$API.rpm.rparty.list.req({page:0}).then(res=>{
this.rpartyOptions = res
})
},
// //
add() { add() {
this.dialog.save = true; this.dialog.save = true;

View File

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

View File

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