| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-input v-model="query.name" clearable placeholder="请输入名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectTypeId" clearable filterable placeholder="请选择项目类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.projectTypeId" clearable filterable placeholder="项目类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in projectTypeList" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.liableUserId" clearable filterable placeholder="请选择责任人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectDistinguish" clearable filterable placeholder="项目区分" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectDistinguish]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.liableUserId" clearable filterable placeholder="责任人" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="query.projectStatus" clearable filterable placeholder="请选择项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select v-model="query.projectStatus" clearable filterable placeholder="项目状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[projectStatus]" |
| | | :key="item.id" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <date-range-picker v-model="query.planStartDate" class="date-item" @keyup.enter.native="crud.toQuery" /> |
| | | <date-range-picker v-model="query.planEndDate" class="date-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-select v-model="query.approveStatus" clearable filterable placeholder="批准状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in dict[approveStatus]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="690px"> |
| | | <el-form ref="form" :model="form" :rules="rules" :inline="true" size="small" label-width="110px"> |
| | | <el-divider>项目基本</el-divider> |
| | | <el-form-item label="名称" prop="name"> |
| | | <el-input v-model="form.name" maxlength="100" style="width: 523px;" /> |
| | | <el-input v-model="form.name" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目类型" prop="projectTypeId"> |
| | | <el-select v-model="form.projectTypeId" clearable filterable placeholder="请选择" style="width: 200px;" @change="projectTypeChange"> |
| | |
| | | <el-form-item label="需求说明"> |
| | | <el-input v-model="form.requirement" :rows="3" type="textarea" style="width: 523px;" /> |
| | | </el-form-item> |
| | | <el-divider>金额</el-divider> |
| | | <el-form-item label="报价单金" prop="quotationPrice"> |
| | | <money-input :key="random" v-model="form.quotationPrice" :width="200" /> |
| | | </el-form-item> |
| | |
| | | <money-input :key="random" v-model="form.performancePrice" :width="200" /> |
| | | </el-form-item> |
| | | <el-form-item label="绩效币种"> |
| | | <el-input value="人民币" maxlength="100" :disabled="true" style="width: 200px;" /> |
| | | <el-select v-model="standardUnitCurrencyRenminbi" clearable filterable placeholder="请选择" style="width: 200px;" disabled> |
| | | <el-option |
| | | v-for="item in dict[standardUnitCurrency]" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="绩效目标" prop="performanceObjectives"> |
| | | <el-input :key="random" v-model="form.performanceObjectives" style="width: 200px;"> |
| | | <template slot="append">%</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="合同金额" prop="contractPrice"> |
| | | <el-form-item label="合同总金额" prop="contractPrice"> |
| | | <money-input :key="random" v-model="form.contractPrice" :width="200" /> |
| | | </el-form-item> |
| | | <el-divider>项目其他</el-divider> |
| | | <el-form-item label="计划开始日期" prop="planStartDate"> |
| | | <el-date-picker v-model="form.planStartDate" style="width: 200px;" :picker-options="pickerOptionsStart" type="date" placeholder="选择日期" /> |
| | | <el-date-picker v-model="form.planStartDate" type="date" :picker-options="pickerOptionsStart" placeholder="选择日期" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="计划结束日期" prop="planEndDate"> |
| | | <el-date-picker v-model="form.planEndDate" type="date" :picker-options="pickerOptionsEnd" style="width: 200px;" placeholder="选择日期" /> |
| | | <el-date-picker v-model="form.planEndDate" type="date" :picker-options="pickerOptionsEnd" placeholder="选择日期" style="width: 200px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="责任人"> |
| | | <el-select v-model="form.liableUserId" clearable filterable placeholder="请选择" style="width: 200px;"> |
| | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 150%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" fixed="left" /> |
| | | <el-table-column prop="name" label="名称" show-overflow-tooltip fixed="left" width="130" /> |
| | | <el-table-column prop="projectTypeName" label="项目类型" width="130"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="name" label="名称" fixed="left" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectTypeName" label="项目类型" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.projectTypeName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectDistinguish" label="项目区分" width="130"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectDistinguish" label="项目区分" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectDistinguish][scope.row.projectDistinguish] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="contractPrice" label="合同金额" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="requirement" label="需求说明" width="140" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="contractPrice" label="合同总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.contractPrice != null && scope.row.contractPrice != '' ? crud.toMoney(scope.row.contractPrice) : '' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="quotationPrice" label="报价金额" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalTaskTime" label="任务总工时" width="100" /> |
| | | <el-table-column label="报价"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="quotationPrice" label="单金" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tooltip class="item" effect="dark" :content="scope.row.quotationPrice + ' * ' + scope.row.totalTaskTime" placement="top"> |
| | | <span>{{ scope.row.quotationPrice != null && scope.row.quotationPrice != '' ? crud.toMoney(scope.row.quotationPrice * scope.row.totalTaskTime) : 0 }}</span> |
| | | </el-tooltip> |
| | | {{ crud.toMoney(scope.row.quotationPrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performancePrice" label="绩效金额" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="unitCurrency" label="币种" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tooltip class="item" effect="dark" :content="scope.row.performancePrice + ' * ' + scope.row.totalTaskTime" placement="top"> |
| | | <span>{{ scope.row.performancePrice != null && scope.row.performancePrice != '' ? crud.toMoney(scope.row.performancePrice * scope.row.totalTaskTime) : 0 }}</span> |
| | | </el-tooltip> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.unitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="totalLaborCost" label="项目成本" align="center" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" label="总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.performancePrice * scope.row.totalTaskTime < scope.row.totalLaborCost" type="danger"> |
| | | {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }} |
| | | </el-tag> |
| | | <span v-else> |
| | | {{ scope.row.totalLaborCost != null && scope.row.totalLaborCost != '' ? crud.toMoney(scope.row.totalLaborCost) : '' }} |
| | | </span> |
| | | {{ crud.toMoney(scope.row.quotationPrice * scope.row.totalTaskTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceObjectives" label="绩效目标" align="center" width="120"> |
| | | </el-table-column> |
| | | <el-table-column label="绩效"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performancePrice" label="单金" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.performancePrice * scope.row.totalTaskTime * (1 - scope.row.performanceObjectives / 100) < scope.row.totalLaborCost" type="warning"> |
| | | {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }} |
| | | </el-tag> |
| | | <span v-else> |
| | | {{ crud.toMoney(scope.row.performancePrice) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="币种" width="100"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][standardUnitCurrencyRenminbi] }}</el-tag> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.performancePrice * scope.row.totalTaskTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="performanceObjectives" label="绩效目标" width="80"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.performancePrice * scope.row.totalTaskTime * (1 - scope.row.performanceObjectives / 100) < scope.row.totalLaborCost ? 'red' : '' }"> |
| | | {{ (scope.row.performanceObjectives ? scope.row.performanceObjectives : 0) + '%' }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="liableUserName" label="责任人" width="80"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalLaborCost" label="项目总成本" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.liableUserName != null && scope.row.liableUserName != ''">{{ scope.row.liableUserName }}</el-tag> |
| | | <span :style="{ color: scope.row.performancePrice * scope.row.totalTaskTime < scope.row.totalLaborCost ? 'red' : '' }"> |
| | | {{ crud.toMoney(scope.row.totalLaborCost) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planStartDate" label="计划开始日期" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="liableUserName" label="责任人" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.liableUserName != null && scope.row.liableUserName != ''"> |
| | | {{ scope.row.liableUserName }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planStartDate" label="计划开始日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planStartDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="planEndDate" label="计划结束日期" width="120"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="planEndDate" label="计划结束日期" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.planEndDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="projectStatus" label="项目状态" width="80"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="projectStatus" label="项目状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[projectStatus][scope.row.projectStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="approveStatus" label="批准状态" width="80"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="approveStatus" label="批准状态" width="80"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[approveStatus][scope.row.approveStatus] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" width="140" /> |
| | | <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','project:edit','project:del'])" label="操作" width="180px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | |
| | | import pagination from '@crud/Pagination' |
| | | import moneyInput from '../../assembly/moneyInput/index.vue' |
| | | import constant from '../../../utils/constant' |
| | | import DateRangePicker from '@/components/DateRangePicker' |
| | | |
| | | const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, liableUserId: null, planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'Project', |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, DateRangePicker }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, moneyInput }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.STANDARD_UNIT_CURRENCY, constant.PROJECT_DISTINGUISH, constant.PROJECT_STATUS, constant.APPROVE_STATUS], |
| | | cruds() { |
| | | return CRUD({ title: '项目', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | return CRUD({ title: '项目详情', url: 'api/project', idField: 'id', sort: 'id,desc', crudMethod: { ...crudProject }}) |
| | | }, |
| | | data() { |
| | | var quotationPrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('报价单金必须是数字')) |
| | | } else { |
| | | if (value <= 0) { |
| | | callback(new Error('报价单金必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('报价单金必须小于1百亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | } else { |
| | | callback(new Error('单价金额不能为空')) |
| | | } |
| | | } |
| | | var performancePrice = (rule, value, callback) => { |
| | | if (value !== null) { |
| | | if (isNaN(Number(value))) { |
| | | callback(new Error('绩效单金必须是数字')) |
| | | } else { |
| | | if (value < 0) { |
| | | callback(new Error('绩效单金必须大于0')) |
| | | } else if (value >= 10000000000) { |
| | | callback(new Error('绩效单金必须小于1百亿')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | // 指针重指向 |
| | | const _this = this |
| | | // 金额(十亿内)验证 |
| | | var priceValidate = (rule, value, callback) => { |
| | | if (value != null && value !== '' && (isNaN(value) || Number(value) < 0 || Number(value) > 1000000000)) { |
| | | callback(new Error('请输入 十亿 以内的正整数或两位小数')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' }, |
| | | { min: 1, max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | { max: 100, message: '最大长度 100 个字符', trigger: 'blur' } |
| | | ], |
| | | projectTypeId: [ |
| | | { required: true, message: '项目类型不能为空', trigger: 'change' } |
| | |
| | | { required: true, message: '单价币种不能为空', trigger: 'change' } |
| | | ], |
| | | quotationPrice: [ |
| | | { required: true, validator: quotationPrice, trigger: 'blur' } |
| | | { required: true, message: '报价单金不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | performancePrice: [ |
| | | { required: true, validator: performancePrice, trigger: 'blur' } |
| | | { required: true, message: '绩效单金不能为空', trigger: 'blur' }, |
| | | { validator: priceValidate, trigger: 'blur' } |
| | | ], |
| | | performanceObjectives: [ |
| | | { required: true, validator: proportionValidate, trigger: 'blur' } |
| | | { required: true, message: '绩效目标不能为空', trigger: 'blur' }, |
| | | { validator: proportionValidate, trigger: 'blur' } |
| | | ], |
| | | projectStatus: [ |
| | | { required: true, message: '项目状态不能为空', trigger: 'change' } |
| | |
| | | { key: 'name', display_name: '名称' }, |
| | | { key: 'projectTypeId', display_name: '项目类型' }, |
| | | { key: 'projectDistinguish', display_name: '项目区分' }, |
| | | { key: 'unitCurrency', display_name: '单价币种' }, |
| | | { key: 'liableUserId', display_name: '责任人' }, |
| | | { key: 'planStartDate', display_name: '计划开始日期' }, |
| | | { key: 'planEndDate', display_name: '计划结束日期' }, |
| | | { key: 'projectStatus', display_name: '项目状态' }, |
| | | { key: 'approveStatus', display_name: '批准状态' } |
| | | ], |
| | | // 标准单价币种 |
| | | standardUnitCurrency: constant.STANDARD_UNIT_CURRENCY, |
| | | // 标准单价币种:人民币 |
| | | standardUnitCurrencyRenminbi: constant.STANDARD_UNIT_CURRENCY_RENMINBI, |
| | | // 项目状态 |
| | | projectStatus: constant.PROJECT_STATUS, |
| | | // 批准状态 |
| | |
| | | // 选中结束时间之后不可选 |
| | | pickerOptionsStart: { |
| | | disabledDate: (time) => { |
| | | if (this.form.planEndDate) { |
| | | return time.getTime() > Date.now() || time.getTime() > this.form.planEndDate |
| | | } |
| | | return _this.form.planEndDate != null && _this.form.planEndDate !== '' ? time.getTime() > new Date(_this.form.planEndDate).getTime() : false |
| | | } |
| | | }, |
| | | // 选中开始时间之后不可选 |
| | | pickerOptionsEnd: { |
| | | disabledDate: (time) => { |
| | | return time.getTime() < this.form.planStartDate |
| | | return _this.form.planStartDate != null && _this.form.planStartDate !== '' ? time.getTime() < new Date(_this.form.planStartDate).getTime() : false |
| | | } |
| | | } |
| | | } |