|
@@ -1,25 +1,34 @@
|
|
|
<template>
|
|
|
<section>
|
|
|
<!--工具条-->
|
|
|
- <!-- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
|
|
|
+ <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
|
|
|
<el-form :inline="true">
|
|
|
- <el-form-item label="类型:">
|
|
|
- <el-select v-model="search.value" placeholder="请选择类型" @change="getList()">
|
|
|
- <el-option label="全部" value="-1"></el-option>
|
|
|
- <el-option label="待审核" value="0"></el-option>
|
|
|
- <el-option label="已通过" value="1"></el-option>
|
|
|
- <el-option label="已驳回" value="2"></el-option>
|
|
|
+ <el-form-item label="项目:">
|
|
|
+ <el-select v-model="search.projectId" placeholder="请选择" clearable @change="getList()">
|
|
|
+ <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="search.value == -1" label="日期:" style="margin-left:20px;">
|
|
|
+ <el-form-item label="部门:">
|
|
|
+ <el-cascader v-model="search.departmentIdArray" placeholder="请选择部门" style="width: 100%"
|
|
|
+ :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable
|
|
|
+ @change="getList()"
|
|
|
+ ></el-cascader>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="日期:" style="margin-left:20px;">
|
|
|
<el-date-picker v-model="search.date" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
|
|
|
@change="getList()" :clearable="true" type="date" placeholder="选择工作日期"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item style="margin-left:20px;">
|
|
|
+ <el-button @click="batchApprove(true)" style="margin-left:10px;" :disabled="multipleSelection.length==0">批量通过</el-button>
|
|
|
+ <el-button @click="batchApprove(false)" :disabled="multipleSelection.length==0">批量驳回</el-button>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
</el-form>
|
|
|
- </el-col> -->
|
|
|
-
|
|
|
+ </el-col>
|
|
|
<!--列表-->
|
|
|
- <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
|
|
|
+ <el-table :data="list" ref="multipleTable" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;"
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55"></el-table-column>
|
|
|
<el-table-column type="expand">
|
|
|
<template slot-scope="props">
|
|
|
<el-timeline>
|
|
@@ -34,16 +43,11 @@
|
|
|
</el-timeline>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column type="index" width="60"></el-table-column>
|
|
|
+
|
|
|
<el-table-column prop="name" label="姓名" sortable></el-table-column>
|
|
|
<el-table-column prop="date" label="日期" sortable>
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="search.value == -1">{{search.date}}</span>
|
|
|
- <span v-else>{{scope.row.date}}</span>
|
|
|
- </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="reportTime" label="工作时长(h)" >
|
|
|
-
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="state" label="状态" sortable>
|
|
|
<template slot-scope="scope">
|
|
@@ -60,7 +64,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<!--工具条-->
|
|
|
<!-- <el-col v-if="search.value != -1" :span="24" class="toolbar">
|
|
|
<el-pagination
|
|
@@ -82,15 +86,19 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ isAllSelect:false,
|
|
|
user: JSON.parse(sessionStorage.getItem("user")),
|
|
|
|
|
|
search: {
|
|
|
- value: 0,
|
|
|
- date: util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
|
|
|
+ projectId:null,
|
|
|
+ departmentIdArray: null,
|
|
|
+ departmentId:null,
|
|
|
+ date: null,
|
|
|
+ state:0,
|
|
|
},
|
|
|
|
|
|
users: [],
|
|
|
-
|
|
|
+ option:[],
|
|
|
tableHeight: 0,
|
|
|
listLoading: false,
|
|
|
total: 0,
|
|
@@ -98,10 +106,69 @@
|
|
|
size: 20,
|
|
|
list: [],
|
|
|
logining: false,
|
|
|
-
|
|
|
+ multipleSelection: [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取部门列表
|
|
|
+ getDepartment() {
|
|
|
+ this.http.post( this.port.manage.depList, {},
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ var list1 = JSON.parse(JSON.stringify(res.data));
|
|
|
+
|
|
|
+ this.option = this.changeArr(list1);
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val;
|
|
|
+ },
|
|
|
+ batchApprove(isPass) {
|
|
|
+ console.log(this.multipleSelection);
|
|
|
+ var ids = '';
|
|
|
+ for (var i=0;i<this.multipleSelection.length; i++) {
|
|
|
+ var line = this.multipleSelection[i];
|
|
|
+ var array = line.data;
|
|
|
+ for (var m=0;m<array.length; m++) {
|
|
|
+ ids += array[m].id+',';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ids.length > 0) {
|
|
|
+ ids = ids.substring(0, ids.length-1);
|
|
|
+ }
|
|
|
+ this.http.post(isPass?'/report/batchApproveReport':'/report/batchDenyReport', {ids: ids},
|
|
|
+ res => {
|
|
|
+ this.listLoading = false;
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.listLoading = false;
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
//分页
|
|
|
handleCurrentChange(val) {
|
|
|
this.page = val;
|
|
@@ -113,16 +180,22 @@
|
|
|
this.getList();
|
|
|
},
|
|
|
|
|
|
- //获取项目列表
|
|
|
+ //获取待审核的数据列表
|
|
|
getList() {
|
|
|
this.listLoading = true;
|
|
|
- let form = {}
|
|
|
- if(this.search.value==-1) {
|
|
|
- form.date = this.search.date
|
|
|
+ // let form = {}
|
|
|
+ // if(this.search.value==-1) {
|
|
|
+ // form.date = this.search.date
|
|
|
+ // } else {
|
|
|
+ // form.state = this.search.value;
|
|
|
+ // }
|
|
|
+ if (this.search.departmentIdArray == null) {
|
|
|
+ this.search.departmentId = null;
|
|
|
} else {
|
|
|
- form.state = this.search.value;
|
|
|
+ var length = this.search.departmentIdArray.length;
|
|
|
+ this.search.departmentId = this.search.departmentIdArray[length-1];
|
|
|
}
|
|
|
- this.http.post(this.search.value==-1?this.port.report.list:this.port.report.portList, form,
|
|
|
+ this.http.post(this.port.report.portList, this.search,
|
|
|
res => {
|
|
|
this.listLoading = false;
|
|
|
if (res.code == "ok") {
|
|
@@ -147,19 +220,14 @@
|
|
|
approve(id,date, item) {
|
|
|
console.log(item);
|
|
|
this.logining = true;
|
|
|
- var time = "";
|
|
|
- if(this.search.value == -1) {
|
|
|
- time = this.search.date;
|
|
|
- } else {
|
|
|
- time = date;
|
|
|
- }
|
|
|
+
|
|
|
var ids = '';
|
|
|
var data = item.data;
|
|
|
data.forEach(element => {
|
|
|
ids +=(element.id+',');
|
|
|
});
|
|
|
|
|
|
- this.http.post( this.port.report.approve, {id: id , date: time, reportIds: ids},
|
|
|
+ this.http.post(this.port.report.approve, {id: id ,reportIds: ids},
|
|
|
res => {
|
|
|
this.logining = false;
|
|
|
if (res.code == "ok") {
|
|
@@ -183,16 +251,52 @@
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+// 修改数组
|
|
|
+ changeArr(arr) {
|
|
|
+ for (var i = 0; i < arr.length; i++) {
|
|
|
+ if(arr[i].id != -1 && arr[i].id != 0) {
|
|
|
+ if (arr[i].children != null && arr[i].children.length>0) {
|
|
|
+ arr[i].children = this.changeArr(arr[i].children);
|
|
|
+ }
|
|
|
+ arr[i].id && (arr[i].value = arr[i].id);
|
|
|
+ delete arr[i].id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(var i in arr) {
|
|
|
+ if(arr[i].id == -1 || arr[i].id == 0) {
|
|
|
+ arr.splice(i,1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+ },
|
|
|
+
|
|
|
+ //获取项目列表
|
|
|
+ getProjectList() {
|
|
|
+ this.listLoading = true;
|
|
|
+ this.http.post( this.port.project.list, {},
|
|
|
+ res => {
|
|
|
+ this.listLoading = false;
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.projectList = res.data;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.listLoading = false;
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
// 未通过日报
|
|
|
deny(id,i,date, item) {
|
|
|
this.logining = true;
|
|
|
- var time = "";
|
|
|
- if(this.search.value == -1) {
|
|
|
- time = this.search.date;
|
|
|
- } else {
|
|
|
- time = date;
|
|
|
- }
|
|
|
+ var time = date;
|
|
|
var ids = '';
|
|
|
var data = item.data;
|
|
|
data.forEach(element => {
|
|
@@ -225,14 +329,16 @@
|
|
|
},
|
|
|
created() {
|
|
|
let height = window.innerHeight;
|
|
|
- this.tableHeight = height - 85;
|
|
|
+ this.tableHeight = height - 125;
|
|
|
const that = this;
|
|
|
window.onresize = function temp() {
|
|
|
- that.tableHeight = window.innerHeight - 85;
|
|
|
+ that.tableHeight = window.innerHeight - 125;
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getList();
|
|
|
+ this.getDepartment();
|
|
|
+ this.getProjectList();
|
|
|
}
|
|
|
};
|
|
|
</script>
|