|
@@ -17,11 +17,11 @@
|
|
|
<span >
|
|
|
<span>日期:</span>
|
|
|
<span v-for="(item,index) in allDate" :id="'day'+index" :class="index==choseDay?'chooseDate date_item':'date_item'"
|
|
|
- @click="choseDate(index)" :key="index">{{item}}</span>
|
|
|
+ @click="choseDate(index, item)" :key="index">{{item}}</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <div style="float:left;width:200px;" v-if="user.role == 1">
|
|
|
+ <div style="display:flex;">
|
|
|
+ <div v-if="user.role > 0">
|
|
|
<div>
|
|
|
<el-select v-model="selectState" size="small" @change="stateChange">
|
|
|
<el-option value="-1" label="全部状态" >全部状态</el-option>
|
|
@@ -29,6 +29,7 @@
|
|
|
<el-option value="1" label="已通过">已通过</el-option>
|
|
|
<el-option value="0" label="待审核">待审核</el-option>
|
|
|
<el-option value="2" label="不通过">不通过</el-option>
|
|
|
+ <el-option value="3" label="已撤回">已撤回</el-option>
|
|
|
</el-select></div>
|
|
|
<div>
|
|
|
<el-tree :data="data" @node-click="handleNodeClick" >
|
|
@@ -48,23 +49,35 @@
|
|
|
<span v-if="data.isUser == 1 && data.state == 2" style="color:red;">
|
|
|
未通过
|
|
|
</span>
|
|
|
+ <span v-if="data.isUser == 1 && data.state == 3" style="color:red;">
|
|
|
+ 已撤回
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</span>
|
|
|
</el-tree>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div :style="'height:'+tableHeight+'px;width:0.5px;background:#eee;margin-right:10px;float:left;'" ></div>
|
|
|
- <div class="allDaily" style="float:left;">
|
|
|
- <div class="report_title"><span>工作日报 | {{depData.label}}</span> - 已填写<span style="margin-left:5px;margin-right:5px;color:red;">{{reportList.length}}</span>人,
|
|
|
+ <div :style="'height:'+tableHeight+'px;width:0.5px;background:#eee;margin-right:10px;margin-left:10px;'" ></div>
|
|
|
+ <div class="allDaily" style="float:left;flex-grow:1">
|
|
|
+ <!--系统管理员 -->
|
|
|
+ <div class="report_title" v-if="user.role > 0">
|
|
|
+ <span>工作日报 | {{depData.label}}</span> - 已填写<span style="margin-left:5px;margin-right:5px;color:green;">{{reportList.length}}</span>人,
|
|
|
未填写<span style="margin-left:5px;margin-right:5px;color:red;">{{(depData == null?data[0].membCount:(depData.isUser == 1?1:depData.membCount))-reportList.length}}</span>人
|
|
|
<span style="float:right;">
|
|
|
<el-link type="primary" style="margin-right:10px;" :underline="false" @click="fillInReport(-1)">填写日报</el-link>
|
|
|
- <el-link type="primary" style="margin-right:10px;" :underline="false" v-if="user.role != 0" @click="exportReport">导出日报</el-link>
|
|
|
- <el-link type="primary" style="margin-right:10px;" :underline="false" v-if="user.role != 0" @click="batchApprove">批量审核</el-link>
|
|
|
+ <el-link type="primary" style="margin-right:10px;" :underline="false" @click="exportReport">导出日报</el-link>
|
|
|
+ <el-link type="primary" style="margin-right:10px;" :underline="false" @click="batchApprove">批量审核</el-link>
|
|
|
</span>
|
|
|
</div>
|
|
|
- <div style="height:490px;overflow:scroll;padding-top:10px;">
|
|
|
+ <!--普通员工,含项目经理 -->
|
|
|
+ <div class="report_title" v-if="user.role==0"><span>日报列表</span>
|
|
|
+ <span style="float:right;" v-if="user.role==0">
|
|
|
+ <el-link type="primary" style="margin-right:10px;" :underline="false" @click="fillInReport(-1)">填写日报</el-link>
|
|
|
+ <el-link type="primary" v-if="user.leader" style="margin-right:10px;" :underline="false" @click="batchApprove">批量审核</el-link>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div :style="'height:'+(tableHeight-50)+'px;overflow:scroll;padding-top:10px;'">
|
|
|
<div class="one_daily" v-for="(item1,index1) in reportList" :key="index1">
|
|
|
<i class="fa fa-circle"></i>{{item1.name}}
|
|
|
<span style="margin-left:30px;">
|
|
@@ -76,24 +89,30 @@
|
|
|
<span style="margin-left:10px;">成本:</span>
|
|
|
<span >{{item1.cost}}</span>元
|
|
|
</span>
|
|
|
- <!-- <el-link v-if="user.role != 0" type="primary" :underline="false" @click="junpToDeskTop(item1.id)">系统智能统计:{{item1.calculateTime}}h</el-link>
|
|
|
- <span v-else>系统智能统计:{{item1.calculateTime}}h</span> -->
|
|
|
- <span style="margin-left:15px;color:#DAA520;" v-if="item1.state == 0">[ 待审核 ]</span>
|
|
|
- <span style="margin-left:15px;color:#32CD32;" v-else-if="item1.state == 1">[ 已通过 ]</span>
|
|
|
- <span style="margin-left:15px;color:#FF0000;" v-else-if="item1.state == 2">[ 已驳回 ]</span>
|
|
|
</span>
|
|
|
<div class="checkbtn">
|
|
|
- <el-button v-if="user.role != 0 && item1.state == 0" type="primary" :loading="logining" size="small" @click="approve(item1.id)">通过</el-button>
|
|
|
- <el-button v-if="user.role != 0 && item1.state == 0" type="danger" :loading="logining" size="small" @click="deny(item1.id,0)">驳回</el-button>
|
|
|
- <el-button v-if="user.role != 0 && item1.state == 1" type="danger" :loading="logining" size="small" @click="deny(item1.id,1)">撤销</el-button>
|
|
|
- <el-button v-if="item1.state == 2 && user.id == item1.id" type="primary" size="small" @click="fillInReport(index1)">编辑日报</el-button>
|
|
|
+ <el-button v-if="(user.role != 0 || user.id == item1.data[0].inchargerId) && item1.state == 0" type="primary" :loading="logining" size="small" @click="approve(item1.id, item1)">通过</el-button>
|
|
|
+ <el-button v-if="(user.role != 0 || user.id == item1.data[0].inchargerId) && item1.state == 0" type="danger" :loading="logining" size="small" @click="deny(item1.id,0, item1)">驳回</el-button>
|
|
|
+ <!--自己可以撤回待审核状态的报告 -->
|
|
|
+ <el-button v-if="(user.id == item1.id) && item1.state == 0" type="normal" :loading="logining" size="small" @click="cancel(item1)">撤回</el-button>
|
|
|
+ <el-button v-if="(user.role != 0 || user.id == item1.data[0].inchargerId) && item1.state == 1" type="normal" :loading="logining" size="small" @click="deny(item1.id,1, item1)">撤销</el-button>
|
|
|
+ <el-button v-if="item1.state >= 2 && user.id == item1.id" type="primary" size="small" @click="fillInReport(index1)">编辑日报</el-button>
|
|
|
</div>
|
|
|
<div class="one_daily_body">
|
|
|
<el-timeline>
|
|
|
<el-timeline-item v-for="(item2,index2) in item1.data" :key="index2">
|
|
|
<el-card shadow="never">
|
|
|
- <p>项目:<b>{{item2.project}}</b></p>
|
|
|
- <p>时长:{{item2.time}}h ({{typeList[item2.timeType]}})</p>
|
|
|
+ <p>项目:<b>{{item2.project}}</b><span v-if="item2.subProjectName != null"> / {{item2.subProjectName}}</span>
|
|
|
+ <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0">[ 待审核 ]</span>
|
|
|
+ <span style="margin-left:15px;color:#32CD32;" v-else-if="item2.state == 1">[ 已通过 ]</span>
|
|
|
+ <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 2">[ 已驳回 ]</span>
|
|
|
+ <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 3">[ 已撤回 ]</span>
|
|
|
+ </p>
|
|
|
+ <p>时长:
|
|
|
+ <span v-if="item2.reportTimeType == 0" style="margin-right:10px;">{{typeList[item2.timeType]}}</span>
|
|
|
+ <span v-if="item2.reportTimeType == 2" style="margin-right:10px;">{{item2.startTime+'-'+item2.endTime}}</span>
|
|
|
+ {{item2.time.toFixed(1)}}h
|
|
|
+ </p>
|
|
|
<p>事项:<span v-html="item2.content"></span></p>
|
|
|
</el-card>
|
|
|
</el-timeline-item>
|
|
@@ -101,7 +120,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 简陋的无报告提示 -->
|
|
|
- <div v-if="reportList.length==0" style="width:800px;font-size:17px;text-align:center;color:#aaa;">今日暂无报告</div>
|
|
|
+ <div v-if="reportList.length==0" style="width:100%;font-size:17px;text-align:center;color:#aaa;">{{curDate}}暂无报告</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -121,12 +140,15 @@
|
|
|
</el-form-item> -->
|
|
|
|
|
|
<div v-for="(domain, index) in workForm.domains" :key="domain.id">
|
|
|
- <el-form-item label="工作时间" :prop="'domains.' + index + '.timeType'"
|
|
|
- :rules="{ required: true, message: '请选择工作时间', trigger: 'blur' }">
|
|
|
+ <el-form-item label="工作时长" :prop="'domains.' + index + '.timeType'"
|
|
|
+ :rules="{ required: true, message: '请选择工作时长', trigger: 'blur' }">
|
|
|
<!-- <el-input v-model.number="domain.workingTime" placeholder="请输入投入时长" type='number' clearable style="width:200px;"
|
|
|
:disabled="workForm.domains.length==0?true:(workForm.domains[0].state==2?false:true)"></el-input> -->
|
|
|
- <el-select v-model="domain.timeType" placeholder="请选择工作时间"
|
|
|
- :disabled="workForm.domains.length==0?true:(workForm.domains[0].state==2?false:true)"
|
|
|
+ <!-- 全天/上下午 -->
|
|
|
+ <el-select v-model="domain.timeType"
|
|
|
+ v-if="reportTimeType.type == 0"
|
|
|
+ placeholder="请选择工作时长"
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
|
|
|
@change="onTimeTypeChange(domain.timeType)">
|
|
|
<el-option
|
|
|
v-for="item in timeType"
|
|
@@ -134,38 +156,78 @@
|
|
|
:label="item.label"
|
|
|
:value="item.value">
|
|
|
</el-option>
|
|
|
- </el-select>
|
|
|
+ </el-select>
|
|
|
+ <!-- 数字时长选择 -->
|
|
|
+ <el-select v-model="domain.workingTime"
|
|
|
+ v-if="reportTimeType.type == 1"
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
|
|
|
+ placeholder="请选择工作时长" >
|
|
|
+ <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
|
|
|
+ </el-select>
|
|
|
+ <span v-if="reportTimeType.type == 1">小时</span>
|
|
|
+ <span v-if="reportTimeType.type == 2">
|
|
|
+ <!--时间范围选择 -->
|
|
|
+ <el-time-select
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
|
|
|
+ placeholder="起始时间"
|
|
|
+ style="width:120px;"
|
|
|
+ v-model="domain.startTime"
|
|
|
+ :picker-options="{
|
|
|
+ start: '08:00',
|
|
|
+ step: '00:30',
|
|
|
+ end: '23:30'
|
|
|
+ }">
|
|
|
+ </el-time-select> - <el-time-select
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
|
|
|
+ placeholder="结束时间"
|
|
|
+ style="width:120px;"
|
|
|
+ v-model="domain.endTime"
|
|
|
+ :picker-options="{
|
|
|
+ start: '08:00',
|
|
|
+ step: '00:30',
|
|
|
+ end: '23:30',
|
|
|
+ minTime: domain.startTime
|
|
|
+ }">
|
|
|
+ </el-time-select>
|
|
|
+ </span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="投入项目" :prop="'domains.' + index + '.projectId'"
|
|
|
:rules="{ required: true, message: '请选择投入项目', trigger: ['change','blur'] }">
|
|
|
- <el-select v-model="domain.projectId" placeholder="请选择" style="width:200px;"
|
|
|
- :disabled="workForm.domains.length==0?true:(workForm.domains[0].state==2?false:true)">
|
|
|
+ <el-select v-model="domain.projectId" placeholder="请选择" style="width:200px;" clearable="true" @change="selectProject(domain, index)"
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
|
|
|
<el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
+ <!--子项目 -->
|
|
|
+ <el-select v-model="domain.subProjectId" placeholder="请选择" style="width:200px;" clearable="true" v-if="domain.subProjectList != null && domain.subProjectList.length> 0"
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
|
|
|
+ <el-option v-for="item in domain.subProjectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
<el-link v-if="index >= 1" type="primary" :underline="false" @click="delDomain(index)" style="float:right;margin-right:10px;"
|
|
|
- :disabled="workForm.domains.length==0?true:(workForm.domains[0].state==2?false:true)">
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
|
|
|
<i class="fa fa-trash" style="color: red;;font-size:18px;"></i>
|
|
|
</el-link>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="工作事项" :prop="'domains.' + index + '.content'" >
|
|
|
- <el-input v-model="domain.content" type="textarea" :rows="4" placeholder="请输入投入时长" clearable
|
|
|
- :disabled="workForm.domains.length==0?true:(workForm.domains[0].state==2?false:true)"></el-input>
|
|
|
+ <el-input v-model="domain.content" type="textarea" :rows="4" placeholder="请填写工作事项" clearable
|
|
|
+ :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-divider v-if="workForm.domains.length>1"></el-divider>
|
|
|
</div>
|
|
|
<el-link v-if="showAddMore" type="primary" :underline="false" @click="addDomain" style="margin-left:40px">添加更多</el-link>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="deleteReport" v-if="workForm.domains[0].id != null">删除</el-button>
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click="submitDepartment"
|
|
|
- :disabled="workForm.domains.length==0?true:(workForm.domains[0].state==2?false:true)" >提交</el-button>
|
|
|
+ :disabled="workForm.domains.length==0?true:(canEdit?false:true)" >提交</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 批量日报审核 -->
|
|
|
<el-dialog title="批量日报审核" :visible.sync="approveDialogVisible" width="500px">
|
|
|
- <el-checkbox v-model="isAllSelect" label="全选" style="margin-left:24px;" @change="selectAll" v-if="batchShowData.length > 0"></el-checkbox>
|
|
|
- <el-tree ref="approveTree" node-key="id" :data="batchShowData" show-checkbox="true" @check-change="handleCheckChange" >
|
|
|
+ <el-checkbox v-model="isAllSelect" label="全选" style="margin-left:24px;" @change="selectAll" v-if="reportNames.length > 0"></el-checkbox>
|
|
|
+ <el-tree ref="approveTree" node-key="id" :data="reportNames" show-checkbox="true" @check-change="handleCheckChange" >
|
|
|
</el-tree>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="approveDialogVisible = false">取消</el-button>
|
|
@@ -182,6 +244,12 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ subProjectList:[],
|
|
|
+ canEdit: true,
|
|
|
+ timeRange:[0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.5,13.0,13.5,14.0,14.5,15.0],
|
|
|
+ selectTime:null,
|
|
|
+ reportTimeType:{},
|
|
|
+ curDate:'',
|
|
|
isAllSelect: false,
|
|
|
approveDialogVisible:false,
|
|
|
deptId:null,
|
|
@@ -200,6 +268,7 @@
|
|
|
|
|
|
projectList: [], //项目列表
|
|
|
reportList: [], //日报列表
|
|
|
+ reportNames:[], //批量审批列表
|
|
|
|
|
|
dialogVisible: false, //项目弹窗
|
|
|
report: '',
|
|
@@ -247,6 +316,70 @@
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ //项目选中了, 加载子项目
|
|
|
+ selectProject(domain, index) {
|
|
|
+ this.http.post('/sub-project/list',{
|
|
|
+ projectId: domain.projectId
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.workForm.domains[index].subProjectList = res.data;
|
|
|
+ // domain.subProjectList = res.data;
|
|
|
+ // console.log(domain.subProjectList);
|
|
|
+ this.$forceUpdate();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.listLoading = false;
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ //删除自己的日报
|
|
|
+ deleteReport() {
|
|
|
+ this.$confirm("确定要删除该日报吗?","提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.listLoading = true;
|
|
|
+ this.http.post('/report/delete',{
|
|
|
+ userId: this.user.id,
|
|
|
+ date: this.workForm.createDate
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ this.listLoading = false;
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.$message({
|
|
|
+ message: "删除成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getReportList();
|
|
|
+ this.getDepartment();
|
|
|
+ this.dialogVisible = false;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.listLoading = false;
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+
|
|
|
+ },
|
|
|
//提交批量审核数据
|
|
|
submitBatchApprove() {
|
|
|
console.log(this.$refs.approveTree.getCheckedNodes());
|
|
@@ -266,6 +399,7 @@
|
|
|
}
|
|
|
}
|
|
|
let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
|
|
|
+ console.log('ids==='+ids);
|
|
|
this.http.post("/report/batchApproveReport", {ids:ids, date:this.date + day},
|
|
|
res => {
|
|
|
if (res.code == "ok") {
|
|
@@ -293,7 +427,7 @@
|
|
|
selectAll() {
|
|
|
if (this.isAllSelect) {
|
|
|
var keys = [];
|
|
|
- this.batchShowData.forEach(b=>{
|
|
|
+ this.reportNames.forEach(b=>{
|
|
|
keys.push(b.id);
|
|
|
})
|
|
|
this.$refs.approveTree.setCheckedKeys(keys);
|
|
@@ -305,14 +439,21 @@
|
|
|
batchApprove() {
|
|
|
this.approveDialogVisible = true;
|
|
|
console.log(this.allData);
|
|
|
- this.batchShowData = JSON.parse(JSON.stringify(this.allData));
|
|
|
- //去掉全部人员
|
|
|
- this.batchShowData.splice(0,1);
|
|
|
- //过滤。只显示待审核的
|
|
|
- this.filterState(0, this.batchShowData);
|
|
|
- this.calculateMembCount(this.batchShowData);
|
|
|
- //去掉空的部门
|
|
|
- this.removeEmptyNode(this.batchShowData);
|
|
|
+ this.reportNames = [];
|
|
|
+ for (var i=0;i<this.reportList.length; i++) {
|
|
|
+ var report = this.reportList[i];
|
|
|
+ var hasUnChecked =false;
|
|
|
+ var id = '';
|
|
|
+ for (var j=0;j<report.data.length; j++) {
|
|
|
+ if (report.data[j].state == 0) {
|
|
|
+ hasUnChecked = true;
|
|
|
+ id += report.data[j].id+',';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (hasUnChecked) {
|
|
|
+ this.reportNames.push({id:id, label: report.name});
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
removeEmptyNode(list) {
|
|
|
for (var i=0;i<list.length;i++) {
|
|
@@ -514,6 +655,10 @@
|
|
|
res => {
|
|
|
if (res.code == "ok") {
|
|
|
var t = res.data;
|
|
|
+ this.reportTimeType = t;
|
|
|
+ if (this.reportTimeType.type > 0) {
|
|
|
+ this.showAddMore = true;
|
|
|
+ }
|
|
|
//转化时间格式
|
|
|
if (t.allday != null) {
|
|
|
this.timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
|
|
@@ -522,7 +667,7 @@
|
|
|
this.timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
|
|
|
}
|
|
|
if (t.pm != null) {
|
|
|
- this.timeType.push({value:2, label:'上午 - '+t.pm+'小时', hours: t.pm});
|
|
|
+ this.timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
|
|
|
}
|
|
|
} else {
|
|
|
this.$message({
|
|
@@ -548,12 +693,13 @@
|
|
|
},
|
|
|
|
|
|
// 选择日期
|
|
|
- choseDate(i) {
|
|
|
+ choseDate(i, item) {
|
|
|
this.choseDay = i;
|
|
|
let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
|
|
|
sessionStorage.msg = this.date + day,
|
|
|
this.getReportList();
|
|
|
this.getDepartment();
|
|
|
+ this.curDate = item;
|
|
|
},
|
|
|
|
|
|
// 获取日期列表
|
|
@@ -579,6 +725,9 @@
|
|
|
dayArry.push(str);
|
|
|
}
|
|
|
this.allDate = dayArry;
|
|
|
+ if (sessionStorage.msg) {
|
|
|
+ this.curDate = sessionStorage.msg;
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
getCountDays() {
|
|
@@ -691,6 +840,7 @@
|
|
|
this.report = list;
|
|
|
if(list.report.length != 0) {
|
|
|
var arr = [];
|
|
|
+ this.canEdit = false;
|
|
|
for(var i in list.report) {
|
|
|
arr.push({
|
|
|
id: list.report[i].id,
|
|
@@ -700,6 +850,9 @@
|
|
|
state: list.report[i].state,
|
|
|
timeType: list.report[i].timeType
|
|
|
})
|
|
|
+ if (list.report[i].state >= 2) {
|
|
|
+ this.canEdit = true;
|
|
|
+ }
|
|
|
}
|
|
|
this.workForm = {
|
|
|
createDate: this.workForm.createDate,
|
|
@@ -717,6 +870,7 @@
|
|
|
timeType:0,
|
|
|
}],
|
|
|
}
|
|
|
+ this.canEdit = true;
|
|
|
}
|
|
|
} else {
|
|
|
this.$message({
|
|
@@ -737,40 +891,46 @@
|
|
|
fillInReport(i) {
|
|
|
if(i == -1) {
|
|
|
this.isDisable = false;
|
|
|
- let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
|
|
|
- this.workForm.createDate = this.date + day;
|
|
|
} else {
|
|
|
this.isDisable = true;
|
|
|
-
|
|
|
}
|
|
|
+ let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
|
|
|
+ this.workForm.createDate = this.date + day;
|
|
|
this.getReport(i);
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
|
|
|
// 添加模块
|
|
|
addDomain() {
|
|
|
-
|
|
|
this.workForm.domains.push({
|
|
|
projectId: "",
|
|
|
workingTime: "",
|
|
|
content: "",
|
|
|
+ state:2,//2-表示待提交
|
|
|
});
|
|
|
- //检测时间段数量,达到2个,不能再加了
|
|
|
- var length = this.workForm.domains.length;
|
|
|
- if (length == 2) {
|
|
|
- this.showAddMore = false;
|
|
|
+
|
|
|
+ if (this.reportTimeType.type == 0) {
|
|
|
+ //全天上下午模式下,检测时间段数量,达到2个,不能再加了
|
|
|
+ var length = this.workForm.domains.length;
|
|
|
+ if (length == 2) {
|
|
|
+ this.showAddMore = false;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
|
|
|
// 移除模块
|
|
|
delDomain(i) {
|
|
|
this.workForm.domains.splice(i,1)
|
|
|
//检测当前剩下的一个,时间类型是否是全天
|
|
|
- if (this.workForm.domains[0].timeType == 0) {
|
|
|
- this.showAddMore = false;
|
|
|
- } else {
|
|
|
- this.showAddMore = true;
|
|
|
+ if (this.reportTimeType.type == 0) {
|
|
|
+ if (this.workForm.domains[0].timeType == 0) {
|
|
|
+ this.showAddMore = false;
|
|
|
+ } else {
|
|
|
+ this.showAddMore = true;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
|
|
|
// 改变月份
|
|
@@ -783,47 +943,49 @@
|
|
|
this.$refs.workForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
//检查时间,全天和上下午不能同时存在
|
|
|
- var alldayNum = 0;
|
|
|
- var amNum = 0;
|
|
|
- var pmNum = 0;
|
|
|
- for(var i in this.workForm.domains) {
|
|
|
- if (this.workForm.domains[i].timeType == 0) {
|
|
|
- alldayNum ++;
|
|
|
- } else if (this.workForm.domains[i].timeType == 1) {
|
|
|
- amNum++;
|
|
|
- } else if (this.workForm.domains[i].timeType == 2) {
|
|
|
- pmNum++;
|
|
|
+ if (this.reportTimeType.type == 0) {
|
|
|
+ var alldayNum = 0;
|
|
|
+ var amNum = 0;
|
|
|
+ var pmNum = 0;
|
|
|
+ for(var i in this.workForm.domains) {
|
|
|
+ if (this.workForm.domains[i].timeType == 0) {
|
|
|
+ alldayNum ++;
|
|
|
+ } else if (this.workForm.domains[i].timeType == 1) {
|
|
|
+ amNum++;
|
|
|
+ } else if (this.workForm.domains[i].timeType == 2) {
|
|
|
+ pmNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (alldayNum > 1) {
|
|
|
+ this.$message({
|
|
|
+ message: "工作时间-全天,只能选择一次",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (amNum > 1) {
|
|
|
+ this.$message({
|
|
|
+ message: "工作时间-上午,只能选择一次",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pmNum > 1) {
|
|
|
+ this.$message({
|
|
|
+ message: "工作时间-下午,只能选择一次",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
|
|
|
+ this.$message({
|
|
|
+ message: "工作时间-全天,不能和上下午同时存在",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
- if (alldayNum > 1) {
|
|
|
- this.$message({
|
|
|
- message: "工作时间-全天,只能选择一次",
|
|
|
- type: "error"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (amNum > 1) {
|
|
|
- this.$message({
|
|
|
- message: "工作时间-上午,只能选择一次",
|
|
|
- type: "error"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (pmNum > 1) {
|
|
|
- this.$message({
|
|
|
- message: "工作时间-下午,只能选择一次",
|
|
|
- type: "error"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
|
|
|
- this.$message({
|
|
|
- message: "工作时间-全天,不能和上下午同时存在",
|
|
|
- type: "error"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
this.listLoading = true;
|
|
|
let formData = new FormData();
|
|
|
for(var i in this.workForm.domains) {
|
|
@@ -833,9 +995,25 @@
|
|
|
formData.append("id", -1);
|
|
|
}
|
|
|
formData.append("projectId", this.workForm.domains[i].projectId);
|
|
|
- formData.append("timeType", this.workForm.domains[i].timeType);
|
|
|
- var workingTime = this.timeType.filter(t=>t.value == this.workForm.domains[i].timeType)[0].hours;
|
|
|
- formData.append("workingTime", workingTime);
|
|
|
+ if (this.workForm.domains[i].subProjectId != null) {
|
|
|
+ formData.append("subProjectId", this.workForm.domains[i].subProjectId);
|
|
|
+ } else {
|
|
|
+ formData.append("subProjectId", 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ formData.append("reportTimeType", this.reportTimeType.type);
|
|
|
+ if (this.reportTimeType.type == 0) {
|
|
|
+ formData.append("timeType", this.workForm.domains[i].timeType);
|
|
|
+ var workingTime = this.timeType.filter(t=>t.value == this.workForm.domains[i].timeType)[0].hours;
|
|
|
+ formData.append("workingTime", workingTime);
|
|
|
+ } else if (this.reportTimeType.type == 1){
|
|
|
+ formData.append("workingTime", this.workForm.domains[i].workingTime);
|
|
|
+ } else if (this.reportTimeType.type == 2) {
|
|
|
+ formData.append("startTime", this.workForm.domains[i].startTime);
|
|
|
+ formData.append("endTime", this.workForm.domains[i].endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (this.workForm.domains[i].content == null || this.workForm.domains[i].content == '') {
|
|
|
formData.append("content", '-');
|
|
|
} else {
|
|
@@ -880,10 +1058,16 @@
|
|
|
},
|
|
|
|
|
|
// 通过日报
|
|
|
- approve(id) {
|
|
|
+ approve(id, item) {
|
|
|
this.logining = true;
|
|
|
let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
|
|
|
- this.http.post( this.port.report.approve, {id: id , date: this.date +day},
|
|
|
+
|
|
|
+ var ids = '';
|
|
|
+ var data = item.data;
|
|
|
+ data.forEach(element => {
|
|
|
+ ids +=(element.id+',');
|
|
|
+ });
|
|
|
+ this.http.post( this.port.report.approve, {id: id , date: this.date +day, reportIds: ids},
|
|
|
res => {
|
|
|
this.logining = false;
|
|
|
if (res.code == "ok") {
|
|
@@ -909,11 +1093,51 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ //撤回日报
|
|
|
+ cancel(item) {
|
|
|
+ this.logining = true;
|
|
|
+
|
|
|
+ var ids = '';
|
|
|
+ var data = item.data;
|
|
|
+ data.forEach(element => {
|
|
|
+ ids +=(element.id+',');
|
|
|
+ });
|
|
|
+ this.http.post(this.port.report.cancelReport, {userId: this.user.id, reportIds: ids},
|
|
|
+ res => {
|
|
|
+ this.logining = false;
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.$message({
|
|
|
+ message:"撤回成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getReportList();
|
|
|
+ this.getDepartment();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.logining = false;
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
// 未通过日报
|
|
|
- deny(id,i) {
|
|
|
+ deny(id,i, item) {
|
|
|
this.logining = true;
|
|
|
let day = this.choseDay > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
|
|
|
- this.http.post( this.port.report.deny, {id: id , date: this.date +day},
|
|
|
+ var ids = '';
|
|
|
+ var data = item.data;
|
|
|
+ data.forEach(element => {
|
|
|
+ ids +=(element.id+',');
|
|
|
+ });
|
|
|
+ this.http.post( this.port.report.deny, {id: id , date: this.date +day, reportIds: ids},
|
|
|
res => {
|
|
|
this.logining = false;
|
|
|
if (res.code == "ok") {
|
|
@@ -942,11 +1166,13 @@
|
|
|
},
|
|
|
created() {
|
|
|
let height = window.innerHeight;
|
|
|
- this.tableHeight = height - 233;
|
|
|
+ console.log('window inner height=='+height)
|
|
|
+ this.tableHeight = height - 153;
|
|
|
const that = this;
|
|
|
window.onresize = function temp() {
|
|
|
- that.tableHeight = window.innerHeight - 233;
|
|
|
+ that.tableHeight = window.innerHeight - 153;
|
|
|
};
|
|
|
+
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getAllDate();
|