| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <el-row v-loading="taskLoading" :gutter="10" type="flex" style="flex-wrap: wrap; row-gap: 10px;"> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12"> |
| | | <el-card class="box-card" shadow="never" style="width: 100%" body-style="padding: 10px"> |
| | | <el-tabs v-model="tobeOver" style="height: 200px;" @tab-click="handleClickTobeTasked"> |
| | | <el-tab-pane :label="tobeTasked" name="first"> |
| | | <el-table |
| | | :data="adventTasks" |
| | | height="180" |
| | | :show-header="false" |
| | | > |
| | | <el-table-column |
| | | prop="name" |
| | | :show-overflow-tooltip="true" |
| | | min-width="140px" |
| | | /> |
| | | <el-table-column |
| | | prop="taskStartDate" |
| | | :show-overflow-tooltip="true" |
| | | width="140px" |
| | | /> |
| | | <el-table-column |
| | | prop="taskEndDate" |
| | | :show-overflow-tooltip="true" |
| | | width="140px" |
| | | /> |
| | | <el-table-column width="100px" style="align-items: center"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="primary" size="mini" @click="quickFilling(scope.row)">填写日报</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12"> |
| | | <el-card class="box-card" shadow="never" style="width: 100%" body-style="padding: 10px"> |
| | | <el-tabs v-model="activeName" style="height: 200px;"> |
| | | <el-tab-pane :label="tasking" name="first"> |
| | | <el-table |
| | | v-if="ongoingTasks.length != 0" |
| | | :data="ongoingTasks" |
| | | height="180" |
| | | :show-header="false" |
| | | :stripe="true" |
| | | > |
| | | <el-table-column |
| | | prop="name" |
| | | :show-overflow-tooltip="true" |
| | | min-width="140px" |
| | | /> |
| | | <el-table-column |
| | | prop="taskStartDate" |
| | | :show-overflow-tooltip="true" |
| | | width="140px" |
| | | /> |
| | | <el-table-column |
| | | prop="taskEndDate" |
| | | :show-overflow-tooltip="true" |
| | | width="140px" |
| | | /> |
| | | <el-table-column width="100px" style="align-items: center"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="primary" size="mini" @click="quickFilling(scope.row)">填写日报</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <span v-else>暂无任务</span> |
| | | </el-tab-pane> |
| | | <el-tab-pane :label="tobeTask" name="second"> |
| | | <el-table |
| | | v-if="taskNotStarted.length != 0" |
| | | :data="taskNotStarted" |
| | | height="180" |
| | | :show-header="false" |
| | | > |
| | | <el-table-column |
| | | prop="name" |
| | | :show-overflow-tooltip="true" |
| | | min-width="140px" |
| | | /> |
| | | <el-table-column |
| | | prop="taskStartDate" |
| | | :show-overflow-tooltip="true" |
| | | width="140px" |
| | | /> |
| | | <el-table-column |
| | | prop="taskEndDate" |
| | | :show-overflow-tooltip="true" |
| | | width="140px" |
| | | /> |
| | | <el-table-column width="100px" style="align-items: center"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="primary" size="mini" @click="quickFilling(scope.row)">填写日报</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <span v-else>暂无任务</span> |
| | | </el-tab-pane> |
| | | <!--<el-tab-pane label="未分配任务" name="third" style=":display: false">未分配任务</el-tab-pane>--> |
| | | </el-tabs> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider /> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery"> |
| | | <el-date-picker |
| | | v-model="query.fillDates" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="请选择日报日期" |
| | | range-separator=" ~ " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | style="width: 285px;" |
| | | /> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" :loading="loadingProject" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery" @clear="clearQueryTasks"> |
| | | <el-option |
| | | v-for="item in queryProjects" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.taskId" filterable clearable placeholder="所属任务" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.taskMongoId" filterable clearable placeholder="所属任务" :loading="loadingTast" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in queryTasks" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.name" filterable clearable placeholder="任务名称" style="width: 185px;" class="filter-item" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-view" |
| | | style="margin-left: 4px !important;" |
| | | @click="statistics" |
| | | > |
| | | 统计 |
| | | </el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.report" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-document" |
| | | style="margin-left: 4px !important;" |
| | | @click="toGenerateReport" |
| | | > |
| | | 报告生成 |
| | | </el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="填写日期" prop="fillDate"> |
| | | <el-date-picker v-model="form.fillDate" type="date" style="width: 340px;" :disabled="disabledFlagBySettlement" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagBySettlement || userRolesLevelMin == roleLevelOrdinary" @change="formUserChange"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled" |
| | | /> |
| | | </el-select> |
| | | <el-form-item label="所属员工" prop="userNickName"> |
| | | <el-input v-model="form.userNickName" style="width: 340px;" :disabled="true" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagBySettlement || crud.status.edit == crudStatusPrepared" @change="formProjectChange"> |
| | | <el-option |
| | | v-for="item in formProjects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | <el-input v-if="crud.status.edit > 0" v-model="form.projectName" style="width: 340px;" :disabled="true" /> |
| | | <el-select v-else-if="queryProjects.length > 0" v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formProjectChange"> |
| | | <template v-if="loadingQueryProjectsOne" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | | <template v-if="!loadingQueryProjectsOne"> |
| | | <el-option |
| | | v-for="item in queryProjects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </template> |
| | | </el-select> |
| | | <el-select v-else v-model="form.projectId" filterable clearable :placeholder="loadingQueryProjectsOne ? '加载中' : '请选择'" style="width: 340px;" :disabled="form.flag" @change="formProjectChange"> |
| | | <template v-if="loadingQueryProjectsOne" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | | <template v-if="!loadingQueryProjectsOne"> |
| | | <el-option |
| | | v-for="item in queryProjects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </template> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属任务" prop="taskId"> |
| | | <el-select v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagBySettlement" @change="formTaskChange"> |
| | | <el-option |
| | | v-for="item in formTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | <el-input v-if="form.taskName" v-model="form.taskName" style="width: 340px;" :disabled="true" /> |
| | | <el-select v-else-if="formTasks.length > 0" v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskChange"> |
| | | <template v-if="loadingQueryProjects" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | | <template v-if="!loadingQueryProjects"> |
| | | <el-option |
| | | v-for="item in formTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </template> |
| | | </el-select> |
| | | <el-select v-else v-model="form.taskId" filterable clearable :placeholder="loadingQueryProjects ? '加载中' : '请选择'" style="width: 340px;" :disabled="form.flag" @change="formTaskChange"> |
| | | <template v-if="loadingQueryProjects" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | | <template v-if="!loadingQueryProjects"> |
| | | <el-option |
| | | v-for="item in formTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </template> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="分配任务" prop="taskUserMongo"> |
| | | <el-input v-if="form.taskUserMongo && form.taskUserMongo.name" v-model="form.taskUserMongo.name" style="width: 340px;" :disabled="true" /> |
| | | <el-select v-else-if="formTaskUserIds.length > 0" v-model="form.taskUserMongo.id" :allow-create="true" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange"> |
| | | <template v-if="loadingQueryProjectsTwo" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | | <template v-if="!loadingQueryProjects"> |
| | | <el-option |
| | | v-for="item in formTaskUserIds" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </template> |
| | | </el-select> |
| | | <el-select v-else v-model="form.taskUserMongo.id" filterable clearable :placeholder="loadingQueryProjectsTwo ? '加载中' : '请选择'" style="width: 340px;" :disabled="form.flag" @change="formTaskUserChange"> |
| | | <template v-if="loadingQueryProjectsTwo" #prefix> |
| | | <i class="el-icon-loading" /> |
| | | </template> |
| | | <template v-if="!loadingQueryProjectsTwo"> |
| | | <el-option |
| | | v-for="item in formTaskUserIds" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </template> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="填写日期" prop="fillDate"> |
| | | <el-date-picker :key="form.taskUserMongo.id" v-model="form.fillDate" value-format="yyyy-MM-dd" type="date" style="width: 340px;" :picker-options="{ disabledDate }" :disabled="form.taskUserMongo.id == null || crud.status.edit > 0" @change="formDateChange" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | 本日已填其他任务工时:{{ (1 * form.todayFixedHours).toFixed(2) }} / 本日打卡工时:{{ (1 * form.todayAttendanceHours).toFixed(2) }} |
| | | </el-form-item> |
| | | <el-form-item label="消耗工时" prop="consumedHours"> |
| | | <el-input v-model="form.consumedHours" style="width: 340px;" :disabled="disabledFlagBySettlement"> |
| | | <el-input v-model="form.consumedHours" style="width: 340px;" :disabled="disabledFlagBySettlement || form.fillDate == null" @input="watchFlagChange"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量" prop="consumedWorkload"> |
| | | <el-input v-model="form.consumedWorkload" style="width: 340px;" :disabled="disabledFlagBySettlement" /> |
| | | <el-form-item> |
| | | 本任务已消耗工时:{{ (1 * form.alreadyConsumedHours).toFixed(2) }} / 本任务总工时:{{ (1 * form.taskHours).toFixed(2) }} |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量单位" prop="consumedWorkloadUnit"> |
| | | <el-form-item label="成品时长" prop="taskSeconds"> |
| | | <el-input v-model="form.taskSeconds" style="width: 340px;"> |
| | | <template slot="append">秒</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.taskUserMongo && form.taskUserMongo.rid" label="问题数量" prop="issueCount"> |
| | | <el-input v-model="form.issueCount" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item v-else label="消耗积分" prop="pointsConsumed"> |
| | | <el-input v-model="form.pointsConsumed" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量" prop="consumedWorkload"> |
| | | <el-input v-model="form.consumedWorkload" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量单位"> |
| | | {{ dict.label[standardWorkloadUnit][form.consumedWorkloadUnit] }} |
| | | </el-form-item> |
| | | <el-form-item label="任务进度" prop="taskProgress"> |
| | |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item v-if="userRolesLevelMin != roleLevelOrdinary && crud.status.edit == crudStatusPrepared" label="结算状态" prop="settlementStatus"> |
| | | <el-select v-model="form.settlementStatus" filterable placeholder="请选择" style="width: 340px;" :disabled="disabledFlagBySettlement"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" :disabled="disabledFlagBySettlement" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="checkForm(1)">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!--统计数据表单--> |
| | | <el-dialog :close-on-click-modal="false" :visible.sync="centerDialogVisibleStatistics" title="统计数据" width="800px"> |
| | | <el-table v-loading="statisticsLoading" :data="statisticsData" size="small" style="width: 100%;"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="项目名称" fixed="left" min-width="100px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskName" label="任务名称" fixed="left" min-width="100px" /> |
| | | <el-table-column prop="settlementStatus" min-width="80px" label="绩效类型"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.taskUserMongo.performanceType === "1" ? "绩效" : "非绩效" }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceHours" label="分配工时" min-width="80px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskUserMongo.performanceHours }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="绩效工时" min-width="80px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" min-width="80px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | |
| | | <!--报告生成表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerateReport" :visible.sync="generateReportParam.visible" title="报告生成" width="580px"> |
| | | <el-form ref="reportForm" :model="generateReportParam.form" :rules="generateReportParam.rules" size="small" label-width="110px"> |
| | | <el-form-item label="考勤日期" prop="attendTime"> |
| | | <!-- <el-date-picker |
| | | v-model="generateReportParam.form.attendTime" |
| | | type="date" |
| | | placeholder="选择日期" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd" |
| | | align="right" |
| | | /> --> |
| | | <el-date-picker |
| | | v-model="generateReportParam.form.attendTime" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="请选择日期" |
| | | range-separator=" ~ " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | style="width: 370px;" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="generateReportParam.form.userId" filterable clearable placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <div class="tips-content">*选择员工则生成选中员工的考勤报告,未选择员工则更新所有员工(暂为开发部所有员工)的考勤报告</div> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerateReport">取消</el-button> |
| | | <el-button :loading="generateReportParam.loading" type="primary" @click="doGenerateReport">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | |
| | | <el-tag>{{ scope.row.taskName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="消耗工时" min-width="80px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="consumedWorkload" label="消耗工作量" min-width="80px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskWorkloadUnit" label="消耗工作量单位" min-width="110px"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskUserMongo.name" label="分配任务" min-width="180px"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.taskWorkloadUnit != null && scope.row.taskWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.taskWorkloadUnit] }}</el-tag> |
| | | <el-tag>{{ scope.row.taskUserMongo.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="消耗工时" min-width="80px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" min-width="80px"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" min-width="80px" label="结算状态"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" min-width="80px" label="绩效类型"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[settlementStatus][scope.row.settlementStatus] }}</el-tag> |
| | | <el-tag>{{ scope.row.taskUserMongo.performanceType === "1" ? "绩效" : "非绩效" }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" min-width="140px" /> |
| | | <el-table-column prop="createTime" label="创建时间" min-width="140px" /> |
| | | <el-table-column v-if="checkPer(['admin','taskDaliy:edit','taskDaliy:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | | <el-table-column v-if="checkPer(['admin','taskDaliy:add','taskDaliy:edit','taskDaliy:del'])" label="操作" width="180px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | v-if="userRolesLevelMin != roleLevelOrdinary || scope.row.userId == user.id" |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | <udOperation :data="scope.row" :permission="permission"> |
| | | <el-button |
| | | slot="left" |
| | | v-permission="permission.add" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-share" |
| | | @click="quickFilling1(scope.row)" |
| | | /> |
| | | </udOperation> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <el-dialog |
| | | title="提示" |
| | | :visible.sync="centerDialogVisibleTaskHours" |
| | | width="30%" |
| | | center |
| | | > |
| | | <span>本次日报的消耗工时已超过任务工时,确定要继续吗?</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="centerDialogVisibleTaskHours = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitDialogTaskHours">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | title="提示" |
| | | :visible.sync="centerDialogVisibleTaskProgress" |
| | | width="30%" |
| | | center |
| | | > |
| | | <span>本次日报的任务进度比您原本的任务进度要少,确定要继续吗?</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="centerDialogVisibleTaskProgress = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitDialogTaskProgress">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | |
| | | import pagination from '@crud/Pagination' |
| | | import { mapGetters } from 'vuex' |
| | | import constant from '../../../utils/constant' |
| | | import crudUser from '@/api/system/user' |
| | | import crudProject from '@/api/project/project' |
| | | import crudTask from '@/api/task/task' |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | import crudAttendance from '@/api/attendance/attendance' |
| | | import crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, projectId: null, taskId: null, userId: null, fillDate: null, consumedHours: null, consumedWorkload: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, projectId: null, taskId: null, taskName: null, taskMongoId: null, taskUserMongo: {}, userId: null, fillDate: null, consumedHours: null, todayFixedHours: 0, todayAttendanceHours: 0, alreadyConsumedHours: 0, taskHours: 0, consumedWorkload: null, consumedWorkloadUnit: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, taskSeconds: null, pointsConsumed: null, issueCount: null } |
| | | export default { |
| | | name: 'TaskDaliy', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | return CRUD({ title: '任务日报', url: 'api/taskDaliy', idField: 'id', sort: 'fillDate,desc', crudMethod: { ...crudTaskDaliy }}) |
| | | }, |
| | | data() { |
| | | // 时长(千内)验证 |
| | | // 时长(万内)验证 |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/ |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | | callback(new Error('请输入 一千 以内的正整数或两位小数')) |
| | | callback(new Error('请输入 一万 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | add: ['admin', 'taskDaliy:add'], |
| | | edit: ['admin', 'taskDaliy:edit'], |
| | | del: ['admin', 'taskDaliy:del'], |
| | | download: ['admin', 'taskDaliy:download'] |
| | | download: ['admin', 'taskDaliy:download'], |
| | | report: ['admin', 'taskDaliy:report'] |
| | | }, |
| | | rules: { |
| | | fillDate: [ |
| | | { required: true, message: '填写日期不能为空', trigger: 'change' } |
| | | ], |
| | | userId: [ |
| | | userNickName: [ |
| | | { required: true, message: '所属员工不能为空', trigger: 'change' } |
| | | ], |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | { required: true, message: '所属项目不能为空', trigger: 'blur' } |
| | | ], |
| | | taskId: [ |
| | | { required: true, message: '所属任务不能为空', trigger: 'change' } |
| | | { required: true, message: '所属任务不能为空', trigger: 'blur' } |
| | | ], |
| | | taskUserMongo: [ |
| | | { required: true, message: '分配任务不能为空', trigger: 'blur' } |
| | | ], |
| | | consumedHours: [ |
| | | { required: true, message: '消耗工时不能为空', trigger: 'blur' }, |
| | |
| | | queryTypeOptions: [ |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'taskId', display_name: '所属任务' } |
| | | { key: 'taskId', display_name: '所属任务' }, |
| | | { key: 'taskUserId', display_name: '分配任务' }, |
| | | { key: 'TaskUserName', display_name: '任务名称' }, |
| | | { key: 'taskMongoId', display_name: '任务名称' } |
| | | ], |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:结算状态 |
| | | settlementStatus: constant.SETTLEMENT_STATUS, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 字典:绩效对象 |
| | | performanceType: constant.PERFORMANCE_TYPE, |
| | | // 角色级别:超级管理员 |
| | | roleLevelSuper: constant.ROLE_LEVEL_SUPER, |
| | | // 角色级别:总经理 |
| | | roleLevelGeneral: constant.ROLE_LEVEL_GENERAL, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | | // 用户最大角色级别 |
| | |
| | | users: [], |
| | | // 检索项目列表 |
| | | queryProjects: [], |
| | | adventTasks: [], |
| | | ongoingTasks: [], |
| | | taskNotStarted: [], |
| | | // 检索任务列表 |
| | | queryTasks: [], |
| | | // 表单项目列表 |
| | | formProjects: [], |
| | | // 表单任务列表 |
| | | formTasks: [], |
| | | // 三级任务 |
| | | formTaskUserIds: [], |
| | | // 表单禁用标记(结算状态) |
| | | disabledFlagBySettlement: false |
| | | disabledFlagBySettlement: false, |
| | | // 当前月份 |
| | | currentMonth: new Date(), |
| | | // 当前TAB |
| | | activeName: 'first', |
| | | tobeOver: 'first', |
| | | tasking: '进行中任务', |
| | | tobeTask: '未着手任务', |
| | | tobeTasked: '临期任务', |
| | | currentTask: null, |
| | | taskLoading: true, |
| | | centerDialogVisibleTaskHours: false, |
| | | centerDialogVisibleTaskProgress: false, |
| | | centerDialogVisibleStatistics: false, |
| | | confirmHours: false, |
| | | confirmProgress: false, |
| | | newValue: '', |
| | | oldValue: '', |
| | | tempValue: '', |
| | | resData: true, |
| | | userIds: [], |
| | | watchFlg: false, |
| | | editVar: '', |
| | | loadingProject: true, |
| | | loadingTast: false, |
| | | loadingQueryProjectsOne: false, |
| | | loadingQueryProjects: false, |
| | | loadingQueryProjectsTwo: false, |
| | | statisticsLoading: false, |
| | | statisticsData: [], |
| | | // 报告生成参数 |
| | | generateReportParam: { |
| | | loading: false, |
| | | visible: false, |
| | | form: { |
| | | attendTime: [], |
| | | userId: null |
| | | }, |
| | | rules: { |
| | | attendTime: [{ required: true, message: '考勤日期不能为空', trigger: 'change' }] |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'user' |
| | | ]) |
| | | }, |
| | | watch: { |
| | | 'form.consumedHours': function(newVal, oldVal) { |
| | | if (newVal === 0 && this.userIds.includes(this.form.taskUserMongo.id)) { |
| | | this.form.alreadyConsumedHours = this.tempValue |
| | | } |
| | | if (this.crud.status.edit === 1 && newVal === 0) { |
| | | this.form.alreadyConsumedHours = (this.form.alreadyConsumedHours - (this.editVar - 0)).toFixed(2) |
| | | } |
| | | if (this.watchFlg) { |
| | | this.form.alreadyConsumedHours = (this.form.alreadyConsumedHours - (oldVal - 0) + (newVal - 0)).toFixed(2) |
| | | this.watchFlg = false |
| | | } |
| | | if (this.form.alreadyConsumedHours < 0) { |
| | | this.form.alreadyConsumedHours = 0 |
| | | } |
| | | }, |
| | | 'confirmProgress': function(newVal) { |
| | | this.confirmProgress = newVal |
| | | }, |
| | | 'confirmHours': function(newVal) { |
| | | this.confirmHours = newVal |
| | | }, |
| | | 'crud.status.edit': function() { |
| | | this.editVar = this.form.consumedHours |
| | | } |
| | | }, |
| | | created() { |
| | | const that = this |
| | | crudUser.getAll().then(res => { |
| | | that.users = res |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'projectId', Number(this.$route.params.projectId)) |
| | | // 获取任务列表 |
| | | crudTask.getAll({ projectId: this.query.projectId }).then(res => { |
| | | crudTask.getAllOfDaily({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | }) |
| | |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | // 获取用户 |
| | | this.getUser() |
| | | // 获取检索项目 |
| | | this.getQueryProject() |
| | | this.getAdventTasks() |
| | | this.getOngoingTasks() |
| | | this.getTaskNotStarted() |
| | | return true |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | | // 获取用户 |
| | | crudUser.getAll().then(res => { |
| | | // 用户列表 |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 获取检索项目 |
| | | getQueryProject() { |
| | | // 获取项目 |
| | | crudProject.getRelevant().then(res => { |
| | | // 检索项目列表 |
| | | this.queryProjects = res |
| | | }) |
| | | }, |
| | | // 检索项目变更 |
| | | queryProjectChange() { |
| | | // 检索赋值 |
| | | this.$set(this.query, 'taskId', null) |
| | | // 判断检索项目是否为空 |
| | | if (this.query.projectId == null || this.query.projectId === '') { |
| | | // 检索任务列表 |
| | | this.queryTasks = [] |
| | | } else { |
| | | // 获取任务 |
| | | crudTask.getAll({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | }) |
| | | } |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | |
| | | // 表单禁用标记(结算状态) |
| | | this.disabledFlagBySettlement = false |
| | | } |
| | | // 随机数 |
| | | this.random = Math.random() |
| | | }, |
| | | [CRUD.HOOK.afterSubmit]() { |
| | | this.form.flag = false |
| | | this.currentTask = null |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.confirmHours = false |
| | | this.confirmProgress = false |
| | | }, |
| | | [CRUD.HOOK.afterEditError]() { |
| | | this.form.flag = false |
| | | this.currentTask = null |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.confirmHours = false |
| | | this.confirmProgress = false |
| | | }, |
| | | [CRUD.HOOK.afterEditCancel]() { |
| | | this.form.flag = false |
| | | this.currentTask = null |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.confirmHours = false |
| | | this.confirmProgress = false |
| | | }, |
| | | [CRUD.HOOK.afterAddCancel]() { |
| | | this.form.flag = false |
| | | this.currentTask = null |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.confirmHours = false |
| | | this.confirmProgress = false |
| | | }, |
| | | [CRUD.HOOK.afterAddError]() { |
| | | this.form.flag = false |
| | | this.currentTask = null |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.confirmHours = false |
| | | this.confirmProgress = false |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 表单赋值 |
| | | this.form.consumedWorkloadUnit = null |
| | | // 判断用户最大角色级别是否是角色级别:普通用户 |
| | | if (this.userRolesLevelMin === this.roleLevelOrdinary) { |
| | | // 表单赋值 |
| | | if (this.currentTask) { |
| | | this.form.projectId = this.currentTask.projectId |
| | | this.form.taskId = this.currentTask.taskId |
| | | this.form.taskName = this.currentTask.taskName |
| | | this.form.taskUserMongo.id = this.currentTask.id |
| | | this.form.taskUserMongo.name = this.currentTask.name |
| | | this.form.taskUserMongo.taskStartDate = this.currentTask.taskStartDate |
| | | this.form.taskUserMongo.taskEndDate = this.currentTask.taskEndDate |
| | | this.form.taskUserMongo.rid = this.currentTask.rid |
| | | this.form.taskProgress = this.currentTask.taskProgress |
| | | |
| | | this.fetchAlreadyConsumedHours() |
| | | |
| | | // this.form.taskHours = this.currentTask.performanceHours |
| | | // this.form.alreadyConsumedHours = this.currentTask.alreadyConsumedHours |
| | | // this.tempValue = this.currentTask.alreadyConsumedHours |
| | | this.form.flag = true |
| | | |
| | | this.form.userId = this.user.id |
| | | // 表单用户变更 |
| | | this.formUserChange() |
| | | this.form.userNickName = this.user.nickName |
| | | } else { |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.taskId = null |
| | | this.form.taskUserMongo.id = null |
| | | this.form.taskUserMongo.name = null |
| | | this.form.taskUserMongo.taskStartDate = null |
| | | this.form.taskUserMongo.taskEndDate = null |
| | | this.form.userId = this.user.id |
| | | this.form.userNickName = this.user.nickName |
| | | } |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | // 获取项目 |
| | | crudProject.getPartake({ taskUserId: this.form.userId, approveStatus: constant.APPROVE_STATUS_ACKNOWLEDGED }).then(res => { |
| | | // 表单项目列表 |
| | | this.formProjects = res |
| | | this.form.userId = this.user.id |
| | | this.form.userNickName = this.user.nickName |
| | | this.tempValue = this.form.taskHours |
| | | |
| | | this.formDateChange() |
| | | this.fetchAlreadyConsumedHours() |
| | | }, |
| | | [CRUD.HOOK.afterRefresh]() { |
| | | this.taskLoading = false |
| | | }, |
| | | // [CRUD.HOOK.beforeSubmit]() { |
| | | // if (!this.userIds.includes(this.form.taskUserMongo.id)) { |
| | | // // 置换一下 |
| | | // var taskUserMongoName = this.form.taskUserMongo.id |
| | | // this.form.taskUserMongo.name = taskUserMongoName |
| | | // this.form.taskUserMongo.id = null |
| | | // } |
| | | // }, |
| | | disabledDate(time) { |
| | | return ( |
| | | time.getTime() < new Date(this.form.taskUserMongo.taskStartDate) - 8.64e7 || |
| | | time.getTime() > new Date(this.form.taskUserMongo.taskEndDate).getTime() |
| | | ) |
| | | }, |
| | | checkForm(flag) { |
| | | if (this.form.taskUserMongo.id === undefined) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: '分配任务不能为空', |
| | | type: 'error' |
| | | }) |
| | | return |
| | | } else if (this.form.fillDate === undefined) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: '填写日期不能为空', |
| | | type: 'error' |
| | | }) |
| | | return |
| | | } else if (this.form.consumedHours === undefined || this.form.consumedHours === 0) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: '请填写消耗工时', |
| | | type: 'error' |
| | | }) |
| | | return |
| | | // } else if (parseInt(this.form.consumedHours) + parseInt(this.form.todayFixedHours) > parseInt(this.form.todayAttendanceHours)) { |
| | | // this.$message({ |
| | | // showClose: true, |
| | | // message: '当日消耗工时总和超过打卡时间,请修改消耗工时', |
| | | // type: 'error' |
| | | // }) |
| | | // return |
| | | } else if (this.form.taskProgress === undefined) { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: '任务进度不能为空', |
| | | type: 'error' |
| | | }) |
| | | return |
| | | } |
| | | crudTaskDaliy.checkTaskHours({ 'taskProgress': this.form.taskProgress, 'taskUserId': this.form.taskUserMongo.id, 'fillDate': this.form.fillDate }).then(res => { |
| | | if (res === false && !this.confirmProgress) { |
| | | flag++ |
| | | // 为假 |
| | | this.centerDialogVisibleTaskProgress = true |
| | | if (this.confirmProgress) { |
| | | // 如果确定了 |
| | | // const result = this.form.alreadyConsumedHours |
| | | // if (result > this.form.taskHours && !this.confirmHours) { |
| | | // this.centerDialogVisibleTaskHours = true |
| | | // if (this.confirmHours) { |
| | | // this.crud.submitCU() |
| | | // } else { |
| | | // if (flag > 1) { |
| | | // return |
| | | // } else { |
| | | // this.checkForm() |
| | | // } |
| | | // } |
| | | // } else { |
| | | this.crud.submitCU() |
| | | // } |
| | | } else { |
| | | if (flag > 1) { |
| | | return |
| | | } else { |
| | | // 没确定 |
| | | this.checkForm() |
| | | } |
| | | } |
| | | } else { |
| | | flag++ |
| | | // 判断时间 |
| | | const result = this.form.alreadyConsumedHours |
| | | if (result > this.form.taskHours && !this.confirmHours) { |
| | | this.centerDialogVisibleTaskHours = true |
| | | if (this.confirmHours) { |
| | | this.crud.submitCU() |
| | | } else { |
| | | if (flag > 1) { |
| | | return |
| | | } else { |
| | | this.checkForm() |
| | | } |
| | | } |
| | | } else { |
| | | this.crud.submitCU() |
| | | } |
| | | } |
| | | }) |
| | | // 获取任务 |
| | | crudTask.getPartake({ taskUserId: this.form.userId, projectId: this.form.projectId }).then(res => { |
| | | // 表单任务列表 |
| | | this.formTasks = res |
| | | // 表单任务变更 |
| | | this.formTaskChange() |
| | | }, |
| | | watchFlagChange() { |
| | | this.watchFlg = true |
| | | }, |
| | | statistics() { |
| | | this.centerDialogVisibleStatistics = true |
| | | this.statisticsLoading = true |
| | | crudTaskDaliy.getStatistics(this.crud.query).then(res => { |
| | | this.statisticsData = res |
| | | console.log('this.statisticsData : ', this.statisticsData) |
| | | }).finally(() => { |
| | | // 同意按钮加载状态 |
| | | this.statisticsLoading = false |
| | | }) |
| | | }, |
| | | getAdventTasks() { |
| | | crudTaskUser.getAdventTasks().then(res => { |
| | | this.adventTasks = res |
| | | }) |
| | | }, |
| | | getOngoingTasks() { |
| | | crudTaskUser.getOngoingTasks().then(res => { |
| | | this.ongoingTasks = res |
| | | }) |
| | | }, |
| | | getTaskNotStarted() { |
| | | crudTaskUser.getTaskNotStarted().then(res => { |
| | | this.taskNotStarted = res |
| | | }) |
| | | }, |
| | | handleClick(tab, event) { |
| | | }, |
| | | handleClickTobeTasked(tab, event) { |
| | | }, |
| | | // 获取检索项目 |
| | | getQueryProject() { |
| | | this.loadingProject = true |
| | | this.queryProjects = [] |
| | | this.loadingQueryProjectsOne = true |
| | | // 获取项目 |
| | | crudProject.getRelevantOfDaily().then(res => { |
| | | // this.formProjects = res |
| | | // 检索项目列表 |
| | | this.queryProjects = res |
| | | this.loadingProject = false |
| | | this.$nextTick().then(() => { |
| | | this.loadingQueryProjectsOne = false |
| | | }) |
| | | }) |
| | | }, |
| | | // 检索项目变更 |
| | | queryProjectChange() { |
| | | this.queryTasks = [] |
| | | this.loadingTast = true |
| | | // 检索赋值 |
| | | this.$set(this.query, 'taskId', null) |
| | | // 判断检索项目是否为空 |
| | | if (this.query.projectId === null || this.query.projectId === '') { |
| | | // 检索任务列表 |
| | | this.queryTasks = [] |
| | | } else { |
| | | // 获取任务 |
| | | crudTask.getAllOfDaily({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | this.loadingTast = false |
| | | }) |
| | | } |
| | | }, |
| | | clearQueryTasks() { |
| | | this.loadingTast = false |
| | | }, |
| | | formDateChange() { |
| | | crudAttendance.queryAttendanceHours({ userId: this.$store.state.user.user.id, date: this.form.fillDate }).then(res => { |
| | | this.form.todayAttendanceHours = res |
| | | }) |
| | | crudTaskDaliy.taskConsumedHours({ userId: this.$store.state.user.user.id, fillDate: this.form.fillDate, id: this.form.id }).then(res => { |
| | | this.form.todayFixedHours = res |
| | | }) |
| | | crudTaskDaliy.getDailyDetail({ taskUserId: this.form.taskUserMongo.id, fillDate: this.form.fillDate }).then(res => { |
| | | if (res === '') { |
| | | this.form.alreadyConsumedHours = this.tempValue |
| | | this.form.consumedHours = 0 |
| | | } else { |
| | | this.form.alreadyConsumedHours = this.tempValue |
| | | this.form.consumedHours = res.consumedHours |
| | | this.form.taskProgress = res.taskProgress |
| | | } |
| | | // if (!this.userIds.includes(this.form.taskUserMongo.id)) { |
| | | // this.form.consumedHours = 0 |
| | | // this.form.taskProgress = 0 |
| | | // this.form.alreadyConsumedHours = 0 |
| | | // } |
| | | }) |
| | | }, |
| | | // 表单用户变更 |
| | |
| | | } |
| | | }, |
| | | // 表单项目变更 |
| | | formProjectChange() { |
| | | formProjectChange(cb) { |
| | | // 表单赋值 |
| | | this.form.taskId = null |
| | | this.form.taskUserMongo = {} |
| | | this.form.taskHours = 0 |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.form.consumedHours = null |
| | | this.form.taskProgress = null |
| | | this.form.remarks = null |
| | | // 判断表单项目是否为空 |
| | | if (this.form.projectId == null || this.form.projectId === '') { |
| | | // 表单任务列表 |
| | | this.formTasks = [] |
| | | } else { |
| | | this.loadingQueryProjects = true |
| | | this.loadingQueryProjectsTwo = true |
| | | this.formTasks = [] |
| | | this.formTaskUserIds = [] |
| | | this.form.taskId = null |
| | | this.form.taskUserMongo.id = null |
| | | // 获取任务 |
| | | crudTask.getPartake({ taskUserId: this.form.userId, projectId: this.form.projectId }).then(res => { |
| | | // 表单任务列表 |
| | | crudTask.getAllOfDaily({ projectId: this.form.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.formTasks = res |
| | | this.$nextTick().then(() => { |
| | | this.loadingQueryProjects = false |
| | | }) |
| | | if (cb) { |
| | | cb() |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | fetchAlreadyConsumedHours() { |
| | | crudTask.getRelevantTaskUser({ 'taskId': this.form.taskId }).then(res => { |
| | | for (let i = 0; i < res.length; i++) { |
| | | this.userIds.push(res[i].id) |
| | | } |
| | | this.formTaskUserIds = res |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTaskUserIds.length; i++) { |
| | | // 判断是否为选中任务 |
| | | if (this.formTaskUserIds[i].id === this.form.taskUserMongo.id) { |
| | | this.form.taskHours = this.formTaskUserIds[i].performanceHours |
| | | this.form.alreadyConsumedHours = this.formTaskUserIds[i].alreadyConsumedHours |
| | | this.tempValue = this.formTaskUserIds[i].alreadyConsumedHours |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 表单任务变更 |
| | | formTaskChange() { |
| | | formTaskChange(cb) { |
| | | this.formTaskUserIds = [] |
| | | this.form.taskUserMongo = {} |
| | | this.loadingQueryProjectsTwo = true |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTasks.length; i++) { |
| | | // 判断是否为选中任务 |
| | | if (this.formTasks[i].id === this.form.taskId) { |
| | | // 表单赋值 |
| | | this.form.consumedWorkloadUnit = this.formTasks[i].planWorkloadUnit |
| | | return |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === this.formTasks.length - 1) { |
| | | // 表单赋值 |
| | | this.form.consumedWorkloadUnit = null |
| | | crudTask.getRelevantTaskUser({ 'taskId': this.form.taskId }).then(res => { |
| | | if (res === []) { |
| | | this.formTaskUserIds = [] |
| | | return |
| | | } |
| | | for (let i = 0; i < res.length; i++) { |
| | | this.userIds.push(res[i].id) |
| | | } |
| | | this.formTaskUserIds = res |
| | | this.$nextTick().then(() => { |
| | | this.loadingQueryProjectsTwo = false |
| | | }) |
| | | // this.form.taskProgress = res.taskProgress |
| | | // this.form.consumedHours = res.consumedHours |
| | | if (cb) { |
| | | cb() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | formTaskUserChange() { |
| | | this.form.consumedHours = 0 |
| | | this.form.fillDate = null |
| | | // this.form.taskProgress = 0 |
| | | this.form.alreadyConsumedHours = 0 |
| | | this.form.taskHours = 0 |
| | | let defaultTaskUser = null |
| | | |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTaskUserIds.length; i++) { |
| | | // 判断是否为选中任务 |
| | | if (this.formTaskUserIds[i].id === this.form.taskUserMongo.id) { |
| | | this.form.taskHours = this.formTaskUserIds[i].performanceHours |
| | | this.form.alreadyConsumedHours = this.formTaskUserIds[i].alreadyConsumedHours |
| | | this.tempValue = this.formTaskUserIds[i].alreadyConsumedHours |
| | | defaultTaskUser = this.formTaskUserIds[i] |
| | | } |
| | | } |
| | | |
| | | this.getTaskProgress(this.form.taskUserMongo.id, defaultTaskUser) |
| | | }, |
| | | quickFilling(object) { |
| | | this.currentTask = object |
| | | this.crud.toAdd() |
| | | this.getTaskProgress(object.id) |
| | | }, |
| | | quickFilling1(object) { |
| | | this.currentTask = { ...object, id: object.taskUserMongo.id, consumedHours: object.consumedHours, taskProgress: object.taskProgress } |
| | | // this.form = object |
| | | // this.form.fillDate = '' |
| | | // this.form.consumedHours = 0 |
| | | // console.log('object : ', object); |
| | | // this.form.taskUserMongo = object.taskUserMongo |
| | | this.crud.toAdd() |
| | | }, |
| | | getTaskProgress(id, defaultTaskUser) { |
| | | // 附加默认值(防止任务可选日期范围溢出) |
| | | if (defaultTaskUser) { |
| | | this.form.taskUserMongo.id = defaultTaskUser.id |
| | | this.form.taskUserMongo.taskStartDate = defaultTaskUser.taskStartDate |
| | | this.form.taskUserMongo.taskEndDate = defaultTaskUser.taskEndDate |
| | | this.form.taskUserMongo.performanceType = defaultTaskUser.performanceType |
| | | } |
| | | // 任务更改查询任务进度 |
| | | crudTaskDaliy.getDailyTaskProgress({ taskUserId: id }).then(res => { |
| | | if (res !== '') { |
| | | this.form.taskProgress = res.taskProgress |
| | | } else { |
| | | this.form.taskProgress = 0 |
| | | } |
| | | if (res.taskUserMongo) { |
| | | this.form.taskUserMongo.id = res.taskUserMongo.id |
| | | this.form.taskUserMongo.taskStartDate = res.taskUserMongo.taskStartDate |
| | | this.form.taskUserMongo.taskEndDate = res.taskUserMongo.taskEndDate |
| | | this.form.taskUserMongo.performanceType = res.taskUserMongo.performanceType |
| | | } |
| | | }) |
| | | }, |
| | | submitDialogTaskHours() { |
| | | this.centerDialogVisibleTaskHours = false |
| | | this.confirmHours = true |
| | | }, |
| | | submitDialogTaskProgress() { |
| | | this.centerDialogVisibleTaskProgress = false |
| | | this.confirmProgress = true |
| | | }, |
| | | // 开启报告生成 |
| | | toGenerateReport() { |
| | | const that = this |
| | | that.generateReportParam.visible = true |
| | | }, |
| | | // 执行报告生成 |
| | | doGenerateReport() { |
| | | const that = this |
| | | that.$refs.reportForm.validate((valid) => { |
| | | if (!valid) { |
| | | return |
| | | } |
| | | // 制作数据 |
| | | const data = { |
| | | fillDates: that.generateReportParam.form.attendTime, |
| | | userId: that.generateReportParam.form.userId |
| | | } |
| | | that.$set(that.generateReportParam, 'loading', true) |
| | | // 生成报告 |
| | | that.crud.crudMethod.generateReport(data).then(() => { |
| | | that.$message({ type: 'success', message: '操作成功' }) |
| | | that.closeGenerateReport() |
| | | }).catch(() => { |
| | | that.$set(that.generateReportParam, 'loading', false) |
| | | }) |
| | | }) |
| | | }, |
| | | // 关闭报告生成 |
| | | closeGenerateReport() { |
| | | const that = this |
| | | that.$refs.reportForm.clearValidate() |
| | | that.$set(that.generateReportParam, 'loading', false) |
| | | that.$set(that.generateReportParam, 'visible', false) |
| | | that.$set(that.generateReportParam, 'form', { attendTime: [], userId: null }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | adventTable tr:first-child { |
| | | display: none; |
| | | } |
| | | .tips-content { |
| | | font-size: 12px; |
| | | text-align: center; |
| | | color: red; |
| | | padding: 0px 40px; |
| | | } |
| | | </style> |