| | |
| | | <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" @keyup.enter.native="crud.toQuery"> |
| | | <el-input v-model="query.blurry" clearable placeholder="请输入项目名" style="width: 185px" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.distinguish" filterable clearable placeholder="请选择项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.settlementStatus" filterable clearable placeholder="请选择结算状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.belongYear" filterable clearable placeholder="请选择年度" style="width: 185px;" class="filter-item"> |
| | | <el-option |
| | | v-for="item in belongYearList" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.belongWeek" filterable clearable placeholder="请选择周数" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in belongWeekList" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | |
| | | <!--表单组件--> |
| | | <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="80px"> |
| | | <el-form-item label="项目" prop="projectId"> |
| | | <el-select v-model="form.projectId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled"> |
| | | <el-form-item label="项目" prop="project.id"> |
| | | <el-select v-model="form.project.id" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled || crud.status.add !== 1"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :disabled="item.approveStatus == approveStatusAcknowledged" |
| | | :disabled="item.approveStatus == approveStatusUnsettled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="年度" prop="belongYear"> |
| | | <el-select v-model="form.belongYear" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled || crud.status.add !== 1"> |
| | | <el-option |
| | | v-for="item in belongYearList" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="周数" prop="belongWeek"> |
| | | <el-select v-model="form.belongWeek" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabled || crud.status.add !== 1"> |
| | | <el-option |
| | | v-for="item in belongWeekList2" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | :disabled="item.approveStatus == approveStatusUnsettled" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="结算状态" prop="settlementStatus"> |
| | | <el-select v-model="form.settlementStatus" filterable clearable :disabled="disabled" placeholder="请选择" style="width: 370px;"> |
| | | <el-form-item label="批准状态" prop="approveStatus"> |
| | | <el-select v-model="form.approveStatus" filterable clearable :disabled="disabled" placeholder="请选择" style="width: 370px;"> |
| | | <el-option |
| | | v-for="item in dict[settlementStatus]" |
| | | v-for="item in dict[approveStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | |
| | | <!--表格渲染--> |
| | | <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 prop="projectName" label="项目" show-overflow-tooltip> |
| | | <el-table-column prop="belongYear" label="年度" width="70" /> |
| | | <el-table-column prop="belongWeek" label="周数" width="50" /> |
| | | <el-table-column prop="projectName" label="项目" show-overflow-tooltip width="170"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectName }}</el-tag> |
| | | <el-tag>{{ scope.row.project.name }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectProgress" label="项目进度" show-overflow-tooltip> |
| | | <el-table-column prop="projectProgress" label="项目进度" show-overflow-tooltip width="70"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.projectProgress + '%' }} |
| | | {{ (scope.row.projectProgress ? scope.row.projectProgress : 0) + '%' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="settlementStatus" label="结算状态" show-overflow-tooltip> |
| | | <el-table-column prop="approveStatus" label="批准状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[settlementStatus][scope.row.settlementStatus] }}</el-tag> |
| | | <el-tag>{{ dict.label[approveStatus][scope.row.approveStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="timeTotalInit" label="总绩效工时" align="center" width="100" /> |
| | | <el-table-column prop="timeTotalCost" label="总消耗绩效工时" align="center" width="120" /> |
| | | <el-table-column prop="timeLastCost" label="本周消化绩效工时" align="center" width="120" /> |
| | | <el-table-column prop="realLastCost" label="实际消化工时" align="center" width="100" /> |
| | | <el-table-column prop="workTotalInit" label="总工作量" align="center" width="100" /> |
| | | <el-table-column prop="workTotalCost" label="总消耗工作量" align="center" width="100" /> |
| | | <el-table-column prop="workLastCost" label="本周消化工作量" align="center" width="110" /> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" width="140" /> |
| | | <el-table-column v-if="checkPer(['admin','projectProgress:edit','projectProgress:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { id: null, projectId: null, projectProgress: null, settlementStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, project: { id: null }, belongYear: null, belongWeek: null, approveStatus: null, projectProgress: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'ProjectProgress', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.SETTLEMENT_STATUS], |
| | | dicts: [constant.APPROVE_STATUS, constant.PROJECT_DISTINGUISH], |
| | | cruds() { |
| | | return CRUD({ title: '项目进度', url: 'api/projectProgress', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProjectProgress }}) |
| | | return CRUD({ title: '项目进度', url: 'api/projectProgress', idField: 'id', sort: ['belongYear,desc', 'belongWeek,desc'], crudMethod: { ...crudProjectProgress }}) |
| | | }, |
| | | data() { |
| | | var checkProjectProgress = (rule, value, callback) => { |
| | |
| | | download: ['admin', 'projectProgress:download'] |
| | | }, |
| | | rules: { |
| | | projectId: [ |
| | | { required: true, message: '项目不能为空', trigger: 'blur' } |
| | | 'project.id': [ |
| | | { required: true, message: '项目不能为空', trigger: 'onblur' } |
| | | ], |
| | | projectProgress: [ |
| | | { required: true, validator: checkProjectProgress, trigger: 'blur' } |
| | | { required: true, message: '进度不能为空', trigger: 'onblur' }, |
| | | { required: true, validator: checkProjectProgress, trigger: 'onblur' } |
| | | ], |
| | | settlementStatus: [ |
| | | { required: true, message: '结算状态不能为空', trigger: 'blur' } |
| | | approveStatus: [ |
| | | { required: true, message: '进度不能为空', trigger: 'onblur' } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'projectId', display_name: '项目' }, |
| | | { key: 'settlementStatus', display_name: '结算状态' } |
| | | { key: 'projectDistinguish', display_name: '项目区分' }, |
| | | { key: 'belongYear', display_name: '年度' }, |
| | | { key: 'belongWeek', display_name: '周数' } |
| | | ], |
| | | // 项目 |
| | | projectList: [], |
| | | // 年度 |
| | | belongYearList: [], |
| | | // 周数 |
| | | belongWeekList: [], |
| | | // 周数 |
| | | belongWeekList2: [], |
| | | // 禁用状态 |
| | | disabled: false, |
| | | // 结算状态 |
| | | settlementStatus: constant.SETTLEMENT_STATUS, |
| | | // 结算状态:已结算 |
| | | settlementStatusSettled: constant.SETTLEMENT_STATUS_SETTLED, |
| | | // 结算状态:未结算 |
| | | settlementStatusUnsettled: constant.SETTLEMENT_STATUS_UNSETTLED, |
| | | projectDistinguish: constant.PROJECT_DISTINGUISH, |
| | | // 承认状态 |
| | | approveStatus: constant.APPROVE_STATUS, |
| | | // 未承认 |
| | | approveStatusUnsettled: constant.APPROVE_STATUS_UNRECOGNIZED, |
| | | // 已承认 |
| | | approveStatusAcknowledged: constant.APPROVE_STATUS_ACKNOWLEDGED |
| | | } |
| | | }, |
| | | watch: { |
| | | 'query.belongYear'(newValue) { |
| | | // 年度变更后,周数初始化 |
| | | if (this.query.belongWeek) { |
| | | this.query.belongWeek = null |
| | | } |
| | | this.belongWeekList = [] |
| | | |
| | | // 年度清空后不需要查询数据 |
| | | if (!newValue) { |
| | | return |
| | | } |
| | | // 查询年度对应的周数 |
| | | crudProjectProgress.getBelongWeek(newValue).then(res => { |
| | | res.forEach(item => { |
| | | this.belongWeekList.push(item) |
| | | }) |
| | | }) |
| | | }, |
| | | 'form.belongYear'(newValue, oldValue) { |
| | | if (this.disabled || this.crud.status.add !== 1) { |
| | | return |
| | | } |
| | | // 年度变更后,周数初始化 |
| | | if (this.form.belongWeek) { |
| | | this.form.belongWeek = null |
| | | } |
| | | this.belongWeekList2 = [] |
| | | |
| | | // 年度清空后不需要查询数据 |
| | | if (!newValue) { |
| | | return |
| | | } |
| | | // 查询年度对应的周数 |
| | | crudProjectProgress.getBelongWeek(newValue).then(res => { |
| | | res.forEach(item => { |
| | | this.belongWeekList2.push(item) |
| | | }) |
| | | }) |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getProject() |
| | | this.getBelongYear() |
| | | return true |
| | | }, |
| | | // 新增与编辑前做的操作 |
| | | [CRUD.HOOK.afterToCU](crud, form) { |
| | | this.getDisabled() |
| | | this.belongWeekList2.splice(0, this.belongWeekList2.length) |
| | | }, |
| | | // 获取项目信息 |
| | | getProject() { |
| | |
| | | this.projectList = res |
| | | }) |
| | | }, |
| | | getBelongYear() { |
| | | crudProjectProgress.getBelongYear().then(res => { |
| | | this.belongYearList = res |
| | | }) |
| | | }, |
| | | // 是否可以修改 |
| | | getDisabled() { |
| | | if (this.form.settlementStatus === this.settlementStatusSettled) { |
| | | this.disabled = false |
| | | if (this.form.approveStatus === this.approveStatusAcknowledged) { |
| | | this.disabled = true |
| | | } else if (this.form.settlementStatus === this.settlementStatusUnsettled) { |
| | | } else if (this.form.approveStatus === this.approveStatusUnsettled) { |
| | | this.disabled = false |
| | | } |
| | | this.rules['project.id'].forEach(element => { |
| | | element.required = !(this.disabled || this.crud.status.add !== 1) |
| | | }) |
| | | this.rules.projectProgress.forEach(element => { |
| | | element.required = !(this.disabled) |
| | | }) |
| | | this.rules.approveStatus.forEach(element => { |
| | | element.required = !(this.disabled) |
| | | }) |
| | | } |
| | | } |
| | | } |