| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" style="width: 185px;" class="filter-item" @change="queryProjectChange" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :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-option |
| | | v-for="item in queryTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <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.taskStatus" filterable clearable placeholder="任务状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <date-range-picker v-model="query.createTime" class="date-item" /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <!--表单组件--> |
| | | <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="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary" @change="formProjectChange"> |
| | | <el-option |
| | | v-for="item in projects" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusUnrecognized" |
| | | <el-row :gutter="20"> |
| | | <!--侧边部门数据--> |
| | | <el-col :span="6"> |
| | | <div class="head-container"> |
| | | <el-card class="box-card"> |
| | | <div slot="header"> |
| | | <el-select v-model="projectId" filterable clearable placeholder="请先选择所属项目" style="width:100%" class="filter-item" @change="getTaskDatas"> |
| | | <el-option |
| | | v-for="item in projectDatas" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-model="taskName" |
| | | clearable |
| | | size="small" |
| | | placeholder="输入任务名称搜索" |
| | | prefix-icon="el-icon-search" |
| | | class="filter-item" |
| | | @change="getTaskDatas" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属任务" prop="taskId"> |
| | | <el-select v-model="form.taskId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary" @change="formTaskChange"> |
| | | <el-option |
| | | v-for="item in formTasks" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="crud.status.edit == crudStatusPrepared || userRolesLevelMin == roleLevelOrdinary" @change="calcHour"> |
| | | </div> |
| | | <div v-if="!infinite" class="infinite-list" style="overflow:auto;height:500px"> |
| | | <el-card v-for="task in taskDatas" :key="task.id" class="box-card" :class="{ 'active': task === selectedTask }" style="margin-bottom: 10px;cursor:pointer" shadow="hover"> |
| | | <!-- <el-tooltip class="item" effect="dark" placement="top-start" :open-delay="1000" enterable> --> |
| | | <!-- <div slot="content" class="slot-style"> |
| | | <div @click="showTaskDetail(task)"> |
| | | <h4 style="cursor: pointer;">查看详细</h4> |
| | | </div> |
| | | </div> --> |
| | | <div @click="handleNodeClick(task)"> |
| | | {{ task.name }} |
| | | <i class="el-icon-search" style="float: right;" @click="showTaskDetail(task)" /> |
| | | </div> |
| | | <!-- </el-tooltip> --> |
| | | </el-card> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | <el-tree |
| | | v-if="false" |
| | | v-loading="taskLoading" |
| | | :data="taskDatas" |
| | | :load="getTaskDatas" |
| | | :props="defaultProps" |
| | | class="flow-tree" |
| | | accordion |
| | | :expand-on-click-node="false" |
| | | lazy |
| | | @node-click="handleNodeClick" |
| | | > |
| | | <template slot-scope="{node}"> |
| | | <el-tooltip effect="dark" :content="node.label" placement="top-start" style="font-size:14px;"> |
| | | <div>{{ node.label }}</div> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-tree> |
| | | </el-col> |
| | | <!--任务分配数据--> |
| | | <el-col :span="18"> |
| | | <el-dialog |
| | | title="分配详情" |
| | | :visible.sync="dialogVisible_taskUser" |
| | | width="600px" |
| | | @closed="setNull" |
| | | @close="dialogVisible_taskUser = false" |
| | | > |
| | | |
| | | <div v-if="steps.length > 0" v-loading="dialogLoading_taskUser"> |
| | | <el-card v-if="steps.length > 0"> |
| | | <div style="width: 35%;float: left"> |
| | | 任务名称:{{ TaskName }} |
| | | <p v-for="(item,index) in taskUserDetail" :key="index"> |
| | | {{ index }} 共消耗 {{ item }} 工时 |
| | | </p> |
| | | </div> |
| | | <div style="width: 65%;float: right"> |
| | | <el-progress :percentage="taskProgress" style="width: 80%;margin-left: 55px" :color="ProgressStatus" :format="formatTaskProgress" /> |
| | | <br> |
| | | <i>任务预计时长:{{ expectedHours }}小时</i><i style="margin-left: 40px">任务实际用时:{{ actualHours }}小时</i> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | <br> |
| | | <div v-if="steps.length > 0" v-loading="dialogLoading_taskUser" class="block" style="height: 500px; overflow: auto;"> |
| | | <el-timeline> |
| | | <el-timeline-item v-for="(item,index) in steps" :key="index" :timestamp="item.fillDate" :color="item.color"> |
| | | <el-card> |
| | | <h4> |
| | | {{ item.title }} |
| | | <el-tooltip class="item" effect="dark" :content="item.remarks" placement="top-start"> |
| | | <i v-if="item.flag" class="el-icon-s-comment" style="float: right" /> |
| | | </el-tooltip></h4> |
| | | </el-card> |
| | | </el-timeline-item> |
| | | </el-timeline> |
| | | </div> |
| | | <div v-else v-loading="dialogLoading_taskUser" class="block"> |
| | | <p>暂无信息</p></div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | title="任务详情" |
| | | :visible.sync="dialogVisible_task" |
| | | width="300px" |
| | | @closed="setNull" |
| | | @close="dialogLoading_task = false" |
| | | > |
| | | <div v-if="taskDetail" v-loading="dialogLoading_task"> |
| | | <el-card style="padding-top: 10px"> |
| | | <div v-for="(item,index) in taskDetail" :key="index" style="padding-top: 10px"> |
| | | <span>{{ index }} 分配时长: {{ item }} 小时</span><br> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | <div v-else> |
| | | <el-card style="padding-top: 10px"> |
| | | <span>暂无数据</span><br> |
| | | </el-card> |
| | | </div> |
| | | </el-dialog> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <!-- 搜索 --> |
| | | <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" |
| | | :disabled="!item.enabled || form.divideUserIds.includes(item.id)" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | | <el-date-picker v-model="form.taskStartDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" :picker-options="taskStartDatePickerOptions" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务结束时间" prop="taskEndDate"> |
| | | <el-date-picker v-model="form.taskEndDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options="taskEndDatePickerOptions" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" @change="calcHour" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工时" prop="taskHours"> |
| | | <el-input v-model="form.taskHours" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量" prop="taskWorkload"> |
| | | <el-input v-model="form.taskWorkload" style="width: 340px;" :disabled="userRolesLevelMin == roleLevelOrdinary" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工作量单位" prop="taskWorkloadUnit"> |
| | | {{ dict.label[standardWorkloadUnit][form.taskWorkloadUnit] }} |
| | | </el-form-item> |
| | | <el-form-item label="强制更新" tool-tip prop="enable"> |
| | | <el-tooltip content="不增减工作量的场合调整工时的话,需要选择此项。(有疑问请联系管理员,不要随便选。。。)" effect="dark" placement="bottom"> |
| | | <el-switch v-model="form.enable" /> |
| | | </el-tooltip> |
| | | </el-form-item> |
| | | <el-form-item label="任务状态" prop="taskStatus"> |
| | | <el-select v-model="form.taskStatus" filterable placeholder="请选择" style="width: 340px;"> |
| | | <el-select v-model="query.taskStatus" filterable clearable multiple collapse-tags placeholder="任务状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[taskStatus]" |
| | | :key="item.id" |
| | |
| | | :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="userRolesLevelMin == roleLevelOrdinary" /> |
| | | </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> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <crudOperation v-if="flag" :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 6px;" |
| | | @click="openGenerate" |
| | | >导入</el-button> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.generate" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-check" |
| | | style="margin-right: 60px;" |
| | | @click="taskCompleted" |
| | | >任务完结</el-button> |
| | | </crudOperation> |
| | | <div> |
| | | <span> 当前任务:<i> {{ selectedTaskName }} </i> |
| | | <span v-if="taskTotal.performanceType" style="magin: right 10px;"><i> (绩效类型: {{ taskTotal.performanceType === '1' ? '绩效' : '非绩效' }})</i></span> |
| | | </span> |
| | | <el-divider> |
| | | <span v-for="item in taskTotal.details" :key="item._id"> |
| | | <template v-if="item._id === 'task_status_not_started'"> |
| | | <b>未开始:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | <template v-if="item._id === 'task_status_in_hand'"> |
| | | <b>进行中:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | <template v-if="item._id === 'task_status_stop'"> |
| | | <b>已暂停:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | <template v-if="item._id === 'task_status_completed'"> |
| | | <b>已完成:</b>{{ item.taskStatusCnt }}件(合计:{{ item.taskHours }}小时) |
| | | </template> |
| | | </span> |
| | | </el-divider> |
| | | </div> |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table |
| | | ref="table" |
| | | v-loading="crud.loading" |
| | | :data="crud.data" |
| | | size="small" |
| | | style="width: 100%;" |
| | | :summary-method="getSummaries" |
| | | show-summary |
| | | @selection-change="crud.selectionChangeHandler" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectName" label="所属项目" fixed="left" width="140"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskName" label="所属任务" fixed="left" width="180"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.taskName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userNickName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskEndDate" label="任务结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" label="消耗 / 任务工时" width="110"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.consumedHours }} / {{ scope.row.taskHours }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="消耗 / 任务工作量" width="120"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.consumedWorkload }} / {{ scope.row.taskWorkload == null || scope.row.taskWorkload == '' ? 0 : scope.row.taskWorkload }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskWorkloadUnit" label="任务工作量单位" width="110"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.taskWorkloadUnit != null && scope.row.taskWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.taskWorkloadUnit] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度" width="80"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | <!--表单渲染--> |
| | | <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="taskId"> |
| | | <el-input v-show="false" v-model="form.task.id" style="width: 340px;" /> |
| | | <el-input v-model="form.task.name" :disabled="true" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务名称"> |
| | | <el-input v-model="form.name" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务开始时间" prop="taskStartDate"> |
| | | <el-date-picker v-model="form.taskStartDate" popper-class="hide-time" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" :picker-options=" {disabledDate} " style="width: 340px; " @change="checkStartTime(form.taskStartDate)" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务结束时间" prop="taskEndDate"> |
| | | <el-date-picker v-model="form.taskEndDate" popper-class="hide-time" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" :picker-options=" {disabledDate} " style="width: 340px;" @change="checkEndTime(form.taskEndDate)" /> |
| | | </el-form-item> |
| | | <el-form-item label="任务工时" prop="taskHours"> |
| | | <el-input v-model="form.taskHours" style="width: 340px;"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="所属员工" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.start"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | :disabled="!item.enabled || form.divideUserIds.includes(item.id)" |
| | | > |
| | | <span style="float: left">{{ item.nickName }}</span> |
| | | <span style="float: right; color: #8492a6; font-size: 13px">{{ item.levelName }}</span> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效工时" prop="performanceHours"> |
| | | <el-input v-model="form.performanceHours" style="width: 340px;" :disabled="true"> |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="任务进度" prop="newTaskProgress"> |
| | | <el-input v-model="form.newTaskProgress" style="width: 340px;" :disabled="true" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.newTaskProgress === 100" label="任务状态"> |
| | | <el-switch |
| | | v-model="form.is_ok" |
| | | v-permission="permission.list" |
| | | active-text="已完成" |
| | | /> |
| | | </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> |
| | | </div> |
| | | </el-dialog> |
| | | <el-table |
| | | ref="table" |
| | | v-loading="crud.loading" |
| | | :data="crud.data" |
| | | size="small" |
| | | style="width: 100%;" |
| | | @selection-change="crud.selectionChangeHandler" |
| | | > |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="270"> |
| | | <template slot-scope="scope"> |
| | | <el-tag slot="reference">{{ scope.row.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStartDate" label="任务开始时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskEndDate" label="任务结束时间" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskHours" label="任务工时" width="80" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属员工" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tooltip class="item" effect="light" :open-delay="1000" placement="top" :disabled="!flag"> |
| | | <div slot="content" class="slot-style"> |
| | | <div @click="showDetail(scope.row)"> |
| | | <h4 style="cursor: pointer;">查看详情</h4> |
| | | </div> |
| | | </div> |
| | | <el-tag v-if="scope.row.userNickName" style="cursor: pointer;">{{ scope.row.userNickName }}</el-tag> |
| | | <el-tag v-else>未指定</el-tag> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceHours" label="绩效工时" width="80" /> |
| | | <el-table-column :show-overflow-tooltip="true" label="任务进度" width="80"> |
| | | <template slot-scope="scope"> |
| | | <span style="margin-left: 10px">{{ scope.row.newTaskProgress }}%</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="taskStatus" label="任务状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="200" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.userNickName" |
| | | :key="scope.row.userNickName" |
| | | slot="left" |
| | | v-permission="permission.list" |
| | | size="mini" |
| | | type="primary" |
| | | style="float: left" |
| | | :disabled="true" |
| | | >已分配</el-button> |
| | | <el-button |
| | | v-else |
| | | slot="left" |
| | | v-permission="permission.list" |
| | | size="mini" |
| | | type="primary" |
| | | style="float: left" |
| | | @click="unPick(scope.row)" |
| | | >获取</el-button> |
| | | <udOperation |
| | | v-if="flag" |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--表格渲染--> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="closeGenerate" :visible.sync="generateStatus" title="导入任务分配信息" width="720px"> |
| | | <el-form ref="generateForm" size="small" label-width="80px"> |
| | | <upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" /> |
| | | <el-table :data="generateForm" border highlight-current-row style="width: 100%;margin-top:20px;"> |
| | | <el-table-column v-for="item of tableHeader" :key="item.id" :prop="item.id" :label="item.name" /> |
| | | </el-table> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="closeGenerate">取消</el-button> |
| | | <el-button :loading="generateLoading" type="primary" :disabled="uploading" @click="submitGenerate">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | import crudTask from '@/api/task/task' |
| | | import crudUser from '@/api/system/user' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import { mapGetters } from 'vuex' |
| | | import constant from '../../../utils/constant' |
| | | import crudProject from '@/api/project/project' |
| | | import crudTask from '@/api/task/task' |
| | | import crudUser from '@/api/system/user' |
| | | import DateRangePicker from '@/components/DateRangePicker' |
| | | |
| | | const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null, enable: false, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, divideUserIds: [] } |
| | | import Treeselect from '@riophae/vue-treeselect' |
| | | import { mapGetters } from 'vuex' |
| | | import constant from '@/utils/constant' |
| | | import UploadExcelComponent from '@/components/UploadExcel/index.vue' |
| | | const defaultForm = { id: null, userId: null, projectId: null, task: { id: null }, taskStartDate: null, taskEndDate: null, taskHours: null, newTaskProgress: null, taskStatus: null, remarks: null, divideUserIds: [], is_ok: null } |
| | | export default { |
| | | name: 'TaskUser', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.TASK_STATUS, constant.STANDARD_WORKLOAD_UNIT], |
| | | // eslint-disable-next-line vue/no-unused-components |
| | | components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker, UploadExcelComponent }, |
| | | cruds() { |
| | | return CRUD({ title: '任务分配', url: 'api/taskUser', idField: 'id', sort: 'taskStartDate,desc', crudMethod: { ...crudTaskUser }}) |
| | | return CRUD({ title: '任务分配', url: 'api/taskUser', crudMethod: { ...crudTaskUser }}) |
| | | }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | // 数据字典 |
| | | dicts: [constant.TASK_STATUS, constant.TAST_CLASSIFICATION, constant.STANDARD_WORKLOAD_UNIT, constant.PERFORMANCE_TYPE], |
| | | data() { |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 时长(万内)验证 |
| | | // eslint-disable-next-line no-unused-vars |
| | | var durationValidate = (rule, value, callback) => { |
| | | const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/ |
| | | if (value != null && value !== '' && !reg.test(value)) { |
| | |
| | | } |
| | | } |
| | | return { |
| | | projectId: null, |
| | | projectDatas: [], |
| | | taskName: '', |
| | | selectedTaskName: '', |
| | | planStartTime: null, |
| | | planEndTime: null, |
| | | taskTotal: {}, |
| | | taskDatas: [], |
| | | taskLoading: false, |
| | | defaultProps: { children: 'nodes', label: 'name', isLeaf: 'leaf' }, |
| | | permission: { |
| | | list: ['admin', 'taskUser:list'], |
| | | add: ['admin', 'taskUser:add'], |
| | | edit: ['admin', 'taskUser:edit'], |
| | | del: ['admin', 'taskUser:del'], |
| | | download: ['admin', 'taskUser:download'] |
| | | download: ['admin', 'taskUser:download'], |
| | | generate: ['admin', 'taskUser:add'] |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '所属项目不能为空', trigger: 'change' } |
| | | ], |
| | | taskId: [ |
| | | { required: true, message: '所属任务不能为空', trigger: 'change' } |
| | | ], |
| | | userId: [ |
| | | { required: true, message: '所属员工不能为空', trigger: 'change' } |
| | | ], |
| | | taskStartDate: [ |
| | | { required: true, message: '任务开始时间不能为空', trigger: 'change' } |
| | | ], |
| | |
| | | { required: true, message: '任务结束时间不能为空', trigger: 'change' } |
| | | ], |
| | | taskHours: [ |
| | | { required: true, message: '任务工时不能为空', trigger: 'blur' }, |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskWorkload: [ |
| | | { validator: durationValidate, trigger: 'blur' } |
| | | ], |
| | | taskStatus: [ |
| | | { required: true, message: '任务状态不能为空', trigger: 'change' } |
| | | { required: true, message: '任务时长不能为空', trigger: 'change' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '所属项目' }, |
| | | { key: 'taskId', display_name: '所属任务' }, |
| | | { key: 'userId', display_name: '所属员工' }, |
| | | { key: 'taskStatus', display_name: '任务状态' }, |
| | | { key: 'createTime', display_name: '创建时间' } |
| | | ], |
| | | // 任务开始时间选项 |
| | | taskStartDatePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.form.taskEndDate != null && _this.form.taskEndDate !== '' ? time.getTime() > new Date(_this.form.taskEndDate).getTime() : false |
| | | } |
| | | }, |
| | | // 任务结束时间选项 |
| | | taskEndDatePickerOptions: { |
| | | // 禁用日期 |
| | | disabledDate(time) { |
| | | return _this.form.taskStartDate != null && _this.form.taskStartDate !== '' ? time.getTime() < new Date(_this.form.taskStartDate).getTime() - (86400000 - 1) : false |
| | | } |
| | | }, |
| | | // 字典:任务状态 |
| | | taskStatus: constant.TASK_STATUS, |
| | | // 字典:任务分类 |
| | | taskClassification: constant.TAST_CLASSIFICATION, |
| | | // 字典:标准工作量单位 |
| | | standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT, |
| | | // 字典:绩效对象 |
| | | performanceType: constant.PERFORMANCE_TYPE, |
| | | // 字典:批准状态-未承认 |
| | | approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | | // 用户最大角色级别 |
| | | userRolesLevelMin: null, |
| | | Is_ok: false, |
| | | generateForm: [], |
| | | tableHeader: [], |
| | | users: [], |
| | | // 项目列表 |
| | | projects: [], |
| | | // 检索任务列表 |
| | | queryTasks: [], |
| | | // 表单任务列表 |
| | | formTasks: [], |
| | | // 用户列表 |
| | | users: [] |
| | | // 生成表单状态 |
| | | generateStatus: false, |
| | | // 生成表单加载 |
| | | generateLoading: false, |
| | | uploading: true, |
| | | flag: false, |
| | | infinite: false, |
| | | selectedTask: '', |
| | | dialogVisible_taskUser: false, |
| | | dialogLoading_taskUser: true, |
| | | dialogVisible_task: false, |
| | | dialogLoading_task: true, |
| | | steps: [], |
| | | TaskName: '', |
| | | expectedHours: '', |
| | | actualHours: '', |
| | | taskUserDetail: {}, |
| | | taskDetail: {}, |
| | | taskProgress: '', |
| | | ProgressStatus: '' |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | 'user' |
| | | ]) |
| | | }, |
| | | mounted() { |
| | | this.getAllProjectDatas() |
| | | this.getTaskDatas() |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.projectId != null && this.$route.params.projectId !== '' && this.crud.query.projectId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'projectId', Number(this.$route.params.projectId)) |
| | | // 获取任务列表 |
| | | crudTask.getAll({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | }) |
| | | if (!this.query.taskId) { |
| | | this.taskTotal = {} |
| | | return false |
| | | } |
| | | // 判断传参是否为空 |
| | | if (this.$route.params.taskId != null && this.$route.params.taskId !== '' && this.crud.query.taskId === undefined) { |
| | | // 检索条件赋值 |
| | | this.$set(this.crud.query, 'taskId', Number(this.$route.params.taskId)) |
| | | } |
| | | // 用户角色级别数组 |
| | | const userRolesLevel = this.user.roles.map(({ level }) => level) |
| | | // 用户最大角色级别 |
| | | this.userRolesLevelMin = Math.min(...userRolesLevel) |
| | | // 获取项目 |
| | | this.getProject() |
| | | // 获取用户 |
| | | this.getUser() |
| | | crudTaskUser.getSum({ 'taskId': this.query.taskId }).then(res => { |
| | | this.taskTotal = res |
| | | }) |
| | | return true |
| | | }, |
| | | // 获取项目 |
| | | getProject() { |
| | | // 获取项目 |
| | | crudProject.getRelevant().then(res => { |
| | | // 项目列表 |
| | | this.projects = res |
| | | }) |
| | | [CRUD.HOOK.afterSubmit]() { |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterEditError]() { |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterEditCancel]() { |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterAddCancel]() { |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.afterAddError]() { |
| | | this.formTasks = [] |
| | | this.form.name = null |
| | | this.form.performanceHours = null |
| | | this.form.start = false |
| | | }, |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.form.task.id = this.query.taskId |
| | | this.form.task.name = this.selectedTaskName |
| | | this.form.projectId = this.projectId |
| | | }, |
| | | [CRUD.HOOK.beforeSubmit]() { |
| | | if (!this.form.taskStatus) { |
| | | this.form.taskStatus = 'task_status_not_started' |
| | | } |
| | | // if (this.form.task.id === undefined || this.form.task.id === null || this.form.task.id === '') { |
| | | // this.form.task = null |
| | | // } |
| | | return true |
| | | }, |
| | | disabledDate(time) { |
| | | return time.getTime() < new Date(this.planStartTime) - 8.64e7 || time.getTime() > new Date(this.planEndTime).getTime() |
| | | }, |
| | | checkStartTime(time) { |
| | | if (time > this.planEndTime || time < this.planStartTime) { |
| | | this.form.taskStartDate = null |
| | | this.$notify({ |
| | | title: '无效时间', |
| | | type: 'error', |
| | | duration: 2500 |
| | | }) |
| | | return |
| | | } |
| | | }, |
| | | checkEndTime(time) { |
| | | if (time > this.planEndTime || time < this.planStartTime) { |
| | | this.form.taskEndDate = null |
| | | this.$notify({ |
| | | title: '无效时间', |
| | | type: 'error', |
| | | duration: 2500 |
| | | }) |
| | | return |
| | | } |
| | | }, |
| | | // 获取用户 |
| | | getUser() { |
| | | getUser(taskId) { |
| | | // 获取用户 |
| | | crudUser.getAll().then(res => { |
| | | crudUser.getProjectUser(taskId).then(res => { |
| | | // 用户列表 |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 自动计算工时 |
| | | calcHour() { |
| | | if (this.form.taskEndDate && this.form.taskStartDate && this.form.userId && !this.form.taskHours) { |
| | | crudTaskUser.calcHours({ userId: this.form.userId, taskStartDate: this.form.taskStartDate, taskEndDate: this.form.taskEndDate }).then(res => { |
| | | this.form.taskHours = res |
| | | }) |
| | | } |
| | | getAllProjectDatas() { |
| | | crudTask.getProjects().then(res => { |
| | | this.projectDatas = res |
| | | }) |
| | | }, |
| | | // 检索项目变更 |
| | | queryProjectChange() { |
| | | // 检索赋值 |
| | | this.$set(this.query, 'taskId', null) |
| | | // 判断检索项目是否为空 |
| | | if (this.query.projectId == null || this.query.projectId === '') { |
| | | // 检索任务列表 |
| | | this.queryTasks = [] |
| | | // 获取左侧部门数据 |
| | | getTaskDatas(node, resolve) { |
| | | if (node !== undefined) { |
| | | this.infinite = true |
| | | } |
| | | const sort = 'id,desc' |
| | | const params = { sort: sort } |
| | | if (!this.projectId) { |
| | | return |
| | | } else { |
| | | // 获取任务列表 |
| | | crudTask.getAll({ projectId: this.query.projectId }).then(res => { |
| | | // 检索任务列表 |
| | | this.queryTasks = res |
| | | }) |
| | | params['projectId'] = this.projectId |
| | | } |
| | | }, |
| | | // 表格统计 |
| | | getSummaries(param) { |
| | | const { columns, data } = param |
| | | const sums = [] |
| | | columns.forEach((column, index) => { |
| | | // 6号单元格 |
| | | if (index === 6) { |
| | | // 消耗工时 |
| | | let consumedHours = 0 |
| | | const consumedHoursValues = data.map(item => Number(item['consumedHours'])) |
| | | if (!consumedHoursValues.every(value => isNaN(value))) { |
| | | consumedHours = consumedHoursValues.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return prev + curr |
| | | } else { |
| | | return prev |
| | | } |
| | | }, 0) |
| | | } |
| | | // 任务工时 |
| | | let taskHours = 0 |
| | | const taskHoursValues = data.map(item => Number(item['taskHours'])) |
| | | if (!taskHoursValues.every(value => isNaN(value))) { |
| | | taskHours = taskHoursValues.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return prev + curr |
| | | } else { |
| | | return prev |
| | | } |
| | | }, 0) |
| | | } |
| | | sums[index] = consumedHours + ' / ' + taskHours |
| | | } |
| | | // 7号单元格 |
| | | if (index === 7) { |
| | | // 消耗工作量 |
| | | let consumedWorkload = 0 |
| | | const consumedWorkloadValues = data.map(item => Number(item['consumedWorkload'])) |
| | | if (!consumedWorkloadValues.every(value => isNaN(value))) { |
| | | consumedWorkload = consumedWorkloadValues.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return prev + curr |
| | | } else { |
| | | return prev |
| | | } |
| | | }, 0) |
| | | } |
| | | // 任务工作量 |
| | | let taskWorkload = 0 |
| | | const taskWorkloadValues = data.map(item => Number(item['taskWorkload'])) |
| | | if (!taskWorkloadValues.every(value => isNaN(value))) { |
| | | taskWorkload = taskWorkloadValues.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return prev + curr |
| | | } else { |
| | | return prev |
| | | } |
| | | }, 0) |
| | | } |
| | | sums[index] = consumedWorkload + ' / ' + taskWorkload |
| | | } |
| | | }) |
| | | return sums |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 表单赋值 |
| | | this.form.taskWorkloadUnit = null |
| | | // 表单任务列表 |
| | | this.formTasks = [] |
| | | }, |
| | | // 钩子:编辑 - 之前 |
| | | [CRUD.HOOK.beforeToEdit]() { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 表单任务列表 |
| | | this.formTasks = res |
| | | // // 表单任务变更 |
| | | // this.formTaskChange() |
| | | }) |
| | | }, |
| | | // 表单项目变更 |
| | | formProjectChange() { |
| | | // 表单赋值 |
| | | this.form.taskId = null |
| | | // 判断表单项目是否为空 |
| | | if (this.form.projectId == null || this.form.projectId === '') { |
| | | // 表单任务列表 |
| | | this.formTasks = [] |
| | | if (typeof node === 'object' && node.level !== 0) { |
| | | params['pid'] = node.data.id |
| | | } else { |
| | | // 获取父级任务 |
| | | crudTask.getAll({ projectId: this.form.projectId }).then(res => { |
| | | // 表单任务列表 |
| | | this.formTasks = res |
| | | params['isTop'] = true |
| | | } |
| | | if (this.taskName) { |
| | | params['name'] = this.taskName |
| | | } |
| | | this.taskLoading = true |
| | | setTimeout(() => { |
| | | crudTask.ChildrenTaskAnyParent(params).then(res => { |
| | | if (resolve) { |
| | | resolve(res) |
| | | } else { |
| | | this.infinite = false |
| | | this.taskDatas = res |
| | | } |
| | | this.taskLoading = false |
| | | }).catch(() => { |
| | | this.taskLoading = false |
| | | }) |
| | | } |
| | | }, 100) |
| | | }, |
| | | // 表单任务变更 |
| | | formTaskChange() { |
| | | // 循环表单任务列表 |
| | | for (let i = 0; i < this.formTasks.length; i++) { |
| | | // 判断是否为选中任务 |
| | | if (this.formTasks[i].id === this.form.taskId) { |
| | | // 表单赋值 |
| | | this.form.taskStartDate = this.formTasks[i].planStartTime |
| | | this.form.taskEndDate = this.formTasks[i].planEndTime |
| | | this.form.taskWorkloadUnit = this.formTasks[i].planWorkloadUnit |
| | | break |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === this.formTasks.length - 1) { |
| | | // 表单赋值 |
| | | this.form.taskStartDate = null |
| | | this.form.taskEndDate = null |
| | | this.form.taskWorkloadUnit = null |
| | | } |
| | | // 切换任务 |
| | | handleNodeClick(data) { |
| | | this.selectedTask = data |
| | | if (data.pid === 0) { |
| | | this.query.taskId = null |
| | | this.query.taskStatus = [] |
| | | this.selectedTaskName = null |
| | | // this.taskTotal = {} |
| | | } else { |
| | | this.query.taskId = data.id |
| | | this.query.taskStatus = ['task_status_not_started', 'task_status_in_hand', 'task_status_test', 'task_status_stop'] |
| | | this.selectedTaskName = data.name |
| | | this.flag = data.flag |
| | | console.log('data : ', data) |
| | | this.planStartTime = data.planStartTime |
| | | this.planEndTime = data.planEndTime |
| | | // crudTaskUser.getSum({ 'taskId': this.query.taskId }).then(res => { |
| | | // this.taskTotal = res |
| | | // }) |
| | | } |
| | | // 判断是否是否是新增 |
| | | if (this.crud.status.add === CRUD.STATUS.PREPARED) { |
| | | // 表单赋值 |
| | | this.form.userId = null |
| | | this.crud.toQuery() |
| | | this.getUser(this.query.taskId) |
| | | }, |
| | | beforeUpload(file) { |
| | | const isLt1M = file.size / 1024 / 1024 < 1 |
| | | if (isLt1M) { |
| | | return true |
| | | } |
| | | // 查询任务分配用户 |
| | | crudTaskUser.getTaskUserIds({ taskId: this.form.taskId }).then(res => { |
| | | // 表单赋值 |
| | | this.form.divideUserIds = res |
| | | this.$message({ |
| | | message: '请不要上传大于1m的文件.', |
| | | type: 'warning' |
| | | }) |
| | | return false |
| | | }, |
| | | handleSuccess({ results, header }) { |
| | | this.uploading = false |
| | | this.generateForm = results |
| | | console.log('this.generateForm : ', results) |
| | | this.tableHeader = header |
| | | }, |
| | | // 生成表单打开 |
| | | openGenerate() { |
| | | // 生成表单数据 |
| | | this.generateForm = [] |
| | | // 生成表单状态 |
| | | this.generateStatus = true |
| | | }, |
| | | // 生成表单关闭 |
| | | closeGenerate() { |
| | | // 生成表单状态 |
| | | this.generateStatus = false |
| | | }, |
| | | // 生成表单提交 |
| | | submitGenerate() { |
| | | if (!this.generateForm.file.size) { |
| | | this.$message.warning('请选择上传的文件') |
| | | return |
| | | } |
| | | // 生成表单加载 |
| | | this.generateLoading = true |
| | | this.uploading = true |
| | | console.log('3333333333333333333 : ', this.generateForm) |
| | | // crudUserInsurance.generate(this.generateForm).then(res => { |
| | | // // 生成表单关闭 |
| | | // this.closeGenerate() |
| | | // // 生成表单加载 |
| | | // this.generateLoading = true |
| | | // // 搜索:刷新表格 |
| | | // this.crud.toQuery() |
| | | // this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
| | | // }).catch(err=>{ |
| | | // this.uploading = false |
| | | // // 生成表单加载 |
| | | // this.generateLoading = false |
| | | // }) |
| | | }, |
| | | |
| | | unPick(e) { |
| | | crudTaskUser.addTaskUser({ 'TaskId': e.id, 'projectId': this.projectId }).then(res => { |
| | | this.pickFlg = false |
| | | if (res === 1) { |
| | | this.$notify({ |
| | | title: '获取成功', |
| | | type: 'success', |
| | | duration: 2500 |
| | | }) |
| | | |
| | | this.crud.toQuery() |
| | | } else { |
| | | this.$notify({ |
| | | title: '获取失败', |
| | | type: 'error', |
| | | duration: 2500 |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | taskCompleted() { |
| | | const selectData = this.$refs.table.selection |
| | | var changesId = [] |
| | | for (var i = 0; i < selectData.length; i++) { |
| | | if (selectData[i].newTaskProgress !== 100) { |
| | | this.$notify.error({ |
| | | title: '任务进度未达到100%' |
| | | }) |
| | | return |
| | | } |
| | | changesId.push(selectData[i].id) |
| | | } |
| | | // 当程序执行到这里时,说明选择的都是已经达到100的任务 |
| | | crudTaskUser.changeStatus(changesId).then(res => { |
| | | this.crud.toQuery() |
| | | this.$notify.success({ |
| | | title: '确认成功' |
| | | }) |
| | | }) |
| | | }, |
| | | showDetail(e) { |
| | | this.dialogVisible_taskUser = true |
| | | this.TaskName = e.name |
| | | this.expectedHours = e.performanceHours |
| | | this.actualHours = 0 |
| | | // 发送taskUser,获取所有的日报信息,并在后台进行处理,将处理后的结果返回给前端的steps中,进行显示 |
| | | crudTaskUser.getTaskUserDetail(e.id).then(res => { |
| | | this.steps = res |
| | | for (let i = 0; i < this.steps.length; i++) { |
| | | this.taskUserDetail[this.steps[i].taskUserName] = this.steps[i].alreadyConsumeHours |
| | | } |
| | | // console.log(this.taskUserDetail) |
| | | // this.taskUserDetail.map((key, value) => { |
| | | // console.log(key) |
| | | // console.log(value) |
| | | // }) |
| | | |
| | | // var key = this.taskUserDetail.keySet(); |
| | | for (var key in this.taskUserDetail) { |
| | | this.actualHours += this.taskUserDetail[key] |
| | | } |
| | | |
| | | this.taskProgress = Math.round(this.actualHours / this.expectedHours * 100) |
| | | if (this.taskProgress > 100) { |
| | | this.taskProgress = 100 |
| | | } |
| | | if (this.taskProgress === 100) { |
| | | this.ProgressStatus = '#F56C6C' |
| | | } |
| | | if (this.taskProgress < 100) { |
| | | this.ProgressStatus = '#409EFF' |
| | | } |
| | | // this.taskUserDetail.forEach(function(value,key){ |
| | | // console.log(value,key); |
| | | // }); |
| | | this.dialogLoading_taskUser = false |
| | | }) |
| | | }, |
| | | setNull() { |
| | | this.taskUserDetail = {} |
| | | this.dialogLoading_taskUser = true |
| | | this.dialogLoading_task = true |
| | | }, |
| | | showTaskDetail(e) { |
| | | console.log(e.id) |
| | | this.dialogVisible_task = true |
| | | crudTaskUser.getTaskDetail(e.id).then(res => { |
| | | for (let i = 0; i < res.length; i++) { |
| | | this.taskDetail[res[i].nickName] = res[i].assignedWork |
| | | } |
| | | this.dialogLoading_task = false |
| | | }) |
| | | }, |
| | | formatTaskProgress(percentage) { |
| | | return percentage === 100 ? '实际消耗已超出计划时长' : `${percentage}%` |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | <style rel="stylesheet/scss" lang="scss" > |
| | | |
| | | /*.el-picker-panel__footer{*/ |
| | | /* display: none;*/ |
| | | /*}*/ |
| | | .hide-time .el-button--text { |
| | | display: none; |
| | | } |
| | | |
| | | .tree-scroll { |
| | | height: 100%; |
| | | width: 100%; |
| | | } |
| | | |
| | | .flow-tree { |
| | | overflow-x: hidden; |
| | | overflow-y: auto; |
| | | max-height: 600px; |
| | | width: 100%; |
| | | |
| | | >>>.el-tree-node { |
| | | // height:40px; |
| | | > .el-tree-node__children { |
| | | overflow-y: visible !important; |
| | | } |
| | | > .el-tree-node__content { |
| | | height: 100%; |
| | | } |
| | | } |
| | | } |
| | | ::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value { |
| | | height: 40px; |
| | | line-height: 40px; |
| | | } |
| | | |
| | | .active { |
| | | /* 添加长亮效果的样式 */ |
| | | color: #1890ff; |
| | | } |
| | | |
| | | </style> |